wnr854t-setup.c 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. /*
  2. * arch/arm/mach-orion5x/wnr854t-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 wnr854t_mpp_modes[] __initdata = {
  24. { 0, MPP_GPIO }, /* Power LED green (0=on) */
  25. { 1, MPP_GPIO }, /* Reset Button (0=off) */
  26. { 2, MPP_GPIO }, /* Power LED blink (0=off) */
  27. { 3, MPP_GPIO }, /* WAN Status LED amber (0=off) */
  28. { 4, MPP_GPIO }, /* PCI int */
  29. { 5, MPP_GPIO }, /* ??? */
  30. { 6, MPP_GPIO }, /* ??? */
  31. { 7, MPP_GPIO }, /* ??? */
  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 WNR854T_NOR_BOOT_BASE 0xf4000000
  50. #define WNR854T_NOR_BOOT_SIZE SZ_8M
  51. static struct mtd_partition wnr854t_nor_flash_partitions[] = {
  52. {
  53. .name = "kernel",
  54. .offset = 0x00000000,
  55. .size = 0x00100000,
  56. }, {
  57. .name = "rootfs",
  58. .offset = 0x00100000,
  59. .size = 0x00660000,
  60. }, {
  61. .name = "uboot",
  62. .offset = 0x00760000,
  63. .size = 0x00040000,
  64. },
  65. };
  66. static struct physmap_flash_data wnr854t_nor_flash_data = {
  67. .width = 2,
  68. .parts = wnr854t_nor_flash_partitions,
  69. .nr_parts = ARRAY_SIZE(wnr854t_nor_flash_partitions),
  70. };
  71. static struct resource wnr854t_nor_flash_resource = {
  72. .flags = IORESOURCE_MEM,
  73. .start = WNR854T_NOR_BOOT_BASE,
  74. .end = WNR854T_NOR_BOOT_BASE + WNR854T_NOR_BOOT_SIZE - 1,
  75. };
  76. static struct platform_device wnr854t_nor_flash = {
  77. .name = "physmap-flash",
  78. .id = 0,
  79. .dev = {
  80. .platform_data = &wnr854t_nor_flash_data,
  81. },
  82. .num_resources = 1,
  83. .resource = &wnr854t_nor_flash_resource,
  84. };
  85. static struct mv643xx_eth_platform_data wnr854t_eth_data = {
  86. .phy_addr = -1,
  87. };
  88. static void __init wnr854t_init(void)
  89. {
  90. /*
  91. * Setup basic Orion functions. Need to be called early.
  92. */
  93. orion5x_init();
  94. orion5x_mpp_conf(wnr854t_mpp_modes);
  95. /*
  96. * Configure peripherals.
  97. */
  98. orion5x_eth_init(&wnr854t_eth_data);
  99. orion5x_uart0_init();
  100. orion5x_setup_dev_boot_win(WNR854T_NOR_BOOT_BASE,
  101. WNR854T_NOR_BOOT_SIZE);
  102. platform_device_register(&wnr854t_nor_flash);
  103. }
  104. static int __init wnr854t_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
  105. {
  106. int irq;
  107. /*
  108. * Check for devices with hard-wired IRQs.
  109. */
  110. irq = orion5x_pci_map_irq(dev, slot, pin);
  111. if (irq != -1)
  112. return irq;
  113. /*
  114. * Mini-PCI slot.
  115. */
  116. if (slot == 7)
  117. return gpio_to_irq(4);
  118. return -1;
  119. }
  120. static struct hw_pci wnr854t_pci __initdata = {
  121. .nr_controllers = 2,
  122. .swizzle = pci_std_swizzle,
  123. .setup = orion5x_pci_sys_setup,
  124. .scan = orion5x_pci_sys_scan_bus,
  125. .map_irq = wnr854t_pci_map_irq,
  126. };
  127. static int __init wnr854t_pci_init(void)
  128. {
  129. if (machine_is_wnr854t())
  130. pci_common_init(&wnr854t_pci);
  131. return 0;
  132. }
  133. subsys_initcall(wnr854t_pci_init);
  134. MACHINE_START(WNR854T, "Netgear WNR854T")
  135. /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */
  136. .phys_io = ORION5X_REGS_PHYS_BASE,
  137. .io_pg_offst = ((ORION5X_REGS_VIRT_BASE) >> 18) & 0xFFFC,
  138. .boot_params = 0x00000100,
  139. .init_machine = wnr854t_init,
  140. .map_io = orion5x_map_io,
  141. .init_irq = orion5x_init_irq,
  142. .timer = &orion5x_timer,
  143. .fixup = tag_fixup_mem32,
  144. MACHINE_END