setup.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /*
  2. * Copyright (C) 2009 Renesas Solutions Corp.
  3. *
  4. * Kuninori Morimoto <morimoto.kuninori@renesas.com>
  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/device.h>
  12. #include <linux/platform_device.h>
  13. #include <linux/mtd/physmap.h>
  14. #include <linux/gpio.h>
  15. #include <linux/interrupt.h>
  16. #include <asm/io.h>
  17. #include <asm/heartbeat.h>
  18. #include <cpu/sh7724.h>
  19. /*
  20. * Address Interface BusWidth
  21. *-----------------------------------------
  22. * 0x0000_0000 uboot 16bit
  23. * 0x0004_0000 Linux romImage 16bit
  24. * 0x0014_0000 MTD for Linux 16bit
  25. * 0x0400_0000 Internal I/O 16/32bit
  26. * 0x0800_0000 DRAM 32bit
  27. * 0x1800_0000 MFI 16bit
  28. */
  29. /* Heartbeat */
  30. static unsigned char led_pos[] = { 0, 1, 2, 3 };
  31. static struct heartbeat_data heartbeat_data = {
  32. .regsize = 8,
  33. .nr_bits = 4,
  34. .bit_pos = led_pos,
  35. };
  36. static struct resource heartbeat_resources[] = {
  37. [0] = {
  38. .start = 0xA405012C, /* PTG */
  39. .end = 0xA405012E - 1,
  40. .flags = IORESOURCE_MEM,
  41. },
  42. };
  43. static struct platform_device heartbeat_device = {
  44. .name = "heartbeat",
  45. .id = -1,
  46. .dev = {
  47. .platform_data = &heartbeat_data,
  48. },
  49. .num_resources = ARRAY_SIZE(heartbeat_resources),
  50. .resource = heartbeat_resources,
  51. };
  52. /* MTD */
  53. static struct mtd_partition nor_flash_partitions[] = {
  54. {
  55. .name = "boot loader",
  56. .offset = 0,
  57. .size = (5 * 1024 * 1024),
  58. .mask_flags = MTD_CAP_ROM,
  59. }, {
  60. .name = "free-area",
  61. .offset = MTDPART_OFS_APPEND,
  62. .size = MTDPART_SIZ_FULL,
  63. },
  64. };
  65. static struct physmap_flash_data nor_flash_data = {
  66. .width = 2,
  67. .parts = nor_flash_partitions,
  68. .nr_parts = ARRAY_SIZE(nor_flash_partitions),
  69. };
  70. static struct resource nor_flash_resources[] = {
  71. [0] = {
  72. .name = "NOR Flash",
  73. .start = 0x00000000,
  74. .end = 0x03ffffff,
  75. .flags = IORESOURCE_MEM,
  76. }
  77. };
  78. static struct platform_device nor_flash_device = {
  79. .name = "physmap-flash",
  80. .resource = nor_flash_resources,
  81. .num_resources = ARRAY_SIZE(nor_flash_resources),
  82. .dev = {
  83. .platform_data = &nor_flash_data,
  84. },
  85. };
  86. static struct platform_device *ecovec_devices[] __initdata = {
  87. &heartbeat_device,
  88. &nor_flash_device,
  89. };
  90. static int __init devices_setup(void)
  91. {
  92. /* enable SCIFA0 */
  93. gpio_request(GPIO_FN_SCIF0_TXD, NULL);
  94. gpio_request(GPIO_FN_SCIF0_RXD, NULL);
  95. /* enable debug LED */
  96. gpio_request(GPIO_PTG0, NULL);
  97. gpio_request(GPIO_PTG1, NULL);
  98. gpio_request(GPIO_PTG2, NULL);
  99. gpio_request(GPIO_PTG3, NULL);
  100. gpio_direction_output(GPIO_PTG0, 0);
  101. gpio_direction_output(GPIO_PTG1, 0);
  102. gpio_direction_output(GPIO_PTG2, 0);
  103. gpio_direction_output(GPIO_PTG3, 0);
  104. return platform_add_devices(ecovec_devices,
  105. ARRAY_SIZE(ecovec_devices));
  106. }
  107. device_initcall(devices_setup);
  108. static struct sh_machine_vector mv_ecovec __initmv = {
  109. .mv_name = "R0P7724 (EcoVec)",
  110. };