platform.c 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  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. /* USB Device Controller */
  29. struct platform_device jz4740_udc_xceiv_device = {
  30. .name = "usb_phy_generic",
  31. .id = 0,
  32. };
  33. static struct resource jz4740_udc_resources[] = {
  34. [0] = {
  35. .start = JZ4740_UDC_BASE_ADDR,
  36. .end = JZ4740_UDC_BASE_ADDR + 0x10000 - 1,
  37. .flags = IORESOURCE_MEM,
  38. },
  39. [1] = {
  40. .start = JZ4740_IRQ_UDC,
  41. .end = JZ4740_IRQ_UDC,
  42. .flags = IORESOURCE_IRQ,
  43. .name = "mc",
  44. },
  45. };
  46. struct platform_device jz4740_udc_device = {
  47. .name = "musb-jz4740",
  48. .id = -1,
  49. .dev = {
  50. .dma_mask = &jz4740_udc_device.dev.coherent_dma_mask,
  51. .coherent_dma_mask = DMA_BIT_MASK(32),
  52. },
  53. .num_resources = ARRAY_SIZE(jz4740_udc_resources),
  54. .resource = jz4740_udc_resources,
  55. };
  56. /* MMC/SD controller */
  57. static struct resource jz4740_mmc_resources[] = {
  58. {
  59. .start = JZ4740_MSC_BASE_ADDR,
  60. .end = JZ4740_MSC_BASE_ADDR + 0x1000 - 1,
  61. .flags = IORESOURCE_MEM,
  62. },
  63. {
  64. .start = JZ4740_IRQ_MSC,
  65. .end = JZ4740_IRQ_MSC,
  66. .flags = IORESOURCE_IRQ,
  67. }
  68. };
  69. struct platform_device jz4740_mmc_device = {
  70. .name = "jz4740-mmc",
  71. .id = 0,
  72. .dev = {
  73. .dma_mask = &jz4740_mmc_device.dev.coherent_dma_mask,
  74. .coherent_dma_mask = DMA_BIT_MASK(32),
  75. },
  76. .num_resources = ARRAY_SIZE(jz4740_mmc_resources),
  77. .resource = jz4740_mmc_resources,
  78. };
  79. /* RTC controller */
  80. static struct resource jz4740_rtc_resources[] = {
  81. {
  82. .start = JZ4740_RTC_BASE_ADDR,
  83. .end = JZ4740_RTC_BASE_ADDR + 0x38 - 1,
  84. .flags = IORESOURCE_MEM,
  85. },
  86. {
  87. .start = JZ4740_IRQ_RTC,
  88. .end = JZ4740_IRQ_RTC,
  89. .flags = IORESOURCE_IRQ,
  90. },
  91. };
  92. struct platform_device jz4740_rtc_device = {
  93. .name = "jz4740-rtc",
  94. .id = -1,
  95. .num_resources = ARRAY_SIZE(jz4740_rtc_resources),
  96. .resource = jz4740_rtc_resources,
  97. };
  98. /* I2C controller */
  99. static struct resource jz4740_i2c_resources[] = {
  100. {
  101. .start = JZ4740_I2C_BASE_ADDR,
  102. .end = JZ4740_I2C_BASE_ADDR + 0x1000 - 1,
  103. .flags = IORESOURCE_MEM,
  104. },
  105. {
  106. .start = JZ4740_IRQ_I2C,
  107. .end = JZ4740_IRQ_I2C,
  108. .flags = IORESOURCE_IRQ,
  109. }
  110. };
  111. struct platform_device jz4740_i2c_device = {
  112. .name = "jz4740-i2c",
  113. .id = 0,
  114. .num_resources = ARRAY_SIZE(jz4740_i2c_resources),
  115. .resource = jz4740_i2c_resources,
  116. };
  117. /* NAND controller */
  118. static struct resource jz4740_nand_resources[] = {
  119. {
  120. .name = "mmio",
  121. .start = JZ4740_EMC_BASE_ADDR,
  122. .end = JZ4740_EMC_BASE_ADDR + 0x1000 - 1,
  123. .flags = IORESOURCE_MEM,
  124. },
  125. {
  126. .name = "bank1",
  127. .start = 0x18000000,
  128. .end = 0x180C0000 - 1,
  129. .flags = IORESOURCE_MEM,
  130. },
  131. {
  132. .name = "bank2",
  133. .start = 0x14000000,
  134. .end = 0x140C0000 - 1,
  135. .flags = IORESOURCE_MEM,
  136. },
  137. {
  138. .name = "bank3",
  139. .start = 0x0C000000,
  140. .end = 0x0C0C0000 - 1,
  141. .flags = IORESOURCE_MEM,
  142. },
  143. {
  144. .name = "bank4",
  145. .start = 0x08000000,
  146. .end = 0x080C0000 - 1,
  147. .flags = IORESOURCE_MEM,
  148. },
  149. };
  150. struct platform_device jz4740_nand_device = {
  151. .name = "jz4740-nand",
  152. .num_resources = ARRAY_SIZE(jz4740_nand_resources),
  153. .resource = jz4740_nand_resources,
  154. };
  155. /* LCD controller */
  156. static struct resource jz4740_framebuffer_resources[] = {
  157. {
  158. .start = JZ4740_LCD_BASE_ADDR,
  159. .end = JZ4740_LCD_BASE_ADDR + 0x1000 - 1,
  160. .flags = IORESOURCE_MEM,
  161. },
  162. };
  163. struct platform_device jz4740_framebuffer_device = {
  164. .name = "jz4740-fb",
  165. .id = -1,
  166. .num_resources = ARRAY_SIZE(jz4740_framebuffer_resources),
  167. .resource = jz4740_framebuffer_resources,
  168. .dev = {
  169. .dma_mask = &jz4740_framebuffer_device.dev.coherent_dma_mask,
  170. .coherent_dma_mask = DMA_BIT_MASK(32),
  171. },
  172. };
  173. /* I2S controller */
  174. static struct resource jz4740_i2s_resources[] = {
  175. {
  176. .start = JZ4740_AIC_BASE_ADDR,
  177. .end = JZ4740_AIC_BASE_ADDR + 0x38 - 1,
  178. .flags = IORESOURCE_MEM,
  179. },
  180. };
  181. struct platform_device jz4740_i2s_device = {
  182. .name = "jz4740-i2s",
  183. .id = -1,
  184. .num_resources = ARRAY_SIZE(jz4740_i2s_resources),
  185. .resource = jz4740_i2s_resources,
  186. };
  187. /* PCM */
  188. struct platform_device jz4740_pcm_device = {
  189. .name = "jz4740-pcm-audio",
  190. .id = -1,
  191. };
  192. /* Codec */
  193. static struct resource jz4740_codec_resources[] = {
  194. {
  195. .start = JZ4740_AIC_BASE_ADDR + 0x80,
  196. .end = JZ4740_AIC_BASE_ADDR + 0x88 - 1,
  197. .flags = IORESOURCE_MEM,
  198. },
  199. };
  200. struct platform_device jz4740_codec_device = {
  201. .name = "jz4740-codec",
  202. .id = -1,
  203. .num_resources = ARRAY_SIZE(jz4740_codec_resources),
  204. .resource = jz4740_codec_resources,
  205. };
  206. /* ADC controller */
  207. static struct resource jz4740_adc_resources[] = {
  208. {
  209. .start = JZ4740_SADC_BASE_ADDR,
  210. .end = JZ4740_SADC_BASE_ADDR + 0x30,
  211. .flags = IORESOURCE_MEM,
  212. },
  213. {
  214. .start = JZ4740_IRQ_SADC,
  215. .end = JZ4740_IRQ_SADC,
  216. .flags = IORESOURCE_IRQ,
  217. },
  218. {
  219. .start = JZ4740_IRQ_ADC_BASE,
  220. .end = JZ4740_IRQ_ADC_BASE,
  221. .flags = IORESOURCE_IRQ,
  222. },
  223. };
  224. struct platform_device jz4740_adc_device = {
  225. .name = "jz4740-adc",
  226. .id = -1,
  227. .num_resources = ARRAY_SIZE(jz4740_adc_resources),
  228. .resource = jz4740_adc_resources,
  229. };
  230. /* Watchdog */
  231. static struct resource jz4740_wdt_resources[] = {
  232. {
  233. .start = JZ4740_WDT_BASE_ADDR,
  234. .end = JZ4740_WDT_BASE_ADDR + 0x10 - 1,
  235. .flags = IORESOURCE_MEM,
  236. },
  237. };
  238. struct platform_device jz4740_wdt_device = {
  239. .name = "jz4740-wdt",
  240. .id = -1,
  241. .num_resources = ARRAY_SIZE(jz4740_wdt_resources),
  242. .resource = jz4740_wdt_resources,
  243. };
  244. /* PWM */
  245. struct platform_device jz4740_pwm_device = {
  246. .name = "jz4740-pwm",
  247. .id = -1,
  248. };
  249. /* DMA */
  250. static struct resource jz4740_dma_resources[] = {
  251. {
  252. .start = JZ4740_DMAC_BASE_ADDR,
  253. .end = JZ4740_DMAC_BASE_ADDR + 0x400 - 1,
  254. .flags = IORESOURCE_MEM,
  255. },
  256. {
  257. .start = JZ4740_IRQ_DMAC,
  258. .end = JZ4740_IRQ_DMAC,
  259. .flags = IORESOURCE_IRQ,
  260. },
  261. };
  262. struct platform_device jz4740_dma_device = {
  263. .name = "jz4740-dma",
  264. .id = -1,
  265. .num_resources = ARRAY_SIZE(jz4740_dma_resources),
  266. .resource = jz4740_dma_resources,
  267. };