setup.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. #include <linux/init.h>
  2. #include <linux/platform_device.h>
  3. #include <linux/mtd/physmap.h>
  4. #include <asm/machvec.h>
  5. #include <mach-se/mach/se7343.h>
  6. #include <asm/heartbeat.h>
  7. #include <asm/irq.h>
  8. #include <asm/io.h>
  9. static struct resource smc91x_resources[] = {
  10. [0] = {
  11. .start = 0x10000000,
  12. .end = 0x1000000F,
  13. .flags = IORESOURCE_MEM,
  14. },
  15. [1] = {
  16. /*
  17. * shared with other devices via externel
  18. * interrupt controller in FPGA...
  19. */
  20. .start = SMC_IRQ,
  21. .end = SMC_IRQ,
  22. .flags = IORESOURCE_IRQ,
  23. },
  24. };
  25. static struct platform_device smc91x_device = {
  26. .name = "smc91x",
  27. .id = 0,
  28. .num_resources = ARRAY_SIZE(smc91x_resources),
  29. .resource = smc91x_resources,
  30. };
  31. static struct resource heartbeat_resources[] = {
  32. [0] = {
  33. .start = PA_LED,
  34. .end = PA_LED,
  35. .flags = IORESOURCE_MEM,
  36. },
  37. };
  38. static struct heartbeat_data heartbeat_data = {
  39. .regsize = 16,
  40. };
  41. static struct platform_device heartbeat_device = {
  42. .name = "heartbeat",
  43. .id = -1,
  44. .dev = {
  45. .platform_data = &heartbeat_data,
  46. },
  47. .num_resources = ARRAY_SIZE(heartbeat_resources),
  48. .resource = heartbeat_resources,
  49. };
  50. static struct mtd_partition nor_flash_partitions[] = {
  51. {
  52. .name = "loader",
  53. .offset = 0x00000000,
  54. .size = 128 * 1024,
  55. },
  56. {
  57. .name = "rootfs",
  58. .offset = MTDPART_OFS_APPEND,
  59. .size = 31 * 1024 * 1024,
  60. },
  61. {
  62. .name = "data",
  63. .offset = MTDPART_OFS_APPEND,
  64. .size = MTDPART_SIZ_FULL,
  65. },
  66. };
  67. static struct physmap_flash_data nor_flash_data = {
  68. .width = 2,
  69. .parts = nor_flash_partitions,
  70. .nr_parts = ARRAY_SIZE(nor_flash_partitions),
  71. };
  72. static struct resource nor_flash_resources[] = {
  73. [0] = {
  74. .start = 0x00000000,
  75. .end = 0x01ffffff,
  76. .flags = IORESOURCE_MEM,
  77. }
  78. };
  79. static struct platform_device nor_flash_device = {
  80. .name = "physmap-flash",
  81. .dev = {
  82. .platform_data = &nor_flash_data,
  83. },
  84. .num_resources = ARRAY_SIZE(nor_flash_resources),
  85. .resource = nor_flash_resources,
  86. };
  87. static struct platform_device *sh7343se_platform_devices[] __initdata = {
  88. &smc91x_device,
  89. &heartbeat_device,
  90. &nor_flash_device,
  91. };
  92. static int __init sh7343se_devices_setup(void)
  93. {
  94. return platform_add_devices(sh7343se_platform_devices,
  95. ARRAY_SIZE(sh7343se_platform_devices));
  96. }
  97. device_initcall(sh7343se_devices_setup);
  98. /*
  99. * Initialize the board
  100. */
  101. static void __init sh7343se_setup(char **cmdline_p)
  102. {
  103. ctrl_outw(0xf900, FPGA_OUT); /* FPGA */
  104. ctrl_outw(0x0002, PORT_PECR); /* PORT E 1 = IRQ5 */
  105. ctrl_outw(0x0020, PORT_PSELD);
  106. printk(KERN_INFO "MS7343CP01 Setup...done\n");
  107. }
  108. /*
  109. * The Machine Vector
  110. */
  111. static struct sh_machine_vector mv_7343se __initmv = {
  112. .mv_name = "SolutionEngine 7343",
  113. .mv_setup = sh7343se_setup,
  114. .mv_nr_irqs = 108,
  115. .mv_inb = sh7343se_inb,
  116. .mv_inw = sh7343se_inw,
  117. .mv_inl = sh7343se_inl,
  118. .mv_outb = sh7343se_outb,
  119. .mv_outw = sh7343se_outw,
  120. .mv_outl = sh7343se_outl,
  121. .mv_inb_p = sh7343se_inb_p,
  122. .mv_inw_p = sh7343se_inw,
  123. .mv_inl_p = sh7343se_inl,
  124. .mv_outb_p = sh7343se_outb_p,
  125. .mv_outw_p = sh7343se_outw,
  126. .mv_outl_p = sh7343se_outl,
  127. .mv_insb = sh7343se_insb,
  128. .mv_insw = sh7343se_insw,
  129. .mv_insl = sh7343se_insl,
  130. .mv_outsb = sh7343se_outsb,
  131. .mv_outsw = sh7343se_outsw,
  132. .mv_outsl = sh7343se_outsl,
  133. .mv_init_irq = init_7343se_IRQ,
  134. };