ipq807x: Add support for Plasma Cloud PAX1800 v2

Device specifications:
======================

* Qualcomm IPQ6000
* 512 MB of RAM
* 64 MB of SPI NOR flash
  - 2x 28 MB available; but one of the 28 MB regions is the recovery image
* 2T2R 2.4 GHz Wi-Fi (11ax)
* 2T2R 5 GHz Wi-Fi (11ax)
* multi-color LED (controlled via red/green/blue GPIOs)
* 1x GPIO-button (reset)
* external h/w watchdog (enabled by default))
* TTL pins are on board
* 2x ethernet
  - eth0
    + 1000 Mbps Ethernet
    + used as LAN interface
  - eth1
    + 1000 Mbps Ethernet
    + 802.3at POE
    + used as WAN interface
* 12 2A DC
* internal antennas

Flashing instructions:
======================

Various methods can be used to install the actual image on the flash.
Two easy ones are:

ap51-flash
----------

The tool ap51-flash (https://github.com/ap51-flash/ap51-flash) should be
used to transfer the image to the u-boot when the device boots up.

initramfs from TFTP
-------------------

The serial console must be used to access the u-boot shell during bootup.
It can then be used to first boot up the initramfs image from a TFTP server
(here with the IP 192.168.1.21):

   setenv serverip 192.168.1.21
   setenv ipaddr 192.168.1.1
   setenv bootargs 'console=ttyMSM0,115200n8 rootfstype=squashfs,jffs2 board=PAX1800v2 root=31:10 mtdparts=spi32766.0:768k(0:SBL1),64k(0:MIBIB),1664k(0:QSEE),64k(0:DEVCFG),128k(0:RPM),64k(0:CDT),64k(0:APPSBLENV),640k(0:APPSBL),256k(0:ART),28672k(inactive),28672k(inactive2),64k(custom),64k(0:KEYS),2304k(0:WIFIFW)'
   tftpboot <filename-of-initramfs-kernel>.bin && bootm

The actual sysupgrade image can then be transferred (on the LAN port) to the
device via

  scp <filename-of-squashfs-sysupgrade>.bin root@192.168.1.1:/tmp/

On the device, the sysupgrade must then be started using

  sysupgrade -n /tmp/<filename-of-squashfs-sysupgrade>.bin

Signed-off-by: Sven Eckelmann <sven@narfation.org>
This commit is contained in:
Sven Eckelmann
2022-03-14 15:47:05 +01:00
committed by John Crispin
parent 200f627a9c
commit cc54c8654f
11 changed files with 532 additions and 3 deletions

View File

@@ -34,7 +34,8 @@ qcom_setup_interfaces()
qcom,ipq5018-mp03.3|\
yuncore,ax840|\
motorola,q14|\
sercomm,wallaby)
sercomm,wallaby|\
plasmacloud,pax1800-v2)
ucidef_set_interface_lan "eth0"
ucidef_set_interface_wan "eth1"
;;

View File

@@ -49,6 +49,15 @@ ath11k_generate_macs_ion4x() {
echo -ne \\x${wifimac2//:/\\x} >> /lib/firmware/ath11k-macs
}
ath11k_generate_macs_pax1800() {
touch /lib/firmware/ath11k-macs
eth=$(cat /sys/class/net/eth0/address)
mac1=$(macaddr_add $eth 10)
mac2=$(macaddr_add $eth 2)
echo -ne \\x${mac1//:/\\x} >> /lib/firmware/ath11k-macs
echo -ne \\x${mac2//:/\\x} >> /lib/firmware/ath11k-macs
}
caldata_die() {
echo "caldata: " "$*"
exit 1
@@ -98,7 +107,8 @@ case "$FIRMWARE" in
wallys,dr6018-v4|\
qcom,ipq6018-cp01|\
xiaomi,ax1800|\
glinet,ax1800)
glinet,ax1800|\
plasmacloud,pax1800-v2)
caldata_extract "0:ART" 0x1000 0x20000
;;
esac
@@ -165,6 +175,9 @@ ath11k-macs)
cig,wf194c)
ath11k_generate_macs_wf194
;;
plasmacloud,pax1800-v2)
ath11k_generate_macs_pax1800
;;
esac
;;
*)

View File

