board-kota2.c 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. /*
  2. * kota2 board support
  3. *
  4. * Copyright (C) 2011 Renesas Solutions Corp.
  5. * Copyright (C) 2011 Magnus Damm
  6. * Copyright (C) 2010 Takashi Yoshii <yoshii.takashi.zj@renesas.com>
  7. * Copyright (C) 2009 Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; version 2 of the License.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  21. */
  22. #include <linux/kernel.h>
  23. #include <linux/init.h>
  24. #include <linux/interrupt.h>
  25. #include <linux/irq.h>
  26. #include <linux/platform_device.h>
  27. #include <linux/delay.h>
  28. #include <linux/io.h>
  29. #include <linux/smsc911x.h>
  30. #include <linux/gpio.h>
  31. #include <mach/hardware.h>
  32. #include <mach/sh73a0.h>
  33. #include <mach/common.h>
  34. #include <asm/mach-types.h>
  35. #include <asm/mach/arch.h>
  36. #include <asm/mach/map.h>
  37. #include <asm/mach/time.h>
  38. #include <asm/hardware/gic.h>
  39. #include <asm/hardware/cache-l2x0.h>
  40. #include <asm/traps.h>
  41. static struct resource smsc9220_resources[] = {
  42. [0] = {
  43. .start = 0x14000000, /* CS5A */
  44. .end = 0x140000ff, /* A1->A7 */
  45. .flags = IORESOURCE_MEM,
  46. },
  47. [1] = {
  48. .start = gic_spi(33), /* PINTA2 @ PORT144 */
  49. .flags = IORESOURCE_IRQ,
  50. },
  51. };
  52. static struct smsc911x_platform_config smsc9220_platdata = {
  53. .flags = SMSC911X_USE_32BIT, /* 32-bit SW on 16-bit HW bus */
  54. .phy_interface = PHY_INTERFACE_MODE_MII,
  55. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
  56. .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
  57. };
  58. static struct platform_device eth_device = {
  59. .name = "smsc911x",
  60. .id = 0,
  61. .dev = {
  62. .platform_data = &smsc9220_platdata,
  63. },
  64. .resource = smsc9220_resources,
  65. .num_resources = ARRAY_SIZE(smsc9220_resources),
  66. };
  67. static struct platform_device *kota2_devices[] __initdata = {
  68. &eth_device,
  69. };
  70. static struct map_desc kota2_io_desc[] __initdata = {
  71. /* create a 1:1 entity map for 0xe6xxxxxx
  72. * used by CPGA, INTC and PFC.
  73. */
  74. {
  75. .virtual = 0xe6000000,
  76. .pfn = __phys_to_pfn(0xe6000000),
  77. .length = 256 << 20,
  78. .type = MT_DEVICE_NONSHARED
  79. },
  80. };
  81. static void __init kota2_map_io(void)
  82. {
  83. iotable_init(kota2_io_desc, ARRAY_SIZE(kota2_io_desc));
  84. /* setup early devices and console here as well */
  85. sh73a0_add_early_devices();
  86. shmobile_setup_console();
  87. }
  88. #define PINTER0A 0xe69000a0
  89. #define PINTCR0A 0xe69000b0
  90. void __init kota2_init_irq(void)
  91. {
  92. sh73a0_init_irq();
  93. /* setup PINT: enable PINTA2 as active low */
  94. __raw_writel(1 << 29, PINTER0A);
  95. __raw_writew(2 << 10, PINTCR0A);
  96. }
  97. static void __init kota2_init(void)
  98. {
  99. sh73a0_pinmux_init();
  100. /* SCIFA2 (UART2) */
  101. gpio_request(GPIO_FN_SCIFA2_TXD1, NULL);
  102. gpio_request(GPIO_FN_SCIFA2_RXD1, NULL);
  103. gpio_request(GPIO_FN_SCIFA2_RTS1_, NULL);
  104. gpio_request(GPIO_FN_SCIFA2_CTS1_, NULL);
  105. /* SMSC911X */
  106. gpio_request(GPIO_FN_D0_NAF0, NULL);
  107. gpio_request(GPIO_FN_D1_NAF1, NULL);
  108. gpio_request(GPIO_FN_D2_NAF2, NULL);
  109. gpio_request(GPIO_FN_D3_NAF3, NULL);
  110. gpio_request(GPIO_FN_D4_NAF4, NULL);
  111. gpio_request(GPIO_FN_D5_NAF5, NULL);
  112. gpio_request(GPIO_FN_D6_NAF6, NULL);
  113. gpio_request(GPIO_FN_D7_NAF7, NULL);
  114. gpio_request(GPIO_FN_D8_NAF8, NULL);
  115. gpio_request(GPIO_FN_D9_NAF9, NULL);
  116. gpio_request(GPIO_FN_D10_NAF10, NULL);
  117. gpio_request(GPIO_FN_D11_NAF11, NULL);
  118. gpio_request(GPIO_FN_D12_NAF12, NULL);
  119. gpio_request(GPIO_FN_D13_NAF13, NULL);
  120. gpio_request(GPIO_FN_D14_NAF14, NULL);
  121. gpio_request(GPIO_FN_D15_NAF15, NULL);
  122. gpio_request(GPIO_FN_CS5A_, NULL);
  123. gpio_request(GPIO_FN_WE0__FWE, NULL);
  124. gpio_request(GPIO_PORT144, NULL); /* PINTA2 */
  125. gpio_direction_input(GPIO_PORT144);
  126. gpio_request(GPIO_PORT145, NULL); /* RESET */
  127. gpio_direction_output(GPIO_PORT145, 1);
  128. #ifdef CONFIG_CACHE_L2X0
  129. /* Early BRESP enable, Shared attribute override enable, 64K*8way */
  130. l2x0_init(__io(0xf0100000), 0x40460000, 0x82000fff);
  131. #endif
  132. sh73a0_add_standard_devices();
  133. platform_add_devices(kota2_devices, ARRAY_SIZE(kota2_devices));
  134. }
  135. static void __init kota2_timer_init(void)
  136. {
  137. sh73a0_clock_init();
  138. shmobile_timer.init();
  139. return;
  140. }
  141. struct sys_timer kota2_timer = {
  142. .init = kota2_timer_init,
  143. };
  144. MACHINE_START(KOTA2, "kota2")
  145. .map_io = kota2_map_io,
  146. .init_irq = kota2_init_irq,
  147. .handle_irq = shmobile_handle_irq_gic,
  148. .init_machine = kota2_init,
  149. .timer = &kota2_timer,
  150. MACHINE_END