initial commit with v3.6.7
[linux-3.6.7-moxart.git] / arch / mips / alchemy / devboards / db1300.c
blobc56e0246694ecdffbc4afda86374db50d8bc5cb8
1 /*
2 * DBAu1300 init and platform device setup.
4 * (c) 2009 Manuel Lauss <manuel.lauss@googlemail.com>
5 */
7 #include <linux/dma-mapping.h>
8 #include <linux/gpio.h>
9 #include <linux/gpio_keys.h>
10 #include <linux/init.h>
11 #include <linux/input.h> /* KEY_* codes */
12 #include <linux/i2c.h>
13 #include <linux/io.h>
14 #include <linux/leds.h>
15 #include <linux/ata_platform.h>
16 #include <linux/mmc/host.h>
17 #include <linux/module.h>
18 #include <linux/mtd/mtd.h>
19 #include <linux/mtd/nand.h>
20 #include <linux/mtd/partitions.h>
21 #include <linux/platform_device.h>
22 #include <linux/smsc911x.h>
24 #include <asm/mach-au1x00/au1000.h>
25 #include <asm/mach-au1x00/au1100_mmc.h>
26 #include <asm/mach-au1x00/au1200fb.h>
27 #include <asm/mach-au1x00/au1xxx_dbdma.h>
28 #include <asm/mach-au1x00/au1xxx_psc.h>
29 #include <asm/mach-db1x00/db1300.h>
30 #include <asm/mach-db1x00/bcsr.h>
31 #include <asm/mach-au1x00/prom.h>
33 #include "platform.h"
35 static struct i2c_board_info db1300_i2c_devs[] __initdata = {
36 { I2C_BOARD_INFO("wm8731", 0x1b), }, /* I2S audio codec */
37 { I2C_BOARD_INFO("ne1619", 0x2d), }, /* adm1025-compat hwmon */
40 /* multifunction pins to assign to GPIO controller */
41 static int db1300_gpio_pins[] __initdata = {
42 AU1300_PIN_LCDPWM0, AU1300_PIN_PSC2SYNC1, AU1300_PIN_WAKE1,
43 AU1300_PIN_WAKE2, AU1300_PIN_WAKE3, AU1300_PIN_FG3AUX,
44 AU1300_PIN_EXTCLK1,
45 -1, /* terminator */
48 /* multifunction pins to assign to device functions */
49 static int db1300_dev_pins[] __initdata = {
50 /* wake-from-str pins 0-3 */
51 AU1300_PIN_WAKE0,
52 /* external clock sources for PSC0 */
53 AU1300_PIN_EXTCLK0,
54 /* 8bit MMC interface on SD0: 6-9 */
55 AU1300_PIN_SD0DAT4, AU1300_PIN_SD0DAT5, AU1300_PIN_SD0DAT6,
56 AU1300_PIN_SD0DAT7,
57 /* UART1 pins: 11-18 */
58 AU1300_PIN_U1RI, AU1300_PIN_U1DCD, AU1300_PIN_U1DSR,
59 AU1300_PIN_U1CTS, AU1300_PIN_U1RTS, AU1300_PIN_U1DTR,
60 AU1300_PIN_U1RX, AU1300_PIN_U1TX,
61 /* UART0 pins: 19-24 */
62 AU1300_PIN_U0RI, AU1300_PIN_U0DCD, AU1300_PIN_U0DSR,
63 AU1300_PIN_U0CTS, AU1300_PIN_U0RTS, AU1300_PIN_U0DTR,
64 /* UART2: 25-26 */
65 AU1300_PIN_U2RX, AU1300_PIN_U2TX,
66 /* UART3: 27-28 */
67 AU1300_PIN_U3RX, AU1300_PIN_U3TX,
68 /* LCD controller PWMs, ext pixclock: 30-31 */
69 AU1300_PIN_LCDPWM1, AU1300_PIN_LCDCLKIN,
70 /* SD1 interface: 32-37 */
71 AU1300_PIN_SD1DAT0, AU1300_PIN_SD1DAT1, AU1300_PIN_SD1DAT2,
72 AU1300_PIN_SD1DAT3, AU1300_PIN_SD1CMD, AU1300_PIN_SD1CLK,
73 /* SD2 interface: 38-43 */
74 AU1300_PIN_SD2DAT0, AU1300_PIN_SD2DAT1, AU1300_PIN_SD2DAT2,
75 AU1300_PIN_SD2DAT3, AU1300_PIN_SD2CMD, AU1300_PIN_SD2CLK,
76 /* PSC0/1 clocks: 44-45 */
77 AU1300_PIN_PSC0CLK, AU1300_PIN_PSC1CLK,
78 /* PSCs: 46-49/50-53/54-57/58-61 */
79 AU1300_PIN_PSC0SYNC0, AU1300_PIN_PSC0SYNC1, AU1300_PIN_PSC0D0,
80 AU1300_PIN_PSC0D1,
81 AU1300_PIN_PSC1SYNC0, AU1300_PIN_PSC1SYNC1, AU1300_PIN_PSC1D0,
82 AU1300_PIN_PSC1D1,
83 AU1300_PIN_PSC2SYNC0, AU1300_PIN_PSC2D0,
84 AU1300_PIN_PSC2D1,
85 AU1300_PIN_PSC3SYNC0, AU1300_PIN_PSC3SYNC1, AU1300_PIN_PSC3D0,
86 AU1300_PIN_PSC3D1,
87 /* PCMCIA interface: 62-70 */
88 AU1300_PIN_PCE2, AU1300_PIN_PCE1, AU1300_PIN_PIOS16,
89 AU1300_PIN_PIOR, AU1300_PIN_PWE, AU1300_PIN_PWAIT,
90 AU1300_PIN_PREG, AU1300_PIN_POE, AU1300_PIN_PIOW,
91 /* camera interface H/V sync inputs: 71-72 */
92 AU1300_PIN_CIMLS, AU1300_PIN_CIMFS,
93 /* PSC2/3 clocks: 73-74 */
94 AU1300_PIN_PSC2CLK, AU1300_PIN_PSC3CLK,
95 -1, /* terminator */
98 static void __init db1300_gpio_config(void)
100 int *i;
102 i = &db1300_dev_pins[0];
103 while (*i != -1)
104 au1300_pinfunc_to_dev(*i++);
106 i = &db1300_gpio_pins[0];
107 while (*i != -1)
108 au1300_gpio_direction_input(*i++);/* implies pin_to_gpio */
110 au1300_set_dbdma_gpio(1, AU1300_PIN_FG3AUX);
113 char *get_system_type(void)
115 return "DB1300";
118 /**********************************************************************/
120 static void au1300_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
121 unsigned int ctrl)
123 struct nand_chip *this = mtd->priv;
124 unsigned long ioaddr = (unsigned long)this->IO_ADDR_W;
126 ioaddr &= 0xffffff00;
128 if (ctrl & NAND_CLE) {
129 ioaddr += MEM_STNAND_CMD;
130 } else if (ctrl & NAND_ALE) {
131 ioaddr += MEM_STNAND_ADDR;
132 } else {
133 /* assume we want to r/w real data by default */
134 ioaddr += MEM_STNAND_DATA;
136 this->IO_ADDR_R = this->IO_ADDR_W = (void __iomem *)ioaddr;
137 if (cmd != NAND_CMD_NONE) {
138 __raw_writeb(cmd, this->IO_ADDR_W);
139 wmb();
143 static int au1300_nand_device_ready(struct mtd_info *mtd)
145 return __raw_readl((void __iomem *)MEM_STSTAT) & 1;
148 static struct mtd_partition db1300_nand_parts[] = {
150 .name = "NAND FS 0",
151 .offset = 0,
152 .size = 8 * 1024 * 1024,
155 .name = "NAND FS 1",
156 .offset = MTDPART_OFS_APPEND,
157 .size = MTDPART_SIZ_FULL
161 struct platform_nand_data db1300_nand_platdata = {
162 .chip = {
163 .nr_chips = 1,
164 .chip_offset = 0,
165 .nr_partitions = ARRAY_SIZE(db1300_nand_parts),
166 .partitions = db1300_nand_parts,
167 .chip_delay = 20,
169 .ctrl = {
170 .dev_ready = au1300_nand_device_ready,
171 .cmd_ctrl = au1300_nand_cmd_ctrl,
175 static struct resource db1300_nand_res[] = {
176 [0] = {
177 .start = DB1300_NAND_PHYS_ADDR,
178 .end = DB1300_NAND_PHYS_ADDR + 0xff,
179 .flags = IORESOURCE_MEM,
183 static struct platform_device db1300_nand_dev = {
184 .name = "gen_nand",
185 .num_resources = ARRAY_SIZE(db1300_nand_res),
186 .resource = db1300_nand_res,
187 .id = -1,
188 .dev = {
189 .platform_data = &db1300_nand_platdata,
193 /**********************************************************************/
195 static struct resource db1300_eth_res[] = {
196 [0] = {
197 .start = DB1300_ETH_PHYS_ADDR,
198 .end = DB1300_ETH_PHYS_END,
199 .flags = IORESOURCE_MEM,
201 [1] = {
202 .start = DB1300_ETH_INT,
203 .end = DB1300_ETH_INT,
204 .flags = IORESOURCE_IRQ,
208 static struct smsc911x_platform_config db1300_eth_config = {
209 .phy_interface = PHY_INTERFACE_MODE_MII,
210 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
211 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
212 .flags = SMSC911X_USE_32BIT,
215 static struct platform_device db1300_eth_dev = {
216 .name = "smsc911x",
217 .id = -1,
218 .num_resources = ARRAY_SIZE(db1300_eth_res),
219 .resource = db1300_eth_res,
220 .dev = {
221 .platform_data = &db1300_eth_config,
225 /**********************************************************************/
227 static struct resource au1300_psc1_res[] = {
228 [0] = {
229 .start = AU1300_PSC1_PHYS_ADDR,
230 .end = AU1300_PSC1_PHYS_ADDR + 0x0fff,
231 .flags = IORESOURCE_MEM,
233 [1] = {
234 .start = AU1300_PSC1_INT,
235 .end = AU1300_PSC1_INT,
236 .flags = IORESOURCE_IRQ,
238 [2] = {
239 .start = AU1300_DSCR_CMD0_PSC1_TX,
240 .end = AU1300_DSCR_CMD0_PSC1_TX,
241 .flags = IORESOURCE_DMA,
243 [3] = {
244 .start = AU1300_DSCR_CMD0_PSC1_RX,
245 .end = AU1300_DSCR_CMD0_PSC1_RX,
246 .flags = IORESOURCE_DMA,
250 static struct platform_device db1300_ac97_dev = {
251 .name = "au1xpsc_ac97",
252 .id = 1, /* PSC ID. match with AC97 codec ID! */
253 .num_resources = ARRAY_SIZE(au1300_psc1_res),
254 .resource = au1300_psc1_res,
257 /**********************************************************************/
259 static struct resource au1300_psc2_res[] = {
260 [0] = {
261 .start = AU1300_PSC2_PHYS_ADDR,
262 .end = AU1300_PSC2_PHYS_ADDR + 0x0fff,
263 .flags = IORESOURCE_MEM,
265 [1] = {
266 .start = AU1300_PSC2_INT,
267 .end = AU1300_PSC2_INT,
268 .flags = IORESOURCE_IRQ,
270 [2] = {
271 .start = AU1300_DSCR_CMD0_PSC2_TX,
272 .end = AU1300_DSCR_CMD0_PSC2_TX,
273 .flags = IORESOURCE_DMA,
275 [3] = {
276 .start = AU1300_DSCR_CMD0_PSC2_RX,
277 .end = AU1300_DSCR_CMD0_PSC2_RX,
278 .flags = IORESOURCE_DMA,
282 static struct platform_device db1300_i2s_dev = {
283 .name = "au1xpsc_i2s",
284 .id = 2, /* PSC ID */
285 .num_resources = ARRAY_SIZE(au1300_psc2_res),
286 .resource = au1300_psc2_res,
289 /**********************************************************************/
291 static struct resource au1300_psc3_res[] = {
292 [0] = {
293 .start = AU1300_PSC3_PHYS_ADDR,
294 .end = AU1300_PSC3_PHYS_ADDR + 0x0fff,
295 .flags = IORESOURCE_MEM,
297 [1] = {
298 .start = AU1300_PSC3_INT,
299 .end = AU1300_PSC3_INT,
300 .flags = IORESOURCE_IRQ,
302 [2] = {
303 .start = AU1300_DSCR_CMD0_PSC3_TX,
304 .end = AU1300_DSCR_CMD0_PSC3_TX,
305 .flags = IORESOURCE_DMA,
307 [3] = {
308 .start = AU1300_DSCR_CMD0_PSC3_RX,
309 .end = AU1300_DSCR_CMD0_PSC3_RX,
310 .flags = IORESOURCE_DMA,
314 static struct platform_device db1300_i2c_dev = {
315 .name = "au1xpsc_smbus",
316 .id = 0, /* bus number */
317 .num_resources = ARRAY_SIZE(au1300_psc3_res),
318 .resource = au1300_psc3_res,
321 /**********************************************************************/
323 /* proper key assignments when facing the LCD panel. For key assignments
324 * according to the schematics swap up with down and left with right.
325 * I chose to use it to emulate the arrow keys of a keyboard.
327 static struct gpio_keys_button db1300_5waysw_arrowkeys[] = {
329 .code = KEY_DOWN,
330 .gpio = AU1300_PIN_LCDPWM0,
331 .type = EV_KEY,
332 .debounce_interval = 1,
333 .active_low = 1,
334 .desc = "5waysw-down",
337 .code = KEY_UP,
338 .gpio = AU1300_PIN_PSC2SYNC1,
339 .type = EV_KEY,
340 .debounce_interval = 1,
341 .active_low = 1,
342 .desc = "5waysw-up",
345 .code = KEY_RIGHT,
346 .gpio = AU1300_PIN_WAKE3,
347 .type = EV_KEY,
348 .debounce_interval = 1,
349 .active_low = 1,
350 .desc = "5waysw-right",
353 .code = KEY_LEFT,
354 .gpio = AU1300_PIN_WAKE2,
355 .type = EV_KEY,
356 .debounce_interval = 1,
357 .active_low = 1,
358 .desc = "5waysw-left",
361 .code = KEY_ENTER,
362 .gpio = AU1300_PIN_WAKE1,
363 .type = EV_KEY,
364 .debounce_interval = 1,
365 .active_low = 1,
366 .desc = "5waysw-push",
370 static struct gpio_keys_platform_data db1300_5waysw_data = {
371 .buttons = db1300_5waysw_arrowkeys,
372 .nbuttons = ARRAY_SIZE(db1300_5waysw_arrowkeys),
373 .rep = 1,
374 .name = "db1300-5wayswitch",
377 static struct platform_device db1300_5waysw_dev = {
378 .name = "gpio-keys",
379 .dev = {
380 .platform_data = &db1300_5waysw_data,
384 /**********************************************************************/
386 static struct pata_platform_info db1300_ide_info = {
387 .ioport_shift = DB1300_IDE_REG_SHIFT,
390 #define IDE_ALT_START (14 << DB1300_IDE_REG_SHIFT)
391 static struct resource db1300_ide_res[] = {
392 [0] = {
393 .start = DB1300_IDE_PHYS_ADDR,
394 .end = DB1300_IDE_PHYS_ADDR + IDE_ALT_START - 1,
395 .flags = IORESOURCE_MEM,
397 [1] = {
398 .start = DB1300_IDE_PHYS_ADDR + IDE_ALT_START,
399 .end = DB1300_IDE_PHYS_ADDR + DB1300_IDE_PHYS_LEN - 1,
400 .flags = IORESOURCE_MEM,
402 [2] = {
403 .start = DB1300_IDE_INT,
404 .end = DB1300_IDE_INT,
405 .flags = IORESOURCE_IRQ,
409 static struct platform_device db1300_ide_dev = {
410 .dev = {
411 .platform_data = &db1300_ide_info,
413 .name = "pata_platform",
414 .resource = db1300_ide_res,
415 .num_resources = ARRAY_SIZE(db1300_ide_res),
418 /**********************************************************************/
420 static irqreturn_t db1300_mmc_cd(int irq, void *ptr)
422 void(*mmc_cd)(struct mmc_host *, unsigned long);
424 /* disable the one currently screaming. No other way to shut it up */
425 if (irq == DB1300_SD1_INSERT_INT) {
426 disable_irq_nosync(DB1300_SD1_INSERT_INT);
427 enable_irq(DB1300_SD1_EJECT_INT);
428 } else {
429 disable_irq_nosync(DB1300_SD1_EJECT_INT);
430 enable_irq(DB1300_SD1_INSERT_INT);
433 /* link against CONFIG_MMC=m. We can only be called once MMC core has
434 * initialized the controller, so symbol_get() should always succeed.
436 mmc_cd = symbol_get(mmc_detect_change);
437 mmc_cd(ptr, msecs_to_jiffies(500));
438 symbol_put(mmc_detect_change);
440 return IRQ_HANDLED;
443 static int db1300_mmc_card_readonly(void *mmc_host)
445 /* it uses SD1 interface, but the DB1200's SD0 bit in the CPLD */
446 return bcsr_read(BCSR_STATUS) & BCSR_STATUS_SD0WP;
449 static int db1300_mmc_card_inserted(void *mmc_host)
451 return bcsr_read(BCSR_SIGSTAT) & (1 << 12); /* insertion irq signal */
454 static int db1300_mmc_cd_setup(void *mmc_host, int en)
456 int ret;
458 if (en) {
459 ret = request_irq(DB1300_SD1_INSERT_INT, db1300_mmc_cd, 0,
460 "sd_insert", mmc_host);
461 if (ret)
462 goto out;
464 ret = request_irq(DB1300_SD1_EJECT_INT, db1300_mmc_cd, 0,
465 "sd_eject", mmc_host);
466 if (ret) {
467 free_irq(DB1300_SD1_INSERT_INT, mmc_host);
468 goto out;
471 if (db1300_mmc_card_inserted(mmc_host))
472 enable_irq(DB1300_SD1_EJECT_INT);
473 else
474 enable_irq(DB1300_SD1_INSERT_INT);
476 } else {
477 free_irq(DB1300_SD1_INSERT_INT, mmc_host);
478 free_irq(DB1300_SD1_EJECT_INT, mmc_host);
480 ret = 0;
481 out:
482 return ret;
485 static void db1300_mmcled_set(struct led_classdev *led,
486 enum led_brightness brightness)
488 if (brightness != LED_OFF)
489 bcsr_mod(BCSR_LEDS, BCSR_LEDS_LED0, 0);
490 else
491 bcsr_mod(BCSR_LEDS, 0, BCSR_LEDS_LED0);
494 static struct led_classdev db1300_mmc_led = {
495 .brightness_set = db1300_mmcled_set,
498 struct au1xmmc_platform_data db1300_sd1_platdata = {
499 .cd_setup = db1300_mmc_cd_setup,
500 .card_inserted = db1300_mmc_card_inserted,
501 .card_readonly = db1300_mmc_card_readonly,
502 .led = &db1300_mmc_led,
505 static struct resource au1300_sd1_res[] = {
506 [0] = {
507 .start = AU1300_SD1_PHYS_ADDR,
508 .end = AU1300_SD1_PHYS_ADDR,
509 .flags = IORESOURCE_MEM,
511 [1] = {
512 .start = AU1300_SD1_INT,
513 .end = AU1300_SD1_INT,
514 .flags = IORESOURCE_IRQ,
516 [2] = {
517 .start = AU1300_DSCR_CMD0_SDMS_TX1,
518 .end = AU1300_DSCR_CMD0_SDMS_TX1,
519 .flags = IORESOURCE_DMA,
521 [3] = {
522 .start = AU1300_DSCR_CMD0_SDMS_RX1,
523 .end = AU1300_DSCR_CMD0_SDMS_RX1,
524 .flags = IORESOURCE_DMA,
528 static struct platform_device db1300_sd1_dev = {
529 .dev = {
530 .platform_data = &db1300_sd1_platdata,
532 .name = "au1xxx-mmc",
533 .id = 1,
534 .resource = au1300_sd1_res,
535 .num_resources = ARRAY_SIZE(au1300_sd1_res),
538 /**********************************************************************/
540 static int db1300_movinand_inserted(void *mmc_host)
542 return 0; /* disable for now, it doesn't work yet */
545 static int db1300_movinand_readonly(void *mmc_host)
547 return 0;
550 static void db1300_movinand_led_set(struct led_classdev *led,
551 enum led_brightness brightness)
553 if (brightness != LED_OFF)
554 bcsr_mod(BCSR_LEDS, BCSR_LEDS_LED1, 0);
555 else
556 bcsr_mod(BCSR_LEDS, 0, BCSR_LEDS_LED1);
559 static struct led_classdev db1300_movinand_led = {
560 .brightness_set = db1300_movinand_led_set,
563 struct au1xmmc_platform_data db1300_sd0_platdata = {
564 .card_inserted = db1300_movinand_inserted,
565 .card_readonly = db1300_movinand_readonly,
566 .led = &db1300_movinand_led,
567 .mask_host_caps = MMC_CAP_NEEDS_POLL,
570 static struct resource au1300_sd0_res[] = {
571 [0] = {
572 .start = AU1100_SD0_PHYS_ADDR,
573 .end = AU1100_SD0_PHYS_ADDR,
574 .flags = IORESOURCE_MEM,
576 [1] = {
577 .start = AU1300_SD0_INT,
578 .end = AU1300_SD0_INT,
579 .flags = IORESOURCE_IRQ,
581 [2] = {
582 .start = AU1300_DSCR_CMD0_SDMS_TX0,
583 .end = AU1300_DSCR_CMD0_SDMS_TX0,
584 .flags = IORESOURCE_DMA,
586 [3] = {
587 .start = AU1300_DSCR_CMD0_SDMS_RX0,
588 .end = AU1300_DSCR_CMD0_SDMS_RX0,
589 .flags = IORESOURCE_DMA,
593 static struct platform_device db1300_sd0_dev = {
594 .dev = {
595 .platform_data = &db1300_sd0_platdata,
597 .name = "au1xxx-mmc",
598 .id = 0,
599 .resource = au1300_sd0_res,
600 .num_resources = ARRAY_SIZE(au1300_sd0_res),
603 /**********************************************************************/
605 static struct platform_device db1300_wm9715_dev = {
606 .name = "wm9712-codec",
607 .id = 1, /* ID of PSC for AC97 audio, see asoc glue! */
610 static struct platform_device db1300_ac97dma_dev = {
611 .name = "au1xpsc-pcm",
612 .id = 1, /* PSC ID */
615 static struct platform_device db1300_i2sdma_dev = {
616 .name = "au1xpsc-pcm",
617 .id = 2, /* PSC ID */
620 static struct platform_device db1300_sndac97_dev = {
621 .name = "db1300-ac97",
624 static struct platform_device db1300_sndi2s_dev = {
625 .name = "db1300-i2s",
628 /**********************************************************************/
630 static int db1300fb_panel_index(void)
632 return 9; /* DB1300_800x480 */
635 static int db1300fb_panel_init(void)
637 /* Apply power (Vee/Vdd logic is inverted on Panel DB1300_800x480) */
638 bcsr_mod(BCSR_BOARD, BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD,
639 BCSR_BOARD_LCDBL);
640 return 0;
643 static int db1300fb_panel_shutdown(void)
645 /* Remove power (Vee/Vdd logic is inverted on Panel DB1300_800x480) */
646 bcsr_mod(BCSR_BOARD, BCSR_BOARD_LCDBL,
647 BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD);
648 return 0;
651 static struct au1200fb_platdata db1300fb_pd = {
652 .panel_index = db1300fb_panel_index,
653 .panel_init = db1300fb_panel_init,
654 .panel_shutdown = db1300fb_panel_shutdown,
657 static struct resource au1300_lcd_res[] = {
658 [0] = {
659 .start = AU1200_LCD_PHYS_ADDR,
660 .end = AU1200_LCD_PHYS_ADDR + 0x800 - 1,
661 .flags = IORESOURCE_MEM,
663 [1] = {
664 .start = AU1300_LCD_INT,
665 .end = AU1300_LCD_INT,
666 .flags = IORESOURCE_IRQ,
670 static u64 au1300_lcd_dmamask = DMA_BIT_MASK(32);
672 static struct platform_device db1300_lcd_dev = {
673 .name = "au1200-lcd",
674 .id = 0,
675 .dev = {
676 .dma_mask = &au1300_lcd_dmamask,
677 .coherent_dma_mask = DMA_BIT_MASK(32),
678 .platform_data = &db1300fb_pd,
680 .num_resources = ARRAY_SIZE(au1300_lcd_res),
681 .resource = au1300_lcd_res,
684 /**********************************************************************/
686 static struct platform_device *db1300_dev[] __initdata = {
687 &db1300_eth_dev,
688 &db1300_i2c_dev,
689 &db1300_5waysw_dev,
690 &db1300_nand_dev,
691 &db1300_ide_dev,
692 &db1300_sd0_dev,
693 &db1300_sd1_dev,
694 &db1300_lcd_dev,
695 &db1300_ac97_dev,
696 &db1300_i2s_dev,
697 &db1300_wm9715_dev,
698 &db1300_ac97dma_dev,
699 &db1300_i2sdma_dev,
700 &db1300_sndac97_dev,
701 &db1300_sndi2s_dev,
704 static int __init db1300_device_init(void)
706 int swapped, cpldirq;
708 /* setup CPLD IRQ muxer */
709 cpldirq = au1300_gpio_to_irq(AU1300_PIN_EXTCLK1);
710 irq_set_irq_type(cpldirq, IRQ_TYPE_LEVEL_HIGH);
711 bcsr_init_irq(DB1300_FIRST_INT, DB1300_LAST_INT, cpldirq);
713 /* insert/eject IRQs: one always triggers so don't enable them
714 * when doing request_irq() on them. DB1200 has this bug too.
716 irq_set_status_flags(DB1300_SD1_INSERT_INT, IRQ_NOAUTOEN);
717 irq_set_status_flags(DB1300_SD1_EJECT_INT, IRQ_NOAUTOEN);
718 irq_set_status_flags(DB1300_CF_INSERT_INT, IRQ_NOAUTOEN);
719 irq_set_status_flags(DB1300_CF_EJECT_INT, IRQ_NOAUTOEN);
722 * setup board
724 prom_get_ethernet_addr(&db1300_eth_config.mac[0]);
726 i2c_register_board_info(0, db1300_i2c_devs,
727 ARRAY_SIZE(db1300_i2c_devs));
729 /* Audio PSC clock is supplied by codecs (PSC1, 2) */
730 __raw_writel(PSC_SEL_CLK_SERCLK,
731 (void __iomem *)KSEG1ADDR(AU1300_PSC1_PHYS_ADDR) + PSC_SEL_OFFSET);
732 wmb();
733 __raw_writel(PSC_SEL_CLK_SERCLK,
734 (void __iomem *)KSEG1ADDR(AU1300_PSC2_PHYS_ADDR) + PSC_SEL_OFFSET);
735 wmb();
736 /* I2C uses internal 48MHz EXTCLK1 */
737 __raw_writel(PSC_SEL_CLK_INTCLK,
738 (void __iomem *)KSEG1ADDR(AU1300_PSC3_PHYS_ADDR) + PSC_SEL_OFFSET);
739 wmb();
741 /* enable power to USB ports */
742 bcsr_mod(BCSR_RESETS, 0, BCSR_RESETS_USBHPWR | BCSR_RESETS_OTGPWR);
744 /* although it is socket #0, it uses the CPLD bits which previous boards
745 * have used for socket #1.
747 db1x_register_pcmcia_socket(
748 AU1000_PCMCIA_ATTR_PHYS_ADDR,
749 AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x00400000 - 1,
750 AU1000_PCMCIA_MEM_PHYS_ADDR,
751 AU1000_PCMCIA_MEM_PHYS_ADDR + 0x00400000 - 1,
752 AU1000_PCMCIA_IO_PHYS_ADDR,
753 AU1000_PCMCIA_IO_PHYS_ADDR + 0x00010000 - 1,
754 DB1300_CF_INT, DB1300_CF_INSERT_INT, 0, DB1300_CF_EJECT_INT, 1);
756 swapped = bcsr_read(BCSR_STATUS) & BCSR_STATUS_DB1200_SWAPBOOT;
757 db1x_register_norflash(64 << 20, 2, swapped);
759 return platform_add_devices(db1300_dev, ARRAY_SIZE(db1300_dev));
761 device_initcall(db1300_device_init);
764 void __init board_setup(void)
766 unsigned short whoami;
768 db1300_gpio_config();
769 bcsr_init(DB1300_BCSR_PHYS_ADDR,
770 DB1300_BCSR_PHYS_ADDR + DB1300_BCSR_HEXLED_OFS);
772 whoami = bcsr_read(BCSR_WHOAMI);
773 printk(KERN_INFO "NetLogic DBAu1300 Development Platform.\n\t"
774 "BoardID %d CPLD Rev %d DaughtercardID %d\n",
775 BCSR_WHOAMI_BOARD(whoami), BCSR_WHOAMI_CPLD(whoami),
776 BCSR_WHOAMI_DCID(whoami));
778 /* enable UARTs, YAMON only enables #2 */
779 alchemy_uart_enable(AU1300_UART0_PHYS_ADDR);
780 alchemy_uart_enable(AU1300_UART1_PHYS_ADDR);
781 alchemy_uart_enable(AU1300_UART3_PHYS_ADDR);