board-urquell.c 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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/smc91x.h>
  15. #include <linux/mtd/physmap.h>
  16. #include <linux/delay.h>
  17. #include <linux/gpio.h>
  18. #include <linux/irq.h>
  19. #include <mach/urquell.h>
  20. #include <cpu/sh7786.h>
  21. #include <asm/heartbeat.h>
  22. #include <asm/sizes.h>
  23. static struct resource heartbeat_resources[] = {
  24. [0] = {
  25. .start = BOARDREG(SLEDR),
  26. .end = BOARDREG(SLEDR),
  27. .flags = IORESOURCE_MEM,
  28. },
  29. };
  30. static struct heartbeat_data heartbeat_data = {
  31. .regsize = 16,
  32. };
  33. static struct platform_device heartbeat_device = {
  34. .name = "heartbeat",
  35. .id = -1,
  36. .dev = {
  37. .platform_data = &heartbeat_data,
  38. },
  39. .num_resources = ARRAY_SIZE(heartbeat_resources),
  40. .resource = heartbeat_resources,
  41. };
  42. static struct smc91x_platdata smc91x_info = {
  43. .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
  44. };
  45. static struct resource smc91x_eth_resources[] = {
  46. [0] = {
  47. .name = "SMC91C111" ,
  48. .start = 0x05800300,
  49. .end = 0x0580030f,
  50. .flags = IORESOURCE_MEM,
  51. },
  52. [1] = {
  53. .start = 11,
  54. .flags = IORESOURCE_IRQ,
  55. },
  56. };
  57. static struct platform_device smc91x_eth_device = {
  58. .name = "smc91x",
  59. .num_resources = ARRAY_SIZE(smc91x_eth_resources),
  60. .resource = smc91x_eth_resources,
  61. .dev = {
  62. .platform_data = &smc91x_info,
  63. },
  64. };
  65. static struct mtd_partition nor_flash_partitions[] = {
  66. {
  67. .name = "loader",
  68. .offset = 0x00000000,
  69. .size = SZ_512K,
  70. .mask_flags = MTD_WRITEABLE, /* Read-only */
  71. },
  72. {
  73. .name = "bootenv",
  74. .offset = MTDPART_OFS_APPEND,
  75. .size = SZ_512K,
  76. .mask_flags = MTD_WRITEABLE, /* Read-only */
  77. },
  78. {
  79. .name = "kernel",
  80. .offset = MTDPART_OFS_APPEND,
  81. .size = SZ_4M,
  82. },
  83. {
  84. .name = "data",
  85. .offset = MTDPART_OFS_APPEND,
  86. .size = MTDPART_SIZ_FULL,
  87. },
  88. };
  89. static struct physmap_flash_data nor_flash_data = {
  90. .width = 2,
  91. .parts = nor_flash_partitions,
  92. .nr_parts = ARRAY_SIZE(nor_flash_partitions),
  93. };
  94. static struct resource nor_flash_resources[] = {
  95. [0] = {
  96. .start = NOR_FLASH_ADDR,
  97. .end = NOR_FLASH_ADDR + NOR_FLASH_SIZE - 1,
  98. .flags = IORESOURCE_MEM,
  99. }
  100. };
  101. static struct platform_device nor_flash_device = {
  102. .name = "physmap-flash",
  103. .dev = {
  104. .platform_data = &nor_flash_data,
  105. },
  106. .num_resources = ARRAY_SIZE(nor_flash_resources),
  107. .resource = nor_flash_resources,
  108. };
  109. static struct platform_device *urquell_devices[] __initdata = {
  110. &heartbeat_device,
  111. &smc91x_eth_device,
  112. &nor_flash_device,
  113. };
  114. static int __init urquell_devices_setup(void)
  115. {
  116. /* USB */
  117. gpio_request(GPIO_FN_USB_OVC0, NULL);
  118. gpio_request(GPIO_FN_USB_PENC0, NULL);
  119. /* enable LAN */
  120. __raw_writew(__raw_readw(UBOARDREG(IRL2MSKR)) & ~0x00000001,
  121. UBOARDREG(IRL2MSKR));
  122. return platform_add_devices(urquell_devices,
  123. ARRAY_SIZE(urquell_devices));
  124. }
  125. device_initcall(urquell_devices_setup);
  126. static void urquell_power_off(void)
  127. {
  128. __raw_writew(0xa5a5, UBOARDREG(SRSTR));
  129. }
  130. static void __init urquell_init_irq(void)
  131. {
  132. plat_irq_setup_pins(IRQ_MODE_IRL3210_MASK);
  133. }
  134. /* Initialize the board */
  135. static void __init urquell_setup(char **cmdline_p)
  136. {
  137. printk(KERN_INFO "Renesas Technology Corp. Urquell support.\n");
  138. pm_power_off = urquell_power_off;
  139. }
  140. /*
  141. * The Machine Vector
  142. */
  143. static struct sh_machine_vector mv_urquell __initmv = {
  144. .mv_name = "Urquell",
  145. .mv_setup = urquell_setup,
  146. .mv_init_irq = urquell_init_irq,
  147. };