Skip to contentSkip to conversation

OMAP: GPIO: Implement GPIO in HWMOD way

PATCH Superseded Varadarajan, Charulatha 5 participants 36 messages Jun 15, 2010 – Jun 24, 2010

Subsystems (6)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v3 cover OMAP: GPIO: Implement GPIO in HWMOD way

From: Charulatha V <[email protected]>

This patch series makes OMAP2PLUS specific GPIO implemented in HWMOD FW way. This is done by implementing GPIO module in platform device model.

This patch series is generated on "origin/pm-wip/hwmods-omap4".

This patch series is created on top of the following two patches:
- OMAP: GPIO: fix auto-disable of debounce clock

    https://patchwork.kernel.org/patch/103831/
- omap: Stalker board: switch over to gpio_set_debounce
    https://patchwork.kernel.org/patch/103017/

This patch series is tested on OMAP4430 SDP board and OMAP3430 SDP board. It would be of great help if someone could test the same on OMAP1 and OMAP2 boards.

Version History:
---------------

Comments Fixed in v3:
- .module_offs populated in hwmod structures
- If not defined CONFIG_PM_RUNTIME is not handled in GPIO driver
- No changes to mach-omap2/clockxxxx-data.c to handle clocks by dev ptr as it is taken care using clock get by name in hwmod & omap_device layer
- Using "ick" instead of "arm_gpio_ck" for OMAP15xx clock
- SoC base addresses moved to plat-omap/omapXXXX.h that should be used only by the omap_hwmod_xxxx_data.c file
- OMAP2/3 hwmod structures naming convention changed as it is followed in OMAP4
- omap24xx_gpio_init() uses cpu_is_omap24xx() instead of separate checks for 2420 & 2430 in OMAP2 specific init call (mach-omap layer)
- Reason for using postcore_initcall is added to patch description for the patch "OMAP: GPIO: Introduce support for OMAP2PLUS chip GPIO init"
- Comments added for usage of dbck_flag and other elements
in dev_attr structure
- Uses dev_dbg() and dev_err() instead of pr_dbg() and pr_err()
- Corrects the gpio clock details in OMAP4 hwmod database

v2 series:
Some important links to patch v2 series and comments:
http://www.mail-archive.com/[email protected]/msg30262.html
http://www.mail-archive.com/[email protected]/msg28787.html
http://www.mail-archive.com/[email protected]/msg30263.html
http://www.mail-archive.com/[email protected]/msg30295.html
http://www.mail-archive.com/[email protected]/msg30259.html
http://www.mail-archive.com/[email protected]/msg28933.html
Comments Fixed in V2:
- GPIO dev attr was added for SoC specific chip info (eg., gpio bank count)
- Removed omap_gpio_init() usage from board files
- platform_get_resource() used instead of pdata->base for OMAP2+ base addresses
- postcore_initcall used for gpio init instead of making
GPIO as an early platform device. SoC specific gpio_init needs to be done before machine_init functions access gpio APIs. Hence making SoC specific gpio_init as postcore_initcall.
- getting gpio dbck is moved to omap_set_gpio_debounce() instead of doing it in probe

v1 series:
Some important links to patch v1 series and comments:
http://www.mail-archive.com/[email protected]/msg26934.html
http://www.mail-archive.com/[email protected]/msg27860.html
http://www.mail-archive.com/[email protected]/msg28183.html
Highlights in v1:
- Introduces SoC specific functions at mach-omap layer
- Implements GPIO as a platform device
- Make gpio an early device and make it implemented in HWMOD FW adapted way for OMAP2PLUS

Charulatha V (13):
OMAP: GPIO: Modify init() in preparation for platform device
implementation
OMAP: GPIO: Populate GPIO base address in omapxxxx.h
OMAP: GPIO: Include platform_data structure for GPIO
OMAP: GPIO: Introduce support for OMAP15xx chip GPIO init
OMAP: GPIO: Introduce support for OMAP16xx chip GPIO init
OMAP: GPIO: Introduce support for OMAP7xx chip GPIO init
OMAP: GPIO: add GPIO hwmods structures for OMAP3
OMAP: GPIO: add GPIO hwmods structures for OMAP242X
OMAP: GPIO: add GPIO hwmods structures for OMAP243X
OMAP: GPIO: Add gpio dev_attr and correct clks in OMAP4 hwmod struct
OMAP: GPIO: Introduce support for OMAP2PLUS chip GPIO init
OMAP: GPIO: Implement GPIO as a platform device
OMAP: GPIO: Remove omap_gpio_init()

 arch/arm/mach-omap1/Makefile               |    6 +
 arch/arm/mach-omap1/board-ams-delta.c      |    1 -
 arch/arm/mach-omap1/board-fsample.c        |    1 -
 arch/arm/mach-omap1/board-h2.c             |    1 -
 arch/arm/mach-omap1/board-h3.c             |    1 -
 arch/arm/mach-omap1/board-htcherald.c      |    1 -
 arch/arm/mach-omap1/board-innovator.c      |    1 -
 arch/arm/mach-omap1/board-nokia770.c       |    1 -
 arch/arm/mach-omap1/board-osk.c            |    1 -
 arch/arm/mach-omap1/board-palmte.c         |    1 -
 arch/arm/mach-omap1/board-palmz71.c        |    1 -
 arch/arm/mach-omap1/board-perseus2.c       |    1 -
 arch/arm/mach-omap1/board-sx1.c            |    1 -
 arch/arm/mach-omap1/board-voiceblue.c      |    1 -
 arch/arm/mach-omap1/clock_data.c           |    4 +-
 arch/arm/mach-omap1/gpio15xx.c             |  102 +++++
 arch/arm/mach-omap1/gpio16xx.c             |  208 ++++++++++
 arch/arm/mach-omap1/gpio7xx.c              |  274 ++++++++++++
 arch/arm/mach-omap2/Makefile               |    2 +-
 arch/arm/mach-omap2/board-2430sdp.c        |    1 -
 arch/arm/mach-omap2/board-3430sdp.c        |    1 -
 arch/arm/mach-omap2/board-3630sdp.c        |    1 -
 arch/arm/mach-omap2/board-4430sdp.c        |    1 -
 arch/arm/mach-omap2/board-am3517evm.c      |    1 -
 arch/arm/mach-omap2/board-apollon.c        |    1 -
 arch/arm/mach-omap2/board-cm-t35.c         |    1 -
 arch/arm/mach-omap2/board-devkit8000.c     |    1 -
 arch/arm/mach-omap2/board-h4.c             |    1 -
 arch/arm/mach-omap2/board-igep0020.c       |    1 -
 arch/arm/mach-omap2/board-ldp.c            |    1 -
 arch/arm/mach-omap2/board-n8x0.c           |    1 -
 arch/arm/mach-omap2/board-omap3beagle.c    |    1 -
 arch/arm/mach-omap2/board-omap3evm.c       |    1 -
 arch/arm/mach-omap2/board-omap3pandora.c   |    1 -
 arch/arm/mach-omap2/board-omap3stalker.c   |    1 -
 arch/arm/mach-omap2/board-omap3touchbook.c |    1 -
 arch/arm/mach-omap2/board-overo.c          |    1 -
 arch/arm/mach-omap2/board-rx51.c           |    1 -
 arch/arm/mach-omap2/board-zoom2.c          |    1 -
 arch/arm/mach-omap2/board-zoom3.c          |    1 -
 arch/arm/mach-omap2/gpio.c                 |  104 +++++
 arch/arm/mach-omap2/omap_hwmod_2420_data.c |  228 ++++++++++
 arch/arm/mach-omap2/omap_hwmod_2430_data.c |  279 +++++++++++++
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |  366 ++++++++++++++++
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   37 ++-
 arch/arm/plat-omap/gpio.c                  |  620 ++++++++++------------------
 arch/arm/plat-omap/include/plat/gpio.h     |   22 +-
 arch/arm/plat-omap/include/plat/omap24xx.h |   12 +
 arch/arm/plat-omap/include/plat/omap34xx.h |    8 +
 arch/arm/plat-omap/include/plat/omap44xx.h |    8 +
 50 files changed, 1852 insertions(+), 462 deletions(-)
 create mode 100644 arch/arm/mach-omap1/gpio15xx.c
 create mode 100644 arch/arm/mach-omap1/gpio16xx.c
 create mode 100644 arch/arm/mach-omap1/gpio7xx.c
 create mode 100644 arch/arm/mach-omap2/gpio.c
#1 lore raw

PATCH v3 1/13 OMAP: GPIO: Modify init() in preparation for platform device implementation

From: Charulatha V <[email protected]>

This is in prepartion for implementing GPIO as a platform device. gpio bank's base addresses are moved from gpio.c to plat/gpio.h.

This patch also modifies omap_gpio_init() to make use of omap_gpio_chip_init() and omap_gpio_mod_init(). omap_gpio_mod_init() does the module init by clearing the status register and initializing the GPIO control register. omap_gpio_chip_init() initializes the chip request, free, get, set and other function pointers and sets the gpio irq handler.

---
 arch/arm/plat-omap/gpio.c |  235 +++++++++++++++++++++++----------------------
 1 files changed, 120 insertions(+), 115 deletions(-)
arch/arm/plat-omap/gpio.c +120 -115
index 9b7e354..3ea616a 100644
@@ -190,14 +190,12 @@ struct gpio_bank {
 	u32 suspend_wakeup;
 	u32 saved_wakeup;
 #endif
-#ifdef CONFIG_ARCH_OMAP2PLUS
 	u32 non_wakeup_gpios;
 	u32 enabled_non_wakeup_gpios;
 
 	u32 saved_datain;
 	u32 saved_fallingdetect;
 	u32 saved_risingdetect;
-#endif
 	u32 level_mask;
 	u32 toggle_mask;
 	spinlock_t lock;
@@ -1711,6 +1709,124 @@ static void __init omap_gpio_show_rev(void)
  */
 static struct lock_class_key gpio_lock_class;
 
+static void omap_gpio_mod_init(struct gpio_bank *bank, int id)
+{
+	if (cpu_class_is_omap2()) {
+		if (cpu_is_omap44xx()) {
+			__raw_writel(0xffffffff, bank->base +
+					OMAP4_GPIO_IRQSTATUSCLR0);
+			__raw_writel(0x00000000, bank->base +
+					 OMAP4_GPIO_DEBOUNCENABLE);
+			/* Initialize interface clk ungated, module enabled */
+			__raw_writel(0, bank->base + OMAP4_GPIO_CTRL);
+		} else if (cpu_is_omap34xx()) {
+			__raw_writel(0x00000000, bank->base +
+					OMAP24XX_GPIO_IRQENABLE1);
+			__raw_writel(0xffffffff, bank->base +
+					OMAP24XX_GPIO_IRQSTATUS1);
+			__raw_writel(0x00000000, bank->base +
+					OMAP24XX_GPIO_DEBOUNCE_EN);
+
+			/* Initialize interface clk ungated, module enabled */
+			__raw_writel(0, bank->base + OMAP24XX_GPIO_CTRL);
+			/* Enable autoidle for the OCP interface */
+			omap_writel(1 << 0, 0x48306814);
+		} else if (cpu_is_omap24xx()) {
+			static const u32 non_wakeup_gpios[] = {
+				0xe203ffc0, 0x08700040
+			};
+			if (id < ARRAY_SIZE(non_wakeup_gpios))
+				bank->non_wakeup_gpios = non_wakeup_gpios[id];
+
+			/* Enable autoidle for the OCP interface */
+			omap_writel(1 << 0, 0x48019010);
+		}
+	} else if (cpu_class_is_omap1()) {
+		if (bank_is_mpuio(bank))
+			__raw_writew(0xffff, bank->base
+						+ OMAP_MPUIO_GPIO_MASKIT);
+		if (cpu_is_omap15xx() && bank->method == METHOD_GPIO_1510) {
+			__raw_writew(0xffff, bank->base
+						+ OMAP1510_GPIO_INT_MASK);
+			__raw_writew(0x0000, bank->base
+						+ OMAP1510_GPIO_INT_STATUS);
+		}
+		if (cpu_is_omap16xx() && bank->method == METHOD_GPIO_1610) {
+			__raw_writew(0x0000, bank->base
+						+ OMAP1610_GPIO_IRQENABLE1);
+			__raw_writew(0xffff, bank->base
+						+ OMAP1610_GPIO_IRQSTATUS1);
+			__raw_writew(0x0014, bank->base
+						+ OMAP1610_GPIO_SYSCONFIG);
+
+			/* Enable system clock for GPIO module.
+			 * The CAM_CLK_CTRL *is* really the right place. */
+			omap_writel(omap_readl(ULPD_CAM_CLK_CTRL) | 0x04,
+						ULPD_CAM_CLK_CTRL);
+		}
+		if (cpu_is_omap7xx() && bank->method == METHOD_GPIO_7XX) {
+			__raw_writel(0xffffffff, bank->base
+						+ OMAP7XX_GPIO_INT_MASK);
+			__raw_writel(0x00000000, bank->base
+						+ OMAP7XX_GPIO_INT_STATUS);
+		}
+	}
+}
+
+static void __init omap_gpio_chip_init(struct gpio_bank *bank)
+{
+	int j, gpio_bank_bits = 16;
+	static int gpio;
+
+	if (cpu_is_omap7xx() && bank->method == METHOD_GPIO_7XX)
+		gpio_bank_bits = 32; /* 7xx has 32-bit GPIOs */
+
+	if ((bank->method == METHOD_GPIO_24XX) ||
+			(bank->method == METHOD_GPIO_44XX))
+		gpio_bank_bits = 32;
+
+	bank->mod_usage = 0;
+	/* REVISIT eventually switch from OMAP-specific gpio structs
+	 * over to the generic ones
+	 */
+	bank->chip.request = omap_gpio_request;
+	bank->chip.free = omap_gpio_free;
+	bank->chip.direction_input = gpio_input;
+	bank->chip.get = gpio_get;
+	bank->chip.direction_output = gpio_output;
+	bank->chip.set_debounce = gpio_debounce;
+	bank->chip.set = gpio_set;
+	bank->chip.to_irq = gpio_2irq;
+	if (bank_is_mpuio(bank)) {
+		bank->chip.label = "mpuio";
+#ifdef CONFIG_ARCH_OMAP16XX
+		bank->chip.dev = &omap_mpuio_device.dev;
+#endif
+		bank->chip.base = OMAP_MPUIO(0);
+	} else {
+		bank->chip.label = "gpio";
+		bank->chip.base = gpio;
+		gpio += gpio_bank_bits;
+	}
+	bank->chip.ngpio = gpio_bank_bits;
+
+	gpiochip_add(&bank->chip);
+
+	for (j = bank->virtual_irq_start;
+		     j < bank->virtual_irq_start + gpio_bank_bits; j++) {
+		lockdep_set_class(&irq_desc[j].lock, &gpio_lock_class);
+		set_irq_chip_data(j, bank);
+		if (bank_is_mpuio(bank))
+			set_irq_chip(j, &mpuio_irq_chip);
+		else
+			set_irq_chip(j, &gpio_irq_chip);
+		set_irq_handler(j, handle_simple_irq);
+		set_irq_flags(j, IRQF_VALID);
+	}
+	set_irq_chained_handler(bank->irq, gpio_irq_handler);
+	set_irq_data(bank->irq, bank);
+}
+
 static int __init _omap_gpio_init(void)
 {
 	int i;
@@ -1821,7 +1937,6 @@ static int __init _omap_gpio_init(void)
 	}
 #endif
 	for (i = 0; i < gpio_bank_count; i++) {
-		int j, gpio_count = 16;
 
 		bank = &gpio_bank[i];
 		spin_lock_init(&bank->lock);
@@ -1833,107 +1948,8 @@ static int __init _omap_gpio_init(void)
 			continue;
 		}
 
-		if (bank_is_mpuio(bank))
-			__raw_writew(0xffff, bank->base + OMAP_MPUIO_GPIO_MASKIT);
-		if (cpu_is_omap15xx() && bank->method == METHOD_GPIO_1510) {
-			__raw_writew(0xffff, bank->base + OMAP1510_GPIO_INT_MASK);
-			__raw_writew(0x0000, bank->base + OMAP1510_GPIO_INT_STATUS);
-		}
-		if (cpu_is_omap16xx() && bank->method == METHOD_GPIO_1610) {
-			__raw_writew(0x0000, bank->base + OMAP1610_GPIO_IRQENABLE1);
-			__raw_writew(0xffff, bank->base + OMAP1610_GPIO_IRQSTATUS1);
-			__raw_writew(0x0014, bank->base + OMAP1610_GPIO_SYSCONFIG);
-		}
-		if (cpu_is_omap7xx() && bank->method == METHOD_GPIO_7XX) {
-			__raw_writel(0xffffffff, bank->base + OMAP7XX_GPIO_INT_MASK);
-			__raw_writel(0x00000000, bank->base + OMAP7XX_GPIO_INT_STATUS);
-
-			gpio_count = 32; /* 7xx has 32-bit GPIOs */
-		}
-
-#ifdef CONFIG_ARCH_OMAP2PLUS
-		if ((bank->method == METHOD_GPIO_24XX) ||
-				(bank->method == METHOD_GPIO_44XX)) {
-			static const u32 non_wakeup_gpios[] = {
-				0xe203ffc0, 0x08700040
-			};
-
-			if (cpu_is_omap44xx()) {
-				__raw_writel(0xffffffff, bank->base +
-						OMAP4_GPIO_IRQSTATUSCLR0);
-				__raw_writew(0x0015, bank->base +
-						OMAP4_GPIO_SYSCONFIG);
-				__raw_writel(0x00000000, bank->base +
-						 OMAP4_GPIO_DEBOUNCENABLE);
-				/*
-				 * Initialize interface clock ungated,
-				 * module enabled
-				 */
-				__raw_writel(0, bank->base + OMAP4_GPIO_CTRL);
-			} else {
-				__raw_writel(0x00000000, bank->base +
-						OMAP24XX_GPIO_IRQENABLE1);
-				__raw_writel(0xffffffff, bank->base +
-						OMAP24XX_GPIO_IRQSTATUS1);
-				__raw_writew(0x0015, bank->base +
-						OMAP24XX_GPIO_SYSCONFIG);
-				__raw_writel(0x00000000, bank->base +
-						OMAP24XX_GPIO_DEBOUNCE_EN);
-
-				/*
-				 * Initialize interface clock ungated,
-				 * module enabled
-				 */
-				__raw_writel(0, bank->base +
-						OMAP24XX_GPIO_CTRL);
-			}
-			if (cpu_is_omap24xx() &&
-			    i < ARRAY_SIZE(non_wakeup_gpios))
-				bank->non_wakeup_gpios = non_wakeup_gpios[i];
-			gpio_count = 32;
-		}
-#endif
-
-		bank->mod_usage = 0;
-		/* REVISIT eventually switch from OMAP-specific gpio structs
-		 * over to the generic ones
-		 */
-		bank->chip.request = omap_gpio_request;
-		bank->chip.free = omap_gpio_free;
-		bank->chip.direction_input = gpio_input;
-		bank->chip.get = gpio_get;
-		bank->chip.direction_output = gpio_output;
-		bank->chip.set_debounce = gpio_debounce;
-		bank->chip.set = gpio_set;
-		bank->chip.to_irq = gpio_2irq;
-		if (bank_is_mpuio(bank)) {
-			bank->chip.label = "mpuio";
-#ifdef CONFIG_ARCH_OMAP16XX
-			bank->chip.dev = &omap_mpuio_device.dev;
-#endif
-			bank->chip.base = OMAP_MPUIO(0);
-		} else {
-			bank->chip.label = "gpio";
-			bank->chip.base = gpio;
-			gpio += gpio_count;
-		}
-		bank->chip.ngpio = gpio_count;
-
-		gpiochip_add(&bank->chip);
-
-		for (j = bank->virtual_irq_start;
-		     j < bank->virtual_irq_start + gpio_count; j++) {
-			lockdep_set_class(&irq_desc[j].lock, &gpio_lock_class);
-			set_irq_chip_data(j, bank);
-			if (bank_is_mpuio(bank))
-				set_irq_chip(j, &mpuio_irq_chip);
-			else
-				set_irq_chip(j, &gpio_irq_chip);
-			set_irq_handler(j, handle_simple_irq);
-			set_irq_flags(j, IRQF_VALID);
-		}
-		set_irq_chained_handler(bank->irq, gpio_irq_handler);
-		set_irq_data(bank->irq, bank);
+		omap_gpio_mod_init(bank, i);
+		omap_gpio_chip_init(bank);
 
 		if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
 			sprintf(clk_name, "gpio%d_dbck", i + 1);
@@ -1943,17 +1959,6 @@ static int __init _omap_gpio_init(void)
 		}
 	}
 
-	/* Enable system clock for GPIO module.
-	 * The CAM_CLK_CTRL *is* really the right place. */
-	if (cpu_is_omap16xx())
-		omap_writel(omap_readl(ULPD_CAM_CLK_CTRL) | 0x04, ULPD_CAM_CLK_CTRL);
-
-	/* Enable autoidle for the OCP interface */
-	if (cpu_is_omap24xx())
-		omap_writel(1 << 0, 0x48019010);
-	if (cpu_is_omap34xx())
-		omap_writel(1 << 0, 0x48306814);
-
 	omap_gpio_show_rev();
 
 	return 0;
Signature · 1 line
1.6.3.3
#2 lore raw

PATCH v3 2/13 OMAP: GPIO: Populate GPIO base address in omapxxxx.h

From: Charulatha V <[email protected]>

This patch populates omap24xx.h, omap34xx.h and omap44xx.h files with SoC specific GPIO base addresses. This would be later used while creating GPIO hwmod structures.

---
 arch/arm/plat-omap/include/plat/omap24xx.h |   12 ++++++++++++
 arch/arm/plat-omap/include/plat/omap34xx.h |    8 ++++++++
 arch/arm/plat-omap/include/plat/omap44xx.h |    8 ++++++++
 3 files changed, 28 insertions(+), 0 deletions(-)
arch/arm/plat-omap/include/plat/omap24xx.h +12 -0
index 7055672..4406bbe 100644
@@ -85,5 +85,17 @@
 #define OMAP24XX_SEC_AES_BASE	(OMAP24XX_SEC_BASE + 0x6000)
 #define OMAP24XX_SEC_PKA_BASE	(OMAP24XX_SEC_BASE + 0x8000)
 
+/* GPIO controller*/
+#define OMAP242X_GPIO1_BASE	(L4_24XX_BASE + 0x18000)
+#define OMAP242X_GPIO2_BASE	(L4_24XX_BASE + 0x1a000)
+#define OMAP242X_GPIO3_BASE	(L4_24XX_BASE + 0x1c000)
+#define OMAP242X_GPIO4_BASE	(L4_24XX_BASE + 0x1e000)
+
+#define OMAP243X_GPIO1_BASE	(L4_WK_243X_BASE + 0xC000)
+#define OMAP243X_GPIO2_BASE	(L4_WK_243X_BASE + 0xE000)
+#define OMAP243X_GPIO3_BASE	(L4_WK_243X_BASE + 0x10000)
+#define OMAP243X_GPIO4_BASE	(L4_WK_243X_BASE + 0x12000)
+#define OMAP243X_GPIO5_BASE	(L4_24XX_BASE	 + 0xB6000)
+
 #endif /* __ASM_ARCH_OMAP2_H */
 
arch/arm/plat-omap/include/plat/omap34xx.h +8 -0
index 98fc8b4..53279b8 100644
@@ -87,5 +87,13 @@
 #define OMAP34XX_SEC_SHA1MD5_BASE	(OMAP34XX_SEC_BASE + 0x23000)
 #define OMAP34XX_SEC_AES_BASE	(OMAP34XX_SEC_BASE + 0x25000)
 
+/* GPIO controller*/
+#define OMAP34XX_GPIO1_BASE	(L4_WK_34XX_BASE  + 0x10000)
+#define OMAP34XX_GPIO2_BASE	(L4_PER_34XX_BASE + 0x50000)
+#define OMAP34XX_GPIO3_BASE	(L4_PER_34XX_BASE + 0x52000)
+#define OMAP34XX_GPIO4_BASE	(L4_PER_34XX_BASE + 0x54000)
+#define OMAP34XX_GPIO5_BASE	(L4_PER_34XX_BASE + 0x56000)
+#define OMAP34XX_GPIO6_BASE	(L4_PER_34XX_BASE + 0x58000)
+
 #endif /* __ASM_ARCH_OMAP3_H */
 
arch/arm/plat-omap/include/plat/omap44xx.h +8 -0
index 8b3f12f..bec7d69 100644
@@ -52,5 +52,13 @@
 #define OMAP4_MMU1_BASE			0x55082000
 #define OMAP4_MMU2_BASE			0x4A066000
 
+/* GPIO controller*/
+#define OMAP44XX_GPIO1_BASE             (L4_WK_44XX_BASE  + 0x10000)
+#define OMAP44XX_GPIO2_BASE             (L4_PER_44XX_BASE + 0x55000)
+#define OMAP44XX_GPIO3_BASE             (L4_PER_44XX_BASE + 0x57000)
+#define OMAP44XX_GPIO4_BASE             (L4_PER_44XX_BASE + 0x59000)
+#define OMAP44XX_GPIO5_BASE             (L4_PER_44XX_BASE + 0x5B000)
+#define OMAP44XX_GPIO6_BASE             (L4_PER_44XX_BASE + 0x5D000)
+
 #endif /* __ASM_ARCH_OMAP44XX_H */
 
Signature · 1 line
1.6.3.3
#3 lore raw

PATCH v3 3/13 OMAP: GPIO: Include platform_data structure for GPIO

From: Charulatha V <[email protected]>

This patch introduces platform_data structure for GPIO so that GPIO module can be implemented in platform device model.

---
 arch/arm/plat-omap/include/plat/gpio.h |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
arch/arm/plat-omap/include/plat/gpio.h +21 -0
index de1c604..fa5c05f 100644
@@ -28,6 +28,7 @@
 
 #include <linux/io.h>
 #include <mach/irqs.h>
+#include <linux/platform_device.h>
 
 #define OMAP1_MPUIO_BASE			0xfffb5000
 
@@ -71,6 +72,26 @@
 				 IH_MPUIO_BASE + ((nr) & 0x0f) : \
 				 IH_GPIO_BASE + (nr))
 
+#define METHOD_MPUIO		0
+#define METHOD_GPIO_1510	1
+#define METHOD_GPIO_1610	2
+#define METHOD_GPIO_7XX		3
+#define METHOD_GPIO_24XX	5
+#define METHOD_GPIO_44XX	6
+
+struct omap_gpio_dev_attr {
+	int gpio_bank_count;	/* No of GPIO banks - SoC specific */
+	int gpio_bank_bits;	/* GPIO bank width */
+	bool dbck_flag;		/* dbck validity - True only for OMAP3&4 */
+	bool omap1_ick_flag;	/* OMAP1 ick - True only for OMAP15xx */
+};
+
+struct omap_gpio_platform_data {
+	u16 virtual_irq_start;
+	int method;
+	struct omap_gpio_dev_attr *gpio_attr;
+};
+
 extern int omap_gpio_init(void);	/* Call from board init only */
 extern void omap2_gpio_prepare_for_idle(int power_state);
 extern void omap2_gpio_resume_after_idle(void);
Signature · 1 line
1.6.3.3
#4 lore raw

PATCH v3 4/13 OMAP: GPIO: Introduce support for OMAP15xx chip GPIO init