@@ -0,0 +1,103 @@
# The U-Boot loader with the datachk patchset for dualbooting requires image
# sizes and checksums to be provided in the U-Boot environment.
# The devices come with 2 main partitions - while one is active
# sysupgrade will flash the other. The boot order is changed to boot the
# newly flashed partition. If the new partition can't be booted due to
# upgrade failures the previously used partition is loaded.
platform_do_upgrade_dualboot_datachk() {
local tar_file="$1"
local restore_backup
local primary_kernel_mtd
local setenv_script="/tmp/fw_env_upgrade"
local kernel_mtd="$(find_mtd_index $PART_NAME)"
local kernel_offset="$(cat /sys/class/mtd/mtd${kernel_mtd}/offset)"
local total_size="$(cat /sys/class/mtd/mtd${kernel_mtd}/size)"
# detect to which flash region the new image is written to.
#
# 1. check what is the mtd index for the first flash region on this
# device
# 2. check if the target partition ("inactive") has the mtd index of
# the first flash region
#
# - when it is: the new bootseq will be 1,2 and the first region is
# modified
# - when it isnt: bootseq will be 2,1 and the second region is
# modified
#
# The detection has to be done via the hardcoded mtd partition because
# the current boot might be done with the fallback region. Let us
# assume that the current bootseq is 1,2. The bootloader detected that
# the image in flash region 1 is corrupt and thus switches to flash
# region 2. The bootseq in the u-boot-env is now still the same and
# the sysupgrade code can now only rely on the actual mtd indexes and
# not the bootseq variable to detect the currently booted flash
# region/image.
#
# In the above example, an implementation which uses bootseq ("1,2") to
# detect the currently booted image would assume that region 1 is booted
# and then overwrite the variables for the wrong flash region (aka the
# one which isn't modified). This could result in a device which doesn't
# boot anymore to Linux until it was reflashed with ap51-flash.
local next_boot_part="1"
case "$(board_name)" in
plasmacloud,pax1800-v2)
primary_kernel_mtd=9
;;
*)
echo "failed to detect primary kernel mtd partition for board"
return 1
;;
esac
[ "$kernel_mtd" = "$primary_kernel_mtd" ] || next_boot_part="2"
local board_dir=$(tar tf $tar_file | grep -m 1 '^sysupgrade-.*/$')
board_dir=${board_dir%/}
local kernel_length=$(tar xf $tar_file ${board_dir}/kernel -O | wc -c)
local rootfs_length=$(tar xf $tar_file ${board_dir}/root -O | wc -c)
# rootfs without EOF marker
rootfs_length=$((rootfs_length-4))
local kernel_md5=$(tar xf $tar_file ${board_dir}/kernel -O | md5sum); kernel_md5="${kernel_md5%% *}"
# md5 checksum of rootfs with EOF marker
local rootfs_md5=$(tar xf $tar_file ${board_dir}/root -O | dd bs=1 count=$rootfs_length | md5sum); rootfs_md5="${rootfs_md5%% *}"
#
# add tar support to get_image() to use default_do_upgrade() instead?
#
# take care of restoring a saved config
[ -n "$UPGRADE_BACKUP" ] && restore_backup="${MTD_CONFIG_ARGS} -j ${UPGRADE_BACKUP}"
mtd -q erase inactive
tar xf $tar_file ${board_dir}/root -O | mtd -n -p $kernel_length $restore_backup write - $PART_NAME
tar xf $tar_file ${board_dir}/kernel -O | mtd -n write - $PART_NAME
# prepare new u-boot env
if [ "$next_boot_part" = "1" ]; then
echo "bootseq 1,2" > $setenv_script
else
echo "bootseq 2,1" > $setenv_script
fi
printf "kernel_size_%i 0x%08x\n" $next_boot_part $kernel_length >> $setenv_script
printf "vmlinux_start_addr 0x%08x\n" ${kernel_offset} >> $setenv_script
printf "vmlinux_size 0x%08x\n" ${kernel_length} >> $setenv_script
printf "vmlinux_checksum %s\n" ${kernel_md5} >> $setenv_script
printf "rootfs_size_%i 0x%08x\n" $next_boot_part $((total_size-kernel_length)) >> $setenv_script
printf "rootfs_start_addr 0x%08x\n" $((kernel_offset+kernel_length)) >> $setenv_script
printf "rootfs_size 0x%08x\n" ${rootfs_length} >> $setenv_script
printf "rootfs_checksum %s\n" ${rootfs_md5} >> $setenv_script
# store u-boot env changes
mkdir -p /var/lock
fw_setenv -s $setenv_script || {
echo "failed to update U-Boot environment"
return 1
}
}

View File

