blob: 7fa5a3779e0dab6d443a3de263e62cf5b6b1a403 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * linux/arch/arm/mach-pxa/mainstone.c
3 *
4 * Support for the Intel HCDDBBVA0 Development Platform.
5 * (go figure how they came up with such name...)
6 *
7 * Author: Nicolas Pitre
8 * Created: Nov 05, 2002
9 * Copyright: MontaVista Software Inc.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 */
15
16#include <linux/init.h>
Russell Kingd052d1b2005-10-29 19:07:23 +010017#include <linux/platform_device.h>
Nicolas Pitre22f11c42005-06-16 21:23:56 +010018#include <linux/sysdev.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070019#include <linux/interrupt.h>
20#include <linux/sched.h>
21#include <linux/bitops.h>
22#include <linux/fb.h>
Todd Poynor74ec71e2005-11-04 17:15:45 +000023#include <linux/ioport.h>
24#include <linux/mtd/mtd.h>
25#include <linux/mtd/partitions.h>
Russell King3777f772007-11-08 11:22:48 +000026#include <linux/backlight.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070027
28#include <asm/types.h>
29#include <asm/setup.h>
30#include <asm/memory.h>
31#include <asm/mach-types.h>
32#include <asm/hardware.h>
33#include <asm/irq.h>
Todd Poynor74ec71e2005-11-04 17:15:45 +000034#include <asm/sizes.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070035
36#include <asm/mach/arch.h>
37#include <asm/mach/map.h>
38#include <asm/mach/irq.h>
Todd Poynor74ec71e2005-11-04 17:15:45 +000039#include <asm/mach/flash.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070040
41#include <asm/arch/pxa-regs.h>
Russell King8785a8f2008-01-14 17:02:33 +000042#include <asm/arch/pxa2xx-regs.h>
eric miaofef06d22008-02-04 17:15:50 +080043#include <asm/arch/mfp-pxa27x.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070044#include <asm/arch/mainstone.h>
45#include <asm/arch/audio.h>
46#include <asm/arch/pxafb.h>
47#include <asm/arch/mmc.h>
Nicolas Pitre6f475c02005-10-28 16:39:33 +010048#include <asm/arch/irda.h>
Richard Purdie81f280e2005-11-12 14:22:11 +000049#include <asm/arch/ohci.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070050
51#include "generic.h"
Russell King46c41e62007-05-15 15:39:36 +010052#include "devices.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070053
eric miaofef06d22008-02-04 17:15:50 +080054static unsigned long mainstone_pin_config[] = {
55 /* Chip Select */
56 GPIO15_nCS_1,
57
58 /* LCD - 16bpp Active TFT */
59 GPIO58_LCD_LDD_0,
60 GPIO59_LCD_LDD_1,
61 GPIO60_LCD_LDD_2,
62 GPIO61_LCD_LDD_3,
63 GPIO62_LCD_LDD_4,
64 GPIO63_LCD_LDD_5,
65 GPIO64_LCD_LDD_6,
66 GPIO65_LCD_LDD_7,
67 GPIO66_LCD_LDD_8,
68 GPIO67_LCD_LDD_9,
69 GPIO68_LCD_LDD_10,
70 GPIO69_LCD_LDD_11,
71 GPIO70_LCD_LDD_12,
72 GPIO71_LCD_LDD_13,
73 GPIO72_LCD_LDD_14,
74 GPIO73_LCD_LDD_15,
75 GPIO74_LCD_FCLK,
76 GPIO75_LCD_LCLK,
77 GPIO76_LCD_PCLK,
78 GPIO77_LCD_BIAS,
79 GPIO16_PWM0_OUT, /* Backlight */
80
81 /* MMC */
82 GPIO32_MMC_CLK,
83 GPIO112_MMC_CMD,
84 GPIO92_MMC_DAT_0,
85 GPIO109_MMC_DAT_1,
86 GPIO110_MMC_DAT_2,
87 GPIO111_MMC_DAT_3,
88
89 /* USB Host Port 1 */
90 GPIO88_USBH1_PWR,
91 GPIO89_USBH1_PEN,
92
93 /* PC Card */
94 GPIO48_nPOE,
95 GPIO49_nPWE,
96 GPIO50_nPIOR,
97 GPIO51_nPIOW,
98 GPIO85_nPCE_1,
99 GPIO54_nPCE_2,
100 GPIO79_PSKTSEL,
101 GPIO55_nPREG,
102 GPIO56_nPWAIT,
103 GPIO57_nIOIS16,
104
105 /* AC97 */
106 GPIO45_AC97_SYSCLK,
107
108 /* Keypad */
109 GPIO93_KP_DKIN_0 | WAKEUP_ON_LEVEL_HIGH,
110 GPIO94_KP_DKIN_1 | WAKEUP_ON_LEVEL_HIGH,
111 GPIO95_KP_DKIN_2 | WAKEUP_ON_LEVEL_HIGH,
112 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
113 GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
114 GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
115 GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
116 GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
117 GPIO99_KP_MKIN_5 | WAKEUP_ON_LEVEL_HIGH,
118 GPIO103_KP_MKOUT_0,
119 GPIO104_KP_MKOUT_1,
120 GPIO105_KP_MKOUT_2,
121 GPIO106_KP_MKOUT_3,
122 GPIO107_KP_MKOUT_4,
123 GPIO108_KP_MKOUT_5,
124 GPIO96_KP_MKOUT_6,
125
126 /* GPIO */
127 GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH,
128};
Linus Torvalds1da177e2005-04-16 15:20:36 -0700129
130static unsigned long mainstone_irq_enabled;
131
132static void mainstone_mask_irq(unsigned int irq)
133{
134 int mainstone_irq = (irq - MAINSTONE_IRQ(0));
135 MST_INTMSKENA = (mainstone_irq_enabled &= ~(1 << mainstone_irq));
136}
137
138static void mainstone_unmask_irq(unsigned int irq)
139{
140 int mainstone_irq = (irq - MAINSTONE_IRQ(0));
141 /* the irq can be acknowledged only if deasserted, so it's done here */
142 MST_INTSETCLR &= ~(1 << mainstone_irq);
143 MST_INTMSKENA = (mainstone_irq_enabled |= (1 << mainstone_irq));
144}
145
David Brownell38c677c2006-08-01 22:26:25 +0100146static struct irq_chip mainstone_irq_chip = {
147 .name = "FPGA",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700148 .ack = mainstone_mask_irq,
149 .mask = mainstone_mask_irq,
150 .unmask = mainstone_unmask_irq,
151};
152
Russell King10dd5ce2006-11-23 11:41:32 +0000153static void mainstone_irq_handler(unsigned int irq, struct irq_desc *desc)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700154{
155 unsigned long pending = MST_INTSETCLR & mainstone_irq_enabled;
156 do {
157 GEDR(0) = GPIO_bit(0); /* clear useless edge notification */
158 if (likely(pending)) {
159 irq = MAINSTONE_IRQ(0) + __ffs(pending);
160 desc = irq_desc + irq;
Linus Torvalds0cd61b62006-10-06 10:53:39 -0700161 desc_handle_irq(irq, desc);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700162 }
163 pending = MST_INTSETCLR & mainstone_irq_enabled;
164 } while (pending);
165}
166
167static void __init mainstone_init_irq(void)
168{
169 int irq;
170
Eric Miaocd491042007-06-22 04:14:09 +0100171 pxa27x_init_irq();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700172
173 /* setup extra Mainstone irqs */
174 for(irq = MAINSTONE_IRQ(0); irq <= MAINSTONE_IRQ(15); irq++) {
175 set_irq_chip(irq, &mainstone_irq_chip);
Russell King10dd5ce2006-11-23 11:41:32 +0000176 set_irq_handler(irq, handle_level_irq);
Thomas Gleixnerec641522006-05-17 20:14:29 +0100177 if (irq == MAINSTONE_IRQ(10) || irq == MAINSTONE_IRQ(14))
178 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE | IRQF_NOAUTOEN);
179 else
180 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700181 }
182 set_irq_flags(MAINSTONE_IRQ(8), 0);
183 set_irq_flags(MAINSTONE_IRQ(12), 0);
184
185 MST_INTMSKENA = 0;
186 MST_INTSETCLR = 0;
187
188 set_irq_chained_handler(IRQ_GPIO(0), mainstone_irq_handler);
189 set_irq_type(IRQ_GPIO(0), IRQT_FALLING);
190}
191
Nicolas Pitre22f11c42005-06-16 21:23:56 +0100192#ifdef CONFIG_PM
193
194static int mainstone_irq_resume(struct sys_device *dev)
195{
196 MST_INTMSKENA = mainstone_irq_enabled;
197 return 0;
198}
199
200static struct sysdev_class mainstone_irq_sysclass = {
Kay Sieversaf5ca3f2007-12-20 02:09:39 +0100201 .name = "cpld_irq",
Nicolas Pitre22f11c42005-06-16 21:23:56 +0100202 .resume = mainstone_irq_resume,
203};
204
205static struct sys_device mainstone_irq_device = {
206 .cls = &mainstone_irq_sysclass,
207};
208
209static int __init mainstone_irq_device_init(void)
210{
Russell King16f159b2007-12-10 13:33:06 +0000211 int ret = -ENODEV;
212
213 if (machine_is_mainstone()) {
214 ret = sysdev_class_register(&mainstone_irq_sysclass);
215 if (ret == 0)
216 ret = sysdev_register(&mainstone_irq_device);
217 }
Nicolas Pitre22f11c42005-06-16 21:23:56 +0100218 return ret;
219}
220
221device_initcall(mainstone_irq_device_init);
222
223#endif
224
Linus Torvalds1da177e2005-04-16 15:20:36 -0700225
226static struct resource smc91x_resources[] = {
227 [0] = {
228 .start = (MST_ETH_PHYS + 0x300),
229 .end = (MST_ETH_PHYS + 0xfffff),
230 .flags = IORESOURCE_MEM,
231 },
232 [1] = {
233 .start = MAINSTONE_IRQ(3),
234 .end = MAINSTONE_IRQ(3),
Russell Kinge7b3dc72008-01-14 22:30:10 +0000235 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700236 }
237};
238
239static struct platform_device smc91x_device = {
240 .name = "smc91x",
241 .id = 0,
242 .num_resources = ARRAY_SIZE(smc91x_resources),
243 .resource = smc91x_resources,
244};
245
Takashi Iwaif7cbb7f2006-01-13 18:48:06 +0100246static int mst_audio_startup(struct snd_pcm_substream *substream, void *priv)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700247{
248 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
249 MST_MSCWR2 &= ~MST_MSCWR2_AC97_SPKROFF;
250 return 0;
251}
252
Takashi Iwaif7cbb7f2006-01-13 18:48:06 +0100253static void mst_audio_shutdown(struct snd_pcm_substream *substream, void *priv)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700254{
255 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
256 MST_MSCWR2 |= MST_MSCWR2_AC97_SPKROFF;
257}
258
259static long mst_audio_suspend_mask;
260
261static void mst_audio_suspend(void *priv)
262{
263 mst_audio_suspend_mask = MST_MSCWR2;
264 MST_MSCWR2 |= MST_MSCWR2_AC97_SPKROFF;
265}
266
267static void mst_audio_resume(void *priv)
268{
269 MST_MSCWR2 &= mst_audio_suspend_mask | ~MST_MSCWR2_AC97_SPKROFF;
270}
271
272static pxa2xx_audio_ops_t mst_audio_ops = {
273 .startup = mst_audio_startup,
274 .shutdown = mst_audio_shutdown,
275 .suspend = mst_audio_suspend,
276 .resume = mst_audio_resume,
277};
278
279static struct platform_device mst_audio_device = {
280 .name = "pxa2xx-ac97",
281 .id = -1,
282 .dev = { .platform_data = &mst_audio_ops },
283};
284
Todd Poynor74ec71e2005-11-04 17:15:45 +0000285static struct resource flash_resources[] = {
286 [0] = {
287 .start = PXA_CS0_PHYS,
288 .end = PXA_CS0_PHYS + SZ_64M - 1,
289 .flags = IORESOURCE_MEM,
290 },
291 [1] = {
292 .start = PXA_CS1_PHYS,
293 .end = PXA_CS1_PHYS + SZ_64M - 1,
294 .flags = IORESOURCE_MEM,
295 },
296};
297
298static struct mtd_partition mainstoneflash0_partitions[] = {
299 {
300 .name = "Bootloader",
301 .size = 0x00040000,
302 .offset = 0,
303 .mask_flags = MTD_WRITEABLE /* force read-only */
304 },{
305 .name = "Kernel",
306 .size = 0x00400000,
307 .offset = 0x00040000,
308 },{
309 .name = "Filesystem",
310 .size = MTDPART_SIZ_FULL,
311 .offset = 0x00440000
312 }
313};
314
315static struct flash_platform_data mst_flash_data[2] = {
316 {
317 .map_name = "cfi_probe",
318 .parts = mainstoneflash0_partitions,
319 .nr_parts = ARRAY_SIZE(mainstoneflash0_partitions),
320 }, {
321 .map_name = "cfi_probe",
322 .parts = NULL,
323 .nr_parts = 0,
324 }
325};
326
327static struct platform_device mst_flash_device[2] = {
328 {
329 .name = "pxa2xx-flash",
330 .id = 0,
331 .dev = {
332 .platform_data = &mst_flash_data[0],
333 },
334 .resource = &flash_resources[0],
335 .num_resources = 1,
336 },
337 {
338 .name = "pxa2xx-flash",
339 .id = 1,
340 .dev = {
341 .platform_data = &mst_flash_data[1],
342 },
343 .resource = &flash_resources[1],
344 .num_resources = 1,
345 },
346};
347
Russell King3777f772007-11-08 11:22:48 +0000348#ifdef CONFIG_BACKLIGHT_CLASS_DEVICE
349static int mainstone_backlight_update_status(struct backlight_device *bl)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700350{
Russell King3777f772007-11-08 11:22:48 +0000351 int brightness = bl->props.brightness;
352
353 if (bl->props.power != FB_BLANK_UNBLANK ||
354 bl->props.fb_blank != FB_BLANK_UNBLANK)
355 brightness = 0;
356
eric miaofef06d22008-02-04 17:15:50 +0800357 if (brightness != 0)
Eric Miao7053acb2007-04-05 04:07:20 +0100358 pxa_set_cken(CKEN_PWM0, 1);
eric miaofef06d22008-02-04 17:15:50 +0800359
Russell King3777f772007-11-08 11:22:48 +0000360 PWM_CTRL0 = 0;
361 PWM_PWDUTY0 = brightness;
362 PWM_PERVAL0 = bl->props.max_brightness;
eric miaofef06d22008-02-04 17:15:50 +0800363
Russell King3777f772007-11-08 11:22:48 +0000364 if (brightness == 0)
365 pxa_set_cken(CKEN_PWM0, 0);
366 return 0; /* pointless return value */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700367}
368
Russell King3777f772007-11-08 11:22:48 +0000369static int mainstone_backlight_get_brightness(struct backlight_device *bl)
370{
371 return PWM_PWDUTY0;
372}
373
374static /*const*/ struct backlight_ops mainstone_backlight_ops = {
375 .update_status = mainstone_backlight_update_status,
376 .get_brightness = mainstone_backlight_get_brightness,
377};
378
379static void __init mainstone_backlight_register(void)
380{
381 struct backlight_device *bl;
382
383 bl = backlight_device_register("mainstone-bl", &pxa_device_fb.dev,
384 NULL, &mainstone_backlight_ops);
385 if (IS_ERR(bl)) {
386 printk(KERN_ERR "mainstone: unable to register backlight: %ld\n",
387 PTR_ERR(bl));
388 return;
389 }
390
391 /*
392 * broken design - register-then-setup interfaces are
393 * utterly broken by definition.
394 */
395 bl->props.max_brightness = 1023;
396 bl->props.brightness = 1023;
397 backlight_update_status(bl);
398}
399#else
400#define mainstone_backlight_register() do { } while (0)
401#endif
402
Richard Purdied14b2722006-09-20 22:54:21 +0100403static struct pxafb_mode_info toshiba_ltm04c380k_mode = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700404 .pixclock = 50000,
405 .xres = 640,
406 .yres = 480,
407 .bpp = 16,
408 .hsync_len = 1,
409 .left_margin = 0x9f,
410 .right_margin = 1,
411 .vsync_len = 44,
412 .upper_margin = 0,
413 .lower_margin = 0,
414 .sync = FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700415};
416
Richard Purdied14b2722006-09-20 22:54:21 +0100417static struct pxafb_mode_info toshiba_ltm035a776c_mode = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700418 .pixclock = 110000,
419 .xres = 240,
420 .yres = 320,
421 .bpp = 16,
422 .hsync_len = 4,
423 .left_margin = 8,
424 .right_margin = 20,
425 .vsync_len = 3,
426 .upper_margin = 1,
427 .lower_margin = 10,
428 .sync = FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT,
Richard Purdied14b2722006-09-20 22:54:21 +0100429};
430
431static struct pxafb_mach_info mainstone_pxafb_info = {
432 .num_modes = 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700433 .lccr0 = LCCR0_Act,
434 .lccr3 = LCCR3_PCP,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700435};
436
David Howells40220c12006-10-09 12:19:47 +0100437static int mainstone_mci_init(struct device *dev, irq_handler_t mstone_detect_int, void *data)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700438{
439 int err;
440
Linus Torvalds1da177e2005-04-16 15:20:36 -0700441 /* make sure SD/Memory Stick multiplexer's signals
442 * are routed to MMC controller
443 */
444 MST_MSCWR1 &= ~MST_MSCWR1_MS_SEL;
445
Thomas Gleixner52e405e2006-07-03 02:20:05 +0200446 err = request_irq(MAINSTONE_MMC_IRQ, mstone_detect_int, IRQF_DISABLED,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700447 "MMC card detect", data);
Russell King2687bd32008-01-23 14:05:58 +0000448 if (err)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700449 printk(KERN_ERR "mainstone_mci_init: MMC/SD: can't request MMC card detect IRQ\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700450
Russell King2687bd32008-01-23 14:05:58 +0000451 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700452}
453
454static void mainstone_mci_setpower(struct device *dev, unsigned int vdd)
455{
456 struct pxamci_platform_data* p_d = dev->platform_data;
457
458 if (( 1 << vdd) & p_d->ocr_mask) {
Harvey Harrison8e86f422008-03-04 15:08:02 -0800459 printk(KERN_DEBUG "%s: on\n", __func__);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700460 MST_MSCWR1 |= MST_MSCWR1_MMC_ON;
461 MST_MSCWR1 &= ~MST_MSCWR1_MS_SEL;
462 } else {
Harvey Harrison8e86f422008-03-04 15:08:02 -0800463 printk(KERN_DEBUG "%s: off\n", __func__);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700464 MST_MSCWR1 &= ~MST_MSCWR1_MMC_ON;
465 }
466}
467
468static void mainstone_mci_exit(struct device *dev, void *data)
469{
470 free_irq(MAINSTONE_MMC_IRQ, data);
471}
472
473static struct pxamci_platform_data mainstone_mci_platform_data = {
474 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
475 .init = mainstone_mci_init,
476 .setpower = mainstone_mci_setpower,
477 .exit = mainstone_mci_exit,
478};
479
Nicolas Pitre6f475c02005-10-28 16:39:33 +0100480static void mainstone_irda_transceiver_mode(struct device *dev, int mode)
481{
482 unsigned long flags;
483
484 local_irq_save(flags);
485 if (mode & IR_SIRMODE) {
486 MST_MSCWR1 &= ~MST_MSCWR1_IRDA_FIR;
487 } else if (mode & IR_FIRMODE) {
488 MST_MSCWR1 |= MST_MSCWR1_IRDA_FIR;
489 }
490 if (mode & IR_OFF) {
491 MST_MSCWR1 = (MST_MSCWR1 & ~MST_MSCWR1_IRDA_MASK) | MST_MSCWR1_IRDA_OFF;
492 } else {
493 MST_MSCWR1 = (MST_MSCWR1 & ~MST_MSCWR1_IRDA_MASK) | MST_MSCWR1_IRDA_FULL;
494 }
495 local_irq_restore(flags);
496}
497
498static struct pxaficp_platform_data mainstone_ficp_platform_data = {
499 .transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF,
500 .transceiver_mode = mainstone_irda_transceiver_mode,
501};
502
Todd Poynor74ec71e2005-11-04 17:15:45 +0000503static struct platform_device *platform_devices[] __initdata = {
504 &smc91x_device,
505 &mst_audio_device,
506 &mst_flash_device[0],
507 &mst_flash_device[1],
508};
509
Richard Purdie81f280e2005-11-12 14:22:11 +0000510static int mainstone_ohci_init(struct device *dev)
511{
Richard Purdie81f280e2005-11-12 14:22:11 +0000512 /* Set the Power Control Polarity Low and Power Sense
513 Polarity Low to active low. */
514 UHCHR = (UHCHR | UHCHR_PCPL | UHCHR_PSPL) &
515 ~(UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSEP3 | UHCHR_SSE);
516
517 return 0;
518}
519
520static struct pxaohci_platform_data mainstone_ohci_platform_data = {
521 .port_mode = PMM_PERPORT_MODE,
522 .init = mainstone_ohci_init,
523};
524
Linus Torvalds1da177e2005-04-16 15:20:36 -0700525static void __init mainstone_init(void)
526{
Todd Poynor74ec71e2005-11-04 17:15:45 +0000527 int SW7 = 0; /* FIXME: get from SCR (Mst doc section 3.2.1.1) */
528
eric miaofef06d22008-02-04 17:15:50 +0800529 pxa2xx_mfp_config(ARRAY_AND_SIZE(mainstone_pin_config));
530
Todd Poynor74ec71e2005-11-04 17:15:45 +0000531 mst_flash_data[0].width = (BOOT_DEF & 1) ? 2 : 4;
532 mst_flash_data[1].width = 4;
533
534 /* Compensate for SW7 which swaps the flash banks */
535 mst_flash_data[SW7].name = "processor-flash";
536 mst_flash_data[SW7 ^ 1].name = "mainboard-flash";
537
538 printk(KERN_NOTICE "Mainstone configured to boot from %s\n",
539 mst_flash_data[0].name);
540
Jared Hulbert5b2e98c2006-01-05 21:12:26 +0000541 /* system bus arbiter setting
542 * - Core_Park
543 * - LCD_wt:DMA_wt:CORE_Wt = 2:3:4
544 */
545 ARB_CNTRL = ARB_CORE_PARK | 0x234;
546
Todd Poynor74ec71e2005-11-04 17:15:45 +0000547 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700548
549 /* reading Mainstone's "Virtual Configuration Register"
550 might be handy to select LCD type here */
551 if (0)
Richard Purdied14b2722006-09-20 22:54:21 +0100552 mainstone_pxafb_info.modes = &toshiba_ltm04c380k_mode;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700553 else
Richard Purdied14b2722006-09-20 22:54:21 +0100554 mainstone_pxafb_info.modes = &toshiba_ltm035a776c_mode;
555
556 set_pxa_fb_info(&mainstone_pxafb_info);
Russell King3777f772007-11-08 11:22:48 +0000557 mainstone_backlight_register();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700558
559 pxa_set_mci_info(&mainstone_mci_platform_data);
Nicolas Pitre6f475c02005-10-28 16:39:33 +0100560 pxa_set_ficp_info(&mainstone_ficp_platform_data);
Richard Purdie81f280e2005-11-12 14:22:11 +0000561 pxa_set_ohci_info(&mainstone_ohci_platform_data);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700562}
563
564
565static struct map_desc mainstone_io_desc[] __initdata = {
Deepak Saxena6f9182e2005-10-28 15:19:01 +0100566 { /* CPLD */
567 .virtual = MST_FPGA_VIRT,
568 .pfn = __phys_to_pfn(MST_FPGA_PHYS),
569 .length = 0x00100000,
570 .type = MT_DEVICE
571 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700572};
573
574static void __init mainstone_map_io(void)
575{
576 pxa_map_io();
577 iotable_init(mainstone_io_desc, ARRAY_SIZE(mainstone_io_desc));
578
Todd Poynor87754202005-06-03 20:52:27 +0100579 /* for use I SRAM as framebuffer. */
580 PSLR |= 0xF04;
581 PCFR = 0x66;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700582}
583
584MACHINE_START(MAINSTONE, "Intel HCDDBBVA0 Development Platform (aka Mainstone)")
Russell Kinge9dea0c2005-07-03 17:38:58 +0100585 /* Maintainer: MontaVista Software Inc. */
Russell Kinge9dea0c2005-07-03 17:38:58 +0100586 .phys_io = 0x40000000,
Steve Yanga7d14f82006-06-05 19:47:17 +0100587 .boot_params = 0xa0000100, /* BLOB boot parameter setting */
Russell King68070bd2005-07-04 10:44:34 +0100588 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100589 .map_io = mainstone_map_io,
590 .init_irq = mainstone_init_irq,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700591 .timer = &pxa_timer,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100592 .init_machine = mainstone_init,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700593MACHINE_END