board-bockw.c 2.7 KB

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