aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap1
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2010-12-10 14:37:47 -0500
committerTony Lindgren <tony@atomide.com>2010-12-10 14:37:47 -0500
commit79b357c2171ab3e52148503f0efa66d64a13413e (patch)
tree7f134ef19ae4a882b32da87ce3d3ed9e5134691a /arch/arm/mach-omap1
parentb2d6fef51223a1913c0d3230df4252ab49990bc1 (diff)
parent5de62b86d2f5cf3459cb02ecb7a4530787bbd898 (diff)
Merge branch 'devel-gpio' into omap-for-linus
Diffstat (limited to 'arch/arm/mach-omap1')
-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.c22
-rw-r--r--arch/arm/mach-omap1/board-h2.c4
-rw-r--r--arch/arm/mach-omap1/board-h3.c22
-rw-r--r--arch/arm/mach-omap1/board-htcherald.c2
-rw-r--r--arch/arm/mach-omap1/board-innovator.c4
-rw-r--r--arch/arm/mach-omap1/board-nokia770.c1
-rw-r--r--arch/arm/mach-omap1/board-osk.c6
-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.c22
-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-omap1/gpio15xx.c99
-rw-r--r--arch/arm/mach-omap1/gpio16xx.c200
-rw-r--r--arch/arm/mach-omap1/gpio7xx.c262
18 files changed, 609 insertions, 50 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 dc82f3d028b5..e1439506eba9 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 149fdd32e127..0c3f396328bd 100644
--- a/arch/arm/mach-omap1/board-fsample.c
+++ b/arch/arm/mach-omap1/board-fsample.c
@@ -120,6 +120,15 @@ static struct resource smc91x_resources[] = {
120 }, 120 },
121}; 121};
122 122
123static void __init fsample_init_smc91x(void)
124{
125 fpga_write(1, H2P2_DBG_FPGA_LAN_RESET);
126 mdelay(50);
127 fpga_write(fpga_read(H2P2_DBG_FPGA_LAN_RESET) & ~1,
128 H2P2_DBG_FPGA_LAN_RESET);
129 mdelay(50);
130}
131
123static struct mtd_partition nor_partitions[] = { 132static struct mtd_partition nor_partitions[] = {
124 /* bootloader (U-Boot, etc) in first sector */ 133 /* bootloader (U-Boot, etc) in first sector */
125 { 134 {
@@ -285,6 +294,8 @@ static struct omap_board_config_kernel fsample_config[] = {
285 294
286static void __init omap_fsample_init(void) 295static void __init omap_fsample_init(void)
287{ 296{
297 fsample_init_smc91x();
298
288 if (gpio_request(FSAMPLE_NAND_RB_GPIO_PIN, "NAND ready") < 0) 299 if (gpio_request(FSAMPLE_NAND_RB_GPIO_PIN, "NAND ready") < 0)
289 BUG(); 300 BUG();
290 gpio_direction_input(FSAMPLE_NAND_RB_GPIO_PIN); 301 gpio_direction_input(FSAMPLE_NAND_RB_GPIO_PIN);
@@ -312,21 +323,10 @@ static void __init omap_fsample_init(void)
312 omap_register_i2c_bus(1, 100, NULL, 0); 323 omap_register_i2c_bus(1, 100, NULL, 0);
313} 324}
314 325
315static void __init fsample_init_smc91x(void)
316{
317 fpga_write(1, H2P2_DBG_FPGA_LAN_RESET);
318 mdelay(50);
319 fpga_write(fpga_read(H2P2_DBG_FPGA_LAN_RESET) & ~1,
320 H2P2_DBG_FPGA_LAN_RESET);
321 mdelay(50);
322}
323
324static void __init omap_fsample_init_irq(void) 326static void __init omap_fsample_init_irq(void)
325{ 327{
326 omap1_init_common_hw(); 328 omap1_init_common_hw();
327 omap_init_irq(); 329 omap_init_irq();
328 omap_gpio_init();
329 fsample_init_smc91x();
330} 330}
331 331
332/* 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 197adb49dc5a..082a73ca5564 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -374,8 +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 h2_init_smc91x();
379} 377}
380 378
381static struct omap_usb_config h2_usb_config __initdata = { 379static struct omap_usb_config h2_usb_config __initdata = {
@@ -403,6 +401,8 @@ static struct omap_board_config_kernel h2_config[] __initdata = {
403 401
404static void __init h2_init(void) 402static void __init h2_init(void)
405{ 403{
404 h2_init_smc91x();
405
406 /* Here we assume the NOR boot config: NOR on CS3 (possibly swapped 406 /* Here we assume the NOR boot config: NOR on CS3 (possibly swapped
407 * to address 0 by a dip switch), NAND on CS2B. The NAND driver will 407 * to address 0 by a dip switch), NAND on CS2B. The NAND driver will
408 * notice whether a NAND chip is enabled at probe time. 408 * notice whether a NAND chip is enabled at probe time.
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index 9126e3e37b4a..d2cff5022fe5 100644
--- a/arch/arm/mach-omap1/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -264,6 +264,15 @@ static struct platform_device smc91x_device = {
264 .resource = smc91x_resources, 264 .resource = smc91x_resources,
265}; 265};
266 266
267static void __init h3_init_smc91x(void)
268{
269 omap_cfg_reg(W15_1710_GPIO40);
270 if (gpio_request(40, "SMC91x irq") < 0) {
271 printk("Error requesting gpio 40 for smc91x irq\n");
272 return;
273 }
274}
275
267#define GPTIMER_BASE 0xFFFB1400 276#define GPTIMER_BASE 0xFFFB1400
268#define GPTIMER_REGS(x) (0xFFFB1400 + (x * 0x800)) 277#define GPTIMER_REGS(x) (0xFFFB1400 + (x * 0x800))
269#define GPTIMER_REGS_SIZE 0x46 278#define GPTIMER_REGS_SIZE 0x46
@@ -376,6 +385,8 @@ static struct i2c_board_info __initdata h3_i2c_board_info[] = {
376 385
377static void __init h3_init(void) 386static void __init h3_init(void)
378{ 387{
388 h3_init_smc91x();
389
379 /* Here we assume the NOR boot config: NOR on CS3 (possibly swapped 390 /* Here we assume the NOR boot config: NOR on CS3 (possibly swapped
380 * to address 0 by a dip switch), NAND on CS2B. The NAND driver will 391 * to address 0 by a dip switch), NAND on CS2B. The NAND driver will
381 * notice whether a NAND chip is enabled at probe time. 392 * notice whether a NAND chip is enabled at probe time.
@@ -422,21 +433,10 @@ static void __init h3_init(void)
422 h3_mmc_init(); 433 h3_mmc_init();
423} 434}
424 435
425static void __init h3_init_smc91x(void)
426{
427 omap_cfg_reg(W15_1710_GPIO40);
428 if (gpio_request(40, "SMC91x irq") < 0) {
429 printk("Error requesting gpio 40 for smc91x irq\n");
430 return;
431 }
432}
433
434static void __init h3_init_irq(void) 436static void __init h3_init_irq(void)
435{ 437{
436 omap1_init_common_hw(); 438 omap1_init_common_hw();
437 omap_init_irq(); 439 omap_init_irq();
438 omap_gpio_init();
439 h3_init_smc91x();
440} 440}
441 441
442static 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 dc2b86fd66c1..a051acdc526a 100644
--- a/arch/arm/mach-omap1/board-innovator.c
+++ b/arch/arm/mach-omap1/board-innovator.c
@@ -290,13 +290,11 @@ 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();
297 } 296 }
298#endif 297#endif
299 innovator_init_smc91x();
300} 298}
301 299
302#ifdef CONFIG_ARCH_OMAP15XX 300#ifdef CONFIG_ARCH_OMAP15XX
@@ -387,6 +385,8 @@ static struct omap_board_config_kernel innovator_config[] = {
387 385
388static void __init innovator_init(void) 386static void __init innovator_init(void)
389{ 387{
388 innovator_init_smc91x();
389
390#ifdef CONFIG_ARCH_OMAP15XX 390#ifdef CONFIG_ARCH_OMAP15XX
391 if (cpu_is_omap1510()) { 391 if (cpu_is_omap1510()) {
392 unsigned char reg; 392 unsigned char reg;
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 e9dd79149a8e..d44e7172efc2 100644
--- a/arch/arm/mach-omap1/board-osk.c
+++ b/arch/arm/mach-omap1/board-osk.c
@@ -283,9 +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 osk_init_smc91x();
288 osk_init_cf();
289} 286}
290 287
291static struct omap_usb_config osk_usb_config __initdata = { 288static struct omap_usb_config osk_usb_config __initdata = {
@@ -541,6 +538,9 @@ static void __init osk_init(void)
541{ 538{
542 u32 l; 539 u32 l;
543 540
541 osk_init_smc91x();
542 osk_init_cf();
543
544 /* Workaround for wrong CS3 (NOR flash) timing 544 /* Workaround for wrong CS3 (NOR flash) timing
545 * There are some U-Boot versions out there which configure 545 * There are some U-Boot versions out there which configure
546 * wrong CS3 memory timings. This mainly leads to CRC 546 * wrong CS3 memory timings. This mainly leads to CRC
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 a8d16a255c18..69fda218fb45 100644
--- a/arch/arm/mach-omap1/board-perseus2.c
+++ b/arch/arm/mach-omap1/board-perseus2.c
@@ -251,8 +251,19 @@ static struct omap_board_config_kernel perseus2_config[] __initdata = {
251 { OMAP_TAG_LCD, &perseus2_lcd_config }, 251 { OMAP_TAG_LCD, &perseus2_lcd_config },
252}; 252};
253 253
254static void __init perseus2_init_smc91x(void)
255{
256 fpga_write(1, H2P2_DBG_FPGA_LAN_RESET);
257 mdelay(50);
258 fpga_write(fpga_read(H2P2_DBG_FPGA_LAN_RESET) & ~1,
259 H2P2_DBG_FPGA_LAN_RESET);
260 mdelay(50);
261}
262
254static void __init omap_perseus2_init(void) 263static void __init omap_perseus2_init(void)
255{ 264{
265 perseus2_init_smc91x();
266
256 if (gpio_request(P2_NAND_RB_GPIO_PIN, "NAND ready") < 0) 267 if (gpio_request(P2_NAND_RB_GPIO_PIN, "NAND ready") < 0)
257 BUG(); 268 BUG();
258 gpio_direction_input(P2_NAND_RB_GPIO_PIN); 269 gpio_direction_input(P2_NAND_RB_GPIO_PIN);
@@ -280,21 +291,10 @@ static void __init omap_perseus2_init(void)
280 omap_register_i2c_bus(1, 100, NULL, 0); 291 omap_register_i2c_bus(1, 100, NULL, 0);
281} 292}
282 293
283static void __init perseus2_init_smc91x(void)
284{
285 fpga_write(1, H2P2_DBG_FPGA_LAN_RESET);
286 mdelay(50);
287 fpga_write(fpga_read(H2P2_DBG_FPGA_LAN_RESET) & ~1,
288 H2P2_DBG_FPGA_LAN_RESET);
289 mdelay(50);
290}
291
292static void __init omap_perseus2_init_irq(void) 294static void __init omap_perseus2_init_irq(void)
293{ 295{
294 omap1_init_common_hw(); 296 omap1_init_common_hw();
295 omap_init_irq(); 297 omap_init_irq();
296 omap_gpio_init();
297 perseus2_init_smc91x();
298} 298}
299/* 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 */
300static 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 b2838bfeab86..815a69ce821d 100644
--- a/arch/arm/mach-omap1/board-voiceblue.c
+++ b/arch/arm/mach-omap1/board-voiceblue.c
@@ -161,7 +161,6 @@ static void __init voiceblue_init_irq(void)
161{ 161{
162 omap1_init_common_hw(); 162 omap1_init_common_hw();
163 omap_init_irq(); 163 omap_init_irq();
164 omap_gpio_init();
165} 164}
166 165
167static void __init voiceblue_init(void) 166static 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-omap1/gpio15xx.c b/arch/arm/mach-omap1/gpio15xx.c
new file mode 100644
index 000000000000..04c4b04cf54e
--- /dev/null
+++ b/arch/arm/mach-omap1/gpio15xx.c
@@ -0,0 +1,99 @@
1/*
2 * OMAP15xx specific gpio init
3 *
4 * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
5 *
6 * Author:
7 * Charulatha V <charu@ti.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation version 2.
12 *
13 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
14 * kind, whether express or implied; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 */
18
19#include <linux/gpio.h>
20
21#define OMAP1_MPUIO_VBASE OMAP1_MPUIO_BASE
22#define OMAP1510_GPIO_BASE 0xFFFCE000
23
24/* gpio1 */
25static struct __initdata resource omap15xx_mpu_gpio_resources[] = {
26 {
27 .start = OMAP1_MPUIO_VBASE,
28 .end = OMAP1_MPUIO_VBASE + SZ_2K - 1,
29 .flags = IORESOURCE_MEM,
30 },
31 {
32 .start = INT_MPUIO,
33 .flags = IORESOURCE_IRQ,
34 },
35};
36
37static struct __initdata omap_gpio_platform_data omap15xx_mpu_gpio_config = {
38 .virtual_irq_start = IH_MPUIO_BASE,
39 .bank_type = METHOD_MPUIO,
40 .bank_width = 16,
41 .bank_stride = 1,
42};
43
44static struct __initdata platform_device omap15xx_mpu_gpio = {
45 .name = "omap_gpio",
46 .id = 0,
47 .dev = {
48 .platform_data = &omap15xx_mpu_gpio_config,
49 },
50 .num_resources = ARRAY_SIZE(omap15xx_mpu_gpio_resources),
51 .resource = omap15xx_mpu_gpio_resources,
52};
53
54/* gpio2 */
55static struct __initdata resource omap15xx_gpio_resources[] = {
56 {
57 .start = OMAP1510_GPIO_BASE,
58 .end = OMAP1510_GPIO_BASE + SZ_2K - 1,
59 .flags = IORESOURCE_MEM,
60 },
61 {
62 .start = INT_GPIO_BANK1,
63 .flags = IORESOURCE_IRQ,
64 },
65};
66
67static struct __initdata omap_gpio_platform_data omap15xx_gpio_config = {
68 .virtual_irq_start = IH_GPIO_BASE,
69 .bank_type = METHOD_GPIO_1510,
70 .bank_width = 16,
71};
72
73static struct __initdata platform_device omap15xx_gpio = {
74 .name = "omap_gpio",
75 .id = 1,
76 .dev = {
77 .platform_data = &omap15xx_gpio_config,
78 },
79 .num_resources = ARRAY_SIZE(omap15xx_gpio_resources),
80 .resource = omap15xx_gpio_resources,
81};
82
83/*
84 * omap15xx_gpio_init needs to be done before
85 * machine_init functions access gpio APIs.
86 * Hence omap15xx_gpio_init is a postcore_initcall.
87 */
88static int __init omap15xx_gpio_init(void)
89{
90 if (!cpu_is_omap15xx())
91 return -EINVAL;
92
93 platform_device_register(&omap15xx_mpu_gpio);
94 platform_device_register(&omap15xx_gpio);
95
96 gpio_bank_count = 2;
97 return 0;
98}
99postcore_initcall(omap15xx_gpio_init);
diff --git a/arch/arm/mach-omap1/gpio16xx.c b/arch/arm/mach-omap1/gpio16xx.c
new file mode 100644
index 000000000000..5dd0d4c82b24
--- /dev/null
+++ b/arch/arm/mach-omap1/gpio16xx.c
@@ -0,0 +1,200 @@
1/*
2 * OMAP16xx specific gpio init
3 *
4 * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
5 *
6 * Author:
7 * Charulatha V <charu@ti.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation version 2.
12 *
13 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
14 * kind, whether express or implied; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 */
18
19#include <linux/gpio.h>
20
21#define OMAP1610_GPIO1_BASE 0xfffbe400
22#define OMAP1610_GPIO2_BASE 0xfffbec00
23#define OMAP1610_GPIO3_BASE 0xfffbb400
24#define OMAP1610_GPIO4_BASE 0xfffbbc00
25#define OMAP1_MPUIO_VBASE OMAP1_MPUIO_BASE
26
27/* mpu gpio */
28static struct __initdata resource omap16xx_mpu_gpio_resources[] = {
29 {
30 .start = OMAP1_MPUIO_VBASE,
31 .end = OMAP1_MPUIO_VBASE + SZ_2K - 1,
32 .flags = IORESOURCE_MEM,
33 },
34 {
35 .start = INT_MPUIO,
36 .flags = IORESOURCE_IRQ,
37 },
38};
39
40static struct __initdata omap_gpio_platform_data omap16xx_mpu_gpio_config = {
41 .virtual_irq_start = IH_MPUIO_BASE,
42 .bank_type = METHOD_MPUIO,
43 .bank_width = 16,
44 .bank_stride = 1,
45};
46
47static struct __initdata platform_device omap16xx_mpu_gpio = {
48 .name = "omap_gpio",
49 .id = 0,
50 .dev = {
51 .platform_data = &omap16xx_mpu_gpio_config,
52 },
53 .num_resources = ARRAY_SIZE(omap16xx_mpu_gpio_resources),
54 .resource = omap16xx_mpu_gpio_resources,
55};
56
57/* gpio1 */
58static struct __initdata resource omap16xx_gpio1_resources[] = {
59 {
60 .start = OMAP1610_GPIO1_BASE,
61 .end = OMAP1610_GPIO1_BASE + SZ_2K - 1,
62 .flags = IORESOURCE_MEM,
63 },
64 {
65 .start = INT_GPIO_BANK1,
66 .flags = IORESOURCE_IRQ,
67 },
68};
69
70static struct __initdata omap_gpio_platform_data omap16xx_gpio1_config = {
71 .virtual_irq_start = IH_GPIO_BASE,
72 .bank_type = METHOD_GPIO_1610,
73 .bank_width = 16,
74};
75
76static struct __initdata platform_device omap16xx_gpio1 = {
77 .name = "omap_gpio",
78 .id = 1,
79 .dev = {
80 .platform_data = &omap16xx_gpio1_config,
81 },
82 .num_resources = ARRAY_SIZE(omap16xx_gpio1_resources),
83 .resource = omap16xx_gpio1_resources,
84};
85
86/* gpio2 */
87static struct __initdata resource omap16xx_gpio2_resources[] = {
88 {
89 .start = OMAP1610_GPIO2_BASE,
90 .end = OMAP1610_GPIO2_BASE + SZ_2K - 1,
91 .flags = IORESOURCE_MEM,
92 },
93 {
94 .start = INT_1610_GPIO_BANK2,
95 .flags = IORESOURCE_IRQ,
96 },
97};
98
99static struct __initdata omap_gpio_platform_data omap16xx_gpio2_config = {
100 .virtual_irq_start = IH_GPIO_BASE + 16,
101 .bank_type = METHOD_GPIO_1610,
102 .bank_width = 16,
103};
104
105static struct __initdata platform_device omap16xx_gpio2 = {
106 .name = "omap_gpio",
107 .id = 2,
108 .dev = {
109 .platform_data = &omap16xx_gpio2_config,
110 },
111 .num_resources = ARRAY_SIZE(omap16xx_gpio2_resources),
112 .resource = omap16xx_gpio2_resources,
113};
114
115/* gpio3 */
116static struct __initdata resource omap16xx_gpio3_resources[] = {
117 {
118 .start = OMAP1610_GPIO3_BASE,
119 .end = OMAP1610_GPIO3_BASE + SZ_2K - 1,
120 .flags = IORESOURCE_MEM,
121 },
122 {
123 .start = INT_1610_GPIO_BANK3,
124 .flags = IORESOURCE_IRQ,
125 },
126};
127
128static struct __initdata omap_gpio_platform_data omap16xx_gpio3_config = {
129 .virtual_irq_start = IH_GPIO_BASE + 32,
130 .bank_type = METHOD_GPIO_1610,
131 .bank_width = 16,
132};
133
134static struct __initdata platform_device omap16xx_gpio3 = {
135 .name = "omap_gpio",
136 .id = 3,
137 .dev = {
138 .platform_data = &omap16xx_gpio3_config,
139 },
140 .num_resources = ARRAY_SIZE(omap16xx_gpio3_resources),
141 .resource = omap16xx_gpio3_resources,
142};
143
144/* gpio4 */
145static struct __initdata resource omap16xx_gpio4_resources[] = {
146 {
147 .start = OMAP1610_GPIO4_BASE,
148 .end = OMAP1610_GPIO4_BASE + SZ_2K - 1,
149 .flags = IORESOURCE_MEM,
150 },
151 {
152 .start = INT_1610_GPIO_BANK4,
153 .flags = IORESOURCE_IRQ,
154 },
155};
156
157static struct __initdata omap_gpio_platform_data omap16xx_gpio4_config = {
158 .virtual_irq_start = IH_GPIO_BASE + 48,
159 .bank_type = METHOD_GPIO_1610,
160 .bank_width = 16,
161};
162
163static struct __initdata platform_device omap16xx_gpio4 = {
164 .name = "omap_gpio",
165 .id = 4,
166 .dev = {
167 .platform_data = &omap16xx_gpio4_config,
168 },
169 .num_resources = ARRAY_SIZE(omap16xx_gpio4_resources),
170 .resource = omap16xx_gpio4_resources,
171};
172
173static struct __initdata platform_device * omap16xx_gpio_dev[] = {
174 &omap16xx_mpu_gpio,
175 &omap16xx_gpio1,
176 &omap16xx_gpio2,
177 &omap16xx_gpio3,
178 &omap16xx_gpio4,
179};
180
181/*
182 * omap16xx_gpio_init needs to be done before
183 * machine_init functions access gpio APIs.
184 * Hence omap16xx_gpio_init is a postcore_initcall.
185 */
186static int __init omap16xx_gpio_init(void)
187{
188 int i;
189
190 if (!cpu_is_omap16xx())
191 return -EINVAL;
192
193 for (i = 0; i < ARRAY_SIZE(omap16xx_gpio_dev); i++)
194 platform_device_register(omap16xx_gpio_dev[i]);
195
196 gpio_bank_count = ARRAY_SIZE(omap16xx_gpio_dev);
197
198 return 0;
199}
200postcore_initcall(omap16xx_gpio_init);
diff --git a/arch/arm/mach-omap1/gpio7xx.c b/arch/arm/mach-omap1/gpio7xx.c
new file mode 100644
index 000000000000..1204c8b871af
--- /dev/null
+++ b/arch/arm/mach-omap1/gpio7xx.c
@@ -0,0 +1,262 @@
1/*
2 * OMAP7xx specific gpio init
3 *
4 * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
5 *
6 * Author:
7 * Charulatha V <charu@ti.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation version 2.
12 *
13 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
14 * kind, whether express or implied; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 */
18
19#include <linux/gpio.h>
20
21#define OMAP7XX_GPIO1_BASE 0xfffbc000
22#define OMAP7XX_GPIO2_BASE 0xfffbc800
23#define OMAP7XX_GPIO3_BASE 0xfffbd000
24#define OMAP7XX_GPIO4_BASE 0xfffbd800
25#define OMAP7XX_GPIO5_BASE 0xfffbe000
26#define OMAP7XX_GPIO6_BASE 0xfffbe800
27#define OMAP1_MPUIO_VBASE OMAP1_MPUIO_BASE
28
29/* mpu gpio */
30static struct __initdata resource omap7xx_mpu_gpio_resources[] = {
31 {
32 .start = OMAP1_MPUIO_VBASE,
33 .end = OMAP1_MPUIO_VBASE + SZ_2K - 1,
34 .flags = IORESOURCE_MEM,
35 },
36 {
37 .start = INT_7XX_MPUIO,
38 .flags = IORESOURCE_IRQ,
39 },
40};
41
42static struct __initdata omap_gpio_platform_data omap7xx_mpu_gpio_config = {
43 .virtual_irq_start = IH_MPUIO_BASE,
44 .bank_type = METHOD_MPUIO,
45 .bank_width = 32,
46 .bank_stride = 2,
47};
48
49static struct __initdata platform_device omap7xx_mpu_gpio = {
50 .name = "omap_gpio",
51 .id = 0,
52 .dev = {
53 .platform_data = &omap7xx_mpu_gpio_config,
54 },
55 .num_resources = ARRAY_SIZE(omap7xx_mpu_gpio_resources),
56 .resource = omap7xx_mpu_gpio_resources,
57};
58
59/* gpio1 */
60static struct __initdata resource omap7xx_gpio1_resources[] = {
61 {
62 .start = OMAP7XX_GPIO1_BASE,
63 .end = OMAP7XX_GPIO1_BASE + SZ_2K - 1,
64 .flags = IORESOURCE_MEM,
65 },
66 {
67 .start = INT_7XX_GPIO_BANK1,
68 .flags = IORESOURCE_IRQ,
69 },
70};
71
72static struct __initdata omap_gpio_platform_data omap7xx_gpio1_config = {
73 .virtual_irq_start = IH_GPIO_BASE,
74 .bank_type = METHOD_GPIO_7XX,
75 .bank_width = 32,
76};
77
78static struct __initdata platform_device omap7xx_gpio1 = {
79 .name = "omap_gpio",
80 .id = 1,
81 .dev = {
82 .platform_data = &omap7xx_gpio1_config,
83 },
84 .num_resources = ARRAY_SIZE(omap7xx_gpio1_resources),
85 .resource = omap7xx_gpio1_resources,
86};
87
88/* gpio2 */
89static struct __initdata resource omap7xx_gpio2_resources[] = {
90 {
91 .start = OMAP7XX_GPIO2_BASE,
92 .end = OMAP7XX_GPIO2_BASE + SZ_2K - 1,
93 .flags = IORESOURCE_MEM,
94 },
95 {
96 .start = INT_7XX_GPIO_BANK2,
97 .flags = IORESOURCE_IRQ,
98 },
99};
100
101static struct __initdata omap_gpio_platform_data omap7xx_gpio2_config = {
102 .virtual_irq_start = IH_GPIO_BASE + 32,
103 .bank_type = METHOD_GPIO_7XX,
104 .bank_width = 32,
105};
106
107static struct __initdata platform_device omap7xx_gpio2 = {
108 .name = "omap_gpio",
109 .id = 2,
110 .dev = {
111 .platform_data = &omap7xx_gpio2_config,
112 },
113 .num_resources = ARRAY_SIZE(omap7xx_gpio2_resources),
114 .resource = omap7xx_gpio2_resources,
115};
116
117/* gpio3 */
118static struct __initdata resource omap7xx_gpio3_resources[] = {
119 {
120 .start = OMAP7XX_GPIO3_BASE,
121 .end = OMAP7XX_GPIO3_BASE + SZ_2K - 1,
122 .flags = IORESOURCE_MEM,
123 },
124 {
125 .start = INT_7XX_GPIO_BANK3,
126 .flags = IORESOURCE_IRQ,
127 },
128};
129
130static struct __initdata omap_gpio_platform_data omap7xx_gpio3_config = {
131 .virtual_irq_start = IH_GPIO_BASE + 64,
132 .bank_type = METHOD_GPIO_7XX,
133 .bank_width = 32,
134};
135
136static struct __initdata platform_device omap7xx_gpio3 = {
137 .name = "omap_gpio",
138 .id = 3,
139 .dev = {
140 .platform_data = &omap7xx_gpio3_config,
141 },
142 .num_resources = ARRAY_SIZE(omap7xx_gpio3_resources),
143 .resource = omap7xx_gpio3_resources,
144};
145
146/* gpio4 */
147static struct __initdata resource omap7xx_gpio4_resources[] = {
148 {
149 .start = OMAP7XX_GPIO4_BASE,
150 .end = OMAP7XX_GPIO4_BASE + SZ_2K - 1,
151 .flags = IORESOURCE_MEM,
152 },
153 {
154 .start = INT_7XX_GPIO_BANK4,
155 .flags = IORESOURCE_IRQ,
156 },
157};
158
159static struct __initdata omap_gpio_platform_data omap7xx_gpio4_config = {
160 .virtual_irq_start = IH_GPIO_BASE + 96,
161 .bank_type = METHOD_GPIO_7XX,
162 .bank_width = 32,
163};
164
165static struct __initdata platform_device omap7xx_gpio4 = {
166 .name = "omap_gpio",
167 .id = 4,
168 .dev = {
169 .platform_data = &omap7xx_gpio4_config,
170 },
171 .num_resources = ARRAY_SIZE(omap7xx_gpio4_resources),
172 .resource = omap7xx_gpio4_resources,
173};
174
175/* gpio5 */
176static struct __initdata resource omap7xx_gpio5_resources[] = {
177 {
178 .start = OMAP7XX_GPIO5_BASE,
179 .end = OMAP7XX_GPIO5_BASE + SZ_2K - 1,
180 .flags = IORESOURCE_MEM,
181 },
182 {
183 .start = INT_7XX_GPIO_BANK5,
184 .flags = IORESOURCE_IRQ,
185 },
186};
187
188static struct __initdata omap_gpio_platform_data omap7xx_gpio5_config = {
189 .virtual_irq_start = IH_GPIO_BASE + 128,
190 .bank_type = METHOD_GPIO_7XX,
191 .bank_width = 32,
192};
193
194static struct __initdata platform_device omap7xx_gpio5 = {
195 .name = "omap_gpio",
196 .id = 5,
197 .dev = {
198 .platform_data = &omap7xx_gpio5_config,
199 },
200 .num_resources = ARRAY_SIZE(omap7xx_gpio5_resources),
201 .resource = omap7xx_gpio5_resources,
202};
203
204/* gpio6 */
205static struct __initdata resource omap7xx_gpio6_resources[] = {
206 {
207 .start = OMAP7XX_GPIO6_BASE,
208 .end = OMAP7XX_GPIO6_BASE + SZ_2K - 1,
209 .flags = IORESOURCE_MEM,
210 },
211 {
212 .start = INT_7XX_GPIO_BANK6,
213 .flags = IORESOURCE_IRQ,
214 },
215};
216
217static struct __initdata omap_gpio_platform_data omap7xx_gpio6_config = {
218 .virtual_irq_start = IH_GPIO_BASE + 160,
219 .bank_type = METHOD_GPIO_7XX,
220 .bank_width = 32,
221};
222
223static struct __initdata platform_device omap7xx_gpio6 = {
224 .name = "omap_gpio",
225 .id = 6,
226 .dev = {
227 .platform_data = &omap7xx_gpio6_config,
228 },
229 .num_resources = ARRAY_SIZE(omap7xx_gpio6_resources),
230 .resource = omap7xx_gpio6_resources,
231};
232
233static struct __initdata platform_device * omap7xx_gpio_dev[] = {
234 &omap7xx_mpu_gpio,
235 &omap7xx_gpio1,
236 &omap7xx_gpio2,
237 &omap7xx_gpio3,
238 &omap7xx_gpio4,
239 &omap7xx_gpio5,
240 &omap7xx_gpio6,
241};
242
243/*
244 * omap7xx_gpio_init needs to be done before
245 * machine_init functions access gpio APIs.
246 * Hence omap7xx_gpio_init is a postcore_initcall.
247 */
248static int __init omap7xx_gpio_init(void)
249{
250 int i;
251
252 if (!cpu_is_omap7xx())
253 return -EINVAL;
254
255 for (i = 0; i < ARRAY_SIZE(omap7xx_gpio_dev); i++)
256 platform_device_register(omap7xx_gpio_dev[i]);
257
258 gpio_bank_count = ARRAY_SIZE(omap7xx_gpio_dev);
259
260 return 0;
261}
262postcore_initcall(omap7xx_gpio_init);