aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorVaradarajan, Charulatha <charu@ti.com>2010-12-07 19:26:57 -0500
committerTony Lindgren <tony@atomide.com>2010-12-07 19:26:57 -0500
commit77640aabd7558e43b65bc1a0311be2dbb42c3ff8 (patch)
tree59a77126b13f4280c13b144fe3bb3a01d46df649 /arch
parentf547170fe721f145b7b7d6eb8b252e45f489dc4b (diff)
OMAP: GPIO: Implement GPIO as a platform device
Implement GPIO as a platform device. GPIO APIs are used in machine_init functions. Hence it is required to complete GPIO probe before board_init. Therefore GPIO device register and driver register are implemented as postcore_initcalls. 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. Inorder to convert GPIO as platform device, modifications are required in clockxxxx_data.c file for OMAP1 so that device names can be used to obtain clock instead of getting clocks by name/NULL ptr. Use runtime pm APIs (pm_runtime_put*/pm_runtime_get*) for enabling or disabling the clocks, modify sysconfig settings and remove usage of clock FW APIs. Note 1: Converting GPIO driver to use runtime PM APIs is not done as a separate patch because GPIO clock names are different for various OMAPs and are different for some of the banks in the same CPU. This would need usage of cpu_is checks and bank id checks while using clock FW APIs in the gpio driver. Hence while making GPIO a platform driver framework, PM runtime APIs are used directly. Note 2: While implementing GPIO as a platform device, pm runtime APIs are used as mentioned above and modification is not done in gpio's prepare for idle/ resume after idle functions. This would be done in the next patch series and GPIO driver would be made to use dev_pm_ops instead of sysdev_class in that series only. Due to the above, the GPIO driver implicitly relies on CM_AUTOIDLE = 1 on its iclk for power management to work, since the driver never disables its iclk. This would be taken care in the next patch series (see Note 3 below). Refer to http://www.mail-archive.com/linux-omap@vger.kernel.org/msg39112.html for more details. Note 3: only pm_runtime_get_sync is called in gpio's probe() and pm_runtime_put* is never called. This is to make the implementation similar to the existing GPIO code. Another patch series would be sent to correct this. In OMAP3 and OMAP4 gpio's debounce clocks are optional clocks. They are enabled/ disabled whenever required using clock framework APIs 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. Rename 'method'/ avoid it's usage 5. Fix the non-wakeup gpios handling for OMAP2430, OMAP3 & OMAP4 6. Modify gpio's prepare for idle/ resume after idle functions to use runtime pm implentation. Signed-off-by: Charulatha V <charu@ti.com> Signed-off-by: Rajendra Nayak <rnayak@ti.com> Reviewed-by: Basak, Partha <p-basak2@ti.com> Acked-by: Kevin Hilman <khilman@deeprootsystems.com> [tony@atomide.com: updated for bank specific revision and updated boards] Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-omap1/Makefile6
-rw-r--r--arch/arm/mach-omap1/board-ams-delta.c1
-rw-r--r--arch/arm/mach-omap1/board-fsample.c1
-rw-r--r--arch/arm/mach-omap1/board-h2.c1
-rw-r--r--arch/arm/mach-omap1/board-h3.c1
-rw-r--r--arch/arm/mach-omap1/board-htcherald.c2
-rw-r--r--arch/arm/mach-omap1/board-innovator.c1
-rw-r--r--arch/arm/mach-omap1/board-nokia770.c1
-rw-r--r--arch/arm/mach-omap1/board-osk.c1
-rw-r--r--arch/arm/mach-omap1/board-palmte.c1
-rw-r--r--arch/arm/mach-omap1/board-palmz71.c1
-rw-r--r--arch/arm/mach-omap1/board-perseus2.c1
-rw-r--r--arch/arm/mach-omap1/board-sx1.c1
-rw-r--r--arch/arm/mach-omap1/board-voiceblue.c1
-rw-r--r--arch/arm/mach-omap1/clock_data.c4
-rw-r--r--arch/arm/mach-omap2/Makefile2
-rw-r--r--arch/arm/mach-omap2/board-2430sdp.c1
-rw-r--r--arch/arm/mach-omap2/board-3430sdp.c1
-rw-r--r--arch/arm/mach-omap2/board-3630sdp.c1
-rw-r--r--arch/arm/mach-omap2/board-4430sdp.c1
-rw-r--r--arch/arm/mach-omap2/board-am3517crane.c2
-rw-r--r--arch/arm/mach-omap2/board-am3517evm.c1
-rw-r--r--arch/arm/mach-omap2/board-apollon.c1
-rw-r--r--arch/arm/mach-omap2/board-cm-t35.c1
-rw-r--r--arch/arm/mach-omap2/board-cm-t3517.c1
-rw-r--r--arch/arm/mach-omap2/board-devkit8000.c1
-rw-r--r--arch/arm/mach-omap2/board-h4.c1
-rw-r--r--arch/arm/mach-omap2/board-igep0020.c1
-rw-r--r--arch/arm/mach-omap2/board-igep0030.c1
-rw-r--r--arch/arm/mach-omap2/board-ldp.c1
-rw-r--r--arch/arm/mach-omap2/board-n8x0.c1
-rw-r--r--arch/arm/mach-omap2/board-omap3beagle.c1
-rw-r--r--arch/arm/mach-omap2/board-omap3evm.c1
-rw-r--r--arch/arm/mach-omap2/board-omap3logic.c1
-rw-r--r--arch/arm/mach-omap2/board-omap3pandora.c1
-rw-r--r--arch/arm/mach-omap2/board-omap3stalker.c1
-rw-r--r--arch/arm/mach-omap2/board-omap3touchbook.c1
-rw-r--r--arch/arm/mach-omap2/board-omap4panda.c1
-rw-r--r--arch/arm/mach-omap2/board-overo.c1
-rw-r--r--arch/arm/mach-omap2/board-rx51.c1
-rw-r--r--arch/arm/mach-omap2/board-zoom.c1
-rw-r--r--arch/arm/plat-omap/gpio.c413
-rw-r--r--arch/arm/plat-omap/include/plat/gpio.h1
43 files changed, 107 insertions, 359 deletions
diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile
index de3cc130ab8e..0b1c07ffa2f1 100644
--- a/arch/arm/mach-omap1/Makefile
+++ b/arch/arm/mach-omap1/Makefile
@@ -49,6 +49,12 @@ ifeq ($(CONFIG_ARCH_OMAP15XX),y)
49obj-$(CONFIG_MACH_OMAP_INNOVATOR) += fpga.o 49obj-$(CONFIG_MACH_OMAP_INNOVATOR) += fpga.o
50endif 50endif
51 51
52# GPIO
53obj-$(CONFIG_ARCH_OMAP730) += gpio7xx.o
54obj-$(CONFIG_ARCH_OMAP850) += gpio7xx.o
55obj-$(CONFIG_ARCH_OMAP15XX) += gpio15xx.o
56obj-$(CONFIG_ARCH_OMAP16XX) += gpio16xx.o
57
52# LEDs support 58# LEDs support
53led-$(CONFIG_MACH_OMAP_H2) += leds-h2p2-debug.o 59led-$(CONFIG_MACH_OMAP_H2) += leds-h2p2-debug.o
54led-$(CONFIG_MACH_OMAP_H3) += leds-h2p2-debug.o 60led-$(CONFIG_MACH_OMAP_H3) += leds-h2p2-debug.o
diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
index 9d97a72c5393..ce4d69ca15fe 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -141,7 +141,6 @@ static void __init ams_delta_init_irq(void)
141{ 141{
142 omap1_init_common_hw(); 142 omap1_init_common_hw();
143 omap_init_irq(); 143 omap_init_irq();
144 omap_gpio_init();
145} 144}
146 145
147static struct map_desc ams_delta_io_desc[] __initdata = { 146static struct map_desc ams_delta_io_desc[] __initdata = {
diff --git a/arch/arm/mach-omap1/board-fsample.c b/arch/arm/mach-omap1/board-fsample.c
index 295ab6713670..0c3f396328bd 100644
--- a/arch/arm/mach-omap1/board-fsample.c
+++ b/arch/arm/mach-omap1/board-fsample.c
@@ -327,7 +327,6 @@ static void __init omap_fsample_init_irq(void)
327{ 327{
328 omap1_init_common_hw(); 328 omap1_init_common_hw();
329 omap_init_irq(); 329 omap_init_irq();
330 omap_gpio_init();
331} 330}
332 331
333/* Only FPGA needs to be mapped here. All others are done with ioremap */ 332/* Only FPGA needs to be mapped here. All others are done with ioremap */
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index dd35efdefcf7..082a73ca5564 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -374,7 +374,6 @@ static void __init h2_init_irq(void)
374{ 374{
375 omap1_init_common_hw(); 375 omap1_init_common_hw();
376 omap_init_irq(); 376 omap_init_irq();
377 omap_gpio_init();
378} 377}
379 378
380static struct omap_usb_config h2_usb_config __initdata = { 379static struct omap_usb_config h2_usb_config __initdata = {
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index 78719198809e..d2cff5022fe5 100644
--- a/arch/arm/mach-omap1/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -437,7 +437,6 @@ static void __init h3_init_irq(void)
437{ 437{
438 omap1_init_common_hw(); 438 omap1_init_common_hw();
439 omap_init_irq(); 439 omap_init_irq();
440 omap_gpio_init();
441} 440}
442 441
443static void __init h3_map_io(void) 442static void __init h3_map_io(void)
diff --git a/arch/arm/mach-omap1/board-htcherald.c b/arch/arm/mach-omap1/board-htcherald.c
index 071af3e47789..faa344f734dc 100644
--- a/arch/arm/mach-omap1/board-htcherald.c
+++ b/arch/arm/mach-omap1/board-htcherald.c
@@ -577,8 +577,6 @@ static void __init htcherald_init(void)
577 printk(KERN_INFO "HTC Herald init.\n"); 577 printk(KERN_INFO "HTC Herald init.\n");
578 578
579 /* Do board initialization before we register all the devices */ 579 /* Do board initialization before we register all the devices */
580 omap_gpio_init();
581
582 omap_board_config = htcherald_config; 580 omap_board_config = htcherald_config;
583 omap_board_config_size = ARRAY_SIZE(htcherald_config); 581 omap_board_config_size = ARRAY_SIZE(htcherald_config);
584 platform_add_devices(devices, ARRAY_SIZE(devices)); 582 platform_add_devices(devices, ARRAY_SIZE(devices));
diff --git a/arch/arm/mach-omap1/board-innovator.c b/arch/arm/mach-omap1/board-innovator.c
index 0feaa6731c7e..a051acdc526a 100644
--- a/arch/arm/mach-omap1/board-innovator.c
+++ b/arch/arm/mach-omap1/board-innovator.c
@@ -290,7 +290,6 @@ static void __init innovator_init_irq(void)
290{ 290{
291 omap1_init_common_hw(); 291 omap1_init_common_hw();
292 omap_init_irq(); 292 omap_init_irq();
293 omap_gpio_init();
294#ifdef CONFIG_ARCH_OMAP15XX 293#ifdef CONFIG_ARCH_OMAP15XX
295 if (cpu_is_omap1510()) { 294 if (cpu_is_omap1510()) {
296 omap1510_fpga_init_irq(); 295 omap1510_fpga_init_irq();
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index aa8375b2a0a3..605495bbc583 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -246,7 +246,6 @@ static void __init omap_nokia770_init(void)
246 platform_add_devices(nokia770_devices, ARRAY_SIZE(nokia770_devices)); 246 platform_add_devices(nokia770_devices, ARRAY_SIZE(nokia770_devices));
247 spi_register_board_info(nokia770_spi_board_info, 247 spi_register_board_info(nokia770_spi_board_info,
248 ARRAY_SIZE(nokia770_spi_board_info)); 248 ARRAY_SIZE(nokia770_spi_board_info));
249 omap_gpio_init();
250 omap_serial_init(); 249 omap_serial_init();
251 omap_register_i2c_bus(1, 100, NULL, 0); 250 omap_register_i2c_bus(1, 100, NULL, 0);
252 hwa742_dev_init(); 251 hwa742_dev_init();
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
index 30bdbdb93636..d44e7172efc2 100644
--- a/arch/arm/mach-omap1/board-osk.c
+++ b/arch/arm/mach-omap1/board-osk.c
@@ -283,7 +283,6 @@ static void __init osk_init_irq(void)
283{ 283{
284 omap1_init_common_hw(); 284 omap1_init_common_hw();
285 omap_init_irq(); 285 omap_init_irq();
286 omap_gpio_init();
287} 286}
288 287
289static struct omap_usb_config osk_usb_config __initdata = { 288static struct omap_usb_config osk_usb_config __initdata = {
diff --git a/arch/arm/mach-omap1/board-palmte.c b/arch/arm/mach-omap1/board-palmte.c
index f32738b1eb6b..994dc6f50729 100644
--- a/arch/arm/mach-omap1/board-palmte.c
+++ b/arch/arm/mach-omap1/board-palmte.c
@@ -63,7 +63,6 @@ static void __init omap_palmte_init_irq(void)
63{ 63{
64 omap1_init_common_hw(); 64 omap1_init_common_hw();
65 omap_init_irq(); 65 omap_init_irq();
66 omap_gpio_init();
67} 66}
68 67
69static const int palmte_keymap[] = { 68static const int palmte_keymap[] = {
diff --git a/arch/arm/mach-omap1/board-palmz71.c b/arch/arm/mach-omap1/board-palmz71.c
index d7a245cef9a4..2afac598baee 100644
--- a/arch/arm/mach-omap1/board-palmz71.c
+++ b/arch/arm/mach-omap1/board-palmz71.c
@@ -62,7 +62,6 @@ omap_palmz71_init_irq(void)
62{ 62{
63 omap1_init_common_hw(); 63 omap1_init_common_hw();
64 omap_init_irq(); 64 omap_init_irq();
65 omap_gpio_init();
66} 65}
67 66
68static int palmz71_keymap[] = { 67static int palmz71_keymap[] = {
diff --git a/arch/arm/mach-omap1/board-perseus2.c b/arch/arm/mach-omap1/board-perseus2.c
index 07660be4f228..69fda218fb45 100644
--- a/arch/arm/mach-omap1/board-perseus2.c
+++ b/arch/arm/mach-omap1/board-perseus2.c
@@ -295,7 +295,6 @@ static void __init omap_perseus2_init_irq(void)
295{ 295{
296 omap1_init_common_hw(); 296 omap1_init_common_hw();
297 omap_init_irq(); 297 omap_init_irq();
298 omap_gpio_init();
299} 298}
300/* Only FPGA needs to be mapped here. All others are done with ioremap */ 299/* Only FPGA needs to be mapped here. All others are done with ioremap */
301static struct map_desc omap_perseus2_io_desc[] __initdata = { 300static struct map_desc omap_perseus2_io_desc[] __initdata = {
diff --git a/arch/arm/mach-omap1/board-sx1.c b/arch/arm/mach-omap1/board-sx1.c
index d25f59e5a773..463862c67819 100644
--- a/arch/arm/mach-omap1/board-sx1.c
+++ b/arch/arm/mach-omap1/board-sx1.c
@@ -409,7 +409,6 @@ static void __init omap_sx1_init_irq(void)
409{ 409{
410 omap1_init_common_hw(); 410 omap1_init_common_hw();
411 omap_init_irq(); 411 omap_init_irq();
412 omap_gpio_init();
413} 412}
414/*----------------------------------------*/ 413/*----------------------------------------*/
415 414
diff --git a/arch/arm/mach-omap1/board-voiceblue.c b/arch/arm/mach-omap1/board-voiceblue.c
index f5992c239bcd..789f5bac7359 100644
--- a/arch/arm/mach-omap1/board-voiceblue.c
+++ b/arch/arm/mach-omap1/board-voiceblue.c
@@ -158,7 +158,6 @@ static void __init voiceblue_init_irq(void)
158{ 158{
159 omap1_init_common_hw(); 159 omap1_init_common_hw();
160 omap_init_irq(); 160 omap_init_irq();
161 omap_gpio_init();
162} 161}
163 162
164static void __init voiceblue_init(void) 163static void __init voiceblue_init(void)
diff --git a/arch/arm/mach-omap1/clock_data.c b/arch/arm/mach-omap1/clock_data.c
index af54114b8f08..423d21d8c190 100644
--- a/arch/arm/mach-omap1/clock_data.c
+++ b/arch/arm/mach-omap1/clock_data.c
@@ -143,7 +143,7 @@ static struct arm_idlect1_clk armper_ck = {
143 * activation. [ GPIO code for 1510 ] 143 * activation. [ GPIO code for 1510 ]
144 */ 144 */
145static struct clk arm_gpio_ck = { 145static struct clk arm_gpio_ck = {
146 .name = "arm_gpio_ck", 146 .name = "ick",
147 .ops = &clkops_generic, 147 .ops = &clkops_generic,
148 .parent = &ck_dpll1, 148 .parent = &ck_dpll1,
149 .flags = ENABLE_ON_INIT, 149 .flags = ENABLE_ON_INIT,
@@ -684,7 +684,7 @@ static struct omap_clk omap_clks[] = {
684 CLK(NULL, "ck_sossi", &sossi_ck, CK_16XX), 684 CLK(NULL, "ck_sossi", &sossi_ck, CK_16XX),
685 CLK(NULL, "arm_ck", &arm_ck, CK_16XX | CK_1510 | CK_310), 685 CLK(NULL, "arm_ck", &arm_ck, CK_16XX | CK_1510 | CK_310),
686 CLK(NULL, "armper_ck", &armper_ck.clk, CK_16XX | CK_1510 | CK_310), 686 CLK(NULL, "armper_ck", &armper_ck.clk, CK_16XX | CK_1510 | CK_310),
687 CLK(NULL, "arm_gpio_ck", &arm_gpio_ck, CK_1510 | CK_310), 687 CLK("omap_gpio.0", "ick", &arm_gpio_ck, CK_1510 | CK_310),
688 CLK(NULL, "armxor_ck", &armxor_ck.clk, CK_16XX | CK_1510 | CK_310 | CK_7XX), 688 CLK(NULL, "armxor_ck", &armxor_ck.clk, CK_16XX | CK_1510 | CK_310 | CK_7XX),
689 CLK(NULL, "armtim_ck", &armtim_ck.clk, CK_16XX | CK_1510 | CK_310), 689 CLK(NULL, "armtim_ck", &armtim_ck.clk, CK_16XX | CK_1510 | CK_310),
690 CLK("omap_wdt", "fck", &armwdt_ck.clk, CK_16XX | CK_1510 | CK_310), 690 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 ce7b1f017670..fbc87395a025 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -4,7 +4,7 @@
4 4
5# Common support 5# Common support
6obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o pm.o \ 6obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o pm.o \
7 common.o 7 common.o gpio.o
8 8
9omap-2-3-common = irq.o sdrc.o prm2xxx_3xxx.o 9omap-2-3-common = irq.o sdrc.o prm2xxx_3xxx.o
10hwmod-common = omap_hwmod.o \ 10hwmod-common = omap_hwmod.o \
diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c
index b527f8d187ad..0f14001c1641 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -145,7 +145,6 @@ static void __init omap_2430sdp_init_irq(void)
145 omap_board_config_size = ARRAY_SIZE(sdp2430_config); 145 omap_board_config_size = ARRAY_SIZE(sdp2430_config);
146 omap2_init_common_hw(NULL, NULL); 146 omap2_init_common_hw(NULL, NULL);
147 omap_init_irq(); 147 omap_init_irq();
148 omap_gpio_init();
149} 148}
150 149
151static struct twl4030_gpio_platform_data sdp2430_gpio_data = { 150static struct twl4030_gpio_platform_data sdp2430_gpio_data = {
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c
index 4e3742c512b8..5cb23f3d4fc0 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -328,7 +328,6 @@ static void __init omap_3430sdp_init_irq(void)
328 omap3_pm_init_cpuidle(omap3_cpuidle_params_table); 328 omap3_pm_init_cpuidle(omap3_cpuidle_params_table);
329 omap2_init_common_hw(hyb18m512160af6_sdrc_params, NULL); 329 omap2_init_common_hw(hyb18m512160af6_sdrc_params, NULL);
330 omap_init_irq(); 330 omap_init_irq();
331 omap_gpio_init();
332} 331}
333 332
334static int sdp3430_batt_table[] = { 333static int sdp3430_batt_table[] = {
diff --git a/arch/arm/mach-omap2/board-3630sdp.c b/arch/arm/mach-omap2/board-3630sdp.c
index bbcf580fa097..b23f401aa6b6 100644
--- a/arch/arm/mach-omap2/board-3630sdp.c
+++ b/arch/arm/mach-omap2/board-3630sdp.c
@@ -76,7 +76,6 @@ static void __init omap_sdp_init_irq(void)
76 omap2_init_common_hw(h8mbx00u0mer0em_sdrc_params, 76 omap2_init_common_hw(h8mbx00u0mer0em_sdrc_params,
77 h8mbx00u0mer0em_sdrc_params); 77 h8mbx00u0mer0em_sdrc_params);
78 omap_init_irq(); 78 omap_init_irq();
79 omap_gpio_init();
80} 79}
81 80
82#ifdef CONFIG_OMAP_MUX 81#ifdef CONFIG_OMAP_MUX
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index 94d989bee8ad..8842ec5e51e3 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -223,7 +223,6 @@ static void __init omap_4430sdp_init_irq(void)
223 omap2_gp_clockevent_set_gptimer(1); 223 omap2_gp_clockevent_set_gptimer(1);
224#endif 224#endif
225 gic_init_irq(); 225 gic_init_irq();
226 omap_gpio_init();
227} 226}
228 227
229static struct omap_musb_board_data musb_board_data = { 228static struct omap_musb_board_data musb_board_data = {
diff --git a/arch/arm/mach-omap2/board-am3517crane.c b/arch/arm/mach-omap2/board-am3517crane.c
index 13ead330e389..8ba404770e75 100644
--- a/arch/arm/mach-omap2/board-am3517crane.c
+++ b/arch/arm/mach-omap2/board-am3517crane.c
@@ -19,7 +19,6 @@
19 19
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/gpio.h>
23 22
24#include <mach/hardware.h> 23#include <mach/hardware.h>
25#include <asm/mach-types.h> 24#include <asm/mach-types.h>
@@ -50,7 +49,6 @@ static void __init am3517_crane_init_irq(void)
50 49
51 omap2_init_common_hw(NULL, NULL); 50 omap2_init_common_hw(NULL, NULL);
52 omap_init_irq(); 51 omap_init_irq();
53 omap_gpio_init();
54} 52}
55 53
56static void __init am3517_crane_init(void) 54static void __init am3517_crane_init(void)
diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c
index 07399505312b..df6900e8ad5a 100644
--- a/arch/arm/mach-omap2/board-am3517evm.c
+++ b/arch/arm/mach-omap2/board-am3517evm.c
@@ -392,7 +392,6 @@ static void __init am3517_evm_init_irq(void)
392 392
393 omap2_init_common_hw(NULL, NULL); 393 omap2_init_common_hw(NULL, NULL);
394 omap_init_irq(); 394 omap_init_irq();
395 omap_gpio_init();
396} 395}
397 396
398static struct omap_musb_board_data musb_board_data = { 397static struct omap_musb_board_data musb_board_data = {
diff --git a/arch/arm/mach-omap2/board-apollon.c b/arch/arm/mach-omap2/board-apollon.c
index 6ae777e08896..f51f4f1e07f7 100644
--- a/arch/arm/mach-omap2/board-apollon.c
+++ b/arch/arm/mach-omap2/board-apollon.c
@@ -280,7 +280,6 @@ static void __init omap_apollon_init_irq(void)
280 omap_board_config_size = ARRAY_SIZE(apollon_config); 280 omap_board_config_size = ARRAY_SIZE(apollon_config);
281 omap2_init_common_hw(NULL, NULL); 281 omap2_init_common_hw(NULL, NULL);
282 omap_init_irq(); 282 omap_init_irq();
283 omap_gpio_init();
284} 283}
285 284
286static void __init apollon_led_init(void) 285static void __init apollon_led_init(void)
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c
index 63f764e2af3f..78b67fb790bf 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -686,7 +686,6 @@ static void __init cm_t35_init_irq(void)
686 omap2_init_common_hw(mt46h32m32lf6_sdrc_params, 686 omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
687 mt46h32m32lf6_sdrc_params); 687 mt46h32m32lf6_sdrc_params);
688 omap_init_irq(); 688 omap_init_irq();
689 omap_gpio_init();
690} 689}
691 690
692static struct omap_board_mux board_mux[] __initdata = { 691static struct omap_board_mux board_mux[] __initdata = {
diff --git a/arch/arm/mach-omap2/board-cm-t3517.c b/arch/arm/mach-omap2/board-cm-t3517.c
index 1dd303e9a267..7ee23dab84fe 100644
--- a/arch/arm/mach-omap2/board-cm-t3517.c
+++ b/arch/arm/mach-omap2/board-cm-t3517.c
@@ -250,7 +250,6 @@ static void __init cm_t3517_init_irq(void)
250 250
251 omap2_init_common_hw(NULL, NULL); 251 omap2_init_common_hw(NULL, NULL);
252 omap_init_irq(); 252 omap_init_irq();
253 omap_gpio_init();
254} 253}
255 254
256static struct omap_board_mux board_mux[] __initdata = { 255static struct omap_board_mux board_mux[] __initdata = {
diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c
index 53ac762518bd..a30a7fce8cbf 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -450,7 +450,6 @@ static void __init devkit8000_init_irq(void)
450#ifdef CONFIG_OMAP_32K_TIMER 450#ifdef CONFIG_OMAP_32K_TIMER
451 omap2_gp_clockevent_set_gptimer(12); 451 omap2_gp_clockevent_set_gptimer(12);
452#endif 452#endif
453 omap_gpio_init();
454} 453}
455 454
456static void __init devkit8000_ads7846_init(void) 455static void __init devkit8000_ads7846_init(void)
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c
index 929993b4bf26..68e6f4c8e00a 100644
--- a/arch/arm/mach-omap2/board-h4.c
+++ b/arch/arm/mach-omap2/board-h4.c
@@ -293,7 +293,6 @@ static void __init omap_h4_init_irq(void)
293 omap_board_config_size = ARRAY_SIZE(h4_config); 293 omap_board_config_size = ARRAY_SIZE(h4_config);
294 omap2_init_common_hw(NULL, NULL); 294 omap2_init_common_hw(NULL, NULL);
295 omap_init_irq(); 295 omap_init_irq();
296 omap_gpio_init();
297 h4_init_flash(); 296 h4_init_flash();
298} 297}
299 298
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c
index fe76b59b13ed..3bda186fe677 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -484,7 +484,6 @@ static void __init igep2_init_irq(void)
484{ 484{
485 omap2_init_common_hw(m65kxxxxam_sdrc_params, m65kxxxxam_sdrc_params); 485 omap2_init_common_hw(m65kxxxxam_sdrc_params, m65kxxxxam_sdrc_params);
486 omap_init_irq(); 486 omap_init_irq();
487 omap_gpio_init();
488} 487}
489 488
490static struct twl4030_codec_audio_data igep2_audio_data = { 489static struct twl4030_codec_audio_data igep2_audio_data = {
diff --git a/arch/arm/mach-omap2/board-igep0030.c b/arch/arm/mach-omap2/board-igep0030.c
index 22b0b253e16b..c7c57cdf83d6 100644
--- a/arch/arm/mach-omap2/board-igep0030.c
+++ b/arch/arm/mach-omap2/board-igep0030.c
@@ -291,7 +291,6 @@ static void __init igep3_init_irq(void)
291{ 291{
292 omap2_init_common_hw(m65kxxxxam_sdrc_params, m65kxxxxam_sdrc_params); 292 omap2_init_common_hw(m65kxxxxam_sdrc_params, m65kxxxxam_sdrc_params);
293 omap_init_irq(); 293 omap_init_irq();
294 omap_gpio_init();
295} 294}
296 295
297static struct twl4030_platform_data igep3_twl4030_pdata = { 296static struct twl4030_platform_data igep3_twl4030_pdata = {
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index 3dab44e3eb42..d97e3caed7c0 100644
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -294,7 +294,6 @@ static void __init omap_ldp_init_irq(void)
294 omap_board_config_size = ARRAY_SIZE(ldp_config); 294 omap_board_config_size = ARRAY_SIZE(ldp_config);
295 omap2_init_common_hw(NULL, NULL); 295 omap2_init_common_hw(NULL, NULL);
296 omap_init_irq(); 296 omap_init_irq();
297 omap_gpio_init();
298} 297}
299 298
300static struct twl4030_usb_data ldp_usb_data = { 299static struct twl4030_usb_data ldp_usb_data = {
diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
index e823c7042ab3..d8a489338e0c 100644
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -641,7 +641,6 @@ static void __init n8x0_init_irq(void)
641{ 641{
642 omap2_init_common_hw(NULL, NULL); 642 omap2_init_common_hw(NULL, NULL);
643 omap_init_irq(); 643 omap_init_irq();
644 omap_gpio_init();
645} 644}
646 645
647#ifdef CONFIG_OMAP_MUX 646#ifdef CONFIG_OMAP_MUX
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 14f42240ae79..a4131bef50fb 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -490,7 +490,6 @@ static void __init omap3_beagle_init_irq(void)
490#ifdef CONFIG_OMAP_32K_TIMER 490#ifdef CONFIG_OMAP_32K_TIMER
491 omap2_gp_clockevent_set_gptimer(12); 491 omap2_gp_clockevent_set_gptimer(12);
492#endif 492#endif
493 omap_gpio_init();
494} 493}
495 494
496static struct platform_device *omap3_beagle_devices[] __initdata = { 495static struct platform_device *omap3_beagle_devices[] __initdata = {
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index b04365c6bb10..5ca02202d608 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -625,7 +625,6 @@ static void __init omap3_evm_init_irq(void)
625 omap_board_config_size = ARRAY_SIZE(omap3_evm_config); 625 omap_board_config_size = ARRAY_SIZE(omap3_evm_config);
626 omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL); 626 omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL);
627 omap_init_irq(); 627 omap_init_irq();
628 omap_gpio_init();
629} 628}
630 629
631static struct platform_device *omap3_evm_devices[] __initdata = { 630static struct platform_device *omap3_evm_devices[] __initdata = {
diff --git a/arch/arm/mach-omap2/board-omap3logic.c b/arch/arm/mach-omap2/board-omap3logic.c
index 5f7d2c1e7ef5..263294044c7e 100644
--- a/arch/arm/mach-omap2/board-omap3logic.c
+++ b/arch/arm/mach-omap2/board-omap3logic.c
@@ -199,7 +199,6 @@ static void __init omap3logic_init_irq(void)
199{ 199{
200 omap2_init_common_hw(NULL, NULL); 200 omap2_init_common_hw(NULL, NULL);
201 omap_init_irq(); 201 omap_init_irq();
202 omap_gpio_init();
203} 202}
204 203
205#ifdef CONFIG_OMAP_MUX 204#ifdef CONFIG_OMAP_MUX
diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c
index 89ed1be2d62e..1031d7cadb3a 100644
--- a/arch/arm/mach-omap2/board-omap3pandora.c
+++ b/arch/arm/mach-omap2/board-omap3pandora.c
@@ -639,7 +639,6 @@ static void __init omap3pandora_init_irq(void)
639 omap2_init_common_hw(mt46h32m32lf6_sdrc_params, 639 omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
640 mt46h32m32lf6_sdrc_params); 640 mt46h32m32lf6_sdrc_params);
641 omap_init_irq(); 641 omap_init_irq();
642 omap_gpio_init();
643} 642}
644 643
645static void pandora_wl1251_set_power(bool enable) 644static void pandora_wl1251_set_power(bool enable)
diff --git a/arch/arm/mach-omap2/board-omap3stalker.c b/arch/arm/mach-omap2/board-omap3stalker.c
index f25272125413..ea13e2aeeec5 100644
--- a/arch/arm/mach-omap2/board-omap3stalker.c
+++ b/arch/arm/mach-omap2/board-omap3stalker.c
@@ -589,7 +589,6 @@ static void __init omap3_stalker_init_irq(void)
589#ifdef CONFIG_OMAP_32K_TIMER 589#ifdef CONFIG_OMAP_32K_TIMER
590 omap2_gp_clockevent_set_gptimer(12); 590 omap2_gp_clockevent_set_gptimer(12);
591#endif 591#endif
592 omap_gpio_init();
593} 592}
594 593
595static struct platform_device *omap3_stalker_devices[] __initdata = { 594static struct platform_device *omap3_stalker_devices[] __initdata = {
diff --git a/arch/arm/mach-omap2/board-omap3touchbook.c b/arch/arm/mach-omap2/board-omap3touchbook.c
index 41104bb8774c..2339964058cc 100644
--- a/arch/arm/mach-omap2/board-omap3touchbook.c
+++ b/arch/arm/mach-omap2/board-omap3touchbook.c
@@ -428,7 +428,6 @@ static void __init omap3_touchbook_init_irq(void)
428#ifdef CONFIG_OMAP_32K_TIMER 428#ifdef CONFIG_OMAP_32K_TIMER
429 omap2_gp_clockevent_set_gptimer(12); 429 omap2_gp_clockevent_set_gptimer(12);
430#endif 430#endif
431 omap_gpio_init();
432} 431}
433 432
434static struct platform_device *omap3_touchbook_devices[] __initdata = { 433static struct platform_device *omap3_touchbook_devices[] __initdata = {
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
index 801f8146b00c..38f942beb121 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -79,7 +79,6 @@ static void __init omap4_panda_init_irq(void)
79{ 79{
80 omap2_init_common_hw(NULL, NULL); 80 omap2_init_common_hw(NULL, NULL);
81 gic_init_irq(); 81 gic_init_irq();
82 omap_gpio_init();
83} 82}
84 83
85static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { 84static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index 7053bc0b46db..805b78393393 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -416,7 +416,6 @@ static void __init overo_init_irq(void)
416 omap2_init_common_hw(mt46h32m32lf6_sdrc_params, 416 omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
417 mt46h32m32lf6_sdrc_params); 417 mt46h32m32lf6_sdrc_params);
418 omap_init_irq(); 418 omap_init_irq();
419 omap_gpio_init();
420} 419}
421 420
422static struct platform_device *overo_devices[] __initdata = { 421static struct platform_device *overo_devices[] __initdata = {
diff --git a/arch/arm/mach-omap2/board-rx51.c b/arch/arm/mach-omap2/board-rx51.c
index 36f2cf4efd57..1c3b0795c6e2 100644
--- a/arch/arm/mach-omap2/board-rx51.c
+++ b/arch/arm/mach-omap2/board-rx51.c
@@ -108,7 +108,6 @@ static void __init rx51_init_irq(void)
108 sdrc_params = rx51_get_sdram_timings(); 108 sdrc_params = rx51_get_sdram_timings();
109 omap2_init_common_hw(sdrc_params, sdrc_params); 109 omap2_init_common_hw(sdrc_params, sdrc_params);
110 omap_init_irq(); 110 omap_init_irq();
111 omap_gpio_init();
112} 111}
113 112
114extern void __init rx51_peripherals_init(void); 113extern void __init rx51_peripherals_init(void);
diff --git a/arch/arm/mach-omap2/board-zoom.c b/arch/arm/mach-omap2/board-zoom.c
index 3da69e4102a4..abd864a50b4e 100644
--- a/arch/arm/mach-omap2/board-zoom.c
+++ b/arch/arm/mach-omap2/board-zoom.c
@@ -43,7 +43,6 @@ static void __init omap_zoom_init_irq(void)
43 h8mbx00u0mer0em_sdrc_params); 43 h8mbx00u0mer0em_sdrc_params);
44 44
45 omap_init_irq(); 45 omap_init_irq();
46 omap_gpio_init();
47} 46}
48 47
49#ifdef CONFIG_OMAP_MUX 48#ifdef CONFIG_OMAP_MUX
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index 2b0d90109828..6f53dee98a91 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -21,6 +21,8 @@
21#include <linux/err.h> 21#include <linux/err.h>
22#include <linux/clk.h> 22#include <linux/clk.h>
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/slab.h>
25#include <linux/pm_runtime.h>
24 26
25#include <mach/hardware.h> 27#include <mach/hardware.h>
26#include <asm/irq.h> 28#include <asm/irq.h>
@@ -32,7 +34,6 @@
32/* 34/*
33 * OMAP1510 GPIO registers 35 * OMAP1510 GPIO registers
34 */ 36 */
35#define OMAP1510_GPIO_BASE 0xfffce000
36#define OMAP1510_GPIO_DATA_INPUT 0x00 37#define OMAP1510_GPIO_DATA_INPUT 0x00
37#define OMAP1510_GPIO_DATA_OUTPUT 0x04 38#define OMAP1510_GPIO_DATA_OUTPUT 0x04
38#define OMAP1510_GPIO_DIR_CONTROL 0x08 39#define OMAP1510_GPIO_DIR_CONTROL 0x08
@@ -46,10 +47,6 @@
46/* 47/*
47 * OMAP1610 specific GPIO registers 48 * OMAP1610 specific GPIO registers
48 */ 49 */
49#define OMAP1610_GPIO1_BASE 0xfffbe400
50#define OMAP1610_GPIO2_BASE 0xfffbec00
51#define OMAP1610_GPIO3_BASE 0xfffbb400
52#define OMAP1610_GPIO4_BASE 0xfffbbc00
53#define OMAP1610_GPIO_REVISION 0x0000 50#define OMAP1610_GPIO_REVISION 0x0000
54#define OMAP1610_GPIO_SYSCONFIG 0x0010 51#define OMAP1610_GPIO_SYSCONFIG 0x0010
55#define OMAP1610_GPIO_SYSSTATUS 0x0014 52#define OMAP1610_GPIO_SYSSTATUS 0x0014
@@ -71,12 +68,6 @@
71/* 68/*
72 * OMAP7XX specific GPIO registers 69 * OMAP7XX specific GPIO registers
73 */ 70 */
74#define OMAP7XX_GPIO1_BASE 0xfffbc000
75#define OMAP7XX_GPIO2_BASE 0xfffbc800
76#define OMAP7XX_GPIO3_BASE 0xfffbd000
77#define OMAP7XX_GPIO4_BASE 0xfffbd800
78#define OMAP7XX_GPIO5_BASE 0xfffbe000
79#define OMAP7XX_GPIO6_BASE 0xfffbe800
80#define OMAP7XX_GPIO_DATA_INPUT 0x00 71#define OMAP7XX_GPIO_DATA_INPUT 0x00
81#define OMAP7XX_GPIO_DATA_OUTPUT 0x04 72#define OMAP7XX_GPIO_DATA_OUTPUT 0x04
82#define OMAP7XX_GPIO_DIR_CONTROL 0x08 73#define OMAP7XX_GPIO_DIR_CONTROL 0x08
@@ -84,25 +75,10 @@
84#define OMAP7XX_GPIO_INT_MASK 0x10 75#define OMAP7XX_GPIO_INT_MASK 0x10
85#define OMAP7XX_GPIO_INT_STATUS 0x14 76#define OMAP7XX_GPIO_INT_STATUS 0x14
86 77
87#define OMAP1_MPUIO_VBASE OMAP1_MPUIO_BASE
88
89/* 78/*
90 * omap24xx specific GPIO registers 79 * omap2+ specific GPIO registers
91 */ 80 */
92#define OMAP242X_GPIO1_BASE 0x48018000
93#define OMAP242X_GPIO2_BASE 0x4801a000
94#define OMAP242X_GPIO3_BASE 0x4801c000
95#define OMAP242X_GPIO4_BASE 0x4801e000
96
97#define OMAP243X_GPIO1_BASE 0x4900C000
98#define OMAP243X_GPIO2_BASE 0x4900E000
99#define OMAP243X_GPIO3_BASE 0x49010000
100#define OMAP243X_GPIO4_BASE 0x49012000
101#define OMAP243X_GPIO5_BASE 0x480B6000
102
103#define OMAP24XX_GPIO_REVISION 0x0000 81#define OMAP24XX_GPIO_REVISION 0x0000
104#define OMAP24XX_GPIO_SYSCONFIG 0x0010
105#define OMAP24XX_GPIO_SYSSTATUS 0x0014
106#define OMAP24XX_GPIO_IRQSTATUS1 0x0018 82#define OMAP24XX_GPIO_IRQSTATUS1 0x0018
107#define OMAP24XX_GPIO_IRQSTATUS2 0x0028 83#define OMAP24XX_GPIO_IRQSTATUS2 0x0028
108#define OMAP24XX_GPIO_IRQENABLE2 0x002c 84#define OMAP24XX_GPIO_IRQENABLE2 0x002c
@@ -126,7 +102,6 @@
126#define OMAP24XX_GPIO_SETDATAOUT 0x0094 102#define OMAP24XX_GPIO_SETDATAOUT 0x0094
127 103
128#define OMAP4_GPIO_REVISION 0x0000 104#define OMAP4_GPIO_REVISION 0x0000
129#define OMAP4_GPIO_SYSCONFIG 0x0010
130#define OMAP4_GPIO_EOI 0x0020 105#define OMAP4_GPIO_EOI 0x0020
131#define OMAP4_GPIO_IRQSTATUSRAW0 0x0024 106#define OMAP4_GPIO_IRQSTATUSRAW0 0x0024
132#define OMAP4_GPIO_IRQSTATUSRAW1 0x0028 107#define OMAP4_GPIO_IRQSTATUSRAW1 0x0028
@@ -138,7 +113,6 @@
138#define OMAP4_GPIO_IRQSTATUSCLR1 0x0040 113#define OMAP4_GPIO_IRQSTATUSCLR1 0x0040
139#define OMAP4_GPIO_IRQWAKEN0 0x0044 114#define OMAP4_GPIO_IRQWAKEN0 0x0044
140#define OMAP4_GPIO_IRQWAKEN1 0x0048 115#define OMAP4_GPIO_IRQWAKEN1 0x0048
141#define OMAP4_GPIO_SYSSTATUS 0x0114
142#define OMAP4_GPIO_IRQENABLE1 0x011c 116#define OMAP4_GPIO_IRQENABLE1 0x011c
143#define OMAP4_GPIO_WAKE_EN 0x0120 117#define OMAP4_GPIO_WAKE_EN 0x0120
144#define OMAP4_GPIO_IRQSTATUS2 0x0128 118#define OMAP4_GPIO_IRQSTATUS2 0x0128
@@ -159,26 +133,6 @@
159#define OMAP4_GPIO_SETWKUENA 0x0184 133#define OMAP4_GPIO_SETWKUENA 0x0184
160#define OMAP4_GPIO_CLEARDATAOUT 0x0190 134#define OMAP4_GPIO_CLEARDATAOUT 0x0190
161#define OMAP4_GPIO_SETDATAOUT 0x0194 135#define OMAP4_GPIO_SETDATAOUT 0x0194
162/*
163 * omap34xx specific GPIO registers
164 */
165
166#define OMAP34XX_GPIO1_BASE 0x48310000
167#define OMAP34XX_GPIO2_BASE 0x49050000
168#define OMAP34XX_GPIO3_BASE 0x49052000
169#define OMAP34XX_GPIO4_BASE 0x49054000
170#define OMAP34XX_GPIO5_BASE 0x49056000
171#define OMAP34XX_GPIO6_BASE 0x49058000
172
173/*
174 * OMAP44XX specific GPIO registers
175 */
176#define OMAP44XX_GPIO1_BASE 0x4a310000
177#define OMAP44XX_GPIO2_BASE 0x48055000
178#define OMAP44XX_GPIO3_BASE 0x48057000
179#define OMAP44XX_GPIO4_BASE 0x48059000
180#define OMAP44XX_GPIO5_BASE 0x4805B000
181#define OMAP44XX_GPIO6_BASE 0x4805D000
182 136
183struct gpio_bank { 137struct gpio_bank {
184 unsigned long pbase; 138 unsigned long pbase;
@@ -203,97 +157,12 @@ struct gpio_bank {
203 struct clk *dbck; 157 struct clk *dbck;
204 u32 mod_usage; 158 u32 mod_usage;
205 u32 dbck_enable_mask; 159 u32 dbck_enable_mask;
160 struct device *dev;
161 bool dbck_flag;
206}; 162};
207 163
208#ifdef CONFIG_ARCH_OMAP16XX
209static struct gpio_bank gpio_bank_1610[5] = {
210 { OMAP1_MPUIO_VBASE, NULL, INT_MPUIO, IH_MPUIO_BASE,
211 METHOD_MPUIO },
212 { OMAP1610_GPIO1_BASE, NULL, INT_GPIO_BANK1, IH_GPIO_BASE,
213 METHOD_GPIO_1610 },
214 { OMAP1610_GPIO2_BASE, NULL, INT_1610_GPIO_BANK2, IH_GPIO_BASE + 16,
215 METHOD_GPIO_1610 },
216 { OMAP1610_GPIO3_BASE, NULL, INT_1610_GPIO_BANK3, IH_GPIO_BASE + 32,
217 METHOD_GPIO_1610 },
218 { OMAP1610_GPIO4_BASE, NULL, INT_1610_GPIO_BANK4, IH_GPIO_BASE + 48,
219 METHOD_GPIO_1610 },
220};
221#endif
222
223#ifdef CONFIG_ARCH_OMAP15XX
224static struct gpio_bank gpio_bank_1510[2] = {
225 { OMAP1_MPUIO_VBASE, NULL, INT_MPUIO, IH_MPUIO_BASE,
226 METHOD_MPUIO },
227 { OMAP1510_GPIO_BASE, NULL, INT_GPIO_BANK1, IH_GPIO_BASE,
228 METHOD_GPIO_1510 }
229};
230#endif
231
232#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
233static struct gpio_bank gpio_bank_7xx[7] = {
234 { OMAP1_MPUIO_VBASE, NULL, INT_7XX_MPUIO, IH_MPUIO_BASE,
235 METHOD_MPUIO },
236 { OMAP7XX_GPIO1_BASE, NULL, INT_7XX_GPIO_BANK1, IH_GPIO_BASE,
237 METHOD_GPIO_7XX },
238 { OMAP7XX_GPIO2_BASE, NULL, INT_7XX_GPIO_BANK2, IH_GPIO_BASE + 32,
239 METHOD_GPIO_7XX },
240 { OMAP7XX_GPIO3_BASE, NULL, INT_7XX_GPIO_BANK3, IH_GPIO_BASE + 64,
241 METHOD_GPIO_7XX },
242 { OMAP7XX_GPIO4_BASE, NULL, INT_7XX_GPIO_BANK4, IH_GPIO_BASE + 96,
243 METHOD_GPIO_7XX },
244 { OMAP7XX_GPIO5_BASE, NULL, INT_7XX_GPIO_BANK5, IH_GPIO_BASE + 128,
245 METHOD_GPIO_7XX },
246 { OMAP7XX_GPIO6_BASE, NULL, INT_7XX_GPIO_BANK6, IH_GPIO_BASE + 160,
247 METHOD_GPIO_7XX },
248};
249#endif
250
251#ifdef CONFIG_ARCH_OMAP2
252
253static struct gpio_bank gpio_bank_242x[4] = {
254 { OMAP242X_GPIO1_BASE, NULL, INT_24XX_GPIO_BANK1, IH_GPIO_BASE,
255 METHOD_GPIO_24XX },
256 { OMAP242X_GPIO2_BASE, NULL, INT_24XX_GPIO_BANK2, IH_GPIO_BASE + 32,
257 METHOD_GPIO_24XX },
258 { OMAP242X_GPIO3_BASE, NULL, INT_24XX_GPIO_BANK3, IH_GPIO_BASE + 64,
259 METHOD_GPIO_24XX },
260 { OMAP242X_GPIO4_BASE, NULL, INT_24XX_GPIO_BANK4, IH_GPIO_BASE + 96,
261 METHOD_GPIO_24XX },
262};
263
264static struct gpio_bank gpio_bank_243x[5] = {
265 { OMAP243X_GPIO1_BASE, NULL, INT_24XX_GPIO_BANK1, IH_GPIO_BASE,
266 METHOD_GPIO_24XX },
267 { OMAP243X_GPIO2_BASE, NULL, INT_24XX_GPIO_BANK2, IH_GPIO_BASE + 32,
268 METHOD_GPIO_24XX },
269 { OMAP243X_GPIO3_BASE, NULL, INT_24XX_GPIO_BANK3, IH_GPIO_BASE + 64,
270 METHOD_GPIO_24XX },
271 { OMAP243X_GPIO4_BASE, NULL, INT_24XX_GPIO_BANK4, IH_GPIO_BASE + 96,
272 METHOD_GPIO_24XX },
273 { OMAP243X_GPIO5_BASE, NULL, INT_24XX_GPIO_BANK5, IH_GPIO_BASE + 128,
274 METHOD_GPIO_24XX },
275};
276
277#endif
278
279#ifdef CONFIG_ARCH_OMAP3 164#ifdef CONFIG_ARCH_OMAP3
280static struct gpio_bank gpio_bank_34xx[6] = {
281 { OMAP34XX_GPIO1_BASE, NULL, INT_34XX_GPIO_BANK1, IH_GPIO_BASE,
282 METHOD_GPIO_24XX },
283 { OMAP34XX_GPIO2_BASE, NULL, INT_34XX_GPIO_BANK2, IH_GPIO_BASE + 32,
284 METHOD_GPIO_24XX },
285 { OMAP34XX_GPIO3_BASE, NULL, INT_34XX_GPIO_BANK3, IH_GPIO_BASE + 64,
286 METHOD_GPIO_24XX },
287 { OMAP34XX_GPIO4_BASE, NULL, INT_34XX_GPIO_BANK4, IH_GPIO_BASE + 96,
288 METHOD_GPIO_24XX },
289 { OMAP34XX_GPIO5_BASE, NULL, INT_34XX_GPIO_BANK5, IH_GPIO_BASE + 128,
290 METHOD_GPIO_24XX },
291 { OMAP34XX_GPIO6_BASE, NULL, INT_34XX_GPIO_BANK6, IH_GPIO_BASE + 160,
292 METHOD_GPIO_24XX },
293};
294
295struct omap3_gpio_regs { 165struct omap3_gpio_regs {
296 u32 sysconfig;
297 u32 irqenable1; 166 u32 irqenable1;
298 u32 irqenable2; 167 u32 irqenable2;
299 u32 wake_en; 168 u32 wake_en;
@@ -309,25 +178,14 @@ struct omap3_gpio_regs {
309static struct omap3_gpio_regs gpio_context[OMAP34XX_NR_GPIOS]; 178static struct omap3_gpio_regs gpio_context[OMAP34XX_NR_GPIOS];
310#endif 179#endif
311 180
312#ifdef CONFIG_ARCH_OMAP4 181/*
313static struct gpio_bank gpio_bank_44xx[6] = { 182 * TODO: Cleanup gpio_bank usage as it is having information
314 { OMAP44XX_GPIO1_BASE, NULL, OMAP44XX_IRQ_GPIO1, IH_GPIO_BASE, 183 * related to all instances of the device
315 METHOD_GPIO_44XX }, 184 */
316 { OMAP44XX_GPIO2_BASE, NULL, OMAP44XX_IRQ_GPIO2, IH_GPIO_BASE + 32, 185static struct gpio_bank *gpio_bank;
317 METHOD_GPIO_44XX },
318 { OMAP44XX_GPIO3_BASE, NULL, OMAP44XX_IRQ_GPIO3, IH_GPIO_BASE + 64,
319 METHOD_GPIO_44XX },
320 { OMAP44XX_GPIO4_BASE, NULL, OMAP44XX_IRQ_GPIO4, IH_GPIO_BASE + 96,
321 METHOD_GPIO_44XX },
322 { OMAP44XX_GPIO5_BASE, NULL, OMAP44XX_IRQ_GPIO5, IH_GPIO_BASE + 128,
323 METHOD_GPIO_44XX },
324 { OMAP44XX_GPIO6_BASE, NULL, OMAP44XX_IRQ_GPIO6, IH_GPIO_BASE + 160,
325 METHOD_GPIO_44XX },
326};
327 186
328#endif 187static int bank_width;
329 188
330static struct gpio_bank *gpio_bank;
331/* TODO: Analyze removing gpio_bank_count usage from driver code */ 189/* TODO: Analyze removing gpio_bank_count usage from driver code */
332int gpio_bank_count; 190int gpio_bank_count;
333 191
@@ -634,6 +492,9 @@ static void _set_gpio_debounce(struct gpio_bank *bank, unsigned gpio,
634 u32 val; 492 u32 val;
635 u32 l; 493 u32 l;
636 494
495 if (!bank->dbck_flag)
496 return;
497
637 if (debounce < 32) 498 if (debounce < 32)
638 debounce = 0x01; 499 debounce = 0x01;
639 else if (debounce > 7936) 500 else if (debounce > 7936)
@@ -643,7 +504,7 @@ static void _set_gpio_debounce(struct gpio_bank *bank, unsigned gpio,
643 504
644 l = 1 << get_gpio_index(gpio); 505 l = 1 << get_gpio_index(gpio);
645 506
646 if (cpu_is_omap44xx()) 507 if (bank->method == METHOD_GPIO_44XX)
647 reg += OMAP4_GPIO_DEBOUNCINGTIME; 508 reg += OMAP4_GPIO_DEBOUNCINGTIME;
648 else 509 else
649 reg += OMAP24XX_GPIO_DEBOUNCE_VAL; 510 reg += OMAP24XX_GPIO_DEBOUNCE_VAL;
@@ -651,7 +512,7 @@ static void _set_gpio_debounce(struct gpio_bank *bank, unsigned gpio,
651 __raw_writel(debounce, reg); 512 __raw_writel(debounce, reg);
652 513
653 reg = bank->base; 514 reg = bank->base;
654 if (cpu_is_omap44xx()) 515 if (bank->method == METHOD_GPIO_44XX)
655 reg += OMAP4_GPIO_DEBOUNCENABLE; 516 reg += OMAP4_GPIO_DEBOUNCENABLE;
656 else 517 else
657 reg += OMAP24XX_GPIO_DEBOUNCE_EN; 518 reg += OMAP24XX_GPIO_DEBOUNCE_EN;
@@ -660,12 +521,10 @@ static void _set_gpio_debounce(struct gpio_bank *bank, unsigned gpio,
660 521
661 if (debounce) { 522 if (debounce) {
662 val |= l; 523 val |= l;
663 if (cpu_is_omap34xx() || cpu_is_omap44xx()) 524 clk_enable(bank->dbck);
664 clk_enable(bank->dbck);
665 } else { 525 } else {
666 val &= ~l; 526 val &= ~l;
667 if (cpu_is_omap34xx() || cpu_is_omap44xx()) 527 clk_disable(bank->dbck);
668 clk_disable(bank->dbck);
669 } 528 }
670 bank->dbck_enable_mask = val; 529 bank->dbck_enable_mask = val;
671 530
@@ -1537,7 +1396,8 @@ static struct platform_device omap_mpuio_device = {
1537 1396
1538static inline void mpuio_init(void) 1397static inline void mpuio_init(void)
1539{ 1398{
1540 platform_set_drvdata(&omap_mpuio_device, &gpio_bank_1610[0]); 1399 struct gpio_bank *bank = get_gpio_bank(OMAP_MPUIO(0));
1400 platform_set_drvdata(&omap_mpuio_device, bank);
1541 1401
1542 if (platform_driver_register(&omap_mpuio_driver) == 0) 1402 if (platform_driver_register(&omap_mpuio_driver) == 0)
1543 (void) platform_device_register(&omap_mpuio_device); 1403 (void) platform_device_register(&omap_mpuio_device);
@@ -1642,6 +1502,13 @@ static int gpio_debounce(struct gpio_chip *chip, unsigned offset,
1642 unsigned long flags; 1502 unsigned long flags;
1643 1503
1644 bank = container_of(chip, struct gpio_bank, chip); 1504 bank = container_of(chip, struct gpio_bank, chip);
1505
1506 if (!bank->dbck) {
1507 bank->dbck = clk_get(bank->dev, "dbclk");
1508 if (IS_ERR(bank->dbck))
1509 dev_err(bank->dev, "Could not get gpio dbck\n");
1510 }
1511
1645 spin_lock_irqsave(&bank->lock, flags); 1512 spin_lock_irqsave(&bank->lock, flags);
1646 _set_gpio_debounce(bank, offset, debounce); 1513 _set_gpio_debounce(bank, offset, debounce);
1647 spin_unlock_irqrestore(&bank->lock, flags); 1514 spin_unlock_irqrestore(&bank->lock, flags);
@@ -1670,24 +1537,6 @@ static int gpio_2irq(struct gpio_chip *chip, unsigned offset)
1670 1537
1671/*---------------------------------------------------------------------*/ 1538/*---------------------------------------------------------------------*/
1672 1539
1673static int initialized;
1674#if defined(CONFIG_ARCH_OMAP1) || defined(CONFIG_ARCH_OMAP2)
1675static struct clk * gpio_ick;
1676#endif
1677
1678#if defined(CONFIG_ARCH_OMAP2)
1679static struct clk * gpio_fck;
1680#endif
1681
1682#if defined(CONFIG_ARCH_OMAP2430)
1683static struct clk * gpio5_ick;
1684static struct clk * gpio5_fck;
1685#endif
1686
1687#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
1688static struct clk *gpio_iclks[OMAP34XX_NR_GPIOS];
1689#endif
1690
1691static void __init omap_gpio_show_rev(struct gpio_bank *bank) 1540static void __init omap_gpio_show_rev(struct gpio_bank *bank)
1692{ 1541{
1693 u32 rev; 1542 u32 rev;
@@ -1710,6 +1559,19 @@ static void __init omap_gpio_show_rev(struct gpio_bank *bank)
1710 */ 1559 */
1711static struct lock_class_key gpio_lock_class; 1560static struct lock_class_key gpio_lock_class;
1712 1561
1562static inline int init_gpio_info(struct platform_device *pdev)
1563{
1564 /* TODO: Analyze removing gpio_bank_count usage from driver code */
1565 gpio_bank = kzalloc(gpio_bank_count * sizeof(struct gpio_bank),
1566 GFP_KERNEL);
1567 if (!gpio_bank) {
1568 dev_err(&pdev->dev, "Memory alloc failed for gpio_bank\n");
1569 return -ENOMEM;
1570 }
1571 return 0;
1572}
1573
1574/* TODO: Cleanup cpu_is_* checks */
1713static void omap_gpio_mod_init(struct gpio_bank *bank, int id) 1575static void omap_gpio_mod_init(struct gpio_bank *bank, int id)
1714{ 1576{
1715 if (cpu_class_is_omap2()) { 1577 if (cpu_class_is_omap2()) {
@@ -1773,16 +1635,9 @@ static void omap_gpio_mod_init(struct gpio_bank *bank, int id)
1773 1635
1774static void __init omap_gpio_chip_init(struct gpio_bank *bank) 1636static void __init omap_gpio_chip_init(struct gpio_bank *bank)
1775{ 1637{
1776 int j, bank_width = 16; 1638 int j;
1777 static int gpio; 1639 static int gpio;
1778 1640
1779 if (cpu_is_omap7xx() && bank->method == METHOD_GPIO_7XX)
1780 bank_width = 32; /* 7xx has 32-bit GPIOs */
1781
1782 if ((bank->method == METHOD_GPIO_24XX) ||
1783 (bank->method == METHOD_GPIO_44XX))
1784 bank_width = 32;
1785
1786 bank->mod_usage = 0; 1641 bank->mod_usage = 0;
1787 /* 1642 /*
1788 * REVISIT eventually switch from OMAP-specific gpio structs 1643 * REVISIT eventually switch from OMAP-specific gpio structs
@@ -1826,139 +1681,68 @@ static void __init omap_gpio_chip_init(struct gpio_bank *bank)
1826 set_irq_data(bank->irq, bank); 1681 set_irq_data(bank->irq, bank);
1827} 1682}
1828 1683
1829static int __init _omap_gpio_init(void) 1684static int __devinit omap_gpio_probe(struct platform_device *pdev)
1830{ 1685{
1831 int i; 1686 static int gpio_init_done;
1687 struct omap_gpio_platform_data *pdata;
1688 struct resource *res;
1689 int id;
1832 struct gpio_bank *bank; 1690 struct gpio_bank *bank;
1833 int bank_size = SZ_8K; /* Module 4KB + L4 4KB except on omap1 */
1834 char clk_name[11];
1835 1691
1836 initialized = 1; 1692 if (!pdev->dev.platform_data)
1693 return -EINVAL;
1837 1694
1838#if defined(CONFIG_ARCH_OMAP1) 1695 pdata = pdev->dev.platform_data;
1839 if (cpu_is_omap15xx()) {
1840 gpio_ick = clk_get(NULL, "arm_gpio_ck");
1841 if (IS_ERR(gpio_ick))
1842 printk("Could not get arm_gpio_ck\n");
1843 else
1844 clk_enable(gpio_ick);
1845 }
1846#endif
1847#if defined(CONFIG_ARCH_OMAP2)
1848 if (cpu_class_is_omap2()) {
1849 gpio_ick = clk_get(NULL, "gpios_ick");
1850 if (IS_ERR(gpio_ick))
1851 printk("Could not get gpios_ick\n");
1852 else
1853 clk_enable(gpio_ick);
1854 gpio_fck = clk_get(NULL, "gpios_fck");
1855 if (IS_ERR(gpio_fck))
1856 printk("Could not get gpios_fck\n");
1857 else
1858 clk_enable(gpio_fck);
1859 1696
1860 /* 1697 if (!gpio_init_done) {
1861 * On 2430 & 3430 GPIO 5 uses CORE L4 ICLK 1698 int ret;
1862 */
1863#if defined(CONFIG_ARCH_OMAP2430)
1864 if (cpu_is_omap2430()) {
1865 gpio5_ick = clk_get(NULL, "gpio5_ick");
1866 if (IS_ERR(gpio5_ick))
1867 printk("Could not get gpio5_ick\n");
1868 else
1869 clk_enable(gpio5_ick);
1870 gpio5_fck = clk_get(NULL, "gpio5_fck");
1871 if (IS_ERR(gpio5_fck))
1872 printk("Could not get gpio5_fck\n");
1873 else
1874 clk_enable(gpio5_fck);
1875 }
1876#endif
1877 }
1878#endif
1879 1699
1880#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4) 1700 ret = init_gpio_info(pdev);
1881 if (cpu_is_omap34xx() || cpu_is_omap44xx()) { 1701 if (ret)
1882 for (i = 0; i < OMAP34XX_NR_GPIOS; i++) { 1702 return ret;
1883 sprintf(clk_name, "gpio%d_ick", i + 1);
1884 gpio_iclks[i] = clk_get(NULL, clk_name);
1885 if (IS_ERR(gpio_iclks[i]))
1886 printk(KERN_ERR "Could not get %s\n", clk_name);
1887 else
1888 clk_enable(gpio_iclks[i]);
1889 }
1890 } 1703 }
1891#endif
1892 1704
1705 id = pdev->id;
1706 bank = &gpio_bank[id];
1893 1707
1894#ifdef CONFIG_ARCH_OMAP15XX 1708 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
1895 if (cpu_is_omap15xx()) { 1709 if (unlikely(!res)) {
1896 gpio_bank_count = 2; 1710 dev_err(&pdev->dev, "GPIO Bank %i Invalid IRQ resource\n", id);
1897 gpio_bank = gpio_bank_1510; 1711 return -ENODEV;
1898 bank_size = SZ_2K;
1899 }
1900#endif
1901#if defined(CONFIG_ARCH_OMAP16XX)
1902 if (cpu_is_omap16xx()) {
1903 gpio_bank_count = 5;
1904 gpio_bank = gpio_bank_1610;
1905 bank_size = SZ_2K;
1906 }
1907#endif
1908#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
1909 if (cpu_is_omap7xx()) {
1910 gpio_bank_count = 7;
1911 gpio_bank = gpio_bank_7xx;
1912 bank_size = SZ_2K;
1913 }
1914#endif
1915#ifdef CONFIG_ARCH_OMAP2
1916 if (cpu_is_omap242x()) {
1917 gpio_bank_count = 4;
1918 gpio_bank = gpio_bank_242x;
1919 }
1920 if (cpu_is_omap243x()) {
1921 gpio_bank_count = 5;
1922 gpio_bank = gpio_bank_243x;
1923 }
1924#endif
1925#ifdef CONFIG_ARCH_OMAP3
1926 if (cpu_is_omap34xx()) {
1927 gpio_bank_count = OMAP34XX_NR_GPIOS;
1928 gpio_bank = gpio_bank_34xx;
1929 }
1930#endif
1931#ifdef CONFIG_ARCH_OMAP4
1932 if (cpu_is_omap44xx()) {
1933 gpio_bank_count = OMAP34XX_NR_GPIOS;
1934 gpio_bank = gpio_bank_44xx;
1935 } 1712 }
1936#endif
1937 for (i = 0; i < gpio_bank_count; i++) {
1938 1713
1939 bank = &gpio_bank[i]; 1714 bank->irq = res->start;
1940 spin_lock_init(&bank->lock); 1715 bank->virtual_irq_start = pdata->virtual_irq_start;
1716 bank->method = pdata->bank_type;
1717 bank->dev = &pdev->dev;
1718 bank->dbck_flag = pdata->dbck_flag;
1719 bank_width = pdata->bank_width;
1941 1720
1942 /* Static mapping, never released */ 1721 spin_lock_init(&bank->lock);
1943 bank->base = ioremap(bank->pbase, bank_size);
1944 if (!bank->base) {
1945 printk(KERN_ERR "Could not ioremap gpio bank%i\n", i);
1946 continue;
1947 }
1948 1722
1949 omap_gpio_mod_init(bank, i); 1723 /* Static mapping, never released */
1950 omap_gpio_chip_init(bank); 1724 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1725 if (unlikely(!res)) {
1726 dev_err(&pdev->dev, "GPIO Bank %i Invalid mem resource\n", id);
1727 return -ENODEV;
1728 }
1951 1729
1952 if (cpu_is_omap34xx() || cpu_is_omap44xx()) { 1730 bank->base = ioremap(res->start, resource_size(res));
1953 sprintf(clk_name, "gpio%d_dbck", i + 1); 1731 if (!bank->base) {
1954 bank->dbck = clk_get(NULL, clk_name); 1732 dev_err(&pdev->dev, "Could not ioremap gpio bank%i\n", id);
1955 if (IS_ERR(bank->dbck)) 1733 return -ENOMEM;
1956 printk(KERN_ERR "Could not get %s\n", clk_name);
1957 }
1958 } 1734 }
1959 1735
1736 pm_runtime_enable(bank->dev);
1737 pm_runtime_get_sync(bank->dev);
1738
1739 omap_gpio_mod_init(bank, id);
1740 omap_gpio_chip_init(bank);
1960 omap_gpio_show_rev(bank); 1741 omap_gpio_show_rev(bank);
1961 1742
1743 if (!gpio_init_done)
1744 gpio_init_done = 1;
1745
1962 return 0; 1746 return 0;
1963} 1747}
1964 1748
@@ -2252,8 +2036,6 @@ void omap_gpio_save_context(void)
2252 /* saving banks from 2-6 only since GPIO1 is in WKUP */ 2036 /* saving banks from 2-6 only since GPIO1 is in WKUP */
2253 for (i = 1; i < gpio_bank_count; i++) { 2037 for (i = 1; i < gpio_bank_count; i++) {
2254 struct gpio_bank *bank = &gpio_bank[i]; 2038 struct gpio_bank *bank = &gpio_bank[i];
2255 gpio_context[i].sysconfig =
2256 __raw_readl(bank->base + OMAP24XX_GPIO_SYSCONFIG);
2257 gpio_context[i].irqenable1 = 2039 gpio_context[i].irqenable1 =
2258 __raw_readl(bank->base + OMAP24XX_GPIO_IRQENABLE1); 2040 __raw_readl(bank->base + OMAP24XX_GPIO_IRQENABLE1);
2259 gpio_context[i].irqenable2 = 2041 gpio_context[i].irqenable2 =
@@ -2284,8 +2066,6 @@ void omap_gpio_restore_context(void)
2284 2066
2285 for (i = 1; i < gpio_bank_count; i++) { 2067 for (i = 1; i < gpio_bank_count; i++) {
2286 struct gpio_bank *bank = &gpio_bank[i]; 2068 struct gpio_bank *bank = &gpio_bank[i];
2287 __raw_writel(gpio_context[i].sysconfig,
2288 bank->base + OMAP24XX_GPIO_SYSCONFIG);
2289 __raw_writel(gpio_context[i].irqenable1, 2069 __raw_writel(gpio_context[i].irqenable1,
2290 bank->base + OMAP24XX_GPIO_IRQENABLE1); 2070 bank->base + OMAP24XX_GPIO_IRQENABLE1);
2291 __raw_writel(gpio_context[i].irqenable2, 2071 __raw_writel(gpio_context[i].irqenable2,
@@ -2310,25 +2090,28 @@ void omap_gpio_restore_context(void)
2310} 2090}
2311#endif 2091#endif
2312 2092
2093static struct platform_driver omap_gpio_driver = {
2094 .probe = omap_gpio_probe,
2095 .driver = {
2096 .name = "omap_gpio",
2097 },
2098};
2099
2313/* 2100/*
2314 * This may get called early from board specific init 2101 * gpio driver register needs to be done before
2315 * for boards that have interrupts routed via FPGA. 2102 * machine_init functions access gpio APIs.
2103 * Hence omap_gpio_drv_reg() is a postcore_initcall.
2316 */ 2104 */
2317int __init omap_gpio_init(void) 2105static int __init omap_gpio_drv_reg(void)
2318{ 2106{
2319 if (!initialized) 2107 return platform_driver_register(&omap_gpio_driver);
2320 return _omap_gpio_init();
2321 else
2322 return 0;
2323} 2108}
2109postcore_initcall(omap_gpio_drv_reg);
2324 2110
2325static int __init omap_gpio_sysinit(void) 2111static int __init omap_gpio_sysinit(void)
2326{ 2112{
2327 int ret = 0; 2113 int ret = 0;
2328 2114
2329 if (!initialized)
2330 ret = _omap_gpio_init();
2331
2332 mpuio_init(); 2115 mpuio_init();
2333 2116
2334#if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP2PLUS) 2117#if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP2PLUS)
diff --git a/arch/arm/plat-omap/include/plat/gpio.h b/arch/arm/plat-omap/include/plat/gpio.h
index 24892a6707c4..5f118ff0d3eb 100644
--- a/arch/arm/plat-omap/include/plat/gpio.h
+++ b/arch/arm/plat-omap/include/plat/gpio.h
@@ -94,7 +94,6 @@ struct omap_gpio_platform_data {
94/* TODO: Analyze removing gpio_bank_count usage from driver code */ 94/* TODO: Analyze removing gpio_bank_count usage from driver code */
95extern int gpio_bank_count; 95extern int gpio_bank_count;
96 96
97extern int omap_gpio_init(void); /* Call from board init only */
98extern void omap2_gpio_prepare_for_idle(int power_state); 97extern void omap2_gpio_prepare_for_idle(int power_state);
99extern void omap2_gpio_resume_after_idle(void); 98extern void omap2_gpio_resume_after_idle(void);
100extern void omap_set_gpio_debounce(int gpio, int enable); 99extern void omap_set_gpio_debounce(int gpio, int enable);