From 355f0444f3622347650776dd8f1e388dc5d000ca Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Tue, 17 Dec 2019 01:15:35 +0100 Subject: [PATCH] lantiq: split base-files into subtargets This splits the device-dependent base-files into subtarget directories, like done recently for ath79 and ramips. While this increases the overall lines of codes, it will make the code per subtarget smaller and easier to keep track of features and devices. While at it, several variables at the top of 02_network are removed, as they were never changed. The values are put directly into the function calls where they are used. Remove unneeded LED setup from 01_leds, and remove 01_leds entirely for falcon subtarget (as it is not used there). Applies alphabetic reordering to device cases in base-files. Signed-off-by: Adrian Schmutzler --- .../lantiq/ase/base-files/etc/board.d/01_leds | 32 +++ .../ase/base-files/etc/board.d/02_network | 52 +++++ .../ase/base-files/lib/upgrade/platform.sh | 10 + .../falcon/base-files/etc/board.d/02_network | 36 +++ .../falcon/base-files/lib/upgrade/platform.sh | 10 + .../base-files/etc/board.d/01_leds | 41 ++-- .../base-files/etc/board.d/02_network | 209 ++++-------------- .../etc/hotplug.d/firmware/11-ath10k-caldata | 1 - .../etc/hotplug.d/firmware/12-ath9k-eeprom | 38 ++++ .../base-files/lib/upgrade/platform.sh | 2 - .../xway/base-files/etc/board.d/01_leds | 44 ++++ .../xway/base-files/etc/board.d/02_network | 122 ++++++++++ .../etc/hotplug.d/firmware/12-ath9k-eeprom | 17 +- .../xway/base-files/lib/upgrade/platform.sh | 20 ++ .../base-files/etc/board.d/01_leds | 41 ++++ .../base-files/etc/board.d/02_network | 52 +++++ .../base-files/lib/upgrade/platform.sh | 10 + 17 files changed, 523 insertions(+), 214 deletions(-) create mode 100755 target/linux/lantiq/ase/base-files/etc/board.d/01_leds create mode 100755 target/linux/lantiq/ase/base-files/etc/board.d/02_network create mode 100755 target/linux/lantiq/ase/base-files/lib/upgrade/platform.sh create mode 100755 target/linux/lantiq/falcon/base-files/etc/board.d/02_network create mode 100755 target/linux/lantiq/falcon/base-files/lib/upgrade/platform.sh rename target/linux/lantiq/{ => xrx200}/base-files/etc/board.d/01_leds (83%) rename target/linux/lantiq/{ => xrx200}/base-files/etc/board.d/02_network (54%) rename target/linux/lantiq/{ => xrx200}/base-files/etc/hotplug.d/firmware/11-ath10k-caldata (87%) create mode 100644 target/linux/lantiq/xrx200/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom rename target/linux/lantiq/{ => xrx200}/base-files/lib/upgrade/platform.sh (91%) create mode 100755 target/linux/lantiq/xway/base-files/etc/board.d/01_leds create mode 100755 target/linux/lantiq/xway/base-files/etc/board.d/02_network rename target/linux/lantiq/{ => xway}/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom (70%) create mode 100755 target/linux/lantiq/xway/base-files/lib/upgrade/platform.sh create mode 100755 target/linux/lantiq/xway_legacy/base-files/etc/board.d/01_leds create mode 100755 target/linux/lantiq/xway_legacy/base-files/etc/board.d/02_network create mode 100755 target/linux/lantiq/xway_legacy/base-files/lib/upgrade/platform.sh diff --git a/target/linux/lantiq/ase/base-files/etc/board.d/01_leds b/target/linux/lantiq/ase/base-files/etc/board.d/01_leds new file mode 100755 index 0000000000..6a8de7d7a5 --- /dev/null +++ b/target/linux/lantiq/ase/base-files/etc/board.d/01_leds @@ -0,0 +1,32 @@ +#!/bin/sh +# +# Copyright (C) 2011-2015 OpenWrt.org +# + +. /lib/functions/leds.sh +. /lib/functions/uci-defaults.sh + +board_config_update + +led_dsl="$(get_dt_led dsl)" +[ -n "$led_dsl" ] && { + led_internet="$(get_dt_led internet)" + if [ -n "$led_internet" ]; then + ucidef_set_led_default "dsl" "dsl" "$led_dsl" "0" + ucidef_set_led_netdev "internet" "internet" "$led_internet" "pppoe-wan" + else + ucidef_set_led_netdev "dsl" "dsl" "$led_dsl" "dsl0" + fi +} + +board=$(board_name) + +case "$board" in +allnet,all0333cj) + ucidef_set_led_netdev "lan" "lan" "all0333cj:green:lan" "eth0.1" + ;; +esac + +board_config_flush + +exit 0 diff --git a/target/linux/lantiq/ase/base-files/etc/board.d/02_network b/target/linux/lantiq/ase/base-files/etc/board.d/02_network new file mode 100755 index 0000000000..d37e999243 --- /dev/null +++ b/target/linux/lantiq/ase/base-files/etc/board.d/02_network @@ -0,0 +1,52 @@ +#!/bin/sh +# +# Copyright (C) 2011-2015 OpenWrt.org +# + +. /lib/functions/uci-defaults.sh +. /lib/functions/system.sh +. /lib/functions/lantiq.sh + +board_config_update + +annex="a" + +lan_mac="" +wan_mac="" + +board=$(board_name) + +case "$board" in +allnet,all0333cj) + annex="b" + lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr) + wan_mac=$(macaddr_add "$lan_mac" 1) + ucidef_set_interface_lan 'eth0' + ;; +netgear,dgn1000b) + annex="b" + ucidef_set_interface_lan 'eth0' + ;; +*) + ucidef_set_interface_lan 'eth0' + ;; +esac + +ls /lib/modules/$(uname -r)/ltq_atm* 1> /dev/null 2>&1 && \ + ucidef_add_atm_bridge 1 32 "llc" "bridged" "dsl" + +if lantiq_is_vdsl_system; then + ucidef_add_vdsl_modem "$annex" "av" +else + ucidef_add_adsl_modem "$annex" "/lib/firmware/adsl.bin" +fi + +ucidef_set_interface_wan "dsl0" "pppoe" + +[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" "$lan_mac" +[ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" "$wan_mac" + +board_config_flush + +exit 0 + diff --git a/target/linux/lantiq/ase/base-files/lib/upgrade/platform.sh b/target/linux/lantiq/ase/base-files/lib/upgrade/platform.sh new file mode 100755 index 0000000000..d088601bb0 --- /dev/null +++ b/target/linux/lantiq/ase/base-files/lib/upgrade/platform.sh @@ -0,0 +1,10 @@ +PART_NAME=firmware +REQUIRE_IMAGE_METADATA=1 + +platform_check_image() { + return 0 +} + +platform_do_upgrade() { + default_do_upgrade "$1" +} diff --git a/target/linux/lantiq/falcon/base-files/etc/board.d/02_network b/target/linux/lantiq/falcon/base-files/etc/board.d/02_network new file mode 100755 index 0000000000..76f134d6d4 --- /dev/null +++ b/target/linux/lantiq/falcon/base-files/etc/board.d/02_network @@ -0,0 +1,36 @@ +#!/bin/sh +# +# Copyright (C) 2011-2015 OpenWrt.org +# + +. /lib/functions/uci-defaults.sh +. /lib/functions/system.sh +. /lib/functions/lantiq.sh + +board_config_update + +annex="a" + +lan_mac="" +wan_mac="" + +ucidef_set_interface_lan 'eth0' + +ls /lib/modules/$(uname -r)/ltq_atm* 1> /dev/null 2>&1 && \ + ucidef_add_atm_bridge 1 32 "llc" "bridged" "dsl" + +if lantiq_is_vdsl_system; then + ucidef_add_vdsl_modem "$annex" "av" +else + ucidef_add_adsl_modem "$annex" "/lib/firmware/adsl.bin" +fi + +ucidef_set_interface_wan "dsl0" "pppoe" + +[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" "$lan_mac" +[ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" "$wan_mac" + +board_config_flush + +exit 0 + diff --git a/target/linux/lantiq/falcon/base-files/lib/upgrade/platform.sh b/target/linux/lantiq/falcon/base-files/lib/upgrade/platform.sh new file mode 100755 index 0000000000..d088601bb0 --- /dev/null +++ b/target/linux/lantiq/falcon/base-files/lib/upgrade/platform.sh @@ -0,0 +1,10 @@ +PART_NAME=firmware +REQUIRE_IMAGE_METADATA=1 + +platform_check_image() { + return 0 +} + +platform_do_upgrade() { + default_do_upgrade "$1" +} diff --git a/target/linux/lantiq/base-files/etc/board.d/01_leds b/target/linux/lantiq/xrx200/base-files/etc/board.d/01_leds similarity index 83% rename from target/linux/lantiq/base-files/etc/board.d/01_leds rename to target/linux/lantiq/xrx200/base-files/etc/board.d/01_leds index e89de97fbe..b4d26d37ff 100755 --- a/target/linux/lantiq/base-files/etc/board.d/01_leds +++ b/target/linux/lantiq/xrx200/base-files/etc/board.d/01_leds @@ -1,7 +1,6 @@ #!/bin/sh # # Copyright (C) 2011-2015 OpenWrt.org -# based on ar71xx # . /lib/functions/leds.sh @@ -32,35 +31,9 @@ led_dsl="$(get_dt_led dsl)" board=$(board_name) case "$board" in -allnet,all0333cj) - ucidef_set_led_netdev "lan" "lan" "all0333cj:green:lan" "eth0.1" - ;; -arcadyan,arv4525pw) - ucidef_set_led_netdev "wifi" "wifi" "arv4525pw:green:wlan" "wlan0" - ;; -arcadyan,arv7506pw11) - ucidef_set_led_wlan "wifi" "wifi" "arv7506pw11:green:wlan" "phy0radio" - ;; arcadyan,arv7519rw22) ucidef_set_led_netdev "lan" "lan" "arv7519rw22:green:lan" "eth0.1" ;; -arcadyan,arv752dpw22) - ucidef_set_led_wlan "wifi" "wifi" "arv752dpw22:red:wifi" "phy0radio" - ;; -bt,homehub-v5a) - ucidef_set_led_default "dimmed" "dimmed" "dimmed" "0" - ;; -netgear,dm200) - ucidef_set_led_netdev "lan" "lan" "dm200:green:lan" "eth0" - ;; -avm,fritz3370-rev2-hynix|\ -avm,fritz3370-rev2-micron) - ucidef_set_led_switch "lan" "LAN" "fritz3370:green:lan" "switch0" "0x17" - ;; -zyxel,p-2812hnu-f1|\ -zyxel,p-2812hnu-f3) - ucidef_set_led_wlan "wifi" "wifi" "p2812hnufx:green:wlan" "phy0radio" - ;; arcadyan,vgv7510kw22-nor|\ arcadyan,vgv7510kw22-brn) ucidef_set_led_wlan "wifi" "wifi" "vgv7510kw22:green:wlan" "phy0radio" @@ -69,6 +42,13 @@ arcadyan,vgv7519-nor|\ arcadyan,vgv7519-brn) ucidef_set_led_wlan "wifi" "wifi" "vgv7519:green:wireless" "phy0radio" ;; +avm,fritz3370-rev2-hynix|\ +avm,fritz3370-rev2-micron) + ucidef_set_led_switch "lan" "LAN" "fritz3370:green:lan" "switch0" "0x17" + ;; +bt,homehub-v5a) + ucidef_set_led_default "dimmed" "dimmed" "dimmed" "0" + ;; buffalo,wbmr-300hpd) ucidef_set_led_switch "lan1" "LAN1" "wbmr300:green:lan1" "switch0" "0x08" ucidef_set_led_switch "lan2" "LAN2" "wbmr300:green:lan2" "switch0" "0x04" @@ -76,7 +56,12 @@ buffalo,wbmr-300hpd) ucidef_set_led_switch "lan3" "LAN3" "wbmr300:green:lan3" "switch0" "0x20" ucidef_set_led_default "router" "router" "wbmr300:green:router" "1" ;; -*) +netgear,dm200) + ucidef_set_led_netdev "lan" "lan" "dm200:green:lan" "eth0" + ;; +zyxel,p-2812hnu-f1|\ +zyxel,p-2812hnu-f3) + ucidef_set_led_wlan "wifi" "wifi" "p2812hnufx:green:wlan" "phy0radio" ;; esac diff --git a/target/linux/lantiq/base-files/etc/board.d/02_network b/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network similarity index 54% rename from target/linux/lantiq/base-files/etc/board.d/02_network rename to target/linux/lantiq/xrx200/base-files/etc/board.d/02_network index d79a30d22d..f56de32614 100755 --- a/target/linux/lantiq/base-files/etc/board.d/02_network +++ b/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network @@ -9,132 +9,44 @@ board_config_update -vpi=1 -vci=32 annex="a" -tone="av" -xfer_mode="" -encaps="llc" -payload="bridged" + lan_mac="" wan_mac="" -interface_wan="dsl0" board=$(board_name) case "$board" in -audiocodes,mp-252) - ucidef_add_switch "switch0" \ - "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5t@eth0" - ;; - -allnet,all0333cj) - annex="b" - lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr) - wan_mac=$(macaddr_add "$lan_mac" 1) - ucidef_set_interface_lan 'eth0' - ;; - -arcadyan,arv4510pw) - lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr) - wan_mac=$(macaddr_add "$lan_mac" 1) - ucidef_add_switch "switch0" \ - "0:lan:4" "2:lan:2" "1:lan:3" "3:lan:1" "5t@eth0" - ;; - -arcadyan,arv4519pw|arcadyan,arv7510pw22|arcadyan,arv7518pw) - ucidef_add_switch "switch0" \ - "0t@eth0" "2:lan" "3:lan" "4:lan" "5:lan" - ;; - -arcadyan,arv4520pw) - annex="b" - ucidef_add_switch "switch0" \ - "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5t@eth0" - ;; - -arcadyan,arv4525pw|arcadyan,arv452cqw|arcadyan,arv7525pw|arcadyan,arv752dpw) - annex="b" - ucidef_set_interface_lan 'eth0' - ;; - -arcadyan,arv7506pw11) - annex="b" - wan_mac=$(macaddr_add "$(mtd_get_mac_binary board_config 0x16)" 2) - ucidef_add_switch "switch0" \ - "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5t@eth0" - ;; - -arcadyan,arv7519pw) - wan_mac=$(macaddr_add "$(mtd_get_mac_binary board_config 0x16)" 1) - ucidef_add_switch "switch0" \ - "0:lan" "1:lan" "2:lan" "3:lan" "4t@eth0" - ;; - -arcadyan,arv7519rw22) - wan_mac=$(macaddr_add "$(mtd_get_mac_binary boardconfig 0x16)" 1) - ucidef_add_switch "switch0" \ - "0:lan:5" "2:lan:3" "3:lan:4" "4:lan:1" "5:lan:2" "6t@eth0" - ;; - -arcadyan,arv752dpw22|arcadyan,arv8539pw22) - annex="b" - ucidef_add_switch "switch0" \ - "0t@eth0" "2:lan" "3:lan" "4:lan" "5:lan" - ;; - alphanetworks,asl56026) lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr) wan_mac=$(mtd_get_mac_ascii uboot_env wanmac) ucidef_add_switch "switch0"\ "2:lan" "3:lan" "6t@eth0" ;; - -bt,homehub-v2b) - lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr) - wan_mac=$(macaddr_add "$lan_mac" 1) +arcadyan,arv7519rw22) + wan_mac=$(macaddr_add "$(mtd_get_mac_binary boardconfig 0x16)" 1) ucidef_add_switch "switch0" \ - "1:lan" "2:lan" "3:lan" "4:lan" "5t@eth0" - ;; - -bt,homehub-v3a) - lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr) - wan_mac=$(macaddr_add "$lan_mac" 1) - ucidef_set_interface_lan 'eth0' + "0:lan:5" "2:lan:3" "3:lan:4" "4:lan:1" "5:lan:2" "6t@eth0" ;; - -bt,homehub-v5a) - lan_mac=$(mtd_get_mac_binary_ubi caldata 0x110c) +arcadyan,vg3503j) + lan_mac=$(mtd_get_mac_ascii uboot-env ethaddr) wan_mac=$(macaddr_add "$lan_mac" 1) ucidef_add_switch "switch0" \ - "0:lan:3" "1:lan:4" "2:lan:2" "4:lan:1" "5:wan:5" "6t@eth0" + "2:lan:2" "4:lan:1" "6t@eth0" ;; - -netgear,dgn1000b) +arcadyan,vgv7510kw22-brn|\ +arcadyan,vgv7510kw22-nor) annex="b" - ucidef_set_interface_lan 'eth0' - ;; - -netgear,dgn3500|netgear,dgn3500b) - lan_mac=$(mtd_get_mac_ascii uboot-env ethaddr) - wan_mac=$(macaddr_add "$lan_mac" 1) + wan_mac=$(macaddr_add "$(mtd_get_mac_binary board_config 0x16)" 2) ucidef_add_switch "switch0" \ - "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5t@eth0" - ;; - -netgear,dm200) - lan_mac=$(mtd_get_mac_binary ART 0x0) - wan_mac=$(macaddr_add "$lan_mac" 1) - ucidef_set_interface_lan 'eth0' + "2:lan:2" "3:lan:1" "4:lan:4" "5:lan:3" "0:wan:5" "6t@eth0" ;; - -lantiq,easy80920-nand|lantiq,easy80920-nor) - lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr) - wan_mac=$(macaddr_add "$lan_mac" 1) +arcadyan,vgv7519-brn|\ +arcadyan,vgv7519-nor) + wan_mac=$(mtd_get_mac_binary board_config 0x16) ucidef_add_switch "switch0" \ "0:lan:4" "1:lan:3" "2:lan:2" "4:lan:1" "5:wan:5" "6t@eth0" ;; - avm,fritz3370-rev2-hynix|\ avm,fritz3370-rev2-micron) annex="b" @@ -143,21 +55,12 @@ avm,fritz3370-rev2-micron) ucidef_add_switch "switch0" \ "0:lan:3" "1:lan:4" "2:lan:2" "4:lan:1" "6t@eth0" ;; - -avm,fritz7312|\ -avm,fritz7320) - annex="b" - wan_mac=$(macaddr_add "$(mtd_get_mac_binary urlader 0xa91)" 1) - ucidef_set_interface_lan 'eth0' - ;; - avm,fritz7360sl) annex="b" wan_mac=$(macaddr_add "$(mtd_get_mac_binary urlader 0xa91)" 1) ucidef_add_switch "switch0" \ "0:lan:3" "1:lan:4" "2:lan:2" "4:lan:1" "6t@eth0" ;; - avm,fritz7362sl) annex="b" lan_mac=$(fritz_tffs -n maca -i $(find_mtd_part "tffs (1)")) @@ -165,7 +68,6 @@ avm,fritz7362sl) ucidef_add_switch "switch0" \ "0:lan:3" "1:lan:4" "2:lan:2" "4:lan:1" "6t@eth0" ;; - avm,fritz7412) tffsdev=$(find_mtd_chardev "nand-tffs") annex="b" @@ -173,91 +75,64 @@ avm,fritz7412) wan_mac=$(/usr/bin/fritz_tffs_nand -d $tffsdev -n macdsl -o) ucidef_set_interface_lan 'eth0' ;; - -siemens,gigaset-sx76x) - annex="b" +bt,homehub-v5a) + lan_mac=$(mtd_get_mac_binary_ubi caldata 0x110c) + wan_mac=$(macaddr_add "$lan_mac" 1) ucidef_add_switch "switch0" \ - "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5t@eth0" + "0:lan:3" "1:lan:4" "2:lan:2" "4:lan:1" "5:wan:5" "6t@eth0" ;; - -zte,h201l) - annex="b" +buffalo,wbmr-300hpd) + lan_mac=$(mtd_get_mac_ascii ubootconfig ethaddr) + wan_mac="$lan_mac" ucidef_add_switch "switch0" \ - "0:lan" "1:lan" "2:lan" "3:lan" "4t@eth0" + "5:lan:2" "2:lan:3" "3:lan:4" "4:wan:1" "6t@eth0" ;; - -zyxel,p-2601hn) +lantiq,easy80920-nand|\ +lantiq,easy80920-nor) + lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr) + wan_mac=$(macaddr_add "$lan_mac" 1) ucidef_add_switch "switch0" \ - "0:lan" "1:lan" "2:lan" "3:lan" "5t@eth0" + "0:lan:4" "1:lan:3" "2:lan:2" "4:lan:1" "5:wan:5" "6t@eth0" ;; - -zyxel,p-2812hnu-f1|zyxel,p-2812hnu-f3) - lan_mac=$(mtd_get_mac_ascii uboot-env ethaddr) +netgear,dm200) + lan_mac=$(mtd_get_mac_binary ART 0x0) wan_mac=$(macaddr_add "$lan_mac" 1) - ucidef_add_switch "switch0" \ - "0:lan" "1:lan" "2:lan" "4:lan" "5:wan" "6t@eth0" + ucidef_set_interface_lan 'eth0' ;; - -tplink,tdw8970|tplink,tdw8980) +tplink,tdw8970|\ +tplink,tdw8980) wan_mac=$(macaddr_add "$(mtd_get_mac_binary boardconfig 0xf100)" 1) ucidef_add_switch "switch0" \ "0:lan:2" "2:lan:3" "4:lan:4" "5:lan:1" "6t@eth0" ;; - -arcadyan,vg3503j) - lan_mac=$(mtd_get_mac_ascii uboot-env ethaddr) - wan_mac=$(macaddr_add "$lan_mac" 1) - ucidef_add_switch "switch0" \ - "2:lan:2" "4:lan:1" "6t@eth0" - ;; - -tplink,vr200|tplink,vr200v) +tplink,vr200|\ +tplink,vr200v) wan_mac=$(macaddr_add "$(mtd_get_mac_binary romfile 0xf100)" 1) ucidef_add_switch "switch0" \ "0:lan" "2:lan" "4:lan" "5:lan" "6t@eth0" ;; - -arcadyan,vgv7510kw22-nor|arcadyan,vgv7510kw22-brn) - annex="b" - wan_mac=$(macaddr_add "$(mtd_get_mac_binary board_config 0x16)" 2) - ucidef_add_switch "switch0" \ - "2:lan:2" "3:lan:1" "4:lan:4" "5:lan:3" "0:wan:5" "6t@eth0" - ;; - -arcadyan,vgv7519-nor|arcadyan,vgv7519-brn) - wan_mac=$(mtd_get_mac_binary board_config 0x16) - ucidef_add_switch "switch0" \ - "0:lan:4" "1:lan:3" "2:lan:2" "4:lan:1" "5:wan:5" "6t@eth0" - ;; - -buffalo,wbmr-hp-g300h) - ucidef_add_switch "switch0" \ - "0t@eth0" "2:lan" "3:lan" "4:lan" "5:lan" - ;; - -buffalo,wbmr-300hpd) - lan_mac=$(mtd_get_mac_ascii ubootconfig ethaddr) - wan_mac="$lan_mac" +zyxel,p-2812hnu-f1|\ +zyxel,p-2812hnu-f3) + lan_mac=$(mtd_get_mac_ascii uboot-env ethaddr) + wan_mac=$(macaddr_add "$lan_mac" 1) ucidef_add_switch "switch0" \ - "5:lan:2" "2:lan:3" "3:lan:4" "4:wan:1" "6t@eth0" + "0:lan" "1:lan" "2:lan" "4:lan" "5:wan" "6t@eth0" ;; - *) ucidef_set_interface_lan 'eth0' ;; - esac ls /lib/modules/$(uname -r)/ltq_atm* 1> /dev/null 2>&1 && \ - ucidef_add_atm_bridge "$vpi" "$vci" "$encaps" "$payload" "dsl" + ucidef_add_atm_bridge 1 32 "llc" "bridged" "dsl" if lantiq_is_vdsl_system; then - ucidef_add_vdsl_modem "$annex" "$tone" "$xfer_mode" + ucidef_add_vdsl_modem "$annex" "av" else ucidef_add_adsl_modem "$annex" "/lib/firmware/adsl.bin" fi -ucidef_set_interface_wan "$interface_wan" "pppoe" +ucidef_set_interface_wan "dsl0" "pppoe" [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" "$lan_mac" [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" "$wan_mac" diff --git a/target/linux/lantiq/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/lantiq/xrx200/base-files/etc/hotplug.d/firmware/11-ath10k-caldata similarity index 87% rename from target/linux/lantiq/base-files/etc/hotplug.d/firmware/11-ath10k-caldata rename to target/linux/lantiq/xrx200/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index 0b48b77d41..4202187d4f 100644 --- a/target/linux/lantiq/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/lantiq/xrx200/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -1,5 +1,4 @@ #!/bin/sh -# Based on ar71xx 11-ath10k-caldata and 10-rt2x00-eeprom [ -e /lib/firmware/$FIRMWARE ] && exit 0 diff --git a/target/linux/lantiq/xrx200/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom b/target/linux/lantiq/xrx200/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom new file mode 100644 index 0000000000..6fee72ea8d --- /dev/null +++ b/target/linux/lantiq/xrx200/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom @@ -0,0 +1,38 @@ +#!/bin/sh + +[ -e /lib/firmware/$FIRMWARE ] && exit 0 + +. /lib/functions/caldata.sh + +case "$FIRMWARE" in + "ath9k-eeprom-pci-0000:00:0e.0.bin" | \ + "ath9k-eeprom-pci-0000:01:00.0.bin" | \ + "ath9k-eeprom-pci-0000:02:00.0.bin") + board=$(board_name) + + case "$board" in + avm,fritz3370-rev2-hynix|\ + avm,fritz3370-rev2-micron|\ + avm,fritz7362sl) + caldata_extract_reverse "urlader" 0x1541 0x440 + ;; + avm,fritz7360sl) + caldata_extract "urlader" 0x985 0x1000 + ;; + avm,fritz7412) + /usr/bin/fritz_cal_extract -i 1 -s 0x1e000 -e 0x207 -l 4096 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader") + ;; + bt,homehub-v5a) + caldata_extract_ubi "caldata" 0x1000 0x1000 + ath9k_patch_mac_crc $(macaddr_add $(mtd_get_mac_binary_ubi caldata 0x110c) +2) 0x10c + ;; + tplink,tdw8970|\ + tplink,tdw8980) + caldata_extract "boardconfig" 0x21000 0x1000 + ;; + *) + caldata_die "board $board is not supported yet" + ;; + esac + ;; +esac diff --git a/target/linux/lantiq/base-files/lib/upgrade/platform.sh b/target/linux/lantiq/xrx200/base-files/lib/upgrade/platform.sh similarity index 91% rename from target/linux/lantiq/base-files/lib/upgrade/platform.sh rename to target/linux/lantiq/xrx200/base-files/lib/upgrade/platform.sh index c47ff78fb2..dcd797c30d 100755 --- a/target/linux/lantiq/base-files/lib/upgrade/platform.sh +++ b/target/linux/lantiq/xrx200/base-files/lib/upgrade/platform.sh @@ -13,8 +13,6 @@ platform_do_upgrade() { avm,fritz3370-rev2-micron|\ avm,fritz7362sl|\ avm,fritz7412|\ - bt,homehub-v2b|\ - bt,homehub-v3a|\ bt,homehub-v5a|\ zyxel,p-2812hnu-f1|\ zyxel,p-2812hnu-f3) diff --git a/target/linux/lantiq/xway/base-files/etc/board.d/01_leds b/target/linux/lantiq/xway/base-files/etc/board.d/01_leds new file mode 100755 index 0000000000..82a39f4648 --- /dev/null +++ b/target/linux/lantiq/xway/base-files/etc/board.d/01_leds @@ -0,0 +1,44 @@ +#!/bin/sh +# +# Copyright (C) 2011-2015 OpenWrt.org +# + +. /lib/functions/leds.sh +. /lib/functions/uci-defaults.sh + +board_config_update + +led_wifi="$(get_dt_led wifi)" +[ -n "$led_wifi" ] && ucidef_set_led_wlan "wifi" "wifi" "$led_wifi" "phy0tpt" + +led_usb="$(get_dt_led usb)" +[ -n "$led_usb" ] && ucidef_set_led_usbdev "usb" "usb" "$led_usb" "1-1" + +led_usb2="$(get_dt_led usb2)" +[ -n "$led_usb2" ] && ucidef_set_led_usbdev "usb2" "usb2" "$led_usb2" "2-1" + +led_dsl="$(get_dt_led dsl)" +[ -n "$led_dsl" ] && { + led_internet="$(get_dt_led internet)" + if [ -n "$led_internet" ]; then + ucidef_set_led_default "dsl" "dsl" "$led_dsl" "0" + ucidef_set_led_netdev "internet" "internet" "$led_internet" "pppoe-wan" + else + ucidef_set_led_netdev "dsl" "dsl" "$led_dsl" "dsl0" + fi +} + +board=$(board_name) + +case "$board" in +arcadyan,arv7506pw11) + ucidef_set_led_wlan "wifi" "wifi" "arv7506pw11:green:wlan" "phy0radio" + ;; +arcadyan,arv752dpw22) + ucidef_set_led_wlan "wifi" "wifi" "arv752dpw22:red:wifi" "phy0radio" + ;; +esac + +board_config_flush + +exit 0 diff --git a/target/linux/lantiq/xway/base-files/etc/board.d/02_network b/target/linux/lantiq/xway/base-files/etc/board.d/02_network new file mode 100755 index 0000000000..b1b742bd1f --- /dev/null +++ b/target/linux/lantiq/xway/base-files/etc/board.d/02_network @@ -0,0 +1,122 @@ +#!/bin/sh +# +# Copyright (C) 2011-2015 OpenWrt.org +# + +. /lib/functions/uci-defaults.sh +. /lib/functions/system.sh +. /lib/functions/lantiq.sh + +board_config_update + +annex="a" + +lan_mac="" +wan_mac="" + +board=$(board_name) + +case "$board" in +arcadyan,arv4510pw) + lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr) + wan_mac=$(macaddr_add "$lan_mac" 1) + ucidef_add_switch "switch0" \ + "0:lan:4" "2:lan:2" "1:lan:3" "3:lan:1" "5t@eth0" + ;; +arcadyan,arv4519pw|\ +arcadyan,arv7510pw22|\ +arcadyan,arv7518pw) + ucidef_add_switch "switch0" \ + "0t@eth0" "2:lan" "3:lan" "4:lan" "5:lan" + ;; +arcadyan,arv7506pw11) + annex="b" + wan_mac=$(macaddr_add "$(mtd_get_mac_binary board_config 0x16)" 2) + ucidef_add_switch "switch0" \ + "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5t@eth0" + ;; +arcadyan,arv7519pw) + wan_mac=$(macaddr_add "$(mtd_get_mac_binary board_config 0x16)" 1) + ucidef_add_switch "switch0" \ + "0:lan" "1:lan" "2:lan" "3:lan" "4t@eth0" + ;; +arcadyan,arv7525pw|\ +arcadyan,arv752dpw) + annex="b" + ucidef_set_interface_lan 'eth0' + ;; +arcadyan,arv752dpw22|\ +arcadyan,arv8539pw22) + annex="b" + ucidef_add_switch "switch0" \ + "0t@eth0" "2:lan" "3:lan" "4:lan" "5:lan" + ;; +audiocodes,mp-252) + ucidef_add_switch "switch0" \ + "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5t@eth0" + ;; +avm,fritz7312|\ +avm,fritz7320) + annex="b" + wan_mac=$(macaddr_add "$(mtd_get_mac_binary urlader 0xa91)" 1) + ucidef_set_interface_lan 'eth0' + ;; +bt,homehub-v2b) + lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr) + wan_mac=$(macaddr_add "$lan_mac" 1) + ucidef_add_switch "switch0" \ + "1:lan" "2:lan" "3:lan" "4:lan" "5t@eth0" + ;; +bt,homehub-v3a) + lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr) + wan_mac=$(macaddr_add "$lan_mac" 1) + ucidef_set_interface_lan 'eth0' + ;; +buffalo,wbmr-hp-g300h) + ucidef_add_switch "switch0" \ + "0t@eth0" "2:lan" "3:lan" "4:lan" "5:lan" + ;; +netgear,dgn3500|\ +netgear,dgn3500b) + lan_mac=$(mtd_get_mac_ascii uboot-env ethaddr) + wan_mac=$(macaddr_add "$lan_mac" 1) + ucidef_add_switch "switch0" \ + "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5t@eth0" + ;; +siemens,gigaset-sx76x) + annex="b" + ucidef_add_switch "switch0" \ + "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5t@eth0" + ;; +zte,h201l) + annex="b" + ucidef_add_switch "switch0" \ + "0:lan" "1:lan" "2:lan" "3:lan" "4t@eth0" + ;; +zyxel,p-2601hn) + ucidef_add_switch "switch0" \ + "0:lan" "1:lan" "2:lan" "3:lan" "5t@eth0" + ;; +*) + ucidef_set_interface_lan 'eth0' + ;; +esac + +ls /lib/modules/$(uname -r)/ltq_atm* 1> /dev/null 2>&1 && \ + ucidef_add_atm_bridge 1 32 "llc" "bridged" "dsl" + +if lantiq_is_vdsl_system; then + ucidef_add_vdsl_modem "$annex" "av" +else + ucidef_add_adsl_modem "$annex" "/lib/firmware/adsl.bin" +fi + +ucidef_set_interface_wan "dsl0" "pppoe" + +[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" "$lan_mac" +[ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" "$wan_mac" + +board_config_flush + +exit 0 + diff --git a/target/linux/lantiq/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom b/target/linux/lantiq/xway/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom similarity index 70% rename from target/linux/lantiq/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom rename to target/linux/lantiq/xway/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom index 5a6e8d360b..1f12da8553 100644 --- a/target/linux/lantiq/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom +++ b/target/linux/lantiq/xway/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom @@ -41,28 +41,13 @@ case "$FIRMWARE" in caldata_extract_swap "art-copy" 0x0 0x1000 ath9k_patch_mac_crc $(macaddr_add $(mtd_get_mac_ascii uboot_env ethaddr) +2) 0x10c ;; - bt,homehub-v5a) - caldata_extract_ubi "caldata" 0x1000 0x1000 - ath9k_patch_mac_crc $(macaddr_add $(mtd_get_mac_binary_ubi caldata 0x110c) +2) 0x10c - ;; netgear,dgn3500|netgear,dgn3500b) caldata_extract "calibration" 0xf000 0x1000 ath9k_patch_mac_crc $(macaddr_add $(mtd_get_mac_ascii uboot-env ethaddr) +2) 0x20c ;; - avm,fritz3370-rev2-hynix|\ - avm,fritz3370-rev2-micron|\ - avm,fritz7362sl) - caldata_extract_reverse "urlader" 0x1541 0x440 - ;; - avm,fritz7312|avm,fritz7320|avm,fritz7360sl) + avm,fritz7312|avm,fritz7320) caldata_extract "urlader" 0x985 0x1000 ;; - avm,fritz7412) - /usr/bin/fritz_cal_extract -i 1 -s 0x1e000 -e 0x207 -l 4096 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader") - ;; - tplink,tdw8970|tplink,tdw8980) - caldata_extract "boardconfig" 0x21000 0x1000 - ;; *) caldata_die "board $board is not supported yet" ;; diff --git a/target/linux/lantiq/xway/base-files/lib/upgrade/platform.sh b/target/linux/lantiq/xway/base-files/lib/upgrade/platform.sh new file mode 100755 index 0000000000..5ef0a0ddb9 --- /dev/null +++ b/target/linux/lantiq/xway/base-files/lib/upgrade/platform.sh @@ -0,0 +1,20 @@ +PART_NAME=firmware +REQUIRE_IMAGE_METADATA=1 + +platform_check_image() { + return 0 +} + +platform_do_upgrade() { + local board=$(board_name) + + case "$board" in + bt,homehub-v2b|\ + bt,homehub-v3a) + nand_do_upgrade $1 + ;; + *) + default_do_upgrade "$1" + ;; + esac +} diff --git a/target/linux/lantiq/xway_legacy/base-files/etc/board.d/01_leds b/target/linux/lantiq/xway_legacy/base-files/etc/board.d/01_leds new file mode 100755 index 0000000000..4200dcb0c8 --- /dev/null +++ b/target/linux/lantiq/xway_legacy/base-files/etc/board.d/01_leds @@ -0,0 +1,41 @@ +#!/bin/sh +# +# Copyright (C) 2011-2015 OpenWrt.org +# + +. /lib/functions/leds.sh +. /lib/functions/uci-defaults.sh + +board_config_update + +led_wifi="$(get_dt_led wifi)" +[ -n "$led_wifi" ] && ucidef_set_led_wlan "wifi" "wifi" "$led_wifi" "phy0tpt" + +led_usb="$(get_dt_led usb)" +[ -n "$led_usb" ] && ucidef_set_led_usbdev "usb" "usb" "$led_usb" "1-1" + +led_usb2="$(get_dt_led usb2)" +[ -n "$led_usb2" ] && ucidef_set_led_usbdev "usb2" "usb2" "$led_usb2" "2-1" + +led_dsl="$(get_dt_led dsl)" +[ -n "$led_dsl" ] && { + led_internet="$(get_dt_led internet)" + if [ -n "$led_internet" ]; then + ucidef_set_led_default "dsl" "dsl" "$led_dsl" "0" + ucidef_set_led_netdev "internet" "internet" "$led_internet" "pppoe-wan" + else + ucidef_set_led_netdev "dsl" "dsl" "$led_dsl" "dsl0" + fi +} + +board=$(board_name) + +case "$board" in +arcadyan,arv4525pw) + ucidef_set_led_netdev "wifi" "wifi" "arv4525pw:green:wlan" "wlan0" + ;; +esac + +board_config_flush + +exit 0 diff --git a/target/linux/lantiq/xway_legacy/base-files/etc/board.d/02_network b/target/linux/lantiq/xway_legacy/base-files/etc/board.d/02_network new file mode 100755 index 0000000000..120857de4c --- /dev/null +++ b/target/linux/lantiq/xway_legacy/base-files/etc/board.d/02_network @@ -0,0 +1,52 @@ +#!/bin/sh +# +# Copyright (C) 2011-2015 OpenWrt.org +# + +. /lib/functions/uci-defaults.sh +. /lib/functions/system.sh +. /lib/functions/lantiq.sh + +board_config_update + +annex="a" + +lan_mac="" +wan_mac="" + +board=$(board_name) + +case "$board" in +arcadyan,arv4520pw) + annex="b" + ucidef_add_switch "switch0" \ + "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5t@eth0" + ;; +arcadyan,arv4525pw|\ +arcadyan,arv452cqw) + annex="b" + ucidef_set_interface_lan 'eth0' + ;; +*) + ucidef_set_interface_lan 'eth0' + ;; +esac + +ls /lib/modules/$(uname -r)/ltq_atm* 1> /dev/null 2>&1 && \ + ucidef_add_atm_bridge 1 32 "llc" "bridged" "dsl" + +if lantiq_is_vdsl_system; then + ucidef_add_vdsl_modem "$annex" "av" +else + ucidef_add_adsl_modem "$annex" "/lib/firmware/adsl.bin" +fi + +ucidef_set_interface_wan "dsl0" "pppoe" + +[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" "$lan_mac" +[ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" "$wan_mac" + +board_config_flush + +exit 0 + diff --git a/target/linux/lantiq/xway_legacy/base-files/lib/upgrade/platform.sh b/target/linux/lantiq/xway_legacy/base-files/lib/upgrade/platform.sh new file mode 100755 index 0000000000..d088601bb0 --- /dev/null +++ b/target/linux/lantiq/xway_legacy/base-files/lib/upgrade/platform.sh @@ -0,0 +1,10 @@ +PART_NAME=firmware +REQUIRE_IMAGE_METADATA=1 + +platform_check_image() { + return 0 +} + +platform_do_upgrade() { + default_do_upgrade "$1" +} -- 2.30.2