This patch implements GPIO as a platform device. Also it
implements OMAP2PLUS specific GPIO as HWMOD FW adapted device.
This patch makes GPIO to use runtime APIs.
GPIO APIs are used in machine_init functions. Hence it is
required to complete GPIO probe before machine_init. Therefore
GPIO device register and driver register are implemented as
postcore_initcalls.
Inorder to convert GPIO as platform device, modifications are
required in clock_data.c file for OMAP1 so that device names
can be used to obtain clock instead of getting clocks by
name/NULL ptr.
omap_gpio_init() does nothing now and this function would be
removed in the next patch as it's usage is spread across most of
the board files.
TODO:
1. Cleanup the GPIO driver. Use function pointers and register
offest pointers instead of using hardcoded values
2. Remove all cpu_is_ checks and OMAP specific macros
3. Remove usage of gpio_bank array so that only
instance specific information is used in driver code
4. Modify save/restore context, gpio_prepare_for_idle,
and gpio_resume_after_idle functions as instance
specific function and not for all instances in a single call
5. Rename 'method'/ avoid it's usage
Signed-off-by: Charulatha V
Signed-off-by: Rajendra Nayak
Signed-off-by: Basak, Partha
---
arch/arm/mach-omap1/Makefile |6 +
arch/arm/mach-omap1/clock_data.c |4 +-
arch/arm/mach-omap2/Makefile |2 +-
arch/arm/plat-omap/gpio.c | 430
arch/arm/plat-omap/include/plat/gpio.h |3 +
5 files changed, 122 insertions(+), 323 deletions(-)
diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile
index fd4df71..69f293d 100644
--- a/arch/arm/mach-omap1/Makefile
+++ b/arch/arm/mach-omap1/Makefile
@@ -46,6 +46,12 @@ ifeq ($(CONFIG_ARCH_OMAP15XX),y)
obj-$(CONFIG_MACH_OMAP_INNOVATOR) += fpga.o
endif
+# GPIO
+obj-$(CONFIG_ARCH_OMAP730) += gpio7xx.o
+obj-$(CONFIG_ARCH_OMAP850) += gpio7xx.o
+obj-$(CONFIG_ARCH_OMAP15XX)+= gpio15xx.o
+obj-$(CONFIG_ARCH_OMAP16XX)+= gpio16xx.o
+
# LEDs support
led-$(CONFIG_MACH_OMAP_H2) += leds-h2p2-debug.o
led-$(CONFIG_MACH_OMAP_H3) += leds-h2p2-debug.o
diff --git a/arch/arm/mach-omap1/clock_data.c b/arch/arm/mach-omap1/clock_data.c
index aa8558a..5c2a0a1 100644
--- a/arch/arm/mach-omap1/clock_data.c
+++ b/arch/arm/mach-omap1/clock_data.c
@@ -99,7 +99,7 @@ static struct arm_idlect1_clk armper_ck = {
* activation. [ GPIO code for 1510 ]
*/
static struct clk arm_gpio_ck = {
- .name = "arm_gpio_ck",
+ .name = "ick",
.ops= &clkops_generic,
.parent = &ck_dpll1,
.flags = ENABLE_ON_INIT,
@@ -589,7 +589,7 @@ static struct omap_clk omap_clks[] = {
CLK(NULL, "ck_sossi", &sossi_ck, CK_16XX),
CLK(NULL, "arm_ck", &arm_ck,CK_16XX | CK_1510 |
CK_310),
CLK(NULL, "armper_ck",&armper_ck.clk, CK_16XX | CK_1510 |
CK_310),
- CLK(NULL, "arm_gpio_ck", &arm_gpio_ck, CK_1510 | CK_310),
+ CLK("omap-gpio.0", "ick", &arm_gpio_ck, CK_1510 | CK_310),
CLK(NULL, "armxor_ck",&armxor_ck.clk, CK_16XX | CK_1510 |
CK_310 | CK_7XX),
CLK(NULL, "armtim_ck",&armtim_ck.clk, CK_16XX | CK_1510 |
CK_310),
CLK("omap_wdt", "fck", &armwdt_ck.clk, CK_16XX | CK_1510 |
CK_310),
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index ae5f36f..0756b84 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -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 \
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index 3ea616a..7f8ef27 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -21,7 +21,10 @@
#include
#include
#include
+#include
+#include
+#include
#include
#include
#include
@@ -32,7 +35,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
@@ -46,10 +48,6 @@
/*
* OMAP1610 specific GPIO registers
*/
-#define OMAP1610_GPIO1_BASE0xfffbe400
-#define OMAP1610_GPIO2_BASE0xfffbec00
-#define OMAP1610_GPIO3_BASE0xfffbb400
-#define OMAP1610_GPIO4_BASE0xfffbbc00
#define OMAP1610_GPIO_REVISION 0x
#define OMAP1610_GPIO_SYSCONFIG0x0010
#define OMAP1610_GPIO_SYSSTATUS0x0014
@@ -71,12 +69,6 @@
/*
* OMAP7XX specific GPIO registers
*/
-#defin