board-marzen.c 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. /*
  2. * marzen board support
  3. *
  4. * Copyright (C) 2011 Renesas Solutions Corp.
  5. * Copyright (C) 2011 Magnus Damm
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; version 2 of the License.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #include <linux/kernel.h>
  21. #include <linux/init.h>
  22. #include <linux/interrupt.h>
  23. #include <linux/irq.h>
  24. #include <linux/platform_device.h>
  25. #include <linux/delay.h>
  26. #include <linux/io.h>
  27. #include <linux/gpio.h>
  28. #include <linux/dma-mapping.h>
  29. #include <linux/smsc911x.h>
  30. #include <mach/hardware.h>
  31. #include <mach/r8a7779.h>
  32. #include <mach/common.h>
  33. #include <asm/mach-types.h>
  34. #include <asm/mach/arch.h>
  35. #include <asm/mach/map.h>
  36. #include <asm/mach/time.h>
  37. #include <asm/hardware/gic.h>
  38. #include <asm/traps.h>
  39. /* SMSC LAN89218 */
  40. static struct resource smsc911x_resources[] = {
  41. [0] = {
  42. .start = 0x18000000, /* ExCS0 */
  43. .end = 0x180000ff, /* A1->A7 */
  44. .flags = IORESOURCE_MEM,
  45. },
  46. [1] = {
  47. .start = gic_spi(28), /* IRQ 1 */
  48. .flags = IORESOURCE_IRQ,
  49. },
  50. };
  51. static struct smsc911x_platform_config smsc911x_platdata = {
  52. .flags = SMSC911X_USE_32BIT, /* 32-bit SW on 16-bit HW bus */
  53. .phy_interface = PHY_INTERFACE_MODE_MII,
  54. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
  55. .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
  56. };
  57. static struct platform_device eth_device = {
  58. .name = "smsc911x",
  59. .id = 0,
  60. .dev = {
  61. .platform_data = &smsc911x_platdata,
  62. },
  63. .resource = smsc911x_resources,
  64. .num_resources = ARRAY_SIZE(smsc911x_resources),
  65. };
  66. static struct platform_device *marzen_devices[] __initdata = {
  67. &eth_device,
  68. };
  69. static struct map_desc marzen_io_desc[] __initdata = {
  70. /* 2M entity map for 0xf0000000 (MPCORE) */
  71. {
  72. .virtual = 0xf0000000,
  73. .pfn = __phys_to_pfn(0xf0000000),
  74. .length = SZ_2M,
  75. .type = MT_DEVICE_NONSHARED
  76. },
  77. /* 16M entity map for 0xfexxxxxx (DMAC-S/HPBREG/INTC2/LRAM/DBSC) */
  78. {
  79. .virtual = 0xfe000000,
  80. .pfn = __phys_to_pfn(0xfe000000),
  81. .length = SZ_16M,
  82. .type = MT_DEVICE_NONSHARED
  83. },
  84. };
  85. static void __init marzen_map_io(void)
  86. {
  87. iotable_init(marzen_io_desc, ARRAY_SIZE(marzen_io_desc));
  88. }
  89. static void __init marzen_init_early(void)
  90. {
  91. r8a7779_add_early_devices();
  92. /* Early serial console setup is not included here due to
  93. * memory map collisions. The SCIF serial ports in r8a7779
  94. * are difficult to entity map 1:1 due to collision with the
  95. * virtual memory range used by the coherent DMA code on ARM.
  96. *
  97. * Anyone wanting to debug early can remove UPF_IOREMAP from
  98. * the sh-sci serial console platform data, adjust mapbase
  99. * to a static M:N virt:phys mapping that needs to be added to
  100. * the mappings passed with iotable_init() above.
  101. *
  102. * Then add a call to shmobile_setup_console() from this function.
  103. *
  104. * As a final step pass earlyprint=sh-sci.2,115200 on the kernel
  105. * command line.
  106. */
  107. }
  108. static void __init marzen_init(void)
  109. {
  110. r8a7779_pinmux_init();
  111. /* SCIF2 (CN18: DEBUG0) */
  112. gpio_request(GPIO_FN_TX2_C, NULL);
  113. gpio_request(GPIO_FN_RX2_C, NULL);
  114. /* SCIF4 (CN19: DEBUG1) */
  115. gpio_request(GPIO_FN_TX4, NULL);
  116. gpio_request(GPIO_FN_RX4, NULL);
  117. /* LAN89218 */
  118. gpio_request(GPIO_FN_EX_CS0, NULL); /* nCS */
  119. gpio_request(GPIO_FN_IRQ1_B, NULL); /* IRQ + PME */
  120. r8a7779_add_standard_devices();
  121. platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices));
  122. }
  123. static void __init marzen_timer_init(void)
  124. {
  125. r8a7779_clock_init();
  126. shmobile_timer.init();
  127. return;
  128. }
  129. struct sys_timer marzen_timer = {
  130. .init = marzen_timer_init,
  131. };
  132. MACHINE_START(MARZEN, "marzen")
  133. .map_io = marzen_map_io,
  134. .init_early = marzen_init_early,
  135. .nr_irqs = NR_IRQS_LEGACY,
  136. .init_irq = r8a7779_init_irq,
  137. .handle_irq = gic_handle_irq,
  138. .init_machine = marzen_init,
  139. .timer = &marzen_timer,
  140. MACHINE_END