board-ag5evm.c 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. /*
  2. * arch/arm/mach-shmobile/board-ag5evm.c
  3. *
  4. * Copyright (C) 2010 Takashi Yoshii <yoshii.takashi.zj@renesas.com>
  5. * Copyright (C) 2009 Yoshihiro Shimoda <shimoda.yoshihiro@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. */
  21. #include <linux/kernel.h>
  22. #include <linux/init.h>
  23. #include <linux/interrupt.h>
  24. #include <linux/irq.h>
  25. #include <linux/platform_device.h>
  26. #include <linux/delay.h>
  27. #include <linux/io.h>
  28. #include <linux/dma-mapping.h>
  29. #include <linux/serial_sci.h>
  30. #include <linux/smsc911x.h>
  31. #include <linux/gpio.h>
  32. #include <mach/hardware.h>
  33. #include <mach/sh73a0.h>
  34. #include <mach/common.h>
  35. #include <asm/mach-types.h>
  36. #include <asm/mach/arch.h>
  37. #include <asm/mach/map.h>
  38. #include <asm/mach/time.h>
  39. #include <asm/hardware/gic.h>
  40. #include <asm/hardware/cache-l2x0.h>
  41. #include <asm/traps.h>
  42. static struct resource smsc9220_resources[] = {
  43. [0] = {
  44. .start = 0x14000000,
  45. .end = 0x14000000 + SZ_64K - 1,
  46. .flags = IORESOURCE_MEM,
  47. },
  48. [1] = {
  49. .start = gic_spi(33), /* PINT1 */
  50. .flags = IORESOURCE_IRQ,
  51. },
  52. };
  53. static struct smsc911x_platform_config smsc9220_platdata = {
  54. .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
  55. .phy_interface = PHY_INTERFACE_MODE_MII,
  56. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
  57. .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
  58. };
  59. static struct platform_device eth_device = {
  60. .name = "smsc911x",
  61. .id = 0,
  62. .dev = {
  63. .platform_data = &smsc9220_platdata,
  64. },
  65. .resource = smsc9220_resources,
  66. .num_resources = ARRAY_SIZE(smsc9220_resources),
  67. };
  68. static struct platform_device *ag5evm_devices[] __initdata = {
  69. &eth_device,
  70. };
  71. static struct map_desc ag5evm_io_desc[] __initdata = {
  72. /* create a 1:1 entity map for 0xe6xxxxxx
  73. * used by CPGA, INTC and PFC.
  74. */
  75. {
  76. .virtual = 0xe6000000,
  77. .pfn = __phys_to_pfn(0xe6000000),
  78. .length = 256 << 20,
  79. .type = MT_DEVICE_NONSHARED
  80. },
  81. };
  82. static void __init ag5evm_map_io(void)
  83. {
  84. iotable_init(ag5evm_io_desc, ARRAY_SIZE(ag5evm_io_desc));
  85. /* setup early devices and console here as well */
  86. sh73a0_add_early_devices();
  87. shmobile_setup_console();
  88. }
  89. #define PINTC_ADDR 0xe6900000
  90. #define PINTER0A (PINTC_ADDR + 0xa0)
  91. #define PINTCR0A (PINTC_ADDR + 0xb0)
  92. void __init ag5evm_init_irq(void)
  93. {
  94. /* setup PINT: enable PINTA2 as active low */
  95. __raw_writel(__raw_readl(PINTER0A) | (1<<29), PINTER0A);
  96. __raw_writew(__raw_readw(PINTCR0A) | (2<<10), PINTCR0A);
  97. gic_dist_init(0, __io(0xf0001000), 29);
  98. gic_cpu_init(0, __io(0xf0000100));
  99. }
  100. #define PORT144CR 0xe6052090
  101. #define PORT145CR 0xe6052091
  102. #define PORT154CR 0xe605209a
  103. #define PORT155CR 0xe605209b
  104. #define PORT156CR 0xe605209c
  105. #define PORT157CR 0xe605209d
  106. #define PORTR159_128DR 0xe6056004
  107. static void __init ag5evm_init(void)
  108. {
  109. sh73a0_pinmux_init();
  110. /* enable SCIFA2 */
  111. gpio_request(GPIO_FN_SCIFA2_TXD1, NULL);
  112. gpio_request(GPIO_FN_SCIFA2_RXD1, NULL);
  113. gpio_request(GPIO_FN_SCIFA2_RTS1_, NULL);
  114. gpio_request(GPIO_FN_SCIFA2_CTS1_, NULL);
  115. /* enable SMSC911X */
  116. gpio_request(GPIO_PORT144, NULL); /* PINTA2 */
  117. gpio_direction_input(GPIO_PORT144);
  118. gpio_request(GPIO_PORT145, NULL); /* RESET */
  119. gpio_direction_output(GPIO_PORT145, 1);
  120. #ifdef CONFIG_CACHE_L2X0
  121. /* Shared attribute override enable, 64K*8way */
  122. l2x0_init(__io(0xf0100000), 0x00460000, 0xc2000fff);
  123. #endif
  124. sh73a0_add_standard_devices();
  125. platform_add_devices(ag5evm_devices, ARRAY_SIZE(ag5evm_devices));
  126. }
  127. static void __init ag5evm_timer_init(void)
  128. {
  129. sh73a0_clock_init();
  130. shmobile_timer.init();
  131. return;
  132. }
  133. struct sys_timer ag5evm_timer = {
  134. .init = ag5evm_timer_init,
  135. };
  136. MACHINE_START(AG5EVM, "ag5evm")
  137. .map_io = ag5evm_map_io,
  138. .init_irq = ag5evm_init_irq,
  139. .init_machine = ag5evm_init,
  140. .timer = &ag5evm_timer,
  141. MACHINE_END