ipq50xx: add redmi ax3000
Some checks failed
Build Kernel / Build all affected Kernels (push) Waiting to run
Build all core packages / Build all core packages for selected target (push) Waiting to run
Coverity scan build / Coverity x86/64 build (push) Has been cancelled

This commit is contained in:
breeze303 2024-10-25 15:46:41 +08:00
parent 34922242db
commit 447f9fe6ee
13 changed files with 581 additions and 17 deletions

View File

@ -8,6 +8,8 @@ touch /etc/config/ubootenv
board=$(board_name)
case "$board" in
redmi,ax3000|\
linksys,mx2000|\
linksys,mx5500)
idx="$(find_mtd_index u_env)"

View File

@ -38,10 +38,10 @@ ALLWIFIBOARDS:= \
edgecore_eap102 \
edimax_cax1800 \
gl-b3000 \
linksys_mx2000 \
linksys_mx2000 \
linksys_mx4200 \
linksys_mx5300 \
linksys_mx5500 \
linksys_mx5500 \
linksys_mx8500 \
linksys_whw03 \
netgear_lbr20 \
@ -52,6 +52,7 @@ ALLWIFIBOARDS:= \
netgear_wax620 \
netgear_wax630 \
prpl_haze \
redmi_ax3000 \
qnap_301w \
redmi_ax6 \
skspruce_wia3300-20 \
@ -186,6 +187,7 @@ $(eval $(call generate-ipq-wifi-package,netgear_wax218,Netgear WAX218))
$(eval $(call generate-ipq-wifi-package,netgear_wax620,Netgear WAX620))
$(eval $(call generate-ipq-wifi-package,netgear_wax630,Netgear WAX630))
$(eval $(call generate-ipq-wifi-package,qnap_301w,QNAP 301w))
$(eval $(call generate-ipq-wifi-package,redmi_ax3000,Redmi AX3000))
$(eval $(call generate-ipq-wifi-package,prpl_haze,prpl Haze))
$(eval $(call generate-ipq-wifi-package,redmi_ax6,Redmi AX6))
$(eval $(call generate-ipq-wifi-package,skspruce_wia3300-20,SKSpruce WIA3300-20))

View File

@ -38,9 +38,17 @@ EXTRA_CFLAGS+= \
-I$(STAGING_DIR)/usr/include/qca-ssdk
NSS_DP_HAL_DIR:=$(PKG_BUILD_DIR)/hal
define Build/Configure
$(CP) $(NSS_DP_HAL_DIR)/soc_ops/$(CONFIG_TARGET_SUBTARGET)/nss_$(CONFIG_TARGET_SUBTARGET).h \
$(PKG_BUILD_DIR)/exports/nss_dp_arch.h
ifeq ($(CONFIG_TARGET_SUBTARGET),ipq50xx_32)
COPY_FILE=$(NSS_DP_HAL_DIR)/soc_ops/ipq50xx/nss_ipq50xx.h
else
COPY_FILE=$(NSS_DP_HAL_DIR)/soc_ops/$(CONFIG_TARGET_SUBTARGET)/nss_$(CONFIG_TARGET_SUBTARGET).h
endif
$(CP) $$COPY_FILE $(PKG_BUILD_DIR)/exports/nss_dp_arch.h
endef
endef
define Build/Compile

View File

