db1550.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620
  1. /*
  2. * Alchemy Db1550/Pb1550 board support
  3. *
  4. * (c) 2011 Manuel Lauss <manuel.lauss@googlemail.com>
  5. */
  6. #include <linux/clk.h>
  7. #include <linux/dma-mapping.h>
  8. #include <linux/gpio.h>
  9. #include <linux/i2c.h>
  10. #include <linux/init.h>
  11. #include <linux/io.h>
  12. #include <linux/interrupt.h>
  13. #include <linux/mtd/mtd.h>
  14. #include <linux/mtd/nand.h>
  15. #include <linux/mtd/partitions.h>
  16. #include <linux/platform_device.h>
  17. #include <linux/pm.h>
  18. #include <linux/spi/spi.h>
  19. #include <linux/spi/flash.h>
  20. #include <asm/bootinfo.h>
  21. #include <asm/mach-au1x00/au1000.h>
  22. #include <asm/mach-au1x00/au1xxx_eth.h>
  23. #include <asm/mach-au1x00/au1xxx_dbdma.h>
  24. #include <asm/mach-au1x00/au1xxx_psc.h>
  25. #include <asm/mach-au1x00/au1550_spi.h>
  26. #include <asm/mach-au1x00/au1550nd.h>
  27. #include <asm/mach-db1x00/bcsr.h>
  28. #include <prom.h>
  29. #include "platform.h"
  30. static void __init db1550_hw_setup(void)
  31. {
  32. void __iomem *base;
  33. unsigned long v;
  34. /* complete pin setup: assign GPIO16 to PSC0_SYNC1 (SPI cs# line)
  35. * as well as PSC1_SYNC for AC97 on PB1550.
  36. */
  37. v = alchemy_rdsys(AU1000_SYS_PINFUNC);
  38. alchemy_wrsys(v | 1 | SYS_PF_PSC1_S1, AU1000_SYS_PINFUNC);
  39. /* reset the AC97 codec now, the reset time in the psc-ac97 driver
  40. * is apparently too short although it's ridiculous as it is.
  41. */
  42. base = (void __iomem *)KSEG1ADDR(AU1550_PSC1_PHYS_ADDR);
  43. __raw_writel(PSC_SEL_CLK_SERCLK | PSC_SEL_PS_AC97MODE,
  44. base + PSC_SEL_OFFSET);
  45. __raw_writel(PSC_CTRL_DISABLE, base + PSC_CTRL_OFFSET);
  46. wmb();
  47. __raw_writel(PSC_AC97RST_RST, base + PSC_AC97RST_OFFSET);
  48. wmb();
  49. }
  50. int __init db1550_board_setup(void)
  51. {
  52. unsigned short whoami;
  53. bcsr_init(DB1550_BCSR_PHYS_ADDR,
  54. DB1550_BCSR_PHYS_ADDR + DB1550_BCSR_HEXLED_OFS);
  55. whoami = bcsr_read(BCSR_WHOAMI); /* PB1550 hexled offset differs */
  56. switch (BCSR_WHOAMI_BOARD(whoami)) {
  57. case BCSR_WHOAMI_PB1550_SDR:
  58. case BCSR_WHOAMI_PB1550_DDR:
  59. bcsr_init(PB1550_BCSR_PHYS_ADDR,
  60. PB1550_BCSR_PHYS_ADDR + PB1550_BCSR_HEXLED_OFS);
  61. case BCSR_WHOAMI_DB1550:
  62. break;
  63. default:
  64. return -ENODEV;
  65. }
  66. pr_info("Alchemy/AMD %s Board, CPLD Rev %d Board-ID %d " \
  67. "Daughtercard ID %d\n", get_system_type(),
  68. (whoami >> 4) & 0xf, (whoami >> 8) & 0xf, whoami & 0xf);
  69. db1550_hw_setup();
  70. return 0;
  71. }
  72. /*****************************************************************************/
  73. static struct mtd_partition db1550_spiflash_parts[] = {
  74. {
  75. .name = "spi_flash",
  76. .offset = 0,
  77. .size = MTDPART_SIZ_FULL,
  78. },
  79. };
  80. static struct flash_platform_data db1550_spiflash_data = {
  81. .name = "s25fl010",
  82. .parts = db1550_spiflash_parts,
  83. .nr_parts = ARRAY_SIZE(db1550_spiflash_parts),
  84. .type = "m25p10",
  85. };
  86. static struct spi_board_info db1550_spi_devs[] __initdata = {
  87. {
  88. /* TI TMP121AIDBVR temp sensor */
  89. .modalias = "tmp121",
  90. .max_speed_hz = 2400000,
  91. .bus_num = 0,
  92. .chip_select = 0,
  93. .mode = SPI_MODE_0,
  94. },
  95. {
  96. /* Spansion S25FL001D0FMA SPI flash */
  97. .modalias = "m25p80",
  98. .max_speed_hz = 2400000,
  99. .bus_num = 0,
  100. .chip_select = 1,
  101. .mode = SPI_MODE_0,
  102. .platform_data = &db1550_spiflash_data,
  103. },
  104. };
  105. static struct i2c_board_info db1550_i2c_devs[] __initdata = {
  106. { I2C_BOARD_INFO("24c04", 0x52),}, /* AT24C04-10 I2C eeprom */
  107. { I2C_BOARD_INFO("ne1619", 0x2d),}, /* adm1025-compat hwmon */
  108. { I2C_BOARD_INFO("wm8731", 0x1b),}, /* I2S audio codec WM8731 */
  109. };
  110. /**********************************************************************/
  111. static void au1550_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
  112. unsigned int ctrl)
  113. {
  114. struct nand_chip *this = mtd->priv;
  115. unsigned long ioaddr = (unsigned long)this->IO_ADDR_W;
  116. ioaddr &= 0xffffff00;
  117. if (ctrl & NAND_CLE) {
  118. ioaddr += MEM_STNAND_CMD;
  119. } else if (ctrl & NAND_ALE) {
  120. ioaddr += MEM_STNAND_ADDR;
  121. } else {
  122. /* assume we want to r/w real data by default */
  123. ioaddr += MEM_STNAND_DATA;
  124. }
  125. this->IO_ADDR_R = this->IO_ADDR_W = (void __iomem *)ioaddr;
  126. if (cmd != NAND_CMD_NONE) {
  127. __raw_writeb(cmd, this->IO_ADDR_W);
  128. wmb();
  129. }
  130. }
  131. static int au1550_nand_device_ready(struct mtd_info *mtd)
  132. {
  133. return alchemy_rdsmem(AU1000_MEM_STSTAT) & 1;
  134. }
  135. static struct mtd_partition db1550_nand_parts[] = {
  136. {
  137. .name = "NAND FS 0",
  138. .offset = 0,
  139. .size = 8 * 1024 * 1024,
  140. },
  141. {
  142. .name = "NAND FS 1",
  143. .offset = MTDPART_OFS_APPEND,
  144. .size = MTDPART_SIZ_FULL
  145. },
  146. };
  147. struct platform_nand_data db1550_nand_platdata = {
  148. .chip = {
  149. .nr_chips = 1,
  150. .chip_offset = 0,
  151. .nr_partitions = ARRAY_SIZE(db1550_nand_parts),
  152. .partitions = db1550_nand_parts,
  153. .chip_delay = 20,
  154. },
  155. .ctrl = {
  156. .dev_ready = au1550_nand_device_ready,
  157. .cmd_ctrl = au1550_nand_cmd_ctrl,
  158. },
  159. };
  160. static struct resource db1550_nand_res[] = {
  161. [0] = {
  162. .start = 0x20000000,
  163. .end = 0x200000ff,
  164. .flags = IORESOURCE_MEM,
  165. },
  166. };
  167. static struct platform_device db1550_nand_dev = {
  168. .name = "gen_nand",
  169. .num_resources = ARRAY_SIZE(db1550_nand_res),
  170. .resource = db1550_nand_res,
  171. .id = -1,
  172. .dev = {
  173. .platform_data = &db1550_nand_platdata,
  174. }
  175. };
  176. static struct au1550nd_platdata pb1550_nand_pd = {
  177. .parts = db1550_nand_parts,
  178. .num_parts = ARRAY_SIZE(db1550_nand_parts),
  179. .devwidth = 0, /* x8 NAND default, needs fixing up */
  180. };
  181. static struct platform_device pb1550_nand_dev = {
  182. .name = "au1550-nand",
  183. .id = -1,
  184. .resource = db1550_nand_res,
  185. .num_resources = ARRAY_SIZE(db1550_nand_res),
  186. .dev = {
  187. .platform_data = &pb1550_nand_pd,
  188. },
  189. };
  190. static void __init pb1550_nand_setup(void)
  191. {
  192. int boot_swapboot = (alchemy_rdsmem(AU1000_MEM_STSTAT) & (0x7 << 1)) |
  193. ((bcsr_read(BCSR_STATUS) >> 6) & 0x1);
  194. gpio_direction_input(206); /* de-assert NAND CS# */
  195. switch (boot_swapboot) {
  196. case 0: case 2: case 8: case 0xC: case 0xD:
  197. /* x16 NAND Flash */
  198. pb1550_nand_pd.devwidth = 1;
  199. /* fallthrough */
  200. case 1: case 3: case 9: case 0xE: case 0xF:
  201. /* x8 NAND, already set up */
  202. platform_device_register(&pb1550_nand_dev);
  203. }
  204. }
  205. /**********************************************************************/
  206. static struct resource au1550_psc0_res[] = {
  207. [0] = {
  208. .start = AU1550_PSC0_PHYS_ADDR,
  209. .end = AU1550_PSC0_PHYS_ADDR + 0xfff,
  210. .flags = IORESOURCE_MEM,
  211. },
  212. [1] = {
  213. .start = AU1550_PSC0_INT,
  214. .end = AU1550_PSC0_INT,
  215. .flags = IORESOURCE_IRQ,
  216. },
  217. [2] = {
  218. .start = AU1550_DSCR_CMD0_PSC0_TX,
  219. .end = AU1550_DSCR_CMD0_PSC0_TX,
  220. .flags = IORESOURCE_DMA,
  221. },
  222. [3] = {
  223. .start = AU1550_DSCR_CMD0_PSC0_RX,
  224. .end = AU1550_DSCR_CMD0_PSC0_RX,
  225. .flags = IORESOURCE_DMA,
  226. },
  227. };
  228. static void db1550_spi_cs_en(struct au1550_spi_info *spi, int cs, int pol)
  229. {
  230. if (cs)
  231. bcsr_mod(BCSR_BOARD, 0, BCSR_BOARD_SPISEL);
  232. else
  233. bcsr_mod(BCSR_BOARD, BCSR_BOARD_SPISEL, 0);
  234. }
  235. static struct au1550_spi_info db1550_spi_platdata = {
  236. .mainclk_hz = 48000000, /* PSC0 clock: max. 2.4MHz SPI clk */
  237. .num_chipselect = 2,
  238. .activate_cs = db1550_spi_cs_en,
  239. };
  240. static u64 spi_dmamask = DMA_BIT_MASK(32);
  241. static struct platform_device db1550_spi_dev = {
  242. .dev = {
  243. .dma_mask = &spi_dmamask,
  244. .coherent_dma_mask = DMA_BIT_MASK(32),
  245. .platform_data = &db1550_spi_platdata,
  246. },
  247. .name = "au1550-spi",
  248. .id = 0, /* bus number */
  249. .num_resources = ARRAY_SIZE(au1550_psc0_res),
  250. .resource = au1550_psc0_res,
  251. };
  252. /**********************************************************************/
  253. static struct resource au1550_psc1_res[] = {
  254. [0] = {
  255. .start = AU1550_PSC1_PHYS_ADDR,
  256. .end = AU1550_PSC1_PHYS_ADDR + 0xfff,
  257. .flags = IORESOURCE_MEM,
  258. },
  259. [1] = {
  260. .start = AU1550_PSC1_INT,
  261. .end = AU1550_PSC1_INT,
  262. .flags = IORESOURCE_IRQ,
  263. },
  264. [2] = {
  265. .start = AU1550_DSCR_CMD0_PSC1_TX,
  266. .end = AU1550_DSCR_CMD0_PSC1_TX,
  267. .flags = IORESOURCE_DMA,
  268. },
  269. [3] = {
  270. .start = AU1550_DSCR_CMD0_PSC1_RX,
  271. .end = AU1550_DSCR_CMD0_PSC1_RX,
  272. .flags = IORESOURCE_DMA,
  273. },
  274. };
  275. static struct platform_device db1550_ac97_dev = {
  276. .name = "au1xpsc_ac97",
  277. .id = 1, /* PSC ID */
  278. .num_resources = ARRAY_SIZE(au1550_psc1_res),
  279. .resource = au1550_psc1_res,
  280. };
  281. static struct resource au1550_psc2_res[] = {
  282. [0] = {
  283. .start = AU1550_PSC2_PHYS_ADDR,
  284. .end = AU1550_PSC2_PHYS_ADDR + 0xfff,
  285. .flags = IORESOURCE_MEM,
  286. },
  287. [1] = {
  288. .start = AU1550_PSC2_INT,
  289. .end = AU1550_PSC2_INT,
  290. .flags = IORESOURCE_IRQ,
  291. },
  292. [2] = {
  293. .start = AU1550_DSCR_CMD0_PSC2_TX,
  294. .end = AU1550_DSCR_CMD0_PSC2_TX,
  295. .flags = IORESOURCE_DMA,
  296. },
  297. [3] = {
  298. .start = AU1550_DSCR_CMD0_PSC2_RX,
  299. .end = AU1550_DSCR_CMD0_PSC2_RX,
  300. .flags = IORESOURCE_DMA,
  301. },
  302. };
  303. static struct platform_device db1550_i2c_dev = {
  304. .name = "au1xpsc_smbus",
  305. .id = 0, /* bus number */
  306. .num_resources = ARRAY_SIZE(au1550_psc2_res),
  307. .resource = au1550_psc2_res,
  308. };
  309. /**********************************************************************/
  310. static struct resource au1550_psc3_res[] = {
  311. [0] = {
  312. .start = AU1550_PSC3_PHYS_ADDR,
  313. .end = AU1550_PSC3_PHYS_ADDR + 0xfff,
  314. .flags = IORESOURCE_MEM,
  315. },
  316. [1] = {
  317. .start = AU1550_PSC3_INT,
  318. .end = AU1550_PSC3_INT,
  319. .flags = IORESOURCE_IRQ,
  320. },
  321. [2] = {
  322. .start = AU1550_DSCR_CMD0_PSC3_TX,
  323. .end = AU1550_DSCR_CMD0_PSC3_TX,
  324. .flags = IORESOURCE_DMA,
  325. },
  326. [3] = {
  327. .start = AU1550_DSCR_CMD0_PSC3_RX,
  328. .end = AU1550_DSCR_CMD0_PSC3_RX,
  329. .flags = IORESOURCE_DMA,
  330. },
  331. };
  332. static struct platform_device db1550_i2s_dev = {
  333. .name = "au1xpsc_i2s",
  334. .id = 3, /* PSC ID */
  335. .num_resources = ARRAY_SIZE(au1550_psc3_res),
  336. .resource = au1550_psc3_res,
  337. };
  338. /**********************************************************************/
  339. static struct platform_device db1550_stac_dev = {
  340. .name = "ac97-codec",
  341. .id = 1, /* on PSC1 */
  342. };
  343. static struct platform_device db1550_ac97dma_dev = {
  344. .name = "au1xpsc-pcm",
  345. .id = 1, /* on PSC3 */
  346. };
  347. static struct platform_device db1550_i2sdma_dev = {
  348. .name = "au1xpsc-pcm",
  349. .id = 3, /* on PSC3 */
  350. };
  351. static struct platform_device db1550_sndac97_dev = {
  352. .name = "db1550-ac97",
  353. };
  354. static struct platform_device db1550_sndi2s_dev = {
  355. .name = "db1550-i2s",
  356. };
  357. /**********************************************************************/
  358. static int db1550_map_pci_irq(const struct pci_dev *d, u8 slot, u8 pin)
  359. {
  360. if ((slot < 11) || (slot > 13) || pin == 0)
  361. return -1;
  362. if (slot == 11)
  363. return (pin == 1) ? AU1550_PCI_INTC : 0xff;
  364. if (slot == 12) {
  365. switch (pin) {
  366. case 1: return AU1550_PCI_INTB;
  367. case 2: return AU1550_PCI_INTC;
  368. case 3: return AU1550_PCI_INTD;
  369. case 4: return AU1550_PCI_INTA;
  370. }
  371. }
  372. if (slot == 13) {
  373. switch (pin) {
  374. case 1: return AU1550_PCI_INTA;
  375. case 2: return AU1550_PCI_INTB;
  376. case 3: return AU1550_PCI_INTC;
  377. case 4: return AU1550_PCI_INTD;
  378. }
  379. }
  380. return -1;
  381. }
  382. static int pb1550_map_pci_irq(const struct pci_dev *d, u8 slot, u8 pin)
  383. {
  384. if ((slot < 12) || (slot > 13) || pin == 0)
  385. return -1;
  386. if (slot == 12) {
  387. switch (pin) {
  388. case 1: return AU1500_PCI_INTB;
  389. case 2: return AU1500_PCI_INTC;
  390. case 3: return AU1500_PCI_INTD;
  391. case 4: return AU1500_PCI_INTA;
  392. }
  393. }
  394. if (slot == 13) {
  395. switch (pin) {
  396. case 1: return AU1500_PCI_INTA;
  397. case 2: return AU1500_PCI_INTB;
  398. case 3: return AU1500_PCI_INTC;
  399. case 4: return AU1500_PCI_INTD;
  400. }
  401. }
  402. return -1;
  403. }
  404. static struct resource alchemy_pci_host_res[] = {
  405. [0] = {
  406. .start = AU1500_PCI_PHYS_ADDR,
  407. .end = AU1500_PCI_PHYS_ADDR + 0xfff,
  408. .flags = IORESOURCE_MEM,
  409. },
  410. };
  411. static struct alchemy_pci_platdata db1550_pci_pd = {
  412. .board_map_irq = db1550_map_pci_irq,
  413. };
  414. static struct platform_device db1550_pci_host_dev = {
  415. .dev.platform_data = &db1550_pci_pd,
  416. .name = "alchemy-pci",
  417. .id = 0,
  418. .num_resources = ARRAY_SIZE(alchemy_pci_host_res),
  419. .resource = alchemy_pci_host_res,
  420. };
  421. /**********************************************************************/
  422. static struct platform_device *db1550_devs[] __initdata = {
  423. &db1550_i2c_dev,
  424. &db1550_ac97_dev,
  425. &db1550_spi_dev,
  426. &db1550_i2s_dev,
  427. &db1550_stac_dev,
  428. &db1550_ac97dma_dev,
  429. &db1550_i2sdma_dev,
  430. &db1550_sndac97_dev,
  431. &db1550_sndi2s_dev,
  432. };
  433. /* must be arch_initcall; MIPS PCI scans busses in a subsys_initcall */
  434. int __init db1550_pci_setup(int id)
  435. {
  436. if (id)
  437. db1550_pci_pd.board_map_irq = pb1550_map_pci_irq;
  438. return platform_device_register(&db1550_pci_host_dev);
  439. }
  440. static void __init db1550_devices(void)
  441. {
  442. alchemy_gpio_direction_output(203, 0); /* red led on */
  443. irq_set_irq_type(AU1550_GPIO0_INT, IRQ_TYPE_EDGE_BOTH); /* CD0# */
  444. irq_set_irq_type(AU1550_GPIO1_INT, IRQ_TYPE_EDGE_BOTH); /* CD1# */
  445. irq_set_irq_type(AU1550_GPIO3_INT, IRQ_TYPE_LEVEL_LOW); /* CARD0# */
  446. irq_set_irq_type(AU1550_GPIO5_INT, IRQ_TYPE_LEVEL_LOW); /* CARD1# */
  447. irq_set_irq_type(AU1550_GPIO21_INT, IRQ_TYPE_LEVEL_LOW); /* STSCHG0# */
  448. irq_set_irq_type(AU1550_GPIO22_INT, IRQ_TYPE_LEVEL_LOW); /* STSCHG1# */
  449. db1x_register_pcmcia_socket(
  450. AU1000_PCMCIA_ATTR_PHYS_ADDR,
  451. AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x000400000 - 1,
  452. AU1000_PCMCIA_MEM_PHYS_ADDR,
  453. AU1000_PCMCIA_MEM_PHYS_ADDR + 0x000400000 - 1,
  454. AU1000_PCMCIA_IO_PHYS_ADDR,
  455. AU1000_PCMCIA_IO_PHYS_ADDR + 0x000010000 - 1,
  456. AU1550_GPIO3_INT, AU1550_GPIO0_INT,
  457. /*AU1550_GPIO21_INT*/0, 0, 0);
  458. db1x_register_pcmcia_socket(
  459. AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x004000000,
  460. AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x004400000 - 1,
  461. AU1000_PCMCIA_MEM_PHYS_ADDR + 0x004000000,
  462. AU1000_PCMCIA_MEM_PHYS_ADDR + 0x004400000 - 1,
  463. AU1000_PCMCIA_IO_PHYS_ADDR + 0x004000000,
  464. AU1000_PCMCIA_IO_PHYS_ADDR + 0x004010000 - 1,
  465. AU1550_GPIO5_INT, AU1550_GPIO1_INT,
  466. /*AU1550_GPIO22_INT*/0, 0, 1);
  467. platform_device_register(&db1550_nand_dev);
  468. alchemy_gpio_direction_output(202, 0); /* green led on */
  469. }
  470. static void __init pb1550_devices(void)
  471. {
  472. irq_set_irq_type(AU1550_GPIO0_INT, IRQ_TYPE_LEVEL_LOW);
  473. irq_set_irq_type(AU1550_GPIO1_INT, IRQ_TYPE_LEVEL_LOW);
  474. irq_set_irq_type(AU1550_GPIO201_205_INT, IRQ_TYPE_LEVEL_HIGH);
  475. /* enable both PCMCIA card irqs in the shared line */
  476. alchemy_gpio2_enable_int(201); /* socket 0 card irq */
  477. alchemy_gpio2_enable_int(202); /* socket 1 card irq */
  478. /* Pb1550, like all others, also has statuschange irqs; however they're
  479. * wired up on one of the Au1550's shared GPIO201_205 line, which also
  480. * services the PCMCIA card interrupts. So we ignore statuschange and
  481. * use the GPIO201_205 exclusively for card interrupts, since a) pcmcia
  482. * drivers are used to shared irqs and b) statuschange isn't really use-
  483. * ful anyway.
  484. */
  485. db1x_register_pcmcia_socket(
  486. AU1000_PCMCIA_ATTR_PHYS_ADDR,
  487. AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x000400000 - 1,
  488. AU1000_PCMCIA_MEM_PHYS_ADDR,
  489. AU1000_PCMCIA_MEM_PHYS_ADDR + 0x000400000 - 1,
  490. AU1000_PCMCIA_IO_PHYS_ADDR,
  491. AU1000_PCMCIA_IO_PHYS_ADDR + 0x000010000 - 1,
  492. AU1550_GPIO201_205_INT, AU1550_GPIO0_INT, 0, 0, 0);
  493. db1x_register_pcmcia_socket(
  494. AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x008000000,
  495. AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x008400000 - 1,
  496. AU1000_PCMCIA_MEM_PHYS_ADDR + 0x008000000,
  497. AU1000_PCMCIA_MEM_PHYS_ADDR + 0x008400000 - 1,
  498. AU1000_PCMCIA_IO_PHYS_ADDR + 0x008000000,
  499. AU1000_PCMCIA_IO_PHYS_ADDR + 0x008010000 - 1,
  500. AU1550_GPIO201_205_INT, AU1550_GPIO1_INT, 0, 0, 1);
  501. pb1550_nand_setup();
  502. }
  503. int __init db1550_dev_setup(void)
  504. {
  505. int swapped, id;
  506. struct clk *c;
  507. id = (BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI)) != BCSR_WHOAMI_DB1550);
  508. i2c_register_board_info(0, db1550_i2c_devs,
  509. ARRAY_SIZE(db1550_i2c_devs));
  510. spi_register_board_info(db1550_spi_devs,
  511. ARRAY_SIZE(db1550_i2c_devs));
  512. c = clk_get(NULL, "psc0_intclk");
  513. if (!IS_ERR(c)) {
  514. clk_set_rate(c, 50000000);
  515. clk_prepare_enable(c);
  516. clk_put(c);
  517. }
  518. c = clk_get(NULL, "psc2_intclk");
  519. if (!IS_ERR(c)) {
  520. clk_set_rate(c, db1550_spi_platdata.mainclk_hz);
  521. clk_prepare_enable(c);
  522. clk_put(c);
  523. }
  524. /* Audio PSC clock is supplied by codecs (PSC1, 3) FIXME: platdata!! */
  525. __raw_writel(PSC_SEL_CLK_SERCLK,
  526. (void __iomem *)KSEG1ADDR(AU1550_PSC1_PHYS_ADDR) + PSC_SEL_OFFSET);
  527. wmb();
  528. __raw_writel(PSC_SEL_CLK_SERCLK,
  529. (void __iomem *)KSEG1ADDR(AU1550_PSC3_PHYS_ADDR) + PSC_SEL_OFFSET);
  530. wmb();
  531. /* SPI/I2C use internally supplied 50MHz source */
  532. __raw_writel(PSC_SEL_CLK_INTCLK,
  533. (void __iomem *)KSEG1ADDR(AU1550_PSC0_PHYS_ADDR) + PSC_SEL_OFFSET);
  534. wmb();
  535. __raw_writel(PSC_SEL_CLK_INTCLK,
  536. (void __iomem *)KSEG1ADDR(AU1550_PSC2_PHYS_ADDR) + PSC_SEL_OFFSET);
  537. wmb();
  538. id ? pb1550_devices() : db1550_devices();
  539. swapped = bcsr_read(BCSR_STATUS) &
  540. (id ? BCSR_STATUS_PB1550_SWAPBOOT : BCSR_STATUS_DB1000_SWAPBOOT);
  541. db1x_register_norflash(128 << 20, 4, swapped);
  542. return platform_add_devices(db1550_devs, ARRAY_SIZE(db1550_devs));
  543. }