From cefad013467815876619c49e59ff422b6c440e1e Mon Sep 17 00:00:00 2001 From: Chen Minqiang Date: Wed, 14 Oct 2020 05:08:52 +0800 Subject: [PATCH] ath79: add support for domywifi_dw33d-nor --- .../ath79/dts/qca9558_domywifi_dw33d-nor.dts | 19 ++++++++++++ .../ath79/dts/qca9558_domywifi_dw33d.dts | 28 +++++++++++++++-- target/linux/ath79/image/nand.mk | 30 +++++++++++++++++++ .../nand/base-files/etc/board.d/02_network | 3 +- .../etc/hotplug.d/firmware/11-ath10k-caldata | 3 +- 5 files changed, 79 insertions(+), 4 deletions(-) create mode 100644 target/linux/ath79/dts/qca9558_domywifi_dw33d-nor.dts diff --git a/target/linux/ath79/dts/qca9558_domywifi_dw33d-nor.dts b/target/linux/ath79/dts/qca9558_domywifi_dw33d-nor.dts new file mode 100644 index 0000000000..809c3735d0 --- /dev/null +++ b/target/linux/ath79/dts/qca9558_domywifi_dw33d-nor.dts @@ -0,0 +1,19 @@ +#include "qca9558_domywifi_dw33d.dts" + +/ { + compatible = "domywifi,dw33d-nor", "qca,qca9558"; + model = "DomyWifi DW33D (NOR)"; +}; + +&okli_firmware { + compatible = "openwrt,okli"; + label = "firmware"; +}; + +&nand_kernel { + label = "nand-kernel"; +}; + +&nand_ubi { + label = "nand-ubi"; +}; diff --git a/target/linux/ath79/dts/qca9558_domywifi_dw33d.dts b/target/linux/ath79/dts/qca9558_domywifi_dw33d.dts index 4af1860aca..e320cd411d 100644 --- a/target/linux/ath79/dts/qca9558_domywifi_dw33d.dts +++ b/target/linux/ath79/dts/qca9558_domywifi_dw33d.dts @@ -132,6 +132,30 @@ }; partition@50000 { + label = "loader1"; + reg = <0x50000 0x10000>; + }; + + okli_firmware: partition@60000 { + label = "okli-firmware"; + reg = <0x60000 0xe20000>; + }; + + partition@e80000 { + label = "loader2"; + reg = <0xe80000 0x10000>; + }; + + partition@e90000 { + label = "unused"; + reg = <0xe90000 0x160000>; + }; + + /* firmware + * oem-rootfs: 0x50000 0xe30000 ->loader1(64k) + kernel + rootfs + * oem-kernel: 0xe80000 0x170000 ->loader2(64k) + */ + partition@1 { label = "oem-firmware"; reg = <0x50000 0xfa0000>; }; @@ -153,12 +177,12 @@ #address-cells = <1>; #size-cells = <1>; - partition@0 { + nand_kernel: partition@0 { label = "kernel"; reg = <0x0 0x500000>; }; - partition@500000 { + nand_ubi: partition@500000 { label = "ubi"; reg = <0x500000 0x5b00000>; }; diff --git a/target/linux/ath79/image/nand.mk b/target/linux/ath79/image/nand.mk index c7f96eb6d4..5f3704af0b 100644 --- a/target/linux/ath79/image/nand.mk +++ b/target/linux/ath79/image/nand.mk @@ -2,6 +2,17 @@ include ./common-netgear.mk # for netgear-uImage DEVICE_VARS += RAS_ROOTFS_SIZE RAS_BOARD RAS_VERSION +define Build/append-okli-kernel + dd if="$(KDIR)/loader-$(word 1,$(1)).uImage" >> "$@" +endef + +define Build/prepad-okli-kernel + -[ -f "$@" ] && \ + dd if="$(KDIR)/loader-$(word 1,$(1)).uImage" of="$@".tmp bs=64k conv=sync && \ + cat "$@" >>"$@".tmp && \ + mv "$@".tmp "$@" +endef + # attention: only zlib compression is allowed for the boot fs define Build/zyxel-buildkerneljffs rm -rf $(KDIR_TMP)/zyxelnbg6716 @@ -81,6 +92,25 @@ define Device/domywifi_dw33d endef TARGET_DEVICES += domywifi_dw33d +define Device/domywifi_dw33d-nor + $(Device/domywifi_dw33d) + DEVICE_VARIANT := NOR + IMAGE_SIZE := 14464k + BLOCKSIZE := 64k + LOADER_TYPE := bin + LOADER_FLASH_OFFS := 0x60000 + COMPILE := loader-$(1).bin loader-$(1).uImage + COMPILE/loader-$(1).bin := loader-okli-compile + COMPILE/loader-$(1).uImage := append-loader-okli $(1) | pad-to 64k | lzma | uImage lzma + KERNEL := kernel-bin | append-dtb | lzma | uImage lzma -M 0x4f4b4c49 + IMAGES := sysupgrade.bin breed-factory.bin + IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | append-metadata | \ + check-size + IMAGE/breed-factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | \ + prepad-okli-kernel $(1) | pad-to 14528k | append-okli-kernel $(1) +endef +TARGET_DEVICES += domywifi_dw33d-nor + define Device/glinet_gl-ar300m-common-nand SOC := qca9531 DEVICE_VENDOR := GL.iNet diff --git a/target/linux/ath79/nand/base-files/etc/board.d/02_network b/target/linux/ath79/nand/base-files/etc/board.d/02_network index 910df517aa..a6287df6c8 100755 --- a/target/linux/ath79/nand/base-files/etc/board.d/02_network +++ b/target/linux/ath79/nand/base-files/etc/board.d/02_network @@ -12,7 +12,8 @@ ath79_setup_interfaces() glinet,gl-e750) ucidef_set_interface_lan "eth0" ;; - domywifi,dw33d) + domywifi,dw33d|\ + domywifi,dw33d-nor) ucidef_add_switch "switch0" \ "0@eth0" "1:wan" "2:lan" "3:lan" "4:lan" "5:lan" "6@eth1" ;; diff --git a/target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index bedd02006a..8ab793fc6f 100644 --- a/target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -32,7 +32,8 @@ board=$(board_name) case "$FIRMWARE" in "ath10k/cal-pci-0000:00:00.0.bin") case $board in - domywifi,dw33d) + domywifi,dw33d|\ + domywifi,dw33d-nor) ath10kcal_extract "art" 0x5000 0x844 ath10kcal_patch_mac $(mtd_get_mac_binary art 0x12) ;;