board-marzen.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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/regulator/fixed.h>
  30. #include <linux/regulator/machine.h>
  31. #include <linux/smsc911x.h>
  32. #include <mach/hardware.h>
  33. #include <mach/r8a7779.h>
  34. #include <mach/common.h>
  35. #include <mach/irqs.h>
  36. #include <asm/mach-types.h>
  37. #include <asm/mach/arch.h>
  38. #include <asm/hardware/gic.h>
  39. #include <asm/traps.h>
  40. /* Dummy supplies, where voltage doesn't matter */
  41. static struct regulator_consumer_supply dummy_supplies[] = {
  42. REGULATOR_SUPPLY("vddvario", "smsc911x"),
  43. REGULATOR_SUPPLY("vdd33a", "smsc911x"),
  44. };
  45. /* SMSC LAN89218 */
  46. static struct resource smsc911x_resources[] = {
  47. [0] = {
  48. .start = 0x18000000, /* ExCS0 */
  49. .end = 0x180000ff, /* A1->A7 */
  50. .flags = IORESOURCE_MEM,
  51. },
  52. [1] = {
  53. .start = gic_spi(28), /* IRQ 1 */
  54. .flags = IORESOURCE_IRQ,
  55. },
  56. };
  57. static struct smsc911x_platform_config smsc911x_platdata = {
  58. .flags = SMSC911X_USE_32BIT, /* 32-bit SW on 16-bit HW bus */
  59. .phy_interface = PHY_INTERFACE_MODE_MII,
  60. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
  61. .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
  62. };
  63. static struct platform_device eth_device = {
  64. .name = "smsc911x",
  65. .id = 0,
  66. .dev = {
  67. .platform_data = &smsc911x_platdata,
  68. },
  69. .resource = smsc911x_resources,
  70. .num_resources = ARRAY_SIZE(smsc911x_resources),
  71. };
  72. static struct platform_device *marzen_devices[] __initdata = {
  73. &eth_device,
  74. };
  75. static void __init marzen_init(void)
  76. {
  77. regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
  78. r8a7779_pinmux_init();
  79. /* SCIF2 (CN18: DEBUG0) */
  80. gpio_request(GPIO_FN_TX2_C, NULL);
  81. gpio_request(GPIO_FN_RX2_C, NULL);
  82. /* SCIF4 (CN19: DEBUG1) */
  83. gpio_request(GPIO_FN_TX4, NULL);
  84. gpio_request(GPIO_FN_RX4, NULL);
  85. /* LAN89218 */
  86. gpio_request(GPIO_FN_EX_CS0, NULL); /* nCS */
  87. gpio_request(GPIO_FN_IRQ1_B, NULL); /* IRQ + PME */
  88. r8a7779_add_standard_devices();
  89. platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices));
  90. }
  91. MACHINE_START(MARZEN, "marzen")
  92. .map_io = r8a7779_map_io,
  93. .init_early = r8a7779_add_early_devices,
  94. .nr_irqs = NR_IRQS_LEGACY,
  95. .init_irq = r8a7779_init_irq,
  96. .handle_irq = gic_handle_irq,
  97. .init_machine = marzen_init,
  98. .init_late = shmobile_init_late,
  99. .timer = &shmobile_timer,
  100. MACHINE_END