+ * Init the hAP ac / 962UiGS-5HacT2HnT hardware (QCA9558).
+ * The hAP ac has 5 ethernet ports provided by an AR8337 switch. Port 1 is
+ * assigned to WAN, ports 2-5 are assigned to LAN. Port 0 is connected to the
+ * SoC, ports 1-5 of the switch are connected to physical ports 1-5 in order.
+ * The SFP cage is not assigned by default on RouterOS. Extra work is required
+ * to support this interface as it is directly connected to the SoC (eth1).
+ * Wireless is provided by a 2.4GHz radio on the SoC (WLAN1) and a 5GHz radio
+ * attached via PCI (QCA9880). Red and green WLAN LEDs are populated however
+ * they are not attached to GPIOs, extra work is required to support these.
+ * PoE and USB output power control is supported.
+ */
+static void __init rb962_setup(void)
+{
+ u32 flags = RBSPI_HAS_USB | RBSPI_HAS_POE | RBSPI_HAS_PCI;
+
+ if (rbspi_platform_setup())
+ return;
+
+ rbspi_peripherals_setup(flags);
+
+ /* Do not call rbspi_network_setup as we have a discrete switch chip */
+ ath79_eth0_pll_data.pll_1000 = 0xae000000;
+ ath79_eth0_pll_data.pll_100 = 0xa0000101;
+ ath79_eth0_pll_data.pll_10 = 0xa0001313;
+
+ ath79_register_mdio(0, 0x0);
+ mdiobus_register_board_info(rb962_mdio0_info,
+ ARRAY_SIZE(rb962_mdio0_info));
+
+ ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN);
+
+ ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0);
+ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
+ ath79_eth0_data.phy_mask = BIT(0);
+ ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
+ ath79_register_eth(0);
+
+ /* WLAN1 MAC is HW MAC + 7 */
+ rbspi_wlan_init(1, 7);
+
+ if (flags & RBSPI_HAS_USB)
+ gpio_request_one(RB962_GPIO_USB_POWER,
+ GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
+ "USB power");
+
+ /* PoE output GPIO is inverted, set GPIOF_ACTIVE_LOW for consistency */
+ if (flags & RBSPI_HAS_POE)
+ gpio_request_one(RB962_GPIO_POE_POWER,
+ GPIOF_OUT_INIT_HIGH | GPIOF_ACTIVE_LOW |
+ GPIOF_EXPORT_DIR_FIXED,
+ "POE power");
+
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(rb962_leds_gpio),
+ rb962_leds_gpio);
+
+ /* This device has a single reset button as gpio 20 */
+ ath79_register_gpio_keys_polled(-1, RBSPI_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(rbspi_gpio_keys_reset20),
+ rbspi_gpio_keys_reset20);
+}
+
+/*
+ * Init the LHG hardware (AR9344).
+ * The LHG 5nD has a single ethernet port connected to PHY0.
+ * Wireless is provided via 5GHz WLAN1.
+ */
+static void __init rblhg_setup(void)
+{
+ u32 flags = RBSPI_HAS_WLAN1 | RBSPI_HAS_MDIO1;
+
+ if (rbspi_platform_setup())
+ return;
+
+ rbspi_peripherals_setup(flags);
+
+ /* GMAC1 is HW MAC, WLAN1 MAC is HW MAC + 1 */
+ rbspi_network_setup(flags, 0, 0, 1);
+
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(rblhg_leds), rblhg_leds);
+
+ ath79_register_gpio_keys_polled(-1, RBSPI_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(rblhg_gpio_keys),
+ rblhg_gpio_keys);
+}
+
+/*
+ * Init the wAP hardware.