setup.c 3.7 KB

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