aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorTodd Poynor <tpoynor@mvista.com>2005-11-04 12:15:45 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2005-11-04 12:15:45 -0500
commit74ec71e16189717d3f33ec7e5d22021480f4173b (patch)
treefc617f464cda174f4b040141ddc25176a92c22cc /arch
parent7866f6492856dde7d70e4f878e3893e1f91216ce (diff)
[ARM] 3087/1: PXA2xx flash platform device conversion
Patch from Todd Poynor Add platform devices for flash to Lubbock and Mainstone board files. Once in place, the two existing mtd map drivers for the boards will be converted to use a single pxa2xx map driver in the linux-mtd tree. Take 4: flash_platform_data .map_name vs. .name cleaned up, resync with merged irda patch context. Signed-off-by: Todd Poynor <tpoynor@mvista.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-pxa/lubbock.c80
-rw-r--r--arch/arm/mach-pxa/mainstone.c90
2 files changed, 168 insertions, 2 deletions
diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c
index 9c6e77faec5..b464bc88ff9 100644
--- a/arch/arm/mach-pxa/lubbock.c
+++ b/arch/arm/mach-pxa/lubbock.c
@@ -19,16 +19,20 @@
19#include <linux/major.h> 19#include <linux/major.h>
20#include <linux/fb.h> 20#include <linux/fb.h>
21#include <linux/interrupt.h> 21#include <linux/interrupt.h>
22#include <linux/mtd/mtd.h>
23#include <linux/mtd/partitions.h>
22 24
23#include <asm/setup.h> 25#include <asm/setup.h>
24#include <asm/memory.h> 26#include <asm/memory.h>
25#include <asm/mach-types.h> 27#include <asm/mach-types.h>
26#include <asm/hardware.h> 28#include <asm/hardware.h>
27#include <asm/irq.h> 29#include <asm/irq.h>
30#include <asm/sizes.h>
28 31
29#include <asm/mach/arch.h> 32#include <asm/mach/arch.h>
30#include <asm/mach/map.h> 33#include <asm/mach/map.h>
31#include <asm/mach/irq.h> 34#include <asm/mach/irq.h>
35#include <asm/mach/flash.h>
32 36
33#include <asm/hardware/sa1111.h> 37#include <asm/hardware/sa1111.h>
34 38
@@ -199,10 +203,75 @@ static struct platform_device smc91x_device = {
199 .resource = smc91x_resources, 203 .resource = smc91x_resources,
200}; 204};
201 205
206static struct resource flash_resources[] = {
207 [0] = {
208 .start = 0x00000000,
209 .end = SZ_64M - 1,
210 .flags = IORESOURCE_MEM,
211 },
212 [1] = {
213 .start = 0x04000000,
214 .end = 0x04000000 + SZ_64M - 1,
215 .flags = IORESOURCE_MEM,
216 },
217};
218
219static struct mtd_partition lubbock_partitions[] = {
220 {
221 .name = "Bootloader",
222 .size = 0x00040000,
223 .offset = 0,
224 .mask_flags = MTD_WRITEABLE /* force read-only */
225 },{
226 .name = "Kernel",
227 .size = 0x00100000,
228 .offset = 0x00040000,
229 },{
230 .name = "Filesystem",
231 .size = MTDPART_SIZ_FULL,
232 .offset = 0x00140000
233 }
234};
235
236static struct flash_platform_data lubbock_flash_data[2] = {
237 {
238 .map_name = "cfi_probe",
239 .parts = lubbock_partitions,
240 .nr_parts = ARRAY_SIZE(lubbock_partitions),
241 }, {
242 .map_name = "cfi_probe",
243 .parts = NULL,
244 .nr_parts = 0,
245 }
246};
247
248static struct platform_device lubbock_flash_device[2] = {
249 {
250 .name = "pxa2xx-flash",
251 .id = 0,
252 .dev = {
253 .platform_data = &lubbock_flash_data[0],
254 },
255 .resource = &flash_resources[0],
256 .num_resources = 1,
257 },
258 {
259 .name = "pxa2xx-flash",
260 .id = 1,
261 .dev = {
262 .platform_data = &lubbock_flash_data[1],
263 },
264 .resource = &flash_resources[1],
265 .num_resources = 1,
266 },
267};
268
202static struct platform_device *devices[] __initdata = { 269static struct platform_device *devices[] __initdata = {
203 &sa1111_device, 270 &sa1111_device,
204 &lub_audio_device, 271 &lub_audio_device,
205 &smc91x_device, 272 &smc91x_device,
273 &lubbock_flash_device[0],
274 &lubbock_flash_device[1],
206}; 275};
207 276
208static struct pxafb_mach_info sharp_lm8v31 __initdata = { 277static struct pxafb_mach_info sharp_lm8v31 __initdata = {
@@ -315,10 +384,21 @@ static struct pxaficp_platform_data lubbock_ficp_platform_data = {
315 384
316static void __init lubbock_init(void) 385static void __init lubbock_init(void)
317{ 386{
387 int flashboot = (LUB_CONF_SWITCHES & 1);
388
318 pxa_set_udc_info(&udc_info); 389 pxa_set_udc_info(&udc_info);
319 set_pxa_fb_info(&sharp_lm8v31); 390 set_pxa_fb_info(&sharp_lm8v31);
320 pxa_set_mci_info(&lubbock_mci_platform_data); 391 pxa_set_mci_info(&lubbock_mci_platform_data);
321 pxa_set_ficp_info(&lubbock_ficp_platform_data); 392 pxa_set_ficp_info(&lubbock_ficp_platform_data);
393
394 lubbock_flash_data[0].width = lubbock_flash_data[1].width =
395 (BOOT_DEF & 1) ? 2 : 4;
396 /* Compensate for the nROMBT switch which swaps the flash banks */
397 printk(KERN_NOTICE "Lubbock configured to boot from %s (bank %d)\n",
398 flashboot?"Flash":"ROM", flashboot);
399
400 lubbock_flash_data[flashboot^1].name = "application-flash";
401 lubbock_flash_data[flashboot].name = "boot-rom";
322 (void) platform_add_devices(devices, ARRAY_SIZE(devices)); 402 (void) platform_add_devices(devices, ARRAY_SIZE(devices));
323} 403}
324 404
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c
index 887a8cb7b72..07892f4012d 100644
--- a/arch/arm/mach-pxa/mainstone.c
+++ b/arch/arm/mach-pxa/mainstone.c
@@ -20,6 +20,9 @@
20#include <linux/sched.h> 20#include <linux/sched.h>
21#include <linux/bitops.h> 21#include <linux/bitops.h>
22#include <linux/fb.h> 22#include <linux/fb.h>
23#include <linux/ioport.h>
24#include <linux/mtd/mtd.h>
25#include <linux/mtd/partitions.h>
23 26
24#include <asm/types.h> 27#include <asm/types.h>
25#include <asm/setup.h> 28#include <asm/setup.h>
@@ -27,10 +30,12 @@
27#include <asm/mach-types.h> 30#include <asm/mach-types.h>
28#include <asm/hardware.h> 31#include <asm/hardware.h>
29#include <asm/irq.h> 32#include <asm/irq.h>
33#include <asm/sizes.h>
30 34
31#include <asm/mach/arch.h> 35#include <asm/mach/arch.h>
32#include <asm/mach/map.h> 36#include <asm/mach/map.h>
33#include <asm/mach/irq.h> 37#include <asm/mach/irq.h>
38#include <asm/mach/flash.h>
34 39
35#include <asm/arch/pxa-regs.h> 40#include <asm/arch/pxa-regs.h>
36#include <asm/arch/mainstone.h> 41#include <asm/arch/mainstone.h>
@@ -190,6 +195,69 @@ static struct platform_device mst_audio_device = {
190 .dev = { .platform_data = &mst_audio_ops }, 195 .dev = { .platform_data = &mst_audio_ops },
191}; 196};
192 197
198static struct resource flash_resources[] = {
199 [0] = {
200 .start = PXA_CS0_PHYS,
201 .end = PXA_CS0_PHYS + SZ_64M - 1,
202 .flags = IORESOURCE_MEM,
203 },
204 [1] = {
205 .start = PXA_CS1_PHYS,
206 .end = PXA_CS1_PHYS + SZ_64M - 1,
207 .flags = IORESOURCE_MEM,
208 },
209};
210
211static struct mtd_partition mainstoneflash0_partitions[] = {
212 {
213 .name = "Bootloader",
214 .size = 0x00040000,
215 .offset = 0,
216 .mask_flags = MTD_WRITEABLE /* force read-only */
217 },{
218 .name = "Kernel",
219 .size = 0x00400000,
220 .offset = 0x00040000,
221 },{
222 .name = "Filesystem",
223 .size = MTDPART_SIZ_FULL,
224 .offset = 0x00440000
225 }
226};
227
228static struct flash_platform_data mst_flash_data[2] = {
229 {
230 .map_name = "cfi_probe",
231 .parts = mainstoneflash0_partitions,
232 .nr_parts = ARRAY_SIZE(mainstoneflash0_partitions),
233 }, {
234 .map_name = "cfi_probe",
235 .parts = NULL,
236 .nr_parts = 0,
237 }
238};
239
240static struct platform_device mst_flash_device[2] = {
241 {
242 .name = "pxa2xx-flash",
243 .id = 0,
244 .dev = {
245 .platform_data = &mst_flash_data[0],
246 },
247 .resource = &flash_resources[0],
248 .num_resources = 1,
249 },
250 {
251 .name = "pxa2xx-flash",
252 .id = 1,
253 .dev = {
254 .platform_data = &mst_flash_data[1],
255 },
256 .resource = &flash_resources[1],
257 .num_resources = 1,
258 },
259};
260
193static void mainstone_backlight_power(int on) 261static void mainstone_backlight_power(int on)
194{ 262{
195 if (on) { 263 if (on) {
@@ -318,16 +386,34 @@ static struct pxaficp_platform_data mainstone_ficp_platform_data = {
318 .transceiver_mode = mainstone_irda_transceiver_mode, 386 .transceiver_mode = mainstone_irda_transceiver_mode,
319}; 387};
320 388
389static struct platform_device *platform_devices[] __initdata = {
390 &smc91x_device,
391 &mst_audio_device,
392 &mst_flash_device[0],
393 &mst_flash_device[1],
394};
395
321static void __init mainstone_init(void) 396static void __init mainstone_init(void)
322{ 397{
398 int SW7 = 0; /* FIXME: get from SCR (Mst doc section 3.2.1.1) */
399
400 mst_flash_data[0].width = (BOOT_DEF & 1) ? 2 : 4;
401 mst_flash_data[1].width = 4;
402
403 /* Compensate for SW7 which swaps the flash banks */
404 mst_flash_data[SW7].name = "processor-flash";
405 mst_flash_data[SW7 ^ 1].name = "mainboard-flash";
406
407 printk(KERN_NOTICE "Mainstone configured to boot from %s\n",
408 mst_flash_data[0].name);
409
323 /* 410 /*
324 * On Mainstone, we route AC97_SYSCLK via GPIO45 to 411 * On Mainstone, we route AC97_SYSCLK via GPIO45 to
325 * the audio daughter card 412 * the audio daughter card
326 */ 413 */
327 pxa_gpio_mode(GPIO45_SYSCLK_AC97_MD); 414 pxa_gpio_mode(GPIO45_SYSCLK_AC97_MD);
328 415
329 platform_device_register(&smc91x_device); 416 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
330 platform_device_register(&mst_audio_device);
331 417
332 /* reading Mainstone's "Virtual Configuration Register" 418 /* reading Mainstone's "Virtual Configuration Register"
333 might be handy to select LCD type here */ 419 might be handy to select LCD type here */