diff options
author | Vladimir Zapolskiy <vz@mleia.com> | 2016-09-18 21:37:20 -0400 |
---|---|---|
committer | Shawn Guo <shawnguo@kernel.org> | 2016-09-20 10:35:08 -0400 |
commit | a95a9322df400b5b4a9dc49dffbb30742ecc5497 (patch) | |
tree | fd0f59578bb2f8e08ddf4ddb367114ea83d8af58 | |
parent | c5f9cfe60bd4763432e78780174fa6b6c5e82336 (diff) |
ARM: imx legacy: armadillo5x0: move peripheral initialization to .init_late
The change moves some of peripheral registrations and initializations
(all peripherals dependent on GPIOs) from .init_machine to .init_late
level, this allows to safely shift the shared GPIO controller driver
initialization level after init level of i.MX IOMUXC driver.
Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
-rw-r--r-- | arch/arm/mach-imx/mach-armadillo5x0.c | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/arch/arm/mach-imx/mach-armadillo5x0.c b/arch/arm/mach-imx/mach-armadillo5x0.c index eaee47a2fcc0..17a97ba2cecf 100644 --- a/arch/arm/mach-imx/mach-armadillo5x0.c +++ b/arch/arm/mach-imx/mach-armadillo5x0.c | |||
@@ -493,24 +493,12 @@ static void __init armadillo5x0_init(void) | |||
493 | 493 | ||
494 | regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies)); | 494 | regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies)); |
495 | 495 | ||
496 | armadillo5x0_smc911x_resources[1].start = | ||
497 | gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_0)); | ||
498 | armadillo5x0_smc911x_resources[1].end = | ||
499 | gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_0)); | ||
500 | platform_add_devices(devices, ARRAY_SIZE(devices)); | ||
501 | imx_add_gpio_keys(&armadillo5x0_button_data); | ||
502 | imx31_add_imx_i2c1(NULL); | 496 | imx31_add_imx_i2c1(NULL); |
503 | 497 | ||
504 | /* Register UART */ | 498 | /* Register UART */ |
505 | imx31_add_imx_uart0(&uart_pdata); | 499 | imx31_add_imx_uart0(&uart_pdata); |
506 | imx31_add_imx_uart1(&uart_pdata); | 500 | imx31_add_imx_uart1(&uart_pdata); |
507 | 501 | ||
508 | /* SMSC9118 IRQ pin */ | ||
509 | gpio_direction_input(MX31_PIN_GPIO1_0); | ||
510 | |||
511 | /* Register SDHC */ | ||
512 | imx31_add_mxc_mmc(0, &sdhc_pdata); | ||
513 | |||
514 | /* Register FB */ | 502 | /* Register FB */ |
515 | imx31_add_ipu_core(); | 503 | imx31_add_ipu_core(); |
516 | imx31_add_mx3_sdc_fb(&mx3fb_pdata); | 504 | imx31_add_mx3_sdc_fb(&mx3fb_pdata); |
@@ -527,21 +515,39 @@ static void __init armadillo5x0_init(void) | |||
527 | /* set NAND page size to 2k if not configured via boot mode pins */ | 515 | /* set NAND page size to 2k if not configured via boot mode pins */ |
528 | imx_writel(imx_readl(mx3_ccm_base + MXC_CCM_RCSR) | (1 << 30), | 516 | imx_writel(imx_readl(mx3_ccm_base + MXC_CCM_RCSR) | (1 << 30), |
529 | mx3_ccm_base + MXC_CCM_RCSR); | 517 | mx3_ccm_base + MXC_CCM_RCSR); |
518 | } | ||
519 | |||
520 | static void __init armadillo5x0_late(void) | ||
521 | { | ||
522 | armadillo5x0_smc911x_resources[1].start = | ||
523 | gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_0)); | ||
524 | armadillo5x0_smc911x_resources[1].end = | ||
525 | gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_0)); | ||
526 | platform_add_devices(devices, ARRAY_SIZE(devices)); | ||
527 | |||
528 | imx_add_gpio_keys(&armadillo5x0_button_data); | ||
529 | |||
530 | /* SMSC9118 IRQ pin */ | ||
531 | gpio_direction_input(MX31_PIN_GPIO1_0); | ||
532 | |||
533 | /* Register SDHC */ | ||
534 | imx31_add_mxc_mmc(0, &sdhc_pdata); | ||
530 | 535 | ||
531 | /* RTC */ | 536 | /* RTC */ |
532 | /* Get RTC IRQ and register the chip */ | 537 | /* Get RTC IRQ and register the chip */ |
533 | if (gpio_request(ARMADILLO5X0_RTC_GPIO, "rtc") == 0) { | 538 | if (!gpio_request(ARMADILLO5X0_RTC_GPIO, "rtc")) { |
534 | if (gpio_direction_input(ARMADILLO5X0_RTC_GPIO) == 0) | 539 | if (!gpio_direction_input(ARMADILLO5X0_RTC_GPIO)) |
535 | armadillo5x0_i2c_rtc.irq = gpio_to_irq(ARMADILLO5X0_RTC_GPIO); | 540 | armadillo5x0_i2c_rtc.irq = |
541 | gpio_to_irq(ARMADILLO5X0_RTC_GPIO); | ||
536 | else | 542 | else |
537 | gpio_free(ARMADILLO5X0_RTC_GPIO); | 543 | gpio_free(ARMADILLO5X0_RTC_GPIO); |
538 | } | 544 | } |
545 | |||
539 | if (armadillo5x0_i2c_rtc.irq == 0) | 546 | if (armadillo5x0_i2c_rtc.irq == 0) |
540 | pr_warn("armadillo5x0_init: failed to get RTC IRQ\n"); | 547 | pr_warn("armadillo5x0_init: failed to get RTC IRQ\n"); |
541 | i2c_register_board_info(1, &armadillo5x0_i2c_rtc, 1); | 548 | i2c_register_board_info(1, &armadillo5x0_i2c_rtc, 1); |
542 | 549 | ||
543 | /* USB */ | 550 | /* USB */ |
544 | |||
545 | usbotg_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS | | 551 | usbotg_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS | |
546 | ULPI_OTG_DRVVBUS_EXT); | 552 | ULPI_OTG_DRVVBUS_EXT); |
547 | if (usbotg_pdata.otg) | 553 | if (usbotg_pdata.otg) |
@@ -565,5 +571,6 @@ MACHINE_START(ARMADILLO5X0, "Armadillo-500") | |||
565 | .init_irq = mx31_init_irq, | 571 | .init_irq = mx31_init_irq, |
566 | .init_time = armadillo5x0_timer_init, | 572 | .init_time = armadillo5x0_timer_init, |
567 | .init_machine = armadillo5x0_init, | 573 | .init_machine = armadillo5x0_init, |
574 | .init_late = armadillo5x0_late, | ||
568 | .restart = mxc_restart, | 575 | .restart = mxc_restart, |
569 | MACHINE_END | 576 | MACHINE_END |