diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-06-22 04:09:14 -0400 |
---|---|---|
committer | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-06-30 03:00:50 -0400 |
commit | 06606ff1300ecb05a2a2953c9f735730950365f5 (patch) | |
tree | c34e823648d219d5f6288f68a50804cafe0f13f8 | |
parent | 7536cf992f395cb431f723041183d14a91d89c84 (diff) |
ARM: imx: dynamically register spi_imx devices (imx31)
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-rw-r--r-- | arch/arm/mach-mx3/Kconfig | 4 | ||||
-rw-r--r-- | arch/arm/mach-mx3/devices-imx31.h | 7 | ||||
-rw-r--r-- | arch/arm/mach-mx3/devices.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-mx3/devices.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-mx3/mach-mx31_3ds.c | 5 | ||||
-rw-r--r-- | arch/arm/mach-mx3/mach-mx31lilly.c | 10 | ||||
-rw-r--r-- | arch/arm/mach-mx3/mach-mx31lite.c | 5 | ||||
-rw-r--r-- | arch/arm/mach-mx3/mach-mx31moboard.c | 8 | ||||
-rw-r--r-- | arch/arm/mach-mx3/mx31lite-db.c | 6 |
9 files changed, 30 insertions, 19 deletions
diff --git a/arch/arm/mach-mx3/Kconfig b/arch/arm/mach-mx3/Kconfig index b8a7610ade19..60d58a62906a 100644 --- a/arch/arm/mach-mx3/Kconfig +++ b/arch/arm/mach-mx3/Kconfig | |||
@@ -55,6 +55,7 @@ config MACH_MX31LITE | |||
55 | select ARCH_MX31 | 55 | select ARCH_MX31 |
56 | select MXC_ULPI if USB_ULPI | 56 | select MXC_ULPI if USB_ULPI |
57 | select IMX_HAVE_PLATFORM_MXC_NAND | 57 | select IMX_HAVE_PLATFORM_MXC_NAND |
58 | select IMX_HAVE_PLATFORM_SPI_IMX | ||
58 | help | 59 | help |
59 | Include support for MX31 LITEKIT platform. This includes specific | 60 | Include support for MX31 LITEKIT platform. This includes specific |
60 | configurations for the board and its peripherals. | 61 | configurations for the board and its peripherals. |
@@ -63,6 +64,7 @@ config MACH_MX31_3DS | |||
63 | bool "Support MX31PDK (3DS)" | 64 | bool "Support MX31PDK (3DS)" |
64 | select ARCH_MX31 | 65 | select ARCH_MX31 |
65 | select IMX_HAVE_PLATFORM_MXC_NAND | 66 | select IMX_HAVE_PLATFORM_MXC_NAND |
67 | select IMX_HAVE_PLATFORM_SPI_IMX | ||
66 | help | 68 | help |
67 | Include support for MX31PDK (3DS) platform. This includes specific | 69 | Include support for MX31PDK (3DS) platform. This includes specific |
68 | configurations for the board and its peripherals. | 70 | configurations for the board and its peripherals. |
@@ -80,6 +82,7 @@ config MACH_MX31MOBOARD | |||
80 | bool "Support mx31moboard platforms (EPFL Mobots group)" | 82 | bool "Support mx31moboard platforms (EPFL Mobots group)" |
81 | select ARCH_MX31 | 83 | select ARCH_MX31 |
82 | select IMX_HAVE_PLATFORM_IMX_I2C | 84 | select IMX_HAVE_PLATFORM_IMX_I2C |
85 | select IMX_HAVE_PLATFORM_SPI_IMX | ||
83 | select MXC_ULPI if USB_ULPI | 86 | select MXC_ULPI if USB_ULPI |
84 | help | 87 | help |
85 | Include support for mx31moboard platform. This includes specific | 88 | Include support for mx31moboard platform. This includes specific |
@@ -88,6 +91,7 @@ config MACH_MX31MOBOARD | |||
88 | config MACH_MX31LILLY | 91 | config MACH_MX31LILLY |
89 | bool "Support MX31 LILLY-1131 platforms (INCO startec)" | 92 | bool "Support MX31 LILLY-1131 platforms (INCO startec)" |
90 | select ARCH_MX31 | 93 | select ARCH_MX31 |
94 | select IMX_HAVE_PLATFORM_SPI_IMX | ||
91 | select MXC_ULPI if USB_ULPI | 95 | select MXC_ULPI if USB_ULPI |
92 | help | 96 | help |
93 | Include support for mx31 based LILLY1131 modules. This includes | 97 | Include support for mx31 based LILLY1131 modules. This includes |
diff --git a/arch/arm/mach-mx3/devices-imx31.h b/arch/arm/mach-mx3/devices-imx31.h index 56bc1e1ca8d6..1cf96caf8265 100644 --- a/arch/arm/mach-mx3/devices-imx31.h +++ b/arch/arm/mach-mx3/devices-imx31.h | |||
@@ -18,3 +18,10 @@ | |||
18 | 18 | ||
19 | #define imx31_add_mxc_nand(pdata) \ | 19 | #define imx31_add_mxc_nand(pdata) \ |
20 | imx_add_mxc_nand_v1(MX31_NFC_BASE_ADDR, MX31_INT_NANDFC, pdata) | 20 | imx_add_mxc_nand_v1(MX31_NFC_BASE_ADDR, MX31_INT_NANDFC, pdata) |
21 | |||
22 | #define imx31_add_spi_imx0(pdata) \ | ||
23 | imx_add_spi_imx(0, MX31_CSPI1_BASE_ADDR, SZ_4K, MX31_INT_CSPI1, pdata) | ||
24 | #define imx31_add_spi_imx1(pdata) \ | ||
25 | imx_add_spi_imx(1, MX31_CSPI2_BASE_ADDR, SZ_4K, MX31_INT_CSPI2, pdata) | ||
26 | #define imx31_add_spi_imx2(pdata) \ | ||
27 | imx_add_spi_imx(2, MX31_CSPI3_BASE_ADDR, SZ_4K, MX31_INT_CSPI3, pdata) | ||
diff --git a/arch/arm/mach-mx3/devices.c b/arch/arm/mach-mx3/devices.c index a285b1660c8c..02d05ea7036c 100644 --- a/arch/arm/mach-mx3/devices.c +++ b/arch/arm/mach-mx3/devices.c | |||
@@ -379,6 +379,7 @@ struct platform_device mxc_usbh2 = { | |||
379 | .num_resources = ARRAY_SIZE(mxc_usbh2_resources), | 379 | .num_resources = ARRAY_SIZE(mxc_usbh2_resources), |
380 | }; | 380 | }; |
381 | 381 | ||
382 | #if defined(CONFIG_ARCH_MX35) | ||
382 | /* | 383 | /* |
383 | * SPI master controller | 384 | * SPI master controller |
384 | * 3 channels | 385 | * 3 channels |
@@ -440,7 +441,6 @@ struct platform_device mxc_spi_device2 = { | |||
440 | .resource = mxc_spi_2_resources, | 441 | .resource = mxc_spi_2_resources, |
441 | }; | 442 | }; |
442 | 443 | ||
443 | #ifdef CONFIG_ARCH_MX35 | ||
444 | static struct resource mxc_fec_resources[] = { | 444 | static struct resource mxc_fec_resources[] = { |
445 | { | 445 | { |
446 | .start = MXC_FEC_BASE_ADDR, | 446 | .start = MXC_FEC_BASE_ADDR, |
diff --git a/arch/arm/mach-mx3/devices.h b/arch/arm/mach-mx3/devices.h index c50596addfc7..d22a32730c9e 100644 --- a/arch/arm/mach-mx3/devices.h +++ b/arch/arm/mach-mx3/devices.h | |||
@@ -16,9 +16,11 @@ extern struct platform_device mxc_otg_host; | |||
16 | extern struct platform_device mxc_usbh1; | 16 | extern struct platform_device mxc_usbh1; |
17 | extern struct platform_device mxc_usbh2; | 17 | extern struct platform_device mxc_usbh2; |
18 | extern struct platform_device mxc_rnga_device; | 18 | extern struct platform_device mxc_rnga_device; |
19 | #if defined(CONFIG_ARCH_MX35) | ||
19 | extern struct platform_device mxc_spi_device0; | 20 | extern struct platform_device mxc_spi_device0; |
20 | extern struct platform_device mxc_spi_device1; | 21 | extern struct platform_device mxc_spi_device1; |
21 | extern struct platform_device mxc_spi_device2; | 22 | extern struct platform_device mxc_spi_device2; |
23 | #endif | ||
22 | extern struct platform_device imx_ssi_device0; | 24 | extern struct platform_device imx_ssi_device0; |
23 | extern struct platform_device imx_ssi_device1; | 25 | extern struct platform_device imx_ssi_device1; |
24 | extern struct platform_device imx_ssi_device1; | 26 | extern struct platform_device imx_ssi_device1; |
diff --git a/arch/arm/mach-mx3/mach-mx31_3ds.c b/arch/arm/mach-mx3/mach-mx31_3ds.c index c730c090208a..2aa3e581e840 100644 --- a/arch/arm/mach-mx3/mach-mx31_3ds.c +++ b/arch/arm/mach-mx3/mach-mx31_3ds.c | |||
@@ -35,7 +35,6 @@ | |||
35 | #include <mach/common.h> | 35 | #include <mach/common.h> |
36 | #include <mach/imx-uart.h> | 36 | #include <mach/imx-uart.h> |
37 | #include <mach/iomux-mx3.h> | 37 | #include <mach/iomux-mx3.h> |
38 | #include <mach/spi.h> | ||
39 | 38 | ||
40 | #include "devices-imx31.h" | 39 | #include "devices-imx31.h" |
41 | #include "devices.h" | 40 | #include "devices.h" |
@@ -170,7 +169,7 @@ static int spi1_internal_chipselect[] = { | |||
170 | MXC_SPI_CS(2), | 169 | MXC_SPI_CS(2), |
171 | }; | 170 | }; |
172 | 171 | ||
173 | static struct spi_imx_master spi1_pdata = { | 172 | static const struct spi_imx_master spi1_pdata __initconst = { |
174 | .chipselect = spi1_internal_chipselect, | 173 | .chipselect = spi1_internal_chipselect, |
175 | .num_chipselect = ARRAY_SIZE(spi1_internal_chipselect), | 174 | .num_chipselect = ARRAY_SIZE(spi1_internal_chipselect), |
176 | }; | 175 | }; |
@@ -419,7 +418,7 @@ static void __init mxc_board_init(void) | |||
419 | mxc_register_device(&mxc_uart_device0, &uart_pdata); | 418 | mxc_register_device(&mxc_uart_device0, &uart_pdata); |
420 | imx31_add_mxc_nand(&mx31_3ds_nand_board_info); | 419 | imx31_add_mxc_nand(&mx31_3ds_nand_board_info); |
421 | 420 | ||
422 | mxc_register_device(&mxc_spi_device1, &spi1_pdata); | 421 | imx31_add_spi_imx0(&spi1_pdata); |
423 | spi_register_board_info(mx31_3ds_spi_devs, | 422 | spi_register_board_info(mx31_3ds_spi_devs, |
424 | ARRAY_SIZE(mx31_3ds_spi_devs)); | 423 | ARRAY_SIZE(mx31_3ds_spi_devs)); |
425 | 424 | ||
diff --git a/arch/arm/mach-mx3/mach-mx31lilly.c b/arch/arm/mach-mx3/mach-mx31lilly.c index 13cb61a3bf85..d228b9e6701a 100644 --- a/arch/arm/mach-mx3/mach-mx31lilly.c +++ b/arch/arm/mach-mx3/mach-mx31lilly.c | |||
@@ -42,10 +42,10 @@ | |||
42 | #include <mach/common.h> | 42 | #include <mach/common.h> |
43 | #include <mach/iomux-mx3.h> | 43 | #include <mach/iomux-mx3.h> |
44 | #include <mach/board-mx31lilly.h> | 44 | #include <mach/board-mx31lilly.h> |
45 | #include <mach/spi.h> | ||
46 | #include <mach/mxc_ehci.h> | 45 | #include <mach/mxc_ehci.h> |
47 | #include <mach/ulpi.h> | 46 | #include <mach/ulpi.h> |
48 | 47 | ||
48 | #include "devices-imx31.h" | ||
49 | #include "devices.h" | 49 | #include "devices.h" |
50 | 50 | ||
51 | /* | 51 | /* |
@@ -253,12 +253,12 @@ static int spi_internal_chipselect[] = { | |||
253 | MXC_SPI_CS(2), | 253 | MXC_SPI_CS(2), |
254 | }; | 254 | }; |
255 | 255 | ||
256 | static struct spi_imx_master spi0_pdata = { | 256 | static const struct spi_imx_master spi0_pdata __initconst = { |
257 | .chipselect = spi_internal_chipselect, | 257 | .chipselect = spi_internal_chipselect, |
258 | .num_chipselect = ARRAY_SIZE(spi_internal_chipselect), | 258 | .num_chipselect = ARRAY_SIZE(spi_internal_chipselect), |
259 | }; | 259 | }; |
260 | 260 | ||
261 | static struct spi_imx_master spi1_pdata = { | 261 | static const struct spi_imx_master spi1_pdata __initconst = { |
262 | .chipselect = spi_internal_chipselect, | 262 | .chipselect = spi_internal_chipselect, |
263 | .num_chipselect = ARRAY_SIZE(spi_internal_chipselect), | 263 | .num_chipselect = ARRAY_SIZE(spi_internal_chipselect), |
264 | }; | 264 | }; |
@@ -310,8 +310,8 @@ static void __init mx31lilly_board_init(void) | |||
310 | mxc_iomux_alloc_pin(MX31_PIN_CSPI2_SS1__SS1, "SPI2_SS1"); | 310 | mxc_iomux_alloc_pin(MX31_PIN_CSPI2_SS1__SS1, "SPI2_SS1"); |
311 | mxc_iomux_alloc_pin(MX31_PIN_CSPI2_SS2__SS2, "SPI2_SS2"); | 311 | mxc_iomux_alloc_pin(MX31_PIN_CSPI2_SS2__SS2, "SPI2_SS2"); |
312 | 312 | ||
313 | mxc_register_device(&mxc_spi_device0, &spi0_pdata); | 313 | imx31_add_spi_imx0(&spi0_pdata); |
314 | mxc_register_device(&mxc_spi_device1, &spi1_pdata); | 314 | imx31_add_spi_imx1(&spi1_pdata); |
315 | spi_register_board_info(&mc13783_dev, 1); | 315 | spi_register_board_info(&mc13783_dev, 1); |
316 | 316 | ||
317 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 317 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
diff --git a/arch/arm/mach-mx3/mach-mx31lite.c b/arch/arm/mach-mx3/mach-mx31lite.c index f0a68e64e004..634b8559c81b 100644 --- a/arch/arm/mach-mx3/mach-mx31lite.c +++ b/arch/arm/mach-mx3/mach-mx31lite.c | |||
@@ -41,7 +41,6 @@ | |||
41 | #include <mach/imx-uart.h> | 41 | #include <mach/imx-uart.h> |
42 | #include <mach/iomux-mx3.h> | 42 | #include <mach/iomux-mx3.h> |
43 | #include <mach/irqs.h> | 43 | #include <mach/irqs.h> |
44 | #include <mach/spi.h> | ||
45 | #include <mach/mxc_ehci.h> | 44 | #include <mach/mxc_ehci.h> |
46 | #include <mach/ulpi.h> | 45 | #include <mach/ulpi.h> |
47 | 46 | ||
@@ -109,7 +108,7 @@ static int spi_internal_chipselect[] = { | |||
109 | MXC_SPI_CS(0), | 108 | MXC_SPI_CS(0), |
110 | }; | 109 | }; |
111 | 110 | ||
112 | static struct spi_imx_master spi1_pdata = { | 111 | static const struct spi_imx_master spi1_pdata __initconst = { |
113 | .chipselect = spi_internal_chipselect, | 112 | .chipselect = spi_internal_chipselect, |
114 | .num_chipselect = ARRAY_SIZE(spi_internal_chipselect), | 113 | .num_chipselect = ARRAY_SIZE(spi_internal_chipselect), |
115 | }; | 114 | }; |
@@ -252,7 +251,7 @@ static void __init mxc_board_init(void) | |||
252 | platform_device_register(&physmap_flash_device); | 251 | platform_device_register(&physmap_flash_device); |
253 | imx31_add_mxc_nand(&mx31lite_nand_board_info); | 252 | imx31_add_mxc_nand(&mx31lite_nand_board_info); |
254 | 253 | ||
255 | mxc_register_device(&mxc_spi_device1, &spi1_pdata); | 254 | imx31_add_spi_imx1(&spi1_pdata); |
256 | spi_register_board_info(&mc13783_spi_dev, 1); | 255 | spi_register_board_info(&mc13783_spi_dev, 1); |
257 | 256 | ||
258 | #if defined(CONFIG_USB_ULPI) | 257 | #if defined(CONFIG_USB_ULPI) |
diff --git a/arch/arm/mach-mx3/mach-mx31moboard.c b/arch/arm/mach-mx3/mach-mx31moboard.c index dd51d08f2594..689b0681a409 100644 --- a/arch/arm/mach-mx3/mach-mx31moboard.c +++ b/arch/arm/mach-mx3/mach-mx31moboard.c | |||
@@ -152,7 +152,7 @@ static int moboard_spi1_cs[] = { | |||
152 | MXC_SPI_CS(2), | 152 | MXC_SPI_CS(2), |
153 | }; | 153 | }; |
154 | 154 | ||
155 | static struct spi_imx_master moboard_spi1_master = { | 155 | static const struct spi_imx_master moboard_spi1_pdata __initconst = { |
156 | .chipselect = moboard_spi1_cs, | 156 | .chipselect = moboard_spi1_cs, |
157 | .num_chipselect = ARRAY_SIZE(moboard_spi1_cs), | 157 | .num_chipselect = ARRAY_SIZE(moboard_spi1_cs), |
158 | }; | 158 | }; |
@@ -282,7 +282,7 @@ static int moboard_spi2_cs[] = { | |||
282 | MXC_SPI_CS(1), | 282 | MXC_SPI_CS(1), |
283 | }; | 283 | }; |
284 | 284 | ||
285 | static struct spi_imx_master moboard_spi2_master = { | 285 | static const struct spi_imx_master moboard_spi2_pdata __initconst = { |
286 | .chipselect = moboard_spi2_cs, | 286 | .chipselect = moboard_spi2_cs, |
287 | .num_chipselect = ARRAY_SIZE(moboard_spi2_cs), | 287 | .num_chipselect = ARRAY_SIZE(moboard_spi2_cs), |
288 | }; | 288 | }; |
@@ -502,8 +502,8 @@ static void __init mxc_board_init(void) | |||
502 | imx31_add_imx_i2c0(&moboard_i2c0_data); | 502 | imx31_add_imx_i2c0(&moboard_i2c0_data); |
503 | imx31_add_imx_i2c1(&moboard_i2c1_data); | 503 | imx31_add_imx_i2c1(&moboard_i2c1_data); |
504 | 504 | ||
505 | mxc_register_device(&mxc_spi_device1, &moboard_spi1_master); | 505 | imx31_add_spi_imx1(&moboard_spi1_pdata); |
506 | mxc_register_device(&mxc_spi_device2, &moboard_spi2_master); | 506 | imx31_add_spi_imx2(&moboard_spi2_pdata); |
507 | 507 | ||
508 | gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3), "pmic-irq"); | 508 | gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3), "pmic-irq"); |
509 | gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3)); | 509 | gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3)); |
diff --git a/arch/arm/mach-mx3/mx31lite-db.c b/arch/arm/mach-mx3/mx31lite-db.c index e35d2eb85d30..3786e29752f5 100644 --- a/arch/arm/mach-mx3/mx31lite-db.c +++ b/arch/arm/mach-mx3/mx31lite-db.c | |||
@@ -37,8 +37,8 @@ | |||
37 | #include <mach/iomux-mx3.h> | 37 | #include <mach/iomux-mx3.h> |
38 | #include <mach/board-mx31lite.h> | 38 | #include <mach/board-mx31lite.h> |
39 | #include <mach/mmc.h> | 39 | #include <mach/mmc.h> |
40 | #include <mach/spi.h> | ||
41 | 40 | ||
41 | #include "devices-imx31.h" | ||
42 | #include "devices.h" | 42 | #include "devices.h" |
43 | 43 | ||
44 | /* | 44 | /* |
@@ -157,7 +157,7 @@ static int spi_internal_chipselect[] = { | |||
157 | MXC_SPI_CS(2), | 157 | MXC_SPI_CS(2), |
158 | }; | 158 | }; |
159 | 159 | ||
160 | static struct spi_imx_master spi0_pdata = { | 160 | static const struct spi_imx_master spi0_pdata __initconst = { |
161 | .chipselect = spi_internal_chipselect, | 161 | .chipselect = spi_internal_chipselect, |
162 | .num_chipselect = ARRAY_SIZE(spi_internal_chipselect), | 162 | .num_chipselect = ARRAY_SIZE(spi_internal_chipselect), |
163 | }; | 163 | }; |
@@ -199,7 +199,7 @@ void __init mx31lite_db_init(void) | |||
199 | "development board pins"); | 199 | "development board pins"); |
200 | mxc_register_device(&mxc_uart_device0, &uart_pdata); | 200 | mxc_register_device(&mxc_uart_device0, &uart_pdata); |
201 | mxc_register_device(&mxcsdhc_device0, &mmc_pdata); | 201 | mxc_register_device(&mxcsdhc_device0, &mmc_pdata); |
202 | mxc_register_device(&mxc_spi_device0, &spi0_pdata); | 202 | imx31_add_spi_imx0(&spi0_pdata); |
203 | platform_device_register(&litekit_led_device); | 203 | platform_device_register(&litekit_led_device); |
204 | mxc_register_device(&imx_wdt_device0, NULL); | 204 | mxc_register_device(&imx_wdt_device0, NULL); |
205 | mxc_register_device(&imx_rtc_device0, NULL); | 205 | mxc_register_device(&imx_rtc_device0, NULL); |