@@ -1,6 +1,7 @@
. /lib/functions/system.sh
RAMFS_COPY_BIN='fw_printenv fw_setenv'
RAMFS_COPY_BIN='fw_setenv'
RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'
qca_do_upgrade() {
@@ -83,6 +84,7 @@ platform_check_image() {
edgecore,eap106|\
hfcl,ion4xi|\
hfcl,ion4xe|\
plasmacloud,pax1800-v2|\
tplink,ex227|\
tplink,ex447|\
yuncore,ax840|\
@@ -160,5 +162,9 @@ platform_do_upgrade() {
fi
nand_upgrade_tar "$1"
;;
plasmacloud,pax1800-v2)
PART_NAME="inactive"
platform_do_upgrade_dualboot_datachk "$1"
;;
esac
}

View File

@@ -0,0 +1,18 @@
/*
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "../../../arm64/boot/dts/qcom/qcom-ipq6018-pax1800-v2.dts"
#include "qcom-ipq6018.dtsi"

View File

@@ -0,0 +1,318 @@
/dts-v1/;
/*
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "qcom-ipq6018.dtsi"
#include "qcom-ipq6018-rpm-regulator.dtsi"
#include "qcom-ipq6018-cpr-regulator.dtsi"
#include "qcom-ipq6018-cp-cpu.dtsi"
#include <dt-bindings/input/input.h>
/ {
#address-cells = <0x2>;
#size-cells = <0x2>;
model = "Plasma Cloud PAX1800 v2";
compatible = "plasmacloud,pax1800-v2", "qcom,ipq6018-cp03", "qcom,ipq6018";
interrupt-parent = <&intc>;
qcom,msm-id = <0x1A5 0x0>;
chosen {
bootargs = "console=ttyMSM0,115200,n8 rw init=/init";
bootargs-append = " swiotlb=1 coherent_pool=2M";
};
aliases {
serial0 = &blsp1_uart3;
/*
* Aliases as required by u-boot
* to patch MAC addresses
*/
ethernet0 = "/soc/dp1";
ethernet1 = "/soc/dp2";
led-boot = &led_status_green;
led-failsafe = &led_status_green;
led-running = &led_status_green;
led-upgrade = &led_status_green;
led-uplink = &led_status_blue;
};
gpio_keys {
compatible = "gpio-keys";
pinctrl-0 = <&button_pins>;
pinctrl-names = "default";
reset {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&tlmm 24 GPIO_ACTIVE_LOW>;
linux,input-type = <1>;
debounce-interval = <60>;
};
};
leds {
compatible = "gpio-leds";
pinctrl-0 = <&leds_pins>;
pinctrl-names = "default";
status_red {
label = "red:status";
gpios = <&tlmm 25 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "default-off";
};
led_status_green: status_green {
label = "green:status";
gpios = <&tlmm 35 GPIO_ACTIVE_HIGH>;
};
led_status_blue: status_blue {
label = "blue:status";
gpios = <&tlmm 37 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "default-off";
};
};
watchdog {
compatible = "linux,wdt-gpio";
pinctrl-0 = <&watchdog_pins>;
pinctrl-names = "default";
gpios = <&tlmm 67 GPIO_ACTIVE_LOW>;
hw_algo = "toggle";
hw_margin_ms = <2000>;
always-running;
};
/*
* +=========+==============+========================+
* | | | |
* | Region | Start Offset | Size |
* | | | |
* +--------+--------------+-------------------------+
* | | | |
* | | | |
* | | | |
* | | | |
* | Linux | 0x41000000 | 139MB |
* | | | |
* | | | |
* | | | |
* +--------+--------------+-------------------------+
* | TZ App | 0x49B00000 | 6MB |
* +--------+--------------+-------------------------+
*
* From the available 145 MB for Linux in the first 256 MB,
* we are reserving 6 MB for TZAPP.
*
* Refer arch/arm64/boot/dts/qcom/qcom-ipq6018-memory.dtsi
* for memory layout.
*/
/* TZAPP is enabled only in default memory profile */
#if !defined(__IPQ_MEM_PROFILE_256_MB__) && !defined(__IPQ_MEM_PROFILE_512_MB__)
reserved-memory {
tzapp:tzapp@49B00000 { /* TZAPPS */
no-map;
reg = <0x0 0x49B00000 0x0 0x00600000>;
};
};
#endif
};
&tlmm {
uart_pins: uart_pins {
mux {
pins = "gpio44", "gpio45";
function = "blsp2_uart";
drive-strength = <8>;
bias-pull-down;
};
};
spi_0_pins: spi_0_pins {
mux {
pins = "gpio38", "gpio39", "gpio40", "gpio41";
function = "blsp0_spi";
drive-strength = <8>;
bias-pull-down;
};
};
button_pins: button_pins {
reset_button {
pins = "gpio24";
function = "gpio";
drive-strength = <8>;
bias-pull-up;
};
};
mdio_pins: mdio_pinmux {
mux_0 {
pins = "gpio64";
function = "mdc";
drive-strength = <8>;
bias-pull-up;
};
mux_1 {
pins = "gpio65";
function = "mdio";
drive-strength = <8>;
bias-pull-up;
};
mux_2 {
pins = "gpio75";
function = "gpio";
bias-pull-up;
};
};
leds_pins: led_pinmux {
led_power_green {
pins = "gpio25";
function = "gpio";
drive-strength = <8>;
bias-pull-down;
};
led_power_blue {
pins = "gpio35";
function = "gpio";
drive-strength = <8>;
bias-pull-down;
};
led_power_red {
pins = "gpio37";
function = "gpio";
drive-strength = <8>;
bias-pull-down;
};
};
watchdog_pins: watchdog_pinmux {
mux {
pins = "gpio67";
function = "gpio";
bias-none;
output-low;
};
};
};
&soc {
mdio@90000 {
pinctrl-0 = <&mdio_pins>;
pinctrl-names = "default";
phy-reset-gpio = <&tlmm 75 0>;
status = "ok";
phy0: ethernet-phy@0 {
reg = <3>;
};
phy1: ethernet-phy@1 {
reg = <4>;
};
};
ess-switch@3a000000 {
switch_cpu_bmp = <0x1>; /* cpu port bitmap */
switch_lan_bmp = <0x08>; /* lan port bitmap */
switch_wan_bmp = <0x10>; /* wan port bitmap */
switch_inner_bmp = <0xc0>; /*inner port bitmap*/
switch_mac_mode = <0x0>; /* mac mode for uniphy instance0*/
switch_mac_mode1 = <0xff>; /* mac mode for uniphy instance1*/
switch_mac_mode2 = <0xff>; /* mac mode for uniphy instance2*/
qcom,port_phyinfo {
port@3 {
port_id = <3>;
phy_address = <4>;
};
port@4 {
port_id = <4>;
phy_address = <3>;
};
};
};
dp1 {
device_type = "network";
compatible = "qcom,nss-dp";
qcom,id = <3>;
reg = <0x3a001400 0x200>;
qcom,mactype = <0>;
local-mac-address = [000000000000];
qcom,link-poll = <1>;
qcom,phy-mdio-addr = <4>;
phy-mode = "sgmii";
};
dp2 {
device_type = "network";
compatible = "qcom,nss-dp";
qcom,id = <4>;
reg = <0x3a001600 0x200>;
qcom,mactype = <0>;
local-mac-address = [000000000000];
qcom,link-poll = <1>;
qcom,phy-mdio-addr = <3>;
phy-mode = "sgmii";
};
};
&blsp1_uart3 {
pinctrl-0 = <&uart_pins>;
pinctrl-names = "default";
status = "ok";
};
&spi_0 {
pinctrl-0 = <&spi_0_pins>;
pinctrl-names = "default";
cs-select = <0>;
status = "ok";
m25p80@0 {
#address-cells = <1>;
#size-cells = <1>;
reg = <0>;
compatible = "n25q128a11";
linux,modalias = "m25p80", "n25q128a11";
spi-max-frequency = <50000000>;
use-default-sizes;
};
};
&qpic_bam {
status = "ok";
};
&nss_crypto {
status = "ok";
};
/* TZAPP is enabled in default memory profile only */
#if !defined(__IPQ_MEM_PROFILE_256_MB__) && !defined(__IPQ_MEM_PROFILE_512_MB__)
&qseecom {
mem-start = <0x49B00000>;
mem-size = <0x600000>;
status = "ok";
};
#endif
&wifi0 {
status = "okay";
qcom,ath11k-calibration-variant = "PlasmaCloud-PAX1800";
};

