aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2010-12-07 19:26:55 -0500
committerTony Lindgren <tony@atomide.com>2010-12-07 19:26:55 -0500
commitc2cdaffe0bb32015e84af8e31f73e620ba271165 (patch)
tree420ae7c0acec63eda182c7b4ceea1e39406bc41b
parent7b045c96cd1405597a6a2e98bc53a4ac01d835b1 (diff)
omap: Fix gpio_request calls to happen as arch_initcall
Looks like some boards are calling gpio_request from init_irq. This will make the request_irq fail, as GPIO will be initialized as postcore_initcall. Reported-by: Paul Walmsley <paul@pwsan.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
-rw-r--r--arch/arm/mach-omap1/board-fsample.c21
-rw-r--r--arch/arm/mach-omap1/board-h2.c3
-rw-r--r--arch/arm/mach-omap1/board-h3.c21
-rw-r--r--arch/arm/mach-omap1/board-innovator.c3
-rw-r--r--arch/arm/mach-omap1/board-osk.c5
-rw-r--r--arch/arm/mach-omap1/board-perseus2.c21
-rw-r--r--arch/arm/mach-omap2/board-apollon.c2
-rw-r--r--arch/arm/mach-omap2/board-ldp.c2
8 files changed, 42 insertions, 36 deletions
diff --git a/arch/arm/mach-omap1/board-fsample.c b/arch/arm/mach-omap1/board-fsample.c
index 149fdd32e127..295ab6713670 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,11 @@ 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(); 330 omap_gpio_init();
329 fsample_init_smc91x();
330} 331}
331 332
332/* Only FPGA needs to be mapped here. All others are done with ioremap */ 333/* 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..dd35efdefcf7 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -375,7 +375,6 @@ static void __init h2_init_irq(void)
375 omap1_init_common_hw(); 375 omap1_init_common_hw();
376 omap_init_irq(); 376 omap_init_irq();
377 omap_gpio_init(); 377 omap_gpio_init();
378 h2_init_smc91x();
379} 378}
380 379
381static struct omap_usb_config h2_usb_config __initdata = { 380static struct omap_usb_config h2_usb_config __initdata = {
@@ -403,6 +402,8 @@ static struct omap_board_config_kernel h2_config[] __initdata = {
403 402
404static void __init h2_init(void) 403static void __init h2_init(void)
405{ 404{
405 h2_init_smc91x();
406
406 /* Here we assume the NOR boot config: NOR on CS3 (possibly swapped 407 /* 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 408 * 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. 409 * 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..78719198809e 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,11 @@ 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(); 440 omap_gpio_init();
439 h3_init_smc91x();
440} 441}
441 442
442static void __init h3_map_io(void) 443static void __init h3_map_io(void)
diff --git a/arch/arm/mach-omap1/board-innovator.c b/arch/arm/mach-omap1/board-innovator.c
index dc2b86fd66c1..0feaa6731c7e 100644
--- a/arch/arm/mach-omap1/board-innovator.c
+++ b/arch/arm/mach-omap1/board-innovator.c
@@ -296,7 +296,6 @@ static void __init innovator_init_irq(void)
296 omap1510_fpga_init_irq(); 296 omap1510_fpga_init_irq();
297 } 297 }
298#endif 298#endif
299 innovator_init_smc91x();
300} 299}
301 300
302#ifdef CONFIG_ARCH_OMAP15XX 301#ifdef CONFIG_ARCH_OMAP15XX
@@ -387,6 +386,8 @@ static struct omap_board_config_kernel innovator_config[] = {
387 386
388static void __init innovator_init(void) 387static void __init innovator_init(void)
389{ 388{
389 innovator_init_smc91x();
390
390#ifdef CONFIG_ARCH_OMAP15XX 391#ifdef CONFIG_ARCH_OMAP15XX
391 if (cpu_is_omap1510()) { 392 if (cpu_is_omap1510()) {
392 unsigned char reg; 393 unsigned char reg;
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
index e9dd79149a8e..30bdbdb93636 100644
--- a/arch/arm/mach-omap1/board-osk.c
+++ b/arch/arm/mach-omap1/board-osk.c
@@ -284,8 +284,6 @@ static void __init osk_init_irq(void)
284 omap1_init_common_hw(); 284 omap1_init_common_hw();
285 omap_init_irq(); 285 omap_init_irq();
286 omap_gpio_init(); 286 omap_gpio_init();
287 osk_init_smc91x();
288 osk_init_cf();
289} 287}
290 288
291static struct omap_usb_config osk_usb_config __initdata = { 289static struct omap_usb_config osk_usb_config __initdata = {
@@ -541,6 +539,9 @@ static void __init osk_init(void)
541{ 539{
542 u32 l; 540 u32 l;
543 541
542 osk_init_smc91x();
543 osk_init_cf();
544
544 /* Workaround for wrong CS3 (NOR flash) timing 545 /* Workaround for wrong CS3 (NOR flash) timing
545 * There are some U-Boot versions out there which configure 546 * There are some U-Boot versions out there which configure
546 * wrong CS3 memory timings. This mainly leads to CRC 547 * wrong CS3 memory timings. This mainly leads to CRC
diff --git a/arch/arm/mach-omap1/board-perseus2.c b/arch/arm/mach-omap1/board-perseus2.c
index a8d16a255c18..07660be4f228 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,11 @@ 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(); 298 omap_gpio_init();
297 perseus2_init_smc91x();
298} 299}
299/* Only FPGA needs to be mapped here. All others are done with ioremap */ 300/* Only FPGA needs to be mapped here. All others are done with ioremap */
300static struct map_desc omap_perseus2_io_desc[] __initdata = { 301static struct map_desc omap_perseus2_io_desc[] __initdata = {
diff --git a/arch/arm/mach-omap2/board-apollon.c b/arch/arm/mach-omap2/board-apollon.c
index 2c6db1aaeb29..6ae777e08896 100644
--- a/arch/arm/mach-omap2/board-apollon.c
+++ b/arch/arm/mach-omap2/board-apollon.c
@@ -281,7 +281,6 @@ static void __init omap_apollon_init_irq(void)
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(); 283 omap_gpio_init();
284 apollon_init_smc91x();
285} 284}
286 285
287static void __init apollon_led_init(void) 286static void __init apollon_led_init(void)
@@ -324,6 +323,7 @@ static void __init omap_apollon_init(void)
324 323
325 omap2420_mux_init(board_mux, OMAP_PACKAGE_ZAC); 324 omap2420_mux_init(board_mux, OMAP_PACKAGE_ZAC);
326 325
326 apollon_init_smc91x();
327 apollon_led_init(); 327 apollon_led_init();
328 apollon_flash_init(); 328 apollon_flash_init();
329 apollon_usb_init(); 329 apollon_usb_init();
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index 001fd9713f39..3dab44e3eb42 100644
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -295,7 +295,6 @@ static void __init omap_ldp_init_irq(void)
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(); 297 omap_gpio_init();
298 ldp_init_smsc911x();
299} 298}
300 299
301static struct twl4030_usb_data ldp_usb_data = { 300static struct twl4030_usb_data ldp_usb_data = {
@@ -426,6 +425,7 @@ static struct mtd_partition ldp_nand_partitions[] = {
426static void __init omap_ldp_init(void) 425static void __init omap_ldp_init(void)
427{ 426{
428 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 427 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
428 ldp_init_smsc911x();
429 omap_i2c_init(); 429 omap_i2c_init();
430 platform_add_devices(ldp_devices, ARRAY_SIZE(ldp_devices)); 430 platform_add_devices(ldp_devices, ARRAY_SIZE(ldp_devices));
431 ts_gpio = 54; 431 ts_gpio = 54;