From 54b275c8ed3ad20c447fd46deec83384822ac79d Mon Sep 17 00:00:00 2001 From: John Crispin Date: Wed, 21 Feb 2018 20:40:50 +0100 Subject: ipq40xx: add target Signed-off-by: Christian Lamparter Signed-off-by: Mathias Kresin Signed-off-by: John Crispin --- .../linux/ipq40xx/base-files/etc/board.d/01_leds | 28 ++++++++++ .../ipq40xx/base-files/etc/board.d/02_network | 31 +++++++++++ target/linux/ipq40xx/base-files/etc/diag.sh | 43 +++++++++++++++ .../etc/hotplug.d/firmware/11-ath10k-caldata | 62 ++++++++++++++++++++++ target/linux/ipq40xx/base-files/etc/inittab | 4 ++ 5 files changed, 168 insertions(+) create mode 100755 target/linux/ipq40xx/base-files/etc/board.d/01_leds create mode 100755 target/linux/ipq40xx/base-files/etc/board.d/02_network create mode 100755 target/linux/ipq40xx/base-files/etc/diag.sh create mode 100644 target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata create mode 100644 target/linux/ipq40xx/base-files/etc/inittab (limited to 'target/linux/ipq40xx/base-files/etc') diff --git a/target/linux/ipq40xx/base-files/etc/board.d/01_leds b/target/linux/ipq40xx/base-files/etc/board.d/01_leds new file mode 100755 index 0000000000..31c6e32a06 --- /dev/null +++ b/target/linux/ipq40xx/base-files/etc/board.d/01_leds @@ -0,0 +1,28 @@ +#!/bin/sh +# +# Copyright (C) 2015 OpenWrt.org +# + +. /lib/functions/uci-defaults.sh + +board_config_update + +board=$(board_name) +boardname="${board##*,}" + +case "$board" in +avm,fritzbox-4040) + ucidef_set_led_wlan "wlan" "WLAN" "fritz4040:green:wlan" "phy0tpt" "phy1tpt" + ucidef_set_led_netdev "wan" "WAN" "fritz4040:green:wan" "eth1" + ucidef_set_led_switch "lan" "LAN" "fritz4040:green:lan" "switch0" "0x1e" + ;; +glinet,gl-b1300) + ucidef_set_led_wlan "wlan" "WLAN" "${boardname}:green:wlan" "phy0tpt" + ;; +*) + ;; +esac + +board_config_flush + +exit 0 diff --git a/target/linux/ipq40xx/base-files/etc/board.d/02_network b/target/linux/ipq40xx/base-files/etc/board.d/02_network new file mode 100755 index 0000000000..37f81a398a --- /dev/null +++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network @@ -0,0 +1,31 @@ +#!/bin/sh +# +# Copyright (c) 2015 The Linux Foundation. All rights reserved. +# Copyright (c) 2011-2015 OpenWrt.org +# + +. /lib/functions/uci-defaults.sh +. /lib/functions/system.sh + +board_config_update + +board=$(board_name) + +case "$board" in +avm,fritzbox-4040) + ucidef_set_interfaces_lan_wan "eth0" "eth1" + ucidef_add_switch "switch0" \ + "0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan" + ;; +glinet,gl-b1300 |\ +openmesh,a42) + ucidef_set_interfaces_lan_wan "eth1" "eth0" + ;; +*) + echo "Unsupported hardware. Network interfaces not intialized" + ;; +esac + +board_config_flush + +exit 0 diff --git a/target/linux/ipq40xx/base-files/etc/diag.sh b/target/linux/ipq40xx/base-files/etc/diag.sh new file mode 100755 index 0000000000..4cfe6325f2 --- /dev/null +++ b/target/linux/ipq40xx/base-files/etc/diag.sh @@ -0,0 +1,43 @@ +#!/bin/sh + +. /lib/functions/leds.sh + +boot="$(get_dt_led boot)" +failsafe="$(get_dt_led failsafe)" +running="$(get_dt_led running)" +upgrade="$(get_dt_led upgrade)" + +set_state() { + status_led="$boot" + + case "$1" in + preinit) + status_led_blink_preinit + ;; + failsafe) + status_led_off + [ -n "$running" ] && { + status_led="$running" + status_led_off + } + status_led="$failsafe" + status_led_blink_failsafe + ;; + preinit_regular) + status_led_blink_preinit_regular + ;; + upgrade) + [ -n "$running" ] && { + status_led="$upgrade" + status_led_blink_preinit_regular + } + ;; + done) + status_led_off + [ -n "$running" ] && { + status_led="$running" + status_led_on + } + ;; + esac +} diff --git a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata new file mode 100644 index 0000000000..33ea9b426c --- /dev/null +++ b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -0,0 +1,62 @@ +#!/bin/sh + +ath10kcal_die() { + echo "ath10cal: " "$*" + exit 1 +} + +ath10kcal_extract() { + local part=$1 + local offset=$2 + local count=$3 + local mtd + + mtd=$(find_mtd_chardev $part) + [ -n "$mtd" ] || \ + ath10kcal_die "no mtd device found for partition $part" + + dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \ + ath10kcal_die "failed to extract calibration data from $mtd" +} + +[ -e /lib/firmware/$FIRMWARE ] && exit 0 + +. /lib/functions.sh +. /lib/functions/system.sh + +board=$(board_name) + + +case "$FIRMWARE" in +"ath10k/pre-cal-ahb-a000000.wifi.bin") + case "$board" in + avm,fritzbox-4040) + /usr/bin/fritz_cal_extract -i 1 -s 0x400 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader_config") + ;; + glinet,gl-b1300 |\ + qcom,ap-dk01.1-c1) + ath10kcal_extract "ART" 4096 12064 + ;; + openmesh,a42) + ath10kcal_extract "0:ART" 4096 12064 + ;; + esac + ;; +"ath10k/pre-cal-ahb-a800000.wifi.bin") + case "$board" in + avm,fritzbox-4040) + /usr/bin/fritz_cal_extract -i 1 -s 0x400 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader_config") + ;; + glinet,gl-b1300 |\ + qcom,ap-dk01.1-c1) + ath10kcal_extract "ART" 20480 12064 + ;; + openmesh,a42) + ath10kcal_extract "0:ART" 20480 12064 + ;; + esac + ;; +*) + exit 1 + ;; +esac diff --git a/target/linux/ipq40xx/base-files/etc/inittab b/target/linux/ipq40xx/base-files/etc/inittab new file mode 100644 index 0000000000..809bba5e5f --- /dev/null +++ b/target/linux/ipq40xx/base-files/etc/inittab @@ -0,0 +1,4 @@ +# Copyright (c) 2013 The Linux Foundation. All rights reserved. +::sysinit:/etc/init.d/rcS S boot +::shutdown:/etc/init.d/rcS K shutdown +ttyMSM0::askfirst:/usr/libexec/login.sh -- cgit v1.2.3