View File

@@ -1,5 +1,7 @@
KERNEL_LOADADDR := 0x41008000
DEVICE_VARS += CE_TYPE
define Device/cig_wf188n
DEVICE_TITLE := Cigtech WF-188n
DEVICE_DTS := qcom-ipq6018-cig-wf188n
@@ -88,3 +90,24 @@ define Device/yuncore_ax840
DEVICE_PACKAGES := ath11k-wifi-yuncore-ax840 uboot-env
endef
TARGET_DEVICES += yuncore_ax840
define Device/plasmacloud_common_64k
DEVICE_PACKAGES := uboot-envtools
CE_TYPE :=
BLOCKSIZE := 64k
IMAGES := sysupgrade.tar factory.bin
IMAGE/factory.bin := append-rootfs | pad-rootfs | openmesh-image ce_type=$$$$(CE_TYPE)
IMAGE/sysupgrade.tar := append-rootfs | pad-rootfs | sysupgrade-tar rootfs=$$$$@ | append-metadata
KERNEL += | pad-to $$(BLOCKSIZE)
endef
define Device/plasmacloud_pax1800-v2
$(Device/plasmacloud_common_64k)
DEVICE_TITLE := Plasma Cloud PAX1800 v2
DEVICE_DTS := qcom-ipq6018-pax1800-v2
SUPPORTED_DEVICES := plasmacloud,pax1800-v2
DEVICE_DTS_CONFIG := config@plasmacloud.pax1800v2
CE_TYPE := PAX1800v2
DEVICE_PACKAGES += ath11k-wifi-plasmacloud-pax1800
endef
TARGET_DEVICES += plasmacloud_pax1800-v2

