board-urquell.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /*
  2. * Renesas Technology Corp. SH7786 Urquell Support.
  3. *
  4. * Copyright (C) 2008 Kuninori Morimoto <morimoto.kuninori@renesas.com>
  5. * Copyright (C) 2008 Yoshihiro Shimoda
  6. *
  7. * This file is subject to the terms and conditions of the GNU General Public
  8. * License. See the file "COPYING" in the main directory of this archive
  9. * for more details.
  10. */
  11. #include <linux/init.h>
  12. #include <linux/platform_device.h>
  13. #include <linux/fb.h>
  14. #include <linux/mtd/physmap.h>
  15. #include <linux/delay.h>
  16. #include <linux/gpio.h>
  17. #include <linux/irq.h>
  18. #include <mach/urquell.h>
  19. #include <cpu/sh7786.h>
  20. #include <asm/heartbeat.h>
  21. #include <asm/sizes.h>
  22. static struct resource heartbeat_resources[] = {
  23. [0] = {
  24. .start = BOARDREG(SLEDR),
  25. .end = BOARDREG(SLEDR),
  26. .flags = IORESOURCE_MEM,
  27. },
  28. };
  29. static struct heartbeat_data heartbeat_data = {
  30. .regsize = 16,
  31. };
  32. static struct platform_device heartbeat_device = {
  33. .name = "heartbeat",
  34. .id = -1,
  35. .dev = {
  36. .platform_data = &heartbeat_data,
  37. },
  38. .num_resources = ARRAY_SIZE(heartbeat_resources),
  39. .resource = heartbeat_resources,
  40. };
  41. static struct mtd_partition nor_flash_partitions[] = {
  42. {
  43. .name = "loader",
  44. .offset = 0x00000000,
  45. .size = SZ_512K,
  46. .mask_flags = MTD_WRITEABLE, /* Read-only */
  47. },
  48. {
  49. .name = "bootenv",
  50. .offset = MTDPART_OFS_APPEND,
  51. .size = SZ_512K,
  52. .mask_flags = MTD_WRITEABLE, /* Read-only */
  53. },
  54. {
  55. .name = "kernel",
  56. .offset = MTDPART_OFS_APPEND,
  57. .size = SZ_4M,
  58. },
  59. {
  60. .name = "data",
  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. .start = NOR_FLASH_ADDR,
  73. .end = NOR_FLASH_ADDR + NOR_FLASH_SIZE - 1,
  74. .flags = IORESOURCE_MEM,
  75. }
  76. };
  77. static struct platform_device nor_flash_device = {
  78. .name = "physmap-flash",
  79. .dev = {
  80. .platform_data = &nor_flash_data,
  81. },
  82. .num_resources = ARRAY_SIZE(nor_flash_resources),
  83. .resource = nor_flash_resources,
  84. };
  85. static struct platform_device *urquell_devices[] __initdata = {
  86. &heartbeat_device,
  87. &nor_flash_device,
  88. };
  89. static int __init urquell_devices_setup(void)
  90. {
  91. /* USB */
  92. gpio_request(GPIO_FN_USB_OVC0, NULL);
  93. gpio_request(GPIO_FN_USB_PENC0, NULL);
  94. return platform_add_devices(urquell_devices,
  95. ARRAY_SIZE(urquell_devices));
  96. }
  97. device_initcall(urquell_devices_setup);
  98. static void urquell_power_off(void)
  99. {
  100. __raw_writew(0xa5a5, UBOARDREG(SRSTR));
  101. }
  102. /* Initialize the board */
  103. static void __init urquell_setup(char **cmdline_p)
  104. {
  105. printk(KERN_INFO "Renesas Technology Corp. Urquell support.\n");
  106. pm_power_off = urquell_power_off;
  107. }
  108. /*
  109. * The Machine Vector
  110. */
  111. static struct sh_machine_vector mv_urquell __initmv = {
  112. .mv_name = "Urquell",
  113. .mv_setup = urquell_setup,
  114. };