Skip to contentSkip to conversation

OMAP: GPIO: Implement GPIO in HWMOD way

PATCH Superseded Charulatha V 5 participants 33 messages May 18, 2010 – Jun 4, 2010 2 messages not in the archive

Subsystems (6)

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#9 lore raw

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

In reply to Charulatha V

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

---
 arch/arm/mach-omap2/gpio.c |  113 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 113 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap2/gpio.c
arch/arm/mach-omap2/gpio.c new file +113 -0
new file mode 100644
index 0000000..bc339ef
@@ -0,0 +1,113 @@
+/*
+ * 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 omap242x_gpio_init(void)
+{	if (!cpu_is_omap2420())
+		return -EINVAL;
+
+	return gpio_init(METHOD_GPIO_24XX);
+}
+postcore_initcall(omap242x_gpio_init);
+
+static int __init omap243x_gpio_init(void)
+{
+	if (!cpu_is_omap2430())
+		return -EINVAL;
+
+	return gpio_init(METHOD_GPIO_24XX);
+}
+postcore_initcall(omap243x_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
#0 lore raw

cover OMAP: GPIO: Implement GPIO in HWMOD way

This patch series implements GPIO module in platform device model. It also makes OMAP2PLUS specific GPIO implemented in HWMOD FW way.

This patch series is created on "origin/pm-wip/runtime".

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

Charulatha V (11):
OMAP: GPIO: Modify init() in preparation for platform device
implementation
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: 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           |    2 +-
 arch/arm/mach-omap1/gpio15xx.c             |  104 +++++
 arch/arm/mach-omap1/gpio16xx.c             |  202 +++++++++
 arch/arm/mach-omap1/gpio7xx.c              |  266 ++++++++++++
 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-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/clock2420_data.c       |   10 +-
 arch/arm/mach-omap2/clock2430_data.c       |   14 +-
 arch/arm/mach-omap2/clock3xxx_data.c       |   24 +-
 arch/arm/mach-omap2/clock44xx_data.c       |   24 +-
 arch/arm/mach-omap2/gpio.c                 |  113 +++++
 arch/arm/mach-omap2/omap_hwmod_2420_data.c |  222 ++++++++++
 arch/arm/mach-omap2/omap_hwmod_2430_data.c |  270 ++++++++++++
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |  357 ++++++++++++++++-
 arch/arm/plat-omap/gpio.c                  |  622 ++++++++++------------------
 arch/arm/plat-omap/include/plat/gpio.h     |   84 ++++-
 49 files changed, 1886 insertions(+), 469 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
#2 lore raw

PATCH 2/11 OMAP: GPIO: Include platform_data structure for GPIO

In reply to Charulatha V

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 |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
arch/arm/plat-omap/include/plat/gpio.h +15 -0
index a06acb6..d2d310b 100644
@@ -28,6 +28,7 @@
 
 #include <linux/io.h>
 #include <mach/irqs.h>
+#include <linux/platform_device.h>
 
 #define OMAP1_MPUIO_BASE		0xfffb5000
 #define OMAP1_MPUIO_VBASE		OMAP1_MPUIO_BASE
@@ -137,6 +138,20 @@
 				 IH_MPUIO_BASE + ((nr) & 0x0f) : \
 				 IH_GPIO_BASE + (nr))
 
+struct omap_gpio_dev_attr {
+	int gpio_bank_count;
+	int gpio_bank_bits;
+	bool dbck_flag;
+	bool fck_flag;
+	bool arm_gpio_ck_flag;
+};
+
+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_retention(void);
 extern void omap2_gpio_resume_after_retention(void);
Signature · 1 line
1.6.3.3
#4 lore raw

PATCH 4/11 OMAP: GPIO: Introduce support for OMAP16xx chip GPIO init

In reply to Charulatha V

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 |  202 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 202 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap1/gpio16xx.c
arch/arm/mach-omap1/gpio16xx.c new file +202 -0
new file mode 100644
index 0000000..07febcc
@@ -0,0 +1,202 @@
+/*
+ * 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>
+
+static struct omap_gpio_dev_attr omap16xx_gpio_attr = {
+	.gpio_bank_count	= 5,
+	.gpio_bank_bits		= 16,
+	.arm_gpio_ck_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 6/11 OMAP: GPIO: add GPIO hwmods structures for OMAP3

In reply to Charulatha V

Add hwmod structures for GPIO module on OMAP3

---
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |  357 +++++++++++++++++++++++++++-
 1 files changed, 356 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +356 -1
index 5f74c34..499be79 100644
@@ -20,6 +20,7 @@
 #include <plat/serial.h>
 #include <plat/l4_3xxx.h>
 #include <plat/mmc.h>
+#include <plat/gpio.h>
 
 #include "omap_hwmod_common_data.h"
 
@@ -89,6 +90,12 @@ static struct omap_hwmod omap3xxx_uart3_hwmod;
 static struct omap_hwmod omap3xxx_mmc1_hwmod;
 static struct omap_hwmod omap3xxx_mmc2_hwmod;
 static struct omap_hwmod omap3xxx_mmc3_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 = {
@@ -226,6 +233,114 @@ static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmc3 = {
 	.flags		= OMAP_FIREWALL_L4
 };
 
+/* L4 WKUP -> GPIO1 interface */
+static struct omap_hwmod_addr_space omap3xxx_gpio1_addr_space[] = {
+	{
+		.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_addr_space,
+	.addr_cnt	= ARRAY_SIZE(omap3xxx_gpio1_addr_space),
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 PER -> GPIO2 interface */
+static struct omap_hwmod_addr_space omap3xxx_gpio2_addr_space[] = {
+	{
+		.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_addr_space,
+	.addr_cnt	= ARRAY_SIZE(omap3xxx_gpio2_addr_space),
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 PER -> GPIO3 interface */
+static struct omap_hwmod_addr_space omap3xxx_gpio3_addr_space[] = {
+	{
+		.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_addr_space,
+	.addr_cnt	= ARRAY_SIZE(omap3xxx_gpio3_addr_space),
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 PER -> GPIO4 interface */
+static struct omap_hwmod_addr_space omap3xxx_gpio4_addr_space[] = {
+	{
+		.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_addr_space,
+	.addr_cnt	= ARRAY_SIZE(omap3xxx_gpio4_addr_space),
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 PER -> GPIO5 interface */
+static struct omap_hwmod_addr_space omap3xxx_gpio5_addr_space[] = {
+	{
+		.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_addr_space,
+	.addr_cnt	= ARRAY_SIZE(omap3xxx_gpio5_addr_space),
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 PER -> GPIO6 interface */
+static struct omap_hwmod_addr_space omap3xxx_gpio6_addr_space[] = {
+	{
+		.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_addr_space,
+	.addr_cnt	= ARRAY_SIZE(omap3xxx_gpio6_addr_space),
+	.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,
@@ -252,6 +367,11 @@ static struct omap_hwmod omap3xxx_l4_core_hwmod = {
 /* Slave interfaces on the L4_PER interconnect */
 static struct omap_hwmod_ocp_if *omap3xxx_l4_per_slaves[] = {
 	&omap3xxx_l3__l4_per,
+	&omap3xxx_l4_per__gpio2,
+	&omap3xxx_l4_per__gpio3,
+	&omap3xxx_l4_per__gpio4,
+	&omap3xxx_l4_per__gpio5,
+	&omap3xxx_l4_per__gpio6,
 };
 
 /* Master interfaces on the L4_PER interconnect */
@@ -273,6 +393,7 @@ static struct omap_hwmod omap3xxx_l4_per_hwmod = {
 /* Slave interfaces on the L4_WKUP interconnect */
 static struct omap_hwmod_ocp_if *omap3xxx_l4_wkup_slaves[] = {
 	&omap3xxx_l4_core__l4_wkup,
+	&omap3xxx_l4_wkup__gpio1,
 };
 
 /* Master interfaces on the L4_WKUP interconnect */
@@ -442,7 +563,6 @@ static struct omap_hwmod_class mmc_class = {
 	.sysc = &mmc_sysc,
 };
 
-
 /* MMC/SD/SDIO1 */
 
 static struct mmc_dev_attr mmc1_dev_attr = {
@@ -576,6 +696,235 @@ static struct omap_hwmod omap3xxx_mmc3_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,
+	.fck_flag = false,
+};
+
+static struct omap_hwmod_class_sysconfig gpio_sysc = {
+	.rev_offs	= 0x0000,
+	.sysc_offs	= 0x0010,
+	.syss_offs	= 0x0014,
+	.sysc_flags	= (SYSC_HAS_SIDLEMODE |
+			   SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
+			   SYSC_HAS_AUTOIDLE),
+	.idlemodes	= (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+	.sysc_fields    = &omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class gpio_class = {
+	.name = "gpio",
+	.sysc = &gpio_sysc,
+};
+
+/* GPIO1 */
+
+static struct omap_hwmod_irq_info gpio1_mpu_irqs[] = {
+	{ .name = "gpio_mpu_irq", .irq = INT_34XX_GPIO_BANK1 },
+};
+
+static struct omap_hwmod_opt_clk gpio1_opt_clks[] = {
+	{ .role = "gpio1_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_hwmod",
+	.mpu_irqs	= gpio1_mpu_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(gpio1_mpu_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,
+		},
+	},
+	.slaves		= omap3xxx_gpio1_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap3xxx_gpio1_slaves),
+	.class		= &gpio_class,
+	.dev_attr	= &gpio_dev_attr,
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
+};
+
+/* GPIO2 */
+
+static struct omap_hwmod_irq_info gpio2_mpu_irqs[] = {
+	{ .name = "gpio_mpu_irq", .irq = INT_34XX_GPIO_BANK2 },
+};
+
+static struct omap_hwmod_opt_clk gpio2_opt_clks[] = {
+	{ .role = "gpio2_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_hwmod",
+	.mpu_irqs	= gpio2_mpu_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(gpio2_mpu_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,
+		},
+	},
+	.slaves		= omap3xxx_gpio2_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap3xxx_gpio2_slaves),
+	.class		= &gpio_class,
+	.dev_attr	= &gpio_dev_attr,
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
+};
+
+/* GPIO3 */
+
+static struct omap_hwmod_irq_info gpio3_mpu_irqs[] = {
+	{ .name = "gpio_mpu_irq", .irq = INT_34XX_GPIO_BANK3 },
+};
+
+static struct omap_hwmod_opt_clk gpio3_opt_clks[] = {
+	{ .role = "gpio3_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_hwmod",
+	.mpu_irqs	= gpio3_mpu_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(gpio3_mpu_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,
+		},
+	},
+	.slaves		= omap3xxx_gpio3_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap3xxx_gpio3_slaves),
+	.class		= &gpio_class,
+	.dev_attr	= &gpio_dev_attr,
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
+};
+
+/* GPIO4 */
+
+static struct omap_hwmod_irq_info gpio4_mpu_irqs[] = {
+	{ .name = "gpio_mpu_irq", .irq = INT_34XX_GPIO_BANK4 },
+};
+
+static struct omap_hwmod_opt_clk gpio4_opt_clks[] = {
+	{ .role = "gpio4_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_hwmod",
+	.mpu_irqs	= gpio4_mpu_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(gpio4_mpu_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,
+		},
+	},
+	.slaves		= omap3xxx_gpio4_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap3xxx_gpio4_slaves),
+	.class		= &gpio_class,
+	.dev_attr	= &gpio_dev_attr,
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
+};
+
+
+/* GPIO5 */
+
+static struct omap_hwmod_irq_info gpio5_mpu_irqs[] = {
+	{ .name = "gpio_mpu_irq", .irq = INT_34XX_GPIO_BANK5 },
+};
+
+static struct omap_hwmod_opt_clk gpio5_opt_clks[] = {
+	{ .role = "gpio5_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_hwmod",
+	.mpu_irqs	= gpio5_mpu_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(gpio5_mpu_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,
+		},
+	},
+	.slaves		= omap3xxx_gpio5_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap3xxx_gpio5_slaves),
+	.class		= &gpio_class,
+	.dev_attr	= &gpio_dev_attr,
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
+};
+
+/* GPIO6 */
+
+static struct omap_hwmod_irq_info gpio6_mpu_irqs[] = {
+	{ .name = "gpio_mpu_irq", .irq = INT_34XX_GPIO_BANK6 },
+};
+
+static struct omap_hwmod_opt_clk gpio6_opt_clks[] = {
+	{ .role = "gpio6_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_hwmod",
+	.mpu_irqs	= gpio6_mpu_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(gpio6_mpu_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,
+		},
+	},
+	.slaves		= omap3xxx_gpio6_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap3xxx_gpio6_slaves),
+	.class		= &gpio_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,
@@ -588,6 +937,12 @@ static __initdata struct omap_hwmod *omap3xxx_hwmods[] = {
 	&omap3xxx_mmc1_hwmod,
 	&omap3xxx_mmc2_hwmod,
 	&omap3xxx_mmc3_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
#7 lore raw

PATCH 7/11 OMAP: GPIO: add GPIO hwmods structures for OMAP242X

Add hwmod structures for GPIO module on OMAP242X

---
 arch/arm/mach-omap2/omap_hwmod_2420_data.c |  222 ++++++++++++++++++++++++++++
 1 files changed, 222 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/omap_hwmod_2420_data.c +222 -0
index eb7ee24..4d05a9a 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 = {
@@ -87,6 +92,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",
@@ -101,6 +178,10 @@ static struct omap_hwmod omap2420_l4_core_hwmod = {
 /* Slave interfaces on the L4_WKUP interconnect */
 static struct omap_hwmod_ocp_if *omap2420_l4_wkup_slaves[] = {
 	&omap2420_l4_core__l4_wkup,
+	&omap2420_l4_wkup__gpio1,
+	&omap2420_l4_wkup__gpio2,
+	&omap2420_l4_wkup__gpio3,
+	&omap2420_l4_wkup__gpio4,
 };
 
 /* Master interfaces on the L4_WKUP interconnect */
@@ -133,11 +214,152 @@ 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,
+	.fck_flag = true,
+};
+
+static struct omap_hwmod_class_sysconfig gpio_sysc = {
+	.rev_offs	= 0x0000,
+	.sysc_offs	= 0x0010,
+	.syss_offs	= 0x0014,
+	.sysc_flags	= (SYSC_HAS_SIDLEMODE |
+			   SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
+			   SYSC_HAS_AUTOIDLE),
+	.idlemodes	= (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+	.sysc_fields    = &omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class gpio_class = {
+	.name = "gpio",
+	.sysc = &gpio_sysc,
+};
+
+/* GPIO1 */
+
+static struct omap_hwmod_irq_info gpio1_mpu_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_hwmod",
+	.mpu_irqs	= gpio1_mpu_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(gpio1_mpu_irqs),
+	.main_clk	= "gpios_fck",
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP24XX_EN_GPIOS_SHIFT,
+		},
+	},
+	.slaves		= omap2420_gpio1_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap2420_gpio1_slaves),
+	.class		= &gpio_class,
+	.dev_attr	= &gpio_dev_attr,
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
+};
+
+/* GPIO2 */
+
+static struct omap_hwmod_irq_info gpio2_mpu_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_hwmod",
+	.mpu_irqs	= gpio2_mpu_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(gpio2_mpu_irqs),
+	.main_clk	= "gpios_fck",
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP24XX_EN_GPIOS_SHIFT,
+		},
+	},
+	.slaves		= omap2420_gpio2_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap2420_gpio2_slaves),
+	.class		= &gpio_class,
+	.dev_attr	= &gpio_dev_attr,
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
+};
+
+/* GPIO3 */
+
+static struct omap_hwmod_irq_info gpio3_mpu_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_hwmod",
+	.mpu_irqs	= gpio3_mpu_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(gpio3_mpu_irqs),
+	.main_clk	= "gpios_fck",
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP24XX_EN_GPIOS_SHIFT,
+		},
+	},
+	.slaves		= omap2420_gpio3_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap2420_gpio3_slaves),
+	.class		= &gpio_class,
+	.dev_attr	= &gpio_dev_attr,
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
+};
+
+/* GPIO4 */
+
+static struct omap_hwmod_irq_info gpio4_mpu_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_hwmod",
+	.mpu_irqs	= gpio4_mpu_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(gpio4_mpu_irqs),
+	.main_clk	= "gpios_fck",
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP24XX_EN_GPIOS_SHIFT,
+		},
+	},
+	.slaves		= omap2420_gpio4_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap2420_gpio4_slaves),
+	.class		= &gpio_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
#1 lore raw

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

