platform.c 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. /*
  2. * Copyright (C) 2009-2010, Lars-Peter Clausen <lars@metafoo.de>
  3. * JZ4740 platform devices
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of the GNU General Public License as published by the
  7. * Free Software Foundation; either version 2 of the License, or (at your
  8. * option) any later version.
  9. *
  10. * You should have received a copy of the GNU General Public License along
  11. * with this program; if not, write to the Free Software Foundation, Inc.,
  12. * 675 Mass Ave, Cambridge, MA 02139, USA.
  13. *
  14. */
  15. #include <linux/clk.h>
  16. #include <linux/device.h>
  17. #include <linux/kernel.h>
  18. #include <linux/platform_device.h>
  19. #include <linux/resource.h>
  20. #include <linux/dma-mapping.h>
  21. #include <linux/usb/musb.h>
  22. #include <asm/mach-jz4740/platform.h>
  23. #include <asm/mach-jz4740/base.h>
  24. #include <asm/mach-jz4740/irq.h>
  25. #include <linux/serial_core.h>
  26. #include <linux/serial_8250.h>
  27. #include "clock.h"
  28. /* OHCI controller */
  29. static struct resource jz4740_usb_ohci_resources[] = {
  30. {
  31. .start = JZ4740_UHC_BASE_ADDR,
  32. .end = JZ4740_UHC_BASE_ADDR + 0x1000 - 1,
  33. .flags = IORESOURCE_MEM,
  34. },
  35. {
  36. .start = JZ4740_IRQ_UHC,
  37. .end = JZ4740_IRQ_UHC,
  38. .flags = IORESOURCE_IRQ,
  39. },
  40. };
  41. struct platform_device jz4740_usb_ohci_device = {
  42. .name = "jz4740-ohci",
  43. .id = -1,
  44. .dev = {
  45. .dma_mask = &jz4740_usb_ohci_device.dev.coherent_dma_mask,
  46. .coherent_dma_mask = DMA_BIT_MASK(32),
  47. },
  48. .num_resources = ARRAY_SIZE(jz4740_usb_ohci_resources),
  49. .resource = jz4740_usb_ohci_resources,
  50. };
  51. /* USB Device Controller */
  52. struct platform_device jz4740_udc_xceiv_device = {
  53. .name = "usb_phy_generic",
  54. .id = 0,
  55. };
  56. static struct resource jz4740_udc_resources[] = {
  57. [0] = {
  58. .start = JZ4740_UDC_BASE_ADDR,
  59. .end = JZ4740_UDC_BASE_ADDR + 0x10000 - 1,
  60. .flags = IORESOURCE_MEM,
  61. },
  62. [1] = {
  63. .start = JZ4740_IRQ_UDC,
  64. .end = JZ4740_IRQ_UDC,
  65. .flags = IORESOURCE_IRQ,
  66. .name = "mc",
  67. },
  68. };
  69. struct platform_device jz4740_udc_device = {
  70. .name = "musb-jz4740",
  71. .id = -1,
  72. .dev = {
  73. .dma_mask = &jz4740_udc_device.dev.coherent_dma_mask,
  74. .coherent_dma_mask = DMA_BIT_MASK(32),
  75. },
  76. .num_resources = ARRAY_SIZE(jz4740_udc_resources),
  77. .resource = jz4740_udc_resources,
  78. };
  79. /* MMC/SD controller */
  80. static struct resource jz4740_mmc_resources[] = {
  81. {
  82. .start = JZ4740_MSC_BASE_ADDR,
  83. .end = JZ4740_MSC_BASE_ADDR + 0x1000 - 1,
  84. .flags = IORESOURCE_MEM,
  85. },
  86. {
  87. .start = JZ4740_IRQ_MSC,
  88. .end = JZ4740_IRQ_MSC,
  89. .flags = IORESOURCE_IRQ,
  90. }
  91. };
  92. struct platform_device jz4740_mmc_device = {
  93. .name = "jz4740-mmc",
  94. .id = 0,
  95. .dev = {
  96. .dma_mask = &jz4740_mmc_device.dev.coherent_dma_mask,
  97. .coherent_dma_mask = DMA_BIT_MASK(32),
  98. },
  99. .num_resources = ARRAY_SIZE(jz4740_mmc_resources),
  100. .resource = jz4740_mmc_resources,
  101. };
  102. /* RTC controller */
  103. static struct resource jz4740_rtc_resources[] = {
  104. {
  105. .start = JZ4740_RTC_BASE_ADDR,
  106. .end = JZ4740_RTC_BASE_ADDR + 0x38 - 1,
  107. .flags = IORESOURCE_MEM,
  108. },
  109. {
  110. .start = JZ4740_IRQ_RTC,
  111. .end = JZ4740_IRQ_RTC,
  112. .flags = IORESOURCE_IRQ,
  113. },
  114. };
  115. struct platform_device jz4740_rtc_device = {
  116. .name = "jz4740-rtc",
  117. .id = -1,
  118. .num_resources = ARRAY_SIZE(jz4740_rtc_resources),
  119. .resource = jz4740_rtc_resources,
  120. };
  121. /* I2C controller */
  122. static struct resource jz4740_i2c_resources[] = {
  123. {
  124. .start = JZ4740_I2C_BASE_ADDR,
  125. .end = JZ4740_I2C_BASE_ADDR + 0x1000 - 1,
  126. .flags = IORESOURCE_MEM,
  127. },
  128. {
  129. .start = JZ4740_IRQ_I2C,
  130. .end = JZ4740_IRQ_I2C,
  131. .flags = IORESOURCE_IRQ,
  132. }
  133. };
  134. struct platform_device jz4740_i2c_device = {
  135. .name = "jz4740-i2c",
  136. .id = 0,
  137. .num_resources = ARRAY_SIZE(jz4740_i2c_resources),
  138. .resource = jz4740_i2c_resources,
  139. };
  140. /* NAND controller */
  141. static struct resource jz4740_nand_resources[] = {
  142. {
  143. .name = "mmio",
  144. .start = JZ4740_EMC_BASE_ADDR,
  145. .end = JZ4740_EMC_BASE_ADDR + 0x1000 - 1,
  146. .flags = IORESOURCE_MEM,
  147. },
  148. {
  149. .name = "bank1",
  150. .start = 0x18000000,
  151. .end = 0x180C0000 - 1,
  152. .flags = IORESOURCE_MEM,
  153. },
  154. {
  155. .name = "bank2",
  156. .start = 0x14000000,
  157. .end = 0x140C0000 - 1,
  158. .flags = IORESOURCE_MEM,
  159. },
  160. {
  161. .name = "bank3",
  162. .start = 0x0C000000,
  163. .end = 0x0C0C0000 - 1,
  164. .flags = IORESOURCE_MEM,
  165. },
  166. {
  167. .name = "bank4",
  168. .start = 0x08000000,
  169. .end = 0x080C0000 - 1,
  170. .flags = IORESOURCE_MEM,
  171. },
  172. };
  173. struct platform_device jz4740_nand_device = {
  174. .name = "jz4740-nand",
  175. .num_resources = ARRAY_SIZE(jz4740_nand_resources),
  176. .resource = jz4740_nand_resources,
  177. };
  178. /* LCD controller */
  179. static struct resource jz4740_framebuffer_resources[] = {
  180. {
  181. .start = JZ4740_LCD_BASE_ADDR,
  182. .end = JZ4740_LCD_BASE_ADDR + 0x1000 - 1,
  183. .flags = IORESOURCE_MEM,
  184. },
  185. };
  186. struct platform_device jz4740_framebuffer_device = {
  187. .name = "jz4740-fb",
  188. .id = -1,
  189. .num_resources = ARRAY_SIZE(jz4740_framebuffer_resources),
  190. .resource = jz4740_framebuffer_resources,
  191. .dev = {
  192. .dma_mask = &jz4740_framebuffer_device.dev.coherent_dma_mask,
  193. .coherent_dma_mask = DMA_BIT_MASK(32),
  194. },
  195. };
  196. /* I2S controller */
  197. static struct resource jz4740_i2s_resources[] = {
  198. {
  199. .start = JZ4740_AIC_BASE_ADDR,
  200. .end = JZ4740_AIC_BASE_ADDR + 0x38 - 1,
  201. .flags = IORESOURCE_MEM,
  202. },
  203. };
  204. struct platform_device jz4740_i2s_device = {
  205. .name = "jz4740-i2s",
  206. .id = -1,
  207. .num_resources = ARRAY_SIZE(jz4740_i2s_resources),
  208. .resource = jz4740_i2s_resources,
  209. };
  210. /* PCM */
  211. struct platform_device jz4740_pcm_device = {
  212. .name = "jz4740-pcm-audio",
  213. .id = -1,
  214. };
  215. /* Codec */
  216. static struct resource jz4740_codec_resources[] = {
  217. {
  218. .start = JZ4740_AIC_BASE_ADDR + 0x80,
  219. .end = JZ4740_AIC_BASE_ADDR + 0x88 - 1,
  220. .flags = IORESOURCE_MEM,
  221. },
  222. };
  223. struct platform_device jz4740_codec_device = {
  224. .name = "jz4740-codec",
  225. .id = -1,
  226. .num_resources = ARRAY_SIZE(jz4740_codec_resources),
  227. .resource = jz4740_codec_resources,
  228. };
  229. /* ADC controller */
  230. static struct resource jz4740_adc_resources[] = {
  231. {
  232. .start = JZ4740_SADC_BASE_ADDR,
  233. .end = JZ4740_SADC_BASE_ADDR + 0x30,
  234. .flags = IORESOURCE_MEM,
  235. },
  236. {
  237. .start = JZ4740_IRQ_SADC,
  238. .end = JZ4740_IRQ_SADC,
  239. .flags = IORESOURCE_IRQ,
  240. },
  241. {
  242. .start = JZ4740_IRQ_ADC_BASE,
  243. .end = JZ4740_IRQ_ADC_BASE,
  244. .flags = IORESOURCE_IRQ,
  245. },
  246. };
  247. struct platform_device jz4740_adc_device = {
  248. .name = "jz4740-adc",
  249. .id = -1,
  250. .num_resources = ARRAY_SIZE(jz4740_adc_resources),
  251. .resource = jz4740_adc_resources,
  252. };
  253. /* Watchdog */
  254. static struct resource jz4740_wdt_resources[] = {
  255. {
  256. .start = JZ4740_WDT_BASE_ADDR,
  257. .end = JZ4740_WDT_BASE_ADDR + 0x10 - 1,
  258. .flags = IORESOURCE_MEM,
  259. },
  260. };
  261. struct platform_device jz4740_wdt_device = {
  262. .name = "jz4740-wdt",
  263. .id = -1,
  264. .num_resources = ARRAY_SIZE(jz4740_wdt_resources),
  265. .resource = jz4740_wdt_resources,
  266. };
  267. /* PWM */
  268. struct platform_device jz4740_pwm_device = {
  269. .name = "jz4740-pwm",
  270. .id = -1,
  271. };
  272. /* DMA */
  273. static struct resource jz4740_dma_resources[] = {
  274. {
  275. .start = JZ4740_DMAC_BASE_ADDR,
  276. .end = JZ4740_DMAC_BASE_ADDR + 0x400 - 1,
  277. .flags = IORESOURCE_MEM,
  278. },
  279. {
  280. .start = JZ4740_IRQ_DMAC,
  281. .end = JZ4740_IRQ_DMAC,
  282. .flags = IORESOURCE_IRQ,
  283. },
  284. };
  285. struct platform_device jz4740_dma_device = {
  286. .name = "jz4740-dma",
  287. .id = -1,
  288. .num_resources = ARRAY_SIZE(jz4740_dma_resources),
  289. .resource = jz4740_dma_resources,
  290. };