aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ath79/mikrotik/base-files/etc
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/ath79/mikrotik/base-files/etc')
-rw-r--r--target/linux/ath79/mikrotik/base-files/etc/board.d/02_network39
-rw-r--r--target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom22
-rw-r--r--target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/11-ath10k-caldata28
-rw-r--r--target/linux/ath79/mikrotik/base-files/etc/uci-defaults/04_led_migration17
4 files changed, 106 insertions, 0 deletions
diff --git a/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network b/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network
new file mode 100644
index 0000000000..ee795c7496
--- /dev/null
+++ b/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+. /lib/functions/system.sh
+. /lib/functions/uci-defaults.sh
+
+ath79_setup_interfaces()
+{
+ local board="$1"
+
+ case "$board" in
+ mikrotik,routerboard-922uags-5hpacd|\
+ mikrotik,routerboard-wap-g-5hact2hnd)
+ ucidef_set_interface_lan "eth0"
+ ;;
+ *)
+ ucidef_set_interfaces_lan_wan "eth0" "eth1"
+ ;;
+ esac
+}
+
+ath79_setup_macs()
+{
+ local board="$1"
+
+ case "$board" in
+ esac
+
+ [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
+ [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
+ [ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac
+}
+
+board_config_update
+board=$(board_name)
+ath79_setup_interfaces $board
+ath79_setup_macs $board
+board_config_flush
+
+exit 0
diff --git a/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
new file mode 100644
index 0000000000..f5f88484b5
--- /dev/null
+++ b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+[ -e /lib/firmware/$FIRMWARE ] && exit 0
+
+. /lib/functions/caldata.sh
+. /lib/functions/mikrotik-caldata.sh
+
+board=$(board_name)
+
+case "$FIRMWARE" in
+"ath9k-eeprom-ahb-18100000.wmac.bin")
+ case $board in
+ mikrotik,routerboard-wap-g-5hact2hnd)
+ mikrotik_caldata_extract "art" 0x1000 0x440
+ ath9k_patch_mac $(macaddr_add $(mtd_get_mac_binary art 0x10) +2)
+ ;;
+ *)
+ caldata_die "board $board is not supported yet"
+ ;;
+ esac
+ ;;
+esac
diff --git a/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
new file mode 100644
index 0000000000..6eb9a93b75
--- /dev/null
+++ b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+[ -e /lib/firmware/$FIRMWARE ] && exit 0
+
+. /lib/functions/caldata.sh
+. /lib/functions/mikrotik-caldata.sh
+
+board=$(board_name)
+
+case "$FIRMWARE" in
+"ath10k/cal-pci-0000:00:00.0.bin")
+ case $board in
+ mikrotik,routerboard-wap-g-5hact2hnd)
+ mikrotik_caldata_extract "art" 0x5000 0x844
+ ;;
+ esac
+ ;;
+"ath10k/cal-pci-0000:01:00.0.bin")
+ case $board in
+ mikrotik,routerboard-922uags-5hpacd)
+ mikrotik_caldata_extract "art" 0x5000 0x844
+ ;;
+ esac
+ ;;
+*)
+ exit 1
+ ;;
+esac
diff --git a/target/linux/ath79/mikrotik/base-files/etc/uci-defaults/04_led_migration b/target/linux/ath79/mikrotik/base-files/etc/uci-defaults/04_led_migration
new file mode 100644
index 0000000000..1a7b371a99
--- /dev/null
+++ b/target/linux/ath79/mikrotik/base-files/etc/uci-defaults/04_led_migration
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+. /lib/functions.sh
+. /lib/functions/migrations.sh
+
+board=$(board_name)
+boardonly="${board##*,}"
+
+case "$board" in
+mikrotik,*)
+ migrate_leds "^rb:=mikrotik:"
+ ;;
+esac
+
+migrations_apply system
+
+exit 0