mach-w90p910evb.c 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. /*
  2. * linux/arch/arm/mach-w90x900/mach-w90p910evb.c
  3. *
  4. * Based on mach-s3c2410/mach-smdk2410.c by Jonas Dietsche
  5. *
  6. * Copyright (C) 2008 Nuvoton technology corporation.
  7. *
  8. * Wan ZongShun <mcuos.com@gmail.com>
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License as
  12. * published by the Free Software Foundation;version 2 of the License.
  13. *
  14. */
  15. #include <linux/kernel.h>
  16. #include <linux/types.h>
  17. #include <linux/interrupt.h>
  18. #include <linux/list.h>
  19. #include <linux/timer.h>
  20. #include <linux/init.h>
  21. #include <linux/platform_device.h>
  22. #include <linux/mtd/physmap.h>
  23. #include <asm/mach/arch.h>
  24. #include <asm/mach/map.h>
  25. #include <asm/mach/irq.h>
  26. #include <asm/mach-types.h>
  27. #include <mach/regs-serial.h>
  28. #include <mach/map.h>
  29. #include "cpu.h"
  30. /*w90p910 evb norflash driver data */
  31. #define W90P910_FLASH_BASE 0xA0000000
  32. #define W90P910_FLASH_SIZE 0x400000
  33. static struct mtd_partition w90p910_flash_partitions[] = {
  34. {
  35. .name = "NOR Partition 1 for kernel (960K)",
  36. .size = 0xF0000,
  37. .offset = 0x10000,
  38. },
  39. {
  40. .name = "NOR Partition 2 for image (1M)",
  41. .size = 0x100000,
  42. .offset = 0x100000,
  43. },
  44. {
  45. .name = "NOR Partition 3 for user (2M)",
  46. .size = 0x200000,
  47. .offset = 0x00200000,
  48. }
  49. };
  50. static struct physmap_flash_data w90p910_flash_data = {
  51. .width = 2,
  52. .parts = w90p910_flash_partitions,
  53. .nr_parts = ARRAY_SIZE(w90p910_flash_partitions),
  54. };
  55. static struct resource w90p910_flash_resources[] = {
  56. {
  57. .start = W90P910_FLASH_BASE,
  58. .end = W90P910_FLASH_BASE + W90P910_FLASH_SIZE - 1,
  59. .flags = IORESOURCE_MEM,
  60. }
  61. };
  62. static struct platform_device w90p910_flash_device = {
  63. .name = "physmap-flash",
  64. .id = 0,
  65. .dev = {
  66. .platform_data = &w90p910_flash_data,
  67. },
  68. .resource = w90p910_flash_resources,
  69. .num_resources = ARRAY_SIZE(w90p910_flash_resources),
  70. };
  71. /* USB EHCI Host Controller */
  72. static struct resource w90x900_usb_ehci_resource[] = {
  73. [0] = {
  74. .start = W90X900_PA_USBEHCIHOST,
  75. .end = W90X900_PA_USBEHCIHOST + W90X900_SZ_USBEHCIHOST - 1,
  76. .flags = IORESOURCE_MEM,
  77. },
  78. [1] = {
  79. .start = IRQ_USBH,
  80. .end = IRQ_USBH,
  81. .flags = IORESOURCE_IRQ,
  82. }
  83. };
  84. static u64 w90x900_device_usb_ehci_dmamask = 0xffffffffUL;
  85. struct platform_device w90x900_device_usb_ehci = {
  86. .name = "w90x900-ehci",
  87. .id = -1,
  88. .num_resources = ARRAY_SIZE(w90x900_usb_ehci_resource),
  89. .resource = w90x900_usb_ehci_resource,
  90. .dev = {
  91. .dma_mask = &w90x900_device_usb_ehci_dmamask,
  92. .coherent_dma_mask = 0xffffffffUL
  93. }
  94. };
  95. EXPORT_SYMBOL(w90x900_device_usb_ehci);
  96. /* USB OHCI Host Controller */
  97. static struct resource w90x900_usb_ohci_resource[] = {
  98. [0] = {
  99. .start = W90X900_PA_USBOHCIHOST,
  100. .end = W90X900_PA_USBOHCIHOST + W90X900_SZ_USBOHCIHOST - 1,
  101. .flags = IORESOURCE_MEM,
  102. },
  103. [1] = {
  104. .start = IRQ_USBH,
  105. .end = IRQ_USBH,
  106. .flags = IORESOURCE_IRQ,
  107. }
  108. };
  109. static u64 w90x900_device_usb_ohci_dmamask = 0xffffffffUL;
  110. struct platform_device w90x900_device_usb_ohci = {
  111. .name = "w90x900-ohci",
  112. .id = -1,
  113. .num_resources = ARRAY_SIZE(w90x900_usb_ohci_resource),
  114. .resource = w90x900_usb_ohci_resource,
  115. .dev = {
  116. .dma_mask = &w90x900_device_usb_ohci_dmamask,
  117. .coherent_dma_mask = 0xffffffffUL
  118. }
  119. };
  120. EXPORT_SYMBOL(w90x900_device_usb_ohci);
  121. /*TouchScreen controller*/
  122. static struct resource w90x900_ts_resource[] = {
  123. [0] = {
  124. .start = W90X900_PA_ADC,
  125. .end = W90X900_PA_ADC + W90X900_SZ_ADC-1,
  126. .flags = IORESOURCE_MEM,
  127. },
  128. [1] = {
  129. .start = IRQ_ADC,
  130. .end = IRQ_ADC,
  131. .flags = IORESOURCE_IRQ,
  132. },
  133. };
  134. struct platform_device w90x900_device_ts = {
  135. .name = "w90x900-ts",
  136. .id = -1,
  137. .resource = w90x900_ts_resource,
  138. .num_resources = ARRAY_SIZE(w90x900_ts_resource),
  139. };
  140. EXPORT_SYMBOL(w90x900_device_ts);
  141. /* RTC controller*/
  142. static struct resource w90x900_rtc_resource[] = {
  143. [0] = {
  144. .start = W90X900_PA_RTC,
  145. .end = W90X900_PA_RTC + 0xff,
  146. .flags = IORESOURCE_MEM,
  147. },
  148. [1] = {
  149. .start = IRQ_RTC,
  150. .end = IRQ_RTC,
  151. .flags = IORESOURCE_IRQ,
  152. },
  153. };
  154. struct platform_device w90x900_device_rtc = {
  155. .name = "w90x900-rtc",
  156. .id = -1,
  157. .num_resources = ARRAY_SIZE(w90x900_rtc_resource),
  158. .resource = w90x900_rtc_resource,
  159. };
  160. EXPORT_SYMBOL(w90x900_device_rtc);
  161. /* KPI controller*/
  162. static struct resource w90x900_kpi_resource[] = {
  163. [0] = {
  164. .start = W90X900_PA_KPI,
  165. .end = W90X900_PA_KPI + W90X900_SZ_KPI - 1,
  166. .flags = IORESOURCE_MEM,
  167. },
  168. [1] = {
  169. .start = IRQ_KPI,
  170. .end = IRQ_KPI,
  171. .flags = IORESOURCE_IRQ,
  172. }
  173. };
  174. struct platform_device w90x900_device_kpi = {
  175. .name = "w90x900-kpi",
  176. .id = -1,
  177. .num_resources = ARRAY_SIZE(w90x900_kpi_resource),
  178. .resource = w90x900_kpi_resource,
  179. };
  180. EXPORT_SYMBOL(w90x900_device_kpi);
  181. /* USB Device (Gadget)*/
  182. static struct resource w90x900_usbgadget_resource[] = {
  183. [0] = {
  184. .start = W90X900_PA_USBDEV,
  185. .end = W90X900_PA_USBDEV + W90X900_SZ_USBDEV - 1,
  186. .flags = IORESOURCE_MEM,
  187. },
  188. [1] = {
  189. .start = IRQ_USBD,
  190. .end = IRQ_USBD,
  191. .flags = IORESOURCE_IRQ,
  192. }
  193. };
  194. struct platform_device w90x900_device_usbgadget = {
  195. .name = "w90x900-usbgadget",
  196. .id = -1,
  197. .num_resources = ARRAY_SIZE(w90x900_usbgadget_resource),
  198. .resource = w90x900_usbgadget_resource,
  199. };
  200. EXPORT_SYMBOL(w90x900_device_usbgadget);
  201. static struct map_desc w90p910_iodesc[] __initdata = {
  202. };
  203. /*Here should be your evb resourse,such as LCD*/
  204. static struct platform_device *w90p910evb_dev[] __initdata = {
  205. &w90p910_serial_device,
  206. &w90p910_flash_device,
  207. &w90x900_device_usb_ehci,
  208. &w90x900_device_usb_ohci,
  209. &w90x900_device_ts,
  210. &w90x900_device_rtc,
  211. &w90x900_device_kpi,
  212. &w90x900_device_usbgadget,
  213. };
  214. static void __init w90p910evb_map_io(void)
  215. {
  216. w90p910_map_io(w90p910_iodesc, ARRAY_SIZE(w90p910_iodesc));
  217. w90p910_init_clocks();
  218. }
  219. static void __init w90p910evb_init(void)
  220. {
  221. platform_add_devices(w90p910evb_dev, ARRAY_SIZE(w90p910evb_dev));
  222. }
  223. MACHINE_START(W90P910EVB, "W90P910EVB")
  224. /* Maintainer: Wan ZongShun */
  225. .phys_io = W90X900_PA_UART,
  226. .io_pg_offst = (((u32)W90X900_VA_UART) >> 18) & 0xfffc,
  227. .boot_params = 0,
  228. .map_io = w90p910evb_map_io,
  229. .init_irq = w90x900_init_irq,
  230. .init_machine = w90p910evb_init,
  231. .timer = &w90x900_timer,
  232. MACHINE_END