rd88f5181l-ge-setup.c 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. /*
  2. * arch/arm/mach-orion5x/rd88f5181l-ge-setup.c
  3. *
  4. * Marvell Orion-VoIP GE Reference Design Setup
  5. *
  6. * This file is licensed under the terms of the GNU General Public
  7. * License version 2. This program is licensed "as is" without any
  8. * warranty of any kind, whether express or implied.
  9. */
  10. #include <linux/kernel.h>
  11. #include <linux/init.h>
  12. #include <linux/platform_device.h>
  13. #include <linux/pci.h>
  14. #include <linux/irq.h>
  15. #include <linux/mtd/physmap.h>
  16. #include <linux/mv643xx_eth.h>
  17. #include <linux/ethtool.h>
  18. #include <linux/i2c.h>
  19. #include <net/dsa.h>
  20. #include <asm/mach-types.h>
  21. #include <asm/gpio.h>
  22. #include <asm/leds.h>
  23. #include <asm/mach/arch.h>
  24. #include <asm/mach/pci.h>
  25. #include <mach/orion5x.h>
  26. #include "common.h"
  27. #include "mpp.h"
  28. /*****************************************************************************
  29. * RD-88F5181L GE Info
  30. ****************************************************************************/
  31. /*
  32. * 16M NOR flash Device bus boot chip select
  33. */
  34. #define RD88F5181L_GE_NOR_BOOT_BASE 0xff000000
  35. #define RD88F5181L_GE_NOR_BOOT_SIZE SZ_16M
  36. /*****************************************************************************
  37. * 16M NOR Flash on Device bus Boot chip select
  38. ****************************************************************************/
  39. static struct physmap_flash_data rd88f5181l_ge_nor_boot_flash_data = {
  40. .width = 1,
  41. };
  42. static struct resource rd88f5181l_ge_nor_boot_flash_resource = {
  43. .flags = IORESOURCE_MEM,
  44. .start = RD88F5181L_GE_NOR_BOOT_BASE,
  45. .end = RD88F5181L_GE_NOR_BOOT_BASE +
  46. RD88F5181L_GE_NOR_BOOT_SIZE - 1,
  47. };
  48. static struct platform_device rd88f5181l_ge_nor_boot_flash = {
  49. .name = "physmap-flash",
  50. .id = 0,
  51. .dev = {
  52. .platform_data = &rd88f5181l_ge_nor_boot_flash_data,
  53. },
  54. .num_resources = 1,
  55. .resource = &rd88f5181l_ge_nor_boot_flash_resource,
  56. };
  57. /*****************************************************************************
  58. * General Setup
  59. ****************************************************************************/
  60. static struct orion5x_mpp_mode rd88f5181l_ge_mpp_modes[] __initdata = {
  61. { 0, MPP_GPIO }, /* LED1 */
  62. { 1, MPP_GPIO }, /* LED5 */
  63. { 2, MPP_GPIO }, /* LED4 */
  64. { 3, MPP_GPIO }, /* LED3 */
  65. { 4, MPP_GPIO }, /* PCI_intA */
  66. { 5, MPP_GPIO }, /* RTC interrupt */
  67. { 6, MPP_PCI_CLK }, /* CPU PCI refclk */
  68. { 7, MPP_PCI_CLK }, /* PCI/PCIe refclk */
  69. { 8, MPP_GPIO }, /* 88e6131 interrupt */
  70. { 9, MPP_GPIO }, /* GE_RXERR */
  71. { 10, MPP_GPIO }, /* PCI_intB */
  72. { 11, MPP_GPIO }, /* LED2 */
  73. { 12, MPP_GIGE }, /* GE_TXD[4] */
  74. { 13, MPP_GIGE }, /* GE_TXD[5] */
  75. { 14, MPP_GIGE }, /* GE_TXD[6] */
  76. { 15, MPP_GIGE }, /* GE_TXD[7] */
  77. { 16, MPP_GIGE }, /* GE_RXD[4] */
  78. { 17, MPP_GIGE }, /* GE_RXD[5] */
  79. { 18, MPP_GIGE }, /* GE_RXD[6] */
  80. { 19, MPP_GIGE }, /* GE_RXD[7] */
  81. { -1 },
  82. };
  83. static struct mv643xx_eth_platform_data rd88f5181l_ge_eth_data = {
  84. .phy_addr = MV643XX_ETH_PHY_NONE,
  85. .speed = SPEED_1000,
  86. .duplex = DUPLEX_FULL,
  87. };
  88. static struct dsa_chip_data rd88f5181l_ge_switch_chip_data = {
  89. .port_names[0] = "lan2",
  90. .port_names[1] = "lan1",
  91. .port_names[2] = "wan",
  92. .port_names[3] = "cpu",
  93. .port_names[5] = "lan4",
  94. .port_names[7] = "lan3",
  95. };
  96. static struct dsa_platform_data rd88f5181l_ge_switch_plat_data = {
  97. .nr_chips = 1,
  98. .chip = &rd88f5181l_ge_switch_chip_data,
  99. };
  100. static struct i2c_board_info __initdata rd88f5181l_ge_i2c_rtc = {
  101. I2C_BOARD_INFO("ds1338", 0x68),
  102. };
  103. static void __init rd88f5181l_ge_init(void)
  104. {
  105. /*
  106. * Setup basic Orion functions. Need to be called early.
  107. */
  108. orion5x_init();
  109. orion5x_mpp_conf(rd88f5181l_ge_mpp_modes);
  110. /*
  111. * Configure peripherals.
  112. */
  113. orion5x_ehci0_init();
  114. orion5x_eth_init(&rd88f5181l_ge_eth_data);
  115. orion5x_eth_switch_init(&rd88f5181l_ge_switch_plat_data,
  116. gpio_to_irq(8));
  117. orion5x_i2c_init();
  118. orion5x_uart0_init();
  119. orion5x_setup_dev_boot_win(RD88F5181L_GE_NOR_BOOT_BASE,
  120. RD88F5181L_GE_NOR_BOOT_SIZE);
  121. platform_device_register(&rd88f5181l_ge_nor_boot_flash);
  122. i2c_register_board_info(0, &rd88f5181l_ge_i2c_rtc, 1);
  123. }
  124. static int __init
  125. rd88f5181l_ge_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
  126. {
  127. int irq;
  128. /*
  129. * Check for devices with hard-wired IRQs.
  130. */
  131. irq = orion5x_pci_map_irq(dev, slot, pin);
  132. if (irq != -1)
  133. return irq;
  134. /*
  135. * Cardbus slot.
  136. */
  137. if (pin == 1)
  138. return gpio_to_irq(4);
  139. else
  140. return gpio_to_irq(10);
  141. }
  142. static struct hw_pci rd88f5181l_ge_pci __initdata = {
  143. .nr_controllers = 2,
  144. .swizzle = pci_std_swizzle,
  145. .setup = orion5x_pci_sys_setup,
  146. .scan = orion5x_pci_sys_scan_bus,
  147. .map_irq = rd88f5181l_ge_pci_map_irq,
  148. };
  149. static int __init rd88f5181l_ge_pci_init(void)
  150. {
  151. if (machine_is_rd88f5181l_ge()) {
  152. orion5x_pci_set_cardbus_mode();
  153. pci_common_init(&rd88f5181l_ge_pci);
  154. }
  155. return 0;
  156. }
  157. subsys_initcall(rd88f5181l_ge_pci_init);
  158. MACHINE_START(RD88F5181L_GE, "Marvell Orion-VoIP GE Reference Design")
  159. /* Maintainer: Lennert Buytenhek <buytenh@marvell.com> */
  160. .phys_io = ORION5X_REGS_PHYS_BASE,
  161. .io_pg_offst = ((ORION5X_REGS_VIRT_BASE) >> 18) & 0xFFFC,
  162. .boot_params = 0x00000100,
  163. .init_machine = rd88f5181l_ge_init,
  164. .map_io = orion5x_map_io,
  165. .init_irq = orion5x_init_irq,
  166. .timer = &orion5x_timer,
  167. .fixup = tag_fixup_mem32,
  168. MACHINE_END