diff options
author | Guennadi Liakhovetski <lg@denx.de> | 2008-06-13 04:17:31 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-07-09 16:31:52 -0400 |
commit | e172274ccc55d20536fbdceb6131f38e288541e0 (patch) | |
tree | e3b0424d9c6d7e74608c29c91d94d94f6ab36706 | |
parent | cabb352a6455c3550f157909196845f533b0f374 (diff) |
[ARM] 5088/3: pxa2xx: add pxa2xx_set_spi_info to register pxa2xx-spi platform devices
Add a function to dynamically allocate and register pxa2xx-spi platform
devices, to be used by PXA2xx and PXA3xx based systems. Switch pcm027 and
lubbock to use it.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@pengutronix.de>
Acked-by: Eric Miao <eric.miao@marvell.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/mach-pxa/Kconfig | 1 | ||||
-rw-r--r-- | arch/arm/mach-pxa/devices.c | 18 | ||||
-rw-r--r-- | arch/arm/mach-pxa/lubbock.c | 10 | ||||
-rw-r--r-- | arch/arm/mach-pxa/pcm027.c | 31 | ||||
-rw-r--r-- | include/asm-arm/arch-pxa/pxa2xx_spi.h | 2 |
5 files changed, 53 insertions, 9 deletions
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig index 914bb33dab92..ef7271e37810 100644 --- a/arch/arm/mach-pxa/Kconfig +++ b/arch/arm/mach-pxa/Kconfig | |||
@@ -139,6 +139,7 @@ config MACH_PCM027 | |||
139 | bool "Phytec phyCORE-PXA270 CPU module (PCM-027)" | 139 | bool "Phytec phyCORE-PXA270 CPU module (PCM-027)" |
140 | select PXA27x | 140 | select PXA27x |
141 | select IWMMXT | 141 | select IWMMXT |
142 | select PXA_SSP | ||
142 | 143 | ||
143 | endmenu | 144 | endmenu |
144 | 145 | ||
diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c index a6f2390ce662..abc161dd083a 100644 --- a/arch/arm/mach-pxa/devices.c +++ b/arch/arm/mach-pxa/devices.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <asm/arch/mfp-pxa27x.h> | 13 | #include <asm/arch/mfp-pxa27x.h> |
14 | #include <asm/arch/ohci.h> | 14 | #include <asm/arch/ohci.h> |
15 | #include <asm/arch/pxa27x_keypad.h> | 15 | #include <asm/arch/pxa27x_keypad.h> |
16 | #include <asm/arch/pxa2xx_spi.h> | ||
16 | #include <asm/arch/camera.h> | 17 | #include <asm/arch/camera.h> |
17 | #include <asm/arch/audio.h> | 18 | #include <asm/arch/audio.h> |
18 | 19 | ||
@@ -831,3 +832,20 @@ void __init pxa3xx_set_mci3_info(struct pxamci_platform_data *info) | |||
831 | } | 832 | } |
832 | 833 | ||
833 | #endif /* CONFIG_PXA3xx */ | 834 | #endif /* CONFIG_PXA3xx */ |
835 | |||
836 | /* pxa2xx-spi platform-device ID equals respective SSP platform-device ID + 1. | ||
837 | * See comment in arch/arm/mach-pxa/ssp.c::ssp_probe() */ | ||
838 | void __init pxa2xx_set_spi_info(unsigned id, struct pxa2xx_spi_master *info) | ||
839 | { | ||
840 | struct platform_device *pd; | ||
841 | |||
842 | pd = platform_device_alloc("pxa2xx-spi", id); | ||
843 | if (pd == NULL) { | ||
844 | printk(KERN_ERR "pxa2xx-spi: failed to allocate device id %d\n", | ||
845 | id); | ||
846 | return; | ||
847 | } | ||
848 | |||
849 | pd->dev.platform_data = info; | ||
850 | platform_device_add(pd); | ||
851 | } | ||
diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c index a3fae4139203..e041cceab16b 100644 --- a/arch/arm/mach-pxa/lubbock.c +++ b/arch/arm/mach-pxa/lubbock.c | |||
@@ -226,14 +226,6 @@ static struct pxa2xx_spi_master pxa_ssp_master_info = { | |||
226 | .num_chipselect = 0, | 226 | .num_chipselect = 0, |
227 | }; | 227 | }; |
228 | 228 | ||
229 | static struct platform_device pxa_ssp = { | ||
230 | .name = "pxa2xx-spi", | ||
231 | .id = 1, | ||
232 | .dev = { | ||
233 | .platform_data = &pxa_ssp_master_info, | ||
234 | }, | ||
235 | }; | ||
236 | |||
237 | static int lubbock_ads7846_pendown_state(void) | 229 | static int lubbock_ads7846_pendown_state(void) |
238 | { | 230 | { |
239 | /* TS_BUSY is bit 8 in LUB_MISC_RD, but pendown is irq-only */ | 231 | /* TS_BUSY is bit 8 in LUB_MISC_RD, but pendown is irq-only */ |
@@ -367,7 +359,6 @@ static struct platform_device *devices[] __initdata = { | |||
367 | &smc91x_device, | 359 | &smc91x_device, |
368 | &lubbock_flash_device[0], | 360 | &lubbock_flash_device[0], |
369 | &lubbock_flash_device[1], | 361 | &lubbock_flash_device[1], |
370 | &pxa_ssp, | ||
371 | }; | 362 | }; |
372 | 363 | ||
373 | static struct pxafb_mode_info sharp_lm8v31_mode = { | 364 | static struct pxafb_mode_info sharp_lm8v31_mode = { |
@@ -501,6 +492,7 @@ static void __init lubbock_init(void) | |||
501 | lubbock_flash_data[flashboot].name = "boot-rom"; | 492 | lubbock_flash_data[flashboot].name = "boot-rom"; |
502 | (void) platform_add_devices(devices, ARRAY_SIZE(devices)); | 493 | (void) platform_add_devices(devices, ARRAY_SIZE(devices)); |
503 | 494 | ||
495 | pxa2xx_set_spi_info(1, &pxa_ssp_master_info); | ||
504 | spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info)); | 496 | spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info)); |
505 | } | 497 | } |
506 | 498 | ||
diff --git a/arch/arm/mach-pxa/pcm027.c b/arch/arm/mach-pxa/pcm027.c index 3b945eb0aee3..377f3be8ce57 100644 --- a/arch/arm/mach-pxa/pcm027.c +++ b/arch/arm/mach-pxa/pcm027.c | |||
@@ -24,7 +24,9 @@ | |||
24 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
25 | #include <linux/mtd/physmap.h> | 25 | #include <linux/mtd/physmap.h> |
26 | #include <linux/spi/spi.h> | 26 | #include <linux/spi/spi.h> |
27 | #include <linux/spi/max7301.h> | ||
27 | #include <linux/leds.h> | 28 | #include <linux/leds.h> |
29 | |||
28 | #include <asm/mach-types.h> | 30 | #include <asm/mach-types.h> |
29 | #include <asm/mach/arch.h> | 31 | #include <asm/mach/arch.h> |
30 | #include <asm/arch/hardware.h> | 32 | #include <asm/arch/hardware.h> |
@@ -108,6 +110,32 @@ static struct platform_device smc91x_device = { | |||
108 | .resource = smc91x_resources, | 110 | .resource = smc91x_resources, |
109 | }; | 111 | }; |
110 | 112 | ||
113 | /* | ||
114 | * SPI host and devices | ||
115 | */ | ||
116 | static struct pxa2xx_spi_master pxa_ssp_master_info = { | ||
117 | .num_chipselect = 1, | ||
118 | }; | ||
119 | |||
120 | static struct max7301_platform_data max7301_info = { | ||
121 | .base = -1, | ||
122 | }; | ||
123 | |||
124 | /* bus_num must match id in pxa2xx_set_spi_info() call */ | ||
125 | static struct spi_board_info spi_board_info[] __initdata = { | ||
126 | { | ||
127 | .modalias = "max7301", | ||
128 | .platform_data = &max7301_info, | ||
129 | .max_speed_hz = 13000000, | ||
130 | .bus_num = 1, | ||
131 | .chip_select = 0, | ||
132 | .mode = SPI_MODE_0, | ||
133 | }, | ||
134 | }; | ||
135 | |||
136 | /* | ||
137 | * NOR flash | ||
138 | */ | ||
111 | static struct physmap_flash_data pcm027_flash_data = { | 139 | static struct physmap_flash_data pcm027_flash_data = { |
112 | .width = 4, | 140 | .width = 4, |
113 | }; | 141 | }; |
@@ -190,6 +218,9 @@ static void __init pcm027_init(void) | |||
190 | #ifdef CONFIG_MACH_PCM990_BASEBOARD | 218 | #ifdef CONFIG_MACH_PCM990_BASEBOARD |
191 | pcm990_baseboard_init(); | 219 | pcm990_baseboard_init(); |
192 | #endif | 220 | #endif |
221 | |||
222 | pxa2xx_set_spi_info(1, &pxa_ssp_master_info); | ||
223 | spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info)); | ||
193 | } | 224 | } |
194 | 225 | ||
195 | static void __init pcm027_map_io(void) | 226 | static void __init pcm027_map_io(void) |
diff --git a/include/asm-arm/arch-pxa/pxa2xx_spi.h b/include/asm-arm/arch-pxa/pxa2xx_spi.h index 3459fb26ce97..2206cb61a9f9 100644 --- a/include/asm-arm/arch-pxa/pxa2xx_spi.h +++ b/include/asm-arm/arch-pxa/pxa2xx_spi.h | |||
@@ -41,4 +41,6 @@ struct pxa2xx_spi_chip { | |||
41 | void (*cs_control)(u32 command); | 41 | void (*cs_control)(u32 command); |
42 | }; | 42 | }; |
43 | 43 | ||
44 | extern void pxa2xx_set_spi_info(unsigned id, struct pxa2xx_spi_master *info); | ||
45 | |||
44 | #endif /*PXA2XX_SPI_H_*/ | 46 | #endif /*PXA2XX_SPI_H_*/ |