@ -0,0 +1,503 @@
// SPDX-License-Identifier: (GPL-2.0+)
/dts-v1/;
#include "ipq5018.dtsi"
#include "ipq5018-ess.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
/ {
model = "Redmi AX3000";
compatible = "redmi,ax3000", "qcom,ipq5018";
aliases {
serial0 = &blsp1_uart1;
ethernet0 = &dp1;
ethernet1 = &dp2;
led-boot = &led_system_blue;
led-failsafe = &led_system_yellow;
led-running = &led_system_blue;
led-upgrade = &led_system_yellow;
};
chosen {
// Override the root parameter from u-boot
// Increase coherent_pool size for WiFi
bootargs-append = " root=/dev/ubiblock0_1 coherent_pool=2M";
stdout-path = "serial0:115200n8";
};
reserved-memory {
// Not sure why but without this, WiFi will crash
tz_apps@4a400000 {
no-map;
// The size is incorrent, but it works
reg = <0x0 0x4a400000 0x0 0x700000>;
};
q6_mem_regions: q6_mem_regions@4b000000 {
no-map;
// reg = <0x0 0x4b000000 0x0 0x3b00000>;
reg = <0x0 0x4b000000 0x0 0x3000000>;
};
};
};
&tlmm {
blsp_uart0_pins: blsp_uart0_pins {
pins =
"gpio28", /* RX */
"gpio29"; /* TX */
function = "blsp0_uart1";
drive-strength = <8>;
bias-disable;
};
qspi_nand_pins: qspi_nand_pins {
clock {
pins = "gpio9";
function = "qspi_clk";
drive-strength = <8>;
bias-disable;
};
cs {
pins = "gpio8";
function = "qspi_cs";
drive-strength = <8>;
bias-disable;
};
data {
pins = "gpio4", "gpio5", "gpio6", "gpio7";
function = "qspi_data";
drive-strength = <8>;
bias-disable;
};
};
mdio1_pins: mdio1_pins {
mdc {
pins = "gpio36";
function = "mdc";
drive-strength = <8>;
bias-pull-up;
};
mdio {
pins = "gpio37";
function = "mdio";
drive-strength = <8>;
bias-pull-up;
};
};
leds_pins: leds_pins {
led_system_blue {
pins = "gpio19";
function = "gpio";
drive-strength = <8>;
bias-pull-down;
};
led_system_yellow {
pins = "gpio17";
function = "gpio";
drive-strength = <8>;
bias-pull-down;
};
led_internet_blue {
pins = "gpio22";
function = "gpio";
drive-strength = <8>;
bias-pull-down;
};
led_internet_yellow {
pins = "gpio20";
function = "gpio";
drive-strength = <8>;
bias-pull-down;
};
};
button_pins: button_pins {
button_reset {
pins = "gpio25";
function = "gpio";
drive-strength = <8>;
bias-pull-up;
};
button_mesh {
pins = "gpio23";
function = "gpio";
drive-strength = <8>;
bias-pull-up;
};
};
};
&blsp1_uart1 {
pinctrl-0 = <&blsp_uart0_pins>;
pinctrl-names = "default";
status = "okay";
};
&qpic_bam {
status = "okay";
};
&qpic_nand {
pinctrl-0 = <&qspi_nand_pins>;
pinctrl-names = "default";
status = "okay";
};
&soc {
leds {
compatible = "gpio-leds";
pinctrl-0 = <&leds_pins>;
pinctrl-names = "default";
led_system_blue: led_system_blue {
label = "blue:system";
gpio = <&tlmm 19 GPIO_ACTIVE_HIGH>;
default-state = "on";
};
led_system_yellow: led_system_yellow {
label = "yellow:system";
gpio = <&tlmm 17 GPIO_ACTIVE_HIGH>;
};
led_internet_blue: led_internet_blue {
label = "blue:internet";
gpio = <&tlmm 22 GPIO_ACTIVE_HIGH>;
};
led_internet_yellow: led_internet_yellow {
label = "yellow:internet";
gpio = <&tlmm 20 GPIO_ACTIVE_HIGH>;
};
};
button {
compatible = "gpio-keys";
pinctrl-0 = <&button_pins>;
pinctrl-names = "default";
button_reset {
label = "reset";
gpios = <&tlmm 25 GPIO_ACTIVE_LOW>;
linux,input-type = <EV_KEY>;
linux,code = <KEY_RESTART>;
debounce-interval = <60>;
};
button_mesh {
label = "mesh";
gpios = <&tlmm 23 GPIO_ACTIVE_LOW>;
linux,input-type = <EV_KEY>;
linux,code = <KEY_WPS_BUTTON>;
debounce-interval = <60>;
};
};
};
&switch {
status = "okay";
// mdio-bus = <&mdio0>;
// switch_cpu_bmp = <ESS_PORT0>;
// switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2)>;
switch_mac_mode = <MAC_MODE_SGMII_CHANNEL0>;
qcom,port_phyinfo {
// MAC0 -> GE Phy -> QCA8337 Phy4
port@0 {
port_id = <1>;
mdiobus = <&mdio0>;
phy_address = <7>;
phy_dac = <0x10 0x10>;
// status = "disabled";
};
// MAC1 ---SGMII---> QCA8337 SerDes
port@1 {
port_id = <2>;
forced-speed = <1000>;
forced-duplex = <1>;
};
};
};
// MAC0 -> GE Phy
&dp1 {
/*
* ===============================================================
* _______________________ _______________________
* | IPQ5018 | | QCA8337 |
* | +------+ +--------+ | | +--------+ +------+ |
* | | MAC0 |---| GE Phy |-+--UTP--+-| Phy4 |---| MAC5 | |
* | +------+ +--------+ | | +--------+ +------+ |
* | +------+ +--------+ | | +--------+ +------+ |
* | | MAC1 |---| Uniphy |-+-SGMII-+-| SerDes |---| MAC0 | |
* | +------+ +--------+ | | +--------+ +------+ |
* |_______________________| |_______________________|
*
* ===============================================================
*
* Current drivers don't support such topology. So dp1 and ge_phy
* are useless. But they can't be disabled dut to qca-ssdk use
* ge_phy to detect IPQ5018 dummy switch.
*/
status = "okay";
};
// MAC1 ---SGMII---> QCA8337 SerDes
&dp2 {
status = "okay";
phy-mode = "sgmii";
fixed-link {
speed = <1000>;
full-duplex;
};
};
&mdio0 {
status = "okay";
};
// IPQ5018 GE Phy -> QCA8337 Phy4
&ge_phy {
status = "okay";
};
&mdio1 {
pinctrl-0 = <&mdio1_pins>;
pinctrl-names = "default";
status = "okay";
reset-gpios = <&tlmm 26 GPIO_ACTIVE_LOW>;
// QCA8337 Phy0 -> LAN1
qca8337_0: ethernet-phy@0 {
reg = <0>;
};
// QCA8337 Phy1 -> LAN2
qca8337_1: ethernet-phy@1 {
reg = <1>;
};
// QCA8337 Phy2 -> LAN3
qca8337_2: ethernet-phy@2 {
reg = <2>;
};
// QCA8337 Phy3 -> WAN
qca8337_3: ethernet-phy@3 {
reg = <3>;
};
// QCA8337 Phy4 -> IPQ5018 GE Phy
qca8337_4: ethernet-phy@4 {
reg = <4>;
status = "disabled";
};
switch0: ethernet-switch@17 {
compatible = "qca,qca8337";
reg = <17>;
ports {
#address-cells = <1>;
#size-cells = <0>;
switch0cpu: port@0 {
reg = <0>;
label = "cpu";
phy-mode = "sgmii";
ethernet = <&dp2>;
qca,sgmii-enable-pll;
fixed-link {
speed = <1000>;
full-duplex;
};
};
port@1 {
reg = <1>;
label = "lan1";
phy-handle = <&qca8337_0>;
};
port@2 {
reg = <2>;
label = "lan2";
phy-handle = <&qca8337_1>;
};
port@3 {
reg = <3>;
label = "lan3";
phy-handle = <&qca8337_2>;
};
port@4 {
reg = <4>;
label = "wan";
phy-handle = <&qca8337_3>;
};
port@5 {
reg = <5>;
label = "cpu2";
phy-handle = <&qca8337_4>;
status = "disabled";
};
};
};
};
&q6v5_wcss {
memory-region = <&q6_mem_regions>;
firmware-name = "IPQ5018/q6_fw.mdt",
"IPQ5018/m3_fw.mdt",
"qcn6122/m3_fw.mdt";
qcom,bootargs_smem = <507>;
boot-args = </* type: */ 0x2 /* PCIE1 */
/* length: */ 4
/* PD id: */ 2
/* reset GPIO: */ 27
/* reserved: */ 0 0>;
status = "okay";
// IPQ5018
q6_wcss_pd1: pd-1 {
resets =
<&gcc GCC_WCSSAON_RESET>,
<&gcc GCC_WCSS_BCR>,
<&gcc GCC_CE_BCR>;
reset-names =
"wcss_aon_reset",
"wcss_reset",
"ce_reset";
clocks =
<&gcc GCC_WCSS_AHB_S_CLK>,
<&gcc GCC_WCSS_ACMT_CLK>,
<&gcc GCC_WCSS_AXI_M_CLK>;
clock-names =
"gcc_wcss_ahb_s_clk",
"gcc_wcss_acmt_clk",
"gcc_wcss_axi_m_clk";
reg = <0x4ab000 0x20>;
reg-names = "rmb";
// qcom,halt-regs = <&tcsr_q6_block 0xa000 0xd000 0x0>;
interrupts-extended =
<&wcss_smp2p_in 8 0>,
<&wcss_smp2p_in 9 0>,
<&wcss_smp2p_in 12 0>,
<&wcss_smp2p_in 11 0>;
interrupt-names =
"fatal",
"ready",
"spawn-ack",
"stop-ack";
qcom,smem-states =
<&wcss_smp2p_out 8>,
<&wcss_smp2p_out 9>,
<&wcss_smp2p_out 10>;
qcom,smem-state-names =
"shutdown",
"stop",
"spawn";
firmware-name = "IPQ5018/q6_fw.mdt";
// m3_firmware = "IPQ5018/m3_fw.mdt";
};
// QCN6102
q6_wcss_pd2: pd-2 {
interrupts-extended =
<&wcss_smp2p_in 16 0>,
<&wcss_smp2p_in 17 0>,
<&wcss_smp2p_in 20 0>,
<&wcss_smp2p_in 19 0>;
interrupt-names =
"fatal",
"ready",
"spawn-ack",
"stop-ack";
qcom,smem-states =
<&wcss_smp2p_out 16>,
<&wcss_smp2p_out 17>,
<&wcss_smp2p_out 18>;
qcom,smem-state-names =
"shutdown",
"stop",
"spawn";
firmware-name = "IPQ5018/q6_fw.mdt";
// m3_firmware = "qcn6122/m3_fw.mdt";
};
};
&wifi0 {
// IPQ5000
qcom,multipd_arch;
qcom,rproc = <&q6_wcss_pd1>;
qcom,userpd-subsys-name = "q6v5_wcss_userpd1";
// Be overridden by /etc/hotplug.d/firmware/10-ath11k-board_id
// M79: 0x10
// M81: 0x24
qcom,board_id = <0x24>;
// qcom,ath11k-fw-memory-mode = <0>;
// qcom,bdf-addr = <0x4c400000>;
// qcom,caldb-addr = <0x4d200000>;
// qcom,m3-dump-addr = <0x4d400000>;
qcom,ath11k-fw-memory-mode = <2>;
qcom,bdf-addr = <0x4c400000>;
status = "okay";
};
&wifi1 {
// QCN6102
qcom,multipd_arch;
qcom,rproc = <&q6_wcss_pd2>;
qcom,userpd-subsys-name = "q6v5_wcss_userpd2";
qcom,board_id = <0x60>;
// qcom,ath11k-fw-memory-mode = <0>;
// qcom,bdf-addr = <0x4d500000>;
// qcom,caldb-addr = <0x4e500000>;
// qcom,m3-dump-addr = <0x4ea00000>;
qcom,ath11k-fw-memory-mode = <2>;
qcom,bdf-addr = <0x4d100000>;
qcom,m3-dump-addr = <0x4df00000>;
status = "okay";
};

