ipq40xx: add support for MobiPromo CM520-79F

MobiPromo CM520-79F is an AC1300 dual band router based on IPQ4019

Specification:

SoC/Wireless: QCA IPQ4019
RAM: 512MiB
Flash: 128MiB SLC NAND
Ethernet PHY: QCA8075
Ethernet ports: 1x WAN, 2x LAN
LEDs: 7 LEDs
      2 (USB, CAN) are GPIO
      other 5 (2.4G, 5G, LAN1, LAN2, WAN) are connected to a shift register
Button: Reset

Flash instruction:
Disassemble the router, connect UART pins like this:
 GND TX    RX
  [x x . . x .]
  [. . . . . .]

(QCA8075 and IPQ4019 below)
Baud-rate: 115200

Set up TFTP server: IP 192.168.1.188/24
Power on the router and interrupt the booting with UART console
env backup (in case you want to go back to stock and need it there):
	printenv
	(Copy the output to somewhere save)
Set bootenv:
	setenv set_ubi 'set mtdids nand0=nand0; set mtdparts mtdparts=nand0:0x7480000@0xb80000(fs); ubi part fs'
	setenv bootkernel 'ubi read 0x84000000 kernel; bootm 0x84000000#config@1'
	setenv cm520_boot 'run set_ubi; run bootkernel'
	setenv bootcmd 'run cm520_boot'
	setenv bootargs
	saveenv
Boot initramfs from TFTP:
	tftpboot openwrt-ipq40xx-generic-mobipromo_cm520-79f-initramfs-fit-zImage.itb
	bootm
After initramfs image is booted, backup rootfs partition in case of reverting to stock image
	cat /dev/mtd12 > /tmp/mtd12.bin
Then fetch it via SCP