In reply to Charulatha V

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              |  277 ++++++++++++++------------------
 arch/arm/plat-omap/include/plat/gpio.h |   68 ++++++++-
 2 files changed, 185 insertions(+), 160 deletions(-)
arch/arm/plat-omap/gpio.c +118 -159
index 45a225d..70deebc 100644
@@ -31,7 +31,6 @@
 /*
  * OMAP1510 GPIO registers
  */
-#define OMAP1510_GPIO_BASE		0xfffce000
 #define OMAP1510_GPIO_DATA_INPUT	0x00
 #define OMAP1510_GPIO_DATA_OUTPUT	0x04
 #define OMAP1510_GPIO_DIR_CONTROL	0x08
@@ -40,15 +39,9 @@
 #define OMAP1510_GPIO_INT_STATUS	0x14
 #define OMAP1510_GPIO_PIN_CONTROL	0x18
 
-#define OMAP1510_IH_GPIO_BASE		64
-
 /*
  * OMAP1610 specific GPIO registers
  */
-#define OMAP1610_GPIO1_BASE		0xfffbe400
-#define OMAP1610_GPIO2_BASE		0xfffbec00
-#define OMAP1610_GPIO3_BASE		0xfffbb400
-#define OMAP1610_GPIO4_BASE		0xfffbbc00
 #define OMAP1610_GPIO_REVISION		0x0000
 #define OMAP1610_GPIO_SYSCONFIG		0x0010
 #define OMAP1610_GPIO_SYSSTATUS		0x0014
@@ -70,12 +63,6 @@
 /*
  * OMAP7XX specific GPIO registers
  */
-#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 OMAP7XX_GPIO_DATA_INPUT		0x00
 #define OMAP7XX_GPIO_DATA_OUTPUT	0x04
 #define OMAP7XX_GPIO_DIR_CONTROL	0x08
@@ -83,22 +70,9 @@
 #define OMAP7XX_GPIO_INT_MASK		0x10
 #define OMAP7XX_GPIO_INT_STATUS		0x14
 
-#define OMAP1_MPUIO_VBASE		OMAP1_MPUIO_BASE
-
 /*
  * omap24xx specific GPIO registers
  */
-#define OMAP242X_GPIO1_BASE		0x48018000
-#define OMAP242X_GPIO2_BASE		0x4801a000
-#define OMAP242X_GPIO3_BASE		0x4801c000
-#define OMAP242X_GPIO4_BASE		0x4801e000
-
-#define OMAP243X_GPIO1_BASE		0x4900C000
-#define OMAP243X_GPIO2_BASE		0x4900E000
-#define OMAP243X_GPIO3_BASE		0x49010000
-#define OMAP243X_GPIO4_BASE		0x49012000
-#define OMAP243X_GPIO5_BASE		0x480B6000
-
 #define OMAP24XX_GPIO_REVISION		0x0000
 #define OMAP24XX_GPIO_SYSCONFIG		0x0010
 #define OMAP24XX_GPIO_SYSSTATUS		0x0014
@@ -150,26 +124,6 @@
 #define OMAP4_GPIO_DEBOUNCINGTIME	0x0154
 #define OMAP4_GPIO_CLEARDATAOUT		0x0190
 #define OMAP4_GPIO_SETDATAOUT		0x0194
