Skip to content

Commit

Permalink
target: add ipq50xx test
Browse files Browse the repository at this point in the history
  • Loading branch information
tiffany-929 committed Jul 15, 2024
1 parent a96a848 commit ccf5705
Show file tree
Hide file tree
Showing 68 changed files with 14,464 additions and 0 deletions.
21 changes: 21 additions & 0 deletions package/boot/uboot-envtools/files/ipq50xx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh

[ -e /etc/config/ubootenv ] && exit 0

touch /etc/config/ubootenv

. /lib/uboot-envtools.sh
. /lib/functions.sh

board=$(board_name)
case "$board" in
redmi,ax3000|\
xiaomi,cr881x)
ubootenv_add_uci_config "/dev/mtd10" "0x0" "0x10000" "0x20000"
;;
esac

config_load ubootenv
config_foreach ubootenv_add_app_config ubootenv

exit 0
4 changes: 4 additions & 0 deletions package/firmware/ipq-wifi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ ALLWIFIBOARDS:= \
prpl_haze \
qnap_301w \
qihoo_v6 \
redmi_ax3000 \
redmi_ax5 \
redmi_ax5-jdcloud \
redmi_ax6 \
Expand All @@ -64,6 +65,7 @@ ALLWIFIBOARDS:= \
xiaomi_ax1800 \
xiaomi_ax3600 \
xiaomi_ax9000 \
xiaomi_cr881x \
yyets_le1 \
yuncore_ax880 \
zn_m2 \
Expand Down Expand Up @@ -191,6 +193,7 @@ $(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,prpl_haze,prpl Haze))
$(eval $(call generate-ipq-wifi-package,qihoo_v6,Qihoo V6))
$(eval $(call generate-ipq-wifi-package,redmi_ax3000,Redmi AX3000))
$(eval $(call generate-ipq-wifi-package,redmi_ax5,Redmi AX5))
$(eval $(call generate-ipq-wifi-package,redmi_ax5-jdcloud,Redmi AX5 JDCloud))
$(eval $(call generate-ipq-wifi-package,redmi_ax6,Redmi AX6))
Expand All @@ -199,6 +202,7 @@ $(eval $(call generate-ipq-wifi-package,wallys_dr40x9,Wallys DR40X9))
$(eval $(call generate-ipq-wifi-package,xiaomi_ax1800,Xiaomi AX1800))
$(eval $(call generate-ipq-wifi-package,xiaomi_ax3600,Xiaomi AX3600))
$(eval $(call generate-ipq-wifi-package,xiaomi_ax9000,Xiaomi AX9000))
$(eval $(call generate-ipq-wifi-package,xiaomi_cr881x,Xiaomi CR881x))
$(eval $(call generate-ipq-wifi-package,yyets_le1,YYeTs LE1))
$(eval $(call generate-ipq-wifi-package,yuncore_ax880,Yuncore AX880))
$(eval $(call generate-ipq-wifi-package,zn_m2,ZN M2))
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
22 changes: 22 additions & 0 deletions target/linux/ipq50xx/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
include $(TOPDIR)/rules.mk

BOARD:=ipq50xx
BOARDNAME:=Qualcomm Atheros IPQ50XX
SUBTARGETS:=arm aarch64

CPU_TYPE:=cortex-a53
FEATURES:=fpu ramdisk nand squashfs pcie

KERNEL_PATCHVER:=6.6

include $(INCLUDE_DIR)/target.mk

KERNELNAME:=Image dtbs

DEFAULT_PACKAGES += \
kmod-gpio-button-hotplug \
uboot-envtools \
kmod-qca-nss-dp swconfig \
kmod-ath11k kmod-ath11k-ahb kmod-ath11k-pci wpad-basic-wolfssl

