wrt350n-v2-setup.c 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. /*
  2. * arch/arm/mach-orion5x/wrt350n-v2-setup.c
  3. *
  4. * This file is licensed under the terms of the GNU General Public
  5. * License version 2. This program is licensed "as is" without any
  6. * warranty of any kind, whether express or implied.
  7. */
  8. #include <linux/kernel.h>
  9. #include <linux/init.h>
  10. #include <linux/platform_device.h>
  11. #include <linux/pci.h>
  12. #include <linux/irq.h>
  13. #include <linux/delay.h>
  14. #include <linux/mtd/physmap.h>
  15. #include <linux/mv643xx_eth.h>
  16. #include <asm/mach-types.h>
  17. #include <asm/gpio.h>
  18. #include <asm/mach/arch.h>
  19. #include <asm/mach/pci.h>
  20. #include <asm/arch/orion5x.h>
  21. #include "common.h"
  22. #include "mpp.h"
  23. static struct orion5x_mpp_mode wrt350n_v2_mpp_modes[] __initdata = {
  24. { 0, MPP_GPIO }, /* Power LED green (0=on) */
  25. { 1, MPP_GPIO }, /* Security LED (0=on) */
  26. { 2, MPP_GPIO }, /* Internal Button (0=on) */
  27. { 3, MPP_GPIO }, /* Reset Button (0=on) */
  28. { 4, MPP_GPIO }, /* PCI int */
  29. { 5, MPP_GPIO }, /* Power LED orange (0=on) */
  30. { 6, MPP_GPIO }, /* USB LED (0=on) */
  31. { 7, MPP_GPIO }, /* Wireless LED (0=on) */
  32. { 8, MPP_UNUSED }, /* ??? */
  33. { 9, MPP_GIGE }, /* GE_RXERR */
  34. { 10, MPP_UNUSED }, /* ??? */
  35. { 11, MPP_UNUSED }, /* ??? */
  36. { 12, MPP_GIGE }, /* GE_TXD[4] */
  37. { 13, MPP_GIGE }, /* GE_TXD[5] */
  38. { 14, MPP_GIGE }, /* GE_TXD[6] */
  39. { 15, MPP_GIGE }, /* GE_TXD[7] */
  40. { 16, MPP_GIGE }, /* GE_RXD[4] */
  41. { 17, MPP_GIGE }, /* GE_RXD[5] */
  42. { 18, MPP_GIGE }, /* GE_RXD[6] */
  43. { 19, MPP_GIGE }, /* GE_RXD[7] */
  44. { -1 },
  45. };
  46. /*
  47. * 8M NOR flash Device bus boot chip select
  48. */
  49. #define WRT350N_V2_NOR_BOOT_BASE 0xf4000000
  50. #define WRT350N_V2_NOR_BOOT_SIZE SZ_8M
  51. static struct mtd_partition wrt350n_v2_nor_flash_partitions[] = {
  52. {
  53. .name = "kernel",
  54. .offset = 0x00000000,
  55. .size = 0x00760000,
  56. }, {
  57. .name = "rootfs",
  58. .offset = 0x001a0000,
  59. .size = 0x005c0000,
  60. }, {
  61. .name = "lang",
  62. .offset = 0x00760000,
  63. .size = 0x00040000,
  64. }, {
  65. .name = "nvram",
  66. .offset = 0x007a0000,
  67. .size = 0x00020000,
  68. }, {
  69. .name = "u-boot",
  70. .offset = 0x007c0000,
  71. .size = 0x00040000,
  72. },
  73. };
  74. static struct physmap_flash_data wrt350n_v2_nor_flash_data = {
  75. .width = 1,
  76. .parts = wrt350n_v2_nor_flash_partitions,
  77. .nr_parts = ARRAY_SIZE(wrt350n_v2_nor_flash_partitions),
  78. };
  79. static struct resource wrt350n_v2_nor_flash_resource = {
  80. .flags = IORESOURCE_MEM,
  81. .start = WRT350N_V2_NOR_BOOT_BASE,
  82. .end = WRT350N_V2_NOR_BOOT_BASE + WRT350N_V2_NOR_BOOT_SIZE - 1,
  83. };
  84. static struct platform_device wrt350n_v2_nor_flash = {
  85. .name = "physmap-flash",
  86. .id = 0,
  87. .dev = {
  88. .platform_data = &wrt350n_v2_nor_flash_data,
  89. },
  90. .num_resources = 1,
  91. .resource = &wrt350n_v2_nor_flash_resource,
  92. };
  93. static struct mv643xx_eth_platform_data wrt350n_v2_eth_data = {
  94. .phy_addr = -1,
  95. };
  96. static void __init wrt350n_v2_init(void)
  97. {
  98. /*
  99. * Setup basic Orion functions. Need to be called early.
  100. */
  101. orion5x_init();
  102. orion5x_mpp_conf(wrt350n_v2_mpp_modes);
  103. /*
  104. * Configure peripherals.
  105. */
  106. orion5x_ehci0_init();
  107. orion5x_eth_init(&wrt350n_v2_eth_data);
  108. orion5x_uart0_init();
  109. orion5x_setup_dev_boot_win(WRT350N_V2_NOR_BOOT_BASE,
  110. WRT350N_V2_NOR_BOOT_SIZE);
  111. platform_device_register(&wrt350n_v2_nor_flash);
  112. }
  113. static int __init wrt350n_v2_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
  114. {
  115. int irq;
  116. /*
  117. * Check for devices with hard-wired IRQs.
  118. */
  119. irq = orion5x_pci_map_irq(dev, slot, pin);
  120. if (irq != -1)
  121. return irq;
  122. /*
  123. * Mini-PCI slot.
  124. */
  125. if (slot == 7)
  126. return gpio_to_irq(4);
  127. return -1;
  128. }
  129. static struct hw_pci wrt350n_v2_pci __initdata = {
  130. .nr_controllers = 2,
  131. .swizzle = pci_std_swizzle,
  132. .setup = orion5x_pci_sys_setup,
  133. .scan = orion5x_pci_sys_scan_bus,
  134. .map_irq = wrt350n_v2_pci_map_irq,
  135. };
  136. static int __init wrt350n_v2_pci_init(void)
  137. {
  138. if (machine_is_wrt350n_v2())
  139. pci_common_init(&wrt350n_v2_pci);
  140. return 0;
  141. }
  142. subsys_initcall(wrt350n_v2_pci_init);
  143. MACHINE_START(WRT350N_V2, "Linksys WRT350N v2")
  144. /* Maintainer: Lennert Buytenhek <buytenh@marvell.com> */
  145. .phys_io = ORION5X_REGS_PHYS_BASE,
  146. .io_pg_offst = ((ORION5X_REGS_VIRT_BASE) >> 18) & 0xFFFC,
  147. .boot_params = 0x00000100,
  148. .init_machine = wrt350n_v2_init,
  149. .map_io = orion5x_map_io,
  150. .init_irq = orion5x_init_irq,
  151. .timer = &orion5x_timer,
  152. .fixup = tag_fixup_mem32,
  153. MACHINE_END