-/*
- * omap34xx specific GPIO registers
- */
-
-#define OMAP34XX_GPIO1_BASE		0x48310000
-#define OMAP34XX_GPIO2_BASE		0x49050000
-#define OMAP34XX_GPIO3_BASE		0x49052000
-#define OMAP34XX_GPIO4_BASE		0x49054000
-#define OMAP34XX_GPIO5_BASE		0x49056000
-#define OMAP34XX_GPIO6_BASE		0x49058000
-
-/*
- * OMAP44XX  specific GPIO registers
- */
-#define OMAP44XX_GPIO1_BASE             0x4a310000
-#define OMAP44XX_GPIO2_BASE             0x48055000
-#define OMAP44XX_GPIO3_BASE             0x48057000
-#define OMAP44XX_GPIO4_BASE             0x48059000
-#define OMAP44XX_GPIO5_BASE             0x4805B000
-#define OMAP44XX_GPIO6_BASE             0x4805D000
 
 struct gpio_bank {
 	unsigned long pbase;
@@ -181,14 +135,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;
@@ -1669,6 +1621,122 @@ 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()) {
+		static const u32 non_wakeup_gpios[] = {
+			0xe203ffc0, 0x08700040
+		};
+		if (id < ARRAY_SIZE(non_wakeup_gpios))
+			bank->non_wakeup_gpios = non_wakeup_gpios[id];
+
+		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())
+			/* 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 = 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;
@@ -1779,7 +1847,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);
@@ -1791,105 +1858,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 (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 = 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);
@@ -1899,17 +1869,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;
arch/arm/plat-omap/include/plat/gpio.h +67 -1

82 lines not on this page · raw message

Signature · 1 line
1.6.3.3
#3 lore raw

PATCH 3/11 OMAP: GPIO: Introduce support for OMAP15xx chip GPIO init

In reply to Charulatha V

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 |  99 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 104 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap1/gpio15xx.c
arch/arm/mach-omap1/gpio15xx.c new file +99 -0
new file mode 100644
index 0000000..c9082bd
@@ -0,0 +1,99 @@
+/*
+ * 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>
+
+static struct omap_gpio_dev_attr omap15xx_gpio_attr = {
+		.gpio_bank_count	= 2,
+		.gpio_bank_bits		= 16,
+		.arm_gpio_ck_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 5/11 OMAP: GPIO: Introduce support for OMAP7xx chip GPIO init

In reply to Charulatha V

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 |  266 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 266 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap1/gpio7xx.c
arch/arm/mach-omap1/gpio7xx.c new file +266 -0
new file mode 100644
index 0000000..56a482c
@@ -0,0 +1,266 @@
+/*
+ * 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>
+
+static struct omap_gpio_dev_attr omap7xx_gpio_attr = {
+	.gpio_bank_count	= 7,
+	.gpio_bank_bits		= 32,
+	.arm_gpio_ck_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
#10 lore raw

PATCH 10/11 OMAP: GPIO: Implement GPIO as a platform device

In reply to Charulatha V

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

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 files so that device names can be used to obtain clock instead of getting clocks by name/NULL ptr.

GPIO driver uses runtime APIs.Clock FW APIs are used to enable iclk and fclk when CONFIG_PM_RUNTIME is not defined.

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     |    2 +-
 arch/arm/mach-omap2/Makefile         |    2 +-
 arch/arm/mach-omap2/clock2420_data.c |   10 +-
 arch/arm/mach-omap2/clock2430_data.c |   14 +-
 arch/arm/mach-omap2/clock3xxx_data.c |   24 +-
 arch/arm/mach-omap2/clock44xx_data.c |   24 +-
 arch/arm/plat-omap/gpio.c            |  389 +++++++++++-----------------------
 8 files changed, 178 insertions(+), 293 deletions(-)
arch/arm/mach-omap1/Makefile +6 -0
index b6a537c..dabd2be 100644
@@ -45,6 +45,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 +1 -1
index aa8558a..9bc2aa1 100644
@@ -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", "arm_gpio_ck", &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 58a0474..d2d63ca 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/mach-omap2/clock2420_data.c +8 -2
index d932b14..a693403 100644
@@ -1802,8 +1802,14 @@ static struct omap_clk omap2420_clks[] = {
 	CLK(NULL,	"uart2_fck",	&uart2_fck,	CK_242X),
 	CLK(NULL,	"uart3_ick",	&uart3_ick,	CK_242X),
 	CLK(NULL,	"uart3_fck",	&uart3_fck,	CK_242X),
-	CLK(NULL,	"gpios_ick",	&gpios_ick,	CK_242X),
-	CLK(NULL,	"gpios_fck",	&gpios_fck,	CK_242X),
+	CLK("omap-gpio.0",	"ick",	&gpios_ick,	CK_242X),
+	CLK("omap-gpio.1",	"ick",	&gpios_ick,	CK_242X),
+	CLK("omap-gpio.2",	"ick",	&gpios_ick,	CK_242X),
+	CLK("omap-gpio.3",	"ick",	&gpios_ick,	CK_242X),
+	CLK("omap-gpio.0",	"fck",	&gpios_fck,	CK_242X),
+	CLK("omap-gpio.1",	"fck",	&gpios_fck,	CK_242X),
+	CLK("omap-gpio.2",	"fck",	&gpios_fck,	CK_242X),
+	CLK("omap-gpio.3",	"fck",	&gpios_fck,	CK_242X),
 	CLK("omap_wdt",	"ick",		&mpu_wdt_ick,	CK_242X),
 	CLK("omap_wdt",	"fck",		&mpu_wdt_fck,	CK_242X),
 	CLK(NULL,	"sync_32k_ick",	&sync_32k_ick,	CK_242X),
arch/arm/mach-omap2/clock2430_data.c +10 -4
index 0438b6e..56bbcbc 100644
@@ -1896,8 +1896,14 @@ static struct omap_clk omap2430_clks[] = {
 	CLK(NULL,	"uart2_fck",	&uart2_fck,	CK_243X),
 	CLK(NULL,	"uart3_ick",	&uart3_ick,	CK_243X),
 	CLK(NULL,	"uart3_fck",	&uart3_fck,	CK_243X),
-	CLK(NULL,	"gpios_ick",	&gpios_ick,	CK_243X),
-	CLK(NULL,	"gpios_fck",	&gpios_fck,	CK_243X),
+	CLK("omap-gpio.0",	"ick",	&gpios_ick,	CK_243X),
+	CLK("omap-gpio.1",	"ick",	&gpios_ick,	CK_243X),
+	CLK("omap-gpio.2",	"ick",	&gpios_ick,	CK_243X),
+	CLK("omap-gpio.3",	"ick",	&gpios_ick,	CK_243X),
+	CLK("omap-gpio.0",	"fck",	&gpios_fck,	CK_243X),
+	CLK("omap-gpio.1",	"fck",	&gpios_fck,	CK_243X),
+	CLK("omap-gpio.2",	"fck",	&gpios_fck,	CK_243X),
+	CLK("omap-gpio.3",	"fck",	&gpios_fck,	CK_243X),
 	CLK("omap_wdt",	"ick",		&mpu_wdt_ick,	CK_243X),
 	CLK("omap_wdt",	"fck",		&mpu_wdt_fck,	CK_243X),
 	CLK(NULL,	"sync_32k_ick",	&sync_32k_ick,	CK_243X),
@@ -1934,8 +1940,8 @@ static struct omap_clk omap2430_clks[] = {
 	CLK("mmci-omap-hs.0", "fck",	&mmchs1_fck,	CK_243X),
 	CLK("mmci-omap-hs.1", "ick",	&mmchs2_ick,	CK_243X),
 	CLK("mmci-omap-hs.1", "fck",	&mmchs2_fck,	CK_243X),
-	CLK(NULL,	"gpio5_ick",	&gpio5_ick,	CK_243X),
-	CLK(NULL,	"gpio5_fck",	&gpio5_fck,	CK_243X),
+	CLK("omap-gpio.4",	"ick",	&gpio5_ick,	CK_243X),
+	CLK("omap-gpio.4",	"fck",	&gpio5_fck,	CK_243X),
 	CLK(NULL,	"mdm_intc_ick",	&mdm_intc_ick,	CK_243X),
 	CLK("mmci-omap-hs.0", "mmchsdb_fck",	&mmchsdb1_fck,	CK_243X),
 	CLK("mmci-omap-hs.1", "mmchsdb_fck", 	&mmchsdb2_fck,	CK_243X),
arch/arm/mach-omap2/clock3xxx_data.c +12 -12
index 9cba556..3962234 100644
@@ -3407,13 +3407,13 @@ static struct omap_clk omap3xxx_clks[] = {
 	CLK(NULL,	"usim_fck",	&usim_fck,	CK_3430ES2),
 	CLK(NULL,	"gpt1_fck",	&gpt1_fck,	CK_3XXX),
 	CLK(NULL,	"wkup_32k_fck",	&wkup_32k_fck,	CK_3XXX),
-	CLK(NULL,	"gpio1_dbck",	&gpio1_dbck,	CK_3XXX),
+	CLK("omap-gpio.0",	"dbck",	&gpio1_dbck,	CK_3XXX),
 	CLK("omap_wdt",	"fck",		&wdt2_fck,	CK_3XXX),
 	CLK(NULL,	"wkup_l4_ick",	&wkup_l4_ick,	CK_343X),
 	CLK(NULL,	"usim_ick",	&usim_ick,	CK_3430ES2),
 	CLK("omap_wdt",	"ick",		&wdt2_ick,	CK_3XXX),
 	CLK(NULL,	"wdt1_ick",	&wdt1_ick,	CK_3XXX),
-	CLK(NULL,	"gpio1_ick",	&gpio1_ick,	CK_3XXX),
+	CLK("omap-gpio.0",	"ick",	&gpio1_ick,	CK_3XXX),
 	CLK(NULL,	"omap_32ksync_ick", &omap_32ksync_ick, CK_3XXX),
 	CLK(NULL,	"gpt12_ick",	&gpt12_ick,	CK_3XXX),
 	CLK(NULL,	"gpt1_ick",	&gpt1_ick,	CK_3XXX),
@@ -3429,18 +3429,18 @@ static struct omap_clk omap3xxx_clks[] = {
 	CLK(NULL,	"gpt8_fck",	&gpt8_fck,	CK_3XXX),
 	CLK(NULL,	"gpt9_fck",	&gpt9_fck,	CK_3XXX),
 	CLK(NULL,	"per_32k_alwon_fck", &per_32k_alwon_fck, CK_3XXX),
-	CLK(NULL,	"gpio6_dbck",	&gpio6_dbck,	CK_3XXX),
-	CLK(NULL,	"gpio5_dbck",	&gpio5_dbck,	CK_3XXX),
-	CLK(NULL,	"gpio4_dbck",	&gpio4_dbck,	CK_3XXX),
-	CLK(NULL,	"gpio3_dbck",	&gpio3_dbck,	CK_3XXX),
-	CLK(NULL,	"gpio2_dbck",	&gpio2_dbck,	CK_3XXX),
+	CLK("omap-gpio.5",	"dbck",	&gpio6_dbck,	CK_3XXX),
+	CLK("omap-gpio.4",	"dbck",	&gpio5_dbck,	CK_3XXX),
+	CLK("omap-gpio.3",	"dbck",	&gpio4_dbck,	CK_3XXX),
+	CLK("omap-gpio.2",	"dbck",	&gpio3_dbck,	CK_3XXX),
+	CLK("omap-gpio.1",	"dbck",	&gpio2_dbck,	CK_3XXX),
 	CLK(NULL,	"wdt3_fck",	&wdt3_fck,	CK_3XXX),
 	CLK(NULL,	"per_l4_ick",	&per_l4_ick,	CK_3XXX),
-	CLK(NULL,	"gpio6_ick",	&gpio6_ick,	CK_3XXX),
-	CLK(NULL,	"gpio5_ick",	&gpio5_ick,	CK_3XXX),
-	CLK(NULL,	"gpio4_ick",	&gpio4_ick,	CK_3XXX),
-	CLK(NULL,	"gpio3_ick",	&gpio3_ick,	CK_3XXX),
-	CLK(NULL,	"gpio2_ick",	&gpio2_ick,	CK_3XXX),
+	CLK("omap-gpio.5",	"ick",	&gpio6_ick,	CK_3XXX),
+	CLK("omap-gpio.4",	"ick",	&gpio5_ick,	CK_3XXX),
+	CLK("omap-gpio.3",	"ick",	&gpio4_ick,	CK_3XXX),
+	CLK("omap-gpio.2",	"ick",	&gpio3_ick,	CK_3XXX),
+	CLK("omap-gpio.1",	"ick",	&gpio2_ick,	CK_3XXX),
 	CLK(NULL,	"wdt3_ick",	&wdt3_ick,	CK_3XXX),
 	CLK(NULL,	"uart3_ick",	&uart3_ick,	CK_3XXX),
 	CLK(NULL,	"gpt9_ick",	&gpt9_ick,	CK_3XXX),
arch/arm/mach-omap2/clock44xx_data.c +12 -12
index a5c0c9c..4d76598 100644
@@ -2566,12 +2566,12 @@ static struct omap_clk omap44xx_clks[] = {
 	CLK(NULL,	"fdif_fck",			&fdif_fck,	CK_443X),
 	CLK(NULL,	"per_sgx_fclk",			&per_sgx_fclk,	CK_443X),
 	CLK(NULL,	"gfx_fck",			&gfx_fck,	CK_443X),
-	CLK(NULL,	"gpio1_ick",			&gpio1_ick,	CK_443X),
-	CLK(NULL,	"gpio2_ick",			&gpio2_ick,	CK_443X),
-	CLK(NULL,	"gpio3_ick",			&gpio3_ick,	CK_443X),
-	CLK(NULL,	"gpio4_ick",			&gpio4_ick,	CK_443X),
-	CLK(NULL,	"gpio5_ick",			&gpio5_ick,	CK_443X),
-	CLK(NULL,	"gpio6_ick",			&gpio6_ick,	CK_443X),
+	CLK("omap-gpio.0",	"ick",			&gpio1_ick,	CK_443X),
+	CLK("omap-gpio.1",	"ick",			&gpio2_ick,	CK_443X),
+	CLK("omap-gpio.2",	"ick",			&gpio3_ick,	CK_443X),
+	CLK("omap-gpio.3",	"ick",			&gpio4_ick,	CK_443X),
+	CLK("omap-gpio.4",	"ick",			&gpio5_ick,	CK_443X),
+	CLK("omap-gpio.5",	"ick",			&gpio6_ick,	CK_443X),
 	CLK(NULL,	"gpmc_ick",			&gpmc_ick,	CK_443X),
 	CLK(NULL,	"gpt1_fck",			&gpt1_fck,	CK_443X),
 	CLK(NULL,	"gpt10_fck",			&gpt10_fck,	CK_443X),
@@ -2645,12 +2645,12 @@ static struct omap_clk omap44xx_clks[] = {
 	CLK(NULL,	"usim_fclk",			&usim_fclk,	CK_443X),
 	CLK(NULL,	"utmi_p1_gfclk_ck",		&utmi_p1_gfclk_ck,	CK_443X),
 	CLK(NULL,	"utmi_p2_gfclk_ck",		&utmi_p2_gfclk_ck,	CK_443X),
-	CLK(NULL,	"gpio1_dbck",			&dummy_ck,	CK_443X),
-	CLK(NULL,	"gpio2_dbck",			&dummy_ck,	CK_443X),
-	CLK(NULL,	"gpio3_dbck",			&dummy_ck,	CK_443X),
-	CLK(NULL,	"gpio4_dbck",			&dummy_ck,	CK_443X),
-	CLK(NULL,	"gpio5_dbck",			&dummy_ck,	CK_443X),
-	CLK(NULL,	"gpio6_dbck",			&dummy_ck,	CK_443X),
+	CLK("omap-gpio.0",	"dbck",			&dummy_ck,	CK_443X),
+	CLK("omap-gpio.1",	"dbck",			&dummy_ck,	CK_443X),
+	CLK("omap-gpio.2",	"dbck",			&dummy_ck,	CK_443X),
+	CLK("omap-gpio.3",	"dbck",			&dummy_ck,	CK_443X),
+	CLK("omap-gpio.4",	"dbck",			&dummy_ck,	CK_443X),
+	CLK("omap-gpio.5",	"dbck",			&dummy_ck,	CK_443X),
 	CLK(NULL,	"gpmc_ck",			&dummy_ck,	CK_443X),
 	CLK(NULL,	"gpt1_ick",			&dummy_ck,	CK_443X),
 	CLK(NULL,	"gpt2_ick",			&dummy_ck,	CK_443X),
arch/arm/plat-omap/gpio.c +120 -261

477 lines not on this page · raw message

Signature · 1 line
1.6.3.3
#11 lore raw

PATCH 11/11 OMAP: GPIO: Remove omap_gpio_init()

This patch removes the usage of omap_gpio_init() in 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-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 -
 35 files changed, 0 insertions(+), 40 deletions(-)
arch/arm/mach-omap1/board-ams-delta.c +0 -1
index 7fc11c3..7c0c812 100644
@@ -134,7 +134,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 e36639f..82a9a59 100644
@@ -279,7 +279,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 01d113f..7c4c2bc 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 5822bcf..8e9f10b 100644
@@ -329,7 +329,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 b88f28c..25e39cb 100644
@@ -102,7 +102,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 c1c4389..5926617 100644
@@ -270,7 +270,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 2de4f79..5b397f5 100644
@@ -704,7 +704,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 47e3af2..18662a0 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 5fcb52e..e12e468 100644
@@ -292,7 +292,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 962d377..faa118f 100644
@@ -363,7 +363,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 017bb2f..bbaa0de 100644
@@ -628,7 +628,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 395d049..3fe0d17 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-omap3touchbook.c +0 -1
index 2504d41..3ad378d 100644
@@ -445,7 +445,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 8848c7c..0fb3153 100644
@@ -387,7 +387,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 b155c36..97f888b 100644
@@ -107,7 +107,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 9a26f84..7f71256 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 cd3e40c..49e17f1 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 55a5796..5308147 100644
@@ -2086,12 +2086,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 d2d310b..a60b3a3 100644
@@ -152,7 +152,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_retention(void);
 extern void omap2_gpio_resume_after_retention(void);
 extern void omap_set_gpio_debounce(int gpio, int enable);
Signature · 1 line
1.6.3.3
#8 lore raw

PATCH 8/11 OMAP: GPIO: add GPIO hwmods structures for OMAP243X

In reply to Charulatha V

Add hwmod structures for GPIO module on OMAP243X

---
 arch/arm/mach-omap2/omap_hwmod_2430_data.c |  270 ++++++++++++++++++++++++++++
 1 files changed, 270 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/omap_hwmod_2430_data.c +270 -0
index d9c92aa..57a7d80 100644
@@ -16,6 +16,7 @@
 #include <plat/cpu.h>
 #include <plat/dma.h>
 #include <plat/mmc.h>
+#include <plat/gpio.h>
 
 #include "omap_hwmod_common_data.h"
 
@@ -73,6 +74,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 = {
@@ -117,10 +123,100 @@ static struct omap_hwmod_ocp_if omap2430_l4_core__mmc2 = {
 	.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,
+	&omap2430_l4_core__gpio5,
 };
 
 /* Master interfaces on the L4_CORE interconnect */
