db1000.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617
  1. /*
  2. * DBAu1000/1500/1100 PBAu1100/1500 board support
  3. *
  4. * Copyright 2000, 2008 MontaVista Software Inc.
  5. * Author: MontaVista Software, Inc. <source@mvista.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. #include <linux/clk.h>
  22. #include <linux/dma-mapping.h>
  23. #include <linux/gpio.h>
  24. #include <linux/init.h>
  25. #include <linux/interrupt.h>
  26. #include <linux/leds.h>
  27. #include <linux/mmc/host.h>
  28. #include <linux/module.h>
  29. #include <linux/platform_device.h>
  30. #include <linux/pm.h>
  31. #include <linux/spi/spi.h>
  32. #include <linux/spi/spi_gpio.h>
  33. #include <linux/spi/ads7846.h>
  34. #include <asm/mach-au1x00/au1000.h>
  35. #include <asm/mach-au1x00/au1000_dma.h>
  36. #include <asm/mach-au1x00/au1100_mmc.h>
  37. #include <asm/mach-db1x00/bcsr.h>
  38. #include <asm/reboot.h>
  39. #include <prom.h>
  40. #include "platform.h"
  41. #define F_SWAPPED (bcsr_read(BCSR_STATUS) & BCSR_STATUS_DB1000_SWAPBOOT)
  42. const char *get_system_type(void);
  43. int __init db1000_board_setup(void)
  44. {
  45. /* initialize board register space */
  46. bcsr_init(DB1000_BCSR_PHYS_ADDR,
  47. DB1000_BCSR_PHYS_ADDR + DB1000_BCSR_HEXLED_OFS);
  48. switch (BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI))) {
  49. case BCSR_WHOAMI_DB1000:
  50. case BCSR_WHOAMI_DB1500:
  51. case BCSR_WHOAMI_DB1100:
  52. case BCSR_WHOAMI_PB1500:
  53. case BCSR_WHOAMI_PB1500R2:
  54. case BCSR_WHOAMI_PB1100:
  55. pr_info("AMD Alchemy %s Board\n", get_system_type());
  56. return 0;
  57. }
  58. return -ENODEV;
  59. }
  60. static int db1500_map_pci_irq(const struct pci_dev *d, u8 slot, u8 pin)
  61. {
  62. if ((slot < 12) || (slot > 13) || pin == 0)
  63. return -1;
  64. if (slot == 12)
  65. return (pin == 1) ? AU1500_PCI_INTA : 0xff;
  66. if (slot == 13) {
  67. switch (pin) {
  68. case 1: return AU1500_PCI_INTA;
  69. case 2: return AU1500_PCI_INTB;
  70. case 3: return AU1500_PCI_INTC;
  71. case 4: return AU1500_PCI_INTD;
  72. }
  73. }
  74. return -1;
  75. }
  76. static struct resource alchemy_pci_host_res[] = {
  77. [0] = {
  78. .start = AU1500_PCI_PHYS_ADDR,
  79. .end = AU1500_PCI_PHYS_ADDR + 0xfff,
  80. .flags = IORESOURCE_MEM,
  81. },
  82. };
  83. static struct alchemy_pci_platdata db1500_pci_pd = {
  84. .board_map_irq = db1500_map_pci_irq,
  85. };
  86. static struct platform_device db1500_pci_host_dev = {
  87. .dev.platform_data = &db1500_pci_pd,
  88. .name = "alchemy-pci",
  89. .id = 0,
  90. .num_resources = ARRAY_SIZE(alchemy_pci_host_res),
  91. .resource = alchemy_pci_host_res,
  92. };
  93. int __init db1500_pci_setup(void)
  94. {
  95. return platform_device_register(&db1500_pci_host_dev);
  96. }
  97. static struct resource au1100_lcd_resources[] = {
  98. [0] = {
  99. .start = AU1100_LCD_PHYS_ADDR,
  100. .end = AU1100_LCD_PHYS_ADDR + 0x800 - 1,
  101. .flags = IORESOURCE_MEM,
  102. },
  103. [1] = {
  104. .start = AU1100_LCD_INT,
  105. .end = AU1100_LCD_INT,
  106. .flags = IORESOURCE_IRQ,
  107. }
  108. };
  109. static u64 au1100_lcd_dmamask = DMA_BIT_MASK(32);
  110. static struct platform_device au1100_lcd_device = {
  111. .name = "au1100-lcd",
  112. .id = 0,
  113. .dev = {
  114. .dma_mask = &au1100_lcd_dmamask,
  115. .coherent_dma_mask = DMA_BIT_MASK(32),
  116. },
  117. .num_resources = ARRAY_SIZE(au1100_lcd_resources),
  118. .resource = au1100_lcd_resources,
  119. };
  120. static struct resource alchemy_ac97c_res[] = {
  121. [0] = {
  122. .start = AU1000_AC97_PHYS_ADDR,
  123. .end = AU1000_AC97_PHYS_ADDR + 0xfff,
  124. .flags = IORESOURCE_MEM,
  125. },
  126. [1] = {
  127. .start = DMA_ID_AC97C_TX,
  128. .end = DMA_ID_AC97C_TX,
  129. .flags = IORESOURCE_DMA,
  130. },
  131. [2] = {
  132. .start = DMA_ID_AC97C_RX,
  133. .end = DMA_ID_AC97C_RX,
  134. .flags = IORESOURCE_DMA,
  135. },
  136. };
  137. static struct platform_device alchemy_ac97c_dev = {
  138. .name = "alchemy-ac97c",
  139. .id = -1,
  140. .resource = alchemy_ac97c_res,
  141. .num_resources = ARRAY_SIZE(alchemy_ac97c_res),
  142. };
  143. static struct platform_device alchemy_ac97c_dma_dev = {
  144. .name = "alchemy-pcm-dma",
  145. .id = 0,
  146. };
  147. static struct platform_device db1x00_codec_dev = {
  148. .name = "ac97-codec",
  149. .id = -1,
  150. };
  151. static struct platform_device db1x00_audio_dev = {
  152. .name = "db1000-audio",
  153. };
  154. /******************************************************************************/
  155. static irqreturn_t db1100_mmc_cd(int irq, void *ptr)
  156. {
  157. void (*mmc_cd)(struct mmc_host *, unsigned long);
  158. /* link against CONFIG_MMC=m */
  159. mmc_cd = symbol_get(mmc_detect_change);
  160. mmc_cd(ptr, msecs_to_jiffies(500));
  161. symbol_put(mmc_detect_change);
  162. return IRQ_HANDLED;
  163. }
  164. static int db1100_mmc_cd_setup(void *mmc_host, int en)
  165. {
  166. int ret = 0, irq;
  167. if (BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI)) == BCSR_WHOAMI_DB1100)
  168. irq = AU1100_GPIO19_INT;
  169. else
  170. irq = AU1100_GPIO14_INT; /* PB1100 SD0 CD# */
  171. if (en) {
  172. irq_set_irq_type(irq, IRQ_TYPE_EDGE_BOTH);
  173. ret = request_irq(irq, db1100_mmc_cd, 0,
  174. "sd0_cd", mmc_host);
  175. } else
  176. free_irq(irq, mmc_host);
  177. return ret;
  178. }
  179. static int db1100_mmc1_cd_setup(void *mmc_host, int en)
  180. {
  181. int ret = 0, irq;
  182. if (BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI)) == BCSR_WHOAMI_DB1100)
  183. irq = AU1100_GPIO20_INT;
  184. else
  185. irq = AU1100_GPIO15_INT; /* PB1100 SD1 CD# */
  186. if (en) {
  187. irq_set_irq_type(irq, IRQ_TYPE_EDGE_BOTH);
  188. ret = request_irq(irq, db1100_mmc_cd, 0,
  189. "sd1_cd", mmc_host);
  190. } else
  191. free_irq(irq, mmc_host);
  192. return ret;
  193. }
  194. static int db1100_mmc_card_readonly(void *mmc_host)
  195. {
  196. /* testing suggests that this bit is inverted */
  197. return (bcsr_read(BCSR_STATUS) & BCSR_STATUS_SD0WP) ? 0 : 1;
  198. }
  199. static int db1100_mmc_card_inserted(void *mmc_host)
  200. {
  201. return !alchemy_gpio_get_value(19);
  202. }
  203. static void db1100_mmc_set_power(void *mmc_host, int state)
  204. {
  205. int bit;
  206. if (BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI)) == BCSR_WHOAMI_DB1100)
  207. bit = BCSR_BOARD_SD0PWR;
  208. else
  209. bit = BCSR_BOARD_PB1100_SD0PWR;
  210. if (state) {
  211. bcsr_mod(BCSR_BOARD, 0, bit);
  212. msleep(400); /* stabilization time */
  213. } else
  214. bcsr_mod(BCSR_BOARD, bit, 0);
  215. }
  216. static void db1100_mmcled_set(struct led_classdev *led, enum led_brightness b)
  217. {
  218. if (b != LED_OFF)
  219. bcsr_mod(BCSR_LEDS, BCSR_LEDS_LED0, 0);
  220. else
  221. bcsr_mod(BCSR_LEDS, 0, BCSR_LEDS_LED0);
  222. }
  223. static struct led_classdev db1100_mmc_led = {
  224. .brightness_set = db1100_mmcled_set,
  225. };
  226. static int db1100_mmc1_card_readonly(void *mmc_host)
  227. {
  228. return (bcsr_read(BCSR_BOARD) & BCSR_BOARD_SD1WP) ? 1 : 0;
  229. }
  230. static int db1100_mmc1_card_inserted(void *mmc_host)
  231. {
  232. return !alchemy_gpio_get_value(20);
  233. }
  234. static void db1100_mmc1_set_power(void *mmc_host, int state)
  235. {
  236. int bit;
  237. if (BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI)) == BCSR_WHOAMI_DB1100)
  238. bit = BCSR_BOARD_SD1PWR;
  239. else
  240. bit = BCSR_BOARD_PB1100_SD1PWR;
  241. if (state) {
  242. bcsr_mod(BCSR_BOARD, 0, bit);
  243. msleep(400); /* stabilization time */
  244. } else
  245. bcsr_mod(BCSR_BOARD, bit, 0);
  246. }
  247. static void db1100_mmc1led_set(struct led_classdev *led, enum led_brightness b)
  248. {
  249. if (b != LED_OFF)
  250. bcsr_mod(BCSR_LEDS, BCSR_LEDS_LED1, 0);
  251. else
  252. bcsr_mod(BCSR_LEDS, 0, BCSR_LEDS_LED1);
  253. }
  254. static struct led_classdev db1100_mmc1_led = {
  255. .brightness_set = db1100_mmc1led_set,
  256. };
  257. static struct au1xmmc_platform_data db1100_mmc_platdata[2] = {
  258. [0] = {
  259. .cd_setup = db1100_mmc_cd_setup,
  260. .set_power = db1100_mmc_set_power,
  261. .card_inserted = db1100_mmc_card_inserted,
  262. .card_readonly = db1100_mmc_card_readonly,
  263. .led = &db1100_mmc_led,
  264. },
  265. [1] = {
  266. .cd_setup = db1100_mmc1_cd_setup,
  267. .set_power = db1100_mmc1_set_power,
  268. .card_inserted = db1100_mmc1_card_inserted,
  269. .card_readonly = db1100_mmc1_card_readonly,
  270. .led = &db1100_mmc1_led,
  271. },
  272. };
  273. static struct resource au1100_mmc0_resources[] = {
  274. [0] = {
  275. .start = AU1100_SD0_PHYS_ADDR,
  276. .end = AU1100_SD0_PHYS_ADDR + 0xfff,
  277. .flags = IORESOURCE_MEM,
  278. },
  279. [1] = {
  280. .start = AU1100_SD_INT,
  281. .end = AU1100_SD_INT,
  282. .flags = IORESOURCE_IRQ,
  283. },
  284. [2] = {
  285. .start = DMA_ID_SD0_TX,
  286. .end = DMA_ID_SD0_TX,
  287. .flags = IORESOURCE_DMA,
  288. },
  289. [3] = {
  290. .start = DMA_ID_SD0_RX,
  291. .end = DMA_ID_SD0_RX,
  292. .flags = IORESOURCE_DMA,
  293. }
  294. };
  295. static u64 au1xxx_mmc_dmamask = DMA_BIT_MASK(32);
  296. static struct platform_device db1100_mmc0_dev = {
  297. .name = "au1xxx-mmc",
  298. .id = 0,
  299. .dev = {
  300. .dma_mask = &au1xxx_mmc_dmamask,
  301. .coherent_dma_mask = DMA_BIT_MASK(32),
  302. .platform_data = &db1100_mmc_platdata[0],
  303. },
  304. .num_resources = ARRAY_SIZE(au1100_mmc0_resources),
  305. .resource = au1100_mmc0_resources,
  306. };
  307. static struct resource au1100_mmc1_res[] = {
  308. [0] = {
  309. .start = AU1100_SD1_PHYS_ADDR,
  310. .end = AU1100_SD1_PHYS_ADDR + 0xfff,
  311. .flags = IORESOURCE_MEM,
  312. },
  313. [1] = {
  314. .start = AU1100_SD_INT,
  315. .end = AU1100_SD_INT,
  316. .flags = IORESOURCE_IRQ,
  317. },
  318. [2] = {
  319. .start = DMA_ID_SD1_TX,
  320. .end = DMA_ID_SD1_TX,
  321. .flags = IORESOURCE_DMA,
  322. },
  323. [3] = {
  324. .start = DMA_ID_SD1_RX,
  325. .end = DMA_ID_SD1_RX,
  326. .flags = IORESOURCE_DMA,
  327. }
  328. };
  329. static struct platform_device db1100_mmc1_dev = {
  330. .name = "au1xxx-mmc",
  331. .id = 1,
  332. .dev = {
  333. .dma_mask = &au1xxx_mmc_dmamask,
  334. .coherent_dma_mask = DMA_BIT_MASK(32),
  335. .platform_data = &db1100_mmc_platdata[1],
  336. },
  337. .num_resources = ARRAY_SIZE(au1100_mmc1_res),
  338. .resource = au1100_mmc1_res,
  339. };
  340. /******************************************************************************/
  341. static void db1000_irda_set_phy_mode(int mode)
  342. {
  343. unsigned short mask = BCSR_RESETS_IRDA_MODE_MASK | BCSR_RESETS_FIR_SEL;
  344. switch (mode) {
  345. case AU1000_IRDA_PHY_MODE_OFF:
  346. bcsr_mod(BCSR_RESETS, mask, BCSR_RESETS_IRDA_MODE_OFF);
  347. break;
  348. case AU1000_IRDA_PHY_MODE_SIR:
  349. bcsr_mod(BCSR_RESETS, mask, BCSR_RESETS_IRDA_MODE_FULL);
  350. break;
  351. case AU1000_IRDA_PHY_MODE_FIR:
  352. bcsr_mod(BCSR_RESETS, mask, BCSR_RESETS_IRDA_MODE_FULL |
  353. BCSR_RESETS_FIR_SEL);
  354. break;
  355. }
  356. }
  357. static struct au1k_irda_platform_data db1000_irda_platdata = {
  358. .set_phy_mode = db1000_irda_set_phy_mode,
  359. };
  360. static struct resource au1000_irda_res[] = {
  361. [0] = {
  362. .start = AU1000_IRDA_PHYS_ADDR,
  363. .end = AU1000_IRDA_PHYS_ADDR + 0x0fff,
  364. .flags = IORESOURCE_MEM,
  365. },
  366. [1] = {
  367. .start = AU1000_IRDA_TX_INT,
  368. .end = AU1000_IRDA_TX_INT,
  369. .flags = IORESOURCE_IRQ,
  370. },
  371. [2] = {
  372. .start = AU1000_IRDA_RX_INT,
  373. .end = AU1000_IRDA_RX_INT,
  374. .flags = IORESOURCE_IRQ,
  375. },
  376. };
  377. static struct platform_device db1000_irda_dev = {
  378. .name = "au1000-irda",
  379. .id = -1,
  380. .dev = {
  381. .platform_data = &db1000_irda_platdata,
  382. },
  383. .resource = au1000_irda_res,
  384. .num_resources = ARRAY_SIZE(au1000_irda_res),
  385. };
  386. /******************************************************************************/
  387. static struct ads7846_platform_data db1100_touch_pd = {
  388. .model = 7846,
  389. .vref_mv = 3300,
  390. .gpio_pendown = 21,
  391. };
  392. static struct spi_gpio_platform_data db1100_spictl_pd = {
  393. .sck = 209,
  394. .mosi = 208,
  395. .miso = 207,
  396. .num_chipselect = 1,
  397. };
  398. static struct spi_board_info db1100_spi_info[] __initdata = {
  399. [0] = {
  400. .modalias = "ads7846",
  401. .max_speed_hz = 3250000,
  402. .bus_num = 0,
  403. .chip_select = 0,
  404. .mode = 0,
  405. .irq = AU1100_GPIO21_INT,
  406. .platform_data = &db1100_touch_pd,
  407. .controller_data = (void *)210, /* for spi_gpio: CS# GPIO210 */
  408. },
  409. };
  410. static struct platform_device db1100_spi_dev = {
  411. .name = "spi_gpio",
  412. .id = 0,
  413. .dev = {
  414. .platform_data = &db1100_spictl_pd,
  415. },
  416. };
  417. static struct platform_device *db1x00_devs[] = {
  418. &db1x00_codec_dev,
  419. &alchemy_ac97c_dma_dev,
  420. &alchemy_ac97c_dev,
  421. &db1x00_audio_dev,
  422. };
  423. static struct platform_device *db1000_devs[] = {
  424. &db1000_irda_dev,
  425. };
  426. static struct platform_device *db1100_devs[] = {
  427. &au1100_lcd_device,
  428. &db1100_mmc0_dev,
  429. &db1100_mmc1_dev,
  430. &db1000_irda_dev,
  431. };
  432. int __init db1000_dev_setup(void)
  433. {
  434. int board = BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI));
  435. int c0, c1, d0, d1, s0, s1, flashsize = 32, twosocks = 1;
  436. unsigned long pfc;
  437. struct clk *c, *p;
  438. if (board == BCSR_WHOAMI_DB1500) {
  439. c0 = AU1500_GPIO2_INT;
  440. c1 = AU1500_GPIO5_INT;
  441. d0 = AU1500_GPIO0_INT;
  442. d1 = AU1500_GPIO3_INT;
  443. s0 = AU1500_GPIO1_INT;
  444. s1 = AU1500_GPIO4_INT;
  445. } else if (board == BCSR_WHOAMI_DB1100) {
  446. c0 = AU1100_GPIO2_INT;
  447. c1 = AU1100_GPIO5_INT;
  448. d0 = AU1100_GPIO0_INT;
  449. d1 = AU1100_GPIO3_INT;
  450. s0 = AU1100_GPIO1_INT;
  451. s1 = AU1100_GPIO4_INT;
  452. gpio_request(19, "sd0_cd");
  453. gpio_request(20, "sd1_cd");
  454. gpio_direction_input(19); /* sd0 cd# */
  455. gpio_direction_input(20); /* sd1 cd# */
  456. /* spi_gpio on SSI0 pins */
  457. pfc = alchemy_rdsys(AU1000_SYS_PINFUNC);
  458. pfc |= (1 << 0); /* SSI0 pins as GPIOs */
  459. alchemy_wrsys(pfc, AU1000_SYS_PINFUNC);
  460. spi_register_board_info(db1100_spi_info,
  461. ARRAY_SIZE(db1100_spi_info));
  462. /* link LCD clock to AUXPLL */
  463. p = clk_get(NULL, "auxpll_clk");
  464. c = clk_get(NULL, "lcd_intclk");
  465. if (!IS_ERR(c) && !IS_ERR(p)) {
  466. clk_set_parent(c, p);
  467. clk_set_rate(c, clk_get_rate(p));
  468. }
  469. if (!IS_ERR(c))
  470. clk_put(c);
  471. if (!IS_ERR(p))
  472. clk_put(p);
  473. platform_add_devices(db1100_devs, ARRAY_SIZE(db1100_devs));
  474. platform_device_register(&db1100_spi_dev);
  475. } else if (board == BCSR_WHOAMI_DB1000) {
  476. c0 = AU1000_GPIO2_INT;
  477. c1 = AU1000_GPIO5_INT;
  478. d0 = AU1000_GPIO0_INT;
  479. d1 = AU1000_GPIO3_INT;
  480. s0 = AU1000_GPIO1_INT;
  481. s1 = AU1000_GPIO4_INT;
  482. platform_add_devices(db1000_devs, ARRAY_SIZE(db1000_devs));
  483. } else if ((board == BCSR_WHOAMI_PB1500) ||
  484. (board == BCSR_WHOAMI_PB1500R2)) {
  485. c0 = AU1500_GPIO203_INT;
  486. d0 = AU1500_GPIO201_INT;
  487. s0 = AU1500_GPIO202_INT;
  488. twosocks = 0;
  489. flashsize = 64;
  490. /* RTC and daughtercard irqs */
  491. irq_set_irq_type(AU1500_GPIO204_INT, IRQ_TYPE_LEVEL_LOW);
  492. irq_set_irq_type(AU1500_GPIO205_INT, IRQ_TYPE_LEVEL_LOW);
  493. /* EPSON S1D13806 0x1b000000
  494. * SRAM 1MB/2MB 0x1a000000
  495. * DS1693 RTC 0x0c000000
  496. */
  497. } else if (board == BCSR_WHOAMI_PB1100) {
  498. c0 = AU1100_GPIO11_INT;
  499. d0 = AU1100_GPIO9_INT;
  500. s0 = AU1100_GPIO10_INT;
  501. twosocks = 0;
  502. flashsize = 64;
  503. /* pendown, rtc, daughtercard irqs */
  504. irq_set_irq_type(AU1100_GPIO8_INT, IRQ_TYPE_LEVEL_LOW);
  505. irq_set_irq_type(AU1100_GPIO12_INT, IRQ_TYPE_LEVEL_LOW);
  506. irq_set_irq_type(AU1100_GPIO13_INT, IRQ_TYPE_LEVEL_LOW);
  507. /* EPSON S1D13806 0x1b000000
  508. * SRAM 1MB/2MB 0x1a000000
  509. * DiskOnChip 0x0d000000
  510. * DS1693 RTC 0x0c000000
  511. */
  512. platform_add_devices(db1100_devs, ARRAY_SIZE(db1100_devs));
  513. } else
  514. return 0; /* unknown board, no further dev setup to do */
  515. irq_set_irq_type(d0, IRQ_TYPE_EDGE_BOTH);
  516. irq_set_irq_type(c0, IRQ_TYPE_LEVEL_LOW);
  517. irq_set_irq_type(s0, IRQ_TYPE_LEVEL_LOW);
  518. db1x_register_pcmcia_socket(
  519. AU1000_PCMCIA_ATTR_PHYS_ADDR,
  520. AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x000400000 - 1,
  521. AU1000_PCMCIA_MEM_PHYS_ADDR,
  522. AU1000_PCMCIA_MEM_PHYS_ADDR + 0x000400000 - 1,
  523. AU1000_PCMCIA_IO_PHYS_ADDR,
  524. AU1000_PCMCIA_IO_PHYS_ADDR + 0x000010000 - 1,
  525. c0, d0, /*s0*/0, 0, 0);
  526. if (twosocks) {
  527. irq_set_irq_type(d1, IRQ_TYPE_EDGE_BOTH);
  528. irq_set_irq_type(c1, IRQ_TYPE_LEVEL_LOW);
  529. irq_set_irq_type(s1, IRQ_TYPE_LEVEL_LOW);
  530. db1x_register_pcmcia_socket(
  531. AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x004000000,
  532. AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x004400000 - 1,
  533. AU1000_PCMCIA_MEM_PHYS_ADDR + 0x004000000,
  534. AU1000_PCMCIA_MEM_PHYS_ADDR + 0x004400000 - 1,
  535. AU1000_PCMCIA_IO_PHYS_ADDR + 0x004000000,
  536. AU1000_PCMCIA_IO_PHYS_ADDR + 0x004010000 - 1,
  537. c1, d1, /*s1*/0, 0, 1);
  538. }
  539. platform_add_devices(db1x00_devs, ARRAY_SIZE(db1x00_devs));
  540. db1x_register_norflash(flashsize << 20, 4 /* 32bit */, F_SWAPPED);
  541. return 0;
  542. }