diff options
author | Adrian Schmutzler <freifunk@adrianschmutzler.de> | 2019-12-17 01:15:35 +0100 |
---|---|---|
committer | Adrian Schmutzler <freifunk@adrianschmutzler.de> | 2020-01-14 22:04:29 +0100 |
commit | 355f0444f3622347650776dd8f1e388dc5d000ca (patch) | |
tree | b1d60761c4f170df95c94c3bc7055f300e9bac1a /target/linux/lantiq/xway | |
parent | b070101c506ca5541d6f232c2da3e0f7b1383106 (diff) | |
download | upstream-355f0444f3622347650776dd8f1e388dc5d000ca.tar.gz upstream-355f0444f3622347650776dd8f1e388dc5d000ca.tar.bz2 upstream-355f0444f3622347650776dd8f1e388dc5d000ca.zip |
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 <freifunk@adrianschmutzler.de>
Diffstat (limited to 'target/linux/lantiq/xway')
4 files changed, 242 insertions, 0 deletions
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/xway/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom b/target/linux/lantiq/xway/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom new file mode 100644 index 0000000000..1f12da8553 --- /dev/null +++ b/target/linux/lantiq/xway/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom @@ -0,0 +1,56 @@ +#!/bin/sh + +[ -e /lib/firmware/$FIRMWARE ] && exit 0 + +. /lib/functions/caldata.sh + +caldata_extract_swap() { + local part=$1 + local offset=$2 + local count=$3 + local mtd + + mtd=$(find_mtd_chardev $part) + [ -n "$mtd" ] || caldata_die "no mtd device found for partition $part" + + offset=$(($offset / 2)) + count=$(($count / 2)) + + dd if=$mtd of=/lib/firmware/$FIRMWARE bs=2 skip=$offset count=$count conv=swab 2>/dev/null || \ + caldata_die "failed to extract calibration data from $mtd" +} + +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 + arcadyan,arv7518pw) + caldata_extract_swap "boardconfig" 0x400 0x1000 + ;; + arcadyan,arv8539pw22) + caldata_extract_swap "art" 0x400 0x1000 + ;; + bt,homehub-v2b) + caldata_extract_swap "art" 0x0 0x1000 + ath9k_patch_mac_crc "00:00:00:00:00:00" 0x20c + ;; + bt,homehub-v3a) + caldata_extract_swap "art-copy" 0x0 0x1000 + ath9k_patch_mac_crc $(macaddr_add $(mtd_get_mac_ascii uboot_env ethaddr) +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,fritz7312|avm,fritz7320) + caldata_extract "urlader" 0x985 0x1000 + ;; + *) + caldata_die "board $board is not supported yet" + ;; + esac + ;; +esac 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 +} |