@@ -144,6 +240,10 @@ static struct omap_hwmod omap2430_l4_core_hwmod = {
 /* Slave interfaces on the L4_WKUP interconnect */
 static struct omap_hwmod_ocp_if *omap2430_l4_wkup_slaves[] = {
 	&omap2430_l4_core__l4_wkup,
+	&omap2430_l4_wkup__gpio1,
+	&omap2430_l4_wkup__gpio2,
+	&omap2430_l4_wkup__gpio3,
+	&omap2430_l4_wkup__gpio4,
 };
 
 /* Master interfaces on the L4_WKUP interconnect */
@@ -283,11 +383,181 @@ static struct omap_hwmod omap2430_mmc2_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,
+	.fck_flag = true,
+};
+
+static struct omap_hwmod_class_sysconfig gpio_sysc = {
+	.rev_offs	= 0x0000,
+	.sysc_offs	= 0x0010,
+	.syss_offs	= 0x0014,
+	.sysc_flags	= (SYSC_HAS_SIDLEMODE |
+			   SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
+			   SYSC_HAS_AUTOIDLE),
+	.idlemodes	= (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+	.sysc_fields    = &omap_hwmod_sysc_type1,
+};
+
+static struct omap_hwmod_class gpio_class = {
+	.name = "gpio",
+	.sysc = &gpio_sysc,
+};
+
+/* GPIO1 */
+
+static struct omap_hwmod_irq_info gpio1_mpu_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_hwmod",
+	.mpu_irqs	= gpio1_mpu_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(gpio1_mpu_irqs),
+	.main_clk	= "gpios_fck",
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP24XX_EN_GPIOS_SHIFT,
+		},
+	},
+	.slaves		= omap2430_gpio1_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap2430_gpio1_slaves),
+	.class		= &gpio_class,
+	.dev_attr	= &gpio_dev_attr,
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
+};
+
+/* GPIO2 */
+
+static struct omap_hwmod_irq_info gpio2_mpu_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_hwmod",
+	.mpu_irqs	= gpio2_mpu_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(gpio2_mpu_irqs),
+	.main_clk	= "gpios_fck",
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP24XX_EN_GPIOS_SHIFT,
+		},
+	},
+	.slaves		= omap2430_gpio2_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap2430_gpio2_slaves),
+	.class		= &gpio_class,
+	.dev_attr	= &gpio_dev_attr,
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
+};
+
+/* GPIO3 */
+
+static struct omap_hwmod_irq_info gpio3_mpu_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_hwmod",
+	.mpu_irqs	= gpio3_mpu_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(gpio3_mpu_irqs),
+	.main_clk	= "gpios_fck",
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP24XX_EN_GPIOS_SHIFT,
+		},
+	},
+	.slaves		= omap2430_gpio3_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap2430_gpio3_slaves),
+	.class		= &gpio_class,
+	.dev_attr	= &gpio_dev_attr,
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
+};
+
+/* GPIO4 */
+
+static struct omap_hwmod_irq_info gpio4_mpu_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_hwmod",
+	.mpu_irqs	= gpio4_mpu_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(gpio4_mpu_irqs),
+	.main_clk	= "gpios_fck",
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP24XX_EN_GPIOS_SHIFT,
+		},
+	},
+	.slaves		= omap2430_gpio4_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap2430_gpio4_slaves),
+	.class		= &gpio_class,
+	.dev_attr	= &gpio_dev_attr,
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
+};
+
+/* GPIO5 */
+
+static struct omap_hwmod_irq_info gpio5_mpu_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_hwmod",
+	.mpu_irqs	= gpio5_mpu_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(gpio5_mpu_irqs),
+	.main_clk	= "gpio5_fck",
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 1,
+			.module_bit = OMAP24XX_EN_GPIOS_SHIFT,
+		},
+	},
+	.slaves		= omap2430_gpio5_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap2430_gpio5_slaves),
+	.class		= &gpio_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
maintainer
#23 lore raw

Re: [PATCH 01/11] OMAP: GPIO: Modify init() in preparation for platform device implementation

In reply to Charulatha V
Quoted 8 lines · Charulatha V

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.

<snip>

Quoted 31 lines
arch/arm/plat-omap/include/plat/gpio.h +15 -1
index de7c547..a06acb6 100644
@@ -29,7 +29,8 @@
 #include <linux/io.h>
 #include <mach/irqs.h>
 
-#define OMAP1_MPUIO_BASE			0xfffb5000
+#define OMAP1_MPUIO_BASE		0xfffb5000
+#define OMAP1_MPUIO_VBASE		OMAP1_MPUIO_BASE
 
 #if (defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850))
 
@@ -62,8 +63,73 @@
 #define OMAP_MPUIO_LATCH		0x34
 #endif
 
+/*
+ * OMAP1510 GPIO base addresses
+ */
+#define OMAP1510_GPIO_BASE		0xfffce000
+#define OMAP1510_IH_GPIO_BASE		64
+
+/*
+ * OMAP1610 GPIO base addresses
+ */
+#define OMAP1610_GPIO1_BASE		0xfffbe400
+#define OMAP1610_GPIO2_BASE		0xfffbec00
+#define OMAP1610_GPIO3_BASE		0xfffbb400
+#define OMAP1610_GPIO4_BASE		0xfffbbc00

arch/arm/plat-omap/include/plat/gpio.h line 88

Quoted 10 lines
arch/arm/plat-omap/include/plat/gpio.h +10 -0
+
+/*
+ * OMAP7XX GPIO base addresses
+ */
+#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

Please move these into the mach-omap1/gpio1xxx.c instead, they should not be needed anywhere else. We don't want to have the GPIO registers available in the common headers as otherwise we'll get tons of drivers that suddenly start tinkering with these registers directly..

arch/arm/plat-omap/include/plat/gpio.h line 102

Quoted 13 lines
arch/arm/plat-omap/include/plat/gpio.h +13 -0
+/*
+ * omap24xx GPIO base addresses
+ */
+#define OMAP242X_GPIO1_BASE		0x48018000
+#define OMAP242X_GPIO2_BASE		0x4801a000
+#define OMAP242X_GPIO3_BASE		0x4801c000
+#define OMAP242X_GPIO4_BASE		0x4801e000
+
+#define OMAP243X_GPIO1_BASE		0x4900C000
+#define OMAP243X_GPIO2_BASE		0x4900E000
+#define OMAP243X_GPIO3_BASE		0x49010000
+#define OMAP243X_GPIO4_BASE		0x49012000
+#define OMAP243X_GPIO5_BASE		0x480B6000

These should go into mach-omap2/gpioxxxx.c. The same for the others.

Regards,

Tony

maintainer
#28 lore raw
In reply to Charulatha V
Quoted 7 lines · Charulatha V

This patch series implements GPIO module in platform device model. It also makes OMAP2PLUS specific GPIO implemented in HWMOD FW way.

This patch series is created on "origin/pm-wip/runtime".

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

Great, thanks. Let's give review these, and then if no more comments, let's test them in the linux-omap master branch. Too late to get these merged for this merge window for sure.

Regards,

Tony

maintainer
#18 lore raw

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

In reply to Charulatha V
Quoted 43 lines · Charulatha V

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

arch/arm/mach-omap2/gpio.c new file +36 -0
+
+/*
+ * 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 omap242x_gpio_init(void)
+{	if (!cpu_is_omap2420())
+		return -EINVAL;
+
+	return gpio_init(METHOD_GPIO_24XX);
+}
+postcore_initcall(omap242x_gpio_init);
+
+static int __init omap243x_gpio_init(void)
+{
+	if (!cpu_is_omap2430())
+		return -EINVAL;
+
+	return gpio_init(METHOD_GPIO_24XX);
+}
+postcore_initcall(omap243x_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
+

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

Quoted 10 lines
arch/arm/mach-omap2/gpio.c new file +10 -0
+#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

What was the reason again for using postcore_initcall? You mentioned it somewhere, but I forgot already.. Maybe put that into the patch description too?

Regards,

Tony

#24 lore raw

RE: [PATCH 01/11] OMAP: GPIO: Modify init() in preparation for platform device implementation

In reply to Tony Lindgren
Quoted 72 lines

-----Original Message-----
From: Tony Lindgren [mailto:[email protected]]
Sent: Wednesday, May 19, 2010 5:11 AM
To: Varadarajan, Charulatha
Cc: [email protected]; Nayak, Rajendra; [email protected]; [email protected]
Subject: Re: [PATCH 01/11] OMAP: GPIO: Modify init() in preparation for platform device implementation

Quoted 8 lines · Charulatha V

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.

<snip>

arch/arm/plat-

Quoted 1 line
arch/arm/plat- renamed from arch/arm/plat-omap/include/plat/gpio.h +0 -0

omap/include/plat/gpio.h

Quoted 30 lines

index de7c547..a06acb6 100644

arch/arm/plat-omap/include/plat/gpio.h +15 -1
@@ -29,7 +29,8 @@
 #include <linux/io.h>
 #include <mach/irqs.h>
 
-#define OMAP1_MPUIO_BASE			0xfffb5000
+#define OMAP1_MPUIO_BASE		0xfffb5000
+#define OMAP1_MPUIO_VBASE		OMAP1_MPUIO_BASE
 
 #if (defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850))
 
@@ -62,8 +63,73 @@
 #define OMAP_MPUIO_LATCH		0x34
 #endif
 
+/*
+ * OMAP1510 GPIO base addresses
+ */
+#define OMAP1510_GPIO_BASE		0xfffce000
+#define OMAP1510_IH_GPIO_BASE		64
+
+/*
+ * OMAP1610 GPIO base addresses
+ */
+#define OMAP1610_GPIO1_BASE		0xfffbe400
+#define OMAP1610_GPIO2_BASE		0xfffbec00
+#define OMAP1610_GPIO3_BASE		0xfffbb400
+#define OMAP1610_GPIO4_BASE		0xfffbbc00

arch/arm/plat-omap/include/plat/gpio.h line 88

Quoted 10 lines
arch/arm/plat-omap/include/plat/gpio.h +10 -0
+
+/*
+ * OMAP7XX GPIO base addresses
+ */
+#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