$(eval $(call BuildTarget))
73 changes: 73 additions & 0 deletions target/linux/ipq50xx/aarch64/config-default
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# CONFIG_32BIT is not set
CONFIG_64BIT=y
# CONFIG_ACPI is not set
# CONFIG_ARCH_BCM_IPROC is not set
# CONFIG_ARCH_EXYNOS7 is not set
CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y
CONFIG_ARCH_HAS_HOLES_MEMORYMODEL=y
# CONFIG_ARCH_LAYERSCAPE is not set
CONFIG_ARCH_PHYS_ADDR_T_64BIT=y
# CONFIG_ARCH_SEATTLE is not set
CONFIG_ARCH_SELECT_MEMORY_MODEL=y
CONFIG_ARCH_SPARSEMEM_DEFAULT=y
CONFIG_ARCH_SPARSEMEM_ENABLE=y
# CONFIG_ARCH_SPRD is not set
# CONFIG_ARCH_STRATIX10 is not set
# CONFIG_ARCH_THUNDER is not set
CONFIG_ARCH_WANT_COMPAT_IPC_PARSE_VERSION=y
CONFIG_ARCH_WANT_FRAME_POINTERS=y
CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y
# CONFIG_ARCH_XGENE is not set
# CONFIG_ARCH_ZYNQMP is not set
CONFIG_ARM64=y
# CONFIG_ARM64_16K_PAGES is not set
CONFIG_ARM64_4K_PAGES=y
# CONFIG_ARM64_64K_PAGES is not set
# CONFIG_ARM64_CRYPTO is not set
# CONFIG_ARM64_ERRATUM_819472 is not set
# CONFIG_ARM64_ERRATUM_824069 is not set
# CONFIG_ARM64_ERRATUM_826319 is not set
# CONFIG_ARM64_ERRATUM_827319 is not set
# CONFIG_ARM64_ERRATUM_832075 is not set
# CONFIG_ARM64_ERRATUM_843419 is not set
# CONFIG_ARM64_ERRATUM_845719 is not set
CONFIG_ARM64_HW_AFDBM=y
# CONFIG_ARM64_LSE_ATOMICS is not set
CONFIG_ARM64_PAN=y
# CONFIG_ARM64_PTDUMP is not set
# CONFIG_ARM64_RANDOMIZE_TEXT_OFFSET is not set
CONFIG_ARM64_VA_BITS=39
CONFIG_ARM64_VA_BITS_39=y
# CONFIG_ARM64_VA_BITS_48 is not set
# CONFIG_ARMV8_DEPRECATED is not set
# CONFIG_CAVIUM_ERRATUM_22375 is not set
# CONFIG_CAVIUM_ERRATUM_23154 is not set
# CONFIG_CAVIUM_ERRATUM_27456 is not set
# CONFIG_COMMON_CLK_VERSATILE is not set
CONFIG_COMMON_CLK_XGENE=y
CONFIG_COMPAT=y
CONFIG_COMPAT_BINFMT_ELF=y
# CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set
# CONFIG_DEBUG_ALIGN_RODATA is not set
CONFIG_FRAME_WARN=2048
# CONFIG_GPIO_XGENE is not set
# CONFIG_HUGETLBFS is not set
CONFIG_IPQ_APSS_5018=y
# CONFIG_I2C_CADENCE is not set
# CONFIG_KASAN is not set
# CONFIG_KVM is not set
# CONFIG_NET_VENDOR_CAVIUM is not set
# CONFIG_PCI_HISI is not set
CONFIG_PHYS_ADDR_T_64BIT=y
# CONFIG_PHY_XGENE is not set
# CONFIG_POWER_RESET_XGENE is not set
CONFIG_QCOM_SCM_64=y
# CONFIG_RTC_DRV_EFI is not set
CONFIG_SPARSEMEM=y
CONFIG_SPARSEMEM_EXTREME=y
CONFIG_SPARSEMEM_MANUAL=y
CONFIG_SPARSEMEM_VMEMMAP=y
CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
CONFIG_VIRTUALIZATION=y

CONFIG_ZONE_DMA32=y
5 changes: 5 additions & 0 deletions target/linux/ipq50xx/aarch64/target.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
SUBTARGET:=aarch64
BOARDNAME:=AArch64 64Bit

ARCH:=aarch64
CPU_TYPE:=cortex-a53
7 changes: 7 additions & 0 deletions target/linux/ipq50xx/arm/config-default
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
CONFIG_ARCH_IPQ5018=y
CONFIG_ARCH_MMAP_RND_BITS=8
CONFIG_IPQ_APSS_5018=y
CONFIG_PCIE_DW_PLAT=y
# CONFIG_USB_QCOM_DIAG_BRIDGE is not set
CONFIG_VMSPLIT_2G=y
# CONFIG_VMSPLIT_3G is not set
6 changes: 6 additions & 0 deletions target/linux/ipq50xx/arm/target.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
SUBTARGET:=arm
BOARDNAME:=ARM 32Bit

