From 23d989b0ca567ac6a3cd6adf6cef344b911848d1 Mon Sep 17 00:00:00 2001 From: acoul Date: Thu, 31 Mar 2016 21:46:35 +0300 Subject: [PATCH] linux/ar71xx: rework RB-711 patch --- .../702-MIPS-ath79-add-rb711.patch | 107 ++++++++++++++++-- .../702-MIPS-ath79-add-rb711.patch | 107 ++++++++++++++++-- .../702-MIPS-ath79-add-rb711.patch | 107 ++++++++++++++++-- 3 files changed, 285 insertions(+), 36 deletions(-) diff --git a/target/linux/ar71xx/patches-3.18/702-MIPS-ath79-add-rb711.patch b/target/linux/ar71xx/patches-3.18/702-MIPS-ath79-add-rb711.patch index 0d0ac625c3..abfac705df 100644 --- a/target/linux/ar71xx/patches-3.18/702-MIPS-ath79-add-rb711.patch +++ b/target/linux/ar71xx/patches-3.18/702-MIPS-ath79-add-rb711.patch @@ -1,16 +1,25 @@ --- a/arch/mips/ath79/mach-rb750.c +++ b/arch/mips/ath79/mach-rb750.c -@@ -325,6 +325,32 @@ static void __init rb751_wlan_setup(void - ap91_pci_init(NULL, mac); - } +@@ -27,6 +27,7 @@ + #include "dev-usb.h" + #include "dev-eth.h" + #include "machtypes.h" ++#include "pci.h" + #include "routerboot.h" + static struct rb750_led_data rb750_leds[] = { +@@ -344,3 +345,104 @@ static void __init rb751g_setup(void) + + MIPS_MACHINE(ATH79_MACH_RB_751G, "751g", "MikroTik RouterBOARD 751G", + rb751g_setup); ++ +static void __init rb711_setup(void) +{ + ath79_gpio_function_disable(AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN | -+ AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN | -+ AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN | -+ AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN | -+ AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN); ++ AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN | ++ AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN | ++ AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN | ++ AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN); + + ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0); + @@ -24,22 +33,96 @@ + rb750_nand_data.latch_change = rb750_latch_change; + platform_device_register(&rb750_nand_device); + ++ ++ ath79_register_pci(); + rb751_wlan_setup(); +} + +MIPS_MACHINE(ATH79_MACH_RB_711, "711", "MikroTik RouterBOARD 711", -+ rb711_setup); ++ rb711_setup); ++ ++MIPS_MACHINE(ATH79_MACH_RB_711_R3, "711r3", "MikroTik RouterBOARD 711", ++ rb711_setup); ++ ++static void __init rb711g_setup(void) ++{ ++ ath79_gpio_function_disable(AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN | ++ AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN | ++ AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN | ++ AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN | ++ AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN); ++ ++ ath79_register_mdio(0, 0x0); ++ ++ mdiobus_register_board_info(rb750g3_mdio_info, ++ ARRAY_SIZE(rb750g3_mdio_info)); ++ ++ ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0); ++ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; ++ ++ ath79_register_eth(0); ++ ++ rb750_leds_data.num_leds = ARRAY_SIZE(rb750gr3_leds); ++ rb750_leds_data.leds = rb750gr3_leds; ++ rb750_leds_data.latch_change = rb750gr3_latch_change; ++ platform_device_register(&rb750_leds_device); ++ ++ rb750_nand_data.nce_line = RB7XX_NAND_NCE; ++ rb750_nand_data.enable_pins = rb750gr3_nand_enable_pins; ++ rb750_nand_data.disable_pins = rb750gr3_nand_disable_pins; ++ rb750_nand_data.latch_change = rb750gr3_latch_change; ++ platform_device_register(&rb750_nand_device); ++ ++ ath79_register_pci(); ++ rb751_wlan_setup(); ++} ++ ++MIPS_MACHINE(ATH79_MACH_RB_711G, "711G", "MikroTik RouterBOARD 711G", ++ rb711g_setup); ++ ++MIPS_MACHINE(ATH79_MACH_RB_711GT, "711GT", "MikroTik RouterBOARD 711GT", ++ rb711g_setup); ++ ++static void __init rb711gr100_setup(void) ++{ ++ ath79_register_mdio(0, 0x0); ++ mdiobus_register_board_info(rb750g3_mdio_info, ++ ARRAY_SIZE(rb750g3_mdio_info)); ++ ++ 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_register_eth(0); ++ ++ rb750_leds_data.num_leds = ARRAY_SIZE(rb750gr3_leds); ++ rb750_leds_data.leds = rb750gr3_leds; ++ rb750_leds_data.latch_change = rb750gr3_latch_change; ++ platform_device_register(&rb750_leds_device); ++ ++ rb750_nand_data.nce_line = RB7XX_NAND_NCE; ++ rb750_nand_data.enable_pins = rb750gr3_nand_enable_pins; ++ rb750_nand_data.disable_pins = rb750gr3_nand_disable_pins; ++ rb750_nand_data.latch_change = rb750gr3_latch_change; ++ platform_device_register(&rb750_nand_device); ++ ++ ath79_register_usb(); ++ ath79_register_pci(); ++ rb751_wlan_setup(); ++} + - static void __init rb751_setup(void) - { - rb750_setup(); ++MIPS_MACHINE(ATH79_MACH_RB_711GR100, "711Gr100", "MikroTik RouterBOARD 711Gr100", ++ rb711gr100_setup); --- a/arch/mips/ath79/machtypes.h +++ b/arch/mips/ath79/machtypes.h -@@ -127,6 +127,7 @@ enum ath79_mach_type { +@@ -131,6 +131,10 @@ enum ath79_mach_type { ATH79_MACH_RB_493, /* Mikrotik RouterBOARD 493/493AH */ ATH79_MACH_RB_493G, /* Mikrotik RouterBOARD 493G */ ATH79_MACH_RB_711GR100, /* Mikrotik RouterBOARD 911/912 boards */ + ATH79_MACH_RB_711, /* MikroTik RouterBOARD 711 */ ++ ATH79_MACH_RB_711_R3, /* MikroTik RouterBOARD 711 */ ++ ATH79_MACH_RB_711G, /* MikroTik RouterBOARD 711G */ ++ ATH79_MACH_RB_711GT, /* MikroTik RouterBOARD 711GT */ ATH79_MACH_RB_750, /* MikroTik RouterBOARD 750 */ ATH79_MACH_RB_750G_R3, /* MikroTik RouterBOARD 750GL */ ATH79_MACH_RB_751, /* MikroTik RouterBOARD 751 */ diff --git a/target/linux/ar71xx/patches-4.1/702-MIPS-ath79-add-rb711.patch b/target/linux/ar71xx/patches-4.1/702-MIPS-ath79-add-rb711.patch index 6f56781d49..abfac705df 100644 --- a/target/linux/ar71xx/patches-4.1/702-MIPS-ath79-add-rb711.patch +++ b/target/linux/ar71xx/patches-4.1/702-MIPS-ath79-add-rb711.patch @@ -1,16 +1,25 @@ --- a/arch/mips/ath79/mach-rb750.c +++ b/arch/mips/ath79/mach-rb750.c -@@ -325,6 +325,32 @@ static void __init rb751_wlan_setup(void - ap91_pci_init(NULL, mac); - } +@@ -27,6 +27,7 @@ + #include "dev-usb.h" + #include "dev-eth.h" + #include "machtypes.h" ++#include "pci.h" + #include "routerboot.h" + static struct rb750_led_data rb750_leds[] = { +@@ -344,3 +345,104 @@ static void __init rb751g_setup(void) + + MIPS_MACHINE(ATH79_MACH_RB_751G, "751g", "MikroTik RouterBOARD 751G", + rb751g_setup); ++ +static void __init rb711_setup(void) +{ + ath79_gpio_function_disable(AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN | -+ AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN | -+ AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN | -+ AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN | -+ AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN); ++ AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN | ++ AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN | ++ AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN | ++ AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN); + + ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0); + @@ -24,22 +33,96 @@ + rb750_nand_data.latch_change = rb750_latch_change; + platform_device_register(&rb750_nand_device); + ++ ++ ath79_register_pci(); + rb751_wlan_setup(); +} + +MIPS_MACHINE(ATH79_MACH_RB_711, "711", "MikroTik RouterBOARD 711", -+ rb711_setup); ++ rb711_setup); ++ ++MIPS_MACHINE(ATH79_MACH_RB_711_R3, "711r3", "MikroTik RouterBOARD 711", ++ rb711_setup); ++ ++static void __init rb711g_setup(void) ++{ ++ ath79_gpio_function_disable(AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN | ++ AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN | ++ AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN | ++ AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN | ++ AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN); ++ ++ ath79_register_mdio(0, 0x0); ++ ++ mdiobus_register_board_info(rb750g3_mdio_info, ++ ARRAY_SIZE(rb750g3_mdio_info)); ++ ++ ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0); ++ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; ++ ++ ath79_register_eth(0); ++ ++ rb750_leds_data.num_leds = ARRAY_SIZE(rb750gr3_leds); ++ rb750_leds_data.leds = rb750gr3_leds; ++ rb750_leds_data.latch_change = rb750gr3_latch_change; ++ platform_device_register(&rb750_leds_device); ++ ++ rb750_nand_data.nce_line = RB7XX_NAND_NCE; ++ rb750_nand_data.enable_pins = rb750gr3_nand_enable_pins; ++ rb750_nand_data.disable_pins = rb750gr3_nand_disable_pins; ++ rb750_nand_data.latch_change = rb750gr3_latch_change; ++ platform_device_register(&rb750_nand_device); ++ ++ ath79_register_pci(); ++ rb751_wlan_setup(); ++} ++ ++MIPS_MACHINE(ATH79_MACH_RB_711G, "711G", "MikroTik RouterBOARD 711G", ++ rb711g_setup); ++ ++MIPS_MACHINE(ATH79_MACH_RB_711GT, "711GT", "MikroTik RouterBOARD 711GT", ++ rb711g_setup); ++ ++static void __init rb711gr100_setup(void) ++{ ++ ath79_register_mdio(0, 0x0); ++ mdiobus_register_board_info(rb750g3_mdio_info, ++ ARRAY_SIZE(rb750g3_mdio_info)); ++ ++ 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_register_eth(0); ++ ++ rb750_leds_data.num_leds = ARRAY_SIZE(rb750gr3_leds); ++ rb750_leds_data.leds = rb750gr3_leds; ++ rb750_leds_data.latch_change = rb750gr3_latch_change; ++ platform_device_register(&rb750_leds_device); ++ ++ rb750_nand_data.nce_line = RB7XX_NAND_NCE; ++ rb750_nand_data.enable_pins = rb750gr3_nand_enable_pins; ++ rb750_nand_data.disable_pins = rb750gr3_nand_disable_pins; ++ rb750_nand_data.latch_change = rb750gr3_latch_change; ++ platform_device_register(&rb750_nand_device); ++ ++ ath79_register_usb(); ++ ath79_register_pci(); ++ rb751_wlan_setup(); ++} + - static void __init rb751_setup(void) - { - rb750_setup(); ++MIPS_MACHINE(ATH79_MACH_RB_711GR100, "711Gr100", "MikroTik RouterBOARD 711Gr100", ++ rb711gr100_setup); --- a/arch/mips/ath79/machtypes.h +++ b/arch/mips/ath79/machtypes.h -@@ -123,6 +123,7 @@ enum ath79_mach_type { +@@ -131,6 +131,10 @@ enum ath79_mach_type { ATH79_MACH_RB_493, /* Mikrotik RouterBOARD 493/493AH */ ATH79_MACH_RB_493G, /* Mikrotik RouterBOARD 493G */ ATH79_MACH_RB_711GR100, /* Mikrotik RouterBOARD 911/912 boards */ + ATH79_MACH_RB_711, /* MikroTik RouterBOARD 711 */ ++ ATH79_MACH_RB_711_R3, /* MikroTik RouterBOARD 711 */ ++ ATH79_MACH_RB_711G, /* MikroTik RouterBOARD 711G */ ++ ATH79_MACH_RB_711GT, /* MikroTik RouterBOARD 711GT */ ATH79_MACH_RB_750, /* MikroTik RouterBOARD 750 */ ATH79_MACH_RB_750G_R3, /* MikroTik RouterBOARD 750GL */ ATH79_MACH_RB_751, /* MikroTik RouterBOARD 751 */ diff --git a/target/linux/ar71xx/patches-4.4/702-MIPS-ath79-add-rb711.patch b/target/linux/ar71xx/patches-4.4/702-MIPS-ath79-add-rb711.patch index 6f56781d49..abfac705df 100644 --- a/target/linux/ar71xx/patches-4.4/702-MIPS-ath79-add-rb711.patch +++ b/target/linux/ar71xx/patches-4.4/702-MIPS-ath79-add-rb711.patch @@ -1,16 +1,25 @@ --- a/arch/mips/ath79/mach-rb750.c +++ b/arch/mips/ath79/mach-rb750.c -@@ -325,6 +325,32 @@ static void __init rb751_wlan_setup(void - ap91_pci_init(NULL, mac); - } +@@ -27,6 +27,7 @@ + #include "dev-usb.h" + #include "dev-eth.h" + #include "machtypes.h" ++#include "pci.h" + #include "routerboot.h" + static struct rb750_led_data rb750_leds[] = { +@@ -344,3 +345,104 @@ static void __init rb751g_setup(void) + + MIPS_MACHINE(ATH79_MACH_RB_751G, "751g", "MikroTik RouterBOARD 751G", + rb751g_setup); ++ +static void __init rb711_setup(void) +{ + ath79_gpio_function_disable(AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN | -+ AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN | -+ AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN | -+ AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN | -+ AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN); ++ AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN | ++ AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN | ++ AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN | ++ AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN); + + ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0); + @@ -24,22 +33,96 @@ + rb750_nand_data.latch_change = rb750_latch_change; + platform_device_register(&rb750_nand_device); + ++ ++ ath79_register_pci(); + rb751_wlan_setup(); +} + +MIPS_MACHINE(ATH79_MACH_RB_711, "711", "MikroTik RouterBOARD 711", -+ rb711_setup); ++ rb711_setup); ++ ++MIPS_MACHINE(ATH79_MACH_RB_711_R3, "711r3", "MikroTik RouterBOARD 711", ++ rb711_setup); ++ ++static void __init rb711g_setup(void) ++{ ++ ath79_gpio_function_disable(AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN | ++ AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN | ++ AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN | ++ AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN | ++ AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN); ++ ++ ath79_register_mdio(0, 0x0); ++ ++ mdiobus_register_board_info(rb750g3_mdio_info, ++ ARRAY_SIZE(rb750g3_mdio_info)); ++ ++ ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0); ++ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; ++ ++ ath79_register_eth(0); ++ ++ rb750_leds_data.num_leds = ARRAY_SIZE(rb750gr3_leds); ++ rb750_leds_data.leds = rb750gr3_leds; ++ rb750_leds_data.latch_change = rb750gr3_latch_change; ++ platform_device_register(&rb750_leds_device); ++ ++ rb750_nand_data.nce_line = RB7XX_NAND_NCE; ++ rb750_nand_data.enable_pins = rb750gr3_nand_enable_pins; ++ rb750_nand_data.disable_pins = rb750gr3_nand_disable_pins; ++ rb750_nand_data.latch_change = rb750gr3_latch_change; ++ platform_device_register(&rb750_nand_device); ++ ++ ath79_register_pci(); ++ rb751_wlan_setup(); ++} ++ ++MIPS_MACHINE(ATH79_MACH_RB_711G, "711G", "MikroTik RouterBOARD 711G", ++ rb711g_setup); ++ ++MIPS_MACHINE(ATH79_MACH_RB_711GT, "711GT", "MikroTik RouterBOARD 711GT", ++ rb711g_setup); ++ ++static void __init rb711gr100_setup(void) ++{ ++ ath79_register_mdio(0, 0x0); ++ mdiobus_register_board_info(rb750g3_mdio_info, ++ ARRAY_SIZE(rb750g3_mdio_info)); ++ ++ 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_register_eth(0); ++ ++ rb750_leds_data.num_leds = ARRAY_SIZE(rb750gr3_leds); ++ rb750_leds_data.leds = rb750gr3_leds; ++ rb750_leds_data.latch_change = rb750gr3_latch_change; ++ platform_device_register(&rb750_leds_device); ++ ++ rb750_nand_data.nce_line = RB7XX_NAND_NCE; ++ rb750_nand_data.enable_pins = rb750gr3_nand_enable_pins; ++ rb750_nand_data.disable_pins = rb750gr3_nand_disable_pins; ++ rb750_nand_data.latch_change = rb750gr3_latch_change; ++ platform_device_register(&rb750_nand_device); ++ ++ ath79_register_usb(); ++ ath79_register_pci(); ++ rb751_wlan_setup(); ++} + - static void __init rb751_setup(void) - { - rb750_setup(); ++MIPS_MACHINE(ATH79_MACH_RB_711GR100, "711Gr100", "MikroTik RouterBOARD 711Gr100", ++ rb711gr100_setup); --- a/arch/mips/ath79/machtypes.h +++ b/arch/mips/ath79/machtypes.h -@@ -123,6 +123,7 @@ enum ath79_mach_type { +@@ -131,6 +131,10 @@ enum ath79_mach_type { ATH79_MACH_RB_493, /* Mikrotik RouterBOARD 493/493AH */ ATH79_MACH_RB_493G, /* Mikrotik RouterBOARD 493G */ ATH79_MACH_RB_711GR100, /* Mikrotik RouterBOARD 911/912 boards */ + ATH79_MACH_RB_711, /* MikroTik RouterBOARD 711 */ ++ ATH79_MACH_RB_711_R3, /* MikroTik RouterBOARD 711 */ ++ ATH79_MACH_RB_711G, /* MikroTik RouterBOARD 711G */ ++ ATH79_MACH_RB_711GT, /* MikroTik RouterBOARD 711GT */ ATH79_MACH_RB_750, /* MikroTik RouterBOARD 750 */ ATH79_MACH_RB_750G_R3, /* MikroTik RouterBOARD 750GL */ ATH79_MACH_RB_751, /* MikroTik RouterBOARD 751 */ -- 2.35.1