Please move these into the mach-omap1/gpio1xxx.c instead, they should not be needed anywhere else. We don't want to have the GPIO registers available in the common headers as otherwise we'll get tons of drivers that suddenly start tinkering with these registers directly..

Quoted 16 lines

arch/arm/plat-omap/include/plat/gpio.h line 102

Quoted 13 lines
arch/arm/plat-omap/include/plat/gpio.h +13 -0
+/*
+ * omap24xx GPIO base addresses
+ */
+#define OMAP242X_GPIO1_BASE		0x48018000
+#define OMAP242X_GPIO2_BASE		0x4801a000
+#define OMAP242X_GPIO3_BASE		0x4801c000
+#define OMAP242X_GPIO4_BASE		0x4801e000
+
+#define OMAP243X_GPIO1_BASE		0x4900C000
+#define OMAP243X_GPIO2_BASE		0x4900E000
+#define OMAP243X_GPIO3_BASE		0x49010000
+#define OMAP243X_GPIO4_BASE		0x49012000
+#define OMAP243X_GPIO5_BASE		0x480B6000

These should go into mach-omap2/gpioxxxx.c. The same for the others.

They are used in omap_hwmod_xxxx_data.c files. That is why they are
moved to plat-omap/gpio.h files.
1. Instead of having them in common headers, I can move them to mach-omapx/gpio.h. 2. Else, hard code these addresses directly in hwmod data structures and avoid moving these definitions to header files.

Quoted 4 lines

Regards,

Tony

#19 lore raw

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

In reply to Tony Lindgren
Quoted 15 lines

-----Original Message-----
From: Tony Lindgren [mailto:[email protected]]
Sent: Wednesday, May 19, 2010 5:17 AM
To: Varadarajan, Charulatha
Cc: [email protected]; Nayak, Rajendra; [email protected]; [email protected]
Subject: Re: [PATCH 09/11] OMAP: GPIO: Introduce support for OMAP2PLUS chip GPIO init

Quoted 3 lines · Charulatha V

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

Quoted 8 lines

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

Quoted 8 lines
arch/arm/mach-omap2/gpio.c new file +6 -0
+
+/*
+ * gpio_init needs to be done before
+ * machine_init functions access gpio APIs.
+ * Hence gpio_init is a postcore_initcall.
+ */

Need for postcore_initcall is mentioned here as a common comment for all SoCs in the beginning of the file

Quoted 36 lines
Quoted 36 lines
arch/arm/mach-omap2/gpio.c new file +36 -0
+#ifdef CONFIG_ARCH_OMAP2
+static int __init omap242x_gpio_init(void)
+{	if (!cpu_is_omap2420())
+		return -EINVAL;
+
+	return gpio_init(METHOD_GPIO_24XX);
+}
+postcore_initcall(omap242x_gpio_init);
+
+static int __init omap243x_gpio_init(void)
+{
+	if (!cpu_is_omap2430())
+		return -EINVAL;
+
+	return gpio_init(METHOD_GPIO_24XX);
+}
+postcore_initcall(omap243x_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;
+
Quoted 8 lines

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

Quoted 4 lines
arch/arm/mach-omap2/gpio.c new file +4 -0
+	return gpio_init(METHOD_GPIO_44XX);
+}
+postcore_initcall(omap44xx_gpio_init);
+#endif

What was the reason again for using postcore_initcall? You mentioned it somewhere, but I forgot already.. Maybe put that into the patch description too?

Okay. I will add it in this patch description too.

Quoted 4 lines

Regards,

Tony

#29 lore raw
In reply to Tony Lindgren
Quoted 14 lines

-----Original Message-----
From: Tony Lindgren [mailto:[email protected]]
Sent: Wednesday, May 19, 2010 5:12 AM
To: Varadarajan, Charulatha
Cc: [email protected]; Nayak, Rajendra; [email protected]; [email protected]
Subject: Re: [PATCH 00/11] OMAP: GPIO: Implement GPIO in HWMOD way

Quoted 3 lines · Charulatha V

This patch series implements GPIO module in platform device model. It also makes OMAP2PLUS specific GPIO implemented in HWMOD FW way.

Quoted 8 lines
Quoted 4 lines

This patch series is created on "origin/pm-wip/runtime".

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

Great, thanks. Let's give review these, and then if no more comments, let's test them in the linux-omap master branch. Too late to get these merged for this merge window for sure.

GPIO uses pm_runtime APIs and unless all pm_runtime related patches are upstreamed, we cannot test this patch series on linux-omap master branch.

Quoted 4 lines

Regards,

Tony

#14 lore raw

RE: [PATCH 10/11] OMAP: GPIO: Implement GPIO as a platform device

In reply to a message not in the archive

Hi Charu

Quoted 36 lines

From: Varadarajan, Charulatha

Quoted 25 lines

From: Cousson, Benoit
Sent: Tuesday, May 18, 2010 10:55 PM

Hi Charu,

On 5/18/2010 4:50 PM, Charulatha V wrote:

[snip]

arch/arm/mach-

Quoted 1 line
arch/arm/mach- renamed from arch/arm/mach-omap2/clock2420_data.c +0 -0

omap2/clock2420_data.c

Quoted 14 lines

index d932b14..a693403 100644