ARCH:=arm
CPU_TYPE:=cortex-a7
CPU_SUBTYPE:=neon-vfpv4
32 changes: 32 additions & 0 deletions target/linux/ipq50xx/base-files/etc/board.d/01_leds
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/sh

. /lib/functions/uci-defaults.sh

bits() {
local val
val=0

while [ -n "$1" ]; do
val=$(( val | (1 << $1) ))
shift 1
done

printf "0x%x" "$val"
}

board_config_update

board=$(board_name)

case $board in
redmi,ax3000)
ucidef_set_led_switch "wan" "WAN" "blue:internet" "switch1" "$( bits 4 )"
;;
xiaomi,cr881x)
ucidef_set_led_switch "wan" "WAN" "blue:internet" "switch0" "$( bits 3 )"
;;
esac

board_config_flush

exit 0
29 changes: 29 additions & 0 deletions target/linux/ipq50xx/base-files/etc/board.d/02_network
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/sh

. /lib/functions/uci-defaults.sh

ipq50xx_setup_interfaces()
{
local board="$1"
case $board in
redmi,ax3000)
ucidef_add_switch "switch1" \
"6u@eth1" "5u@eth0" \
"1:lan:1" "2:lan:2" "3:lan:3" \
"4:wan"
;;
xiaomi,cr881x)
ucidef_add_switch "switch0" \
"8u@eth1" "4u@eth0" \
"0:lan:1" "1:lan:2" "2:lan:3" \
"3:wan"
;;
esac
}

board_config_update
board=$(board_name)
ipq50xx_setup_interfaces $board
board_config_flush

exit 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/sh

[ -e /lib/firmware/$FIRMWARE ] && exit 0

set_board_id() {
echo "$1" >/lib/firmware/$FIRMWARE
}

board=$(board_name)

case "$FIRMWARE" in
"ath11k/IPQ5018/hw1.0/board_id-ahb-c000000.wifi")
case "$board" in
redmi,ax3000)
case "$(strings /dev/mtdblock15 | grep wl_pa_type= | cut -d= -f2)" in
epa) set_board_id 0x24 ;;
ipa|*) set_board_id 0x10 ;;
esac
;;
esac
;;
*)
exit 1
;;
esac
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/sh

[ -e /lib/firmware/$FIRMWARE ] && exit 0

. /lib/functions/caldata.sh

board=$(board_name)

case "$FIRMWARE" in
"ath11k/IPQ5018/hw1.0/caldata.bin")
case "$board" in
redmi,ax3000|\
xiaomi,cr881x)
caldata_extract "0:ART" 0x1000 0x20000
;;
esac
;;
"ath11k/qcn6122/hw1.0/caldata_1.bin")
case "$board" in
redmi,ax3000|\
xiaomi,cr881x)
caldata_extract "0:ART" 0x26800 0x20000
;;
esac
;;
*)
exit 1
;;
esac
35 changes: 35 additions & 0 deletions target/linux/ipq50xx/base-files/etc/init.d/uboot_env
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/sh /etc/rc.common

START=99

. /lib/functions.sh

boot() {
case $(board_name) in
redmi,ax3000|\
xiaomi,cr881x)
fw_printenv >/dev/null || return 0

local flag_ota_reboot="$(fw_printenv flag_ota_reboot | cut -d'=' -f2)"
if [[ "$flag_ota_reboot" == 1 ]]; then
local mtd="$(grep -oE 'ubi.mtd=[a-zA-Z0-9\-\_]*' /proc/cmdline | cut -d'=' -f2)"
case $mtd in
rootfs)
fw_setenv flag_last_success 0
fw_setenv flag_ota_reboot 0
fw_setenv flag_boot_success 1
;;
rootfs_1)
fw_setenv flag_last_success 1
fw_setenv flag_ota_reboot 0
fw_setenv flag_boot_success 1
;;
*)
echo "Unable to determine UBIPART: ubi.mtd=$mtd"
return 1
;;
esac
fi
;;
esac
}
Loading

0 comments on commit ccf5705

Please sign in to comment.