platform.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648
  1. /*
  2. * DBAu1200 board platform device registration
  3. *
  4. * Copyright (C) 2008-2009 Manuel Lauss
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #include <linux/dma-mapping.h>
  21. #include <linux/gpio.h>
  22. #include <linux/i2c.h>
  23. #include <linux/init.h>
  24. #include <linux/io.h>
  25. #include <linux/leds.h>
  26. #include <linux/mmc/host.h>
  27. #include <linux/mtd/mtd.h>
  28. #include <linux/mtd/nand.h>
  29. #include <linux/mtd/partitions.h>
  30. #include <linux/platform_device.h>
  31. #include <linux/serial_8250.h>
  32. #include <linux/spi/spi.h>
  33. #include <linux/spi/flash.h>
  34. #include <linux/smc91x.h>
  35. #include <asm/mach-au1x00/au1100_mmc.h>
  36. #include <asm/mach-au1x00/au1xxx_dbdma.h>
  37. #include <asm/mach-au1x00/au1550_spi.h>
  38. #include <asm/mach-db1x00/bcsr.h>
  39. #include <asm/mach-db1x00/db1200.h>
  40. #include "../platform.h"
  41. static struct mtd_partition db1200_spiflash_parts[] = {
  42. {
  43. .name = "DB1200 SPI flash",
  44. .offset = 0,
  45. .size = MTDPART_SIZ_FULL,
  46. },
  47. };
  48. static struct flash_platform_data db1200_spiflash_data = {
  49. .name = "s25fl001",
  50. .parts = db1200_spiflash_parts,
  51. .nr_parts = ARRAY_SIZE(db1200_spiflash_parts),
  52. .type = "m25p10",
  53. };
  54. static struct spi_board_info db1200_spi_devs[] __initdata = {
  55. {
  56. /* TI TMP121AIDBVR temp sensor */
  57. .modalias = "tmp121",
  58. .max_speed_hz = 2000000,
  59. .bus_num = 0,
  60. .chip_select = 0,
  61. .mode = 0,
  62. },
  63. {
  64. /* Spansion S25FL001D0FMA SPI flash */
  65. .modalias = "m25p80",
  66. .max_speed_hz = 50000000,
  67. .bus_num = 0,
  68. .chip_select = 1,
  69. .mode = 0,
  70. .platform_data = &db1200_spiflash_data,
  71. },
  72. };
  73. static struct i2c_board_info db1200_i2c_devs[] __initdata = {
  74. {
  75. /* AT24C04-10 I2C eeprom */
  76. I2C_BOARD_INFO("24c04", 0x52),
  77. },
  78. {
  79. /* Philips NE1619 temp/voltage sensor (adm1025 drv) */
  80. I2C_BOARD_INFO("ne1619", 0x2d),
  81. },
  82. {
  83. /* I2S audio codec WM8731 */
  84. I2C_BOARD_INFO("wm8731", 0x1b),
  85. },
  86. };
  87. /**********************************************************************/
  88. static void au1200_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
  89. unsigned int ctrl)
  90. {
  91. struct nand_chip *this = mtd->priv;
  92. unsigned long ioaddr = (unsigned long)this->IO_ADDR_W;
  93. ioaddr &= 0xffffff00;
  94. if (ctrl & NAND_CLE) {
  95. ioaddr += MEM_STNAND_CMD;
  96. } else if (ctrl & NAND_ALE) {
  97. ioaddr += MEM_STNAND_ADDR;
  98. } else {
  99. /* assume we want to r/w real data by default */
  100. ioaddr += MEM_STNAND_DATA;
  101. }
  102. this->IO_ADDR_R = this->IO_ADDR_W = (void __iomem *)ioaddr;
  103. if (cmd != NAND_CMD_NONE) {
  104. __raw_writeb(cmd, this->IO_ADDR_W);
  105. wmb();
  106. }
  107. }
  108. static int au1200_nand_device_ready(struct mtd_info *mtd)
  109. {
  110. return __raw_readl((void __iomem *)MEM_STSTAT) & 1;
  111. }
  112. static const char *db1200_part_probes[] = { "cmdlinepart", NULL };
  113. static struct mtd_partition db1200_nand_parts[] = {
  114. {
  115. .name = "NAND FS 0",
  116. .offset = 0,
  117. .size = 8 * 1024 * 1024,
  118. },
  119. {
  120. .name = "NAND FS 1",
  121. .offset = MTDPART_OFS_APPEND,
  122. .size = MTDPART_SIZ_FULL
  123. },
  124. };
  125. struct platform_nand_data db1200_nand_platdata = {
  126. .chip = {
  127. .nr_chips = 1,
  128. .chip_offset = 0,
  129. .nr_partitions = ARRAY_SIZE(db1200_nand_parts),
  130. .partitions = db1200_nand_parts,
  131. .chip_delay = 20,
  132. .part_probe_types = db1200_part_probes,
  133. },
  134. .ctrl = {
  135. .dev_ready = au1200_nand_device_ready,
  136. .cmd_ctrl = au1200_nand_cmd_ctrl,
  137. },
  138. };
  139. static struct resource db1200_nand_res[] = {
  140. [0] = {
  141. .start = DB1200_NAND_PHYS_ADDR,
  142. .end = DB1200_NAND_PHYS_ADDR + 0xff,
  143. .flags = IORESOURCE_MEM,
  144. },
  145. };
  146. static struct platform_device db1200_nand_dev = {
  147. .name = "gen_nand",
  148. .num_resources = ARRAY_SIZE(db1200_nand_res),
  149. .resource = db1200_nand_res,
  150. .id = -1,
  151. .dev = {
  152. .platform_data = &db1200_nand_platdata,
  153. }
  154. };
  155. /**********************************************************************/
  156. static struct smc91x_platdata db1200_eth_data = {
  157. .flags = SMC91X_NOWAIT | SMC91X_USE_16BIT,
  158. .leda = RPC_LED_100_10,
  159. .ledb = RPC_LED_TX_RX,
  160. };
  161. static struct resource db1200_eth_res[] = {
  162. [0] = {
  163. .start = DB1200_ETH_PHYS_ADDR,
  164. .end = DB1200_ETH_PHYS_ADDR + 0xf,
  165. .flags = IORESOURCE_MEM,
  166. },
  167. [1] = {
  168. .start = DB1200_ETH_INT,
  169. .end = DB1200_ETH_INT,
  170. .flags = IORESOURCE_IRQ,
  171. },
  172. };
  173. static struct platform_device db1200_eth_dev = {
  174. .dev = {
  175. .platform_data = &db1200_eth_data,
  176. },
  177. .name = "smc91x",
  178. .id = -1,
  179. .num_resources = ARRAY_SIZE(db1200_eth_res),
  180. .resource = db1200_eth_res,
  181. };
  182. /**********************************************************************/
  183. static struct resource db1200_ide_res[] = {
  184. [0] = {
  185. .start = DB1200_IDE_PHYS_ADDR,
  186. .end = DB1200_IDE_PHYS_ADDR + DB1200_IDE_PHYS_LEN - 1,
  187. .flags = IORESOURCE_MEM,
  188. },
  189. [1] = {
  190. .start = DB1200_IDE_INT,
  191. .end = DB1200_IDE_INT,
  192. .flags = IORESOURCE_IRQ,
  193. },
  194. [2] = {
  195. .start = AU1200_DSCR_CMD0_DMA_REQ1,
  196. .end = AU1200_DSCR_CMD0_DMA_REQ1,
  197. .flags = IORESOURCE_DMA,
  198. },
  199. };
  200. static u64 ide_dmamask = DMA_BIT_MASK(32);
  201. static struct platform_device db1200_ide_dev = {
  202. .name = "au1200-ide",
  203. .id = 0,
  204. .dev = {
  205. .dma_mask = &ide_dmamask,
  206. .coherent_dma_mask = DMA_BIT_MASK(32),
  207. },
  208. .num_resources = ARRAY_SIZE(db1200_ide_res),
  209. .resource = db1200_ide_res,
  210. };
  211. /**********************************************************************/
  212. static struct platform_device db1200_rtc_dev = {
  213. .name = "rtc-au1xxx",
  214. .id = -1,
  215. };
  216. /**********************************************************************/
  217. /* SD carddetects: they're supposed to be edge-triggered, but ack
  218. * doesn't seem to work (CPLD Rev 2). Instead, the screaming one
  219. * is disabled and its counterpart enabled. The 500ms timeout is
  220. * because the carddetect isn't debounced in hardware.
  221. */
  222. static irqreturn_t db1200_mmc_cd(int irq, void *ptr)
  223. {
  224. void(*mmc_cd)(struct mmc_host *, unsigned long);
  225. if (irq == DB1200_SD0_INSERT_INT) {
  226. disable_irq_nosync(DB1200_SD0_INSERT_INT);
  227. enable_irq(DB1200_SD0_EJECT_INT);
  228. } else {
  229. disable_irq_nosync(DB1200_SD0_EJECT_INT);
  230. enable_irq(DB1200_SD0_INSERT_INT);
  231. }
  232. /* link against CONFIG_MMC=m */
  233. mmc_cd = symbol_get(mmc_detect_change);
  234. if (mmc_cd) {
  235. mmc_cd(ptr, msecs_to_jiffies(500));
  236. symbol_put(mmc_detect_change);
  237. }
  238. return IRQ_HANDLED;
  239. }
  240. static int db1200_mmc_cd_setup(void *mmc_host, int en)
  241. {
  242. int ret;
  243. if (en) {
  244. ret = request_irq(DB1200_SD0_INSERT_INT, db1200_mmc_cd,
  245. IRQF_DISABLED, "sd_insert", mmc_host);
  246. if (ret)
  247. goto out;
  248. ret = request_irq(DB1200_SD0_EJECT_INT, db1200_mmc_cd,
  249. IRQF_DISABLED, "sd_eject", mmc_host);
  250. if (ret) {
  251. free_irq(DB1200_SD0_INSERT_INT, mmc_host);
  252. goto out;
  253. }
  254. if (bcsr_read(BCSR_SIGSTAT) & BCSR_INT_SD0INSERT)
  255. enable_irq(DB1200_SD0_EJECT_INT);
  256. else
  257. enable_irq(DB1200_SD0_INSERT_INT);
  258. } else {
  259. free_irq(DB1200_SD0_INSERT_INT, mmc_host);
  260. free_irq(DB1200_SD0_EJECT_INT, mmc_host);
  261. }
  262. ret = 0;
  263. out:
  264. return ret;
  265. }
  266. static void db1200_mmc_set_power(void *mmc_host, int state)
  267. {
  268. if (state) {
  269. bcsr_mod(BCSR_BOARD, 0, BCSR_BOARD_SD0PWR);
  270. msleep(400); /* stabilization time */
  271. } else
  272. bcsr_mod(BCSR_BOARD, BCSR_BOARD_SD0PWR, 0);
  273. }
  274. static int db1200_mmc_card_readonly(void *mmc_host)
  275. {
  276. return (bcsr_read(BCSR_STATUS) & BCSR_STATUS_SD0WP) ? 1 : 0;
  277. }
  278. static int db1200_mmc_card_inserted(void *mmc_host)
  279. {
  280. return (bcsr_read(BCSR_SIGSTAT) & BCSR_INT_SD0INSERT) ? 1 : 0;
  281. }
  282. static void db1200_mmcled_set(struct led_classdev *led,
  283. enum led_brightness brightness)
  284. {
  285. if (brightness != LED_OFF)
  286. bcsr_mod(BCSR_LEDS, BCSR_LEDS_LED0, 0);
  287. else
  288. bcsr_mod(BCSR_LEDS, 0, BCSR_LEDS_LED0);
  289. }
  290. static struct led_classdev db1200_mmc_led = {
  291. .brightness_set = db1200_mmcled_set,
  292. };
  293. static struct au1xmmc_platform_data db1200mmc_platdata = {
  294. .cd_setup = db1200_mmc_cd_setup,
  295. .set_power = db1200_mmc_set_power,
  296. .card_inserted = db1200_mmc_card_inserted,
  297. .card_readonly = db1200_mmc_card_readonly,
  298. .led = &db1200_mmc_led,
  299. };
  300. static struct resource au1200_mmc0_resources[] = {
  301. [0] = {
  302. .start = AU1100_SD0_PHYS_ADDR,
  303. .end = AU1100_SD0_PHYS_ADDR + 0xfff,
  304. .flags = IORESOURCE_MEM,
  305. },
  306. [1] = {
  307. .start = AU1200_SD_INT,
  308. .end = AU1200_SD_INT,
  309. .flags = IORESOURCE_IRQ,
  310. },
  311. [2] = {
  312. .start = AU1200_DSCR_CMD0_SDMS_TX0,
  313. .end = AU1200_DSCR_CMD0_SDMS_TX0,
  314. .flags = IORESOURCE_DMA,
  315. },
  316. [3] = {
  317. .start = AU1200_DSCR_CMD0_SDMS_RX0,
  318. .end = AU1200_DSCR_CMD0_SDMS_RX0,
  319. .flags = IORESOURCE_DMA,
  320. }
  321. };
  322. static u64 au1xxx_mmc_dmamask = DMA_BIT_MASK(32);
  323. static struct platform_device db1200_mmc0_dev = {
  324. .name = "au1xxx-mmc",
  325. .id = 0,
  326. .dev = {
  327. .dma_mask = &au1xxx_mmc_dmamask,
  328. .coherent_dma_mask = DMA_BIT_MASK(32),
  329. .platform_data = &db1200mmc_platdata,
  330. },
  331. .num_resources = ARRAY_SIZE(au1200_mmc0_resources),
  332. .resource = au1200_mmc0_resources,
  333. };
  334. /**********************************************************************/
  335. static struct resource au1200_lcd_res[] = {
  336. [0] = {
  337. .start = AU1200_LCD_PHYS_ADDR,
  338. .end = AU1200_LCD_PHYS_ADDR + 0x800 - 1,
  339. .flags = IORESOURCE_MEM,
  340. },
  341. [1] = {
  342. .start = AU1200_LCD_INT,
  343. .end = AU1200_LCD_INT,
  344. .flags = IORESOURCE_IRQ,
  345. }
  346. };
  347. static u64 au1200_lcd_dmamask = DMA_BIT_MASK(32);
  348. static struct platform_device au1200_lcd_dev = {
  349. .name = "au1200-lcd",
  350. .id = 0,
  351. .dev = {
  352. .dma_mask = &au1200_lcd_dmamask,
  353. .coherent_dma_mask = DMA_BIT_MASK(32),
  354. },
  355. .num_resources = ARRAY_SIZE(au1200_lcd_res),
  356. .resource = au1200_lcd_res,
  357. };
  358. /**********************************************************************/
  359. static struct resource au1200_psc0_res[] = {
  360. [0] = {
  361. .start = AU1550_PSC0_PHYS_ADDR,
  362. .end = AU1550_PSC0_PHYS_ADDR + 0xfff,
  363. .flags = IORESOURCE_MEM,
  364. },
  365. [1] = {
  366. .start = AU1200_PSC0_INT,
  367. .end = AU1200_PSC0_INT,
  368. .flags = IORESOURCE_IRQ,
  369. },
  370. [2] = {
  371. .start = AU1200_DSCR_CMD0_PSC0_TX,
  372. .end = AU1200_DSCR_CMD0_PSC0_TX,
  373. .flags = IORESOURCE_DMA,
  374. },
  375. [3] = {
  376. .start = AU1200_DSCR_CMD0_PSC0_RX,
  377. .end = AU1200_DSCR_CMD0_PSC0_RX,
  378. .flags = IORESOURCE_DMA,
  379. },
  380. };
  381. static struct platform_device db1200_i2c_dev = {
  382. .name = "au1xpsc_smbus",
  383. .id = 0, /* bus number */
  384. .num_resources = ARRAY_SIZE(au1200_psc0_res),
  385. .resource = au1200_psc0_res,
  386. };
  387. static void db1200_spi_cs_en(struct au1550_spi_info *spi, int cs, int pol)
  388. {
  389. if (cs)
  390. bcsr_mod(BCSR_RESETS, 0, BCSR_RESETS_SPISEL);
  391. else
  392. bcsr_mod(BCSR_RESETS, BCSR_RESETS_SPISEL, 0);
  393. }
  394. static struct au1550_spi_info db1200_spi_platdata = {
  395. .mainclk_hz = 50000000, /* PSC0 clock */
  396. .num_chipselect = 2,
  397. .activate_cs = db1200_spi_cs_en,
  398. };
  399. static u64 spi_dmamask = DMA_BIT_MASK(32);
  400. static struct platform_device db1200_spi_dev = {
  401. .dev = {
  402. .dma_mask = &spi_dmamask,
  403. .coherent_dma_mask = DMA_BIT_MASK(32),
  404. .platform_data = &db1200_spi_platdata,
  405. },
  406. .name = "au1550-spi",
  407. .id = 0, /* bus number */
  408. .num_resources = ARRAY_SIZE(au1200_psc0_res),
  409. .resource = au1200_psc0_res,
  410. };
  411. static struct resource au1200_psc1_res[] = {
  412. [0] = {
  413. .start = AU1550_PSC1_PHYS_ADDR,
  414. .end = AU1550_PSC1_PHYS_ADDR + 0xfff,
  415. .flags = IORESOURCE_MEM,
  416. },
  417. [1] = {
  418. .start = AU1200_PSC1_INT,
  419. .end = AU1200_PSC1_INT,
  420. .flags = IORESOURCE_IRQ,
  421. },
  422. [2] = {
  423. .start = AU1200_DSCR_CMD0_PSC1_TX,
  424. .end = AU1200_DSCR_CMD0_PSC1_TX,
  425. .flags = IORESOURCE_DMA,
  426. },
  427. [3] = {
  428. .start = AU1200_DSCR_CMD0_PSC1_RX,
  429. .end = AU1200_DSCR_CMD0_PSC1_RX,
  430. .flags = IORESOURCE_DMA,
  431. },
  432. };
  433. /* AC97 or I2S device */
  434. static struct platform_device db1200_audio_dev = {
  435. /* name assigned later based on switch setting */
  436. .id = 1, /* PSC ID */
  437. .num_resources = ARRAY_SIZE(au1200_psc1_res),
  438. .resource = au1200_psc1_res,
  439. };
  440. /* DB1200 ASoC card device */
  441. static struct platform_device db1200_sound_dev = {
  442. /* name assigned later based on switch setting */
  443. .id = 1, /* PSC ID */
  444. };
  445. static struct platform_device db1200_stac_dev = {
  446. .name = "ac97-codec",
  447. .id = 1, /* on PSC1 */
  448. };
  449. static struct platform_device db1200_audiodma_dev = {
  450. .name = "au1xpsc-pcm",
  451. .id = 1, /* PSC ID */
  452. };
  453. static struct platform_device *db1200_devs[] __initdata = {
  454. NULL, /* PSC0, selected by S6.8 */
  455. &db1200_ide_dev,
  456. &db1200_mmc0_dev,
  457. &au1200_lcd_dev,
  458. &db1200_eth_dev,
  459. &db1200_rtc_dev,
  460. &db1200_nand_dev,
  461. &db1200_audiodma_dev,
  462. &db1200_audio_dev,
  463. &db1200_stac_dev,
  464. &db1200_sound_dev,
  465. };
  466. static int __init db1200_dev_init(void)
  467. {
  468. unsigned long pfc;
  469. unsigned short sw;
  470. int swapped;
  471. i2c_register_board_info(0, db1200_i2c_devs,
  472. ARRAY_SIZE(db1200_i2c_devs));
  473. spi_register_board_info(db1200_spi_devs,
  474. ARRAY_SIZE(db1200_i2c_devs));
  475. /* SWITCHES: S6.8 I2C/SPI selector (OFF=I2C ON=SPI)
  476. * S6.7 AC97/I2S selector (OFF=AC97 ON=I2S)
  477. */
  478. /* NOTE: GPIO215 controls OTG VBUS supply. In SPI mode however
  479. * this pin is claimed by PSC0 (unused though, but pinmux doesn't
  480. * allow to free it without crippling the SPI interface).
  481. * As a result, in SPI mode, OTG simply won't work (PSC0 uses
  482. * it as an input pin which is pulled high on the boards).
  483. */
  484. pfc = __raw_readl((void __iomem *)SYS_PINFUNC) & ~SYS_PINFUNC_P0A;
  485. /* switch off OTG VBUS supply */
  486. gpio_request(215, "otg-vbus");
  487. gpio_direction_output(215, 1);
  488. printk(KERN_INFO "DB1200 device configuration:\n");
  489. sw = bcsr_read(BCSR_SWITCHES);
  490. if (sw & BCSR_SWITCHES_DIP_8) {
  491. db1200_devs[0] = &db1200_i2c_dev;
  492. bcsr_mod(BCSR_RESETS, BCSR_RESETS_PSC0MUX, 0);
  493. pfc |= (2 << 17); /* GPIO2 block owns GPIO215 */
  494. printk(KERN_INFO " S6.8 OFF: PSC0 mode I2C\n");
  495. printk(KERN_INFO " OTG port VBUS supply available!\n");
  496. } else {
  497. db1200_devs[0] = &db1200_spi_dev;
  498. bcsr_mod(BCSR_RESETS, 0, BCSR_RESETS_PSC0MUX);
  499. pfc |= (1 << 17); /* PSC0 owns GPIO215 */
  500. printk(KERN_INFO " S6.8 ON : PSC0 mode SPI\n");
  501. printk(KERN_INFO " OTG port VBUS supply disabled\n");
  502. }
  503. __raw_writel(pfc, (void __iomem *)SYS_PINFUNC);
  504. wmb();
  505. /* Audio: DIP7 selects I2S(0)/AC97(1), but need I2C for I2S!
  506. * so: DIP7=1 || DIP8=0 => AC97, DIP7=0 && DIP8=1 => I2S
  507. */
  508. sw &= BCSR_SWITCHES_DIP_8 | BCSR_SWITCHES_DIP_7;
  509. if (sw == BCSR_SWITCHES_DIP_8) {
  510. bcsr_mod(BCSR_RESETS, 0, BCSR_RESETS_PSC1MUX);
  511. db1200_audio_dev.name = "au1xpsc_i2s";
  512. db1200_sound_dev.name = "db1200-i2s";
  513. printk(KERN_INFO " S6.7 ON : PSC1 mode I2S\n");
  514. } else {
  515. bcsr_mod(BCSR_RESETS, BCSR_RESETS_PSC1MUX, 0);
  516. db1200_audio_dev.name = "au1xpsc_ac97";
  517. db1200_sound_dev.name = "db1200-ac97";
  518. printk(KERN_INFO " S6.7 OFF: PSC1 mode AC97\n");
  519. }
  520. /* Audio PSC clock is supplied externally. (FIXME: platdata!!) */
  521. __raw_writel(PSC_SEL_CLK_SERCLK,
  522. (void __iomem *)KSEG1ADDR(AU1550_PSC1_PHYS_ADDR) + PSC_SEL_OFFSET);
  523. wmb();
  524. db1x_register_pcmcia_socket(
  525. AU1000_PCMCIA_ATTR_PHYS_ADDR,
  526. AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x000400000 - 1,
  527. AU1000_PCMCIA_MEM_PHYS_ADDR,
  528. AU1000_PCMCIA_MEM_PHYS_ADDR + 0x000400000 - 1,
  529. AU1000_PCMCIA_IO_PHYS_ADDR,
  530. AU1000_PCMCIA_IO_PHYS_ADDR + 0x000010000 - 1,
  531. DB1200_PC0_INT, DB1200_PC0_INSERT_INT,
  532. /*DB1200_PC0_STSCHG_INT*/0, DB1200_PC0_EJECT_INT, 0);
  533. db1x_register_pcmcia_socket(
  534. AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x004000000,
  535. AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x004400000 - 1,
  536. AU1000_PCMCIA_MEM_PHYS_ADDR + 0x004000000,
  537. AU1000_PCMCIA_MEM_PHYS_ADDR + 0x004400000 - 1,
  538. AU1000_PCMCIA_IO_PHYS_ADDR + 0x004000000,
  539. AU1000_PCMCIA_IO_PHYS_ADDR + 0x004010000 - 1,
  540. DB1200_PC1_INT, DB1200_PC1_INSERT_INT,
  541. /*DB1200_PC1_STSCHG_INT*/0, DB1200_PC1_EJECT_INT, 1);
  542. swapped = bcsr_read(BCSR_STATUS) & BCSR_STATUS_DB1200_SWAPBOOT;
  543. db1x_register_norflash(64 << 20, 2, swapped);
  544. return platform_add_devices(db1200_devs, ARRAY_SIZE(db1200_devs));
  545. }
  546. device_initcall(db1200_dev_init);
  547. /* au1200fb calls these: STERBT EINEN TRAGISCHEN TOD!!! */
  548. int board_au1200fb_panel(void)
  549. {
  550. return (bcsr_read(BCSR_SWITCHES) >> 8) & 0x0f;
  551. }
  552. int board_au1200fb_panel_init(void)
  553. {
  554. /* Apply power */
  555. bcsr_mod(BCSR_BOARD, 0, BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD |
  556. BCSR_BOARD_LCDBL);
  557. return 0;
  558. }
  559. int board_au1200fb_panel_shutdown(void)
  560. {
  561. /* Remove power */
  562. bcsr_mod(BCSR_BOARD, BCSR_BOARD_LCDVEE | BCSR_BOARD_LCDVDD |
  563. BCSR_BOARD_LCDBL, 0);
  564. return 0;
  565. }