board-bockw.c 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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/platform_device.h>
  21. #include <linux/smsc911x.h>
  22. #include <mach/common.h>
  23. #include <mach/irqs.h>
  24. #include <mach/r8a7778.h>
  25. #include <asm/mach/arch.h>
  26. static struct smsc911x_platform_config smsc911x_data = {
  27. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
  28. .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
  29. .flags = SMSC911X_USE_32BIT,
  30. .phy_interface = PHY_INTERFACE_MODE_MII,
  31. };
  32. static struct resource smsc911x_resources[] = {
  33. DEFINE_RES_MEM(0x18300000, 0x1000),
  34. DEFINE_RES_IRQ(irq_pin(0)), /* IRQ 0 */
  35. };
  36. #define IRQ0MR 0x30
  37. static void __init bockw_init(void)
  38. {
  39. void __iomem *fpga;
  40. r8a7778_clock_init();
  41. r8a7778_init_irq_extpin(1);
  42. r8a7778_add_standard_devices();
  43. fpga = ioremap_nocache(0x18200000, SZ_1M);
  44. if (fpga) {
  45. /*
  46. * CAUTION
  47. *
  48. * IRQ0/1 is cascaded interrupt from FPGA.
  49. * it should be cared in the future
  50. * Now, it is assuming IRQ0 was used only from SMSC.
  51. */
  52. u16 val = ioread16(fpga + IRQ0MR);
  53. val &= ~(1 << 4); /* enable SMSC911x */
  54. iowrite16(val, fpga + IRQ0MR);
  55. iounmap(fpga);
  56. platform_device_register_resndata(
  57. &platform_bus, "smsc911x", -1,
  58. smsc911x_resources, ARRAY_SIZE(smsc911x_resources),
  59. &smsc911x_data, sizeof(smsc911x_data));
  60. }
  61. }
  62. static const char *bockw_boards_compat_dt[] __initdata = {
  63. "renesas,bockw",
  64. NULL,
  65. };
  66. DT_MACHINE_START(BOCKW_DT, "bockw")
  67. .init_early = r8a7778_init_delay,
  68. .init_irq = r8a7778_init_irq_dt,
  69. .init_machine = bockw_init,
  70. .init_time = shmobile_timer_init,
  71. .dt_compat = bockw_boards_compat_dt,
  72. MACHINE_END