From 44168fda7800dfdd28c8d51fa92b4863f4fd6ea9 Mon Sep 17 00:00:00 2001 From: Mantas Pucka Date: Mon, 22 Jan 2024 11:28:32 +0200 Subject: [PATCH] qualcommax: ipq60xx: Add 8devices Mango DVK 8devices Mango DVK is a single board computer / devkit for 8devices Mango system-on-module (SoM). Specifications: * CPU: Qualcomm IPQ6010 Quad core Cortex-A53 1.8GHz * RAM: 512 MB * Storage: * 32 MB serial NOR flash (on SoM) * 256 MB parallel NAND flash (on DVK) * Ethernet: * 2x1G RJ45 ports(QCA8072 or QCA8075) * 1x2.5G RJ45 port (QCA8081) * 1xSFP (shares SGMII with QCA8081) * Switch: Qualcomm Atheros IPQ6010 * WLAN: * 2.4GHz: QCN5121 2x2 802.11b/g/n/ax 574 Mbps PHY rate * 5GHz: QCN5152 2x2 802.11a/n/ac/ax 1201 Mbps PHY rate * USB: * 1x USB3.0 Type-A port * 1x USB2.0 available at mini PCIe slot * PCIe: 1x mini PCIe slot 1xLane Gen3 (8GT/s) * SD/eMMC (on a single shared bus - only one can be active): * micro SD slot * eMMC module connector * LEDs: * Green power led (not controllable) * Green 2.4GHz radio led (GPIO 67) * Green 5GHz radio led (GPIO 66) * Buttons: * 1x (WPS GPIO79) button * GPIOs: 2.54mm header brings out 18 GPIOs (1.8V level) * UART: 4-pin UART header (3.3V level) * 115200 8N1, 3.3V-Tx-Rx-GND (3.3V is pin 1 close to boot-switch SW2) * Power: * PoE IN on 2.5G port (passive 24-48V) * DC power terminal (12-58V) Installation instructions: Vendor image format is compatible with squashfs-sysupgrade image. Run: sysupgrade -n -F openwrt-qualcommax-ipq60xx-8devices_mango-dvk-squashfs-sysupgrade.bin Signed-off-by: Mantas Pucka --- .../uboot-envtools/files/qualcommax_ipq60xx | 22 ++ .../arm64/boot/dts/qcom/ipq6010-mango-dvk.dts | 360 ++++++++++++++++++ target/linux/qualcommax/image/ipq60xx.mk | 12 + .../ipq60xx/base-files/etc/board.d/02_network | 28 ++ .../etc/hotplug.d/firmware/11-ath11-caldata | 20 + .../base-files/lib/upgrade/platform.sh | 17 + 6 files changed, 459 insertions(+) create mode 100644 package/boot/uboot-envtools/files/qualcommax_ipq60xx create mode 100644 target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6010-mango-dvk.dts create mode 100644 target/linux/qualcommax/ipq60xx/base-files/etc/board.d/02_network create mode 100644 target/linux/qualcommax/ipq60xx/base-files/etc/hotplug.d/firmware/11-ath11-caldata create mode 100644 target/linux/qualcommax/ipq60xx/base-files/lib/upgrade/platform.sh diff --git a/package/boot/uboot-envtools/files/qualcommax_ipq60xx b/package/boot/uboot-envtools/files/qualcommax_ipq60xx new file mode 100644 index 0000000000..df19a30335 --- /dev/null +++ b/package/boot/uboot-envtools/files/qualcommax_ipq60xx @@ -0,0 +1,22 @@ +[ -e /etc/config/ubootenv ] && exit 0 + +touch /etc/config/ubootenv + +. /lib/uboot-envtools.sh +. /lib/functions.sh + +board=$(board_name) + +case "$board" in +8devices,mango-dvk|\ +8devices,mango-dvk-sfp) + idx="$(find_mtd_index 0:APPSBLENV)" + [ -n "$idx" ] && \ + ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x10000" + ;; +esac + +config_load ubootenv +config_foreach ubootenv_add_app_config + +exit 0 diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6010-mango-dvk.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6010-mango-dvk.dts new file mode 100644 index 0000000000..27247524a3 --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6010-mango-dvk.dts @@ -0,0 +1,360 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; + +#include "ipq6018.dtsi" +#include "ipq6018-cp-cpu.dtsi" +#include "ipq6018-ess.dtsi" +#include +#include +#include + +/ { + model = "8devices Mango-DVK"; + compatible = "8devices,mango-dvk", "qcom,ipq6018"; + + aliases { + serial0 = &blsp1_uart3; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + keys { + compatible = "gpio-keys"; + + wps { + label = "wps"; + gpios = <&tlmm 79 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + pinctrl-0 = <&led_pins>; + pinctrl-names = "default"; + + wlan5g { + color = ; + function = LED_FUNCTION_WLAN; + function-enumerator = <0>; + gpios = <&tlmm 66 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "phy0radio"; + }; + + wlan2g { + color = ; + function = LED_FUNCTION_WLAN; + function-enumerator = <1>; + gpios = <&tlmm 67 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "phy1radio"; + }; + }; +}; + +&tlmm { + mdio_pins: mdio-pins { + mdc { + pins = "gpio64"; + function = "mdc"; + drive-strength = <8>; + bias-pull-up; + }; + + mdio { + pins = "gpio65"; + function = "mdio"; + drive-strength = <8>; + bias-pull-up; + }; + }; + + spi_0_pins: spi-0-pins { + pins = "gpio38", "gpio39", "gpio40", "gpio41"; + function = "blsp0_spi"; + drive-strength = <8>; + bias-pull-down; + }; + + led_pins: led_pins { + leds { + pins = "gpio66", "gpio67"; + function = "gpio"; + drive-strength = <8>; + bias-pull-down; + }; + }; + + sd_pins: sd_pins { + sd_cd { + pins = "gpio62"; + function = "gpio"; + drive-strength = <8>; + bias-pull-up; + }; + }; +}; + +&blsp1_uart3 { + pinctrl-0 = <&serial_3_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +&blsp1_spi1 { + pinctrl-0 = <&spi_0_pins>; + pinctrl-names = "default"; + status = "okay"; + + flash@0 { + #address-cells = <1>; + #size-cells = <1>; + reg = <0>; + compatible = "jedec,spi-nor"; + spi-max-frequency = <25000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "0:SBL1"; + reg = <0x00000000 0x000c0000>; + }; + + partition@c0000 { + label = "0:MIBIB"; + reg = <0x000c0000 0x00010000>; + }; + + partition@d0000 { + label = "0:QSEE"; + reg = <0x000d0000 0x001a0000>; + }; + + partition@270000 { + label = "0:DEVCFG"; + reg = <0x00270000 0x00010000>; + }; + + partition@280000 { + label = "0:RPM"; + reg = <0x00280000 0x00020000>; + }; + + partition@2a0000 { + label = "0:CDT"; + reg = <0x002a0000 0x00010000>; + }; + + partition@2b0000 { + label = "0:APPSBLENV"; + reg = <0x002b0000 0x00010000>; + }; + + partition@2c0000 { + label = "0:APPSBL"; + reg = <0x002c0000 0x000a0000>; + }; + + partition@360000 { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + label = "0:ART"; + reg = <0x00360000 0x00040000>; + + macaddr_eth0: macaddr@0 { + reg = <0x0 0x6>; + }; + + macaddr_eth1: macaddr@6 { + reg = <0x6 0x6>; + }; + + macaddr_eth2: macaddr@c { + reg = <0xc 0x6>; + }; + }; + + partition@3a0000 { + label = "config"; + reg = <0x003a0000 0x00040000>; + }; + + partition@3e0000 { + label = "data"; + reg = <0x003e0000 0x00100000>; + }; + + partition@4e0000 { + label = "firmware"; + compatible = "denx,fit"; + reg = <0x004e0000 0x1b20000>; + }; + }; + }; +}; + +&dp3 { + status = "okay"; + + phy-handle = <&qca8072_1>; + nvmem-cells = <&macaddr_eth1>; + nvmem-cell-names = "mac-address"; + label = "lan2"; +}; + +&dp4 { + status = "okay"; + + phy-handle = <&qca8072_0>; + nvmem-cells = <&macaddr_eth0>; + nvmem-cell-names = "mac-address"; + label = "lan1"; +}; + +&dp5 { + status = "okay"; + + phy-handle = <&qca8081>; + nvmem-cells = <&macaddr_eth2>; + nvmem-cell-names = "mac-address"; + label = "wan"; +}; + +&edma { + status = "okay"; +}; + +&mdio { + status = "okay"; + pinctrl-0 = <&mdio_pins>; + pinctrl-names = "default"; + reset-gpios = <&tlmm 75 GPIO_ACTIVE_LOW>; + reset-delay-us = <10000>; + reset-post-delay-us = <50000>; + + ethernet-phy-package@0 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "qcom,qca8075-package"; + reg = <0>; + + qcom,package-mode = "psgmii"; + + qca8072_0: ethernet-phy@3 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <3>; + }; + + qca8072_1: ethernet-phy@4 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <4>; + }; + }; + + qca8081: ethernet-phy@24 { + compatible = "ethernet-phy-id004d.d101"; + reg = <24>; + reset-gpios = <&tlmm 77 GPIO_ACTIVE_LOW>; + }; +}; + +&sdhc_1 { + pinctrl-0 = <&sd_pins>; + pinctrl-names = "default"; + status = "okay"; + + vqmmc-supply = <&ipq6018_l2>; + cd-gpios = <&tlmm 62 GPIO_ACTIVE_LOW>; +}; + +&switch { + status = "okay"; + + switch_lan_bmp = <(ESS_PORT3 | ESS_PORT4)>; + switch_wan_bmp = ; + switch_mac_mode = ; + switch_mac_mode1 = ; + port3_pcs_channel = <4>; + + qcom,port_phyinfo { + port@3 { + port_id = <3>; + phy_address = <4>; + }; + port@4 { + port_id = <4>; + phy_address = <3>; + }; + port@5 { + port_id = <5>; + phy_address = <24>; + port_mac_sel = "QGMAC_PORT"; + }; + }; +}; + +&qpic_bam { + status = "okay"; +}; + +&qpic_nand { + status = "okay"; + + nand@0 { + reg = <0>; + + nand-ecc-strength = <4>; + nand-ecc-step-size = <512>; + nand-bus-width = <8>; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "nand_data"; + reg = <0x0000000 0x10000000>; + }; + }; + }; +}; + +&pcie_phy { + status = "okay"; +}; + +&pcie0 { + status = "okay"; + perst-gpio = <&tlmm 60 GPIO_ACTIVE_LOW>; +}; + +&wifi { + status = "okay"; + qcom,ath11k-calibration-variant = "8devices-Mango"; +}; + +&qusb_phy_1 { + status = "okay"; +}; + +&usb2 { + status = "okay"; +}; + +&qusb_phy_0 { + status = "okay"; +}; + +&ssphy_0 { + status = "okay"; +}; + +&usb3 { + status = "okay"; +}; diff --git a/target/linux/qualcommax/image/ipq60xx.mk b/target/linux/qualcommax/image/ipq60xx.mk index e69de29bb2..00dead93ad 100644 --- a/target/linux/qualcommax/image/ipq60xx.mk +++ b/target/linux/qualcommax/image/ipq60xx.mk @@ -0,0 +1,12 @@ +define Device/8devices_mango-dvk + $(call Device/FitImageLzma) + DEVICE_VENDOR := 8devices + DEVICE_MODEL := Mango-DVK + IMAGE_SIZE := 27776k + BLOCKSIZE := 64k + SOC := ipq6010 + SUPPORTED_DEVICES += 8devices,mango + IMAGE/sysupgrade.bin := append-kernel | pad-to 64k | append-rootfs | pad-rootfs | check-size | append-metadata + DEVICE_PACKAGES := ipq-wifi-8devices_mango +endef +TARGET_DEVICES += 8devices_mango-dvk diff --git a/target/linux/qualcommax/ipq60xx/base-files/etc/board.d/02_network b/target/linux/qualcommax/ipq60xx/base-files/etc/board.d/02_network new file mode 100644 index 0000000000..081d894e1e --- /dev/null +++ b/target/linux/qualcommax/ipq60xx/base-files/etc/board.d/02_network @@ -0,0 +1,28 @@ +# +# Copyright (c) 2015 The Linux Foundation. All rights reserved. +# Copyright (c) 2011-2015 OpenWrt.org +# + +. /lib/functions/uci-defaults.sh +. /lib/functions/system.sh + +ipq60xx_setup_interfaces() +{ + local board="$1" + + case "$board" in + 8devices,mango-dvk) + ucidef_set_interfaces_lan_wan "lan1 lan2" "wan" + ;; + *) + echo "Unsupported hardware. Network interfaces not initialized" + ;; + esac +} + +board_config_update +board=$(board_name) +ipq60xx_setup_interfaces $board +board_config_flush + +exit 0 diff --git a/target/linux/qualcommax/ipq60xx/base-files/etc/hotplug.d/firmware/11-ath11-caldata b/target/linux/qualcommax/ipq60xx/base-files/etc/hotplug.d/firmware/11-ath11-caldata new file mode 100644 index 0000000000..c14722c799 --- /dev/null +++ b/target/linux/qualcommax/ipq60xx/base-files/etc/hotplug.d/firmware/11-ath11-caldata @@ -0,0 +1,20 @@ +#!/bin/sh + +[ -e /lib/firmware/$FIRMWARE ] && exit 0 + +. /lib/functions/caldata.sh + +board=$(board_name) + +case "$FIRMWARE" in +"ath11k/IPQ6018/hw1.0/cal-ahb-c000000.wifi.bin") + case "$board" in + 8devices,mango-dvk) + caldata_extract "0:ART" 0x1000 0x20000 + ;; + esac + ;; +*) + exit 1 + ;; +esac diff --git a/target/linux/qualcommax/ipq60xx/base-files/lib/upgrade/platform.sh b/target/linux/qualcommax/ipq60xx/base-files/lib/upgrade/platform.sh new file mode 100644 index 0000000000..3d3c17b3b9 --- /dev/null +++ b/target/linux/qualcommax/ipq60xx/base-files/lib/upgrade/platform.sh @@ -0,0 +1,17 @@ +PART_NAME=firmware +REQUIRE_IMAGE_METADATA=1 + +RAMFS_COPY_BIN='fw_printenv fw_setenv head' +RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock' + +platform_check_image() { + return 0; +} + +platform_do_upgrade() { + case "$(board_name)" in + *) + default_do_upgrade "$1" + ;; + esac +} -- 2.30.2