diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-06-22 03:00:22 -0400 |
---|---|---|
committer | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-06-30 03:00:49 -0400 |
commit | 7536cf992f395cb431f723041183d14a91d89c84 (patch) | |
tree | f7b494f9d703272a749c8f5bda4e31dd46c87891 /arch/arm | |
parent | 63ddc5b01681567d10ddb94cb41390c77237cb62 (diff) |
ARM: imx: dynamically register spi_imx devices (imx27)
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-imx/Kconfig | 3 | ||||
-rw-r--r-- | arch/arm/mach-imx/devices-imx27.h | 7 | ||||
-rw-r--r-- | arch/arm/mach-imx/devices.c | 33 | ||||
-rw-r--r-- | arch/arm/mach-imx/devices.h | 5 | ||||
-rw-r--r-- | arch/arm/mach-imx/eukrea_mbimx27-baseboard.c | 5 | ||||
-rw-r--r-- | arch/arm/mach-imx/mach-pca100.c | 7 | ||||
-rw-r--r-- | arch/arm/mach-imx/mach-pcm038.c | 5 |
7 files changed, 17 insertions, 48 deletions
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig index 2bf807818fdc..c185ec3254ca 100644 --- a/arch/arm/mach-imx/Kconfig +++ b/arch/arm/mach-imx/Kconfig | |||
@@ -92,6 +92,7 @@ config MACH_PCM038 | |||
92 | bool "Phytec phyCORE-i.MX27 CPU module (pcm038)" | 92 | bool "Phytec phyCORE-i.MX27 CPU module (pcm038)" |
93 | select IMX_HAVE_PLATFORM_IMX_I2C | 93 | select IMX_HAVE_PLATFORM_IMX_I2C |
94 | select IMX_HAVE_PLATFORM_MXC_NAND | 94 | select IMX_HAVE_PLATFORM_MXC_NAND |
95 | select IMX_HAVE_PLATFORM_SPI_IMX | ||
95 | select MXC_ULPI if USB_ULPI | 96 | select MXC_ULPI if USB_ULPI |
96 | help | 97 | help |
97 | Include support for phyCORE-i.MX27 (aka pcm038) platform. This | 98 | Include support for phyCORE-i.MX27 (aka pcm038) platform. This |
@@ -134,6 +135,7 @@ choice | |||
134 | config MACH_EUKREA_MBIMX27_BASEBOARD | 135 | config MACH_EUKREA_MBIMX27_BASEBOARD |
135 | prompt "Eukrea MBIMX27 development board" | 136 | prompt "Eukrea MBIMX27 development board" |
136 | bool | 137 | bool |
138 | select IMX_HAVE_PLATFORM_SPI_IMX | ||
137 | help | 139 | help |
138 | This adds board specific devices that can be found on Eukrea's | 140 | This adds board specific devices that can be found on Eukrea's |
139 | MBIMX27 evaluation board. | 141 | MBIMX27 evaluation board. |
@@ -156,6 +158,7 @@ config MACH_PCA100 | |||
156 | bool "Phytec phyCARD-s (pca100)" | 158 | bool "Phytec phyCARD-s (pca100)" |
157 | select IMX_HAVE_PLATFORM_IMX_I2C | 159 | select IMX_HAVE_PLATFORM_IMX_I2C |
158 | select IMX_HAVE_PLATFORM_MXC_NAND | 160 | select IMX_HAVE_PLATFORM_MXC_NAND |
161 | select IMX_HAVE_PLATFORM_SPI_IMX | ||
159 | select MXC_ULPI if USB_ULPI | 162 | select MXC_ULPI if USB_ULPI |
160 | help | 163 | help |
161 | Include support for phyCARD-s (aka pca100) platform. This | 164 | Include support for phyCARD-s (aka pca100) platform. This |
diff --git a/arch/arm/mach-imx/devices-imx27.h b/arch/arm/mach-imx/devices-imx27.h index 5e0c40c92013..7da1e2bfd4bb 100644 --- a/arch/arm/mach-imx/devices-imx27.h +++ b/arch/arm/mach-imx/devices-imx27.h | |||
@@ -16,3 +16,10 @@ | |||
16 | 16 | ||
17 | #define imx27_add_mxc_nand(pdata) \ | 17 | #define imx27_add_mxc_nand(pdata) \ |
18 | imx_add_mxc_nand_v1(MX27_NFC_BASE_ADDR, MX27_INT_NANDFC, pdata) | 18 | imx_add_mxc_nand_v1(MX27_NFC_BASE_ADDR, MX27_INT_NANDFC, pdata) |
19 | |||
20 | #define imx27_add_spi_imx0(pdata) \ | ||
21 | imx_add_spi_imx(0, MX27_CSPI1_BASE_ADDR, SZ_4K, MX27_INT_CSPI1, pdata) | ||
22 | #define imx27_add_spi_imx1(pdata) \ | ||
23 | imx_add_spi_imx(1, MX27_CSPI2_BASE_ADDR, SZ_4K, MX27_INT_CSPI2, pdata) | ||
24 | #define imx27_add_spi_imx2(pdata) \ | ||
25 | imx_add_spi_imx(2, MX27_CSPI3_BASE_ADDR, SZ_4K, MX27_INT_CSPI3, pdata) | ||
diff --git a/arch/arm/mach-imx/devices.c b/arch/arm/mach-imx/devices.c index e42eead9dd9a..84e6da6b8c0c 100644 --- a/arch/arm/mach-imx/devices.c +++ b/arch/arm/mach-imx/devices.c | |||
@@ -219,39 +219,6 @@ int __init imx1_register_gpios(void) | |||
219 | 219 | ||
220 | #if defined(CONFIG_MACH_MX21) || defined(CONFIG_MACH_MX27) | 220 | #if defined(CONFIG_MACH_MX21) || defined(CONFIG_MACH_MX27) |
221 | /* | 221 | /* |
222 | * SPI master controller | ||
223 | * | ||
224 | * - i.MX1: 2 channel (slighly different register setting) | ||
225 | * - i.MX21: 2 channel | ||
226 | * - i.MX27: 3 channel | ||
227 | */ | ||
228 | #ifdef CONFIG_MACH_MX27 | ||
229 | #define DEFINE_IMX_SPI_DEVICE(n, baseaddr, irq) \ | ||
230 | static struct resource mxc_spi_resources ## n[] = { \ | ||
231 | { \ | ||
232 | .start = baseaddr, \ | ||
233 | .end = baseaddr + SZ_4K - 1, \ | ||
234 | .flags = IORESOURCE_MEM, \ | ||
235 | }, { \ | ||
236 | .start = irq, \ | ||
237 | .end = irq, \ | ||
238 | .flags = IORESOURCE_IRQ, \ | ||
239 | }, \ | ||
240 | }; \ | ||
241 | \ | ||
242 | struct platform_device mxc_spi_device ## n = { \ | ||
243 | .name = "spi_imx", \ | ||
244 | .id = n, \ | ||
245 | .num_resources = ARRAY_SIZE(mxc_spi_resources ## n), \ | ||
246 | .resource = mxc_spi_resources ## n, \ | ||
247 | } | ||
248 | |||
249 | DEFINE_IMX_SPI_DEVICE(0, MX2x_CSPI1_BASE_ADDR, MX2x_INT_CSPI1); | ||
250 | DEFINE_IMX_SPI_DEVICE(1, MX2x_CSPI2_BASE_ADDR, MX2x_INT_CSPI2); | ||
251 | DEFINE_IMX_SPI_DEVICE(2, MX27_CSPI3_BASE_ADDR, MX27_INT_CSPI3); | ||
252 | #endif | ||
253 | |||
254 | /* | ||
255 | * General Purpose Timer | 222 | * General Purpose Timer |
256 | * - i.MX21: 3 timers | 223 | * - i.MX21: 3 timers |
257 | * - i.MX27: 6 timers | 224 | * - i.MX27: 6 timers |
diff --git a/arch/arm/mach-imx/devices.h b/arch/arm/mach-imx/devices.h index c15b0de42d65..db995b156ee6 100644 --- a/arch/arm/mach-imx/devices.h +++ b/arch/arm/mach-imx/devices.h | |||
@@ -34,11 +34,6 @@ extern struct platform_device mxc_otg_udc_device; | |||
34 | extern struct platform_device mxc_otg_host; | 34 | extern struct platform_device mxc_otg_host; |
35 | extern struct platform_device mxc_usbh1; | 35 | extern struct platform_device mxc_usbh1; |
36 | extern struct platform_device mxc_usbh2; | 36 | extern struct platform_device mxc_usbh2; |
37 | #ifdef CONFIG_MACH_MX27 | ||
38 | extern struct platform_device mxc_spi_device0; | ||
39 | extern struct platform_device mxc_spi_device1; | ||
40 | extern struct platform_device mxc_spi_device2; | ||
41 | #endif | ||
42 | extern struct platform_device mx21_usbhc_device; | 37 | extern struct platform_device mx21_usbhc_device; |
43 | extern struct platform_device imx_ssi_device0; | 38 | extern struct platform_device imx_ssi_device0; |
44 | extern struct platform_device imx_ssi_device1; | 39 | extern struct platform_device imx_ssi_device1; |
diff --git a/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c b/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c index 463e80df6d42..eed814371247 100644 --- a/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c +++ b/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <mach/mmc.h> | 34 | #include <mach/mmc.h> |
35 | #include <mach/imx-uart.h> | 35 | #include <mach/imx-uart.h> |
36 | 36 | ||
37 | #include "devices-imx27.h" | ||
37 | #include "devices.h" | 38 | #include "devices.h" |
38 | 39 | ||
39 | static int eukrea_mbimx27_pins[] = { | 40 | static int eukrea_mbimx27_pins[] = { |
@@ -201,7 +202,7 @@ static struct spi_board_info eukrea_mbimx27_spi_board_info[] __initdata = { | |||
201 | 202 | ||
202 | static int eukrea_mbimx27_spi_cs[] = {GPIO_PORTD | 28}; | 203 | static int eukrea_mbimx27_spi_cs[] = {GPIO_PORTD | 28}; |
203 | 204 | ||
204 | static struct spi_imx_master eukrea_mbimx27_spi_0_data = { | 205 | static const struct spi_imx_master eukrea_mbimx27_spi0_data __initconst = { |
205 | .chipselect = eukrea_mbimx27_spi_cs, | 206 | .chipselect = eukrea_mbimx27_spi_cs, |
206 | .num_chipselect = ARRAY_SIZE(eukrea_mbimx27_spi_cs), | 207 | .num_chipselect = ARRAY_SIZE(eukrea_mbimx27_spi_cs), |
207 | }; | 208 | }; |
@@ -233,7 +234,7 @@ void __init eukrea_mbimx27_baseboard_init(void) | |||
233 | /* SPI and ADS7846 Touchscreen controler init */ | 234 | /* SPI and ADS7846 Touchscreen controler init */ |
234 | mxc_gpio_mode(GPIO_PORTD | 28 | GPIO_GPIO | GPIO_OUT); | 235 | mxc_gpio_mode(GPIO_PORTD | 28 | GPIO_GPIO | GPIO_OUT); |
235 | mxc_gpio_mode(GPIO_PORTD | 25 | GPIO_GPIO | GPIO_IN); | 236 | mxc_gpio_mode(GPIO_PORTD | 25 | GPIO_GPIO | GPIO_IN); |
236 | mxc_register_device(&mxc_spi_device0, &eukrea_mbimx27_spi_0_data); | 237 | imx27_add_spi_imx0(&eukrea_mbimx27_spi0_data); |
237 | spi_register_board_info(eukrea_mbimx27_spi_board_info, | 238 | spi_register_board_info(eukrea_mbimx27_spi_board_info, |
238 | ARRAY_SIZE(eukrea_mbimx27_spi_board_info)); | 239 | ARRAY_SIZE(eukrea_mbimx27_spi_board_info)); |
239 | ads7846_dev_init(); | 240 | ads7846_dev_init(); |
diff --git a/arch/arm/mach-imx/mach-pca100.c b/arch/arm/mach-imx/mach-pca100.c index 6501a7a5b18c..953cc74bb07f 100644 --- a/arch/arm/mach-imx/mach-pca100.c +++ b/arch/arm/mach-imx/mach-pca100.c | |||
@@ -37,9 +37,6 @@ | |||
37 | #include <mach/hardware.h> | 37 | #include <mach/hardware.h> |
38 | #include <mach/iomux-mx27.h> | 38 | #include <mach/iomux-mx27.h> |
39 | #include <asm/mach/time.h> | 39 | #include <asm/mach/time.h> |
40 | #if defined(CONFIG_SPI_IMX) || defined(CONFIG_SPI_IMX_MODULE) | ||
41 | #include <mach/spi.h> | ||
42 | #endif | ||
43 | #include <mach/imx-uart.h> | 40 | #include <mach/imx-uart.h> |
44 | #include <mach/audmux.h> | 41 | #include <mach/audmux.h> |
45 | #include <mach/ssi.h> | 42 | #include <mach/ssi.h> |
@@ -192,7 +189,7 @@ static struct spi_board_info pca100_spi_board_info[] __initdata = { | |||
192 | 189 | ||
193 | static int pca100_spi_cs[] = {GPIO_PORTD + 28, GPIO_PORTD + 27}; | 190 | static int pca100_spi_cs[] = {GPIO_PORTD + 28, GPIO_PORTD + 27}; |
194 | 191 | ||
195 | static struct spi_imx_master pca100_spi_0_data = { | 192 | static const struct spi_imx_master pca100_spi0_data __initconst = { |
196 | .chipselect = pca100_spi_cs, | 193 | .chipselect = pca100_spi_cs, |
197 | .num_chipselect = ARRAY_SIZE(pca100_spi_cs), | 194 | .num_chipselect = ARRAY_SIZE(pca100_spi_cs), |
198 | }; | 195 | }; |
@@ -347,7 +344,7 @@ static void __init pca100_init(void) | |||
347 | #if defined(CONFIG_SPI_IMX) || defined(CONFIG_SPI_IMX_MODULE) | 344 | #if defined(CONFIG_SPI_IMX) || defined(CONFIG_SPI_IMX_MODULE) |
348 | spi_register_board_info(pca100_spi_board_info, | 345 | spi_register_board_info(pca100_spi_board_info, |
349 | ARRAY_SIZE(pca100_spi_board_info)); | 346 | ARRAY_SIZE(pca100_spi_board_info)); |
350 | mxc_register_device(&mxc_spi_device0, &pca100_spi_0_data); | 347 | imx27_add_spi_imx0(&pca100_spi_0_data); |
351 | #endif | 348 | #endif |
352 | 349 | ||
353 | gpio_request(OTG_PHY_CS_GPIO, "usb-otg-cs"); | 350 | gpio_request(OTG_PHY_CS_GPIO, "usb-otg-cs"); |
diff --git a/arch/arm/mach-imx/mach-pcm038.c b/arch/arm/mach-imx/mach-pcm038.c index 7559e0f7527d..c09f234f5d08 100644 --- a/arch/arm/mach-imx/mach-pcm038.c +++ b/arch/arm/mach-imx/mach-pcm038.c | |||
@@ -38,7 +38,6 @@ | |||
38 | #include <mach/iomux-mx27.h> | 38 | #include <mach/iomux-mx27.h> |
39 | #include <mach/imx-uart.h> | 39 | #include <mach/imx-uart.h> |
40 | #include <mach/mxc_nand.h> | 40 | #include <mach/mxc_nand.h> |
41 | #include <mach/spi.h> | ||
42 | #include <mach/mxc_ehci.h> | 41 | #include <mach/mxc_ehci.h> |
43 | #include <mach/ulpi.h> | 42 | #include <mach/ulpi.h> |
44 | 43 | ||
@@ -216,7 +215,7 @@ static struct i2c_board_info pcm038_i2c_devices[] = { | |||
216 | 215 | ||
217 | static int pcm038_spi_cs[] = {GPIO_PORTD + 28}; | 216 | static int pcm038_spi_cs[] = {GPIO_PORTD + 28}; |
218 | 217 | ||
219 | static struct spi_imx_master pcm038_spi_0_data = { | 218 | static const struct spi_imx_master pcm038_spi0_data __initconst = { |
220 | .chipselect = pcm038_spi_cs, | 219 | .chipselect = pcm038_spi_cs, |
221 | .num_chipselect = ARRAY_SIZE(pcm038_spi_cs), | 220 | .num_chipselect = ARRAY_SIZE(pcm038_spi_cs), |
222 | }; | 221 | }; |
@@ -327,7 +326,7 @@ static void __init pcm038_init(void) | |||
327 | /* MC13783 IRQ */ | 326 | /* MC13783 IRQ */ |
328 | mxc_gpio_mode(GPIO_PORTB | 23 | GPIO_GPIO | GPIO_IN); | 327 | mxc_gpio_mode(GPIO_PORTB | 23 | GPIO_GPIO | GPIO_IN); |
329 | 328 | ||
330 | mxc_register_device(&mxc_spi_device0, &pcm038_spi_0_data); | 329 | imx27_add_spi_imx0(&pcm038_spi0_data); |
331 | spi_register_board_info(pcm038_spi_board_info, | 330 | spi_register_board_info(pcm038_spi_board_info, |
332 | ARRAY_SIZE(pcm038_spi_board_info)); | 331 | ARRAY_SIZE(pcm038_spi_board_info)); |
333 | 332 | ||