diff options
author | Vladimir Zapolskiy <vz@mleia.com> | 2016-09-18 21:37:14 -0400 |
---|---|---|
committer | Shawn Guo <shawnguo@kernel.org> | 2016-09-20 10:34:47 -0400 |
commit | 4ed9bb21847b9459cdc16a4027b6058d0540dcc8 (patch) | |
tree | 7aaf8bae6246b222943e463100ded2a739521162 /arch/arm/mach-imx | |
parent | 4bc2e627c5aa3b69e1a549f71792c738ce220b1c (diff) |
ARM: imx legacy: mx31lite: 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>
Diffstat (limited to 'arch/arm/mach-imx')
-rw-r--r-- | arch/arm/mach-imx/mach-mx31lite.c | 68 | ||||
-rw-r--r-- | arch/arm/mach-imx/mx31lite-db.c | 33 |
2 files changed, 48 insertions, 53 deletions
diff --git a/arch/arm/mach-imx/mach-mx31lite.c b/arch/arm/mach-imx/mach-mx31lite.c index 4822a1738de4..f033a57d5694 100644 --- a/arch/arm/mach-imx/mach-mx31lite.c +++ b/arch/arm/mach-imx/mach-mx31lite.c | |||
@@ -52,6 +52,19 @@ | |||
52 | */ | 52 | */ |
53 | 53 | ||
54 | static unsigned int mx31lite_pins[] = { | 54 | static unsigned int mx31lite_pins[] = { |
55 | /* UART1 */ | ||
56 | MX31_PIN_CTS1__CTS1, | ||
57 | MX31_PIN_RTS1__RTS1, | ||
58 | MX31_PIN_TXD1__TXD1, | ||
59 | MX31_PIN_RXD1__RXD1, | ||
60 | /* SPI 0 */ | ||
61 | MX31_PIN_CSPI1_SCLK__SCLK, | ||
62 | MX31_PIN_CSPI1_MOSI__MOSI, | ||
63 | MX31_PIN_CSPI1_MISO__MISO, | ||
64 | MX31_PIN_CSPI1_SPI_RDY__SPI_RDY, | ||
65 | MX31_PIN_CSPI1_SS0__SS0, | ||
66 | MX31_PIN_CSPI1_SS1__SS1, | ||
67 | MX31_PIN_CSPI1_SS2__SS2, | ||
55 | /* LAN9117 IRQ pin */ | 68 | /* LAN9117 IRQ pin */ |
56 | IOMUX_MODE(MX31_PIN_SFS6, IOMUX_CONFIG_GPIO), | 69 | IOMUX_MODE(MX31_PIN_SFS6, IOMUX_CONFIG_GPIO), |
57 | /* SPI 1 */ | 70 | /* SPI 1 */ |
@@ -64,6 +77,23 @@ static unsigned int mx31lite_pins[] = { | |||
64 | MX31_PIN_CSPI2_SS2__SS2, | 77 | MX31_PIN_CSPI2_SS2__SS2, |
65 | }; | 78 | }; |
66 | 79 | ||
80 | /* UART */ | ||
81 | static const struct imxuart_platform_data uart_pdata __initconst = { | ||
82 | .flags = IMXUART_HAVE_RTSCTS, | ||
83 | }; | ||
84 | |||
85 | /* SPI */ | ||
86 | static int spi0_internal_chipselect[] = { | ||
87 | MXC_SPI_CS(0), | ||
88 | MXC_SPI_CS(1), | ||
89 | MXC_SPI_CS(2), | ||
90 | }; | ||
91 | |||
92 | static const struct spi_imx_master spi0_pdata __initconst = { | ||
93 | .chipselect = spi0_internal_chipselect, | ||
94 | .num_chipselect = ARRAY_SIZE(spi0_internal_chipselect), | ||
95 | }; | ||
96 | |||
67 | static const struct mxc_nand_platform_data | 97 | static const struct mxc_nand_platform_data |
68 | mx31lite_nand_board_info __initconst = { | 98 | mx31lite_nand_board_info __initconst = { |
69 | .width = 1, | 99 | .width = 1, |
@@ -103,13 +133,13 @@ static struct platform_device smsc911x_device = { | |||
103 | * The MC13783 is the only hard-wired SPI device on the module. | 133 | * The MC13783 is the only hard-wired SPI device on the module. |
104 | */ | 134 | */ |
105 | 135 | ||
106 | static int spi_internal_chipselect[] = { | 136 | static int spi1_internal_chipselect[] = { |
107 | MXC_SPI_CS(0), | 137 | MXC_SPI_CS(0), |
108 | }; | 138 | }; |
109 | 139 | ||
110 | static const struct spi_imx_master spi1_pdata __initconst = { | 140 | static const struct spi_imx_master spi1_pdata __initconst = { |
111 | .chipselect = spi_internal_chipselect, | 141 | .chipselect = spi1_internal_chipselect, |
112 | .num_chipselect = ARRAY_SIZE(spi_internal_chipselect), | 142 | .num_chipselect = ARRAY_SIZE(spi1_internal_chipselect), |
113 | }; | 143 | }; |
114 | 144 | ||
115 | static struct mc13xxx_platform_data mc13783_pdata __initdata = { | 145 | static struct mc13xxx_platform_data mc13783_pdata __initdata = { |
@@ -200,8 +230,6 @@ static struct platform_device physmap_flash_device = { | |||
200 | .num_resources = 1, | 230 | .num_resources = 1, |
201 | }; | 231 | }; |
202 | 232 | ||
203 | |||
204 | |||
205 | /* | 233 | /* |
206 | * This structure defines the MX31 memory map. | 234 | * This structure defines the MX31 memory map. |
207 | */ | 235 | */ |
@@ -233,29 +261,30 @@ static struct regulator_consumer_supply dummy_supplies[] = { | |||
233 | 261 | ||
234 | static void __init mx31lite_init(void) | 262 | static void __init mx31lite_init(void) |
235 | { | 263 | { |
236 | int ret; | ||
237 | |||
238 | imx31_soc_init(); | 264 | imx31_soc_init(); |
239 | 265 | ||
240 | switch (mx31lite_baseboard) { | ||
241 | case MX31LITE_NOBOARD: | ||
242 | break; | ||
243 | case MX31LITE_DB: | ||
244 | mx31lite_db_init(); | ||
245 | break; | ||
246 | default: | ||
247 | printk(KERN_ERR "Illegal mx31lite_baseboard type %d\n", | ||
248 | mx31lite_baseboard); | ||
249 | } | ||
250 | |||
251 | mxc_iomux_setup_multiple_pins(mx31lite_pins, ARRAY_SIZE(mx31lite_pins), | 266 | mxc_iomux_setup_multiple_pins(mx31lite_pins, ARRAY_SIZE(mx31lite_pins), |
252 | "mx31lite"); | 267 | "mx31lite"); |
253 | 268 | ||
269 | imx31_add_imx_uart0(&uart_pdata); | ||
270 | imx31_add_spi_imx0(&spi0_pdata); | ||
271 | |||
254 | /* NOR and NAND flash */ | 272 | /* NOR and NAND flash */ |
255 | platform_device_register(&physmap_flash_device); | 273 | platform_device_register(&physmap_flash_device); |
256 | imx31_add_mxc_nand(&mx31lite_nand_board_info); | 274 | imx31_add_mxc_nand(&mx31lite_nand_board_info); |
257 | 275 | ||
258 | imx31_add_spi_imx1(&spi1_pdata); | 276 | imx31_add_spi_imx1(&spi1_pdata); |
277 | |||
278 | regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies)); | ||
279 | } | ||
280 | |||
281 | static void __init mx31lite_late(void) | ||
282 | { | ||
283 | int ret; | ||
284 | |||
285 | if (mx31lite_baseboard == MX31LITE_DB) | ||
286 | mx31lite_db_init(); | ||
287 | |||
259 | mc13783_spi_dev.irq = gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3)); | 288 | mc13783_spi_dev.irq = gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3)); |
260 | spi_register_board_info(&mc13783_spi_dev, 1); | 289 | spi_register_board_info(&mc13783_spi_dev, 1); |
261 | 290 | ||
@@ -265,8 +294,6 @@ static void __init mx31lite_init(void) | |||
265 | if (usbh2_pdata.otg) | 294 | if (usbh2_pdata.otg) |
266 | imx31_add_mxc_ehci_hs(2, &usbh2_pdata); | 295 | imx31_add_mxc_ehci_hs(2, &usbh2_pdata); |
267 | 296 | ||
268 | regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies)); | ||
269 | |||
270 | /* SMSC9117 IRQ pin */ | 297 | /* SMSC9117 IRQ pin */ |
271 | ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_SFS6), "sms9117-irq"); | 298 | ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_SFS6), "sms9117-irq"); |
272 | if (ret) | 299 | if (ret) |
@@ -294,5 +321,6 @@ MACHINE_START(MX31LITE, "LogicPD i.MX31 SOM") | |||
294 | .init_irq = mx31_init_irq, | 321 | .init_irq = mx31_init_irq, |
295 | .init_time = mx31lite_timer_init, | 322 | .init_time = mx31lite_timer_init, |
296 | .init_machine = mx31lite_init, | 323 | .init_machine = mx31lite_init, |
324 | .init_late = mx31lite_late, | ||
297 | .restart = mxc_restart, | 325 | .restart = mxc_restart, |
298 | MACHINE_END | 326 | MACHINE_END |
diff --git a/arch/arm/mach-imx/mx31lite-db.c b/arch/arm/mach-imx/mx31lite-db.c index 5a160b7e4fce..c66a006bf2fd 100644 --- a/arch/arm/mach-imx/mx31lite-db.c +++ b/arch/arm/mach-imx/mx31lite-db.c | |||
@@ -45,19 +45,6 @@ | |||
45 | */ | 45 | */ |
46 | 46 | ||
47 | static unsigned int litekit_db_board_pins[] __initdata = { | 47 | static unsigned int litekit_db_board_pins[] __initdata = { |
48 | /* UART1 */ | ||
49 | MX31_PIN_CTS1__CTS1, | ||
50 | MX31_PIN_RTS1__RTS1, | ||
51 | MX31_PIN_TXD1__TXD1, | ||
52 | MX31_PIN_RXD1__RXD1, | ||
53 | /* SPI 0 */ | ||
54 | MX31_PIN_CSPI1_SCLK__SCLK, | ||
55 | MX31_PIN_CSPI1_MOSI__MOSI, | ||
56 | MX31_PIN_CSPI1_MISO__MISO, | ||
57 | MX31_PIN_CSPI1_SPI_RDY__SPI_RDY, | ||
58 | MX31_PIN_CSPI1_SS0__SS0, | ||
59 | MX31_PIN_CSPI1_SS1__SS1, | ||
60 | MX31_PIN_CSPI1_SS2__SS2, | ||
61 | /* SDHC1 */ | 48 | /* SDHC1 */ |
62 | MX31_PIN_SD1_DATA0__SD1_DATA0, | 49 | MX31_PIN_SD1_DATA0__SD1_DATA0, |
63 | MX31_PIN_SD1_DATA1__SD1_DATA1, | 50 | MX31_PIN_SD1_DATA1__SD1_DATA1, |
@@ -67,11 +54,6 @@ static unsigned int litekit_db_board_pins[] __initdata = { | |||
67 | MX31_PIN_SD1_CMD__SD1_CMD, | 54 | MX31_PIN_SD1_CMD__SD1_CMD, |
68 | }; | 55 | }; |
69 | 56 | ||
70 | /* UART */ | ||
71 | static const struct imxuart_platform_data uart_pdata __initconst = { | ||
72 | .flags = IMXUART_HAVE_RTSCTS, | ||
73 | }; | ||
74 | |||
75 | /* MMC */ | 57 | /* MMC */ |
76 | 58 | ||
77 | static int gpio_det, gpio_wp; | 59 | static int gpio_det, gpio_wp; |
@@ -146,19 +128,6 @@ static const struct imxmmc_platform_data mmc_pdata __initconst = { | |||
146 | .exit = mxc_mmc1_exit, | 128 | .exit = mxc_mmc1_exit, |
147 | }; | 129 | }; |
148 | 130 | ||
149 | /* SPI */ | ||
150 | |||
151 | static int spi_internal_chipselect[] = { | ||
152 | MXC_SPI_CS(0), | ||
153 | MXC_SPI_CS(1), | ||
154 | MXC_SPI_CS(2), | ||
155 | }; | ||
156 | |||
157 | static const struct spi_imx_master spi0_pdata __initconst = { | ||
158 | .chipselect = spi_internal_chipselect, | ||
159 | .num_chipselect = ARRAY_SIZE(spi_internal_chipselect), | ||
160 | }; | ||
161 | |||
162 | /* GPIO LEDs */ | 131 | /* GPIO LEDs */ |
163 | 132 | ||
164 | static const struct gpio_led litekit_leds[] __initconst = { | 133 | static const struct gpio_led litekit_leds[] __initconst = { |
@@ -187,9 +156,7 @@ void __init mx31lite_db_init(void) | |||
187 | mxc_iomux_setup_multiple_pins(litekit_db_board_pins, | 156 | mxc_iomux_setup_multiple_pins(litekit_db_board_pins, |
188 | ARRAY_SIZE(litekit_db_board_pins), | 157 | ARRAY_SIZE(litekit_db_board_pins), |
189 | "development board pins"); | 158 | "development board pins"); |
190 | imx31_add_imx_uart0(&uart_pdata); | ||
191 | imx31_add_mxc_mmc(0, &mmc_pdata); | 159 | imx31_add_mxc_mmc(0, &mmc_pdata); |
192 | imx31_add_spi_imx0(&spi0_pdata); | ||
193 | gpio_led_register_device(-1, &litekit_led_platform_data); | 160 | gpio_led_register_device(-1, &litekit_led_platform_data); |
194 | imx31_add_imx2_wdt(); | 161 | imx31_add_imx2_wdt(); |
195 | imx31_add_mxc_rtc(); | 162 | imx31_add_mxc_rtc(); |