From 96df635829278a80ac0f38019803bda11fe0dbb5 Mon Sep 17 00:00:00 2001 From: "Alexandros C. Couloumbis" Date: Sun, 18 Dec 2022 08:26:05 +0200 Subject: [PATCH] add rb711 support (not tested) --- target/linux/ar71xx/base-files/lib/ar71xx.sh | 8 + .../ar71xx/base-files/lib/upgrade/platform.sh | 4 + .../ar71xx/files/arch/mips/ath79/mach-rb750.c | 175 ++++++++++++++++++ .../ar71xx/files/arch/mips/ath79/machtypes.h | 6 + target/linux/ar71xx/mikrotik/config-default | 2 + .../703-MIPS-ath79-add-rb711-detection.patch | 10 + 6 files changed, 205 insertions(+) create mode 100644 target/linux/ar71xx/patches-4.14/703-MIPS-ath79-add-rb711-detection.patch diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index 14b661cfd7..35a8aaa9d7 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -451,6 +451,14 @@ mikrotik_board_detect() { *"493G") name="rb-493g" ;; + *"711"|\ + *"711HnD"|\ + *"711GHnD"|\ + *"711G"|\ + *"711GT"|\ + *"711Gr100") + name="rb-711" + ;; *"750") name="rb-750" ;; diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index f44cdb061f..4d51955c2a 100755 --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -548,6 +548,8 @@ platform_check_image() { rb-450g|\ rb-493|\ rb-493g|\ + rb-711-5hnd|\ + rb-711g-5hnd|\ rb-750|\ rb-750gl|\ rb-751|\ @@ -868,6 +870,8 @@ platform_do_upgrade() { rb-450g|\ rb-493|\ rb-493g|\ + rb-711-5hnd|\ + rb-711g-5hnd|\ rb-750|\ rb-750gl|\ rb-751|\ diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb750.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb750.c index 0ec94a80e3..75f27ca8f1 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb750.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb750.c @@ -347,3 +347,178 @@ 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); + + ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0); + + ath79_register_mdio(0, 0x0); + + ath79_register_eth(0); + + ath79_register_usb(); + rb751_wlan_setup(); +} + +MIPS_MACHINE(ATH79_MACH_RB_711, "711", "MikroTik RouterBOARD 711", + rb711_setup); + +static void __init rb711hnd_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_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0); + ath79_init_mac(ath79_eth1_data.mac_addr, ath79_mac_base, 1); + + ath79_register_mdio(0, 0x0); + + ath79_register_eth(1); + 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 = RB750_NAND_NCE; + rb750_nand_data.enable_pins = rb750_nand_enable_pins; + rb750_nand_data.disable_pins = rb750_nand_disable_pins; + rb750_nand_data.latch_change = rb750_latch_change; + platform_device_register(&rb750_nand_device); + + rb751_wlan_setup(); +} + +MIPS_MACHINE(ATH79_MACH_RB_711HnD, "711HnD", "MikroTik RouterBOARD 711 5HnD", + rb711hnd_setup); + +static void __init rb711ghnd_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_eth0_data.phy_mask = BIT(0); + ath79_eth0_pll_data.pll_1000 = 0x16000000; + + 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 = RB750_NAND_NCE; + rb750_nand_data.enable_pins = rb750_nand_enable_pins; + rb750_nand_data.disable_pins = rb750_nand_disable_pins; + rb750_nand_data.latch_change = rb750_latch_change; + platform_device_register(&rb750_nand_device); + + rb751_wlan_setup(); +} + +MIPS_MACHINE(ATH79_MACH_RB_711GHnD, "711GHnD", "MikroTik RouterBOARD 711G 5HnD", + rb711ghnd_setup); + +static void __init rb711r3_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_register_mdio(0, 0x0); + + 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(); + rb751_wlan_setup(); +} + +MIPS_MACHINE(ATH79_MACH_RB_711_R3, "711r3", "MikroTik RouterBOARD 711", + rb711r3_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_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0); + ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; + + ath79_register_mdio(0, 0x0); + + ath79_register_eth(0); + + ath79_register_usb(); + 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(); + rb751_wlan_setup(); +} + +MIPS_MACHINE(ATH79_MACH_RB_711GR100, "711Gr100", "MikroTik RouterBOARD 711Gr100", + rb711gr100_setup); diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h index 900b4ec87b..3baf9c86bd 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h +++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h @@ -211,6 +211,12 @@ 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_711HnD, /* MikroTik RouterBOARD 711 HnD */ + ATH79_MACH_RB_711GHnD, /* MikroTik RouterBOARD 711G HnD */ ATH79_MACH_RB_750, /* MikroTik RouterBOARD 750 */ ATH79_MACH_RB_750G_R3, /* MikroTik RouterBOARD 750GL */ ATH79_MACH_RB_750UPR2, /* MikroTik RouterBOARD 750UP r2 */ diff --git a/target/linux/ar71xx/mikrotik/config-default b/target/linux/ar71xx/mikrotik/config-default index eb2f362034..9f1605486f 100644 --- a/target/linux/ar71xx/mikrotik/config-default +++ b/target/linux/ar71xx/mikrotik/config-default @@ -77,3 +77,5 @@ CONFIG_UBIFS_FS_ADVANCED_COMPR=y CONFIG_UBIFS_FS_ZLIB=y CONFIG_ZLIB_DEFLATE=y CONFIG_ZLIB_INFLATE=y +# CONFIG_CMDLINE="console=ttyS0,115200 GPIO_RESET=yes gpio=790341 HZ=400000000 mem=32M board=711GHnD noinitrd" +# CONFIG_CMDLINE_OVERRIDE=y diff --git a/target/linux/ar71xx/patches-4.14/703-MIPS-ath79-add-rb711-detection.patch b/target/linux/ar71xx/patches-4.14/703-MIPS-ath79-add-rb711-detection.patch new file mode 100644 index 0000000000..963a3b30a6 --- /dev/null +++ b/target/linux/ar71xx/patches-4.14/703-MIPS-ath79-add-rb711-detection.patch @@ -0,0 +1,10 @@ +--- a/arch/mips/ath79/prom.c ++++ b/arch/mips/ath79/prom.c +@@ -155,6 +155,7 @@ void __init prom_init(void) + strstr(arcs_cmdline, "board=435") || + strstr(arcs_cmdline, "board=450") || + strstr(arcs_cmdline, "board=493") || ++ strstr(arcs_cmdline, "board=711") || + strstr(arcs_cmdline, "board=951G") || + strstr(arcs_cmdline, "board=H951L") || + strstr(arcs_cmdline, "board=952-hb") || -- 2.35.1