board-marzen.c 2.8 KB

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