mach-e750a-v4.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /*
  2. * Qxwlan E750A v4 board support
  3. *
  4. * Copyright (C) 2017 Peng Zhang <[email protected]>
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License version 2 as published
  8. * by the Free Software Foundation.
  9. */
  10. #include <linux/phy.h>
  11. #include <linux/gpio.h>
  12. #include <linux/platform_device.h>
  13. #include <linux/ath9k_platform.h>
  14. #include <linux/ar8216_platform.h>
  15. #include <asm/mach-ath79/ar71xx_regs.h>
  16. #include "common.h"
  17. #include "dev-eth.h"
  18. #include "dev-gpio-buttons.h"
  19. #include "dev-leds-gpio.h"
  20. #include "dev-m25p80.h"
  21. #include "dev-usb.h"
  22. #include "dev-wmac.h"
  23. #include "machtypes.h"
  24. #include "pci.h"
  25. #define E750A_V4_GPIO_LED_SYS 14
  26. #define E750A_V4_GPIO_LED_LAN 19
  27. #define E750A_V4_GPIO_LED_WAN 18
  28. #define E750A_V4_GPIO_LED_DS10 15
  29. #define E750A_V4_GPIO_LED_DS20 20
  30. #define E750A_V4_GPIO_LED_WLAN 21
  31. #define E750A_V4_GPIO_BTN_RESET 12
  32. #define E750A_V4_KEYS_POLL_INTERVAL 20 /* msecs */
  33. #define E750A_V4_KEYS_DEBOUNCE_INTERVAL (3 * E750A_V4_KEYS_POLL_INTERVAL)
  34. static struct gpio_led e750a_v4_leds_gpio[] __initdata = {
  35. {
  36. .name = "e750a-v4:green:system",
  37. .gpio = E750A_V4_GPIO_LED_SYS,
  38. .active_low = 1,
  39. },
  40. {
  41. .name = "e750a-v4:green:lan",
  42. .gpio = E750A_V4_GPIO_LED_LAN,
  43. .active_low = 1,
  44. },
  45. {
  46. .name = "e750a-v4:green:wan",
  47. .gpio = E750A_V4_GPIO_LED_WAN,
  48. .active_low = 1,
  49. },
  50. {
  51. .name = "e750a-v4:green:wlan",
  52. .gpio = E750A_V4_GPIO_LED_WLAN,
  53. .active_low = 1,
  54. },
  55. {
  56. .name = "e750a-v4:green:ds10",
  57. .gpio = E750A_V4_GPIO_LED_DS10,
  58. .active_low = 1,
  59. },
  60. {
  61. .name = "e750a-v4:green:ds20",
  62. .gpio = E750A_V4_GPIO_LED_DS20,
  63. .active_low = 1,
  64. },
  65. };
  66. static struct gpio_keys_button e750a_v4_gpio_keys[] __initdata = {
  67. {
  68. .desc = "reset",
  69. .type = EV_KEY,
  70. .code = KEY_RESTART,
  71. .debounce_interval = E750A_V4_KEYS_DEBOUNCE_INTERVAL,
  72. .gpio = E750A_V4_GPIO_BTN_RESET,
  73. .active_low = 1,
  74. },
  75. };
  76. static void __init e750a_v4_setup(void)
  77. {
  78. u8 *mac = (u8 *) KSEG1ADDR(0x1f050400);
  79. u8 *art = (u8 *) KSEG1ADDR(0x1f061000);
  80. ath79_register_m25p80(NULL);
  81. ath79_register_leds_gpio(-1, ARRAY_SIZE(e750a_v4_leds_gpio),
  82. e750a_v4_leds_gpio);
  83. ath79_register_gpio_keys_polled(-1, E750A_V4_KEYS_POLL_INTERVAL,
  84. ARRAY_SIZE(e750a_v4_gpio_keys),
  85. e750a_v4_gpio_keys);
  86. ath79_register_mdio(1, 0x0);
  87. ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_ONLY_MODE);
  88. /* GMAC1 is connected to the internal switch */
  89. ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
  90. ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0);
  91. ath79_register_eth(1);
  92. /* GMAC0 is connected to the PHY4 of the internal switch */
  93. ath79_switch_data.phy4_mii_en = 1;
  94. ath79_switch_data.phy_poll_mask = BIT(4);
  95. ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
  96. ath79_eth0_data.phy_mask = BIT(4);
  97. ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev;
  98. ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1);
  99. ath79_register_eth(0);
  100. ath79_register_pci();
  101. ath79_register_usb();
  102. ath79_register_wmac(art, NULL);
  103. }
  104. MIPS_MACHINE(ATH79_MACH_E750A_V4, "E750A-V4", "Qxlan E750A v4",
  105. e750a_v4_setup);