board-bockw.c 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 const struct pinctrl_map bockw_pinctrl_map[] = {
  38. /* SCIF0 */
  39. PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.0", "pfc-r8a7778",
  40. "scif0_data_a", "scif0"),
  41. PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.0", "pfc-r8a7778",
  42. "scif0_ctrl", "scif0"),
  43. };
  44. #define FPGA 0x18200000
  45. #define IRQ0MR 0x30
  46. static void __init bockw_init(void)
  47. {
  48. void __iomem *base;
  49. r8a7778_clock_init();
  50. r8a7778_init_irq_extpin(1);
  51. r8a7778_add_standard_devices();
  52. pinctrl_register_mappings(bockw_pinctrl_map,
  53. ARRAY_SIZE(bockw_pinctrl_map));
  54. r8a7778_pinmux_init();
  55. base = ioremap_nocache(FPGA, SZ_1M);
  56. if (base) {
  57. /*
  58. * CAUTION
  59. *
  60. * IRQ0/1 is cascaded interrupt from FPGA.
  61. * it should be cared in the future
  62. * Now, it is assuming IRQ0 was used only from SMSC.
  63. */
  64. u16 val = ioread16(base + IRQ0MR);
  65. val &= ~(1 << 4); /* enable SMSC911x */
  66. iowrite16(val, base + IRQ0MR);
  67. iounmap(base);
  68. platform_device_register_resndata(
  69. &platform_bus, "smsc911x", -1,
  70. smsc911x_resources, ARRAY_SIZE(smsc911x_resources),
  71. &smsc911x_data, sizeof(smsc911x_data));
  72. }
  73. }
  74. static const char *bockw_boards_compat_dt[] __initdata = {
  75. "renesas,bockw",
  76. NULL,
  77. };
  78. DT_MACHINE_START(BOCKW_DT, "bockw")
  79. .init_early = r8a7778_init_delay,
  80. .init_irq = r8a7778_init_irq_dt,
  81. .init_machine = bockw_init,
  82. .init_time = shmobile_timer_init,
  83. .dt_compat = bockw_boards_compat_dt,
  84. MACHINE_END