mxm8x10.c 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474
  1. /*
  2. * linux/arch/arm/mach-pxa/mxm8x10.c
  3. *
  4. * Support for the Embedian MXM-8x10 Computer on Module
  5. *
  6. * Copyright (C) 2006 Marvell International Ltd.
  7. * Copyright (C) 2009 Embedian Inc.
  8. * Copyright (C) 2009 TMT Services & Supplies (Pty) Ltd.
  9. *
  10. * 2007-09-04: eric miao <eric.y.miao@gmail.com>
  11. * rewrite to align with latest kernel
  12. *
  13. * 2010-01-09: Edwin Peer <epeer@tmtservices.co.za>
  14. * Hennie van der Merwe <hvdmerwe@tmtservices.co.za>
  15. * rework for upstream merge
  16. *
  17. * This program is free software; you can redistribute it and/or modify
  18. * it under the terms of the GNU General Public License version 2 as
  19. * published by the Free Software Foundation.
  20. */
  21. #include <linux/serial_8250.h>
  22. #include <linux/dm9000.h>
  23. #include <linux/gpio.h>
  24. #include <linux/platform_data/i2c-pxa.h>
  25. #include <linux/platform_data/mtd-nand-pxa3xx.h>
  26. #include <linux/platform_data/video-pxafb.h>
  27. #include <linux/platform_data/mmc-pxamci.h>
  28. #include <linux/platform_data/usb-ohci-pxa27x.h>
  29. #include "pxa320.h"
  30. #include "mxm8x10.h"
  31. #include "devices.h"
  32. #include "generic.h"
  33. /* GPIO pin definition
  34. External device stuff - Leave unconfigured for now...
  35. ---------------------
  36. GPIO0 - DREQ (External DMA Request)
  37. GPIO3 - nGCS2 (External Chip Select) Where is nGCS0; nGCS1; nGCS4; nGCS5 ?
  38. GPIO4 - nGCS3
  39. GPIO15 - EXT_GPIO1
  40. GPIO16 - EXT_GPIO2
  41. GPIO17 - EXT_GPIO3
  42. GPIO24 - EXT_GPIO4
  43. GPIO25 - EXT_GPIO5
  44. GPIO26 - EXT_GPIO6
  45. GPIO27 - EXT_GPIO7
  46. GPIO28 - EXT_GPIO8
  47. GPIO29 - EXT_GPIO9
  48. GPIO30 - EXT_GPIO10
  49. GPIO31 - EXT_GPIO11
  50. GPIO57 - EXT_GPIO12
  51. GPIO74 - EXT_IRQ1
  52. GPIO75 - EXT_IRQ2
  53. GPIO76 - EXT_IRQ3
  54. GPIO77 - EXT_IRQ4
  55. GPIO78 - EXT_IRQ5
  56. GPIO79 - EXT_IRQ6
  57. GPIO80 - EXT_IRQ7
  58. GPIO81 - EXT_IRQ8
  59. GPIO87 - VCCIO_PWREN (External Device PWREN)
  60. Dallas 1-Wire - Leave unconfigured for now...
  61. -------------
  62. GPIO0_2 - DS - 1Wire
  63. Ethernet
  64. --------
  65. GPIO1 - DM9000 PWR
  66. GPIO9 - DM9K_nIRQ
  67. GPIO36 - DM9K_RESET
  68. Keypad - Leave unconfigured by for now...
  69. ------
  70. GPIO1_2 - KP_DKIN0
  71. GPIO5_2 - KP_MKOUT7
  72. GPIO82 - KP_DKIN1
  73. GPIO85 - KP_DKIN2
  74. GPIO86 - KP_DKIN3
  75. GPIO113 - KP_MKIN0
  76. GPIO114 - KP_MKIN1
  77. GPIO115 - KP_MKIN2
  78. GPIO116 - KP_MKIN3
  79. GPIO117 - KP_MKIN4
  80. GPIO118 - KP_MKIN5
  81. GPIO119 - KP_MKIN6
  82. GPIO120 - KP_MKIN7
  83. GPIO121 - KP_MKOUT0
  84. GPIO122 - KP_MKOUT1
  85. GPIO122 - KP_MKOUT2
  86. GPIO123 - KP_MKOUT3
  87. GPIO124 - KP_MKOUT4
  88. GPIO125 - KP_MKOUT5
  89. GPIO127 - KP_MKOUT6
  90. Data Bus - Leave unconfigured for now...
  91. --------
  92. GPIO2 - nWait (Data Bus)
  93. USB Device
  94. ----------
  95. GPIO4_2 - USBD_PULLUP
  96. GPIO10 - UTM_CLK (USB Device UTM Clk)
  97. GPIO49 - USB 2.0 Device UTM_DATA0
  98. GPIO50 - USB 2.0 Device UTM_DATA1
  99. GPIO51 - USB 2.0 Device UTM_DATA2
  100. GPIO52 - USB 2.0 Device UTM_DATA3
  101. GPIO53 - USB 2.0 Device UTM_DATA4
  102. GPIO54 - USB 2.0 Device UTM_DATA5
  103. GPIO55 - USB 2.0 Device UTM_DATA6
  104. GPIO56 - USB 2.0 Device UTM_DATA7
  105. GPIO58 - UTM_RXVALID (USB 2.0 Device)
  106. GPIO59 - UTM_RXACTIVE (USB 2.0 Device)
  107. GPIO60 - UTM_RXERROR
  108. GPIO61 - UTM_OPMODE0
  109. GPIO62 - UTM_OPMODE1
  110. GPIO71 - USBD_INT (USB Device?)
  111. GPIO73 - UTM_TXREADY (USB 2.0 Device)
  112. GPIO83 - UTM_TXVALID (USB 2.0 Device)
  113. GPIO98 - UTM_RESET (USB 2.0 device)
  114. GPIO99 - UTM_XCVR_SELECT
  115. GPIO100 - UTM_TERM_SELECT
  116. GPIO101 - UTM_SUSPENDM_X
  117. GPIO102 - UTM_LINESTATE0
  118. GPIO103 - UTM_LINESTATE1
  119. Card-Bus Interface - Leave unconfigured for now...
  120. ------------------
  121. GPIO5 - nPIOR (I/O space output enable)
  122. GPIO6 - nPIOW (I/O space write enable)
  123. GPIO7 - nIOS16 (Input from I/O space telling size of data bus)
  124. GPIO8 - nPWAIT (Input for inserting wait states)
  125. LCD
  126. ---
  127. GPIO6_2 - LDD0
  128. GPIO7_2 - LDD1
  129. GPIO8_2 - LDD2
  130. GPIO9_2 - LDD3
  131. GPIO11_2 - LDD5
  132. GPIO12_2 - LDD6
  133. GPIO13_2 - LDD7
  134. GPIO14_2 - VSYNC
  135. GPIO15_2 - HSYNC
  136. GPIO16_2 - VCLK
  137. GPIO17_2 - HCLK
  138. GPIO18_2 - VDEN
  139. GPIO63 - LDD8 (CPU LCD)
  140. GPIO64 - LDD9 (CPU LCD)
  141. GPIO65 - LDD10 (CPU LCD)
  142. GPIO66 - LDD11 (CPU LCD)
  143. GPIO67 - LDD12 (CPU LCD)
  144. GPIO68 - LDD13 (CPU LCD)
  145. GPIO69 - LDD14 (CPU LCD)
  146. GPIO70 - LDD15 (CPU LCD)
  147. GPIO88 - VCCLCD_PWREN (LCD Panel PWREN)
  148. GPIO97 - BACKLIGHT_EN
  149. GPIO104 - LCD_PWREN
  150. PWM - Leave unconfigured for now...
  151. ---
  152. GPIO11 - PWM0
  153. GPIO12 - PWM1
  154. GPIO13 - PWM2
  155. GPIO14 - PWM3
  156. SD-CARD
  157. -------
  158. GPIO18 - SDDATA0
  159. GPIO19 - SDDATA1
  160. GPIO20 - SDDATA2
  161. GPIO21 - SDDATA3
  162. GPIO22 - SDCLK
  163. GPIO23 - SDCMD
  164. GPIO72 - SD_WP
  165. GPIO84 - SD_nIRQ_CD (SD-Card)
  166. I2C
  167. ---
  168. GPIO32 - I2CSCL
  169. GPIO33 - I2CSDA
  170. AC97
  171. ----
  172. GPIO35 - AC97_SDATA_IN
  173. GPIO37 - AC97_SDATA_OUT
  174. GPIO38 - AC97_SYNC
  175. GPIO39 - AC97_BITCLK
  176. GPIO40 - AC97_nRESET
  177. UART1
  178. -----
  179. GPIO41 - UART_RXD1
  180. GPIO42 - UART_TXD1
  181. GPIO43 - UART_CTS1
  182. GPIO44 - UART_DCD1
  183. GPIO45 - UART_DSR1
  184. GPIO46 - UART_nRI1
  185. GPIO47 - UART_DTR1
  186. GPIO48 - UART_RTS1
  187. UART2
  188. -----
  189. GPIO109 - RTS2
  190. GPIO110 - RXD2
  191. GPIO111 - TXD2
  192. GPIO112 - nCTS2
  193. UART3
  194. -----
  195. GPIO105 - nCTS3
  196. GPIO106 - nRTS3
  197. GPIO107 - TXD3
  198. GPIO108 - RXD3
  199. SSP3 - Leave unconfigured for now...
  200. ----
  201. GPIO89 - SSP3_CLK
  202. GPIO90 - SSP3_SFRM
  203. GPIO91 - SSP3_TXD
  204. GPIO92 - SSP3_RXD
  205. SSP4
  206. GPIO93 - SSP4_CLK
  207. GPIO94 - SSP4_SFRM
  208. GPIO95 - SSP4_TXD
  209. GPIO96 - SSP4_RXD
  210. */
  211. static mfp_cfg_t mfp_cfg[] __initdata = {
  212. /* USB */
  213. GPIO10_UTM_CLK,
  214. GPIO49_U2D_PHYDATA_0,
  215. GPIO50_U2D_PHYDATA_1,
  216. GPIO51_U2D_PHYDATA_2,
  217. GPIO52_U2D_PHYDATA_3,
  218. GPIO53_U2D_PHYDATA_4,
  219. GPIO54_U2D_PHYDATA_5,
  220. GPIO55_U2D_PHYDATA_6,
  221. GPIO56_U2D_PHYDATA_7,
  222. GPIO58_UTM_RXVALID,
  223. GPIO59_UTM_RXACTIVE,
  224. GPIO60_U2D_RXERROR,
  225. GPIO61_U2D_OPMODE0,
  226. GPIO62_U2D_OPMODE1,
  227. GPIO71_GPIO, /* USBD_INT */
  228. GPIO73_UTM_TXREADY,
  229. GPIO83_U2D_TXVALID,
  230. GPIO98_U2D_RESET,
  231. GPIO99_U2D_XCVR_SEL,
  232. GPIO100_U2D_TERM_SEL,
  233. GPIO101_U2D_SUSPEND,
  234. GPIO102_UTM_LINESTATE_0,
  235. GPIO103_UTM_LINESTATE_1,
  236. GPIO4_2_GPIO | MFP_PULL_HIGH, /* UTM_PULLUP */
  237. /* DM9000 */
  238. GPIO1_GPIO,
  239. GPIO9_GPIO,
  240. GPIO36_GPIO,
  241. /* AC97 */
  242. GPIO35_AC97_SDATA_IN_0,
  243. GPIO37_AC97_SDATA_OUT,
  244. GPIO38_AC97_SYNC,
  245. GPIO39_AC97_BITCLK,
  246. GPIO40_AC97_nACRESET,
  247. /* UARTS */
  248. GPIO41_UART1_RXD,
  249. GPIO42_UART1_TXD,
  250. GPIO43_UART1_CTS,
  251. GPIO44_UART1_DCD,
  252. GPIO45_UART1_DSR,
  253. GPIO46_UART1_RI,
  254. GPIO47_UART1_DTR,
  255. GPIO48_UART1_RTS,
  256. GPIO109_UART2_RTS,
  257. GPIO110_UART2_RXD,
  258. GPIO111_UART2_TXD,
  259. GPIO112_UART2_CTS,
  260. GPIO105_UART3_CTS,
  261. GPIO106_UART3_RTS,
  262. GPIO107_UART3_TXD,
  263. GPIO108_UART3_RXD,
  264. GPIO78_GPIO,
  265. GPIO79_GPIO,
  266. GPIO80_GPIO,
  267. GPIO81_GPIO,
  268. /* I2C */
  269. GPIO32_I2C_SCL,
  270. GPIO33_I2C_SDA,
  271. /* MMC */
  272. GPIO18_MMC1_DAT0,
  273. GPIO19_MMC1_DAT1,
  274. GPIO20_MMC1_DAT2,
  275. GPIO21_MMC1_DAT3,
  276. GPIO22_MMC1_CLK,
  277. GPIO23_MMC1_CMD,
  278. GPIO72_GPIO | MFP_PULL_HIGH, /* Card Detect */
  279. GPIO84_GPIO | MFP_PULL_LOW, /* Write Protect */
  280. /* IRQ */
  281. GPIO74_GPIO | MFP_LPM_EDGE_RISE, /* EXT_IRQ1 */
  282. GPIO75_GPIO | MFP_LPM_EDGE_RISE, /* EXT_IRQ2 */
  283. GPIO76_GPIO | MFP_LPM_EDGE_RISE, /* EXT_IRQ3 */
  284. GPIO77_GPIO | MFP_LPM_EDGE_RISE, /* EXT_IRQ4 */
  285. GPIO78_GPIO | MFP_LPM_EDGE_RISE, /* EXT_IRQ5 */
  286. GPIO79_GPIO | MFP_LPM_EDGE_RISE, /* EXT_IRQ6 */
  287. GPIO80_GPIO | MFP_LPM_EDGE_RISE, /* EXT_IRQ7 */
  288. GPIO81_GPIO | MFP_LPM_EDGE_RISE /* EXT_IRQ8 */
  289. };
  290. /* MMC/MCI Support */
  291. #if defined(CONFIG_MMC)
  292. static struct pxamci_platform_data mxm_8x10_mci_platform_data = {
  293. .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
  294. .detect_delay_ms = 10,
  295. .gpio_card_detect = MXM_8X10_SD_nCD,
  296. .gpio_card_ro = MXM_8X10_SD_WP,
  297. .gpio_power = -1
  298. };
  299. void __init mxm_8x10_mmc_init(void)
  300. {
  301. pxa_set_mci_info(&mxm_8x10_mci_platform_data);
  302. }
  303. #endif
  304. /* USB Open Host Controller Interface */
  305. static struct pxaohci_platform_data mxm_8x10_ohci_platform_data = {
  306. .port_mode = PMM_NPS_MODE,
  307. .flags = ENABLE_PORT_ALL
  308. };
  309. void __init mxm_8x10_usb_host_init(void)
  310. {
  311. pxa_set_ohci_info(&mxm_8x10_ohci_platform_data);
  312. }
  313. /* AC97 Sound Support */
  314. static struct platform_device mxm_8x10_ac97_device = {
  315. .name = "pxa2xx-ac97"
  316. };
  317. void __init mxm_8x10_ac97_init(void)
  318. {
  319. platform_device_register(&mxm_8x10_ac97_device);
  320. }
  321. /* NAND flash Support */
  322. #if IS_ENABLED(CONFIG_MTD_NAND_MARVELL)
  323. #define NAND_BLOCK_SIZE SZ_128K
  324. #define NB(x) (NAND_BLOCK_SIZE * (x))
  325. static struct mtd_partition mxm_8x10_nand_partitions[] = {
  326. [0] = {
  327. .name = "boot",
  328. .size = NB(0x002),
  329. .offset = NB(0x000),
  330. .mask_flags = MTD_WRITEABLE
  331. },
  332. [1] = {
  333. .name = "kernel",
  334. .size = NB(0x010),
  335. .offset = NB(0x002),
  336. .mask_flags = MTD_WRITEABLE
  337. },
  338. [2] = {
  339. .name = "root",
  340. .size = NB(0x36c),
  341. .offset = NB(0x012)
  342. },
  343. [3] = {
  344. .name = "bbt",
  345. .size = NB(0x082),
  346. .offset = NB(0x37e),
  347. .mask_flags = MTD_WRITEABLE
  348. }
  349. };
  350. static struct pxa3xx_nand_platform_data mxm_8x10_nand_info = {
  351. .keep_config = 1,
  352. .parts = mxm_8x10_nand_partitions,
  353. .nr_parts = ARRAY_SIZE(mxm_8x10_nand_partitions)
  354. };
  355. static void __init mxm_8x10_nand_init(void)
  356. {
  357. pxa3xx_set_nand_info(&mxm_8x10_nand_info);
  358. }
  359. #else
  360. static inline void mxm_8x10_nand_init(void) {}
  361. #endif /* IS_ENABLED(CONFIG_MTD_NAND_MARVELL) */
  362. /* Ethernet support: Davicom DM9000 */
  363. static struct resource dm9k_resources[] = {
  364. [0] = {
  365. .start = MXM_8X10_ETH_PHYS + 0x300,
  366. .end = MXM_8X10_ETH_PHYS + 0x300,
  367. .flags = IORESOURCE_MEM
  368. },
  369. [1] = {
  370. .start = MXM_8X10_ETH_PHYS + 0x308,
  371. .end = MXM_8X10_ETH_PHYS + 0x308,
  372. .flags = IORESOURCE_MEM
  373. },
  374. [2] = {
  375. .start = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO9)),
  376. .end = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO9)),
  377. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE
  378. }
  379. };
  380. static struct dm9000_plat_data dm9k_plat_data = {
  381. .flags = DM9000_PLATF_16BITONLY
  382. };
  383. static struct platform_device dm9k_device = {
  384. .name = "dm9000",
  385. .id = 0,
  386. .num_resources = ARRAY_SIZE(dm9k_resources),
  387. .resource = dm9k_resources,
  388. .dev = {
  389. .platform_data = &dm9k_plat_data
  390. }
  391. };
  392. static void __init mxm_8x10_ethernet_init(void)
  393. {
  394. platform_device_register(&dm9k_device);
  395. }
  396. /* PXA UARTs */
  397. static void __init mxm_8x10_uarts_init(void)
  398. {
  399. pxa_set_ffuart_info(NULL);
  400. pxa_set_btuart_info(NULL);
  401. pxa_set_stuart_info(NULL);
  402. }
  403. /* I2C and Real Time Clock */
  404. static struct i2c_board_info __initdata mxm_8x10_i2c_devices[] = {
  405. {
  406. I2C_BOARD_INFO("ds1337", 0x68)
  407. }
  408. };
  409. static void __init mxm_8x10_i2c_init(void)
  410. {
  411. i2c_register_board_info(0, mxm_8x10_i2c_devices,
  412. ARRAY_SIZE(mxm_8x10_i2c_devices));
  413. pxa_set_i2c_info(NULL);
  414. }
  415. void __init mxm_8x10_barebones_init(void)
  416. {
  417. pxa3xx_mfp_config(ARRAY_AND_SIZE(mfp_cfg));
  418. mxm_8x10_uarts_init();
  419. mxm_8x10_nand_init();
  420. mxm_8x10_i2c_init();
  421. mxm_8x10_ethernet_init();
  422. }