static void __init wndap360_setup(void) { u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); ath79_register_mdio(0, ~(WNDAP360_LAN_PHYMASK)); /* Reusing wifi MAC with offset of 1 as eth0 MAC */ ath79_init_mac(ath79_eth0_data.mac_addr, art + WNDAP360_WMAC0_MAC_OFFSET, 1); ath79_eth0_pll_data.pll_1000 = 0x11110000; ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; ath79_eth0_data.phy_mask = WNDAP360_LAN_PHYMASK; ath79_eth0_data.speed = SPEED_1000; ath79_eth0_data.duplex = DUPLEX_FULL; ath79_register_eth(0); ath79_register_m25p80(NULL); ath79_register_leds_gpio(-1, ARRAY_SIZE(wndap360_leds_gpio), wndap360_leds_gpio); ath79_register_gpio_keys_polled(-1, WNDAP360_KEYS_POLL_INTERVAL, ARRAY_SIZE(wndap360_gpio_keys), wndap360_gpio_keys); ap9x_pci_setup_wmac_led_pin(0, 5); ap9x_pci_setup_wmac_led_pin(1, 5); ap94_pci_init(art + WNDAP360_CALDATA0_OFFSET, art + WNDAP360_WMAC0_MAC_OFFSET, art + WNDAP360_CALDATA1_OFFSET, art + WNDAP360_WMAC1_MAC_OFFSET); }
static void __init tew673gru_wlan_init(void) { u8 mac1[ETH_ALEN], mac2[ETH_ALEN]; u8 *caldata; caldata = (u8 *) KSEG1ADDR(TEW673GRU_CAL_LOCATION_0); if (!tew673gru_is_caldata_valid(caldata)) { caldata = (u8 *)KSEG1ADDR(TEW673GRU_CAL_LOCATION_1); if (!tew673gru_is_caldata_valid(caldata)) { pr_err("no calibration data found\n"); return; } } ath79_parse_ascii_mac(caldata + TEW673GRU_MAC0_OFFSET, mac1); ath79_parse_ascii_mac(caldata + TEW673GRU_MAC1_OFFSET, mac2); ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 2); ath79_init_mac(ath79_eth1_data.mac_addr, mac1, 3); ap9x_pci_setup_wmac_led_pin(0, 5); ap9x_pci_setup_wmac_led_pin(1, 5); ap94_pci_init(caldata + TEW673GRU_CAL0_OFFSET, mac1, caldata + TEW673GRU_CAL1_OFFSET, mac2); }
static void __init dir825b1_wlan_init(void) { u8 *caldata; u8 mac0[ETH_ALEN], mac1[ETH_ALEN]; u8 wmac0[ETH_ALEN], wmac1[ETH_ALEN]; caldata = (u8 *) KSEG1ADDR(DIR825B1_CAL_LOCATION_0); if (!dir825b1_is_caldata_valid(caldata)) { caldata = (u8 *)KSEG1ADDR(DIR825B1_CAL_LOCATION_1); if (!dir825b1_is_caldata_valid(caldata)) { pr_err("no calibration data found\n"); return; } } ath79_parse_ascii_mac(caldata + DIR825B1_MAC0_OFFSET, mac0); ath79_parse_ascii_mac(caldata + DIR825B1_MAC1_OFFSET, mac1); ath79_init_mac(ath79_eth0_data.mac_addr, mac0, 0); ath79_init_mac(ath79_eth1_data.mac_addr, mac1, 0); ath79_init_mac(wmac0, mac0, 0); ath79_init_mac(wmac1, mac1, 1); ap9x_pci_setup_wmac_led_pin(0, 5); ap9x_pci_setup_wmac_led_pin(1, 5); ap94_pci_init(caldata + DIR825B1_CAL0_OFFSET, wmac0, caldata + DIR825B1_CAL1_OFFSET, wmac1); }
static void __init wrt400n_setup(void) { u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); u8 *mac = art + WRT400N_MAC_ADDR_OFFSET; ar71xx_add_device_mdio(0x0); ar71xx_init_mac(ar71xx_eth0_data.mac_addr, mac, 1); ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; ar71xx_eth0_data.speed = SPEED_100; ar71xx_eth0_data.duplex = DUPLEX_FULL; ar71xx_init_mac(ar71xx_eth1_data.mac_addr, mac, 2); ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; ar71xx_eth1_data.phy_mask = 0x10; ar71xx_add_device_eth(0); ar71xx_add_device_eth(1); ar71xx_add_device_m25p80(&wrt400n_flash_data); ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(wrt400n_leds_gpio), wrt400n_leds_gpio); ar71xx_register_gpio_keys_polled(-1, WRT400N_KEYS_POLL_INTERVAL, ARRAY_SIZE(wrt400n_gpio_keys), wrt400n_gpio_keys); ap94_pci_init(art + WRT400N_CALDATA0_OFFSET, NULL, art + WRT400N_CALDATA1_OFFSET, NULL); }
static void __init wndr3700_common_setup(void) { u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); ar71xx_init_mac(ar71xx_eth0_data.mac_addr, art + WNDR3700_ETH0_MAC_OFFSET, 0); ar71xx_eth0_pll_data.pll_1000 = 0x11110000; ar71xx_eth0_data.mii_bus_dev = &wndr3700_rtl8366s_device.dev; ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; ar71xx_eth0_data.speed = SPEED_1000; ar71xx_eth0_data.duplex = DUPLEX_FULL; ar71xx_init_mac(ar71xx_eth1_data.mac_addr, art + WNDR3700_ETH1_MAC_OFFSET, 0); ar71xx_eth1_pll_data.pll_1000 = 0x11110000; ar71xx_eth1_data.mii_bus_dev = &wndr3700_rtl8366s_device.dev; ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; ar71xx_eth1_data.phy_mask = 0x10; ar71xx_add_device_eth(0); ar71xx_add_device_eth(1); ar71xx_add_device_usb(); ar71xx_add_device_m25p80(&wndr3700_flash_data); ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(wndr3700_leds_gpio), wndr3700_leds_gpio); ar71xx_register_gpio_keys_polled(-1, WNDR3700_KEYS_POLL_INTERVAL, ARRAY_SIZE(wndr3700_gpio_keys), wndr3700_gpio_keys); platform_device_register(&wndr3700_rtl8366s_device); platform_device_register_simple("wndr3700-led-usb", -1, NULL, 0); ap94_pci_setup_wmac_led_pin(0, 5); ap94_pci_setup_wmac_led_pin(1, 5); /* 2.4 GHz uses the first fixed antenna group (1, 0, 1, 0) */ ap94_pci_setup_wmac_gpio(0, (0xf << 6), (0xa << 6)); /* 5 GHz uses the second fixed antenna group (0, 1, 1, 0) */ ap94_pci_setup_wmac_gpio(1, (0xf << 6), (0x6 << 6)); ap94_pci_init(art + WNDR3700_CALDATA0_OFFSET, art + WNDR3700_WMAC0_MAC_OFFSET, art + WNDR3700_CALDATA1_OFFSET, art + WNDR3700_WMAC1_MAC_OFFSET); }
static void __init tew673gru_setup(void) { u8 mac1[ETH_ALEN], mac2[ETH_ALEN]; tew673gru_read_ascii_mac(mac1, TEW673GRU_MAC_LOCATION_0); tew673gru_read_ascii_mac(mac2, TEW673GRU_MAC_LOCATION_1); ath79_register_mdio(0, 0x0); ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 2); ath79_eth0_data.mii_bus_dev = &tew673gru_rtl8366s_device.dev; ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; ath79_eth0_data.speed = SPEED_1000; ath79_eth0_data.duplex = DUPLEX_FULL; ath79_eth0_pll_data.pll_1000 = 0x11110000; ath79_init_mac(ath79_eth1_data.mac_addr, mac1, 3); ath79_eth1_data.mii_bus_dev = &tew673gru_rtl8366s_device.dev; ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; ath79_eth1_data.phy_mask = 0x10; ath79_eth1_pll_data.pll_1000 = 0x11110000; ath79_register_eth(0); ath79_register_eth(1); ath79_register_m25p80(NULL); ath79_register_leds_gpio(-1, ARRAY_SIZE(tew673gru_leds_gpio), tew673gru_leds_gpio); ath79_register_gpio_keys_polled(-1, TEW673GRU_KEYS_POLL_INTERVAL, ARRAY_SIZE(tew673gru_gpio_keys), tew673gru_gpio_keys); ath79_register_usb(); platform_device_register(&tew673gru_rtl8366s_device); ap9x_pci_setup_wmac_led_pin(0, 5); ap9x_pci_setup_wmac_led_pin(1, 5); ap94_pci_init((u8 *) KSEG1ADDR(TEW673GRU_CAL_LOCATION_0), mac1, (u8 *) KSEG1ADDR(TEW673GRU_CAL_LOCATION_1), mac2); spi_register_board_info(tew673gru_spi_info, ARRAY_SIZE(tew673gru_spi_info)); platform_device_register(&tew673gru_spi_device); }
static void __init dir825b1_setup(void) { u8 mac[6], i; memcpy(mac, (u8*)KSEG1ADDR(DIR825B1_MAC_LOCATION_1), 6); for(i = 5; i >= 3; i--) if(++mac[i] != 0x00) break; ar71xx_set_mac_base(mac); ar71xx_add_device_mdio(0x0); ar71xx_eth0_data.mii_bus_dev = &dir825b1_rtl8366s_device.dev; ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; ar71xx_eth0_data.speed = SPEED_1000; ar71xx_eth0_data.duplex = DUPLEX_FULL; ar71xx_eth0_pll_data.pll_1000 = 0x11110000; ar71xx_eth1_data.mii_bus_dev = &dir825b1_rtl8366s_device.dev; ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; ar71xx_eth1_data.phy_mask = 0x10; ar71xx_eth1_pll_data.pll_1000 = 0x11110000; ar71xx_add_device_eth(0); ar71xx_add_device_eth(1); ar71xx_add_device_m25p80(&dir825b1_flash_data); ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(dir825b1_leds_gpio), dir825b1_leds_gpio); ar71xx_add_device_gpio_buttons(-1, DIR825B1_BUTTONS_POLL_INTERVAL, ARRAY_SIZE(dir825b1_gpio_buttons), dir825b1_gpio_buttons); ar71xx_add_device_usb(); platform_device_register(&dir825b1_rtl8366s_device); ap94_pci_setup_wmac_led_pin(0, 5); ap94_pci_setup_wmac_led_pin(1, 5); ap94_pci_init((u8 *) KSEG1ADDR(DIR825B1_CAL_LOCATION_0), (u8 *) KSEG1ADDR(DIR825B1_MAC_LOCATION_0), (u8 *) KSEG1ADDR(DIR825B1_CAL_LOCATION_1), (u8 *) KSEG1ADDR(DIR825B1_MAC_LOCATION_1)); }
static void __init wzrhpag300h_setup(void) { u8 *eeprom1 = (u8 *) KSEG1ADDR(0x1f051000); u8 *eeprom2 = (u8 *) KSEG1ADDR(0x1f055000); u8 *mac1 = eeprom1 + WZRHPAG300H_MAC_OFFSET; u8 *mac2 = eeprom2 + WZRHPAG300H_MAC_OFFSET; ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0); ath79_init_mac(ath79_eth1_data.mac_addr, mac2, 1); ath79_register_mdio(0, ~(BIT(0) | BIT(4))); ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; ath79_eth0_data.speed = SPEED_1000; ath79_eth0_data.duplex = DUPLEX_FULL; ath79_eth0_data.phy_mask = BIT(0); ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; ath79_eth1_data.phy_mask = BIT(4); ath79_register_eth(0); ath79_register_eth(1); gpio_request_one(2, GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, "USB power"); ath79_register_usb(); ath79_register_leds_gpio(-1, ARRAY_SIZE(wzrhpag300h_leds_gpio), wzrhpag300h_leds_gpio); ath79_register_gpio_keys_polled(-1, WZRHPAG300H_KEYS_POLL_INTERVAL, ARRAY_SIZE(wzrhpag300h_gpio_keys), wzrhpag300h_gpio_keys); ath79_register_m25p80_multi(&wzrhpag300h_flash_data); ap94_pci_init(eeprom1, mac1, eeprom2, mac2); ap9x_pci_setup_wmac_led_pin(0, 1); ap9x_pci_setup_wmac_led_pin(1, 5); ap9x_pci_setup_wmac_leds(0, wzrhpag300h_wmac0_leds_gpio, ARRAY_SIZE(wzrhpag300h_wmac0_leds_gpio)); ap9x_pci_setup_wmac_leds(1, wzrhpag300h_wmac1_leds_gpio, ARRAY_SIZE(wzrhpag300h_wmac1_leds_gpio)); }
static void __init dir825b1_setup(void) { u8 mac1[ETH_ALEN], mac2[ETH_ALEN]; dir825b1_read_ascii_mac(mac1, DIR825B1_MAC_LOCATION_0); dir825b1_read_ascii_mac(mac2, DIR825B1_MAC_LOCATION_1); ath79_register_mdio(0, 0x0); ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 2); ath79_eth0_data.mii_bus_dev = &dir825b1_rtl8366s_device.dev; ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; ath79_eth0_data.speed = SPEED_1000; ath79_eth0_data.duplex = DUPLEX_FULL; ath79_eth0_pll_data.pll_1000 = 0x11110000; ath79_init_mac(ath79_eth1_data.mac_addr, mac1, 3); ath79_eth1_data.mii_bus_dev = &dir825b1_rtl8366s_device.dev; ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; ath79_eth1_data.phy_mask = 0x10; ath79_eth1_pll_data.pll_1000 = 0x11110000; ath79_register_eth(0); ath79_register_eth(1); ath79_register_m25p80(&dir825b1_flash_data); ath79_register_leds_gpio(-1, ARRAY_SIZE(dir825b1_leds_gpio), dir825b1_leds_gpio); ath79_register_gpio_keys_polled(-1, DIR825B1_KEYS_POLL_INTERVAL, ARRAY_SIZE(dir825b1_gpio_keys), dir825b1_gpio_keys); ath79_register_usb(); platform_device_register(&dir825b1_rtl8366s_device); ap9x_pci_setup_wmac_led_pin(0, 5); ap9x_pci_setup_wmac_led_pin(1, 5); ap94_pci_init((u8 *) KSEG1ADDR(DIR825B1_CAL_LOCATION_0), mac1, (u8 *) KSEG1ADDR(DIR825B1_CAL_LOCATION_1), mac2); }
static void __init wzrhpag300h_setup(void) { u8 *eeprom1 = (u8 *) KSEG1ADDR(0x1f051000); u8 *eeprom2 = (u8 *) KSEG1ADDR(0x1f055000); u8 *mac1 = eeprom1 + WZRHPAG300H_MAC_OFFSET; u8 *mac2 = eeprom2 + WZRHPAG300H_MAC_OFFSET; ar71xx_init_mac(ar71xx_eth0_data.mac_addr, mac1, 0); ar71xx_init_mac(ar71xx_eth1_data.mac_addr, mac2, 1); ar71xx_add_device_mdio(0, ~(BIT(0) | BIT(4))); ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; ar71xx_eth0_data.speed = SPEED_1000; ar71xx_eth0_data.duplex = DUPLEX_FULL; ar71xx_eth0_data.phy_mask = BIT(0); ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; ar71xx_eth1_data.phy_mask = BIT(4); ar71xx_add_device_eth(0); ar71xx_add_device_eth(1); ar71xx_add_device_usb(); gpio_request(2, "usb"); gpio_direction_output(2, 1); ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(wzrhpag300h_leds_gpio), wzrhpag300h_leds_gpio); ar71xx_register_gpio_keys_polled(-1, WZRHPAG300H_KEYS_POLL_INTERVAL, ARRAY_SIZE(wzrhpag300h_gpio_keys), wzrhpag300h_gpio_keys); ar71xx_add_device_spi(NULL, ar71xx_spi_info, ARRAY_SIZE(ar71xx_spi_info)); add_mtd_concat_notifier(); ap94_pci_init(eeprom1, mac1, eeprom2, mac2); }
static void __init ap96_setup(void) { u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); ath79_register_mdio(0, ~(AP96_WAN_PHYMASK | AP96_LAN_PHYMASK)); ath79_init_mac(ath79_eth0_data.mac_addr, art, 0); ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; ath79_eth0_data.phy_mask = AP96_LAN_PHYMASK; ath79_eth0_data.speed = SPEED_1000; ath79_eth0_data.duplex = DUPLEX_FULL; ath79_register_eth(0); ath79_init_mac(ath79_eth1_data.mac_addr, art, 1); ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; ath79_eth1_data.phy_mask = AP96_WAN_PHYMASK; ath79_eth1_pll_data.pll_1000 = 0x1f000000; ath79_register_eth(1); ath79_register_usb(); ath79_register_m25p80(&ap96_flash_data); ath79_register_leds_gpio(-1, ARRAY_SIZE(ap96_leds_gpio), ap96_leds_gpio); ath79_register_gpio_keys_polled(-1, AP96_KEYS_POLL_INTERVAL, ARRAY_SIZE(ap96_gpio_keys), ap96_gpio_keys); ap94_pci_init(art + AP96_CALDATA0_OFFSET, art + AP96_WMAC0_MAC_OFFSET, art + AP96_CALDATA1_OFFSET, art + AP96_WMAC1_MAC_OFFSET); }
static void __init wzrhpag300h_setup(void) { u8 *eeprom1 = (u8 *) KSEG1ADDR(0x1f051000); u8 *eeprom2 = (u8 *) KSEG1ADDR(0x1f055000); u8 *mac1 = eeprom1 + WZRHPAG300H_MAC_OFFSET; u8 *mac2 = eeprom2 + WZRHPAG300H_MAC_OFFSET; ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0); ath79_init_mac(ath79_eth1_data.mac_addr, mac2, 1); ath79_register_mdio(0, ~(BIT(0) | BIT(4))); ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; ath79_eth0_data.speed = SPEED_1000; ath79_eth0_data.duplex = DUPLEX_FULL; ath79_eth0_data.phy_mask = BIT(0); ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; ath79_eth1_data.phy_mask = BIT(4); ath79_register_eth(0); ath79_register_eth(1); ath79_register_usb(); gpio_request(2, "usb"); gpio_direction_output(2, 1); ath79_register_leds_gpio(-1, ARRAY_SIZE(wzrhpag300h_leds_gpio), wzrhpag300h_leds_gpio); ath79_register_gpio_keys_polled(-1, WZRHPAG300H_KEYS_POLL_INTERVAL, ARRAY_SIZE(wzrhpag300h_gpio_keys), wzrhpag300h_gpio_keys); ath79_register_m25p80_multi(&wzrhpag300h_flash_data); ap94_pci_init(eeprom1, mac1, eeprom2, mac2); }
static void __init cr5000_setup(void) { u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); ath79_gpio_function_enable(AR934X_GPIO_FUNC_JTAG_DISABLE); gpio_request_one(CR5000_GPIO_LED_POWER_ENABLE, GPIOF_OUT_INIT_LOW, "Power LED enable"); ath79_gpio_output_select(CR5000_GPIO_LED_POWER_AMBER, AR934X_GPIO_OUT_GPIO); ath79_gpio_output_select(CR5000_GPIO_LED_WLAN_2G, AR934X_GPIO_OUT_GPIO); ath79_gpio_output_select(CR5000_GPIO_LED_WPS, AR934X_GPIO_OUT_GPIO); ath79_register_m25p80(NULL); ath79_register_leds_gpio(-1, ARRAY_SIZE(cr5000_leds_gpio), cr5000_leds_gpio); ath79_register_gpio_keys_polled(-1, CR5000_KEYS_POLL_INTERVAL, ARRAY_SIZE(cr5000_gpio_keys), cr5000_gpio_keys); ath79_register_usb(); ath79_register_wmac(art + CR5000_WMAC_CALDATA_OFFSET, art + CR5000_WMAC_MAC_OFFSET); ap94_pci_init(NULL, NULL, NULL, art + CR5000_PCIE_MAC_OFFSET); ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0); ath79_register_mdio(0, 0x0); ath79_init_mac(ath79_eth0_data.mac_addr, art + CR5000_MAC0_OFFSET, 0); mdiobus_register_board_info(cr5000_mdio0_info, ARRAY_SIZE(cr5000_mdio0_info)); /* GMAC0 is connected to an AR8327 switch */ 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_eth0_pll_data.pll_1000 = 0x06000000; ath79_register_eth(0); }
static void __init wrt400n_setup(void) { u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); u8 mac[6]; int i; memcpy(mac, art + WRT400N_MAC_ADDR_OFFSET, 6); for (i = 5; i >= 3; i--) if (++mac[i] != 0x00) break; ar71xx_set_mac_base(mac); ar71xx_add_device_mdio(0x0); ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; ar71xx_eth0_data.speed = SPEED_100; ar71xx_eth0_data.duplex = DUPLEX_FULL; ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII; ar71xx_eth1_data.phy_mask = 0x10; ar71xx_add_device_eth(0); ar71xx_add_device_eth(1); ar71xx_add_device_m25p80(&wrt400n_flash_data); ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(wrt400n_leds_gpio), wrt400n_leds_gpio); ar71xx_add_device_gpio_buttons(-1, WRT400N_BUTTONS_POLL_INTERVAL, ARRAY_SIZE(wrt400n_gpio_buttons), wrt400n_gpio_buttons); ap94_pci_init(art + WRT400N_CALDATA0_OFFSET, NULL, art + WRT400N_CALDATA1_OFFSET, NULL); }