db1550.c 16 KB

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