View File

@ -1,2 +1,2 @@
#include <../../../arm64/boot/dts/qcom/ipq5018.dtsi>
#include <qcom-ipq5018.dtsi>
#include "../../../arm64/boot/dts/qcom/ipq5018.dtsi"
#include "qcom-ipq5018.dtsi"

View File

@ -1,14 +1,16 @@
KERNEL_LOADADDR := 0x41208000
define Device/glinet_gl-b3000
$(call Device/FitImage)
$(call Device/UbiFit)
SOC := ipq5000
DEVICE_VENDOR := GL.iNET
DEVICE_MODEL := GL-B3000
BLOCKSIZE := 128k
PAGESIZE := 2048
DEVICE_DTS_CONFIG := config@mp03.5-c1
UBINIZE_OPTS := -E 5
DEVICE_PACKAGES := ath11k-firmware-qcn6122 ipq-wifi-gl-b3000
$(call Device/FitImage)
$(call Device/UbiFit)
SOC := ipq5000
DEVICE_VENDOR := GL.iNET
DEVICE_MODEL := GL-B3000
BLOCKSIZE := 128k
PAGESIZE := 2048
DEVICE_DTS_CONFIG := config@mp03.5-c1
UBINIZE_OPTS := -E 5
DEVICE_PACKAGES := ath11k-firmware-qcn6122 ipq-wifi-gl-b3000
endef
TARGET_DEVICES += glinet_gl-b3000
@ -47,4 +49,25 @@ define Device/linksys_mx5500
ath11k-firmware-qcn9074 \
ipq-wifi-linksys_mx5500
endef
TARGET_DEVICES += linksys_mx5500
TARGET_DEVICES += linksys_mx5500
define Device/redmi_ax3000
$(call Device/FitImage)
$(call Device/UbiFit)
SOC := ipq5000
DEVICE_VENDOR := Redmi
DEVICE_MODEL := AX3000
DEVICE_ALT0_VENDOR := Xiaomi
DEVICE_ALT0_MODEL := CR880x
DEVICE_ALT0_VARIANT := (M81 version)
DEVICE_ALT1_VENDOR := Xiaomi
DEVICE_ALT1_MODEL := CR880x
DEVICE_ALT1_VARIANT := (M79 version)
BLOCKSIZE := 128k
PAGESIZE := 2048
DEVICE_DTS_CONFIG := config@mp02.1
DEVICE_PACKAGES := ath11k-firmware-ipq5018 \
ath11k-firmware-qcn6122 \
ipq-wifi-redmi_ax3000
endef
TARGET_DEVICES += redmi_ax3000

