board-bockw.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*
  2. * Bock-W board support
  3. *
  4. * Copyright (C) 2013 Renesas Solutions Corp.
  5. * Copyright (C) 2013 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
  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/pinctrl/machine.h>
  21. #include <linux/platform_device.h>
  22. #include <linux/smsc911x.h>
  23. #include <mach/common.h>
  24. #include <mach/irqs.h>
  25. #include <mach/r8a7778.h>
  26. #include <asm/mach/arch.h>
  27. static struct smsc911x_platform_config smsc911x_data = {
  28. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
  29. .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
  30. .flags = SMSC911X_USE_32BIT,
  31. .phy_interface = PHY_INTERFACE_MODE_MII,
  32. };
  33. static struct resource smsc911x_resources[] = {
  34. DEFINE_RES_MEM(0x18300000, 0x1000),
  35. DEFINE_RES_IRQ(irq_pin(0)), /* IRQ 0 */
  36. };
  37. static struct rcar_phy_platform_data usb_phy_platform_data __initdata;
  38. static const struct pinctrl_map bockw_pinctrl_map[] = {
  39. /* SCIF0 */
  40. PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.0", "pfc-r8a7778",
  41. "scif0_data_a", "scif0"),
  42. PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.0", "pfc-r8a7778",
  43. "scif0_ctrl", "scif0"),
  44. PIN_MAP_MUX_GROUP_DEFAULT("ehci-platform", "pfc-r8a7778",
  45. "usb0", "usb0"),
  46. PIN_MAP_MUX_GROUP_DEFAULT("ehci-platform", "pfc-r8a7778",
  47. "usb1", "usb1"),
  48. };
  49. #define IRQ0MR 0x30
  50. static void __init bockw_init(void)
  51. {
  52. void __iomem *fpga;
  53. r8a7778_clock_init();
  54. r8a7778_init_irq_extpin(1);
  55. r8a7778_add_standard_devices();
  56. r8a7778_add_usb_phy_device(&usb_phy_platform_data);
  57. pinctrl_register_mappings(bockw_pinctrl_map,
  58. ARRAY_SIZE(bockw_pinctrl_map));
  59. r8a7778_pinmux_init();
  60. fpga = ioremap_nocache(0x18200000, SZ_1M);
  61. if (fpga) {
  62. /*
  63. * CAUTION
  64. *
  65. * IRQ0/1 is cascaded interrupt from FPGA.
  66. * it should be cared in the future
  67. * Now, it is assuming IRQ0 was used only from SMSC.
  68. */
  69. u16 val = ioread16(fpga + IRQ0MR);
  70. val &= ~(1 << 4); /* enable SMSC911x */
  71. iowrite16(val, fpga + IRQ0MR);
  72. iounmap(fpga);
  73. platform_device_register_resndata(
  74. &platform_bus, "smsc911x", -1,
  75. smsc911x_resources, ARRAY_SIZE(smsc911x_resources),
  76. &smsc911x_data, sizeof(smsc911x_data));
  77. }
  78. }
  79. static const char *bockw_boards_compat_dt[] __initdata = {
  80. "renesas,bockw",
  81. NULL,
  82. };
  83. DT_MACHINE_START(BOCKW_DT, "bockw")
  84. .init_early = r8a7778_init_delay,
  85. .init_irq = r8a7778_init_irq_dt,
  86. .init_machine = bockw_init,
  87. .init_time = shmobile_timer_init,
  88. .dt_compat = bockw_boards_compat_dt,
  89. .init_late = r8a7778_init_late,
  90. MACHINE_END