View File

@@ -36,6 +36,7 @@ ALLWIFIBOARDS:= \
sercomm-wallaby \
edgecore-eap102 \
edgecore-eap104 \
plasmacloud-pax1800 \
wallys-dr6018 \
wallys-dr6018-v4 \
tplink-ex227 \
@@ -97,6 +98,11 @@ $(call Package/ath11k-wifi-default)
TITLE:=motorola q14 bdf
endef
define Package/ath11k-wifi-plasmacloud-pax1800
$(call Package/ath11k-wifi-default)
TITLE:=plasmacloud-pax1800(-v2) bdf
endef
define ath11k-wifi-install-one-to
$(INSTALL_DIR) $(2)/lib/firmware/$(3)/
$(INSTALL_DATA) $(1) $(2)/lib/firmware/$(3)/board.bin
@@ -196,6 +202,11 @@ define Package/ath11k-wifi-motorola-q14/install
$(INSTALL_DATA) ./board-2-motorol-q14.bin.QCN6122 $(1)/lib/firmware/ath11k/qcn6122/hw1.0/board-2.bin
endef
define Package/ath11k-wifi-plasmacloud-pax1800/install
$(INSTALL_DIR) $(1)/lib/firmware/ath11k/IPQ6018/hw1.0/
$(INSTALL_DATA) ./board-plasmacloud-pax1800.bin.IPQ6018 $(1)/lib/firmware/ath11k/IPQ6018/hw1.0/board-2.bin
endef
$(eval $(call generate-ath11k-wifi-package,cig-wf188,Cigtech WF188))
$(eval $(call generate-ath11k-wifi-package,cig-wf188n,Cigtech WF188n))
$(eval $(call generate-ath11k-wifi-package,cig-wf194c,Cigtech WF194c))

View File

@@ -0,0 +1,23 @@
From: Sven Eckelmann <sven@narfation.org>
Date: Mon, 14 Mar 2022 15:23:40 +0100
Subject: om-fwupgradecfg-gen: Add support for Plasma Cloud PAX1800 v2
Signed-off-by: Sven Eckelmann <sven@narfation.org>
diff --git a/scripts/om-fwupgradecfg-gen.sh b/scripts/om-fwupgradecfg-gen.sh
index bf7c047c5ba8e78ad4e43fa7edff2bb4bb3f4388..61617a0b772e1661a46f559380ffaf0b021c524d 100755
--- a/scripts/om-fwupgradecfg-gen.sh
+++ b/scripts/om-fwupgradecfg-gen.sh
@@ -45,6 +45,12 @@ case $CE_TYPE in
SIZE_FACTOR=1024
SIZE_FORMAT="0x%08x"
;;
+ PAX1800v2)
+ MAX_PART_SIZE=28672
+ KERNEL_FLASH_ADDR=0x3a0000
+ SIZE_FACTOR=1024
+ SIZE_FORMAT="0x%08x"
+ ;;
*)
echo "Error - unsupported ce type: $CE_TYPE"
exit 1

View File

@@ -0,0 +1,13 @@
profile: plasmacloud_pax1800-v2
target: ipq807x
subtarget: ipq60xx
description: Build image for the Plasma Cloud PAX1800 v2
image: bin/targets/ipq807x/ipq60xx/openwrt-ipq807x-plasmacloud_pax1800-v2-squashfs-sysupgrade.tar
feeds:
- name: ipq807x
path: ../../feeds/ipq807x
include:
- wifi-ax
- ucentral-ap-light
diffconfig: |
CONFIG_KERNEL_IPQ_MEM_PROFILE=512