From a9360452f0130bb39a8e732334a174cc3f8991fd Mon Sep 17 00:00:00 2001 From: Chuanhong Guo Date: Mon, 15 Jul 2019 19:43:31 +0800 Subject: ath79: add support for Qihoo C301 Specifications: - SoC: AR9344 - RAM: 128MB - Flash: 2 * 16MB (MX25L12845) - Ethernet: 2 * FE LAN & 1 * FE WAN - WiFi: 2.4G: AR9344 5G: QCA9882 Flash instruction: 1. Hold reset and power up the router 2. Set your IP to 192.168.1.x 3. Open 192.168.1.1 and upload the generated *factory* firmware Signed-off-by: Chuanhong Guo --- target/linux/ath79/base-files/etc/board.d/01_leds | 3 +++ target/linux/ath79/base-files/etc/board.d/02_network | 9 +++++++++ .../ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom | 4 ++++ .../ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata | 4 ++++ target/linux/ath79/base-files/etc/init.d/bootcount | 11 +++++++++++ 5 files changed, 31 insertions(+) create mode 100755 target/linux/ath79/base-files/etc/init.d/bootcount (limited to 'target/linux/ath79/base-files') diff --git a/target/linux/ath79/base-files/etc/board.d/01_leds b/target/linux/ath79/base-files/etc/board.d/01_leds index 46b3e51193..ecfb7b0694 100755 --- a/target/linux/ath79/base-files/etc/board.d/01_leds +++ b/target/linux/ath79/base-files/etc/board.d/01_leds @@ -104,6 +104,9 @@ pcs,cr3000) ucidef_set_led_switch "lan3" "LAN3" "pcs:blue:lan3" "switch0" "0x10" ucidef_set_led_switch "lan4" "LAN4" "pcs:blue:lan4" "switch0" "0x02" ;; +qihoo,c301) + ucidef_set_led_wlan "wlan" "WLAN" "$boardname:green:wlan" "phy0tpt" + ;; tplink,archer-a7-v5|\ tplink,archer-c7-v4|\ tplink,archer-c7-v5) diff --git a/target/linux/ath79/base-files/etc/board.d/02_network b/target/linux/ath79/base-files/etc/board.d/02_network index 85e57c6eb5..f7cac3e300 100755 --- a/target/linux/ath79/base-files/etc/board.d/02_network +++ b/target/linux/ath79/base-files/etc/board.d/02_network @@ -184,6 +184,11 @@ ath79_setup_interfaces() ucidef_add_switch "switch0" \ "0@eth0" "3:lan:1" "5:lan:2" "4:wan" ;; + qihoo,c301) + ucidef_set_interface_wan "eth1" + ucidef_add_switch "switch0" \ + "0@eth0" "2:lan" "3:lan" + ;; rosinson,wr818) ucidef_add_switch "switch0" \ "0@eth0" "1:lan" "2:lan" "3:wan" @@ -328,6 +333,10 @@ ath79_setup_macs() lan_mac=$(k2t_get_mac "lan_mac") wan_mac=$(k2t_get_mac "wan_mac") ;; + qihoo,c301) + lan_mac=$(mtd_get_mac_ascii devdata lanmac) + wan_mac=$(mtd_get_mac_ascii devdata wanmac) + ;; rosinson,wr818) wan_mac=$(mtd_get_mac_binary factory 0) lan_mac=$(macaddr_setbit_la "$wan_mac") diff --git a/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom index 5a20b84344..f049dbd46a 100644 --- a/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom +++ b/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom @@ -127,6 +127,10 @@ case "$FIRMWARE" in ath9k_eeprom_extract "art" 4096 1088 ath9k_patch_fw_mac $(mtd_get_mac_text board_data 1664) 2 ;; + qihoo,c301) + ath9k_eeprom_extract "radiocfg" 4096 1088 + ath9k_patch_fw_mac $(mtd_get_mac_ascii devdata "wlan24mac") 2 + ;; *) ath9k_eeprom_die "board $board is not supported yet" ;; diff --git a/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index 06a48e2258..149d744eb8 100644 --- a/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -138,6 +138,10 @@ case "$FIRMWARE" in ath10kcal_extract "art" 20480 2116 ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +16) ;; + qihoo,c301) + ath10kcal_extract "radiocfg" 20480 2116 + ath10kcal_patch_mac_crc $(mtd_get_mac_ascii devdata wlan5mac) + ;; tplink,archer-a7-v5|\ tplink,archer-c2-v3|\ tplink,archer-c7-v4|\ diff --git a/target/linux/ath79/base-files/etc/init.d/bootcount b/target/linux/ath79/base-files/etc/init.d/bootcount new file mode 100755 index 0000000000..b71fbf9a69 --- /dev/null +++ b/target/linux/ath79/base-files/etc/init.d/bootcount @@ -0,0 +1,11 @@ +#!/bin/sh /etc/rc.common +START=99 + +boot() { + case $(board_name) in + qihoo,c301) + local n=$(fw_printenv activeregion | cut -d = -f 2) + fw_setenv "image${n}trynum" 0 + ;; + esac +} -- cgit v1.2.3