[OpenWrt-Devel] [PATCH] ath79: add support for Qihoo C301
Adrian Schmutzler
mail at adrianschmutzler.de
Mon Jul 15 09:29:27 EDT 2019
Hi,
can you tell which of the 4 MAC addresses is on the device label, so I can add it to my label-mac-address PR?
Best
Adrian
> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org] On
> Behalf Of Chuanhong Guo
> Sent: Montag, 15. Juli 2019 13:54
> To: openwrt-devel at lists.openwrt.org
> Cc: Chuanhong Guo <gch981213 at gmail.com>
> Subject: [OpenWrt-Devel] [PATCH] 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 <gch981213 at gmail.com>
> ---
> package/boot/uboot-envtools/files/ath79 | 3 +
> .../ath79/base-files/etc/board.d/01_leds | 3 +
> .../ath79/base-files/etc/board.d/02_network | 9 +
> .../etc/hotplug.d/firmware/10-ath9k-eeprom | 4 +
> .../etc/hotplug.d/firmware/11-ath10k-caldata | 4 +
> .../ath79/base-files/etc/init.d/bootcount | 11 +
> target/linux/ath79/config-4.19 | 1 +
> target/linux/ath79/dts/ar9344_qihoo_c301.dts | 236 ++++++++++++++++++
> target/linux/ath79/image/generic.mk | 12 +
> 9 files changed, 283 insertions(+)
> create mode 100755 target/linux/ath79/base-files/etc/init.d/bootcount
> create mode 100644 target/linux/ath79/dts/ar9344_qihoo_c301.dts
>
> diff --git a/package/boot/uboot-envtools/files/ath79 b/package/boot/uboot-
> envtools/files/ath79
> index 069d7be06b..cc11725242 100644
> --- a/package/boot/uboot-envtools/files/ath79
> +++ b/package/boot/uboot-envtools/files/ath79
> @@ -29,6 +29,9 @@ openmesh,om5p-ac-v2|\
> yuncore,a770)
> ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000"
> ;;
> +qihoo,c301)
> + ubootenv_add_uci_config "/dev/mtd9" "0x0" "0x10000" "0x10000"
> + ;;
> esac
>
> config_load ubootenv
> 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 at eth0" "3:lan:1" "5:lan:2" "4:wan"
> ;;
> + qihoo,c301)
> + ucidef_set_interface_wan "eth1"
> + ucidef_add_switch "switch0" \
> + "0 at eth0" "2:lan" "3:lan"
> + ;;
> rosinson,wr818)
> ucidef_add_switch "switch0" \
> "0 at 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
> +}
> diff --git a/target/linux/ath79/config-4.19 b/target/linux/ath79/config-4.19
> index 6cdbb968c3..3843702a38 100644
> --- a/target/linux/ath79/config-4.19
> +++ b/target/linux/ath79/config-4.19
> @@ -167,6 +167,7 @@ CONFIG_MTD_PARSER_CYBERTAN=y
> CONFIG_MTD_PHYSMAP=y
> CONFIG_MTD_SPI_NOR=y
> CONFIG_MTD_SPLIT_LZMA_FW=y
> +CONFIG_MTD_SPLIT_SEAMA_FW=y
> CONFIG_MTD_SPLIT_TPLINK_FW=y
> CONFIG_MTD_SPLIT_UIMAGE_FW=y
> CONFIG_MTD_TPLINK_PARTS=y
> diff --git a/target/linux/ath79/dts/ar9344_qihoo_c301.dts
> b/target/linux/ath79/dts/ar9344_qihoo_c301.dts
> new file mode 100644
> index 0000000000..92c4433070
> --- /dev/null
> +++ b/target/linux/ath79/dts/ar9344_qihoo_c301.dts
> @@ -0,0 +1,236 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
> +/dts-v1/;
> +
> +#include <dt-bindings/gpio/gpio.h>
> +#include <dt-bindings/input/input.h>
> +
> +#include "ar9344.dtsi"
> +
> +/ {
> + model = "Qihoo 360 C301";
> + compatible = "qihoo,c301";
> +
> + aliases {
> + led-boot = &led_wlan_g;
> + led-failsafe = &led_wlan_o;
> + led-upgrade = &led_wlan_o;
> + };
> +
> + leds {
> + compatible = "gpio-leds";
> + pinctrl-names = "default";
> + pinctrl-0 = <&jtag_disable_pins>;
> +
> + led_wlan_g: wlan_g {
> + label = "c301:green:wlan";
> + gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
> + };
> +
> + led_wlan_o: wlan_o {
> + label = "c301:orange:wlan";
> + gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
> + linux,default-trigger = "phy1tpt";
> + };
> + };
> +
> + keys {
> + compatible = "gpio-keys";
> +
> + reset {
> + linux,code = <KEY_RESTART>;
> + gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
> + debounce-interval = <60>;
> + };
> + };
> +
> + reg_eth_led_vbus {
> + compatible = "regulator-fixed";
> + regulator-name = "eth_led_vbus";
> + regulator-min-microvolt = <3300000>;
> + regulator-max-microvolt = <3300000>;
> + regulator-always-on;
> + gpio = <&gpio 18 GPIO_ACTIVE_LOW>;
> + };
> +
> + reg_usb_vbus {
> + compatible = "regulator-fixed";
> + regulator-name = "usb_vbus";
> + regulator-min-microvolt = <5000000>;
> + regulator-max-microvolt = <5000000>;
> + enable-active-high;
> + regulator-always-on;
> + gpio = <&gpio 19 GPIO_ACTIVE_HIGH>;
> + };
> +};
> +
> +&pinmux {
> + pmx_spi_cs1: pinmux_spi_cs1 {
> + pinctrl-single,bits = <0xc 0x07 0xff>;
> + };
> +
> + pmx_led_switch: pinmux_led_switch {
> + pinctrl-single,bits = <0x0 0x2b2a2d00 0xffffff00>;
> + };
> +};
> +
> +&ref {
> + clock-frequency = <40000000>;
> +};
> +
> +&uart {
> + status = "okay";
> +};
> +
> +&gpio {
> + status = "okay";
> +
> + gpio_ext_lna0 {
> + gpio-hog;
> + gpios = <14 0>;
> + output-high;
> + line-name = "c301:ext:lna0";
> + };
> +
> + gpio_ext_lna1 {
> + gpio-hog;
> + gpios = <15 0>;
> + output-high;
> + line-name = "c301:ext:lna1";
> + };
> +};
> +
> +&builtin_switch {
> + pinctrl-names = "default";
> + pinctrl-0 = <&pmx_led_switch>;
> +};
> +
> +&spi {
> + pinctrl-names = "default";
> + pinctrl-0 = <&pmx_spi_cs1>;
> + status = "okay";
> +
> + num-cs = <2>;
> + cs-gpios= <0>, <0>;
> +
> + flash at 0 {
> + #address-cells = <1>;
> + #size-cells = <1>;
> + compatible = "jedec,spi-nor";
> + reg = <0>;
> + spi-max-frequency = <25000000>;
> +
> + partitions {
> + compatible = "fixed-partitions";
> + #address-cells = <1>;
> + #size-cells = <1>;
> +
> + uboot: partition at 0 {
> + label = "u-boot";
> + reg = <0x0 0x40000>;
> + read-only;
> + };
> +
> + partition at 40000 {
> + label = "u-boot-env";
> + reg = <0x40000 0x10000>;
> + read-only;
> + };
> +
> + partition at 50000 {
> + label = "devdata";
> + reg = <0x50000 0x10000>;
> + read-only;
> + };
> +
> + partition at 60000 {
> + label = "devconf";
> + reg = <0x60000 0x10000>;
> + read-only;
> + };
> +
> + partition at 70000 {
> + compatible = "seama";
> + label = "firmware";
> + reg = <0x70000 0xf60000>;
> + };
> +
> + partition at fd0000 {
> + label = "warm_start";
> + reg = <0xfd0000 0x10000>;
> + read-only;
> + };
> +
> + partition at fe0000 {
> + label = "action_image_config";
> + reg = <0xfe0000 0x10000>;
> + };
> +
> + partition at ff0000 {
> + label = "radiocfg";
> + reg = <0xff0000 0x10000>;
> + read-only;
> + };
> + };
> + };
> +
> + flash at 1 {
> + #address-cells = <1>;
> + #size-cells = <1>;
> + compatible = "jedec,spi-nor";
> + reg = <1>;
> + spi-max-frequency = <25000000>;
> +
> + partitions {
> + compatible = "fixed-partitions";
> + #address-cells = <1>;
> + #size-cells = <1>;
> +
> + partition at 0 {
> + label = "firmware2";
> + reg = <0x0 0xf00000>;
> + };
> +
> + partition at f00000 {
> + label = "privatedata";
> + reg = <0xf00000 0x100000>;
> + read-only;
> + };
> + };
> + };
> +};
> +
> +&usb {
> + status = "okay";
> +};
> +
> +&usb_phy {
> + status = "okay";
> +};
> +
> +&pcie {
> + status = "okay";
> +
> + wifi at 0,0 {
> + compatible = "qcom,ath10k";
> + reg = <0 0 0 0 0>;
> + };
> +};
> +
> +&wmac {
> + status = "okay";
> + qca,no-eeprom;
> +};
> +
> +ð1 {
> + status = "okay";
> + gmac-config {
> + device = <&gmac>;
> + switch-phy-swap = <1>;
> + switch-only-mode = <1>;
> + };
> +};
> +
> +ð0 {
> + status = "okay";
> + phy-handle = <&swphy0>;
> +};
> diff --git a/target/linux/ath79/image/generic.mk
> b/target/linux/ath79/image/generic.mk
> index 0836751e2a..4662383541 100644
> --- a/target/linux/ath79/image/generic.mk
> +++ b/target/linux/ath79/image/generic.mk
> @@ -728,6 +728,18 @@ define Device/phicomm_k2t
> endef
> TARGET_DEVICES += phicomm_k2t
>
> +define Device/qihoo_c301
> + $(Device/seama)
> + ATH_SOC := ar9344
> + DEVICE_VENDOR := Qihoo
> + DEVICE_MODEL := C301
> + DEVICE_PACKAGES := kmod-usb2 kmod-ath10k-ct ath10k-firmware-qca988x-
> ct uboot-envtools
> + IMAGE_SIZE := 15744k
> + SEAMA_SIGNATURE := wrgac26_qihoo360_360rg
> + SUPPORTED_DEVICES += qihoo-c301
> +endef
> +TARGET_DEVICES += qihoo_c301
> +
> define Device/rosinson_wr818
> ATH_SOC := qca9563
> DEVICE_VENDOR := Rosinson
> --
> 2.21.0
>
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20190715/4afd54fe/attachment.sig>
-------------- next part --------------
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list