From: Charulatha V <[email protected]>

This patch adds support for handling OMAP15xx specific gpio_init by providing platform device data and doing device registration.

---
 arch/arm/mach-omap1/gpio15xx.c |  102 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 102 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap1/gpio15xx.c
arch/arm/mach-omap1/gpio15xx.c new file +102 -0
new file mode 100644
index 0000000..e4f1738
@@ -0,0 +1,102 @@
+/*
+ * gpio15xx.c - OMAP15XX-specific gpio code
+ *
+ * Copyright (C) 2010 Texas Instruments, Inc.
+ *
+ * Author:
+ *	Charulatha V <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/gpio.h>
+
+#define OMAP1_MPUIO_VBASE		OMAP1_MPUIO_BASE
+#define OMAP1510_GPIO_BASE		0xfffce000
+
+static struct omap_gpio_dev_attr omap15xx_gpio_attr = {
+		.gpio_bank_count = 2,
+		.gpio_bank_bits	= 16,
+		.omap1_ick_flag	= true,
+};
+
+/*
+ * OMAP15XX GPIO1 interface data
+ */
+static struct __initdata resource omap15xx_mpu_gpio_resources[] = {
+	{
+		.start	= OMAP1_MPUIO_VBASE,
+		.end	= OMAP1_MPUIO_VBASE + SZ_2K - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	{
+		.start	= INT_MPUIO,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct __initdata omap_gpio_platform_data omap15xx_mpu_gpio_config = {
+	.virtual_irq_start	= IH_MPUIO_BASE,
+	.method			= METHOD_MPUIO,
+	.gpio_attr		= &omap15xx_gpio_attr,
+};
+
+static struct __initdata platform_device omap15xx_mpu_gpio = {
+	.name           = "omap-gpio",
+	.id             = 0,
+	.dev            = {
+		.platform_data = &omap15xx_mpu_gpio_config,
+	},
+	.num_resources = ARRAY_SIZE(omap15xx_mpu_gpio_resources),
+	.resource = omap15xx_mpu_gpio_resources,
+};
+
+/*
+ * OMAP15XX GPIO2 interface data
+ */
+static struct __initdata resource omap15xx_gpio_resources[] = {
+	{
+		.start	= OMAP1510_GPIO_BASE,
+		.end	= OMAP1510_GPIO_BASE + SZ_2K - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	{
+		.start	= INT_GPIO_BANK1,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct __initdata omap_gpio_platform_data omap15xx_gpio_config = {
+	.virtual_irq_start	= IH_GPIO_BASE,
+	.method			= METHOD_GPIO_1510,
+	.gpio_attr		= &omap15xx_gpio_attr,
+};
+
+static struct __initdata platform_device omap15xx_gpio = {
+	.name           = "omap-gpio",
+	.id             = 1,
+	.dev            = {
+		.platform_data = &omap15xx_gpio_config,
+	},
+	.num_resources = ARRAY_SIZE(omap15xx_gpio_resources),
+	.resource = omap15xx_gpio_resources,
+};
+
+/*
+ * omap15xx_gpio_init needs to be done before
+ * machine_init functions access gpio APIs.
+ * Hence omap15xx_gpio_init is a postcore_initcall.
+ */
+static int __init omap15xx_gpio_init(void)
+{
+	if (!cpu_is_omap15xx())
+		return -EINVAL;
+
+	platform_device_register(&omap15xx_mpu_gpio);
+	platform_device_register(&omap15xx_gpio);
+
+	return 0;
+}
+postcore_initcall(omap15xx_gpio_init);
Signature · 1 line
1.6.3.3
#5 lore raw

PATCH v3 5/13 OMAP: GPIO: Introduce support for OMAP16xx chip GPIO init

From: Charulatha V <[email protected]>

This patch adds support for handling OMAP16xx specific gpio_init by providing platform device data and doing device registration.

---
 arch/arm/mach-omap1/gpio16xx.c |  208 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 208 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap1/gpio16xx.c
arch/arm/mach-omap1/gpio16xx.c new file +208 -0
new file mode 100644
index 0000000..6651d15
@@ -0,0 +1,208 @@
+/*
+ * gpio16xx.c - OMAP16XX-specific gpio code
+ *
+ * Copyright (C) 2010 Texas Instruments, Inc.
+ *
+ * Author:
+ *	Charulatha V <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/gpio.h>
+
+#define OMAP1610_GPIO1_BASE		0xfffbe400
+#define OMAP1610_GPIO2_BASE		0xfffbec00
+#define OMAP1610_GPIO3_BASE		0xfffbb400
+#define OMAP1610_GPIO4_BASE		0xfffbbc00
+#define OMAP1_MPUIO_VBASE		OMAP1_MPUIO_BASE
+
+static struct omap_gpio_dev_attr omap16xx_gpio_attr = {
+	.gpio_bank_count = 5,
+	.gpio_bank_bits	= 16,
+	.omap1_ick_flag	= false,
+};
+
+/*
+ * OMAP16XX MPU GPIO interface data
+ */
+static struct __initdata resource omap16xx_mpu_gpio_resources[] = {
+	{
+		.start	= OMAP1_MPUIO_VBASE,
+		.end	= OMAP1_MPUIO_VBASE + SZ_2K - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	{
+		.start	= INT_MPUIO,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct __initdata omap_gpio_platform_data omap16xx_mpu_gpio_config = {
+	.virtual_irq_start	= IH_MPUIO_BASE,
+	.method			= METHOD_MPUIO,
+	.gpio_attr		= &omap16xx_gpio_attr,
+};
+
+static struct __initdata platform_device omap16xx_mpu_gpio = {
+	.name           = "omap-gpio",
+	.id             = 0,
+	.dev            = {
+		.platform_data = &omap16xx_mpu_gpio_config,
+	},
+	.num_resources = ARRAY_SIZE(omap16xx_mpu_gpio_resources),
+	.resource = omap16xx_mpu_gpio_resources,
+};
+
+/*
+ * OMAP16XX GPIO1 interface data
+ */
+static struct __initdata resource omap16xx_gpio1_resources[] = {
+	{
+		.start	= OMAP1610_GPIO1_BASE,
+		.end	= OMAP1610_GPIO1_BASE + SZ_2K - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	{
+		.start	= INT_GPIO_BANK1,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct __initdata omap_gpio_platform_data omap16xx_gpio1_config = {
+	.virtual_irq_start	= IH_GPIO_BASE,
+	.method			= METHOD_GPIO_1610,
+	.gpio_attr		= &omap16xx_gpio_attr,
+};
+
+static struct __initdata platform_device omap16xx_gpio1 = {
+	.name           = "omap-gpio",
+	.id             = 1,
+	.dev            = {
+		.platform_data = &omap16xx_gpio1_config,
+	},
+	.num_resources = ARRAY_SIZE(omap16xx_gpio1_resources),
+	.resource = omap16xx_gpio1_resources,
+};
+
+/*
+ * OMAP16XX GPIO2 interface data
+ */
+static struct __initdata resource omap16xx_gpio2_resources[] = {
+	{
+		.start	= OMAP1610_GPIO2_BASE,
+		.end	= OMAP1610_GPIO2_BASE + SZ_2K - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	{
+		.start	= INT_1610_GPIO_BANK2,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct __initdata omap_gpio_platform_data omap16xx_gpio2_config = {
+	.virtual_irq_start	= IH_GPIO_BASE + 16,
+	.method			= METHOD_GPIO_1610,
+	.gpio_attr		= &omap16xx_gpio_attr,
+};
+
+static struct __initdata platform_device omap16xx_gpio2 = {
+	.name           = "omap-gpio",
+	.id             = 2,
+	.dev            = {
+		.platform_data = &omap16xx_gpio2_config,
+	},
+	.num_resources = ARRAY_SIZE(omap16xx_gpio2_resources),
+	.resource = omap16xx_gpio2_resources,
+};
+
+/*
+ * OMAP16XX GPIO3 interface data
+ */
+static struct __initdata resource omap16xx_gpio3_resources[] = {
+	{
+		.start	= OMAP1610_GPIO3_BASE,
+		.end	= OMAP1610_GPIO3_BASE + SZ_2K - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	{
+		.start	= INT_1610_GPIO_BANK3,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct __initdata omap_gpio_platform_data omap16xx_gpio3_config = {
+	.virtual_irq_start	= IH_GPIO_BASE + 32,
+	.method			= METHOD_GPIO_1610,
+	.gpio_attr		= &omap16xx_gpio_attr,
+};
+
+static struct __initdata platform_device omap16xx_gpio3 = {
+	.name           = "omap-gpio",
+	.id             = 3,
+	.dev            = {
+		.platform_data = &omap16xx_gpio3_config,
+	},
+	.num_resources = ARRAY_SIZE(omap16xx_gpio3_resources),
+	.resource = omap16xx_gpio3_resources,
+};
+
+/*
+ * OMAP16XX GPIO4 interface data
+  */
+static struct __initdata resource omap16xx_gpio4_resources[] = {
+	{
+		.start	= OMAP1610_GPIO4_BASE,
+		.end	= OMAP1610_GPIO4_BASE + SZ_2K - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	{
+		.start	= INT_1610_GPIO_BANK4,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct __initdata omap_gpio_platform_data omap16xx_gpio4_config = {
+	.virtual_irq_start	= IH_GPIO_BASE + 48,
+	.method			= METHOD_GPIO_1610,
+	.gpio_attr		= &omap16xx_gpio_attr,
+};
+
+static struct __initdata platform_device omap16xx_gpio4 = {
+	.name           = "omap-gpio",
+	.id             = 4,
+	.dev            = {
+		.platform_data = &omap16xx_gpio4_config,
+	},
+	.num_resources = ARRAY_SIZE(omap16xx_gpio4_resources),
+	.resource = omap16xx_gpio4_resources,
+};
+
+static struct __initdata platform_device * omap16xx_gpio_dev[] = {
+	&omap16xx_mpu_gpio,
+	&omap16xx_gpio1,
+	&omap16xx_gpio2,
+	&omap16xx_gpio3,
+	&omap16xx_gpio4,
+};
+
+/*
+ * omap16xx_gpio_init needs to be done before
+ * machine_init functions access gpio APIs.
+ * Hence omap16xx_gpio_init is a postcore_initcall.
+ */
+static int __init omap16xx_gpio_init(void)
+{
+	int i;
+
+	if (!cpu_is_omap16xx())
+		return -EINVAL;
+
+	for (i = 0; i < sizeof(omap16xx_gpio_dev); i++)
+			platform_device_register(omap16xx_gpio_dev[i]);
+
+	return 0;
+}
+postcore_initcall(omap16xx_gpio_init);
Signature · 1 line
1.6.3.3
#6 lore raw

PATCH v3 6/13 OMAP: GPIO: Introduce support for OMAP7xx chip GPIO init

From: Charulatha V <[email protected]>

This patch adds support for handling OMAP7xx specific gpio_init by providing platform device data and doing device registration.

---
 arch/arm/mach-omap1/gpio7xx.c |  274 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 274 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap1/gpio7xx.c
arch/arm/mach-omap1/gpio7xx.c new file +274 -0
new file mode 100644
index 0000000..6db124f
@@ -0,0 +1,274 @@
+/*
+ * gpio7xx.c - OMAP7XX-specific gpio code
+ *
+ * Copyright (C) 2010 Texas Instruments, Inc.
+ *
+ * Author:
+ *	Charulatha V <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/gpio.h>
+
+#define OMAP7XX_GPIO1_BASE		0xfffbc000
+#define OMAP7XX_GPIO2_BASE		0xfffbc800
+#define OMAP7XX_GPIO3_BASE		0xfffbd000
+#define OMAP7XX_GPIO4_BASE		0xfffbd800
+#define OMAP7XX_GPIO5_BASE		0xfffbe000
+#define OMAP7XX_GPIO6_BASE		0xfffbe800
+#define OMAP1_MPUIO_VBASE		OMAP1_MPUIO_BASE
+
+static struct omap_gpio_dev_attr omap7xx_gpio_attr = {
+	.gpio_bank_count = 7,
+	.gpio_bank_bits	= 32,
+	.omap1_ick_flag	= false,
+};
+
+/*
+ * OMAP7XX MPU GPIO interface data
+ */
+static struct __initdata resource omap7xx_mpu_gpio_resources[] = {
+	{
+		.start	= OMAP1_MPUIO_VBASE,
+		.end	= OMAP1_MPUIO_VBASE + SZ_2K - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	{
+		.start	= INT_7XX_MPUIO,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct __initdata omap_gpio_platform_data omap7xx_mpu_gpio_config = {
+	.virtual_irq_start	= IH_MPUIO_BASE,
+	.method			= METHOD_MPUIO,
+	.gpio_attr		= &omap7xx_gpio_attr,
+};
+
+static struct __initdata platform_device omap7xx_mpu_gpio = {
+	.name           = "omap-gpio",
+	.id             = 0,
+	.dev            = {
+		.platform_data = &omap7xx_mpu_gpio_config,
+	},
+	.num_resources = ARRAY_SIZE(omap7xx_mpu_gpio_resources),
+	.resource = omap7xx_mpu_gpio_resources,
+};
+
+/*
+ * OMAP7XX GPIO1 interface data
+ */
+static struct __initdata resource omap7xx_gpio1_resources[] = {
+	{
+		.start	= OMAP7XX_GPIO1_BASE,
+		.end	= OMAP7XX_GPIO1_BASE + SZ_2K - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	{
+		.start	= INT_7XX_GPIO_BANK1,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct __initdata omap_gpio_platform_data omap7xx_gpio1_config = {
+	.virtual_irq_start	= IH_GPIO_BASE,
+	.method			= METHOD_GPIO_7XX,
+	.gpio_attr		= &omap7xx_gpio_attr,
+};
+
+static struct __initdata platform_device omap7xx_gpio1 = {
+	.name           = "omap-gpio",
+	.id             = 1,
+	.dev            = {
+		.platform_data = &omap7xx_gpio1_config,
+	},
+	.num_resources = ARRAY_SIZE(omap7xx_gpio1_resources),
+	.resource = omap7xx_gpio1_resources,
+};
+
+/*
+ * OMAP7XX GPIO2 interface data
+ */
+static struct __initdata resource omap7xx_gpio2_resources[] = {
+	{
+		.start	= OMAP7XX_GPIO2_BASE,
+		.end	= OMAP7XX_GPIO2_BASE + SZ_2K - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	{
+		.start	= INT_7XX_GPIO_BANK2,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct __initdata omap_gpio_platform_data omap7xx_gpio2_config = {
+	.virtual_irq_start	= IH_GPIO_BASE + 32,
+	.method			= METHOD_GPIO_7XX,
+	.gpio_attr		= &omap7xx_gpio_attr,
+};
+
+static struct __initdata platform_device omap7xx_gpio2 = {
+	.name           = "omap-gpio",
+	.id             = 2,
+	.dev            = {
+		.platform_data = &omap7xx_gpio2_config,
+	},
+	.num_resources = ARRAY_SIZE(omap7xx_gpio2_resources),
+	.resource = omap7xx_gpio2_resources,
+};
+
+/*
+ * OMAP7XX GPIO3 interface data
+ */
+static struct __initdata resource omap7xx_gpio3_resources[] = {
+	{
+		.start	= OMAP7XX_GPIO3_BASE,
+		.end	= OMAP7XX_GPIO3_BASE + SZ_2K - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	{
+		.start	= INT_7XX_GPIO_BANK3,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct __initdata omap_gpio_platform_data omap7xx_gpio3_config = {
+	.virtual_irq_start	= IH_GPIO_BASE + 64,
+	.method			= METHOD_GPIO_7XX,
+	.gpio_attr		= &omap7xx_gpio_attr,
+};
+
+static struct __initdata platform_device omap7xx_gpio3 = {
+	.name           = "omap-gpio",
+	.id             = 3,
+	.dev            = {
+		.platform_data = &omap7xx_gpio3_config,
+	},
+	.num_resources = ARRAY_SIZE(omap7xx_gpio3_resources),
+	.resource = omap7xx_gpio3_resources,
+};
+
+/*
+ * OMAP7XX GPIO4 interface data
+ */
+static struct __initdata resource omap7xx_gpio4_resources[] = {
+	{
+		.start	= OMAP7XX_GPIO4_BASE,
+		.end	= OMAP7XX_GPIO4_BASE + SZ_2K - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	{
+		.start	= INT_7XX_GPIO_BANK4,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct __initdata omap_gpio_platform_data omap7xx_gpio4_config = {
+	.virtual_irq_start	= IH_GPIO_BASE + 96,
+	.method			= METHOD_GPIO_7XX,
+	.gpio_attr		= &omap7xx_gpio_attr,
+};
+
+static struct __initdata platform_device omap7xx_gpio4 = {
+	.name           = "omap-gpio",
+	.id             = 4,
+	.dev            = {
+		.platform_data = &omap7xx_gpio4_config,
+	},
+	.num_resources = ARRAY_SIZE(omap7xx_gpio4_resources),
+	.resource = omap7xx_gpio4_resources,
+};
+
+/*
+ * OMAP7XX GPIO5 interface data
+  */
+static struct __initdata resource omap7xx_gpio5_resources[] = {
+	{
+		.start	= OMAP7XX_GPIO5_BASE,
+		.end	= OMAP7XX_GPIO5_BASE + SZ_2K - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	{
+		.start	= INT_7XX_GPIO_BANK5,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct __initdata omap_gpio_platform_data omap7xx_gpio5_config = {
+	.virtual_irq_start	= IH_GPIO_BASE + 128,
+	.method			= METHOD_GPIO_7XX,
+	.gpio_attr		= &omap7xx_gpio_attr,
+};
+
+static struct __initdata platform_device omap7xx_gpio5 = {
+	.name           = "omap-gpio",
+	.id             = 5,
+	.dev            = {
+		.platform_data = &omap7xx_gpio5_config,
+	},
+	.num_resources = ARRAY_SIZE(omap7xx_gpio5_resources),
+	.resource = omap7xx_gpio5_resources,
+};
+
+/*
+ * OMAP7XX GPIO6 interface data
+  */
+static struct __initdata resource omap7xx_gpio6_resources[] = {
+	{
+		.start	= OMAP7XX_GPIO6_BASE,
+		.end	= OMAP7XX_GPIO6_BASE + SZ_2K - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	{
+		.start	= INT_7XX_GPIO_BANK6,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct __initdata omap_gpio_platform_data omap7xx_gpio6_config = {
+	.virtual_irq_start	= IH_GPIO_BASE + 160,
+	.method			= METHOD_GPIO_7XX,
+	.gpio_attr		= &omap7xx_gpio_attr,
+};
+
+static struct __initdata platform_device omap7xx_gpio6 = {
+	.name           = "omap-gpio",
+	.id             = 6,
+	.dev            = {
+		.platform_data = &omap7xx_gpio6_config,
+	},
+	.num_resources = ARRAY_SIZE(omap7xx_gpio6_resources),
+	.resource = omap7xx_gpio6_resources,
+};
+
+static struct __initdata platform_device * omap7xx_gpio_dev[] = {
+	&omap7xx_mpu_gpio,
+	&omap7xx_gpio1,
+	&omap7xx_gpio2,
+	&omap7xx_gpio3,
+	&omap7xx_gpio4,
+	&omap7xx_gpio5,
+	&omap7xx_gpio6,
+};
+
+/*
+ * omap7xx_gpio_init needs to be done before
+ * machine_init functions access gpio APIs.
+ * Hence omap7xx_gpio_init is a postcore_initcall.
+ */
+static int __init omap7xx_gpio_init(void)
+{
+	int i;
+
+	if (!cpu_is_omap7xx())
+		return -EINVAL;
+
+	for (i = 0; i < sizeof(omap7xx_gpio_dev); i++)
+		platform_device_register(omap7xx_gpio_dev[i]);
+
+	return 0;
+}
+postcore_initcall(omap7xx_gpio_init);
Signature · 1 line
1.6.3.3
#7 lore raw

PATCH v3 7/13 OMAP: GPIO: add GPIO hwmods structures for OMAP3

From: Charulatha V <[email protected]>

Add hwmod structures for GPIO module on OMAP3

---
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |  366 ++++++++++++++++++++++++++++
 1 files changed, 366 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +366 -0
index e288b20..91ef205 100644
@@ -17,6 +17,7 @@
 #include <mach/irqs.h>
 #include <plat/cpu.h>
 #include <plat/dma.h>
+#include <plat/gpio.h>
 
 #include "omap_hwmod_common_data.h"
 
@@ -81,6 +82,12 @@ static struct omap_hwmod omap3xxx_l3_hwmod = {
 };
 
 static struct omap_hwmod omap3xxx_l4_wkup_hwmod;
+static struct omap_hwmod omap3xxx_gpio1_hwmod;
+static struct omap_hwmod omap3xxx_gpio2_hwmod;
+static struct omap_hwmod omap3xxx_gpio3_hwmod;
+static struct omap_hwmod omap3xxx_gpio4_hwmod;
+static struct omap_hwmod omap3xxx_gpio5_hwmod;
+static struct omap_hwmod omap3xxx_gpio6_hwmod;
 
 /* L4_CORE -> L4_WKUP interface */
 static struct omap_hwmod_ocp_if omap3xxx_l4_core__l4_wkup = {
@@ -89,6 +96,114 @@ static struct omap_hwmod_ocp_if omap3xxx_l4_core__l4_wkup = {
 	.user	= OCP_USER_MPU | OCP_USER_SDMA,
 };
 
+/* L4 WKUP -> GPIO1 interface */
+static struct omap_hwmod_addr_space omap3xxx_gpio1_addrs[] = {
+	{
+		.pa_start	= OMAP34XX_GPIO1_BASE,
+		.pa_end		= OMAP34XX_GPIO1_BASE + SZ_4K - 1,
+		.flags		= ADDR_TYPE_RT
+	},
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_wkup__gpio1 = {
+	.master		= &omap3xxx_l4_wkup_hwmod,
+	.slave		= &omap3xxx_gpio1_hwmod,
+	.clk		= "gpio1_ick",
+	.addr		= omap3xxx_gpio1_addrs,
+	.addr_cnt	= ARRAY_SIZE(omap3xxx_gpio1_addrs),
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 PER -> GPIO2 interface */
+static struct omap_hwmod_addr_space omap3xxx_gpio2_addrs[] = {
+	{
+		.pa_start	= OMAP34XX_GPIO2_BASE,
+		.pa_end		= OMAP34XX_GPIO2_BASE + SZ_4K - 1,
+		.flags		= ADDR_TYPE_RT
+	},
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio2 = {
+	.master		= &omap3xxx_l4_per_hwmod,
+	.slave		= &omap3xxx_gpio2_hwmod,
+	.clk		= "gpio2_ick",
+	.addr		= omap3xxx_gpio2_addrs,
+	.addr_cnt	= ARRAY_SIZE(omap3xxx_gpio2_addrs),
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 PER -> GPIO3 interface */
+static struct omap_hwmod_addr_space omap3xxx_gpio3_addrs[] = {
+	{
+		.pa_start	= OMAP34XX_GPIO3_BASE,
+		.pa_end		= OMAP34XX_GPIO3_BASE + SZ_4K - 1,
+		.flags		= ADDR_TYPE_RT
+	},
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio3 = {
+	.master		= &omap3xxx_l4_per_hwmod,
+	.slave		= &omap3xxx_gpio3_hwmod,
+	.clk		= "gpio3_ick",
+	.addr		= omap3xxx_gpio3_addrs,
+	.addr_cnt	= ARRAY_SIZE(omap3xxx_gpio3_addrs),
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 PER -> GPIO4 interface */
+static struct omap_hwmod_addr_space omap3xxx_gpio4_addrs[] = {
+	{
+		.pa_start	= OMAP34XX_GPIO4_BASE,
+		.pa_end		= OMAP34XX_GPIO4_BASE + SZ_4K - 1,
+		.flags		= ADDR_TYPE_RT
+	},
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio4 = {
+	.master		= &omap3xxx_l4_per_hwmod,
+	.slave		= &omap3xxx_gpio4_hwmod,
+	.clk		= "gpio4_ick",
+	.addr		= omap3xxx_gpio4_addrs,
+	.addr_cnt	= ARRAY_SIZE(omap3xxx_gpio4_addrs),
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 PER -> GPIO5 interface */
+static struct omap_hwmod_addr_space omap3xxx_gpio5_addrs[] = {
+	{
+		.pa_start	= OMAP34XX_GPIO5_BASE,
+		.pa_end		= OMAP34XX_GPIO5_BASE + SZ_4K - 1,
+		.flags		= ADDR_TYPE_RT
+	},
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio5 = {
+	.master		= &omap3xxx_l4_per_hwmod,
+	.slave		= &omap3xxx_gpio5_hwmod,
+	.clk		= "gpio5_ick",
+	.addr		= omap3xxx_gpio5_addrs,
+	.addr_cnt	= ARRAY_SIZE(omap3xxx_gpio5_addrs),
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 PER -> GPIO6 interface */
+static struct omap_hwmod_addr_space omap3xxx_gpio6_addrs[] = {
+	{
+		.pa_start	= OMAP34XX_GPIO6_BASE,
+		.pa_end		= OMAP34XX_GPIO6_BASE + SZ_4K - 1,
+		.flags		= ADDR_TYPE_RT
+	},
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio6 = {
+	.master		= &omap3xxx_l4_per_hwmod,
+	.slave		= &omap3xxx_gpio6_hwmod,
+	.clk		= "gpio6_ick",
+	.addr		= omap3xxx_gpio6_addrs,
+	.addr_cnt	= ARRAY_SIZE(omap3xxx_gpio6_addrs),
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+};
+
 /* Slave interfaces on the L4_CORE interconnect */
 static struct omap_hwmod_ocp_if *omap3xxx_l4_core_slaves[] = {
 	&omap3xxx_l3__l4_core,
@@ -168,12 +283,263 @@ static struct omap_hwmod omap3xxx_mpu_hwmod = {
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 };
 
+/* GPIO common */
+static struct omap_gpio_dev_attr gpio_dev_attr = {
+	.gpio_bank_count = 6,
+	.gpio_bank_bits = 32,
+	.dbck_flag = true,
+};
+
+static struct omap_hwmod_class_sysconfig omap3xxx_gpio_sysc = {
+	.rev_offs	= 0x0000,
+	.sysc_offs	= 0x0010,
+	.syss_offs	= 0x0014,
+	.sysc_flags	= (SYSC_HAS_ENAWAKEUP | SYSC_HAS_SIDLEMODE |
+			   SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE),
+	.idlemodes	= (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+	.sysc_fields    = &omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class omap3xxx_gpio_hwmod_class = {
+	.name = "gpio",
+	.sysc = &omap3xxx_gpio_sysc,
+};
+
+/* GPIO1 */
+
+static struct omap_hwmod_irq_info omap3xxx_gpio1_irqs[] = {
+	{ .name = "gpio_mpu_irq", .irq = INT_34XX_GPIO_BANK1 },
+};
+
+static struct omap_hwmod_opt_clk gpio1_opt_clks[] = {
+	{ .role = "dbclk", .clk = "gpio1_dbck", },
+};
+
+static struct omap_hwmod_ocp_if *omap3xxx_gpio1_slaves[] = {
+	&omap3xxx_l4_wkup__gpio1,
+};
+
+static struct omap_hwmod omap3xxx_gpio1_hwmod = {
+	.name		= "gpio1",
+	.mpu_irqs	= omap3xxx_gpio1_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(omap3xxx_gpio1_irqs),
+	.main_clk	= NULL,
+	.opt_clks	= gpio1_opt_clks,
+	.opt_clks_cnt	= ARRAY_SIZE(gpio1_opt_clks),
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP3430_EN_GPIO1_SHIFT,
+			.module_offs = WKUP_MOD,
+			.idlest_reg_id = 1,
+			.idlest_idle_bit = 3,
+		},
+	},
+	.slaves		= omap3xxx_gpio1_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap3xxx_gpio1_slaves),
+	.class		= &omap3xxx_gpio_hwmod_class,
+	.dev_attr	= &gpio_dev_attr,
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
+};
+
+/* GPIO2 */
+
+static struct omap_hwmod_irq_info omap3xxx_gpio2_irqs[] = {
+	{ .name = "gpio_mpu_irq", .irq = INT_34XX_GPIO_BANK2 },
+};
+
+static struct omap_hwmod_opt_clk gpio2_opt_clks[] = {
+	{ .role = "dbclk", .clk = "gpio2_dbck", },
+};
+
+static struct omap_hwmod_ocp_if *omap3xxx_gpio2_slaves[] = {
+	&omap3xxx_l4_per__gpio2,
+};
+
+static struct omap_hwmod omap3xxx_gpio2_hwmod = {
+	.name		= "gpio2",
+	.mpu_irqs	= omap3xxx_gpio2_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(omap3xxx_gpio2_irqs),
+	.main_clk	= NULL,
+	.opt_clks	= gpio2_opt_clks,
+	.opt_clks_cnt	= ARRAY_SIZE(gpio2_opt_clks),
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP3430_EN_GPIO2_SHIFT,
+			.module_offs = OMAP3430_PER_MOD,
+			.idlest_reg_id = 1,
+			.idlest_idle_bit = 13,
+		},
+	},
+	.slaves		= omap3xxx_gpio2_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap3xxx_gpio2_slaves),
+	.class		= &omap3xxx_gpio_hwmod_class,
+	.dev_attr	= &gpio_dev_attr,
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
+};
+
+/* GPIO3 */
+
+static struct omap_hwmod_irq_info omap3xxx_gpio3_irqs[] = {
+	{ .name = "gpio_mpu_irq", .irq = INT_34XX_GPIO_BANK3 },
+};
+
+static struct omap_hwmod_opt_clk gpio3_opt_clks[] = {
+	{ .role = "dbclk", .clk = "gpio3_dbck", },
+};
+
+static struct omap_hwmod_ocp_if *omap3xxx_gpio3_slaves[] = {
+	&omap3xxx_l4_per__gpio3,
+};
+
+static struct omap_hwmod omap3xxx_gpio3_hwmod = {
+	.name		= "gpio3",
+	.mpu_irqs	= omap3xxx_gpio3_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(omap3xxx_gpio3_irqs),
+	.main_clk	= NULL,
+	.opt_clks	= gpio3_opt_clks,
+	.opt_clks_cnt	= ARRAY_SIZE(gpio3_opt_clks),
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP3430_EN_GPIO3_SHIFT,
+			.module_offs = OMAP3430_PER_MOD,
+			.idlest_reg_id = 1,
+			.idlest_idle_bit = 14,
+		},
+	},
+	.slaves		= omap3xxx_gpio3_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap3xxx_gpio3_slaves),
+	.class		= &omap3xxx_gpio_hwmod_class,
+	.dev_attr	= &gpio_dev_attr,
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
+};
+
+/* GPIO4 */
+
+static struct omap_hwmod_irq_info omap3xxx_gpio4_irqs[] = {
+	{ .name = "gpio_mpu_irq", .irq = INT_34XX_GPIO_BANK4 },
+};
+
+static struct omap_hwmod_opt_clk gpio4_opt_clks[] = {
+	{ .role = "dbclk", .clk = "gpio4_dbck", },
+};
+
+static struct omap_hwmod_ocp_if *omap3xxx_gpio4_slaves[] = {
+	&omap3xxx_l4_per__gpio4,
+};
+
+static struct omap_hwmod omap3xxx_gpio4_hwmod = {
+	.name		= "gpio4",
+	.mpu_irqs	= omap3xxx_gpio4_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(omap3xxx_gpio4_irqs),
+	.main_clk	= NULL,
+	.opt_clks	= gpio4_opt_clks,
+	.opt_clks_cnt	= ARRAY_SIZE(gpio4_opt_clks),
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP3430_EN_GPIO4_SHIFT,
+			.module_offs = OMAP3430_PER_MOD,
+			.idlest_reg_id = 1,
+			.idlest_idle_bit = 15,
+		},
+	},
+	.slaves		= omap3xxx_gpio4_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap3xxx_gpio4_slaves),
+	.class		= &omap3xxx_gpio_hwmod_class,
+	.dev_attr	= &gpio_dev_attr,
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
+};
+
+
+/* GPIO5 */
+
+static struct omap_hwmod_irq_info omap3xxx_gpio5_irqs[] = {
+	{ .name = "gpio_mpu_irq", .irq = INT_34XX_GPIO_BANK5 },
+};
+
+static struct omap_hwmod_opt_clk gpio5_opt_clks[] = {
+	{ .role = "dbclk", .clk = "gpio5_dbck", },
+};
+
+static struct omap_hwmod_ocp_if *omap3xxx_gpio5_slaves[] = {
+	&omap3xxx_l4_per__gpio5,
+};
+
+static struct omap_hwmod omap3xxx_gpio5_hwmod = {
+	.name		= "gpio5",
+	.mpu_irqs	= omap3xxx_gpio5_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(omap3xxx_gpio5_irqs),
+	.main_clk	= NULL,
+	.opt_clks	= gpio5_opt_clks,
+	.opt_clks_cnt	= ARRAY_SIZE(gpio5_opt_clks),
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP3430_EN_GPIO5_SHIFT,
+			.module_offs = OMAP3430_PER_MOD,
+			.idlest_reg_id = 1,
+			.idlest_idle_bit = 16,
+		},
+	},
+	.slaves		= omap3xxx_gpio5_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap3xxx_gpio5_slaves),
+	.class		= &omap3xxx_gpio_hwmod_class,
+	.dev_attr	= &gpio_dev_attr,
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
+};
+
+/* GPIO6 */
+
+static struct omap_hwmod_irq_info omap3xxx_gpio6_irqs[] = {
+	{ .name = "gpio_mpu_irq", .irq = INT_34XX_GPIO_BANK6 },
+};
+
+static struct omap_hwmod_opt_clk gpio6_opt_clks[] = {
+	{ .role = "dbclk", .clk = "gpio6_dbck", },
+};
+
+static struct omap_hwmod_ocp_if *omap3xxx_gpio6_slaves[] = {
+	&omap3xxx_l4_per__gpio6,
+};
+
+static struct omap_hwmod omap3xxx_gpio6_hwmod = {
+	.name		= "gpio6",
+	.mpu_irqs	= omap3xxx_gpio6_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(omap3xxx_gpio6_irqs),
+	.main_clk	= NULL,
+	.opt_clks	= gpio6_opt_clks,
+	.opt_clks_cnt	= ARRAY_SIZE(gpio6_opt_clks),
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP3430_EN_GPIO6_SHIFT,
+			.module_offs = OMAP3430_PER_MOD,
+			.idlest_reg_id = 1,
+			.idlest_idle_bit = 17,
+		},
+	},
+	.slaves		= omap3xxx_gpio6_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap3xxx_gpio6_slaves),
+	.class		= &omap3xxx_gpio_hwmod_class,
+	.dev_attr	= &gpio_dev_attr,
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
+};
+
 static __initdata struct omap_hwmod *omap3xxx_hwmods[] = {
 	&omap3xxx_l3_hwmod,
 	&omap3xxx_l4_core_hwmod,
 	&omap3xxx_l4_per_hwmod,
 	&omap3xxx_l4_wkup_hwmod,
 	&omap3xxx_mpu_hwmod,
+	&omap3xxx_gpio1_hwmod,
+	&omap3xxx_gpio2_hwmod,
+	&omap3xxx_gpio3_hwmod,
+	&omap3xxx_gpio4_hwmod,
+	&omap3xxx_gpio5_hwmod,
+	&omap3xxx_gpio6_hwmod,
 	NULL,
 };
 
Signature · 1 line
1.6.3.3
#8 lore raw

PATCH v3 8/13 OMAP: GPIO: add GPIO hwmods structures for OMAP242X

From: Charulatha V <[email protected]>

Add hwmod structures for GPIO module on OMAP242X

---
 arch/arm/mach-omap2/omap_hwmod_2420_data.c |  228 ++++++++++++++++++++++++++++
 1 files changed, 228 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/omap_hwmod_2420_data.c +228 -0
index a8b57a6..8742707 100644
@@ -15,6 +15,7 @@
 #include <mach/irqs.h>
 #include <plat/cpu.h>
 #include <plat/dma.h>
+#include <plat/gpio.h>
 
 #include "omap_hwmod_common_data.h"
 
@@ -32,6 +33,10 @@
 static struct omap_hwmod omap2420_mpu_hwmod;
 static struct omap_hwmod omap2420_l3_hwmod;
 static struct omap_hwmod omap2420_l4_core_hwmod;
+static struct omap_hwmod omap2420_gpio1_hwmod;
+static struct omap_hwmod omap2420_gpio2_hwmod;
+static struct omap_hwmod omap2420_gpio3_hwmod;
+static struct omap_hwmod omap2420_gpio4_hwmod;
 
 /* L3 -> L4_CORE interface */
 static struct omap_hwmod_ocp_if omap2420_l3__l4_core = {
@@ -88,6 +93,78 @@ static struct omap_hwmod_ocp_if *omap2420_l4_core_masters[] = {
 	&omap2420_l4_core__l4_wkup,
 };
 
+/* L4 WKUP -> GPIO1 interface */
+static struct omap_hwmod_addr_space omap2420_gpio1_addr_space[] = {
+	{
+		.pa_start	= OMAP242X_GPIO1_BASE,
+		.pa_end		= OMAP242X_GPIO1_BASE + SZ_4K - 1,
+		.flags		= ADDR_TYPE_RT
+	},
+};
+
+static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio1 = {
+	.master		= &omap2420_l4_wkup_hwmod,
+	.slave		= &omap2420_gpio1_hwmod,
+	.clk		= "gpios_ick",
+	.addr		= omap2420_gpio1_addr_space,
+	.addr_cnt	= ARRAY_SIZE(omap2420_gpio1_addr_space),
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 WKUP -> GPIO2 interface */
+static struct omap_hwmod_addr_space omap2420_gpio2_addr_space[] = {
+	{
+		.pa_start	= OMAP242X_GPIO2_BASE,
+		.pa_end		= OMAP242X_GPIO2_BASE + SZ_4K - 1,
+		.flags		= ADDR_TYPE_RT
+	},
+};
+
+static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio2 = {
+	.master		= &omap2420_l4_wkup_hwmod,
+	.slave		= &omap2420_gpio2_hwmod,
+	.clk		= "gpios_ick",
+	.addr		= omap2420_gpio2_addr_space,
+	.addr_cnt	= ARRAY_SIZE(omap2420_gpio2_addr_space),
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 WKUP -> GPIO3 interface */
+static struct omap_hwmod_addr_space omap2420_gpio3_addr_space[] = {
+	{
+		.pa_start	= OMAP242X_GPIO3_BASE,
+		.pa_end		= OMAP242X_GPIO3_BASE + SZ_4K - 1,
+		.flags		= ADDR_TYPE_RT
+	},
+};
+
+static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio3 = {
+	.master		= &omap2420_l4_wkup_hwmod,
+	.slave		= &omap2420_gpio3_hwmod,
+	.clk		= "gpios_ick",
+	.addr		= omap2420_gpio3_addr_space,
+	.addr_cnt	= ARRAY_SIZE(omap2420_gpio3_addr_space),
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 WKUP -> GPIO4 interface */
+static struct omap_hwmod_addr_space omap2420_gpio4_addr_space[] = {
+	{
+		.pa_start	= OMAP242X_GPIO4_BASE,
+		.pa_end		= OMAP242X_GPIO4_BASE + SZ_4K - 1,
+		.flags		= ADDR_TYPE_RT
+	},
+};
+
+static struct omap_hwmod_ocp_if omap2420_l4_wkup__gpio4 = {
+	.master		= &omap2420_l4_wkup_hwmod,
+	.slave		= &omap2420_gpio4_hwmod,
+	.clk		= "gpios_ick",
+	.addr		= omap2420_gpio4_addr_space,
+	.addr_cnt	= ARRAY_SIZE(omap2420_gpio4_addr_space),
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+};
+
 /* L4 CORE */
 static struct omap_hwmod omap2420_l4_core_hwmod = {
 	.name		= "l4_core_hwmod",
@@ -136,11 +213,162 @@ static struct omap_hwmod omap2420_mpu_hwmod = {
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
 };
 
+/* GPIO common */
+
+static struct omap_gpio_dev_attr gpio_dev_attr = {
+	.gpio_bank_count = 4,
+	.gpio_bank_bits = 32,
+	.dbck_flag = false,
+};
+
+static struct omap_hwmod_class_sysconfig omap242x_gpio_sysc = {
+	.rev_offs	= 0x0000,
+	.sysc_offs	= 0x0010,
+	.syss_offs	= 0x0014,
+	.sysc_flags	= (SYSC_HAS_ENAWAKEUP | SYSC_HAS_SIDLEMODE |
+			   SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE),
+	.idlemodes	= (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+	.sysc_fields    = &omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class omap242x_gpio_hwmod_class = {
+	.name = "gpio",
+	.sysc = &omap242x_gpio_sysc,
+};
+
+/* GPIO1 */
+
+static struct omap_hwmod_irq_info omap242x_gpio1_irqs[] = {
+	{ .name = "gpio_mpu_irq", .irq = INT_24XX_GPIO_BANK1 },
+};
+
+static struct omap_hwmod_ocp_if *omap2420_gpio1_slaves[] = {
+	&omap2420_l4_wkup__gpio1,
+};
+
+static struct omap_hwmod omap2420_gpio1_hwmod = {
+	.name		= "gpio1",
+	.mpu_irqs	= omap242x_gpio1_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(omap242x_gpio1_irqs),
+	.main_clk	= "gpios_fck",
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP24XX_EN_GPIOS_SHIFT,
+			.module_offs = WKUP_MOD,
+			.idlest_reg_id = 1,
+			.idlest_idle_bit = OMAP24XX_EN_GPIOS_SHIFT,
+		},
+	},
+	.slaves		= omap2420_gpio1_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap2420_gpio1_slaves),
+	.class		= &omap242x_gpio_hwmod_class,
+	.dev_attr	= &gpio_dev_attr,
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
+};
+
+/* GPIO2 */
+
+static struct omap_hwmod_irq_info omap242x_gpio2_irqs[] = {
+	{ .name = "gpio_mpu_irq", .irq = INT_24XX_GPIO_BANK2 },
+};
+
+static struct omap_hwmod_ocp_if *omap2420_gpio2_slaves[] = {
+	&omap2420_l4_wkup__gpio2,
+};
+
+static struct omap_hwmod omap2420_gpio2_hwmod = {
+	.name		= "gpio2",
+	.mpu_irqs	= omap242x_gpio2_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(omap242x_gpio2_irqs),
+	.main_clk	= "gpios_fck",
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP24XX_EN_GPIOS_SHIFT,
+			.module_offs = WKUP_MOD,
+			.idlest_reg_id = 1,
+			.idlest_idle_bit = OMAP24XX_EN_GPIOS_SHIFT,
+		},
+	},
+	.slaves		= omap2420_gpio2_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap2420_gpio2_slaves),
+	.class		= &omap242x_gpio_hwmod_class,
+	.dev_attr	= &gpio_dev_attr,
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
+};
+
+/* GPIO3 */
+
+static struct omap_hwmod_irq_info omap242x_gpio3_irqs[] = {
+	{ .name = "gpio_mpu_irq", .irq = INT_24XX_GPIO_BANK3 },
+};
+
+static struct omap_hwmod_ocp_if *omap2420_gpio3_slaves[] = {
+	&omap2420_l4_wkup__gpio3,
+};
+
+static struct omap_hwmod omap2420_gpio3_hwmod = {
+	.name		= "gpio3",
+	.mpu_irqs	= omap242x_gpio3_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(omap242x_gpio3_irqs),
+	.main_clk	= "gpios_fck",
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP24XX_EN_GPIOS_SHIFT,
+			.module_offs = WKUP_MOD,
+			.idlest_reg_id = 1,
+			.idlest_idle_bit = OMAP24XX_EN_GPIOS_SHIFT,
+		},
+	},
+	.slaves		= omap2420_gpio3_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap2420_gpio3_slaves),
+	.class		= &omap242x_gpio_hwmod_class,
+	.dev_attr	= &gpio_dev_attr,
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
+};
+
+/* GPIO4 */
+
+static struct omap_hwmod_irq_info omap242x_gpio4_irqs[] = {
+	{ .name = "gpio_mpu_irq", .irq = INT_24XX_GPIO_BANK4 },
+};
+
+static struct omap_hwmod_ocp_if *omap2420_gpio4_slaves[] = {
+	&omap2420_l4_wkup__gpio4,
+};
+
+static struct omap_hwmod omap2420_gpio4_hwmod = {
+	.name		= "gpio4",
+	.mpu_irqs	= omap242x_gpio4_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(omap242x_gpio4_irqs),
+	.main_clk	= "gpios_fck",
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP24XX_EN_GPIOS_SHIFT,
+			.module_offs = WKUP_MOD,
+			.idlest_reg_id = 1,
+			.idlest_idle_bit = OMAP24XX_EN_GPIOS_SHIFT,
+		},
+	},
+	.slaves		= omap2420_gpio4_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap2420_gpio4_slaves),
+	.class		= &omap242x_gpio_hwmod_class,
+	.dev_attr	= &gpio_dev_attr,
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
+};
+
 static __initdata struct omap_hwmod *omap2420_hwmods[] = {
 	&omap2420_l3_hwmod,
 	&omap2420_l4_core_hwmod,
 	&omap2420_l4_wkup_hwmod,
 	&omap2420_mpu_hwmod,
+	&omap2420_gpio1_hwmod,
+	&omap2420_gpio2_hwmod,
+	&omap2420_gpio3_hwmod,
+	&omap2420_gpio4_hwmod,
 	NULL,
 };
 
Signature · 1 line
1.6.3.3
#9 lore raw

PATCH v3 9/13 OMAP: GPIO: add GPIO hwmods structures for OMAP243X

From: Charulatha V <[email protected]>

Add hwmod structures for GPIO module on OMAP243X

---
 arch/arm/mach-omap2/omap_hwmod_2430_data.c |  279 ++++++++++++++++++++++++++++
 1 files changed, 279 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/omap_hwmod_2430_data.c +279 -0
index 8b1f74b..ac0e191 100644
@@ -15,6 +15,7 @@
 #include <mach/irqs.h>
 #include <plat/cpu.h>
 #include <plat/dma.h>
+#include <plat/gpio.h>
 
 #include "omap_hwmod_common_data.h"
 
@@ -72,6 +73,11 @@ static struct omap_hwmod omap2430_l3_hwmod = {
 static struct omap_hwmod omap2430_l4_wkup_hwmod;
 static struct omap_hwmod omap2430_mmc1_hwmod;
 static struct omap_hwmod omap2430_mmc2_hwmod;
+static struct omap_hwmod omap2430_gpio1_hwmod;
+static struct omap_hwmod omap2430_gpio2_hwmod;
+static struct omap_hwmod omap2430_gpio3_hwmod;
+static struct omap_hwmod omap2430_gpio4_hwmod;
+static struct omap_hwmod omap2430_gpio5_hwmod;
 
 /* L4_CORE -> L4_WKUP interface */
 static struct omap_hwmod_ocp_if omap2430_l4_core__l4_wkup = {
@@ -80,6 +86,96 @@ static struct omap_hwmod_ocp_if omap2430_l4_core__l4_wkup = {
 	.user	= OCP_USER_MPU | OCP_USER_SDMA,
 };
 
+/* L4 WKUP -> GPIO1 interface */
+static struct omap_hwmod_addr_space omap2430_gpio1_addr_space[] = {
+	{
+		.pa_start	= OMAP243X_GPIO1_BASE,
+		.pa_end		= OMAP243X_GPIO1_BASE + SZ_4K - 1,
+		.flags		= ADDR_TYPE_RT
+	},
+};
+
+static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio1 = {
+	.master		= &omap2430_l4_wkup_hwmod,
+	.slave		= &omap2430_gpio1_hwmod,
+	.clk		= "gpios_ick",
+	.addr		= omap2430_gpio1_addr_space,
+	.addr_cnt	= ARRAY_SIZE(omap2430_gpio1_addr_space),
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 WKUP -> GPIO2 interface */
+static struct omap_hwmod_addr_space omap2430_gpio2_addr_space[] = {
+	{
+		.pa_start	= OMAP243X_GPIO2_BASE,
+		.pa_end		= OMAP243X_GPIO2_BASE + SZ_4K - 1,
+		.flags		= ADDR_TYPE_RT
+	},
+};
+
+static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio2 = {
+	.master		= &omap2430_l4_wkup_hwmod,
+	.slave		= &omap2430_gpio2_hwmod,
+	.clk		= "gpios_ick",
+	.addr		= omap2430_gpio2_addr_space,
+	.addr_cnt	= ARRAY_SIZE(omap2430_gpio2_addr_space),
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 WKUP -> GPIO3 interface */
+static struct omap_hwmod_addr_space omap2430_gpio3_addr_space[] = {
+	{
+		.pa_start	= OMAP243X_GPIO3_BASE,
+		.pa_end		= OMAP243X_GPIO3_BASE + SZ_4K - 1,
+		.flags		= ADDR_TYPE_RT
+	},
+};
+
+static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio3 = {
+	.master		= &omap2430_l4_wkup_hwmod,
+	.slave		= &omap2430_gpio3_hwmod,
+	.clk		= "gpios_ick",
+	.addr		= omap2430_gpio3_addr_space,
+	.addr_cnt	= ARRAY_SIZE(omap2430_gpio3_addr_space),
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 WKUP -> GPIO4 interface */
+static struct omap_hwmod_addr_space omap2430_gpio4_addr_space[] = {
+	{
+		.pa_start	= OMAP243X_GPIO4_BASE,
+		.pa_end		= OMAP243X_GPIO4_BASE + SZ_4K - 1,
+		.flags		= ADDR_TYPE_RT
+	},
+};
+
+static struct omap_hwmod_ocp_if omap2430_l4_wkup__gpio4 = {
+	.master		= &omap2430_l4_wkup_hwmod,
+	.slave		= &omap2430_gpio4_hwmod,
+	.clk		= "gpios_ick",
+	.addr		= omap2430_gpio4_addr_space,
+	.addr_cnt	= ARRAY_SIZE(omap2430_gpio4_addr_space),
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 CORE -> GPIO5 interface */
+static struct omap_hwmod_addr_space omap2430_gpio5_addr_space[] = {
+	{
+		.pa_start	= OMAP243X_GPIO5_BASE,
+		.pa_end		= OMAP243X_GPIO5_BASE + SZ_4K - 1,
+		.flags		= ADDR_TYPE_RT
+	},
+};
+
+static struct omap_hwmod_ocp_if omap2430_l4_core__gpio5 = {
+	.master		= &omap2430_l4_core_hwmod,
+	.slave		= &omap2430_gpio5_hwmod,
+	.clk		= "gpio5_ick",
+	.addr		= omap2430_gpio5_addr_space,
+	.addr_cnt	= ARRAY_SIZE(omap2430_gpio5_addr_space),
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+};
+
 /* Slave interfaces on the L4_CORE interconnect */
 static struct omap_hwmod_ocp_if *omap2430_l4_core_slaves[] = {
 	&omap2430_l3__l4_core,
@@ -138,11 +234,194 @@ static struct omap_hwmod omap2430_mpu_hwmod = {
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
 };
 
+/* GPIO common */
+
+static struct omap_gpio_dev_attr gpio_dev_attr = {
+	.gpio_bank_count = 5,
+	.gpio_bank_bits = 32,
+	.dbck_flag = false,
+};
+
+static struct omap_hwmod_class_sysconfig omap243x_gpio_sysc = {
+	.rev_offs	= 0x0000,
+	.sysc_offs	= 0x0010,
+	.syss_offs	= 0x0014,
+	.sysc_flags	= (SYSC_HAS_ENAWAKEUP | SYSC_HAS_SIDLEMODE |
+			   SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE),
+	.idlemodes	= (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+	.sysc_fields    = &omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class omap243x_gpio_hwmod_class = {
+	.name = "gpio",
+	.sysc = &omap243x_gpio_sysc,
+};
+
+/* GPIO1 */
+
+static struct omap_hwmod_irq_info omap243x_gpio1_irqs[] = {
+	{ .name = "gpio_mpu_irq", .irq = INT_24XX_GPIO_BANK1 },
+};
+
+static struct omap_hwmod_ocp_if *omap2430_gpio1_slaves[] = {
+	&omap2430_l4_wkup__gpio1,
+};
+
+static struct omap_hwmod omap2430_gpio1_hwmod = {
+	.name		= "gpio1",
+	.mpu_irqs	= omap243x_gpio1_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(omap243x_gpio1_irqs),
+	.main_clk	= "gpios_fck",
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP24XX_EN_GPIOS_SHIFT,
+			.module_offs = WKUP_MOD,
+			.idlest_reg_id = 1,
+			.idlest_idle_bit = OMAP24XX_EN_GPIOS_SHIFT,
+		},
+	},
+	.slaves		= omap2430_gpio1_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap2430_gpio1_slaves),
+	.class		= &omap243x_gpio_hwmod_class,
+	.dev_attr	= &gpio_dev_attr,
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
+};
+
+/* GPIO2 */
+
+static struct omap_hwmod_irq_info omap243x_gpio2_irqs[] = {
+	{ .name = "gpio_mpu_irq", .irq = INT_24XX_GPIO_BANK2 },
+};
+
+static struct omap_hwmod_ocp_if *omap2430_gpio2_slaves[] = {
+	&omap2430_l4_wkup__gpio2,
+};
+
+static struct omap_hwmod omap2430_gpio2_hwmod = {
+	.name		= "gpio2",
+	.mpu_irqs	= omap243x_gpio2_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(omap243x_gpio2_irqs),
+	.main_clk	= "gpios_fck",
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP24XX_EN_GPIOS_SHIFT,
+			.module_offs = WKUP_MOD,
+			.idlest_reg_id = 1,
+			.idlest_idle_bit = OMAP24XX_EN_GPIOS_SHIFT,
+		},
+	},
+	.slaves		= omap2430_gpio2_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap2430_gpio2_slaves),
+	.class		= &omap243x_gpio_hwmod_class,
+	.dev_attr	= &gpio_dev_attr,
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
+};
+
+/* GPIO3 */
+
+static struct omap_hwmod_irq_info omap243x_gpio3_irqs[] = {
+	{ .name = "gpio_mpu_irq", .irq = INT_24XX_GPIO_BANK3 },
+};
+
+static struct omap_hwmod_ocp_if *omap2430_gpio3_slaves[] = {
+	&omap2430_l4_wkup__gpio3,
+};
+
+static struct omap_hwmod omap2430_gpio3_hwmod = {
+	.name		= "gpio3",
+	.mpu_irqs	= omap243x_gpio3_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(omap243x_gpio3_irqs),
+	.main_clk	= "gpios_fck",
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP24XX_EN_GPIOS_SHIFT,
+			.module_offs = WKUP_MOD,
+			.idlest_reg_id = 1,
+			.idlest_idle_bit = OMAP24XX_EN_GPIOS_SHIFT,
+		},
+	},
+	.slaves		= omap2430_gpio3_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap2430_gpio3_slaves),
+	.class		= &omap243x_gpio_hwmod_class,
+	.dev_attr	= &gpio_dev_attr,
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
+};
+
+/* GPIO4 */
+
+static struct omap_hwmod_irq_info omap243x_gpio4_irqs[] = {
+	{ .name = "gpio_mpu_irq", .irq = INT_24XX_GPIO_BANK4 },
+};
+
+static struct omap_hwmod_ocp_if *omap2430_gpio4_slaves[] = {
+	&omap2430_l4_wkup__gpio4,
+};
+
+static struct omap_hwmod omap2430_gpio4_hwmod = {
+	.name		= "gpio4",
+	.mpu_irqs	= omap243x_gpio4_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(omap243x_gpio4_irqs),
+	.main_clk	= "gpios_fck",
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP24XX_EN_GPIOS_SHIFT,
+			.module_offs = WKUP_MOD,
+			.idlest_reg_id = 1,
+			.idlest_idle_bit = OMAP24XX_EN_GPIOS_SHIFT,
+		},
+	},
+	.slaves		= omap2430_gpio4_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap2430_gpio4_slaves),
+	.class		= &omap243x_gpio_hwmod_class,
+	.dev_attr	= &gpio_dev_attr,
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
+};
+
+/* GPIO5 */
+
+static struct omap_hwmod_irq_info omap243x_gpio5_irqs[] = {
+	{ .name = "gpio_mpu_irq", .irq = INT_24XX_GPIO_BANK5 },
+};
+
+static struct omap_hwmod_ocp_if *omap2430_gpio5_slaves[] = {
+	&omap2430_l4_core__gpio5,
+};
+
+static struct omap_hwmod omap2430_gpio5_hwmod = {
+	.name		= "gpio5",
+	.mpu_irqs	= omap243x_gpio5_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(omap243x_gpio5_irqs),
+	.main_clk	= "gpio5_fck",
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP2430_ST_GPIO5_SHIFT,
+			.module_offs = CORE_MOD,
+			.idlest_reg_id = 1,
+			.idlest_idle_bit = OMAP2430_ST_GPIO5_SHIFT,
+		},
+	},
+	.slaves		= omap2430_gpio5_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap2430_gpio5_slaves),
+	.class		= &omap243x_gpio_hwmod_class,
+	.dev_attr	= &gpio_dev_attr,
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
+};
+
 static __initdata struct omap_hwmod *omap2430_hwmods[] = {
 	&omap2430_l3_hwmod,
 	&omap2430_l4_core_hwmod,
 	&omap2430_l4_wkup_hwmod,
 	&omap2430_mpu_hwmod,
+	&omap2430_gpio1_hwmod,
+	&omap2430_gpio2_hwmod,
+	&omap2430_gpio3_hwmod,
+	&omap2430_gpio4_hwmod,
+	&omap2430_gpio5_hwmod,
 	NULL,
 };
 
Signature · 1 line
1.6.3.3
#10 lore raw

PATCH v3 10/13 OMAP: GPIO: Add gpio dev_attr and correct clks in OMAP4 hwmod struct

From: Charulatha V <[email protected]>

This patch adds gpio_dev_attr to OMAP4 gpio hwmod structure. This patch also corrects the gpio .main_clk and .clk fields in gpio hwmod structures.

---
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   37 +++++++++++++++++++---------
 1 files changed, 25 insertions(+), 12 deletions(-)
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +25 -12
index 20f5f8c..b4c0878 100644
@@ -22,6 +22,7 @@
 
 #include <plat/omap_hwmod.h>
 #include <plat/cpu.h>
+#include <plat/gpio.h>
 
 #include "omap_hwmod_common_data.h"
 
@@ -1272,6 +1273,12 @@ static struct omap_hwmod omap44xx_fdif_hwmod = {
  * general purpose io module
  */
 
+static struct omap_gpio_dev_attr gpio_dev_attr = {
+	.gpio_bank_count = 6,
+	.gpio_bank_bits = 32,
+	.dbck_flag = true,
+};
+
 static struct omap_hwmod_class_sysconfig omap44xx_gpio_sysc = {
 	.rev_offs	= 0x0000,
 	.sysc_offs	= 0x0010,
@@ -1305,7 +1312,7 @@ static struct omap_hwmod_addr_space omap44xx_gpio1_addrs[] = {
 static struct omap_hwmod_ocp_if omap44xx_l4_wkup__gpio1 = {
 	.master		= &omap44xx_l4_wkup_hwmod,
 	.slave		= &omap44xx_gpio1_hwmod,
-	.clk		= "l4_wkup_clk_mux_ck",
+	.clk		= "gpio1_ick",
 	.addr		= omap44xx_gpio1_addrs,
 	.addr_cnt	= ARRAY_SIZE(omap44xx_gpio1_addrs),
 	.user		= OCP_USER_MPU | OCP_USER_SDMA,
@@ -1325,7 +1332,7 @@ static struct omap_hwmod omap44xx_gpio1_hwmod = {
 	.class		= &omap44xx_gpio_hwmod_class,
 	.mpu_irqs	= omap44xx_gpio1_irqs,
 	.mpu_irqs_cnt	= ARRAY_SIZE(omap44xx_gpio1_irqs),
-	.main_clk	= "gpio1_ick",
+	.main_clk	= NULL,
 	.prcm = {
 		.omap4 = {
 			.clkctrl_reg = OMAP4430_CM_WKUP_GPIO1_CLKCTRL,
@@ -1333,6 +1340,7 @@ static struct omap_hwmod omap44xx_gpio1_hwmod = {
 	},
 	.opt_clks	= gpio1_opt_clks,
 	.opt_clks_cnt = ARRAY_SIZE(gpio1_opt_clks),
+	.dev_attr	= &gpio_dev_attr,
 	.slaves		= omap44xx_gpio1_slaves,
 	.slaves_cnt	= ARRAY_SIZE(omap44xx_gpio1_slaves),
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
@@ -1356,7 +1364,7 @@ static struct omap_hwmod_addr_space omap44xx_gpio2_addrs[] = {
 static struct omap_hwmod_ocp_if omap44xx_l4_per__gpio2 = {
 	.master		= &omap44xx_l4_per_hwmod,
 	.slave		= &omap44xx_gpio2_hwmod,
-	.clk		= "l4_div_ck",
+	.clk		= "gpio2_ick",
 	.addr		= omap44xx_gpio2_addrs,
 	.addr_cnt	= ARRAY_SIZE(omap44xx_gpio2_addrs),
 	.user		= OCP_USER_MPU | OCP_USER_SDMA,
@@ -1376,7 +1384,7 @@ static struct omap_hwmod omap44xx_gpio2_hwmod = {
 	.class		= &omap44xx_gpio_hwmod_class,
 	.mpu_irqs	= omap44xx_gpio2_irqs,
 	.mpu_irqs_cnt	= ARRAY_SIZE(omap44xx_gpio2_irqs),
-	.main_clk	= "gpio2_ick",
+	.main_clk	= NULL,
 	.prcm = {
 		.omap4 = {
 			.clkctrl_reg = OMAP4430_CM_L4PER_GPIO2_CLKCTRL,
@@ -1384,6 +1392,7 @@ static struct omap_hwmod omap44xx_gpio2_hwmod = {
 	},
 	.opt_clks	= gpio2_opt_clks,
 	.opt_clks_cnt = ARRAY_SIZE(gpio2_opt_clks),
+	.dev_attr	= &gpio_dev_attr,
 	.slaves		= omap44xx_gpio2_slaves,
 	.slaves_cnt	= ARRAY_SIZE(omap44xx_gpio2_slaves),
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
@@ -1407,7 +1416,7 @@ static struct omap_hwmod_addr_space omap44xx_gpio3_addrs[] = {
 static struct omap_hwmod_ocp_if omap44xx_l4_per__gpio3 = {
 	.master		= &omap44xx_l4_per_hwmod,
 	.slave		= &omap44xx_gpio3_hwmod,
-	.clk		= "l4_div_ck",
+	.clk		= "gpio3_ick",
 	.addr		= omap44xx_gpio3_addrs,
 	.addr_cnt	= ARRAY_SIZE(omap44xx_gpio3_addrs),
 	.user		= OCP_USER_MPU | OCP_USER_SDMA,
@@ -1427,7 +1436,7 @@ static struct omap_hwmod omap44xx_gpio3_hwmod = {
 	.class		= &omap44xx_gpio_hwmod_class,
 	.mpu_irqs	= omap44xx_gpio3_irqs,
 	.mpu_irqs_cnt	= ARRAY_SIZE(omap44xx_gpio3_irqs),
-	.main_clk	= "gpio3_ick",
+	.main_clk	= NULL,
 	.prcm = {
 		.omap4 = {
 			.clkctrl_reg = OMAP4430_CM_L4PER_GPIO3_CLKCTRL,
@@ -1435,6 +1444,7 @@ static struct omap_hwmod omap44xx_gpio3_hwmod = {
 	},
 	.opt_clks	= gpio3_opt_clks,
 	.opt_clks_cnt = ARRAY_SIZE(gpio3_opt_clks),
+	.dev_attr	= &gpio_dev_attr,
 	.slaves		= omap44xx_gpio3_slaves,
 	.slaves_cnt	= ARRAY_SIZE(omap44xx_gpio3_slaves),
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
@@ -1458,7 +1468,7 @@ static struct omap_hwmod_addr_space omap44xx_gpio4_addrs[] = {
 static struct omap_hwmod_ocp_if omap44xx_l4_per__gpio4 = {
 	.master		= &omap44xx_l4_per_hwmod,
 	.slave		= &omap44xx_gpio4_hwmod,
-	.clk		= "l4_div_ck",
+	.clk		= "gpio4_ick",
 	.addr		= omap44xx_gpio4_addrs,
 	.addr_cnt	= ARRAY_SIZE(omap44xx_gpio4_addrs),
 	.user		= OCP_USER_MPU | OCP_USER_SDMA,
@@ -1478,7 +1488,7 @@ static struct omap_hwmod omap44xx_gpio4_hwmod = {
 	.class		= &omap44xx_gpio_hwmod_class,
 	.mpu_irqs	= omap44xx_gpio4_irqs,
 	.mpu_irqs_cnt	= ARRAY_SIZE(omap44xx_gpio4_irqs),
-	.main_clk	= "gpio4_ick",
+	.main_clk	= NULL,
 	.prcm = {
 		.omap4 = {
 			.clkctrl_reg = OMAP4430_CM_L4PER_GPIO4_CLKCTRL,
@@ -1486,6 +1496,7 @@ static struct omap_hwmod omap44xx_gpio4_hwmod = {
 	},
 	.opt_clks	= gpio4_opt_clks,
 	.opt_clks_cnt = ARRAY_SIZE(gpio4_opt_clks),
+	.dev_attr	= &gpio_dev_attr,
 	.slaves		= omap44xx_gpio4_slaves,
 	.slaves_cnt	= ARRAY_SIZE(omap44xx_gpio4_slaves),
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
@@ -1509,7 +1520,7 @@ static struct omap_hwmod_addr_space omap44xx_gpio5_addrs[] = {
 static struct omap_hwmod_ocp_if omap44xx_l4_per__gpio5 = {
 	.master		= &omap44xx_l4_per_hwmod,
 	.slave		= &omap44xx_gpio5_hwmod,
-	.clk		= "l4_div_ck",
+	.clk		= "gpio5_ick",
 	.addr		= omap44xx_gpio5_addrs,
 	.addr_cnt	= ARRAY_SIZE(omap44xx_gpio5_addrs),
 	.user		= OCP_USER_MPU | OCP_USER_SDMA,
@@ -1529,7 +1540,7 @@ static struct omap_hwmod omap44xx_gpio5_hwmod = {
 	.class		= &omap44xx_gpio_hwmod_class,
 	.mpu_irqs	= omap44xx_gpio5_irqs,
 	.mpu_irqs_cnt	= ARRAY_SIZE(omap44xx_gpio5_irqs),
-	.main_clk	= "gpio5_ick",
+	.main_clk	= NULL,
 	.prcm = {
 		.omap4 = {
 			.clkctrl_reg = OMAP4430_CM_L4PER_GPIO5_CLKCTRL,
@@ -1537,6 +1548,7 @@ static struct omap_hwmod omap44xx_gpio5_hwmod = {
 	},
 	.opt_clks	= gpio5_opt_clks,
 	.opt_clks_cnt = ARRAY_SIZE(gpio5_opt_clks),
+	.dev_attr	= &gpio_dev_attr,
 	.slaves		= omap44xx_gpio5_slaves,
 	.slaves_cnt	= ARRAY_SIZE(omap44xx_gpio5_slaves),
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
@@ -1560,7 +1572,7 @@ static struct omap_hwmod_addr_space omap44xx_gpio6_addrs[] = {
 static struct omap_hwmod_ocp_if omap44xx_l4_per__gpio6 = {
 	.master		= &omap44xx_l4_per_hwmod,
 	.slave		= &omap44xx_gpio6_hwmod,
-	.clk		= "l4_div_ck",
+	.clk		= "gpio6_ick",
 	.addr		= omap44xx_gpio6_addrs,
 	.addr_cnt	= ARRAY_SIZE(omap44xx_gpio6_addrs),
 	.user		= OCP_USER_MPU | OCP_USER_SDMA,
@@ -1580,7 +1592,7 @@ static struct omap_hwmod omap44xx_gpio6_hwmod = {
 	.class		= &omap44xx_gpio_hwmod_class,
 	.mpu_irqs	= omap44xx_gpio6_irqs,
 	.mpu_irqs_cnt	= ARRAY_SIZE(omap44xx_gpio6_irqs),
-	.main_clk	= "gpio6_ick",
+	.main_clk	= NULL,
 	.prcm = {
 		.omap4 = {
 			.clkctrl_reg = OMAP4430_CM_L4PER_GPIO6_CLKCTRL,
@@ -1588,6 +1600,7 @@ static struct omap_hwmod omap44xx_gpio6_hwmod = {
 	},
 	.opt_clks	= gpio6_opt_clks,
 	.opt_clks_cnt = ARRAY_SIZE(gpio6_opt_clks),
+	.dev_attr	= &gpio_dev_attr,
 	.slaves		= omap44xx_gpio6_slaves,
 	.slaves_cnt	= ARRAY_SIZE(omap44xx_gpio6_slaves),
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP4430),
Signature · 1 line
1.6.3.3
#11 lore raw

PATCH v3 11/13 OMAP: GPIO: Introduce support for OMAP2PLUS chip GPIO init

From: Charulatha V <[email protected]>

This patch adds support for handling GPIO as a HWMOD FW adapted platform device for OMAP2PLUS chips.

gpio_init needs to be done before machine_init functions access gpio APIs. Hence gpio_init is made as a postcore_initcall.

---
 arch/arm/mach-omap2/gpio.c |  104 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 104 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap2/gpio.c
arch/arm/mach-omap2/gpio.c new file +104 -0
new file mode 100644
index 0000000..993995a
@@ -0,0 +1,104 @@
+/*
+ * gpio.c - OMAP2PLUS-specific gpio code
+ *
+ * Copyright (C) 2010 Texas Instruments, Inc.
+ *
+ * Author:
+ *	Charulatha V <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/gpio.h>
+#include <linux/err.h>
+#include <linux/slab.h>
+
+#include <plat/omap_hwmod.h>
+#include <plat/omap_device.h>
+
+static struct omap_device_pm_latency omap_gpio_latency[] = {
+	[0] = {
+		.deactivate_func = omap_device_idle_hwmods,
+		.activate_func   = omap_device_enable_hwmods,
+		.flags		 = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
+	},
+};
+
+static int omap2_init_gpio(struct omap_hwmod *oh, void *user)
+{
+	struct omap_device *od;
+	struct omap_gpio_platform_data *pdata;
+	char *name = "omap-gpio";
+	static int id;
+	struct omap_gpio_dev_attr *gpio_dev_data;
+
+	if (!oh)
+		pr_err("Could not look up omap gpio %d\n", id + 1);
+
+	pdata = kzalloc(sizeof(struct omap_gpio_platform_data),
+					GFP_KERNEL);
+	if (!pdata) {
+		pr_err("Memory allocation failed gpio%d\n", id + 1);
+		return -ENOMEM;
+	}
+
+	gpio_dev_data = (struct omap_gpio_dev_attr *)oh->dev_attr;
+	pdata->gpio_attr = gpio_dev_data;
+	pdata->method = (int)user;
+	pdata->virtual_irq_start = IH_GPIO_BASE + 32 * id;
+
+	od = omap_device_build(name, id, oh, pdata,
+				sizeof(*pdata),	omap_gpio_latency,
+				ARRAY_SIZE(omap_gpio_latency),
+				false);
+	WARN(IS_ERR(od), "Cant build omap_device for %s:%s.\n",
+				name, oh->name);
+
+	id++;
+	return 0;
+}
+
+static int __init gpio_init(int method)
+{
+	return omap_hwmod_for_each_by_class("gpio", omap2_init_gpio,
+						(void *)method);
+}
+
+/*
+ * gpio_init needs to be done before
+ * machine_init functions access gpio APIs.
+ * Hence gpio_init is a postcore_initcall.
+ */
+#ifdef CONFIG_ARCH_OMAP2
+static int __init omap24xx_gpio_init(void)
+{	if (!cpu_is_omap24xx())
+		return -EINVAL;
+
+	return gpio_init(METHOD_GPIO_24XX);
+}
+postcore_initcall(omap24xx_gpio_init);
+#endif
+
+#ifdef CONFIG_ARCH_OMAP3
+static int __init omap3xxx_gpio_init(void)
+{
+	if (!cpu_is_omap34xx())
+		return -EINVAL;
+
+	return gpio_init(METHOD_GPIO_24XX);
+}
+postcore_initcall(omap3xxx_gpio_init);
+#endif
+
+#ifdef CONFIG_ARCH_OMAP4
+static int __init omap44xx_gpio_init(void)
+{
+	if (!cpu_is_omap44xx())
+		return -EINVAL;
+
+	return gpio_init(METHOD_GPIO_44XX);
+}
+postcore_initcall(omap44xx_gpio_init);
+#endif
Signature · 1 line
1.6.3.3
#12 lore raw

PATCH v3 12/13 OMAP: GPIO: Implement GPIO as a platform device

From: Charulatha V <[email protected]>

This patch implements GPIO as a platform device. Also it implements OMAP2PLUS specific GPIO as HWMOD FW adapted device. OMAP2PLUS GPIO uses runtime APIs.

GPIO APIs are used in machine_init functions. Hence it is required to complete GPIO probe before machine_init. Therefore GPIO device register and driver register are implemented as postcore_initcalls.

Inorder to convert GPIO as platform device, modifications are required in clockxxxx_data.c file for OMAP1 so that device names can be used to obtain clock instead of getting clocks by name/NULL ptr.

omap_gpio_init() does nothing now and this function would be removed in the next patch as it's usage is spread across most of the board files.

---
 arch/arm/mach-omap1/Makefile     |    6 +
 arch/arm/mach-omap1/clock_data.c |    4 +-
 arch/arm/mach-omap2/Makefile     |    2 +-
 arch/arm/plat-omap/gpio.c        |  425 ++++++++++----------------------------
 4 files changed, 120 insertions(+), 317 deletions(-)
arch/arm/mach-omap1/Makefile +6 -0
index ea231c7..88f0905 100644
@@ -46,6 +46,12 @@ ifeq ($(CONFIG_ARCH_OMAP15XX),y)
 obj-$(CONFIG_MACH_OMAP_INNOVATOR)	+= fpga.o
 endif
 
+# GPIO
+obj-$(CONFIG_ARCH_OMAP730)		+= gpio7xx.o
+obj-$(CONFIG_ARCH_OMAP850)		+= gpio7xx.o
+obj-$(CONFIG_ARCH_OMAP15XX)		+= gpio15xx.o
+obj-$(CONFIG_ARCH_OMAP16XX)		+= gpio16xx.o
+
 # LEDs support
 led-$(CONFIG_MACH_OMAP_H2)		+= leds-h2p2-debug.o
 led-$(CONFIG_MACH_OMAP_H3)		+= leds-h2p2-debug.o
arch/arm/mach-omap1/clock_data.c +2 -2
index aa8558a..5c2a0a1 100644
@@ -99,7 +99,7 @@ static struct arm_idlect1_clk armper_ck = {
  * activation.  [ GPIO code for 1510 ]
  */
 static struct clk arm_gpio_ck = {
-	.name		= "arm_gpio_ck",
+	.name		= "ick",
 	.ops		= &clkops_generic,
 	.parent		= &ck_dpll1,
 	.flags		= ENABLE_ON_INIT,
@@ -589,7 +589,7 @@ static struct omap_clk omap_clks[] = {
 	CLK(NULL,	"ck_sossi",	&sossi_ck,	CK_16XX),
 	CLK(NULL,	"arm_ck",	&arm_ck,	CK_16XX | CK_1510 | CK_310),
 	CLK(NULL,	"armper_ck",	&armper_ck.clk,	CK_16XX | CK_1510 | CK_310),
-	CLK(NULL,	"arm_gpio_ck",	&arm_gpio_ck,	CK_1510 | CK_310),
+	CLK("omap-gpio.0", "ick", &arm_gpio_ck,	CK_1510 | CK_310),
 	CLK(NULL,	"armxor_ck",	&armxor_ck.clk,	CK_16XX | CK_1510 | CK_310 | CK_7XX),
 	CLK(NULL,	"armtim_ck",	&armtim_ck.clk,	CK_16XX | CK_1510 | CK_310),
 	CLK("omap_wdt",	"fck",		&armwdt_ck.clk,	CK_16XX | CK_1510 | CK_310),
arch/arm/mach-omap2/Makefile +1 -1
index ae5f36f..0756b84 100644
@@ -3,7 +3,7 @@
 #
 
 # Common support
-obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o
+obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o gpio.o
 
 omap-2-3-common				= irq.o sdrc.o
 hwmod-common				= omap_hwmod.o \
arch/arm/plat-omap/gpio.c +111 -314

575 lines not on this page · raw message

Signature · 1 line
1.6.3.3
#13 lore raw

PATCH v3 13/13 OMAP: GPIO: Remove omap_gpio_init()

From: Charulatha V <[email protected]>

This patch removes the usage of omap_gpio_init() from all omap board files since omap_gpio_init() does nothing, after gpio is implemented as a platform device.

---
 arch/arm/mach-omap1/board-ams-delta.c      |    1 -
 arch/arm/mach-omap1/board-fsample.c        |    1 -
 arch/arm/mach-omap1/board-h2.c             |    1 -
 arch/arm/mach-omap1/board-h3.c             |    1 -
 arch/arm/mach-omap1/board-htcherald.c      |    1 -
 arch/arm/mach-omap1/board-innovator.c      |    1 -
 arch/arm/mach-omap1/board-nokia770.c       |    1 -
 arch/arm/mach-omap1/board-osk.c            |    1 -
 arch/arm/mach-omap1/board-palmte.c         |    1 -
 arch/arm/mach-omap1/board-palmz71.c        |    1 -
 arch/arm/mach-omap1/board-perseus2.c       |    1 -
 arch/arm/mach-omap1/board-sx1.c            |    1 -
 arch/arm/mach-omap1/board-voiceblue.c      |    1 -
 arch/arm/mach-omap2/board-2430sdp.c        |    1 -
 arch/arm/mach-omap2/board-3430sdp.c        |    1 -
 arch/arm/mach-omap2/board-3630sdp.c        |    1 -
 arch/arm/mach-omap2/board-4430sdp.c        |    1 -
 arch/arm/mach-omap2/board-am3517evm.c      |    1 -
 arch/arm/mach-omap2/board-apollon.c        |    1 -
 arch/arm/mach-omap2/board-cm-t35.c         |    1 -
 arch/arm/mach-omap2/board-devkit8000.c     |    1 -
 arch/arm/mach-omap2/board-h4.c             |    1 -
 arch/arm/mach-omap2/board-igep0020.c       |    1 -
 arch/arm/mach-omap2/board-ldp.c            |    1 -
 arch/arm/mach-omap2/board-n8x0.c           |    1 -
 arch/arm/mach-omap2/board-omap3beagle.c    |    1 -
 arch/arm/mach-omap2/board-omap3evm.c       |    1 -
 arch/arm/mach-omap2/board-omap3pandora.c   |    1 -
 arch/arm/mach-omap2/board-omap3stalker.c   |    1 -
 arch/arm/mach-omap2/board-omap3touchbook.c |    1 -
 arch/arm/mach-omap2/board-overo.c          |    1 -
 arch/arm/mach-omap2/board-rx51.c           |    1 -
 arch/arm/mach-omap2/board-zoom2.c          |    1 -
 arch/arm/mach-omap2/board-zoom3.c          |    1 -
 arch/arm/plat-omap/gpio.c                  |    6 ------
 arch/arm/plat-omap/include/plat/gpio.h     |    1 -
 36 files changed, 0 insertions(+), 41 deletions(-)
arch/arm/mach-omap1/board-ams-delta.c +0 -1
index fdd1dd5..75d1bd0 100644
@@ -136,7 +136,6 @@ static void __init ams_delta_init_irq(void)
 {
 	omap1_init_common_hw();
 	omap_init_irq();
-	omap_gpio_init();
 }
 
 static struct map_desc ams_delta_io_desc[] __initdata = {
arch/arm/mach-omap1/board-fsample.c +0 -1
index 096f2ed..8d9d6e8 100644
@@ -313,7 +313,6 @@ static void __init omap_fsample_init_irq(void)
 {
 	omap1_init_common_hw();
 	omap_init_irq();
-	omap_gpio_init();
 	fsample_init_smc91x();
 }
 
arch/arm/mach-omap1/board-h2.c +0 -1
index d1100e4..dd04ef5 100644
@@ -383,7 +383,6 @@ static void __init h2_init_irq(void)
 {
 	omap1_init_common_hw();
 	omap_init_irq();
-	omap_gpio_init();
 	h2_init_smc91x();
 }
 
arch/arm/mach-omap1/board-h3.c +0 -1
index a53ab82..ac8af4b 100644
@@ -422,7 +422,6 @@ static void __init h3_init_irq(void)
 {
 	omap1_init_common_hw();
 	omap_init_irq();
-	omap_gpio_init();
 	h3_init_smc91x();
 }
 
arch/arm/mach-omap1/board-htcherald.c +0 -1
index 8e313b4..6ff6f30 100644
@@ -278,7 +278,6 @@ static void __init htcherald_init(void)
 {
 	printk(KERN_INFO "HTC Herald init.\n");
 
-	omap_gpio_init();
 
 	omap_board_config = htcherald_config;
 	omap_board_config_size = ARRAY_SIZE(htcherald_config);
arch/arm/mach-omap1/board-innovator.c +0 -1
index 5d12fd3..28bb2cd 100644
@@ -290,7 +290,6 @@ static void __init innovator_init_irq(void)
 {
 	omap1_init_common_hw();
 	omap_init_irq();
-	omap_gpio_init();
 #ifdef CONFIG_ARCH_OMAP15XX
 	if (cpu_is_omap1510()) {
 		omap1510_fpga_init_irq();
arch/arm/mach-omap1/board-nokia770.c +0 -1
index 71e1a3f..6ea838c 100644
@@ -379,7 +379,6 @@ static void __init omap_nokia770_init(void)
 	platform_add_devices(nokia770_devices, ARRAY_SIZE(nokia770_devices));
 	spi_register_board_info(nokia770_spi_board_info,
 				ARRAY_SIZE(nokia770_spi_board_info));
-	omap_gpio_init();
 	omap_serial_init();
 	omap_register_i2c_bus(1, 100, NULL, 0);
 	omap_dsp_init();
arch/arm/mach-omap1/board-osk.c +0 -1
index 80d8620..2db7712 100644
@@ -283,7 +283,6 @@ static void __init osk_init_irq(void)
 {
 	omap1_init_common_hw();
 	omap_init_irq();
-	omap_gpio_init();
 	osk_init_smc91x();
 	osk_init_cf();
 }
arch/arm/mach-omap1/board-palmte.c +0 -1
index 569b4c9..3864eab 100644
@@ -63,7 +63,6 @@ static void __init omap_palmte_init_irq(void)
 {
 	omap1_init_common_hw();
 	omap_init_irq();
-	omap_gpio_init();
 }
 
 static const int palmte_keymap[] = {
arch/arm/mach-omap1/board-palmz71.c +0 -1
index 6641de9..8e3174d 100644
@@ -62,7 +62,6 @@ omap_palmz71_init_irq(void)
 {
 	omap1_init_common_hw();
 	omap_init_irq();
-	omap_gpio_init();
 }
 
 static int palmz71_keymap[] = {
arch/arm/mach-omap1/board-perseus2.c +0 -1
index e854d57..d9f1ce7 100644
@@ -281,7 +281,6 @@ static void __init omap_perseus2_init_irq(void)
 {
 	omap1_init_common_hw();
 	omap_init_irq();
-	omap_gpio_init();
 	perseus2_init_smc91x();
 }
 /* Only FPGA needs to be mapped here. All others are done with ioremap */
arch/arm/mach-omap1/board-sx1.c +0 -1
index 2fb1e5f..f19e32c 100644
@@ -409,7 +409,6 @@ static void __init omap_sx1_init_irq(void)
 {
 	omap1_init_common_hw();
 	omap_init_irq();
-	omap_gpio_init();
 }
 /*----------------------------------------*/
 
arch/arm/mach-omap1/board-voiceblue.c +0 -1
index 87b9436..df5e975 100644
@@ -158,7 +158,6 @@ static void __init voiceblue_init_irq(void)
 {
 	omap1_init_common_hw();
 	omap_init_irq();
-	omap_gpio_init();
 }
 
 static void __init voiceblue_init(void)
arch/arm/mach-omap2/board-2430sdp.c +0 -1
index a11a575..07a75d2 100644
@@ -148,7 +148,6 @@ static void __init omap_2430sdp_init_irq(void)
 	omap_board_config_size = ARRAY_SIZE(sdp2430_config);
 	omap2_init_common_hw(NULL, NULL);
 	omap_init_irq();
-	omap_gpio_init();
 }
 
 static struct twl4030_gpio_platform_data sdp2430_gpio_data = {
arch/arm/mach-omap2/board-3430sdp.c +0 -1
index f474a80..abc4d28 100644
@@ -328,7 +328,6 @@ static void __init omap_3430sdp_init_irq(void)
 	omap3_pm_init_cpuidle(omap3_cpuidle_params_table);
 	omap2_init_common_hw(hyb18m512160af6_sdrc_params, NULL);
 	omap_init_irq();
-	omap_gpio_init();
 }
 
 static int sdp3430_batt_table[] = {
arch/arm/mach-omap2/board-3630sdp.c +0 -1
index 504d2bd..3a47578 100644
@@ -82,7 +82,6 @@ static void __init omap_sdp_init_irq(void)
 	omap2_init_common_hw(h8mbx00u0mer0em_sdrc_params,
 			h8mbx00u0mer0em_sdrc_params);
 	omap_init_irq();
-	omap_gpio_init();
 }
 
 #ifdef CONFIG_OMAP_MUX
arch/arm/mach-omap2/board-4430sdp.c +0 -1
index e4a5d66..0094cfb 100644
@@ -131,7 +131,6 @@ static void __init omap_4430sdp_init_irq(void)
 	omap2_gp_clockevent_set_gptimer(1);
 #endif
 	gic_init_irq();
-	omap_gpio_init();
 }
 
 static struct omap_musb_board_data musb_board_data = {
arch/arm/mach-omap2/board-am3517evm.c +0 -1
index af383a8..abf2703 100644
@@ -372,7 +372,6 @@ static void __init am3517_evm_init_irq(void)
 
 	omap2_init_common_hw(NULL, NULL);
 	omap_init_irq();
-	omap_gpio_init();
 }
 
 static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
arch/arm/mach-omap2/board-apollon.c +0 -1
index aa69fb9..269cd73 100644
@@ -279,7 +279,6 @@ static void __init omap_apollon_init_irq(void)
 	omap_board_config_size = ARRAY_SIZE(apollon_config);
 	omap2_init_common_hw(NULL, NULL);
 	omap_init_irq();
-	omap_gpio_init();
 	apollon_init_smc91x();
 }
 
arch/arm/mach-omap2/board-cm-t35.c +0 -1
index e679a2c..af6d039 100644
@@ -705,7 +705,6 @@ static void __init cm_t35_init_irq(void)
 	omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
 			     mt46h32m32lf6_sdrc_params);
 	omap_init_irq();
-	omap_gpio_init();
 }
 
 static void __init cm_t35_map_io(void)
arch/arm/mach-omap2/board-devkit8000.c +0 -1
index 77022b5..55addbc 100644
@@ -472,7 +472,6 @@ static void __init devkit8000_init_irq(void)
 #ifdef CONFIG_OMAP_32K_TIMER
 	omap2_gp_clockevent_set_gptimer(12);
 #endif
-	omap_gpio_init();
 }
 
 static void __init devkit8000_ads7846_init(void)
arch/arm/mach-omap2/board-h4.c +0 -1
index 0665f2c..bd4e4ef 100644
@@ -314,7 +314,6 @@ static void __init omap_h4_init_irq(void)
 	omap_board_config_size = ARRAY_SIZE(h4_config);
 	omap2_init_common_hw(NULL, NULL);
 	omap_init_irq();
-	omap_gpio_init();
 	h4_init_flash();
 }
 
arch/arm/mach-omap2/board-igep0020.c +0 -1
index d55c57b..0e004cb 100644
@@ -406,7 +406,6 @@ static void __init igep2_init_irq(void)
 	omap_board_config_size = ARRAY_SIZE(igep2_config);
 	omap2_init_common_hw(m65kxxxxam_sdrc_params, m65kxxxxam_sdrc_params);
 	omap_init_irq();
-	omap_gpio_init();
 }
 
 static struct twl4030_codec_audio_data igep2_audio_data = {
arch/arm/mach-omap2/board-ldp.c +0 -1
index fefd7e6..f60cda8 100644
@@ -291,7 +291,6 @@ static void __init omap_ldp_init_irq(void)
 	omap_board_config_size = ARRAY_SIZE(ldp_config);
 	omap2_init_common_hw(NULL, NULL);
 	omap_init_irq();
-	omap_gpio_init();
 	ldp_init_smsc911x();
 }
 
arch/arm/mach-omap2/board-n8x0.c +0 -1
index 3ccc34e..8efaacd 100644
@@ -646,7 +646,6 @@ static void __init n8x0_init_irq(void)
 {
 	omap2_init_common_hw(NULL, NULL);
 	omap_init_irq();
-	omap_gpio_init();
 }
 
 static void __init n8x0_init_machine(void)
arch/arm/mach-omap2/board-omap3beagle.c +0 -1
index 69b154c..19da4fa 100644
@@ -410,7 +410,6 @@ static void __init omap3_beagle_init_irq(void)
 #ifdef CONFIG_OMAP_32K_TIMER
 	omap2_gp_clockevent_set_gptimer(12);
 #endif
-	omap_gpio_init();
 }
 
 static struct platform_device *omap3_beagle_devices[] __initdata = {
arch/arm/mach-omap2/board-omap3evm.c +0 -1
index b952610..f67e611 100644
@@ -627,7 +627,6 @@ static void __init omap3_evm_init_irq(void)
 	omap_board_config_size = ARRAY_SIZE(omap3_evm_config);
 	omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL);
 	omap_init_irq();
-	omap_gpio_init();
 }
 
 static struct platform_device *omap3_evm_devices[] __initdata = {
arch/arm/mach-omap2/board-omap3pandora.c +0 -1
index db06dc9..ef415e3 100644
@@ -536,7 +536,6 @@ static void __init omap3pandora_init_irq(void)
 	omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
 			     mt46h32m32lf6_sdrc_params);
 	omap_init_irq();
-	omap_gpio_init();
 }
 
 static struct platform_device *omap3pandora_devices[] __initdata = {
arch/arm/mach-omap2/board-omap3stalker.c +0 -1
index a04cffd..bccf466 100644
@@ -588,7 +588,6 @@ static void __init omap3_stalker_init_irq(void)
 #ifdef CONFIG_OMAP_32K_TIMER
 	omap2_gp_clockevent_set_gptimer(12);
 #endif
-	omap_gpio_init();
 }
 
 static struct platform_device *omap3_stalker_devices[] __initdata = {
arch/arm/mach-omap2/board-omap3touchbook.c +0 -1
index 2f5f823..252aaed 100644
@@ -444,7 +444,6 @@ static void __init omap3_touchbook_init_irq(void)
 #ifdef CONFIG_OMAP_32K_TIMER
 	omap2_gp_clockevent_set_gptimer(12);
 #endif
-	omap_gpio_init();
 }
 
 static struct platform_device *omap3_touchbook_devices[] __initdata = {
arch/arm/mach-omap2/board-overo.c +0 -1
index 79ac414..6fa95e5 100644
@@ -399,7 +399,6 @@ static void __init overo_init_irq(void)
 	omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
 			     mt46h32m32lf6_sdrc_params);
 	omap_init_irq();
-	omap_gpio_init();
 }
 
 static struct platform_device *overo_devices[] __initdata = {
arch/arm/mach-omap2/board-rx51.c +0 -1
index 1b86b5b..4e9b749 100644
@@ -108,7 +108,6 @@ static void __init rx51_init_irq(void)
 	sdrc_params = rx51_get_sdram_timings();
 	omap2_init_common_hw(sdrc_params, sdrc_params);
 	omap_init_irq();
-	omap_gpio_init();
 }
 
 extern void __init rx51_peripherals_init(void);
arch/arm/mach-omap2/board-zoom2.c +0 -1
index 803ef14..67bee0a 100644
@@ -31,7 +31,6 @@ static void __init omap_zoom2_init_irq(void)
 	omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
 				 mt46h32m32lf6_sdrc_params);
 	omap_init_irq();
-	omap_gpio_init();
 }
 
 /* REVISIT: These audio entries can be removed once MFD code is merged */
arch/arm/mach-omap2/board-zoom3.c +0 -1
index 3314704..4285d43 100644
@@ -41,7 +41,6 @@ static void __init omap_zoom_init_irq(void)
 	omap2_init_common_hw(h8mbx00u0mer0em_sdrc_params,
 			h8mbx00u0mer0em_sdrc_params);
 	omap_init_irq();
-	omap_gpio_init();
 }
 
 #ifdef CONFIG_OMAP_MUX
arch/arm/plat-omap/gpio.c +0 -6
index 81d8e2d..2acb309 100644
@@ -2116,12 +2116,6 @@ static int __init omap_gpio_drv_reg(void)
 }
 postcore_initcall(omap_gpio_drv_reg);
 
-/* TODO: Remove omap_gpio_init() and its usage from board files */
-int __init omap_gpio_init(void)
-{
-	return 0;
-}
-
 static int __init omap_gpio_sysinit(void)
 {
 	int ret = 0;
arch/arm/plat-omap/include/plat/gpio.h +0 -1
index fa5c05f..d91bb17 100644
@@ -92,7 +92,6 @@ struct omap_gpio_platform_data {
 	struct omap_gpio_dev_attr *gpio_attr;
 };
 
-extern int omap_gpio_init(void);	/* Call from board init only */
 extern void omap2_gpio_prepare_for_idle(int power_state);
 extern void omap2_gpio_resume_after_idle(void);
 extern void omap_set_gpio_debounce(int gpio, int enable);
Signature · 1 line
1.6.3.3
#14 lore raw

Re: [PATCH 12/13 v3] OMAP: GPIO: Implement GPIO as a platform device

In reply to Varadarajan, Charulatha
Quoted 23 lines · Charulatha

From: Charulatha V<[email protected]>

This patch implements GPIO as a platform device. Also it implements OMAP2PLUS specific GPIO as HWMOD FW adapted device. OMAP2PLUS GPIO uses runtime APIs.

GPIO APIs are used in machine_init functions. Hence it is required to complete GPIO probe before machine_init. Therefore GPIO device register and driver register are implemented as postcore_initcalls.

Inorder to convert GPIO as platform device, modifications are required in clockxxxx_data.c file for OMAP1 so that device names can be used to obtain clock instead of getting clocks by name/NULL ptr.

omap_gpio_init() does nothing now and this function would be removed in the next patch as it's usage is spread across most of the board files.

---

[snip]

arch/arm/plat-omap/gpio.c static void __init omap_gpio_show_rev(void) · line 1556

Quoted 4 lines
arch/arm/plat-omap/gpio.c +4 -0
+static inline int init_gpio_info(struct platform_device *pdev)
+{
+       gpio_bank = kzalloc(gpio_bank_count * sizeof(struct gpio_bank),
+                               GFP_KERNEL);

This is the real issue with the gpio_bank_count.

You are creating a global driver information related to all instances of this device with a per device variable. You should store the registers per device, and that will remove the need for that global information.

Benoit

#15 lore raw

RE: [PATCH 12/13 v3] OMAP: GPIO: Implement GPIO as a platform device

Quoted 11 lines

[snip]

arch/arm/plat-omap/gpio.c static void __init omap_gpio_show_rev(void) · line 1556

Quoted 4 lines
arch/arm/plat-omap/gpio.c +4 -0
+static inline int init_gpio_info(struct platform_device *pdev)
+{
+       gpio_bank = kzalloc(gpio_bank_count * sizeof(struct gpio_bank),
+                               GFP_KERNEL);

This is the real issue with the gpio_bank_count.

Quoted 4 lines

You are creating a global driver information related to all instances of this device with a per device variable.
You should store the registers per device, and that will remove the need for that global information.

Agreed. But "gpio_bank" can be removed only during cleanup, as this information is spread around the whole driver and the current gpio driver assumes it to be an array of all instances of the device.

For now, would modify the code to get gpio_bank_count using omap_hwmod_class() iteration count.

Until code cleanup is done, 'gpio_bank_count' would be given to driver by means of a global variable/ a function pointer to omap_get_gpio_count().

Quoted 2 lines

Benoit

#16 lore raw

Re: [PATCH 11/13 v3] OMAP: GPIO: Introduce support for OMAP2PLUS chip GPIO init

In reply to Varadarajan, Charulatha
Quoted 59 lines · Charulatha

From: Charulatha V<[email protected]>

This patch adds support for handling GPIO as a HWMOD FW adapted platform device for OMAP2PLUS chips.

gpio_init needs to be done before machine_init functions access gpio APIs. Hence gpio_init is made as a postcore_initcall.

---
  arch/arm/mach-omap2/gpio.c |  104 ++++++++++++++++++++++++++++++++++++++++++++
  1 files changed, 104 insertions(+), 0 deletions(-)

create mode 100644 arch/arm/mach-omap2/gpio.c

arch/arm/mach-omap2/gpio.c new file +39 -0
new file mode 100644
index 0000000..993995a
@@ -0,0 +1,104 @@
+/*
+ * gpio.c - OMAP2PLUS-specific gpio code
+ *
+ * Copyright (C) 2010 Texas Instruments, Inc.
+ *
+ * Author:
+ *	Charulatha V<[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include<linux/gpio.h>
+#include<linux/err.h>
+#include<linux/slab.h>
+
+#include<plat/omap_hwmod.h>
+#include<plat/omap_device.h>
+
+static struct omap_device_pm_latency omap_gpio_latency[] = {
+	[0] = {
+		.deactivate_func = omap_device_idle_hwmods,
+		.activate_func   = omap_device_enable_hwmods,
+		.flags		 = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
+	},
+};
+
+static int omap2_init_gpio(struct omap_hwmod *oh, void *user)
+{
+	struct omap_device *od;
+	struct omap_gpio_platform_data *pdata;
+	char *name = "omap-gpio";
+	static int id;
+	struct omap_gpio_dev_attr *gpio_dev_data;
+
+	if (!oh)
+		pr_err("Could not look up omap gpio %d\n", id + 1);
+

arch/arm/mach-omap2/gpio.c line 49

Quoted 10 lines
arch/arm/mach-omap2/gpio.c new file +10 -0
+	pdata = kzalloc(sizeof(struct omap_gpio_platform_data),
+					GFP_KERNEL);
+	if (!pdata) {
+		pr_err("Memory allocation failed gpio%d\n", id + 1);
+		return -ENOMEM;
+	}
+
+	gpio_dev_data = (struct omap_gpio_dev_attr *)oh->dev_attr;
+	pdata->gpio_attr = gpio_dev_data;
+	pdata->method = (int)user;

That method seems to be an IP version specific information and not a Soc specific one. You should store that in the hwmod dev_attr.

What does 'method' mean in that context? Maybe the name should be revisited?

Quoted 43 lines
arch/arm/mach-omap2/gpio.c new file +43 -0
+	pdata->virtual_irq_start = IH_GPIO_BASE + 32 * id;
+
+	od = omap_device_build(name, id, oh, pdata,
+				sizeof(*pdata),	omap_gpio_latency,
+				ARRAY_SIZE(omap_gpio_latency),
+				false);
+	WARN(IS_ERR(od), "Cant build omap_device for %s:%s.\n",
+				name, oh->name);
+
+	id++;
+	return 0;
+}
+
+static int __init gpio_init(int method)
+{
+	return omap_hwmod_for_each_by_class("gpio", omap2_init_gpio,
+						(void *)method);
+}
+
+/*
+ * gpio_init needs to be done before
+ * machine_init functions access gpio APIs.
+ * Hence gpio_init is a postcore_initcall.
+ */
+#ifdef CONFIG_ARCH_OMAP2
+static int __init omap24xx_gpio_init(void)
+{	if (!cpu_is_omap24xx())
+		return -EINVAL;
+
+	return gpio_init(METHOD_GPIO_24XX);
+}
+postcore_initcall(omap24xx_gpio_init);
+#endif
+
+#ifdef CONFIG_ARCH_OMAP3
+static int __init omap3xxx_gpio_init(void)
+{
+	if (!cpu_is_omap34xx())
+		return -EINVAL;
+
+	return gpio_init(METHOD_GPIO_24XX);
+}
+postcore_initcall(omap3xxx_gpio_init);

arch/arm/mach-omap2/gpio.c line 102

Quoted 10 lines
arch/arm/mach-omap2/gpio.c new file +10 -0
+#endif
+
+#ifdef CONFIG_ARCH_OMAP4
+static int __init omap44xx_gpio_init(void)
+{
+	if (!cpu_is_omap44xx())
+		return -EINVAL;
+
+	return gpio_init(METHOD_GPIO_44XX);
+}

You can avoid all this duplication of code by using the dev_attr instead of using a parameter.

Benoit

#17 lore raw

RE: [PATCH 11/13 v3] OMAP: GPIO: Introduce support for OMAP2PLUS chip GPIO init

Quoted 77 lines

-----Original Message-----
From: Cousson, Benoit
Sent: Tuesday, June 15, 2010 10:53 PM
To: Varadarajan, Charulatha
Cc: [email protected]; [email protected]; akpm@linux- foundation.org; [email protected]; [email protected]; Nayak, Rajendra; [email protected]; [email protected]
Subject: Re: [PATCH 11/13 v3] OMAP: GPIO: Introduce support for OMAP2PLUS chip GPIO init

Quoted 64 lines · Charulatha

From: Charulatha V<[email protected]>

This patch adds support for handling GPIO as a HWMOD FW adapted platform device for OMAP2PLUS chips.

gpio_init needs to be done before machine_init functions access gpio APIs. Hence gpio_init is made as a postcore_initcall.

---
  arch/arm/mach-omap2/gpio.c |  104 ++++++++++++++++++++++++++++++++++++++++++++
  1 files changed, 104 insertions(+), 0 deletions(-)

create mode 100644 arch/arm/mach-omap2/gpio.c

arch/arm/mach-omap2/gpio.c new file +44 -0
new file mode 100644
index 0000000..993995a
@@ -0,0 +1,104 @@
+/*
+ * gpio.c - OMAP2PLUS-specific gpio code
+ *
+ * Copyright (C) 2010 Texas Instruments, Inc.
+ *
+ * Author:
+ *	Charulatha V<[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include<linux/gpio.h>
+#include<linux/err.h>
+#include<linux/slab.h>
+
+#include<plat/omap_hwmod.h>
+#include<plat/omap_device.h>
+
+static struct omap_device_pm_latency omap_gpio_latency[] = {
+	[0] = {
+		.deactivate_func = omap_device_idle_hwmods,
+		.activate_func   = omap_device_enable_hwmods,
+		.flags		 = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
+	},
+};
+
+static int omap2_init_gpio(struct omap_hwmod *oh, void *user)
+{
+	struct omap_device *od;
+	struct omap_gpio_platform_data *pdata;
+	char *name = "omap-gpio";
+	static int id;
+	struct omap_gpio_dev_attr *gpio_dev_data;
+
+	if (!oh)
+		pr_err("Could not look up omap gpio %d\n", id + 1);
+
+	pdata = kzalloc(sizeof(struct omap_gpio_platform_data),
+					GFP_KERNEL);
+	if (!pdata) {
+		pr_err("Memory allocation failed gpio%d\n", id + 1);
+		return -ENOMEM;
Quoted 8 lines

arch/arm/mach-omap2/gpio.c line 49

Quoted 5 lines
arch/arm/mach-omap2/gpio.c new file +5 -0
+	}
+
+	gpio_dev_data = (struct omap_gpio_dev_attr *)oh->dev_attr;
+	pdata->gpio_attr = gpio_dev_data;
+	pdata->method = (int)user;

That method seems to be an IP version specific information and not a Soc specific one. You should store that in the hwmod dev_attr.

'method' is chip ID information mapped to GPIO driver specific enum that is passed to the driver (eg., METHOD_GPIO_24XX, METHOD_GPIO_44XX). I think this should not be moved to hwmod dev_attr because this is only an info required for the driver to identify the chip ID and accordingly access functions/ registers.

Also this 'method' would be removed once GPIO code undergoes a complete cleanup.

Quoted 2 lines

What does 'method' mean in that context? Maybe the name should be revisited?

Agree. 'method' is used throughout OMAP GPIO code. As mentioned above, this field would be removed once the whole GPIO code is cleaned up. This patch series doesn't bother to clean up GPIO code as the changes would be huge and intended only for HWMOD FW adaptation. Cleaning up GPIO code would come as a separate series and we can address this then.

Quoted 36 lines
Quoted 36 lines
arch/arm/mach-omap2/gpio.c new file +34 -0
+	pdata->virtual_irq_start = IH_GPIO_BASE + 32 * id;
+
+	od = omap_device_build(name, id, oh, pdata,
+				sizeof(*pdata),	omap_gpio_latency,
+				ARRAY_SIZE(omap_gpio_latency),
+				false);
+	WARN(IS_ERR(od), "Cant build omap_device for %s:%s.\n",
+				name, oh->name);
+
+	id++;
+	return 0;
+}
+
+static int __init gpio_init(int method)
+{
+	return omap_hwmod_for_each_by_class("gpio", omap2_init_gpio,
+						(void *)method);
+}
+
+/*
+ * gpio_init needs to be done before
+ * machine_init functions access gpio APIs.
+ * Hence gpio_init is a postcore_initcall.
+ */
+#ifdef CONFIG_ARCH_OMAP2
+static int __init omap24xx_gpio_init(void)
+{	if (!cpu_is_omap24xx())
+		return -EINVAL;
+
+	return gpio_init(METHOD_GPIO_24XX);
+}
+postcore_initcall(omap24xx_gpio_init);
+#endif
+
#18 lore raw

RE: [PATCH 11/13 v3] OMAP: GPIO: Introduce support for OMAP2PLUS chip GPIO init

Quoted 104 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Varadarajan, Charulatha
Sent: Wednesday, June 16, 2010 12:25 PM
To: Cousson, Benoit
Cc: [email protected]; [email protected]; [email protected]; linux- [email protected]; [email protected]; Nayak, Rajendra; [email protected]; [email protected]; Basak, Partha
Subject: RE: [PATCH 11/13 v3] OMAP: GPIO: Introduce support for OMAP2PLUS chip GPIO init

Quoted 75 lines

-----Original Message-----
From: Cousson, Benoit
Sent: Tuesday, June 15, 2010 10:53 PM
To: Varadarajan, Charulatha
Cc: [email protected]; [email protected]; akpm@linux- foundation.org; [email protected]; [email protected]; Nayak, Rajendra; [email protected]; [email protected]
Subject: Re: [PATCH 11/13 v3] OMAP: GPIO: Introduce support for OMAP2PLUS chip GPIO init

Quoted 64 lines · Charulatha

From: Charulatha V<[email protected]>

This patch adds support for handling GPIO as a HWMOD FW adapted platform device for OMAP2PLUS chips.

gpio_init needs to be done before machine_init functions access gpio APIs. Hence gpio_init is made as a postcore_initcall.

---
  arch/arm/mach-omap2/gpio.c |  104 ++++++++++++++++++++++++++++++++++++++++++++
  1 files changed, 104 insertions(+), 0 deletions(-)

create mode 100644 arch/arm/mach-omap2/gpio.c

arch/arm/mach-omap2/gpio.c new file +44 -0
new file mode 100644
index 0000000..993995a
@@ -0,0 +1,104 @@
+/*
+ * gpio.c - OMAP2PLUS-specific gpio code
+ *
+ * Copyright (C) 2010 Texas Instruments, Inc.
+ *
+ * Author:
+ *	Charulatha V<[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include<linux/gpio.h>
+#include<linux/err.h>
+#include<linux/slab.h>
+
+#include<plat/omap_hwmod.h>
+#include<plat/omap_device.h>
+
+static struct omap_device_pm_latency omap_gpio_latency[] = {
+	[0] = {
+		.deactivate_func = omap_device_idle_hwmods,
+		.activate_func   = omap_device_enable_hwmods,
+		.flags		 = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
+	},
+};
+
+static int omap2_init_gpio(struct omap_hwmod *oh, void *user)
+{
+	struct omap_device *od;
+	struct omap_gpio_platform_data *pdata;
+	char *name = "omap-gpio";
+	static int id;
+	struct omap_gpio_dev_attr *gpio_dev_data;
+
+	if (!oh)
+		pr_err("Could not look up omap gpio %d\n", id + 1);
+
+	pdata = kzalloc(sizeof(struct omap_gpio_platform_data),
+					GFP_KERNEL);
+	if (!pdata) {
+		pr_err("Memory allocation failed gpio%d\n", id + 1);
+		return -ENOMEM;
Quoted 8 lines

arch/arm/mach-omap2/gpio.c line 49

Quoted 5 lines
arch/arm/mach-omap2/gpio.c new file +5 -0
+	}
+
+	gpio_dev_data = (struct omap_gpio_dev_attr *)oh->dev_attr;
+	pdata->gpio_attr = gpio_dev_data;
+	pdata->method = (int)user;

That method seems to be an IP version specific information and not a Soc specific one. You should store that in the hwmod dev_attr.

'method' is chip ID information mapped to GPIO driver specific enum that is passed to the driver (eg., METHOD_GPIO_24XX, METHOD_GPIO_44XX). I think this should not be moved to hwmod dev_attr because this is only an info required for the driver to identify the chip ID and accordingly access functions/ registers.

Also this 'method' would be removed once GPIO code undergoes a complete cleanup.

Quoted 1 line
Quoted 7 lines
Quoted 1 line

What does 'method' mean in that context? Maybe the name should be revisited?

Agree. 'method' is used throughout OMAP GPIO code. As mentioned above, this field would be removed once the whole GPIO code is cleaned up. This patch series doesn't bother to clean up GPIO code as the changes would be huge and intended only for HWMOD FW adaptation. Cleaning up GPIO code would come as a separate series and we can address this then.

Sorry if my comment is not aligned but I thought we are addressing the gpio clean up as well.

If we are re-vamping the code so much, is it not the right time to clean up as well ??

Regards,
Santosh

#19 lore raw

RE: [PATCH 11/13 v3] OMAP: GPIO: Introduce support for OMAP2PLUS chip GPIO init

Quoted 131 lines

-----Original Message-----
From: Shilimkar, Santosh
Sent: Wednesday, June 16, 2010 12:51 PM
To: Varadarajan, Charulatha; Cousson, Benoit
Cc: [email protected]; [email protected]; akpm@linux- foundation.org; [email protected]; [email protected]; Nayak, Rajendra; [email protected]; [email protected]; Basak, Partha
Subject: RE: [PATCH 11/13 v3] OMAP: GPIO: Introduce support for OMAP2PLUS chip GPIO init

Quoted 2 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]]

On Behalf Of

Quoted 4 lines

Varadarajan, Charulatha
Sent: Wednesday, June 16, 2010 12:25 PM
To: Cousson, Benoit
Cc: [email protected]; [email protected]; akpm@linux-

foundation.org; linux-

Quoted 1 line

[email protected]; [email protected]; Nayak, Rajendra;

[email protected]; [email protected];

Quoted 2 lines

Basak, Partha
Subject: RE: [PATCH 11/13 v3] OMAP: GPIO: Introduce support for OMAP2PLUS chip

GPIO init

Quoted 19 lines
Quoted 19 lines

-----Original Message-----
From: Cousson, Benoit
Sent: Tuesday, June 15, 2010 10:53 PM
To: Varadarajan, Charulatha
Cc: [email protected]; [email protected]; akpm@linux- foundation.org; [email protected]; [email protected]; Nayak, Rajendra; [email protected]; [email protected]
Subject: Re: [PATCH 11/13 v3] OMAP: GPIO: Introduce support for OMAP2PLUS chip GPIO init

Quoted 5 lines · Charulatha

From: Charulatha V<[email protected]>

This patch adds support for handling GPIO as a HWMOD FW adapted platform device for OMAP2PLUS chips.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

gpio_init needs to be done before machine_init functions access gpio APIs. Hence gpio_init is made as a postcore_initcall.

---
  arch/arm/mach-omap2/gpio.c |  104

++++++++++++++++++++++++++++++++++++++++++++

Quoted 62 lines
Quoted 53 lines
Quoted 53 lines
  1 files changed, 104 insertions(+), 0 deletions(-)

create mode 100644 arch/arm/mach-omap2/gpio.c

arch/arm/mach-omap2/gpio.c new file +44 -0
new file mode 100644
index 0000000..993995a
@@ -0,0 +1,104 @@
+/*
+ * gpio.c - OMAP2PLUS-specific gpio code
+ *
+ * Copyright (C) 2010 Texas Instruments, Inc.
+ *
+ * Author:
+ *	Charulatha V<[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include<linux/gpio.h>
+#include<linux/err.h>
+#include<linux/slab.h>
+
+#include<plat/omap_hwmod.h>
+#include<plat/omap_device.h>
+
+static struct omap_device_pm_latency omap_gpio_latency[] = {
+	[0] = {
+		.deactivate_func = omap_device_idle_hwmods,
+		.activate_func   = omap_device_enable_hwmods,
+		.flags		 = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
+	},
+};
+
+static int omap2_init_gpio(struct omap_hwmod *oh, void *user)
+{
+	struct omap_device *od;
+	struct omap_gpio_platform_data *pdata;
+	char *name = "omap-gpio";
+	static int id;
+	struct omap_gpio_dev_attr *gpio_dev_data;
+
+	if (!oh)
+		pr_err("Could not look up omap gpio %d\n", id + 1);
+
+	pdata = kzalloc(sizeof(struct omap_gpio_platform_data),
+					GFP_KERNEL);
+	if (!pdata) {
+		pr_err("Memory allocation failed gpio%d\n", id + 1);
+		return -ENOMEM;
Quoted 8 lines

arch/arm/mach-omap2/gpio.c line 49

Quoted 5 lines
arch/arm/mach-omap2/gpio.c new file +5 -0
+	}
+
+	gpio_dev_data = (struct omap_gpio_dev_attr *)oh->dev_attr;
+	pdata->gpio_attr = gpio_dev_data;
+	pdata->method = (int)user;

That method seems to be an IP version specific information and not a Soc specific one. You should store that in the hwmod dev_attr.

Quoted 1 line

'method' is chip ID information mapped to GPIO driver specific enum that is

passed to the driver

Quoted 1 line

(eg., METHOD_GPIO_24XX, METHOD_GPIO_44XX). I think this should not be moved to

hwmod dev_attr because

Quoted 1 line

this is only an info required for the driver to identify the chip ID and

accordingly access

Quoted 8 lines

functions/ registers.

Also this 'method' would be removed once GPIO code undergoes a complete cleanup.

Quoted 2 lines

What does 'method' mean in that context? Maybe the name should be revisited?

Agree. 'method' is used throughout OMAP GPIO code. As mentioned above, this

field would be removed

Quoted 1 line

once the whole GPIO code is cleaned up. This patch series doesn't bother to

clean up GPIO code as the

Quoted 1 line

changes would be huge and intended only for HWMOD FW adaptation. Cleaning up

Quoted 8 lines

GPIO code would come as

Quoted 2 lines

a separate series and we can address this then.

Sorry if my comment is not aligned but I thought we are addressing the gpio clean up as well.

If we are re-vamping the code so much, is it not the right time to clean up as well ??

We are not addressing GPIO code clean up in this series. As you mentioned, we are revamping the code so much just for doing HWMOD FW adaptation. If we attempt to clean up the whole GPIO code along with this, we will have many more changes as we need to introduce function pointers and cleanup almost each line of the existing code. This will be too much to be done in a single series. Hence HWMOD FW adaptation series is coming first. GPIO code clean up series can be done on top of this.

When GPIO code cleanup was attempted some months back along with HWMOD FW adaptation, the changes were so much that reviewing became difficult.
http://www.mail-archive.com/[email protected]/msg26069.html

Quoted 3 lines

Regards,
Santosh

#20 lore raw

Re: [PATCH 11/13 v3] OMAP: GPIO: Introduce support for OMAP2PLUS chip GPIO init

Quoted 137 lines · Charulatha
Quoted 137 lines

-----Original Message-----
From: Shilimkar, Santosh
Sent: Wednesday, June 16, 2010 12:51 PM
To: Varadarajan, Charulatha; Cousson, Benoit
Cc: [email protected]; [email protected]; akpm@linux- foundation.org; [email protected]; [email protected]; Nayak, Rajendra; [email protected]; [email protected]; Basak, Partha
Subject: RE: [PATCH 11/13 v3] OMAP: GPIO: Introduce support for OMAP2PLUS chip GPIO init

Quoted 2 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]]

On Behalf Of

Quoted 4 lines

Varadarajan, Charulatha
Sent: Wednesday, June 16, 2010 12:25 PM
To: Cousson, Benoit
Cc: [email protected]; [email protected]; akpm@linux-

foundation.org; linux-

Quoted 1 line

[email protected]; [email protected]; Nayak, Rajendra;

[email protected]; [email protected];

Quoted 2 lines

Basak, Partha
Subject: RE: [PATCH 11/13 v3] OMAP: GPIO: Introduce support for OMAP2PLUS chip

GPIO init

Quoted 19 lines
Quoted 19 lines

-----Original Message-----
From: Cousson, Benoit
Sent: Tuesday, June 15, 2010 10:53 PM
To: Varadarajan, Charulatha
Cc: [email protected]; [email protected]; akpm@linux- foundation.org; [email protected]; [email protected]; Nayak, Rajendra; [email protected]; [email protected]
Subject: Re: [PATCH 11/13 v3] OMAP: GPIO: Introduce support for OMAP2PLUS chip GPIO init

Quoted 5 lines · Charulatha

From: Charulatha V<[email protected]>

This patch adds support for handling GPIO as a HWMOD FW adapted platform device for OMAP2PLUS chips.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

gpio_init needs to be done before machine_init functions access gpio APIs. Hence gpio_init is made as a postcore_initcall.

---
   arch/arm/mach-omap2/gpio.c |  104

++++++++++++++++++++++++++++++++++++++++++++

Quoted 62 lines
Quoted 53 lines
Quoted 53 lines
   1 files changed, 104 insertions(+), 0 deletions(-)

create mode 100644 arch/arm/mach-omap2/gpio.c

arch/arm/mach-omap2/gpio.c new file +44 -0
new file mode 100644
index 0000000..993995a
@@ -0,0 +1,104 @@
+/*
+ * gpio.c - OMAP2PLUS-specific gpio code
+ *
+ * Copyright (C) 2010 Texas Instruments, Inc.
+ *
+ * Author:
+ *	Charulatha V<[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include<linux/gpio.h>
+#include<linux/err.h>
+#include<linux/slab.h>
+
+#include<plat/omap_hwmod.h>
+#include<plat/omap_device.h>
+
+static struct omap_device_pm_latency omap_gpio_latency[] = {
+	[0] = {
+		.deactivate_func = omap_device_idle_hwmods,
+		.activate_func   = omap_device_enable_hwmods,
+		.flags		 = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
+	},
+};
+
+static int omap2_init_gpio(struct omap_hwmod *oh, void *user)
+{
+	struct omap_device *od;
+	struct omap_gpio_platform_data *pdata;
+	char *name = "omap-gpio";
+	static int id;
+	struct omap_gpio_dev_attr *gpio_dev_data;
+
+	if (!oh)
+		pr_err("Could not look up omap gpio %d\n", id + 1);
+
+	pdata = kzalloc(sizeof(struct omap_gpio_platform_data),
+					GFP_KERNEL);
+	if (!pdata) {
+		pr_err("Memory allocation failed gpio%d\n", id + 1);
+		return -ENOMEM;
Quoted 8 lines

arch/arm/mach-omap2/gpio.c line 49

Quoted 5 lines
arch/arm/mach-omap2/gpio.c new file +5 -0
+	}
+
+	gpio_dev_data = (struct omap_gpio_dev_attr *)oh->dev_attr;
+	pdata->gpio_attr = gpio_dev_data;
+	pdata->method = (int)user;

That method seems to be an IP version specific information and not a Soc specific one. You should store that in the hwmod dev_attr.

Quoted 1 line

'method' is chip ID information mapped to GPIO driver specific enum that is

passed to the driver

Quoted 1 line

(eg., METHOD_GPIO_24XX, METHOD_GPIO_44XX). I think this should not be moved to

hwmod dev_attr because

Quoted 1 line

this is only an info required for the driver to identify the chip ID and

accordingly access

Quoted 8 lines

functions/ registers.

Also this 'method' would be removed once GPIO code undergoes a complete cleanup.

Quoted 2 lines

What does 'method' mean in that context? Maybe the name should be revisited?

Agree. 'method' is used throughout OMAP GPIO code. As mentioned above, this

field would be removed

Quoted 1 line

once the whole GPIO code is cleaned up. This patch series doesn't bother to

clean up GPIO code as the

Quoted 1 line

changes would be huge and intended only for HWMOD FW adaptation. Cleaning up

GPIO code would come as

Quoted 2 lines

a separate series and we can address this then.

Sorry if my comment is not aligned but I thought we are addressing the gpio clean up as well.

Quoted 7 lines
Quoted 2 lines

If we are re-vamping the code so much, is it not the right time to clean up as well ??

We are not addressing GPIO code clean up in this series. As you mentioned, we are revamping the code so much just for doing HWMOD FW adaptation. If we attempt to clean up the whole GPIO code along with this, we will have many more changes as we need to introduce function pointers and cleanup almost each line of the existing code. This will be too much to be done in a single series. Hence HWMOD FW adaptation series is coming first. GPIO code clean up series can be done on top of this.

When GPIO code cleanup was attempted some months back along with HWMOD FW adaptation, the changes were so much that reviewing became difficult.
http://www.mail-archive.com/[email protected]/msg26069.html

I didn't find anything in this thread saying that you will do both cleanup and hwmod migration, so what is your plan? Do you already have a second series that will do the cleanup on top of that one?

FWIW, in my case, the change is quite straightforward to do it right now.

Benoit

#21 lore raw

Re: [PATCH 11/13 v3] OMAP: GPIO: Introduce support for OMAP2PLUS chip GPIO init

In reply to Shilimkar, Santosh
Quoted 111 lines · Santosh
Quoted 104 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Varadarajan, Charulatha
Sent: Wednesday, June 16, 2010 12:25 PM
To: Cousson, Benoit
Cc: [email protected]; [email protected]; [email protected]; linux- [email protected]; [email protected]; Nayak, Rajendra; [email protected]; [email protected]; Basak, Partha
Subject: RE: [PATCH 11/13 v3] OMAP: GPIO: Introduce support for OMAP2PLUS chip GPIO init

Quoted 75 lines

-----Original Message-----
From: Cousson, Benoit
Sent: Tuesday, June 15, 2010 10:53 PM
To: Varadarajan, Charulatha
Cc: [email protected]; [email protected]; akpm@linux- foundation.org; [email protected]; [email protected]; Nayak, Rajendra; [email protected]; [email protected]
Subject: Re: [PATCH 11/13 v3] OMAP: GPIO: Introduce support for OMAP2PLUS chip GPIO init

Quoted 64 lines · Charulatha

From: Charulatha V<[email protected]>

This patch adds support for handling GPIO as a HWMOD FW adapted platform device for OMAP2PLUS chips.

gpio_init needs to be done before machine_init functions access gpio APIs. Hence gpio_init is made as a postcore_initcall.

---
   arch/arm/mach-omap2/gpio.c |  104 ++++++++++++++++++++++++++++++++++++++++++++
   1 files changed, 104 insertions(+), 0 deletions(-)

create mode 100644 arch/arm/mach-omap2/gpio.c

arch/arm/mach-omap2/gpio.c new file +44 -0
new file mode 100644
index 0000000..993995a
@@ -0,0 +1,104 @@
+/*
+ * gpio.c - OMAP2PLUS-specific gpio code
+ *
+ * Copyright (C) 2010 Texas Instruments, Inc.
+ *
+ * Author:
+ *	Charulatha V<[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include<linux/gpio.h>
+#include<linux/err.h>
+#include<linux/slab.h>
+
+#include<plat/omap_hwmod.h>
+#include<plat/omap_device.h>
+
+static struct omap_device_pm_latency omap_gpio_latency[] = {
+	[0] = {
+		.deactivate_func = omap_device_idle_hwmods,
+		.activate_func   = omap_device_enable_hwmods,
+		.flags		 = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
+	},
+};
+
+static int omap2_init_gpio(struct omap_hwmod *oh, void *user)
+{
+	struct omap_device *od;
+	struct omap_gpio_platform_data *pdata;
+	char *name = "omap-gpio";
+	static int id;
+	struct omap_gpio_dev_attr *gpio_dev_data;
+
+	if (!oh)
+		pr_err("Could not look up omap gpio %d\n", id + 1);
+
+	pdata = kzalloc(sizeof(struct omap_gpio_platform_data),
+					GFP_KERNEL);
+	if (!pdata) {
+		pr_err("Memory allocation failed gpio%d\n", id + 1);
+		return -ENOMEM;
Quoted 8 lines

arch/arm/mach-omap2/gpio.c line 49

Quoted 5 lines
arch/arm/mach-omap2/gpio.c new file +5 -0
+	}
+
+	gpio_dev_data = (struct omap_gpio_dev_attr *)oh->dev_attr;
+	pdata->gpio_attr = gpio_dev_data;
+	pdata->method = (int)user;

That method seems to be an IP version specific information and not a Soc specific one. You should store that in the hwmod dev_attr.

'method' is chip ID information mapped to GPIO driver specific enum that is passed to the driver (eg., METHOD_GPIO_24XX, METHOD_GPIO_44XX). I think this should not be moved to hwmod dev_attr because this is only an info required for the driver to identify the chip ID and accordingly access functions/ registers.

Also this 'method' would be removed once GPIO code undergoes a complete cleanup.

Quoted 1 line
Quoted 7 lines
Quoted 1 line

What does 'method' mean in that context? Maybe the name should be revisited?

Agree. 'method' is used throughout OMAP GPIO code. As mentioned above, this field would be removed once the whole GPIO code is cleaned up. This patch series doesn't bother to clean up GPIO code as the changes would be huge and intended only for HWMOD FW adaptation. Cleaning up GPIO code would come as a separate series and we can address this then.

Quoted 4 lines

Sorry if my comment is not aligned but I thought we are addressing the gpio clean up as well.

If we are re-vamping the code so much, is it not the right time to clean up as well ??

I agree with Santosh, you are already cleaning a bunch of things, and in that case you can easily take advantage of HWMOD to remove a good amount of useless code.

We'd better do that right now, instead of waiting a next phase that might never happen...

And BTW, this 'method' is a IP version dependent information and not a Soc specific one. You can potentially use the HW revision field, if it is available for the GPIO.

Regards,
Benoit

#22 lore raw

RE: [PATCH 11/13 v3] OMAP: GPIO: Introduce support for OMAP2PLUS chip GPIO init

Quoted 22 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines · Charulatha
Quoted 5 lines

From: Charulatha V<[email protected]>

This patch adds support for handling GPIO as a HWMOD FW adapted platform device for OMAP2PLUS chips.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

gpio_init needs to be done before machine_init functions access gpio APIs. Hence gpio_init is made as a postcore_initcall.

---
   arch/arm/mach-omap2/gpio.c |  104

++++++++++++++++++++++++++++++++++++++++++++

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
   1 files changed, 104 insertions(+), 0 deletions(-)

create mode 100644 arch/arm/mach-omap2/gpio.c

arch/arm/mach-omap2/gpio.c new file +0 -0
new file mode 100644
index 0000000..993995a

[snip]

Quoted 51 lines
Quoted 25 lines
Quoted 25 lines
Quoted 24 lines
Quoted 11 lines
arch/arm/mach-omap2/gpio.c new file +11 -0
+static int omap2_init_gpio(struct omap_hwmod *oh, void *user)
+{
+	struct omap_device *od;
+	struct omap_gpio_platform_data *pdata;
+	char *name = "omap-gpio";
+	static int id;
+	struct omap_gpio_dev_attr *gpio_dev_data;
+
+	if (!oh)
+		pr_err("Could not look up omap gpio %d\n", id + 1);
+

arch/arm/mach-omap2/gpio.c line 49

Quoted 10 lines
arch/arm/mach-omap2/gpio.c new file +10 -0
+	pdata = kzalloc(sizeof(struct omap_gpio_platform_data),
+					GFP_KERNEL);
+	if (!pdata) {
+		pr_err("Memory allocation failed gpio%d\n", id + 1);
+		return -ENOMEM;
+	}
+
+	gpio_dev_data = (struct omap_gpio_dev_attr *)oh->dev_attr;
+	pdata->gpio_attr = gpio_dev_data;
+	pdata->method = (int)user;

That method seems to be an IP version specific information and not a Soc specific one. You should store that in the hwmod dev_attr.

Quoted 1 line
Quoted 1 line

'method' is chip ID information mapped to GPIO driver specific enum that is

passed to the driver

Quoted 1 line
Quoted 1 line

(eg., METHOD_GPIO_24XX, METHOD_GPIO_44XX). I think this should not be moved to

hwmod dev_attr because

Quoted 1 line
Quoted 1 line

this is only an info required for the driver to identify the chip ID and

accordingly access

Quoted 3 lines
Quoted 3 lines

functions/ registers.

Also this 'method' would be removed once GPIO code undergoes a complete

cleanup.

Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

What does 'method' mean in that context? Maybe the name should be revisited?

Agree. 'method' is used throughout OMAP GPIO code. As mentioned above, this

field would be removed

Quoted 1 line
Quoted 1 line

once the whole GPIO code is cleaned up. This patch series doesn't bother to

clean up GPIO code as the

Quoted 1 line
Quoted 1 line

changes would be huge and intended only for HWMOD FW adaptation. Cleaning up

GPIO code would come as

Quoted 6 lines
Quoted 2 lines

a separate series and we can address this then.

Sorry if my comment is not aligned but I thought we are addressing the gpio clean up as well.

If we are re-vamping the code so much, is it not the right time to clean up as

Quoted 8 lines

well ??

I agree with Santosh, you are already cleaning a bunch of things, and in that case you can easily take advantage of HWMOD to remove a good amount of useless code.

We'd better do that right now, instead of waiting a next phase that might never happen...

Since hwmod migration would change mainly the init part of the code, I started working on hwmod migration as part of the first series. Once we agree upon the final patch set for GPIO hwmod migration, I can work on top of the hwmod migration patch series to clean up the GPIO code and send a dependent series. This will help sending the changes in smaller chunks.

I would add a TODO section in patch description outlining the cleanup to be done in the next patch series.

Tony,
Can you add your feedback?

Please refer http://www.mail-archive.com/[email protected]/msg26065.html for the old context.

Quoted 4 lines

And BTW, this 'method' is a IP version dependent information and not a Soc specific one. You can potentially use the HW revision field, if it is available for the GPIO.

I agree that it is not SoC specific. But I still feel that it is better not to have 'method' as part of dev_attr, considering that, after clean-up, this information will no longer be needed.

Quoted 3 lines

Regards,
Benoit

#23 lore raw

Re: [PATCH 11/13 v3] OMAP: GPIO: Introduce support for OMAP2PLUS chip GPIO init

"Varadarajan, Charulatha" <[email protected]> writes:

[...]

Quoted 32 lines
Quoted 16 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

What does 'method' mean in that context? Maybe the name should be revisited?

Agree. 'method' is used throughout OMAP GPIO code. As mentioned above, this

field would be removed

Quoted 1 line
Quoted 1 line

once the whole GPIO code is cleaned up. This patch series doesn't bother to

clean up GPIO code as the

Quoted 1 line
Quoted 1 line

changes would be huge and intended only for HWMOD FW adaptation. Cleaning up

GPIO code would come as

Quoted 6 lines
Quoted 2 lines

a separate series and we can address this then.

Sorry if my comment is not aligned but I thought we are addressing the gpio clean up as well.

If we are re-vamping the code so much, is it not the right time to clean up as

Quoted 8 lines

well ??

I agree with Santosh, you are already cleaning a bunch of things, and in that case you can easily take advantage of HWMOD to remove a good amount of useless code.

We'd better do that right now, instead of waiting a next phase that might never happen...

Since hwmod migration would change mainly the init part of the code, I started working on hwmod migration as part of the first series. Once we agree upon the final patch set for GPIO hwmod migration, I can work on top of the hwmod migration patch series to clean up the GPIO code and send a dependent series. This will help sending the changes in smaller chunks.

Quoted 2 lines

I would add a TODO section in patch description outlining the cleanup to be done in the next patch series.

At a minimum, a TODO describing the rest of the cleanups would be helpful.

Quoted 6 lines

Tony,
Can you add your feedback?

Please refer http://www.mail-archive.com/[email protected]/msg26065.html for the old context.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

And BTW, this 'method' is a IP version dependent information and not a Soc specific one. You can potentially use the HW revision field, if it is available for the GPIO.

I agree that it is not SoC specific. But I still feel that it is better not to have 'method' as part of dev_attr, considering that, after clean-up, this information will no longer be needed.

Considering just this 'method' issue, and not the entire cleanup, I don't like this extra 'user' field past to omap2_init_gpio() used for the method.

Can you investigate whether or not this flag is even needed and if we can determine the method based on the REVISION register?

Kevin

#24 lore raw

RE: [PATCH 11/13 v3] OMAP: GPIO: Introduce support for OMAP2PLUS chip GPIO init

Quoted 57 lines

-----Original Message-----
From: Kevin Hilman [mailto:[email protected]]
Sent: Thursday, June 17, 2010 10:05 PM
To: Varadarajan, Charulatha
Cc: Cousson, Benoit; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Nayak, Rajendra; Basak, Partha; Shilimkar, Santosh
Subject: Re: [PATCH 11/13 v3] OMAP: GPIO: Introduce support for OMAP2PLUS chip GPIO init

"Varadarajan, Charulatha" <[email protected]> writes:

[...]

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

What does 'method' mean in that context? Maybe the

name should be revisited?

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Agree. 'method' is used throughout OMAP GPIO code. As

mentioned above, this

Quoted 2 lines
Quoted 2 lines

field would be removed

Quoted 1 line
Quoted 1 line

once the whole GPIO code is cleaned up. This patch

series doesn't bother to

Quoted 2 lines
Quoted 2 lines

clean up GPIO code as the

Quoted 1 line
Quoted 1 line

changes would be huge and intended only for HWMOD FW

adaptation. Cleaning up

Quoted 4 lines
Quoted 4 lines

GPIO code would come as

Quoted 3 lines
Quoted 2 lines

a separate series and we can address this then.

Sorry if my comment is not aligned but I thought we are

addressing the

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

gpio clean up as well.

If we are re-vamping the code so much, is it not the

right time to clean up as

Quoted 3 lines
Quoted 3 lines

well ??

I agree with Santosh, you are already cleaning a bunch of

things, and in

Quoted 1 line
Quoted 1 line

that case you can easily take advantage of HWMOD to remove

a good amount

Quoted 12 lines
Quoted 4 lines

of useless code.

We'd better do that right now, instead of waiting a next phase that might never happen...

Since hwmod migration would change mainly the init part of the code, I started working on hwmod migration as part of the first series. Once we agree upon the final patch set for GPIO hwmod migration, I can work on top of the hwmod migration patch series to clean up the GPIO code and send a dependent series. This will help sending the changes in smaller chunks.

Quoted 5 lines
Quoted 2 lines

I would add a TODO section in patch description outlining the cleanup to be done in the next patch series.

At a minimum, a TODO describing the rest of the cleanups would be helpful.

Okay. Will take care in next version of patch series.

Quoted 6 lines
Quoted 5 lines

Tony,
Can you add your feedback?

Please refer

http://www.mail-archive.com/[email protected]/msg2606

5.html for the old context.

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

And BTW, this 'method' is a IP version dependent information and not a Soc specific one. You can potentially use the HW revision field, if it is available for the GPIO.

Quoted 7 lines
Quoted 3 lines

I agree that it is not SoC specific. But I still feel that it is better not to have 'method' as part of dev_attr, considering that, after clean-up, this information will no longer be needed.

Considering just this 'method' issue, and not the entire cleanup, I don't like this extra 'user' field past to omap2_init_gpio() used for the method.

Okay, I will avoid passing 'method' as 'user' field in my next version of this patch series.

Instead will use 'rev' field of omap_hwmod_class structure and will populate 'method' based on 'rev' value.

In hwmod database assign,
'rev' value for OMAP2 as '0'
'rev' value for OMAP3 as '1'
'rev' value for OMAP4 as '2'

static int omap2_init_gpio(struct omap_hwmod *oh, void *user)

{
	...
	...
	switch (oh->class->rev) {
		case 0:
		case 1:
			pdata->method = METHOD_GPIO_24XX;
			break;
		case 2:
			pdata->method = METHOD_GPIO_44XX;
			break;		
	}
	...
	...
}
Quoted 3 lines

Can you investigate whether or not this flag is even needed and if we can determine the method based on the REVISION register?

AFAIK 'method' is not based on REVISION register. If you see 'method' usage for omap15xx chip, it has METHOD_MPUIO and METHOD_GPIO_1510. Similar for omap16xx and omap 7xx.

Even after cleanup we might need a way to find out if the gpio bank falls under MPUIO method. I would do a name change for 'method' as suggested by Benoit during cleanup and it would be used only for identifying MPUIO type after cleanup.

Quoted 3 lines

Kevin

#25 lore raw

Re: [PATCH 10/13 v3] OMAP: GPIO: Add gpio dev_attr and correct clks in OMAP4 hwmod struct

In reply to Varadarajan, Charulatha

Hi Charu,

Quoted 23 lines · Charulatha

From: Charulatha V<[email protected]>

This patch adds gpio_dev_attr to OMAP4 gpio hwmod structure. This patch also corrects the gpio .main_clk and .clk fields in gpio hwmod structures.

---
  arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   37 +++++++++++++++++++---------
  1 files changed, 25 insertions(+), 12 deletions(-)
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +1 -0
index 20f5f8c..b4c0878 100644
@@ -22,6 +22,7 @@
 
  #include<plat/omap_hwmod.h>
  #include<plat/cpu.h>
+#include<plat/gpio.h>
 
  #include "omap_hwmod_common_data.h"
 

arch/arm/mach-omap2/omap_hwmod_44xx_data.c static struct omap_hwmod omap44xx_fdif_hwmod = { · line 1277

Quoted 5 lines
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +2 -0
@@ -1272,6 +1273,12 @@ static struct omap_hwmod omap44xx_fdif_hwmod = {
   * general purpose io module
   */
 
+static struct omap_gpio_dev_attr gpio_dev_attr = {
+	.gpio_bank_count = 6,

Why do you need that information?
The point is that this struct is in theory a per instance data not a global one. If needed, you should be able to get that from the number of iteration done during the init of hwmods.

arch/arm/mach-omap2/omap_hwmod_44xx_data.c static struct omap_hwmod omap44xx_fdif_hwmod = { · line 1280

Quoted 3 lines
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +3 -0
+	.gpio_bank_bits = 32,
+	.dbck_flag = true,
+};

Since this structure is the same than OMAP3, you should maybe consider sharing it.

Quoted 14 lines
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +2 -1
+
  static struct omap_hwmod_class_sysconfig omap44xx_gpio_sysc = {
  	.rev_offs	= 0x0000,
  	.sysc_offs	= 0x0010,
@@ -1305,7 +1312,7 @@ static struct omap_hwmod_addr_space omap44xx_gpio1_addrs[] = {
  static struct omap_hwmod_ocp_if omap44xx_l4_wkup__gpio1 = {
  	.master		=&omap44xx_l4_wkup_hwmod,
  	.slave		=&omap44xx_gpio1_hwmod,
-	.clk		= "l4_wkup_clk_mux_ck",
+	.clk		= "gpio1_ick",
  	.addr		= omap44xx_gpio1_addrs,
  	.addr_cnt	= ARRAY_SIZE(omap44xx_gpio1_addrs),
  	.user		= OCP_USER_MPU | OCP_USER_SDMA,

arch/arm/mach-omap2/omap_hwmod_44xx_data.c static struct omap_hwmod omap44xx_gpio1_hwmod = { · line 1335

Quoted 5 lines
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +1 -1
@@ -1325,7 +1332,7 @@ static struct omap_hwmod omap44xx_gpio1_hwmod = {
  	.class		=&omap44xx_gpio_hwmod_class,
  	.mpu_irqs	= omap44xx_gpio1_irqs,
  	.mpu_irqs_cnt	= ARRAY_SIZE(omap44xx_gpio1_irqs),
-	.main_clk	= "gpio1_ick",
+	.main_clk	= NULL,

Removing the line is enough. It will be null by default.
I'm still not 100% sure that this is the good way to control the GPIO module mode, but at least this is cleaner than the previous clock mapping.

Benoit

#26 lore raw

RE: [PATCH 10/13 v3] OMAP: GPIO: Add gpio dev_attr and correct clks in OMAP4 hwmod struct

Quoted 42 lines

-----Original Message-----
From: Cousson, Benoit
Sent: Tuesday, June 15, 2010 10:10 PM
To: Varadarajan, Charulatha
Cc: [email protected]; [email protected]; akpm@linux- foundation.org; [email protected]; [email protected]; Nayak, Rajendra; [email protected]; [email protected]
Subject: Re: [PATCH 10/13 v3] OMAP: GPIO: Add gpio dev_attr and correct clks in OMAP4 hwmod struct

Hi Charu,

arch/arm/mach-

Quoted 11 lines · Charulatha

From: Charulatha V<[email protected]>

This patch adds gpio_dev_attr to OMAP4 gpio hwmod structure. This patch also corrects the gpio .main_clk and .clk fields in gpio hwmod structures.

---
  arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   37 +++++++++++++++++++---------
  1 files changed, 25 insertions(+), 12 deletions(-)
arch/arm/mach- renamed from arch/arm/mach-omap2/omap_hwmod_44xx_data.c +0 -0

omap2/omap_hwmod_44xx_data.c

Quoted 15 lines

index 20f5f8c..b4c0878 100644

arch/arm/mach-omap2/omap_hwmod_44xx_data.c +1 -0
@@ -22,6 +22,7 @@
 
  #include<plat/omap_hwmod.h>
  #include<plat/cpu.h>
+#include<plat/gpio.h>
 
  #include "omap_hwmod_common_data.h"
 
@@ -1272,6 +1273,12 @@ static struct omap_hwmod omap44xx_fdif_hwmod = {
   * general purpose io module
   */
 
Quoted 7 lines

arch/arm/mach-omap2/omap_hwmod_44xx_data.c static struct omap_hwmod omap44xx_fdif_hwmod = { · line 1277

Quoted 2 lines
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +2 -0
+static struct omap_gpio_dev_attr gpio_dev_attr = {
+	.gpio_bank_count = 6,

Why do you need that information?
The point is that this struct is in theory a per instance data not a global one. If needed, you should be able to get that from the number of iteration done during the init of hwmods.

Even though it is possible to get it through number of iterations, more efficient approach would be to keep this information here. My point is that this information can be auto-generated and hence it is better to keep it in hwmod database itself.

FYI, in a meeting we recently had with Kevin, we discussed about "global data" information getting duplicated for each instance and it was agreed that it is okay to have pointers duplicated for each instance.

Quoted 7 lines

arch/arm/mach-omap2/omap_hwmod_44xx_data.c static struct omap_hwmod omap44xx_fdif_hwmod = { · line 1280

Quoted 4 lines
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +3 -0
+	.gpio_bank_bits = 32,
+	.dbck_flag = true,
+};

Since this structure is the same than OMAP3, you should maybe consider sharing it.

They are in different _data.c files. I feel that it will be good if they are kept decoupled as we need not have to mix up different SoC data. Here it's only a coincidence that OMAP3 and OMAP4 have same data.

Quoted 7 lines

arch/arm/mach-omap2/omap_hwmod_44xx_data.c static struct omap_hwmod_addr_space omap44xx_gpio1_addrs[]

Quoted 6 lines
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +1 -0
+
  static struct omap_hwmod_class_sysconfig omap44xx_gpio_sysc = {
  	.rev_offs	= 0x0000,
  	.sysc_offs	= 0x0010,
@@ -1305,7 +1312,7 @@ static struct omap_hwmod_addr_space omap44xx_gpio1_addrs[]

= {

Quoted 16 lines
Quoted 9 lines
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +1 -1
  static struct omap_hwmod_ocp_if omap44xx_l4_wkup__gpio1 = {
  	.master		=&omap44xx_l4_wkup_hwmod,
  	.slave		=&omap44xx_gpio1_hwmod,
-	.clk		= "l4_wkup_clk_mux_ck",
+	.clk		= "gpio1_ick",
  	.addr		= omap44xx_gpio1_addrs,
  	.addr_cnt	= ARRAY_SIZE(omap44xx_gpio1_addrs),
  	.user		= OCP_USER_MPU | OCP_USER_SDMA,

arch/arm/mach-omap2/omap_hwmod_44xx_data.c static struct omap_hwmod omap44xx_gpio1_hwmod = { · line 1335

Quoted 5 lines
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +1 -1
@@ -1325,7 +1332,7 @@ static struct omap_hwmod omap44xx_gpio1_hwmod = {
  	.class		=&omap44xx_gpio_hwmod_class,
  	.mpu_irqs	= omap44xx_gpio1_irqs,
  	.mpu_irqs_cnt	= ARRAY_SIZE(omap44xx_gpio1_irqs),
-	.main_clk	= "gpio1_ick",
+	.main_clk	= NULL,

Removing the line is enough. It will be null by default.

Agreed.

Quoted 4 lines

I'm still not 100% sure that this is the good way to control the GPIO module mode, but at least this is cleaner than the previous clock mapping.

Benoit

#27 lore raw

Re: [PATCH 10/13 v3] OMAP: GPIO: Add gpio dev_attr and correct clks in OMAP4 hwmod struct

Quoted 42 lines · Charulatha
Quoted 34 lines

From: Cousson, Benoit
Sent: Tuesday, June 15, 2010 10:10 PM

Hi Charu,

arch/arm/mach-

Quoted 11 lines · Charulatha

From: Charulatha V<[email protected]>

This patch adds gpio_dev_attr to OMAP4 gpio hwmod structure. This patch also corrects the gpio .main_clk and .clk fields in gpio hwmod structures.

---
   arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   37 +++++++++++++++++++---------
   1 files changed, 25 insertions(+), 12 deletions(-)
arch/arm/mach- renamed from arch/arm/mach-omap2/omap_hwmod_44xx_data.c +0 -0

omap2/omap_hwmod_44xx_data.c

Quoted 15 lines

index 20f5f8c..b4c0878 100644

arch/arm/mach-omap2/omap_hwmod_44xx_data.c +1 -0
@@ -22,6 +22,7 @@
 
   #include<plat/omap_hwmod.h>
   #include<plat/cpu.h>
+#include<plat/gpio.h>
 
   #include "omap_hwmod_common_data.h"
 
@@ -1272,6 +1273,12 @@ static struct omap_hwmod omap44xx_fdif_hwmod = {
    * general purpose io module
    */
 
Quoted 7 lines

arch/arm/mach-omap2/omap_hwmod_44xx_data.c static struct omap_hwmod omap44xx_fdif_hwmod = { · line 1277

Quoted 2 lines
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +2 -0
+static struct omap_gpio_dev_attr gpio_dev_attr = {
+	.gpio_bank_count = 6,

Why do you need that information?
The point is that this struct is in theory a per instance data not a global one. If needed, you should be able to get that from the number of iteration done during the init of hwmods.

Quoted 1 line

Even though it is possible to get it through number of iterations, more efficient approach would be to keep this information here. My point is that this information can be auto-generated and hence it is better to keep it in hwmod database itself.

It is still a duplication of an information we already have indirectly. The number of GPIO bank is exactly the number of hwmod gpio instances. You do not need any other parameters to get that.

Quoted 1 line

FYI, in a meeting we recently had with Kevin, we discussed about "global data" information getting duplicated for each instance and it was agreed that it is okay to have pointers duplicated for each instance.

I'm not OK with that. If we start mixing the pure IP specific information with the global one it will be a mess, and it will prevent the easy reuse accross SoC familly.
hwmod structure is an IP information. The number of GPIO is an integration information that has nothing to do inside the hwmod. If we want to add an extra instance of GPIO in OMAP4440 for example, we will not be able to reuse the current 4430 data.

So please, don't do that.

BTW, you didn't answer the first answer, do you really need that?

Quoted 9 lines
Quoted 7 lines

arch/arm/mach-omap2/omap_hwmod_44xx_data.c static struct omap_hwmod omap44xx_fdif_hwmod = { · line 1280

Quoted 4 lines
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +3 -0
+	.gpio_bank_bits = 32,
+	.dbck_flag = true,
+};

Since this structure is the same than OMAP3, you should maybe consider sharing it.

They are in different _data.c files. I feel that it will be good if they are kept decoupled as we need not have to mix up different SoC data. Here it's only a coincidence that OMAP3 and OMAP4 have same data

No it is not a coincidence, it is because we are re-using the same IP implementation. In that case, it is not a big deal, but you should try to reuse as most as you can already existing data.

Benoit

Quoted 32 lines
Quoted 8 lines

arch/arm/mach-omap2/omap_hwmod_44xx_data.c static struct omap_hwmod_addr_space omap44xx_gpio1_addrs[]

Quoted 7 lines
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +1 -0
+
   static struct omap_hwmod_class_sysconfig omap44xx_gpio_sysc = {
   	.rev_offs	= 0x0000,
   	.sysc_offs	= 0x0010,
@@ -1305,7 +1312,7 @@ static struct omap_hwmod_addr_space omap44xx_gpio1_addrs[]

= {

Quoted 16 lines
Quoted 9 lines
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +1 -1
   static struct omap_hwmod_ocp_if omap44xx_l4_wkup__gpio1 = {
   	.master		=&omap44xx_l4_wkup_hwmod,
   	.slave		=&omap44xx_gpio1_hwmod,
-	.clk		= "l4_wkup_clk_mux_ck",
+	.clk		= "gpio1_ick",
   	.addr		= omap44xx_gpio1_addrs,
   	.addr_cnt	= ARRAY_SIZE(omap44xx_gpio1_addrs),
   	.user		= OCP_USER_MPU | OCP_USER_SDMA,

arch/arm/mach-omap2/omap_hwmod_44xx_data.c static struct omap_hwmod omap44xx_gpio1_hwmod = { · line 1335

Quoted 5 lines
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +1 -1
@@ -1325,7 +1332,7 @@ static struct omap_hwmod omap44xx_gpio1_hwmod = {
   	.class		=&omap44xx_gpio_hwmod_class,
   	.mpu_irqs	= omap44xx_gpio1_irqs,
   	.mpu_irqs_cnt	= ARRAY_SIZE(omap44xx_gpio1_irqs),
-	.main_clk	= "gpio1_ick",
+	.main_clk	= NULL,

Removing the line is enough. It will be null by default.

Agreed.

Quoted 4 lines

I'm still not 100% sure that this is the good way to control the GPIO module mode, but at least this is cleaner than the previous clock mapping.

Benoit

#28 lore raw

RE: [PATCH 10/13 v3] OMAP: GPIO: Add gpio dev_attr and correct clks in OMAP4 hwmod struct

Quoted 58 lines · Charulatha
Quoted 7 lines
Quoted 7 lines

From: Cousson, Benoit
Sent: Tuesday, June 15, 2010 10:10 PM

Hi Charu,

On 6/15/2010 5:05 PM, Varadarajan, Charulatha wrote:

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

From: Charulatha V<[email protected]>

This patch adds gpio_dev_attr to OMAP4 gpio hwmod structure. This patch also corrects the gpio .main_clk and .clk fields in gpio hwmod structures.

---
   arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   37 +++++++++++++++++++------

---

Quoted 27 lines
Quoted 19 lines

arch/arm/mach-

Quoted 3 lines
   1 files changed, 25 insertions(+), 12 deletions(-)
arch/arm/mach- renamed from arch/arm/mach-omap2/omap_hwmod_44xx_data.c +0 -0

omap2/omap_hwmod_44xx_data.c

Quoted 15 lines

index 20f5f8c..b4c0878 100644

arch/arm/mach-omap2/omap_hwmod_44xx_data.c +1 -0
@@ -22,6 +22,7 @@
 
   #include<plat/omap_hwmod.h>
   #include<plat/cpu.h>
+#include<plat/gpio.h>
 
   #include "omap_hwmod_common_data.h"
 
@@ -1272,6 +1273,12 @@ static struct omap_hwmod omap44xx_fdif_hwmod = {
    * general purpose io module
    */
 
Quoted 7 lines

arch/arm/mach-omap2/omap_hwmod_44xx_data.c static struct omap_hwmod omap44xx_fdif_hwmod = { · line 1277

Quoted 2 lines
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +2 -0
+static struct omap_gpio_dev_attr gpio_dev_attr = {
+	.gpio_bank_count = 6,

Why do you need that information?
The point is that this struct is in theory a per instance data not a global one. If needed, you should be able to get that from the number of iteration done during the init of hwmods.

Quoted 1 line

Even though it is possible to get it through number of iterations, more

efficient approach would be to keep this information here. My point is that this information can be auto-generated and hence it is better to keep it in hwmod database itself.

It is still a duplication of an information we already have indirectly. The number of GPIO bank is exactly the number of hwmod gpio instances. You do not need any other parameters to get that.

Quoted 1 line

FYI, in a meeting we recently had with Kevin, we discussed about "global data"

information getting duplicated for each instance and it was agreed that it is okay to have pointers duplicated for each instance.

Quoted 7 lines

I'm not OK with that. If we start mixing the pure IP specific information with the global one it will be a mess, and it will prevent the easy reuse accross SoC familly.
hwmod structure is an IP information. The number of GPIO is an integration information that has nothing to do inside the hwmod. If we want to add an extra instance of GPIO in OMAP4440 for example, we will not be able to reuse the current 4430 data.

I guess, irq no and dma channel information are also integration information that are auto-generated in 4430 database. Shall we consider gpio_bank_count too?

Quoted 5 lines

So please, don't do that.

BTW, you didn't answer the first answer, do you really need that?

It is used in save/restore context which would be called from sram_idle path.

Considering implementing using iterations count, there would be an additional loop that would do this counting and the final value would be passed as pdata->gpio_bank_count through each device data.

static int gpio_bank_count;

void omap_get_gpio_count (void) {
	gpio_bank_count++;
}

int omap2_init_gpio (struct omap_hwmod *oh, void*user)

{
	...
	...
	pdata->gpio_bank_count = gpio_bank_count;
	omap_device_build(...);
	...
	...
}

void gpio_init ()

{
	...
	...
	omap_hwmod_for_each_by_class("gpio", &omap_get_gpio_count(oh, NULL));
	...
	...
	omap_hwmod_for_each_by_class("gpio", &omap2_init_gpio(oh, NULL));
}

Do we need to consider this?

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

arch/arm/mach-omap2/omap_hwmod_44xx_data.c static struct omap_hwmod omap44xx_fdif_hwmod = { · line 1280

Quoted 4 lines
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +3 -0
+	.gpio_bank_bits = 32,
+	.dbck_flag = true,
+};

Since this structure is the same than OMAP3, you should maybe consider sharing it.

Quoted 7 lines
Quoted 1 line

They are in different _data.c files. I feel that it will be good if they are

kept decoupled as we need not have to mix up different SoC data. Here it's only a coincidence that OMAP3 and OMAP4 have same data

No it is not a coincidence, it is because we are re-using the same IP implementation. In that case, it is not a big deal, but you should try to reuse as most as you can already existing data.

They are in two different omap_hwmod_xxxx_data.c files. Is there a way to share this data?

Quoted 36 lines

Benoit

Quoted 7 lines
Quoted 7 lines

arch/arm/mach-omap2/omap_hwmod_44xx_data.c static struct omap_hwmod_addr_space

Quoted 7 lines
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +1 -0
+
   static struct omap_hwmod_class_sysconfig omap44xx_gpio_sysc = {
   	.rev_offs	= 0x0000,
   	.sysc_offs	= 0x0010,
@@ -1305,7 +1312,7 @@ static struct omap_hwmod_addr_space

omap44xx_gpio1_addrs[]

Quoted 25 lines
Quoted 17 lines

= {

Quoted 9 lines
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +1 -1
   static struct omap_hwmod_ocp_if omap44xx_l4_wkup__gpio1 = {
   	.master		=&omap44xx_l4_wkup_hwmod,
   	.slave		=&omap44xx_gpio1_hwmod,
-	.clk		= "l4_wkup_clk_mux_ck",
+	.clk		= "gpio1_ick",
   	.addr		= omap44xx_gpio1_addrs,
   	.addr_cnt	= ARRAY_SIZE(omap44xx_gpio1_addrs),
   	.user		= OCP_USER_MPU | OCP_USER_SDMA,

arch/arm/mach-omap2/omap_hwmod_44xx_data.c static struct omap_hwmod omap44xx_gpio1_hwmod = { · line 1335

Quoted 5 lines
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +1 -1
@@ -1325,7 +1332,7 @@ static struct omap_hwmod omap44xx_gpio1_hwmod = {
   	.class		=&omap44xx_gpio_hwmod_class,
   	.mpu_irqs	= omap44xx_gpio1_irqs,
   	.mpu_irqs_cnt	= ARRAY_SIZE(omap44xx_gpio1_irqs),
-	.main_clk	= "gpio1_ick",
+	.main_clk	= NULL,

Removing the line is enough. It will be null by default.

Agreed.

Quoted 4 lines

I'm still not 100% sure that this is the good way to control the GPIO module mode, but at least this is cleaner than the previous clock mapping.

Benoit

#29 lore raw

Re: [PATCH 10/13 v3] OMAP: GPIO: Add gpio dev_attr and correct clks in OMAP4 hwmod struct

Quoted 66 lines · Charulatha
Quoted 58 lines · Charulatha
Quoted 7 lines
Quoted 7 lines

From: Cousson, Benoit
Sent: Tuesday, June 15, 2010 10:10 PM

Hi Charu,

On 6/15/2010 5:05 PM, Varadarajan, Charulatha wrote:

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

From: Charulatha V<[email protected]>

This patch adds gpio_dev_attr to OMAP4 gpio hwmod structure. This patch also corrects the gpio .main_clk and .clk fields in gpio hwmod structures.

---
    arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   37 +++++++++++++++++++------

---

Quoted 27 lines
Quoted 19 lines

arch/arm/mach-

Quoted 3 lines
    1 files changed, 25 insertions(+), 12 deletions(-)
arch/arm/mach- renamed from arch/arm/mach-omap2/omap_hwmod_44xx_data.c +0 -0

omap2/omap_hwmod_44xx_data.c

Quoted 15 lines

index 20f5f8c..b4c0878 100644

arch/arm/mach-omap2/omap_hwmod_44xx_data.c +1 -0
@@ -22,6 +22,7 @@
 
    #include<plat/omap_hwmod.h>
    #include<plat/cpu.h>
+#include<plat/gpio.h>
 
    #include "omap_hwmod_common_data.h"
 
@@ -1272,6 +1273,12 @@ static struct omap_hwmod omap44xx_fdif_hwmod = {
     * general purpose io module
     */
 
Quoted 7 lines

arch/arm/mach-omap2/omap_hwmod_44xx_data.c static struct omap_hwmod omap44xx_fdif_hwmod = { · line 1277

Quoted 2 lines
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +2 -0
+static struct omap_gpio_dev_attr gpio_dev_attr = {
+	.gpio_bank_count = 6,

Why do you need that information?
The point is that this struct is in theory a per instance data not a global one. If needed, you should be able to get that from the number of iteration done during the init of hwmods.

Quoted 1 line

Even though it is possible to get it through number of iterations, more

efficient approach would be to keep this information here. My point is that this information can be auto-generated and hence it is better to keep it in hwmod database itself.

It is still a duplication of an information we already have indirectly. The number of GPIO bank is exactly the number of hwmod gpio instances. You do not need any other parameters to get that.

Quoted 1 line

FYI, in a meeting we recently had with Kevin, we discussed about "global data"

information getting duplicated for each instance and it was agreed that it is okay to have pointers duplicated for each instance.

Quoted 7 lines

I'm not OK with that. If we start mixing the pure IP specific information with the global one it will be a mess, and it will prevent the easy reuse accross SoC familly.
hwmod structure is an IP information. The number of GPIO is an integration information that has nothing to do inside the hwmod. If we want to add an extra instance of GPIO in OMAP4440 for example, we will not be able to reuse the current 4430 data.

Quoted 1 line

I guess, irq no and dma channel information are also integration information that are auto-generated in 4430 database. Shall we consider gpio_bank_count too?

I don't think you shall. irq and dma are information related to the instance itself. The number of gpio is just a soc information.

Quoted 38 lines
Quoted 5 lines

So please, don't do that.

BTW, you didn't answer the first answer, do you really need that?

It is used in save/restore context which would be called from sram_idle path.

Considering implementing using iterations count, there would be an additional loop that would do this counting and the final value would be passed as pdata->gpio_bank_count through each device data.

static int gpio_bank_count;

void omap_get_gpio_count (void) {
	gpio_bank_count++;
}

int omap2_init_gpio (struct omap_hwmod *oh, void*user)

{
	...
	...
	pdata->gpio_bank_count = gpio_bank_count;
	omap_device_build(...);
	...
	...
}

void gpio_init ()

{
	...
	...
	omap_hwmod_for_each_by_class("gpio",&omap_get_gpio_count(oh, NULL));
	...
	...
	omap_hwmod_for_each_by_class("gpio",&omap2_init_gpio(oh, NULL));
}
Quoted 1 line

Do we need to consider this?

I think you need to reconsider the usage of gpio_bank_count.
The omap_gpio_save_context should not use that variable at all. This seems to be a legacy of the old none platform_driver code.

That should solve your problem.

Benoit

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 7 lines

arch/arm/mach-omap2/omap_hwmod_44xx_data.c static struct omap_hwmod omap44xx_fdif_hwmod = { · line 1280

Quoted 4 lines
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +3 -0
+	.gpio_bank_bits = 32,
+	.dbck_flag = true,
+};

Since this structure is the same than OMAP3, you should maybe consider sharing it.

They are in different _data.c files. I feel that it will be good if they are

Quoted 8 lines
Quoted 6 lines

kept decoupled as we need not have to mix up different SoC data. Here it's only a coincidence that OMAP3 and OMAP4 have same data

No it is not a coincidence, it is because we are re-using the same IP implementation. In that case, it is not a big deal, but you should try to reuse as most as you can already existing data.

They are in two different omap_hwmod_xxxx_data.c files. Is there a way to share this data?

You can use omap_hwmod_common_data.c if you want.

Benoit

Quoted 37 lines
Quoted 36 lines

Benoit

Quoted 7 lines
Quoted 7 lines

arch/arm/mach-omap2/omap_hwmod_44xx_data.c static struct omap_hwmod_addr_space

Quoted 7 lines
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +1 -0
+
    static struct omap_hwmod_class_sysconfig omap44xx_gpio_sysc = {
    	.rev_offs	= 0x0000,
    	.sysc_offs	= 0x0010,
@@ -1305,7 +1312,7 @@ static struct omap_hwmod_addr_space

omap44xx_gpio1_addrs[]

Quoted 25 lines
Quoted 17 lines

= {

Quoted 9 lines
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +1 -1
    static struct omap_hwmod_ocp_if omap44xx_l4_wkup__gpio1 = {
    	.master		=&omap44xx_l4_wkup_hwmod,
    	.slave		=&omap44xx_gpio1_hwmod,
-	.clk		= "l4_wkup_clk_mux_ck",
+	.clk		= "gpio1_ick",
    	.addr		= omap44xx_gpio1_addrs,
    	.addr_cnt	= ARRAY_SIZE(omap44xx_gpio1_addrs),
    	.user		= OCP_USER_MPU | OCP_USER_SDMA,

arch/arm/mach-omap2/omap_hwmod_44xx_data.c static struct omap_hwmod omap44xx_gpio1_hwmod = { · line 1335

Quoted 5 lines
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +1 -1
@@ -1325,7 +1332,7 @@ static struct omap_hwmod omap44xx_gpio1_hwmod = {
    	.class		=&omap44xx_gpio_hwmod_class,
    	.mpu_irqs	= omap44xx_gpio1_irqs,
    	.mpu_irqs_cnt	= ARRAY_SIZE(omap44xx_gpio1_irqs),
-	.main_clk	= "gpio1_ick",
+	.main_clk	= NULL,

Removing the line is enough. It will be null by default.

Agreed.

Quoted 4 lines

I'm still not 100% sure that this is the good way to control the GPIO module mode, but at least this is cleaner than the previous clock mapping.

Benoit

#30 lore raw

Re: [PATCH 10/13 v3] OMAP: GPIO: Add gpio dev_attr and correct clks in OMAP4 hwmod struct

In reply to Varadarajan, Charulatha

"Varadarajan, Charulatha" <[email protected]> writes:

[...]

Quoted 7 lines
Quoted 5 lines

So please, don't do that.

BTW, you didn't answer the first answer, do you really need that?

It is used in save/restore context which would be called from sram_idle path.

Cleaning this up should be considered instead of keeping around the bank count.

The save/restore should be done per-bank whenever the bank usage count goes to zero (or changes from zero.)

If you don't want to address that cleanup in this series, add it to the TODO list for the cleanups and use the current variable, but it's value should be set when iterating over the number of hwmods as suggested by Benoit.

Kevin

#31 lore raw

RE: [PATCH 10/13 v3] OMAP: GPIO: Add gpio dev_attr and correct clks in OMAP4 hwmod struct

Quoted 22 lines

-----Original Message-----
From: Kevin Hilman [mailto:[email protected]]
Sent: Thursday, June 17, 2010 10:13 PM
To: Varadarajan, Charulatha
Cc: Cousson, Benoit; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Nayak, Rajendra; [email protected]; Basak, Partha
Subject: Re: [PATCH 10/13 v3] OMAP: GPIO: Add gpio dev_attr and correct clks in OMAP4 hwmod struct

"Varadarajan, Charulatha" <[email protected]> writes:

[...]

Quoted 5 lines
Quoted 5 lines

So please, don't do that.

BTW, you didn't answer the first answer, do you really need that?

Quoted 8 lines
Quoted 2 lines

It is used in save/restore context which would be called from sram_idle path.

Cleaning this up should be considered instead of keeping around the bank count.

The save/restore should be done per-bank whenever the bank usage count goes to zero (or changes from zero.)

When a GPIO is acquired in a particular gpio bank, the gpio bank can still go to idle if it is called by omap_sram_idle(). In such a case, restore context will be called even when bank count is not 0.

Quoted 5 lines

If you don't want to address that cleanup in this series, add it to the TODO list for the cleanups and use the current variable, but it's value should be set when iterating over the number of hwmods as suggested by Benoit.

Okay. Will add these changes in my next version of patchset.

Quoted 16 lines

Kevin

Quoted 12 lines
Quoted 12 lines
Quoted 9 lines
Quoted 7 lines

arch/arm/mach-omap2/omap_hwmod_44xx_data.c static struct omap_hwmod omap44xx_fdif_hwmod = { · line 1280

Quoted 4 lines
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +3 -0
+	.gpio_bank_bits = 32,
+	.dbck_flag = true,
+};

Since this structure is the same than OMAP3, you should maybe consider sharing it.

They are in different _data.c files. I feel that it will be good if they are

kept decoupled as we need not have to mix up different SoC data. Here it's only a coincidence that OMAP3 and OMAP4 have same data

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

No it is not a coincidence, it is because we are re-using the same IP implementation. In that case, it is not a big deal, but you should try to reuse as most as you can already existing data.

They are in two different omap_hwmod_xxxx_data.c files. Is there a way to share this data?

You can use omap_hwmod_common_data.c if you want.

It is common only for OMAP3/4 and not for OMAP2. But, omap_hwmod_common_data.c is common for all OMAP2PLUS. Hence will maintain dev_attr for OMAP3&4 in their respective hwmod database files.

Quoted 1 line

Benoit

#32 lore raw

Re: [PATCH 10/13 v3] OMAP: GPIO: Add gpio dev_attr and correct clks in OMAP4 hwmod struct

Quoted 28 lines · Charulatha
Quoted 28 lines

-----Original Message-----
From: Kevin Hilman [mailto:[email protected]]
Sent: Thursday, June 17, 2010 10:13 PM
To: Varadarajan, Charulatha
Cc: Cousson, Benoit; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Nayak, Rajendra; [email protected]; Basak, Partha
Subject: Re: [PATCH 10/13 v3] OMAP: GPIO: Add gpio dev_attr and correct clks in OMAP4 hwmod struct

"Varadarajan, Charulatha" <[email protected]> writes:

[...]

Quoted 7 lines
Quoted 5 lines

So please, don't do that.

BTW, you didn't answer the first answer, do you really need that?

It is used in save/restore context which would be called from sram_idle path.

Cleaning this up should be considered instead of keeping around the bank count.

Quoted 6 lines
Quoted 2 lines

The save/restore should be done per-bank whenever the bank usage count goes to zero (or changes from zero.)

When a GPIO is acquired in a particular gpio bank, the gpio bank can still go to idle if it is called by omap_sram_idle(). In such a case, restore context will be called even when bank count is not 0.

If a GPIO has been requested, then it should have a non-zero usage count. and save/restore should be used. If it has a zero usage count, then save should be done when the usage count goes to zero, and restore should be done when usage count changes from zero.

The way it works today is that save/restore is blindly called for all banks every idle path. This should be fixed.

Kevin

Quoted 37 lines
Quoted 5 lines

If you don't want to address that cleanup in this series, add it to the TODO list for the cleanups and use the current variable, but it's value should be set when iterating over the number of hwmods as suggested by Benoit.

Okay. Will add these changes in my next version of patchset.

Quoted 16 lines

Kevin

Quoted 12 lines
Quoted 12 lines
Quoted 9 lines
Quoted 7 lines

Review

Quoted 4 lines
(quoted diff) +3 -0
+	.gpio_bank_bits = 32,
+	.dbck_flag = true,
+};

Since this structure is the same than OMAP3, you should maybe consider sharing it.

They are in different _data.c files. I feel that it will be good if they are

kept decoupled as we need not have to mix up different SoC data. Here it's only a coincidence that OMAP3 and OMAP4 have same data

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

No it is not a coincidence, it is because we are re-using the same IP implementation. In that case, it is not a big deal, but you should try to reuse as most as you can already existing data.

They are in two different omap_hwmod_xxxx_data.c files. Is there a way to share this data?

You can use omap_hwmod_common_data.c if you want.

It is common only for OMAP3/4 and not for OMAP2. But, omap_hwmod_common_data.c is common for all OMAP2PLUS. Hence will maintain dev_attr for OMAP3&4 in their respective hwmod database files.

Quoted 1 line

Benoit

#33 lore raw

RE: [PATCH 07/13 v3] OMAP: GPIO: add GPIO hwmods structures for OMAP3

In reply to Varadarajan, Charulatha
Quoted 166 lines

-----Original Message-----
From: [email protected] [mailto:linux-omap- [email protected]] On Behalf Of Varadarajan, Charulatha
Sent: Tuesday, June 15, 2010 8:36 PM
To: [email protected]; [email protected]; akpm@linux- foundation.org; [email protected]
Cc: [email protected]; Nayak, Rajendra; Cousson, Benoit; [email protected]; [email protected]; Varadarajan, Charulatha
Subject: [PATCH 07/13 v3] OMAP: GPIO: add GPIO hwmods structures for OMAP3

From: Charulatha V <[email protected]>

Add hwmod structures for GPIO module on OMAP3

---
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |  366
++++++++++++++++++++++++++++
 1 files changed, 366 insertions(+), 0 deletions(-)
arch/arm/mach- renamed from arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +0 -0

omap2/omap_hwmod_3xxx_data.c
index e288b20..91ef205 100644

arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +115 -0
@@ -17,6 +17,7 @@
 #include <mach/irqs.h>
 #include <plat/cpu.h>
 #include <plat/dma.h>
+#include <plat/gpio.h>
 
 #include "omap_hwmod_common_data.h"
 
@@ -81,6 +82,12 @@ static struct omap_hwmod omap3xxx_l3_hwmod = {
 };
 
 static struct omap_hwmod omap3xxx_l4_wkup_hwmod;
+static struct omap_hwmod omap3xxx_gpio1_hwmod;
+static struct omap_hwmod omap3xxx_gpio2_hwmod;
+static struct omap_hwmod omap3xxx_gpio3_hwmod;
+static struct omap_hwmod omap3xxx_gpio4_hwmod;
+static struct omap_hwmod omap3xxx_gpio5_hwmod;
+static struct omap_hwmod omap3xxx_gpio6_hwmod;
 
 /* L4_CORE -> L4_WKUP interface */
 static struct omap_hwmod_ocp_if omap3xxx_l4_core__l4_wkup = {
@@ -89,6 +96,114 @@ static struct omap_hwmod_ocp_if
 omap3xxx_l4_core__l4_wkup = {
 	.user	= OCP_USER_MPU | OCP_USER_SDMA,
 };
 
+/* L4 WKUP -> GPIO1 interface */
+static struct omap_hwmod_addr_space omap3xxx_gpio1_addrs[] = {
+	{
+		.pa_start	= OMAP34XX_GPIO1_BASE,
+		.pa_end		= OMAP34XX_GPIO1_BASE + SZ_4K - 1,
+		.flags		= ADDR_TYPE_RT
+	},
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_wkup__gpio1 = {
+	.master		= &omap3xxx_l4_wkup_hwmod,
+	.slave		= &omap3xxx_gpio1_hwmod,
+	.clk		= "gpio1_ick",
+	.addr		= omap3xxx_gpio1_addrs,
+	.addr_cnt	= ARRAY_SIZE(omap3xxx_gpio1_addrs),
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 PER -> GPIO2 interface */
+static struct omap_hwmod_addr_space omap3xxx_gpio2_addrs[] = {
+	{
+		.pa_start	= OMAP34XX_GPIO2_BASE,
+		.pa_end		= OMAP34XX_GPIO2_BASE + SZ_4K - 1,
+		.flags		= ADDR_TYPE_RT
+	},
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio2 = {
+	.master		= &omap3xxx_l4_per_hwmod,
+	.slave		= &omap3xxx_gpio2_hwmod,
+	.clk		= "gpio2_ick",
+	.addr		= omap3xxx_gpio2_addrs,
+	.addr_cnt	= ARRAY_SIZE(omap3xxx_gpio2_addrs),
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 PER -> GPIO3 interface */
+static struct omap_hwmod_addr_space omap3xxx_gpio3_addrs[] = {
+	{
+		.pa_start	= OMAP34XX_GPIO3_BASE,
+		.pa_end		= OMAP34XX_GPIO3_BASE + SZ_4K - 1,
+		.flags		= ADDR_TYPE_RT
+	},
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio3 = {
+	.master		= &omap3xxx_l4_per_hwmod,
+	.slave		= &omap3xxx_gpio3_hwmod,
+	.clk		= "gpio3_ick",
+	.addr		= omap3xxx_gpio3_addrs,
+	.addr_cnt	= ARRAY_SIZE(omap3xxx_gpio3_addrs),
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 PER -> GPIO4 interface */
+static struct omap_hwmod_addr_space omap3xxx_gpio4_addrs[] = {
+	{
+		.pa_start	= OMAP34XX_GPIO4_BASE,
+		.pa_end		= OMAP34XX_GPIO4_BASE + SZ_4K - 1,
+		.flags		= ADDR_TYPE_RT
+	},
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio4 = {
+	.master		= &omap3xxx_l4_per_hwmod,
+	.slave		= &omap3xxx_gpio4_hwmod,
+	.clk		= "gpio4_ick",
+	.addr		= omap3xxx_gpio4_addrs,
+	.addr_cnt	= ARRAY_SIZE(omap3xxx_gpio4_addrs),
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 PER -> GPIO5 interface */
+static struct omap_hwmod_addr_space omap3xxx_gpio5_addrs[] = {
+	{
+		.pa_start	= OMAP34XX_GPIO5_BASE,
+		.pa_end		= OMAP34XX_GPIO5_BASE + SZ_4K - 1,
+		.flags		= ADDR_TYPE_RT
+	},
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio5 = {
+	.master		= &omap3xxx_l4_per_hwmod,
+	.slave		= &omap3xxx_gpio5_hwmod,
+	.clk		= "gpio5_ick",
+	.addr		= omap3xxx_gpio5_addrs,
+	.addr_cnt	= ARRAY_SIZE(omap3xxx_gpio5_addrs),
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 PER -> GPIO6 interface */
+static struct omap_hwmod_addr_space omap3xxx_gpio6_addrs[] = {
+	{
+		.pa_start	= OMAP34XX_GPIO6_BASE,
+		.pa_end		= OMAP34XX_GPIO6_BASE + SZ_4K - 1,
+		.flags		= ADDR_TYPE_RT
+	},
+};
+
+static struct omap_hwmod_ocp_if omap3xxx_l4_per__gpio6 = {
+	.master		= &omap3xxx_l4_per_hwmod,
+	.slave		= &omap3xxx_gpio6_hwmod,
+	.clk		= "gpio6_ick",
+	.addr		= omap3xxx_gpio6_addrs,
+	.addr_cnt	= ARRAY_SIZE(omap3xxx_gpio6_addrs),
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+};
+
 /* Slave interfaces on the L4_CORE interconnect */
 static struct omap_hwmod_ocp_if *omap3xxx_l4_core_slaves[] = {
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +0 -0
 	&omap3xxx_l3__l4_core,

arch/arm/mach-omap2/omap_hwmod_3xxx_data.c static struct omap_hwmod omap3xxx_mpu_hwmod = { · line 291

Quoted 9 lines
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +6 -0
@@ -168,12 +283,263 @@ static struct omap_hwmod omap3xxx_mpu_hwmod = {
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
 };
 
+/* GPIO common */
+static struct omap_gpio_dev_attr gpio_dev_attr = {
+	.gpio_bank_count = 6,
+	.gpio_bank_bits = 32,
+	.dbck_flag = true,
+};

(i) I thought following structure is what is being initialized above. If so, why the field names are not matching? Or, there is some disconnect in my observation! struct omap_gpio_dev_attr {
int gpio_bank_width; /* GPIO bank width */
bool dbck_flag; /* dbck validity - True only for OMAP3&4 */
bool omap1_ick_flag; /* OMAP1 ick - True only for OMAP15xx */
};

(ii) If the structures are different, can we have the field names as:
bank_count
bank_bits

Quoted 261 lines
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +245 -1
+
+static struct omap_hwmod_class_sysconfig omap3xxx_gpio_sysc = {
+	.rev_offs	= 0x0000,
+	.sysc_offs	= 0x0010,
+	.syss_offs	= 0x0014,
+	.sysc_flags	= (SYSC_HAS_ENAWAKEUP | SYSC_HAS_SIDLEMODE |
+			   SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE),
+	.idlemodes	= (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+	.sysc_fields    = &omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class omap3xxx_gpio_hwmod_class = {
+	.name = "gpio",
+	.sysc = &omap3xxx_gpio_sysc,
+};
+
+/* GPIO1 */
+
+static struct omap_hwmod_irq_info omap3xxx_gpio1_irqs[] = {
+	{ .name = "gpio_mpu_irq", .irq = INT_34XX_GPIO_BANK1 },
+};
+
+static struct omap_hwmod_opt_clk gpio1_opt_clks[] = {
+	{ .role = "dbclk", .clk = "gpio1_dbck", },
+};
+
+static struct omap_hwmod_ocp_if *omap3xxx_gpio1_slaves[] = {
+	&omap3xxx_l4_wkup__gpio1,
+};
+
+static struct omap_hwmod omap3xxx_gpio1_hwmod = {
+	.name		= "gpio1",
+	.mpu_irqs	= omap3xxx_gpio1_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(omap3xxx_gpio1_irqs),
+	.main_clk	= NULL,
+	.opt_clks	= gpio1_opt_clks,
+	.opt_clks_cnt	= ARRAY_SIZE(gpio1_opt_clks),
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP3430_EN_GPIO1_SHIFT,
+			.module_offs = WKUP_MOD,
+			.idlest_reg_id = 1,
+			.idlest_idle_bit = 3,
+		},
+	},
+	.slaves		= omap3xxx_gpio1_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap3xxx_gpio1_slaves),
+	.class		= &omap3xxx_gpio_hwmod_class,
+	.dev_attr	= &gpio_dev_attr,
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
+};
+
+/* GPIO2 */
+
+static struct omap_hwmod_irq_info omap3xxx_gpio2_irqs[] = {
+	{ .name = "gpio_mpu_irq", .irq = INT_34XX_GPIO_BANK2 },
+};
+
+static struct omap_hwmod_opt_clk gpio2_opt_clks[] = {
+	{ .role = "dbclk", .clk = "gpio2_dbck", },
+};
+
+static struct omap_hwmod_ocp_if *omap3xxx_gpio2_slaves[] = {
+	&omap3xxx_l4_per__gpio2,
+};
+
+static struct omap_hwmod omap3xxx_gpio2_hwmod = {
+	.name		= "gpio2",
+	.mpu_irqs	= omap3xxx_gpio2_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(omap3xxx_gpio2_irqs),
+	.main_clk	= NULL,
+	.opt_clks	= gpio2_opt_clks,
+	.opt_clks_cnt	= ARRAY_SIZE(gpio2_opt_clks),
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP3430_EN_GPIO2_SHIFT,
+			.module_offs = OMAP3430_PER_MOD,
+			.idlest_reg_id = 1,
+			.idlest_idle_bit = 13,
+		},
+	},
+	.slaves		= omap3xxx_gpio2_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap3xxx_gpio2_slaves),
+	.class		= &omap3xxx_gpio_hwmod_class,
+	.dev_attr	= &gpio_dev_attr,
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
+};
+
+/* GPIO3 */
+
+static struct omap_hwmod_irq_info omap3xxx_gpio3_irqs[] = {
+	{ .name = "gpio_mpu_irq", .irq = INT_34XX_GPIO_BANK3 },
+};
+
+static struct omap_hwmod_opt_clk gpio3_opt_clks[] = {
+	{ .role = "dbclk", .clk = "gpio3_dbck", },
+};
+
+static struct omap_hwmod_ocp_if *omap3xxx_gpio3_slaves[] = {
+	&omap3xxx_l4_per__gpio3,
+};
+
+static struct omap_hwmod omap3xxx_gpio3_hwmod = {
+	.name		= "gpio3",
+	.mpu_irqs	= omap3xxx_gpio3_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(omap3xxx_gpio3_irqs),
+	.main_clk	= NULL,
+	.opt_clks	= gpio3_opt_clks,
+	.opt_clks_cnt	= ARRAY_SIZE(gpio3_opt_clks),
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP3430_EN_GPIO3_SHIFT,
+			.module_offs = OMAP3430_PER_MOD,
+			.idlest_reg_id = 1,
+			.idlest_idle_bit = 14,
+		},
+	},
+	.slaves		= omap3xxx_gpio3_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap3xxx_gpio3_slaves),
+	.class		= &omap3xxx_gpio_hwmod_class,
+	.dev_attr	= &gpio_dev_attr,
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
+};
+
+/* GPIO4 */
+
+static struct omap_hwmod_irq_info omap3xxx_gpio4_irqs[] = {
+	{ .name = "gpio_mpu_irq", .irq = INT_34XX_GPIO_BANK4 },
+};
+
+static struct omap_hwmod_opt_clk gpio4_opt_clks[] = {
+	{ .role = "dbclk", .clk = "gpio4_dbck", },
+};
+
+static struct omap_hwmod_ocp_if *omap3xxx_gpio4_slaves[] = {
+	&omap3xxx_l4_per__gpio4,
+};
+
+static struct omap_hwmod omap3xxx_gpio4_hwmod = {
+	.name		= "gpio4",
+	.mpu_irqs	= omap3xxx_gpio4_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(omap3xxx_gpio4_irqs),
+	.main_clk	= NULL,
+	.opt_clks	= gpio4_opt_clks,
+	.opt_clks_cnt	= ARRAY_SIZE(gpio4_opt_clks),
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP3430_EN_GPIO4_SHIFT,
+			.module_offs = OMAP3430_PER_MOD,
+			.idlest_reg_id = 1,
+			.idlest_idle_bit = 15,
+		},
+	},
+	.slaves		= omap3xxx_gpio4_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap3xxx_gpio4_slaves),
+	.class		= &omap3xxx_gpio_hwmod_class,
+	.dev_attr	= &gpio_dev_attr,
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
+};
+
+
+/* GPIO5 */
+
+static struct omap_hwmod_irq_info omap3xxx_gpio5_irqs[] = {
+	{ .name = "gpio_mpu_irq", .irq = INT_34XX_GPIO_BANK5 },
+};
+
+static struct omap_hwmod_opt_clk gpio5_opt_clks[] = {
+	{ .role = "dbclk", .clk = "gpio5_dbck", },
+};
+
+static struct omap_hwmod_ocp_if *omap3xxx_gpio5_slaves[] = {
+	&omap3xxx_l4_per__gpio5,
+};
+
+static struct omap_hwmod omap3xxx_gpio5_hwmod = {
+	.name		= "gpio5",
+	.mpu_irqs	= omap3xxx_gpio5_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(omap3xxx_gpio5_irqs),
+	.main_clk	= NULL,
+	.opt_clks	= gpio5_opt_clks,
+	.opt_clks_cnt	= ARRAY_SIZE(gpio5_opt_clks),
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP3430_EN_GPIO5_SHIFT,
+			.module_offs = OMAP3430_PER_MOD,
+			.idlest_reg_id = 1,
+			.idlest_idle_bit = 16,
+		},
+	},
+	.slaves		= omap3xxx_gpio5_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap3xxx_gpio5_slaves),
+	.class		= &omap3xxx_gpio_hwmod_class,
+	.dev_attr	= &gpio_dev_attr,
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
+};
+
+/* GPIO6 */
+
+static struct omap_hwmod_irq_info omap3xxx_gpio6_irqs[] = {
+	{ .name = "gpio_mpu_irq", .irq = INT_34XX_GPIO_BANK6 },
+};
+
+static struct omap_hwmod_opt_clk gpio6_opt_clks[] = {
+	{ .role = "dbclk", .clk = "gpio6_dbck", },
+};
+
+static struct omap_hwmod_ocp_if *omap3xxx_gpio6_slaves[] = {
+	&omap3xxx_l4_per__gpio6,
+};
+
+static struct omap_hwmod omap3xxx_gpio6_hwmod = {
+	.name		= "gpio6",
+	.mpu_irqs	= omap3xxx_gpio6_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(omap3xxx_gpio6_irqs),
+	.main_clk	= NULL,
+	.opt_clks	= gpio6_opt_clks,
+	.opt_clks_cnt	= ARRAY_SIZE(gpio6_opt_clks),
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP3430_EN_GPIO6_SHIFT,
+			.module_offs = OMAP3430_PER_MOD,
+			.idlest_reg_id = 1,
+			.idlest_idle_bit = 17,
+		},
+	},
+	.slaves		= omap3xxx_gpio6_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap3xxx_gpio6_slaves),
+	.class		= &omap3xxx_gpio_hwmod_class,
+	.dev_attr	= &gpio_dev_attr,
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
+};
+
 static __initdata struct omap_hwmod *omap3xxx_hwmods[] = {
 	&omap3xxx_l3_hwmod,
 	&omap3xxx_l4_core_hwmod,
 	&omap3xxx_l4_per_hwmod,
 	&omap3xxx_l4_wkup_hwmod,
 	&omap3xxx_mpu_hwmod,
+	&omap3xxx_gpio1_hwmod,
+	&omap3xxx_gpio2_hwmod,
+	&omap3xxx_gpio3_hwmod,
+	&omap3xxx_gpio4_hwmod,
+	&omap3xxx_gpio5_hwmod,
+	&omap3xxx_gpio6_hwmod,
 	NULL,
 };
 
--

1.6.3.3

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#34 lore raw

Re: [PATCH 04/13 v3] OMAP: GPIO: Introduce support for OMAP15xx chip GPIO init

In reply to Varadarajan, Charulatha
Quoted 17 lines · Charulatha

From: Charulatha V <[email protected]>

This patch adds support for handling OMAP15xx specific gpio_init by providing platform device data and doing device registration.

---
 arch/arm/mach-omap1/gpio15xx.c |  102 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 102 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap1/gpio15xx.c
arch/arm/mach-omap1/gpio15xx.c new file +0 -0
new file mode 100644
index 0000000..e4f1738

arch/arm/mach-omap1/gpio15xx.c line 2

Quoted 2 lines
arch/arm/mach-omap1/gpio15xx.c new file +2 -0
@@ -0,0 +1,102 @@
+/*
+ * gpio15xx.c - OMAP15XX-specific gpio code

Minor detail, but you don't need the filename here.

Kevin

#35 lore raw

RE: [PATCH 04/13 v3] OMAP: GPIO: Introduce support for OMAP15xx chip GPIO init

Quoted 28 lines

-----Original Message-----
From: Kevin Hilman [mailto:[email protected]]
Sent: Friday, June 18, 2010 1:54 AM
To: Varadarajan, Charulatha
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Nayak, Rajendra; Cousson, Benoit; [email protected]
Subject: Re: [PATCH 04/13 v3] OMAP: GPIO: Introduce support for OMAP15xx chip GPIO init

Quoted 8 lines · Charulatha

From: Charulatha V <[email protected]>

This patch adds support for handling OMAP15xx specific gpio_init by providing platform device data and doing device registration.

---
 arch/arm/mach-omap1/gpio15xx.c |  102 

++++++++++++++++++++++++++++++++++++++++

Review

Quoted 4 lines
 1 files changed, 102 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap1/gpio15xx.c
(quoted diff) +0 -0

b/arch/arm/mach-omap1/gpio15xx.c

Quoted 9 lines

arch/arm/mach-omap1/gpio15xx.c line 2

Quoted 7 lines

new file mode 100644
index 0000000..e4f1738

arch/arm/mach-omap1/gpio15xx.c new file +2 -0
@@ -0,0 +1,102 @@
+/*
+ * gpio15xx.c - OMAP15XX-specific gpio code

Minor detail, but you don't need the filename here.

Okay.

Quoted 3 lines

Kevin