mach-w90p910evb.c 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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. static struct map_desc w90p910_iodesc[] __initdata = {
  142. };
  143. /*Here should be your evb resourse,such as LCD*/
  144. static struct platform_device *w90p910evb_dev[] __initdata = {
  145. &w90p910_serial_device,
  146. &w90p910_flash_device,
  147. &w90x900_device_usb_ehci,
  148. &w90x900_device_usb_ohci,
  149. &w90x900_device_ts,
  150. };
  151. static void __init w90p910evb_map_io(void)
  152. {
  153. w90p910_map_io(w90p910_iodesc, ARRAY_SIZE(w90p910_iodesc));
  154. w90p910_init_clocks(0);
  155. }
  156. static void __init w90p910evb_init(void)
  157. {
  158. platform_add_devices(w90p910evb_dev, ARRAY_SIZE(w90p910evb_dev));
  159. }
  160. MACHINE_START(W90P910EVB, "W90P910EVB")
  161. /* Maintainer: Wan ZongShun */
  162. .phys_io = W90X900_PA_UART,
  163. .io_pg_offst = (((u32)W90X900_VA_UART) >> 18) & 0xfffc,
  164. .boot_params = 0,
  165. .map_io = w90p910evb_map_io,
  166. .init_irq = w90x900_init_irq,
  167. .init_machine = w90p910evb_init,
  168. .timer = &w90x900_timer,
  169. MACHINE_END