zeus.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820
  1. /*
  2. * Support for the Arcom ZEUS.
  3. *
  4. * Copyright (C) 2006 Arcom Control Systems Ltd.
  5. *
  6. * Loosely based on Arcom's 2.6.16.28.
  7. * Maintained by Marc Zyngier <maz@misterjones.org>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. */
  13. #include <linux/cpufreq.h>
  14. #include <linux/interrupt.h>
  15. #include <linux/irq.h>
  16. #include <linux/pm.h>
  17. #include <linux/gpio.h>
  18. #include <linux/serial_8250.h>
  19. #include <linux/dm9000.h>
  20. #include <linux/mmc/host.h>
  21. #include <linux/spi/spi.h>
  22. #include <linux/mtd/mtd.h>
  23. #include <linux/mtd/partitions.h>
  24. #include <linux/mtd/physmap.h>
  25. #include <linux/i2c.h>
  26. #include <linux/i2c/pca953x.h>
  27. #include <asm/mach-types.h>
  28. #include <asm/mach/arch.h>
  29. #include <asm/mach/map.h>
  30. #include <plat/i2c.h>
  31. #include <mach/pxa2xx-regs.h>
  32. #include <mach/regs-uart.h>
  33. #include <mach/ohci.h>
  34. #include <mach/mmc.h>
  35. #include <mach/pxa27x-udc.h>
  36. #include <mach/udc.h>
  37. #include <mach/pxafb.h>
  38. #include <mach/pxa2xx_spi.h>
  39. #include <mach/mfp-pxa27x.h>
  40. #include <mach/pm.h>
  41. #include <mach/audio.h>
  42. #include <mach/arcom-pcmcia.h>
  43. #include <mach/zeus.h>
  44. #include "generic.h"
  45. /*
  46. * Interrupt handling
  47. */
  48. static unsigned long zeus_irq_enabled_mask;
  49. static const int zeus_isa_irqs[] = { 3, 4, 5, 6, 7, 10, 11, 12, };
  50. static const int zeus_isa_irq_map[] = {
  51. 0, /* ISA irq #0, invalid */
  52. 0, /* ISA irq #1, invalid */
  53. 0, /* ISA irq #2, invalid */
  54. 1 << 0, /* ISA irq #3 */
  55. 1 << 1, /* ISA irq #4 */
  56. 1 << 2, /* ISA irq #5 */
  57. 1 << 3, /* ISA irq #6 */
  58. 1 << 4, /* ISA irq #7 */
  59. 0, /* ISA irq #8, invalid */
  60. 0, /* ISA irq #9, invalid */
  61. 1 << 5, /* ISA irq #10 */
  62. 1 << 6, /* ISA irq #11 */
  63. 1 << 7, /* ISA irq #12 */
  64. };
  65. static inline int zeus_irq_to_bitmask(unsigned int irq)
  66. {
  67. return zeus_isa_irq_map[irq - PXA_ISA_IRQ(0)];
  68. }
  69. static inline int zeus_bit_to_irq(int bit)
  70. {
  71. return zeus_isa_irqs[bit] + PXA_ISA_IRQ(0);
  72. }
  73. static void zeus_ack_irq(unsigned int irq)
  74. {
  75. __raw_writew(zeus_irq_to_bitmask(irq), ZEUS_CPLD_ISA_IRQ);
  76. }
  77. static void zeus_mask_irq(unsigned int irq)
  78. {
  79. zeus_irq_enabled_mask &= ~(zeus_irq_to_bitmask(irq));
  80. }
  81. static void zeus_unmask_irq(unsigned int irq)
  82. {
  83. zeus_irq_enabled_mask |= zeus_irq_to_bitmask(irq);
  84. }
  85. static inline unsigned long zeus_irq_pending(void)
  86. {
  87. return __raw_readw(ZEUS_CPLD_ISA_IRQ) & zeus_irq_enabled_mask;
  88. }
  89. static void zeus_irq_handler(unsigned int irq, struct irq_desc *desc)
  90. {
  91. unsigned long pending;
  92. pending = zeus_irq_pending();
  93. do {
  94. /* we're in a chained irq handler,
  95. * so ack the interrupt by hand */
  96. desc->chip->ack(gpio_to_irq(ZEUS_ISA_GPIO));
  97. if (likely(pending)) {
  98. irq = zeus_bit_to_irq(__ffs(pending));
  99. generic_handle_irq(irq);
  100. }
  101. pending = zeus_irq_pending();
  102. } while (pending);
  103. }
  104. static struct irq_chip zeus_irq_chip = {
  105. .name = "ISA",
  106. .ack = zeus_ack_irq,
  107. .mask = zeus_mask_irq,
  108. .unmask = zeus_unmask_irq,
  109. };
  110. static void __init zeus_init_irq(void)
  111. {
  112. int level;
  113. int isa_irq;
  114. pxa27x_init_irq();
  115. /* Peripheral IRQs. It would be nice to move those inside driver
  116. configuration, but it is not supported at the moment. */
  117. set_irq_type(gpio_to_irq(ZEUS_AC97_GPIO), IRQ_TYPE_EDGE_RISING);
  118. set_irq_type(gpio_to_irq(ZEUS_WAKEUP_GPIO), IRQ_TYPE_EDGE_RISING);
  119. set_irq_type(gpio_to_irq(ZEUS_PTT_GPIO), IRQ_TYPE_EDGE_RISING);
  120. set_irq_type(gpio_to_irq(ZEUS_EXTGPIO_GPIO), IRQ_TYPE_EDGE_FALLING);
  121. set_irq_type(gpio_to_irq(ZEUS_CAN_GPIO), IRQ_TYPE_EDGE_FALLING);
  122. /* Setup ISA IRQs */
  123. for (level = 0; level < ARRAY_SIZE(zeus_isa_irqs); level++) {
  124. isa_irq = zeus_bit_to_irq(level);
  125. set_irq_chip(isa_irq, &zeus_irq_chip);
  126. set_irq_handler(isa_irq, handle_edge_irq);
  127. set_irq_flags(isa_irq, IRQF_VALID | IRQF_PROBE);
  128. }
  129. set_irq_type(gpio_to_irq(ZEUS_ISA_GPIO), IRQ_TYPE_EDGE_RISING);
  130. set_irq_chained_handler(gpio_to_irq(ZEUS_ISA_GPIO), zeus_irq_handler);
  131. }
  132. /*
  133. * Platform devices
  134. */
  135. /* Flash */
  136. static struct resource zeus_mtd_resources[] = {
  137. [0] = { /* NOR Flash (up to 64MB) */
  138. .start = ZEUS_FLASH_PHYS,
  139. .end = ZEUS_FLASH_PHYS + SZ_64M - 1,
  140. .flags = IORESOURCE_MEM,
  141. },
  142. [1] = { /* SRAM */
  143. .start = ZEUS_SRAM_PHYS,
  144. .end = ZEUS_SRAM_PHYS + SZ_512K - 1,
  145. .flags = IORESOURCE_MEM,
  146. },
  147. };
  148. static struct physmap_flash_data zeus_flash_data[] = {
  149. [0] = {
  150. .width = 2,
  151. .parts = NULL,
  152. .nr_parts = 0,
  153. },
  154. };
  155. static struct platform_device zeus_mtd_devices[] = {
  156. [0] = {
  157. .name = "physmap-flash",
  158. .id = 0,
  159. .dev = {
  160. .platform_data = &zeus_flash_data[0],
  161. },
  162. .resource = &zeus_mtd_resources[0],
  163. .num_resources = 1,
  164. },
  165. };
  166. /* Serial */
  167. static struct resource zeus_serial_resources[] = {
  168. {
  169. .start = 0x10000000,
  170. .end = 0x1000000f,
  171. .flags = IORESOURCE_MEM,
  172. },
  173. {
  174. .start = 0x10800000,
  175. .end = 0x1080000f,
  176. .flags = IORESOURCE_MEM,
  177. },
  178. {
  179. .start = 0x11000000,
  180. .end = 0x1100000f,
  181. .flags = IORESOURCE_MEM,
  182. },
  183. {
  184. .start = 0x40100000,
  185. .end = 0x4010001f,
  186. .flags = IORESOURCE_MEM,
  187. },
  188. {
  189. .start = 0x40200000,
  190. .end = 0x4020001f,
  191. .flags = IORESOURCE_MEM,
  192. },
  193. {
  194. .start = 0x40700000,
  195. .end = 0x4070001f,
  196. .flags = IORESOURCE_MEM,
  197. },
  198. };
  199. static struct plat_serial8250_port serial_platform_data[] = {
  200. /* External UARTs */
  201. /* FIXME: Shared IRQs on COM1-COM4 will not work properly on v1i1 hardware. */
  202. { /* COM1 */
  203. .mapbase = 0x10000000,
  204. .irq = gpio_to_irq(ZEUS_UARTA_GPIO),
  205. .irqflags = IRQF_TRIGGER_RISING,
  206. .uartclk = 14745600,
  207. .regshift = 1,
  208. .flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
  209. .iotype = UPIO_MEM,
  210. },
  211. { /* COM2 */
  212. .mapbase = 0x10800000,
  213. .irq = gpio_to_irq(ZEUS_UARTB_GPIO),
  214. .irqflags = IRQF_TRIGGER_RISING,
  215. .uartclk = 14745600,
  216. .regshift = 1,
  217. .flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
  218. .iotype = UPIO_MEM,
  219. },
  220. { /* COM3 */
  221. .mapbase = 0x11000000,
  222. .irq = gpio_to_irq(ZEUS_UARTC_GPIO),
  223. .irqflags = IRQF_TRIGGER_RISING,
  224. .uartclk = 14745600,
  225. .regshift = 1,
  226. .flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
  227. .iotype = UPIO_MEM,
  228. },
  229. { /* COM4 */
  230. .mapbase = 0x11800000,
  231. .irq = gpio_to_irq(ZEUS_UARTD_GPIO),
  232. .irqflags = IRQF_TRIGGER_RISING,
  233. .uartclk = 14745600,
  234. .regshift = 1,
  235. .flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
  236. .iotype = UPIO_MEM,
  237. },
  238. /* Internal UARTs */
  239. { /* FFUART */
  240. .membase = (void *)&FFUART,
  241. .mapbase = __PREG(FFUART),
  242. .irq = IRQ_FFUART,
  243. .uartclk = 921600 * 16,
  244. .regshift = 2,
  245. .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
  246. .iotype = UPIO_MEM,
  247. },
  248. { /* BTUART */
  249. .membase = (void *)&BTUART,
  250. .mapbase = __PREG(BTUART),
  251. .irq = IRQ_BTUART,
  252. .uartclk = 921600 * 16,
  253. .regshift = 2,
  254. .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
  255. .iotype = UPIO_MEM,
  256. },
  257. { /* STUART */
  258. .membase = (void *)&STUART,
  259. .mapbase = __PREG(STUART),
  260. .irq = IRQ_STUART,
  261. .uartclk = 921600 * 16,
  262. .regshift = 2,
  263. .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
  264. .iotype = UPIO_MEM,
  265. },
  266. { },
  267. };
  268. static struct platform_device zeus_serial_device = {
  269. .name = "serial8250",
  270. .id = PLAT8250_DEV_PLATFORM,
  271. .dev = {
  272. .platform_data = serial_platform_data,
  273. },
  274. .num_resources = ARRAY_SIZE(zeus_serial_resources),
  275. .resource = zeus_serial_resources,
  276. };
  277. /* Ethernet */
  278. static struct resource zeus_dm9k0_resource[] = {
  279. [0] = {
  280. .start = ZEUS_ETH0_PHYS,
  281. .end = ZEUS_ETH0_PHYS + 1,
  282. .flags = IORESOURCE_MEM
  283. },
  284. [1] = {
  285. .start = ZEUS_ETH0_PHYS + 2,
  286. .end = ZEUS_ETH0_PHYS + 3,
  287. .flags = IORESOURCE_MEM
  288. },
  289. [2] = {
  290. .start = gpio_to_irq(ZEUS_ETH0_GPIO),
  291. .end = gpio_to_irq(ZEUS_ETH0_GPIO),
  292. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
  293. },
  294. };
  295. static struct resource zeus_dm9k1_resource[] = {
  296. [0] = {
  297. .start = ZEUS_ETH1_PHYS,
  298. .end = ZEUS_ETH1_PHYS + 1,
  299. .flags = IORESOURCE_MEM
  300. },
  301. [1] = {
  302. .start = ZEUS_ETH1_PHYS + 2,
  303. .end = ZEUS_ETH1_PHYS + 3,
  304. .flags = IORESOURCE_MEM,
  305. },
  306. [2] = {
  307. .start = gpio_to_irq(ZEUS_ETH1_GPIO),
  308. .end = gpio_to_irq(ZEUS_ETH1_GPIO),
  309. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
  310. },
  311. };
  312. static struct dm9000_plat_data zeus_dm9k_platdata = {
  313. .flags = DM9000_PLATF_16BITONLY,
  314. };
  315. static struct platform_device zeus_dm9k0_device = {
  316. .name = "dm9000",
  317. .id = 0,
  318. .num_resources = ARRAY_SIZE(zeus_dm9k0_resource),
  319. .resource = zeus_dm9k0_resource,
  320. .dev = {
  321. .platform_data = &zeus_dm9k_platdata,
  322. }
  323. };
  324. static struct platform_device zeus_dm9k1_device = {
  325. .name = "dm9000",
  326. .id = 1,
  327. .num_resources = ARRAY_SIZE(zeus_dm9k1_resource),
  328. .resource = zeus_dm9k1_resource,
  329. .dev = {
  330. .platform_data = &zeus_dm9k_platdata,
  331. }
  332. };
  333. /* External SRAM */
  334. static struct resource zeus_sram_resource = {
  335. .start = ZEUS_SRAM_PHYS,
  336. .end = ZEUS_SRAM_PHYS + ZEUS_SRAM_SIZE * 2 - 1,
  337. .flags = IORESOURCE_MEM,
  338. };
  339. static struct platform_device zeus_sram_device = {
  340. .name = "pxa2xx-8bit-sram",
  341. .id = 0,
  342. .num_resources = 1,
  343. .resource = &zeus_sram_resource,
  344. };
  345. /* SPI interface on SSP3 */
  346. static struct pxa2xx_spi_master pxa2xx_spi_ssp3_master_info = {
  347. .num_chipselect = 1,
  348. .enable_dma = 1,
  349. };
  350. static struct platform_device pxa2xx_spi_ssp3_device = {
  351. .name = "pxa2xx-spi",
  352. .id = 3,
  353. .dev = {
  354. .platform_data = &pxa2xx_spi_ssp3_master_info,
  355. },
  356. };
  357. /* Leds */
  358. static struct gpio_led zeus_leds[] = {
  359. [0] = {
  360. .name = "zeus:yellow:1",
  361. .default_trigger = "heartbeat",
  362. .gpio = ZEUS_EXT0_GPIO(3),
  363. .active_low = 1,
  364. },
  365. [1] = {
  366. .name = "zeus:yellow:2",
  367. .default_trigger = "default-on",
  368. .gpio = ZEUS_EXT0_GPIO(4),
  369. .active_low = 1,
  370. },
  371. [2] = {
  372. .name = "zeus:yellow:3",
  373. .default_trigger = "default-on",
  374. .gpio = ZEUS_EXT0_GPIO(5),
  375. .active_low = 1,
  376. },
  377. };
  378. static struct gpio_led_platform_data zeus_leds_info = {
  379. .leds = zeus_leds,
  380. .num_leds = ARRAY_SIZE(zeus_leds),
  381. };
  382. static struct platform_device zeus_leds_device = {
  383. .name = "leds-gpio",
  384. .id = -1,
  385. .dev = {
  386. .platform_data = &zeus_leds_info,
  387. },
  388. };
  389. static void zeus_cf_reset(int state)
  390. {
  391. u16 cpld_state = __raw_readw(ZEUS_CPLD_CONTROL);
  392. if (state)
  393. cpld_state |= ZEUS_CPLD_CONTROL_CF_RST;
  394. else
  395. cpld_state &= ~ZEUS_CPLD_CONTROL_CF_RST;
  396. __raw_writew(cpld_state, ZEUS_CPLD_CONTROL);
  397. }
  398. static struct arcom_pcmcia_pdata zeus_pcmcia_info = {
  399. .cd_gpio = ZEUS_CF_CD_GPIO,
  400. .rdy_gpio = ZEUS_CF_RDY_GPIO,
  401. .pwr_gpio = ZEUS_CF_PWEN_GPIO,
  402. .reset = zeus_cf_reset,
  403. };
  404. static struct platform_device zeus_pcmcia_device = {
  405. .name = "zeus-pcmcia",
  406. .id = -1,
  407. .dev = {
  408. .platform_data = &zeus_pcmcia_info,
  409. },
  410. };
  411. static struct platform_device *zeus_devices[] __initdata = {
  412. &zeus_serial_device,
  413. &zeus_mtd_devices[0],
  414. &zeus_dm9k0_device,
  415. &zeus_dm9k1_device,
  416. &zeus_sram_device,
  417. &pxa2xx_spi_ssp3_device,
  418. &zeus_leds_device,
  419. &zeus_pcmcia_device,
  420. };
  421. /* AC'97 */
  422. static pxa2xx_audio_ops_t zeus_ac97_info = {
  423. .reset_gpio = 95,
  424. };
  425. /*
  426. * USB host
  427. */
  428. static int zeus_ohci_init(struct device *dev)
  429. {
  430. int err;
  431. /* Switch on port 2. */
  432. if ((err = gpio_request(ZEUS_USB2_PWREN_GPIO, "USB2_PWREN"))) {
  433. dev_err(dev, "Can't request USB2_PWREN\n");
  434. return err;
  435. }
  436. if ((err = gpio_direction_output(ZEUS_USB2_PWREN_GPIO, 1))) {
  437. gpio_free(ZEUS_USB2_PWREN_GPIO);
  438. dev_err(dev, "Can't enable USB2_PWREN\n");
  439. return err;
  440. }
  441. /* Port 2 is shared between host and client interface. */
  442. UP2OCR = UP2OCR_HXOE | UP2OCR_HXS | UP2OCR_DMPDE | UP2OCR_DPPDE;
  443. return 0;
  444. }
  445. static void zeus_ohci_exit(struct device *dev)
  446. {
  447. /* Power-off port 2 */
  448. gpio_direction_output(ZEUS_USB2_PWREN_GPIO, 0);
  449. gpio_free(ZEUS_USB2_PWREN_GPIO);
  450. }
  451. static struct pxaohci_platform_data zeus_ohci_platform_data = {
  452. .port_mode = PMM_NPS_MODE,
  453. .flags = ENABLE_PORT_ALL | POWER_CONTROL_LOW | POWER_SENSE_LOW,
  454. .init = zeus_ohci_init,
  455. .exit = zeus_ohci_exit,
  456. };
  457. /*
  458. * Flat Panel
  459. */
  460. static void zeus_lcd_power(int on, struct fb_var_screeninfo *si)
  461. {
  462. gpio_set_value(ZEUS_LCD_EN_GPIO, on);
  463. }
  464. static void zeus_backlight_power(int on)
  465. {
  466. gpio_set_value(ZEUS_BKLEN_GPIO, on);
  467. }
  468. static int zeus_setup_fb_gpios(void)
  469. {
  470. int err;
  471. if ((err = gpio_request(ZEUS_LCD_EN_GPIO, "LCD_EN")))
  472. goto out_err;
  473. if ((err = gpio_direction_output(ZEUS_LCD_EN_GPIO, 0)))
  474. goto out_err_lcd;
  475. if ((err = gpio_request(ZEUS_BKLEN_GPIO, "BKLEN")))
  476. goto out_err_lcd;
  477. if ((err = gpio_direction_output(ZEUS_BKLEN_GPIO, 0)))
  478. goto out_err_bkl;
  479. return 0;
  480. out_err_bkl:
  481. gpio_free(ZEUS_BKLEN_GPIO);
  482. out_err_lcd:
  483. gpio_free(ZEUS_LCD_EN_GPIO);
  484. out_err:
  485. return err;
  486. }
  487. static struct pxafb_mode_info zeus_fb_mode_info[] = {
  488. {
  489. .pixclock = 39722,
  490. .xres = 640,
  491. .yres = 480,
  492. .bpp = 16,
  493. .hsync_len = 63,
  494. .left_margin = 16,
  495. .right_margin = 81,
  496. .vsync_len = 2,
  497. .upper_margin = 12,
  498. .lower_margin = 31,
  499. .sync = 0,
  500. },
  501. };
  502. static struct pxafb_mach_info zeus_fb_info = {
  503. .modes = zeus_fb_mode_info,
  504. .num_modes = 1,
  505. .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
  506. .pxafb_lcd_power = zeus_lcd_power,
  507. .pxafb_backlight_power = zeus_backlight_power,
  508. };
  509. /*
  510. * MMC/SD Device
  511. *
  512. * The card detect interrupt isn't debounced so we delay it by 250ms
  513. * to give the card a chance to fully insert/eject.
  514. */
  515. static struct pxamci_platform_data zeus_mci_platform_data = {
  516. .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
  517. .detect_delay = HZ/4,
  518. .gpio_card_detect = ZEUS_MMC_CD_GPIO,
  519. .gpio_card_ro = ZEUS_MMC_WP_GPIO,
  520. .gpio_card_ro_invert = 1,
  521. .gpio_power = -1
  522. };
  523. /*
  524. * USB Device Controller
  525. */
  526. static void zeus_udc_command(int cmd)
  527. {
  528. switch (cmd) {
  529. case PXA2XX_UDC_CMD_DISCONNECT:
  530. pr_info("zeus: disconnecting USB client\n");
  531. UP2OCR = UP2OCR_HXOE | UP2OCR_HXS | UP2OCR_DMPDE | UP2OCR_DPPDE;
  532. break;
  533. case PXA2XX_UDC_CMD_CONNECT:
  534. pr_info("zeus: connecting USB client\n");
  535. UP2OCR = UP2OCR_HXOE | UP2OCR_DPPUE;
  536. break;
  537. }
  538. }
  539. static struct pxa2xx_udc_mach_info zeus_udc_info = {
  540. .udc_command = zeus_udc_command,
  541. };
  542. static void zeus_power_off(void)
  543. {
  544. local_irq_disable();
  545. pxa27x_cpu_suspend(PWRMODE_DEEPSLEEP);
  546. }
  547. int zeus_get_pcb_info(struct i2c_client *client, unsigned gpio,
  548. unsigned ngpio, void *context)
  549. {
  550. int i;
  551. u8 pcb_info = 0;
  552. for (i = 0; i < 8; i++) {
  553. int pcb_bit = gpio + i + 8;
  554. if (gpio_request(pcb_bit, "pcb info")) {
  555. dev_err(&client->dev, "Can't request pcb info %d\n", i);
  556. continue;
  557. }
  558. if (gpio_direction_input(pcb_bit)) {
  559. dev_err(&client->dev, "Can't read pcb info %d\n", i);
  560. gpio_free(pcb_bit);
  561. continue;
  562. }
  563. pcb_info |= !!gpio_get_value(pcb_bit) << i;
  564. gpio_free(pcb_bit);
  565. }
  566. dev_info(&client->dev, "Zeus PCB version %d issue %d\n",
  567. pcb_info >> 4, pcb_info & 0xf);
  568. return 0;
  569. }
  570. static struct pca953x_platform_data zeus_pca953x_pdata[] = {
  571. [0] = { .gpio_base = ZEUS_EXT0_GPIO_BASE, },
  572. [1] = {
  573. .gpio_base = ZEUS_EXT1_GPIO_BASE,
  574. .setup = zeus_get_pcb_info,
  575. },
  576. [2] = { .gpio_base = ZEUS_USER_GPIO_BASE, },
  577. };
  578. static struct i2c_board_info __initdata zeus_i2c_devices[] = {
  579. {
  580. I2C_BOARD_INFO("pca9535", 0x21),
  581. .platform_data = &zeus_pca953x_pdata[0],
  582. },
  583. {
  584. I2C_BOARD_INFO("pca9535", 0x22),
  585. .platform_data = &zeus_pca953x_pdata[1],
  586. },
  587. {
  588. I2C_BOARD_INFO("pca9535", 0x20),
  589. .platform_data = &zeus_pca953x_pdata[2],
  590. .irq = gpio_to_irq(ZEUS_EXTGPIO_GPIO),
  591. },
  592. { I2C_BOARD_INFO("lm75a", 0x48) },
  593. { I2C_BOARD_INFO("24c01", 0x50) },
  594. { I2C_BOARD_INFO("isl1208", 0x6f) },
  595. };
  596. static mfp_cfg_t zeus_pin_config[] __initdata = {
  597. GPIO15_nCS_1,
  598. GPIO78_nCS_2,
  599. GPIO80_nCS_4,
  600. GPIO33_nCS_5,
  601. GPIO22_GPIO,
  602. GPIO32_MMC_CLK,
  603. GPIO92_MMC_DAT_0,
  604. GPIO109_MMC_DAT_1,
  605. GPIO110_MMC_DAT_2,
  606. GPIO111_MMC_DAT_3,
  607. GPIO112_MMC_CMD,
  608. GPIO88_USBH1_PWR,
  609. GPIO89_USBH1_PEN,
  610. GPIO119_USBH2_PWR,
  611. GPIO120_USBH2_PEN,
  612. GPIO86_LCD_LDD_16,
  613. GPIO87_LCD_LDD_17,
  614. GPIO102_GPIO,
  615. GPIO104_CIF_DD_2,
  616. GPIO105_CIF_DD_1,
  617. GPIO48_nPOE,
  618. GPIO49_nPWE,
  619. GPIO50_nPIOR,
  620. GPIO51_nPIOW,
  621. GPIO85_nPCE_1,
  622. GPIO54_nPCE_2,
  623. GPIO79_PSKTSEL,
  624. GPIO55_nPREG,
  625. GPIO56_nPWAIT,
  626. GPIO57_nIOIS16,
  627. GPIO36_GPIO, /* CF CD */
  628. GPIO97_GPIO, /* CF PWREN */
  629. GPIO99_GPIO, /* CF RDY */
  630. };
  631. static void __init zeus_init(void)
  632. {
  633. u16 dm9000_msc = 0xe279;
  634. system_rev = __raw_readw(ZEUS_CPLD_VERSION);
  635. pr_info("Zeus CPLD V%dI%d\n", (system_rev & 0xf0) >> 4, (system_rev & 0x0f));
  636. /* Fix timings for dm9000s (CS1/CS2)*/
  637. MSC0 = (MSC0 & 0xffff) | (dm9000_msc << 16);
  638. MSC1 = (MSC1 & 0xffff0000) | dm9000_msc;
  639. pm_power_off = zeus_power_off;
  640. pxa2xx_mfp_config(ARRAY_AND_SIZE(zeus_pin_config));
  641. platform_add_devices(zeus_devices, ARRAY_SIZE(zeus_devices));
  642. pxa_set_ohci_info(&zeus_ohci_platform_data);
  643. if (zeus_setup_fb_gpios())
  644. pr_err("Failed to setup fb gpios\n");
  645. else
  646. set_pxa_fb_info(&zeus_fb_info);
  647. pxa_set_mci_info(&zeus_mci_platform_data);
  648. pxa_set_udc_info(&zeus_udc_info);
  649. pxa_set_ac97_info(&zeus_ac97_info);
  650. pxa_set_i2c_info(NULL);
  651. i2c_register_board_info(0, ARRAY_AND_SIZE(zeus_i2c_devices));
  652. }
  653. static struct map_desc zeus_io_desc[] __initdata = {
  654. {
  655. .virtual = ZEUS_CPLD_VERSION,
  656. .pfn = __phys_to_pfn(ZEUS_CPLD_VERSION_PHYS),
  657. .length = 0x1000,
  658. .type = MT_DEVICE,
  659. },
  660. {
  661. .virtual = ZEUS_CPLD_ISA_IRQ,
  662. .pfn = __phys_to_pfn(ZEUS_CPLD_ISA_IRQ_PHYS),
  663. .length = 0x1000,
  664. .type = MT_DEVICE,
  665. },
  666. {
  667. .virtual = ZEUS_CPLD_CONTROL,
  668. .pfn = __phys_to_pfn(ZEUS_CPLD_CONTROL_PHYS),
  669. .length = 0x1000,
  670. .type = MT_DEVICE,
  671. },
  672. {
  673. .virtual = ZEUS_CPLD_EXTWDOG,
  674. .pfn = __phys_to_pfn(ZEUS_CPLD_EXTWDOG_PHYS),
  675. .length = 0x1000,
  676. .type = MT_DEVICE,
  677. },
  678. {
  679. .virtual = ZEUS_PC104IO,
  680. .pfn = __phys_to_pfn(ZEUS_PC104IO_PHYS),
  681. .length = 0x00800000,
  682. .type = MT_DEVICE,
  683. },
  684. };
  685. static void __init zeus_map_io(void)
  686. {
  687. pxa_map_io();
  688. iotable_init(zeus_io_desc, ARRAY_SIZE(zeus_io_desc));
  689. /* Clear PSPR to ensure a full restart on wake-up. */
  690. PMCR = PSPR = 0;
  691. /* enable internal 32.768Khz oscillator (ignore OSCC_OOK) */
  692. OSCC |= OSCC_OON;
  693. /* Some clock cycles later (from OSCC_ON), programme PCFR (OPDE...).
  694. * float chip selects and PCMCIA */
  695. PCFR = PCFR_OPDE | PCFR_DC_EN | PCFR_FS | PCFR_FP;
  696. }
  697. MACHINE_START(ARCOM_ZEUS, "Arcom ZEUS")
  698. /* Maintainer: Marc Zyngier <maz@misterjones.org> */
  699. .phys_io = 0x40000000,
  700. .io_pg_offst = ((io_p2v(0x40000000) >> 18) & 0xfffc),
  701. .boot_params = 0xa0000100,
  702. .map_io = zeus_map_io,
  703. .init_irq = zeus_init_irq,
  704. .timer = &pxa_timer,
  705. .init_machine = zeus_init,
  706. MACHINE_END