setup.c 3.7 KB

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