Upload nand-factory.ubi to /tmp via SCP, then run
	mtd erase rootfs
	mtd write /tmp/*nand-factory.ubi rootfs
	reboot

To revert to stock image, restore default bootenv in uboot UART console
	setenv bootcmd 'bootipq'
	printenv
use the saved dump you did back when you installed OpenWrt to verify that
there are no other differences from back in the day.
	saveenv
upload the backed up mtd12.bin and run
	tftpboot mtd12.bin
	nand erase 0xb80000 0x7480000
	nand write 0x84000000 0xb80000 0x7480000
The BOOTCONFIG may have been configured to boot from alternate partition (rootfs_1) instead
In case of this, set it back to rootfs:
	cd /tmp
	cat /dev/mtd7 > mtd7.bin
	echo -ne '\x0b' | dd of=mtd7.bin conv=notrunc bs=1 count=1 seek=4
	for i in 28 48 68 108; do
		dd if=/dev/zero of=mtd7.bin conv=notrunc bs=1 count=1 seek=$i
	done
	mtd write mtd7.bin BOOTCONFIG
	mtd write mtd7.bin BOOTCONFIG1

Signed-off-by: DENG Qingfang <dengqf6@mail2.sysu.edu.cn>
[renamed volume to ubi to support autoboot,
as per David Lam's test in PR#2432]
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
This commit is contained in:
DENG Qingfang 2020-01-14 22:22:59 +08:00 committed by Christian Lamparter
parent 8ce138607e
commit a30abb1b6b
11 changed files with 739 additions and 2 deletions

View File

@ -33,6 +33,7 @@ ALLWIFIBOARDS:= \
engenius_emd1 \
ezviz_cs-w3-wd1200g-eup \
linksys_ea8300 \
mobipromo_cm520-79f \
qxwlan_e2600ac
ALLWIFIPACKAGES:=$(foreach BOARD,$(ALLWIFIBOARDS),ipq-wifi-$(BOARD))
@ -102,6 +103,7 @@ $(eval $(call generate-ipq-wifi-package,engenius_eap2200,EnGenius EAP2200))
$(eval $(call generate-ipq-wifi-package,engenius_emd1,EnGenius EMD1))
$(eval $(call generate-ipq-wifi-package,ezviz_cs-w3-wd1200g-eup,EZVIZ CS-W3-WD1200G EUP))
$(eval $(call generate-ipq-wifi-package,linksys_ea8300,Linksys EA8300))
$(eval $(call generate-ipq-wifi-package,mobipromo_cm520-79f,MobiPromo CM520-79F))
$(eval $(call generate-ipq-wifi-package,qxwlan_e2600ac,Qxwlan E2600AC))
$(foreach PACKAGE,$(ALLWIFIPACKAGES),$(eval $(call BuildPackage,$(PACKAGE))))

View File

@ -43,6 +43,11 @@ engenius,ens620ext)
ucidef_set_led_netdev "lan1" "LAN1" "${boardname}:green:lan1" "eth0"
ucidef_set_led_netdev "lan2" "LAN2" "${boardname}:green:lan2" "eth1"
;;
mobipromo,cm520-79f)
ucidef_set_led_netdev "wan" "WAN" "${boardname}:blue:wan" "eth1"
ucidef_set_led_switch "lan1" "LAN1" "${boardname}:blue:lan1" "switch0" "0x10"
ucidef_set_led_switch "lan2" "LAN2" "${boardname}:blue:lan2" "switch0" "0x08"
;;
netgear,ex6100v2 |\
netgear,ex6150v2)
ucidef_set_led_wlan "wlan2g" "WLAN2G" "ex61x0v2:green:router" "phy0tpt"

View File

@ -73,6 +73,11 @@ ipq40xx_setup_interfaces()
ucidef_add_switch "switch0" \
"0u@eth0" "3:lan" "4:lan"
;;
mobipromo,cm520-79f)
ucidef_add_switch "switch0" \
"0u@eth0" "3:lan:2" "4:lan:1"
ucidef_set_interface_wan "eth1"
;;
qxwlan,e2600ac-c1 |\
qxwlan,e2600ac-c2)
ucidef_set_interfaces_lan_wan "eth0" "eth1"

View File

@ -51,6 +51,7 @@ case "$FIRMWARE" in
ezviz,cs-w3-wd1200g-eup |\
glinet,gl-b1300 |\
linksys,ea6350v3 |\
mobipromo,cm520-79f |\
qcom,ap-dk01.1-c1)
caldata_extract "ART" 0x1000 0x2f20
;;
@ -132,6 +133,7 @@ case "$FIRMWARE" in
ezviz,cs-w3-wd1200g-eup |\
glinet,gl-b1300 |\
linksys,ea6350v3 |\
mobipromo,cm520-79f |\
qcom,ap-dk01.1-c1)
caldata_extract "ART" 0x5000 0x2f20
;;

View File

@ -54,6 +54,7 @@ platform_do_upgrade() {
avm,fritzrepeater-3000 |\
cilab,meshpoint-one |\
engenius,eap2200 |\
mobipromo,cm520-79f |\
qxwlan,e2600ac-c2)
nand_do_upgrade "$1"
;;

View File

@ -0,0 +1,354 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
#include "qcom-ipq4019.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/soc/qcom,tcsr.h>
/ {
model = "MobiPromo CM520-79F";
compatible = "mobipromo,cm520-79f";
aliases {
led-boot = &led_sys;
led-failsafe = &led_sys;
led-running = &led_sys;
led-upgrade = &led_sys;
};
soc {
rng@22000 {
status = "okay";
};
mdio@90000 {
status = "okay";
pinctrl-0 = <&mdio_pins>;
pinctrl-names = "default";
reset-gpios = <&tlmm 47 GPIO_ACTIVE_LOW>;
reset-delay-us = <1000>;
};
ess-psgmii@98000 {
status = "okay";
};
tcsr@1949000 {
compatible = "qcom,tcsr";
reg = <0x1949000 0x100>;
qcom,wifi_glb_cfg = <TCSR_WIFI_GLB_CFG>;
};
tcsr@194b000 {
compatible = "qcom,tcsr";
reg = <0x194b000 0x100>;
qcom,usb-hsphy-mode-select = <TCSR_USB_HSPHY_HOST_MODE>;
};
ess_tcsr@1953000 {
compatible = "qcom,tcsr";
reg = <0x1953000 0x1000>;
qcom,ess-interface-select = <TCSR_ESS_PSGMII>;
};
tcsr@1957000 {
compatible = "qcom,tcsr";
reg = <0x1957000 0x100>;
qcom,wifi_noc_memtype_m0_m2 = <TCSR_WIFI_NOC_MEMTYPE_M0_M2>;
};
usb2@60f8800 {
status = "okay";
dwc3@6000000 {
#address-cells = <1>;
#size-cells = <0>;
usb2_port1: port@1 {
reg = <1>;
#trigger-source-cells = <0>;
};
};
};
usb3@8af8800 {
status = "okay";
dwc3@8a00000 {
#address-cells = <1>;
#size-cells = <0>;
usb3_port1: port@1 {
reg = <1>;
#trigger-source-cells = <0>;
};
usb3_port2: port@2 {
reg = <2>;
#trigger-source-cells = <0>;
};
};
};
crypto@8e3a000 {
status = "okay";
};
watchdog@b017000 {
status = "okay";
};
ess-switch@c000000 {
status = "okay";
};
edma@c080000 {
status = "okay";
};
};
led_spi {
compatible = "spi-gpio";
#address-cells = <1>;
ranges;
sck-gpios = <&tlmm 40 GPIO_ACTIVE_HIGH>;
mosi-gpios = <&tlmm 36 GPIO_ACTIVE_HIGH>;
num-chipselects = <0>;
led_gpio: led_gpio@0 {
compatible = "fairchild,74hc595";
reg = <0>;
gpio-controller;
#gpio-cells = <2>;
registers-number = <1>;
spi-max-frequency = <1000000>;
};
};
leds {
compatible = "gpio-leds";
usb {
label = "cm520-79f:blue:usb";
gpios = <&tlmm 10 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "usbport";
trigger-sources = <&usb3_port1>, <&usb3_port2>, <&usb2_port1>;
};
led_sys: can {
label = "cm520-79f:blue:can";
gpios = <&tlmm 11 GPIO_ACTIVE_HIGH>;
};
wan {
label = "cm520-79f:blue:wan";
gpios = <&led_gpio 0 GPIO_ACTIVE_LOW>;
};
lan1 {
label = "cm520-79f:blue:lan1";
gpios = <&led_gpio 1 GPIO_ACTIVE_LOW>;
};
lan2 {
label = "cm520-79f:blue:lan2";
gpios = <&led_gpio 2 GPIO_ACTIVE_LOW>;
};
wlan2g {
label = "cm520-79f:blue:wlan2g";
gpios = <&led_gpio 5 GPIO_ACTIVE_LOW>;
linux,default-trigger = "phy0tpt";
};
wlan5g {
label = "cm520-79f:blue:wlan5g";
gpios = <&led_gpio 6 GPIO_ACTIVE_LOW>;
linux,default-trigger = "phy1tpt";
};
};
keys {
compatible = "gpio-keys";
reset {
label = "reset";
gpios = <&tlmm 18 GPIO_ACTIVE_LOW>;
linux,code = <KEY_RESTART>;
};
};
};
&blsp_dma {
status = "okay";
};
&blsp1_uart1 {
status = "okay";
};
&blsp1_uart2 {
status = "okay";
};
&cryptobam {
status = "okay";
};
&gmac0 {
mtd-mac-address = <&art 0x1006>;
};
&gmac1 {
mtd-mac-address = <&art 0x5006>;
};
&nand {
pinctrl-0 = <&nand_pins>;
pinctrl-names = "default";
status = "okay";
nand@0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "SBL1";
reg = <0x0 0x100000>;
read-only;
};
partition@100000 {
label = "MIBIB";
reg = <0x100000 0x100000>;
read-only;
};
partition@200000 {
label = "BOOTCONFIG";
reg = <0x200000 0x100000>;
};
partition@300000 {
label = "QSEE";
reg = <0x300000 0x100000>;
read-only;
};
partition@400000 {
label = "QSEE_1";
reg = <0x400000 0x100000>;
read-only;
};
partition@500000 {
label = "CDT";
reg = <0x500000 0x80000>;
read-only;
};
partition@580000 {
label = "CDT_1";
reg = <0x580000 0x80000>;
read-only;
};
partition@600000 {
label = "BOOTCONFIG1";
reg = <0x600000 0x80000>;
};
partition@680000 {
label = "APPSBLENV";
reg = <0x680000 0x80000>;
};
partition@700000 {
label = "APPSBL";
reg = <0x700000 0x200000>;
read-only;
};
partition@900000 {
label = "APPSBL_1";
reg = <0x900000 0x200000>;
read-only;
};
art: partition@b00000 {
label = "ART";
reg = <0xb00000 0x80000>;
read-only;
};
partition@b80000 {
label = "ubi";
reg = <0xb80000 0x7480000>;
};
};
};
};
&qpic_bam {
status = "okay";
};
&tlmm {
mdio_pins: mdio_pinmux {
mux_1 {
pins = "gpio6";
function = "mdio";
bias-pull-up;
};
mux_2 {
pins = "gpio7";
function = "mdc";
bias-pull-up;
};
};
nand_pins: nand_pins {
pullups {
pins = "gpio52", "gpio53", "gpio58",
"gpio59";
function = "qpic";
bias-pull-up;
};
pulldowns {
pins = "gpio54", "gpio55", "gpio56",
"gpio57", "gpio60", "gpio61",
"gpio62", "gpio63", "gpio64",
"gpio65", "gpio66", "gpio67",
"gpio68", "gpio69";
function = "qpic";
bias-pull-down;
};
};
};
&usb3_ss_phy {
status = "okay";
};
&usb3_hs_phy {
status = "okay";
};
&usb2_hs_phy {
status = "okay";
};
&wifi0 {
status = "okay";
qcom,ath10k-calibration-variant = "CM520-79F";
};
&wifi1 {
status = "okay";
qcom,ath10k-calibration-variant = "CM520-79F";
};

View File

@ -0,0 +1,354 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
#include "qcom-ipq4019.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/soc/qcom,tcsr.h>
/ {
model = "MobiPromo CM520-79F";
compatible = "mobipromo,cm520-79f";
aliases {
led-boot = &led_sys;
led-failsafe = &led_sys;
led-running = &led_sys;
led-upgrade = &led_sys;
};
soc {
rng@22000 {
status = "okay";
};
mdio@90000 {
status = "okay";
pinctrl-0 = <&mdio_pins>;
pinctrl-names = "default";
reset-gpios = <&tlmm 47 GPIO_ACTIVE_LOW>;
reset-delay-us = <1000>;
};
ess-psgmii@98000 {
status = "okay";
};
tcsr@1949000 {
compatible = "qcom,tcsr";
reg = <0x1949000 0x100>;
qcom,wifi_glb_cfg = <TCSR_WIFI_GLB_CFG>;
};
tcsr@194b000 {
compatible = "qcom,tcsr";
reg = <0x194b000 0x100>;
qcom,usb-hsphy-mode-select = <TCSR_USB_HSPHY_HOST_MODE>;
};
ess_tcsr@1953000 {
compatible = "qcom,tcsr";
reg = <0x1953000 0x1000>;
qcom,ess-interface-select = <TCSR_ESS_PSGMII>;
};
tcsr@1957000 {
compatible = "qcom,tcsr";
reg = <0x1957000 0x100>;
qcom,wifi_noc_memtype_m0_m2 = <TCSR_WIFI_NOC_MEMTYPE_M0_M2>;
};
usb2@60f8800 {
status = "okay";
dwc3@6000000 {
#address-cells = <1>;
#size-cells = <0>;
usb2_port1: port@1 {
reg = <1>;
#trigger-source-cells = <0>;
};
};
};
usb3@8af8800 {
status = "okay";
dwc3@8a00000 {
#address-cells = <1>;
#size-cells = <0>;
usb3_port1: port@1 {
reg = <1>;
#trigger-source-cells = <0>;
};
usb3_port2: port@2 {
reg = <2>;
#trigger-source-cells = <0>;
};
};
};
crypto@8e3a000 {
status = "okay";
};
watchdog@b017000 {
status = "okay";
};
ess-switch@c000000 {
status = "okay";
};
edma@c080000 {
status = "okay";
};
};
led_spi {
compatible = "spi-gpio";
#address-cells = <1>;
ranges;
sck-gpios = <&tlmm 40 GPIO_ACTIVE_HIGH>;
mosi-gpios = <&tlmm 36 GPIO_ACTIVE_HIGH>;
num-chipselects = <0>;
led_gpio: led_gpio@0 {
compatible = "fairchild,74hc595";
reg = <0>;
gpio-controller;
#gpio-cells = <2>;
registers-number = <1>;
spi-max-frequency = <1000000>;
};
};
leds {
compatible = "gpio-leds";
usb {
label = "cm520-79f:blue:usb";
gpios = <&tlmm 10 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "usbport";
trigger-sources = <&usb3_port1>, <&usb3_port2>, <&usb2_port1>;
};
led_sys: can {
label = "cm520-79f:blue:can";
gpios = <&tlmm 11 GPIO_ACTIVE_HIGH>;
};
wan {
label = "cm520-79f:blue:wan";
gpios = <&led_gpio 0 GPIO_ACTIVE_LOW>;
};
lan1 {
label = "cm520-79f:blue:lan1";
gpios = <&led_gpio 1 GPIO_ACTIVE_LOW>;
};
lan2 {
label = "cm520-79f:blue:lan2";
gpios = <&led_gpio 2 GPIO_ACTIVE_LOW>;
};
wlan2g {
label = "cm520-79f:blue:wlan2g";
gpios = <&led_gpio 5 GPIO_ACTIVE_LOW>;
linux,default-trigger = "phy0tpt";
};
wlan5g {
label = "cm520-79f:blue:wlan5g";
gpios = <&led_gpio 6 GPIO_ACTIVE_LOW>;
linux,default-trigger = "phy1tpt";
};
};
keys {
compatible = "gpio-keys";
reset {
label = "reset";
gpios = <&tlmm 18 GPIO_ACTIVE_LOW>;
linux,code = <KEY_RESTART>;
};
};
};
&blsp_dma {
status = "okay";
};
&blsp1_uart1 {
status = "okay";
};
&blsp1_uart2 {
status = "okay";
};
&cryptobam {
status = "okay";
};
&gmac0 {
mtd-mac-address = <&art 0x1006>;
};
&gmac1 {
mtd-mac-address = <&art 0x5006>;
};
&nand {
pinctrl-0 = <&nand_pins>;
pinctrl-names = "default";
status = "okay";
nand@0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "SBL1";
reg = <0x0 0x100000>;
read-only;
};
partition@100000 {
label = "MIBIB";
reg = <0x100000 0x100000>;
read-only;
};
partition@200000 {
label = "BOOTCONFIG";
reg = <0x200000 0x100000>;
};
partition@300000 {
label = "QSEE";
reg = <0x300000 0x100000>;
read-only;
};
partition@400000 {
label = "QSEE_1";
reg = <0x400000 0x100000>;
read-only;
};
partition@500000 {
label = "CDT";
reg = <0x500000 0x80000>;
read-only;
};
partition@580000 {
label = "CDT_1";
reg = <0x580000 0x80000>;
read-only;
};
partition@600000 {
label = "BOOTCONFIG1";
reg = <0x600000 0x80000>;
};
partition@680000 {
label = "APPSBLENV";
reg = <0x680000 0x80000>;
};
partition@700000 {
label = "APPSBL";
reg = <0x700000 0x200000>;
read-only;
};
partition@900000 {
label = "APPSBL_1";
reg = <0x900000 0x200000>;
read-only;
};
art: partition@b00000 {
label = "ART";
reg = <0xb00000 0x80000>;
read-only;
};
partition@b80000 {
label = "ubi";
reg = <0xb80000 0x7480000>;
};
};
};
};
&qpic_bam {
status = "okay";
};
&tlmm {
mdio_pins: mdio_pinmux {
mux_1 {
pins = "gpio6";
function = "mdio";
bias-pull-up;
};
mux_2 {
pins = "gpio7";
function = "mdc";
bias-pull-up;
};
};
nand_pins: nand_pins {
pullups {
pins = "gpio52", "gpio53", "gpio58",
"gpio59";
function = "qpic";
bias-pull-up;
};
pulldowns {
pins = "gpio54", "gpio55", "gpio56",
"gpio57", "gpio60", "gpio61",
"gpio62", "gpio63", "gpio64",
"gpio65", "gpio66", "gpio67",
"gpio68", "gpio69";
function = "qpic";
bias-pull-down;
};
};
};
&usb3_ss_phy {
status = "okay";
};
&usb3_hs_phy {
status = "okay";
};
&usb2_hs_phy {
status = "okay";
};
&wifi0 {
status = "okay";
qcom,ath10k-calibration-variant = "CM520-79F";
};
&wifi1 {
status = "okay";
qcom,ath10k-calibration-variant = "CM520-79F";
};

View File

@ -452,6 +452,18 @@ define Device/meraki_mr33
endef
TARGET_DEVICES += meraki_mr33
define Device/mobipromo_cm520-79f
$(call Device/FitzImage)
$(call Device/UbiFit)
DEVICE_VENDOR := MobiPromo
DEVICE_MODEL := CM520-79F
SOC := qcom-ipq4019
BLOCKSIZE := 128k
PAGESIZE := 2048
DEVICE_PACKAGES := ipq-wifi-mobipromo_cm520-79f kmod-usb-ledtrig-usbport
endef
TARGET_DEVICES += mobipromo_cm520-79f
define Device/netgear_ex61x0v2
$(call Device/DniImage)
DEVICE_DTS_CONFIG := config@4

View File

@ -10,7 +10,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -785,11 +785,44 @@ dtb-$(CONFIG_ARCH_QCOM) += \
@@ -785,11 +785,45 @@ dtb-$(CONFIG_ARCH_QCOM) += \
qcom-apq8074-dragonboard.dtb \
qcom-apq8084-ifc6540.dtb \
qcom-apq8084-mtp.dtb \
@ -36,6 +36,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
qcom-ipq4019-ap.dk07.1-c1.dtb \
qcom-ipq4019-ap.dk07.1-c2.dtb \
+ qcom-ipq4019-a62.dtb \
+ qcom-ipq4019-cm520-79f.dtb \
+ qcom-ipq4019-eap2200.dtb \
+ qcom-ipq4019-fritzbox-7530.dtb \
+ qcom-ipq4019-fritzrepeater-1200.dtb \

View File

@ -10,7 +10,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -837,11 +837,44 @@ dtb-$(CONFIG_ARCH_QCOM) += \
@@ -837,11 +837,45 @@ dtb-$(CONFIG_ARCH_QCOM) += \
qcom-apq8074-dragonboard.dtb \
qcom-apq8084-ifc6540.dtb \
qcom-apq8084-mtp.dtb \
@ -36,6 +36,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
qcom-ipq4019-ap.dk07.1-c1.dtb \
qcom-ipq4019-ap.dk07.1-c2.dtb \
+ qcom-ipq4019-a62.dtb \
+ qcom-ipq4019-cm520-79f.dtb \
+ qcom-ipq4019-ea8300.dtb \
+ qcom-ipq4019-eap2200.dtb \
+ qcom-ipq4019-fritzbox-7530.dtb \