+
+static void __init cf_exxxn_qca953x_eth_setup(void)
+{
+ u8 *mac = (u8 *) KSEG1ADDR(0x1f010000);
+
+ ath79_setup_ar933x_phy4_switch(false, false);
+
+ ath79_register_mdio(0, 0x0);
+
+ ath79_switch_data.phy4_mii_en = 1;
+ ath79_switch_data.phy_poll_mask |= BIT(4);
+
+ /* LAN */
+ ath79_eth1_data.duplex = DUPLEX_FULL;
+ ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
+ ath79_eth1_data.speed = SPEED_1000;
+ ath79_init_mac(ath79_eth1_data.mac_addr, mac, 2);
+ ath79_register_eth(1);
+
+ /* WAN */
+ ath79_eth0_data.duplex = DUPLEX_FULL;
+ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
+ ath79_eth0_data.speed = SPEED_100;
+ ath79_eth0_data.phy_mask = BIT(4);
+ ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
+ ath79_register_eth(0);
+}
+
+static void __init cf_e320n_v2_setup(void)
+{
+ cf_exxxn_common_setup(CF_E320N_V2_GPIO_EXT_WDT);
+
+ cf_exxxn_qca953x_eth_setup();
+
+ /* Disable JTAG (enables GPIO0-3) */
+ ath79_gpio_function_enable(AR934X_GPIO_FUNC_JTAG_DISABLE);
+
+ ath79_gpio_direction_select(CF_E320N_V2_GPIO_LED_LAN, true);
+ ath79_gpio_direction_select(CF_E320N_V2_GPIO_LED_WAN, true);
+ ath79_gpio_direction_select(CF_E320N_V2_GPIO_LED_WLAN, true);
+
+ ath79_gpio_output_select(CF_E320N_V2_GPIO_LED_LAN, 0);
+ ath79_gpio_output_select(CF_E320N_V2_GPIO_LED_WAN, 0);
+ ath79_gpio_output_select(CF_E320N_V2_GPIO_LED_WLAN, 0);
+
+ /* Enable GPIO function for GPIOs in J9 header */
+ ath79_gpio_output_select(CF_E320N_V2_GPIO_HEADER_J9_1, 0);
+ ath79_gpio_output_select(CF_E320N_V2_GPIO_HEADER_J9_2, 0);
+ ath79_gpio_output_select(CF_E320N_V2_GPIO_HEADER_J9_3, 0);
+ ath79_gpio_output_select(CF_E320N_V2_GPIO_HEADER_J9_4, 0);
+
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(cf_e320n_v2_leds_gpio),
+ cf_e320n_v2_leds_gpio);
+
+ ath79_register_gpio_keys_polled(-1, CF_EXXXN_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(cf_e320n_v2_gpio_keys),
+ cf_e320n_v2_gpio_keys);
+}
+
+MIPS_MACHINE(ATH79_MACH_CF_E320N_V2, "CF-E320N-V2", "COMFAST CF-E320N v2",
+ cf_e320n_v2_setup);
+
+static void __init cf_e5x0n_gpio_setup(void)
+{
+ ath79_gpio_direction_select(CF_E5X0N_GPIO_LED_WAN, true);
+
+ ath79_gpio_output_select(CF_E5X0N_GPIO_LED_WAN, 0);
+
+ ath79_register_gpio_keys_polled(-1, CF_EXXXN_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(cf_e320n_v2_gpio_keys),
+ cf_e320n_v2_gpio_keys);
+}
+
+static void __init cf_e520n_setup(void)
+{
+ cf_exxxn_common_setup(-1);
+
+ cf_exxxn_qca953x_eth_setup();
+
+ cf_e5x0n_gpio_setup();
+
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(cf_e520n_leds_gpio),
+ cf_e520n_leds_gpio);
+}
+
+MIPS_MACHINE(ATH79_MACH_CF_E520N, "CF-E520N", "COMFAST CF-E520N",
+ cf_e520n_setup);
+
+static void __init cf_e530n_setup(void)
+{
+ cf_exxxn_common_setup(-1);
+
+ cf_exxxn_qca953x_eth_setup();
+
+ cf_e5x0n_gpio_setup();
+
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(cf_e530n_leds_gpio),
+ cf_e530n_leds_gpio);
+}
+
+MIPS_MACHINE(ATH79_MACH_CF_E530N, "CF-E530N", "COMFAST CF-E530N",
+ cf_e530n_setup);