setup.c 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. #include <linux/init.h>
  2. #include <linux/platform_device.h>
  3. #include <linux/mtd/physmap.h>
  4. #include <linux/serial_8250.h>
  5. #include <linux/serial_reg.h>
  6. #include <linux/usb/isp116x.h>
  7. #include <linux/delay.h>
  8. #include <linux/irqdomain.h>
  9. #include <asm/machvec.h>
  10. #include <mach-se/mach/se7343.h>
  11. #include <asm/heartbeat.h>
  12. #include <asm/irq.h>
  13. #include <asm/io.h>
  14. static struct resource heartbeat_resource = {
  15. .start = PA_LED,
  16. .end = PA_LED,
  17. .flags = IORESOURCE_MEM | IORESOURCE_MEM_16BIT,
  18. };
  19. static struct platform_device heartbeat_device = {
  20. .name = "heartbeat",
  21. .id = -1,
  22. .num_resources = 1,
  23. .resource = &heartbeat_resource,
  24. };
  25. static struct mtd_partition nor_flash_partitions[] = {
  26. {
  27. .name = "loader",
  28. .offset = 0x00000000,
  29. .size = 128 * 1024,
  30. },
  31. {
  32. .name = "rootfs",
  33. .offset = MTDPART_OFS_APPEND,
  34. .size = 31 * 1024 * 1024,
  35. },
  36. {
  37. .name = "data",
  38. .offset = MTDPART_OFS_APPEND,
  39. .size = MTDPART_SIZ_FULL,
  40. },
  41. };
  42. static struct physmap_flash_data nor_flash_data = {
  43. .width = 2,
  44. .parts = nor_flash_partitions,
  45. .nr_parts = ARRAY_SIZE(nor_flash_partitions),
  46. };
  47. static struct resource nor_flash_resources[] = {
  48. [0] = {
  49. .start = 0x00000000,
  50. .end = 0x01ffffff,
  51. .flags = IORESOURCE_MEM,
  52. }
  53. };
  54. static struct platform_device nor_flash_device = {
  55. .name = "physmap-flash",
  56. .dev = {
  57. .platform_data = &nor_flash_data,
  58. },
  59. .num_resources = ARRAY_SIZE(nor_flash_resources),
  60. .resource = nor_flash_resources,
  61. };
  62. #define ST16C2550C_FLAGS (UPF_BOOT_AUTOCONF | UPF_IOREMAP)
  63. static struct plat_serial8250_port serial_platform_data[] = {
  64. [0] = {
  65. .iotype = UPIO_MEM,
  66. .mapbase = 0x16000000,
  67. .regshift = 1,
  68. .flags = ST16C2550C_FLAGS,
  69. .uartclk = 7372800,
  70. },
  71. [1] = {
  72. .iotype = UPIO_MEM,
  73. .mapbase = 0x17000000,
  74. .regshift = 1,
  75. .flags = ST16C2550C_FLAGS,
  76. .uartclk = 7372800,
  77. },
  78. { },
  79. };
  80. static struct platform_device uart_device = {
  81. .name = "serial8250",
  82. .id = PLAT8250_DEV_PLATFORM,
  83. .dev = {
  84. .platform_data = serial_platform_data,
  85. },
  86. };
  87. static void isp116x_delay(struct device *dev, int delay)
  88. {
  89. ndelay(delay);
  90. }
  91. static struct resource usb_resources[] = {
  92. [0] = {
  93. .start = 0x11800000,
  94. .end = 0x11800001,
  95. .flags = IORESOURCE_MEM,
  96. },
  97. [1] = {
  98. .start = 0x11800002,
  99. .end = 0x11800003,
  100. .flags = IORESOURCE_MEM,
  101. },
  102. [2] = {
  103. /* Filled in later */
  104. .flags = IORESOURCE_IRQ,
  105. },
  106. };
  107. static struct isp116x_platform_data usb_platform_data = {
  108. .sel15Kres = 1,
  109. .oc_enable = 1,
  110. .int_act_high = 0,
  111. .int_edge_triggered = 0,
  112. .remote_wakeup_enable = 0,
  113. .delay = isp116x_delay,
  114. };
  115. static struct platform_device usb_device = {
  116. .name = "isp116x-hcd",
  117. .id = -1,
  118. .num_resources = ARRAY_SIZE(usb_resources),
  119. .resource = usb_resources,
  120. .dev = {
  121. .platform_data = &usb_platform_data,
  122. },
  123. };
  124. static struct platform_device *sh7343se_platform_devices[] __initdata = {
  125. &heartbeat_device,
  126. &nor_flash_device,
  127. &uart_device,
  128. &usb_device,
  129. };
  130. static int __init sh7343se_devices_setup(void)
  131. {
  132. /* Wire-up dynamic vectors */
  133. serial_platform_data[0].irq = irq_find_mapping(se7343_irq_domain,
  134. SE7343_FPGA_IRQ_UARTA);
  135. serial_platform_data[1].irq = irq_find_mapping(se7343_irq_domain,
  136. SE7343_FPGA_IRQ_UARTB);
  137. usb_resources[2].start = usb_resources[2].end =
  138. irq_find_mapping(se7343_irq_domain, SE7343_FPGA_IRQ_USB);
  139. return platform_add_devices(sh7343se_platform_devices,
  140. ARRAY_SIZE(sh7343se_platform_devices));
  141. }
  142. device_initcall(sh7343se_devices_setup);
  143. /*
  144. * Initialize the board
  145. */
  146. static void __init sh7343se_setup(char **cmdline_p)
  147. {
  148. __raw_writew(0xf900, FPGA_OUT); /* FPGA */
  149. __raw_writew(0x0002, PORT_PECR); /* PORT E 1 = IRQ5 */
  150. __raw_writew(0x0020, PORT_PSELD);
  151. printk(KERN_INFO "MS7343CP01 Setup...done\n");
  152. }
  153. /*
  154. * The Machine Vector
  155. */
  156. static struct sh_machine_vector mv_7343se __initmv = {
  157. .mv_name = "SolutionEngine 7343",
  158. .mv_setup = sh7343se_setup,
  159. .mv_init_irq = init_7343se_IRQ,
  160. };