board-rsk7203.c 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. /*
  2. * Renesas Technology Europe RSK+ 7203 Support.
  3. *
  4. * Copyright (C) 2008 Paul Mundt
  5. *
  6. * This file is subject to the terms and conditions of the GNU General Public
  7. * License. See the file "COPYING" in the main directory of this archive
  8. * for more details.
  9. */
  10. #include <linux/init.h>
  11. #include <linux/types.h>
  12. #include <linux/platform_device.h>
  13. #include <linux/interrupt.h>
  14. #include <linux/mtd/mtd.h>
  15. #include <linux/mtd/partitions.h>
  16. #include <linux/mtd/physmap.h>
  17. #include <linux/mtd/map.h>
  18. #include <linux/smc911x.h>
  19. #include <linux/gpio.h>
  20. #include <linux/leds.h>
  21. #include <asm/machvec.h>
  22. #include <asm/io.h>
  23. #include <cpu/sh7203.h>
  24. static struct smc911x_platdata smc911x_info = {
  25. .flags = SMC911X_USE_16BIT,
  26. .irq_flags = IRQF_TRIGGER_LOW,
  27. };
  28. static struct resource smc911x_resources[] = {
  29. [0] = {
  30. .start = 0x24000000,
  31. .end = 0x24000000 + 0x100,
  32. .flags = IORESOURCE_MEM,
  33. },
  34. [1] = {
  35. .start = 64,
  36. .end = 64,
  37. .flags = IORESOURCE_IRQ,
  38. },
  39. };
  40. static struct platform_device smc911x_device = {
  41. .name = "smc911x",
  42. .id = -1,
  43. .num_resources = ARRAY_SIZE(smc911x_resources),
  44. .resource = smc911x_resources,
  45. .dev = {
  46. .platform_data = &smc911x_info,
  47. },
  48. };
  49. static const char *probes[] = { "cmdlinepart", NULL };
  50. static struct mtd_partition *parsed_partitions;
  51. static struct mtd_partition rsk7203_partitions[] = {
  52. {
  53. .name = "Bootloader",
  54. .offset = 0x00000000,
  55. .size = 0x00040000,
  56. .mask_flags = MTD_WRITEABLE,
  57. }, {
  58. .name = "Kernel",
  59. .offset = MTDPART_OFS_NXTBLK,
  60. .size = 0x001c0000,
  61. }, {
  62. .name = "Flash_FS",
  63. .offset = MTDPART_OFS_NXTBLK,
  64. .size = MTDPART_SIZ_FULL,
  65. }
  66. };
  67. static struct physmap_flash_data flash_data = {
  68. .width = 2,
  69. };
  70. static struct resource flash_resource = {
  71. .start = 0x20000000,
  72. .end = 0x20400000,
  73. .flags = IORESOURCE_MEM,
  74. };
  75. static struct platform_device flash_device = {
  76. .name = "physmap-flash",
  77. .id = -1,
  78. .resource = &flash_resource,
  79. .num_resources = 1,
  80. .dev = {
  81. .platform_data = &flash_data,
  82. },
  83. };
  84. static struct mtd_info *flash_mtd;
  85. static struct map_info rsk7203_flash_map = {
  86. .name = "RSK+ Flash",
  87. .size = 0x400000,
  88. .bankwidth = 2,
  89. };
  90. static void __init set_mtd_partitions(void)
  91. {
  92. int nr_parts = 0;
  93. simple_map_init(&rsk7203_flash_map);
  94. flash_mtd = do_map_probe("cfi_probe", &rsk7203_flash_map);
  95. nr_parts = parse_mtd_partitions(flash_mtd, probes,
  96. &parsed_partitions, 0);
  97. /* If there is no partition table, used the hard coded table */
  98. if (nr_parts <= 0) {
  99. flash_data.parts = rsk7203_partitions;
  100. flash_data.nr_parts = ARRAY_SIZE(rsk7203_partitions);
  101. } else {
  102. flash_data.nr_parts = nr_parts;
  103. flash_data.parts = parsed_partitions;
  104. }
  105. }
  106. static struct gpio_led rsk7203_gpio_leds[] = {
  107. {
  108. .name = "green",
  109. .gpio = GPIO_PE10,
  110. .active_low = 1,
  111. }, {
  112. .name = "orange",
  113. .default_trigger = "nand-disk",
  114. .gpio = GPIO_PE12,
  115. .active_low = 1,
  116. }, {
  117. .name = "red:timer",
  118. .default_trigger = "timer",
  119. .gpio = GPIO_PC14,
  120. .active_low = 1,
  121. }, {
  122. .name = "red:heartbeat",
  123. .default_trigger = "heartbeat",
  124. .gpio = GPIO_PE11,
  125. .active_low = 1,
  126. },
  127. };
  128. static struct gpio_led_platform_data rsk7203_gpio_leds_info = {
  129. .leds = rsk7203_gpio_leds,
  130. .num_leds = ARRAY_SIZE(rsk7203_gpio_leds),
  131. };
  132. static struct platform_device led_device = {
  133. .name = "leds-gpio",
  134. .id = -1,
  135. .dev = {
  136. .platform_data = &rsk7203_gpio_leds_info,
  137. },
  138. };
  139. static struct platform_device *rsk7203_devices[] __initdata = {
  140. &smc911x_device,
  141. &flash_device,
  142. &led_device,
  143. };
  144. static int __init rsk7203_devices_setup(void)
  145. {
  146. /* Select pins for SCIF0 */
  147. gpio_request(GPIO_FN_TXD0, NULL);
  148. gpio_request(GPIO_FN_RXD0, NULL);
  149. set_mtd_partitions();
  150. return platform_add_devices(rsk7203_devices,
  151. ARRAY_SIZE(rsk7203_devices));
  152. }
  153. device_initcall(rsk7203_devices_setup);
  154. /*
  155. * The Machine Vector
  156. */
  157. static struct sh_machine_vector mv_rsk7203 __initmv = {
  158. .mv_name = "RSK+7203",
  159. };