arch/arm/mach-omap2/clock2420_data.c +5 -2
@@ -1802,8 +1802,14 @@ static struct omap_clk omap2420_clks[] = {
         CLK(NULL,       "uart2_fck",&uart2_fck,     CK_242X),
         CLK(NULL,       "uart3_ick",&uart3_ick,     CK_242X),
         CLK(NULL,       "uart3_fck",&uart3_fck,     CK_242X),
-       CLK(NULL,       "gpios_ick",&gpios_ick,     CK_242X),
-       CLK(NULL,       "gpios_fck",&gpios_fck,     CK_242X),
+       CLK("omap-gpio.0",      "ick",&gpios_ick,     CK_242X),
+       CLK("omap-gpio.1",      "ick",&gpios_ick,     CK_242X),
+       CLK("omap-gpio.2",      "ick",&gpios_ick,     CK_242X),
+       CLK("omap-gpio.3",      "ick",&gpios_ick,     CK_242X),
+       CLK("omap-gpio.0",      "fck",&gpios_fck,     CK_242X),
Quoted 8 lines

arch/arm/mach-omap2/clock2420_data.c static struct omap_clk omap2420_clks[] = { · line 1812

Quoted 3 lines
arch/arm/mach-omap2/clock2420_data.c +3 -0
+       CLK("omap-gpio.1",      "fck",&gpios_fck,     CK_242X),
+       CLK("omap-gpio.2",      "fck",&gpios_fck,     CK_242X),
+       CLK("omap-gpio.3",      "fck",&gpios_fck,     CK_242X),

Are you sure that this is still needed? In theory Paul removed the dependency a couple of months ago.
HWMOD does not need that anymore at least, it is relying on the clock name only.

Quoted 6 lines

You are right. These are not required if hwmod is used. But here we use pm_runtime APIs which needs clk_get/ clk_enable in case of CONFIG_PM_RUNTIME is not defined.
Also in OMAP3&4, for dbck we need clk_get/clk_enable to be used as opt_clk is
taken care by the driver. Hence the above changes are required.

That still looks wrong to me. We cannot keep exposing manual clock management method in case runtime_pm is not used. It makes the whole hwmod isolation stuff a little bit useless, it forces us to maintain some dummy clocks node... In that case you should use the omap_device to enable the device.
Dbck are listed as opt_clock in the hwmod struct and thus can be accesses.

Paul, Kevin,
Any thoughts on that?

Benoit

Texas Instruments France SA, 821 Avenue Jack Kilby, 06270 Villeneuve Loubet. 036 420 040 R.C.S Antibes. Capital de EUR 753.920

#25 lore raw

Re: [PATCH 01/11] OMAP: GPIO: Modify init() in preparation for platform device implementation

In reply to Varadarajan, Charulatha
Quoted 82 lines · Charulatha
Quoted 65 lines

From: Tony Lindgren [mailto:[email protected]]
Sent: Wednesday, May 19, 2010 5:11 AM

Quoted 8 lines · Charulatha V

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.

<snip>

arch/arm/plat-

Quoted 1 line
arch/arm/plat- renamed from arch/arm/plat-omap/include/plat/gpio.h +0 -0

omap/include/plat/gpio.h

Quoted 30 lines

index de7c547..a06acb6 100644

arch/arm/plat-omap/include/plat/gpio.h +15 -1
@@ -29,7 +29,8 @@
  #include<linux/io.h>
  #include<mach/irqs.h>
 
-#define OMAP1_MPUIO_BASE			0xfffb5000
+#define OMAP1_MPUIO_BASE		0xfffb5000
+#define OMAP1_MPUIO_VBASE		OMAP1_MPUIO_BASE
 
  #if (defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850))
 
@@ -62,8 +63,73 @@
  #define OMAP_MPUIO_LATCH		0x34
  #endif
 
+/*
+ * OMAP1510 GPIO base addresses
+ */
+#define OMAP1510_GPIO_BASE		0xfffce000
+#define OMAP1510_IH_GPIO_BASE		64
+
+/*
+ * OMAP1610 GPIO base addresses
+ */
+#define OMAP1610_GPIO1_BASE		0xfffbe400
+#define OMAP1610_GPIO2_BASE		0xfffbec00
+#define OMAP1610_GPIO3_BASE		0xfffbb400
+#define OMAP1610_GPIO4_BASE		0xfffbbc00

arch/arm/plat-omap/include/plat/gpio.h line 88

Quoted 10 lines
arch/arm/plat-omap/include/plat/gpio.h +10 -0
+
+/*
+ * OMAP7XX GPIO base addresses
+ */
+#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

Please move these into the mach-omap1/gpio1xxx.c instead, they should not be needed anywhere else. We don't want to have the GPIO registers available in the common headers as otherwise we'll get tons of drivers that suddenly start tinkering with these registers directly..

Quoted 16 lines

arch/arm/plat-omap/include/plat/gpio.h line 102

Quoted 13 lines
arch/arm/plat-omap/include/plat/gpio.h +13 -0
+/*
+ * omap24xx GPIO base addresses
+ */
+#define OMAP242X_GPIO1_BASE		0x48018000
+#define OMAP242X_GPIO2_BASE		0x4801a000
+#define OMAP242X_GPIO3_BASE		0x4801c000
+#define OMAP242X_GPIO4_BASE		0x4801e000
+
+#define OMAP243X_GPIO1_BASE		0x4900C000
+#define OMAP243X_GPIO2_BASE		0x4900E000
+#define OMAP243X_GPIO3_BASE		0x49010000
+#define OMAP243X_GPIO4_BASE		0x49012000
+#define OMAP243X_GPIO5_BASE		0x480B6000

These should go into mach-omap2/gpioxxxx.c. The same for the others.

Quoted 5 lines

They are used in omap_hwmod_xxxx_data.c files. That is why they are moved to plat-omap/gpio.h files.
1. Instead of having them in common headers, I can move them to mach-omapx/gpio.h.
2. Else, hard code these addresses directly in hwmod data structures and avoid moving these definitions to header files.

What was agreed on that is to eventually move all the SoC base address in a single header file (omapXXXX.h) that should be used only by the omap_hwmod_xxxx_data.c file.

Benoit

#31 lore raw
In reply to Charulatha V
Quoted 7 lines · Charulatha V

This patch series implements GPIO module in platform device model. It also makes OMAP2PLUS specific GPIO implemented in HWMOD FW way.

This patch series is created on "origin/pm-wip/runtime".

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

What about OMAP4? Didn't you test it on SDP or Blaze?

Benoit

Quoted 73 lines

Charulatha V (11):
OMAP: GPIO: Modify init() in preparation for platform device
implementation
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: 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           |    2 +-
  arch/arm/mach-omap1/gpio15xx.c             |  104 +++++
  arch/arm/mach-omap1/gpio16xx.c             |  202 +++++++++
  arch/arm/mach-omap1/gpio7xx.c              |  266 ++++++++++++
  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-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/clock2420_data.c       |   10 +-
  arch/arm/mach-omap2/clock2430_data.c       |   14 +-
  arch/arm/mach-omap2/clock3xxx_data.c       |   24 +-
  arch/arm/mach-omap2/clock44xx_data.c       |   24 +-
  arch/arm/mach-omap2/gpio.c                 |  113 +++++
  arch/arm/mach-omap2/omap_hwmod_2420_data.c |  222 ++++++++++
  arch/arm/mach-omap2/omap_hwmod_2430_data.c |  270 ++++++++++++
  arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |  357 ++++++++++++++++-
  arch/arm/plat-omap/gpio.c                  |  622 ++++++++++------------------
  arch/arm/plat-omap/include/plat/gpio.h     |   84 ++++-
  49 files changed, 1886 insertions(+), 469 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

--
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

#32 lore raw
Quoted 14 lines

-----Original Message-----
From: Cousson, Benoit
Sent: Wednesday, May 19, 2010 2:24 PM
To: Varadarajan, Charulatha
Cc: [email protected]; Nayak, Rajendra; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 00/11] OMAP: GPIO: Implement GPIO in HWMOD way

Quoted 3 lines · Charulatha V

This patch series implements GPIO module in platform device model. It also makes OMAP2PLUS specific GPIO implemented in HWMOD FW way.

Quoted 6 lines
Quoted 4 lines

This patch series is created on "origin/pm-wip/runtime".

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

What about OMAP4? Didn't you test it on SDP or Blaze?

I tested this series on 4430SDP using an TI internal tree. Since origin/pm-wip/runtime branch does not have OMAP4 hwmod database, I did not mention about OMAP4.

Quoted 76 lines

Benoit

Quoted 73 lines

Charulatha V (11):
OMAP: GPIO: Modify init() in preparation for platform device
implementation
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: 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           |    2 +-
  arch/arm/mach-omap1/gpio15xx.c             |  104 +++++
  arch/arm/mach-omap1/gpio16xx.c             |  202 +++++++++
  arch/arm/mach-omap1/gpio7xx.c              |  266 ++++++++++++
  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-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/clock2420_data.c       |   10 +-
  arch/arm/mach-omap2/clock2430_data.c       |   14 +-
  arch/arm/mach-omap2/clock3xxx_data.c       |   24 +-
  arch/arm/mach-omap2/clock44xx_data.c       |   24 +-
  arch/arm/mach-omap2/gpio.c                 |  113 +++++
  arch/arm/mach-omap2/omap_hwmod_2420_data.c |  222 ++++++++++
  arch/arm/mach-omap2/omap_hwmod_2430_data.c |  270 ++++++++++++
  arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |  357 ++++++++++++++++-
  arch/arm/plat-omap/gpio.c                  |  622 ++++++++++------------------
  arch/arm/plat-omap/include/plat/gpio.h     |   84 ++++-
  49 files changed, 1886 insertions(+), 469 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

--
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

#26 lore raw

RE: [PATCH 01/11] OMAP: GPIO: Modify init() in preparation for platform device implementation

In reply to Benoit Cousson
Quoted 97 lines

-----Original Message-----
From: Cousson, Benoit
Sent: Wednesday, May 19, 2010 1:32 PM
To: Varadarajan, Charulatha
Cc: Tony Lindgren; [email protected]; Nayak, Rajendra; [email protected]; [email protected]
Subject: Re: [PATCH 01/11] OMAP: GPIO: Modify init() in preparation for platform device implementation

Quoted 82 lines · Charulatha
Quoted 65 lines

From: Tony Lindgren [mailto:[email protected]]
Sent: Wednesday, May 19, 2010 5:11 AM

Quoted 8 lines · Charulatha V

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.

<snip>

arch/arm/plat-

Quoted 1 line
arch/arm/plat- renamed from arch/arm/plat-omap/include/plat/gpio.h +0 -0

omap/include/plat/gpio.h

Quoted 30 lines

index de7c547..a06acb6 100644

arch/arm/plat-omap/include/plat/gpio.h +15 -1
@@ -29,7 +29,8 @@
  #include<linux/io.h>
  #include<mach/irqs.h>
 
-#define OMAP1_MPUIO_BASE			0xfffb5000
+#define OMAP1_MPUIO_BASE		0xfffb5000
+#define OMAP1_MPUIO_VBASE		OMAP1_MPUIO_BASE
 
  #if (defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850))
 
@@ -62,8 +63,73 @@
  #define OMAP_MPUIO_LATCH		0x34
  #endif
 
+/*
+ * OMAP1510 GPIO base addresses
+ */
+#define OMAP1510_GPIO_BASE		0xfffce000
+#define OMAP1510_IH_GPIO_BASE		64
+
+/*
+ * OMAP1610 GPIO base addresses
+ */
+#define OMAP1610_GPIO1_BASE		0xfffbe400
+#define OMAP1610_GPIO2_BASE		0xfffbec00
+#define OMAP1610_GPIO3_BASE		0xfffbb400
+#define OMAP1610_GPIO4_BASE		0xfffbbc00

arch/arm/plat-omap/include/plat/gpio.h line 88

Quoted 10 lines
arch/arm/plat-omap/include/plat/gpio.h +10 -0
+
+/*
+ * OMAP7XX GPIO base addresses
+ */
+#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

Please move these into the mach-omap1/gpio1xxx.c instead, they should not be needed anywhere else. We don't want to have the GPIO registers available in the common headers as otherwise we'll get tons of drivers that suddenly start tinkering with these registers directly..

Quoted 16 lines

arch/arm/plat-omap/include/plat/gpio.h line 102

Quoted 13 lines
arch/arm/plat-omap/include/plat/gpio.h +13 -0
+/*
+ * omap24xx GPIO base addresses
+ */
+#define OMAP242X_GPIO1_BASE		0x48018000
+#define OMAP242X_GPIO2_BASE		0x4801a000
+#define OMAP242X_GPIO3_BASE		0x4801c000
+#define OMAP242X_GPIO4_BASE		0x4801e000
+
+#define OMAP243X_GPIO1_BASE		0x4900C000
+#define OMAP243X_GPIO2_BASE		0x4900E000
+#define OMAP243X_GPIO3_BASE		0x49010000
+#define OMAP243X_GPIO4_BASE		0x49012000
+#define OMAP243X_GPIO5_BASE		0x480B6000

These should go into mach-omap2/gpioxxxx.c. The same for the others.

Quoted 3 lines

They are used in omap_hwmod_xxxx_data.c files. That is why they are moved to plat-omap/gpio.h files.
1. Instead of having them in common headers, I can move them to mach-

Quoted 8 lines

omapx/gpio.h.

Quoted 1 line

2. Else, hard code these addresses directly in hwmod data structures

and avoid

Quoted 1 line

moving these definitions to header files.

What was agreed on that is to eventually move all the SoC base address in a single header file (omapXXXX.h) that should be used only by the omap_hwmod_xxxx_data.c file.

Can you give pointers on where this file would be located and if it is going to auto-generated?

Quoted 2 lines

Benoit

#33 lore raw
In reply to Varadarajan, Charulatha
Quoted 8 lines · Charulatha
Quoted 8 lines

From: Cousson, Benoit
Sent: Wednesday, May 19, 2010 2:24 PM

Quoted 3 lines · Charulatha V

This patch series implements GPIO module in platform device model. It also makes OMAP2PLUS specific GPIO implemented in HWMOD FW way.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

This patch series is created on "origin/pm-wip/runtime".

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

What about OMAP4? Didn't you test it on SDP or Blaze?

I tested this series on 4430SDP using an TI internal tree. Since origin/pm-wip/runtime branch does not have OMAP4 hwmod database, I did not mention about OMAP4.

Since the OMAP4 data was posted one week ago (https://patchwork.kernel.org/patch/99052/), I think you can use them in order to validate on both OMAP3 & OMAP4 with the public code.

Benoit

#27 lore raw

Re: [PATCH 01/11] OMAP: GPIO: Modify init() in preparation for platform device implementation

In reply to Varadarajan, Charulatha
Quoted 102 lines · Charulatha
Quoted 102 lines

-----Original Message-----
From: Cousson, Benoit
Sent: Wednesday, May 19, 2010 1:32 PM
To: Varadarajan, Charulatha
Cc: Tony Lindgren; [email protected]; Nayak, Rajendra; [email protected]; [email protected]
Subject: Re: [PATCH 01/11] OMAP: GPIO: Modify init() in preparation for platform device implementation

Quoted 82 lines · Charulatha
Quoted 65 lines

From: Tony Lindgren [mailto:[email protected]]
Sent: Wednesday, May 19, 2010 5:11 AM

Quoted 8 lines · Charulatha V

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.

<snip>

arch/arm/plat-

Quoted 1 line
arch/arm/plat- renamed from arch/arm/plat-omap/include/plat/gpio.h +0 -0

omap/include/plat/gpio.h

Quoted 30 lines

index de7c547..a06acb6 100644

arch/arm/plat-omap/include/plat/gpio.h +15 -1
@@ -29,7 +29,8 @@
   #include<linux/io.h>
   #include<mach/irqs.h>
 
-#define OMAP1_MPUIO_BASE			0xfffb5000
+#define OMAP1_MPUIO_BASE		0xfffb5000
+#define OMAP1_MPUIO_VBASE		OMAP1_MPUIO_BASE
 
   #if (defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850))
 
@@ -62,8 +63,73 @@
   #define OMAP_MPUIO_LATCH		0x34
   #endif
 
+/*
+ * OMAP1510 GPIO base addresses
+ */
+#define OMAP1510_GPIO_BASE		0xfffce000
+#define OMAP1510_IH_GPIO_BASE		64
+
+/*
+ * OMAP1610 GPIO base addresses
+ */
+#define OMAP1610_GPIO1_BASE		0xfffbe400
+#define OMAP1610_GPIO2_BASE		0xfffbec00
+#define OMAP1610_GPIO3_BASE		0xfffbb400
+#define OMAP1610_GPIO4_BASE		0xfffbbc00

arch/arm/plat-omap/include/plat/gpio.h line 88

Quoted 10 lines
arch/arm/plat-omap/include/plat/gpio.h +10 -0
+
+/*
+ * OMAP7XX GPIO base addresses
+ */
+#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

Please move these into the mach-omap1/gpio1xxx.c instead, they should not be needed anywhere else. We don't want to have the GPIO registers available in the common headers as otherwise we'll get tons of drivers that suddenly start tinkering with these registers directly..

Quoted 16 lines

arch/arm/plat-omap/include/plat/gpio.h line 102

Quoted 13 lines
arch/arm/plat-omap/include/plat/gpio.h +13 -0
+/*
+ * omap24xx GPIO base addresses
+ */
+#define OMAP242X_GPIO1_BASE		0x48018000
+#define OMAP242X_GPIO2_BASE		0x4801a000
+#define OMAP242X_GPIO3_BASE		0x4801c000
+#define OMAP242X_GPIO4_BASE		0x4801e000
+
+#define OMAP243X_GPIO1_BASE		0x4900C000
+#define OMAP243X_GPIO2_BASE		0x4900E000
+#define OMAP243X_GPIO3_BASE		0x49010000
+#define OMAP243X_GPIO4_BASE		0x49012000
+#define OMAP243X_GPIO5_BASE		0x480B6000

These should go into mach-omap2/gpioxxxx.c. The same for the others.

Quoted 3 lines

They are used in omap_hwmod_xxxx_data.c files. That is why they are moved to plat-omap/gpio.h files.
1. Instead of having them in common headers, I can move them to mach-

omapx/gpio.h.

Quoted 1 line

2. Else, hard code these addresses directly in hwmod data structures

and avoid

Quoted 1 line

moving these definitions to header files.

Quoted 5 lines
Quoted 3 lines

What was agreed on that is to eventually move all the SoC base address in a single header file (omapXXXX.h) that should be used only by the omap_hwmod_xxxx_data.c file.

Can you give pointers on where this file would be located and if it is going to auto-generated?

These are the already existing plat-omap/omapXXXX.h files. We should be able to generate them, and I think Paul already did a OMAP3 version, but that should not prevent you to just move manually the GPIO defines in theses files for the moment.

Do not take into account the following comment:
/*
* Please place only base defines here and put the rest in device
* specific headers.
*/

Benoit

#15 lore raw

Re: [PATCH 10/11] OMAP: GPIO: Implement GPIO as a platform device

In reply to Cousson, Benoit
Quoted 45 lines · Benoit

Hi Charu

Quoted 36 lines

From: Varadarajan, Charulatha

Quoted 25 lines

From: Cousson, Benoit
Sent: Tuesday, May 18, 2010 10:55 PM

Hi Charu,

On 5/18/2010 4:50 PM, Charulatha V wrote:

[snip]

arch/arm/mach-

Quoted 1 line
arch/arm/mach- renamed from arch/arm/mach-omap2/clock2420_data.c +0 -0

omap2/clock2420_data.c

Quoted 14 lines

index d932b14..a693403 100644

arch/arm/mach-omap2/clock2420_data.c +5 -2
@@ -1802,8 +1802,14 @@ static struct omap_clk omap2420_clks[] = {
         CLK(NULL,       "uart2_fck",&uart2_fck,     CK_242X),
         CLK(NULL,       "uart3_ick",&uart3_ick,     CK_242X),
         CLK(NULL,       "uart3_fck",&uart3_fck,     CK_242X),
-       CLK(NULL,       "gpios_ick",&gpios_ick,     CK_242X),
-       CLK(NULL,       "gpios_fck",&gpios_fck,     CK_242X),
+       CLK("omap-gpio.0",      "ick",&gpios_ick,     CK_242X),
+       CLK("omap-gpio.1",      "ick",&gpios_ick,     CK_242X),
+       CLK("omap-gpio.2",      "ick",&gpios_ick,     CK_242X),
+       CLK("omap-gpio.3",      "ick",&gpios_ick,     CK_242X),
+       CLK("omap-gpio.0",      "fck",&gpios_fck,     CK_242X),
Quoted 8 lines

arch/arm/mach-omap2/clock2420_data.c static struct omap_clk omap2420_clks[] = { · line 1812

Quoted 3 lines
arch/arm/mach-omap2/clock2420_data.c +3 -0
+       CLK("omap-gpio.1",      "fck",&gpios_fck,     CK_242X),
+       CLK("omap-gpio.2",      "fck",&gpios_fck,     CK_242X),
+       CLK("omap-gpio.3",      "fck",&gpios_fck,     CK_242X),

Are you sure that this is still needed? In theory Paul removed the dependency a couple of months ago.
HWMOD does not need that anymore at least, it is relying on the clock name only.

Quoted 6 lines

You are right. These are not required if hwmod is used. But here we use pm_runtime APIs which needs clk_get/ clk_enable in case of CONFIG_PM_RUNTIME is not defined.
Also in OMAP3&4, for dbck we need clk_get/clk_enable to be used as opt_clk is
taken care by the driver. Hence the above changes are required.

Quoted 3 lines

That still looks wrong to me. We cannot keep exposing manual clock management method in case runtime_pm is not used. It makes the whole hwmod isolation stuff a little bit useless, it forces us to maintain some dummy clocks node... In that case you should use the omap_device to enable the device.

I agree, the !CONFIG_PM_RUNTIME case can still use omap_device API.

Quoted 1 line

Dbck are listed as opt_clock in the hwmod struct and thus can be accesses.

Agreed.

Kevin

#30 lore raw
In reply to Varadarajan, Charulatha
Quoted 9 lines · Charulatha
Quoted 9 lines · Charulatha V
Quoted 7 lines

This patch series implements GPIO module in platform device model. It also makes OMAP2PLUS specific GPIO implemented in HWMOD FW way.

This patch series is created on "origin/pm-wip/runtime".

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

Quoted 6 lines
Quoted 3 lines

Great, thanks. Let's give review these, and then if no more comments, let's test them in the linux-omap master branch. Too late to get these merged for this merge window for sure.

GPIO uses pm_runtime APIs and unless all pm_runtime related patches are upstreamed, we cannot test this patch series on linux-omap master branch.

FYI... The runtime PM patches have now been posted[1] for review and for upstream.

Kevin

[1] http://marc.info/?l=linux-omap&m=127499480300445&w=2

#22 lore raw

Re: [PATCH 06/11] OMAP: GPIO: add GPIO hwmods structures for OMAP3

In reply to Charulatha V
Quoted 4 lines · Charulatha V

Add hwmod structures for GPIO module on OMAP3

[...]

Quoted 13 lines
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +13 -0
+/* GPIO1 */
+
+static struct omap_hwmod_irq_info gpio1_mpu_irqs[] = {
+	{ .name = "gpio_mpu_irq", .irq = INT_34XX_GPIO_BANK1 },
+};
+
+static struct omap_hwmod_opt_clk gpio1_opt_clks[] = {
+	{ .role = "gpio1_dbclk", .clk = "gpio1_dbck", },
+};
+
+static struct omap_hwmod_ocp_if *omap3xxx_gpio1_slaves[] = {
+	&omap3xxx_l4_wkup__gpio1,
+};

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

Quoted 10 lines
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +10 -0
+
+static struct omap_hwmod omap3xxx_gpio1_hwmod = {
+	.name		= "gpio1_hwmod",
+	.mpu_irqs	= gpio1_mpu_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(gpio1_mpu_irqs),
+	.main_clk	= NULL,
+	.opt_clks	= gpio1_opt_clks,
+	.opt_clks_cnt	= ARRAY_SIZE(gpio1_opt_clks),
+	.prcm		= {
+		.omap2 = {

With the _wait_for_ready() cleanups/fixes introduced by Benoit (and now in 2.6.35) you need to populate the .module_offs field here too.

I guess it will be WKUP_MOD for this one and OMAP3430_PER_MOD for the rest.

Kevin

#21 lore raw

Re: [PATCH 07/11] OMAP: GPIO: add GPIO hwmods structures for OMAP242X

In reply to Charulatha V

arch/arm/mach-omap2/omap_hwmod_2420_data.c static struct omap_hwmod omap2420_mpu_hwmod = { · line 258

Quoted 7 lines · Charulatha V
arch/arm/mach-omap2/omap_hwmod_2420_data.c +7 -0
+static struct omap_hwmod omap2420_gpio1_hwmod = {
+	.name		= "gpio1_hwmod",
+	.mpu_irqs	= gpio1_mpu_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(gpio1_mpu_irqs),
+	.main_clk	= "gpios_fck",
+	.prcm		= {
+		.omap2 = {

also needs .module_offs populated.

arch/arm/mach-omap2/omap_hwmod_2420_data.c static struct omap_hwmod omap2420_mpu_hwmod = { · line 269

Quoted 11 lines
arch/arm/mach-omap2/omap_hwmod_2420_data.c +11 -0
+			.prcm_reg_id = 1,
+			.module_bit = OMAP24XX_EN_GPIOS_SHIFT,
+		},
+	},
+	.slaves		= omap2420_gpio1_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap2420_gpio1_slaves),
+	.class		= &gpio_class,
+	.dev_attr	= &gpio_dev_attr,
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
+};
+

Kevin

#20 lore raw

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

In reply to Charulatha V
Quoted 4 lines · Charulatha V

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

[...]

Quoted 13 lines
arch/arm/mach-omap2/gpio.c new file +13 -0
+/*
+ * 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 omap242x_gpio_init(void)
+{	if (!cpu_is_omap2420())
+		return -EINVAL;
+
+	return gpio_init(METHOD_GPIO_24XX);
+}
+postcore_initcall(omap242x_gpio_init);

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

Quoted 10 lines
arch/arm/mach-omap2/gpio.c new file +10 -0
+
+static int __init omap243x_gpio_init(void)
+{
+	if (!cpu_is_omap2430())
+		return -EINVAL;
+
+	return gpio_init(METHOD_GPIO_24XX);
+}
+postcore_initcall(omap243x_gpio_init);
+#endif

Minor nit: you don't need separate functions for 2420 and 2430? A single one for OMAP2 with 'if (!cpu_is_omap24xx())' should do.

Kevin

#34 lore raw
In reply to Charulatha V
Quoted 7 lines · Charulatha V

This patch series implements GPIO module in platform device model. It also makes OMAP2PLUS specific GPIO implemented in HWMOD FW way.

This patch series is created on "origin/pm-wip/runtime".

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

Hi Charu,

This series is looking really good. Thanks!

Can you rebase it onto current pm-wip/runtime branch which has been updated to v2.6.35? There were a handful of GPIO changes that went upstream for 2.6.35 that make it so your series no longer applies. Yes, this is partially my fault for taking so long to review your series. Sorry.

Also note that current pm-wip/runtime is based on my pm-fixes branch which also includes this GPIO fix against 2.6.35:

https://patchwork.kernel.org/patch/103831/

Kevin

#16 lore raw

Re: [PATCH 10/11] OMAP: GPIO: Implement GPIO as a platform device

In reply to Charulatha V
Quoted 8 lines · Charulatha V

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

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.

Quoted 6 lines

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

GPIO driver uses runtime APIs.Clock FW APIs are used to enable iclk and fclk when CONFIG_PM_RUNTIME is not defined.

Something to discuss, and is not specific to your patch...

I handled the #ifndef CONFIG_PM_RUNTIME case as well when I did MMC, but I'm starting to second guess that.

Rather, I think what we should do is leave the handling of that out of the driver and instead just enable all hwmods at boot time if runtime PM is enabled.

Quoted 6 lines

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.

Also, one other general comment. In the driver, you should use dev_dbg() and dev_err() instead of pr_dbg() and pr_err(). Using these will include the device name and be more useful.

Quoted 10 lines
---
 arch/arm/mach-omap1/Makefile         |    6 +
 arch/arm/mach-omap1/clock_data.c     |    2 +-
 arch/arm/mach-omap2/Makefile         |    2 +-
 arch/arm/mach-omap2/clock2420_data.c |   10 +-
 arch/arm/mach-omap2/clock2430_data.c |   14 +-
 arch/arm/mach-omap2/clock3xxx_data.c |   24 +-
 arch/arm/mach-omap2/clock44xx_data.c |   24 +-
 arch/arm/plat-omap/gpio.c            |  389 +++++++++++-----------------------
 8 files changed, 178 insertions(+), 293 deletions(-)

small(er) is beautiful. I like the look of that diffstat. :)

Quoted 23 lines
arch/arm/mach-omap1/Makefile +6 -0
index b6a537c..dabd2be 100644
@@ -45,6 +45,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 +0 -0
index aa8558a..9bc2aa1 100644

arch/arm/mach-omap1/clock_data.c static struct omap_clk omap_clks[] = { · line 592

Quoted 5 lines
arch/arm/mach-omap1/clock_data.c +1 -1
@@ -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", "arm_gpio_ck", &arm_gpio_ck,	CK_1510 | CK_310),

This doesn't look right for OMAP1. With a device name, you should just drop the "arm_cpio_ck" part, so you can do a clk_get(dev, NULL).

Quoted 174 lines
arch/arm/mach-omap1/clock_data.c +0 -0
 	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 58a0474..d2d63ca 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/mach-omap2/clock2420_data.c +8 -2
index d932b14..a693403 100644
@@ -1802,8 +1802,14 @@ static struct omap_clk omap2420_clks[] = {
 	CLK(NULL,	"uart2_fck",	&uart2_fck,	CK_242X),
 	CLK(NULL,	"uart3_ick",	&uart3_ick,	CK_242X),
 	CLK(NULL,	"uart3_fck",	&uart3_fck,	CK_242X),
-	CLK(NULL,	"gpios_ick",	&gpios_ick,	CK_242X),
-	CLK(NULL,	"gpios_fck",	&gpios_fck,	CK_242X),
+	CLK("omap-gpio.0",	"ick",	&gpios_ick,	CK_242X),
+	CLK("omap-gpio.1",	"ick",	&gpios_ick,	CK_242X),
+	CLK("omap-gpio.2",	"ick",	&gpios_ick,	CK_242X),
+	CLK("omap-gpio.3",	"ick",	&gpios_ick,	CK_242X),
+	CLK("omap-gpio.0",	"fck",	&gpios_fck,	CK_242X),
+	CLK("omap-gpio.1",	"fck",	&gpios_fck,	CK_242X),
+	CLK("omap-gpio.2",	"fck",	&gpios_fck,	CK_242X),
+	CLK("omap-gpio.3",	"fck",	&gpios_fck,	CK_242X),
 	CLK("omap_wdt",	"ick",		&mpu_wdt_ick,	CK_242X),
 	CLK("omap_wdt",	"fck",		&mpu_wdt_fck,	CK_242X),
 	CLK(NULL,	"sync_32k_ick",	&sync_32k_ick,	CK_242X),
arch/arm/mach-omap2/clock2430_data.c +10 -4
index 0438b6e..56bbcbc 100644
@@ -1896,8 +1896,14 @@ static struct omap_clk omap2430_clks[] = {
 	CLK(NULL,	"uart2_fck",	&uart2_fck,	CK_243X),
 	CLK(NULL,	"uart3_ick",	&uart3_ick,	CK_243X),
 	CLK(NULL,	"uart3_fck",	&uart3_fck,	CK_243X),
-	CLK(NULL,	"gpios_ick",	&gpios_ick,	CK_243X),
-	CLK(NULL,	"gpios_fck",	&gpios_fck,	CK_243X),
+	CLK("omap-gpio.0",	"ick",	&gpios_ick,	CK_243X),
+	CLK("omap-gpio.1",	"ick",	&gpios_ick,	CK_243X),
+	CLK("omap-gpio.2",	"ick",	&gpios_ick,	CK_243X),
+	CLK("omap-gpio.3",	"ick",	&gpios_ick,	CK_243X),
+	CLK("omap-gpio.0",	"fck",	&gpios_fck,	CK_243X),
+	CLK("omap-gpio.1",	"fck",	&gpios_fck,	CK_243X),
+	CLK("omap-gpio.2",	"fck",	&gpios_fck,	CK_243X),
+	CLK("omap-gpio.3",	"fck",	&gpios_fck,	CK_243X),
 	CLK("omap_wdt",	"ick",		&mpu_wdt_ick,	CK_243X),
 	CLK("omap_wdt",	"fck",		&mpu_wdt_fck,	CK_243X),
 	CLK(NULL,	"sync_32k_ick",	&sync_32k_ick,	CK_243X),
@@ -1934,8 +1940,8 @@ static struct omap_clk omap2430_clks[] = {
 	CLK("mmci-omap-hs.0", "fck",	&mmchs1_fck,	CK_243X),
 	CLK("mmci-omap-hs.1", "ick",	&mmchs2_ick,	CK_243X),
 	CLK("mmci-omap-hs.1", "fck",	&mmchs2_fck,	CK_243X),
-	CLK(NULL,	"gpio5_ick",	&gpio5_ick,	CK_243X),
-	CLK(NULL,	"gpio5_fck",	&gpio5_fck,	CK_243X),
+	CLK("omap-gpio.4",	"ick",	&gpio5_ick,	CK_243X),
+	CLK("omap-gpio.4",	"fck",	&gpio5_fck,	CK_243X),
 	CLK(NULL,	"mdm_intc_ick",	&mdm_intc_ick,	CK_243X),
 	CLK("mmci-omap-hs.0", "mmchsdb_fck",	&mmchsdb1_fck,	CK_243X),
 	CLK("mmci-omap-hs.1", "mmchsdb_fck", 	&mmchsdb2_fck,	CK_243X),
arch/arm/mach-omap2/clock3xxx_data.c +12 -12
index 9cba556..3962234 100644
@@ -3407,13 +3407,13 @@ static struct omap_clk omap3xxx_clks[] = {
 	CLK(NULL,	"usim_fck",	&usim_fck,	CK_3430ES2),
 	CLK(NULL,	"gpt1_fck",	&gpt1_fck,	CK_3XXX),
 	CLK(NULL,	"wkup_32k_fck",	&wkup_32k_fck,	CK_3XXX),
-	CLK(NULL,	"gpio1_dbck",	&gpio1_dbck,	CK_3XXX),
+	CLK("omap-gpio.0",	"dbck",	&gpio1_dbck,	CK_3XXX),
 	CLK("omap_wdt",	"fck",		&wdt2_fck,	CK_3XXX),
 	CLK(NULL,	"wkup_l4_ick",	&wkup_l4_ick,	CK_343X),
 	CLK(NULL,	"usim_ick",	&usim_ick,	CK_3430ES2),
 	CLK("omap_wdt",	"ick",		&wdt2_ick,	CK_3XXX),
 	CLK(NULL,	"wdt1_ick",	&wdt1_ick,	CK_3XXX),
-	CLK(NULL,	"gpio1_ick",	&gpio1_ick,	CK_3XXX),
+	CLK("omap-gpio.0",	"ick",	&gpio1_ick,	CK_3XXX),
 	CLK(NULL,	"omap_32ksync_ick", &omap_32ksync_ick, CK_3XXX),
 	CLK(NULL,	"gpt12_ick",	&gpt12_ick,	CK_3XXX),
 	CLK(NULL,	"gpt1_ick",	&gpt1_ick,	CK_3XXX),
@@ -3429,18 +3429,18 @@ static struct omap_clk omap3xxx_clks[] = {
 	CLK(NULL,	"gpt8_fck",	&gpt8_fck,	CK_3XXX),
 	CLK(NULL,	"gpt9_fck",	&gpt9_fck,	CK_3XXX),
 	CLK(NULL,	"per_32k_alwon_fck", &per_32k_alwon_fck, CK_3XXX),
-	CLK(NULL,	"gpio6_dbck",	&gpio6_dbck,	CK_3XXX),
-	CLK(NULL,	"gpio5_dbck",	&gpio5_dbck,	CK_3XXX),
-	CLK(NULL,	"gpio4_dbck",	&gpio4_dbck,	CK_3XXX),
-	CLK(NULL,	"gpio3_dbck",	&gpio3_dbck,	CK_3XXX),
-	CLK(NULL,	"gpio2_dbck",	&gpio2_dbck,	CK_3XXX),
+	CLK("omap-gpio.5",	"dbck",	&gpio6_dbck,	CK_3XXX),
+	CLK("omap-gpio.4",	"dbck",	&gpio5_dbck,	CK_3XXX),
+	CLK("omap-gpio.3",	"dbck",	&gpio4_dbck,	CK_3XXX),
+	CLK("omap-gpio.2",	"dbck",	&gpio3_dbck,	CK_3XXX),
+	CLK("omap-gpio.1",	"dbck",	&gpio2_dbck,	CK_3XXX),
 	CLK(NULL,	"wdt3_fck",	&wdt3_fck,	CK_3XXX),
 	CLK(NULL,	"per_l4_ick",	&per_l4_ick,	CK_3XXX),
-	CLK(NULL,	"gpio6_ick",	&gpio6_ick,	CK_3XXX),
-	CLK(NULL,	"gpio5_ick",	&gpio5_ick,	CK_3XXX),
-	CLK(NULL,	"gpio4_ick",	&gpio4_ick,	CK_3XXX),
-	CLK(NULL,	"gpio3_ick",	&gpio3_ick,	CK_3XXX),
-	CLK(NULL,	"gpio2_ick",	&gpio2_ick,	CK_3XXX),
+	CLK("omap-gpio.5",	"ick",	&gpio6_ick,	CK_3XXX),
+	CLK("omap-gpio.4",	"ick",	&gpio5_ick,	CK_3XXX),
+	CLK("omap-gpio.3",	"ick",	&gpio4_ick,	CK_3XXX),
+	CLK("omap-gpio.2",	"ick",	&gpio3_ick,	CK_3XXX),
+	CLK("omap-gpio.1",	"ick",	&gpio2_ick,	CK_3XXX),
 	CLK(NULL,	"wdt3_ick",	&wdt3_ick,	CK_3XXX),
 	CLK(NULL,	"uart3_ick",	&uart3_ick,	CK_3XXX),
 	CLK(NULL,	"gpt9_ick",	&gpt9_ick,	CK_3XXX),
arch/arm/mach-omap2/clock44xx_data.c +12 -12
index a5c0c9c..4d76598 100644
@@ -2566,12 +2566,12 @@ static struct omap_clk omap44xx_clks[] = {
 	CLK(NULL,	"fdif_fck",			&fdif_fck,	CK_443X),
 	CLK(NULL,	"per_sgx_fclk",			&per_sgx_fclk,	CK_443X),
 	CLK(NULL,	"gfx_fck",			&gfx_fck,	CK_443X),
-	CLK(NULL,	"gpio1_ick",			&gpio1_ick,	CK_443X),
-	CLK(NULL,	"gpio2_ick",			&gpio2_ick,	CK_443X),
-	CLK(NULL,	"gpio3_ick",			&gpio3_ick,	CK_443X),
-	CLK(NULL,	"gpio4_ick",			&gpio4_ick,	CK_443X),
-	CLK(NULL,	"gpio5_ick",			&gpio5_ick,	CK_443X),
-	CLK(NULL,	"gpio6_ick",			&gpio6_ick,	CK_443X),
+	CLK("omap-gpio.0",	"ick",			&gpio1_ick,	CK_443X),
+	CLK("omap-gpio.1",	"ick",			&gpio2_ick,	CK_443X),
+	CLK("omap-gpio.2",	"ick",			&gpio3_ick,	CK_443X),
+	CLK("omap-gpio.3",	"ick",			&gpio4_ick,	CK_443X),
+	CLK("omap-gpio.4",	"ick",			&gpio5_ick,	CK_443X),
+	CLK("omap-gpio.5",	"ick",			&gpio6_ick,	CK_443X),
 	CLK(NULL,	"gpmc_ick",			&gpmc_ick,	CK_443X),
 	CLK(NULL,	"gpt1_fck",			&gpt1_fck,	CK_443X),
 	CLK(NULL,	"gpt10_fck",			&gpt10_fck,	CK_443X),
@@ -2645,12 +2645,12 @@ static struct omap_clk omap44xx_clks[] = {
 	CLK(NULL,	"usim_fclk",			&usim_fclk,	CK_443X),
 	CLK(NULL,	"utmi_p1_gfclk_ck",		&utmi_p1_gfclk_ck,	CK_443X),
 	CLK(NULL,	"utmi_p2_gfclk_ck",		&utmi_p2_gfclk_ck,	CK_443X),
-	CLK(NULL,	"gpio1_dbck",			&dummy_ck,	CK_443X),
-	CLK(NULL,	"gpio2_dbck",			&dummy_ck,	CK_443X),
-	CLK(NULL,	"gpio3_dbck",			&dummy_ck,	CK_443X),
-	CLK(NULL,	"gpio4_dbck",			&dummy_ck,	CK_443X),
-	CLK(NULL,	"gpio5_dbck",			&dummy_ck,	CK_443X),
-	CLK(NULL,	"gpio6_dbck",			&dummy_ck,	CK_443X),
+	CLK("omap-gpio.0",	"dbck",			&dummy_ck,	CK_443X),
+	CLK("omap-gpio.1",	"dbck",			&dummy_ck,	CK_443X),
+	CLK("omap-gpio.2",	"dbck",			&dummy_ck,	CK_443X),
+	CLK("omap-gpio.3",	"dbck",			&dummy_ck,	CK_443X),
+	CLK("omap-gpio.4",	"dbck",			&dummy_ck,	CK_443X),
+	CLK("omap-gpio.5",	"dbck",			&dummy_ck,	CK_443X),
 	CLK(NULL,	"gpmc_ck",			&dummy_ck,	CK_443X),
 	CLK(NULL,	"gpt1_ick",			&dummy_ck,	CK_443X),
 	CLK(NULL,	"gpt2_ick",			&dummy_ck,	CK_443X),
arch/arm/plat-omap/gpio.c +2 -0
index 70deebc..55a5796 100644
@@ -21,6 +21,8 @@
 #include <linux/err.h>
 #include <linux/clk.h>
 #include <linux/io.h>
+#include <linux/slab.h>
+#include <linux/pm_runtime.h>
 
 #include <mach/hardware.h>
 #include <asm/irq.h>

arch/arm/plat-omap/gpio.c struct gpio_bank { · line 153

Quoted 5 lines
arch/arm/plat-omap/gpio.c +2 -0
@@ -147,102 +149,11 @@ struct gpio_bank {
 	struct gpio_chip chip;
 	struct clk *dbck;
 	u32 mod_usage;
+	struct device *dev;
+	bool dbck_flag;

I don't really see a need for this flag. A failing clk_get() for a debounce clock should indicate that the bank does not have/support a debounce clock. After that, a non-null bank->dbclk will be an indicator.

Kevin

#17 lore raw

Re: [PATCH 10/11] OMAP: GPIO: Implement GPIO as a platform device

Quoted 2 lines · ext Kevin Hilman

This doesn't look right for OMAP1. With a device name, you should just drop the "arm_cpio_ck" part, so you can do a clk_get(dev, NULL).

I guess it doesn't matter. clkdev will try to match device and clk names, if that fails it will try device only and if that still fails, clk only. Although I think something like "ick" instead of "arm_gpio_ck" would be better.

And to decrease the amount of iterations to get the clock, use clk_get(dev, "ick");

Signature · 3 lines
balbi

DefectiveByDesign.org