mach-sc300m.c 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /*
  2. * Abicom International Scorpion SC300M Module support.
  3. *
  4. * Copyright (c) 2012 Qualcomm Atheros
  5. * Copyright (c) 2012-2013 Gabor Juhos <juhosg@openwrt.org>
  6. * Copyright (c) 2017 Conor O'Gorman <i@conorogorman.net>
  7. *
  8. * Permission to use, copy, modify, and/or distribute this software for any
  9. * purpose with or without fee is hereby granted, provided that the above
  10. * copyright notice and this permission notice appear in all copies.
  11. *
  12. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  13. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  14. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  15. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  16. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  17. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  18. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  19. *
  20. */
  21. #include <linux/platform_device.h>
  22. #include <linux/platform_data/phy-at803x.h>
  23. #include <asm/mach-ath79/ar71xx_regs.h>
  24. #include "common.h"
  25. #include "pci.h"
  26. #include "dev-ap9x-pci.h"
  27. #include "dev-gpio-buttons.h"
  28. #include "dev-eth.h"
  29. #include "dev-leds-gpio.h"
  30. #include "dev-m25p80.h"
  31. #include "dev-nfc.h"
  32. #include "dev-usb.h"
  33. #include "dev-wmac.h"
  34. #include "machtypes.h"
  35. #define SC300M_GPIO_LED_WLAN 0
  36. #define SC300M_GPIO_LED_POWER 1
  37. #define SC300M_GPIO_BTN_RESET 17
  38. #define SC300M_KEYS_POLL_INTERVAL 20 /* msecs */
  39. #define SC300M_KEYS_DEBOUNCE_INTERVAL (3 * SC300M_KEYS_POLL_INTERVAL)
  40. #define SC300M_MAC0_OFFSET 0
  41. #define SC300M_MAC1_OFFSET 6
  42. #define SC300M_WMAC_CALDATA_OFFSET 0x1000
  43. #define SC300M_PCIE_CALDATA_OFFSET 0x5000
  44. static struct gpio_led sc300m_leds_gpio[] __initdata = {
  45. {
  46. .name = "sc300m:blue:wlan",
  47. .gpio = SC300M_GPIO_LED_WLAN,
  48. .active_low = 1,
  49. },
  50. {
  51. .name = "sc300m:blue:power",
  52. .gpio = SC300M_GPIO_LED_POWER,
  53. .active_low = 1,
  54. }
  55. };
  56. static struct gpio_keys_button sc300m_gpio_keys[] __initdata = {
  57. {
  58. .desc = "reset",
  59. .type = EV_KEY,
  60. .code = KEY_RESTART,
  61. .debounce_interval = SC300M_KEYS_DEBOUNCE_INTERVAL,
  62. .gpio = SC300M_GPIO_BTN_RESET,
  63. .active_low = 1,
  64. }
  65. };
  66. static struct at803x_platform_data at803x_data = {
  67. .disable_smarteee = 1,
  68. .enable_rgmii_rx_delay = 0,
  69. .enable_rgmii_tx_delay = 0,
  70. };
  71. static struct mdio_board_info sc300m_mdio0_info[] = {
  72. {
  73. .bus_id = "ag71xx-mdio.0",
  74. .mdio_addr = 1,
  75. .platform_data = &at803x_data,
  76. },
  77. };
  78. static void __init sc300m_setup(void)
  79. {
  80. u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
  81. ath79_register_m25p80(NULL);
  82. ath79_register_leds_gpio(-1, ARRAY_SIZE(sc300m_leds_gpio),
  83. sc300m_leds_gpio);
  84. ath79_register_gpio_keys_polled(-1, SC300M_KEYS_POLL_INTERVAL,
  85. ARRAY_SIZE(sc300m_gpio_keys),
  86. sc300m_gpio_keys);
  87. ath79_register_usb();
  88. ath79_register_nfc();
  89. ath79_register_wmac(art + SC300M_WMAC_CALDATA_OFFSET, NULL);
  90. ath79_register_mdio(0, 0);
  91. mdiobus_register_board_info(sc300m_mdio0_info,
  92. ARRAY_SIZE(sc300m_mdio0_info));
  93. ath79_init_mac(ath79_eth0_data.mac_addr, art + SC300M_MAC0_OFFSET, 0);
  94. ath79_eth0_pll_data.pll_1000 = 0xa6000101;
  95. ath79_eth0_pll_data.pll_100 = 0xa4000101;
  96. /* GMAC0 is connected to the RMGII interface */
  97. ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
  98. ath79_eth0_data.phy_mask = 0xF;
  99. ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
  100. ath79_register_eth(0);
  101. /* GMAC1 is connected to the SGMII interface */
  102. ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII;
  103. ath79_eth1_data.speed = SPEED_1000;
  104. ath79_eth1_data.duplex = DUPLEX_FULL;
  105. ath79_register_eth(1);
  106. ath79_register_pci();
  107. }
  108. MIPS_MACHINE(ATH79_MACH_SC300M, "SC300M", "Abicom SC300M", sc300m_setup);