buffalo-wxl-setup.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * arch/arm/mach-mv78xx0/buffalo-wxl-setup.c
  4. *
  5. * Buffalo WXL (Terastation Duo) Setup routines
  6. *
  7. * sebastien requiem <[email protected]>
  8. */
  9. #include <linux/kernel.h>
  10. #include <linux/init.h>
  11. #include <linux/platform_device.h>
  12. #include <linux/ata_platform.h>
  13. #include <linux/mv643xx_eth.h>
  14. #include <linux/ethtool.h>
  15. #include <linux/i2c.h>
  16. #include <asm/mach-types.h>
  17. #include <asm/mach/arch.h>
  18. #include "mv78xx0.h"
  19. #include "common.h"
  20. #include "mpp.h"
  21. /* This arch has 2 Giga Ethernet */
  22. static struct mv643xx_eth_platform_data db78x00_ge00_data = {
  23. .phy_addr = MV643XX_ETH_PHY_ADDR(0),
  24. };
  25. static struct mv643xx_eth_platform_data db78x00_ge01_data = {
  26. .phy_addr = MV643XX_ETH_PHY_ADDR(8),
  27. };
  28. /* 2 SATA controller supporting HotPlug */
  29. static struct mv_sata_platform_data db78x00_sata_data = {
  30. .n_ports = 2,
  31. };
  32. static struct i2c_board_info __initdata db78x00_i2c_rtc = {
  33. I2C_BOARD_INFO("ds1338", 0x68),
  34. };
  35. static unsigned int wxl_mpp_config[] __initdata = {
  36. MPP0_GE1_TXCLK,
  37. MPP1_GE1_TXCTL,
  38. MPP2_GE1_RXCTL,
  39. MPP3_GE1_RXCLK,
  40. MPP4_GE1_TXD0,
  41. MPP5_GE1_TXD1,
  42. MPP6_GE1_TXD2,
  43. MPP7_GE1_TXD3,
  44. MPP8_GE1_RXD0,
  45. MPP9_GE1_RXD1,
  46. MPP10_GE1_RXD2,
  47. MPP11_GE1_RXD3,
  48. MPP12_GPIO,
  49. MPP13_SYSRST_OUTn,
  50. MPP14_SATA1_ACTn,
  51. MPP15_SATA0_ACTn,
  52. MPP16_GPIO,
  53. MPP17_GPIO,
  54. MPP18_GPIO,
  55. MPP19_GPIO,
  56. MPP20_GPIO,
  57. MPP21_GPIO,
  58. MPP22_GPIO,
  59. MPP23_GPIO,
  60. MPP24_UA2_TXD,
  61. MPP25_UA2_RXD,
  62. MPP26_UA2_CTSn,
  63. MPP27_UA2_RTSn,
  64. MPP28_GPIO,
  65. MPP29_SYSRST_OUTn,
  66. MPP30_GPIO,
  67. MPP31_GPIO,
  68. MPP32_GPIO,
  69. MPP33_GPIO,
  70. MPP34_GPIO,
  71. MPP35_GPIO,
  72. MPP36_GPIO,
  73. MPP37_GPIO,
  74. MPP38_GPIO,
  75. MPP39_GPIO,
  76. MPP40_UNUSED,
  77. MPP41_UNUSED,
  78. MPP42_UNUSED,
  79. MPP43_UNUSED,
  80. MPP44_UNUSED,
  81. MPP45_UNUSED,
  82. MPP46_UNUSED,
  83. MPP47_UNUSED,
  84. MPP48_SATA1_ACTn,
  85. MPP49_SATA0_ACTn,
  86. 0
  87. };
  88. static void __init wxl_init(void)
  89. {
  90. /*
  91. * Basic MV78xx0 setup. Needs to be called early.
  92. */
  93. mv78xx0_init();
  94. mv78xx0_mpp_conf(wxl_mpp_config);
  95. /*
  96. * Partition on-chip peripherals between the two CPU cores.
  97. */
  98. mv78xx0_ehci0_init();
  99. mv78xx0_ehci1_init();
  100. mv78xx0_ehci2_init();
  101. mv78xx0_ge00_init(&db78x00_ge00_data);
  102. mv78xx0_ge01_init(&db78x00_ge01_data);
  103. mv78xx0_sata_init(&db78x00_sata_data);
  104. mv78xx0_uart0_init();
  105. mv78xx0_uart1_init();
  106. mv78xx0_uart2_init();
  107. mv78xx0_uart3_init();
  108. mv78xx0_i2c_init();
  109. i2c_register_board_info(0, &db78x00_i2c_rtc, 1);
  110. }
  111. static int __init wxl_pci_init(void)
  112. {
  113. if (machine_is_terastation_wxl()) {
  114. /*
  115. * Assign the x16 PCIe slot on the board to CPU core
  116. * #0, and let CPU core #1 have the four x1 slots.
  117. */
  118. if (mv78xx0_core_index() == 0)
  119. mv78xx0_pcie_init(0, 1);
  120. else
  121. mv78xx0_pcie_init(1, 0);
  122. }
  123. return 0;
  124. }
  125. subsys_initcall(wxl_pci_init);
  126. MACHINE_START(TERASTATION_WXL, "Buffalo Nas WXL")
  127. /* Maintainer: Sebastien Requiem <[email protected]> */
  128. .atag_offset = 0x100,
  129. .nr_irqs = MV78XX0_NR_IRQS,
  130. .init_machine = wxl_init,
  131. .map_io = mv78xx0_map_io,
  132. .init_early = mv78xx0_init_early,
  133. .init_irq = mv78xx0_init_irq,
  134. .init_time = mv78xx0_timer_init,
  135. .restart = mv78xx0_restart,
  136. MACHINE_END