View File

@ -0,0 +1,19 @@
. /lib/functions/leds.sh
. /lib/functions/uci-defaults.sh
board_config_update
board=$(board_name)
case $board in
redmi,ax3000)
ucidef_set_led_switch "wan" "WAN" "blue:internet" "switch1" "$( bits 4 )"
;;
*)
;;
esac
board_config_flush
exit 0

View File

@ -7,6 +7,9 @@ ipq50xx_setup_interfaces()
{
local board="$1"
case $board in
redmi,ax3000)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan"
;;
glinet,gl-b3000)
ucidef_set_interfaces_lan_wan "lan1 lan2" "wan"
;;

View File

@ -17,6 +17,7 @@ case "$FIRMWARE" in
ath11k_remove_regdomain
ath11k_set_macflag
;;
redmi,ax3000|\
glinet,gl-b3000)
caldata_extract "0:ART" 0x1000 0x20000
;;
@ -31,6 +32,7 @@ case "$FIRMWARE" in
ath11k_remove_regdomain
ath11k_set_macflag
;;
redmi,ax3000|\
glinet,gl-b3000)
caldata_extract "0:ART" 0x26800 0x20000
;;

View File

@ -10,6 +10,7 @@ platform_check_image() {
platform_do_upgrade() {
case "$(board_name)" in
redmi,ax3000|\
glinet,gl-b3000)
nand_do_upgrade "$1"
;;

View File

@ -3,6 +3,7 @@ CONFIG_ALIGNMENT_TRAP=y
# CONFIG_APQ_MMCC_8084 is not set
CONFIG_ARCH_32BIT_OFF_T=y
# CONFIG_ARCH_IPQ40XX is not set
CONFIG_ARCH_IPQ50XX=y
# CONFIG_ARCH_MDM9615 is not set
CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
CONFIG_ARCH_MMAP_RND_BITS=8