board-kzm9g.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /*
  2. * KZM-A9-GT board support
  3. *
  4. * Copyright (C) 2012 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; version 2 of the License.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  18. */
  19. #include <linux/gpio.h>
  20. #include <linux/io.h>
  21. #include <linux/irq.h>
  22. #include <linux/platform_device.h>
  23. #include <linux/smsc911x.h>
  24. #include <linux/usb/r8a66597.h>
  25. #include <mach/irqs.h>
  26. #include <mach/sh73a0.h>
  27. #include <mach/common.h>
  28. #include <asm/hardware/cache-l2x0.h>
  29. #include <asm/hardware/gic.h>
  30. #include <asm/mach-types.h>
  31. #include <asm/mach/arch.h>
  32. /* SMSC 9221 */
  33. static struct resource smsc9221_resources[] = {
  34. [0] = {
  35. .start = 0x10000000, /* CS4 */
  36. .end = 0x100000ff,
  37. .flags = IORESOURCE_MEM,
  38. },
  39. [1] = {
  40. .start = intcs_evt2irq(0x260), /* IRQ3 */
  41. .flags = IORESOURCE_IRQ,
  42. },
  43. };
  44. static struct smsc911x_platform_config smsc9221_platdata = {
  45. .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
  46. .phy_interface = PHY_INTERFACE_MODE_MII,
  47. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
  48. .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
  49. };
  50. static struct platform_device smsc_device = {
  51. .name = "smsc911x",
  52. .dev = {
  53. .platform_data = &smsc9221_platdata,
  54. },
  55. .resource = smsc9221_resources,
  56. .num_resources = ARRAY_SIZE(smsc9221_resources),
  57. };
  58. /* USB external chip */
  59. static struct r8a66597_platdata usb_host_data = {
  60. .on_chip = 0,
  61. .xtal = R8A66597_PLATDATA_XTAL_48MHZ,
  62. };
  63. static struct resource usb_resources[] = {
  64. [0] = {
  65. .start = 0x10010000,
  66. .end = 0x1001ffff - 1,
  67. .flags = IORESOURCE_MEM,
  68. },
  69. [1] = {
  70. .start = intcs_evt2irq(0x220), /* IRQ1 */
  71. .flags = IORESOURCE_IRQ,
  72. },
  73. };
  74. static struct platform_device usb_host_device = {
  75. .name = "r8a66597_hcd",
  76. .dev = {
  77. .platform_data = &usb_host_data,
  78. .dma_mask = NULL,
  79. .coherent_dma_mask = 0xffffffff,
  80. },
  81. .num_resources = ARRAY_SIZE(usb_resources),
  82. .resource = usb_resources,
  83. };
  84. static struct platform_device *kzm_devices[] __initdata = {
  85. &smsc_device,
  86. &usb_host_device,
  87. };
  88. static void __init kzm_init(void)
  89. {
  90. sh73a0_pinmux_init();
  91. /* enable SCIFA4 */
  92. gpio_request(GPIO_FN_SCIFA4_TXD, NULL);
  93. gpio_request(GPIO_FN_SCIFA4_RXD, NULL);
  94. gpio_request(GPIO_FN_SCIFA4_RTS_, NULL);
  95. gpio_request(GPIO_FN_SCIFA4_CTS_, NULL);
  96. /* CS4 for SMSC/USB */
  97. gpio_request(GPIO_FN_CS4_, NULL); /* CS4 */
  98. /* SMSC */
  99. gpio_request(GPIO_PORT224, NULL); /* IRQ3 */
  100. gpio_direction_input(GPIO_PORT224);
  101. #ifdef CONFIG_CACHE_L2X0
  102. /* Early BRESP enable, Shared attribute override enable, 64K*8way */
  103. l2x0_init(IOMEM(0xf0100000), 0x40460000, 0x82000fff);
  104. #endif
  105. sh73a0_add_standard_devices();
  106. platform_add_devices(kzm_devices, ARRAY_SIZE(kzm_devices));
  107. }
  108. MACHINE_START(KZM9G, "kzm9g")
  109. .map_io = sh73a0_map_io,
  110. .init_early = sh73a0_add_early_devices,
  111. .nr_irqs = NR_IRQS_LEGACY,
  112. .init_irq = sh73a0_init_irq,
  113. .handle_irq = gic_handle_irq,
  114. .init_machine = kzm_init,
  115. .timer = &shmobile_timer,
  116. MACHINE_END