diff --git a/Config.in b/Config.in index 051d3264e2..f6d0063d58 100644 --- a/Config.in +++ b/Config.in @@ -38,3 +38,5 @@ source "target/sdk/Config.in" source "target/toolchain/Config.in" source "tmp/.config-package.in" + +source "config/Config-ipq.in" diff --git a/README.md b/README.md index 146570ff87..370f76ce2a 100644 --- a/README.md +++ b/README.md @@ -1,93 +1,15 @@ -logo +# 分支说明 +main 为高通专用,无法编译其他平台,带满血NSS驱动。 -# Project ImmortalWrt +owrt 为多平台通用,可编译高通平台,但没有NSS驱动。 -ImmortalWrt is a fork of [OpenWrt](https://openwrt.org), with more packages ported, more devices supported, default optimized profiles and localization modifications for mainland China users.
-Compared to upstream, we allow to use (non-upstreamable) modifications/hacks to provide better feature/performance/support. +# 自用 ImmortalWRT +高通部分源码取自以下项目: -Default login address: http://192.168.1.1 or http://immortalwrt.lan, username: __root__, password: _none_. +https://github.com/JiaY-shi/openwrt.git -## Download -Built firmware images are available for many architectures and come with a package selection to be used as WiFi home router. To quickly find a factory image usable to migrate from a vendor stock firmware to ImmortalWrt, try the *Firmware Selector*. +https://github.com/LiBwrt/openwrt-6.x.git -- [ImmortalWrt Firmware Selector](https://firmware-selector.immortalwrt.org/) +https://github.com/qosmio/openwrt-ipq.git -If your device is supported, please follow the **Info** link to see install instructions or consult the support resources listed below. - -## Development -To build your own firmware you need a GNU/Linux, BSD or macOS system (case sensitive filesystem required). Cygwin is unsupported because of the lack of a case sensitive file system.
- - ### Requirements - To build with this project, Debian 11 is preferred. And you need use the CPU based on AMD64 architecture, with at least 4GB RAM and 25 GB available disk space. Make sure the __Internet__ is accessible. - - The following tools are needed to compile ImmortalWrt, the package names vary between distributions. - - - Here is an example for Debian/Ubuntu users:
- - Method 1: -
- Setup dependencies via APT - - ```bash - sudo apt update -y - sudo apt full-upgrade -y - sudo apt install -y ack antlr3 asciidoc autoconf automake autopoint binutils bison build-essential \ - bzip2 ccache clang cmake cpio curl device-tree-compiler ecj fastjar flex gawk gettext gcc-multilib \ - g++-multilib git gnutls-dev gperf haveged help2man intltool lib32gcc-s1 libc6-dev-i386 libelf-dev \ - libglib2.0-dev libgmp3-dev libltdl-dev libmpc-dev libmpfr-dev libncurses-dev libpython3-dev \ - libreadline-dev libssl-dev libtool libyaml-dev libz-dev lld llvm lrzsz mkisofs msmtp nano \ - ninja-build p7zip p7zip-full patch pkgconf python3 python3-pip python3-ply python3-docutils \ - python3-pyelftools qemu-utils re2c rsync scons squashfs-tools subversion swig texinfo uglifyjs \ - upx-ucl unzip vim wget xmlto xxd zlib1g-dev zstd - ``` -
- - Method 2: - ```bash - sudo bash -c 'bash <(curl -s https://build-scripts.immortalwrt.org/init_build_environment.sh)' - ``` - - Note: - - Do everything as an unprivileged user, not root, without sudo. - - Using CPUs based on other architectures should be fine to compile ImmortalWrt, but more hacks are needed - No warranty at all. - - You must __not__ have spaces or non-ascii characters in PATH or in the work folders on the drive. - - If you're using Windows Subsystem for Linux (or WSL), removing Windows folders from PATH is required, please see [Build system setup WSL](https://openwrt.org/docs/guide-developer/build-system/wsl) documentation. - - Using macOS as the host build OS is __not__ recommended. No warranty at all. You can get tips from [Build system setup macOS](https://openwrt.org/docs/guide-developer/build-system/buildroot.exigence.macosx) documentation. - - For more details, please see [Build system setup](https://openwrt.org/docs/guide-developer/build-system/install-buildsystem) documentation. - - ### Quickstart - 1. Run `git clone -b --single-branch --filter=blob:none https://github.com/immortalwrt/immortalwrt` to clone the source code. - 2. Run `cd immortalwrt` to enter source directory. - 3. Run `./scripts/feeds update -a` to obtain all the latest package definitions defined in feeds.conf / feeds.conf.default - 4. Run `./scripts/feeds install -a` to install symlinks for all obtained packages into package/feeds/ - 5. Run `make menuconfig` to select your preferred configuration for the toolchain, target system & firmware packages. - 6. Run `make` to build your firmware. This will download all sources, build the cross-compile toolchain and then cross-compile the GNU/Linux kernel & all chosen applications for your target system. - - ### Related Repositories - The main repository uses multiple sub-repositories to manage packages of different categories. All packages are installed via the OpenWrt package manager called opkg. If you're looking to develop the web interface or port packages to ImmortalWrt, please find the fitting repository below. - - [LuCI Web Interface](https://github.com/immortalwrt/luci): Modern and modular interface to control the device via a web browser. - - [ImmortalWrt Packages](https://github.com/immortalwrt/packages): Community repository of ported packages. - - [OpenWrt Routing](https://github.com/openwrt/routing): Packages specifically focused on (mesh) routing. - - [OpenWrt Video](https://github.com/openwrt/video): Packages specifically focused on display servers and clients (Xorg and Wayland). - -## Support Information -For a list of supported devices see the [OpenWrt Hardware Database](https://openwrt.org/supported_devices) - ### Documentation - - [Quick Start Guide](https://openwrt.org/docs/guide-quick-start/start) - - [User Guide](https://openwrt.org/docs/guide-user/start) - - [Developer Documentation](https://openwrt.org/docs/guide-developer/start) - - [Technical Reference](https://openwrt.org/docs/techref/start) - - ### Support Community - - Support Chat: group [@ctcgfw_openwrt_discuss](https://t.me/ctcgfw_openwrt_discuss) on [Telegram](https://telegram.org/). - - Support Chat: group [#immortalwrt](https://matrix.to/#/#immortalwrt:matrix.org) on [Matrix](https://matrix.org/). - -## License -ImmortalWrt is licensed under [GPL-2.0-only](https://spdx.org/licenses/GPL-2.0-only.html). - -## Acknowledgements - - - - - - -
Dler CloudJetBrains Black Box Logo logoSourceForge
+https://github.com/King-Of-Knights/openwrt-6.x.git diff --git a/config/Config-images.in b/config/Config-images.in index 966c610466..da900ddd7e 100644 --- a/config/Config-images.in +++ b/config/Config-images.in @@ -313,8 +313,8 @@ menu "Target Images" config TARGET_ROOTFS_PARTSIZE int "Root filesystem partition size (in MiB)" depends on USES_ROOTFS_PART || TARGET_ROOTFS_EXT4FS - default 300 if BUILDBOT - default 160 + default 512 if BUILDBOT + default 1024 help Select the root filesystem partition size. diff --git a/config/Config-ipq.in b/config/Config-ipq.in new file mode 100644 index 0000000000..6b03eaf09d --- /dev/null +++ b/config/Config-ipq.in @@ -0,0 +1,145 @@ +# vim: set ft=kconfig +menu "Qualcomm IPQ Options" + +comment "Kernel build options" + +choice KERNEL_IPQ_MEM_PROFILE + prompt "IPQ memory profile" + default IPQ_MEM_PROFILE_1024 + + config IPQ_MEM_PROFILE_1024 + bool "1024" + config IPQ_MEM_PROFILE_512 + bool "512" + config IPQ_MEM_PROFILE_256 + bool "256" +endchoice + +config KERNEL_IPQ_MEM_PROFILE + int + default 1024 if IPQ_MEM_PROFILE_1024 + default 512 if IPQ_MEM_PROFILE_512 + default 256 if IPQ_MEM_PROFILE_256 + + help + This option select memory profile to used, which defines + the reserved memory configuration used in device tree + +config KERNEL_SKB_RECYCLER + bool "Generic SKB recycling" + default y if KERNEL_IPQ_MEM_PROFILE > 256 + +choice KERNEL_SKB_RECYCLE_SIZE + prompt "SKB recycler size" + default SKB_RECYCLE_SIZE_2304 + default SKB_RECYCLE_SIZE_1856 if KERNEL_IPQ_MEM_PROFILE < 1024 + + depends on KERNEL_SKB_RECYCLER + config SKB_RECYCLE_SIZE_1856 + bool "1856" + config SKB_RECYCLE_SIZE_2304 + bool "2304" +endchoice + +config KERNEL_SKB_RECYCLE_SIZE + int + depends on KERNEL_SKB_RECYCLER + default 2304 if SKB_RECYCLE_SIZE_2304 + default 1856 if SKB_RECYCLE_SIZE_1856 + + help + SKB recycler default size + +config KERNEL_SKB_RECYCLER_MULTI_CPU + bool "Cross-CPU recycling for CPU-locked workloads" + depends on KERNEL_SKB_RECYCLER + default y + +config KERNEL_SKB_RECYCLER_PREALLOC + bool "Enable preallocation of SKBs (For SFE not NSS)" + depends on KERNEL_SKB_RECYCLER + default n + help + NOTE: This is primarily for platforms utilizing SFE (Shortcut Forwarding Engine) + and not NSS (Network Subsystem) offload. + + NSS offload platforms mostly utilize the SKB recycling feature when managing memory. + Mostly when to "reclaim" it. + + This option enables preallocation of SKBs. + The default is '16384' which means 16384 x 4096 (Size of SKB) = 64MB. + +config KERNEL_SKB_RECYCLE_MAX_PREALLOC_SKBS + int "Number of SKBs to be preallocated" + depends on KERNEL_SKB_RECYCLER_PREALLOC + default 16384 + +config KERNEL_SKB_FIXED_SIZE_2K + bool "SKB size fixed at 2K" + default n + default y if KERNEL_IPQ_MEM_PROFILE < 512 + help + SKB size fixed at 2K. Primarily for platforms with less than 512MB memory. + +config KERNEL_ALLOC_SKB_PAGE_FRAG_DISABLE + depends on KERNEL_SKB_RECYCLER + bool "Disable alloc skb page frag" + default n + +choice KERNEL_PREEMPTION + prompt "Kernel preemption level" + default KERNEL_PREEMPT + +config KERNEL_PREEMPT_NONE + bool "No Forced Preemption (Server)" + help + This is the traditional Linux preemption model, geared towards + throughput. It will still provide good latencies most of the time, + but there are no guarantees and occasional longer delays are + possible. + + Select this option if you are building a kernel for a server or + scientific/computation system, or if you want to maximize the + raw processing power of the kernel, irrespective of scheduling + latencies. + +config KERNEL_PREEMPT_NONE_BUILD + depends on KERNEL_PREEMPT_NONE + bool + default y + +config KERNEL_PREEMPT + bool "Preemptible Kernel (Low-Latency)" + help + This option reduces the latency of the kernel by making + all kernel code (that is not executing in a critical section) + preemptible. This allows reaction to interactive events by + permitting a low priority process to be preempted involuntarily + even if it is in kernel mode executing a system call and would + otherwise not be about to reach a natural preemption point. + This allows applications to run more 'smoothly' even when the + system is under load, at the cost of slightly lower throughput + and a slight runtime overhead to kernel code. + + Select this if you are building a kernel for a desktop or + embedded system with latency requirements in the milliseconds + range. + +if KERNEL_PREEMPT + config KERNEL_PREEMPT_RCU + bool "Preemptible RCU" + default y + select KERNEL_PREEMPT_COUNT + help + This option selects the RCU implementation that is + designed for very large SMP systems with hundreds or + thousands of CPUs, but for which real-time response + is also required. It also scales down nicely to + smaller systems. + + Select this option if you are unsure. + +endif +endchoice + +endmenu diff --git a/package/base-files/files/bin/config_generate b/package/base-files/files/bin/config_generate index 16a42a11bf..12047e6da0 100755 --- a/package/base-files/files/bin/config_generate +++ b/package/base-files/files/bin/config_generate @@ -312,8 +312,8 @@ generate_static_system() { delete system.@system[0] add system system set system.@system[-1].hostname='ImmortalWrt' - set system.@system[-1].timezone='GMT0' - set system.@system[-1].zonename='UTC' + set system.@system[-1].timezone="CST-8" + set system.@system[-1].zonename="Asia/Shanghai" set system.@system[-1].ttylogin='0' set system.@system[-1].log_size='128' set system.@system[-1].urandom_seed='0' @@ -322,10 +322,10 @@ generate_static_system() { set system.ntp='timeserver' set system.ntp.enabled='1' set system.ntp.enable_server='0' - add_list system.ntp.server='time1.apple.com' - add_list system.ntp.server='time1.google.com' - add_list system.ntp.server='time.cloudflare.com' - add_list system.ntp.server='pool.ntp.org' + add_list system.ntp.server="ntp.tencent.com" + add_list system.ntp.server="ntp.aliyun.com" + add_list system.ntp.server="ntp.ntsc.ac.cn" + add_list system.ntp.server="cn.ntp.org.cn" EOF if json_is_a system object; then diff --git a/package/base-files/files/etc/board.d/99-default_network b/package/base-files/files/etc/board.d/99-default_network old mode 100644 new mode 100755 diff --git a/package/base-files/files/etc/hotplug.d/leds/00-init b/package/base-files/files/etc/hotplug.d/leds/00-init old mode 100644 new mode 100755 diff --git a/package/base-files/files/etc/hotplug.d/net/00-sysctl b/package/base-files/files/etc/hotplug.d/net/00-sysctl old mode 100644 new mode 100755 diff --git a/package/base-files/files/etc/sysctl.d/10-default.conf b/package/base-files/files/etc/sysctl.d/10-default.conf old mode 100644 new mode 100755 diff --git a/package/base-files/files/etc/uci-defaults/10_migrate-shadow b/package/base-files/files/etc/uci-defaults/10_migrate-shadow old mode 100644 new mode 100755 diff --git a/package/base-files/files/etc/uci-defaults/11_network-migrate-bridges b/package/base-files/files/etc/uci-defaults/11_network-migrate-bridges old mode 100644 new mode 100755 diff --git a/package/base-files/files/etc/uci-defaults/12_network-generate-ula b/package/base-files/files/etc/uci-defaults/12_network-generate-ula old mode 100644 new mode 100755 diff --git a/package/base-files/files/etc/uci-defaults/13_fix-group-user b/package/base-files/files/etc/uci-defaults/13_fix-group-user old mode 100644 new mode 100755 diff --git a/package/base-files/files/etc/uci-defaults/50-root-passwd b/package/base-files/files/etc/uci-defaults/50-root-passwd old mode 100644 new mode 100755 diff --git a/package/base-files/files/etc/uci-defaults/991_set-network.sh b/package/base-files/files/etc/uci-defaults/991_set-network.sh new file mode 100755 index 0000000000..cd6e601594 --- /dev/null +++ b/package/base-files/files/etc/uci-defaults/991_set-network.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +# 检查 network.globals.ula_prefix 是否存在且不为空 +ula_prefix=$(uci get network.globals.ula_prefix 2>/dev/null) + +if [ -n "$ula_prefix" ]; then + uci set dhcp.wan6=dhcp + uci set dhcp.wan6.interface='wan6' + uci set dhcp.wan6.ignore='1' + + uci set dhcp.lan.force='1' + uci set dhcp.lan.ra='hybrid' + uci set dhcp.lan.ra_default='1' + uci set dhcp.lan.max_preferred_lifetime='1800' + uci set dhcp.lan.max_valid_lifetime='3600' + + uci del dhcp.lan.dhcpv6 + uci del dhcp.lan.ra_flags + uci del dhcp.lan.ra_slaac + uci add_list dhcp.lan.ra_flags='none' + + uci commit dhcp + + uci set network.wan6.reqaddress='try' + uci set network.wan6.reqprefix='auto' + uci set network.lan.ip6assign='64' + uci set network.lan.ip6ifaceid='eui64' + uci set network.globals.packet_steering='0' + uci del network.globals.ula_prefix + + uci commit network +fi + +exit 0 diff --git a/package/base-files/files/etc/uci-defaults/999_auto-restart.sh b/package/base-files/files/etc/uci-defaults/999_auto-restart.sh new file mode 100755 index 0000000000..dac8a32927 --- /dev/null +++ b/package/base-files/files/etc/uci-defaults/999_auto-restart.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +/etc/init.d/network restart +/etc/init.d/odhcpd restart +/etc/init.d/rpcd restart + +exit 0 diff --git a/package/base-files/files/lib/upgrade/emmc.sh b/package/base-files/files/lib/upgrade/emmc.sh index 78e398d6d5..de39ba3606 100644 --- a/package/base-files/files/lib/upgrade/emmc.sh +++ b/package/base-files/files/lib/upgrade/emmc.sh @@ -1,5 +1,4 @@ # Copyright (C) 2021 OpenWrt.org -# . /lib/functions.sh @@ -29,8 +28,7 @@ emmc_upgrade_tar() { sync } - [ "$has_kernel" = 1 -a "$EMMC_KERN_DEV" ] && - export EMMC_KERNEL_BLOCKS=$(($(tar xf "$tar_file" ${board_dir}/kernel -O | dd of="$EMMC_KERN_DEV" bs=512 2>&1 | grep "records out" | cut -d' ' -f1))) + [ "$has_kernel" = 1 -a "$EMMC_KERN_DEV" ] && export EMMC_KERNEL_BLOCKS=$(($(tar xf "$tar_file" ${board_dir}/kernel -O | dd of="$EMMC_KERN_DEV" bs=512 2>&1 | grep "records out" | cut -d' ' -f1))) if [ -z "$UPGRADE_BACKUP" ]; then if [ "$EMMC_DATA_DEV" ]; then diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic index b6ccf58752..cce7fa50c0 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -64,7 +64,8 @@ glinet,gl-mt6000|\ glinet,gl-x3000|\ glinet,gl-xe3000|\ huasifei,wh3000-emmc|\ -nradio,c8-668gl) +nradio,c8-668gl|\ +superbox,s20-plus) local envdev=$(find_mmc_part "u-boot-env") ubootenv_add_uci_config "$envdev" "0x0" "0x80000" ;; diff --git a/package/boot/uboot-envtools/files/qualcommax_ipq50xx b/package/boot/uboot-envtools/files/qualcommax_ipq50xx index b63451d627..f3d9719716 100644 --- a/package/boot/uboot-envtools/files/qualcommax_ipq50xx +++ b/package/boot/uboot-envtools/files/qualcommax_ipq50xx @@ -7,13 +7,29 @@ touch /etc/config/ubootenv board=$(board_name) +ubootenv_add_mtd() { + local idx="$(find_mtd_index "${1}")" + [ -n "$idx" ] && ubootenv_add_uci_config "/dev/mtd$idx" "${2}" "${3}" "${4}" +} + +ubootenv_add_sys_mtd() { + local idx="$(find_mtd_index "${1}")" + [ -n "$idx" ] && ubootenv_add_uci_sys_config "/dev/mtd$idx" "${2}" "${3}" "${4}" +} + +ubootenv_add_mmc() { + local mmcpart="$(find_mmc_part "${1}")" + [ -n "$mmcpart" ] && ubootenv_add_uci_config "$mmcpart" "${2}" "${3}" "${4}" "${5}" +} + case "$board" in linksys,mx2000|\ linksys,mx5500|\ linksys,spnmx56) - idx="$(find_mtd_index u_env)" - [ -n "$idx" ] && \ - ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000" + ubootenv_add_mtd "/dev/mtd$idx" "0x0" "0x40000" "0x20000" + ;; +jdcloud,re-cs-03) + ubootenv_add_mmc "0:APPSBLENV" "0x0" "0x40000" "0x20000" ;; esac diff --git a/package/boot/uboot-envtools/files/qualcommax_ipq60xx b/package/boot/uboot-envtools/files/qualcommax_ipq60xx index 2dc60bebe1..fc10ada0b4 100644 --- a/package/boot/uboot-envtools/files/qualcommax_ipq60xx +++ b/package/boot/uboot-envtools/files/qualcommax_ipq60xx @@ -9,8 +9,17 @@ board=$(board_name) ubootenv_add_mtd() { local idx="$(find_mtd_index "${1}")" - [ -n "$idx" ] && \ - ubootenv_add_uci_config "/dev/mtd$idx" "${2}" "${3}" "${4}" + [ -n "$idx" ] && ubootenv_add_uci_config "/dev/mtd$idx" "${2}" "${3}" "${4}" +} + +ubootenv_add_sys_mtd() { + local idx="$(find_mtd_index "${1}")" + [ -n "$idx" ] && ubootenv_add_uci_sys_config "/dev/mtd$idx" "${2}" "${3}" "${4}" +} + +ubootenv_add_mmc() { + local mmcpart="$(find_mmc_part "${1}")" + [ -n "$mmcpart" ] && ubootenv_add_uci_config "$mmcpart" "${2}" "${3}" "${4}" "${5}" } case "$board" in @@ -22,6 +31,13 @@ cambiumnetworks,xe3-4) linksys,mr7350) ubootenv_add_mtd "u_env" "0x0" "0x40000" "0x20000" ;; +cmiot,ax18|\ +glinet,gl-ax1800|\ +glinet,gl-axt1800|\ +qihoo,360v6|\ +redmi,ax5|\ +xiaomi,ax1800|\ +zn,m2|\ netgear,wax214|\ tplink,eap610-outdoor) ubootenv_add_mtd "0:appsblenv" "0x0" "0x40000" "0x20000" @@ -29,6 +45,14 @@ tplink,eap610-outdoor) yuncore,fap650) ubootenv_add_mtd "0:appsblenv" "0x0" "0x10000" "0x10000" ;; +jdcloud,re-ss-01|\ +jdcloud,re-cs-02|\ +jdcloud,re-cs-07|\ +link,nn6000-v1|\ +link,nn6000-v2|\ +redmi,ax5-jdcloud) + ubootenv_add_mmc "0:APPSBLENV" "0x0" "0x40000" "0x20000" + ;; esac config_load ubootenv diff --git a/package/boot/uboot-envtools/files/qualcommax_ipq807x b/package/boot/uboot-envtools/files/qualcommax_ipq807x index 7efb848123..3a9c4ee589 100644 --- a/package/boot/uboot-envtools/files/qualcommax_ipq807x +++ b/package/boot/uboot-envtools/files/qualcommax_ipq807x @@ -9,20 +9,17 @@ board=$(board_name) ubootenv_add_mtd() { local idx="$(find_mtd_index "${1}")" - [ -n "$idx" ] && \ - ubootenv_add_uci_config "/dev/mtd$idx" "${2}" "${3}" "${4}" + [ -n "$idx" ] && ubootenv_add_uci_config "/dev/mtd$idx" "${2}" "${3}" "${4}" } ubootenv_add_sys_mtd() { local idx="$(find_mtd_index "${1}")" - [ -n "$idx" ] && \ - ubootenv_add_uci_sys_config "/dev/mtd$idx" "${2}" "${3}" "${4}" + [ -n "$idx" ] && ubootenv_add_uci_sys_config "/dev/mtd$idx" "${2}" "${3}" "${4}" } ubootenv_add_mmc() { local mmcpart="$(find_mmc_part "${1}")" - [ -n "$mmcpart" ] && \ - ubootenv_add_uci_config "$mmcpart" "${2}" "${3}" "${4}" "${5}" + [ -n "$mmcpart" ] && ubootenv_add_uci_config "$mmcpart" "${2}" "${3}" "${4}" "${5}" } case "$board" in @@ -74,8 +71,9 @@ asus,rt-ax89x|\ qnap,301w) ubootenv_add_mtd "0:appsblenv" "0x0" "0x20000" "0x20000" ;; -spectrum,sax1v1k) - ubootenv_add_mmc "0:APPSBLENV" "0x0" "0x40000" "0x40000" "1" +spectrum,sax1v1k|\ +verizon,cr1000a) + ubootenv_add_mmc "0:APPSBLENV" "0x0" "0x40000" "0x40000" ;; esac diff --git a/package/boot/uboot-rockchip/Makefile b/package/boot/uboot-rockchip/Makefile index 76ff54fe96..59d1ac6bf6 100644 --- a/package/boot/uboot-rockchip/Makefile +++ b/package/boot/uboot-rockchip/Makefile @@ -117,6 +117,13 @@ define U-Boot/rk3399/Default ATF:=$(RK3399_ATF) endef +define U-Boot/fine3399-rk3399 + $(U-Boot/rk3399/Default) + NAME:=Fine 3399 + BUILD_DEVICES:= \ + rumu3f_fine-3399 +endef + define U-Boot/guangmiao-g4c-rk3399 $(U-Boot/rk3399/Default) NAME:=GuangMiao G4C @@ -385,6 +392,7 @@ define U-Boot/rock5a-rk3588s endef UBOOT_TARGETS := \ + fine3399-rk3399 \ guangmiao-g4c-rk3399 \ nanopc-t4-rk3399 \ nanopi-r4s-rk3399 \ diff --git a/package/boot/uboot-rockchip/patches/900-arm-add-dts-files.patch b/package/boot/uboot-rockchip/patches/900-arm-add-dts-files.patch index f75a62eb3f..bb5dbf5849 100644 --- a/package/boot/uboot-rockchip/patches/900-arm-add-dts-files.patch +++ b/package/boot/uboot-rockchip/patches/900-arm-add-dts-files.patch @@ -1,12 +1,13 @@ --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile -@@ -87,6 +87,23 @@ dtb-$(CONFIG_ROCKCHIP_RK3368) += \ +@@ -87,6 +87,24 @@ dtb-$(CONFIG_ROCKCHIP_RK3368) += \ rk3368-geekbox.dtb \ rk3368-px5-evb.dtb \ +dtb-$(CONFIG_ROCKCHIP_RK3399) += \ + rk3399-guangmiao-g4c.dtb \ -+ rk3399-nanopi-r4se.dtb ++ rk3399-nanopi-r4se.dtb \ ++ rk3399-fine-3399.dtb + +dtb-$(CONFIG_ROCKCHIP_RK3566) += \ + rk3566-nanopi-r3s.dtb \ diff --git a/package/boot/uboot-rockchip/src/arch/arm/dts/rk3399-fine-3399-u-boot.dtsi b/package/boot/uboot-rockchip/src/arch/arm/dts/rk3399-fine-3399-u-boot.dtsi new file mode 100644 index 0000000000..86a3c14da5 --- /dev/null +++ b/package/boot/uboot-rockchip/src/arch/arm/dts/rk3399-fine-3399-u-boot.dtsi @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include "rk3399-u-boot.dtsi" +#include "rk3399-sdram-lpddr4-100.dtsi" + +/ { + chosen { + u-boot,spl-boot-order = "same-as-spl", &sdhci, &sdmmc; + }; +}; + +&vdd_log { + regulator-init-microvolt = <950000>; +}; diff --git a/package/boot/uboot-rockchip/src/arch/arm/dts/rk3399-fine-3399.dts b/package/boot/uboot-rockchip/src/arch/arm/dts/rk3399-fine-3399.dts new file mode 100644 index 0000000000..b7c058de43 --- /dev/null +++ b/package/boot/uboot-rockchip/src/arch/arm/dts/rk3399-fine-3399.dts @@ -0,0 +1,789 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) + +/dts-v1/; + +#include +#include +#include "rk3399.dtsi" +#include "rk3399-op1-opp.dtsi" + +/ { + model = "RUMU3F Fine3399"; + compatible = "rockchip,rk3399"; + + aliases { + ethernet0 = &gmac; + mmc0 = &sdio0; + mmc1 = &sdmmc; + mmc2 = &sdhci; + }; + + chosen { + stdout-path = "serial2:1500000n8"; + }; + + clkin_gmac: external-gmac-clock { + compatible = "fixed-clock"; + clock-frequency = <125000000>; + clock-output-names = "clkin_gmac"; + #clock-cells = <0>; + }; + + dc_12v: dc-12v { + compatible = "regulator-fixed"; + regulator-name = "dc_12v"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <12000000>; + regulator-max-microvolt = <12000000>; + }; + + sdio_pwrseq: sdio-pwrseq { + compatible = "mmc-pwrseq-simple"; + clocks = <&rk808 1>; + clock-names = "ext_clock"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_reg_on_h>; + reset-gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_LOW>; + }; + + /* switched by pmic_sleep */ + vcc1v8_s3: vcca1v8_s3: vcc1v8-s3 { + compatible = "regulator-fixed"; + regulator-name = "vcc1v8_s3"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + vin-supply = <&vcc_1v8>; + }; + + vcc3v3_sys: vcc3v3-sys { + compatible = "regulator-fixed"; + regulator-name = "vcc3v3_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&dc_12v>; + }; + + vcc_sys: vcc-sys { + compatible = "regulator-fixed"; + regulator-name = "vcc_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&dc_12v>; + }; + + vcc_phy: vcc-phy-regulator { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio0 RK_PB4 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc_phy_h>; + regulator-name = "vcc_phy"; + regulator-always-on; + regulator-boot-on; + }; + + vdd_log: vdd-log { + compatible = "pwm-regulator"; + pwms = <&pwm2 0 25000 1>; + regulator-name = "vdd_log"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <1400000>; + vin-supply = <&vcc_sys>; + }; + + leds: gpio-leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&user_led2>; + + user_led2 { + label = "blue:work_led"; + gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_LOW>; + linux,default-trigger = "heartbeat"; + }; + }; + + gpio-keys { + compatible = "gpio-keys"; + autorepeat; + pinctrl-names = "default"; + pinctrl-0 = <&power_key>; + + key-power { + debounce-interval = <100>; + gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>; + label = "GPIO Key Power"; + linux,code = ; + wakeup-source; + }; + }; + + fan0: pwm-fan { + compatible = "pwm-fan"; + cooling-levels = <0 25 50 75 100 150>; + #cooling-cells = <2>; + fan-supply = <&vcc_sys>; + pwms = <&pwm1 0 40000 0>; + }; + + backlight: backlight { + compatible = "pwm-backlight"; + brightness-levels = <0 36 72 108 144 180 216 255>; + default-brightness-level = <5>; + pwms = <&pwm0 0 1000000 0>; + }; + + ir-receiver { + compatible = "gpio-ir-receiver"; + gpios = <&gpio0 RK_PA6 GPIO_ACTIVE_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&ir_int>; + }; + + adc-keys { + compatible = "adc-keys"; + io-channels = <&saradc 1>; + io-channel-names = "buttons"; + keyup-threshold-microvolt = <1750000>; + poll-interval = <100>; + + recovery { + label = "Recovery"; + linux,code = ; + press-threshold-microvolt = <0>; + }; + }; +}; + +&cpu_l0 { + cpu-supply = <&vdd_cpu_l>; +}; + +&cpu_l1 { + cpu-supply = <&vdd_cpu_l>; +}; + +&cpu_l2 { + cpu-supply = <&vdd_cpu_l>; +}; + +&cpu_l3 { + cpu-supply = <&vdd_cpu_l>; +}; + +&cpu_b0 { + cpu-supply = <&vdd_cpu_b>; +}; + +&cpu_b1 { + cpu-supply = <&vdd_cpu_b>; +}; + +&gpu { + mali-supply = <&vdd_gpu>; + status = "okay"; +}; + +&cpu_thermal { + trips { + cpu_hot: cpu_hot { + hysteresis = <10000>; + temperature = <55000>; + type = "active"; + }; + }; + + cooling-maps { + map2 { + cooling-device = + <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + trip = <&cpu_hot>; + }; + }; +}; + +&emmc_phy { + status = "okay"; +}; + +&gmac { + assigned-clocks = <&cru SCLK_RMII_SRC>; + assigned-clock-parents = <&clkin_gmac>; + clock_in_out = "input"; + phy-supply = <&vcc_phy>; + phy-mode = "rgmii"; + pinctrl-names = "default"; + pinctrl-0 = <&rgmii_pins>; + snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; + snps,reset-active-low; + snps,reset-delays-us = <0 10000 50000>; + tx_delay = <0x28>; + rx_delay = <0x11>; + status = "okay"; +}; + +&hdmi { + ddc-i2c-bus = <&i2c3>; + pinctrl-names = "default"; + pinctrl-0 = <&hdmi_cec>; + status = "okay"; +}; + +&hdmi_sound { + status = "okay"; +}; + +&i2c0 { + clock-frequency = <400000>; + i2c-scl-rising-time-ns = <168>; + i2c-scl-falling-time-ns = <4>; + status = "okay"; + + rk808: pmic@1b { + compatible = "rockchip,rk808"; + reg = <0x1b>; + interrupt-parent = <&gpio1>; + interrupts = ; + #clock-cells = <1>; + clock-output-names = "xin32k", "rk808-clkout2"; + pinctrl-names = "default"; + pinctrl-0 = <&pmic_int_l &pmic_dvs2>; + rockchip,system-power-controller; + wakeup-source; + + vcc1-supply = <&vcc3v3_sys>; + vcc2-supply = <&vcc3v3_sys>; + vcc3-supply = <&vcc3v3_sys>; + vcc4-supply = <&vcc3v3_sys>; + vcc6-supply = <&vcc3v3_sys>; + vcc7-supply = <&vcc3v3_sys>; + vcc8-supply = <&vcc3v3_sys>; + vcc9-supply = <&vcc3v3_sys>; + vcc10-supply = <&vcc3v3_sys>; + vcc11-supply = <&vcc3v3_sys>; + vcc12-supply = <&vcc3v3_sys>; + vddio-supply = <&vcc1v8_pmu>; + + regulators { + vdd_center: DCDC_REG1 { + regulator-name = "vdd_center"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <750000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_cpu_l: DCDC_REG2 { + regulator-name = "vdd_cpu_l"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <750000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_ddr: DCDC_REG3 { + regulator-name = "vcc_ddr"; + regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vcc_1v8: DCDC_REG4 { + regulator-name = "vcc_1v8"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vcc1v8_dvp: LDO_REG1 { + regulator-name = "vcc1v8_dvp"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc3v0_tp: LDO_REG2 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-name = "vcc3v0_tp"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc1v8_pmu: LDO_REG3 { + regulator-name = "vcc1v8_pmu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vcc_sd: LDO_REG4 { + regulator-name = "vcc_sd"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcca3v0_codec: LDO_REG5 { + regulator-name = "vcca3v0_codec"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_1v5: LDO_REG6 { + regulator-name = "vcc_1v5"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1500000>; + regulator-max-microvolt = <1500000>; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1500000>; + }; + }; + + vcca1v8_codec: LDO_REG7 { + regulator-name = "vcca1v8_codec"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_3v0: LDO_REG8 { + regulator-name = "vcc_3v0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3000000>; + }; + }; + + vcc3v3_s3: SWITCH_REG1 { + regulator-name = "vcc3v3_s3"; + regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc3v3_s0: SWITCH_REG2 { + regulator-name = "vcc3v3_s0"; + regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + }; + }; + + vdd_cpu_b: regulator@40 { + compatible = "silergy,syr827"; + reg = <0x40>; + fcs,suspend-voltage-selector = <1>; + pinctrl-names = "default"; + pinctrl-0 = <&cpu_b_sleep>; + regulator-name = "vdd_cpu_b"; + regulator-min-microvolt = <712500>; + regulator-max-microvolt = <1500000>; + regulator-ramp-delay = <1000>; + regulator-always-on; + regulator-boot-on; + vin-supply = <&vcc_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_gpu: regulator@41 { + compatible = "silergy,syr828"; + reg = <0x41>; + fcs,suspend-voltage-selector = <1>; + pinctrl-names = "default"; + pinctrl-0 = <&gpu_sleep>; + regulator-name = "vdd_gpu"; + regulator-min-microvolt = <712500>; + regulator-max-microvolt = <1500000>; + regulator-ramp-delay = <1000>; + regulator-always-on; + regulator-boot-on; + vin-supply = <&vcc_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; +}; + +&i2c3 { + i2c-scl-rising-time-ns = <450>; + i2c-scl-falling-time-ns = <15>; + status = "okay"; +}; + +&i2s2 { + #sound-dai-cells = <0>; + status = "okay"; +}; + +&iep_mmu { + status = "okay"; +}; + +&io_domains { + status = "okay"; + + bt656-supply = <&vcc_3v0>; + audio-supply = <&vcca1v8_codec>; + sdmmc-supply = <&vcc_sd>; + gpio1830-supply = <&vcc_3v0>; +}; + +&pmu_io_domains { + status = "okay"; + pmu1830-supply = <&vcc_1v8>; +}; + +&pcie_phy { + status = "okay"; +}; + +&pcie0 { + ep-gpios = <&gpio4 RK_PD3 GPIO_ACTIVE_HIGH>; + max-link-speed = <2>; + num-lanes = <2>; + pinctrl-names = "default"; + pinctrl-0 = <&pcie_clkreqn_cpm>; + status = "okay"; +}; + +&pinctrl { + pmic { + cpu_b_sleep: cpu-b-sleep { + rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>; + }; + + gpu_sleep: gpu-sleep { + rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>; + }; + + pmic_int_l: pmic-int-l { + rockchip,pins = <1 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>; + }; + + pmic_dvs2: pmic-dvs2 { + rockchip,pins = <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_down>; + }; + }; + + sdio-pwrseq { + wifi_reg_on_h: wifi-reg-on-h { + rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + wifi { + wifi_host_wake_l: wifi-host-wake-l { + rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + bt { + bt_enable_h: bt-enable-h { + rockchip,pins = <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + bt_host_wake_l: bt-host-wake-l { + rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_down>; + }; + + bt_wake_l: bt-wake-l { + rockchip,pins = <2 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + gmac { + vcc_phy_h: vcc-phy-h { + rockchip,pins = <0 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + leds { + user_led2: user_led2 { + rockchip,pins = <2 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + ir { + ir_int: ir-int { + rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + buttons { + power_key: power_key { + rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; +}; + +&pwm0 { + status = "okay"; +}; + +&pwm1 { + status = "okay"; +}; + +&pwm2 { + status = "okay"; +}; + +&saradc { + vref-supply = <&vcca1v8_s3>; + status = "okay"; +}; + +&sdio0 { + #address-cells = <1>; + #size-cells = <0>; + bus-width = <4>; + cap-sd-highspeed; + cap-sdio-irq; + clock-frequency = <50000000>; + disable-wp; + keep-power-in-suspend; + max-frequency = <50000000>; + mmc-pwrseq = <&sdio_pwrseq>; + non-removable; + pinctrl-names = "default"; + pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>; + sd-uhs-sdr104; + status = "okay"; + + brcmf: wifi@1 { + reg = <1>; + compatible = "brcm,bcm4329-fmac"; + interrupt-parent = <&gpio0>; + interrupts = ; + interrupt-names = "host-wake"; + brcm,drive-strength = <5>; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_host_wake_l>; + }; +}; + +&sdmmc { + bus-width = <4>; + cap-sd-highspeed; + cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>; + clock-frequency = <150000000>; + disable-wp; + sd-uhs-sdr104; + max-frequency = <150000000>; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>; + vqmmc-supply = <&vcc_sd>; + status = "okay"; +}; + +&sdhci { + bus-width = <8>; + mmc-hs400-1_8v; + mmc-hs400-enhanced-strobe; + keep-power-in-suspend; + non-removable; + status = "okay"; +}; + +&spi2 { + status = "okay"; + + panel@0 { + compatible = "sitronix,st7735s", "sitronix,st7735r", "sitronix,st7789v", "jianda,jd-t18003-t01"; + reg = <0>; + rgb; + width = <80>; + height = <160>; + fps = <30>; + buswidth = <8>; + rotate = <270>; + backlight = <&backlight>; + dc-gpios = <&gpio4 RK_PD5 GPIO_ACTIVE_HIGH>; + reset-gpios = <&gpio4 RK_PD1 GPIO_ACTIVE_LOW>; + led-gpios = <&gpio4 RK_PC2 GPIO_ACTIVE_HIGH>; + spi-max-frequency = <32000000>; + debug = <0>; + spi-cpol; + spi-cpha; + }; +}; + +&tcphy0 { + status = "okay"; +}; + +&tcphy1 { + status = "okay"; +}; + +&tsadc { + /* tshut mode 0:CRU 1:GPIO */ + rockchip,hw-tshut-mode = <1>; + /* tshut polarity 0:LOW 1:HIGH */ + rockchip,hw-tshut-polarity = <1>; + status = "okay"; +}; + +&u2phy0 { + status = "okay"; + + u2phy0_otg: otg-port { + status = "okay"; + }; + + u2phy0_host: host-port { + status = "okay"; + }; +}; + +&u2phy1 { + status = "okay"; + + u2phy1_otg: otg-port { + status = "okay"; + }; + + u2phy1_host: host-port { + status = "okay"; + }; +}; + +&uart0 { + pinctrl-names = "default"; + pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>; + status = "okay"; + + bluetooth { + compatible = "brcm,bcm43438-bt"; + clocks = <&rk808 1>; + clock-names = "lpo"; + device-wakeup-gpios = <&gpio2 RK_PD2 GPIO_ACTIVE_HIGH>; + host-wakeup-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>; + shutdown-gpios = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>; + max-speed = <4000000>; + pinctrl-names = "default"; + pinctrl-0 = <&bt_host_wake_l &bt_wake_l &bt_enable_h>; + vbat-supply = <&vcc3v3_sys>; + vddio-supply = <&vcc_1v8>; + }; +}; + +&uart2 { + status = "okay"; +}; + +&usb_host0_ehci { + status = "okay"; +}; + +&usb_host0_ohci { + status = "okay"; +}; + +&usb_host1_ehci { + status = "okay"; +}; + +&usb_host1_ohci { + status = "okay"; +}; + +&usbdrd3_0 { + status = "okay"; +}; + +&usbdrd_dwc3_0 { + status = "okay"; + dr_mode = "host"; +}; + +&usbdrd3_1 { + status = "okay"; +}; + +&usbdrd_dwc3_1 { + status = "okay"; + dr_mode = "host"; +}; + +&vopb { + status = "okay"; +}; + +&vopb_mmu { + status = "okay"; +}; + +&vopl { + status = "okay"; +}; + +&vopl_mmu { + status = "okay"; +}; diff --git a/package/boot/uboot-rockchip/src/configs/fine3399-rk3399_defconfig b/package/boot/uboot-rockchip/src/configs/fine3399-rk3399_defconfig new file mode 100644 index 0000000000..47cad26e7b --- /dev/null +++ b/package/boot/uboot-rockchip/src/configs/fine3399-rk3399_defconfig @@ -0,0 +1,84 @@ +CONFIG_ARM=y +CONFIG_SKIP_LOWLEVEL_INIT=y +CONFIG_COUNTER_FREQUENCY=24000000 +CONFIG_ARCH_ROCKCHIP=y +CONFIG_SPL_GPIO=y +CONFIG_NR_DRAM_BANKS=1 +CONFIG_ENV_OFFSET=0x3F8000 +CONFIG_DEFAULT_DEVICE_TREE="rk3399-fine-3399" +CONFIG_DM_RESET=y +CONFIG_ROCKCHIP_RK3399=y +CONFIG_TARGET_EVB_RK3399=y +CONFIG_DEBUG_UART_BASE=0xFF1A0000 +CONFIG_DEBUG_UART_CLOCK=24000000 +CONFIG_SYS_LOAD_ADDR=0x800800 +CONFIG_DEBUG_UART=y +CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-fine-3399.dtb" +CONFIG_DISPLAY_BOARDINFO_LATE=y +CONFIG_SPL_MAX_SIZE=0x40000 +CONFIG_SPL_PAD_TO=0x7f8000 +# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set +CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y +CONFIG_TPL=y +CONFIG_CMD_BOOTZ=y +CONFIG_CMD_GPT=y +CONFIG_CMD_I2C=y +CONFIG_CMD_MMC=y +CONFIG_CMD_PCI=y +CONFIG_CMD_USB=y +CONFIG_CMD_ROCKUSB=y +CONFIG_CMD_USB_MASS_STORAGE=y +# CONFIG_CMD_SETEXPR is not set +CONFIG_CMD_TIME=y +CONFIG_CMD_PMIC=y +CONFIG_CMD_REGULATOR=y +CONFIG_SPL_OF_CONTROL=y +# CONFIG_OF_UPSTREAM is not set +CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" +CONFIG_ENV_IS_IN_MMC=y +CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_ROCKCHIP_GPIO=y +CONFIG_SYS_I2C_ROCKCHIP=y +CONFIG_ROCKCHIP_IODOMAIN=y +CONFIG_MMC_DW=y +CONFIG_MMC_DW_ROCKCHIP=y +CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_SDMA=y +CONFIG_MMC_SDHCI_ROCKCHIP=y +CONFIG_ETH_DESIGNWARE=y +CONFIG_GMAC_ROCKCHIP=y +CONFIG_NVME_PCI=y +CONFIG_PHY_ROCKCHIP_INNO_USB2=y +CONFIG_PHY_ROCKCHIP_TYPEC=y +CONFIG_PMIC_RK8XX=y +CONFIG_SPL_DM_REGULATOR_FIXED=y +CONFIG_REGULATOR_PWM=y +CONFIG_REGULATOR_RK8XX=y +CONFIG_PWM_ROCKCHIP=y +CONFIG_RAM_ROCKCHIP_LPDDR4=y +CONFIG_BAUDRATE=1500000 +CONFIG_DEBUG_UART_SHIFT=2 +CONFIG_SYS_NS16550_MEM32=y +CONFIG_SYSINFO=y +CONFIG_SYSINFO_SMBIOS=y +CONFIG_SYSRESET=y +CONFIG_USB=y +CONFIG_USB_XHCI_HCD=y +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_EHCI_GENERIC=y +CONFIG_USB_KEYBOARD=y +CONFIG_USB_DWC3=y +CONFIG_USB_DWC3_GENERIC=y +CONFIG_USB_HOST_ETHER=y +CONFIG_USB_ETHER_ASIX=y +CONFIG_USB_ETHER_ASIX88179=y +CONFIG_USB_ETHER_MCS7830=y +CONFIG_USB_ETHER_RTL8152=y +CONFIG_USB_ETHER_SMSC95XX=y +CONFIG_USB_GADGET=y +CONFIG_USB_FUNCTION_ROCKUSB=y +CONFIG_VIDEO=y +CONFIG_DISPLAY=y +CONFIG_VIDEO_ROCKCHIP=y +CONFIG_DISPLAY_ROCKCHIP_HDMI=y +CONFIG_ERRNO_STR=y \ No newline at end of file diff --git a/package/emortal/autocore/Makefile b/package/emortal/autocore/Makefile index bf13fc73a6..0609b2ef3f 100644 --- a/package/emortal/autocore/Makefile +++ b/package/emortal/autocore/Makefile @@ -30,8 +30,6 @@ define Build/Compile endef define Package/autocore/install - $(INSTALL_DIR) $(1)/etc/uci-defaults - $(INSTALL_BIN) ./files/60-autocore-reload-rpcd $(1)/etc/uci-defaults/ ifneq ($(filter i386 i686 x86_64, $(ARCH)),) $(INSTALL_DIR) $(1)/etc/init.d diff --git a/package/emortal/autocore/files/60-autocore-reload-rpcd b/package/emortal/autocore/files/60-autocore-reload-rpcd deleted file mode 100755 index 75e8178bb8..0000000000 --- a/package/emortal/autocore/files/60-autocore-reload-rpcd +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -/etc/init.d/rpcd restart - -exit 0 diff --git a/package/emortal/autocore/files/luci-mod-status-autocore.json b/package/emortal/autocore/files/luci-mod-status-autocore.json old mode 100644 new mode 100755 diff --git a/package/emortal/autocore/files/tempinfo b/package/emortal/autocore/files/tempinfo index c9fbd6d34e..ee4d096acb 100755 --- a/package/emortal/autocore/files/tempinfo +++ b/package/emortal/autocore/files/tempinfo @@ -7,25 +7,25 @@ THERMAL_PATH="/sys/class/thermal" case "$DISTRIB_TARGET" in ipq40xx/*|ipq806x/*) - wifi_temp="$(awk '{printf("%.1f°C ", $0 / 1000)}' "$IEEE_PATH"/phy*/device/hwmon/hwmon*/temp1_input 2>"/dev/null" | awk '$1=$1')" + wifi_temp="$(cat "$IEEE_PATH"/phy*/device/hwmon/hwmon*/temp1_input 2>"/dev/null" | awk '{printf("%.1f°C ", $0 / 1000)}' | awk '$1=$1')" ;; mediatek/mt7622) - wifi_temp="$(awk '{printf("%.1f°C ", $0 / 1000)}' "$IEEE_PATH"/wl*/hwmon*/temp1_input 2>"/dev/null" | awk '$1=$1')" + wifi_temp="$(cat "$IEEE_PATH"/wl*/hwmon*/temp1_input 2>"/dev/null" | awk '{printf("%.1f°C ", $0 / 1000)}' | awk '$1=$1')" ;; *) - wifi_temp="$(awk '{printf("%.1f°C ", $0 / 1000)}' "$IEEE_PATH"/phy*/hwmon*/temp1_input 2>"/dev/null" | awk '$1=$1')" + wifi_temp="$(cat "$IEEE_PATH"/phy*/hwmon*/temp1_input 2>"/dev/null" | awk '{printf("%.1f°C ", $0 / 1000)}' | awk '$1=$1')" ;; esac case "$DISTRIB_TARGET" in ipq40xx/*) if [ -e "$IEEE_PATH/phy0/hwmon0/temp1_input" ]; then - mt76_temp="$(awk -F ': ' '{print $2}' "$IEEE_PATH/phy0/hwmon0/temp1_input" 2>"/dev/null")°C" + mt76_temp="$(awk -F ': ' '{print $2}' "$IEEE_PATH"/phy0/hwmon0/temp1_input 2>"/dev/null")°C" fi [ -z "$mt76_temp" ] || wifi_temp="${wifi_temp:+$wifi_temp }$mt76_temp" ;; *) - cpu_temp="$(awk '{printf("%.1f°C", $0 / 1000)}' "$THERMAL_PATH/thermal_zone0/temp" 2>"/dev/null")" + cpu_temp="$(cat "$THERMAL_PATH"/thermal_zone0/temp 2>"/dev/null" | awk '{printf("%.1f°C", $0 / 1000)}')" ;; esac diff --git a/package/emortal/autosamba/Makefile b/package/emortal/autosamba/Makefile deleted file mode 100644 index 0e228a0c27..0000000000 --- a/package/emortal/autosamba/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -# -# Copyright (C) 2010-2011 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -include $(TOPDIR)/rules.mk - -PKG_NAME:=autosamba -PKG_VERSION:=1 -PKG_RELEASE:=12 - -include $(INCLUDE_DIR)/package.mk - -define Package/autosamba - TITLE:=Samba autoconfig hotplug script. - MAINTAINER:=Lean - DEPENDS:=+luci-app-samba4 +wsdd2 - PKGARCH:=all -endef - -define Package/autosamba/description - A hotplug script to config Samba share automatically. -endef - -define Build/Compile -endef - -define Package/autosamba/install - $(INSTALL_DIR) $(1)/etc/hotplug.d/block - $(INSTALL_BIN) ./files/20-smb $(1)/etc/hotplug.d/block/ -endef - -$(eval $(call BuildPackage,autosamba)) diff --git a/package/emortal/autosamba/files/20-smb b/package/emortal/autosamba/files/20-smb deleted file mode 100644 index ae00f8140d..0000000000 --- a/package/emortal/autosamba/files/20-smb +++ /dev/null @@ -1,106 +0,0 @@ -#!/bin/sh - -# -# D-Team Technology Co.,Ltd. ShenZhen -# 作者:Vic -# -# 警告:对着屏幕的哥们,我们允许你使用此脚本,但不允许你抹去作者的信息,请保留这段话。 -# - -. /lib/functions.sh -. /lib/functions/service.sh - -global=0 -config_file="/etc/config/samba4" - -wait_for_init() { - for i in `seq 30` - do - [ -e /tmp/procd.done ] || { - sleep 1; continue; - } - return - done -} - -smb_handle() { - config_get path $1 path - if [ "$path" = "$2" ] ;then - global=1 - fi -} - -chk_en() { - config_get_bool autoshare $1 autoshare 1 - [ $autoshare -eq 0 ] && exit -} - -config_load samba4 -config_foreach chk_en samba4 - -device=`basename $DEVPATH` - -case "$ACTION" in - add) - - case "$device" in - sd*);; - md*);; - hd*);; - mmcblk*);; - *) return;; - esac - - path="/dev/$device" - - wait_for_init - - cat /proc/mounts | grep -v '/boot\|/opt' | while read j - do - str=${j%% *} - if [ "$str" == $path ];then - strr=${j#* } - target=${strr%% *} - global=0 - config_foreach smb_handle sambashare $target - name=${target#*/mnt/} - - if [ $global -eq 0 ] ;then - echo -e "\n\nconfig sambashare" >> $config_file - echo -e "\toption auto '1'" >> $config_file - echo -e "\toption name '$name'" >> $config_file - echo -e "\toption path '$target'" >> $config_file - echo -e "\toption read_only 'no'" >> $config_file - echo -e "\toption guest_ok 'yes'" >> $config_file - echo -e "\toption create_mask '0666'" >> $config_file - echo -e "\toption dir_mask '0777'" >> $config_file - echo -e "\toption device '$device'" >> $config_file - echo -e "\toption inherit_owner 'yes'" >> $config_file - /etc/init.d/samba4 reload - return - fi - fi - done - ;; - - remove) - i=0 - while true - do - dev=`uci get samba4.@sambashare[$i].device` - [ $? -ne 0 ] && break - - [ "$dev" = "$device" ] && { - auto=`uci get samba4.@sambashare[$i].auto` - [ $auto = "1" ] && { - mount_dir=`uci get samba4.@sambashare[$i].name` - uci delete samba4.@sambashare[$i] - uci commit - /etc/init.d/samba4 reload - return - } - } - let i+=1 - done - ;; -esac diff --git a/package/emortal/default-settings/files/99-default-settings-chinese b/package/emortal/default-settings/files/99-default-settings-chinese index d640c6bf02..c0ce551469 100755 --- a/package/emortal/default-settings/files/99-default-settings-chinese +++ b/package/emortal/default-settings/files/99-default-settings-chinese @@ -9,7 +9,7 @@ if ! uci -q get system.@imm_init[0].system_chn > "/dev/null"; then delete system.ntp.server add_list system.ntp.server="ntp.tencent.com" - add_list system.ntp.server="ntp1.aliyun.com" + add_list system.ntp.server="ntp.aliyun.com" add_list system.ntp.server="ntp.ntsc.ac.cn" add_list system.ntp.server="cn.ntp.org.cn" diff --git a/package/emortal/luci-app-athena-led/.gitignore b/package/emortal/luci-app-athena-led/.gitignore new file mode 100644 index 0000000000..bef8d11bbc --- /dev/null +++ b/package/emortal/luci-app-athena-led/.gitignore @@ -0,0 +1,36 @@ +# 忽略编译生成的文件 +*.o +*.so +*.a + +# LuCI 的生成文件和缓存 +build/ +bin/ +.tmp/ + +# 忽略 OpenWrt 编译生成的安装包 +*.ipk +*.tar.gz +*.deb + +# 忽略临时文件和编辑器缓存 +*.swp +*.swo +*.bak +*.tmp +*.log +.DS_Store + +# 忽略 Git 操作时产生的临时文件 +.git/ + +# IDE 配置文件 +.vscode/ +.idea/ + +# 忽略 Makefile 生成的中间文件 +/feeds +/staging_dir +/tmp/ +config.log +config.status diff --git a/package/emortal/luci-app-athena-led/.latest_commit b/package/emortal/luci-app-athena-led/.latest_commit new file mode 100644 index 0000000000..704f156e13 --- /dev/null +++ b/package/emortal/luci-app-athena-led/.latest_commit @@ -0,0 +1 @@ +f8eeb311 diff --git a/package/emortal/luci-app-athena-led/Makefile b/package/emortal/luci-app-athena-led/Makefile new file mode 100644 index 0000000000..5f5dfcf48c --- /dev/null +++ b/package/emortal/luci-app-athena-led/Makefile @@ -0,0 +1,43 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=luci-app-athena-led +PKG_DEPENDS:= +PKG_VERSION:=0.0.7 +PKG_RELEASE:=20241029 + +LUCI_TITLE:=LuCI Support for athena-led +LUCI_DEPENDS:= + +include $(INCLUDE_DIR)/package.mk + +# 包定义;指示我们的包将如何以及在哪里出现在整体配置菜单中 ('make menuconfig') +define Package/$(PKG_NAME) + TITLE:=$(PKG_NAME) +endef + +# Package description; a more verbose description on what our package does +define Package/$(PKG_NAME)/description + LuCI support for athenaLed +endef + + +define Package/$(PKG_NAME)/install + $(INSTALL_DIR) $(1)/usr/lib/lua/luci + cp -pR ./luasrc/* $(1)/usr/lib/lua/luci + $(INSTALL_DIR) $(1)/ + cp -pR ./root/* $(1)/ +endef + +define Package/$(PKG_NAME)/postinst +#!/bin/sh + chmod +x /usr/sbin/athena-led + chmod +x /etc/init.d/athena_led +exit 0 +endef + +include $(TOPDIR)/feeds/luci/luci.mk + +# This command is always the last, it uses the definitions and variables we give above in order to get the job done +$(eval $(call BuildPackage,$(PKG_NAME))) + + diff --git a/package/emortal/luci-app-athena-led/README.md b/package/emortal/luci-app-athena-led/README.md new file mode 100644 index 0000000000..ab879195e9 --- /dev/null +++ b/package/emortal/luci-app-athena-led/README.md @@ -0,0 +1,21 @@ +# luci-app-athena-led +jdCloud ax6600 led screen ctrl + +#### 定时关闭开启代码 + +``` +# 早上9点30开启显示 +30 9 * * * uci set athena_led.config.enable='1' && uci commit athena_led && /etc/init.d/athena_led reload +# 下午6点30关闭显示 +30 18 * * * uci set athena_led.config.enable='0' && uci commit athena_led && /etc/init.d/athena_led reload +``` + +[推荐固件下载地址](https://github.com/VIKINGYFY/OpenWRT-CI/releases) + + +![image](https://github.com/user-attachments/assets/a2bcf6af-4e29-49d4-b183-799f68b74efb) + + + +感谢以下朋友的捐赠 +1. *姆 diff --git a/package/emortal/luci-app-athena-led/luasrc/controller/athena_led.lua b/package/emortal/luci-app-athena-led/luasrc/controller/athena_led.lua new file mode 100644 index 0000000000..af3b2aff80 --- /dev/null +++ b/package/emortal/luci-app-athena-led/luasrc/controller/athena_led.lua @@ -0,0 +1,18 @@ +module("luci.controller.athena_led", package.seeall) + +function index() + if not nixio.fs.access("/etc/config/athena_led") then + return + end + entry({ "admin", "system", "athena_led" }, firstchild(), _("Athena LED Ctrl"), 80).dependent = false + entry({ "admin", "system", "athena_led", "general" }, cbi("athena_led/settings"), _("Base Setting"), 1) + + entry({ "admin", "system", "athena_led", "status" }, call("act_status")) +end + +function act_status() + local e = {} + e.running = luci.sys.call("pgrep /usr/sbin/athena-led >/dev/null") == 0 + luci.http.prepare_content("application/json") + luci.http.write_json(e) +end \ No newline at end of file diff --git a/package/emortal/luci-app-athena-led/luasrc/model/cbi/athena_led/settings.lua b/package/emortal/luci-app-athena-led/luasrc/model/cbi/athena_led/settings.lua new file mode 100644 index 0000000000..3607cb10a2 --- /dev/null +++ b/package/emortal/luci-app-athena-led/luasrc/model/cbi/athena_led/settings.lua @@ -0,0 +1,84 @@ +m = Map("athena_led", translate("Athena led Ctrl"), translate("JDCloud AX6600 LED Screen Ctrl")) + +m:section(SimpleSection).template = "athena_led/athena_led_status" + +s = m:section(TypedSection, "athena_led") +s.addremove = false +s.anonymous = true + +enable = s:option(Flag, "enable", translate("Enabled")) +enable.rmempty = false + +seconds = s:option(ListValue, "seconds", translate("Display interval time")) +seconds.default = "5" +seconds.rmempty = false +seconds:value("1") +seconds:value("2") +seconds:value("3") +seconds:value("4") +seconds:value("5") +seconds.description = translate("Enable carousel display and set interval time in seconds") + +seconds = s:option(ListValue, "lightLevel", translate("Display light level")) +seconds.default = "5" +seconds.rmempty = false +seconds:value("0") +seconds:value("1") +seconds:value("2") +seconds:value("3") +seconds:value("4") +seconds:value("5") +seconds:value("6") +seconds:value("7") +seconds.description = translate("Display light level desc") + +status = s:option(MultiValue, "status", translate("side led status")) +status.default = "" +status.rmempty = true +status:value("time", translate("status time")) +status:value("medal", translate("status medal")) +status:value("upload", translate("status upload")) +status:value("download", translate("status download")) +status.description = translate("side led status desc") + +type = s:option(MultiValue, "option", translate("Display Type")) +type.default = "date timeBlink" +type.rmempty = false +type:value("date", translate("Display Type Date")) +type:value("time", translate("Display Type Time")) +type:value("timeBlink", translate("Display Type Time Blink")) +type:value("temp", translate("Display Type temp")) +type:value("string", translate("Display Type String")) +type:value("getByUrl", translate("Display Type getByUrl")) +type.description = translate("Specify comma-separated values for option") + +customValue = s:option(Value, "value", translate("Custom Value")) +customValue.default = "abcdefghijklmnopqrstuvwxyz0123456789+-*/=.::℃" +customValue.rmempty = false +customValue.placeholder = translate("Enter your message here") +customValue.description = translate("Set the custom message to display on the LED screen, Only effective on 'Display Type String'") + +url = s:option(Value, "url", translate("api url for get content")) +url.default = "http://www.baidu.com" +url.rmempty = false +url.placeholder = translate("Enter your api url here") +url.description = translate("api url for get content des") + +tempFlag = s:option(MultiValue, "tempFlag", translate("tempFlag")) +tempFlag.default = "4" +tempFlag.rmempty = false +tempFlag:value("0", translate("nss-top")) +tempFlag:value("1", translate("nss")) +tempFlag:value("2", translate("wcss-phya0")) +tempFlag:value("3", translate("wcss-phya1")) +tempFlag:value("4", translate("cpu")) +tempFlag:value("5", translate("lpass")) +tempFlag:value("6", translate("ddrss")) +tempFlag.description = translate("Set the item display on the LED screen, Only effective on 'Display Type temp'") + +function m.on_after_commit(self) + local output = luci.util.exec("/etc/init.d/athena_led reload >/dev/null 2>&1") + luci.util.exec("logger '" .. output .. "'") +end + +return m diff --git a/package/emortal/luci-app-athena-led/luasrc/view/athena_led/athena_led_status.htm b/package/emortal/luci-app-athena-led/luasrc/view/athena_led/athena_led_status.htm new file mode 100644 index 0000000000..ed8cf7209a --- /dev/null +++ b/package/emortal/luci-app-athena-led/luasrc/view/athena_led/athena_led_status.htm @@ -0,0 +1,25 @@ + + +
+

+ <%:Collecting data...%> +

+
diff --git a/package/emortal/luci-app-athena-led/po/zh-cn/athena_led.po b/package/emortal/luci-app-athena-led/po/zh-cn/athena_led.po new file mode 100644 index 0000000000..2f0521a13b --- /dev/null +++ b/package/emortal/luci-app-athena-led/po/zh-cn/athena_led.po @@ -0,0 +1,124 @@ +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8" + +msgid "athena_led" +msgstr "athena_led" + +msgid "Base Setting" +msgstr "设置" + +msgid "Gift" +msgstr "赞赏" + +msgid "Athena LED Ctrl" +msgstr "雅典娜 LED 屏幕控制" + +msgid "JDCloud AX6600 LED Screen Ctrl" +msgstr "京东云 AX6600 LED 屏幕控制" + +msgid "Enabled" +msgstr "启用" + +msgid "Display interval time" +msgstr "刷新时间" + +msgid "Enable carousel display and set interval time in seconds" +msgstr "刷新时间" + +msgid "Display light level" +msgstr "显示亮度调整" + +msgid "Display light level desc" +msgstr "显示亮度调整,数字越大越亮" + +msgid "side led status" +msgstr "侧边状态灯" + +msgid "status time" +msgstr "时间" + +msgid "status medal" +msgstr "奖牌" + +msgid "status upload" +msgstr "上传" + +msgid "status download" +msgstr "下载" + +msgid "side led status desc" +msgstr "设置侧边状态灯" + + +msgid "Display Type" +msgstr "显示模式" + +msgid "Display Type Date" +msgstr "日期" + +msgid "Display Type Time" +msgstr "时间" + +msgid "Display Type Time Blink" +msgstr "时间-闪烁" + +msgid "Display Type temp" +msgstr "温度" + +msgid "Display Type String" +msgstr "自定义文本" + +msgid "Display Type getByUrl" +msgstr "远程文本" + + +msgid "Specify comma-separated values for option" +msgstr "显示模式" + +msgid "Custom Value" +msgstr "自定义文本" + +msgid "Enter your message here" +msgstr "输入你的自定义内容" + +msgid "Set the custom message to display on the LED screen, Only effective on 'Display Type String'" +msgstr "设置显示在led屏幕上的自定义内容,选中'自定义文本'显示模式生效" + +msgid "api url for get content" +msgstr "通过 http/get 请求获取显示内容" + +msgid "Enter your api url here" +msgstr "在此处输入你的接口地址" + +msgid "api url for get content des" +msgstr "通过 http/get 请求获取显示内容,选中'远程文本'显示模式生效" + +msgid "All features are free, and tipping is just to buy me a coffee." +msgstr "所有功能都免费,打赏只是为了请我喝咖啡" + +msgid "tempFlag" +msgstr "温度选项" + +msgid "nss-top" +msgstr "网络子系统nss-top" + +msgid "nss" +msgstr "网络子系统nss" + +msgid "wcss-phya0" +msgstr "无线控制子系统-物理0" + +msgid "wcss-phya1" +msgstr "无线控制子系统-物理1" + +msgid "cpu" +msgstr "中央处理器cpu" + +msgid "lpass" +msgstr "lpass" + +msgid "ddrss" +msgstr "内存子系统ddr" + +msgid "Set the item display on the LED screen, Only effective on 'Display Type temp'" +msgstr "设置显示在led屏幕上的温度,选中'温度'显示模式生效" \ No newline at end of file diff --git a/package/emortal/luci-app-athena-led/po/zh_Hans/athena_led.po b/package/emortal/luci-app-athena-led/po/zh_Hans/athena_led.po new file mode 100644 index 0000000000..2f0521a13b --- /dev/null +++ b/package/emortal/luci-app-athena-led/po/zh_Hans/athena_led.po @@ -0,0 +1,124 @@ +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8" + +msgid "athena_led" +msgstr "athena_led" + +msgid "Base Setting" +msgstr "设置" + +msgid "Gift" +msgstr "赞赏" + +msgid "Athena LED Ctrl" +msgstr "雅典娜 LED 屏幕控制" + +msgid "JDCloud AX6600 LED Screen Ctrl" +msgstr "京东云 AX6600 LED 屏幕控制" + +msgid "Enabled" +msgstr "启用" + +msgid "Display interval time" +msgstr "刷新时间" + +msgid "Enable carousel display and set interval time in seconds" +msgstr "刷新时间" + +msgid "Display light level" +msgstr "显示亮度调整" + +msgid "Display light level desc" +msgstr "显示亮度调整,数字越大越亮" + +msgid "side led status" +msgstr "侧边状态灯" + +msgid "status time" +msgstr "时间" + +msgid "status medal" +msgstr "奖牌" + +msgid "status upload" +msgstr "上传" + +msgid "status download" +msgstr "下载" + +msgid "side led status desc" +msgstr "设置侧边状态灯" + + +msgid "Display Type" +msgstr "显示模式" + +msgid "Display Type Date" +msgstr "日期" + +msgid "Display Type Time" +msgstr "时间" + +msgid "Display Type Time Blink" +msgstr "时间-闪烁" + +msgid "Display Type temp" +msgstr "温度" + +msgid "Display Type String" +msgstr "自定义文本" + +msgid "Display Type getByUrl" +msgstr "远程文本" + + +msgid "Specify comma-separated values for option" +msgstr "显示模式" + +msgid "Custom Value" +msgstr "自定义文本" + +msgid "Enter your message here" +msgstr "输入你的自定义内容" + +msgid "Set the custom message to display on the LED screen, Only effective on 'Display Type String'" +msgstr "设置显示在led屏幕上的自定义内容,选中'自定义文本'显示模式生效" + +msgid "api url for get content" +msgstr "通过 http/get 请求获取显示内容" + +msgid "Enter your api url here" +msgstr "在此处输入你的接口地址" + +msgid "api url for get content des" +msgstr "通过 http/get 请求获取显示内容,选中'远程文本'显示模式生效" + +msgid "All features are free, and tipping is just to buy me a coffee." +msgstr "所有功能都免费,打赏只是为了请我喝咖啡" + +msgid "tempFlag" +msgstr "温度选项" + +msgid "nss-top" +msgstr "网络子系统nss-top" + +msgid "nss" +msgstr "网络子系统nss" + +msgid "wcss-phya0" +msgstr "无线控制子系统-物理0" + +msgid "wcss-phya1" +msgstr "无线控制子系统-物理1" + +msgid "cpu" +msgstr "中央处理器cpu" + +msgid "lpass" +msgstr "lpass" + +msgid "ddrss" +msgstr "内存子系统ddr" + +msgid "Set the item display on the LED screen, Only effective on 'Display Type temp'" +msgstr "设置显示在led屏幕上的温度,选中'温度'显示模式生效" \ No newline at end of file diff --git a/package/emortal/luci-app-athena-led/root/etc/config/athena_led b/package/emortal/luci-app-athena-led/root/etc/config/athena_led new file mode 100644 index 0000000000..499beba2cf --- /dev/null +++ b/package/emortal/luci-app-athena-led/root/etc/config/athena_led @@ -0,0 +1,9 @@ +config athena_led 'config' +option enable '1' +option status ' ' +option seconds '5' +option lightLevel '5' +option option 'date timeBlink' +option value 'abcdefghijklmnopqrstuvwxyz0123456789+-*/=.::℃' +option url 'https://www.baidu.com' +option tempFlag '4' diff --git a/package/emortal/luci-app-athena-led/root/etc/init.d/athena_led b/package/emortal/luci-app-athena-led/root/etc/init.d/athena_led new file mode 100755 index 0000000000..5195413ab6 --- /dev/null +++ b/package/emortal/luci-app-athena-led/root/etc/init.d/athena_led @@ -0,0 +1,42 @@ +#!/bin/sh /etc/rc.common + +START=99 +STOP=99 +USE_PROCD=1 +PROG=/usr/sbin/athena-led + +start_service() { + config_load 'athena_led' + local cfg='config' + + config_get_bool enabled "$cfg" 'enable' '0' + if [ "$enabled" -eq 0 ]; then + logger "athena-led Service is disabled, not starting" + return 1 + fi + + local status seconds lightLevel option value + config_get status $cfg 'status' ' ' + config_get seconds $cfg 'seconds' '5' + config_get lightLevel $cfg 'lightLevel' '5' + config_get option $cfg 'option' 'date timeBlink' + config_get value $cfg 'value' 'abcdefghijklmnopqrstuvwxyz0123456789+-*/=.::℃' + config_get url $cfg 'url' 'https://www.baidu.com' + config_get tempFlag $cfg 'tempFlag' '4' + + procd_open_instance + procd_set_param command $PROG -status "${status}" -seconds "${seconds}" -lightLevel "${lightLevel}" -option "${option}" -value "${value}" -url "${url}" -tempFlag "${tempFlag}" + procd_set_param respawn + procd_close_instance + +} + +service_triggers(){ + procd_add_reload_trigger "athena_led" +} + +reload_service() +{ + stop + start +} diff --git a/package/emortal/luci-app-athena-led/root/usr/sbin/athena-led b/package/emortal/luci-app-athena-led/root/usr/sbin/athena-led new file mode 100755 index 0000000000..d828f72269 Binary files /dev/null and b/package/emortal/luci-app-athena-led/root/usr/sbin/athena-led differ diff --git a/package/firmware/armbian-firmware/Makefile b/package/firmware/armbian-firmware/Makefile index aea6d355ce..252f8bf0d1 100644 --- a/package/firmware/armbian-firmware/Makefile +++ b/package/firmware/armbian-firmware/Makefile @@ -141,3 +141,30 @@ define Package/brcmfmac-nvram-43752-sdio/install $(1)/lib/firmware/brcm/brcmfmac43752-sdio.firefly,rk3568-roc-pc.txt endef $(eval $(call BuildPackage,brcmfmac-nvram-43752-sdio)) + +Package/brcmfmac-firmware-43430b0-sdio = $(call Package/armbian-firmware-default,Broadcom BCM43430B0 FullMac SDIO firmware) +define Package/brcmfmac-firmware-43430b0-sdio/install + $(INSTALL_DIR) $(1)/lib/firmware/brcm + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/brcm/BCM43430B0.hcd \ + $(1)/lib/firmware/brcm/ + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/brcm/brcmfmac43430b0-sdio.bin \ + $(1)/lib/firmware/brcm/ + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/brcm/brcmfmac43430-sdio.clm_blob \ + $(1)/lib/firmware/brcm/ +endef +$(eval $(call BuildPackage,brcmfmac-firmware-43430b0-sdio)) + +Package/brcmfmac-nvram-43430b0-sdio = $(call Package/armbian-firmware-default,Broadcom BCM43430B0 SDIO NVRAM firmware) +define Package/brcmfmac-nvram-43430b0-sdio/install + $(INSTALL_DIR) $(1)/lib/firmware/brcm + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/brcm/brcmfmac43430b0-sdio.txt \ + $(1)/lib/firmware/brcm/ + $(LN) \ + brcmfmac43430b0-sdio.txt \ + $(1)/lib/firmware/brcm/brcmfmac43430b0-sdio.rumu3f,fine-3399.txt +endef +$(eval $(call BuildPackage,brcmfmac-nvram-43430b0-sdio)) diff --git a/package/firmware/ath11k-firmware/Makefile b/package/firmware/ath11k-firmware/Makefile index a333d1b154..8ee9ba7d8d 100644 --- a/package/firmware/ath11k-firmware/Makefile +++ b/package/firmware/ath11k-firmware/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ath11k-firmware -PKG_SOURCE_DATE:=2024-10-14 -PKG_SOURCE_VERSION:=15f050122da5ef5bef2cc8c7c19dfb7f98060a49 -PKG_MIRROR_HASH:=e7a89d1570f32552ade539376181494724b5eafb31d00451ff2dcf5a2922a0cb +PKG_SOURCE_DATE:=2025-02-20 +PKG_SOURCE_VERSION:=0407f7b00b4efd79a16a9481b6bfb6292888a52e +PKG_MIRROR_HASH:=6b03d8bd7ac37765e055f7d6ee41867ee8c4d3e9825f907e5663ffa9b5e3fcaa PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git -PKG_SOURCE_URL:=https://git.codelinaro.org/clo/ath-firmware/ath11k-firmware.git +PKG_SOURCE_URL:=https://github.com/VIKINGYFY/ath11k-firmware-ddwrt.git PKG_LICENSE_FILES:=LICENSE.qca_firmware @@ -25,21 +25,6 @@ include $(INCLUDE_DIR)/package.mk RSTRIP:=: STRIP:=: -ATH11K_LEGACY_FW_NAME:=ath11k-legacy-firmware -ATH11K_LEGACY_FW_DATE:=2024-03-14 -ATH11K_LEGACY_FW_RELEASE:=795809c7 -ATH11K_LEGACY_FW_SUBDIR:=$(ATH11K_LEGACY_FW_NAME)-$(ATH11K_LEGACY_FW_DATE)~$(ATH11K_LEGACY_FW_RELEASE) -ATH11K_LEGACY_FW_SOURCE=$(ATH11K_LEGACY_FW_SUBDIR).tar.zst - -define Download/$(ATH11K_LEGACY_FW_NAME) - FILE:=$(ATH11K_LEGACY_FW_SOURCE) - PROTO:=git - URL:=https://github.com/quic/upstream-wifi-fw.git - SOURCE_VERSION:=795809c7041582bd51bdfaa1f548b916ae8d4382 - MIRROR_HASH:=e042024b6762a5b4fe56f1a5bf8870df2e7abcca90ec22103cd46a609bee7cec - SUBDIR:=$(ATH11K_LEGACY_FW_SUBDIR) -endef - define Package/ath11k-firmware-default SECTION:=firmware CATEGORY:=Firmware @@ -73,60 +58,33 @@ $(Package/ath11k-firmware-default) TITLE:=QCN9074 ath11k firmware endef -define Build/Clean - $(call Build/Clean/Default,) - - rm -rf \ - $(BUILD_DIR)/$(ATH11K_LEGACY_FW_SUBDIR) -endef - -define Build/Prepare - $(eval $(call Download,ath11k-legacy-firmware)) - - $(call Build/Prepare/Default,) - - $(TAR) -C $(BUILD_DIR) -xf $(DL_DIR)/$(ATH11K_LEGACY_FW_SOURCE) -endef - define Build/Compile endef define Package/ath11k-firmware-ipq5018/install $(INSTALL_DIR) $(1)/lib/firmware/ath11k/IPQ5018/hw1.0 - $(INSTALL_DATA) \ - $(BUILD_DIR)/$(ATH11K_LEGACY_FW_SUBDIR)/ath11k-firmware/IPQ5018_QCN6122_QCN6122/hw1.0/2.7.0.1/WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1/*.* \ - $(1)/lib/firmware/ath11k/IPQ5018/hw1.0/ + $(INSTALL_DATA) $(PKG_BUILD_DIR)/IPQ5018/hw1.0/* $(1)/lib/firmware/ath11k/IPQ5018/hw1.0/ endef define Package/ath11k-firmware-ipq6018/install $(INSTALL_DIR) $(1)/lib/firmware/IPQ6018 - $(INSTALL_DATA) \ - $(PKG_BUILD_DIR)/IPQ6018/hw1.0/2.5.0.1/WLAN.HK.2.5.0.1-03982-QCAHKSWPL_SILICONZ-3/* \ - $(1)/lib/firmware/IPQ6018/ + $(INSTALL_DATA) $(PKG_BUILD_DIR)/IPQ6018/hw1.0/* $(1)/lib/firmware/IPQ6018/ endef define Package/ath11k-firmware-ipq8074/install $(INSTALL_DIR) $(1)/lib/firmware/IPQ8074 - $(INSTALL_DATA) \ - $(PKG_BUILD_DIR)/IPQ8074/hw2.0/2.9.0.1/WLAN.HK.2.9.0.1-02146-QCAHKSWPL_SILICONZ-1/* \ - $(1)/lib/firmware/IPQ8074/ + $(INSTALL_DATA) $(PKG_BUILD_DIR)/IPQ8074/hw2.0/* $(1)/lib/firmware/IPQ8074/ endef define Package/ath11k-firmware-qcn6122/install $(INSTALL_DIR) $(1)/lib/firmware/ath11k/QCN6122/hw1.0 - $(INSTALL_DATA) \ - $(BUILD_DIR)/$(ATH11K_LEGACY_FW_SUBDIR)/ath11k-firmware/IPQ5018_QCN6122_QCN6122/hw1.0/2.7.0.1/WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1/qcn6122/* \ - $(1)/lib/firmware/ath11k/QCN6122/hw1.0/ + $(INSTALL_DATA) $(PKG_BUILD_DIR)/QCN6122/hw1.0/* $(1)/lib/firmware/ath11k/QCN6122/hw1.0/ endef define Package/ath11k-firmware-qcn9074/install $(INSTALL_DIR) $(1)/lib/firmware/ath11k/QCN9074/hw1.0 - $(INSTALL_DATA) \ - $(PKG_BUILD_DIR)/QCN9074/hw1.0/2.9.0.1/WLAN.HK.2.9.0.1-02146-QCAHKSWPL_SILICONZ-1/* \ - $(1)/lib/firmware/ath11k/QCN9074/hw1.0/ - $(INSTALL_BIN) \ - $(PKG_BUILD_DIR)/QCN9074/hw1.0/board-2.bin $(1)/lib/firmware/ath11k/QCN9074/hw1.0/board-2.bin + $(INSTALL_DATA) $(PKG_BUILD_DIR)/QCN9074/hw1.0/* $(1)/lib/firmware/ath11k/QCN9074/hw1.0/ endef $(eval $(call BuildPackage,ath11k-firmware-ipq5018)) diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index deeda4955e..59e0c5c5d2 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -73,7 +73,19 @@ ALLWIFIBOARDS:= \ zte_mf269 \ zte_mf287 \ zte_mf287plus \ - zyxel_nbg7815 + zyxel_nbg7815 \ + cmiot_ax18 \ + glinet_gl-ax1800 \ + glinet_gl-axt1800 \ + jdcloud_re-ss-01 \ + jdcloud_re-cs-02 \ + jdcloud_re-cs-03 \ + link_nn6000 \ + redmi_ax5 \ + redmi_ax5-jdcloud \ + verizon_cr1000a \ + xiaomi_ax1800 \ + zn_m2 ALLWIFIPACKAGES:=$(foreach BOARD,$(ALLWIFIBOARDS),ipq-wifi-$(BOARD)) @@ -214,5 +226,17 @@ $(eval $(call generate-ipq-wifi-package,zte_mf269,ZTE MF269)) $(eval $(call generate-ipq-wifi-package,zte_mf287,ZTE MF287)) $(eval $(call generate-ipq-wifi-package,zte_mf287plus,ZTE MF287Plus)) $(eval $(call generate-ipq-wifi-package,zyxel_nbg7815,Zyxel NBG7815)) +$(eval $(call generate-ipq-wifi-package,cmiot_ax18,CMIOT AX18)) +$(eval $(call generate-ipq-wifi-package,glinet_gl-ax1800,GL.iNet GL-AX1800)) +$(eval $(call generate-ipq-wifi-package,glinet_gl-axt1800,GL.iNet GL-AXT1800)) +$(eval $(call generate-ipq-wifi-package,jdcloud_re-ss-01,JDCloud RE-SS-01)) +$(eval $(call generate-ipq-wifi-package,jdcloud_re-cs-02,JDCloud RE-CS-02)) +$(eval $(call generate-ipq-wifi-package,jdcloud_re-cs-03,JDCloud RE-CS-03)) +$(eval $(call generate-ipq-wifi-package,link_nn6000,Link NN6000)) +$(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,verizon_cr1000a,Verizon CR1000A)) +$(eval $(call generate-ipq-wifi-package,xiaomi_ax1800,Xiaomi AX1800)) +$(eval $(call generate-ipq-wifi-package,zn_m2,ZN M2)) $(foreach PACKAGE,$(ALLWIFIPACKAGES),$(eval $(call BuildPackage,$(PACKAGE)))) diff --git a/package/firmware/ipq-wifi/src/board-cmiot_ax18.ipq6018 b/package/firmware/ipq-wifi/src/board-cmiot_ax18.ipq6018 new file mode 100644 index 0000000000..acba41421a Binary files /dev/null and b/package/firmware/ipq-wifi/src/board-cmiot_ax18.ipq6018 differ diff --git a/package/firmware/ipq-wifi/src/board-jdcloud_re-cs-02.ipq6018 b/package/firmware/ipq-wifi/src/board-jdcloud_re-cs-02.ipq6018 new file mode 100644 index 0000000000..65bcb3b3d0 Binary files /dev/null and b/package/firmware/ipq-wifi/src/board-jdcloud_re-cs-02.ipq6018 differ diff --git a/package/firmware/ipq-wifi/src/board-jdcloud_re-cs-02.qcn9074 b/package/firmware/ipq-wifi/src/board-jdcloud_re-cs-02.qcn9074 new file mode 100644 index 0000000000..618048550e Binary files /dev/null and b/package/firmware/ipq-wifi/src/board-jdcloud_re-cs-02.qcn9074 differ diff --git a/package/firmware/ipq-wifi/src/board-jdcloud_re-cs-03.ipq5018 b/package/firmware/ipq-wifi/src/board-jdcloud_re-cs-03.ipq5018 new file mode 100644 index 0000000000..b6d095e8cc Binary files /dev/null and b/package/firmware/ipq-wifi/src/board-jdcloud_re-cs-03.ipq5018 differ diff --git a/package/firmware/ipq-wifi/src/board-jdcloud_re-cs-03.qcn6122 b/package/firmware/ipq-wifi/src/board-jdcloud_re-cs-03.qcn6122 new file mode 100644 index 0000000000..e6abb10b21 Binary files /dev/null and b/package/firmware/ipq-wifi/src/board-jdcloud_re-cs-03.qcn6122 differ diff --git a/package/firmware/ipq-wifi/src/board-jdcloud_re-ss-01.ipq6018 b/package/firmware/ipq-wifi/src/board-jdcloud_re-ss-01.ipq6018 new file mode 100644 index 0000000000..d46f5ae96b Binary files /dev/null and b/package/firmware/ipq-wifi/src/board-jdcloud_re-ss-01.ipq6018 differ diff --git a/package/firmware/ipq-wifi/src/board-link_nn6000.ipq6018 b/package/firmware/ipq-wifi/src/board-link_nn6000.ipq6018 new file mode 100644 index 0000000000..bd5fd09d91 Binary files /dev/null and b/package/firmware/ipq-wifi/src/board-link_nn6000.ipq6018 differ diff --git a/package/firmware/ipq-wifi/src/board-redmi_ax5-jdcloud.ipq6018 b/package/firmware/ipq-wifi/src/board-redmi_ax5-jdcloud.ipq6018 new file mode 100644 index 0000000000..21a8ad8a0a Binary files /dev/null and b/package/firmware/ipq-wifi/src/board-redmi_ax5-jdcloud.ipq6018 differ diff --git a/package/firmware/ipq-wifi/src/board-redmi_ax5.ipq6018 b/package/firmware/ipq-wifi/src/board-redmi_ax5.ipq6018 new file mode 100644 index 0000000000..79b28409b9 Binary files /dev/null and b/package/firmware/ipq-wifi/src/board-redmi_ax5.ipq6018 differ diff --git a/package/firmware/ipq-wifi/src/board-verizon_cr1000a.ipq8074 b/package/firmware/ipq-wifi/src/board-verizon_cr1000a.ipq8074 new file mode 100644 index 0000000000..3739e91d47 Binary files /dev/null and b/package/firmware/ipq-wifi/src/board-verizon_cr1000a.ipq8074 differ diff --git a/package/firmware/ipq-wifi/src/board-xiaomi_ax1800.ipq6018 b/package/firmware/ipq-wifi/src/board-xiaomi_ax1800.ipq6018 new file mode 100644 index 0000000000..2599312d27 Binary files /dev/null and b/package/firmware/ipq-wifi/src/board-xiaomi_ax1800.ipq6018 differ diff --git a/package/firmware/ipq-wifi/src/board-zn_m2.ipq6018 b/package/firmware/ipq-wifi/src/board-zn_m2.ipq6018 new file mode 100644 index 0000000000..62a3b33b9c Binary files /dev/null and b/package/firmware/ipq-wifi/src/board-zn_m2.ipq6018 differ diff --git a/package/kernel/ath10k-ct/patches/999-001-fix-ath10k_update_vif_offload.patch b/package/kernel/ath10k-ct/patches/999-001-fix-ath10k_update_vif_offload.patch new file mode 100644 index 0000000000..98c6459a92 --- /dev/null +++ b/package/kernel/ath10k-ct/patches/999-001-fix-ath10k_update_vif_offload.patch @@ -0,0 +1,20 @@ +--- a/ath10k-6.10/mac.c ++++ b/ath10k-6.10/mac.c +@@ -6365,7 +6365,7 @@ static int ath10k_mac_set_txbf_conf(stru + ar->wmi.vdev_param->txbf, value); + } + +-static void ath10k_update_vif_offload(struct ieee80211_hw *hw, ++static int ath10k_update_vif_offload(struct ieee80211_hw *hw, + struct ieee80211_vif *vif) + { + struct ath10k_vif *arvif = (void *)vif->drv_priv; +@@ -6387,6 +6387,8 @@ static void ath10k_update_vif_offload(st + ath10k_warn(ar, "failed to set vdev %i TX encapsulation: %d\n", + arvif->vdev_id, ret); + } ++ ++ return ret; + } + + /* diff --git a/package/kernel/ath10k-ct/patches/999-800-ath10k-Add-threaded-napi.patch b/package/kernel/ath10k-ct/patches/999-800-ath10k-Add-threaded-napi.patch new file mode 100644 index 0000000000..e2eff29bb4 --- /dev/null +++ b/package/kernel/ath10k-ct/patches/999-800-ath10k-Add-threaded-napi.patch @@ -0,0 +1,33 @@ +--- a/ath10k-6.10/pci.c ++++ b/ath10k-6.10/pci.c +@@ -2285,6 +2285,7 @@ static int ath10k_pci_hif_start(struct a + + ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot hif start\n"); + ++ dev_set_threaded(ar->napi_dev, true); + ath10k_core_napi_enable(ar); + + ath10k_pci_irq_enable(ar); +--- a/ath10k-6.10/sdio.c ++++ b/ath10k-6.10/sdio.c +@@ -1863,6 +1863,7 @@ static int ath10k_sdio_hif_start(struct + struct ath10k_sdio *ar_sdio = ath10k_sdio_priv(ar); + int ret; + ++ dev_set_threaded(&ar->napi_dev, true); + ath10k_core_napi_enable(ar); + + /* Sleep 20 ms before HIF interrupts are disabled. +--- a/ath10k-6.10/core.c ++++ b/ath10k-6.10/core.c +@@ -4576,6 +4576,10 @@ struct ath10k *ath10k_core_create(size_t + if (!ar->napi_dev) + goto err_free_tx_complete; + ++ snprintf(ar->napi_dev->name, sizeof(ar->napi_dev->name), "ath10k_%s", ++ wiphy_name(ar->hw->wiphy)); ++ dev_set_threaded(ar->napi_dev, true); ++ + ret = ath10k_coredump_create(ar); + if (ret) + goto err_free_netdev; diff --git a/package/kernel/cryptodev-linux/Makefile b/package/kernel/cryptodev-linux/Makefile index 165cc60487..751cf9b81d 100644 --- a/package/kernel/cryptodev-linux/Makefile +++ b/package/kernel/cryptodev-linux/Makefile @@ -41,13 +41,22 @@ define KernelPackage/cryptodev/description via a "/dev/crypto" device. endef +ifneq ($(CONFIG_PACKAGE_kmod-crypto-qce),) +EXTRA_CFLAGS+=-DQCA +endif + +ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-crypto),) +EXTRA_CFLAGS+=-DQCANSS +endif + define Build/Configure endef define Build/Compile $(MAKE) -C $(PKG_BUILD_DIR) \ $(KERNEL_MAKE_FLAGS) \ - KERNEL_DIR="$(LINUX_DIR)" + KERNEL_DIR="$(LINUX_DIR)" \ + EXTRA_CFLAGS="$(EXTRA_CFLAGS)" endef define Build/InstallDev diff --git a/package/kernel/linux/modules/crypto.mk b/package/kernel/linux/modules/crypto.mk index 78c9712176..32f43ebd4d 100644 --- a/package/kernel/linux/modules/crypto.mk +++ b/package/kernel/linux/modules/crypto.mk @@ -1193,7 +1193,6 @@ endef $(eval $(call KernelPackage,crypto-xts)) - define KernelPackage/crypto-xxhash TITLE:=xxHash non-cryptographic hash algorithm DEPENDS:=+kmod-crypto-hash +kmod-lib-xxhash @@ -1205,3 +1204,20 @@ endef $(eval $(call KernelPackage,crypto-xxhash)) +define KernelPackage/crypto-qce + TITLE:=QTI Crypto Engine (QCE) + KCONFIG:= \ + CONFIG_CRYPTO_DEV_QCE \ + CONFIG_CRYPTO_DEV_QCE_AEAD=y \ + CONFIG_CRYPTO_DEV_QCE_ENABLE_ALL=y \ + CONFIG_CRYPTO_DEV_QCE_SHA=y \ + CONFIG_CRYPTO_DEV_QCE_SKCIPHER=y \ + CONFIG_CRYPTO_DEV_QCE_SW_MAX_LEN=512 + FILES:= \ + $(LINUX_DIR)/drivers/crypto/qce/qcrypto.ko + AUTOLOAD:=$(call AutoLoad,09,qcrypto) + DEPENDS:=@TARGET_qualcommax +kmod-crypto-manager +kmod-crypto-hash +kmod-crypto-des + $(call AddDepends/crypto) +endef + +$(eval $(call KernelPackage,crypto-qce)) diff --git a/package/kernel/linux/modules/netfilter.mk b/package/kernel/linux/modules/netfilter.mk index 96531b1e08..dbe92c14ff 100644 --- a/package/kernel/linux/modules/netfilter.mk +++ b/package/kernel/linux/modules/netfilter.mk @@ -328,6 +328,7 @@ $(eval $(call KernelPackage,ipt-offload)) define KernelPackage/ipt-ipopt TITLE:=Modules for matching/changing IP packet options KCONFIG:=$(KCONFIG_IPT_IPOPT) + DEPENDS:=+PACKAGE_kmod-nf-conntrack:kmod-nf-conntrack FILES:=$(foreach mod,$(IPT_IPOPT-m),$(LINUX_DIR)/net/$(mod).ko) AUTOLOAD:=$(call AutoProbe,$(notdir $(IPT_IPOPT-m))) $(call AddDepends/ipt) diff --git a/package/kernel/mac80211/patches/ath11k/201-wifi-ath11k-Support-setting-bdf-addr-and-caldb-addr-.patch b/package/kernel/mac80211/patches/ath11k/201-wifi-ath11k-Support-setting-bdf-addr-and-caldb-addr-.patch index 109daf02f2..81aee57546 100644 --- a/package/kernel/mac80211/patches/ath11k/201-wifi-ath11k-Support-setting-bdf-addr-and-caldb-addr-.patch +++ b/package/kernel/mac80211/patches/ath11k/201-wifi-ath11k-Support-setting-bdf-addr-and-caldb-addr-.patch @@ -41,7 +41,7 @@ Signed-off-by: Ziyang Huang } } else { ab->qmi.target_mem[idx].paddr = 0; -@@ -2292,6 +2296,7 @@ static int ath11k_qmi_load_file_target_m +@@ -2295,6 +2299,7 @@ static int ath11k_qmi_load_file_target_m struct qmi_wlanfw_bdf_download_resp_msg_v01 resp; struct qmi_txn txn; const u8 *temp = data; @@ -49,7 +49,7 @@ Signed-off-by: Ziyang Huang void __iomem *bdf_addr = NULL; int ret = 0; u32 remaining = len; -@@ -2303,7 +2308,9 @@ static int ath11k_qmi_load_file_target_m +@@ -2306,7 +2311,9 @@ static int ath11k_qmi_load_file_target_m memset(&resp, 0, sizeof(resp)); if (ab->hw_params.fixed_bdf_addr) { diff --git a/package/kernel/mac80211/patches/ath11k/923-wifi-ath11k-update-hif_and-pci_ops-for-QCN6122.patch b/package/kernel/mac80211/patches/ath11k/923-wifi-ath11k-update-hif_and-pci_ops-for-QCN6122.patch index 9c9caef4f2..8497c3a8c9 100644 --- a/package/kernel/mac80211/patches/ath11k/923-wifi-ath11k-update-hif_and-pci_ops-for-QCN6122.patch +++ b/package/kernel/mac80211/patches/ath11k/923-wifi-ath11k-update-hif_and-pci_ops-for-QCN6122.patch @@ -91,9 +91,9 @@ Signed-off-by: George Moussalem #endif /* _HIF_H_ */ --- a/drivers/net/wireless/ath/ath11k/qmi.c +++ b/drivers/net/wireless/ath/ath11k/qmi.c -@@ -2184,6 +2184,8 @@ static int ath11k_qmi_request_device_inf - ab->mem = bar_addr_va; - ab->mem_len = resp.bar_size; +@@ -2187,6 +2187,8 @@ static int ath11k_qmi_request_device_inf + if (!ab->hw_params.ce_remap) + ab->mem_ce = ab->mem; + ath11k_hif_config_static_window(ab); + diff --git a/package/kernel/mac80211/patches/ath11k/924-wifi-ath11k-add-multipd-support-for-QCN6122.patch b/package/kernel/mac80211/patches/ath11k/924-wifi-ath11k-add-multipd-support-for-QCN6122.patch index e6170a74e4..5b0c58dd94 100644 --- a/package/kernel/mac80211/patches/ath11k/924-wifi-ath11k-add-multipd-support-for-QCN6122.patch +++ b/package/kernel/mac80211/patches/ath11k/924-wifi-ath11k-add-multipd-support-for-QCN6122.patch @@ -89,7 +89,7 @@ Signed-off-by: George Moussalem /* SMBIOS type containing Board Data File Name Extension */ #define ATH11K_SMBIOS_BDF_EXT_TYPE 0xF8 -@@ -945,6 +948,7 @@ struct ath11k_base { +@@ -951,6 +954,7 @@ struct ath11k_base { struct list_head peers; wait_queue_head_t peer_mapping_wq; u8 mac_addr[ETH_ALEN]; diff --git a/package/kernel/mac80211/patches/ath11k/932-wifi-ath11k-poll-reo-status-ipq5018.patch b/package/kernel/mac80211/patches/ath11k/932-wifi-ath11k-poll-reo-status-ipq5018.patch index d89fb92e22..8cb7bd6b08 100644 --- a/package/kernel/mac80211/patches/ath11k/932-wifi-ath11k-poll-reo-status-ipq5018.patch +++ b/package/kernel/mac80211/patches/ath11k/932-wifi-ath11k-poll-reo-status-ipq5018.patch @@ -132,7 +132,7 @@ Signed-off-by: Sriram R }; /* HTT definitions */ -@@ -1712,5 +1718,6 @@ void ath11k_dp_shadow_init_timer(struct +@@ -1689,5 +1695,6 @@ void ath11k_dp_shadow_init_timer(struct struct ath11k_hp_update_timer *update_timer, u32 interval, u32 ring_id); void ath11k_dp_stop_shadow_timers(struct ath11k_base *ab); diff --git a/package/kernel/mac80211/patches/subsys/334-wifi-cfg80211-pass-net_device-to-.set_monitor_channel.patch b/package/kernel/mac80211/patches/subsys/334-wifi-cfg80211-pass-net_device-to-.set_monitor_channel.patch index ef8a36a9af..626f2facaf 100644 --- a/package/kernel/mac80211/patches/subsys/334-wifi-cfg80211-pass-net_device-to-.set_monitor_channel.patch +++ b/package/kernel/mac80211/patches/subsys/334-wifi-cfg80211-pass-net_device-to-.set_monitor_channel.patch @@ -126,7 +126,7 @@ Signed-off-by: Felix Fietkau } --- a/net/wireless/trace.h +++ b/net/wireless/trace.h -@@ -1318,19 +1318,21 @@ TRACE_EVENT(rdev_libertas_set_mesh_chann +@@ -1322,19 +1322,21 @@ TRACE_EVENT(rdev_libertas_set_mesh_chann ); TRACE_EVENT(rdev_set_monitor_channel, diff --git a/package/kernel/mt76/patches/0001-mt76-allow-VHT-rate-on-2.4GHz.patch b/package/kernel/mt76/patches/0001-mt76-allow-VHT-rate-on-2.4GHz.patch index 1701c6001b..0bd6d636db 100644 --- a/package/kernel/mt76/patches/0001-mt76-allow-VHT-rate-on-2.4GHz.patch +++ b/package/kernel/mt76/patches/0001-mt76-allow-VHT-rate-on-2.4GHz.patch @@ -12,7 +12,7 @@ Signed-off-by: DENG Qingfang --- a/mac80211.c +++ b/mac80211.c -@@ -282,7 +282,7 @@ static void mt76_init_stream_cap(struct +@@ -293,7 +293,7 @@ static void mt76_init_stream_cap(struct void mt76_set_stream_caps(struct mt76_phy *phy, bool vht) { if (phy->cap.has_2ghz) @@ -21,7 +21,7 @@ Signed-off-by: DENG Qingfang if (phy->cap.has_5ghz) mt76_init_stream_cap(phy, &phy->sband_5g.sband, vht); if (phy->cap.has_6ghz) -@@ -349,13 +349,13 @@ mt76_init_sband(struct mt76_phy *phy, st +@@ -360,13 +360,13 @@ mt76_init_sband(struct mt76_phy *phy, st static int mt76_init_sband_2g(struct mt76_phy *phy, struct ieee80211_rate *rates, @@ -37,7 +37,7 @@ Signed-off-by: DENG Qingfang } static int -@@ -508,7 +508,7 @@ int mt76_register_phy(struct mt76_phy *p +@@ -553,7 +553,7 @@ int mt76_register_phy(struct mt76_phy *p return ret; if (phy->cap.has_2ghz) { @@ -46,7 +46,7 @@ Signed-off-by: DENG Qingfang if (ret) return ret; } -@@ -691,7 +691,7 @@ int mt76_register_device(struct mt76_dev +@@ -742,7 +742,7 @@ int mt76_register_device(struct mt76_dev return ret; if (phy->cap.has_2ghz) { diff --git a/package/kernel/nat46/Makefile b/package/kernel/nat46/Makefile index 296ef5a058..bcd0cbd9f6 100644 --- a/package/kernel/nat46/Makefile +++ b/package/kernel/nat46/Makefile @@ -3,15 +3,17 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=nat46 -PKG_MIRROR_HASH:=09b93f31d10030d3b4f326066b544b70b1f60236d0482f27c384ed93b298c0a6 PKG_SOURCE_URL:=https://github.com/ayourtch/nat46.git -PKG_SOURCE_DATE:=2022-09-19 +PKG_SOURCE_DATE:=2024-08-12 PKG_SOURCE_PROTO:=git -PKG_SOURCE_VERSION:=4c5beee236841724219598fabb1edc93d4f08ce5 +PKG_SOURCE_VERSION:=b42c37d5c6dee4593df0fc60b37bc7ec4ee243a4 +PKG_MIRROR_HASH:=2d7bbb6cc22808f7e81d716e6bd7a27d9978fb802496304851946627e21534a5 PKG_MAINTAINER:=Hans Dedecker PKG_LICENSE:=GPL-2.0 +PKG_BUILD_PARALLEL:=1 + include $(INCLUDE_DIR)/package.mk define KernelPackage/nat46 @@ -25,11 +27,17 @@ endef include $(INCLUDE_DIR)/kernel-defaults.mk +define Build/InstallDev + $(INSTALL_DIR) $(STAGING_DIR)/usr/include/nat46 + $(INSTALL_DATA) $(PKG_BUILD_DIR)/nat46/modules/*.h $(STAGING_DIR)/usr/include/nat46/ +endef + define Build/Compile - $(KERNEL_MAKE) M="$(PKG_BUILD_DIR)/nat46/modules" \ + +$(KERNEL_MAKE) M="$(PKG_BUILD_DIR)/nat46/modules" \ MODFLAGS="-DMODULE -mlong-calls" \ EXTRA_CFLAGS="-DNAT46_VERSION=\\\"$(PKG_SOURCE_VERSION)\\\"" \ modules + $(INSTALL_DATA) $(PKG_BUILD_DIR)/nat46/modules/Module.symvers $(PKG_BUILD_DIR)/Module.symvers endef $(eval $(call KernelPackage,nat46)) diff --git a/package/kernel/nat46/patches/101-skb-reset.patch b/package/kernel/nat46/patches/101-skb-reset.patch new file mode 100644 index 0000000000..14cf2d75a0 --- /dev/null +++ b/package/kernel/nat46/patches/101-skb-reset.patch @@ -0,0 +1,30 @@ +Author: Pavithra R +Date: Sun Sep 20 13:33:42 2020 +0530 + +nat46: Add skb_ext_reset to reset skb extensions + +This patch adds support to reset the skb extensions before +resetting the netfilter. Without the change, conntrack +is in invalid state and traffic gets dropped. + +Change-Id: I24ee6fe8a9a9dec09d61d8e716fff587f65e4e4f +Signed-off-by: Pavithra R + +--- a/nat46/modules/nat46-core.c ++++ b/nat46/modules/nat46-core.c +@@ -1710,6 +1710,7 @@ int nat46_ipv6_input(struct sk_buff *old + #if LINUX_VERSION_CODE < KERNEL_VERSION(5,4,0) + nf_reset(new_skb); + #else ++ skb_ext_reset(new_skb); + nf_reset_ct(new_skb); + #endif + +@@ -1936,6 +1937,7 @@ int nat46_ipv4_input(struct sk_buff *old + #if LINUX_VERSION_CODE < KERNEL_VERSION(5,4,0) + nf_reset(new_skb); + #else ++ skb_ext_reset(new_skb); + nf_reset_ct(new_skb); + #endif + diff --git a/package/kernel/nat46/patches/102-mapt.patch b/package/kernel/nat46/patches/102-mapt.patch new file mode 100644 index 0000000000..072d0cc447 --- /dev/null +++ b/package/kernel/nat46/patches/102-mapt.patch @@ -0,0 +1,209 @@ +Author: Pavithra R +Date: Sat Aug 1 13:27:20 2020 +0530 + +nat46: Export APIs for acceleration engine support in nat46 for kernel 5.4 + +This patch is propagated from kernel 4.4 commit +861e64a607fd22d5af089cf56539f42a2e31d581 + +The patch defines and exports APIs in nat46 to be used for accelaration. + +Change-Id: I7934b15544953f870d3595b8b359433b4fff7c30 +Signed-off-by: Pavithra R + +--- a/nat46/modules/nat46-core.c ++++ b/nat46/modules/nat46-core.c +@@ -1497,7 +1497,6 @@ static uint16_t nat46_fixup_icmp_dest_un + return 0; + } + +- + /* Fixup ICMP->ICMP6 before IP header translation, according to http://tools.ietf.org/html/rfc6145 */ + + static uint16_t nat46_fixup_icmp(nat46_instance_t *nat46, struct iphdr *iph, struct sk_buff *old_skb) { +@@ -1579,6 +1578,10 @@ int pairs_xlate_v6_to_v4_outer(nat46_ins + return ( (xlate_src >= 0) && (xlate_dst >= 0) ); + } + ++int xlate_6_to_4(struct net_device *dev, struct ipv6hdr *ip6h, uint16_t proto, __u32 *pv4saddr, __u32 *pv4daddr) { ++ return pairs_xlate_v6_to_v4_outer(netdev_nat46_instance(dev), ip6h, proto, pv4saddr, pv4daddr); ++} ++EXPORT_SYMBOL(xlate_6_to_4); + + int nat46_ipv6_input(struct sk_buff *old_skb) { + struct ipv6hdr *ip6h = ipv6_hdr(old_skb); +@@ -1733,6 +1736,10 @@ int nat46_ipv6_input(struct sk_buff *old + + nat46debug(5, "about to send v4 packet, flags: %02x", IPCB(new_skb)->flags); + nat46_netdev_count_xmit(new_skb, old_skb->dev); ++ ++ /* set skb->iif */ ++ new_skb->skb_iif = old_skb->skb_iif; ++ + netif_rx(new_skb); + + /* TBD: should copy be released here? */ +@@ -1841,6 +1848,10 @@ int pairs_xlate_v4_to_v6_outer(nat46_ins + return 0; + } + ++int xlate_4_to_6(struct net_device *dev, struct iphdr *hdr4, uint16_t sport, uint16_t dport, void *v6saddr, void *v6daddr) { ++ return pairs_xlate_v4_to_v6_outer(netdev_nat46_instance(dev), hdr4, &sport, &dport, v6saddr, v6daddr); ++} ++EXPORT_SYMBOL(xlate_4_to_6); + + int nat46_ipv4_input(struct sk_buff *old_skb) { + nat46_instance_t *nat46 = get_nat46_instance(old_skb); +@@ -1981,6 +1992,10 @@ int nat46_ipv4_input(struct sk_buff *old + + nat46debug(5, "about to send v6 packet, flags: %02x", IP6CB(new_skb)->flags); + nat46_netdev_count_xmit(new_skb, old_skb->dev); ++ ++ /* set skb->iif */ ++ new_skb->skb_iif = old_skb->skb_iif; ++ + netif_rx(new_skb); + + done: +@@ -1988,4 +2003,22 @@ done: + return err; + } + ++int nat46_get_npairs(struct net_device *dev) { ++ nat46_instance_t *nat46 = netdev_nat46_instance(dev); ++ return nat46->npairs; ++} ++EXPORT_SYMBOL(nat46_get_npairs); + ++bool nat46_get_rule_config(struct net_device *dev, nat46_xlate_rulepair_t **nat46_rule_pair, int *count) { ++ nat46_instance_t *nat46 = netdev_nat46_instance(dev); ++ if (nat46->npairs < 1) { ++ /* ++ * no rules ? ++ */ ++ return false; ++ } ++ *count = nat46->npairs; ++ *nat46_rule_pair = nat46->pairs; ++ return true; ++} ++EXPORT_SYMBOL(nat46_get_rule_config); +--- a/nat46/modules/nat46-core.h ++++ b/nat46/modules/nat46-core.h +@@ -42,18 +42,18 @@ typedef enum { + #define NAT46_SIGNATURE 0x544e3634 + #define FREED_NAT46_SIGNATURE 0xdead544e + +-typedef struct { ++typedef struct nat46_xlate_rule { + nat46_xlate_style_t style; + struct in6_addr v6_pref; +- int v6_pref_len; +- u32 v4_pref; +- int v4_pref_len; +- int ea_len; +- int psid_offset; +- int fmr_flag; ++ int v6_pref_len; ++ u32 v4_pref; ++ int v4_pref_len; ++ int ea_len; ++ int psid_offset; ++ int fmr_flag; + } nat46_xlate_rule_t; + +-typedef struct { ++typedef struct nat46_xlate_rulepair { + nat46_xlate_rule_t local; + nat46_xlate_rule_t remote; + } nat46_xlate_rulepair_t; +@@ -82,4 +82,9 @@ nat46_instance_t *get_nat46_instance(str + nat46_instance_t *alloc_nat46_instance(int npairs, nat46_instance_t *old, int from_ipair, int to_ipair, int remove_ipair); + void release_nat46_instance(nat46_instance_t *nat46); + ++int xlate_6_to_4(struct net_device *dev, struct ipv6hdr *ip6h, uint16_t proto, __u32 *pv4saddr, __u32 *pv4daddr); ++int xlate_4_to_6(struct net_device *dev, struct iphdr *hdr4, uint16_t sport, uint16_t dport, void *v6saddr, void *v6daddr); ++bool nat46_get_rule_config(struct net_device *dev, nat46_xlate_rulepair_t **nat46_rule_pair, int *count); ++int nat46_get_npairs(struct net_device *dev); ++ + #endif +--- a/nat46/modules/nat46-netdev.c ++++ b/nat46/modules/nat46-netdev.c +@@ -24,10 +24,12 @@ + #include + #include + #include ++#include + #include "nat46-core.h" + #include "nat46-module.h" + + #define NETDEV_DEFAULT_NAME "nat46." ++static RADIX_TREE(netdev_tree, GFP_ATOMIC); + + typedef struct { + u32 sig; +@@ -83,6 +85,18 @@ void nat46_netdev_count_xmit(struct sk_b + dev->stats.tx_bytes += skb->len; + } + ++void nat46_update_stats(struct net_device *dev, uint32_t rx_packets, uint32_t rx_bytes, ++ uint32_t tx_packets, uint32_t tx_bytes, uint32_t rx_dropped, uint32_t tx_dropped) ++{ ++ dev->stats.rx_packets += rx_packets; ++ dev->stats.rx_bytes += rx_bytes; ++ dev->stats.tx_packets += tx_packets; ++ dev->stats.tx_bytes += tx_bytes; ++ dev->stats.rx_dropped += rx_dropped; ++ dev->stats.tx_dropped += tx_dropped; ++} ++EXPORT_SYMBOL(nat46_update_stats); ++ + void *netdev_nat46_instance(struct net_device *dev) { + nat46_netdev_priv_t *priv = netdev_priv(dev); + return priv->nat46; +@@ -160,6 +174,11 @@ int nat46_netdev_create(struct net *net, + printk("nat46: netdevice nat46 '%s' created successfully.\n", devname); + kfree(devname); + ++ /* ++ * add this netdevice to list ++ */ ++ radix_tree_insert(&netdev_tree, (*dev)->ifindex, (void *)*dev); ++ + return 0; + + err_register_dev: +@@ -176,10 +195,24 @@ void nat46_netdev_destroy(struct net_dev + netif_stop_queue(dev); + netdev_nat46_set_instance(dev, NULL); + unregister_netdev(dev); ++ radix_tree_delete(&netdev_tree, dev->ifindex); + free_netdev(dev); + printk("nat46: Destroying nat46 device.\n"); + } + ++bool is_map_t_dev(struct net_device *dev) ++{ ++ if(!dev) { ++ return false; ++ } ++ ++ if(radix_tree_lookup(&netdev_tree, dev->ifindex)) { ++ return true; ++ } ++ return false; ++} ++EXPORT_SYMBOL(is_map_t_dev); ++ + static int is_nat46(struct net_device *dev) { + nat46_netdev_priv_t *priv = netdev_priv(dev); + return (priv && (NAT46_DEVICE_SIGNATURE == priv->sig)); +--- a/nat46/modules/nat46-netdev.h ++++ b/nat46/modules/nat46-netdev.h +@@ -26,3 +26,6 @@ void nat64_show_all_configs(struct net * + void nat46_netdev_count_xmit(struct sk_buff *skb, struct net_device *dev); + void *netdev_nat46_instance(struct net_device *dev); + ++void nat46_update_stats(struct net_device *dev, uint32_t rx_packets, uint32_t rx_bytes, uint32_t tx_packets, uint32_t tx_bytes, ++ uint32_t rx_dropped, uint32_t tx_dropped); ++bool is_map_t_dev(struct net_device *dev); diff --git a/package/kernel/nat46/patches/103-tos.patch b/package/kernel/nat46/patches/103-tos.patch new file mode 100644 index 0000000000..60ffcb2fae --- /dev/null +++ b/package/kernel/nat46/patches/103-tos.patch @@ -0,0 +1,39 @@ +Author: Pavithra R +Date: Sat Aug 1 13:55:33 2020 +0530 + +nat46: Set IPv6 traffic class from IPv4 ToS value + +Set IPv6 traffic class from IPv4 ToS value during +IPv4 to IPv6 translation and vice-versa. + +This patch is propagated from kernel 4.4 commit +1cd3b55b059d4513649bb73bc69da931ed3beb7b + +Change-Id: Ia14e53447e829c8648c01656237ac902ad8674ec +Signed-off-by: Pavithra R + +--- a/nat46/modules/nat46-core.c ++++ b/nat46/modules/nat46-core.c +@@ -886,11 +886,12 @@ void *get_next_header_ptr6(void *pv6, in + } + + void fill_v4hdr_from_v6hdr(struct iphdr * iph, struct ipv6hdr *ip6h, __u32 v4saddr, __u32 v4daddr, __u16 id, __u16 frag_off, __u16 proto, int l3_payload_len) { ++ uint32_t ver_class_flow = ntohl(*(__be32 *)ip6h); + iph->ttl = ip6h->hop_limit; + iph->saddr = v4saddr; + iph->daddr = v4daddr; + iph->protocol = proto; +- *((__be16 *)iph) = htons((4 << 12) | (5 << 8) | (0x00/*tos*/ & 0xff)); ++ *((__be16 *)iph) = htons((4 << 12) | (5 << 8) | ((ver_class_flow >> 20) & 0xff)); + iph->frag_off = frag_off; + iph->id = id; + iph->tot_len = htons( l3_payload_len + IPV4HDRSIZE ); +@@ -1859,7 +1860,7 @@ int nat46_ipv4_input(struct sk_buff *old + uint16_t sport = 0, dport = 0; + + int err = 0; +- int tclass = 0; ++ uint8_t tclass = 0; + int flowlabel = 0; + int check_for_l4 = 0; + int having_l4 = 0; diff --git a/package/kernel/nat46/patches/104-icmp.patch b/package/kernel/nat46/patches/104-icmp.patch new file mode 100644 index 0000000000..7907a66726 --- /dev/null +++ b/package/kernel/nat46/patches/104-icmp.patch @@ -0,0 +1,439 @@ +Author: Pavithra R +Date: Mon Aug 3 17:03:37 2020 +0530 + +nat46: Fix for icmp translation issues. + +This patch is propagated from kernel 4.4 commit +45fce10ba0105515289930b3e3f9df57bf3c22b6. + +Fixed icmpv4 to icmpv6 and vice-versa translation issues, in accordance with RFC6145. + +The change covers: +1. Translation of ICMP errors from IPv4 to IPv6 and vice-versa. +2. Translation of inner L3 packet header {Eth:IPv4:ICMP:IPv4:ICMP} in ICMP error messages. +3. Address translation for packets not having port numbers, hence CE/BR needs to fetch this + information from inner header (atleast 28 bytes (IP hdr + 8 bytes) of orignal packet received + that is transmitted back will be there in response). + +Change-Id: I677474728aeaee656376fdb1edcb9476783d5b40 +Signed-off-by: Pavithra R + +--- a/nat46/modules/nat46-core.c ++++ b/nat46/modules/nat46-core.c +@@ -29,6 +29,9 @@ + #include "nat46-core.h" + #include "nat46-module.h" + ++static uint16_t xlate_pkt_in_err_v4_to_v6(nat46_instance_t *nat46, struct iphdr *iph, ++ struct sk_buff *old_skb, uint16_t *sport, uint16_t *dport); ++ + void + nat46debug_dump(nat46_instance_t *nat46, int level, void *addr, int len) + { +@@ -885,6 +888,14 @@ void *get_next_header_ptr6(void *pv6, in + return ret; + } + ++void fill_v6hdr_from_v4hdr(struct iphdr *iph, struct ipv6hdr *ip6h) { ++ *((__be16 *)ip6h) = htons((6 << 12) | (iph->tos << 4)); /* Version, Traffic Class */ ++ memset(&(ip6h->flow_lbl), 0, sizeof(ip6h->flow_lbl)); /* Flowlabel */ ++ ip6h->payload_len = htons(ntohs(iph->tot_len) - IPV4HDRSIZE); ++ ip6h->nexthdr = iph->protocol; ++ ip6h->hop_limit = iph->ttl; ++} ++ + void fill_v4hdr_from_v6hdr(struct iphdr * iph, struct ipv6hdr *ip6h, __u32 v4saddr, __u32 v4daddr, __u16 id, __u16 frag_off, __u16 proto, int l3_payload_len) { + uint32_t ver_class_flow = ntohl(*(__be32 *)ip6h); + iph->ttl = ip6h->hop_limit; +@@ -1212,10 +1223,14 @@ static void nat46_fixup_icmp6_paramprob( + 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, -1 }; + u32 *pptr6 = icmp6_parameter_ptr(icmp6h); + u8 *pptr4 = icmp_parameter_ptr((struct icmphdr *)icmp6h); +- int new_pptr = -1; ++ u8 new_pptr = -1; + int len = ntohs(ip6h->payload_len)-sizeof(*icmp6h); + + switch(icmp6h->icmp6_code) { ++ case 1: ++ update_icmp6_type_code(nat46, icmp6h, 3, 2); ++ break; ++ + case 0: + if(*pptr6 < sizeof(ptr6_4)/sizeof(ptr6_4[0])) { + new_pptr = ptr6_4[*pptr6]; +@@ -1224,27 +1239,21 @@ static void nat46_fixup_icmp6_paramprob( + *pptr4 = 0xff & new_pptr; + update_icmp6_type_code(nat46, icmp6h, 12, 0); + len = xlate_payload6_to4(nat46, (icmp6h + 1), get_next_header_ptr6((icmp6h + 1), len), len, &icmp6h->icmp6_cksum, ptailTruncSize); +- } else { +- ip6h->nexthdr = NEXTHDR_NONE; ++ update_icmp6_type_code(nat46, icmp6h, 12, 0); ++ break; + } +- } else { +- ip6h->nexthdr = NEXTHDR_NONE; + } +- break; +- case 1: +- icmp6h->icmp6_cksum = csum16_upd(icmp6h->icmp6_cksum, ((*pptr6 >> 16) & 0xffff), 0); +- icmp6h->icmp6_cksum = csum16_upd(icmp6h->icmp6_cksum, (*pptr6 & 0xffff), 0); +- *pptr6 = 0; +- update_icmp6_type_code(nat46, icmp6h, 3, 2); +- len = xlate_payload6_to4(nat46, (icmp6h + 1), get_next_header_ptr6((icmp6h + 1), len), len, &icmp6h->icmp6_cksum, ptailTruncSize); +- break; ++#if __has_attribute(__fallthrough__) ++ __attribute__((__fallthrough__)); ++#endif + case 2: /* fallthrough to default */ + default: + ip6h->nexthdr = NEXTHDR_NONE; ++ return; + } ++ len = xlate_payload6_to4(nat46, (icmp6h + 1), get_next_header_ptr6((icmp6h + 1), len), len, &icmp6h->icmp6_cksum, ptailTruncSize); + } + +- + /* Fixup ICMP6->ICMP before IP header translation, according to http://tools.ietf.org/html/rfc6145 */ + + static void nat46_fixup_icmp6(nat46_instance_t *nat46, struct ipv6hdr *ip6h, struct icmp6hdr *icmp6h, struct sk_buff *old_skb, int *ptailTruncSize) { +@@ -1299,17 +1308,19 @@ int ip6_input_not_interested(nat46_insta + return 0; + } + +-static uint16_t nat46_fixup_icmp_time_exceeded(nat46_instance_t *nat46, struct iphdr *iph, struct icmphdr *icmph, struct sk_buff *old_skb) { ++static uint16_t nat46_fixup_icmp_time_exceeded(nat46_instance_t *nat46, struct iphdr *iph, ++ struct icmphdr *icmph, struct sk_buff *old_skb, uint16_t *sport, uint16_t *dport) { + /* + * Set the Type to 3, and adjust the + * ICMP checksum both to take the type change into account and + * to include the ICMPv6 pseudo-header. The Code is unchanged. + */ + icmph->type = 3; +- return 0; ++ return xlate_pkt_in_err_v4_to_v6(nat46, iph, old_skb, sport, dport); + } + +-static uint16_t nat46_fixup_icmp_parameterprob(nat46_instance_t *nat46, struct iphdr *iph, struct icmphdr *icmph, struct sk_buff *old_skb) { ++static uint16_t nat46_fixup_icmp_parameterprob(nat46_instance_t *nat46, struct iphdr *iph, ++ struct icmphdr *icmph, struct sk_buff *old_skb, uint16_t *sport, uint16_t *dport) { + /* + * Set the Type to 4, and adjust the + * ICMP checksum both to take the type/code change into account +@@ -1352,27 +1363,33 @@ static uint16_t nat46_fixup_icmp_paramet + */ + static int ptr4_6[] = { 0, 1, 4, 4, -1, -1, -1, -1, 7, 6, -1, -1, 8, 8, 8, 8, 24, 24, 24, 24, -1 }; + u8 *icmp_pptr = icmp_parameter_ptr(icmph); +- int new_pptr = -1; ++ u32 *icmp6_pptr = icmp6_parameter_ptr((struct icmp6hdr *)icmph); ++ int8_t new_pptr = -1; ++ ++ icmph->type = 4; ++ + switch (icmph->code) { + case 0: + case 2: + if (*icmp_pptr < (sizeof(ptr4_6)/sizeof(ptr4_6[0]))) { + icmph->code = 0; + new_pptr = ptr4_6[*icmp_pptr]; +- if(new_pptr >= 0) { +- /* FIXME: update the parameter pointer in ICMPv6 with new_pptr value */ ++ if (new_pptr >= 0) { ++ *icmp6_pptr = new_pptr; ++ return xlate_pkt_in_err_v4_to_v6(nat46, iph, old_skb, sport, dport); + } +- } else { +- iph->protocol = NEXTHDR_NONE; + } +- break; ++#if __has_attribute(__fallthrough__) ++ __attribute__((__fallthrough__)); ++#endif + default: + iph->protocol = NEXTHDR_NONE; + } + return 0; + } + +-static uint16_t nat46_fixup_icmp_dest_unreach(nat46_instance_t *nat46, struct iphdr *iph, struct icmphdr *icmph, struct sk_buff *old_skb) { ++static uint16_t nat46_fixup_icmp_dest_unreach(nat46_instance_t *nat46, struct iphdr *iph, ++ struct icmphdr *icmph, struct sk_buff *old_skb, uint16_t *sport, uint16_t *dport) { + /* + * Translate the Code as + * described below, set the Type to 1, and adjust the ICMP +@@ -1435,16 +1452,21 @@ static uint16_t nat46_fixup_icmp_dest_un + + u16 *pmtu = ((u16 *)icmph) + 3; /* IPv4-compatible MTU value is 16 bit */ + ++ icmph->type = 1; ++ + switch (icmph->code) { + case 0: + case 1: + icmph->code = 0; + break; +- case 2: +- /* FIXME: set ICMPv6 parameter pointer to 6 */ ++ case 2: { ++ u32 *icmp6_pptr = icmp6_parameter_ptr((struct icmp6hdr *)icmph); ++ *icmp6_pptr = 6; /* Offset to Next Proto field in IPv6 header. */ + icmph->type = 4; + icmph->code = 1; ++ nat46debug(3, "ICMP Proto Unreachable translated into IPv6 Param Prob.\n"); + break; ++ } + case 3: + icmph->code = 4; + break; +@@ -1494,13 +1516,15 @@ static uint16_t nat46_fixup_icmp_dest_un + break; + default: + iph->protocol = NEXTHDR_NONE; ++ return 0; + } +- return 0; ++ return xlate_pkt_in_err_v4_to_v6(nat46, iph, old_skb, sport, dport); + } + + /* Fixup ICMP->ICMP6 before IP header translation, according to http://tools.ietf.org/html/rfc6145 */ +- +-static uint16_t nat46_fixup_icmp(nat46_instance_t *nat46, struct iphdr *iph, struct sk_buff *old_skb) { ++static uint16_t nat46_fixup_icmp(nat46_instance_t *nat46, struct iphdr *iph, ++ struct sk_buff *old_skb, uint16_t *sport, uint16_t *dport) ++{ + struct icmphdr *icmph = (struct icmphdr *)(iph+1); + uint16_t ret = 0; + +@@ -1509,22 +1533,22 @@ static uint16_t nat46_fixup_icmp(nat46_i + switch(icmph->type) { + case ICMP_ECHO: + icmph->type = ICMPV6_ECHO_REQUEST; +- ret = icmph->un.echo.id; ++ *sport = *dport = icmph->un.echo.id; + nat46debug(3, "ICMP echo request translated into IPv6, id: %d", ntohs(ret)); + break; + case ICMP_ECHOREPLY: + icmph->type = ICMPV6_ECHO_REPLY; +- ret = icmph->un.echo.id; ++ *sport = *dport = icmph->un.echo.id; + nat46debug(3, "ICMP echo reply translated into IPv6, id: %d", ntohs(ret)); + break; + case ICMP_TIME_EXCEEDED: +- ret = nat46_fixup_icmp_time_exceeded(nat46, iph, icmph, old_skb); ++ ret = nat46_fixup_icmp_time_exceeded(nat46, iph, icmph, old_skb, sport, dport); + break; + case ICMP_PARAMETERPROB: +- ret = nat46_fixup_icmp_parameterprob(nat46, iph, icmph, old_skb); ++ ret = nat46_fixup_icmp_parameterprob(nat46, iph, icmph, old_skb, sport, dport); + break; + case ICMP_DEST_UNREACH: +- ret = nat46_fixup_icmp_dest_unreach(nat46, iph, icmph, old_skb); ++ ret = nat46_fixup_icmp_dest_unreach(nat46, iph, icmph, old_skb, sport, dport); + break; + default: + /* Silently drop. */ +@@ -1544,11 +1568,13 @@ int pairs_xlate_v6_to_v4_outer(nat46_ins + + if(-1 == xlate_dst) { + if (xlate_v6_to_v4(nat46, &apair->local, &ip6h->daddr, pv4daddr)) { ++ nat46debug(5, "Dst addr %pI6 to %pI4 \n", &ip6h->daddr, pv4daddr); + xlate_dst = ipair; + } + } + if(-1 == xlate_src) { + if (xlate_v6_to_v4(nat46, &apair->remote, &ip6h->saddr, pv4saddr)) { ++ nat46debug(5, "Src addr %pI6 to %pI4 \n", &ip6h->saddr, pv4saddr); + xlate_src = ipair; + } + } +@@ -1659,6 +1685,7 @@ int nat46_ipv6_input(struct sk_buff *old + } + + if(!pairs_xlate_v6_to_v4_outer(nat46, ip6h, proto, &v4saddr, &v4daddr)) { ++ nat46debug(0, "[nat46] Could not translate v6->v4"); + goto done; + } + +@@ -1821,11 +1848,13 @@ int pairs_xlate_v4_to_v6_outer(nat46_ins + + if(-1 == xlate_src) { + if(xlate_v4_to_v6(nat46, &apair->local, &hdr4->saddr, v6saddr, sport)) { ++ nat46debug(5, "Src addr %pI4 to %pI6 \n", &hdr4->saddr, v6saddr); + xlate_src = ipair; + } + } + if(-1 == xlate_dst) { + if(xlate_v4_to_v6(nat46, &apair->remote, &hdr4->daddr, v6daddr, dport)) { ++ nat46debug(5, "Dst addr %pI4 to %pI6 \n", &hdr4->daddr, v6daddr); + xlate_dst = ipair; + } + } +@@ -1854,10 +1883,145 @@ int xlate_4_to_6(struct net_device *dev, + } + EXPORT_SYMBOL(xlate_4_to_6); + ++/* FIXME: This is a workaround, till the LPM is not added. The sport & dport in inner header will be dport & sport of the outer ++ * header, respectively. Hence, dest. and source ips of inner header will be found in local & remote rules, respectively. ++ * Will work only for a pair of local & remote rules. Once LPM is brought in, this method can be removed and ++ * pairs_xlate_v4_to_v6_outer be used instead. ++ */ ++int pairs_xlate_v4_to_v6_inner(nat46_instance_t *nat46, struct iphdr *iph, ++ uint16_t sport, uint16_t dport, void *v6saddr, void *v6daddr) { ++ int ipair = 0; ++ nat46_xlate_rulepair_t *apair = NULL; ++ int xlate_src = -1; ++ int xlate_dst = -1; ++ ++ for (ipair = 0; ipair < nat46->npairs; ipair++) { ++ apair = &nat46->pairs[ipair]; ++ ++ if (-1 == xlate_dst) { ++ if (xlate_v4_to_v6(nat46, &apair->local, &iph->daddr, v6daddr, &dport)) { ++ nat46debug(3, "Dst addr %pI4 to %pI6 \n", &iph->daddr, v6daddr); ++ xlate_dst = ipair; ++ } ++ } ++ if (-1 == xlate_src) { ++ if(xlate_v4_to_v6(nat46, &apair->remote, &iph->saddr, v6saddr, &sport)) { ++ nat46debug(3, "Src addr %pI4 to %pI6 \n", &iph->saddr, v6saddr); ++ xlate_src = ipair; ++ } ++ } ++ if ((xlate_src >= 0) && (xlate_dst >= 0)) { ++ /* we did manage to translate it */ ++ nat46debug(5, "[nat46] Inner header xlate results: src %d dst %d", xlate_src, xlate_dst); ++ return 1; ++ } else { ++ /* We did not match fully and there are more rules */ ++ if((ipair+1 < nat46->npairs) && is_last_pair_in_group(apair)) { ++ xlate_src = -1; ++ xlate_dst = -1; ++ } ++ } ++} ++ ++ nat46debug(1, "[nat46] Could not find a translation pair v4->v6"); ++ return 0; ++} ++ ++static uint16_t xlate_pkt_in_err_v4_to_v6(nat46_instance_t *nat46, struct iphdr *iph, ++ struct sk_buff *old_skb, uint16_t *sport, uint16_t *dport) { ++ struct ipv6hdr ip6h; ++ char v6saddr[16], v6daddr[16]; ++ uint16_t temp_port = 0; ++ int ret = 0; ++ struct icmphdr *icmph = (struct icmphdr *)(iph + 1); ++ struct iphdr *iiph = (struct iphdr *)(icmph + 1); ++ ++ switch (iiph->protocol) { ++ case IPPROTO_TCP: { ++ struct tcphdr *th = (struct tcphdr *)(iiph + 1); ++ *sport = th->source; ++ *dport = th->dest; ++ iiph->protocol = NEXTHDR_TCP; ++ break; ++ } ++ case IPPROTO_UDP: { ++ struct udphdr *udp = (struct udphdr *)(iiph + 1); ++ *sport = udp->source; ++ *dport = udp->dest; ++ iiph->protocol = NEXTHDR_UDP; ++ break; ++ } ++ case IPPROTO_ICMP: { ++ struct icmphdr *icmph = (struct icmphdr *)(iiph + 1); ++ iiph->protocol = NEXTHDR_ICMP; ++ switch (icmph->type) { ++ case ICMP_ECHO: ++ icmph->type = ICMPV6_ECHO_REQUEST; ++ *sport = *dport = icmph->un.echo.id; ++ break; ++ case ICMP_ECHOREPLY: ++ icmph->type = ICMPV6_ECHO_REPLY; ++ *sport = *dport = icmph->un.echo.id; ++ break; ++ default: ++ nat46debug(3, "ICMP Error message can't be inside another ICMP Error messgae."); ++ *sport = *dport = 0; ++ return 0; ++ } ++ break; ++ } ++ default: ++ nat46debug(3, "[ICMPv4] Next header: %u. Only TCP, UDP, and ICMP are supported.", iiph->protocol); ++ *sport = *dport = 0; ++ return 0; ++ } ++ ++ nat46debug(3, "Retrieved from pkt in error: dest port %d, and src port %d.", ntohs(*dport), ntohs(*sport)); ++ ++ if (!pairs_xlate_v4_to_v6_inner(nat46, iiph, *sport, *dport, v6saddr, v6daddr)) { ++ nat46debug(0, "[nat46] Could not translate inner header v4->v6"); ++ *sport = *dport = 0; ++ return 0; ++ } ++ ++ fill_v6hdr_from_v4hdr (iiph, &ip6h); ++ memcpy(&ip6h.saddr, v6saddr, sizeof(ip6h.saddr)); ++ memcpy(&ip6h.daddr, v6daddr, sizeof(ip6h.daddr)); ++ ++ if (skb_tailroom(old_skb) >= IPV6V4HDRDELTA){ ++ skb_put(old_skb, IPV6V4HDRDELTA); ++ memmove(((char *)iiph + IPV6HDRSIZE), (iiph + 1), ntohs(iiph->tot_len) - IPV4HDRSIZE); ++ memcpy(iiph, &ip6h, IPV6HDRSIZE); ++ } ++ else { ++ ret = pskb_expand_head(old_skb, 0, IPV6V4HDRDELTA, GFP_ATOMIC); ++ if (unlikely(ret)) { ++ nat46debug(0, "[nat46] Could not copy v4 skb"); ++ *sport = *dport = 0; ++ return 0; ++ } ++ ++ skb_put(old_skb, IPV6V4HDRDELTA); ++ iiph = (struct iphdr *)(icmp_hdr(old_skb) + 1); ++ memmove(((char *)iiph + IPV6HDRSIZE), (iiph + 1), ntohs(iiph->tot_len) - IPV4HDRSIZE); ++ memcpy(iiph, &ip6h, IPV6HDRSIZE); ++ nat46 = get_nat46_instance(old_skb); ++ iph = ip_hdr(old_skb); ++ } ++ ++ /* Swapping Ports for outer header */ ++ /* Another work-around till LPM is not present. */ ++ temp_port = *sport; ++ *sport = *dport; ++ *dport = temp_port; ++ ++ return 1; ++} ++ + int nat46_ipv4_input(struct sk_buff *old_skb) { + nat46_instance_t *nat46 = get_nat46_instance(old_skb); + struct sk_buff *new_skb; +- uint16_t sport = 0, dport = 0; ++ uint16_t sport = 0, dport = 0, ret = 0; + + int err = 0; + uint8_t tclass = 0; +@@ -1879,7 +2043,7 @@ int nat46_ipv4_input(struct sk_buff *old + } + nat46debug(1, "nat46_ipv4_input packet"); + nat46debug(5, "nat46_ipv4_input protocol: %d, len: %d, flags: %02x", hdr4->protocol, old_skb->len, IPCB(old_skb)->flags); +- if(0 == (ntohs(hdr4->frag_off) & 0x3FFF) ) { ++ if (0 == (ntohs(hdr4->frag_off) & 0x3FFF)) { + check_for_l4 = 1; + } else if (IPPROTO_ICMP == hdr4->protocol) { + /* +@@ -1916,9 +2080,10 @@ int nat46_ipv4_input(struct sk_buff *old + break; + } + case IPPROTO_ICMP: +- sport = dport = nat46_fixup_icmp(nat46, hdr4, old_skb); +- having_l4 = 1; +- break; ++ ret = nat46_fixup_icmp(nat46, hdr4, old_skb, &sport, &dport); ++ nat46debug(3, "ICMP translated to dest port %d, and src port %d.", ntohs(dport), ntohs(sport)); ++ having_l4 = 1; ++ break; + default: + break; + } diff --git a/package/kernel/nat46/patches/105-longest-prefix-match.patch b/package/kernel/nat46/patches/105-longest-prefix-match.patch new file mode 100644 index 0000000000..af7f2c770b --- /dev/null +++ b/package/kernel/nat46/patches/105-longest-prefix-match.patch @@ -0,0 +1,640 @@ +Author: Pavithra R +Date: Tue Aug 4 10:33:59 2020 +0530 + +nat46: Adding support for multiple MAP-T rules. + +This patch is propagated from kernel 4.4 commit +05a122b0cb0d3a99f040c94b3f626e7350f1445b + +This change covers: +1. Support for adding maximum of 32 MAP-T rules (DMR + FMRs). +2. Support for rule lookup based on Longest Prefix Match method. +3. Support for validation of new rules being inserted. + +Change-Id: Id87448a8f544273b40c20aaab6e5c63b0dbd72e +Signed-off-by: Pavithra R + +--- a/nat46/modules/nat46-core.c ++++ b/nat46/modules/nat46-core.c +@@ -128,6 +128,13 @@ int try_parse_ipv6_prefix(struct in6_add + *arg_plen++ = 0; + if (pref_len) { + *pref_len = simple_strtol(arg_plen, NULL, 10); ++ ++ /* ++ * ipv6 prefix should be <= 128 ++ */ ++ if (*pref_len > IPV6_BITS_MAX) { ++ return -1; ++ } + } + } + err = (1 != in6_pton(arg, -1, (u8 *)pref, '\0', NULL)); +@@ -141,6 +148,13 @@ int try_parse_ipv4_prefix(u32 *v4addr, i + *arg_plen++ = 0; + if (pref_len) { + *pref_len = simple_strtol(arg_plen, NULL, 10); ++ ++ /* ++ * ipv4 prefix len should be <= 32 ++ */ ++ if (*pref_len > IPV4_BITS_MAX) { ++ return -1; ++ } + } + } + err = (1 != in4_pton(arg, -1, (u8 *)v4addr, '/', NULL)); +@@ -183,11 +197,127 @@ int try_parse_rule_arg(nat46_xlate_rule_ + return err; + } + +-/* +- * Parse the config commands in the buffer, +- * destructive (puts zero between the args) ++static inline void nat46_swap(nat46_xlate_rulepair_t *var1, nat46_xlate_rulepair_t *var2) { ++ nat46_xlate_rulepair_t temp; ++ temp = *var1; ++ *var1 = *var2; ++ *var2 = temp; ++} ++ ++/* ++ * Sort rule pairs based on prefix length. + */ ++void nat46_sort_rule_array(nat46_instance_t *nat46) { ++ int i, j; ++ int nelem = nat46->npairs; ++ nat46_xlate_rulepair_t *array = NULL; ++ ++ memcpy(nat46->sorted_ipv4_local_pairs, nat46->pairs, nelem * sizeof(nat46_xlate_rulepair_t)); ++ memcpy(nat46->sorted_ipv4_remote_pairs, nat46->pairs, nelem * sizeof(nat46_xlate_rulepair_t)); ++ memcpy(nat46->sorted_ipv6_local_pairs, nat46->pairs, nelem * sizeof(nat46_xlate_rulepair_t)); ++ memcpy(nat46->sorted_ipv6_remote_pairs, nat46->pairs, nelem * sizeof(nat46_xlate_rulepair_t)); ++ ++ array = &nat46->sorted_ipv4_local_pairs[0]; ++ for (i = 0; i < nelem - 1; i++) { ++ for (j = 0; j < nelem - i - 1; j++) { ++ if (array[j].local.v4_pref_len < array[j+1].local.v4_pref_len) { ++ nat46_swap (&array[j], &array[j+1]); ++ } ++ } ++ } ++ ++ array = &nat46->sorted_ipv4_remote_pairs[0]; ++ for (i = 0; i < nelem - 1; i++) { ++ for (j = 0; j < nelem - i - 1; j++) { ++ if (array[j].remote.v4_pref_len < array[j+1].remote.v4_pref_len) { ++ nat46_swap (&array[j], &array[j+1]); ++ } ++ } ++ } + ++ array = &nat46->sorted_ipv6_local_pairs[0]; ++ for (i = 0; i < nelem - 1; i++) { ++ for (j = 0; j < nelem - i - 1; j++) { ++ if (array[j].local.v6_pref_len < array[j+1].local.v6_pref_len) { ++ nat46_swap (&array[j], &array[j+1]); ++ } ++ } ++ } ++ ++ array = &nat46->sorted_ipv6_remote_pairs[0]; ++ for (i = 0; i < nelem - 1; i++) { ++ for (j = 0; j < nelem - i - 1; j++) { ++ if (array[j].remote.v6_pref_len < array[j+1].remote.v6_pref_len) { ++ nat46_swap (&array[j], &array[j+1]); ++ } ++ } ++ } ++} ++ ++bool nat46_validate_RFC6052_style(nat46_instance_t *nat46, nat46_xlate_rule_t rule) ++{ ++ if (rule.style == NAT46_XLATE_RFC6052) { ++ if (!((rule.v6_pref_len == 32) || (rule.v6_pref_len == 40) || ++ (rule.v6_pref_len == 48) || (rule.v6_pref_len == 56) || ++ (rule.v6_pref_len == 64) || (rule.v6_pref_len == 96))) { ++ nat46debug(3, "IPv6 prefix len is invalid"); ++ return false; ++ } ++ } ++ return true; ++} ++ ++bool nat46_validate_MAP_style(nat46_instance_t *nat46, nat46_xlate_rule_t rule) ++{ ++ int psid_len; ++ if (rule.style == NAT46_XLATE_MAP) { ++ ++ /* ++ * max ea_len is 48 ++ */ ++ if (rule.ea_len > EA_LEN_MAX) { ++ nat46debug(3, "EA-length should not exceed 48"); ++ return false; ++ } ++ ++ if (rule.v4_pref_len + rule.ea_len > IPV4_BITS_MAX) { ++ psid_len = rule.ea_len - (IPV4_BITS_MAX - rule.v4_pref_len); ++ } else { ++ psid_len = 0; ++ } ++ ++ if (psid_len + rule.psid_offset > PSID_LEN_MAX) { ++ nat46debug(3, "psid_len + psid_offset should not exceed 16"); ++ return false; ++ } ++ } ++ return true; ++} ++ ++int nat46_validate_ipair_config(nat46_instance_t *nat46, nat46_xlate_rulepair_t *apair) ++{ ++ if (!nat46_validate_RFC6052_style(nat46, apair->local)) { ++ return -1; ++ } ++ ++ if (!nat46_validate_RFC6052_style(nat46, apair->remote)) { ++ return -1; ++ } ++ ++ if (!nat46_validate_MAP_style(nat46, apair->local)) { ++ return -1; ++ } ++ ++ if (!nat46_validate_MAP_style(nat46, apair->remote)) { ++ return -1; ++ } ++ return 0; ++} ++ ++/* ++ * Parse the config commands in the buffer, ++ * destructive (puts zero between the args) ++ */ + int nat46_set_ipair_config(nat46_instance_t *nat46, int ipair, char *buf, int count) { + char *tail = buf; + char *arg_name; +@@ -217,7 +347,18 @@ int nat46_set_ipair_config(nat46_instanc + err = try_parse_rule_arg(&apair->remote, arg_name, &tail); + } + } +- return err; ++ ++ err = nat46_validate_ipair_config(nat46, apair); ++ if (err) { ++ return err; ++ } ++ ++ /* ++ * sort nat46->pairs based on prefix length. ++ */ ++ nat46_sort_rule_array(nat46); ++ ++ return 0; + } + + int nat46_set_config(nat46_instance_t *nat46, char *buf, int count) { +@@ -933,37 +1074,120 @@ int is_last_pair_in_group(nat46_xlate_ru + return ( (apair->local.style != NAT46_XLATE_NONE) && (apair->remote.style != NAT46_XLATE_NONE) ); + } + ++nat46_xlate_rulepair_t *nat46_lpm(nat46_instance_t *nat46, nat46_rule_type_t type, void *paddr) { ++ int ipair = 0; ++ nat46_xlate_rulepair_t *apair = NULL; ++ uint32_t mask = 0; ++ uint8_t *pa1; ++ uint8_t *pa2; ++ ++ if(!nat46 || !paddr) { ++ return NULL; ++ } ++ ++ switch (type) { ++ case NAT46_IPV4_LOCAL: ++ for (ipair = 0; ipair < nat46->npairs; ipair++) { ++ apair = &nat46->sorted_ipv4_local_pairs[ipair]; ++ ++ /* ++ * For a 32-bit number, if the shift count is 32, then the ++ * result of the left shift operation is always 0. ++ */ ++ if (apair->local.v4_pref_len) { ++ mask = htonl(U32_MASK << (IPV4_BITS_MAX - apair->local.v4_pref_len)); ++ } ++ ++ if((*(uint32_t *)paddr & mask) == (apair->local.v4_pref & mask)) { ++ return apair; ++ } ++ } ++ break; ++ case NAT46_IPV4_REMOTE: ++ for (ipair = 0; ipair < nat46->npairs; ipair++) { ++ apair = &nat46->sorted_ipv4_remote_pairs[ipair]; ++ ++ /* ++ * For a 32-bit number, if the shift count is 32, then the ++ * result of the left shift operation is always 0. ++ */ ++ if (apair->remote.v4_pref_len) { ++ mask = htonl(U32_MASK << (IPV4_BITS_MAX - apair->remote.v4_pref_len)); ++ } ++ ++ if((*(uint32_t *)paddr & mask) == (apair->remote.v4_pref & mask)) { ++ return apair; ++ } ++ } ++ break; ++ case NAT46_IPV6_LOCAL: ++ for (ipair = 0; ipair < nat46->npairs; ipair++) { ++ apair = &nat46->sorted_ipv6_local_pairs[ipair]; ++ if(memcmp(paddr, &apair->local.v6_pref, apair->local.v6_pref_len / BITS_PER_BYTE)) { ++ continue; ++ } ++ if(apair->local.v6_pref_len % BITS_PER_BYTE) { ++ mask = U8_MASK << (BITS_PER_BYTE - (apair->local.v6_pref_len % BITS_PER_BYTE)); ++ pa1 = (uint8_t *)paddr + (apair->local.v6_pref_len / BITS_PER_BYTE); ++ pa2 = (uint8_t *)&apair->local.v6_pref + (apair->local.v6_pref_len / BITS_PER_BYTE); ++ ++ if ((*pa1 & mask) == (*pa2 & mask)) { ++ return apair; ++ } ++ } ++ else ++ return apair; ++ } ++ break; ++ case NAT46_IPV6_REMOTE: ++ for (ipair = 0; ipair < nat46->npairs; ipair++) { ++ apair = &nat46->sorted_ipv6_remote_pairs[ipair]; ++ if(memcmp(paddr, &apair->remote.v6_pref, apair->remote.v6_pref_len / BITS_PER_BYTE)) { ++ continue; ++ } ++ if(apair->remote.v6_pref_len % BITS_PER_BYTE) { ++ mask = U8_MASK << (BITS_PER_BYTE - (apair->remote.v6_pref_len % BITS_PER_BYTE)); ++ pa1 = (uint8_t *)paddr + (apair->remote.v6_pref_len / BITS_PER_BYTE); ++ pa2 = (uint8_t *)&apair->remote.v6_pref + (apair->remote.v6_pref_len / BITS_PER_BYTE); ++ ++ if((*pa1 & mask) == (*pa2 & mask)) { ++ return apair; ++ } ++ } ++ else ++ return apair; ++ } ++ break; ++ default: ++ nat46debug(0, "%s : Invalid prefix type.\n", __func__); ++ } ++ return NULL; ++} ++ + void pairs_xlate_v6_to_v4_inner(nat46_instance_t *nat46, struct ipv6hdr *ip6h, __u32 *pv4saddr, __u32 *pv4daddr) { + int ipair = 0; + nat46_xlate_rulepair_t *apair = NULL; + int xlate_src = -1; + int xlate_dst = -1; + +- for(ipair = 0; ipair < nat46->npairs; ipair++) { +- apair = &nat46->pairs[ipair]; ++ apair = nat46_lpm(nat46, NAT46_IPV6_REMOTE, &ip6h->daddr); ++ if (!apair) { ++ return; ++ } + +- if(-1 == xlate_dst) { +- if(xlate_v6_to_v4(nat46, &apair->remote, &ip6h->daddr, pv4daddr)) { +- xlate_dst = ipair; +- } +- } +- if(-1 == xlate_src) { +- if(xlate_v6_to_v4(nat46, &apair->local, &ip6h->saddr, pv4saddr)) { +- xlate_src = ipair; +- } +- } +- if((xlate_src >= 0) && (xlate_dst >= 0)) { +- /* we did manage to translate it */ +- break; +- } else { +- /* We did not match fully and there are more rules */ +- if((ipair+1 < nat46->npairs) && is_last_pair_in_group(apair)) { +- xlate_src = -1; +- xlate_dst = -1; +- } +- } ++ if (xlate_v6_to_v4(nat46, &apair->remote, &ip6h->daddr, pv4daddr)) { ++ xlate_dst = ipair; ++ } ++ if (xlate_v6_to_v4(nat46, &apair->local, &ip6h->saddr, pv4saddr)) { ++ xlate_src = ipair; ++ } ++ ++ if ((xlate_src >= 0) && (xlate_dst >= 0)) { ++ /* we did manage to translate it */ ++ nat46debug(5, "[nat46payload] xlate results: src %d dst %d", xlate_src, xlate_dst); ++ } else { ++ nat46debug(1, "[nat46] Could not find a translation pair v6->v4 src %pI6c dst %pI6c", &ip6h->saddr, &ip6h->daddr); + } +- nat46debug(5, "[nat46payload] xlate results: src %d dst %d", xlate_src, xlate_dst); + } + + /* +@@ -1557,40 +1781,31 @@ static uint16_t nat46_fixup_icmp(nat46_i + return ret; + } + +-int pairs_xlate_v6_to_v4_outer(nat46_instance_t *nat46, struct ipv6hdr *ip6h, uint16_t proto, __u32 *pv4saddr, __u32 *pv4daddr) { ++int pairs_xlate_v6_to_v4_outer(nat46_instance_t *nat46, nat46_xlate_rulepair_t *apair, ++ struct ipv6hdr *ip6h, uint16_t proto, __u32 *pv4saddr, __u32 *pv4daddr) { + int ipair = 0; +- nat46_xlate_rulepair_t *apair = NULL; + int xlate_src = -1; + int xlate_dst = -1; + + for(ipair = 0; ipair < nat46->npairs; ipair++) { +- apair = &nat46->pairs[ipair]; +- +- if(-1 == xlate_dst) { +- if (xlate_v6_to_v4(nat46, &apair->local, &ip6h->daddr, pv4daddr)) { +- nat46debug(5, "Dst addr %pI6 to %pI4 \n", &ip6h->daddr, pv4daddr); +- xlate_dst = ipair; +- } ++ apair = nat46_lpm(nat46, NAT46_IPV6_REMOTE, &ip6h->saddr); ++ if (!apair) { ++ return 0; + } +- if(-1 == xlate_src) { +- if (xlate_v6_to_v4(nat46, &apair->remote, &ip6h->saddr, pv4saddr)) { +- nat46debug(5, "Src addr %pI6 to %pI4 \n", &ip6h->saddr, pv4saddr); +- xlate_src = ipair; +- } ++ ++ if (xlate_v6_to_v4(nat46, &apair->local, &ip6h->daddr, pv4daddr)) { ++ nat46debug(5, "Dst addr %pI6 to %pI4 \n", &ip6h->daddr, pv4daddr); ++ xlate_dst = ipair; + } +- if( (xlate_src >= 0) && (xlate_dst >= 0) ) { +- break; +- } else { +- /* We did not match fully and there are more rules */ +- if((ipair+1 < nat46->npairs) && is_last_pair_in_group(apair)) { +- xlate_src = -1; +- xlate_dst = -1; +- } ++ ++ if (xlate_v6_to_v4(nat46, &apair->remote, &ip6h->saddr, pv4saddr)) { ++ nat46debug(5, "Src addr %pI6 to %pI4 \n", &ip6h->saddr, pv4saddr); ++ xlate_src = ipair; + } + } + if (xlate_dst >= 0) { + if (xlate_src < 0) { +- if(proto == NEXTHDR_ICMP) { ++ if (proto == NEXTHDR_ICMP) { + nat46debug(1, "[nat46] Could not translate remote address v6->v4, ipair %d, for ICMP6 use dest addr", ipair); + *pv4saddr = *pv4daddr; + xlate_src = xlate_dst; +@@ -1606,12 +1821,14 @@ int pairs_xlate_v6_to_v4_outer(nat46_ins + } + + int xlate_6_to_4(struct net_device *dev, struct ipv6hdr *ip6h, uint16_t proto, __u32 *pv4saddr, __u32 *pv4daddr) { +- return pairs_xlate_v6_to_v4_outer(netdev_nat46_instance(dev), ip6h, proto, pv4saddr, pv4daddr); ++ nat46_xlate_rulepair_t apair; ++ return pairs_xlate_v6_to_v4_outer(netdev_nat46_instance(dev), &apair, ip6h, proto, pv4saddr, pv4daddr); + } + EXPORT_SYMBOL(xlate_6_to_4); + + int nat46_ipv6_input(struct sk_buff *old_skb) { + struct ipv6hdr *ip6h = ipv6_hdr(old_skb); ++ nat46_xlate_rulepair_t apair; + nat46_instance_t *nat46 = get_nat46_instance(old_skb); + uint16_t proto; + uint16_t frag_off; +@@ -1684,7 +1901,7 @@ int nat46_ipv6_input(struct sk_buff *old + check_for_l4 = 1; + } + +- if(!pairs_xlate_v6_to_v4_outer(nat46, ip6h, proto, &v4saddr, &v4daddr)) { ++ if (!pairs_xlate_v6_to_v4_outer(nat46, &apair, ip6h, proto, &v4saddr, &v4daddr)) { + nat46debug(0, "[nat46] Could not translate v6->v4"); + goto done; + } +@@ -1837,56 +2054,44 @@ int ip4_input_not_interested(nat46_insta + return 0; + } + +-int pairs_xlate_v4_to_v6_outer(nat46_instance_t *nat46, struct iphdr *hdr4, uint16_t *sport, uint16_t *dport, void *v6saddr, void *v6daddr) { ++int pairs_xlate_v4_to_v6_outer(nat46_instance_t *nat46, nat46_xlate_rulepair_t *apair, ++ struct iphdr *hdr4, uint16_t *sport, uint16_t *dport, void *v6saddr, void *v6daddr) { + int ipair = 0; +- nat46_xlate_rulepair_t *apair = NULL; + int xlate_src = -1; + int xlate_dst = -1; ++ int ret = 0; + +- for(ipair = 0; ipair < nat46->npairs; ipair++) { +- apair = &nat46->pairs[ipair]; ++ apair = nat46_lpm(nat46, NAT46_IPV4_REMOTE, &hdr4->daddr); ++ if (!apair) { ++ return 0; ++ } + +- if(-1 == xlate_src) { +- if(xlate_v4_to_v6(nat46, &apair->local, &hdr4->saddr, v6saddr, sport)) { +- nat46debug(5, "Src addr %pI4 to %pI6 \n", &hdr4->saddr, v6saddr); +- xlate_src = ipair; +- } +- } +- if(-1 == xlate_dst) { +- if(xlate_v4_to_v6(nat46, &apair->remote, &hdr4->daddr, v6daddr, dport)) { +- nat46debug(5, "Dst addr %pI4 to %pI6 \n", &hdr4->daddr, v6daddr); +- xlate_dst = ipair; +- } +- } +- if( (xlate_src >= 0) && (xlate_dst >= 0) ) { +- break; +- } else { +- /* We did not match fully and there are more rules */ +- if((ipair+1 < nat46->npairs) && is_last_pair_in_group(apair)) { +- xlate_src = -1; +- xlate_dst = -1; +- } +- } ++ if (xlate_v4_to_v6(nat46, &apair->local, &hdr4->saddr, v6saddr, sport)) { ++ nat46debug(5, "Src addr %pI4 to %pI6 \n", &hdr4->saddr, v6saddr); ++ xlate_src = ipair; ++ } ++ if (xlate_v4_to_v6(nat46, &apair->remote, &hdr4->daddr, v6daddr, dport)) { ++ nat46debug(5, "Dst addr %pI4 to %pI6 \n", &hdr4->daddr, v6daddr); ++ xlate_dst = ipair; + } + nat46debug(5, "[nat46] pairs_xlate_v4_to_v6_outer result: src %d dst %d", xlate_src, xlate_dst); + if ( (xlate_src >= 0) && (xlate_dst >= 0) ) { +- return 1; ++ ret = 1; ++ } else { ++ nat46debug(1, "[nat46] Could not find a translation pair v4->v6"); + } +- +- nat46debug(1, "[nat46] Could not find a translation pair v4->v6"); +- +- return 0; ++ return ret; + } + + int xlate_4_to_6(struct net_device *dev, struct iphdr *hdr4, uint16_t sport, uint16_t dport, void *v6saddr, void *v6daddr) { +- return pairs_xlate_v4_to_v6_outer(netdev_nat46_instance(dev), hdr4, &sport, &dport, v6saddr, v6daddr); ++ nat46_xlate_rulepair_t apair; ++ return pairs_xlate_v4_to_v6_outer(netdev_nat46_instance(dev), &apair, hdr4, &sport, &dport, v6saddr, v6daddr); + } + EXPORT_SYMBOL(xlate_4_to_6); + +-/* FIXME: This is a workaround, till the LPM is not added. The sport & dport in inner header will be dport & sport of the outer +- * header, respectively. Hence, dest. and source ips of inner header will be found in local & remote rules, respectively. +- * Will work only for a pair of local & remote rules. Once LPM is brought in, this method can be removed and +- * pairs_xlate_v4_to_v6_outer be used instead. ++/* ++ * The sport & dport in inner header will be dport & sport of the outer header, respectively. ++ * Hence, dest. and source ips of inner header will be found in local & remote rules, respectively. + */ + int pairs_xlate_v4_to_v6_inner(nat46_instance_t *nat46, struct iphdr *iph, + uint16_t sport, uint16_t dport, void *v6saddr, void *v6daddr) { +@@ -1895,35 +2100,27 @@ int pairs_xlate_v4_to_v6_inner(nat46_ins + int xlate_src = -1; + int xlate_dst = -1; + +- for (ipair = 0; ipair < nat46->npairs; ipair++) { +- apair = &nat46->pairs[ipair]; ++ apair = nat46_lpm(nat46, NAT46_IPV4_REMOTE, &iph->saddr); ++ if (!apair) { ++ return 0; ++ } + +- if (-1 == xlate_dst) { +- if (xlate_v4_to_v6(nat46, &apair->local, &iph->daddr, v6daddr, &dport)) { +- nat46debug(3, "Dst addr %pI4 to %pI6 \n", &iph->daddr, v6daddr); +- xlate_dst = ipair; +- } +- } +- if (-1 == xlate_src) { +- if(xlate_v4_to_v6(nat46, &apair->remote, &iph->saddr, v6saddr, &sport)) { +- nat46debug(3, "Src addr %pI4 to %pI6 \n", &iph->saddr, v6saddr); +- xlate_src = ipair; +- } +- } +- if ((xlate_src >= 0) && (xlate_dst >= 0)) { +- /* we did manage to translate it */ +- nat46debug(5, "[nat46] Inner header xlate results: src %d dst %d", xlate_src, xlate_dst); +- return 1; +- } else { +- /* We did not match fully and there are more rules */ +- if((ipair+1 < nat46->npairs) && is_last_pair_in_group(apair)) { +- xlate_src = -1; +- xlate_dst = -1; +- } +- } +-} ++ if (xlate_v4_to_v6(nat46, &apair->local, &iph->daddr, v6daddr, &dport)) { ++ nat46debug(3, "Dst addr %pI4 to %pI6 \n", &iph->daddr, v6daddr); ++ xlate_dst = ipair; ++ } ++ if (xlate_v4_to_v6(nat46, &apair->remote, &iph->saddr, v6saddr, &sport)) { ++ nat46debug(3, "Src addr %pI4 to %pI6 \n", &iph->saddr, v6saddr); ++ xlate_src = ipair; ++ } ++ if ((xlate_src >= 0) && (xlate_dst >= 0)) { ++ /* we did manage to translate it */ ++ nat46debug(5, "[nat46] Inner header xlate results: src %d dst %d", xlate_src, xlate_dst); ++ return 1; ++ } else { ++ nat46debug(1, "[nat46] Could not find a translation pair v4->v6"); ++ } + +- nat46debug(1, "[nat46] Could not find a translation pair v4->v6"); + return 0; + } + +@@ -2020,6 +2217,7 @@ static uint16_t xlate_pkt_in_err_v4_to_v + + int nat46_ipv4_input(struct sk_buff *old_skb) { + nat46_instance_t *nat46 = get_nat46_instance(old_skb); ++ nat46_xlate_rulepair_t apair; + struct sk_buff *new_skb; + uint16_t sport = 0, dport = 0, ret = 0; + +@@ -2097,7 +2295,7 @@ int nat46_ipv4_input(struct sk_buff *old + having_l4 = 1; + } + +- if(!pairs_xlate_v4_to_v6_outer(nat46, hdr4, having_l4 ? &sport : NULL, having_l4 ? &dport : NULL, v6saddr, v6daddr)) { ++ if(!pairs_xlate_v4_to_v6_outer(nat46, &apair, hdr4, having_l4 ? &sport : NULL, having_l4 ? &dport : NULL, v6saddr, v6daddr)) { + nat46debug(0, "[nat46] Could not translate v4->v6"); + goto done; + } +--- a/nat46/modules/nat46-core.h ++++ b/nat46/modules/nat46-core.h +@@ -23,6 +23,15 @@ + // #define nat46debug(level, format, ...) + #define nat46debug(level, format, ...) do { if(nat46->debug >= level) { printk(format "\n", ##__VA_ARGS__); } } while (0) + ++#define U8_MASK (uint8_t)(0xFF) ++#define U32_MASK (uint32_t)(~0U) ++#define BITS_PER_BYTE 8 ++#define PSID_LEN_MAX 16 ++#define NUM_RULE_PAIRS_MAX 32 ++#define IPV4_BITS_MAX 32 ++#define EA_LEN_MAX 48 ++#define IPV6_BITS_MAX 128 ++ + #define IPV6HDRSIZE 40 + #define IPV4HDRSIZE 20 + #define IPV6V4HDRDELTA (IPV6HDRSIZE - IPV4HDRSIZE) +@@ -39,6 +48,17 @@ typedef enum { + NAT46_XLATE_RFC6052 + } nat46_xlate_style_t; + ++/* ++ * Enumeration for sorting pairs based on ++ * type of prefix length. ++ */ ++typedef enum { ++ NAT46_IPV4_LOCAL = 0, ++ NAT46_IPV4_REMOTE, ++ NAT46_IPV6_LOCAL, ++ NAT46_IPV6_REMOTE ++} nat46_rule_type_t; ++ + #define NAT46_SIGNATURE 0x544e3634 + #define FREED_NAT46_SIGNATURE 0xdead544e + +@@ -64,7 +84,11 @@ typedef struct { + int debug; + + int npairs; +- nat46_xlate_rulepair_t pairs[0]; /* npairs */ ++ nat46_xlate_rulepair_t pairs[NUM_RULE_PAIRS_MAX]; /* npairs */ ++ nat46_xlate_rulepair_t sorted_ipv4_local_pairs[NUM_RULE_PAIRS_MAX]; /* npairs */ ++ nat46_xlate_rulepair_t sorted_ipv4_remote_pairs[NUM_RULE_PAIRS_MAX]; /* npairs */ ++ nat46_xlate_rulepair_t sorted_ipv6_local_pairs[NUM_RULE_PAIRS_MAX]; /* npairs */ ++ nat46_xlate_rulepair_t sorted_ipv6_remote_pairs[NUM_RULE_PAIRS_MAX]; /* npairs */ + } nat46_instance_t; + + int nat46_ipv6_input(struct sk_buff *old_skb); +--- a/nat46/modules/nat46-netdev.c ++++ b/nat46/modules/nat46-netdev.c +@@ -270,7 +270,14 @@ int nat46_insert(struct net *net, char * + int ret = -1; + if(dev) { + nat46_instance_t *nat46 = netdev_nat46_instance(dev); +- nat46_instance_t *nat46_new = alloc_nat46_instance(nat46->npairs+1, nat46, 0, 1, -1); ++ nat46_instance_t *nat46_new; ++ ++ if(nat46->npairs == NUM_RULE_PAIRS_MAX) { ++ printk("Could not insert a new rule on device %s\n", devname); ++ return ret; ++ } ++ ++ nat46_new = alloc_nat46_instance(nat46->npairs+1, nat46, 0, 1, -1); + if(nat46_new) { + netdev_nat46_set_instance(dev, nat46_new); + ret = nat46_set_ipair_config(nat46_new, 0, buf, strlen(buf)); diff --git a/package/kernel/nat46/patches/106-dummy_header.patch b/package/kernel/nat46/patches/106-dummy_header.patch new file mode 100644 index 0000000000..bad08339e6 --- /dev/null +++ b/package/kernel/nat46/patches/106-dummy_header.patch @@ -0,0 +1,104 @@ +Author: Pavithra R +Date: Wed Aug 5 10:09:45 2020 +0530 + +nat46: Add dummy fragment header for DF=0 IPv4 packet. + +This patch is propagated from 4.4 kernel commit +b45f19e86ebcc19ea26d5e014bfdcb837148f99e. + +Add dummy fragment header to IPv6 translated packet for +every DF=0 IPv4 packet. + +Change-Id: Id72945eefac030e95e4fd18305e48c46e525def3 +Signed-off-by: Pavithra R + +--- a/nat46/modules/nat46-core.c ++++ b/nat46/modules/nat46-core.c +@@ -1996,6 +1996,27 @@ done: + + + ++/* ++ * Function to get MAP-T rules and flags. ++ */ ++bool nat46_get_info(struct net_device *dev, nat46_xlate_rulepair_t **nat46_rule_pair, ++ int *count, u8 *flag) { ++ if ((!dev) || (!nat46_rule_pair) || (!count) || (!flag)) { ++ return false; ++ } ++ ++ if (!nat46_get_rule_config(dev, nat46_rule_pair, count)) { ++ return false; ++ } ++ ++ /* Check add dummy header flag */ ++ if (add_dummy_header) { ++ *flag = ADD_DUMMY_HEADER; ++ } ++ return true; ++} ++EXPORT_SYMBOL(nat46_get_info); ++ + void ip6_update_csum(struct sk_buff * skb, struct ipv6hdr * ip6hdr, int do_atomic_frag) + { + u32 sum1=0; +@@ -2254,6 +2275,11 @@ int nat46_ipv4_input(struct sk_buff *old + } + hdr4 = ip_hdr(old_skb); + check_for_l4 = 1; ++ if (add_dummy_header) { ++ if (0 == (ntohs(hdr4->frag_off) & IP_DF)) { ++ add_frag_header = 1; ++ } ++ } + } else { + add_frag_header = 1; + if (0 == (ntohs(hdr4->frag_off) & 0x1FFF)) { +--- a/nat46/modules/nat46-core.h ++++ b/nat46/modules/nat46-core.h +@@ -32,6 +32,9 @@ + #define EA_LEN_MAX 48 + #define IPV6_BITS_MAX 128 + ++/* Flag definations for MAP-T */ ++#define ADD_DUMMY_HEADER 0x01 ++ + #define IPV6HDRSIZE 40 + #define IPV4HDRSIZE 20 + #define IPV6V4HDRDELTA (IPV6HDRSIZE - IPV4HDRSIZE) +@@ -110,5 +113,6 @@ int xlate_6_to_4(struct net_device *dev, + int xlate_4_to_6(struct net_device *dev, struct iphdr *hdr4, uint16_t sport, uint16_t dport, void *v6saddr, void *v6daddr); + bool nat46_get_rule_config(struct net_device *dev, nat46_xlate_rulepair_t **nat46_rule_pair, int *count); + int nat46_get_npairs(struct net_device *dev); +- ++bool nat46_get_info(struct net_device *dev, nat46_xlate_rulepair_t **nat46_rule_pair, ++ int *count, u8 *flag); + #endif +--- a/nat46/modules/nat46-module.c ++++ b/nat46/modules/nat46-module.c +@@ -59,12 +59,16 @@ MODULE_AUTHOR("Andrew Yourtchenko +Date: Wed Aug 5 10:57:25 2020 +0530 + +nat46: Add support for 64-bits stats. + +This patch is propagated from 4.4 kernel commit +4a2d1dd9bc9331392c7a4947126c361217c82e0c + +Add 64-bits stats functionality for MAP-T interface. + +Change-Id: I4a6f9c7ed3554ac0ec672aa5fa283be2e95cfdc0 +Signed-off-by: Pavithra R + +--- a/nat46/modules/nat46-netdev.c ++++ b/nat46/modules/nat46-netdev.c +@@ -24,6 +24,7 @@ + #include + #include + #include ++#include + #include + #include "nat46-core.h" + #include "nat46-module.h" +@@ -40,16 +41,40 @@ static u8 netdev_count = 0; + + static int nat46_netdev_up(struct net_device *dev); + static int nat46_netdev_down(struct net_device *dev); +- ++static int nat46_netdev_init(struct net_device *dev); ++static void nat46_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *tot); + static netdev_tx_t nat46_netdev_xmit(struct sk_buff *skb, struct net_device *dev); + + + static const struct net_device_ops nat46_netdev_ops = { ++ .ndo_init = nat46_netdev_init, /* device specific initialization */ + .ndo_open = nat46_netdev_up, /* Called at ifconfig nat46 up */ + .ndo_stop = nat46_netdev_down, /* Called at ifconfig nat46 down */ + .ndo_start_xmit = nat46_netdev_xmit, /* REQUIRED, must return NETDEV_TX_OK */ ++ .ndo_get_stats64 = nat46_get_stats64, /* 64 bit device stats */ + }; + ++static int nat46_netdev_init(struct net_device *dev) ++{ ++ int i; ++ dev->tstats = alloc_percpu(struct pcpu_sw_netstats); ++ if (!dev->tstats) { ++ return -ENOMEM; ++ } ++ ++ for_each_possible_cpu(i) { ++ struct pcpu_sw_netstats *ipt_stats; ++ ipt_stats = per_cpu_ptr(dev->tstats, i); ++ u64_stats_init(&ipt_stats->syncp); ++ } ++ return 0; ++} ++ ++static void nat46_netdev_resource_free(struct net_device *dev) ++{ ++ free_percpu(dev->tstats); ++} ++ + static int nat46_netdev_up(struct net_device *dev) + { + netif_start_queue(dev); +@@ -65,9 +90,14 @@ static int nat46_netdev_down(struct net_ + static netdev_tx_t nat46_netdev_xmit(struct sk_buff *skb, struct net_device *dev) + { + int ret = 0; ++ struct pcpu_sw_netstats *tstats = get_cpu_ptr(dev->tstats); ++ ++ u64_stats_update_begin(&tstats->syncp); ++ u64_stats_inc(&tstats->rx_packets); ++ u64_stats_add(&tstats->rx_bytes, skb->len); ++ u64_stats_update_end(&tstats->syncp); ++ put_cpu_ptr(tstats); + +- dev->stats.rx_packets++; +- dev->stats.rx_bytes += skb->len; + if(ETH_P_IP == ntohs(skb->protocol)) { + ret = nat46_ipv4_input(skb); + } +@@ -81,22 +111,39 @@ static netdev_tx_t nat46_netdev_xmit(str + } + + void nat46_netdev_count_xmit(struct sk_buff *skb, struct net_device *dev) { +- dev->stats.tx_packets++; +- dev->stats.tx_bytes += skb->len; ++ struct pcpu_sw_netstats *tstats = get_cpu_ptr(dev->tstats); ++ ++ u64_stats_update_begin(&tstats->syncp); ++ u64_stats_inc(&tstats->tx_packets); ++ u64_stats_add(&tstats->tx_bytes, skb->len); ++ u64_stats_update_end(&tstats->syncp); ++ put_cpu_ptr(tstats); + } + + void nat46_update_stats(struct net_device *dev, uint32_t rx_packets, uint32_t rx_bytes, + uint32_t tx_packets, uint32_t tx_bytes, uint32_t rx_dropped, uint32_t tx_dropped) + { +- dev->stats.rx_packets += rx_packets; +- dev->stats.rx_bytes += rx_bytes; +- dev->stats.tx_packets += tx_packets; +- dev->stats.tx_bytes += tx_bytes; ++ struct pcpu_sw_netstats *tstats = get_cpu_ptr(dev->tstats); ++ ++ u64_stats_update_begin(&tstats->syncp); ++ u64_stats_add(&tstats->rx_packets, rx_packets); ++ u64_stats_add(&tstats->rx_bytes, rx_bytes); ++ u64_stats_add(&tstats->tx_packets, tx_packets); ++ u64_stats_add(&tstats->tx_bytes, tx_bytes); + dev->stats.rx_dropped += rx_dropped; + dev->stats.tx_dropped += tx_dropped; ++ u64_stats_update_end(&tstats->syncp); ++ put_cpu_ptr(tstats); + } + EXPORT_SYMBOL(nat46_update_stats); + ++static void nat46_get_stats64(struct net_device *dev, ++ struct rtnl_link_stats64 *tot) ++{ ++ netdev_stats_to_stats64(tot, &dev->stats); ++ dev_fetch_sw_netstats(tot, dev->tstats); ++} ++ + void *netdev_nat46_instance(struct net_device *dev) { + nat46_netdev_priv_t *priv = netdev_priv(dev); + return priv->nat46; +@@ -120,6 +167,7 @@ static void nat46_netdev_setup(struct ne + priv->nat46 = nat46; + + dev->netdev_ops = &nat46_netdev_ops; ++ dev->priv_destructor = nat46_netdev_resource_free; + dev->type = ARPHRD_NONE; + dev->hard_header_len = 0; + dev->addr_len = 0; diff --git a/package/kernel/nat46/patches/108-ce_port.patch b/package/kernel/nat46/patches/108-ce_port.patch new file mode 100644 index 0000000000..ab6ab37b98 --- /dev/null +++ b/package/kernel/nat46/patches/108-ce_port.patch @@ -0,0 +1,134 @@ +Author: Pavithra R +Date: Wed Aug 5 18:59:20 2020 +0530 + +nat46: Copy CE's port number to IPv6 fragment header. + +This patch is propagated from kernel 4.4 commit +7886fd3eb081c7767b02685593bc1d19deaecba8 + +Copy CE's port number to the lower 16-bits of IPv6 identification +number. + +Change-Id: I6946e93bf8bed4c1378d19e75db0729097e0d9eb +Signed-off-by: Pavithra R + +--- a/nat46/modules/nat46-core.c ++++ b/nat46/modules/nat46-core.c +@@ -31,6 +31,7 @@ + + static uint16_t xlate_pkt_in_err_v4_to_v6(nat46_instance_t *nat46, struct iphdr *iph, + struct sk_buff *old_skb, uint16_t *sport, uint16_t *dport); ++static DEFINE_SPINLOCK(port_id_lock); + + void + nat46debug_dump(nat46_instance_t *nat46, int level, void *addr, int len) +@@ -2236,6 +2237,73 @@ static uint16_t xlate_pkt_in_err_v4_to_v + return 1; + } + ++/* Return the port number from CE's port set */ ++static uint16_t nat46_get_ce_port(nat46_xlate_rulepair_t *pair, uint16_t sport) ++{ ++ /* ++ * 'psid_bits_len' represents number of bits in PSID. ++ * 'offset' represents offset of PSID in a port number. ++ */ ++ uint8_t psid_bits_len, offset, port_set_bitmask; ++ ++ /* ++ * 'psid16' represent PSID value. ++ * 'm' represents number of bits in excluded port set. ++ * 'a' represents number of bits in a 16-bit port number after PSID. ++ * It is used to control number of port in one contiguous port set. ++ * ++ * Name of a variable 'a' and 'm' is as per Appendix B of [RFC7597]. ++ */ ++ uint16_t psid16, value, m, a; ++ nat46_xlate_rule_t *rule; ++ ++ /* stores to last port number from CE's port set */ ++ static uint16_t port_num; ++ ++ rule = &pair->local; ++ offset = rule->psid_offset; ++ ++ if (rule->ea_len + rule->v4_pref_len > IPV4_BITS_MAX) { ++ psid_bits_len = rule->ea_len - (IPV4_BITS_MAX - rule->v4_pref_len); ++ } else { ++ return 0; ++ } ++ a = PSID_LEN_MAX - offset - psid_bits_len; ++ psid16 = (ntohs(sport) >> a) & (0xffff >> (PSID_LEN_MAX - psid_bits_len)); ++ ++ spin_lock(&port_id_lock); ++ ++ /* Start case */ ++ if (0 == port_num) { ++ m = (offset) ? 1 : 0; ++ port_num = (m << (PSID_LEN_MAX - offset)) | (psid16 << a); ++ value = port_num; ++ spin_unlock(&port_id_lock); ++ return value; ++ } ++ ++ /* End of one port set */ ++ port_set_bitmask = (1 << a) - 1; ++ value = port_num & port_set_bitmask; ++ if (0 == (value ^ port_set_bitmask)) { ++ m = port_num >> (PSID_LEN_MAX - offset); ++ m++; ++ /* End case */ ++ if (m >= (1 << offset)) { ++ m = (offset) ? 1 : 0; ++ } ++ port_num = (m << (PSID_LEN_MAX - offset)) | (psid16 << a); ++ value = port_num; ++ spin_unlock(&port_id_lock); ++ return value; ++ } ++ ++ port_num++; ++ value = port_num; ++ spin_unlock(&port_id_lock); ++ return value; ++} ++ + int nat46_ipv4_input(struct sk_buff *old_skb) { + nat46_instance_t *nat46 = get_nat46_instance(old_skb); + nat46_xlate_rulepair_t apair; +@@ -2368,9 +2436,34 @@ int nat46_ipv4_input(struct sk_buff *old + + if (add_frag_header) { + struct frag_hdr *fh = (struct frag_hdr*)(hdr6 + 1); ++ uint16_t ce_port_num = 0; ++ ++ /* Flag to represent whether PSID is assigned to MAP-T node or not */ ++ bool is_psid = false; ++ + fh->frag_off = htons(((ntohs(hdr4->frag_off) >> 13) & 7) + ((ntohs(hdr4->frag_off) & 0x1FFF) << 3)); + fh->nexthdr = hdr4->protocol; +- fh->identification = htonl(ntohs(hdr4->id)); ++ ++ /* ++ * PSID assigned MAP-T node will have non-zero ea_len and we are currently ++ * only supporting NAT46_XLATE_MAP as the CE's rule style. ++ */ ++ is_psid = (apair.local.style == NAT46_XLATE_MAP) && apair.local.ea_len; ++ if (is_psid) { ++ ce_port_num = nat46_get_ce_port(nat46->pairs, sport); ++ nat46debug(10, "\n ce port number is %02x\n", ce_port_num); ++ ++ /* Assign CE's port number as the fragment identifier */ ++ if (ce_port_num) { ++ fh->identification = htonl(ce_port_num); ++ } else { ++ fh->identification = htonl(ntohs(hdr4->id)); ++ } ++ } else { ++ fh->identification = htonl(ntohs(hdr4->id)); ++ } ++ ++ + } + ip6_update_csum(new_skb, hdr6, add_frag_header); + diff --git a/package/kernel/nat46/patches/109-fragment_if_not_df_and_larger_than_mtu.patch b/package/kernel/nat46/patches/109-fragment_if_not_df_and_larger_than_mtu.patch new file mode 100644 index 0000000000..333228a974 --- /dev/null +++ b/package/kernel/nat46/patches/109-fragment_if_not_df_and_larger_than_mtu.patch @@ -0,0 +1,30 @@ +Author: Pavithra R +Date: Wed Aug 5 19:26:48 2020 +0530 + +nat46: Fix the issue of packets not fragmented + +This patch is propagated from the kernel 4.4 commit +e598f9c249092abd7c7978fe99b6690884f225c9 + +when packets size is larger than the MTU of dst, if DF flag is not set, +fragment it instead of dropping it with PktTooBig ICMPv6 message. + +Change-Id: I380d42f59bb4f46a45e542f251f5710f2cca8b62 +Signed-off-by: Pavithra R + +--- a/nat46/modules/nat46-core.c ++++ b/nat46/modules/nat46-core.c +@@ -2343,10 +2343,11 @@ int nat46_ipv4_input(struct sk_buff *old + } + hdr4 = ip_hdr(old_skb); + check_for_l4 = 1; +- if (add_dummy_header) { +- if (0 == (ntohs(hdr4->frag_off) & IP_DF)) { ++ if (0 == (ntohs(hdr4->frag_off) & IP_DF)) { ++ if (add_dummy_header) { + add_frag_header = 1; + } ++ old_skb->ignore_df = 1; + } + } else { + add_frag_header = 1; diff --git a/package/kernel/nat46/patches/110-icmp_error_not_handled.patch b/package/kernel/nat46/patches/110-icmp_error_not_handled.patch new file mode 100644 index 0000000000..5697c60973 --- /dev/null +++ b/package/kernel/nat46/patches/110-icmp_error_not_handled.patch @@ -0,0 +1,100 @@ +Author: Pavithra R +Date: Wed Aug 5 20:16:27 2020 +0530 + +nat46: fix ICMPv6 error message dropped locally + +This patch is propagated from the kernel 4.4 commit +1b96bd0e9ee9182566b119741854c03bf4b94a99 + +While routing IPv6 packets from a customer-side translated device (CLAT) +to a provider-side translated device (PLAT), it is possible that the IPv6 +destination is unknown. In such a scenario, the IPv6 stack must send back +an ICMP error. However, the source IPv6 address of this error message does +not have a MAP-T translation. According to RFC2473, the translation layer +should use the tunnel's own IPv4 address for the IPv6 ICMP packet's source +address. + +Change-Id: I784473cddf9214843c466d10763cb66852139ef6 +Signed-off-by: Pavithra R + +--- a/nat46/modules/nat46-core.c ++++ b/nat46/modules/nat46-core.c +@@ -1782,11 +1782,12 @@ static uint16_t nat46_fixup_icmp(nat46_i + return ret; + } + +-int pairs_xlate_v6_to_v4_outer(nat46_instance_t *nat46, nat46_xlate_rulepair_t *apair, ++int pairs_xlate_v6_to_v4_outer(nat46_instance_t *nat46, nat46_xlate_rulepair_t **papair, + struct ipv6hdr *ip6h, uint16_t proto, __u32 *pv4saddr, __u32 *pv4daddr) { + int ipair = 0; + int xlate_src = -1; + int xlate_dst = -1; ++ nat46_xlate_rulepair_t *apair; + + for(ipair = 0; ipair < nat46->npairs; ipair++) { + apair = nat46_lpm(nat46, NAT46_IPV6_REMOTE, &ip6h->saddr); +@@ -1794,6 +1795,7 @@ int pairs_xlate_v6_to_v4_outer(nat46_ins + return 0; + } + ++ *papair = apair; + if (xlate_v6_to_v4(nat46, &apair->local, &ip6h->daddr, pv4daddr)) { + nat46debug(5, "Dst addr %pI6 to %pI4 \n", &ip6h->daddr, pv4daddr); + xlate_dst = ipair; +@@ -1822,14 +1824,14 @@ int pairs_xlate_v6_to_v4_outer(nat46_ins + } + + int xlate_6_to_4(struct net_device *dev, struct ipv6hdr *ip6h, uint16_t proto, __u32 *pv4saddr, __u32 *pv4daddr) { +- nat46_xlate_rulepair_t apair; ++ nat46_xlate_rulepair_t *apair; + return pairs_xlate_v6_to_v4_outer(netdev_nat46_instance(dev), &apair, ip6h, proto, pv4saddr, pv4daddr); + } + EXPORT_SYMBOL(xlate_6_to_4); + + int nat46_ipv6_input(struct sk_buff *old_skb) { + struct ipv6hdr *ip6h = ipv6_hdr(old_skb); +- nat46_xlate_rulepair_t apair; ++ nat46_xlate_rulepair_t *apair; + nat46_instance_t *nat46 = get_nat46_instance(old_skb); + uint16_t proto; + uint16_t frag_off; +@@ -1903,8 +1905,37 @@ int nat46_ipv6_input(struct sk_buff *old + } + + if (!pairs_xlate_v6_to_v4_outer(nat46, &apair, ip6h, proto, &v4saddr, &v4daddr)) { +- nat46debug(0, "[nat46] Could not translate v6->v4"); +- goto done; ++ if (proto == NEXTHDR_ICMP) { ++ struct icmp6hdr *icmp6h = add_offset(ip6h, v6packet_l3size); ++ struct ipv6hdr *ip6h_inner = (struct ipv6hdr *) (icmp6h + 1); ++ struct ipv6hdr hdr6; ++ switch(icmp6h->icmp6_type) { ++ case ICMPV6_DEST_UNREACH: ++ case ICMPV6_PKT_TOOBIG: ++ case ICMPV6_TIME_EXCEED: ++ case ICMPV6_PARAMPROB: ++ /* ++ * For icmpv6 error message, using the original message ++ * address to locate the apair one more time according ++ * to the RFC 2473, and use the ipv4 address of the ++ * tunnel as SRC ipv4 address ++ */ ++ memcpy(&hdr6.saddr, &ip6h_inner->daddr, 16); ++ memcpy(&hdr6.daddr, &ip6h_inner->saddr, 16); ++ if (!pairs_xlate_v6_to_v4_outer(nat46, &apair, &hdr6, proto, &v4saddr, &v4daddr)) { ++ nat46debug(0, "[nat46] Could not translate v6->v4"); ++ goto done; ++ } ++ v4saddr = apair->local.v4_pref; ++ break; ++ default: ++ nat46debug(0, "[nat46] Could not translate v6->v4"); ++ goto done; ++ } ++ } else { ++ nat46debug(0, "[nat46] Could not translate v6->v4"); ++ goto done; ++ } + } + + if (check_for_l4) { diff --git a/package/kernel/nat46/patches/111-fix_null_point_reference.patch b/package/kernel/nat46/patches/111-fix_null_point_reference.patch new file mode 100644 index 0000000000..4cef9db199 --- /dev/null +++ b/package/kernel/nat46/patches/111-fix_null_point_reference.patch @@ -0,0 +1,40 @@ +Author: Pavithra R +Date: Wed Aug 5 20:35:00 2020 +0530 + +nat46: Fix null pointer dereference issue + +This patch is propagated from the kernel 4.4 commit +5bdf9bd5500c45ab5a3fd43e60c40a09d5e5a13d + +get_nat46_instance possibly returns null point, before using the returning +point, caller needs to check if it is null. + +Change-Id: Id407a71ca8eccd60a713c34429e7e3f16e2cdd12 +Signed-off-by: Pavithra R + +--- a/nat46/modules/nat46-core.c ++++ b/nat46/modules/nat46-core.c +@@ -1847,6 +1847,11 @@ int nat46_ipv6_input(struct sk_buff *old + int l3_infrag_payload_len = ntohs(ip6h->payload_len); + int check_for_l4 = 0; + ++ if (nat46 == NULL) { ++ printk("nat46:%p skb is dropped for no valid instance found\n", old_skb); ++ return err; ++ } ++ + nat46debug(4, "nat46_ipv6_input packet"); + + if(ip6_input_not_interested(nat46, ip6h, old_skb)) { +@@ -2353,6 +2358,11 @@ int nat46_ipv4_input(struct sk_buff *old + + char v6saddr[16], v6daddr[16]; + ++ if (nat46 == NULL) { ++ printk("nat46:%p skb is dropped for no valid instance found\n", old_skb); ++ return err; ++ } ++ + memset(v6saddr, 1, 16); + memset(v6daddr, 2, 16); + diff --git a/package/kernel/nat46/patches/112-fix_icmp_crash.patch b/package/kernel/nat46/patches/112-fix_icmp_crash.patch new file mode 100644 index 0000000000..5d34697a45 --- /dev/null +++ b/package/kernel/nat46/patches/112-fix_icmp_crash.patch @@ -0,0 +1,40 @@ +Author: Pavithra R +Date: Wed Aug 5 20:57:33 2020 +0530 + +Fix crash of free skb + +This patch is propagated from the 4.4 kernel commit +b959b0d45c66ae004a5bfc1687980093fa5b8cc3. + +This is caused by the translation of the inner ipv6 header, it +move memory by the inner head's tot_len which is not exact that +inner packet will be trimmed for icmp error packets size no more +than 576. + +Change-Id: Id5d41fa0721acdf6ea76721c45415fe3be432207 +Signed-off-by: Pavithra R + +--- a/nat46/modules/nat46-core.c ++++ b/nat46/modules/nat46-core.c +@@ -2245,7 +2245,9 @@ static uint16_t xlate_pkt_in_err_v4_to_v + + if (skb_tailroom(old_skb) >= IPV6V4HDRDELTA){ + skb_put(old_skb, IPV6V4HDRDELTA); +- memmove(((char *)iiph + IPV6HDRSIZE), (iiph + 1), ntohs(iiph->tot_len) - IPV4HDRSIZE); ++ /* ErrorICMP size is less than 576, the inner ipv4 packet will be trimmed */ ++ memmove(((char *)iiph + IPV6HDRSIZE), (iiph + 1), ++ ntohs(iph->tot_len) - 2 * IPV4HDRSIZE - sizeof(struct icmphdr)); + memcpy(iiph, &ip6h, IPV6HDRSIZE); + } + else { +@@ -2258,7 +2260,9 @@ static uint16_t xlate_pkt_in_err_v4_to_v + + skb_put(old_skb, IPV6V4HDRDELTA); + iiph = (struct iphdr *)(icmp_hdr(old_skb) + 1); +- memmove(((char *)iiph + IPV6HDRSIZE), (iiph + 1), ntohs(iiph->tot_len) - IPV4HDRSIZE); ++ /* ErrorICMP size is less than 576, the inner ipv4 packet will be trimmed */ ++ memmove(((char *)iiph + IPV6HDRSIZE), (iiph + 1), ++ ntohs(iph->tot_len) - 2 * IPV4HDRSIZE - sizeof(struct icmphdr)); + memcpy(iiph, &ip6h, IPV6HDRSIZE); + nat46 = get_nat46_instance(old_skb); + iph = ip_hdr(old_skb); diff --git a/package/kernel/nat46/patches/116-rate-limit-the-print.patch b/package/kernel/nat46/patches/116-rate-limit-the-print.patch new file mode 100644 index 0000000000..d857d0e6cb --- /dev/null +++ b/package/kernel/nat46/patches/116-rate-limit-the-print.patch @@ -0,0 +1,34 @@ +Author: Pavithra R +Date: Wed Sep 30 14:05:50 2020 +0530 + +nat46: Add rate limit to a print. + +This patch is propagated from the kernel 4.4 commit +d47f62508d2c105f236470e56bedbe279db0e6f1 + +Change-Id: I2119fbe54d630c3ed39535f1cb1b8a0d9d3199b4 +Signed-off-by: Pavithra R +--- a/nat46/modules/nat46-core.c ++++ b/nat46/modules/nat46-core.c +@@ -1928,7 +1928,9 @@ int nat46_ipv6_input(struct sk_buff *old + memcpy(&hdr6.saddr, &ip6h_inner->daddr, 16); + memcpy(&hdr6.daddr, &ip6h_inner->saddr, 16); + if (!pairs_xlate_v6_to_v4_outer(nat46, &apair, &hdr6, proto, &v4saddr, &v4daddr)) { +- nat46debug(0, "[nat46] Could not translate v6->v4"); ++ if (net_ratelimit()) { ++ nat46debug(0, "[nat46] Could not translate v6->v4"); ++ } + goto done; + } + v4saddr = apair->local.v4_pref; +@@ -2436,7 +2438,9 @@ int nat46_ipv4_input(struct sk_buff *old + } + + if(!pairs_xlate_v4_to_v6_outer(nat46, &apair, hdr4, having_l4 ? &sport : NULL, having_l4 ? &dport : NULL, v6saddr, v6daddr)) { +- nat46debug(0, "[nat46] Could not translate v4->v6"); ++ if (net_ratelimit()) { ++ nat46debug(0, "[nat46] Could not translate v4->v6"); ++ } + goto done; + } + diff --git a/package/kernel/nat46/patches/117-fix-icmp-no-payload-bug.patch b/package/kernel/nat46/patches/117-fix-icmp-no-payload-bug.patch new file mode 100644 index 0000000000..a8bff4a945 --- /dev/null +++ b/package/kernel/nat46/patches/117-fix-icmp-no-payload-bug.patch @@ -0,0 +1,34 @@ +Author: Pavithra R +Date: Wed Sep 30 14:27:37 2020 +0530 + +nat46: Fix for ICMP error packets with no payload. + +This patch is propagated from the kernel 4.4 commit +d8b29a8e31f948a5d7338aa69c36e0f654fcb9e4 + +When no payload is attached to the original packet, any +ICMP error message generated in response to such packets +gets dropped due to malformed packet at CE. + +During the translation of packet-in-error in ICMP, +the IPv6 header in ICMPv6 payload gets corrupted. +Hence, the translated packet gets dropped at CE. + +This fix updates the outer IPv4 header's total length +before translating to IPv6 header. + +Change-Id: Ifd9802afb50771de39b4c6fb734d36b0801613ec +Signed-off-by: Pavithra R +--- a/nat46/modules/nat46-core.c ++++ b/nat46/modules/nat46-core.c +@@ -2266,9 +2266,8 @@ static uint16_t xlate_pkt_in_err_v4_to_v + memmove(((char *)iiph + IPV6HDRSIZE), (iiph + 1), + ntohs(iph->tot_len) - 2 * IPV4HDRSIZE - sizeof(struct icmphdr)); + memcpy(iiph, &ip6h, IPV6HDRSIZE); +- nat46 = get_nat46_instance(old_skb); +- iph = ip_hdr(old_skb); + } ++ iph->tot_len = htons(ntohs(iph->tot_len) + IPV6V4HDRDELTA); + + /* Swapping Ports for outer header */ + /* Another work-around till LPM is not present. */ diff --git a/package/kernel/nat46/patches/118-performance_fix.patch b/package/kernel/nat46/patches/118-performance_fix.patch new file mode 100644 index 0000000000..5f10ca10bb --- /dev/null +++ b/package/kernel/nat46/patches/118-performance_fix.patch @@ -0,0 +1,415 @@ +Author: Suruchi Agarwal +Date: Fri Dec 17 13:37:15 2021 -0800 + + nat46: Performance fix + + Avoid allocating new skb and copy for map-t translation + + Change-Id: I621b90609b4642d64b6e4cfb98b105b3fcbb0365 + Signed-off-by: Suruchi Agarwal + +--- a/nat46/modules/nat46-core.c ++++ b/nat46/modules/nat46-core.c +@@ -118,7 +118,7 @@ char *get_next_arg(char **ptail) { + return pc; + } + +-/* ++/* + * Parse an IPv6 address (if pref_len is NULL), or prefix (if it isn't). + * parses destructively (places \0 between address and prefix len) + */ +@@ -163,7 +163,7 @@ int try_parse_ipv4_prefix(u32 *v4addr, i + } + + +-/* ++/* + * parse a rule argument and put config into a rule. + * advance the tail to prepare for the next arg parsing. + * destructive. +@@ -384,7 +384,7 @@ char *xlate_style_to_string(nat46_xlate_ + return "unknown"; + } + +-/* ++/* + * Get the nat46 configuration into a supplied buffer (if non-null). + */ + int nat46_get_ipair_config(nat46_instance_t *nat46, int ipair, char *buf, int count) { +@@ -985,6 +985,28 @@ __sum16 csum_ipv6_unmagic(nat46_instance + return csum; + } + ++/* Update UDP with incremental checksum */ ++__sum16 csum_ipv6_udp_remagic(struct ipv6hdr *ip6hdr, u32 csum) { ++ uint32_t sum; ++ sum = csum_partial(ip6hdr->saddr.s6_addr16, 2 * sizeof(ip6hdr->saddr), ~csum); ++ sum = ((sum >> 16) & 0xffff) + (sum & 0xffff); ++ sum += ((sum >> 16) & 0xffff); ++ return (u16)(~sum); ++} ++ ++/* Undo the IPv4 pseudoheader inclusion into the checksum */ ++__sum16 csum_ipv4_unmagic(__be32 saddr, __be32 daddr, ++ u32 csum) { ++ u32 s; ++ uint32_t addr_csum; ++ csum = ntohs(~csum); ++ addr_csum = (saddr & 0xffff) + (saddr >> 16) + (daddr & 0xffff) + (daddr >> 16); ++ s= csum + ntohs(~addr_csum); ++ s = ((s >> 16) & 0xffff) + (s & 0xffff); ++ s += ((s >> 16) & 0xffff); ++ return htons((u16)(~s)); ++} ++ + /* Update ICMPv6 type/code with incremental checksum adjustment */ + void update_icmp6_type_code(nat46_instance_t *nat46, struct icmp6hdr *icmp6h, u8 type, u8 code) { + u16 old_tc = *((u16 *)icmp6h); +@@ -1038,9 +1060,8 @@ void fill_v6hdr_from_v4hdr(struct iphdr + ip6h->hop_limit = iph->ttl; + } + +-void fill_v4hdr_from_v6hdr(struct iphdr * iph, struct ipv6hdr *ip6h, __u32 v4saddr, __u32 v4daddr, __u16 id, __u16 frag_off, __u16 proto, int l3_payload_len) { +- uint32_t ver_class_flow = ntohl(*(__be32 *)ip6h); +- iph->ttl = ip6h->hop_limit; ++void fill_v4hdr_from_v6hdr(struct iphdr * iph, uint32_t ver_class_flow, uint8_t hop_limit, __u32 v4saddr, __u32 v4daddr, __u16 id, __u16 frag_off, __u16 proto, int l3_payload_len) { ++ iph->ttl = hop_limit; + iph->saddr = v4saddr; + iph->daddr = v4daddr; + iph->protocol = proto; +@@ -1198,6 +1219,8 @@ void pairs_xlate_v6_to_v4_inner(nat46_in + */ + int xlate_payload6_to4(nat46_instance_t *nat46, void *pv6, void *ptrans_hdr, int v6_len, u16 *ul_sum, int *ptailTruncSize) { + struct ipv6hdr *ip6h = pv6; ++ uint32_t ver_class_flow; ++ uint8_t hop_limit; + __u32 v4saddr, v4daddr; + struct iphdr new_ipv4; + struct iphdr *iph = &new_ipv4; +@@ -1274,7 +1297,10 @@ int xlate_payload6_to4(nat46_instance_t + } + } + +- fill_v4hdr_from_v6hdr(iph, ip6h, v4saddr, v4daddr, ipid, ipflags, proto, infrag_payload_len); ++ ver_class_flow = ntohl(*(__be32 *)ip6h); ++ hop_limit = ip6h->hop_limit; ++ ++ fill_v4hdr_from_v6hdr(iph, ver_class_flow, hop_limit, v4saddr, v4daddr, ipid, ipflags, proto, infrag_payload_len); + if(ul_sum) { + *ul_sum = unchecksum16(pv6, (((u8 *)ptrans_hdr)-((u8 *)pv6))/2, *ul_sum); + *ul_sum = rechecksum16(iph, 10, *ul_sum); +@@ -1831,6 +1857,8 @@ EXPORT_SYMBOL(xlate_6_to_4); + + int nat46_ipv6_input(struct sk_buff *old_skb) { + struct ipv6hdr *ip6h = ipv6_hdr(old_skb); ++ uint32_t ver_class_flow; ++ uint8_t hop_limit; + nat46_xlate_rulepair_t *apair; + nat46_instance_t *nat46 = get_nat46_instance(old_skb); + uint16_t proto; +@@ -1839,22 +1867,20 @@ int nat46_ipv6_input(struct sk_buff *old + + struct iphdr * iph; + __u32 v4saddr, v4daddr; +- struct sk_buff * new_skb = 0; + int err = 0; +- int truncSize = 0; + int tailTruncSize = 0; + int v6packet_l3size = sizeof(*ip6h); + int l3_infrag_payload_len = ntohs(ip6h->payload_len); + int check_for_l4 = 0; + +- if (nat46 == NULL) { ++ if (unlikely(nat46 == NULL)) { + printk("nat46:%p skb is dropped for no valid instance found\n", old_skb); + return err; + } + + nat46debug(4, "nat46_ipv6_input packet"); + +- if(ip6_input_not_interested(nat46, ip6h, old_skb)) { ++ if(unlikely(ip6_input_not_interested(nat46, ip6h, old_skb))) { + nat46debug(1, "nat46_ipv6_input not interested"); + goto done; + } +@@ -1985,47 +2011,45 @@ int nat46_ipv6_input(struct sk_buff *old + } + } + +- new_skb = skb_copy(old_skb, GFP_ATOMIC); // other possible option: GFP_ATOMIC +- if (!new_skb) { +- nat46debug(0, "[nat46] Could not copy v6 skb"); +- goto done; +- } ++ ver_class_flow = ntohl(*(__be32 *)ip6h); ++ hop_limit = ip6h->hop_limit; + + /* Remove any debris in the socket control block */ +- memset(IPCB(new_skb), 0, sizeof(struct inet_skb_parm)); ++ memset(IPCB(old_skb), 0, sizeof(struct inet_skb_parm)); ++ + /* Remove netfilter references to IPv6 packet, new netfilter references will be created based on IPv4 packet */ + #if LINUX_VERSION_CODE < KERNEL_VERSION(5,4,0) +- nf_reset(new_skb); ++ nf_reset(old_skb); + #else +- skb_ext_reset(new_skb); +- nf_reset_ct(new_skb); ++ skb_ext_reset(old_skb); ++ nf_reset_ct(old_skb); + #endif + + /* modify packet: actual IPv6->IPv4 transformation */ +- truncSize = v6packet_l3size - sizeof(struct iphdr); /* chop first 20 bytes */ +- skb_pull(new_skb, truncSize); +- skb_put(new_skb, -tailTruncSize); ++ skb_pull(old_skb, sizeof(struct iphdr)); + l3_infrag_payload_len -= tailTruncSize; +- skb_reset_network_header(new_skb); +- skb_set_transport_header(new_skb,IPV4HDRSIZE); /* transport (TCP/UDP/ICMP/...) header starts after 20 bytes */ ++ skb_reset_mac_header(old_skb); ++ skb_reset_network_header(old_skb); ++ skb_set_transport_header(old_skb,IPV4HDRSIZE); /* transport (TCP/UDP/ICMP/...) header starts after 20 bytes */ + + /* build IPv4 header */ +- iph = ip_hdr(new_skb); +- fill_v4hdr_from_v6hdr(iph, ip6h, v4saddr, v4daddr, frag_id, frag_off, proto, l3_infrag_payload_len); +- new_skb->protocol = htons(ETH_P_IP); ++ iph = ip_hdr(old_skb); ++ fill_v4hdr_from_v6hdr(iph, ver_class_flow, hop_limit, v4saddr, v4daddr, frag_id, frag_off, proto, l3_infrag_payload_len); ++ old_skb->protocol = htons(ETH_P_IP); + + if (ntohs(iph->tot_len) >= 2000) { + nat46debug(0, "Too big IP len: %d", ntohs(iph->tot_len)); + } + +- nat46debug(5, "about to send v4 packet, flags: %02x", IPCB(new_skb)->flags); +- nat46_netdev_count_xmit(new_skb, old_skb->dev); ++ nat46debug(5, "about to send v4 packet, flags: %02x", IPCB(old_skb)->flags); ++ nat46_netdev_count_xmit(old_skb, old_skb->dev); + +- /* set skb->iif */ +- new_skb->skb_iif = old_skb->skb_iif; +- +- netif_rx(new_skb); ++ netif_rx(old_skb); + ++ /* ++ * skb was consumed in the ipv4 format, don't release later. ++ */ ++ err = 1; + /* TBD: should copy be released here? */ + + done: +@@ -2056,7 +2080,7 @@ bool nat46_get_info(struct net_device *d + } + EXPORT_SYMBOL(nat46_get_info); + +-void ip6_update_csum(struct sk_buff * skb, struct ipv6hdr * ip6hdr, int do_atomic_frag) ++void ip6_update_csum(struct sk_buff * skb, struct ipv6hdr * ip6hdr, uint32_t v4saddr, uint32_t v4daddr, int do_atomic_frag) + { + u32 sum1=0; + u16 sum2=0; +@@ -2079,12 +2103,13 @@ void ip6_update_csum(struct sk_buff * sk + struct udphdr *udp = udp_hdr(skb); + unsigned udplen = ntohs(ip6hdr->payload_len) - (do_atomic_frag?8:0); /* UDP hdr + payload */ + +- oldsum = udp->check; +- udp->check = 0; +- +- sum1 = csum_partial((char*)udp, udplen, 0); /* calculate checksum for UDP hdr+payload */ +- sum2 = csum_ipv6_magic(&ip6hdr->saddr, &ip6hdr->daddr, udplen, ip6hdr->nexthdr, sum1); /* add pseudoheader */ +- ++ if (!udp->check) { ++ sum1 = csum_partial((char*)udp, udplen, 0); /* calculate checksum for UDP hdr+payload */ ++ sum2 = csum_ipv6_magic(&ip6hdr->saddr, &ip6hdr->daddr, udplen, ip6hdr->nexthdr, sum1); /* add pseudoheader */ ++ } else { ++ sum1 = csum_ipv4_unmagic(v4saddr, v4daddr, udp->check); ++ sum2 = csum_ipv6_udp_remagic(ip6hdr, sum1); ++ } + udp->check = sum2; + + break; +@@ -2348,7 +2373,6 @@ static uint16_t nat46_get_ce_port(nat46_ + int nat46_ipv4_input(struct sk_buff *old_skb) { + nat46_instance_t *nat46 = get_nat46_instance(old_skb); + nat46_xlate_rulepair_t apair; +- struct sk_buff *new_skb; + uint16_t sport = 0, dport = 0, ret = 0; + + int err = 0; +@@ -2360,10 +2384,15 @@ int nat46_ipv4_input(struct sk_buff *old + + struct ipv6hdr * hdr6; + struct iphdr * hdr4 = ip_hdr(old_skb); ++ uint32_t v4saddr, v4daddr; ++ uint8_t ttl; ++ uint16_t tot_len; ++ uint8_t protocol; ++ uint16_t frag_off, id; + + char v6saddr[16], v6daddr[16]; + +- if (nat46 == NULL) { ++ if (unlikely(nat46 == NULL)) { + printk("nat46:%p skb is dropped for no valid instance found\n", old_skb); + return err; + } +@@ -2443,31 +2472,39 @@ int nat46_ipv4_input(struct sk_buff *old + goto done; + } + +- new_skb = skb_copy(old_skb, GFP_ATOMIC); +- if (!new_skb) { +- nat46debug(0, "[nat46] Could not copy v4 skb"); +- goto done; +- } ++ v4saddr = hdr4->saddr; ++ v4daddr = hdr4->daddr; ++ protocol = hdr4->protocol; ++ tot_len = hdr4->tot_len; ++ ttl = hdr4->ttl; ++ frag_off = hdr4->frag_off; ++ id = hdr4->id; + + /* Remove any debris in the socket control block */ +- memset(IP6CB(new_skb), 0, sizeof(struct inet6_skb_parm)); ++ memset(IP6CB(old_skb), 0, sizeof(struct inet6_skb_parm)); + /* Remove netfilter references to IPv4 packet, new netfilter references will be created based on IPv6 packet */ + #if LINUX_VERSION_CODE < KERNEL_VERSION(5,4,0) +- nf_reset(new_skb); ++ nf_reset(old_skb); + #else +- skb_ext_reset(new_skb); +- nf_reset_ct(new_skb); ++ skb_ext_reset(old_skb); ++ nf_reset_ct(old_skb); + #endif + + /* expand header (add 20 extra bytes at the beginning of sk_buff) */ +- pskb_expand_head(new_skb, IPV6HDRSIZE - (hdr4->ihl << 2) + (add_frag_header?8:0), 0, GFP_ATOMIC); ++ if (skb_headroom(old_skb) < IPV6V4HDRDELTA) { ++ ret = pskb_expand_head(old_skb, IPV6V4HDRDELTA + (add_frag_header?8:0), 0, GFP_ATOMIC); ++ if (unlikely(ret)) { ++ nat46debug(0, "[nat46] Could not expand skb header"); ++ goto done; ++ } ++ } + +- skb_push(new_skb, IPV6HDRSIZE - (hdr4->ihl << 2) + (add_frag_header?8:0)); /* push boundary by extra 20 bytes */ ++ skb_push(old_skb, IPV6HDRSIZE - (hdr4->ihl << 2) + (add_frag_header?8:0)); /* push boundary by extra 20 bytes */ + +- skb_reset_network_header(new_skb); +- skb_set_transport_header(new_skb, IPV6HDRSIZE + (add_frag_header?8:0) ); /* transport (TCP/UDP/ICMP/...) header starts after 40 bytes */ ++ skb_reset_network_header(old_skb); ++ skb_set_transport_header(old_skb, IPV6HDRSIZE + (add_frag_header?8:0) ); /* transport (TCP/UDP/ICMP/...) header starts after 40 bytes */ + +- hdr6 = ipv6_hdr(new_skb); ++ hdr6 = ipv6_hdr(old_skb); + memset(hdr6, 0, sizeof(*hdr6) + (add_frag_header?8:0)); + + /* build IPv6 header */ +@@ -2475,13 +2512,14 @@ int nat46_ipv4_input(struct sk_buff *old + *(__be32 *)hdr6 = htonl(0x60000000 | (tclass << 20)) | flowlabel; /* version, priority, flowlabel */ + + /* IPv6 length is a payload length, IPv4 is hdr+payload */ +- hdr6->payload_len = htons(ntohs(hdr4->tot_len) - (hdr4->ihl << 2) + (add_frag_header?8:0)); +- hdr6->nexthdr = hdr4->protocol; +- hdr6->hop_limit = hdr4->ttl; ++ hdr6->payload_len = htons(ntohs(tot_len) - sizeof(struct iphdr) + (add_frag_header?8:0)); ++ hdr6->nexthdr = protocol; ++ hdr6->hop_limit = ttl; ++ + memcpy(&hdr6->saddr, v6saddr, 16); + memcpy(&hdr6->daddr, v6daddr, 16); + +- new_skb->protocol = htons(ETH_P_IPV6); ++ old_skb->protocol = htons(ETH_P_IPV6); + + if (add_frag_header) { + struct frag_hdr *fh = (struct frag_hdr*)(hdr6 + 1); +@@ -2490,8 +2528,8 @@ int nat46_ipv4_input(struct sk_buff *old + /* Flag to represent whether PSID is assigned to MAP-T node or not */ + bool is_psid = false; + +- fh->frag_off = htons(((ntohs(hdr4->frag_off) >> 13) & 7) + ((ntohs(hdr4->frag_off) & 0x1FFF) << 3)); +- fh->nexthdr = hdr4->protocol; ++ fh->frag_off = htons(((ntohs(frag_off) >> 13) & 7) + ((ntohs(frag_off) & 0x1FFF) << 3)); ++ fh->nexthdr = protocol; + + /* + * PSID assigned MAP-T node will have non-zero ea_len and we are currently +@@ -2506,29 +2544,30 @@ int nat46_ipv4_input(struct sk_buff *old + if (ce_port_num) { + fh->identification = htonl(ce_port_num); + } else { +- fh->identification = htonl(ntohs(hdr4->id)); ++ fh->identification = htonl(ntohs(id)); + } + } else { +- fh->identification = htonl(ntohs(hdr4->id)); ++ fh->identification = htonl(ntohs(id)); + } + + + } +- ip6_update_csum(new_skb, hdr6, add_frag_header); ++ ip6_update_csum(old_skb, hdr6, v4saddr, v4daddr, add_frag_header); + +- hdr6->nexthdr = add_frag_header ? NEXTHDR_FRAGMENT : hdr4->protocol; ++ hdr6->nexthdr = add_frag_header ? NEXTHDR_FRAGMENT : protocol; + + + // FIXME: check if you can not fit the packet into the cached MTU +- // if (dst_mtu(skb_dst(new_skb))==0) { } +- +- nat46debug(5, "about to send v6 packet, flags: %02x", IP6CB(new_skb)->flags); +- nat46_netdev_count_xmit(new_skb, old_skb->dev); ++ // if (dst_mtu(skb_dst(old_skb))==0) { } + +- /* set skb->iif */ +- new_skb->skb_iif = old_skb->skb_iif; ++ nat46debug(5, "about to send v6 packet, flags: %02x", IPCB(old_skb)->flags); ++ nat46_netdev_count_xmit(old_skb, old_skb->dev); ++ netif_rx(old_skb); + +- netif_rx(new_skb); ++ /* ++ * skb was reused, needn't free it later. ++ */ ++ err = 1; + + done: + release_nat46_instance(nat46); +--- a/nat46/modules/nat46-core.h ++++ b/nat46/modules/nat46-core.h +@@ -39,7 +39,7 @@ + #define IPV4HDRSIZE 20 + #define IPV6V4HDRDELTA (IPV6HDRSIZE - IPV4HDRSIZE) + +-/* ++/* + * A generic v4<->v6 translation structure. + * The currently supported translation styles: + */ +--- a/nat46/modules/nat46-netdev.c ++++ b/nat46/modules/nat46-netdev.c +@@ -100,8 +100,7 @@ static netdev_tx_t nat46_netdev_xmit(str + + if(ETH_P_IP == ntohs(skb->protocol)) { + ret = nat46_ipv4_input(skb); +- } +- if(ETH_P_IPV6 == ntohs(skb->protocol)) { ++ }else if(ETH_P_IPV6 == ntohs(skb->protocol)) { + ret = nat46_ipv6_input(skb); + } + if(0 == ret) { +@@ -174,6 +173,7 @@ static void nat46_netdev_setup(struct ne + dev->mtu = 16384; /* iptables does reassembly. Rather than using ETH_DATA_LEN, let's try to get as much mileage as we can with the Linux stack */ + dev->features = NETIF_F_NETNS_LOCAL; + dev->flags = IFF_NOARP | IFF_POINTOPOINT; ++ dev->priv_flags_ext = IFF_EXT_MAPT; + } + + int nat46_netdev_create(struct net *net, char *basename, struct net_device **dev) diff --git a/package/kernel/nat46/patches/120-sleeping_backtrace.patch b/package/kernel/nat46/patches/120-sleeping_backtrace.patch new file mode 100644 index 0000000000..5963af2b03 --- /dev/null +++ b/package/kernel/nat46/patches/120-sleeping_backtrace.patch @@ -0,0 +1,57 @@ +commit 9457a8be6e700f39e6b545f8db0edd30c0693700 +Author: Ken Zhu +Date: Tue Sep 6 11:11:20 2022 -0700 + + nat46: fix sleeping warning back trace + + use spin_lock instead of mutex_lock since + mutex_lock could sleep in the kernel packet process. + + Change-Id: I65c15a9f618ef296159884a0d6d742e66aaf6623 + Signed-off-by: Ken Zhu + +--- a/nat46/modules/nat46-glue.c ++++ b/nat46/modules/nat46-glue.c +@@ -18,7 +18,7 @@ + #include "nat46-glue.h" + #include "nat46-core.h" + +-static DEFINE_MUTEX(ref_lock); ++static DEFINE_SPINLOCK(ref_lock); + int is_valid_nat46(nat46_instance_t *nat46) { + return (nat46 && (nat46->sig == NAT46_SIGNATURE)); + } +@@ -47,28 +47,27 @@ nat46_instance_t *alloc_nat46_instance(i + return nat46; + } + +- + nat46_instance_t *get_nat46_instance(struct sk_buff *sk) { + nat46_instance_t *nat46 = netdev_nat46_instance(sk->dev); +- mutex_lock(&ref_lock); ++ spin_lock_bh(&ref_lock); + if (is_valid_nat46(nat46)) { + nat46->refcount++; +- mutex_unlock(&ref_lock); ++ spin_unlock_bh(&ref_lock); + return nat46; + } else { + printk("[nat46] get_nat46_instance: Could not find a valid NAT46 instance!"); +- mutex_unlock(&ref_lock); ++ spin_unlock_bh(&ref_lock); + return NULL; + } + } + + void release_nat46_instance(nat46_instance_t *nat46) { +- mutex_lock(&ref_lock); ++ spin_lock_bh(&ref_lock); + nat46->refcount--; + if(0 == nat46->refcount) { + printk("[nat46] release_nat46_instance: freeing nat46 instance with %d pairs\n", nat46->npairs); + nat46->sig = FREED_NAT46_SIGNATURE; + kfree(nat46); + } +- mutex_unlock(&ref_lock); ++ spin_unlock_bh(&ref_lock); + } diff --git a/package/kernel/nat46/patches/121-tos-fix.patch b/package/kernel/nat46/patches/121-tos-fix.patch new file mode 100644 index 0000000000..6b265886f5 --- /dev/null +++ b/package/kernel/nat46/patches/121-tos-fix.patch @@ -0,0 +1,27 @@ +Author: Ramkishan Gurjar +Date: Thu Nov 16 15:30:04 2023 +0530 + + nat46: Fix traffic class is not set in ipv6 Header from ipv4 tos value. + + Change-Id: I781d7af8bc9751dd23f6c3f4195644b3f9025fcb + Signed-off-by: Ramkishan Gurjar + +--- a/nat46/modules/nat46-core.c ++++ b/nat46/modules/nat46-core.c +@@ -2397,6 +2397,8 @@ int nat46_ipv4_input(struct sk_buff *old + return err; + } + ++ tclass = ip_tos_ignore ? 0 : hdr4->tos; /* traffic class */ ++ + memset(v6saddr, 1, 16); + memset(v6daddr, 2, 16); + +@@ -2508,7 +2510,6 @@ int nat46_ipv4_input(struct sk_buff *old + memset(hdr6, 0, sizeof(*hdr6) + (add_frag_header?8:0)); + + /* build IPv6 header */ +- tclass = ip_tos_ignore ? 0 : hdr4->tos; /* traffic class */ + *(__be32 *)hdr6 = htonl(0x60000000 | (tclass << 20)) | flowlabel; /* version, priority, flowlabel */ + + /* IPv6 length is a payload length, IPv4 is hdr+payload */ diff --git a/package/kernel/qca-nss-dp/patches/0011-02-nss_dp_switchdev-correctly-unregister-notifier-on-dp.patch b/package/kernel/qca-nss-dp/patches/0011-02-nss_dp_switchdev-correctly-unregister-notifier-on-dp.patch index 5abf178d38..dc5d9ac54a 100644 --- a/package/kernel/qca-nss-dp/patches/0011-02-nss_dp_switchdev-correctly-unregister-notifier-on-dp.patch +++ b/package/kernel/qca-nss-dp/patches/0011-02-nss_dp_switchdev-correctly-unregister-notifier-on-dp.patch @@ -39,7 +39,7 @@ Signed-off-by: Christian Marangi --- a/nss_dp_switchdev.c +++ b/nss_dp_switchdev.c -@@ -648,4 +648,17 @@ void nss_dp_switchdev_setup(struct net_d +@@ -655,4 +655,17 @@ void nss_dp_switchdev_setup(struct net_d switch_init_done = true; } diff --git a/package/kernel/qca-nss-dp/patches/0012-01-syn-gmac-use-standard-DMA-api.patch b/package/kernel/qca-nss-dp/patches/0012-01-syn-gmac-use-standard-DMA-api.patch index 882bc8cad9..654f6ef99f 100644 --- a/package/kernel/qca-nss-dp/patches/0012-01-syn-gmac-use-standard-DMA-api.patch +++ b/package/kernel/qca-nss-dp/patches/0012-01-syn-gmac-use-standard-DMA-api.patch @@ -16,11 +16,9 @@ Signed-off-by: George Moussalem hal/dp_ops/syn_gmac_dp/syn_dp_tx.c | 23 ++++--------- 4 files changed, 42 insertions(+), 44 deletions(-) -diff --git a/hal/dp_ops/syn_gmac_dp/syn_dp_cfg_rx.c b/hal/dp_ops/syn_gmac_dp/syn_dp_cfg_rx.c -index 8cbbcaaf..1c9006c7 100644 --- a/hal/dp_ops/syn_gmac_dp/syn_dp_cfg_rx.c +++ b/hal/dp_ops/syn_gmac_dp/syn_dp_cfg_rx.c -@@ -26,6 +26,7 @@ static int syn_dp_cfg_rx_setup_desc_queue(struct syn_dp_info *dev_info) +@@ -26,6 +26,7 @@ static int syn_dp_cfg_rx_setup_desc_queu { struct syn_dp_info_rx *rx_info = &dev_info->dp_info_rx; struct dma_desc_rx *first_desc = NULL; @@ -28,7 +26,7 @@ index 8cbbcaaf..1c9006c7 100644 struct net_device *netdev = rx_info->netdev; netdev_dbg(netdev, "Total size of memory required for Rx Descriptors in Ring Mode = %u\n", (uint32_t)((sizeof(struct dma_desc_rx) * SYN_DP_RX_DESC_SIZE))); -@@ -33,13 +34,15 @@ static int syn_dp_cfg_rx_setup_desc_queue(struct syn_dp_info *dev_info) +@@ -33,13 +34,15 @@ static int syn_dp_cfg_rx_setup_desc_queu /* * Allocate cacheable descriptors for Rx */ @@ -46,7 +44,7 @@ index 8cbbcaaf..1c9006c7 100644 rx_info->rx_desc = first_desc; syn_dp_gmac_rx_desc_init_ring(rx_info->rx_desc, SYN_DP_RX_DESC_SIZE); -@@ -98,6 +101,10 @@ void syn_dp_cfg_rx_cleanup_rings(struct syn_dp_info *dev_info) +@@ -98,6 +101,10 @@ void syn_dp_cfg_rx_cleanup_rings(struct for (i = 0; i < rx_info->busy_rx_desc_cnt; i++) { rx_skb_index = (rx_skb_index + i) & SYN_DP_RX_DESC_MAX_INDEX; rxdesc = rx_info->rx_desc; @@ -57,7 +55,7 @@ index 8cbbcaaf..1c9006c7 100644 skb = rx_info->rx_buf_pool[rx_skb_index].skb; if (unlikely(skb != NULL)) { dev_kfree_skb_any(skb); -@@ -105,7 +112,8 @@ void syn_dp_cfg_rx_cleanup_rings(struct syn_dp_info *dev_info) +@@ -105,7 +112,8 @@ void syn_dp_cfg_rx_cleanup_rings(struct } } @@ -67,11 +65,9 @@ index 8cbbcaaf..1c9006c7 100644 rx_info->rx_desc = NULL; dev_info->rx_desc_dma_addr = (dma_addr_t)0; } -diff --git a/hal/dp_ops/syn_gmac_dp/syn_dp_cfg_tx.c b/hal/dp_ops/syn_gmac_dp/syn_dp_cfg_tx.c -index bf5e19a0..284e8880 100644 --- a/hal/dp_ops/syn_gmac_dp/syn_dp_cfg_tx.c +++ b/hal/dp_ops/syn_gmac_dp/syn_dp_cfg_tx.c -@@ -91,6 +91,8 @@ void syn_dp_cfg_tx_cleanup_rings(struct syn_dp_info *dev_info) +@@ -91,6 +91,8 @@ void syn_dp_cfg_tx_cleanup_rings(struct tx_skb_index = syn_dp_tx_inc_index(tx_skb_index, i); txdesc = tx_info->tx_desc; @@ -80,11 +76,9 @@ index bf5e19a0..284e8880 100644 skb = tx_info->tx_buf_pool[tx_skb_index].skb; if (unlikely(skb != NULL)) { dev_kfree_skb_any(skb); -diff --git a/hal/dp_ops/syn_gmac_dp/syn_dp_rx.c b/hal/dp_ops/syn_gmac_dp/syn_dp_rx.c -index 1ddeb7d6..1798d4e7 100644 --- a/hal/dp_ops/syn_gmac_dp/syn_dp_rx.c +++ b/hal/dp_ops/syn_gmac_dp/syn_dp_rx.c -@@ -73,16 +73,6 @@ static inline void syn_dp_rx_refill_one_desc(struct dma_desc_rx *rx_desc, +@@ -73,16 +73,6 @@ static inline void syn_dp_rx_refill_one_ */ static inline void syn_dp_rx_inval_and_flush(struct syn_dp_info_rx *rx_info, uint32_t start, uint32_t end) { @@ -101,7 +95,7 @@ index 1ddeb7d6..1798d4e7 100644 dsb(st); } -@@ -124,15 +114,19 @@ int syn_dp_rx_refill_page_mode(struct syn_dp_info_rx *rx_info) +@@ -124,15 +114,19 @@ int syn_dp_rx_refill_page_mode(struct sy break; } @@ -125,7 +119,7 @@ index 1ddeb7d6..1798d4e7 100644 rx_refill_idx = rx_info->rx_refill_idx; rx_desc = rx_info->rx_desc + rx_refill_idx; -@@ -181,8 +175,15 @@ int syn_dp_rx_refill(struct syn_dp_info_rx *rx_info) +@@ -181,8 +175,15 @@ int syn_dp_rx_refill(struct syn_dp_info_ skb_reserve(skb, SYN_DP_SKB_HEADROOM + NET_IP_ALIGN); @@ -143,7 +137,7 @@ index 1ddeb7d6..1798d4e7 100644 rx_refill_idx = rx_info->rx_refill_idx; rx_desc = rx_info->rx_desc + rx_refill_idx; -@@ -407,12 +408,6 @@ int syn_dp_rx(struct syn_dp_info_rx *rx_info, int budget) +@@ -407,12 +408,6 @@ int syn_dp_rx(struct syn_dp_info_rx *rx_ * this code is executing. */ end = syn_dp_rx_inc_index(rx_info->rx_idx, busy); @@ -156,7 +150,7 @@ index 1ddeb7d6..1798d4e7 100644 dsb(st); -@@ -439,8 +434,12 @@ int syn_dp_rx(struct syn_dp_info_rx *rx_info, int budget) +@@ -439,8 +434,12 @@ int syn_dp_rx(struct syn_dp_info_rx *rx_ * speculative prefetch by CPU may have occurred. */ frame_length = syn_dp_gmac_get_rx_desc_frame_length(status); @@ -171,11 +165,9 @@ index 1ddeb7d6..1798d4e7 100644 prefetch((void *)rx_buf->map_addr_virt); rx_next_idx = syn_dp_rx_inc_index(rx_idx, 1); -diff --git a/hal/dp_ops/syn_gmac_dp/syn_dp_tx.c b/hal/dp_ops/syn_gmac_dp/syn_dp_tx.c -index c97e252b..6d4adb3f 100644 --- a/hal/dp_ops/syn_gmac_dp/syn_dp_tx.c +++ b/hal/dp_ops/syn_gmac_dp/syn_dp_tx.c -@@ -104,9 +104,7 @@ static inline struct dma_desc_tx *syn_dp_tx_process_nr_frags(struct syn_dp_info_ +@@ -104,9 +104,7 @@ static inline struct dma_desc_tx *syn_dp BUG_ON(!length); #endif @@ -186,7 +178,7 @@ index c97e252b..6d4adb3f 100644 *total_length += length; tx_desc = syn_dp_tx_set_desc_sg(tx_info, dma_addr, length, DESC_OWN_BY_DMA); -@@ -150,8 +148,7 @@ int syn_dp_tx_nr_frags(struct syn_dp_info_tx *tx_info, struct sk_buff *skb) +@@ -150,8 +148,7 @@ int syn_dp_tx_nr_frags(struct syn_dp_inf /* * Flush the dma for non-paged skb data */ @@ -196,7 +188,7 @@ index c97e252b..6d4adb3f 100644 total_len = length; -@@ -256,12 +253,7 @@ int syn_dp_tx_frag_list(struct syn_dp_info_tx *tx_info, struct sk_buff *skb) +@@ -256,12 +253,7 @@ int syn_dp_tx_frag_list(struct syn_dp_in return NETDEV_TX_BUSY; } @@ -210,7 +202,7 @@ index c97e252b..6d4adb3f 100644 total_len = length; -@@ -290,9 +282,7 @@ int syn_dp_tx_frag_list(struct syn_dp_info_tx *tx_info, struct sk_buff *skb) +@@ -290,9 +282,7 @@ int syn_dp_tx_frag_list(struct syn_dp_in BUG_ON(!length); #endif @@ -221,7 +213,7 @@ index c97e252b..6d4adb3f 100644 total_len += length; -@@ -445,6 +435,7 @@ int syn_dp_tx_complete(struct syn_dp_info_tx *tx_info, int budget) +@@ -445,6 +435,7 @@ int syn_dp_tx_complete(struct syn_dp_inf break; } @@ -229,7 +221,7 @@ index c97e252b..6d4adb3f 100644 if (likely(status & DESC_TX_LAST)) { tx_skb_index = syn_dp_tx_comp_index_get(tx_info); -@@ -571,9 +562,7 @@ int syn_dp_tx(struct syn_dp_info_tx *tx_info, struct sk_buff *skb) +@@ -571,9 +562,7 @@ int syn_dp_tx(struct syn_dp_info_tx *tx_ return NETDEV_TX_BUSY; } @@ -240,6 +232,3 @@ index c97e252b..6d4adb3f 100644 /* * Queue packet to the GMAC rings --- -2.40.1 - diff --git a/package/kernel/qca-nss-dp/patches/0012-02-ipq50xx-use-corrent-scm-function-to-write-tcsr.patch b/package/kernel/qca-nss-dp/patches/0012-02-ipq50xx-use-corrent-scm-function-to-write-tcsr.patch index 10a8eef6da..25fef48fce 100644 --- a/package/kernel/qca-nss-dp/patches/0012-02-ipq50xx-use-corrent-scm-function-to-write-tcsr.patch +++ b/package/kernel/qca-nss-dp/patches/0012-02-ipq50xx-use-corrent-scm-function-to-write-tcsr.patch @@ -13,8 +13,6 @@ Signed-off-by: George Moussalem hal/soc_ops/ipq50xx/nss_ipq50xx.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) -diff --git a/hal/soc_ops/ipq50xx/nss_ipq50xx.c b/hal/soc_ops/ipq50xx/nss_ipq50xx.c -index 3e4491c0..e56de1cc 100644 --- a/hal/soc_ops/ipq50xx/nss_ipq50xx.c +++ b/hal/soc_ops/ipq50xx/nss_ipq50xx.c @@ -18,7 +18,7 @@ @@ -41,6 +39,3 @@ index 3e4491c0..e56de1cc 100644 if (err) { pr_err("%s: SCM TCSR write error: %d\n", __func__, err); } --- -2.40.1 - diff --git a/package/kernel/qca-nss-dp/patches/0013-nss_dp_main-support-fixed-link.patch b/package/kernel/qca-nss-dp/patches/0013-nss_dp_main-support-fixed-link.patch index 668046881a..97057149e5 100644 --- a/package/kernel/qca-nss-dp/patches/0013-nss_dp_main-support-fixed-link.patch +++ b/package/kernel/qca-nss-dp/patches/0013-nss_dp_main-support-fixed-link.patch @@ -16,11 +16,9 @@ Signed-off-by: George Moussalem nss_dp_main.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) -diff --git a/nss_dp_main.c b/nss_dp_main.c -index 9a09edd5..204063bf 100644 --- a/nss_dp_main.c +++ b/nss_dp_main.c -@@ -619,11 +619,20 @@ static int32_t nss_dp_of_get_pdata(struct device_node *np, +@@ -634,11 +634,20 @@ static int32_t nss_dp_of_get_pdata(struc } dp_priv->phy_node = of_parse_phandle(np, "phy-handle", 0); @@ -44,6 +42,3 @@ index 9a09edd5..204063bf 100644 if (of_property_read_u32(np, "qcom,mactype", &hal_pdata->mactype)) { pr_err("%s: error reading mactype\n", np->name); return -EFAULT; --- -2.40.1 - diff --git a/package/kernel/qca-ssdk/patches/0012-suppress-noisy-error-log.patch b/package/kernel/qca-ssdk/patches/0012-suppress-noisy-error-log.patch index 78bb4644b3..f14443b46b 100644 --- a/package/kernel/qca-ssdk/patches/0012-suppress-noisy-error-log.patch +++ b/package/kernel/qca-ssdk/patches/0012-suppress-noisy-error-log.patch @@ -1,6 +1,6 @@ --- a/src/hsl/phy/hsl_phy.c +++ b/src/hsl/phy/hsl_phy.c -@@ -785,7 +785,7 @@ hsl_phy_phydev_get(a_uint32_t dev_id, a_ +@@ -761,7 +761,7 @@ hsl_phy_phydev_get(a_uint32_t dev_id, a_ *phydev = miibus->phy_map[phy_addr]; if(*phydev == NULL) { @@ -9,7 +9,7 @@ return SW_NOT_INITIALIZED; } pdev_addr = (*phydev)->addr; -@@ -795,7 +795,7 @@ hsl_phy_phydev_get(a_uint32_t dev_id, a_ +@@ -771,7 +771,7 @@ hsl_phy_phydev_get(a_uint32_t dev_id, a_ *phydev = mdiobus_get_phy(miibus, phy_addr); if(*phydev == NULL) { diff --git a/package/kernel/qca-ssdk/patches/111-hsl_phy-split-MP_PHY-config.patch b/package/kernel/qca-ssdk/patches/111-hsl_phy-split-MP_PHY-config.patch index 8dd18c08e0..978288d6d3 100644 --- a/package/kernel/qca-ssdk/patches/111-hsl_phy-split-MP_PHY-config.patch +++ b/package/kernel/qca-ssdk/patches/111-hsl_phy-split-MP_PHY-config.patch @@ -18,8 +18,6 @@ Signed-off-by: George Moussalem src/hsl/phy/hsl_phy.c | 4 ++-- 5 files changed, 13 insertions(+), 9 deletions(-) -diff --git a/config b/config -index 99d99dff..1f74e4f8 100644 --- a/config +++ b/config @@ -299,6 +299,7 @@ else ifeq (DESS, $(CHIP_TYPE)) @@ -30,8 +28,6 @@ index 99d99dff..1f74e4f8 100644 IN_SFP_PHY=TRUE IN_SFP=TRUE else ifeq (APPE, $(CHIP_TYPE)) -diff --git a/make/linux_opt.mk b/make/linux_opt.mk -index 6936b754..66b08ef5 100644 --- a/make/linux_opt.mk +++ b/make/linux_opt.mk @@ -183,6 +183,11 @@ endif @@ -46,8 +42,6 @@ index 6936b754..66b08ef5 100644 ifeq (TRUE, $(IN_SFP_PHY)) MODULE_CFLAG += -DIN_SFP_PHY endif -diff --git a/src/adpt/mp/adpt_mp_portctrl.c b/src/adpt/mp/adpt_mp_portctrl.c -index 2c983fff..db60fc72 100644 --- a/src/adpt/mp/adpt_mp_portctrl.c +++ b/src/adpt/mp/adpt_mp_portctrl.c @@ -92,12 +92,15 @@ static sw_error_t @@ -66,7 +60,7 @@ index 2c983fff..db60fc72 100644 /*internal gephy reset*/ SW_RTN_ON_NULL (phy_drv = hsl_phy_api_ops_get(dev_id, port_id)); -@@ -107,6 +110,7 @@ adpt_mp_port_reset_set(a_uint32_t dev_id, a_uint32_t port_id) +@@ -107,6 +110,7 @@ adpt_mp_port_reset_set(a_uint32_t dev_id SW_RTN_ON_ERROR (rv); rv = phy_drv->phy_function_reset(dev_id, phy_addr, PHY_FIFO_RESET); SW_RTN_ON_ERROR (rv); @@ -74,8 +68,6 @@ index 2c983fff..db60fc72 100644 } else if (port_id == SSDK_PHYSICAL_PORT2) { rv = adpt_mp_uniphy_adapter_port_reset(dev_id, port_id); } else { -diff --git a/src/hsl/phy/Makefile b/src/hsl/phy/Makefile -index 68d0679f..0eae9377 100755 --- a/src/hsl/phy/Makefile +++ b/src/hsl/phy/Makefile @@ -23,7 +23,7 @@ ifeq (ISIS, $(CHIP_TYPE)) @@ -100,8 +92,6 @@ index 68d0679f..0eae9377 100755 endif ifeq (NONHK_CHIP, $(CHIP_TYPE)) -diff --git a/src/hsl/phy/hsl_phy.c b/src/hsl/phy/hsl_phy.c -index f2cf90e2..efab2343 100644 --- a/src/hsl/phy/hsl_phy.c +++ b/src/hsl/phy/hsl_phy.c @@ -28,7 +28,7 @@ @@ -113,7 +103,7 @@ index f2cf90e2..efab2343 100644 #include "mpge_phy.h" #endif #ifdef IN_MALIBU_PHY -@@ -94,7 +94,7 @@ phy_driver_instance_t ssdk_phy_driver[] = +@@ -94,7 +94,7 @@ phy_driver_instance_t ssdk_phy_driver[] #else {SFP_PHY_CHIP, {0}, NULL, NULL, NULL}, #endif @@ -122,6 +112,3 @@ index f2cf90e2..efab2343 100644 {MPGE_PHY_CHIP, {0}, NULL, mpge_phy_init, NULL}, #else {MPGE_PHY_CHIP, {0}, NULL, NULL, NULL}, --- -2.40.1 - diff --git a/package/kernel/qca-ssdk/patches/112-init-MP-allow-to-ignore-reset-controlls.patch b/package/kernel/qca-ssdk/patches/112-init-MP-allow-to-ignore-reset-controlls.patch index 616ccea252..86cbda64de 100644 --- a/package/kernel/qca-ssdk/patches/112-init-MP-allow-to-ignore-reset-controlls.patch +++ b/package/kernel/qca-ssdk/patches/112-init-MP-allow-to-ignore-reset-controlls.patch @@ -18,8 +18,6 @@ Signed-off-by: George Moussalem src/init/ssdk_clk.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) -diff --git a/src/init/ssdk_clk.c b/src/init/ssdk_clk.c -index 71e59452..bc244c6e 100644 --- a/src/init/ssdk_clk.c +++ b/src/init/ssdk_clk.c @@ -1282,10 +1282,8 @@ ssdk_mp_reset_init(void) @@ -35,6 +33,3 @@ index 71e59452..bc244c6e 100644 ssdk_gcc_reset(rst, SSDK_RESET_ASSERT); msleep(200); ssdk_gcc_reset(rst, SSDK_RESET_DEASSERT); --- -2.40.1 - diff --git a/package/kernel/qca-ssdk/patches/121-MP-fix-build-issues.patch b/package/kernel/qca-ssdk/patches/121-MP-fix-build-issues.patch index 14fe42bc73..71e637bc5e 100644 --- a/package/kernel/qca-ssdk/patches/121-MP-fix-build-issues.patch +++ b/package/kernel/qca-ssdk/patches/121-MP-fix-build-issues.patch @@ -15,11 +15,9 @@ Signed-off-by: George Moussalem src/adpt/mp/adpt_mp_portctrl.c | 3 ++- 2 files changed, 3 insertions(+), 30 deletions(-) -diff --git a/config b/config -index 1f74e4f8..58d67648 100644 --- a/config +++ b/config -@@ -374,6 +374,7 @@ ifneq (, $(filter MPPE APPE HPPE CPPE ALL_CHIP, $(CHIP_TYPE))) +@@ -374,6 +374,7 @@ ifneq (, $(filter MPPE APPE HPPE CPPE AL endif ifneq (, $(filter MP, $(CHIP_TYPE))) @@ -63,11 +61,9 @@ index 1f74e4f8..58d67648 100644 IN_CTRLPKT=TRUE endif -diff --git a/src/adpt/mp/adpt_mp_portctrl.c b/src/adpt/mp/adpt_mp_portctrl.c -index db60fc72..c230e214 100644 --- a/src/adpt/mp/adpt_mp_portctrl.c +++ b/src/adpt/mp/adpt_mp_portctrl.c -@@ -45,7 +45,8 @@ _adpt_mp_gcc_mac_clock_set(a_uint32_t dev_id, +@@ -45,7 +45,8 @@ _adpt_mp_gcc_mac_clock_set(a_uint32_t de static a_bool_t _adpt_mp_port_phy_connected (a_uint32_t dev_id, fal_port_t port_id) { @@ -77,6 +73,3 @@ index db60fc72..c230e214 100644 /* force port which connect s17c or other device chip*/ if (hsl_port_feature_get(dev_id, port_id, PHY_F_FORCE | PHY_F_SFP)) { --- -2.40.1 - diff --git a/package/kernel/qca-ssdk/patches/122-init-replace-ioremap_nocache-with-ioremap.patch b/package/kernel/qca-ssdk/patches/122-init-replace-ioremap_nocache-with-ioremap.patch index 1e1e909bdb..5d6980ab1b 100644 --- a/package/kernel/qca-ssdk/patches/122-init-replace-ioremap_nocache-with-ioremap.patch +++ b/package/kernel/qca-ssdk/patches/122-init-replace-ioremap_nocache-with-ioremap.patch @@ -12,11 +12,9 @@ Signed-off-by: George Moussalem src/init/ssdk_clk.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -diff --git a/src/init/ssdk_clk.c b/src/init/ssdk_clk.c -index bc244c6e..dc45691e 100644 --- a/src/init/ssdk_clk.c +++ b/src/init/ssdk_clk.c -@@ -1183,7 +1183,7 @@ ssdk_mp_tcsr_get(a_uint32_t tcsr_offset, a_uint32_t *tcsr_val) +@@ -1183,7 +1183,7 @@ ssdk_mp_tcsr_get(a_uint32_t tcsr_offset, { void __iomem *tcsr_base = NULL; @@ -25,7 +23,7 @@ index bc244c6e..dc45691e 100644 if (!tcsr_base) { SSDK_ERROR("Failed to map tcsr eth address!\n"); -@@ -1200,7 +1200,7 @@ ssdk_mp_tcsr_set(a_uint32_t tcsr_offset, a_uint32_t tcsr_val) +@@ -1200,7 +1200,7 @@ ssdk_mp_tcsr_set(a_uint32_t tcsr_offset, { void __iomem *tcsr_base = NULL; @@ -43,7 +41,7 @@ index bc244c6e..dc45691e 100644 if (!pll_lock) { SSDK_ERROR("Failed to map CMN PLL LOCK register!\n"); return A_FALSE; -@@ -1303,7 +1303,7 @@ static void ssdk_cmnblk_pll_src_set(enum cmnblk_pll_src_type pll_source) +@@ -1303,7 +1303,7 @@ static void ssdk_cmnblk_pll_src_set(enum void __iomem *cmn_pll_src_base = NULL; a_uint32_t reg_val; @@ -52,6 +50,3 @@ index bc244c6e..dc45691e 100644 if (!cmn_pll_src_base) { SSDK_ERROR("Failed to map cmn pll source address!\n"); return; --- -2.40.1 - diff --git a/package/kernel/qca-ssdk/patches/200-allow-parallel-build.patch b/package/kernel/qca-ssdk/patches/200-allow-parallel-build.patch index 2a3735a736..1e85ad102c 100644 --- a/package/kernel/qca-ssdk/patches/200-allow-parallel-build.patch +++ b/package/kernel/qca-ssdk/patches/200-allow-parallel-build.patch @@ -40,7 +40,7 @@ kslib_c: --- a/make/linux_opt.mk +++ b/make/linux_opt.mk -@@ -782,6 +782,6 @@ LOCAL_CFLAGS += $(CPU_CFLAG) -D"KBUILD_M +@@ -787,6 +787,6 @@ LOCAL_CFLAGS += $(CPU_CFLAG) -D"KBUILD_M #################################################################### # cflags for LNX Modules-Style Makefile #################################################################### diff --git a/package/kernel/r8168/patches/120-r8168-add-LED-configuration-from-OF.patch b/package/kernel/r8168/patches/120-r8168-add-LED-configuration-from-OF.patch index 0fc2cc360d..8319e0f2ce 100644 --- a/package/kernel/r8168/patches/120-r8168-add-LED-configuration-from-OF.patch +++ b/package/kernel/r8168/patches/120-r8168-add-LED-configuration-from-OF.patch @@ -8,7 +8,7 @@ #include #include #include -@@ -26097,6 +26098,22 @@ rtl8168_setup_mqs_reg(struct rtl8168_pri +@@ -26135,6 +26136,22 @@ rtl8168_setup_mqs_reg(struct rtl8168_pri tp->imr_reg[3] = IntrMask3; } @@ -31,7 +31,7 @@ static void rtl8168_init_software_variable(struct net_device *dev) { -@@ -26792,6 +26809,8 @@ err1: +@@ -26852,6 +26869,8 @@ err1: if (tp->InitRxDescType == RX_DESC_RING_TYPE_2) tp->RxDescLength = RX_DESC_LEN_TYPE_2; diff --git a/package/network/services/dropbear/files/dropbear.config b/package/network/services/dropbear/files/dropbear.config index 91d3f5a18e..e54b4c2b59 100644 --- a/package/network/services/dropbear/files/dropbear.config +++ b/package/network/services/dropbear/files/dropbear.config @@ -4,5 +4,5 @@ config dropbear main option PasswordAuth 'on' option RootPasswordAuth 'on' option Port '22' - option Interface 'lan' + option DirectInterface 'lan' # option BannerFile '/etc/banner' diff --git a/package/network/services/ppp/patches/512-syncppp.patch b/package/network/services/ppp/patches/512-syncppp.patch index 00de134a07..aecb453fa3 100644 --- a/package/network/services/ppp/patches/512-syncppp.patch +++ b/package/network/services/ppp/patches/512-syncppp.patch @@ -1,6 +1,6 @@ --- a/pppd/chap.c +++ b/pppd/chap.c -@@ -42,6 +42,9 @@ +@@ -36,6 +36,9 @@ #include "chap.h" #include "chap-md5.h" @@ -10,7 +10,7 @@ #ifdef PPP_WITH_CHAPMS #include "chap_ms.h" #define MDTYPE_ALL (MDTYPE_MICROSOFT_V2 | MDTYPE_MICROSOFT | MDTYPE_MD5) -@@ -520,6 +523,18 @@ chap_respond(struct chap_client_state *c +@@ -514,6 +517,18 @@ chap_respond(struct chap_client_state *c p[2] = len >> 8; p[3] = len; @@ -31,7 +31,7 @@ --- a/pppd/Makefile.am +++ b/pppd/Makefile.am -@@ -67,6 +67,7 @@ noinst_HEADERS = \ +@@ -66,6 +66,7 @@ noinst_HEADERS = \ peap.h \ pppd-private.h \ spinlock.h \ @@ -39,7 +39,7 @@ tls.h \ tdb.h -@@ -85,6 +86,7 @@ pppd_SOURCES = \ +@@ -84,6 +85,7 @@ pppd_SOURCES = \ main.c \ options.c \ session.c \ @@ -47,7 +47,7 @@ tty.c \ upap.c \ utils.c -@@ -95,7 +97,7 @@ BUILT_SOURCE = \ +@@ -94,7 +96,7 @@ BUILT_SOURCE = \ pppd_CPPFLAGS = -DSYSCONFDIR=\"${sysconfdir}\" -DPPPD_RUNTIME_DIR='"@PPPD_RUNTIME_DIR@"' -DPPPD_LOGFILE_DIR='"@PPPD_LOGFILE_DIR@"' pppd_LDFLAGS = @@ -78,7 +78,7 @@ OPT_PRIV|OPT_LLIMIT|OPT_INITONLY, NULL, 0, -1 }, --- a/pppd/pppd-private.h +++ b/pppd/pppd-private.h -@@ -207,6 +207,7 @@ extern bool dump_options; /* print out o +@@ -209,6 +209,7 @@ extern bool dump_options; /* print out o extern bool show_options; /* show all option names and descriptions */ extern bool dryrun; /* check everything, print options, exit */ extern int child_wait; /* # seconds to wait for children at end */ diff --git a/package/system/fstools/patches/100-fstools-support-extroot-for-non-MTD-rootfs_data.patch b/package/system/fstools/patches/100-fstools-support-extroot-for-non-MTD-rootfs_data.patch index 6a9ea9f4b0..20bc3425e0 100644 --- a/package/system/fstools/patches/100-fstools-support-extroot-for-non-MTD-rootfs_data.patch +++ b/package/system/fstools/patches/100-fstools-support-extroot-for-non-MTD-rootfs_data.patch @@ -12,7 +12,7 @@ Signed-off-by: Qi Liu --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -79,9 +79,9 @@ INSTALL(TARGETS blockd RUNTIME DESTINATI +@@ -80,9 +80,9 @@ INSTALL(TARGETS blockd RUNTIME DESTINATI ADD_EXECUTABLE(block block.c probe.c probe-libblkid.c) IF(DEFINED CMAKE_UBIFS_EXTROOT) ADD_DEFINITIONS(-DUBIFS_EXTROOT) @@ -36,7 +36,7 @@ Signed-off-by: Qi Liu #include "probe.h" #define AUTOFS_MOUNT_PATH "/tmp/run/blockd/" -@@ -1696,6 +1699,44 @@ static int main_extroot(int argc, char * +@@ -1714,6 +1717,44 @@ static int main_extroot(int argc, char * } #endif diff --git a/package/utils/busybox/patches/900-add-e-f-option-for-docker.patch b/package/utils/busybox/patches/900-add-e-f-option-for-docker.patch index cf2b68305f..41f1b0098c 100644 --- a/package/utils/busybox/patches/900-add-e-f-option-for-docker.patch +++ b/package/utils/busybox/patches/900-add-e-f-option-for-docker.patch @@ -1,6 +1,6 @@ --- a/procps/ps.c -+++ a/procps/ps.c -@@ -665,7 +665,7 @@ ++++ b/procps/ps.c +@@ -668,7 +668,7 @@ int ps_main(int argc UNUSED_PARAM, char int w_count = 0; make_all_argv_opts(argv); opts = getopt32(argv, "^" diff --git a/target/linux/mediatek/base-files/etc/inittab b/target/linux/mediatek/base-files/etc/inittab old mode 100644 new mode 100755 diff --git a/target/linux/mediatek/base-files/etc/uci-defaults/99_fwenv-store-ethaddr.sh b/target/linux/mediatek/base-files/etc/uci-defaults/99_fwenv-store-ethaddr.sh old mode 100644 new mode 100755 diff --git a/target/linux/mediatek/base-files/lib/preinit/05_set_preinit_iface b/target/linux/mediatek/base-files/lib/preinit/05_set_preinit_iface old mode 100644 new mode 100755 diff --git a/target/linux/mediatek/base-files/lib/preinit/07_trigger_fip_scrubbing b/target/linux/mediatek/base-files/lib/preinit/07_trigger_fip_scrubbing old mode 100644 new mode 100755 diff --git a/target/linux/mediatek/dts/mt7986a-glinet-gl-mt6000.dts b/target/linux/mediatek/dts/mt7986a-glinet-gl-mt6000.dts index fe55f2ea3a..5da6240513 100644 --- a/target/linux/mediatek/dts/mt7986a-glinet-gl-mt6000.dts +++ b/target/linux/mediatek/dts/mt7986a-glinet-gl-mt6000.dts @@ -27,7 +27,7 @@ reg_1p8v: regulator-1p8v { compatible = "regulator-fixed"; - regulator-name = "1.8vd"; + regulator-name = "fixed-1.8V"; regulator-min-microvolt = <1800000>; regulator-max-microvolt = <1800000>; regulator-boot-on; diff --git a/target/linux/mediatek/dts/mt7986a-superbox-s20-plus.dts b/target/linux/mediatek/dts/mt7986a-superbox-s20-plus.dts new file mode 100644 index 0000000000..5f8e6988a4 --- /dev/null +++ b/target/linux/mediatek/dts/mt7986a-superbox-s20-plus.dts @@ -0,0 +1,347 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; +#include +#include +#include + +#include "mt7986a.dtsi" + +/ { + model = "Superbox S20 Plus"; + compatible = "superbox,s20-plus", "mediatek,mt7986a"; + + aliases { + serial0 = &uart0; + label-mac-device = &gmac1; + led-boot = &led_green; + led-failsafe = &led_green; + led-running = &led_green; + led-upgrade = &led_green; + }; + + chosen { + stdout-path = "serial0:115200n8"; + bootargs-append = " root=PARTLABEL=rootfs rootwait"; + }; + + reg_1p8v: regulator-1p8v { + compatible = "regulator-fixed"; + regulator-name = "fixed-1.8V"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-boot-on; + regulator-always-on; + }; + + reg_3p3v: regulator-3p3v { + compatible = "regulator-fixed"; + regulator-name = "fixed-3.3V"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-boot-on; + regulator-always-on; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&pio 16 GPIO_ACTIVE_LOW>; + }; + }; + + leds { + compatible = "gpio-leds"; + led_green: led_green { + label = "green"; + gpios = <&pio 22 GPIO_ACTIVE_LOW>; + }; + }; + + usb_vbus: regulator-usb-vbus { + compatible = "regulator-fixed"; + regulator-name = "usb_vbus"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpios = <&pio 17 GPIO_ACTIVE_HIGH>; + enable-active-high; + regulator-boot-on; + }; +}; + +ð { + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + ext-phy-reg = <5>; + ext-phy-reset-gpios = <&pio 48 0>; + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "2500base-x"; + ext-phy-reg = <7>; + ext-phy-reset-gpios = <&pio 6 0>; + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + + mdio: mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + + phy5: phy@5 { + compatible = "ethernet-phy-ieee802.3-c45"; + reg = <5>; + }; + + phy7: phy@7 { + compatible = "ethernet-phy-ieee802.3-c45"; + reg = <7>; + }; + + + switch@0 { + compatible = "mediatek,mt7531"; + reg = <31>; + reset-gpios = <&pio 5 0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "lan0"; + }; + + port@1 { + reg = <1>; + label = "lan1"; + }; + + port@2 { + reg = <2>; + label = "lan2"; + }; + + port@3 { + reg = <3>; + label = "lan3"; + }; + + port@4 { + reg = <4>; + label = "lan4"; + }; + + port@5 { + reg = <5>; + label = "lan5"; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + + port@6 { + reg = <6>; + label = "cpu"; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; + }; + }; +}; + +&pio { + wf_2g_5g_pins: wf-2g-5g-pins { + mux { + function = "wifi"; + groups = "wf_2g", "wf_5g"; + }; + conf { + pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4", + "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6", + "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10", + "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1", + "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0", + "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8", + "WF1_TOP_CLK", "WF1_TOP_DATA"; + drive-strength = <4>; + }; + }; + + mmc0_pins_default: mmc0-pins-default { + mux { + function = "emmc"; + groups = "emmc_51"; + }; + conf-cmd-dat { + pins = "EMMC_DATA_0", "EMMC_DATA_1", "EMMC_DATA_2", + "EMMC_DATA_3", "EMMC_DATA_4", "EMMC_DATA_5", + "EMMC_DATA_6", "EMMC_DATA_7", "EMMC_CMD"; + input-enable; + drive-strength = <4>; + mediatek,pull-up-adv = <1>; /* pull-up 10K */ + }; + conf-clk { + pins = "EMMC_CK"; + drive-strength = <6>; + mediatek,pull-down-adv = <2>; /* pull-down 50K */ + }; + conf-ds { + pins = "EMMC_DSL"; + mediatek,pull-down-adv = <2>; /* pull-down 50K */ + }; + conf-rst { + pins = "EMMC_RSTB"; + drive-strength = <4>; + mediatek,pull-up-adv = <1>; /* pull-up 10K */ + }; + }; + + mmc0_pins_uhs: mmc0-uhs-pins { + mux { + function = "emmc"; + groups = "emmc_51"; + }; + conf-cmd-dat { + pins = "EMMC_DATA_0", "EMMC_DATA_1", "EMMC_DATA_2", + "EMMC_DATA_3", "EMMC_DATA_4", "EMMC_DATA_5", + "EMMC_DATA_6", "EMMC_DATA_7", "EMMC_CMD"; + input-enable; + drive-strength = <4>; + mediatek,pull-up-adv = <1>; /* pull-up 10K */ + }; + conf-clk { + pins = "EMMC_CK"; + drive-strength = <6>; + mediatek,pull-down-adv = <2>; /* pull-down 50K */ + }; + conf-ds { + pins = "EMMC_DSL"; + mediatek,pull-down-adv = <2>; /* pull-down 50K */ + }; + conf-rst { + pins = "EMMC_RSTB"; + drive-strength = <4>; + mediatek,pull-up-adv = <1>; /* pull-up 10K */ + }; + }; +}; + +&crypto { + status = "okay"; +}; + +&ssusb { + vusb33-supply = <®_3p3v>; + vbus-supply = <&usb_vbus>; + status = "okay"; +}; + +&trng { + status = "okay"; +}; + +&uart0 { + status = "okay"; +}; + +&usb_phy { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&wifi { + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; + pinctrl-names = "default"; + pinctrl-0 = <&wf_2g_5g_pins>; + status = "okay"; +}; + +&mmc0 { + pinctrl-names = "default", "state_uhs"; + pinctrl-0 = <&mmc0_pins_default>; + pinctrl-1 = <&mmc0_pins_uhs>; + bus-width = <8>; + max-frequency = <200000000>; + cap-mmc-highspeed; + mmc-hs200-1_8v; + mmc-hs400-1_8v; + hs400-ds-delay = <0x14014>; + vmmc-supply = <®_3p3v>; + vqmmc-supply = <®_1p8v>; + non-removable; + no-sd; + no-sdio; + status = "okay"; + + card@0 { + compatible = "mmc-card"; + reg = <0>; + + block { + compatible = "block-device"; + partitions { + block-partition-env { + partname = "u-boot-env"; + + nvmem-layout { + compatible = "u-boot,env"; + }; + }; + + block-partition-factory { + partname = "factory"; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x1000>; + }; + + macaddr_factory_a: macaddr@a { + compatible = "mac-base"; + reg = <0xa 0x6>; + #nvmem-cell-cells = <1>; + }; + }; + }; + }; + }; + }; +}; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds old mode 100644 new mode 100755 diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network old mode 100644 new mode 100755 index 7b64638ccb..3a9371d6b6 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -141,6 +141,9 @@ mediatek_setup_interfaces() xiaomi,redmi-router-ax6000-ubootmod) ucidef_set_interfaces_lan_wan "lan2 lan3 lan4" wan ;; + superbox,s20-plus) + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan5 lan6" wan + ;; *) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" wan ;; @@ -208,6 +211,11 @@ mediatek_setup_macs() yuncore,ax835) label_mac=$(mtd_get_mac_binary "Factory" 0x4) ;; + superbox,s20-plus) + wan_mac=$(mmc_get_mac_binary factory 0x24) + lan_mac=$(macaddr_add "$wan_mac" 2) + label_mac=$wan_mac + ;; esac [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/03_gpio_switches b/target/linux/mediatek/filogic/base-files/etc/board.d/03_gpio_switches old mode 100644 new mode 100755 diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/04_defaults b/target/linux/mediatek/filogic/base-files/etc/board.d/04_defaults old mode 100644 new mode 100755 diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/05_compat-version b/target/linux/mediatek/filogic/base-files/etc/board.d/05_compat-version old mode 100644 new mode 100755 diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/firmware/11-mt76-caldata old mode 100644 new mode 100755 diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/05-wifi-migrate b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/05-wifi-migrate old mode 100644 new mode 100755 diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac old mode 100644 new mode 100755 index 41698e1796..da3882aea7 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -90,7 +90,8 @@ case "$board" in ;; glinet,gl-mt6000|\ glinet,gl-x3000|\ - glinet,gl-xe3000) + glinet,gl-xe3000|\ + superbox,s20-plus) addr=$(mmc_get_mac_binary factory 0x04) [ "$PHYNBR" = "0" ] && echo "$addr" > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "1" ] && macaddr_add $addr 1 > /sys${DEVPATH}/macaddress diff --git a/target/linux/mediatek/filogic/base-files/etc/uci-defaults/05_fix-compat-version b/target/linux/mediatek/filogic/base-files/etc/uci-defaults/05_fix-compat-version old mode 100644 new mode 100755 diff --git a/target/linux/mediatek/filogic/base-files/etc/uci-defaults/990_set-wireless.sh b/target/linux/mediatek/filogic/base-files/etc/uci-defaults/990_set-wireless.sh new file mode 100755 index 0000000000..9cf9e21f1b --- /dev/null +++ b/target/linux/mediatek/filogic/base-files/etc/uci-defaults/990_set-wireless.sh @@ -0,0 +1,116 @@ +#!/bin/sh +. /usr/share/libubox/jshn.sh + +# 默认WIFI设置 +BASE_SSID='OWRT' +BASE_WORD='12345678' +BASE_POWER='auto' + +# 获取无线设备的数量 +RADIO_NUM=$(uci show wireless | grep -c "wifi-device") + +# 如果没有找到无线设备,直接退出 +[ "$RADIO_NUM" -eq 0 ] && exit 0 + +# 配置参数 +configure_wifi() { + local radio=$1 + local channel=$2 + local htmode=$3 + local ssid=$4 + local current_encryption=$(uci get wireless.default_radio${radio}.encryption) + + # 如果当前加密方式已设置且不为"none",则不更新配置 + if [ -n "$current_encryption" ] && [ "$current_encryption" != "none" ]; then + echo "No update needed for radio${radio} with channel ${channel} and SSID ${ssid}" + return 0 + fi + + # 设置无线设备参数 + + uci set wireless.radio${radio}.channel=${channel} + uci set wireless.radio${radio}.htmode=${htmode} + uci set wireless.radio${radio}.txpower=${BASE_POWER} + uci set wireless.radio${radio}.country='CN' + uci set wireless.radio${radio}.disabled='0' + uci set wireless.radio${radio}.mu_beamformer='1' + + uci set wireless.default_radio${radio}.ssid=${ssid} + uci set wireless.default_radio${radio}.key=${BASE_WORD} + uci set wireless.default_radio${radio}.encryption='psk2+ccmp' + uci set wireless.default_radio${radio}.ieee80211k='1' + uci set wireless.default_radio${radio}.time_advertisement='2' + uci set wireless.default_radio${radio}.time_zone='CST-8' + uci set wireless.default_radio${radio}.bss_transition='1' + uci set wireless.default_radio${radio}.wnm_sleep_mode='1' + uci set wireless.default_radio${radio}.wnm_sleep_mode_no_keys='1' +} + +# 查询mode +query_mode() { + json_load_file "/etc/board.json" + json_select wlan + json_get_keys phy_keys + for phy in $phy_keys; do + json_select $phy + json_get_var path_value "path" + if [ "$path_value" = "$1" ]; then + json_select info + json_select bands + json_get_keys band_keys + for band in $band_keys; do + json_select $band + json_select modes + json_get_keys mode_keys + for mode in $mode_keys; do + json_get_var mode_value $mode + last_mode=$mode_value + done + json_select .. + json_select .. + done + echo "$last_mode" + return + fi + json_select .. + done +} + +# 设置无线设备的默认配置 +FIRST_5G='' +set_wifi_def_cfg() { + local band=$(uci get wireless.radio${1}.band) + local path=$(uci get wireless.radio${1}.path) + local htmode=$(query_mode "$path") + local channel='auto' + local ssid="$BASE_SSID" + + case "$band" in + '5g') + if [ -z "$FIRST_5G" ]; then + [ "$RADIO_NUM" -gt 2 ] && ssid="${BASE_SSID}-5G_1" || ssid="${BASE_SSID}-5G" + FIRST_5G=1 + else + ssid="${BASE_SSID}-5G_2" + fi + ;; + *) + case "$htmode" in + 'HT40' | 'VHT40' | 'HE40') + htmode="${htmode%40}20" + ;; + esac + ;; + esac + + configure_wifi "$1" "$channel" "$htmode" "$ssid" +} + +for i in $(seq 0 $((RADIO_NUM - 1))); do + set_wifi_def_cfg "$i" +done + +# 提交配置并重启网络服务 +uci commit wireless + +exit 0 diff --git a/target/linux/mediatek/filogic/base-files/etc/uci-defaults/993_set-ppe-load.sh b/target/linux/mediatek/filogic/base-files/etc/uci-defaults/993_set-ppe-load.sh new file mode 100755 index 0000000000..7256c1cdfe --- /dev/null +++ b/target/linux/mediatek/filogic/base-files/etc/uci-defaults/993_set-ppe-load.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +#指定文件路径 +FILE="/usr/share/rpcd/ucode/luci" + +#添加PPE状态显示 +sed -i "s#const fd = popen('top -n1 | awk \\\'/^CPU/ {printf(\"%d%\", 100 - \$8)}\\\'')#const fd = popen(access('/sbin/cpuusage') ? '/sbin/cpuusage' : 'top -n1 | awk \\\'/^CPU/ {printf(\"%d%\", 100 - \$8)}\\\'')#g" $FILE + +exit 0 \ No newline at end of file diff --git a/target/linux/mediatek/filogic/base-files/lib/preinit/04_set_netdev_label b/target/linux/mediatek/filogic/base-files/lib/preinit/04_set_netdev_label old mode 100644 new mode 100755 diff --git a/target/linux/mediatek/filogic/base-files/lib/preinit/09_mount_cfg_part b/target/linux/mediatek/filogic/base-files/lib/preinit/09_mount_cfg_part old mode 100644 new mode 100755 diff --git a/target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh b/target/linux/mediatek/filogic/base-files/lib/preinit/10_fix_eth_mac.sh old mode 100644 new mode 100755 diff --git a/target/linux/mediatek/filogic/base-files/lib/preinit/75_rootfs_prepare b/target/linux/mediatek/filogic/base-files/lib/preinit/75_rootfs_prepare old mode 100644 new mode 100755 diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh index e78082842d..194ddf12a4 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -115,7 +115,8 @@ platform_do_upgrade() { smartrg,sdg-8632|\ smartrg,sdg-8733|\ smartrg,sdg-8733a|\ - smartrg,sdg-8734) + smartrg,sdg-8734|\ + superbox,s20-plus) CI_KERNPART="kernel" CI_ROOTPART="rootfs" emmc_do_upgrade "$1" @@ -247,7 +248,8 @@ platform_copy_config() { smartrg,sdg-8733|\ smartrg,sdg-8733a|\ smartrg,sdg-8734|\ - ubnt,unifi-6-plus) + ubnt,unifi-6-plus|\ + superbox,s20-plus) emmc_copy_config ;; bananapi,bpi-r3|\ diff --git a/target/linux/mediatek/filogic/base-files/sbin/cpuusage b/target/linux/mediatek/filogic/base-files/sbin/cpuusage new file mode 100755 index 0000000000..8731a1cf03 --- /dev/null +++ b/target/linux/mediatek/filogic/base-files/sbin/cpuusage @@ -0,0 +1,12 @@ +#!/bin/sh +# Copyright (C) 2024 ZqinKing + +cpu_usage=$(top -bn1 | head -n2 | awk -F'[ %]+' 'NR==2{print $2}') + +if [ -r "/sys/kernel/debug/ppe0/entries" ]; then + ppe0_count=$(cat /sys/kernel/debug/ppe0/entries | wc -l) + ppe1_count=$(cat /sys/kernel/debug/ppe1/entries | wc -l) + echo -n "CPU: ${cpu_usage}% PPE0: ${ppe0_count} PPE1: ${ppe1_count}" +else + echo -n "CPU: ${cpu_usage}%" +fi diff --git a/target/linux/mediatek/filogic/target.mk b/target/linux/mediatek/filogic/target.mk index f4f186e738..95bf05a11c 100644 --- a/target/linux/mediatek/filogic/target.mk +++ b/target/linux/mediatek/filogic/target.mk @@ -2,7 +2,7 @@ ARCH:=aarch64 SUBTARGET:=filogic BOARDNAME:=Filogic 8x0 (MT798x) CPU_TYPE:=cortex-a53 -DEFAULT_PACKAGES += fitblk kmod-phy-aquantia kmod-crypto-hw-safexcel wpad-openssl uboot-envtools bridger +DEFAULT_PACKAGES += fitblk kmod-phy-aquantia kmod-phy-realtek kmod-crypto-hw-safexcel wpad-openssl uboot-envtools bridger KERNELNAME:=Image dtbs DEFAULT_PROFILE:=openwrt_one diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index b85be78de1..559ee78559 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -1085,7 +1085,7 @@ define Device/jdcloud_re-cp-03 IMAGE/sysupgrade.itb := append-kernel | \ fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | \ pad-rootfs | append-metadata - ARTIFACTS :=gpt.bin preloader.bin bl31-uboot.fip + ARTIFACTS := gpt.bin preloader.bin bl31-uboot.fip ARTIFACT/gpt.bin := mt798x-gpt emmc ARTIFACT/preloader.bin := mt7986-bl2 emmc-ddr4 ARTIFACT/bl31-uboot.fip := mt7986-bl31-uboot jdcloud_re-cp-03 @@ -2055,3 +2055,16 @@ define Device/zyxel_nwa50ax-pro IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata endef TARGET_DEVICES += zyxel_nwa50ax-pro + +define Device/superbox_s20-plus + DEVICE_VENDOR := SuperBox + DEVICE_MODEL := S20 Plus + DEVICE_DTS := mt7986a-superbox-s20-plus + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-usb3 kmod-mt7915e kmod-mt7986-firmware mt7986-wo-firmware \ + automount f2fsck mkf2fs + IMAGES += factory.bin + IMAGE/factory.bin := append-kernel | pad-to 32M | append-rootfs + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += superbox_s20-plus diff --git a/target/linux/qualcommax/Makefile b/target/linux/qualcommax/Makefile index 7f923bab41..b3addf4fe3 100644 --- a/target/linux/qualcommax/Makefile +++ b/target/linux/qualcommax/Makefile @@ -12,10 +12,9 @@ KERNEL_PATCHVER:=6.6 include $(INCLUDE_DIR)/target.mk DEFAULT_PACKAGES += \ - kmod-usb3 kmod-usb-dwc3 kmod-usb-dwc3-qcom \ - kmod-leds-gpio kmod-gpio-button-hotplug \ - kmod-qca-nss-dp kmod-ath11k-ahb wpad-openssl \ - uboot-envtools losetup \ - automount cpufreq + autocore automount cpufreq e2fsprogs f2fsck mkf2fs losetup luci uboot-envtools wpad-openssl \ + kmod-dsa kmod-dsa-qca8k kmod-fs-ext4 kmod-fs-f2fs kmod-gpio-button-hotplug kmod-leds-gpio \ + kmod-ath11k kmod-ath11k-ahb kmod-ath11k-pci kmod-phy-aquantia kmod-phy-marvell kmod-phy-qca83xx \ + kmod-usb3 kmod-usb-dwc3 kmod-usb-dwc3-qcom kmod-qca-nss-dp \ $(eval $(call BuildTarget)) diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/init.d/set-irq-affinity b/target/linux/qualcommax/base-files/etc/init.d/set-irq-affinity similarity index 82% rename from target/linux/qualcommax/ipq807x/base-files/etc/init.d/set-irq-affinity rename to target/linux/qualcommax/base-files/etc/init.d/set-irq-affinity index 54c4b55036..b903654308 100755 --- a/target/linux/qualcommax/ipq807x/base-files/etc/init.d/set-irq-affinity +++ b/target/linux/qualcommax/base-files/etc/init.d/set-irq-affinity @@ -6,9 +6,9 @@ start() { for eth in $(jsonfilter -i "/etc/board.json" -e "@.network[*].device"); do [ -d "/sys/class/net/$eth" ] || continue for i in "/sys/class/net/$eth"/queues/rx-*/rps_cpus; do echo "f" > "$i"; done - for i in "/sys/class/net/$eth"/queues/rx-*/rps_flow_cnt; do echo "4096" > "$i"; done + for i in "/sys/class/net/$eth"/queues/rx-*/rps_flow_cnt; do echo "8192" > "$i"; done for i in "/sys/class/net/$eth"/queues/tx-*/xps_cpus; do echo "f" > "$i"; done done - echo "32768" > "/proc/sys/net/core/rps_sock_flow_entries" + echo "65535" > "/proc/sys/net/core/rps_sock_flow_entries" } diff --git a/target/linux/qualcommax/base-files/etc/init.d/smp_affinity b/target/linux/qualcommax/base-files/etc/init.d/smp_affinity new file mode 100755 index 0000000000..4ef580bdaa --- /dev/null +++ b/target/linux/qualcommax/base-files/etc/init.d/smp_affinity @@ -0,0 +1,111 @@ +#!/bin/sh /etc/rc.common +###################################################################### +# vim: set ft=bash +# shellcheck disable=2155,3019,3043,3057,3060 +###################################################################### + +START=93 + +PROG=smp_affinity + +log_msg() { + local irq_name="$1" affinity="$2" irq="$3" + msg="$(printf "Pinning IRQ($irq) %-24s to CPU ${affinity}\n" "$irq_name")" + logger -t "$PROG" "$msg" +} + +###################################################################### +## Takes a comma, space separated, or range list of CPU numbers and +## returns a bitmask of CPUs. +## cpus_to_bitmask "0,1,2,3" -> f +## cpus_to_bitmask "0 1 2 3" -> f +## cpus_to_bitmask "0-3" -> f +## cpus_to_bitmask "3" -> 8 +####################################################################### + +cpus_to_bitmask() { + local bitmask=0 + # shellcheck disable=2048 + for range in ${*//,/ }; do + start="${range%-*}" + end="${range#*-}" + if [ -z "$end" ]; then + bitmask="$((bitmask | 1 << start))" + else + bitmask="$((bitmask | (2 ** (end - start + 1) - 1) << start))" + fi + done + printf '%x' $bitmask +} + +###################################################################### +## Takes a bitmask of CPUs and returns a space separated list of +## CPU numbers. +## bitmask_to_cpus f -> 0 1 2 3 +###################################################################### + +bitmask_to_cpus() { + [ "${1:0:2}" != "0x" ] && set -- "0x$1" + local bitmask="$(printf '%d' "$1")" + + local cpus="" + for i in $(seq 0 63); do + if [ $((bitmask & 1)) -ne 0 ]; then + cpus="$cpus $i" + fi + bitmask=$((bitmask >> 1)) + done + echo "${cpus# }" +} + +###################################################################### +## Sets the affinity of the IRQs with the given name to the given CPU. +## 1st argument: IRQ name ("reo2host-destination-ring1") (req) +## 2nd argument: CPU number (req) +###################################################################### + +set_affinity() { + local irq_name="$1" affinity="$2" bitmask irq + awk -v irq_name="$1" '$0 ~ irq_name { print substr($1, 1, length($1)-1); exit }' /proc/interrupts | while read -r irq; do + $enable_log && log_msg "$irq_name" "$affinity" "$irq" + bitmask=$(cpus_to_bitmask "$affinity") && echo "$bitmask" > "/proc/irq/$irq/smp_affinity" + done +} + +enable_affinity() { + # assign 4 rx interrupts to each core + set_affinity 'reo2host-destination-ring1' 0 + set_affinity 'reo2host-destination-ring2' 1 + set_affinity 'reo2host-destination-ring3' 2 + set_affinity 'reo2host-destination-ring4' 3 + + # assign 3 tcl completions to last 3 CPUs + set_affinity 'wbm2host-tx-completions-ring1' 1 + set_affinity 'wbm2host-tx-completions-ring2' 2 + set_affinity 'wbm2host-tx-completions-ring3' 3 + + # assign 3 ppdu mac interrupts to last 3 cores + set_affinity 'ppdu-end-interrupts-mac1' 1 + set_affinity 'ppdu-end-interrupts-mac2' 2 + set_affinity 'ppdu-end-interrupts-mac3' 3 + + # assign 4 lan/wan to core 4 + set_affinity 'edma_txcmpl' 3 + set_affinity 'edma_rxfill' 3 + set_affinity 'edma_rxdesc' 3 + set_affinity 'edma_misc' 3 +} + +boot() { + local enable + + config_load smp_affinity + + config_get_bool enable "general" enable 1 + config_get_bool enable_log "general" enable_log 1 + + [ "$enable" -eq 1 ] && enable=true || enable=false + [ "$enable_log" -eq 1 ] && enable_log=true || enable_log=false + + $enable && enable_affinity +} diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/uci-defaults/15_smp_affinity b/target/linux/qualcommax/base-files/etc/uci-defaults/15_smp_affinity old mode 100644 new mode 100755 similarity index 100% rename from target/linux/qualcommax/ipq807x/base-files/etc/uci-defaults/15_smp_affinity rename to target/linux/qualcommax/base-files/etc/uci-defaults/15_smp_affinity diff --git a/target/linux/qualcommax/base-files/etc/uci-defaults/990_set-wireless.sh b/target/linux/qualcommax/base-files/etc/uci-defaults/990_set-wireless.sh new file mode 100755 index 0000000000..0a91644fc5 --- /dev/null +++ b/target/linux/qualcommax/base-files/etc/uci-defaults/990_set-wireless.sh @@ -0,0 +1,125 @@ +#!/bin/sh +. /usr/share/libubox/jshn.sh + +# 默认WIFI设置 +BASE_SSID='OWRT' +BASE_WORD='12345678' +BASE_POWER='auto' + +# 获取无线设备的数量 +RADIO_NUM=$(uci show wireless | grep -c "wifi-device") + +# 如果没有找到无线设备,直接退出 +[ "$RADIO_NUM" -eq 0 ] && exit 0 + +# 为部分机型设置发射功率 +board_name=$(cat /tmp/sysinfo/board_name) +case "${board_name}" in +jdcloud,re-ss-01) + BASE_POWER='20' + ;; +esac + +# 配置参数 +configure_wifi() { + local radio=$1 + local channel=$2 + local htmode=$3 + local ssid=$4 + local current_encryption=$(uci get wireless.default_radio${radio}.encryption) + + # 如果当前加密方式已设置且不为"none",则不更新配置 + if [ -n "$current_encryption" ] && [ "$current_encryption" != "none" ]; then + echo "No update needed for radio${radio} with channel ${channel} and SSID ${ssid}" + return 0 + fi + + # 设置无线设备参数 + uci set wireless.radio${radio}.channel=${channel} + uci set wireless.radio${radio}.htmode=${htmode} + uci set wireless.radio${radio}.txpower=${BASE_POWER} + uci set wireless.radio${radio}.country='CN' + uci set wireless.radio${radio}.disabled='0' + uci set wireless.radio${radio}.mu_beamformer='1' + + uci set wireless.default_radio${radio}.ssid=${ssid} + uci set wireless.default_radio${radio}.key=${BASE_WORD} + uci set wireless.default_radio${radio}.encryption='psk2+ccmp' + uci set wireless.default_radio${radio}.ieee80211k='1' + uci set wireless.default_radio${radio}.time_advertisement='2' + uci set wireless.default_radio${radio}.time_zone='CST-8' + uci set wireless.default_radio${radio}.bss_transition='1' + uci set wireless.default_radio${radio}.wnm_sleep_mode='1' + uci set wireless.default_radio${radio}.wnm_sleep_mode_no_keys='1' +} + +# 查询mode +query_mode() { + json_load_file "/etc/board.json" + json_select wlan + json_get_keys phy_keys + for phy in $phy_keys; do + json_select $phy + json_get_var path_value "path" + if [ "$path_value" = "$1" ]; then + json_select info + json_select bands + json_get_keys band_keys + for band in $band_keys; do + json_select $band + json_select modes + json_get_keys mode_keys + for mode in $mode_keys; do + json_get_var mode_value $mode + last_mode=$mode_value + done + json_select .. + json_select .. + done + echo "$last_mode" + return + fi + json_select .. + done +} + +# 设置无线设备的默认配置 +FIRST_5G='' +set_wifi_def_cfg() { + local band=$(uci get wireless.radio${1}.band) + local path=$(uci get wireless.radio${1}.path) + local htmode=$(query_mode "$path") + local channel=6 + local ssid="$BASE_SSID" + + case "$band" in + '5g') + channel=149 + [ "$htmode" = 'HE160' ] || [ "$htmode" = 'VHT160' ] && channel=44 + if [ -z "$FIRST_5G" ]; then + [ "$RADIO_NUM" -gt 2 ] && ssid="${BASE_SSID}-5G_1" || ssid="${BASE_SSID}-5G" + FIRST_5G=1 + else + ssid="${BASE_SSID}-5G_2" + fi + ;; + *) + case "$htmode" in + 'HT40' | 'VHT40' | 'HE40') + htmode="${htmode%40}20" + ;; + esac + ;; + esac + + configure_wifi "$1" "$channel" "$htmode" "$ssid" +} + +for i in $(seq 0 $((RADIO_NUM - 1))); do + set_wifi_def_cfg "$i" +done + +# 提交配置并重启网络服务 +uci commit wireless + +exit 0 diff --git a/target/linux/qualcommax/base-files/etc/uci-defaults/993_set-nss-load.sh b/target/linux/qualcommax/base-files/etc/uci-defaults/993_set-nss-load.sh new file mode 100755 index 0000000000..b2f31ffc43 --- /dev/null +++ b/target/linux/qualcommax/base-files/etc/uci-defaults/993_set-nss-load.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +#指定文件路径 +FILE="/usr/share/rpcd/ucode/luci" + +#添加NSS状态显示 +sed -i "s#const fd = popen('top -n1 | awk \\\'/^CPU/ {printf(\"%d%\", 100 - \$8)}\\\'')#const fd = popen(access('/sbin/cpuusage') ? '/sbin/cpuusage' : 'top -n1 | awk \\\'/^CPU/ {printf(\"%d%\", 100 - \$8)}\\\'')#g" $FILE + +exit 0 \ No newline at end of file diff --git a/target/linux/qualcommax/ipq807x/base-files/lib/preinit/09_mount_factory_data b/target/linux/qualcommax/base-files/lib/preinit/09_mount_factory_data old mode 100644 new mode 100755 similarity index 94% rename from target/linux/qualcommax/ipq807x/base-files/lib/preinit/09_mount_factory_data rename to target/linux/qualcommax/base-files/lib/preinit/09_mount_factory_data index 2563202a1a..80b294ab1d --- a/target/linux/qualcommax/ipq807x/base-files/lib/preinit/09_mount_factory_data +++ b/target/linux/qualcommax/base-files/lib/preinit/09_mount_factory_data @@ -7,6 +7,7 @@ preinit_mount_factory_data() { . /lib/functions/system.sh case $(board_name) in + tplink,eap610-outdoor|\ tplink,eap620hd-v1|\ tplink,eap660hd-v1) mtd_path=$(find_mtd_chardev "factory_data") diff --git a/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/buffalo.sh b/target/linux/qualcommax/base-files/lib/upgrade/buffalo.sh old mode 100644 new mode 100755 similarity index 84% rename from target/linux/qualcommax/ipq807x/base-files/lib/upgrade/buffalo.sh rename to target/linux/qualcommax/base-files/lib/upgrade/buffalo.sh index d0ed258890..8371599d56 --- a/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/buffalo.sh +++ b/target/linux/qualcommax/base-files/lib/upgrade/buffalo.sh @@ -10,8 +10,7 @@ buffalo_upgrade_prepare() { local ubi_rootdev ubi_propdev - if ! ubi_rootdev="$(nand_attach_ubi rootfs)" || \ - ! ubi_propdev="$(nand_attach_ubi user_property)"; then + if ! ubi_rootdev="$(nand_attach_ubi rootfs)" || ! ubi_propdev="$(nand_attach_ubi user_property)"; then echo "failed to attach UBI volume \"rootfs\" or \"user_property\", rebooting..." reboot -f fi @@ -34,8 +33,7 @@ buffalo_upgrade_optvol() { local ubi_rootdev ubi_rcvrdev local hashvol_root hashvol_rcvr - if ! ubi_rootdev="$(nand_attach_ubi rootfs)" || \ - ! ubi_rcvrdev="$(nand_attach_ubi rootfs_recover)"; then + if ! ubi_rootdev="$(nand_attach_ubi rootfs)" || ! ubi_rcvrdev="$(nand_attach_ubi rootfs_recover)"; then echo "failed to attach UBI volume \"rootfs\" or \"rootfs_recover\", rebooting..." reboot -f fi @@ -43,8 +41,7 @@ buffalo_upgrade_optvol() { ubimkvol /dev/$ubi_rootdev -N ubi_rootfs -S 1 ubimkvol /dev/$ubi_rootdev -N fw_hash -S 1 -t static - if ! hashvol_root="$(nand_find_volume $ubi_rootdev fw_hash)" || \ - ! hashvol_rcvr="$(nand_find_volume $ubi_rcvrdev fw_hash)"; then + if ! hashvol_root="$(nand_find_volume $ubi_rootdev fw_hash)" || ! hashvol_rcvr="$(nand_find_volume $ubi_rcvrdev fw_hash)"; then echo "\"fw_hash\" volume in \"rootfs\" or \"rootfs_recover\" not found, rebooting..." reboot -f fi diff --git a/target/linux/qualcommax/base-files/sbin/cpuusage b/target/linux/qualcommax/base-files/sbin/cpuusage new file mode 100755 index 0000000000..87bac3be19 --- /dev/null +++ b/target/linux/qualcommax/base-files/sbin/cpuusage @@ -0,0 +1,25 @@ +#!/bin/sh +# Copyright (C) 2024 YumesomeZakura <1552037053@qq.com> + +cpu_usage=$(top -bn1 | head -n2 | awk -F'[ %]+' 'NR==2{print $2}') +combined_output="" +connection_count="" + +if [ -e "/sys/kernel/debug/qca-nss-drv/stats/cpu_load_ubi" ]; then + nss_avg_utilization=$(awk 'NR==6 {print $2}' /sys/kernel/debug/qca-nss-drv/stats/cpu_load_ubi) + combined_output="${combined_output}${nss_avg_utilization}" +fi + +if [ -r "/sys/kernel/debug/ecm/ecm_db/connection_count_simple" ]; then + connection_count=$(cat /sys/kernel/debug/ecm/ecm_db/connection_count_simple) +fi + +if [ -n "$combined_output" ] && [ -n "$connection_count" ]; then + echo -n "CPU: ${cpu_usage}% HWE: ${combined_output} ECM: ${connection_count}" +elif [ -n "$combined_output" ]; then + echo -n "CPU: ${cpu_usage}% HWE: ${combined_output}" +elif [ -n "$connection_count" ]; then + echo -n "CPU: ${cpu_usage}% ECM: ${connection_count}" +else + echo -n "CPU: ${cpu_usage}%" +fi diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-mx-base.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-mx-base.dtsi index a015fcbd34..d1a66a1179 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-mx-base.dtsi +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-mx-base.dtsi @@ -41,7 +41,7 @@ leds { compatible = "pwm-leds"; - led_system_red: red { + led_system_red: system-red { color = ; function = LED_FUNCTION_POWER; pwms = <&pwm 3 1250000>; @@ -55,7 +55,7 @@ max-brightness = <255>; }; - led_system_blue: blue { + led_system_blue: system-blue { color = ; function = LED_FUNCTION_POWER; pwms = <&pwm 1 1250000>; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-mx2000.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-mx2000.dts index ce10405164..18a8d9d938 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-mx2000.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-mx2000.dts @@ -26,7 +26,7 @@ &switch { status = "okay"; - switch_mac_mode = ; + switch_mac_mode = ; qcom,port_phyinfo { // MAC0 -> GE Phy -> QCA8337 Phy4 diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-mx5500.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-mx5500.dts index 4792ed5d43..f92fc58aca 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-mx5500.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-mx5500.dts @@ -26,7 +26,7 @@ &switch { status = "okay"; - switch_mac_mode = ; + switch_mac_mode = ; qcom,port_phyinfo { // MAC0 -> GE Phy -> QCA8337 Phy4 diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-nss.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-nss.dtsi new file mode 100644 index 0000000000..36ccb8b1c6 --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-nss.dtsi @@ -0,0 +1,137 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/ { + nss_dummy_reg: nss-regulator { + compatible = "regulator-fixed"; + regulator-name = "nss-reg"; + regulator-min-microvolt = <848000>; + regulator-max-microvolt = <848000>; + regulator-always-on; + regulator-boot-on; + }; +}; + +&soc { + nss-common { + compatible = "qcom,nss-common"; + reg = <0x01868010 0x1000>; + reg-names = "nss-misc-reset"; + memory-region = <&nss_region>; + }; + + nss0: nss@40000000 { + compatible = "qcom,nss"; + interrupts = , + , + , + , + , + , + , + ; + reg = <0x07a00000 0x100>, <0x0b111000 0x1000>; + reg-names = "nphys", "qgic-phys"; + clocks = <&gcc GCC_UBI0_CFG_CLK>, + <&gcc GCC_UBI0_DBG_CLK>, + <&gcc GCC_UBI0_CORE_CLK>, + <&gcc GCC_UBI0_UTCM_CLK>, + <&gcc GCC_UBI0_AXI_CLK>, + <&gcc GCC_SNOC_UBI0_AXI_CLK>, + <&gcc GCC_UBI0_NC_AXI_CLK>; + clock-names = "nss-cfg-clk", + "nss-dbg-clk", + "nss-core-clk", + "nss-utcm-clk", + "nss-axi-clk", + "nss-snoc-axi-clk", + "nss-nc-axi-clk"; + qcom,id = <0>; + qcom,num-queue = <4>; + qcom,num-irq = <8>; + qcom,num-pri = <4>; + qcom,load-addr = <0x40000000>; + qcom,low-frequency = <850000000>; + qcom,mid-frequency = <850000000>; + qcom,max-frequency = <1000000000>; + qcom,ipv4-enabled; + qcom,ipv4-reasm-enabled; + qcom,ipv6-enabled; + qcom,ipv6-reasm-enabled; + qcom,tun6rd-enabled; + qcom,l2tpv2-enabled; + qcom,gre-enabled; + qcom,map-t-enabled; + qcom,pppoe-enabled; + qcom,pptp-enabled; + qcom,tunipip6-enabled; + qcom,shaping-enabled; + qcom,clmap-enabled; + qcom,vxlan-enabled; + qcom,match-enabled; + qcom,mirror-enabled; + qcom,crypto-enabled; + qcom,ipsec-enabled; + qcom,wlanredirect-enabled; + qcom,gre-redir-enabled; + qcom,gre-redir-mark-enabled; + qcom,portid-enabled; + qcom,wlan-dataplane-offload-enabled; + qcom,pvxlan-enabled; + qcom,udp-st-enabled; + }; + + nss_crypto: qcom,nss_crypto { + compatible = "qcom,nss-crypto"; + #address-cells = <1>; + #size-cells = <1>; + qcom,max-contexts = <64>; + qcom,max-context-size = <144>; + ranges; + ce5_node { + compatible = "qcom,ce5"; + reg-names = "crypto_pbase", "bam_base"; + reg = <0x0073a000 0x6000>, <0x00704000 0x20000>; + qcom,dma-mask = <0x0c>; + qcom,transform-enabled; + qcom,aes128-cbc; + qcom,aes256-cbc; + qcom,aes128-ctr; + qcom,aes256-ctr; + qcom,aes128-ecb; + qcom,aes256-ecb; + qcom,3des-cbc; + qcom,sha160-hash; + qcom,sha256-hash; + qcom,sha160-hmac; + qcom,sha256-hmac; + qcom,aes128-cbc-sha160-hmac; + qcom,aes256-cbc-sha160-hmac; + qcom,aes128-ctr-sha160-hmac; + qcom,aes256-ctr-sha160-hmac; + qcom,3des-cbc-sha160-hmac; + qcom,3des-cbc-sha256-hmac; + qcom,aes128-cbc-sha256-hmac; + qcom,aes256-cbc-sha256-hmac; + qcom,aes128-ctr-sha256-hmac; + qcom,aes256-ctr-sha256-hmac; + engine0 { + qcom,ee = <2 3>; + }; + }; + }; + + nss-macsec0 { + compatible = "qcom,nss-macsec"; + mdiobus = <&mdio>; + phy_addr = <0x18>; + phy_access_mode = <0x00>; + }; + + nss-macsec1 { + compatible = "qcom,nss-macsec"; + mdiobus = <&mdio>; + phy_addr = <0x1c>; + phy_access_mode = <0x00>; + }; + +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-re-cs-03.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-re-cs-03.dts new file mode 100644 index 0000000000..becfa20f51 --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-re-cs-03.dts @@ -0,0 +1,414 @@ +// SPDX-License-Identifier: GPL-2.0-only + +/dts-v1/; + +#include "ipq5018.dtsi" +#include "ipq5018-ess.dtsi" + +#include +#include +#include + +/ { + model = "JDCloud RE-CS-03"; + compatible = "jdcloud,re-cs-03", "qcom,ipq5018"; + + aliases { + sdhc1 = &sdhc_1; + serial0 = &blsp1_uart1; + serial1 = &blsp1_uart2; + + led-boot = &led_status_blue; + led-failsafe = &led_status_red; + led-running = &led_status_green; + led-upgrade = &led_status_red; + }; + + reserved-memory { + #address-cells = <0x02>; + #size-cells = <0x02>; + ranges; + + nss_regions: nss@40000000 { + no-map; + reg = <0x00 0x40000000 0x00 0x800000>; + }; + + q6_mem_regions: q6_mem_regions@4b000000 { + no-map; + reg = <0x00 0x4b000000 0x00 0x3400000>; + }; + + q6_code_data_regions: q6_code_data@4E400000 { + no-map; + reg = <0x00 0x4E400000 0x00 0x1400000>; + }; + + q6_ipq5018_data_regions: q6_ipq5018_data@4F800000 { + no-map; + reg = <0x00 0x4F800000 0x00 0xd00000>; + }; + + m3_dump_regions: m3_dump@50500000 { + no-map; + reg = <0x00 0x50500000 0x00 0x100000>; + }; + + q6_etr_dump_regions: q6_etr_dump@50600000 { + no-map; + reg = <0x00 0x50600000 0x00 0x100000>; + }; + + q6_caldb_region: q6_caldb_region@50700000 { + no-map; + reg = <0x0 0x50700000 0x0 0x200000>; + }; + + q6_qcn6122_data1_regions: q6_qcn6122_data1@50900000 { + no-map; + reg = <0x00 0x50900000 0x00 0xf00000>; + }; + + m3_dump_qcn6122_1_regions: m3_dump_qcn6122_1@51800000 { + no-map; + reg = <0x00 0x51800000 0x00 0x100000>; + }; + + q6_qcn6122_etr_1_regions: q6_qcn6122_etr_1@51900000 { + no-map; + reg = <0x00 0x51900000 0x00 0x100000>; + }; + + q6_qcn6122_caldb_1_regions: q6_qcn6122_caldb_1@51A00000 { + no-map; + reg = <0x0 0x51A00000 0x0 0x500000>; + }; + }; + + soc { + ess-instance { + num_devices = <0x2>; + + ess-switch@0x39c00000 { + compatible = "qcom,ess-switch-ipq50xx"; + reg = <0x39c00000 0x200000>; + switch_access_mode = "local bus"; + device_id = <0>; + switch_mac_mode = ; + cmnblk_clk = "internal_96MHz"; + + qcom,port_phyinfo { + port@0 { + port_id = <1>; + phy_address = <7>; + }; + port@1 { + port_id = <2>; + forced-speed = <1000>; + forced-duplex = <1>; + }; + }; + }; + + ess-switch1@1 { + compatible = "qcom,ess-switch-qca83xx"; + device_id = <1>; + switch_access_mode = "mdio"; + mdio-bus = <&mdio1>; + reset_gpio = <&tlmm 39 GPIO_ACTIVE_LOW>; + switch_cpu_bmp = <0x40>; + switch_lan_bmp = <0x1e>; + switch_wan_bmp = <0x00>; + qca,ar8327-initvals = <0x04 0x7600000 0x08 0x1000000 0x0c 0x80 0x10 0x2613a0 0xe4 0xaa545 0xe0 0xc74164de 0x7c 0x4e 0x94 0x4e>; + + qcom,port_phyinfo { + port@0 { + port_id = <1>; + phy_address = <0>; + }; + port@1 { + port_id = <2>; + phy_address = <1>; + }; + port@2 { + port_id = <3>; + phy_address = <2>; + }; + port@3 { + port_id = <4>; + phy_address = <3>; + }; + }; + }; + }; + + dp1 { + status = "okay"; + }; + + dp2 { + status = "okay"; + }; + }; + + keys { + compatible = "gpio-keys"; + pinctrl-0 = <&button_pins>; + pinctrl-names = "default"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&tlmm 25 GPIO_ACTIVE_LOW>; + linux,input-type = <1>; + debounce-interval = <60>; + }; + + wps { + label = "wps"; + linux,code = ; + gpios = <&tlmm 38 GPIO_ACTIVE_LOW>; + linux,input-type = <1>; + debounce-interval = <60>; + }; + }; + + leds { + compatible = "gpio-leds"; + pinctrl-0 = <&leds_pins>; + pinctrl-names = "default"; + + led_status_blue: status-blue { + label = "blue:status"; + gpio = <&tlmm 31 GPIO_ACTIVE_HIGH>; + }; + + led_status_green: status-green { + label = "green:status"; + gpio = <&tlmm 32 GPIO_ACTIVE_HIGH>; + }; + + led_status_red: status-red { + label = "red:status"; + gpio = <&tlmm 33 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&blsp1_uart1 { + status = "okay"; +}; + +&blsp1_uart2 { + status = "okay"; +}; + +&crypto { + status = "okay"; +}; + +&cryptobam { + status = "okay"; +}; + +&prng { + status = "okay"; +}; + +&mdio0 { + status = "okay"; + + ethernet-phy@0 { + reg = <7>; + }; +}; + +&mdio1 { + pinctrl-0 = <&mdio1_pins>; + pinctrl-names = "default"; + phy-reset-gpio = <&tlmm 39 GPIO_ACTIVE_LOW>; + status = "okay"; + + ethernet-phy@0 { + reg = <0>; + }; + + ethernet-phy@1 { + reg = <1>; + }; + + ethernet-phy@2 { + reg = <2>; + }; + + ethernet-phy@3 { + reg = <3>; + }; +}; + +&q6v5_wcss { + status = "okay"; + + compatible = "qcom,ipq5018-q6-mpd"; + firmware = "IPQ5018/q6_fw.mdt"; + + reg = <0x0cd00000 0x4040>, <0x1938000 0x8>, <0x193d204 0x4>; + reg-names = "qdsp6", "tcsr-msip", "tcsr-q6"; + resets = <&gcc GCC_WCSSAON_RESET>, <&gcc GCC_WCSS_Q6_BCR>; + reset-names = "wcss_aon_reset", "wcss_q6_reset"; + clocks = <&gcc GCC_Q6_AXIS_CLK>, <&gcc GCC_WCSS_ECAHB_CLK>, <&gcc GCC_Q6_AXIM_CLK>, <&gcc GCC_Q6_AXIM2_CLK>, <&gcc GCC_Q6_AHB_CLK>, <&gcc GCC_Q6_AHB_S_CLK>, <&gcc GCC_WCSS_AXI_S_CLK>; + clock-names = "gcc_q6_axis_clk", "gcc_wcss_ecahb_clk", "gcc_q6_axim_clk", "gcc_q6_axim2_clk", "gcc_q6_ahb_clk", "gcc_q6_ahb_s_clk", "gcc_wcss_axi_s_clk"; + qcom,rproc = <&q6v5_wcss>; + qcom,bootargs_smem = <507>; + memory-region = <&q6_mem_regions>, <&q6_etr_dump_regions>, <&q6_caldb_region>; + boot-args = <0x02 0x04 0x02 0x0f 0x00 0x00>; + + q6_wcss_pd1: remoteproc_pd1@4ab000 { + compatible = "qcom,ipq5018-wcss-ahb-mpd"; + firmware = "IPQ5018/q6_fw.mdt"; + m3_firmware = "IPQ5018/m3_fw.mdt"; + + reg = <0x4ab000 0x20>; + reg-names = "rmb"; + 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"; + 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"; + + // qcom,halt-regs = <&tcsr_q6_block 0xa000 0xd000 0x0>; + + qcom,smem-states = <&wcss_smp2p_out 8>, <&wcss_smp2p_out 9>, <&wcss_smp2p_out 10>; + qcom,smem-state-names = "shutdown", "stop", "spawn"; + memory-region = <&q6_ipq5018_data_regions>, <&m3_dump_regions>, <&q6_etr_dump_regions>, <&q6_caldb_region>; + }; + + q6_wcss_pd2: remoteproc_pd2 { + compatible = "qcom,ipq5018-wcss-pcie-mpd"; + firmware = "IPQ5018/q6_fw.mdt"; + m3_firmware = "qcn6122/m3_fw.mdt"; + + 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"; + memory-region = <&q6_qcn6122_data1_regions>, <&m3_dump_qcn6122_1_regions>, <&q6_qcn6122_etr_1_regions>, <&q6_qcn6122_caldb_1_regions>; + }; +}; + +&tlmm { + button_pins: button-pins { + mux { + pins = "gpio25", "gpio38"; + function = "gpio"; + drive-strength = <8>; + bias-pull-up; + }; + }; + + leds_pins: leds-pins { + mux { + pins = "gpio31", "gpio32", "gpio33"; + function = "gpio"; + drive-strength = <8>; + bias-pull-down; + output-low; + }; + }; + + mdio1_pins: mdio1-pins { + mdio1_mdc { + pins = "gpio36"; + function = "mdc"; + drive-strength = <8>; + bias-pull-up; + }; + + mdio1_mdio { + pins = "gpio37"; + function = "mdio"; + drive-strength = <8>; + bias-pull-up; + }; + }; + + emmc_pins: emmc-pins { + emmc_clk { + pins = "gpio9"; + function = "sdc1_clk"; + drive-strength = <8>; + bias-disable; + }; + + emmc_cmd { + pins = "gpio8"; + function = "sdc1_cmd"; + drive-strength = <8>; + bias-pull-up; + }; + + emmc_data_0 { + pins = "gpio7"; + function = "sdc10"; + drive-strength = <0x08>; + bias-disable; + }; + + emmc_data_1 { + pins = "gpio6"; + function = "sdc11"; + drive-strength = <0x08>; + bias-disable; + }; + + emmc_data_2 { + pins = "gpio5"; + function = "sdc12"; + drive-strength = <0x08>; + bias-disable; + }; + + emmc_data_3 { + pins = "gpio4"; + function = "sdc13"; + drive-strength = <0x08>; + bias-disable; + }; + }; +}; + +&sdhc_1 { + status = "okay"; + + pinctrl-0 = <&emmc_pins>; + pinctrl-names = "default"; +}; + +&wifi0 { + status = "okay"; + + qcom,multipd_arch; + qcom,userpd-subsys-name = "q6v5_wcss_userpd1"; + qcom,rproc = <&q6_wcss_pd1>; + qcom,bdf-addr = <0x0 0x4C000000 0x4C000000 0x0 0x0>; + qcom,caldb-addr = <0x0 0x4D000000 0 0 0>; + qcom,caldb-size = <0x200000>; + mem-region = <&q6_ipq5018_data_regions>; + qcom,ath11k-calibration-variant = "JDC-RE-CS-03"; + qcom,ath11k-fw-memory-mode = <1>; +}; + +&wifi1 { + status = "okay"; + + qcom,multipd_arch; + qcom,userpd-subsys-name = "q6v5_wcss_userpd2"; + qcom,rproc = <&q6_wcss_pd2>; + qcom,bdf-addr = <0x0 0x4D200000 0x4CF00000 0x0 0x0>; + qcom,caldb-addr = <0x0 0x4E400000 0 0 0>; + qcom,caldb-size = <0x500000>; + mem-region = <&q6_qcn6122_data1_regions>; + qcom,ath11k-calibration-variant = "JDC-RE-CS-03"; + qcom,ath11k-fw-memory-mode = <1>; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-spnmx56.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-spnmx56.dts index d25ff0f1cb..142a046ad3 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-spnmx56.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-spnmx56.dts @@ -29,7 +29,7 @@ &switch { status = "okay"; - switch_mac_mode = ; + switch_mac_mode = ; qcom,port_phyinfo { // MAC0 -> GE Phy --- MDI --- QCA8337 Switch diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-360v6.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-360v6.dts index 07aabe045a..1467eb0974 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-360v6.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-360v6.dts @@ -3,8 +3,10 @@ /dts-v1/; #include "ipq6018-512m.dtsi" +#include "ipq6018-common.dtsi" #include "ipq6018-ess.dtsi" -#include "ipq6018-cp-cpu.dtsi" +#include "ipq6018-nss.dtsi" +#include "ipq6000-cp-cpu.dtsi" #include #include @@ -16,10 +18,16 @@ aliases { serial0 = &blsp1_uart3; - led-boot = &led_status_red; + + led-boot = &led_status_orange; led-failsafe = &led_status_red; led-running = &led_status_green; led-upgrade = &led_status_orange; + + ethernet0 = &dp1; + ethernet1 = &dp2; + ethernet2 = &dp3; + ethernet3 = &dp4; }; chosen { @@ -46,21 +54,18 @@ leds { compatible = "gpio-leds"; - led_status_red: red { - color = ; - function = LED_FUNCTION_STATUS; + led_status_red: status-red { + label = "red:status"; gpios = <&tlmm 71 GPIO_ACTIVE_HIGH>; }; - led_status_orange: orange { - color = ; - function = LED_FUNCTION_STATUS; + led_status_orange: status-orange { + label = "orange:status"; gpios = <&tlmm 72 GPIO_ACTIVE_HIGH>; }; - led_status_green: green { - color = ; - function = LED_FUNCTION_STATUS; + led_status_green: status-green { + label = "green:status"; gpios = <&tlmm 73 GPIO_ACTIVE_HIGH>; }; }; @@ -84,16 +89,6 @@ }; }; -&blsp1_uart3 { - pinctrl-0 = <&serial_3_pins>; - pinctrl-names = "default"; - status = "okay"; -}; - -&qpic_bam { - status = "okay"; -}; - &qpic_nand { status = "okay"; @@ -109,18 +104,6 @@ }; }; -&qusb_phy_0 { - status = "okay"; -}; - -&ssphy_0 { - status = "okay"; -}; - -&usb3 { - status = "okay"; -}; - &mdio { status = "okay"; @@ -168,14 +151,17 @@ port_id = <1>; phy_address = <0>; }; + port@2 { port_id = <2>; phy_address = <1>; }; + port@3 { port_id = <3>; phy_address = <2>; }; + port@4 { port_id = <4>; phy_address = <3>; @@ -183,8 +169,10 @@ }; }; -&edma { +&wifi { status = "okay"; + qcom,ath11k-fw-memory-mode = <1>; + qcom,ath11k-calibration-variant = "Qihoo-360V6"; }; &dp1 { @@ -211,9 +199,6 @@ label = "wan"; }; -&wifi { +&edma { status = "okay"; - - qcom,ath11k-fw-memory-mode = <1>; - qcom,ath11k-calibration-variant = "Qihoo-360V6"; }; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-ax18.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-ax18.dts new file mode 100644 index 0000000000..ae1045ef8a --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-ax18.dts @@ -0,0 +1,52 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; + +#include "ipq6000-cmiot.dtsi" + +/ { + model = "CMIOT AX18"; + compatible = "cmiot,ax18", "qcom,ipq6018"; + + aliases { + led-boot = &led_power; + led-failsafe = &led_power; + led-running = &led_power; + led-upgrade = &led_power; + }; + + leds { + compatible = "gpio-leds"; + + led_power: power { + label = "blue:power"; + gpios = <&tlmm 73 GPIO_ACTIVE_HIGH>; + }; + + wan { + label = "blue:wan"; + gpios = <&tlmm 74 GPIO_ACTIVE_HIGH>; + }; + + wlan2g { + label = "blue:wlan2g"; + gpios = <&tlmm 37 GPIO_ACTIVE_HIGH>; + }; + + wlan5g { + label = "blue:wlan5g"; + gpios = <&tlmm 35 GPIO_ACTIVE_HIGH>; + }; + + wps { + label = "red:wps"; + gpios = <&tlmm 69 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&wifi { + status = "okay"; + qcom,ath11k-fw-memory-mode = <1>; + qcom,ath11k-calibration-variant = "CMIOT-AX18"; +}; \ No newline at end of file diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-ax1800.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-ax1800.dts new file mode 100644 index 0000000000..2d0f7a4421 --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-ax1800.dts @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; + +#include "ipq6000-xiaomi.dtsi" + +/ { + model = "Xiaomi AX1800"; + compatible = "xiaomi,ax1800", "qcom,ipq6018"; +}; + +&wifi { + status = "okay"; + qcom,ath11k-fw-memory-mode = <1>; + qcom,ath11k-calibration-variant = "Xiaomi-AX1800"; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-ax5-jdcloud.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-ax5-jdcloud.dts new file mode 100644 index 0000000000..68f18cfb99 --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-ax5-jdcloud.dts @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; + +#include "ipq6000-xiaomi.dtsi" + +/ { + model = "Redmi AX5 JDCloud"; + compatible = "redmi,ax5-jdcloud", "qcom,ipq6018"; + + chosen { + /delete-property/ bootargs-append; + }; +}; + +&sdhc_1 { + status = "okay"; + + /delete-property/ mmc-hs400-1_8v; + mmc-hs200-1_8v; + mmc-ddr-1_8v; +}; + +&wifi { + status = "okay"; + qcom,ath11k-fw-memory-mode = <1>; + qcom,ath11k-calibration-variant = "Redmi-AX5-JDCloud"; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-ax5.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-ax5.dts new file mode 100644 index 0000000000..d4d2fc55df --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-ax5.dts @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; + +#include "ipq6000-xiaomi.dtsi" + +/ { + model = "Redmi AX5"; + compatible = "redmi,ax5", "qcom,ipq6018"; +}; + +&wifi { + status = "okay"; + qcom,ath11k-fw-memory-mode = <1>; + qcom,ath11k-calibration-variant = "Redmi-AX5"; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-cmiot.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-cmiot.dtsi new file mode 100644 index 0000000000..9720d71740 --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-cmiot.dtsi @@ -0,0 +1,169 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ipq6018-512m.dtsi" +#include "ipq6018-common.dtsi" +#include "ipq6018-ess.dtsi" +#include "ipq6018-nss.dtsi" +#include "ipq6000-fixed-smps.dtsi" + +#include +#include +#include + +/ { + aliases { + serial0 = &blsp1_uart3; + + ethernet0 = &dp1; + ethernet1 = &dp2; + ethernet3 = &dp4; + ethernet4 = &dp5; + }; + + chosen { + stdout-path = "serial0:115200n8"; + bootargs-append = " root=/dev/ubiblock0_1"; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&tlmm 60 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&tlmm 9 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; +}; + +&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; + }; + }; +}; + +&dp1 { + status = "okay"; + phy-handle = <&qca8075_0>; + label = "lan3"; +}; + +&dp2 { + status = "okay"; + phy-handle = <&qca8075_1>; + label = "lan2"; +}; + +&dp4 { + status = "okay"; + phy-handle = <&qca8075_3>; + label = "lan1"; +}; + +&dp5 { + status = "okay"; + phy-handle = <&qca8075_4>; + label = "wan"; +}; + +&mdio { + status = "okay"; + + pinctrl-0 = <&mdio_pins>; + pinctrl-names = "default"; + reset-gpios = <&tlmm 75 GPIO_ACTIVE_LOW>; + + ethernet-phy-package@0 { + compatible = "qcom,qca8075-package"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + + qca8075_0: ethernet-phy@0 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <0>; + }; + + qca8075_1: ethernet-phy@1 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <1>; + }; + + qca8075_3: ethernet-phy@3 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <3>; + }; + + qca8075_4: ethernet-phy@4 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <4>; + }; + }; +}; + +&switch { + status = "okay"; + + switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT4)>; + switch_wan_bmp = ; + switch_mac_mode = ; + + qcom,port_phyinfo { + port@1 { + port_id = <1>; + phy_address = <0>; + }; + + port@2 { + port_id = <2>; + phy_address = <1>; + }; + + port@4 { + port_id = <4>; + phy_address = <3>; + }; + + port@5 { + port_id = <5>; + phy_address = <4>; + }; + }; +}; + +&qpic_nand { + status = "okay"; + + nand@0 { + reg = <0>; + nand-ecc-strength = <4>; + nand-ecc-step-size = <512>; + nand-bus-width = <8>; + + partitions { + compatible = "qcom,smem-part"; + }; + }; +}; + +&edma { + status = "okay"; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-cp-cpu.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-cp-cpu.dtsi new file mode 100644 index 0000000000..546c31542e --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-cp-cpu.dtsi @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: GPL-2.0-only + +#include "ipq6018-cpr-regulator.dtsi" + +&rpm { + status = "okay"; +}; + +&CPU0 { + cpu-supply = <&apc_vreg>; +}; + +&CPU1 { + cpu-supply = <&apc_vreg>; +}; + +&CPU2 { + cpu-supply = <&apc_vreg>; +}; + +&CPU3 { + cpu-supply = <&apc_vreg>; +}; + +&cpu_opp_table { + /delete-node/ opp-1608000000; + /delete-node/ opp-1800000000; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6018-eap610-outdoor.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-eap610-outdoor.dts similarity index 92% rename from target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6018-eap610-outdoor.dts rename to target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-eap610-outdoor.dts index 165fc3ef1b..735d561551 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6018-eap610-outdoor.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-eap610-outdoor.dts @@ -3,8 +3,10 @@ /dts-v1/; #include "ipq6018.dtsi" -#include "ipq6018-cp-cpu.dtsi" +#include "ipq6018-common.dtsi" #include "ipq6018-ess.dtsi" +#include "ipq6018-nss.dtsi" +#include "ipq6000-cp-cpu.dtsi" #include #include @@ -40,13 +42,13 @@ leds { compatible = "gpio-leds"; - led_sys_amber: led-0 { + led_sys_amber: sys-amber { function = "system"; color = ; gpios = <&tlmm 35 GPIO_ACTIVE_HIGH>; }; - led_sys_green: led-1 { + led_sys_green: sys-green { function = "system"; color = ; gpios = <&tlmm 37 GPIO_ACTIVE_HIGH>; @@ -92,10 +94,10 @@ }; &dp5 { - phy-handle = <&rtl8211f_4>; - phy-mode = "sgmii"; - label = "lan"; status = "okay"; + phy-mode = "sgmii"; + phy-handle = <&rtl8211f_4>; + label = "lan"; }; &edma { @@ -117,7 +119,7 @@ &switch { switch_lan_bmp = ; - switch_mac_mode1 = ; + switch_mac_mode1 = ; status = "okay"; qcom,port_phyinfo { @@ -137,7 +139,6 @@ nand@0 { reg = <0>; - nand-ecc-strength = <4>; nand-ecc-step-size = <512>; nand-bus-width = <8>; @@ -145,7 +146,7 @@ }; &wifi { + status = "okay"; ieee80211-freq-limit = <2402000 5835000>; qcom,ath11k-calibration-variant = "TP-Link-EAP610-Outdoor"; - status = "okay"; }; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6018-fap650.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-fap650.dts similarity index 85% rename from target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6018-fap650.dts rename to target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-fap650.dts index e9ebcc9063..d70e0278e0 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6018-fap650.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-fap650.dts @@ -1,11 +1,13 @@ -// SPDX-License-Identifier: MIT, GPL-2.0 or later -/* Copyright (c) 2023, Ruslan Isaev */ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT /dts-v1/; #include "ipq6018-512m.dtsi" -#include "ipq6018-cp-cpu.dtsi" +#include "ipq6018-common.dtsi" #include "ipq6018-ess.dtsi" +#include "ipq6018-nss.dtsi" +#include "ipq6000-cp-cpu.dtsi" + #include #include #include @@ -13,19 +15,22 @@ / { model = "Yuncore FAP650"; compatible = "yuncore,fap650", "qcom,ipq6018"; - + aliases { + serial0 = &blsp1_uart3; + + led-boot = &led_system; + led-failsafe = &led_system; + led-running = &led_system; + led-upgrade = &led_system; + ethernet0 = &dp5; ethernet1 = &dp4; ethernet2 = &dp3; ethernet3 = &dp2; ethernet4 = &dp1; + label-mac-device = &dp5; - serial0 = &blsp1_uart3; - led-boot = &led_system; - led-failsafe = &led_system; - led-running = &led_system; - led-upgrade = &led_system; }; chosen { @@ -66,12 +71,6 @@ }; }; -&blsp1_uart3 { - pinctrl-0 = <&serial_3_pins>; - pinctrl-names = "default"; - status = "okay"; -}; - &tlmm { mdio_pins: mdio-pins { mdc { @@ -92,20 +91,17 @@ &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 { + compatible = "qcom,qca8075-package"; #address-cells = <1>; #size-cells = <0>; - compatible = "qcom,qca8075-package"; reg = <0>; - qcom,package-mode = "psgmii"; - qca8075_0: ethernet-phy@0 { compatible = "ethernet-phy-ieee802.3-c22"; reg = <0>; @@ -135,9 +131,9 @@ &switch { status = "okay"; - switch_lan_bmp = <(ESS_PORT1|ESS_PORT2|ESS_PORT3|ESS_PORT4)>; /* lan port bitmap */ - switch_wan_bmp = ; /* wan port bitmap */ - switch_mac_mode = ; /* mac mode for uniphy instance0*/ + switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT3 | ESS_PORT4)>; + switch_wan_bmp = ; + switch_mac_mode = ; qcom,port_phyinfo { port@1 { @@ -167,18 +163,6 @@ }; }; -&usb2 { - status = "okay"; -}; - -&usb3 { - status = "okay"; -}; - -&edma { - status = "okay"; -}; - &dp1 { status = "okay"; phy-handle = <&qca8075_0>; @@ -206,17 +190,12 @@ &dp5 { status = "okay"; phy-handle = <&qca8075_4>; - phy-mode = "psgmii"; label = "wan"; }; -&qpic_bam { - status = "okay"; -}; - &blsp1_spi1 { status = "okay"; - + flash@0 { #address-cells = <1>; #size-cells = <1>; @@ -315,11 +294,10 @@ nand@0 { reg = <0>; - nand-ecc-strength = <4>; nand-ecc-step-size = <512>; nand-bus-width = <8>; - + partitions { compatible = "fixed-partitions"; #address-cells = <1>; @@ -339,27 +317,11 @@ }; &wifi { - qcom,ath11k-calibration-variant = "Yuncore-FAP650"; + status = "okay"; qcom,ath11k-fw-memory-mode = <1>; - status = "okay"; + qcom,ath11k-calibration-variant = "Yuncore-FAP650"; }; -&qusb_phy_0 { - status = "okay"; -}; - -&qusb_phy_1 { - status = "okay"; -}; - -&ssphy_0 { - status = "okay"; -}; - -&usb3 { - status = "okay"; -}; - -&usb2 { +&edma { status = "okay"; }; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6018-fixed-smps.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-fixed-smps.dtsi similarity index 53% rename from target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6018-fixed-smps.dtsi rename to target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-fixed-smps.dtsi index e867daf866..478cc7ca9f 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6018-fixed-smps.dtsi +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-fixed-smps.dtsi @@ -26,27 +26,6 @@ }; &cpu_opp_table { - opp-864000000 { - opp-microvolt = <1100000>; - }; - - opp-1056000000 { - opp-microvolt = <1100000>; - }; - - opp-1320000000 { - opp-microvolt = <1100000>; - }; - - opp-1440000000 { - opp-microvolt = <1100000>; - }; - - opp-1608000000 { - opp-microvolt = <1100000>; - }; - - opp-1800000000 { - opp-microvolt = <1100000>; - }; + /delete-node/ opp-1608000000; + /delete-node/ opp-1800000000; }; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-gl-ax1800.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-gl-ax1800.dts new file mode 100644 index 0000000000..dedbcde58c --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-gl-ax1800.dts @@ -0,0 +1,129 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; + +#include "ipq6000-glinet.dtsi" + +/ { + model = "GL Technologies, Inc. AX1800"; + compatible = "glinet,gl-ax1800", "qcom,ipq6018"; + + aliases { + ethernet0 = &dp1; + ethernet1 = &dp2; + ethernet2 = &dp3; + ethernet3 = &dp4; + ethernet4 = &dp5; + }; +}; + +&mdio { + status = "okay"; + + pinctrl-0 = <&mdio_pins>; + pinctrl-names = "default"; + reset-gpios = <&tlmm 75 GPIO_ACTIVE_LOW>; + + ethernet-phy-package@0 { + compatible = "qcom,qca8075-package"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + + qca8075_0: ethernet-phy@0 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <0>; + }; + + qca8075_1: ethernet-phy@1 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <1>; + }; + + qca8075_2: ethernet-phy@2 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <2>; + }; + + qca8075_3: ethernet-phy@3 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <3>; + }; + + qca8075_4: ethernet-phy@4 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <4>; + }; + }; +}; + +&switch { + status = "okay"; + + switch_lan_bmp = <(ESS_PORT2 | ESS_PORT3 | ESS_PORT4 | ESS_PORT5)>; + switch_wan_bmp = ; + switch_mac_mode = ; + + qcom,port_phyinfo { + port@1 { + port_id = <1>; + phy_address = <0>; + }; + + port@2 { + port_id = <2>; + phy_address = <1>; + }; + + port@3 { + port_id = <3>; + phy_address = <2>; + }; + + port@4 { + port_id = <4>; + phy_address = <3>; + }; + + port@5 { + port_id = <5>; + phy_address = <4>; + }; + }; +}; + +&dp1 { + status = "okay"; + phy-handle = <&qca8075_0>; + label = "wan"; +}; + +&dp2 { + status = "okay"; + phy-handle = <&qca8075_1>; + label = "lan1"; +}; + +&dp3 { + status = "okay"; + phy-handle = <&qca8075_2>; + label = "lan2"; +}; + +&dp4 { + status = "okay"; + phy-handle = <&qca8075_3>; + label = "lan3"; +}; + +&dp5 { + status = "okay"; + phy-handle = <&qca8075_4>; + label = "lan4"; +}; + +&wifi { + status = "okay"; + qcom,ath11k-fw-memory-mode = <1>; + qcom,ath11k-calibration-variant = "GL-iNet-GL-AX1800"; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-gl-axt1800.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-gl-axt1800.dts new file mode 100644 index 0000000000..f98002693f --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-gl-axt1800.dts @@ -0,0 +1,193 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; + +#include "ipq6000-glinet.dtsi" + +/ { + model = "GL Technologies, Inc. AXT1800"; + compatible = "glinet,gl-axt1800", "qcom,ipq6018"; + + aliases { + sdhc0 = &sdhc_1; + + ethernet0 = &dp1; + ethernet1 = &dp2; + ethernet2 = &dp3; + }; + + V30: V30 { + compatible = "regulator-fixed"; + regulator-name = "vmmc-supply"; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-always-on; + }; + + V18: V18 { + compatible = "regulator-fixed"; + regulator-name = "vqmmc-supply"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + }; +}; + +&soc { + fan0: pwm-fan { + compatible = "pwm-fan"; + pinctrl-0 = <&fan_pins>; + pinctrl-names = "default"; + cooling-min-state = <0>; + cooling-max-state = <255>; + #cooling-cells = <2>; + pwms = <&pwm 1 40000 0>; + cooling-levels = <0 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 + 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 37 38 39 + 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 + 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 + 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 + 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 + 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 + 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 + 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 + 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 + 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 + 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 + 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255>; + }; +}; + +&pwm { + pinctrl-0 = <&pwm_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +&tlmm { + sd_pins: sd-pins { + sd { + pins = "gpio62"; + function = "sd_card"; + bias-pull-up; + }; + ldo { + pins = "gpio66"; + function = "gpio"; + bias-pull-up; + }; + }; + + pwm_pins: pwm-pins { + pwm { + pins = "gpio30"; + function = "pwm13"; + drive-strength = <8>; + }; + }; + + fan_pins: fan-pins { + pwr { + pins = "gpio29"; + function = "gpio"; + bias-pull-up; + output-high; + }; + speed { + pins = "gpio31"; + function = "gpio"; + drive-strength = <8>; + bias-pull-down; + }; + }; +}; + +&mdio { + status = "okay"; + + pinctrl-0 = <&mdio_pins>; + pinctrl-names = "default"; + reset-gpios = <&tlmm 74 GPIO_ACTIVE_LOW>; + + ethernet-phy-package@0 { + compatible = "qcom,qca8075-package"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + + qca8075_0: ethernet-phy@0 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <0>; + }; + + qca8075_1: ethernet-phy@1 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <1>; + }; + + qca8075_2: ethernet-phy@2 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <2>; + }; + }; +}; + +&switch { + status = "okay"; + + switch_lan_bmp = <(ESS_PORT2 | ESS_PORT3)>; + switch_wan_bmp = ; + switch_mac_mode = ; + + qcom,port_phyinfo { + port@1 { + port_id = <1>; + phy_address = <0>; + }; + + port@2 { + port_id = <2>; + phy_address = <1>; + }; + + port@3 { + port_id = <3>; + phy_address = <2>; + }; + }; +}; + +&dp1{ + status = "okay"; + phy-handle = <&qca8075_0>; + label = "wan"; +}; + +&dp2{ + status = "okay"; + phy-handle = <&qca8075_1>; + label = "lan1"; +}; + +&dp3{ + status = "okay"; + phy-handle = <&qca8075_2>; + label = "lan2"; +}; + +&sdhc_1 { + status = "okay"; + + pinctrl-0 = <&sd_pins>; + pinctrl-names = "default"; + cd-gpios = <&tlmm 62 1>; + sd-ldo-gpios = <&tlmm 66 1>; + vqmmc-supply = <&V18>; + vmmc-supply = <&V30>; +}; + +&wifi { + status = "okay"; + qcom,ath11k-fw-memory-mode = <1>; + qcom,ath11k-calibration-variant = "GL-iNet-GL-AXT1800"; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-glinet.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-glinet.dtsi new file mode 100644 index 0000000000..9fc4067fca --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-glinet.dtsi @@ -0,0 +1,161 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ipq6018-512m.dtsi" +#include "ipq6018-common.dtsi" +#include "ipq6018-ess.dtsi" +#include "ipq6018-nss.dtsi" +#include "ipq6000-fixed-smps.dtsi" + +#include +#include +#include + +/ { + aliases { + serial0 = &blsp1_uart3; + + led-boot = &led_system_white; + led-failsafe = &led_system_white; + led-running = &led_system_white; + led-upgrade = &led_system_white; + }; + + chosen { + stdout-path = "serial0:115200n8"; + bootargs-append = " root=/dev/ubiblock0_1"; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&tlmm 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + switch { + label = "switch"; + gpios = <&tlmm 9 GPIO_ACTIVE_HIGH>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_system_white: system-white { + label = "white:system"; + gpios = <&tlmm 35 GPIO_ACTIVE_HIGH>; + color = ; + }; + + led_system_blue: system-blue { + label = "blue:system"; + gpios = <&tlmm 37 GPIO_ACTIVE_HIGH>; + color = ; + }; + }; +}; + +&tlmm { + gpio-reserved-ranges = <20 1>; + + 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; + }; + + mux_2 { + pins = "gpio74"; + function = "gpio"; + bias-pull-up; + }; + }; + + usb_power_pins: usb-power-pins { + mux { + pins = "gpio0"; + function = "gpio"; + bias-pull-up; + output-high; + }; + }; + + spi_1_pins: spi-1-pins { + mux { + pins = "gpio38", "gpio39", "gpio40", "gpio41"; + function = "blsp0_spi"; + drive-strength = <8>; + bias-pull-down; + }; + }; + + i2c_1_pins: i2c-1-pins { + mux { + pins = "gpio42", "gpio43"; + function = "blsp2_i2c"; + drive-strength = <8>; + bias-pull-down; + }; + }; +}; + +&blsp1_spi1 { + status = "okay"; + + pinctrl-0 = <&spi_1_pins>; + pinctrl-names = "default"; + cs-select = <0>; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + reg = <0>; + compatible = "n25q128a11"; + linux,modalias = "m25p80", "n25q128a11"; + spi-max-frequency = <50000000>; + use-default-sizes; + }; +}; + +&blsp1_i2c3 { + pinctrl-0 = <&i2c_1_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +&usb3 { + pinctrl-0 = <&usb_power_pins>; + pinctrl-names = "default"; + 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 = "qcom,smem-part"; + }; + }; +}; + +&edma { + status = "okay"; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-link.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-link.dtsi new file mode 100644 index 0000000000..33135e430a --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-link.dtsi @@ -0,0 +1,99 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ipq6018.dtsi" +#include "ipq6018-common.dtsi" +#include "ipq6018-ess.dtsi" +#include "ipq6018-nss.dtsi" +#include "ipq6000-fixed-smps.dtsi" + +#include +#include +#include + +/ { + aliases { + serial0 = &blsp1_uart3; + + led-boot = &led_status_blue; + led-failsafe = &led_status_red; + led-running = &led_status_green; + led-upgrade = &led_status_red; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + keys { + compatible = "gpio-keys"; + + wps { + label = "wps"; + linux,code = ; + gpios = <&tlmm 42 GPIO_ACTIVE_LOW>; + }; + + reset { + label = "reset"; + linux,code = ; + gpios = <&tlmm 9 GPIO_ACTIVE_LOW>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_status_red: status-red { + label = "red:status"; + gpios = <&tlmm 50 GPIO_ACTIVE_HIGH>; + }; + + led_status_green: status-green { + label = "green:status"; + gpios = <&tlmm 70 GPIO_ACTIVE_HIGH>; + }; + + led_status_blue: status-blue { + label = "blue:status"; + gpios = <&tlmm 69 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&tlmm { + gpio-reserved-ranges = <20 1>; + + 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; + }; + }; +}; + +&sdhc_1 { + status = "okay"; + + /delete-property/ mmc-hs400-1_8v; + mmc-hs200-1_8v; + mmc-ddr-1_8v; +}; + +&wifi { + status = "okay"; + qcom,ath11k-fw-memory-mode = <1>; + qcom,ath11k-calibration-variant = "Link-NN6000"; +}; + +&edma { + status = "okay"; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-m2.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-m2.dts new file mode 100644 index 0000000000..d5fc6777b3 --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-m2.dts @@ -0,0 +1,57 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; + +#include "ipq6000-cmiot.dtsi" + +/ { + model = "ZN M2"; + compatible = "zn,m2", "qcom,ipq6018"; + + aliases { + led-boot = &led_power; + led-failsafe = &led_power; + led-running = &led_power; + led-upgrade = &led_power; + }; + + leds { + compatible = "gpio-leds"; + + led_power: power { + label = "blue:power"; + gpios = <&tlmm 58 GPIO_ACTIVE_HIGH>; + }; + + mesh { + label = "blue:mesh"; + gpios = <&tlmm 73 GPIO_ACTIVE_HIGH>; + }; + + lan { + label = "blue:lan"; + gpios = <&tlmm 74 GPIO_ACTIVE_HIGH>; + }; + + wan { + label = "blue:wan"; + gpios = <&tlmm 37 GPIO_ACTIVE_HIGH>; + }; + + wlan5g { + label = "blue:wlan5g"; + gpios = <&tlmm 35 GPIO_ACTIVE_HIGH>; + }; + + wlan2g { + label = "blue:wlan2g"; + gpios = <&tlmm 70 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&wifi { + status = "okay"; + qcom,ath11k-fw-memory-mode = <1>; + qcom,ath11k-calibration-variant = "ZN-M2"; +}; \ No newline at end of file diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-mr7350.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-mr7350.dts index 313712061f..4c980a1ecf 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-mr7350.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-mr7350.dts @@ -3,8 +3,11 @@ /dts-v1/; #include "ipq6018.dtsi" -#include "ipq6018-cp-cpu.dtsi" +#include "ipq6018-common.dtsi" #include "ipq6018-ess.dtsi" +#include "ipq6018-nss.dtsi" +#include "ipq6000-cp-cpu.dtsi" + #include #include #include @@ -16,6 +19,7 @@ aliases { serial0 = &blsp1_uart3; serial1 = &blsp1_uart2; + led-boot = &led_system_blue; led-running = &led_system_blue; led-failsafe = &led_system_red; @@ -60,7 +64,7 @@ regulator-name = "usb_vbus"; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; - gpio = <&tlmm 61 GPIO_ACTIVE_LOW>; + gpios = <&tlmm 61 GPIO_ACTIVE_LOW>; regulator-boot-on; }; }; @@ -68,8 +72,7 @@ &tlmm { hsuart_pins: hsuart-pins { mux { - pins = "gpio69", "gpio70", - "gpio71", "gpio72"; + pins = "gpio69", "gpio70", "gpio71", "gpio72"; function = "blsp1_uart"; drive-strength = <8>; bias-disable; @@ -103,9 +106,10 @@ }; &blsp1_i2c3 { + status = "okay"; + pinctrl-0 = <&i2c_pins>; pinctrl-names = "default"; - status = "okay"; led-controller@62 { compatible = "nxp,pca9633"; @@ -113,19 +117,19 @@ #size-cells = <0>; reg = <0x62>; - led_system_red: led@0 { + led_system_red: system-red { reg = <0>; color = ; function = LED_FUNCTION_STATUS; }; - led_system_green: led@1 { + led_system_green: system-green { reg = <1>; color = ; function = LED_FUNCTION_STATUS; }; - led_system_blue: led@2 { + led_system_blue: system-blue { reg = <2>; color = ; function = LED_FUNCTION_STATUS; @@ -139,12 +143,6 @@ status = "okay"; }; -&blsp1_uart3 { - pinctrl-0 = <&serial_3_pins>; - pinctrl-names = "default"; - status = "okay"; -}; - &dwc_0 { #address-cells = <1>; #size-cells = <0>; @@ -160,10 +158,6 @@ }; }; -&qpic_bam { - status = "okay"; -}; - &qpic_nand { status = "okay"; @@ -181,17 +175,12 @@ &qusb_phy_0 { status = "okay"; - vdd-supply = <®_usb_vbus>; }; -&ssphy_0 { - status = "okay"; -}; - &usb3 { - vbus-supply = <®_usb_vbus>; status = "okay"; + vbus-supply = <®_usb_vbus>; }; &mdio { @@ -210,121 +199,26 @@ qca8075_0: ethernet-phy@0 { compatible = "ethernet-phy-ieee802.3-c22"; reg = <0>; - - leds { - #address-cells = <1>; - #size-cells = <0>; - - led@0 { - reg = <0>; - color = ; - function = LED_FUNCTION_LAN; - default-state = "keep"; - }; - - led@1 { - reg = <1>; - color = ; - function = LED_FUNCTION_LAN; - default-state = "keep"; - }; - }; }; qca8075_1: ethernet-phy@1 { compatible = "ethernet-phy-ieee802.3-c22"; reg = <1>; - - leds { - #address-cells = <1>; - #size-cells = <0>; - - led@0 { - reg = <0>; - color = ; - function = LED_FUNCTION_LAN; - default-state = "keep"; - }; - - led@1 { - reg = <1>; - color = ; - function = LED_FUNCTION_LAN; - default-state = "keep"; - }; - }; }; qca8075_2: ethernet-phy@2 { compatible = "ethernet-phy-ieee802.3-c22"; reg = <2>; - - leds { - #address-cells = <1>; - #size-cells = <0>; - - led@0 { - reg = <0>; - color = ; - function = LED_FUNCTION_LAN; - default-state = "keep"; - }; - - led@1 { - reg = <1>; - color = ; - function = LED_FUNCTION_LAN; - default-state = "keep"; - }; - }; }; qca8075_3: ethernet-phy@3 { compatible = "ethernet-phy-ieee802.3-c22"; reg = <3>; - - leds { - #address-cells = <1>; - #size-cells = <0>; - - led@0 { - reg = <0>; - color = ; - function = LED_FUNCTION_LAN; - default-state = "keep"; - }; - - led@1 { - reg = <1>; - color = ; - function = LED_FUNCTION_LAN; - default-state = "keep"; - }; - }; }; qca8075_4: ethernet-phy@4 { compatible = "ethernet-phy-ieee802.3-c22"; reg = <4>; - - leds { - #address-cells = <1>; - #size-cells = <0>; - - led@0 { - reg = <0>; - color = ; - function = LED_FUNCTION_WAN; - default-state = "keep"; - }; - - led@1 { - reg = <1>; - color = ; - function = LED_FUNCTION_WAN; - default-state = "keep"; - }; - }; }; }; }; @@ -341,18 +235,22 @@ port_id = <1>; phy_address = <0>; }; + port@2 { port_id = <2>; phy_address = <1>; }; + port@3 { port_id = <3>; phy_address = <2>; }; + port@4 { port_id = <4>; phy_address = <3>; }; + port@5 { port_id = <5>; phy_address = <4>; @@ -360,8 +258,10 @@ }; }; -&edma { +&wifi { status = "okay"; + qcom,ath11k-fw-memory-mode = <1>; + qcom,ath11k-calibration-variant = "Linksys-MR7350"; }; &dp1 { @@ -394,9 +294,6 @@ label = "wan"; }; -&wifi { +&edma { status = "okay"; - - qcom,ath11k-calibration-variant = "Linksys-MR7350"; - qcom,ath11k-fw-memory-mode = <1>; }; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-nn6000-v1.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-nn6000-v1.dts new file mode 100644 index 0000000000..641e5f0a31 --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-nn6000-v1.dts @@ -0,0 +1,89 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; + +#include "ipq6000-link.dtsi" + +/ { + model = "Link NN6000 v1"; + compatible = "link,nn6000-v1", "qcom,ipq6018"; + + aliases { + ethernet1 = &dp2; + ethernet2 = &dp3; + ethernet3 = &dp4; + }; +}; + +&mdio { + status = "okay"; + + pinctrl-0 = <&mdio_pins>; + pinctrl-names = "default"; + reset-gpios = <&tlmm 75 GPIO_ACTIVE_LOW>; + + ethernet-phy-package@0 { + compatible = "qcom,qca8075-package"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + + qca8075_1: ethernet-phy@1 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <1>; + }; + + qca8075_2: ethernet-phy@2 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <2>; + }; + + qca8075_3: ethernet-phy@3 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <3>; + }; + }; +}; + +&switch { + status = "okay"; + + switch_lan_bmp = <(ESS_PORT3 | ESS_PORT4)>; + switch_wan_bmp = ; + switch_mac_mode = ; + + qcom,port_phyinfo { + port@2 { + port_id = <2>; + phy_address = <1>; + }; + + port@3 { + port_id = <3>; + phy_address = <2>; + }; + + port@4 { + port_id = <4>; + phy_address = <3>; + }; + }; +}; + +&dp2 { + status = "okay"; + phy-handle = <&qca8075_1>; + label = "wan"; +}; + +&dp3 { + status = "okay"; + phy-handle = <&qca8075_2>; + label = "lan1"; +}; + +&dp4 { + status = "okay"; + phy-handle = <&qca8075_3>; + label = "lan2"; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-nn6000-v2.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-nn6000-v2.dts new file mode 100644 index 0000000000..21009e4d3e --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-nn6000-v2.dts @@ -0,0 +1,123 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; + +#include "ipq6000-link.dtsi" + +/ { + model = "Link NN6000 v2"; + compatible = "link,nn6000-v2", "qcom,ipq6018"; + + aliases { + ethernet0 = &dp1; + ethernet1 = &dp2; + ethernet2 = &dp3; + ethernet3 = &dp4; + ethernet4 = &dp5; + }; +}; + +&mdio { + status = "okay"; + + pinctrl-0 = <&mdio_pins>; + pinctrl-names = "default"; + reset-gpios = <&tlmm 75 GPIO_ACTIVE_LOW>; + + ethernet-phy-package@0 { + compatible = "qcom,qca8075-package"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + + qca8075_0: ethernet-phy@0 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <0>; + }; + + qca8075_1: ethernet-phy@1 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <1>; + }; + + qca8075_2: ethernet-phy@2 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <2>; + }; + + qca8075_3: ethernet-phy@3 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <3>; + }; + + qca8075_4: ethernet-phy@4 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <4>; + }; + }; +}; + +&switch { + status = "okay"; + + switch_lan_bmp = <(ESS_PORT2 | ESS_PORT3 | ESS_PORT4 | ESS_PORT5)>; + switch_wan_bmp = ; + switch_mac_mode = ; + + qcom,port_phyinfo { + port@1 { + port_id = <1>; + phy_address = <0>; + }; + + port@2 { + port_id = <2>; + phy_address = <1>; + }; + + port@3 { + port_id = <3>; + phy_address = <2>; + }; + + port@4 { + port_id = <4>; + phy_address = <3>; + }; + + port@5 { + port_id = <5>; + phy_address = <4>; + }; + }; +}; + +&dp1 { + status = "okay"; + phy-handle = <&qca8075_0>; + label = "wan"; +}; + +&dp2 { + status = "okay"; + phy-handle = <&qca8075_1>; + label = "lan1"; +}; + +&dp3 { + status = "okay"; + phy-handle = <&qca8075_2>; + label = "lan2"; +}; + +&dp4 { + status = "okay"; + phy-handle = <&qca8075_3>; + label = "lan3"; +}; + +&dp5 { + status = "okay"; + phy-handle = <&qca8075_4>; + label = "lan4"; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-re-ss-01.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-re-ss-01.dts new file mode 100644 index 0000000000..cec0e292f6 --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-re-ss-01.dts @@ -0,0 +1,198 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; + +#include "ipq6018-512m.dtsi" +#include "ipq6018-common.dtsi" +#include "ipq6018-ess.dtsi" +#include "ipq6018-nss.dtsi" +#include "ipq6000-fixed-smps.dtsi" + +#include +#include +#include + +/ { + model = "JDCloud RE-SS-01"; + compatible = "jdcloud,re-ss-01", "qcom,ipq6018"; + + aliases { + serial0 = &blsp1_uart3; + + led-boot = &led_status_blue; + led-failsafe = &led_status_red; + led-running = &led_status_green; + led-upgrade = &led_status_red; + + ethernet1 = &dp2; + ethernet2 = &dp3; + ethernet3 = &dp4; + ethernet4 = &dp5; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + keys { + compatible = "gpio-keys"; + + wps { + label = "wps"; + linux,code = ; + gpios = <&tlmm 8 GPIO_ACTIVE_LOW>; + }; + + reset { + label = "reset"; + linux,code = ; + gpios = <&tlmm 9 GPIO_ACTIVE_LOW>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_status_red: status-red { + label = "red:status"; + gpios = <&tlmm 37 GPIO_ACTIVE_HIGH>; + }; + + led_status_green: status-green { + label = "green:status"; + gpios = <&tlmm 50 GPIO_ACTIVE_HIGH>; + }; + + led_status_blue: status-blue { + label = "blue:status"; + gpios = <&tlmm 35 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&tlmm { + gpio-reserved-ranges = <20 1>; + + 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; + }; + }; +}; + +&sdhc_1 { + status = "okay"; + + /delete-property/ mmc-hs400-1_8v; + mmc-hs200-1_8v; + mmc-ddr-1_8v; +}; + +&mdio { + status = "okay"; + + pinctrl-0 = <&mdio_pins>; + pinctrl-names = "default"; + reset-gpios = <&tlmm 75 GPIO_ACTIVE_LOW>; + + ethernet-phy-package@0 { + compatible = "qcom,qca8075-package"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + + qca8075_1: ethernet-phy@1 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <1>; + }; + + qca8075_2: ethernet-phy@2 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <2>; + }; + + qca8075_3: ethernet-phy@3 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <3>; + }; + + qca8075_4: ethernet-phy@4 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <4>; + }; + }; +}; + +&switch { + status = "okay"; + + switch_lan_bmp = <(ESS_PORT2 | ESS_PORT3 | ESS_PORT4)>; + switch_wan_bmp = ; + switch_mac_mode = ; + + qcom,port_phyinfo { + port@2 { + port_id = <2>; + phy_address = <1>; + }; + + port@3 { + port_id = <3>; + phy_address = <2>; + }; + + port@4 { + port_id = <4>; + phy_address = <3>; + }; + + port@5 { + port_id = <5>; + phy_address = <4>; + }; + }; +}; + +&wifi { + status = "okay"; + qcom,ath11k-fw-memory-mode = <1>; + qcom,ath11k-calibration-variant = "JDC-RE-SS-01"; +}; + +&dp2 { + status = "okay"; + phy-handle = <&qca8075_1>; + label = "lan1"; +}; + +&dp3 { + status = "okay"; + phy-handle = <&qca8075_2>; + label = "lan2"; +}; + +&dp4 { + status = "okay"; + phy-handle = <&qca8075_3>; + label = "lan3"; +}; + +&dp5 { + status = "okay"; + phy-handle = <&qca8075_4>; + label = "wan"; +}; + +&edma { + status = "okay"; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-xiaomi.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-xiaomi.dtsi new file mode 100644 index 0000000000..186e7af236 --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6000-xiaomi.dtsi @@ -0,0 +1,194 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ipq6018-512m.dtsi" +#include "ipq6018-common.dtsi" +#include "ipq6018-ess.dtsi" +#include "ipq6018-nss.dtsi" +#include "ipq6000-cp-cpu.dtsi" + +#include +#include +#include + +/ { + aliases { + serial0 = &blsp1_uart3; + + led-boot = &led_system_yellow; + led-failsafe = &led_system_blue; + led-running = &led_system_blue; + led-upgrade = &led_system_yellow; + + ethernet1 = &dp2; + ethernet2 = &dp3; + ethernet3 = &dp4; + ethernet4 = &dp5; + }; + + chosen { + stdout-path = "serial0:115200n8"; + bootargs-append = " root=/dev/ubiblock0_1"; + }; + + leds { + compatible = "gpio-leds"; + + led_system_blue: system-blue { + label = "blue:system"; + gpios = <&tlmm 29 GPIO_ACTIVE_HIGH>; + }; + + led_system_yellow: system-yellow { + label = "yellow:system"; + gpios = <&tlmm 30 GPIO_ACTIVE_HIGH>; + }; + + led_network_blue: network-blue { + label = "blue:network"; + gpios = <&tlmm 31 GPIO_ACTIVE_HIGH>; + }; + + led_network_yellow: network-yellow { + label = "yellow:network"; + gpios = <&tlmm 32 GPIO_ACTIVE_HIGH>; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&tlmm 19 GPIO_ACTIVE_LOW>; + linux,input-type = <1>; + debounce-interval = <60>; + }; + }; +}; + +&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; + }; + }; +}; + +&qpic_nand { + status = "okay"; + + nand@0 { + reg = <0>; + nand-ecc-strength = <4>; + nand-ecc-step-size = <512>; + nand-bus-width = <8>; + + partitions { + compatible = "qcom,smem-part"; + }; + }; +}; + +&mdio { + status = "okay"; + + pinctrl-0 = <&mdio_pins>; + pinctrl-names = "default"; + reset-gpios = <&tlmm 75 GPIO_ACTIVE_LOW>; + + ethernet-phy-package@0 { + compatible = "qcom,qca8075-package"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + + qca8075_1: ethernet-phy@1 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <1>; + }; + + qca8075_2: ethernet-phy@2 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <2>; + }; + + qca8075_3: ethernet-phy@3 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <3>; + }; + + qca8075_4: ethernet-phy@4 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <4>; + }; + }; +}; + +&switch { + status = "okay"; + + switch_lan_bmp = <(ESS_PORT2 | ESS_PORT3 | ESS_PORT4)>; + switch_wan_bmp = ; + switch_mac_mode = ; + + qcom,port_phyinfo { + port@2 { + port_id = <2>; + phy_address = <1>; + }; + + port@3 { + port_id = <3>; + phy_address = <2>; + }; + + port@4 { + port_id = <4>; + phy_address = <3>; + }; + + port@5 { + port_id = <5>; + phy_address = <4>; + }; + }; +}; + +&dp2 { + status = "okay"; + phy-handle = <&qca8075_1>; + label = "lan1"; +}; + +&dp3 { + status = "okay"; + phy-handle = <&qca8075_2>; + label = "lan2"; +}; + +&dp4 { + status = "okay"; + phy-handle = <&qca8075_3>; + label = "lan3"; +}; + +&dp5 { + status = "okay"; + phy-handle = <&qca8075_4>; + label = "wan"; +}; + +&edma { + status = "okay"; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6018-cp-cpu.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6010-cp-cpu.dtsi similarity index 89% rename from target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6018-cp-cpu.dtsi rename to target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6010-cp-cpu.dtsi index 2dee366e1e..1542863208 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6018-cp-cpu.dtsi +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6010-cp-cpu.dtsi @@ -2,6 +2,10 @@ #include "ipq6018-cpr-regulator.dtsi" +&rpm { + status = "okay"; +}; + &CPU0 { cpu-supply = <&apc_vreg>; }; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6010-fixed-smps.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6010-fixed-smps.dtsi new file mode 100644 index 0000000000..07d3c9e732 --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6010-fixed-smps.dtsi @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: GPL-2.0-only + +/* + * Board does not use companion MP5496 PMIC, + * but rather uses fixed external SMPS. + */ + +&rpm { + status = "disabled"; +}; + +&CPU0 { + /delete-property/ cpu-supply; +}; + +&CPU1 { + /delete-property/ cpu-supply; +}; + +&CPU2 { + /delete-property/ cpu-supply; +}; + +&CPU3 { + /delete-property/ cpu-supply; +}; 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 index 439b394e8c..7364dffef7 100644 --- 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 @@ -3,8 +3,11 @@ /dts-v1/; #include "ipq6018.dtsi" -#include "ipq6018-cp-cpu.dtsi" +#include "ipq6018-common.dtsi" #include "ipq6018-ess.dtsi" +#include "ipq6018-nss.dtsi" +#include "ipq6010-cp-cpu.dtsi" + #include #include #include @@ -33,8 +36,6 @@ leds { compatible = "gpio-leds"; - pinctrl-0 = <&led_pins>; - pinctrl-names = "default"; wlan5g { color = ; @@ -78,16 +79,7 @@ bias-pull-down; }; - led_pins: led_pins { - leds { - pins = "gpio66", "gpio67"; - function = "gpio"; - drive-strength = <8>; - bias-pull-down; - }; - }; - - sd_pins: sd_pins { + sd_pins: sd-pins { sd_cd { pins = "gpio62"; function = "gpio"; @@ -97,16 +89,11 @@ }; }; -&blsp1_uart3 { - pinctrl-0 = <&serial_3_pins>; - pinctrl-names = "default"; - status = "okay"; -}; - &blsp1_spi1 { + status = "okay"; + pinctrl-0 = <&spi_0_pins>; pinctrl-names = "default"; - status = "okay"; flash@0 { #address-cells = <1>; @@ -204,58 +191,47 @@ &dp3 { status = "okay"; - - phy-handle = <&qca8072_1>; + phy-handle = <&qca8072_4>; + label = "lan2"; nvmem-cells = <&macaddr_eth1>; nvmem-cell-names = "mac-address"; - label = "lan2"; }; &dp4 { status = "okay"; - - phy-handle = <&qca8072_0>; + phy-handle = <&qca8072_3>; + label = "lan1"; nvmem-cells = <&macaddr_eth0>; nvmem-cell-names = "mac-address"; - label = "lan1"; }; &dp5 { status = "okay"; - - phy-mode = "sgmii"; phy-handle = <&qca8081>; + label = "wan"; 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 { + compatible = "qcom,qca8075-package"; #address-cells = <1>; #size-cells = <0>; - compatible = "qcom,qca8075-package"; reg = <0>; - qcom,package-mode = "psgmii"; - - qca8072_0: ethernet-phy@3 { + qca8072_3: ethernet-phy@3 { compatible = "ethernet-phy-ieee802.3-c22"; reg = <3>; }; - qca8072_1: ethernet-phy@4 { + qca8072_4: ethernet-phy@4 { compatible = "ethernet-phy-ieee802.3-c22"; reg = <4>; }; @@ -264,17 +240,16 @@ qca8081: ethernet-phy@24 { compatible = "ethernet-phy-id004d.d101"; reg = <24>; + reset-deassert-us = <10000>; reset-gpios = <&tlmm 77 GPIO_ACTIVE_LOW>; - reset-assert-us = <10000>; - reset-deassert-us = <50000>; }; }; &sdhc_1 { - pinctrl-0 = <&sd_pins>; - pinctrl-names = "default"; status = "okay"; + pinctrl-0 = <&sd_pins>; + pinctrl-names = "default"; vqmmc-supply = <&ipq6018_l2>; cd-gpios = <&tlmm 62 GPIO_ACTIVE_LOW>; }; @@ -293,10 +268,12 @@ port_id = <3>; phy_address = <4>; }; + port@4 { port_id = <4>; phy_address = <3>; }; + port@5 { port_id = <5>; phy_address = <24>; @@ -305,16 +282,11 @@ }; }; -&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>; @@ -332,36 +304,17 @@ }; }; -&pcie_phy { - status = "okay"; -}; - &pcie0 { status = "okay"; - perst-gpio = <&tlmm 60 GPIO_ACTIVE_LOW>; + perst-gpios = <&tlmm 60 GPIO_ACTIVE_LOW>; }; &wifi { status = "okay"; + qcom,ath11k-fw-memory-mode = <1>; qcom,ath11k-calibration-variant = "8devices-Mango"; }; -&qusb_phy_1 { - status = "okay"; -}; - -&usb2 { - status = "okay"; -}; - -&qusb_phy_0 { - status = "okay"; -}; - -&ssphy_0 { - status = "okay"; -}; - -&usb3 { +&edma { status = "okay"; }; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6010-re-cs-02.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6010-re-cs-02.dts new file mode 100644 index 0000000000..9ae4c1781e --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6010-re-cs-02.dts @@ -0,0 +1,287 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; + +#include "ipq6018.dtsi" +#include "ipq6018-common.dtsi" +#include "ipq6018-ess.dtsi" +#include "ipq6018-nss.dtsi" +#include "ipq6010-fixed-smps.dtsi" + +#include +#include +#include + +/ { + model = "JDCloud RE-CS-02"; + compatible = "jdcloud,re-cs-02", "qcom,ipq6018"; + + aliases { + serial0 = &blsp1_uart3; + serial1 = &blsp1_uart6; + + led-boot = &led_status_blue; + led-failsafe = &led_status_red; + led-running = &led_status_green; + led-upgrade = &led_status_red; + + ethernet0 = &dp1; + ethernet1 = &dp2; + ethernet2 = &dp3; + ethernet3 = &dp4; + ethernet4 = &dp5; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + keys { + compatible = "gpio-keys"; + + wps { + label = "wps"; + linux,code = ; + gpios = <&tlmm 72 GPIO_ACTIVE_LOW>; + }; + + reset { + label = "reset"; + linux,code = ; + gpios = <&tlmm 56 GPIO_ACTIVE_LOW>; + }; + + screen { + label = "screen"; + linux,code = ; + gpios = <&tlmm 71 GPIO_ACTIVE_LOW>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_status_red: status-red { + label = "red:status"; + gpios = <&tlmm 57 GPIO_ACTIVE_HIGH>; + }; + + led_status_green: status-green { + label = "green:status"; + gpios = <&tlmm 58 GPIO_ACTIVE_HIGH>; + }; + + led_status_blue: status-blue { + label = "blue:status"; + gpios = <&tlmm 79 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&tlmm { + gpio-reserved-ranges = <20 1>; + + btuart_pins: btuart-pins { + mux { + pins = "gpio48", "gpio49"; + function = "blsp5_uart"; + drive-strength = <8>; + bias-pull-up; + }; + }; + + tmp1628_pins: tmp1628-pins { + mux { + pins = "gpio69", "gpio70", "gpio73", "gpio74"; + function = "gpio"; + drive-strength = <8>; + bias-pull-down; + }; + }; + + 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; + }; + }; + + usb_pwr_pins: usb-pwr-pins { + mux { + pins = "gpio22"; + function = "gpio"; + bias-pull-down; + output-high; + }; + }; +}; + +&blsp1_uart6 { + status = "okay"; + + pinctrl-0 = <&btuart_pins>; + pinctrl-names = "default"; +}; + +&sdhc_1 { + status = "okay"; + + /delete-property/ mmc-hs400-1_8v; + mmc-ddr-1_8v; + mmc-hs200-1_8v; +}; + +&pcie0 { + status = "okay"; + perst-gpios = <&tlmm 53 GPIO_ACTIVE_LOW>; + + bridge@0,0 { + reg = <0x00000000 0 0 0 0>; + #address-cells = <3>; + #size-cells = <2>; + ranges; + + wifi@1,0 { + status = "okay"; + + compatible = "pci17cb,1104"; + qcom,ath11k-fw-memory-mode = <1>; + qcom,ath11k-calibration-variant = "JDC-RE-CS-02"; + reg = <0x00010000 0 0 0 0>; + }; + }; +}; + +&mdio { + status = "okay"; + + pinctrl-0 = <&mdio_pins>; + pinctrl-names = "default"; + reset-gpios = <&tlmm 75 GPIO_ACTIVE_LOW>; + + ethernet-phy-package@0 { + compatible = "qcom,qca8075-package"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + + qca8075_24: ethernet-phy@24 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <24>; + }; + + qca8075_25: ethernet-phy@25 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <25>; + }; + + qca8075_26: ethernet-phy@26 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <26>; + }; + + qca8075_27: ethernet-phy@27 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <27>; + }; + }; + + qca8081: ethernet-phy@12 { + compatible = "ethernet-phy-id004d.d101"; + reg = <12>; + reset-deassert-us = <10000>; + reset-gpios = <&tlmm 77 GPIO_ACTIVE_LOW>; + }; +}; + +&switch { + status = "okay"; + + switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT3 | ESS_PORT4)>; + switch_wan_bmp = ; + switch_mac_mode = ; + switch_mac_mode1 = ; + + qcom,port_phyinfo { + port@1 { + port_id = <1>; + phy_address = <24>; + }; + + port@2 { + port_id = <2>; + phy_address = <25>; + }; + + port@3 { + port_id = <3>; + phy_address = <26>; + }; + + port@4 { + port_id = <4>; + phy_address = <27>; + }; + + port@5 { + port_id = <5>; + phy_address = <12>; + port_mac_sel = "QGMAC_PORT"; + }; + }; +}; + +&wifi { + status = "okay"; + qcom,ath11k-fw-memory-mode = <1>; + qcom,ath11k-calibration-variant = "JDC-RE-CS-02"; +}; + +&dp1 { + status = "okay"; + phy-handle = <&qca8075_24>; + label = "lan1"; +}; + +&dp2 { + status = "okay"; + phy-handle = <&qca8075_25>; + label = "lan2"; +}; + +&dp3 { + status = "okay"; + phy-handle = <&qca8075_26>; + label = "lan3"; +}; + +&dp4 { + status = "okay"; + phy-handle = <&qca8075_27>; + label = "lan4"; +}; + +&dp5 { + status = "okay"; + phy-handle = <&qca8081>; + label = "wan"; +}; + +&usb3 { + status = "okay"; + pinctrl-0 = <&usb_pwr_pins>; + pinctrl-names = "default"; +}; + +&edma { + status = "okay"; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6010-re-cs-07.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6010-re-cs-07.dts new file mode 100644 index 0000000000..b77e05b7c6 --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6010-re-cs-07.dts @@ -0,0 +1,218 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; + +#include "ipq6018.dtsi" +#include "ipq6018-common.dtsi" +#include "ipq6018-ess.dtsi" +#include "ipq6018-nss.dtsi" +#include "ipq6010-fixed-smps.dtsi" + +#include +#include +#include + +/ { + model = "JDCloud RE-CS-07"; + compatible = "jdcloud,re-cs-07", "qcom,ipq6018"; + + aliases { + serial0 = &blsp1_uart3; + serial1 = &blsp1_uart6; + + led-boot = &led_status_blue; + led-failsafe = &led_status_red; + led-running = &led_status_green; + led-upgrade = &led_status_red; + + ethernet0 = &dp1; + ethernet1 = &dp2; + ethernet2 = &dp3; + ethernet3 = &dp4; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&tlmm 56 GPIO_ACTIVE_LOW>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_status_red: status-red { + label = "red:status"; + gpios = <&tlmm 57 GPIO_ACTIVE_HIGH>; + }; + + led_status_green: status-green { + label = "green:status"; + gpios = <&tlmm 58 GPIO_ACTIVE_HIGH>; + }; + + led_status_blue: status-blue { + label = "blue:status"; + gpios = <&tlmm 79 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&tlmm { + gpio-reserved-ranges = <20 1>; + + btuart_pins: btuart-pins { + mux { + pins = "gpio48", "gpio49"; + function = "blsp5_uart"; + drive-strength = <8>; + bias-pull-up; + }; + }; + + 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; + }; + }; + + usb_pwr_pins: usb-pwr-pins { + mux { + pins = "gpio22"; + function = "gpio"; + bias-pull-down; + output-high; + }; + }; +}; + +&blsp1_uart6 { + status = "okay"; + + pinctrl-0 = <&btuart_pins>; + pinctrl-names = "default"; +}; + +&sdhc_1 { + status = "okay"; + + /delete-property/ mmc-hs400-1_8v; + mmc-ddr-1_8v; + mmc-hs200-1_8v; +}; + +&mdio { + status = "okay"; + + pinctrl-0 = <&mdio_pins>; + pinctrl-names = "default"; + reset-gpios = <&tlmm 75 GPIO_ACTIVE_LOW>; + + ethernet-phy-package@0 { + compatible = "qcom,qca8075-package"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + + qca8075_24: ethernet-phy@24 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <24>; + }; + + qca8075_25: ethernet-phy@25 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <25>; + }; + + qca8075_26: ethernet-phy@26 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <26>; + }; + + qca8075_27: ethernet-phy@27 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <27>; + }; + }; +}; + +&switch { + status = "okay"; + + switch_lan_bmp = <(ESS_PORT2 | ESS_PORT3 | ESS_PORT4)>; + switch_wan_bmp = ; + switch_mac_mode = ; + + qcom,port_phyinfo { + port@1 { + port_id = <1>; + phy_address = <24>; + }; + + port@2 { + port_id = <2>; + phy_address = <25>; + }; + + port@3 { + port_id = <3>; + phy_address = <26>; + }; + + port@4 { + port_id = <4>; + phy_address = <27>; + }; + }; +}; + +&dp1 { + status = "okay"; + phy-handle = <&qca8075_24>; + label = "wan"; +}; + +&dp2 { + status = "okay"; + phy-handle = <&qca8075_25>; + label = "lan1"; +}; + +&dp3 { + status = "okay"; + phy-handle = <&qca8075_26>; + label = "lan2"; +}; + +&dp4 { + status = "okay"; + phy-handle = <&qca8075_27>; + label = "lan3"; +}; + +&usb3 { + pinctrl-0 = <&usb_pwr_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +&edma { + status = "okay"; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6010-wax214.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6010-wax214.dts index 90a4828c17..19cfb92599 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6010-wax214.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6010-wax214.dts @@ -1,10 +1,13 @@ -// SPDX-License-Identifier: (GPL-2.0+) +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT /dts-v1/; #include "ipq6018.dtsi" -#include "ipq6018-cp-cpu.dtsi" +#include "ipq6018-common.dtsi" #include "ipq6018-ess.dtsi" +#include "ipq6018-nss.dtsi" +#include "ipq6010-cp-cpu.dtsi" + #include #include #include @@ -15,12 +18,15 @@ aliases { serial0 = &blsp1_uart3; - ethernet0 = &dp3; - label-mac-device = &dp3; + led-boot = &pwr; led-failsafe = &pwr; led-running = &pwr; led-upgrade = &pwr; + + ethernet0 = &dp3; + + label-mac-device = &dp3; }; chosen { @@ -47,13 +53,13 @@ gpios = <&tlmm 28 GPIO_ACTIVE_HIGH>; }; - lan { + lan { color = ; function = LED_FUNCTION_LAN; gpios = <&tlmm 29 GPIO_ACTIVE_HIGH>; }; - wlan2g { + wlan2g { color = ; function = LED_FUNCTION_WLAN; function-enumerator = <0>; @@ -61,7 +67,7 @@ linux,default-trigger = "phy0radio"; }; - wlan5g { + wlan5g { color = ; function = LED_FUNCTION_WLAN; function-enumerator = <1>; @@ -71,12 +77,6 @@ }; }; -&blsp1_uart3 { - pinctrl-0 = <&serial_3_pins>; - pinctrl-names = "default"; - status = "okay"; -}; - &tlmm { mdio_pins: mdio-pins { mdc { @@ -97,31 +97,23 @@ &dp3 { status = "okay"; - phy-handle = <&qca8072_4>; label = "lan"; }; -&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 { + compatible = "qcom,qca8075-package"; #address-cells = <1>; #size-cells = <0>; - compatible = "qcom,qca8075-package"; reg = <0>; - qcom,package-mode = "psgmii"; - qca8072_4: ethernet-phy@4 { compatible = "ethernet-phy-ieee802.3-c22"; reg = <4>; @@ -144,16 +136,11 @@ }; }; -&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>; @@ -164,9 +151,12 @@ }; }; - &wifi { status = "okay"; qcom,ath11k-fw-memory-mode = <1>; qcom,ath11k-calibration-variant = "Netgear-WAX214"; -}; \ No newline at end of file +}; + +&edma { + status = "okay"; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6010-xe3-4.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6010-xe3-4.dts index e0a6e9eb93..51abb5a40e 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6010-xe3-4.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6010-xe3-4.dts @@ -1,30 +1,35 @@ -// SPDX-License-Identifier: (GPL-2.0+) +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT /dts-v1/; #include "ipq6018.dtsi" -#include "ipq6018-fixed-smps.dtsi" +#include "ipq6018-common.dtsi" #include "ipq6018-ess.dtsi" +#include "ipq6018-nss.dtsi" +#include "ipq6010-fixed-smps.dtsi" + #include #include #include / { - /* Qualcomm Technologies, Inc. IPQ6018/AP-CP01-C3 */ model = "Cambium Networks XE3-4"; - compatible = "cambiumnetworks,xe3-4", "qcom,ipq6018-cp01", "qcom,ipq6018"; + compatible = "cambiumnetworks,xe3-4", "qcom,ipq6018"; aliases { - serial0 = &blsp1_uart3; sdhc2 = &sdhc_1; - ethernet0 = &dp5; - ethernet1 = &dp4; - label-mac-device = &dp5; + + serial0 = &blsp1_uart3; led-boot = &led_status_amber; led-failsafe = &led_status_amber; led-running = &led_status_white; led-upgrade = &led_status_amber; + + ethernet0 = &dp5; + ethernet1 = &dp4; + + label-mac-device = &dp5; }; chosen { @@ -44,19 +49,17 @@ leds { compatible = "gpio-leds"; - pinctrl-0 = <&led_pins>; - pinctrl-names = "default"; led_status_white: status-white { color = ; function = LED_FUNCTION_STATUS; - gpio = <&tlmm 56 GPIO_ACTIVE_LOW>; + gpios = <&tlmm 56 GPIO_ACTIVE_LOW>; }; led_status_amber: status-amber { color = ; function = LED_FUNCTION_STATUS; - gpio = <&tlmm 35 GPIO_ACTIVE_LOW>; + gpios = <&tlmm 35 GPIO_ACTIVE_LOW>; }; }; @@ -68,7 +71,7 @@ startup-delay-us = <200>; - gpio = <&tlmm 66 GPIO_ACTIVE_HIGH>; + gpios = <&tlmm 66 GPIO_ACTIVE_HIGH>; enable-active-high; pinctrl-names = "default"; @@ -76,12 +79,6 @@ }; }; -&blsp1_uart3 { - pinctrl-0 = <&serial_3_pins>; - pinctrl-names = "default"; - status = "okay"; -}; - &blsp1_i2c3 { pinctrl-0 = <&i2c_1_pins>; pinctrl-names = "default"; @@ -89,7 +86,6 @@ }; &tlmm { - /* TZ has exclusive control over GPIO20 */ gpio-reserved-ranges = <20 1>; mdio_pins: mdio-pins { @@ -121,15 +117,6 @@ bias-pull-down; }; - led_pins: led_pins { - leds { - pins = "gpio35", "gpio37", "gpio50"; - function = "gpio"; - drive-strength = <8>; - bias-pull-down; - }; - }; - sd_vmmc_en_default: sd-vmmc-en-default-state { pins = "gpio66"; function = "gpio"; @@ -145,13 +132,9 @@ }; }; -&pcie_phy { - status = "okay"; -}; - &pcie0 { status = "okay"; - perst-gpio = <&tlmm 60 GPIO_ACTIVE_LOW>; + perst-gpios = <&tlmm 60 GPIO_ACTIVE_LOW>; bridge@0,0 { reg = <0x00000000 0 0 0 0>; @@ -166,26 +149,22 @@ compatible = "pci17cb,1104"; reg = <0x00010000 0 0 0 0>; - qcom,ath11k-fw-memory-mode = <0>; + qcom,ath11k-fw-memory-mode = <1>; qcom,ath11k-calibration-variant = "CambiumNetworks-XE34"; }; }; }; &sdhc_1 { - pinctrl-0 = <&sd_pins>; - pinctrl-names = "default"; status = "okay"; + pinctrl-0 = <&sd_pins>; + pinctrl-names = "default"; cd-gpios = <&tlmm 62 GPIO_ACTIVE_LOW>; vqmmc-supply = <®_sd_vmmc>; bus-width = <4>; }; -&edma { - status = "okay"; -}; - &switch { status = "okay"; @@ -209,20 +188,17 @@ &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 { + compatible = "qcom,qca8075-package"; #address-cells = <1>; #size-cells = <0>; - compatible = "qcom,qca8075-package"; reg = <0>; - qcom,package-mode = "psgmii"; - qca8072: ethernet-phy@3 { compatible = "ethernet-phy-ieee802.3-c22"; reg = <3>; @@ -232,29 +208,25 @@ qca8081: ethernet-phy@24 { compatible = "ethernet-phy-id004d.d101"; reg = <24>; + reset-deassert-us = <10000>; reset-gpios = <&tlmm 77 GPIO_ACTIVE_LOW>; - reset-assert-us = <10000>; - reset-deassert-us = <50000>; }; }; &dp4 { status = "okay"; - phy-handle = <&qca8072>; + label = "lan2"; nvmem-cell-names = "mac-address"; nvmem-cells = <ð1addr 0>; - label = "lan2"; }; &dp5 { status = "okay"; - - phy-mode = "sgmii"; phy-handle = <&qca8081>; + label = "lan1"; nvmem-cell-names = "mac-address"; nvmem-cells = <ðaddr 0>; - label = "lan1"; }; &blsp1_spi1 { @@ -398,16 +370,11 @@ }; }; -&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>; @@ -442,16 +409,12 @@ &wifi { status = "okay"; + qcom,ath11k-fw-memory-mode = <1>; qcom,ath11k-calibration-variant = "CambiumNetworks-XE34"; - nvmem-cell-names = "mac-address"; nvmem-cells = <ð2addr>; }; -&qusb_phy_1 { - status = "okay"; -}; - -&usb2 { +&edma { status = "okay"; }; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6018-512m.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6018-512m.dtsi index d46a852404..37598c8d5f 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6018-512m.dtsi +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6018-512m.dtsi @@ -1,23 +1,8 @@ -// SPDX-License-Identifier: GPL-2.0-only +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT #include "ipq6018.dtsi" -&rpm_msg_ram { - reg = <0x0 0x00060000 0x0 0x6000>; - no-map; -}; - -&tz { - reg = <0x0 0x4a600000 0x0 0x00400000>; - no-map; -}; - -&smem_region { - reg = <0x0 0x4aa00000 0x0 0x00100000>; - no-map; -}; - &q6_region { - reg = <0x0 0x4ab00000 0x0 0x03700000>; + reg = <0x0 0x4ab00000 0x0 0x4000000>; no-map; }; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6018-common.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6018-common.dtsi new file mode 100644 index 0000000000..4919663a8f --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6018-common.dtsi @@ -0,0 +1,47 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +&blsp1_uart3 { + status = "okay"; + pinctrl-0 = <&serial_3_pins>; + pinctrl-names = "default"; +}; + +&crypto { + status = "okay"; +}; + +&cryptobam { + status = "okay"; +}; + +&pcie_phy { + status = "okay"; +}; + +&prng { + status = "okay"; +}; + +&qpic_bam { + status = "okay"; +}; + +&qusb_phy_0 { + status = "okay"; +}; + +&qusb_phy_1 { + status = "okay"; +}; + +&ssphy_0 { + status = "okay"; +}; + +&usb2 { + status = "okay"; +}; + +&usb3 { + status = "okay"; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6018-cpr-regulator.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6018-cpr-regulator.dtsi index 738123296f..e23e757968 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6018-cpr-regulator.dtsi +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6018-cpr-regulator.dtsi @@ -37,7 +37,7 @@ qcom,cpr-idle-cycles = <15>; qcom,cpr-step-quot-init-min = <0>; qcom,cpr-step-quot-init-max = <15>; - qcom,cpr-count-mode = <0>; /* All-at-once */ + qcom,cpr-count-mode = <0>; qcom,cpr-count-repeat = <1>; qcom,cpr-down-error-step-limit = <1>; qcom,cpr-up-error-step-limit = <1>; @@ -59,21 +59,15 @@ regulator-max-microvolt = <6>; qcom,cpr-fuse-corners = <4>; qcom,cpr-fuse-combos = <8>; - qcom,cpr-corners = <6>; + qcom,cpr-corners = <8>; qcom,cpr-speed-bins = <1>; - qcom,cpr-speed-bin-corners = <6>; - qcom,cpr-corner-fmax-map = <1 3 5 6>; + qcom,cpr-speed-bin-corners = <8>; + qcom,cpr-corner-fmax-map = <1 3 5 7>; qcom,allow-voltage-interpolation; qcom,allow-quotient-interpolation; - qcom,cpr-voltage-ceiling = - <725000 787500 862500 - 925000 987500 1062500>; - qcom,cpr-voltage-floor = - <587500 650000 712500 - 750000 787500 850000>; - qcom,corner-frequencies = - <864000000 1056000000 1320000000 - 1440000000 1608000000 1800000000>; + qcom,cpr-voltage-ceiling = <725000 787500 850000 862500 925000 937500 987500 1062500>; + qcom,cpr-voltage-floor = <587500 650000 700000 712500 750000 762500 787500 850000>; + qcom,corner-frequencies = <864000000 1056000000 1200000000 1320000000 1440000000 1512000000 1608000000 1800000000>; qcom,cpr-ro-sel = /* Speed bin 0; CPR rev 0..7 */ < 0 0 0 0>, diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6018-ess.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6018-ess.dtsi index 0965003142..d30f09d1ea 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6018-ess.dtsi +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6018-ess.dtsi @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + #include &soc { @@ -158,16 +160,16 @@ "uniphy0_port_4_rst"; mdio-bus = <&mdio>; - switch_cpu_bmp = ; /* cpu port bitmap */ - switch_inner_bmp = <(ESS_PORT6 | ESS_PORT7)>; /*inner port bitmap*/ - switch_mac_mode = ; /* MAC mode for UNIPHY instance 0 */ - switch_mac_mode1 = ; /* MAC mode for UNIPHY instance 1 */ - switch_mac_mode2 = ; /* MAC mode for UNIPHY instance 2 */ + switch_cpu_bmp = ; + switch_inner_bmp = <(ESS_PORT6 | ESS_PORT7)>; + switch_mac_mode = ; + switch_mac_mode1 = ; + switch_mac_mode2 = ; status = "disabled"; - bm_tick_mode = <0>; /* bm tick mode */ - tm_tick_mode = <0>; /* tm tick mode */ + bm_tick_mode = <0>; + tm_tick_mode = <0>; port_scheduler_resource { port@0 { @@ -256,7 +258,7 @@ port_id = <0>; l1scheduler { group@0 { - sp = <0 1>; /*L0 SPs*/ + sp = <0 1>; /*cpri cdrr epri edrr*/ cfg = <0 0 0 0>; }; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6018-nss.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6018-nss.dtsi new file mode 100644 index 0000000000..b18ea6cece --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq6018-nss.dtsi @@ -0,0 +1,216 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/ { + nss_dummy_reg: nss-regulator { + compatible = "regulator-fixed"; + regulator-name = "nss-reg"; + regulator-min-microvolt = <848000>; + regulator-max-microvolt = <848000>; + regulator-always-on; + regulator-boot-on; + }; +}; + +&soc { + nss-common { + compatible = "qcom,nss-common"; + reg = <0x0 0x01868010 0x0 0x1000>, <0x0 0x40000000 0x0 0x1000>; + reg-names = "nss-misc-reset", "nss-misc-reset-flag"; + memory-region = <&nss_region>; + }; + + nss0: nss@40000000 { + compatible = "qcom,nss"; + interrupts = , + , + , + , + , + , + , + , + , + ; + reg = <0x0 0x39000000 0x0 0x1000>, <0x0 0x0b111000 0x0 0x1000>; + reg-names = "nphys", "qgic-phys"; + clocks = <&gcc GCC_NSS_NOC_CLK>, + <&gcc GCC_NSS_PTP_REF_CLK>, + <&gcc GCC_NSS_CSR_CLK>, + <&gcc GCC_NSS_CFG_CLK>, + <&gcc GCC_NSSNOC_QOSGEN_REF_CLK>, + <&gcc GCC_NSSNOC_SNOC_CLK>, + <&gcc GCC_NSSNOC_TIMEOUT_REF_CLK>, + <&gcc GCC_MEM_NOC_UBI32_CLK>, + <&gcc GCC_NSS_CE_AXI_CLK>, + <&gcc GCC_NSS_CE_APB_CLK>, + <&gcc GCC_NSSNOC_CE_AXI_CLK>, + <&gcc GCC_NSSNOC_CE_APB_CLK>, + <&gcc GCC_NSSNOC_UBI0_AHB_CLK>, + <&gcc GCC_UBI0_CORE_CLK>, + <&gcc GCC_UBI0_AHB_CLK>, + <&gcc GCC_UBI0_AXI_CLK>, + <&gcc GCC_UBI0_NC_AXI_CLK>, + <&gcc GCC_UBI0_UTCM_CLK>, + <&gcc GCC_SNOC_NSSNOC_CLK>; + clock-names = "nss-noc-clk", + "nss-ptp-ref-clk", + "nss-csr-clk", + "nss-cfg-clk", + "nss-nssnoc-qosgen-ref-clk", + "nss-nssnoc-snoc-clk", + "nss-nssnoc-timeout-ref-clk", + "nss-mem-noc-ubi32-clk", + "nss-ce-axi-clk", + "nss-ce-apb-clk", + "nss-nssnoc-ce-axi-clk", + "nss-nssnoc-ce-apb-clk", + "nss-nssnoc-ahb-clk", + "nss-core-clk", + "nss-ahb-clk", + "nss-axi-clk", + "nss-nc-axi-clk", + "nss-utcm-clk", + "nss-snoc-nssnoc-clk"; + qcom,id = <0>; + qcom,num-queue = <4>; + qcom,num-irq = <10>; + qcom,num-pri = <4>; + qcom,load-addr = <0x40000000>; + qcom,low-frequency = <187200000>; + qcom,mid-frequency = <748800000>; + qcom,max-frequency = <1497600000>; + qcom,bridge-enabled; + qcom,ipv4-enabled; + qcom,ipv4-reasm-enabled; + qcom,ipv6-enabled; + qcom,ipv6-reasm-enabled; + qcom,wlanredirect-enabled; + qcom,tun6rd-enabled; + qcom,l2tpv2-enabled; + qcom,gre-enabled; + qcom,gre-redir-enabled; + qcom,gre-redir-mark-enabled; + qcom,map-t-enabled; + qcom,portid-enabled; + qcom,ppe-enabled; + qcom,pppoe-enabled; + qcom,pptp-enabled; + qcom,tunipip6-enabled; + qcom,shaping-enabled; + qcom,wlan-dataplane-offload-enabled; + qcom,vlan-enabled; + qcom,capwap-enabled; + qcom,dtls-enabled; + qcom,tls-enabled; + qcom,crypto-enabled; + qcom,ipsec-enabled; + qcom,qvpn-enabled; + qcom,pvxlan-enabled; + qcom,clmap-enabled; + qcom,vxlan-enabled; + qcom,match-enabled; + qcom,mirror-enabled; + mx-supply = <&nss_dummy_reg>; + npu-supply = <&nss_dummy_reg>; + }; + + nss_crypto: qcom,nss_crypto { + compatible = "qcom,nss-crypto"; + #address-cells = <1>; + #size-cells = <1>; + qcom,max-contexts = <64>; + qcom,max-context-size = <32>; + ranges; + + eip197_node { + compatible = "qcom,eip197"; + reg-names = "crypto_pbase"; + reg = <0x39800000 0x7ffff>; + clocks = <&gcc GCC_NSS_CRYPTO_CLK>, <&gcc GCC_NSSNOC_CRYPTO_CLK>, <&gcc GCC_CRYPTO_PPE_CLK>; + clock-names = "crypto_clk", "crypto_nocclk", "crypto_ppeclk"; + clock-frequency = /bits/ 64 <600000000 600000000 300000000>; + qcom,dma-mask = <0xff>; + qcom,transform-enabled; + qcom,aes128-cbc; + qcom,aes192-cbc; + qcom,aes256-cbc; + qcom,aes128-ctr; + qcom,aes192-ctr; + qcom,aes256-ctr; + qcom,aes128-ecb; + qcom,aes192-ecb; + qcom,aes256-ecb; + qcom,3des-cbc; + qcom,md5-hash; + qcom,sha160-hash; + qcom,sha224-hash; + qcom,sha256-hash; + qcom,sha384-hash; + qcom,sha512-hash; + qcom,md5-hmac; + qcom,sha160-hmac; + qcom,sha224-hmac; + qcom,sha256-hmac; + qcom,sha384-hmac; + qcom,sha512-hmac; + qcom,aes128-gcm-gmac; + qcom,aes192-gcm-gmac; + qcom,aes256-gcm-gmac; + qcom,aes128-cbc-md5-hmac; + qcom,aes128-cbc-sha160-hmac; + qcom,aes192-cbc-md5-hmac; + qcom,aes192-cbc-sha160-hmac; + qcom,aes256-cbc-md5-hmac; + qcom,aes256-cbc-sha160-hmac; + qcom,aes128-ctr-sha160-hmac; + qcom,aes192-ctr-sha160-hmac; + qcom,aes256-ctr-sha160-hmac; + qcom,aes128-ctr-md5-hmac; + qcom,aes192-ctr-md5-hmac; + qcom,aes256-ctr-md5-hmac; + qcom,3des-cbc-md5-hmac; + qcom,3des-cbc-sha160-hmac; + qcom,aes128-cbc-sha256-hmac; + qcom,aes192-cbc-sha256-hmac; + qcom,aes256-cbc-sha256-hmac; + qcom,aes128-ctr-sha256-hmac; + qcom,aes192-ctr-sha256-hmac; + qcom,aes256-ctr-sha256-hmac; + qcom,3des-cbc-sha256-hmac; + qcom,aes128-cbc-sha384-hmac; + qcom,aes192-cbc-sha384-hmac; + qcom,aes256-cbc-sha384-hmac; + qcom,aes128-ctr-sha384-hmac; + qcom,aes192-ctr-sha384-hmac; + qcom,aes256-ctr-sha384-hmac; + qcom,aes128-cbc-sha512-hmac; + qcom,aes192-cbc-sha512-hmac; + qcom,aes256-cbc-sha512-hmac; + qcom,aes128-ctr-sha512-hmac; + qcom,aes192-ctr-sha512-hmac; + qcom,aes256-ctr-sha512-hmac; + + engine0 { + reg_offset = <0x80000>; + qcom,ifpp-enabled; + qcom,ipue-enabled; + qcom,ofpp-enabled; + qcom,opue-enabled; + }; + }; + }; + + nss-macsec0 { + compatible = "qcom,nss-macsec"; + mdiobus = <&mdio>; + phy_addr = <0x18>; + phy_access_mode = <0x00>; + }; + + nss-macsec1 { + compatible = "qcom,nss-macsec"; + mdiobus = <&mdio>; + phy_addr = <0x1c>; + phy_access_mode = <0x00>; + }; +}; \ No newline at end of file diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8070-cax1800.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8070-cax1800.dts index e62ae314fb..3ae0ab69a9 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8070-cax1800.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8070-cax1800.dts @@ -1,13 +1,16 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/* Copyright (c) 2021, Dirk Buchwalder */ /dts-v1/; #include "ipq8074-512m.dtsi" #include "ipq8074-ac-cpu.dtsi" +#include "ipq8074-common.dtsi" #include "ipq8074-ess.dtsi" +#include "ipq8074-nss.dtsi" + #include #include +#include / { model = "Edimax CAX1800"; @@ -15,12 +18,14 @@ aliases { serial0 = &blsp1_uart5; + led-boot = &led_system_red; led-failsafe = &led_system_red; led-running = &led_system_green; led-upgrade = &led_system_red; - /* Aliases as required by u-boot to patch MAC addresses */ + ethernet0 = &dp5; + label-mac-device = &dp5; }; @@ -77,26 +82,6 @@ }; }; -&blsp1_uart5 { - status = "okay"; -}; - -&prng { - status = "okay"; -}; - -&cryptobam { - status = "okay"; -}; - -&crypto { - status = "okay"; -}; - -&qpic_bam { - status = "okay"; -}; - &qpic_nand { status = "okay"; @@ -120,10 +105,11 @@ }; &blsp1_spi1 { + status = "okay"; + pinctrl-0 = <&spi_0_pins>; pinctrl-names = "default"; cs-select = <0>; - status = "okay"; m25p80@0 { #address-cells = <1>; @@ -259,13 +245,12 @@ pinctrl-0 = <&mdio_pins>; pinctrl-names = "default"; - reset-gpios = <&tlmm 37 GPIO_ACTIVE_LOW>; ethernet-phy-package@0 { + compatible = "qcom,qca8075-package"; #address-cells = <1>; #size-cells = <0>; - compatible = "qcom,qca8075-package"; reg = <0>; qca8075_4: ethernet-phy@4 { @@ -278,8 +263,8 @@ &switch { status = "okay"; - switch_lan_bmp = ; /* lan port bitmap */ - switch_mac_mode = ; /* mac mode for uniphy instance0*/ + switch_lan_bmp = ; + switch_mac_mode = ; qcom,port_phyinfo { port@5 { @@ -289,10 +274,6 @@ }; }; -&edma { - status = "okay"; -}; - &dp5 { status = "okay"; phy-handle = <&qca8075_4>; @@ -301,7 +282,10 @@ &wifi { status = "okay"; - - qcom,ath11k-calibration-variant = "Edimax-CAX1800"; qcom,ath11k-fw-memory-mode = <1>; + qcom,ath11k-calibration-variant = "Edimax-CAX1800"; +}; + +&edma { + status = "okay"; }; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8070-rm2-6.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8070-rm2-6.dts index 5d3123f75e..6776831cce 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8070-rm2-6.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8070-rm2-6.dts @@ -4,7 +4,10 @@ #include "ipq8074-512m.dtsi" #include "ipq8074-ac-cpu.dtsi" +#include "ipq8074-common.dtsi" #include "ipq8074-ess.dtsi" +#include "ipq8074-nss.dtsi" + #include #include #include @@ -16,17 +19,16 @@ aliases { serial0 = &blsp1_uart5; serial1 = &blsp1_uart3; + led-boot = &led_status_red; led-failsafe = &led_status_red; led-running = &led_status_blue; led-upgrade = &led_status_amber; - /* - * Aliases as required by u-boot - * to patch MAC addresses - */ + ethernet0 = &dp4; ethernet1 = &dp2; ethernet2 = &dp5; + label-mac-device = &dp4; }; @@ -99,30 +101,6 @@ }; }; -&blsp1_uart3 { - status = "okay"; -}; - -&blsp1_uart5 { - status = "okay"; -}; - -&cryptobam { - status = "okay"; -}; - -&crypto { - status = "okay"; -}; - -&prng { - status = "okay"; -}; - -&qpic_bam { - status = "okay"; -}; - &qpic_nand { status = "okay"; @@ -265,10 +243,12 @@ port_id = <2>; phy_address = <1>; }; + port@4 { port_id = <4>; phy_address = <3>; }; + port@5 { port_id = <5>; phy_address = <4>; @@ -276,10 +256,6 @@ }; }; -&edma { - status = "okay"; -}; - /* * Directly connect to the Hi5630 * PLC (Power Line Communication) @@ -304,7 +280,10 @@ &wifi { status = "okay"; - - qcom,ath11k-calibration-variant = "CMCC-RM2-6"; qcom,ath11k-fw-memory-mode = <1>; + qcom,ath11k-calibration-variant = "CMCC-RM2-6"; +}; + +&edma { + status = "okay"; }; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ap8220.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ap8220.dts index 176dc59155..d7ca03313e 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ap8220.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ap8220.dts @@ -2,68 +2,22 @@ /dts-v1/; -#include "ipq8074.dtsi" -#include "ipq8074-ac-cpu.dtsi" -#include "ipq8074-ess.dtsi" -#include -#include -#include +#include "ipq8071-edgecore.dtsi" / { model = "Aliyun AP8220"; compatible = "aliyun,ap8220", "qcom,ipq8074"; - aliases { - serial0 = &blsp1_uart5; - led-boot = &led_power; - led-failsafe = &led_power; - led-running = &led_power; - led-upgrade = &led_power; - }; - - chosen { - stdout-path = "serial0:115200n8"; - bootargs-append = " root=/dev/ubiblock0_1"; - }; - - keys { - compatible = "gpio-keys"; - pinctrl-0 = <&button_pins>; - pinctrl-names = "default"; - - reset { - label = "reset"; - linux,code = ; - gpios = <&tlmm 66 GPIO_ACTIVE_LOW>; - }; - }; - leds { compatible = "gpio-leds"; - led_power: power { - color = ; - function = LED_FUNCTION_POWER; + led_pw: led-pw { + label = "pw:status"; gpios = <&tlmm 46 GPIO_ACTIVE_HIGH>; }; - wlan2g { - color = ; - function = LED_FUNCTION_WLAN_2GHZ; - gpios = <&tlmm 47 GPIO_ACTIVE_HIGH>; - linux,default-trigger = "phy1radio"; - }; - - wlan5g { - color = ; - function = LED_FUNCTION_WLAN_5GHZ; - gpios = <&tlmm 48 GPIO_ACTIVE_HIGH>; - linux,default-trigger = "phy0radio"; - }; - - bluetooth { - color = ; - function = LED_FUNCTION_BLUETOOTH; + led_bt: led-bt { + label = "bt:status"; gpios = <&tlmm 50 GPIO_ACTIVE_HIGH>; }; }; @@ -79,36 +33,13 @@ }; }; -&tlmm { - mdio_pins: mdio-pins { - mdc { - pins = "gpio68"; - function = "mdc"; - drive-strength = <8>; - bias-pull-up; - }; - - mdio { - pins = "gpio69"; - function = "mdio"; - drive-strength = <8>; - bias-pull-up; - }; - }; - - button_pins: button-pins { - mux { - pins = "gpio66"; - function = "gpio"; - drive-strength = <8>; - bias-pull-up; - }; - }; -}; - &blsp1_spi1 { status = "okay"; + pinctrl-0 = <&spi_0_pins>; + pinctrl-names = "default"; + cs-select = <0>; + flash@0 { compatible = "jedec,spi-nor"; #address-cells = <1>; @@ -123,44 +54,37 @@ partition@0 { label = "0:sbl1"; - reg = <0x0 0x50000>; - read-only; + reg = <0x00 0x50000>; }; partition@50000 { label = "0:mibib"; reg = <0x50000 0x10000>; - read-only; }; partition@60000 { label = "0:qsee"; reg = <0x60000 0x180000>; - read-only; }; partition@1e0000 { label = "0:devcfg"; reg = <0x1e0000 0x10000>; - read-only; }; partition@1f0000 { label = "0:apdp"; reg = <0x1f0000 0x10000>; - read-only; }; partition@200000 { label = "0:rpm"; reg = <0x200000 0x40000>; - read-only; }; partition@240000 { label = "0:cdt"; reg = <0x240000 0x10000>; - read-only; }; partition@250000 { @@ -171,25 +95,21 @@ partition@260000 { label = "0:appsbl"; reg = <0x260000 0xa0000>; - read-only; }; partition@300000 { label = "0:art"; reg = <0x300000 0x40000>; - read-only; }; partition@340000 { label = "0:ethphyfw"; reg = <0x340000 0x80000>; - read-only; }; partition@3c0000 { label = "product_info"; reg = <0x3c0000 0x10000>; - read-only; }; partition@3d0000 { @@ -200,126 +120,26 @@ partition@3f0000 { label = "priv_data1"; reg = <0x3f0000 0x10000>; - read-only; }; }; }; }; -&blsp1_uart5 { - status = "okay"; -}; - -&cryptobam { - status = "okay"; -}; - -&crypto { - status = "okay"; -}; - -&prng { - status = "okay"; -}; - -&qpic_bam { - status = "okay"; -}; - -&qusb_phy_0 { - status = "okay"; -}; - -&ssphy_0 { - status = "okay"; -}; - -&usb_0 { - status = "okay"; -}; - &qpic_nand { status = "okay"; nand@0 { reg = <0>; + #address-cells = <1>; + #size-cells = <1>; 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 = "rootfs1"; - reg = <0x0000000 0x3000000>; - }; - - partition@3000000 { - label = "rootfs2"; - reg = <0x3000000 0x3000000>; - }; - - partition@6000000 { - label = "usrdata"; - reg = <0x6000000 0x2000000>; - }; - }; }; }; -&mdio { - status = "okay"; - - pinctrl-0 = <&mdio_pins>; - pinctrl-names = "default"; - - qca8081_24: ethernet-phy@24 { - compatible = "ethernet-phy-id004d.d101"; - reg = <24>; - reset-deassert-us = <10000>; - reset-gpios = <&tlmm 33 GPIO_ACTIVE_LOW>; - }; - - qca8081_28: ethernet-phy@28 { - compatible = "ethernet-phy-id004d.d101"; - reg = <28>; - reset-deassert-us = <10000>; - reset-gpios = <&tlmm 44 GPIO_ACTIVE_LOW>; - }; -}; - -&switch { - status = "okay"; - - switch_lan_bmp = ; - switch_wan_bmp = ; - switch_mac_mode1 = ; - switch_mac_mode2 = ; - - qcom,port_phyinfo { - port@5 { - port_id = <5>; - phy_address = <24>; - port_mac_sel = "QGMAC_PORT"; - }; - port@6 { - port_id = <6>; - phy_address = <28>; - port_mac_sel = "QGMAC_PORT"; - }; - }; -}; - -&edma { - status = "okay"; -}; - &dp5 { status = "okay"; - phy-mode = "sgmii"; phy-handle = <&qca8081_24>; label = "wan"; }; @@ -332,6 +152,6 @@ &wifi { status = "okay"; - + qcom,ath11k-fw-memory-mode = <1>; qcom,ath11k-calibration-variant = "Aliyun-AP8220"; }; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ax3600-stock.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ax3600-stock.dts index a67a803f85..1c43e21a5a 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ax3600-stock.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ax3600-stock.dts @@ -1,5 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + #include "ipq8071-ax3600.dts" / { @@ -7,7 +9,6 @@ compatible = "xiaomi,ax3600-stock", "qcom,ipq8074"; aliases { - /* Aliases as required by u-boot to patch MAC addresses */ ethernet1 = &dp2; ethernet2 = &dp3; ethernet3 = &dp4; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ax3600.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ax3600.dts index c6889df25d..976777e161 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ax3600.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ax3600.dts @@ -1,10 +1,8 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/* Copyright (c) 2021, Robert Marko */ /dts-v1/; -#include "ipq8071-ax3600.dtsi" -#include +#include "ipq8071-xiaomi.dtsi" / { model = "Xiaomi AX3600"; @@ -41,14 +39,10 @@ }; }; -&pcie_qmp0 { - status = "okay"; -}; - &pcie0 { status = "okay"; - perst-gpio = <&tlmm 52 GPIO_ACTIVE_HIGH>; + perst-gpios = <&tlmm 52 GPIO_ACTIVE_HIGH>; bridge@0,0 { reg = <0x00000000 0 0 0 0>; @@ -70,61 +64,7 @@ }; &wifi { + status = "okay"; + qcom,ath11k-fw-memory-mode = <1>; qcom,ath11k-calibration-variant = "Xiaomi-AX3600"; }; - -&qca8075_1 { - leds { - #address-cells = <1>; - #size-cells = <0>; - - led@0 { - reg = <0>; - color = ; - function = LED_FUNCTION_WAN; - default-state = "keep"; - }; - }; -}; - -&qca8075_2 { - leds { - #address-cells = <1>; - #size-cells = <0>; - - led@0 { - reg = <0>; - color = ; - function = LED_FUNCTION_LAN; - default-state = "keep"; - }; - }; -}; - -&qca8075_3 { - leds { - #address-cells = <1>; - #size-cells = <0>; - - led@0 { - reg = <0>; - color = ; - function = LED_FUNCTION_LAN; - default-state = "keep"; - }; - }; -}; - -&qca8075_4 { - leds { - #address-cells = <1>; - #size-cells = <0>; - - led@0 { - reg = <0>; - color = ; - function = LED_FUNCTION_LAN; - default-state = "keep"; - }; - }; -}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ax6-stock.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ax6-stock.dts index 47e05a1aeb..718b51d8fb 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ax6-stock.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ax6-stock.dts @@ -1,5 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + #include "ipq8071-ax6.dts" / { @@ -7,7 +9,6 @@ compatible = "redmi,ax6-stock", "qcom,ipq8074"; aliases { - /* Aliases as required by u-boot to patch MAC addresses */ ethernet1 = &dp2; ethernet2 = &dp3; ethernet3 = &dp4; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ax6.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ax6.dts index 6611a8fe27..094a8fe88c 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ax6.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ax6.dts @@ -1,9 +1,8 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/* Copyright (c) 2021, Zhijun You */ /dts-v1/; -#include "ipq8071-ax3600.dtsi" +#include "ipq8071-xiaomi.dtsi" / { model = "Redmi AX6"; @@ -42,5 +41,7 @@ }; &wifi { + status = "okay"; + qcom,ath11k-fw-memory-mode = <1>; qcom,ath11k-calibration-variant = "Redmi-AX6"; }; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-eap102.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-eap102.dts index f8fe6b42f8..88dc2f31e8 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-eap102.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-eap102.dts @@ -1,104 +1,28 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/* Copyright (c) 2022, Matthew Hagan */ /dts-v1/; -#include "ipq8074.dtsi" -#include "ipq8074-ac-cpu.dtsi" -#include "ipq8074-ess.dtsi" -#include -#include -#include +#include "ipq8071-edgecore.dtsi" / { model = "Edgecore EAP102"; compatible = "edgecore,eap102", "qcom,ipq8074"; - aliases { - serial0 = &blsp1_uart5; - serial1 = &blsp1_uart3; - led-boot = &led_system_green; - led-failsafe = &led_system_green; - led-running = &led_system_green; - led-upgrade = &led_system_green; - /* Aliases as required by u-boot to patch MAC addresses */ - ethernet0 = &dp6; - ethernet1 = &dp5; - label-mac-device = &dp5; - }; - - chosen { - stdout-path = "serial0:115200n8"; - bootargs-append = " root=/dev/ubiblock0_1"; - }; - - keys { - compatible = "gpio-keys"; - pinctrl-0 = <&button_pins>; - pinctrl-names = "default"; - - reset { - label = "reset"; - gpios = <&tlmm 66 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - leds { compatible = "gpio-leds"; - led_wanpoe { - label = "green:wanpoe"; + led_poe: led-poe { + label = "poe:status"; gpios = <&tlmm 46 GPIO_ACTIVE_HIGH>; }; - led_wlan2g { - label = "green:wlan2g"; - gpios = <&tlmm 47 GPIO_ACTIVE_HIGH>; - linux,default-trigger = "phy1radio"; - }; - - led_wlan5g { - label = "green:wlan5g"; - gpios = <&tlmm 48 GPIO_ACTIVE_HIGH>; - linux,default-trigger = "phy0radio"; - }; - - led_system_green: led_system { - function = LED_FUNCTION_POWER; - color = ; + led_pw: led-pw { + label = "pw:status"; gpios = <&tlmm 50 GPIO_ACTIVE_HIGH>; }; }; }; -&tlmm { - mdio_pins: mdio-pins { - mdc { - pins = "gpio68"; - function = "mdc"; - drive-strength = <8>; - bias-pull-up; - }; - - mdio { - pins = "gpio69"; - function = "mdio"; - drive-strength = <8>; - bias-pull-up; - }; - }; - - button_pins: button_pins { - reset_button { - pins = "gpio66"; - function = "gpio"; - drive-strength = <8>; - bias-pull-up; - }; - }; -}; - &blsp1_spi1 { status = "okay"; @@ -248,42 +172,6 @@ }; }; -&blsp1_uart3 { - status = "okay"; -}; - -&blsp1_uart5 { - status = "okay"; -}; - -&crypto { - status = "okay"; -}; - -&cryptobam { - status = "okay"; -}; - -&prng { - status = "okay"; -}; - -&qpic_bam { - status = "okay"; -}; - -&qusb_phy_0 { - status = "okay"; -}; - -&ssphy_0 { - status = "okay"; -}; - -&usb_0 { - status = "okay"; -}; - &qpic_nand { status = "okay"; @@ -323,56 +211,8 @@ }; }; -&mdio { - status = "okay"; - - pinctrl-0 = <&mdio_pins>; - pinctrl-names = "default"; - - qca8081_24: ethernet-phy@24 { - compatible = "ethernet-phy-id004d.d101"; - reg = <24>; - reset-deassert-us = <10000>; - reset-gpios = <&tlmm 33 GPIO_ACTIVE_LOW>; - }; - - qca8081_28: ethernet-phy@28 { - compatible = "ethernet-phy-id004d.d101"; - reg = <28>; - reset-deassert-us = <10000>; - reset-gpios = <&tlmm 44 GPIO_ACTIVE_LOW>; - }; -}; - -&switch { - status = "okay"; - - switch_lan_bmp = ; /* lan port bitmap */ - switch_wan_bmp = ; /* wan port bitmap */ - switch_mac_mode1 = ; /* mac mode for uniphy instance1*/ - switch_mac_mode2 = ; /* mac mode for uniphy instance2*/ - - qcom,port_phyinfo { - port@5 { - port_id = <5>; - phy_address = <24>; - port_mac_sel = "QGMAC_PORT"; - }; - port@6 { - port_id = <6>; - phy_address = <28>; - port_mac_sel = "QGMAC_PORT"; - }; - }; -}; - -&edma { - status = "okay"; -}; - &dp5 { status = "okay"; - phy-mode = "sgmii"; phy-handle = <&qca8081_24>; label = "lan"; }; @@ -385,6 +225,6 @@ &wifi { status = "okay"; - + qcom,ath11k-fw-memory-mode = <1>; qcom,ath11k-calibration-variant = "Edgecore-EAP102"; }; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-edgecore.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-edgecore.dtsi new file mode 100644 index 0000000000..8bbd74a60a --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-edgecore.dtsi @@ -0,0 +1,132 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ipq8074.dtsi" +#include "ipq8074-ac-cpu.dtsi" +#include "ipq8074-common.dtsi" +#include "ipq8074-ess.dtsi" +#include "ipq8074-nss.dtsi" + +#include +#include +#include + +/ { + aliases { + serial0 = &blsp1_uart5; + serial1 = &blsp1_uart3; + + led-boot = &led_pw; + led-failsafe = &led_pw; + led-running = &led_pw; + led-upgrade = &led_pw; + + ethernet4 = &dp5; + ethernet5 = &dp6; + + label-mac-device = &dp6; + }; + + chosen { + stdout-path = "serial0:115200n8"; + bootargs-append = " root=/dev/ubiblock0_1"; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&tlmm 66 GPIO_ACTIVE_LOW>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_2g: led-2g { + label = "2g:status"; + gpios = <&tlmm 47 GPIO_ACTIVE_HIGH>; + }; + + led_5g: led-5g { + label = "5g:status"; + gpios = <&tlmm 48 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&tlmm { + mdio_pins: mdio-pins { + mdc { + pins = "gpio68"; + function = "mdc"; + drive-strength = <8>; + bias-pull-up; + }; + + mdio { + pins = "gpio69"; + function = "mdio"; + drive-strength = <8>; + bias-pull-up; + }; + }; + + usb_mux_sel_pins: usb-mux-sel-pins { + mux { + pins = "gpio27"; + function = "gpio"; + drive-strength = <8>; + bias-pull-down; + }; + }; +}; + +&mdio { + status = "okay"; + + pinctrl-0 = <&mdio_pins>; + pinctrl-names = "default"; + + qca8081_24: ethernet-phy@24 { + compatible = "ethernet-phy-id004d.d101"; + reg = <24>; + reset-deassert-us = <10000>; + reset-gpios = <&tlmm 33 GPIO_ACTIVE_LOW>; + }; + + qca8081_28: ethernet-phy@28 { + compatible = "ethernet-phy-id004d.d101"; + reg = <28>; + reset-deassert-us = <10000>; + reset-gpios = <&tlmm 44 GPIO_ACTIVE_LOW>; + }; +}; + +&switch { + status = "okay"; + + switch_lan_bmp = ; + switch_wan_bmp = ; + switch_mac_mode1 = ; + switch_mac_mode2 = ; + + qcom,port_phyinfo { + port@5 { + port_id = <5>; + phy_address = <24>; + port_mac_sel = "QGMAC_PORT"; + }; + + port@6 { + port_id = <6>; + phy_address = <28>; + port_mac_sel = "QGMAC_PORT"; + }; + }; +}; + +&edma { + status = "okay"; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-mf269-stock.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-mf269-stock.dts index a74587d883..f0cd13b75c 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-mf269-stock.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-mf269-stock.dts @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT /dts-v1/; + #include "ipq8071-mf269.dts" / { diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-mf269.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-mf269.dts index 866ed5e9c3..97607a667d 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-mf269.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-mf269.dts @@ -4,7 +4,10 @@ #include "ipq8074-512m.dtsi" #include "ipq8074-ac-cpu.dtsi" +#include "ipq8074-common.dtsi" #include "ipq8074-ess.dtsi" +#include "ipq8074-nss.dtsi" + #include #include #include @@ -15,10 +18,12 @@ aliases { serial0 = &blsp1_uart5; + led-boot = &led_power; led-failsafe = &led_power; led-running = &led_power; led-upgrade = &led_power; + label-mac-device = &dp6_syn; }; @@ -29,8 +34,6 @@ keys { compatible = "gpio-keys"; - pinctrl-0 = <&button_pins>; - pinctrl-names = "default"; wps { label = "wps"; @@ -57,20 +60,13 @@ }; &tlmm { - button_pins: button_pins { - mux { - pins = "gpio37", "gpio46"; - function = "gpio"; - drive-strength = <8>; - bias-pull-up; - }; - }; - i2c_pins: i2c-pins { - pins = "gpio21", "gpio22"; - function = "blsp4_i2c1"; - drive-strength = <8>; - bias-disable; + mux { + pins = "gpio21", "gpio22"; + function = "blsp4_i2c1"; + drive-strength = <8>; + bias-disable; + }; }; mdio_pins: mdio-pins { @@ -89,7 +85,7 @@ }; }; - usb_pwr_pins: usb_pwr_pins { + usb_pwr_pins: usb-pwr-pins { mux { pins = "gpio29"; function = "gpio"; @@ -101,10 +97,11 @@ }; &blsp1_spi1 { + status = "okay"; + pinctrl-0 = <&spi_0_pins>; pinctrl-names = "default"; cs-select = <0>; - status = "okay"; flash@0 { compatible = "jedec,spi-nor"; @@ -246,26 +243,6 @@ }; }; -&blsp1_uart5 { - status = "okay"; -}; - -&cryptobam { - status = "okay"; -}; - -&crypto { - status = "okay"; -}; - -&prng { - status = "okay"; -}; - -&qpic_bam { - status = "okay"; -}; - &qpic_nand { status = "okay"; @@ -367,14 +344,6 @@ }; }; -&qusb_phy_0 { - status = "okay"; -}; - -&ssphy_0 { - status = "okay"; -}; - &usb_0 { pinctrl-0 = <&usb_pwr_pins>; pinctrl-names = "default"; @@ -386,6 +355,7 @@ pinctrl-0 = <&mdio_pins>; pinctrl-names = "default"; + reset-gpios = <&tlmm 37 GPIO_ACTIVE_LOW>; qca8081_24: ethernet-phy@24 { compatible = "ethernet-phy-id004d.d101"; @@ -405,10 +375,10 @@ &switch { status = "okay"; - switch_lan_bmp = ; /* lan port bitmap */ - switch_wan_bmp = ; /* wan port bitmap */ - switch_mac_mode1 = ; /* mac mode for uniphy instance1*/ - switch_mac_mode2 = ; /* mac mode for uniphy instance2*/ + switch_lan_bmp = ; + switch_wan_bmp = ; + switch_mac_mode1 = ; + switch_mac_mode2 = ; qcom,port_phyinfo { port@5 { @@ -416,6 +386,7 @@ phy_address = <24>; port_mac_sel = "QGMAC_PORT"; }; + port@6 { port_id = <6>; phy_address = <28>; @@ -424,10 +395,6 @@ }; }; -&edma { - status = "okay"; -}; - &dp5_syn { status = "okay"; phy-handle = <&qca8081_24>; @@ -446,7 +413,10 @@ &wifi { status = "okay"; - - qcom,ath11k-calibration-variant = "ZTE-MF269"; qcom,ath11k-fw-memory-mode = <1>; + qcom,ath11k-calibration-variant = "ZTE-MF269"; +}; + +&edma { + status = "okay"; }; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ax3600.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-xiaomi.dtsi similarity index 91% rename from target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ax3600.dtsi rename to target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-xiaomi.dtsi index 6afafb3554..55846d481c 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-ax3600.dtsi +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8071-xiaomi.dtsi @@ -1,19 +1,24 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/* Copyright (c) 2021, Robert Marko */ #include "ipq8074-512m.dtsi" #include "ipq8074-ac-cpu.dtsi" +#include "ipq8074-common.dtsi" #include "ipq8074-ess.dtsi" +#include "ipq8074-nss.dtsi" + #include #include +#include / { aliases { serial0 = &blsp1_uart5; + led-boot = &led_system_yellow; led-failsafe = &led_system_yellow; led-running = &led_system_blue; led-upgrade = &led_system_yellow; + label-mac-device = &dp2; }; @@ -51,26 +56,6 @@ }; }; -&blsp1_uart5 { - status = "okay"; -}; - -&prng { - status = "okay"; -}; - -&cryptobam { - status = "okay"; -}; - -&crypto { - status = "okay"; -}; - -&qpic_bam { - status = "okay"; -}; - &qpic_nand { status = "okay"; @@ -214,9 +199,9 @@ reset-gpios = <&tlmm 37 GPIO_ACTIVE_LOW>; ethernet-phy-package@0 { + compatible = "qcom,qca8075-package"; #address-cells = <1>; #size-cells = <0>; - compatible = "qcom,qca8075-package"; reg = <0>; qca8075_1: ethernet-phy@1 { @@ -244,23 +229,26 @@ &switch { status = "okay"; - switch_lan_bmp = <(ESS_PORT3 | ESS_PORT4 | ESS_PORT5)>; /* lan port bitmap */ - switch_wan_bmp = ; /* wan port bitmap */ - switch_mac_mode = ; /* mac mode for uniphy instance0*/ + switch_lan_bmp = <(ESS_PORT3 | ESS_PORT4 | ESS_PORT5)>; + switch_wan_bmp = ; + switch_mac_mode = ; qcom,port_phyinfo { port@2 { port_id = <2>; phy_address = <1>; }; + port@3 { port_id = <3>; phy_address = <2>; }; + port@4 { port_id = <4>; phy_address = <3>; }; + port@5 { port_id = <5>; phy_address = <4>; @@ -268,10 +256,6 @@ }; }; -&edma { - status = "okay"; -}; - &dp2 { status = "okay"; phy-handle = <&qca8075_1>; @@ -304,8 +288,6 @@ nvmem-cell-names = "mac-address"; }; -&wifi { +&edma { status = "okay"; - - qcom,ath11k-fw-memory-mode = <1>; }; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-301w.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-301w.dts index 4fd768f4e5..5723c1e257 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-301w.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-301w.dts @@ -1,11 +1,13 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/* Copyright (c) 2021, Dirk Buchwalder */ /dts-v1/; #include "ipq8074.dtsi" #include "ipq8074-hk-cpu.dtsi" +#include "ipq8074-common.dtsi" #include "ipq8074-ess.dtsi" +#include "ipq8074-nss.dtsi" + #include #include #include @@ -16,20 +18,19 @@ aliases { serial0 = &blsp1_uart5; - /* - * Aliases as required by u-boot - * to patch MAC addresses - */ + led-boot = &led_system_red; led-failsafe = &led_system_red; led-running = &led_pwr_green; led-upgrade = &led_system_red; + ethernet0 = &dp1; ethernet1 = &dp2; ethernet2 = &dp3; ethernet3 = &dp4; ethernet4 = &dp5; ethernet5 = &dp6_syn; + label-mac-device = &dp1; }; @@ -39,8 +40,6 @@ keys { compatible = "gpio-keys"; - pinctrl-0 = <&button_pins>; - pinctrl-names = "default"; wps-button { label = "wps"; @@ -57,22 +56,20 @@ leds { compatible = "gpio-leds"; - pinctrl-0 = <&leds_pins>; - pinctrl-names = "default"; - led_system_green: led-system-green { + led_system_green: system-green { gpios = <&tlmm 1 GPIO_ACTIVE_HIGH>; color = ; function = LED_FUNCTION_STATUS; }; - led_system_red: led-system-red { + led_system_red: system-red { gpios = <&tlmm 3 GPIO_ACTIVE_HIGH>; color = ; function = LED_FUNCTION_STATUS; }; - led_pwr_green: led-pwr-green { + led_pwr_green: pwr-green { gpios = <&tlmm 4 GPIO_ACTIVE_HIGH>; color = ; function = LED_FUNCTION_POWER; @@ -187,82 +184,14 @@ bias-pull-up; }; }; - - button_pins: button-state { - wps-pins { - pins = "gpio57"; - function = "gpio"; - drive-strength = <8>; - bias-pull-up; - }; - - rst-pins { - pins = "gpio67"; - function = "gpio"; - drive-strength = <8>; - bias-pull-up; - }; - }; - - leds_pins: leds-state { - pins = "gpio1", "gpio3", "gpio4", "gpio6", "gpio7", "gpio8", - "gpio11", "gpio12", "gpio13", "gpio14", "gpio15", "gpio42", - "gpio51", "gpio52", "gpio54", "gpio56"; - function = "gpio"; - drive-strength = <8>; - bias-pull-down; - }; }; -&blsp1_uart5 { +&blsp1_spi1 { status = "okay"; -}; -&prng { - status = "okay"; -}; - -&ssphy_0 { - status = "okay"; -}; - -&qusb_phy_0 { - status = "okay"; -}; - -&ssphy_1 { - status = "okay"; -}; - -&qusb_phy_1 { - status = "okay"; -}; - -&usb_0 { - status = "okay"; -}; - -&usb_1 { - status = "okay"; -}; - -&cryptobam { - status = "okay"; -}; - -&crypto { - status = "okay"; -}; - -&qpic_bam { - status = "okay"; -}; - -&blsp1_spi1 { /* BLSP1 QUP1 */ pinctrl-0 = <&spi_0_pins>; pinctrl-names = "default"; cs-gpios = <0>; - status = "okay"; flash@0 { #address-cells = <1>; @@ -399,9 +328,9 @@ }; ethernet-phy-package@16 { + compatible = "qcom,qca8075-package"; #address-cells = <1>; #size-cells = <0>; - compatible = "qcom,qca8075-package"; reg = <16>; qcom,package-mode = "qsgmii"; @@ -444,35 +373,40 @@ &switch { status = "okay"; - switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT3 | ESS_PORT4 | ESS_PORT6)>; /* lan port bitmap */ - switch_wan_bmp = ; /* wan port bitmap */ - switch_mac_mode = ; /* mac mode for uniphy instance0*/ - switch_mac_mode1 = ; /* mac mode for uniphy instance1*/ - switch_mac_mode2 = ; /* mac mode for uniphy instance2*/ + switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT3 | ESS_PORT4 | ESS_PORT6)>; + switch_wan_bmp = ; + switch_mac_mode = ; + switch_mac_mode1 = ; + switch_mac_mode2 = ; qcom,port_phyinfo { port@0 { port_id = <1>; phy_address = <16>; }; + port@1 { port_id = <2>; phy_address = <17>; }; + port@2 { port_id = <3>; phy_address = <18>; }; + port@3 { port_id = <4>; phy_address = <19>; }; + port@4 { port_id = <5>; phy_address = <8>; compatible = "ethernet-phy-ieee802.3-c45"; ethernet-phy-ieee802.3-c45; }; + port@5 { port_id = <6>; phy_address = <0>; @@ -482,10 +416,6 @@ }; }; -&edma { - status = "okay"; -}; - &dp1 { status = "okay"; phy-mode = "qsgmii"; @@ -531,6 +461,10 @@ &wifi { status = "okay"; - + qcom,ath11k-fw-memory-mode = <1>; qcom,ath11k-calibration-variant = "QNAP-301w"; }; + +&edma { + status = "okay"; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-aw1000.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-aw1000.dts index 1b5f58e51b..405b6ea631 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-aw1000.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-aw1000.dts @@ -1,11 +1,13 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/* Copyright (c) 2023, Chukun Pan */ /dts-v1/; #include "ipq8074.dtsi" #include "ipq8074-hk-cpu.dtsi" +#include "ipq8074-common.dtsi" #include "ipq8074-ess.dtsi" +#include "ipq8074-nss.dtsi" + #include #include #include @@ -15,20 +17,19 @@ compatible = "arcadyan,aw1000", "qcom,ipq8074"; aliases { + serial0 = &blsp1_uart5; + led-boot = &led_power; led-failsafe = &led_power; led-running = &led_power; led-upgrade = &led_power; - serial0 = &blsp1_uart5; - /* - * Aliases as required by u-boot - * to patch MAC addresses - */ + ethernet0 = &dp1; ethernet1 = &dp2; ethernet2 = &dp3; ethernet3 = &dp4; ethernet4 = &dp6_syn; + label-mac-device = &dp1; }; @@ -104,8 +105,7 @@ compatible = "gpio-leds"; led_power: power { - function = LED_FUNCTION_POWER; - color = ; + label = "green:power"; gpios = <&led_gpio 0 GPIO_ACTIVE_HIGH>; }; @@ -183,26 +183,6 @@ }; }; -&blsp1_uart5 { - status = "okay"; -}; - -&cryptobam { - status = "okay"; -}; - -&crypto { - status = "okay"; -}; - -&prng { - status = "okay"; -}; - -&qpic_bam { - status = "okay"; -}; - &qpic_nand { status = "okay"; @@ -218,32 +198,11 @@ }; }; -&qusb_phy_0 { - status = "okay"; -}; - &qusb_phy_1 { status = "okay"; - vdd-supply = <&usb_vbus>; }; -&ssphy_0 { - status = "okay"; -}; - -&ssphy_1 { - status = "okay"; -}; - -&usb_0 { - status = "okay"; -}; - -&usb_1 { - status = "okay"; -}; - &mdio { status = "okay"; @@ -285,47 +244,38 @@ reg = <28>; reset-deassert-us = <10000>; reset-gpios = <&tlmm 64 GPIO_ACTIVE_LOW>; - - leds { - #address-cells = <1>; - #size-cells = <0>; - - led@2 { - reg = <2>; - active-low; - color = ; - function = LED_FUNCTION_WAN; - default-state = "keep"; - }; - }; }; }; &switch { status = "okay"; - switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT3 | ESS_PORT4)>; /* lan port bitmap */ - switch_wan_bmp = ; /* wan port bitmap */ - switch_mac_mode = ; /* mac mode for uniphy instance0*/ - switch_mac_mode2 = ; /* mac mode for uniphy instance2*/ + switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT3 | ESS_PORT4)>; + switch_wan_bmp = ; + switch_mac_mode = ; + switch_mac_mode2 = ; qcom,port_phyinfo { port@1 { port_id = <1>; phy_address = <0>; }; + port@2 { port_id = <2>; phy_address = <1>; }; + port@3 { port_id = <3>; phy_address = <2>; }; + port@4 { port_id = <4>; phy_address = <3>; }; + port@6 { port_id = <6>; phy_address = <28>; @@ -334,10 +284,6 @@ }; }; -&edma { - status = "okay"; -}; - &dp1 { status = "okay"; phy-mode = "qsgmii"; @@ -374,6 +320,10 @@ &wifi { status = "okay"; - + qcom,ath11k-fw-memory-mode = <1>; qcom,ath11k-calibration-variant = "Arcadyan-AW1000"; }; + +&edma { + status = "okay"; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-ax880.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-ax880.dts index e5c768fafb..9635a59658 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-ax880.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-ax880.dts @@ -1,29 +1,33 @@ -// SPDX-License-Identifier: MIT, GPL-2.0 or later -/* Copyright (c) 2023, Ruslan Isaev */ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT /dts-v1/; #include "ipq8074.dtsi" #include "ipq8074-hk-cpu.dtsi" +#include "ipq8074-common.dtsi" #include "ipq8074-ess.dtsi" +#include "ipq8074-nss.dtsi" + #include #include #include / { model = "Yuncore AX880"; - compatible = "yuncore,ax880", "qcom,ipq8074", "qcom,ipq8074-hk09"; + compatible = "yuncore,ax880", "qcom,ipq8074"; aliases { serial0 = &blsp1_uart5; serial1 = &blsp1_uart3; + led-boot = &led_system; led-failsafe = &led_system; led-running = &led_system; led-upgrade = &led_system; - /* Aliases as required by u-boot to patch MAC addresses */ + ethernet0 = &dp5_syn; ethernet1 = &dp6_syn; + label-mac-device = &dp5_syn; }; @@ -34,8 +38,6 @@ keys { compatible = "gpio-keys"; - pinctrl-0 = <&button_pins>; - pinctrl-names = "default"; reset { label = "reset"; @@ -82,15 +84,6 @@ bias-pull-up; }; }; - - button_pins: button_pins { - reset_button { - pins = "gpio57"; - function = "gpio"; - drive-strength = <8>; - bias-pull-up; - }; - }; }; &blsp1_spi1 { @@ -229,43 +222,6 @@ }; }; -//serial interface -&blsp1_uart3 { - status = "okay"; -}; - -&blsp1_uart5 { - status = "okay"; -}; - -&crypto { - status = "okay"; -}; - -&cryptobam { - status = "okay"; -}; - -&prng { - status = "okay"; -}; - -&qpic_bam { - status = "okay"; -}; - -&qusb_phy_0 { - status = "okay"; -}; - -&ssphy_0 { - status = "okay"; -}; - -&usb_0 { - status = "okay"; -}; - &qpic_nand { status = "okay"; @@ -310,24 +266,13 @@ pinctrl-0 = <&mdio_pins>; pinctrl-names = "default"; + reset-gpios = <&tlmm 37 GPIO_ACTIVE_LOW>; qca8081_24: ethernet-phy@24 { compatible = "ethernet-phy-id004d.d101"; reg = <24>; reset-deassert-us = <10000>; reset-gpios = <&tlmm 33 GPIO_ACTIVE_LOW>; - - leds { - #address-cells = <1>; - #size-cells = <0>; - - led@0 { - reg = <0>; - color = ; - function = LED_FUNCTION_WAN; - default-state = "keep"; - }; - }; }; qca8081_28: ethernet-phy@28 { @@ -335,28 +280,16 @@ reg = <28>; reset-deassert-us = <10000>; reset-gpios = <&tlmm 44 GPIO_ACTIVE_LOW>; - - leds { - #address-cells = <1>; - #size-cells = <0>; - - led@0 { - reg = <0>; - color = ; - function = LED_FUNCTION_LAN; - default-state = "keep"; - }; - }; }; }; &switch { status = "okay"; - switch_lan_bmp = ; /* lan port bitmap */ - switch_wan_bmp = ; /* wan port bitmap */ - switch_mac_mode1 = ; /* mac mode for uniphy instance1*/ - switch_mac_mode2 = ; /* mac mode for uniphy instance2*/ + switch_lan_bmp = ; + switch_wan_bmp = ; + switch_mac_mode1 = ; + switch_mac_mode2 = ; qcom,port_phyinfo { port@5 { @@ -364,6 +297,7 @@ phy_address = <24>; port_mac_sel = "QGMAC_PORT"; }; + port@6 { port_id = <6>; phy_address = <28>; @@ -372,10 +306,6 @@ }; }; -&edma { - status = "okay"; -}; - &dp5_syn { status = "okay"; phy-handle = <&qca8081_24>; @@ -390,5 +320,10 @@ &wifi { status = "okay"; + qcom,ath11k-fw-memory-mode = <1>; qcom,ath11k-calibration-variant = "Yuncore-AX880"; }; + +&edma { + status = "okay"; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-ax9000.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-ax9000.dts index ec66d47d16..98ae1710fa 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-ax9000.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-ax9000.dts @@ -1,11 +1,13 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/* Copyright (c) 2021, Robert Marko */ /dts-v1/; #include "ipq8074.dtsi" #include "ipq8074-hk-cpu.dtsi" +#include "ipq8074-common.dtsi" #include "ipq8074-ess.dtsi" +#include "ipq8074-nss.dtsi" + #include #include #include @@ -16,10 +18,12 @@ aliases { serial0 = &blsp1_uart5; + led-boot = &led_system_yellow; led-failsafe = &led_system_yellow; led-running = &led_system_blue; led-upgrade = &led_system_yellow; + label-mac-device = &dp5; }; @@ -38,7 +42,7 @@ }; wps { - label = "wps"; /* Labeled Mesh on the device */ + label = "wps"; gpios = <&tlmm 46 GPIO_ACTIVE_LOW>; linux,code = ; }; @@ -105,17 +109,15 @@ }; i2c_pins: i2c-pins { - pins = "gpio0", "gpio2"; - function = "blsp5_i2c"; - drive-strength = <8>; - bias-disable; + mux { + pins = "gpio0", "gpio2"; + function = "blsp5_i2c"; + drive-strength = <8>; + bias-disable; + }; }; }; -&blsp1_uart5 { - status = "okay"; -}; - &blsp1_i2c6 { status = "okay"; @@ -123,22 +125,6 @@ pinctrl-names = "default"; }; -&prng { - status = "okay"; -}; - -&cryptobam { - status = "okay"; -}; - -&crypto { - status = "okay"; -}; - -&qpic_bam { - status = "okay"; -}; - &qpic_nand { status = "okay"; @@ -328,18 +314,6 @@ }; }; -&qusb_phy_0 { - status = "okay"; -}; - -&ssphy_0 { - status = "okay"; -}; - -&usb_0 { - status = "okay"; -}; - &mdio { status = "okay"; @@ -348,9 +322,9 @@ reset-gpios = <&tlmm 37 GPIO_ACTIVE_LOW>; ethernet-phy-package@0 { + compatible = "qcom,qca8075-package"; #address-cells = <1>; #size-cells = <0>; - compatible = "qcom,qca8075-package"; reg = <0>; qcom,package-mode = "qsgmii"; @@ -358,69 +332,21 @@ qca8075_0: ethernet-phy@0 { compatible = "ethernet-phy-ieee802.3-c22"; reg = <0>; - - leds { - #address-cells = <1>; - #size-cells = <0>; - - led@0 { - reg = <0>; - color = ; - function = LED_FUNCTION_LAN; - default-state = "keep"; - }; - }; }; qca8075_1: ethernet-phy@1 { compatible = "ethernet-phy-ieee802.3-c22"; reg = <1>; - - leds { - #address-cells = <1>; - #size-cells = <0>; - - led@0 { - reg = <0>; - color = ; - function = LED_FUNCTION_LAN; - default-state = "keep"; - }; - }; }; qca8075_2: ethernet-phy@2 { compatible = "ethernet-phy-ieee802.3-c22"; reg = <2>; - - leds { - #address-cells = <1>; - #size-cells = <0>; - - led@0 { - reg = <0>; - color = ; - function = LED_FUNCTION_LAN; - default-state = "keep"; - }; - }; }; qca8075_3: ethernet-phy@3 { compatible = "ethernet-phy-ieee802.3-c22"; reg = <3>; - - leds { - #address-cells = <1>; - #size-cells = <0>; - - led@0 { - reg = <0>; - color = ; - function = LED_FUNCTION_LAN; - default-state = "keep"; - }; - }; }; }; @@ -429,46 +355,38 @@ reg = <24>; reset-deassert-us = <10000>; reset-gpios = <&tlmm 44 GPIO_ACTIVE_LOW>; - - leds { - #address-cells = <1>; - #size-cells = <0>; - - led@0 { - reg = <0>; - color = ; - function = LED_FUNCTION_WAN; - default-state = "keep"; - }; - }; }; }; &switch { status = "okay"; - switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT3 | ESS_PORT4)>; /* lan port bitmap */ - switch_wan_bmp = ; /* wan port bitmap */ - switch_mac_mode = ; /* mac mode for uniphy instance0*/ - switch_mac_mode1 = ; /* mac mode for uniphy instance1*/ + switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT3 | ESS_PORT4)>; + switch_wan_bmp = ; + switch_mac_mode = ; + switch_mac_mode1 = ; qcom,port_phyinfo { port@1 { port_id = <1>; phy_address = <0>; }; + port@2 { port_id = <2>; phy_address = <1>; }; + port@3 { port_id = <3>; phy_address = <2>; }; + port@4 { port_id = <4>; phy_address = <3>; }; + port@5 { port_id = <5>; phy_address = <24>; @@ -477,10 +395,6 @@ }; }; -&edma { - status = "okay"; -}; - &dp1 { status = "okay"; phy-mode = "qsgmii"; @@ -526,14 +440,10 @@ nvmem-cell-names = "mac-address"; }; -&pcie_qmp0 { - status = "okay"; -}; - &pcie0 { status = "okay"; - perst-gpio = <&tlmm 58 GPIO_ACTIVE_LOW>; + perst-gpios = <&tlmm 58 GPIO_ACTIVE_LOW>; bridge@0,0 { reg = <0x00000000 0 0 0 0>; @@ -548,19 +458,16 @@ compatible = "pci17cb,1104"; reg = <0x00010000 0 0 0 0>; + qcom,ath11k-fw-memory-mode = <1>; qcom,ath11k-calibration-variant = "Xiaomi-AX9000"; }; }; }; -&pcie_qmp1 { - status = "okay"; -}; - &pcie1 { status = "okay"; - perst-gpio = <&tlmm 62 GPIO_ACTIVE_HIGH>; + perst-gpios = <&tlmm 62 GPIO_ACTIVE_HIGH>; bridge@1,0 { reg = <0x00010000 0 0 0 0>; @@ -583,6 +490,10 @@ &wifi { status = "okay"; - + qcom,ath11k-fw-memory-mode = <1>; qcom,ath11k-calibration-variant = "Xiaomi-AX9000"; }; + +&edma { + status = "okay"; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-cr1000a.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-cr1000a.dts new file mode 100644 index 0000000000..b572893028 --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-cr1000a.dts @@ -0,0 +1,234 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; + +#include "ipq8074.dtsi" +#include "ipq8074-hk-cpu.dtsi" +#include "ipq8074-common.dtsi" +#include "ipq8074-ess.dtsi" +#include "ipq8074-nss.dtsi" + +#include +#include +#include + +/ { + model = "Verizon CR1000A"; + compatible = "verizon,cr1000a", "qcom,ipq8074"; + + aliases { + serial0 = &blsp1_uart5; + sdhc1 = &sdhc_1; + + ethernet4 = &dp5; + ethernet5 = &dp6; + label-mac-device = &dp5_syn; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + keys { + compatible = "gpio-keys"; + + reset { + debounce-interval = <0x3c>; + gpios = <&tlmm 0x2c GPIO_ACTIVE_LOW>; + label = "reset"; + linux,code = ; + }; + + wps { + debounce-interval = <0x3c>; + gpios = <&tlmm 0x2a GPIO_ACTIVE_LOW>; + label = "wps"; + linux,code = ; + }; + }; +}; + +&soc { + fan5646_vreg: dummy_reg { + compatible = "regulator-fixed"; + regulator-name = "fan5646_vreg"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + }; + + fan5646 { + status = "ok"; + compatible = "fsi,leds-fan5646"; + linux-name = "white"; + rgb-name = "rgb"; + gpios = <&tlmm 0x1d 0x2>; /* COMM GPIO, GPIOF_DIR_OUT | GPIOF_INIT_HIGH */ + full-current = <0>; /* Default current 5 mA */ + tsleep = <7>; + fan5646-supply = <&fan5646_vreg>; /* phandle of our regulator node */ + }; +}; + +&blsp1_i2c3 { + status = "okay"; + pinctrl-0 = <&i2c_2_pins>; + pinctrl-names = "default"; +}; + +&blsp1_spi1 { + status = "okay"; + + m25p80@0 { + #address-cells = <0x01>; + #size-cells = <0x01>; + reg = <0x00>; + compatible = "n25q128a11", "jdec,spi-nor"; + linux,modalias = "m25p80", "n25q128a11"; + spi-max-frequency = <0x2faf080>; + use-default-sizes; + }; +}; + +&blsp1_spi5 { + status = "ok"; + pinctrl-0 = <&spi_4_pins>; + pinctrl-names = "default"; + + spi@4 { + // compatible = "qca,spidev"; + compatible = "cisco,spi-petra"; + reg = <0x00>; + spi-max-frequency = <12000000>; + }; +}; + +&tlmm { + mdio_pins: mdio-pins { + mdc { + pins = "gpio68"; + function = "mdc"; + drive-strength = <8>; + bias-pull-up; + }; + + mdio { + pins = "gpio69"; + function = "mdio"; + drive-strength = <8>; + bias-pull-up; + }; + }; + + spi_4_pins: spi-4-pins { + pins = "gpio5", "gpio6", "gpio7", "gpio8"; + function = "blsp4_spi0"; + drive-strength = <8>; + bias-disable; + }; + + i2c_2_pins: i2c-2-pins { + pins = "gpio46", "gpio47"; + function = "blsp2_i2c"; + drive-strength = <8>; + bias-disable; + }; + + button_pins: button_pins { + mux { + pins = "gpio42", "gpio44"; + function = "gpio"; + drive-strength = <0x08>; + bias-pull-up; + }; + }; +}; + +&mdio { + status = "okay"; + pinctrl-0 = <&mdio_pins>; + pinctrl-names = "default"; + reset-gpios = <&tlmm 37 GPIO_ACTIVE_LOW>; + + aqr113c: ethernet-phy@8 { + compatible = "ethernet-phy-ieee802.3-c45"; + reg = <0x08>; + // reset-gpios = <&tlmm 63 GPIO_ACTIVE_LOW>; + }; + + mxl3711: ethernet-phy@f { + //compatible = "ethernet-phy-ieee802.3-c45"; + reg = <0x0f>; + // reset-gpios = <&tlmm 63 GPIO_ACTIVE_LOW>; + }; +}; + +&switch { + status = "okay"; + + switch_lan_bmp = <(ESS_PORT3 | ESS_PORT4 | ESS_PORT5)>; + switch_wan_bmp = ; + switch_mac_mode = ; + switch_mac_mode1 = ; + switch_mac_mode2 = ; + + qcom,port_phyinfo { + rtl9303:port@5 { + port_id = <5>; + phy_address = <0x4>; + }; + + port@6 { + port_id = <6>; + phy_address = <0x8>; + }; + }; +}; + +&wifi { + status = "okay"; + qcom,ath11k-fw-memory-mode = <1>; + qcom,ath11k-calibration-variant = "Verizon-CR1000A"; +}; + +&dp5_syn { + status = "okay"; + phy-handle = <&rtl9303>; + label = "lan"; +}; + +&dp6_syn { + status = "okay"; + phy-handle = <&aqr113c>; + label = "wan"; +}; + +&pcie0 { + status = "okay"; + perst-gpio = <&tlmm 58 GPIO_ACTIVE_LOW>; + + bridge@0,0 { + reg = <0x00000000 0 0 0 0>; + #address-cells = <3>; + #size-cells = <2>; + ranges; + + wifi@1,0 { + status = "okay"; + compatible = "pci17cb,1104"; + reg = <0x00010000 0 0 0 0>; + qcom,ath11k-fw-memory-mode = <1>; + qcom,ath11k-calibration-variant = "Verizon-CR1000A"; + }; + }; +}; + +&edma { + status = "okay"; +}; + +&pcie1 { + status = "okay"; +}; + +&sdhc_1 { + status = "okay"; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-dl-wrx36.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-dl-wrx36.dts index d25bc90153..e46b2483e4 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-dl-wrx36.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-dl-wrx36.dts @@ -1,11 +1,13 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/* Copyright (c) 2022, Robert Marko */ /dts-v1/; #include "ipq8074.dtsi" #include "ipq8074-hk-cpu.dtsi" +#include "ipq8074-common.dtsi" #include "ipq8074-ess.dtsi" +#include "ipq8074-nss.dtsi" + #include #include #include @@ -15,17 +17,19 @@ compatible = "dynalink,dl-wrx36", "qcom,ipq8074"; aliases { + serial0 = &blsp1_uart5; + led-boot = &led_system_red; led-failsafe = &led_system_red; led-running = &led_system_blue; led-upgrade = &led_system_red; - serial0 = &blsp1_uart5; - /* Aliases as required by u-boot to patch MAC addresses */ + ethernet0 = &dp6_syn; ethernet1 = &dp4; ethernet2 = &dp3; ethernet3 = &dp2; ethernet4 = &dp1; + label-mac-device = &dp6_syn; }; @@ -83,26 +87,6 @@ }; }; -&blsp1_uart5 { - status = "okay"; -}; - -&prng { - status = "okay"; -}; - -&cryptobam { - status = "okay"; -}; - -&crypto { - status = "okay"; -}; - -&qpic_bam { - status = "okay"; -}; - &qpic_nand { status = "okay"; @@ -118,18 +102,6 @@ }; }; -&qusb_phy_0 { - status = "okay"; -}; - -&ssphy_0 { - status = "okay"; -}; - -&usb_0 { - status = "okay"; -}; - &mdio { status = "okay"; @@ -138,9 +110,9 @@ reset-gpios = <&tlmm 37 GPIO_ACTIVE_LOW>; ethernet-phy-package@0 { + compatible = "qcom,qca8075-package"; #address-cells = <1>; #size-cells = <0>; - compatible = "qcom,qca8075-package"; reg = <0>; qcom,package-mode = "qsgmii"; @@ -171,54 +143,38 @@ reg = <28>; reset-deassert-us = <10000>; reset-gpios = <&tlmm 44 GPIO_ACTIVE_LOW>; - - leds { - #address-cells = <1>; - #size-cells = <0>; - - led@0 { - reg = <0>; - color = ; - function = LED_FUNCTION_WAN; - default-state = "keep"; - active-low; - }; - - led@2 { - reg = <2>; - color = ; - function = LED_FUNCTION_WAN; - default-state = "keep"; - }; - }; }; }; &switch { status = "okay"; - switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT3 | ESS_PORT4)>; /* lan port bitmap */ - switch_wan_bmp = ; /* wan port bitmap */ - switch_mac_mode = ; /* mac mode for uniphy instance0*/ - switch_mac_mode2 = ; /* mac mode for uniphy instance2*/ + switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT3 | ESS_PORT4)>; + switch_wan_bmp = ; + switch_mac_mode = ; + switch_mac_mode2 = ; qcom,port_phyinfo { port@1 { port_id = <1>; phy_address = <0>; }; + port@2 { port_id = <2>; phy_address = <1>; }; + port@3 { port_id = <3>; phy_address = <2>; }; + port@4 { port_id = <4>; phy_address = <3>; }; + port@6 { port_id = <6>; phy_address = <28>; @@ -227,10 +183,6 @@ }; }; -&edma { - status = "okay"; -}; - &dp1 { status = "okay"; phy-mode = "qsgmii"; @@ -267,5 +219,10 @@ &wifi { status = "okay"; + qcom,ath11k-fw-memory-mode = <1>; qcom,ath11k-calibration-variant = "Dynalink-DL-WRX36"; }; + +&edma { + status = "okay"; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-eap620hd-v1.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-eap620hd-v1.dts index 05621892e6..d6dfcd3bbb 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-eap620hd-v1.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-eap620hd-v1.dts @@ -1,81 +1,21 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR BSD-2-Clause +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT /dts-v1/; -#include "ipq8074.dtsi" -#include "ipq8074-hk-cpu.dtsi" -#include "ipq8074-ess.dtsi" -#include -#include -#include +#include "ipq8072-tplink.dtsi" / { model = "TP-Link EAP620 HD v1"; compatible = "tplink,eap620hd-v1", "qcom,ipq8074"; - - aliases { - serial0 = &blsp1_uart5; - led-boot = &led_status_blue; - led-failsafe = &led_status_blue; - led-running = &led_status_blue; - led-upgrade = &led_status_blue; - }; - - chosen { - stdout-path = "serial0,115200n8"; - bootargs-append = " root=/dev/ubiblock0_1"; - }; - - keys { - compatible = "gpio-keys"; - - reset { - label = "reset"; - gpios = <&tlmm 50 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - leds { - compatible = "gpio-leds"; - - led_status_blue: status-blue { - function = LED_FUNCTION_STATUS; - gpios = <&tlmm 42 GPIO_ACTIVE_HIGH>; - color = ; - }; - }; -}; - -&blsp1_uart5 { - status = "okay"; -}; - -&tlmm { - mdio_pins: mdio-pins { - mdc { - pins = "gpio68"; - function = "mdc"; - drive-strength = <8>; - bias-pull-up; - }; - - mdio { - pins = "gpio69"; - function = "mdio"; - drive-strength = <8>; - bias-pull-up; - }; - }; }; &mdio { status = "okay"; - #size-cells = <1>; + pinctrl-0 = <&mdio_pins>; pinctrl-names = "default"; reset-gpios = <&tlmm 37 GPIO_ACTIVE_LOW>; - + ar8031: ethernet-phy@4 { compatible = "ethernet-phy-ieee802.3-c22"; reg = <4>; @@ -91,7 +31,7 @@ &switch { status = "okay"; switch_lan_bmp = ; - switch_mac_mode2 = ; + switch_mac_mode2 = ; qcom,port_phyinfo { port@6 { @@ -101,42 +41,12 @@ }; }; +&wifi { + status = "okay"; + qcom,ath11k-fw-memory-mode = <1>; + qcom,ath11k-calibration-variant = "TP-Link-EAP620-HD-v1"; +}; + &edma { status = "okay"; }; - -&prng { - status = "okay"; -}; - -&cryptobam { - status = "okay"; -}; - -&crypto { - status = "okay"; -}; - -&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 = "qcom,smem-part"; - }; - }; -}; - -&wifi { - status = "okay"; - qcom,ath11k-calibration-variant = "TP-Link-EAP620-HD-v1"; -}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-eap660hd-v1.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-eap660hd-v1.dts index 500847c98b..2074f066bc 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-eap660hd-v1.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-eap660hd-v1.dts @@ -1,89 +1,31 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR BSD-2-Clause +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT /dts-v1/; -#include "ipq8074.dtsi" -#include "ipq8074-hk-cpu.dtsi" -#include "ipq8074-ess.dtsi" -#include -#include -#include +#include "ipq8072-tplink.dtsi" / { model = "TP-Link EAP660 HD v1"; compatible = "tplink,eap660hd-v1", "qcom,ipq8074"; - - aliases { - serial0 = &blsp1_uart5; - led-boot = &led_status_blue; - led-failsafe = &led_status_blue; - led-running = &led_status_blue; - led-upgrade = &led_status_blue; - }; - - chosen { - stdout-path = "serial0,115200n8"; - bootargs-append = " root=/dev/ubiblock0_1"; - }; - - keys { - compatible = "gpio-keys"; - - reset { - label = "reset"; - gpios = <&tlmm 50 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - leds { - compatible = "gpio-leds"; - - led_status_blue: status-blue { - function = LED_FUNCTION_STATUS; - gpios = <&tlmm 42 GPIO_ACTIVE_HIGH>; - color = ; - }; - }; -}; - -&blsp1_uart5 { - status = "okay"; -}; - -&tlmm { - mdio_pins: mdio-pins { - mdc { - pins = "gpio68"; - function = "mdc"; - drive-strength = <8>; - bias-pull-up; - }; - - mdio { - pins = "gpio69"; - function = "mdio"; - drive-strength = <8>; - bias-pull-up; - }; - }; }; &mdio { status = "okay"; + pinctrl-0 = <&mdio_pins>; pinctrl-names = "default"; - reset-gpios = <&tlmm 25 GPIO_ACTIVE_LOW>; - + reset-gpios = <&tlmm 37 GPIO_ACTIVE_LOW>; + qca8081_28: ethernet-phy@28 { compatible = "ethernet-phy-ieee802.3-c22"; reg = <28>; + reset-deassert-us = <10000>; + reset-gpios = <&tlmm 25 GPIO_ACTIVE_LOW>; }; }; &dp5 { status = "okay"; - phy-mode = "sgmii"; phy-handle = <&qca8081_28>; label = "lan"; }; @@ -102,30 +44,12 @@ }; }; +&wifi { + status = "okay"; + qcom,ath11k-fw-memory-mode = <1>; + qcom,ath11k-calibration-variant = "TP-Link-EAP660-HD-v1"; +}; + &edma { status = "okay"; }; - -&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 = "qcom,smem-part"; - }; - }; -}; - -&wifi { - status = "okay"; - qcom,ath11k-calibration-variant = "TP-Link-EAP660-HD-v1"; -}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-haze.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-haze.dts index 289680d678..4225cccbd1 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-haze.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-haze.dts @@ -4,7 +4,10 @@ #include "ipq8074.dtsi" #include "ipq8074-hk-cpu.dtsi" +#include "ipq8074-common.dtsi" #include "ipq8074-ess.dtsi" +#include "ipq8074-nss.dtsi" + #include #include #include @@ -15,16 +18,18 @@ aliases { serial0 = &blsp1_uart5; - /* Aliases are required by U-Boot to patch MAC addresses */ - ethernet0 = &dp6_syn; - ethernet1 = &dp4; - ethernet2 = &dp3; - ethernet3 = &dp2; - label-mac-device = &dp6_syn; + led-boot = &led_system_blue; led-failsafe = &led_system_red; led-running = &led_system_green; led-upgrade = &led_system_blue; + + ethernet0 = &dp6_syn; + ethernet1 = &dp4; + ethernet2 = &dp3; + ethernet3 = &dp2; + + label-mac-device = &dp6_syn; }; chosen { @@ -33,8 +38,6 @@ keys { compatible = "gpio-keys"; - pinctrl-0 = <&button_pins>; - pinctrl-names = "default"; wps-button { label = "wps"; @@ -67,79 +70,22 @@ }; }; - button_pins: button-state { - wps-pins { - pins = "gpio42"; - function = "gpio"; - drive-strength = <8>; - bias-pull-up; - }; - - rst-pins { - pins = "gpio44"; - function = "gpio"; - drive-strength = <8>; - bias-pull-up; - }; - }; - i2c_3_pins: i2c-3-state { - pins = "gpio46", "gpio47"; - function = "blsp2_i2c"; - drive-strength = <8>; - bias-disable; + mux { + pins = "gpio46", "gpio47"; + function = "blsp2_i2c"; + drive-strength = <8>; + bias-disable; + }; }; }; -&blsp1_uart5 { +&blsp1_spi1 { status = "okay"; -}; -&prng { - status = "okay"; -}; - -&ssphy_0 { - status = "okay"; -}; - -&qusb_phy_0 { - status = "okay"; -}; - -&ssphy_1 { - status = "okay"; -}; - -&qusb_phy_1 { - status = "okay"; -}; - -&usb_0 { - status = "okay"; -}; - -&usb_1 { - status = "okay"; -}; - -&cryptobam { - status = "okay"; -}; - -&crypto { - status = "okay"; -}; - -&qpic_bam { - status = "okay"; -}; - -&blsp1_spi1 { /* BLSP1 QUP1 */ pinctrl-0 = <&spi_0_pins>; pinctrl-names = "default"; cs-gpios = <0>; - status = "okay"; flash@0 { #address-cells = <1>; @@ -162,11 +108,13 @@ reset-gpios = <&tlmm 22 GPIO_ACTIVE_LOW>; ethernet-phy-package@0 { + compatible = "qcom,qca8075-package"; #address-cells = <1>; #size-cells = <0>; - compatible = "qcom,qca8075-package"; reg = <0>; + qcom,package-mode = "qsgmii"; + qca8075_0: ethernet-phy@0 { compatible = "ethernet-phy-ieee802.3-c22"; reg = <0>; @@ -204,29 +152,33 @@ &switch { status = "okay"; - switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT3 | ESS_PORT4)>; /* lan port bitmap */ - switch_wan_bmp = ; /* wan port bitmap */ - switch_mac_mode = ; /* mac mode for uniphy instance0*/ - switch_mac_mode1 = ; /* mac mode for uniphy instance1*/ - switch_mac_mode2 = ; /* mac mode for uniphy instance2*/ + switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT3 | ESS_PORT4)>; + switch_wan_bmp = ; + switch_mac_mode = ; + switch_mac_mode1 = ; + switch_mac_mode2 = ; qcom,port_phyinfo { port@1 { port_id = <1>; phy_address = <0>; }; + port@2 { port_id = <2>; phy_address = <1>; }; + port@3 { port_id = <3>; phy_address = <2>; }; + port@4 { port_id = <4>; phy_address = <3>; }; + port@6 { port_id = <6>; phy_address = <8>; @@ -236,10 +188,6 @@ }; }; -&edma { - status = "okay"; -}; - /* Dummy LAN port */ &dp1 { status = "disabled"; @@ -273,14 +221,10 @@ label = "wan"; }; -&pcie_qmp0 { - status = "okay"; -}; - &pcie0 { status = "okay"; - perst-gpio = <&tlmm 58 GPIO_ACTIVE_LOW>; + perst-gpios = <&tlmm 58 GPIO_ACTIVE_LOW>; bridge@0,0 { reg = <0x00020000 0 0 0 0>; @@ -290,14 +234,10 @@ }; }; -&pcie_qmp1 { - status = "okay"; -}; - &pcie1 { status = "okay"; - perst-gpio = <&tlmm 61 GPIO_ACTIVE_LOW>; + perst-gpios = <&tlmm 61 GPIO_ACTIVE_LOW>; bridge@1,0 { reg = <0x00010000 0 0 0 0>; @@ -312,6 +252,7 @@ compatible = "pci17cb,1104"; reg = <0x00010000 0 0 0 0>; + qcom,ath11k-fw-memory-mode = <1>; qcom,ath11k-calibration-variant = "prpl-Haze"; }; }; @@ -319,11 +260,11 @@ &wifi { status = "okay"; - + qcom,ath11k-fw-memory-mode = <1>; qcom,ath11k-calibration-variant = "prpl-Haze"; }; -&blsp1_i2c3{ +&blsp1_i2c3 { pinctrl-0 = <&i2c_3_pins>; pinctrl-names = "default"; status = "okay"; @@ -335,7 +276,7 @@ #address-cells = <1>; #size-cells = <0>; - led_system_red: chan@0 { + led_system_red: system-red { chan-name = "red"; led-cur = /bits/ 8 <0x20>; max-cur = /bits/ 8 <0x60>; @@ -343,7 +284,7 @@ reg = <0>; }; - led_system_green: chan@1 { + led_system_green: system-green { chan-name = "green"; led-cur = /bits/ 8 <0x20>; max-cur = /bits/ 8 <0x60>; @@ -351,7 +292,7 @@ reg = <1>; }; - led_system_blue: chan@2 { + led_system_blue: system-blue { chan-name = "blue"; led-cur = /bits/ 8 <0x20>; max-cur = /bits/ 8 <0x60>; @@ -360,3 +301,7 @@ }; }; }; + +&edma { + status = "okay"; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-mx5300.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-mx5300.dts index 9d28f2ad0d..3b4e18652a 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-mx5300.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-mx5300.dts @@ -4,7 +4,10 @@ #include "ipq8074.dtsi" #include "ipq8074-hk-cpu.dtsi" +#include "ipq8074-common.dtsi" #include "ipq8074-ess.dtsi" +#include "ipq8074-nss.dtsi" + #include #include #include @@ -15,19 +18,17 @@ aliases { serial0 = &blsp1_uart5; - /* - * Aliases as required by u-boot - * to patch MAC addresses - */ + + led-boot = &led_system_blue; + led-running = &led_system_blue; + led-failsafe = &led_system_red; + led-upgrade = &led_system_green; + ethernet0 = &dp1; ethernet1 = &dp2; ethernet2 = &dp3; ethernet3 = &dp4; ethernet4 = &dp5; - led-boot = &led_system_blue; - led-running = &led_system_blue; - led-failsafe = &led_system_red; - led-upgrade = &led_system_green; }; chosen { @@ -37,8 +38,6 @@ keys { compatible = "gpio-keys"; - pinctrl-0 = <&button_pins>; - pinctrl-names = "default"; reset-button { label = "reset"; @@ -55,13 +54,6 @@ }; &tlmm { - button_pins: button-state { - pins = "gpio54", "gpio67"; - function = "gpio"; - drive-strength = <8>; - bias-pull-up; - }; - mdio_pins: mdio-state { mdc-pins { pins = "gpio68"; @@ -114,26 +106,6 @@ */ }; -&blsp1_uart5 { - status = "okay"; -}; - -&prng { - status = "okay"; -}; - -&cryptobam { - status = "okay"; -}; - -&crypto { - status = "okay"; -}; - -&qpic_bam { - status = "okay"; -}; - &qpic_nand { status = "okay"; @@ -355,19 +327,19 @@ reg = <0x62>; nxp,hw-blink; - led_system_red: led@0 { + led_system_red: system-red { reg = <0>; color = ; function = LED_FUNCTION_STATUS; }; - led_system_green: led@1 { + led_system_green: system-green { reg = <1>; color = ; function = LED_FUNCTION_STATUS; }; - led_system_blue: led@2 { + led_system_blue: system-blue { reg = <2>; color = ; function = LED_FUNCTION_STATUS; @@ -404,9 +376,9 @@ reset-gpios = <&tlmm 37 GPIO_ACTIVE_LOW>; ethernet-phy-package@0 { + compatible = "qcom,qca8075-package"; #address-cells = <1>; #size-cells = <0>; - compatible = "qcom,qca8075-package"; reg = <0>; qca8075_0: ethernet-phy@0 { @@ -439,27 +411,31 @@ &switch { status = "okay"; - switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT3 | ESS_PORT4)>; /* lan port bitmap */ - switch_wan_bmp = ; /* wan port bitmap */ - switch_mac_mode = ; /* mac mode for uniphy instance0*/ + switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT3 | ESS_PORT4)>; + switch_wan_bmp = ; + switch_mac_mode = ; qcom,port_phyinfo { port@1 { port_id = <1>; phy_address = <0>; }; + port@2 { port_id = <2>; phy_address = <1>; }; + port@3 { port_id = <3>; phy_address = <2>; }; + port@4 { port_id = <4>; phy_address = <3>; }; + port@5 { port_id = <5>; phy_address = <4>; @@ -467,10 +443,6 @@ }; }; -&edma { - status = "okay"; -}; - &dp1 { status = "okay"; phy-handle = <&qca8075_0>; @@ -501,26 +473,10 @@ label = "wan"; }; -&ssphy_0 { - status = "okay"; -}; - -&qusb_phy_0 { - status = "okay"; -}; - -&usb_0 { - status = "okay"; -}; - -&pcie_qmp1 { - status = "okay"; -}; - &pcie1 { status = "okay"; - perst-gpio = <&tlmm 58 GPIO_ACTIVE_LOW>; + perst-gpios = <&tlmm 58 GPIO_ACTIVE_LOW>; bridge@0,0 { reg = <0x00000000 0 0 0 0>; @@ -528,7 +484,7 @@ #size-cells = <2>; ranges; - wifi0: wifi@1,0 { + wifi@1,0 { status = "okay"; compatible = "qcom,ath10k"; @@ -543,6 +499,10 @@ &wifi { status = "okay"; - + qcom,ath11k-fw-memory-mode = <1>; qcom,ath11k-calibration-variant = "Linksys-MX5300"; }; + +&edma { + status = "okay"; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-mx8500.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-mx8500.dts index 70f4438ab0..98c7803a86 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-mx8500.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-mx8500.dts @@ -4,7 +4,10 @@ #include "ipq8074.dtsi" #include "ipq8074-hk-cpu.dtsi" +#include "ipq8074-common.dtsi" #include "ipq8074-ess.dtsi" +#include "ipq8074-nss.dtsi" + #include #include #include @@ -16,6 +19,7 @@ aliases { serial0 = &blsp1_uart5; serial1 = &blsp1_uart3; + led-boot = &led_system_blue; led-running = &led_system_blue; led-failsafe = &led_system_red; @@ -40,8 +44,6 @@ keys { compatible = "gpio-keys"; - pinctrl-0 = <&button_pins>; - pinctrl-names = "default"; reset-button { label = "reset"; @@ -58,13 +60,6 @@ }; &tlmm { - button_pins: button-state { - pins = "gpio64", "gpio67"; - function = "gpio"; - drive-strength = <8>; - bias-pull-up; - }; - mdio_pins: mdio-state { mdc-pins { pins = "gpio68"; @@ -82,30 +77,6 @@ }; }; -&blsp1_uart3 { - status = "okay"; -}; - -&blsp1_uart5 { - status = "okay"; -}; - -&prng { - status = "okay"; -}; - -&cryptobam { - status = "okay"; -}; - -&crypto { - status = "okay"; -}; - -&qpic_bam { - status = "okay"; -}; - &qpic_nand { status = "okay"; @@ -334,19 +305,19 @@ reg = <0x62>; nxp,hw-blink; - led_system_red: led@0 { + led_system_red: system-red { reg = <0>; color = ; function = LED_FUNCTION_STATUS; }; - led_system_green: led@1 { + led_system_green: system-green { reg = <1>; color = ; function = LED_FUNCTION_STATUS; }; - led_system_blue: led@2 { + led_system_blue: system-blue { reg = <2>; color = ; function = LED_FUNCTION_STATUS; @@ -362,9 +333,9 @@ reset-gpios = <&tlmm 37 GPIO_ACTIVE_LOW>; ethernet-phy-package@0 { + compatible = "qcom,qca8075-package"; #address-cells = <1>; #size-cells = <0>; - compatible = "qcom,qca8075-package"; reg = <0>; qcom,package-mode = "qsgmii"; @@ -403,10 +374,10 @@ &switch { status = "okay"; - switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT3 | ESS_PORT4)>; /* lan port bitmap */ - switch_wan_bmp = ; /* wan port bitmap */ - switch_mac_mode = ; /* mac mode for uniphy instance0*/ - switch_mac_mode2 = ; /* mac mode for uniphy instance2*/ + switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT3 | ESS_PORT4)>; + switch_wan_bmp = ; + switch_mac_mode = ; + switch_mac_mode2 = ; qcom,port_phyinfo { port@1 { @@ -438,10 +409,6 @@ }; }; -&edma { - status = "okay"; -}; - &dp1 { status = "okay"; phy-mode = "qsgmii"; @@ -477,26 +444,10 @@ label = "wan"; }; -&ssphy_0 { - status = "okay"; -}; - -&qusb_phy_0 { - status = "okay"; -}; - -&usb_0 { - status = "okay"; -}; - -&pcie_qmp0 { - status = "okay"; -}; - &pcie0 { status = "okay"; - perst-gpio = <&tlmm 61 GPIO_ACTIVE_LOW>; + perst-gpios = <&tlmm 61 GPIO_ACTIVE_LOW>; bridge@0,0 { reg = <0x00000000 0 0 0 0>; @@ -511,6 +462,7 @@ compatible = "pci17cb,1104"; reg = <0x00010000 0 0 0 0>; + qcom,ath11k-fw-memory-mode = <1>; qcom,ath11k-calibration-variant = "Linksys-MX8500"; }; }; @@ -518,6 +470,10 @@ &wifi { status = "okay"; - + qcom,ath11k-fw-memory-mode = <1>; qcom,ath11k-calibration-variant = "Linksys-MX8500"; }; + +&edma { + status = "okay"; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-sax1v1k.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-sax1v1k.dts index 15ca4d8ec4..d89223fe18 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-sax1v1k.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-sax1v1k.dts @@ -4,7 +4,10 @@ #include "ipq8074.dtsi" #include "ipq8074-hk-cpu.dtsi" +#include "ipq8074-common.dtsi" #include "ipq8074-ess.dtsi" +#include "ipq8074-nss.dtsi" + #include #include #include @@ -14,16 +17,18 @@ compatible = "spectrum,sax1v1k", "qcom,ipq8074"; aliases { + serial0 = &blsp1_uart5; + led-boot = &led_system_red; led-failsafe = &led_system_red; led-running = &led_system_blue; led-upgrade = &led_system_red; - serial0 = &blsp1_uart5; - /* Aliases as required by u-boot to patch MAC addresses */ + ethernet0 = &dp6_syn; ethernet1 = &dp4; ethernet2 = &dp3; ethernet3 = &dp2; + label-mac-device = &dp6_syn; }; @@ -82,36 +87,17 @@ }; }; -&blsp1_uart5 { - status = "okay"; -}; - -&prng { - status = "okay"; -}; - -&cryptobam { - status = "okay"; -}; - -&crypto { - status = "okay"; -}; - -&qpic_bam { - status = "okay"; -}; - &mdio { + status = "okay"; + pinctrl-0 = <&mdio_pins>; pinctrl-names = "default"; reset-gpios = <&tlmm 37 GPIO_ACTIVE_LOW>; - status = "okay"; ethernet-phy-package@0 { + compatible = "qcom,qca8075-package"; #address-cells = <1>; #size-cells = <0>; - compatible = "qcom,qca8075-package"; reg = <0>; qcom,package-mode = "qsgmii"; @@ -135,29 +121,8 @@ qca8081: ethernet-phy@28 { compatible = "ethernet-phy-id004d.d101"; reg = <28>; - reset-gpios = <&tlmm 44 GPIO_ACTIVE_LOW>; reset-deassert-us = <10000>; - - leds { - #address-cells = <1>; - #size-cells = <0>; - - led@0 { - reg = <0>; - color = ; - function = LED_FUNCTION_WAN; - default-state = "keep"; - active-low; - }; - - led@2 { - reg = <2>; - color = ; - function = LED_FUNCTION_WAN; - default-state = "keep"; - active-low; - }; - }; + reset-gpios = <&tlmm 44 GPIO_ACTIVE_LOW>; }; }; @@ -174,12 +139,13 @@ }; &switch { - switch_lan_bmp = <(ESS_PORT2 | ESS_PORT3 | ESS_PORT4)>; /* lan port bitmap */ - switch_wan_bmp = ; /* wan port bitmap */ - switch_mac_mode = ; /* mac mode for uniphy instance0*/ - switch_mac_mode2 = ; /* mac mode for uniphy instance2*/ status = "okay"; + switch_lan_bmp = <(ESS_PORT2 | ESS_PORT3 | ESS_PORT4)>; + switch_wan_bmp = ; + switch_mac_mode = ; + switch_mac_mode2 = ; + qcom,port_phyinfo { port@2 { port_id = <2>; @@ -204,38 +170,39 @@ }; }; -&edma { - status = "okay"; -}; - &dp2 { + status = "okay"; phy-mode = "qsgmii"; phy-handle = <&qca8075_1>; label = "lan3"; - status = "okay"; }; &dp3 { + status = "okay"; phy-mode = "qsgmii"; phy-handle = <&qca8075_2>; label = "lan2"; - status = "okay"; }; &dp4 { + status = "okay"; phy-mode = "qsgmii"; phy-handle = <&qca8075_3>; label = "lan1"; - status = "okay"; }; &dp6_syn { + status = "okay"; phy-handle = <&qca8081>; label = "wan"; - status = "okay"; }; &wifi { + status = "okay"; + qcom,ath11k-fw-memory-mode = <1>; qcom,ath11k-calibration-variant = "Spectrum-SAX1V1K"; +}; + +&edma { status = "okay"; }; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-tplink.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-tplink.dtsi new file mode 100644 index 0000000000..4026f20ca8 --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-tplink.dtsi @@ -0,0 +1,84 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ipq8074.dtsi" +#include "ipq8074-hk-cpu.dtsi" +#include "ipq8074-common.dtsi" +#include "ipq8074-ess.dtsi" +#include "ipq8074-nss.dtsi" + +#include +#include +#include + +/ { + aliases { + serial0 = &blsp1_uart5; + + led-boot = &led_status_blue; + led-failsafe = &led_status_blue; + led-running = &led_status_blue; + led-upgrade = &led_status_blue; + }; + + chosen { + stdout-path = "serial0,115200n8"; + bootargs-append = " root=/dev/ubiblock0_1"; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&tlmm 50 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_status_blue: status-blue { + function = LED_FUNCTION_STATUS; + gpios = <&tlmm 42 GPIO_ACTIVE_HIGH>; + color = ; + }; + }; +}; + +&tlmm { + mdio_pins: mdio-pins { + mdc { + pins = "gpio68"; + function = "mdc"; + drive-strength = <8>; + bias-pull-up; + }; + + mdio { + pins = "gpio69"; + function = "mdio"; + drive-strength = <8>; + bias-pull-up; + }; + }; +}; + +&qpic_nand { + status = "okay"; + + nand@0 { + reg = <0>; + nand-ecc-strength = <4>; + nand-ecc-step-size = <512>; + nand-bus-width = <8>; + + partitions { + compatible = "qcom,smem-part"; + }; + }; +}; + +&edma { + status = "okay"; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wax218.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wax218.dts index 8ced6318f9..bf0e2a27e7 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wax218.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wax218.dts @@ -1,12 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + /dts-v1/; #include "ipq8074.dtsi" #include "ipq8074-hk-cpu.dtsi" +#include "ipq8074-common.dtsi" #include "ipq8074-ess.dtsi" +#include "ipq8074-nss.dtsi" +#include #include #include -#include / { model = "Netgear WAX218"; @@ -14,6 +18,7 @@ aliases { serial0 = &blsp1_uart5; + led-boot = &led_power_amber; led-failsafe = &led_power_amber; led-running = &led_power_amber; @@ -61,7 +66,7 @@ leds { compatible = "gpio-leds"; - led_power_amber: led_power { + led_power_amber: power-amber { function = LED_FUNCTION_POWER; color = ; gpios = <&led_gpio 1 GPIO_ACTIVE_HIGH>; @@ -85,16 +90,12 @@ }; }; -&edma { - status = "okay"; -}; - &switch { status = "okay"; switch_lan_bmp = ; switch_mac_mode = ; - switch_mac_mode2 = ; + switch_mac_mode2 = ; qcom,port_phyinfo { port@6 { @@ -128,10 +129,12 @@ pinctrl-0 = <&mdio_pins>; pinctrl-names = "default"; - reset-gpios = <&tlmm 44 GPIO_ACTIVE_LOW>; + reset-gpios = <&tlmm 37 GPIO_ACTIVE_LOW>; qca8081_28: ethernet-phy@28 { reg = <28>; + reset-deassert-us = <10000>; + reset-gpios = <&tlmm 44 GPIO_ACTIVE_LOW>; }; }; @@ -143,10 +146,6 @@ nvmem-cell-names = "mac-address"; }; -&qpic_bam { - status = "okay"; -}; - &qpic_nand { status = "okay"; @@ -182,12 +181,12 @@ }; }; -&blsp1_uart5 { - status = "okay"; -}; - &wifi { status = "okay"; - + qcom,ath11k-fw-memory-mode = <1>; qcom,ath11k-calibration-variant = "Netgear-WAX218"; }; + +&edma { + status = "okay"; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wax620.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wax620.dts index f410f79495..6f538f2b46 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wax620.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wax620.dts @@ -4,9 +4,13 @@ #include "ipq8074.dtsi" #include "ipq8074-hk-cpu.dtsi" +#include "ipq8074-common.dtsi" #include "ipq8074-ess.dtsi" -#include +#include "ipq8074-nss.dtsi" + #include +#include +#include / { model = "Netgear WAX620"; @@ -14,13 +18,15 @@ aliases { serial0 = &blsp1_uart5; - ethernet0 = &dp6; - label-mac-device = &dp6; led-boot = &led_system_blue; led-failsafe = &led_system_red; led-running = &led_system_green; led-upgrade = &led_system_blue; + + ethernet0 = &dp6; + + label-mac-device = &dp6; }; chosen { @@ -111,16 +117,12 @@ }; }; -&edma { - status = "okay"; -}; - &switch { status = "okay"; switch_lan_bmp = ; switch_mac_mode = ; - switch_mac_mode2 = ; + switch_mac_mode2 = ; qcom,port_phyinfo { port@6 { @@ -154,10 +156,12 @@ pinctrl-0 = <&mdio_pins>; pinctrl-names = "default"; - reset-gpios = <&tlmm 44 GPIO_ACTIVE_LOW>; + reset-gpios = <&tlmm 37 GPIO_ACTIVE_LOW>; qca8081_28: ethernet-phy@28 { reg = <28>; + reset-deassert-us = <10000>; + reset-gpios = <&tlmm 44 GPIO_ACTIVE_LOW>; }; }; @@ -167,10 +171,6 @@ label = "lan"; }; -&qpic_bam { - status = "okay"; -}; - &qpic_nand { status = "okay"; @@ -186,12 +186,12 @@ }; }; -&blsp1_uart5 { - status = "okay"; -}; - &wifi { status = "okay"; - + qcom,ath11k-fw-memory-mode = <1>; qcom,ath11k-calibration-variant = "Netgear-WAX620"; }; + +&edma { + status = "okay"; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wpq873.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wpq873.dts index 5b2c1d570f..082abf168c 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wpq873.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-wpq873.dts @@ -1,11 +1,13 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/* Copyright 2023 Nokia */ /dts-v1/; #include "ipq8074.dtsi" #include "ipq8074-hk-cpu.dtsi" +#include "ipq8074-common.dtsi" #include "ipq8074-ess.dtsi" +#include "ipq8074-nss.dtsi" + #include #include #include @@ -16,15 +18,17 @@ aliases { serial0 = &blsp1_uart5; + led-boot = &led_power_blue; led-failsafe = &led_power_red; led-running = &led_system_green; led-upgrade = &led_system_blue; - /* Aliases as required by u-boot to patch MAC addresses */ + ethernet0 = &dp6; ethernet1 = &dp2; ethernet2 = &dp3; ethernet3 = &dp4; + label-mac-device = &dp6; }; @@ -91,17 +95,15 @@ }; i2c_pins: i2c-pins { - pins = "gpio0", "gpio2"; - function = "blsp5_i2c"; - drive-strength = <8>; - bias-disable; + mux { + pins = "gpio0", "gpio2"; + function = "blsp5_i2c"; + drive-strength = <8>; + bias-disable; + }; }; }; -&blsp1_uart5 { - status = "okay"; -}; - &blsp1_i2c6 { status = "okay"; @@ -109,53 +111,6 @@ pinctrl-names = "default"; }; -&prng { - status = "okay"; -}; - -&cryptobam { - status = "okay"; -}; - -&crypto { - status = "okay"; -}; - -&qpic_bam { - status = "okay"; -}; - -&blsp1_spi1 { - status = "okay"; -}; - -&tlmm { - mdio_pins: mdio-pins { - mdc { - pins = "gpio68"; - function = "mdc"; - drive-strength = <8>; - bias-pull-up; - }; - - mdio { - pins = "gpio69"; - function = "mdio"; - drive-strength = <8>; - bias-pull-up; - }; - }; - - button_pins: button_pins { - reset_button { - pins = "gpio66"; - function = "gpio"; - drive-strength = <8>; - bias-pull-up; - }; - }; -}; - &blsp1_spi1 { status = "okay"; @@ -326,40 +281,17 @@ }; }; -&qusb_phy_0 { - status = "okay"; -}; - -&qusb_phy_1 { - status = "okay"; -}; - -&ssphy_0 { - status = "okay"; -}; - -&ssphy_1 { - status = "okay"; -}; - -&usb_0 { - status = "okay"; -}; - -&usb_1 { - status = "okay"; -}; - &mdio { status = "okay"; + pinctrl-0 = <&mdio_pins>; pinctrl-names = "default"; reset-gpios = <&tlmm 37 GPIO_ACTIVE_LOW>; ethernet-phy-package@0 { + compatible = "qcom,qca8075-package"; #address-cells = <1>; #size-cells = <0>; - compatible = "qcom,qca8075-package"; reg = <0>; qca8075_1: ethernet-phy@1 { @@ -381,6 +313,7 @@ qca8081: ethernet-phy@28 { compatible = "ethernet-phy-ieee802.3-c22"; reg = <28>; + reset-deassert-us = <10000>; reset-gpios = <&tlmm 44 GPIO_ACTIVE_LOW>; }; }; @@ -388,25 +321,28 @@ &switch { status = "okay"; - switch_lan_bmp = <(ESS_PORT2 | ESS_PORT3 | ESS_PORT4)>; /* lan port bitmap */ - switch_wan_bmp = ; /* wan port bitmap */ - switch_mac_mode = ; /* mac mode for uniphy instance0*/ - switch_mac_mode1 = ; /* mac mode for uniphy instance1*/ - switch_mac_mode2 = ; /* mac mode for uniphy instance2*/ + switch_lan_bmp = <(ESS_PORT2 | ESS_PORT3 | ESS_PORT4)>; + switch_wan_bmp = ; + switch_mac_mode = ; + switch_mac_mode1 = ; + switch_mac_mode2 = ; qcom,port_phyinfo { port@2 { port_id = <2>; phy_address = <1>; }; + port@3 { port_id = <3>; phy_address = <2>; }; + port@4 { port_id = <4>; phy_address = <3>; }; + port@6 { port_id = <6>; phy_address = <28>; @@ -415,10 +351,6 @@ }; }; -&edma { - status = "okay"; -}; - &dp2 { status = "okay"; phy-handle = <&qca8075_1>; @@ -443,14 +375,10 @@ label = "wan"; }; -&pcie_qmp0 { - status = "okay"; -}; - &pcie0 { status = "okay"; - perst-gpio = <&tlmm 58 GPIO_ACTIVE_LOW>; + perst-gpios = <&tlmm 58 GPIO_ACTIVE_LOW>; bridge@0,0 { reg = <0x00020000 0 0 0 0>; @@ -460,14 +388,10 @@ }; }; -&pcie_qmp1 { - status = "okay"; -}; - &pcie1 { status = "okay"; - perst-gpio = <&tlmm 62 GPIO_ACTIVE_HIGH>; + perst-gpios = <&tlmm 62 GPIO_ACTIVE_HIGH>; bridge@1,0 { reg = <0x00010000 0 0 0 0>; @@ -479,6 +403,10 @@ &wifi { status = "okay"; - + qcom,ath11k-fw-memory-mode = <1>; qcom,ath11k-calibration-variant = "Compex-WPQ873"; }; + +&edma { + status = "okay"; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-zbt-z800ax.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-zbt-z800ax.dts index 814a7cb2bd..52423bdd0f 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-zbt-z800ax.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8072-zbt-z800ax.dts @@ -4,7 +4,10 @@ #include "ipq8074.dtsi" #include "ipq8074-hk-cpu.dtsi" +#include "ipq8074-common.dtsi" #include "ipq8074-ess.dtsi" +#include "ipq8074-nss.dtsi" + #include #include #include @@ -14,19 +17,19 @@ compatible = "zbtlink,zbt-z800ax", "qcom,ipq8074"; aliases { + serial0 = &blsp1_uart5; + led-boot = &led_net; led-failsafe = &led_net; + led-running = &led_net; led-upgrade = &led_net; - serial0 = &blsp1_uart5; - /* - * Aliases as required by u-boot - * to patch MAC addresses - */ + ethernet0 = &dp1; ethernet1 = &dp2; ethernet2 = &dp3; ethernet3 = &dp4; ethernet4 = &dp5; + label-mac-device = &dp1; }; @@ -47,8 +50,6 @@ keys { compatible = "gpio-keys"; - pinctrl-0 = <&button_pins>; - pinctrl-names = "default"; reset { label = "reset"; @@ -87,7 +88,7 @@ wlan5g { color = ; - function = LED_FUNCTION_WLAN_5GHZ; + function = LED_FUNCTION_WLAN_5GHZ; gpios = <&tlmm 43 GPIO_ACTIVE_HIGH>; linux,default-trigger = "phy0radio"; }; @@ -95,15 +96,6 @@ }; &tlmm { - button_pins: button-pins { - mux { - pins = "gpio34", "gpio46"; - function = "gpio"; - drive-strength = <8>; - bias-pull-up; - }; - }; - mdio_pins: mdio-pins { mdc { pins = "gpio68"; @@ -122,10 +114,11 @@ }; &blsp1_spi1 { + status = "okay"; + pinctrl-0 = <&spi_0_pins>; pinctrl-names = "default"; cs-select = <0>; - status = "okay"; flash@0 { compatible = "jedec,spi-nor"; @@ -253,26 +246,6 @@ }; }; -&blsp1_uart5 { - status = "okay"; -}; - -&cryptobam { - status = "okay"; -}; - -&crypto { - status = "okay"; -}; - -&prng { - status = "okay"; -}; - -&qpic_bam { - status = "okay"; -}; - &qpic_nand { status = "okay"; @@ -316,30 +289,6 @@ }; }; -&qusb_phy_0 { - status = "okay"; -}; - -&qusb_phy_1 { - status = "okay"; -}; - -&ssphy_0 { - status = "okay"; -}; - -&ssphy_1 { - status = "okay"; -}; - -&usb_0 { - status = "okay"; -}; - -&usb_1 { - status = "okay"; -}; - &mdio { status = "okay"; @@ -392,18 +341,22 @@ port_id = <1>; phy_address = <0>; }; + port@2 { port_id = <2>; phy_address = <1>; }; + port@3 { port_id = <3>; phy_address = <2>; }; + port@4 { port_id = <4>; phy_address = <3>; }; + port@5 { port_id = <5>; phy_address = <4>; @@ -411,10 +364,6 @@ }; }; -&edma { - status = "okay"; -}; - &dp1 { status = "okay"; phy-handle = <&qca8075_0>; @@ -447,6 +396,10 @@ &wifi { status = "okay"; - + qcom,ath11k-fw-memory-mode = <1>; qcom,ath11k-calibration-variant = "ZBT-Z800AX"; }; + +&edma { + status = "okay"; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-512m.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-512m.dtsi index dace4008b3..19329d7b7d 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-512m.dtsi +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-512m.dtsi @@ -1,19 +1,7 @@ -// SPDX-License-Identifier: GPL-2.0-only +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT #include "ipq8074.dtsi" -&tzapp_region { - reg = <0x0 0x4a400000 0x0 0x100000>; -}; - &q6_region { - reg = <0x0 0x4b000000 0x0 0x3700000>; -}; - -&q6_etr_region { - reg = <0x0 0x4e700000 0x0 0x100000>; -}; - -&m3_dump_region { - reg = <0x0 0x4e800000 0x0 0x100000>; + reg = <0x0 0x4b000000 0x0 0x4000000>; }; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-ac-cpu.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-ac-cpu.dtsi index 6cf8bad5b1..009a918d61 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-ac-cpu.dtsi +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-ac-cpu.dtsi @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: GPL-2.0-only +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT #include #include "ipq8074-cpr-regulator.dtsi" diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-common.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-common.dtsi new file mode 100644 index 0000000000..4e65679451 --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-common.dtsi @@ -0,0 +1,65 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +&blsp1_i2c2 { + status = "okay"; +}; + +&blsp1_spi1 { + status = "okay"; +}; + +&blsp1_uart3 { + status = "okay"; +}; + +&blsp1_uart5 { + status = "okay"; +}; + +&crypto { + status = "okay"; +}; + +&cryptobam { + status = "okay"; +}; + +&pcie_qmp0 { + status = "okay"; +}; + +&pcie_qmp1 { + status = "okay"; +}; + +&prng { + status = "okay"; +}; + +&qpic_bam { + status = "okay"; +}; + +&qusb_phy_0 { + status = "okay"; +}; + +&qusb_phy_1 { + status = "okay"; +}; + +&ssphy_0 { + status = "okay"; +}; + +&ssphy_1 { + status = "okay"; +}; + +&usb_0 { + status = "okay"; +}; + +&usb_1 { + status = "okay"; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-cpr-regulator.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-cpr-regulator.dtsi index e351a2e759..804a3179c7 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-cpr-regulator.dtsi +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-cpr-regulator.dtsi @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: GPL-2.0-only +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT #include "pmp8074.dtsi" @@ -25,7 +25,7 @@ qcom,cpr-idle-cycles = <15>; qcom,cpr-step-quot-init-min = <12>; qcom,cpr-step-quot-init-max = <14>; - qcom,cpr-count-mode = <0>; /* All-at-once */ + qcom,cpr-count-mode = <0>; qcom,cpr-count-repeat = <14>; qcom,cpr-down-error-step-limit = <1>; qcom,cpr-up-error-step-limit = <1>; @@ -57,15 +57,9 @@ qcom,allow-voltage-interpolation; qcom,allow-quotient-interpolation; qcom,cpr-scaled-open-loop-voltage-as-ceiling; - qcom,cpr-voltage-ceiling = - <840000 904000 944000 - 984000 992000 1064000>; - qcom,cpr-voltage-floor = - <592000 648000 712000 - 744000 784000 848000>; - qcom,corner-frequencies = - <1017600000 1382400000 1651200000 - 1843200000 1920000000 2208000000>; + qcom,cpr-voltage-ceiling = <840000 904000 944000 984000 992000 1064000>; + qcom,cpr-voltage-floor = <592000 648000 712000 744000 784000 848000>; + qcom,corner-frequencies = <1017600000 1382400000 1651200000 1843200000 1920000000 2208000000>; /* TT/FF parts i.e. turbo L1 OL voltage < 1048 mV */ qcom,cpr-open-loop-voltage-fuse-adjustment-0 = @@ -93,7 +87,7 @@ /* v2 - FF parts i.e. turbo L1 OL voltage < 992 mV */ qcom,cpr-open-loop-voltage-fuse-adjustment-v2-0 = - /* Speed bin 0; CPR rev 0..7 */ + /* Speed bin 0; CPR rev 0..7 */ < 0 0 0 0>, < 0 0 0 0>, < 0 0 0 0>, @@ -192,36 +186,27 @@ qcom,cpr-speed-bin-corners = <2>; qcom,allow-voltage-interpolation; qcom,cpr-corner-fmax-map = <1 2>; - qcom,cpr-voltage-ceiling = - <912000 992000>; - qcom,cpr-voltage-floor = - <752000 792000>; - qcom,corner-frequencies = - <1497600000 1689600000>; + qcom,cpr-voltage-ceiling = <912000 992000>; + qcom,cpr-voltage-floor = <752000 792000>; + qcom,corner-frequencies = <1497600000 1689600000>; /* TT/FF parts i.e. turbo OL voltage < 968 mV */ - qcom,cpr-open-loop-voltage-fuse-adjustment-0 = - < 40000 40000>; + qcom,cpr-open-loop-voltage-fuse-adjustment-0 = <40000 40000>; /* SS parts i.e turbo OL voltage >= 968 mV */ - qcom,cpr-open-loop-voltage-fuse-adjustment-1 = - < 24000 24000>; + qcom,cpr-open-loop-voltage-fuse-adjustment-1 = <24000 24000>; /* FF parts i.e. turbo OL voltage <= 832 mV */ - qcom,cpr-open-loop-voltage-fuse-adjustment-v2-0= - <40000 40000>; + qcom,cpr-open-loop-voltage-fuse-adjustment-v2-0= <40000 40000>; /* TT/SS parts i.e turbo OL voltage > 832 mV */ - qcom,cpr-open-loop-voltage-fuse-adjustment-v2-1= - <40000 40000>; + qcom,cpr-open-loop-voltage-fuse-adjustment-v2-1= <40000 40000>; /* FF parts i.e. turbo OL voltage <= 832 mV */ - qcom,cpr-cold-temp-voltage-adjustment-v2-0 = - <0 0>; + qcom,cpr-cold-temp-voltage-adjustment-v2-0 = <0 0>; /* TT/SS parts i.e turbo OL voltage > 832 mV */ - qcom,cpr-cold-temp-voltage-adjustment-v2-1 = - <35000 27000>; + qcom,cpr-cold-temp-voltage-adjustment-v2-1 = <35000 27000>; }; }; }; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-ess.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-ess.dtsi index 194540aac1..fa8b7923f2 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-ess.dtsi +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-ess.dtsi @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: GPL-2.0-only +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT #include @@ -26,8 +26,8 @@ compatible = "qcom,ess-switch-ipq807x"; reg = <0x3a000000 0x1000000>; switch_access_mode = "local bus"; - switch_cpu_bmp = ; /* cpu port bitmap */ - switch_inner_bmp = ; /*inner port bitmap*/ + switch_cpu_bmp = ; + switch_inner_bmp = ; clocks = <&gcc GCC_CMN_12GPLL_AHB_CLK>, <&gcc GCC_CMN_12GPLL_SYS_CLK>, <&gcc GCC_UNIPHY0_AHB_CLK>, @@ -146,12 +146,12 @@ "nss_port6_rst"; mdio-bus = <&mdio>; - switch_mac_mode = ; /* MAC mode for UNIPHY instance 0 */ - switch_mac_mode1 = ; /* MAC mode for UNIPHY instance 1 */ - switch_mac_mode2 = ; /* MAC mode for UNIPHY instance 2 */ + switch_mac_mode = ; + switch_mac_mode1 = ; + switch_mac_mode2 = ; - bm_tick_mode = <0>; /* bm tick mode */ - tm_tick_mode = <0>; /* tm tick mode */ + bm_tick_mode = <0>; + tm_tick_mode = <0>; status = "disabled"; @@ -242,7 +242,7 @@ port_id = <0>; l1scheduler { group@0 { - sp = <0 1>; /*L0 SPs*/ + sp = <0 1>; /*cpri cdrr epri edrr*/ cfg = <0 0 0 0>; }; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-hk-cpu.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-hk-cpu.dtsi index b7d746c44e..b485988234 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-hk-cpu.dtsi +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-hk-cpu.dtsi @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: GPL-2.0-only +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT #include #include "ipq8074-cpr-regulator.dtsi" diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-nbg7815.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-nbg7815.dts index 242f84fa15..085ef91e1e 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-nbg7815.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-nbg7815.dts @@ -1,14 +1,13 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/* - * Copyright (c) 2022, Karol Przybylski - * Copyright (c) 2023, Andre Valentin - */ /dts-v1/; #include "ipq8074.dtsi" #include "ipq8074-hk-cpu.dtsi" +#include "ipq8074-common.dtsi" #include "ipq8074-ess.dtsi" +#include "ipq8074-nss.dtsi" + #include #include #include @@ -20,8 +19,9 @@ aliases { serial0 = &blsp1_uart5; serial1 = &blsp1_uart3; - /* Alias as required by u-boot to patch MAC addresses */ + ethernet0 = &dp1; + label-mac-device = &dp1; }; @@ -58,36 +58,12 @@ }; }; -&blsp1_uart3 { - status = "okay"; -}; - -&blsp1_uart5 { - status = "okay"; -}; - -&prng { - status = "okay"; -}; - -&cryptobam { - status = "okay"; -}; - -&crypto { - status = "okay"; -}; - -&qpic_bam { - status = "okay"; -}; - - &blsp1_spi1 { + status = "okay"; + pinctrl-0 = <&spi_0_pins>; pinctrl-names = "default"; cs-gpios = <0>; - status = "okay"; /* * Bootloader will find the NAND DT node by the compatible and @@ -267,16 +243,19 @@ &mdio { status = "okay"; + pinctrl-0 = <&mdio_pins>; pinctrl-names = "default"; reset-gpios = <&tlmm 37 GPIO_ACTIVE_LOW>; ethernet-phy-package@0 { + compatible = "qcom,qca8075-package"; #address-cells = <1>; #size-cells = <0>; - compatible = "qcom,qca8075-package"; reg = <0>; + qcom,package-mode = "qsgmii"; + qca8075_0: ethernet-phy@0 { compatible = "ethernet-phy-ieee802.3-c22"; reg = <0>; @@ -309,7 +288,6 @@ compatible = "ethernet-phy-ieee802.3-c45"; reg = <8>; reset-gpios = <&tlmm 63 GPIO_ACTIVE_LOW>; - nvmem-cells = <&aqr_fw>; nvmem-cell-names = "firmware"; }; @@ -320,8 +298,8 @@ switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT3 | ESS_PORT4 | ESS_PORT6)>; switch_wan_bmp = ; - switch_mac_mode = ; - switch_mac_mode1 = ; + switch_mac_mode = ; + switch_mac_mode1 = ; switch_mac_mode2 = ; qcom,port_phyinfo { @@ -359,10 +337,6 @@ }; }; -&edma { - status = "okay"; -}; - &dp1 { status = "okay"; phy-handle = <&qca8075_0>; @@ -414,9 +388,9 @@ }; &blsp1_i2c2 { + status = "okay"; pinctrl-0 = <&i2c_0_pins>; pinctrl-names = "default"; - status = "okay"; tmp103@70 { compatible = "ti,tmp103"; @@ -433,32 +407,12 @@ vqmmc-supply = <&l11>; }; -&ssphy_0 { - status = "okay"; -}; - -&qusb_phy_0 { - status = "okay"; -}; - -&ssphy_1 { - status = "okay"; -}; - -&qusb_phy_1 { - status = "okay"; -}; - -&usb_0 { - status = "okay"; -}; - -&usb_1 { - status = "okay"; -}; - &wifi { status = "okay"; - + qcom,ath11k-fw-memory-mode = <1>; qcom,ath11k-calibration-variant = "Zyxel-NBG7815"; }; + +&edma { + status = "okay"; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-sxk80.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-netgear.dtsi similarity index 87% rename from target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-sxk80.dtsi rename to target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-netgear.dtsi index 7f8b813749..e6b074e3df 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-sxk80.dtsi +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-netgear.dtsi @@ -1,14 +1,11 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/* - * Copyright (c) 2021, Flole - * Copyright (c) 2023, Andrew Smith - */ - -/dts-v1/; #include "ipq8074.dtsi" -#include "ipq8074-ess.dtsi" #include "ipq8074-hk-cpu.dtsi" +#include "ipq8074-common.dtsi" +#include "ipq8074-ess.dtsi" +#include "ipq8074-nss.dtsi" + #include #include #include @@ -16,10 +13,12 @@ / { aliases { serial0 = &blsp1_uart5; + led-boot = &led_front_blue; led-failsafe = &led_front_red; led-running = &led_front_green; led-upgrade = &led_front_white; + label-mac-device = &dp2; }; @@ -103,68 +102,20 @@ bias-pull-up; }; }; - - leds_pins: leds_pinmux { - led_power_green { - pins = "gpio21"; - function = "gpio"; - drive-strength = <8>; - bias-pull-down; - }; - - led_power_red { - pins = "gpio22"; - function = "gpio"; - drive-strength = <8>; - bias-pull-down; - }; - - led_white { - pins = "gpio26"; - function = "gpio"; - drive-strength = <8>; - bias-pull-down; - }; - - led_green { - pins = "gpio29"; - function = "gpio"; - drive-strength = <8>; - bias-pull-down; - }; - - led_red { - pins = "gpio31"; - function = "gpio"; - drive-strength = <8>; - bias-pull-down; - }; - - led_blue { - pins = "gpio33"; - function = "gpio"; - drive-strength = <8>; - bias-pull-down; - }; - }; -}; - -&blsp1_uart5 { - status = "okay"; }; &blsp1_i2c2 { + status = "okay"; + pinctrl-0 = <&i2c_0_pins>; pinctrl-names = "default"; - status = "okay"; - tlc59208f@27 { #address-cells = <1>; #size-cells = <0>; compatible = "ti,tlc59108"; reg = <0x27>; - + led@0 { label = "rgb:led0"; reg = <0>; @@ -191,22 +142,6 @@ }; }; -&prng { - status = "okay"; -}; - -&cryptobam { - status = "okay"; -}; - -&crypto { - status = "okay"; -}; - -&qpic_bam { - status = "okay"; -}; - &qpic_nand { status = "okay"; @@ -422,12 +357,11 @@ reset-gpios = <&tlmm 37 GPIO_ACTIVE_LOW>; ethernet-phy-package@0 { + compatible = "qcom,qca8075-package"; #address-cells = <1>; #size-cells = <0>; reg = <0>; - compatible = "qcom,qca8075-package"; - qca8075_1: ethernet-phy@1 { compatible = "ethernet-phy-ieee802.3-c22"; reg = <1>; @@ -460,28 +394,32 @@ &switch { status = "okay"; - switch_lan_bmp = <(ESS_PORT2 | ESS_PORT3 | ESS_PORT4 | ESS_PORT5)>; /* lan port bitmap */ - switch_wan_bmp = ; /* wan port bitmap */ - switch_mac_mode = ; /* mac mode for uniphy instance0*/ - switch_mac_mode2 = ; /* mac mode for uniphy instance2*/ + switch_lan_bmp = <(ESS_PORT2 | ESS_PORT3 | ESS_PORT4 | ESS_PORT5)>; + switch_wan_bmp = ; + switch_mac_mode = ; + switch_mac_mode2 = ; qcom,port_phyinfo { port@2 { port_id = <2>; phy_address = <1>; }; + port@3 { port_id = <3>; phy_address = <2>; }; + port@4 { port_id = <4>; phy_address = <3>; }; + port@5 { port_id = <5>; phy_address = <4>; }; + port@6 { port_id = <6>; phy_address = <28>; @@ -490,10 +428,6 @@ }; }; -&edma { - status = "okay"; -}; - &dp2 { status = "okay"; phy-handle = <&qca8075_1>; @@ -536,6 +470,10 @@ &wifi { status = "okay"; - + qcom,ath11k-fw-memory-mode = <1>; qcom,ath11k-calibration-variant = "Netgear-SXK80"; }; + +&edma { + status = "okay"; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-nss.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-nss.dtsi new file mode 100644 index 0000000000..b1ba2613e1 --- /dev/null +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-nss.dtsi @@ -0,0 +1,277 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/ { + nss_dummy_reg: nss-regulator { + compatible = "regulator-fixed"; + regulator-name = "nss-reg"; + regulator-min-microvolt = <848000>; + regulator-max-microvolt = <848000>; + regulator-always-on; + regulator-boot-on; + }; +}; + +&soc { + nss-common { + compatible = "qcom,nss-common"; + reg = <0x01868010 0x1000>; + reg-names = "nss-misc-reset"; + memory-region = <&nss_region>; + }; + + nss0: nss@40000000 { + compatible = "qcom,nss"; + interrupts = , + , + , + , + , + , + , + , + , + ; + reg = <0x39000000 0x1000>, <0x38000000 0x30000>, <0x0b111000 0x1000>; + reg-names = "nphys", "vphys", "qgic-phys"; + clocks = <&gcc GCC_NSS_NOC_CLK>, + <&gcc GCC_NSS_PTP_REF_CLK>, + <&gcc GCC_NSS_CSR_CLK>, + <&gcc GCC_NSS_CFG_CLK>, + <&gcc GCC_NSS_IMEM_CLK>, + <&gcc GCC_NSSNOC_QOSGEN_REF_CLK>, + <&gcc GCC_MEM_NOC_NSS_AXI_CLK>, + <&gcc GCC_NSSNOC_SNOC_CLK>, + <&gcc GCC_NSSNOC_TIMEOUT_REF_CLK>, + <&gcc GCC_NSS_CE_AXI_CLK>, + <&gcc GCC_NSS_CE_APB_CLK>, + <&gcc GCC_NSSNOC_CE_AXI_CLK>, + <&gcc GCC_NSSNOC_CE_APB_CLK>, + <&gcc GCC_NSSNOC_UBI0_AHB_CLK>, + <&gcc GCC_UBI0_CORE_CLK>, + <&gcc GCC_UBI0_AHB_CLK>, + <&gcc GCC_UBI0_AXI_CLK>, + <&gcc GCC_UBI0_MPT_CLK>, + <&gcc GCC_UBI0_NC_AXI_CLK>; + clock-names = "nss-noc-clk", + "nss-ptp-ref-clk", + "nss-csr-clk", + "nss-cfg-clk", + "nss-imem-clk", + "nss-nssnoc-qosgen-ref-clk", + "nss-mem-noc-nss-axi-clk", + "nss-nssnoc-snoc-clk", + "nss-nssnoc-timeout-ref-clk", + "nss-ce-axi-clk", + "nss-ce-apb-clk", + "nss-nssnoc-ce-axi-clk", + "nss-nssnoc-ce-apb-clk", + "nss-nssnoc-ahb-clk", + "nss-core-clk", + "nss-ahb-clk", + "nss-axi-clk", + "nss-mpt-clk", + "nss-nc-axi-clk"; + qcom,id = <0>; + qcom,num-queue = <4>; + qcom,num-irq = <10>; + qcom,num-pri = <4>; + qcom,load-addr = <0x40000000>; + qcom,low-frequency = <187200000>; + qcom,mid-frequency = <748800000>; + qcom,max-frequency = <1689600000>; + qcom,bridge-enabled; + qcom,ipv4-enabled; + qcom,ipv4-reasm-enabled; + qcom,ipv6-enabled; + qcom,ipv6-reasm-enabled; + qcom,wlanredirect-enabled; + qcom,tun6rd-enabled; + qcom,l2tpv2-enabled; + qcom,gre-enabled; + qcom,gre-redir-enabled; + qcom,gre-redir-mark-enabled; + qcom,map-t-enabled; + qcom,portid-enabled; + qcom,ppe-enabled; + qcom,pppoe-enabled; + qcom,pptp-enabled; + qcom,tunipip6-enabled; + qcom,shaping-enabled; + qcom,wlan-dataplane-offload-enabled; + qcom,vlan-enabled; + qcom,igs-enabled; + qcom,vxlan-enabled; + qcom,match-enabled; + qcom,mirror-enabled; + qcom,udp-st-enabled; + mx-supply = <&nss_dummy_reg>; + npu-supply = <&nss_dummy_reg>; + }; + + nss1: nss@40800000 { + compatible = "qcom,nss"; + interrupts = , + , + , + , + , + , + , + , + ; + reg = <0x39400000 0x1000>, <0x38030000 0x30000>, <0x0b111000 0x1000>; + reg-names = "nphys", "vphys", "qgic-phys"; + clocks = <&gcc GCC_NSS_NOC_CLK>, + <&gcc GCC_NSS_PTP_REF_CLK>, + <&gcc GCC_NSS_CSR_CLK>, + <&gcc GCC_NSS_CFG_CLK>, + <&gcc GCC_NSS_IMEM_CLK>, + <&gcc GCC_NSSNOC_QOSGEN_REF_CLK>, + <&gcc GCC_MEM_NOC_NSS_AXI_CLK>, + <&gcc GCC_NSSNOC_SNOC_CLK>, + <&gcc GCC_NSSNOC_TIMEOUT_REF_CLK>, + <&gcc GCC_NSS_CE_AXI_CLK>, + <&gcc GCC_NSS_CE_APB_CLK>, + <&gcc GCC_NSSNOC_CE_AXI_CLK>, + <&gcc GCC_NSSNOC_CE_APB_CLK>, + <&gcc GCC_NSSNOC_UBI1_AHB_CLK>, + <&gcc GCC_UBI1_CORE_CLK>, + <&gcc GCC_UBI1_AHB_CLK>, + <&gcc GCC_UBI1_AXI_CLK>, + <&gcc GCC_UBI1_MPT_CLK>, + <&gcc GCC_UBI1_NC_AXI_CLK>; + clock-names = "nss-noc-clk", + "nss-ptp-ref-clk", + "nss-csr-clk", + "nss-cfg-clk", + "nss-imem-clk", + "nss-nssnoc-qosgen-ref-clk", + "nss-mem-noc-nss-axi-clk", + "nss-nssnoc-snoc-clk", + "nss-nssnoc-timeout-ref-clk", + "nss-ce-axi-clk", + "nss-ce-apb-clk", + "nss-nssnoc-ce-axi-clk", + "nss-nssnoc-ce-apb-clk", + "nss-nssnoc-ahb-clk", + "nss-core-clk", + "nss-ahb-clk", + "nss-axi-clk", + "nss-mpt-clk", + "nss-nc-axi-clk"; + qcom,id = <1>; + qcom,num-queue = <4>; + qcom,num-irq = <9>; + qcom,num-pri = <4>; + qcom,load-addr = <0x40800000>; + qcom,capwap-enabled; + qcom,dtls-enabled; + qcom,tls-enabled; + qcom,crypto-enabled; + qcom,ipsec-enabled; + qcom,qvpn-enabled; + qcom,pvxlan-enabled; + qcom,clmap-enabled; + qcom,rmnet_rx-enabled; + }; + + nss_crypto: qcom,nss_crypto { + compatible = "qcom,nss-crypto"; + #address-cells = <1>; + #size-cells = <1>; + qcom,max-contexts = <64>; + qcom,max-context-size = <32>; + ranges; + + eip197_node { + compatible = "qcom,eip197"; + reg-names = "crypto_pbase"; + reg = <0x39800000 0x7ffff>; + clocks = <&gcc GCC_NSS_CRYPTO_CLK>, <&gcc GCC_NSSNOC_CRYPTO_CLK>, <&gcc GCC_CRYPTO_PPE_CLK>; + clock-names = "crypto_clk", "crypto_nocclk", "crypto_ppeclk"; + clock-frequency = /bits/ 64 <600000000 600000000 300000000>; + qcom,dma-mask = <0xff>; + qcom,transform-enabled; + qcom,aes128-cbc; + qcom,aes192-cbc; + qcom,aes256-cbc; + qcom,aes128-ctr; + qcom,aes192-ctr; + qcom,aes256-ctr; + qcom,aes128-ecb; + qcom,aes192-ecb; + qcom,aes256-ecb; + qcom,3des-cbc; + qcom,md5-hash; + qcom,sha160-hash; + qcom,sha224-hash; + qcom,sha384-hash; + qcom,sha512-hash; + qcom,sha256-hash; + qcom,md5-hmac; + qcom,sha160-hmac; + qcom,sha224-hmac; + qcom,sha256-hmac; + qcom,sha384-hmac; + qcom,sha512-hmac; + qcom,aes128-gcm-gmac; + qcom,aes192-gcm-gmac; + qcom,aes256-gcm-gmac; + qcom,aes128-cbc-md5-hmac; + qcom,aes128-cbc-sha160-hmac; + qcom,aes192-cbc-md5-hmac; + qcom,aes192-cbc-sha160-hmac; + qcom,aes256-cbc-md5-hmac; + qcom,aes256-cbc-sha160-hmac; + qcom,aes128-ctr-sha160-hmac; + qcom,aes192-ctr-sha160-hmac; + qcom,aes256-ctr-sha160-hmac; + qcom,aes128-ctr-md5-hmac; + qcom,aes192-ctr-md5-hmac; + qcom,aes256-ctr-md5-hmac; + qcom,3des-cbc-md5-hmac; + qcom,3des-cbc-sha160-hmac; + qcom,aes128-cbc-sha256-hmac; + qcom,aes192-cbc-sha256-hmac; + qcom,aes256-cbc-sha256-hmac; + qcom,aes128-ctr-sha256-hmac; + qcom,aes192-ctr-sha256-hmac; + qcom,aes256-ctr-sha256-hmac; + qcom,3des-cbc-sha256-hmac; + qcom,aes128-cbc-sha384-hmac; + qcom,aes192-cbc-sha384-hmac; + qcom,aes256-cbc-sha384-hmac; + qcom,aes128-ctr-sha384-hmac; + qcom,aes192-ctr-sha384-hmac; + qcom,aes256-ctr-sha384-hmac; + qcom,aes128-cbc-sha512-hmac; + qcom,aes192-cbc-sha512-hmac; + qcom,aes256-cbc-sha512-hmac; + qcom,aes128-ctr-sha512-hmac; + qcom,aes192-ctr-sha512-hmac; + qcom,aes256-ctr-sha512-hmac; + + engine0 { + reg_offset = <0x80000>; + qcom,ifpp-enabled; + qcom,ipue-enabled; + qcom,ofpp-enabled; + qcom,opue-enabled; + }; + }; + }; + + nss-macsec0 { + compatible = "qcom,nss-macsec"; + mdiobus = <&mdio>; + phy_addr = <0x18>; + phy_access_mode = <0x00>; + }; + + nss-macsec1 { + compatible = "qcom,nss-macsec"; + mdiobus = <&mdio>; + phy_addr = <0x1c>; + phy_access_mode = <0x00>; + }; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-rax120v2.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-rax120v2.dts index 36e315cc80..39f738182a 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-rax120v2.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-rax120v2.dts @@ -3,10 +3,13 @@ /dts-v1/; #include "ipq8074.dtsi" -#include "ipq8074-ess.dtsi" #include "ipq8074-hk-cpu.dtsi" -#include +#include "ipq8074-common.dtsi" +#include "ipq8074-ess.dtsi" +#include "ipq8074-nss.dtsi" + #include +#include #include / { @@ -16,9 +19,11 @@ aliases { serial0 = &blsp1_uart5; + led-boot = &led_system_white; + led-failsafe = &led_system_white; led-running = &led_system_white; led-upgrade = &led_system_white; - led-internet = &led_wan_white; + label-mac-device = &dp5; }; @@ -151,11 +156,12 @@ reset-gpios = <&tlmm 37 GPIO_ACTIVE_LOW>; ethernet-phy-package@0 { + compatible = "qcom,qca8075-package"; #address-cells = <1>; #size-cells = <0>; reg = <0>; - compatible = "qcom,qca8075-package"; + qcom,package-mode = "qsgmii"; qca8075_0: ethernet-phy@0 { compatible = "ethernet-phy-ieee802.3-c22"; @@ -193,32 +199,37 @@ &switch { status = "okay"; - switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT3 | ESS_PORT4 | ESS_PORT6)>; /* lan port bitmap */ - switch_wan_bmp = ; /* wan port bitmap */ - switch_mac_mode = ; /* mac mode for uniphy instance0*/ - switch_mac_mode2 = ; /* mac mode for uniphy instance2*/ + switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT3 | ESS_PORT4 | ESS_PORT6)>; + switch_wan_bmp = ; + switch_mac_mode = ; + switch_mac_mode2 = ; qcom,port_phyinfo { port@1 { port_id = <1>; phy_address = <0>; }; + port@2 { port_id = <2>; phy_address = <1>; }; + port@3 { port_id = <3>; phy_address = <2>; }; + port@4 { port_id = <4>; phy_address = <3>; }; + port@5 { port_id = <5>; phy_address = <4>; }; + port@6 { port_id = <6>; phy_address = <7>; @@ -228,10 +239,6 @@ }; }; -&edma { - status = "okay"; -}; - &dp1 { status = "okay"; phy-handle = <&qca8075_0>; @@ -281,10 +288,6 @@ nvmem-cell-names = "mac-address"; }; -&blsp1_uart5 { - status = "okay"; -}; - &blsp1_i2c2 { status = "okay"; @@ -297,10 +300,6 @@ }; }; -&qpic_bam { - status = "okay"; -}; - &qpic_nand { status = "okay"; @@ -494,44 +493,12 @@ }; }; -&qusb_phy_0 { +&wifi { status = "okay"; -}; - -&qusb_phy_1 { - status = "okay"; -}; - -&ssphy_0 { - status = "okay"; -}; - -&ssphy_1 { - status = "okay"; -}; - -&usb_0 { - status = "okay"; -}; - -&usb_1 { - status = "okay"; -}; - -&wifi{ - status = "okay"; - + qcom,ath11k-fw-memory-mode = <1>; qcom,ath11k-calibration-variant = "Netgear-RAX120v2"; }; -&cryptobam { - status = "okay"; -}; - -&crypto { - status = "okay"; -}; - -&prng { +&edma { status = "okay"; }; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-rt-ax89x.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-rt-ax89x.dts index dd5ce8542e..310d8854ec 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-rt-ax89x.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-rt-ax89x.dts @@ -1,11 +1,13 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/* Copyright (c) 2024, Robert Marko */ /dts-v1/; #include "ipq8074.dtsi" #include "ipq8074-hk-cpu.dtsi" +#include "ipq8074-common.dtsi" #include "ipq8074-ess.dtsi" +#include "ipq8074-nss.dtsi" + #include #include #include @@ -15,18 +17,22 @@ compatible = "asus,rt-ax89x", "qcom,ipq8074"; aliases { - serial0 = &blsp1_uart5; mdio-gpio0 = &mdio1; - ethernet0 = &dp1; - ethernet1 = &dp2; - ethernet2 = &dp3; - ethernet3 = &dp4; - ethernet4 = &dp5_syn; - ethernet5 = &dp6_syn; + + serial0 = &blsp1_uart5; + led-boot = &led_pwr; led-failsafe = &led_pwr; led-running = &led_pwr; led-upgrade = &led_pwr; + + ethernet0 = &dp1; + ethernet1 = &dp2; + ethernet2 = &dp3; + ethernet3 = &dp4; + + ethernet4 = &dp5_syn; + ethernet5 = &dp6_syn; }; chosen { @@ -37,8 +43,6 @@ keys { compatible = "gpio-keys"; - pinctrl-0 = <&button_pins>; - pinctrl-names = "default"; wifi-button { label = "wifi"; @@ -67,8 +71,6 @@ leds { compatible = "gpio-leds"; - pinctrl-0 = <&led_pins>; - pinctrl-names = "default"; led_pwr: led-pwr { function = LED_FUNCTION_POWER; @@ -125,8 +127,7 @@ compatible = "gpio-fan"; pinctrl-0 = <&fan_pins>; pinctrl-names = "default"; - gpios = <&tlmm 64 GPIO_ACTIVE_HIGH - &tlmm 66 GPIO_ACTIVE_HIGH>; + gpios = <&tlmm 64 GPIO_ACTIVE_HIGH>, <&tlmm 66 GPIO_ACTIVE_HIGH>; /* * Not supported upstream, but good to document for * future uses. @@ -146,7 +147,7 @@ regulator-name = "usb0_vbus"; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; - gpio = <&tlmm 30 GPIO_ACTIVE_HIGH>; + gpios = <&tlmm 30 GPIO_ACTIVE_HIGH>; enable-active-high; regulator-boot-on; }; @@ -156,7 +157,7 @@ regulator-name = "usb1_vbus"; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; - gpio = <&tlmm 31 GPIO_ACTIVE_HIGH>; + gpios = <&tlmm 31 GPIO_ACTIVE_HIGH>; enable-active-high; regulator-boot-on; }; @@ -248,18 +249,13 @@ }; &tlmm { - button_pins: button-state { - pins = "gpio25", "gpio26", "gpio34", "gpio61"; - function = "gpio"; - drive-strength = <8>; - bias-pull-up; - }; - i2c_pins: i2c-pins { - pins = "gpio42", "gpio43"; - function = "blsp1_i2c"; - drive-strength = <8>; - bias-disable; + mux { + pins = "gpio42", "gpio43"; + function = "blsp1_i2c"; + drive-strength = <8>; + bias-disable; + }; }; mdio_pins: mdio-pins { @@ -279,10 +275,12 @@ }; mdio_gpio_pins: mdio-gpio-pins { - pins = "gpio54", "gpio56"; - function = "gpio"; - drive-strength = <8>; - bias-pull-up; + mux { + pins = "gpio54", "gpio56"; + function = "gpio"; + drive-strength = <8>; + bias-pull-up; + }; }; uniphy_pins: uniphy_pinmux { @@ -316,23 +314,6 @@ }; }; - led_pins: led-state { - power { - pins = "gpio21"; - function = "gpio"; - drive-strength = <8>; - bias-pull-up; - }; - - default_off { - pins = "gpio18", "gpio19", "gpio20", "gpio47", - "gpio44", "gpio35", "gpio36"; - function = "gpio"; - drive-strength = <8>; - bias-pull-down; - }; - }; - fan_pins: fan-state { pins = "gpio64", "gpio66"; function = "gpio"; @@ -342,54 +323,16 @@ }; }; -&blsp1_uart5 { - status = "okay"; -}; - -&prng { - status = "okay"; -}; - -&cryptobam { - status = "okay"; -}; - -&crypto { - status = "okay"; -}; - -&ssphy_0 { - status = "okay"; -}; - &qusb_phy_0 { status = "okay"; - vdd-supply = <&usb0_vbus>; }; -&ssphy_1 { - status = "okay"; -}; - &qusb_phy_1 { status = "okay"; - vdd-supply = <&usb1_vbus>; }; -&usb_0 { - status = "okay"; -}; - -&usb_1 { - status = "okay"; -}; - -&qpic_bam { - status = "okay"; -}; - &qpic_nand { status = "okay"; @@ -466,10 +409,6 @@ }; }; -&blsp1_i2c2 { - status = "okay"; -}; - &mdio { status = "okay"; @@ -519,9 +458,9 @@ }; ethernet-phy-package@8 { + compatible = "qcom,qca8075-package"; #address-cells = <1>; #size-cells = <0>; - compatible = "qcom,qca8075-package"; reg = <8>; qcom,package-mode = "qsgmii"; @@ -615,8 +554,7 @@ compatible = "virtual,mdio-gpio"; pinctrl-0 = <&mdio_gpio_pins>; pinctrl-names = "default"; - gpios = <&tlmm 56 GPIO_ACTIVE_HIGH>, - <&tlmm 54 GPIO_ACTIVE_HIGH>; + gpios = <&tlmm 56 GPIO_ACTIVE_HIGH>, <&tlmm 54 GPIO_ACTIVE_HIGH>; #address-cells = <1>; #size-cells = <0>; @@ -640,25 +578,28 @@ pinctrl-0 = <&uniphy_pins>; pinctrl-names = "default"; - switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT3 | ESS_PORT5 | ESS_PORT6)>; /* lan port bitmap */ - switch_wan_bmp = ; /* wan port bitmap */ - switch_mac_mode = ; /* mac mode for uniphy instance0*/ - switch_mac_mode1 = ; /* mac mode for uniphy instance1*/ - switch_mac_mode2 = ; /* mac mode for uniphy instance2*/ + switch_lan_bmp = <(ESS_PORT1 | ESS_PORT2 | ESS_PORT3 | ESS_PORT5 | ESS_PORT6)>; + switch_wan_bmp = ; + switch_mac_mode = ; + switch_mac_mode1 = ; + switch_mac_mode2 = ; qcom,port_phyinfo { port@0 { port_id = <1>; phy_address = <0x8>; }; + port@1 { port_id = <2>; phy_address = <0x9>; }; + port@2 { port_id = <3>; phy_address = <0xa>; }; + port@3 { port_id = <4>; phy_address = <0xb>; @@ -668,8 +609,8 @@ port_id = <5>; phy_address = <30>; phy_i2c_address = <30>; - phy-i2c-mode; /*i2c access phy */ - media-type = "sfp"; /* fiber mode */ + phy-i2c-mode; + media-type = "sfp"; sfp_tx_dis_pin = <&tlmm 48 GPIO_ACTIVE_HIGH>; sfp_mod_present_pin = <&tlmm 46 GPIO_ACTIVE_LOW>; }; @@ -685,10 +626,6 @@ }; }; -&edma { - status = "okay"; -}; - &dp1 { status = "okay"; phy-mode = "qsgmii"; @@ -731,5 +668,10 @@ &wifi { status = "okay"; + qcom,ath11k-fw-memory-mode = <1>; qcom,ath11k-calibration-variant = "Asus-RT-AX89X"; }; + +&edma { + status = "okay"; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-sxr80.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-sxr80.dts index d90e75da30..345fe35160 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-sxr80.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-sxr80.dts @@ -1,9 +1,8 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/* Copyright (c) 2021, Flole */ /dts-v1/; -#include "ipq8074-sxk80.dtsi" +#include "ipq8074-netgear.dtsi" / { model = "Netgear SXR80"; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-sxs80.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-sxs80.dts index 0d7240cf07..8073a41c07 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-sxs80.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-sxs80.dts @@ -1,9 +1,8 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/* Copyright (c) 2021, Flole */ /dts-v1/; -#include "ipq8074-sxk80.dtsi" +#include "ipq8074-netgear.dtsi" / { model = "Netgear SXS80"; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-wax630.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-wax630.dts index 3393efd7b5..fcbd658af9 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-wax630.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-wax630.dts @@ -4,9 +4,12 @@ #include "ipq8074.dtsi" #include "ipq8074-hk-cpu.dtsi" +#include "ipq8074-common.dtsi" #include "ipq8074-ess.dtsi" -#include +#include "ipq8074-nss.dtsi" + #include +#include #include / { @@ -16,14 +19,15 @@ aliases { serial0 = &blsp1_uart5; - ethernet0 = &dp6_syn; - ethernet1 = &dp4; - label-mac-device = &dp6_syn; - led-boot = &led_system_blue; led-failsafe = &led_system_red; led-running = &led_system_green; led-upgrade = &led_system_blue; + + ethernet0 = &dp6_syn; + ethernet1 = &dp4; + + label-mac-device = &dp6_syn; }; chosen { @@ -144,10 +148,6 @@ }; }; -&edma { - status = "okay"; -}; - &switch { status = "okay"; @@ -195,9 +195,9 @@ reset-gpios = <&tlmm 37 GPIO_ACTIVE_LOW>; ethernet-phy-package@0 { + compatible = "qcom,qca8075-package"; #address-cells = <1>; #size-cells = <0>; - compatible = "qcom,qca8075-package"; reg = <0>; qca8075_3: ethernet-phy@3 { @@ -226,10 +226,6 @@ label = "lan1"; }; -&qpic_bam { - status = "okay"; -}; - &qpic_nand { status = "okay"; @@ -245,12 +241,12 @@ }; }; -&blsp1_uart5 { - status = "okay"; -}; - &wifi { status = "okay"; - + qcom,ath11k-fw-memory-mode = <1>; qcom,ath11k-calibration-variant = "Netgear-WAX630"; }; + +&edma { + status = "okay"; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-wxr-5950ax12.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-wxr-5950ax12.dts index f5574c19b5..f0b790e081 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-wxr-5950ax12.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8074-wxr-5950ax12.dts @@ -4,7 +4,10 @@ #include "ipq8074.dtsi" #include "ipq8074-hk-cpu.dtsi" +#include "ipq8074-common.dtsi" #include "ipq8074-ess.dtsi" +#include "ipq8074-nss.dtsi" + #include #include #include @@ -15,10 +18,12 @@ aliases { serial0 = &blsp1_uart5; + led-boot = &led_power_white; led-failsafe = &led_power_red; led-running = &led_power_white; led-upgrade = &led_power_white; + label-mac-device = &dp5_syn; }; @@ -42,13 +47,13 @@ function = "router"; }; - led_power_red: led-2 { + led_power_red: power-red { gpios = <&tlmm 31 GPIO_ACTIVE_HIGH>; color = ; function = LED_FUNCTION_POWER; }; - led_power_white: led-3 { + led_power_white: power-white { gpios = <&tlmm 34 GPIO_ACTIVE_HIGH>; color = ; function = LED_FUNCTION_POWER; @@ -155,26 +160,6 @@ }; }; -&blsp1_uart5 { - status = "okay"; -}; - -&prng { - status = "okay"; -}; - -&cryptobam { - status = "okay"; -}; - -&crypto { - status = "okay"; -}; - -&qpic_bam { - status = "okay"; -}; - &qpic_nand { status = "okay"; @@ -224,8 +209,7 @@ * Multiple entries in reset-gpios of mdio may not be supported, but * leave the following as-is to show that the those reset pin exists. */ - reset-gpios = <&tlmm 37 GPIO_ACTIVE_LOW>, /* QCA8075 RESET */ - <&tlmm 63 GPIO_ACTIVE_LOW>; /* AQR113C RESET (2x) */ + reset-gpios = <&tlmm 37 GPIO_ACTIVE_LOW>, <&tlmm 63 GPIO_ACTIVE_LOW>; aqr113c_1: ethernet-phy@0 { compatible = "ethernet-phy-ieee802.3-c45"; @@ -238,9 +222,9 @@ }; ethernet-phy-package@17 { + compatible = "qcom,qca8075-package"; #address-cells = <1>; #size-cells = <0>; - compatible = "qcom,qca8075-package"; reg = <0x18>; qcom,package-mode = "qsgmii"; @@ -301,10 +285,6 @@ }; }; -&edma { - status = "okay"; -}; - &dp2 { status = "okay"; phy-mode = "qsgmii"; @@ -350,14 +330,6 @@ nvmem-cell-names = "mac-address"; }; -&ssphy_0 { - status = "okay"; -}; - -&qusb_phy_0 { - status = "okay"; -}; - &usb_0 { status = "okay"; @@ -366,6 +338,10 @@ &wifi { status = "okay"; - + qcom,ath11k-fw-memory-mode = <1>; qcom,ath11k-calibration-variant = "Buffalo-WXR-5950AX12"; }; + +&edma { + status = "okay"; +}; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-homewrk.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-homewrk.dts index 0e184452e3..c125008365 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-homewrk.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-homewrk.dts @@ -63,6 +63,6 @@ &wifi { status = "okay"; - + qcom,ath11k-fw-memory-mode = <1>; qcom,ath11k-calibration-variant = "Linksys-HomeWRK"; }; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200.dtsi index 5867cd4222..39c339d176 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200.dtsi +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200.dtsi @@ -1,5 +1,4 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/* Copyright (c) 2023, Mohammad Sayful Islam */ #include "ipq8174-mx4x00.dtsi" diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v1.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v1.dts index 7946e5c54d..b5cf49d642 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v1.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v1.dts @@ -1,5 +1,4 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/* Copyright (c) 2023, Mohammad Sayful Islam */ /dts-v1/; @@ -13,7 +12,6 @@ &wifi { status = "okay"; - - qcom,ath11k-calibration-variant = "Linksys-MX4200v1"; qcom,ath11k-fw-memory-mode = <1>; + qcom,ath11k-calibration-variant = "Linksys-MX4200v1"; }; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v2.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v2.dts index 44e1b72f16..bf22ca58fb 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v2.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4200v2.dts @@ -1,5 +1,4 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/* Copyright (c) 2023, Mohammad Sayful Islam */ /dts-v1/; @@ -12,6 +11,6 @@ &wifi { status = "okay"; - + qcom,ath11k-fw-memory-mode = <1>; qcom,ath11k-calibration-variant = "Linksys-MX4200v2"; }; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4300.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4300.dts index 1477019ab9..672902ea94 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4300.dts +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4300.dts @@ -42,7 +42,7 @@ nand@0 { reg = <0>; /* - * Some devices use Micron NAND with with 8 bit ECC + * Some devices use Micron NAND with with 8 bit ECC * other AMD/Spansion NAND with 4 bit ECC *nand-ecc-strength = <4>; *nand-ecc-step-size = <512>; @@ -268,6 +268,6 @@ &wifi { status = "okay"; - - qcom,ath11k-calibration-variant = "Linksys-MX4200v1"; + qcom,ath11k-fw-memory-mode = <1>; + qcom,ath11k-calibration-variant = "Linksys-MX4200v2"; }; diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4x00.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4x00.dtsi index 84e68dae35..3bd6a02ccb 100644 --- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4x00.dtsi +++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq8174-mx4x00.dtsi @@ -1,9 +1,11 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/* Copyright (c) 2023, Mohammad Sayful Islam */ #include "ipq8074.dtsi" #include "ipq8074-ac-cpu.dtsi" +#include "ipq8074-common.dtsi" #include "ipq8074-ess.dtsi" +#include "ipq8074-nss.dtsi" + #include #include #include @@ -12,16 +14,14 @@ aliases { serial0 = &blsp1_uart5; serial1 = &blsp1_uart3; - /* - * Aliases as required by u-boot - * to patch MAC addresses - */ - ethernet1 = &dp2; - ethernet2 = &dp3; + led-boot = &led_system_blue; led-running = &led_system_blue; led-failsafe = &led_system_red; led-upgrade = &led_system_green; + + ethernet1 = &dp2; + ethernet2 = &dp3; }; chosen { @@ -30,8 +30,6 @@ keys { compatible = "gpio-keys"; - pinctrl-0 = <&button_pins>; - pinctrl-names = "default"; reset-button { label = "reset"; @@ -48,13 +46,6 @@ }; &tlmm { - button_pins: button-state { - pins = "gpio52", "gpio67"; - function = "gpio"; - drive-strength = <8>; - bias-pull-up; - }; - mdio_pins: mdio-state { mdc-pins { pins = "gpio68"; @@ -72,26 +63,6 @@ }; }; -&blsp1_uart5 { - status = "okay"; -}; - -&prng { - status = "okay"; -}; - -&cryptobam { - status = "okay"; -}; - -&crypto { - status = "okay"; -}; - -&qpic_bam { - status = "okay"; -}; - &blsp1_i2c2 { status = "okay"; @@ -102,19 +73,19 @@ reg = <0x62>; nxp,hw-blink; - led_system_red: led@0 { + led_system_red: system-red { reg = <0>; color = ; function = LED_FUNCTION_STATUS; }; - led_system_green: led@1 { + led_system_green: system-green { reg = <1>; color = ; function = LED_FUNCTION_STATUS; }; - led_system_blue: led@2 { + led_system_blue: system-blue { reg = <2>; color = ; function = LED_FUNCTION_STATUS; @@ -130,9 +101,9 @@ reset-gpios = <&tlmm 37 GPIO_ACTIVE_LOW>; ethernet-phy-package@0 { + compatible = "qcom,qca8075-package"; #address-cells = <1>; #size-cells = <0>; - compatible = "qcom,qca8075-package"; reg = <0>; qca8075_1: ethernet-phy@1 { @@ -160,9 +131,9 @@ &switch { status = "okay"; - switch_lan_bmp = <(ESS_PORT3 | ESS_PORT4 | ESS_PORT5)>; /* lan port bitmap */ - switch_wan_bmp = ; /* wan port bitmap */ - switch_mac_mode = ; /* mac mode for uniphy instance0*/ + switch_lan_bmp = <(ESS_PORT3 | ESS_PORT4 | ESS_PORT5)>; + switch_wan_bmp = ; + switch_mac_mode = ; qcom,port_phyinfo { port@2 { @@ -190,15 +161,3 @@ &edma { status = "okay"; }; - -&ssphy_0 { - status = "okay"; -}; - -&qusb_phy_0 { - status = "okay"; -}; - -&usb_0 { - status = "okay"; -}; diff --git a/target/linux/qualcommax/files/include/net/netfilter/nf_conntrack_dscpremark_ext.h b/target/linux/qualcommax/files/include/net/netfilter/nf_conntrack_dscpremark_ext.h new file mode 100644 index 0000000000..dc6a5004ef --- /dev/null +++ b/target/linux/qualcommax/files/include/net/netfilter/nf_conntrack_dscpremark_ext.h @@ -0,0 +1,95 @@ +/* + ************************************************************************** + * Copyright (c) 2014-2015, The Linux Foundation. All rights reserved. + * Copyright (c) 2022, Qualcomm Innovation Center, Inc. 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. + ************************************************************************** + */ + +/* DSCP remark conntrack extension APIs. */ + +#ifndef _NF_CONNTRACK_DSCPREMARK_H +#define _NF_CONNTRACK_DSCPREMARK_H + +#include +#include + +/* Rule flags */ +#define NF_CT_DSCPREMARK_EXT_DSCP_RULE_VALID 0x1 + +/* Rule validity */ +#define NF_CT_DSCPREMARK_EXT_RULE_VALID 0x1 +#define NF_CT_DSCPREMARK_EXT_RULE_NOT_VALID 0x0 + +/* Which QoS features are set flags */ +#define NF_CT_DSCPREMARK_EXT_PRIO 0x1 +#define NF_CT_DSCPREMARK_EXT_DSCP 0x2 +#define NF_CT_DSCPREMARK_EXT_IGS_QOS 0x4 +#define NF_CT_DSCPREMARK_EXT_MARK 0x8 + +/* + * DSCP remark conntrack extension structure. + */ +struct nf_ct_dscpremark_ext { + __u32 flow_priority; /* Original direction packet priority */ + __u32 reply_priority; /* Reply direction packet priority */ + __u32 flow_mark; /* Original direction packet mark */ + __u32 reply_mark; /* Reply direction packet mark */ + __u16 igs_flow_qos_tag; /* Original direction ingress packet priority */ + __u16 igs_reply_qos_tag; /* Reply direction ingress packet priority */ + __u8 flow_dscp; /* IP DSCP value for original direction */ + __u8 reply_dscp; /* IP DSCP value for reply direction */ + __u16 rule_flags; /* Rule Validity flags */ + __u16 flow_set_flags; /* Original direction set flags */ + __u16 return_set_flags; /* Reply direction set flags */ +}; + +/* + * nf_ct_dscpremark_ext_find() + * Finds the extension data of the conntrack entry if it exists. + */ +static inline struct nf_ct_dscpremark_ext * +nf_ct_dscpremark_ext_find(const struct nf_conn *ct) +{ +#ifdef CONFIG_NF_CONNTRACK_DSCPREMARK_EXT + return nf_ct_ext_find(ct, NF_CT_EXT_DSCPREMARK); +#else + return NULL; +#endif +} + +/* + * nf_ct_dscpremark_ext_add() + * Adds the extension data to the conntrack entry. + */ +static inline +struct nf_ct_dscpremark_ext *nf_ct_dscpremark_ext_add(struct nf_conn *ct, + gfp_t gfp) +{ +#ifdef CONFIG_NF_CONNTRACK_DSCPREMARK_EXT + struct nf_ct_dscpremark_ext *ncde; + + ncde = nf_ct_ext_add(ct, NF_CT_EXT_DSCPREMARK, gfp); + if (!ncde) + return NULL; + + return ncde; +#else + return NULL; +#endif +}; + +#ifdef CONFIG_NF_CONNTRACK_DSCPREMARK_EXT +extern int nf_conntrack_dscpremark_ext_set_dscp_rule_valid(struct nf_conn *ct); +extern int nf_conntrack_dscpremark_ext_get_dscp_rule_validity(struct nf_conn *ct); +#endif /* CONFIG_NF_CONNTRACK_DSCPREMARK_EXT */ +#endif /* _NF_CONNTRACK_DSCPREMARK_H */ diff --git a/target/linux/qualcommax/files/include/uapi/linux/tc_act/tc_nss_mirred.h b/target/linux/qualcommax/files/include/uapi/linux/tc_act/tc_nss_mirred.h new file mode 100644 index 0000000000..3a368fcc8c --- /dev/null +++ b/target/linux/qualcommax/files/include/uapi/linux/tc_act/tc_nss_mirred.h @@ -0,0 +1,36 @@ +#ifndef __LINUX_TC_NSS_MIRRED_H +#define __LINUX_TC_NSS_MIRRED_H + +#include + +/* + * Type of nss mirred action. + */ +#define TCA_ACT_MIRRED_NSS 17 + +/* + * Types of parameters for nss mirred action. + */ +enum { + TC_NSS_MIRRED_UNSPEC, + TC_NSS_MIRRED_TM, + TC_NSS_MIRRED_PARMS, + __TC_NSS_MIRRED_MAX +}; +#define TC_NSS_MIRRED_MAX (__TC_NSS_MIRRED_MAX - 1) + +/* + * tc_nss_mirred + * tc command structure for nss mirred action. + */ +struct tc_nss_mirred { + tc_gen; /* General tc structure. */ + __u32 from_ifindex; /* ifindex of the port from which traffic + * will be redirected. + */ + __u32 to_ifindex; /* ifindex of the port to which traffic + * will be redirected. + */ +}; + +#endif /* __LINUX_TC_NSS_MIRRED_H */ diff --git a/target/linux/qualcommax/files/net/core/skbuff_debug.c b/target/linux/qualcommax/files/net/core/skbuff_debug.c new file mode 100644 index 0000000000..50d0675921 --- /dev/null +++ b/target/linux/qualcommax/files/net/core/skbuff_debug.c @@ -0,0 +1,332 @@ +/* + * Copyright (c) 2013-2014, 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 +#include +#include +#include +#include + +#include "skbuff_debug.h" +#include "skbuff_notifier.h" +#include "skbuff_recycle.h" + +static int skbuff_debugobj_enabled __read_mostly = 1; + +static int skbuff_debug_event_handler(struct notifier_block *nb, + unsigned long action, void *data); +static struct notifier_block skbuff_debug_notify = { + .notifier_call = skbuff_debug_event_handler, + .priority = 0 +}; + +inline u32 skbuff_debugobj_sum(struct sk_buff *skb) +{ + int pos = offsetof(struct sk_buff, free_addr); + u32 sum = 0; + + while (pos--) + sum += ((u8 *)skb)[pos]; + + return sum; +} + +struct skbuff_debugobj_walking { + int pos; + void **d; +}; + +#ifdef CONFIG_ARM +static int skbuff_debugobj_walkstack(struct stackframe *frame, void *p) { + struct skbuff_debugobj_walking *w = (struct skbuff_debugobj_walking *)p; + unsigned long pc = frame->pc; + + if (w->pos < DEBUG_OBJECTS_SKBUFF_STACKSIZE - 1) { + w->d[w->pos++] = (void *)pc; + return 0; + } + + return -ENOENT; +} +#else +static bool skbuff_debugobj_walkstack(void *p, unsigned long pc) +{ + struct skbuff_debugobj_walking *w = (struct skbuff_debugobj_walking *)p; + + if (w->pos < DEBUG_OBJECTS_SKBUFF_STACKSIZE - 1) { + w->d[w->pos++] = (void *)pc; + return true; + } + + return false; +} +#endif + +#if defined(CONFIG_ARM) || defined(CONFIG_ARM64) +static void skbuff_debugobj_get_stack(void **ret) +{ + struct skbuff_debugobj_walking w = {0, ret}; + void *p = &w; + +#ifdef CONFIG_ARM + struct stackframe frame; + register unsigned long current_sp asm ("sp"); + + frame.lr = (unsigned long)__builtin_return_address(0); + frame.fp = (unsigned long)__builtin_frame_address(0); + frame.sp = current_sp; + frame.pc = (unsigned long)skbuff_debugobj_get_stack; + + walk_stackframe(&frame, skbuff_debugobj_walkstack, p); +#else + arch_stack_walk(skbuff_debugobj_walkstack, p, current, NULL); +#endif + + ret[w.pos] = NULL; +} +#else +#error +static void skbuff_debugobj_get_stack(void **ret) +{ + /* not supported */ + ret[0] = 0xdeadbeef; +} +#endif + +void skbuff_debugobj_print_stack(void *const *stack) +{ + int i; + + for (i = 0; stack[i]; i++) + pr_emerg("\t %pS (0x%p)\n", stack[i], stack[i]); +} + +static const char *skbuff_debugobj_state_name(const struct sk_buff *skb) +{ + int obj_state; + + obj_state = debug_object_get_state((struct sk_buff *)skb); + switch (obj_state) { + case ODEBUG_STATE_NONE: + return "none"; + case ODEBUG_STATE_INIT: + return "init"; + case ODEBUG_STATE_INACTIVE: + return "inactive"; + case ODEBUG_STATE_ACTIVE: + return "active"; + case ODEBUG_STATE_DESTROYED: + return "destroyed"; + case ODEBUG_STATE_NOTAVAILABLE: + return "not available"; + default: + return "invalid"; + } +} + +void skbuff_debugobj_print_skb(const struct sk_buff *skb) +{ + pr_emerg("skb_debug: current process = %s (pid %i)\n", + current->comm, current->pid); + pr_emerg("skb_debug: skb 0x%p, next 0x%p, prev 0x%p, state = %s\n", skb, + skb->next, skb->prev, skbuff_debugobj_state_name(skb)); + pr_emerg("skb_debug: free stack:\n"); + skbuff_debugobj_print_stack(skb->free_addr); + pr_emerg("skb_debug: alloc stack:\n"); + skbuff_debugobj_print_stack(skb->alloc_addr); +} +EXPORT_SYMBOL(skbuff_debugobj_print_skb); + +/* skbuff_debugobj_fixup(): + * Called when an error is detected in the state machine for + * the objects + */ +static bool skbuff_debugobj_fixup(void *addr, enum debug_obj_state state) +{ + struct sk_buff *skb = (struct sk_buff *)addr; + ftrace_dump(DUMP_ALL); + WARN(1, "skb_debug: state = %d, skb = 0x%p sum = %d (now %d)\n", + state, skb, skb->sum, skbuff_debugobj_sum(skb)); + skb_recycler_notifier_send_event(SKB_RECYCLER_NOTIFIER_FSM, skb); + + return true; +} + +static struct debug_obj_descr skbuff_debug_descr = { + .name = "sk_buff_struct", + .fixup_init = skbuff_debugobj_fixup, + .fixup_activate = skbuff_debugobj_fixup, + .fixup_destroy = skbuff_debugobj_fixup, + .fixup_free = skbuff_debugobj_fixup, +}; + +inline void skbuff_debugobj_activate(struct sk_buff *skb) +{ + int ret = 0; + + if (!skbuff_debugobj_enabled) + return; + + skbuff_debugobj_get_stack(skb->alloc_addr); + ret = debug_object_activate(skb, &skbuff_debug_descr); + if (ret) + goto err_act; + + skbuff_debugobj_sum_validate(skb); + + return; + +err_act: + ftrace_dump(DUMP_ALL); + WARN(1, "skb_debug: failed to activate err = %d skb = 0x%p sum = %d (now %d)\n", + ret, skb, skb->sum, skbuff_debugobj_sum(skb)); + skb_recycler_notifier_send_event(SKB_RECYCLER_NOTIFIER_DBLALLOC, skb); +} + +inline void skbuff_debugobj_init_and_activate(struct sk_buff *skb) +{ + if (!skbuff_debugobj_enabled) + return; + + /* if we're coming from the slab, the skb->sum might + * be invalid anyways + */ + skb->sum = skbuff_debugobj_sum(skb); + + debug_object_init(skb, &skbuff_debug_descr); + skbuff_debugobj_activate(skb); +} + +inline void skbuff_debugobj_deactivate(struct sk_buff *skb) +{ + int obj_state; + + if (!skbuff_debugobj_enabled) + return; + + skb->sum = skbuff_debugobj_sum(skb); + + obj_state = debug_object_get_state(skb); + + if (obj_state == ODEBUG_STATE_ACTIVE) { + debug_object_deactivate(skb, &skbuff_debug_descr); + skbuff_debugobj_get_stack(skb->free_addr); + return; + } + + ftrace_dump(DUMP_ALL); + WARN(1, "skb_debug: deactivating inactive object skb=0x%p state=%d sum = %d (now %d)\n", + skb, obj_state, skb->sum, skbuff_debugobj_sum(skb)); + skb_recycler_notifier_send_event(SKB_RECYCLER_NOTIFIER_DBLFREE, skb); +} + +inline void _skbuff_debugobj_sum_validate(struct sk_buff *skb, + const char *var, const char *src, + int line, const char *fxn) +{ + if (!skbuff_debugobj_enabled || !skb) + return; + + if (skb->sum == skbuff_debugobj_sum(skb)) + return; + + ftrace_dump(DUMP_ALL); + WARN(1, "skb_debug: skb sum changed skb = 0x%p sum = %d (now %d)\n", + skb, skb->sum, skbuff_debugobj_sum(skb)); + pr_emerg("skb_debug: %s() checking %s in %s:%d\n", fxn, var, src, line); + skb_recycler_notifier_send_event(SKB_RECYCLER_NOTIFIER_SUMERR, skb); +} + +inline void skbuff_debugobj_sum_update(struct sk_buff *skb) +{ + if (!skbuff_debugobj_enabled || !skb) + return; + + skb->sum = skbuff_debugobj_sum(skb); +} + +inline void skbuff_debugobj_destroy(struct sk_buff *skb) +{ + if (!skbuff_debugobj_enabled) + return; + + debug_object_destroy(skb, &skbuff_debug_descr); +} + +static int __init disable_object_debug(char *str) +{ + skbuff_debugobj_enabled = 0; + + pr_info("skb_debug: debug objects is disabled\n"); + return 0; +} + +early_param("no_skbuff_debug_objects", disable_object_debug); + +void skbuff_debugobj_print_skb_list(const struct sk_buff *skb_list, + const char *list_title, int cpu) +{ + int count; + struct sk_buff *skb_i = (struct sk_buff *)skb_list; + u32 sum_i, sum_now; + int obj_state; + + if (cpu < 0) { + cpu = get_cpu(); + put_cpu(); + } + pr_emerg("skb_debug: start skb list '%s' [CPU#%d]\n", list_title, cpu); + count = 0; + if (skb_list) { + do { + obj_state = + debug_object_get_state(skb_i); + if (obj_state < ODEBUG_STATE_NOTAVAILABLE) { + sum_i = skb_i->sum; + sum_now = skbuff_debugobj_sum(skb_i); + } else { + sum_i = 0; + sum_now = 0; + } + if (sum_i != sum_now) { + pr_emerg("skb_debug: [%02d] skb 0x%p, next 0x%p, prev 0x%p, state %d (%s), sum %d (now %d)\n", + count, skb_i, skb_i->next, skb_i->prev, + obj_state, skbuff_debugobj_state_name(skb_i), + sum_i, sum_now); + } + skb_i = skb_i->next; + count++; + } while (skb_list != skb_i); + } + pr_emerg("skb_debug: end skb list '%s'. In total %d skbs iterated.\n", list_title, count); +} + +void skbuff_debugobj_register_callback(void) +{ + skb_recycler_notifier_register(&skbuff_debug_notify); +} + +int skbuff_debug_event_handler(struct notifier_block *nb, unsigned long action, + void *data) +{ + struct sk_buff *skb = (struct sk_buff *)data; + + pr_emerg("skb_debug: notifier event %lu\n", action); + skbuff_debugobj_print_skb(skb); + skb_recycler_print_all_lists(); + + return NOTIFY_DONE; +} diff --git a/target/linux/qualcommax/files/net/core/skbuff_debug.h b/target/linux/qualcommax/files/net/core/skbuff_debug.h new file mode 100644 index 0000000000..43e37ba43b --- /dev/null +++ b/target/linux/qualcommax/files/net/core/skbuff_debug.h @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2013-2014, 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 +#include + +#ifndef _LINUX_SKBBUFF_DEBUG_OBJECTS +#define _LINUX_SKBBUFF_DEBUG_OBJECTS + +#ifdef CONFIG_DEBUG_OBJECTS_SKBUFF +void skbuff_debugobj_init_and_activate(struct sk_buff *skb); +void skbuff_debugobj_activate(struct sk_buff *skb); +void skbuff_debugobj_deactivate(struct sk_buff *skb); +void skbuff_debugobj_destroy(struct sk_buff *skb); +#define skbuff_debugobj_sum_validate(skb) _skbuff_debugobj_sum_validate(skb, \ + #skb, __FILE__, __LINE__, __func__) +void _skbuff_debugobj_sum_validate(struct sk_buff *skb, const char *var, + const char *src, int line, const char *fxn); +void skbuff_debugobj_sum_update(struct sk_buff *skb); +void skbuff_debugobj_print_skb(const struct sk_buff *skb); + +void skbuff_debugobj_print_skb_list(const struct sk_buff *skb_list, + const char *list_title, int cpu); +void skbuff_debugobj_register_callback(void); + +#else +static inline void skbuff_debugobj_init_and_activate(struct sk_buff *skb) { } +static inline void skbuff_debugobj_activate(struct sk_buff *skb) { } +static inline void skbuff_debugobj_deactivate(struct sk_buff *skb) { } +static inline void skbuff_debugobj_destroy(struct sk_buff *skb) { } +static inline void skbuff_debugobj_sum_validate(struct sk_buff *skb) { } +static inline void skbuff_debugobj_sum_update(struct sk_buff *skb) { } +static inline void skbuff_debugobj_print_skb(const struct sk_buff *skb) { } + +static inline void skbuff_debugobj_print_skb_list + (const struct sk_buff *skb_list, const char *list_title, int cpu) { } +static inline void skbuff_debugobj_register_callback(void) { } +#endif + +#endif /* _LINUX_SKBBUFF_DEBUG_OBJECTS */ diff --git a/target/linux/qualcommax/files/net/core/skbuff_notifier.c b/target/linux/qualcommax/files/net/core/skbuff_notifier.c new file mode 100644 index 0000000000..8c59476db7 --- /dev/null +++ b/target/linux/qualcommax/files/net/core/skbuff_notifier.c @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2016, 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. + */ + +/* Notifier interface for the SKB Recycler */ + +#include "skbuff_notifier.h" + +static BLOCKING_NOTIFIER_HEAD(skb_recycler_notifier); + +int skb_recycler_notifier_register(struct notifier_block *nb) +{ + return blocking_notifier_chain_register(&skb_recycler_notifier, nb); +} +EXPORT_SYMBOL(skb_recycler_notifier_register); + +int skb_recycler_notifier_unregister(struct notifier_block *nb) +{ + return blocking_notifier_chain_unregister(&skb_recycler_notifier, nb); +} +EXPORT_SYMBOL(skb_recycler_notifier_unregister); + +int skb_recycler_notifier_send_event(unsigned long action, struct sk_buff *skb) +{ + int ret; + + ret = blocking_notifier_call_chain(&skb_recycler_notifier, action, skb); + + return 0; +} diff --git a/target/linux/qualcommax/files/net/core/skbuff_notifier.h b/target/linux/qualcommax/files/net/core/skbuff_notifier.h new file mode 100644 index 0000000000..3d8bfa586f --- /dev/null +++ b/target/linux/qualcommax/files/net/core/skbuff_notifier.h @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2016, 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. + */ + +#ifndef SKBUFF_NOTIFIER_H +#define SKBUFF_NOTIFIER_H + +#include +#include + +/* notifier events */ +#define SKB_RECYCLER_NOTIFIER_SUMERR 0x0001 +#define SKB_RECYCLER_NOTIFIER_DBLFREE 0x0002 +#define SKB_RECYCLER_NOTIFIER_DBLALLOC 0x0004 +#define SKB_RECYCLER_NOTIFIER_FSM 0x0008 + +#if defined(CONFIG_DEBUG_OBJECTS_SKBUFF) +int skb_recycler_notifier_register(struct notifier_block *nb); +int skb_recycler_notifier_unregister(struct notifier_block *nb); +int skb_recycler_notifier_send_event(unsigned long action, + struct sk_buff *skb); +#else +static inline int skb_recycler_notifier_register(struct notifier_block *nb) +{ + return 0; +} + +static inline int skb_recycler_notifier_unregister(struct notifier_block *nb) +{ + return 0; +} + +static inline int skb_recycler_notifier_send_event(unsigned long action, + struct sk_buff *skb) +{ + return 1; +} +#endif /* CONFIG_DEBUG_OBJECTS_SKBUFF */ + +#endif /* SKBUFF_NOTIFIER_H */ diff --git a/target/linux/qualcommax/files/net/core/skbuff_recycle.c b/target/linux/qualcommax/files/net/core/skbuff_recycle.c new file mode 100644 index 0000000000..fc126abab0 --- /dev/null +++ b/target/linux/qualcommax/files/net/core/skbuff_recycle.c @@ -0,0 +1,807 @@ +/* + * Copyright (c) 2013-2016, 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. + */ +/* Generic skb recycler */ + +#include "skbuff_recycle.h" +#include +#include +#include + +#include "skbuff_debug.h" + +static struct proc_dir_entry *proc_net_skbrecycler; + +static DEFINE_PER_CPU(struct sk_buff_head, recycle_list); +static int skb_recycle_max_skbs = SKB_RECYCLE_MAX_SKBS; + +#ifdef CONFIG_SKB_RECYCLER_MULTI_CPU +static DEFINE_PER_CPU(struct sk_buff_head, recycle_spare_list); +static struct global_recycler glob_recycler; +static int skb_recycle_spare_max_skbs = SKB_RECYCLE_SPARE_MAX_SKBS; +#endif + +static int skb_recycling_enable = 1; +inline struct sk_buff *skb_recycler_alloc(struct net_device *dev, + unsigned int length, bool reset_skb) +{ + unsigned long flags; + struct sk_buff_head *h; + struct sk_buff *skb = NULL; + struct sk_buff *ln = NULL; + + /* Allocate the recycled skbs if the skb_recycling_enable */ + if (unlikely(!skb_recycling_enable)) { + return NULL; + } + + if (unlikely(length > SKB_RECYCLE_SIZE)) + return NULL; + + h = &get_cpu_var(recycle_list); + local_irq_save(flags); + skb = skb_peek(h); + if (skb) { + ln = skb_peek_next(skb, h); + skbuff_debugobj_activate(skb); + /* Recalculate the sum for skb->next as next and prev pointers + * of skb->next will be updated in __skb_unlink + */ + skbuff_debugobj_sum_validate(ln); + __skb_unlink(skb, h); + skbuff_debugobj_sum_update(ln); + } +#ifdef CONFIG_SKB_RECYCLER_MULTI_CPU + if (unlikely(!skb)) { + u8 head; + + spin_lock(&glob_recycler.lock); + /* If global recycle list is not empty, use global buffers */ + head = glob_recycler.head; + if (unlikely(head == glob_recycler.tail)) { + spin_unlock(&glob_recycler.lock); + } else { + struct sk_buff *gn = glob_recycler.pool[head].next; + struct sk_buff *gp = glob_recycler.pool[head].prev; + + /* Move SKBs from global list to CPU pool */ + skbuff_debugobj_sum_validate(gn); + skbuff_debugobj_sum_validate(gp); + skb_queue_splice_init(&glob_recycler.pool[head], h); + skbuff_debugobj_sum_update(gn); + skbuff_debugobj_sum_update(gp); + + head = (head + 1) & SKB_RECYCLE_MAX_SHARED_POOLS_MASK; + glob_recycler.head = head; + spin_unlock(&glob_recycler.lock); + /* We have refilled the CPU pool - dequeue */ + skb = skb_peek(h); + if (skb) { + /* Recalculate the sum for skb->next as next and + * prev pointers of skb->next will be updated + * in __skb_unlink + */ + ln = skb_peek_next(skb, h); + skbuff_debugobj_activate(skb); + skbuff_debugobj_sum_validate(ln); + __skb_unlink(skb, h); + skbuff_debugobj_sum_update(ln); + } + } + } +#endif + local_irq_restore(flags); + put_cpu_var(recycle_list); + + if (likely(skb)) { + struct skb_shared_info *shinfo; + + /* We're about to write a large amount to the skb to + * zero most of the structure so prefetch the start + * of the shinfo region now so it's in the D-cache + * before we start to write that. + * For buffers recycled by PPE DS rings, the packets wouldnt + * have been processed by host and hence shinfo reset can be + * avoided. Avoid it if specifically requested for it + * (by DS rings), and the buffer is found to be recycled by + * DS previously + */ + + shinfo = skb_shinfo(skb); + prefetchw(shinfo); + zero_struct(skb, offsetof(struct sk_buff, tail)); + refcount_set(&skb->users, 1); + skb->mac_header = (typeof(skb->mac_header))~0U; + skb->transport_header = (typeof(skb->transport_header))~0U; + zero_struct(shinfo, offsetof(struct skb_shared_info, dataref)); + atomic_set(&shinfo->dataref, 1); + + skb->data = skb->head + NET_SKB_PAD; + skb_reset_tail_pointer(skb); + + skb->dev = dev; + } + + return skb; +} + +inline bool skb_recycler_consume(struct sk_buff *skb) +{ + unsigned long flags; + struct sk_buff_head *h; + struct sk_buff *ln = NULL; + + /* Consume the skbs if the skb_recycling_enable */ + if (unlikely(!skb_recycling_enable)) { + return false; + } + + /* Can we recycle this skb? If not, simply return that we cannot */ + if (unlikely(!consume_skb_can_recycle(skb, SKB_RECYCLE_MIN_SIZE, + SKB_RECYCLE_MAX_SIZE))) + return false; + + /* If we can, then it will be much faster for us to recycle this one + * later than to allocate a new one from scratch. + */ + h = &get_cpu_var(recycle_list); + local_irq_save(flags); + /* Attempt to enqueue the CPU hot recycle list first */ + if (likely(skb_queue_len(h) < skb_recycle_max_skbs)) { + ln = skb_peek(h); + /* Recalculate the sum for peek of list as next and prev + * pointers of skb->next will be updated in __skb_queue_head + */ + skbuff_debugobj_sum_validate(ln); + __skb_queue_head(h, skb); + skbuff_debugobj_deactivate(skb); + skbuff_debugobj_sum_update(ln); + local_irq_restore(flags); + preempt_enable(); + return true; + } +#ifdef CONFIG_SKB_RECYCLER_MULTI_CPU + h = this_cpu_ptr(&recycle_spare_list); + + /* The CPU hot recycle list was full; if the spare list is also full, + * attempt to move the spare list to the global list for other CPUs to + * use. + */ + if (unlikely(skb_queue_len(h) >= skb_recycle_spare_max_skbs)) { + u8 cur_tail, next_tail; + + spin_lock(&glob_recycler.lock); + cur_tail = glob_recycler.tail; + next_tail = (cur_tail + 1) & SKB_RECYCLE_MAX_SHARED_POOLS_MASK; + if (next_tail != glob_recycler.head) { + struct sk_buff_head *p = &glob_recycler.pool[cur_tail]; + struct sk_buff *hn = h->next, *hp = h->prev; + + /* Move SKBs from CPU pool to Global pool*/ + skbuff_debugobj_sum_validate(hp); + skbuff_debugobj_sum_validate(hn); + skb_queue_splice_init(h, p); + skbuff_debugobj_sum_update(hp); + skbuff_debugobj_sum_update(hn); + + /* Done with global list init */ + glob_recycler.tail = next_tail; + spin_unlock(&glob_recycler.lock); + + /* Recalculate the sum for peek of list as next and prev + * pointers of skb->next will be updated in + * __skb_queue_head + */ + ln = skb_peek(h); + skbuff_debugobj_sum_validate(ln); + /* We have now cleared room in the spare; + * Initialize and enqueue skb into spare + */ + __skb_queue_head(h, skb); + skbuff_debugobj_sum_update(ln); + skbuff_debugobj_deactivate(skb); + + local_irq_restore(flags); + preempt_enable(); + return true; + } + /* We still have a full spare because the global is also full */ + spin_unlock(&glob_recycler.lock); + } else { + /* We have room in the spare list; enqueue to spare list */ + ln = skb_peek(h); + /* Recalculate the sum for peek of list as next and prev + * pointers of skb->next will be updated in __skb_queue_head + */ + skbuff_debugobj_sum_validate(ln); + __skb_queue_head(h, skb); + skbuff_debugobj_deactivate(skb); + skbuff_debugobj_sum_update(ln); + local_irq_restore(flags); + preempt_enable(); + return true; + } +#endif + + local_irq_restore(flags); + preempt_enable(); + + return false; +} + +/** + * skb_recycler_consume_list_fast - free a list of skbs + * @skb_list: head of the buffer list + * + * Add the list of given SKBs to CPU list. Assumption is that these buffers + * have been allocated originally from recycler and have been transmitted through + * a controlled fast xmit path, thus removing the need for additional checks + * before recycling the buffers back to pool + */ +#ifdef CONFIG_DEBUG_OBJECTS_SKBUFF +inline bool skb_recycler_consume_list_fast(struct sk_buff_head *skb_list) +{ + struct sk_buff *skb = NULL, *next = NULL; + if (unlikely(!skb_recycling_enable)) { + return false; + } + skb_queue_walk_safe(skb_list, skb, next) { + if (skb) { + __skb_unlink(skb, skb_list); + skb_recycler_consume(skb); + } + } + + return true; +} +#else +inline bool skb_recycler_consume_list_fast(struct sk_buff_head *skb_list) +{ + unsigned long flags; + struct sk_buff_head *h; + + /* Allocate the recycled skbs if the skb_recycling_enable */ + if (unlikely(!skb_recycling_enable)) { + return false; + } + + h = &get_cpu_var(recycle_list); + local_irq_save(flags); + /* Attempt to enqueue the CPU hot recycle list first */ + if (likely(skb_queue_len(h) < skb_recycle_max_skbs)) { + skb_queue_splice(skb_list,h); + local_irq_restore(flags); + preempt_enable(); + return true; + } + + local_irq_restore(flags); + preempt_enable(); + + return false; +} +#endif + +static void skb_recycler_free_skb(struct sk_buff_head *list) +{ + struct sk_buff *skb = NULL, *next = NULL; + unsigned long flags; + + spin_lock_irqsave(&list->lock, flags); + while ((skb = skb_peek(list)) != NULL) { + skbuff_debugobj_activate(skb); + next = skb->next; + __skb_unlink(skb, list); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,2,0) + skb_release_data(skb, SKB_CONSUMED, false); +#else + skb_release_data(skb); +#endif + kfree_skbmem(skb); + /* + * Update the skb->sum for next due to skb_link operation + */ + if (next) { + skbuff_debugobj_sum_update(next); + } + } + spin_unlock_irqrestore(&list->lock, flags); +} + +static int skb_cpu_callback(unsigned int ocpu) +{ + unsigned long oldcpu = (unsigned long)ocpu; + + skb_recycler_free_skb(&per_cpu(recycle_list, oldcpu)); +#ifdef CONFIG_SKB_RECYCLER_MULTI_CPU + spin_lock(&glob_recycler.lock); + skb_recycler_free_skb(&per_cpu(recycle_spare_list, oldcpu)); + spin_unlock(&glob_recycler.lock); +#endif + + return NOTIFY_DONE; +} + +#ifdef CONFIG_SKB_RECYCLER_PREALLOC +static int __init skb_prealloc_init_list(void) +{ + int i; + struct sk_buff *skb; + + for (i = 0; i < SKB_RECYCLE_MAX_PREALLOC_SKBS; i++) { + skb = __alloc_skb(SKB_RECYCLE_MAX_SIZE + NET_SKB_PAD, + GFP_KERNEL, 0, NUMA_NO_NODE); + if (unlikely(!skb)) + return -ENOMEM; + + skb_reserve(skb, NET_SKB_PAD); + + skb_recycler_consume(skb); + } + return 0; +} +#endif + +/* procfs: count + * Show skb counts + */ +static int proc_skb_count_show(struct seq_file *seq, void *v) +{ + int cpu; + int len; + int total; +#ifdef CONFIG_SKB_RECYCLER_MULTI_CPU + unsigned int i; + unsigned long flags; +#endif + + total = 0; + + for_each_online_cpu(cpu) { + len = skb_queue_len(&per_cpu(recycle_list, cpu)); + seq_printf(seq, "recycle_list[%d]: %d\n", cpu, len); + total += len; + } + +#ifdef CONFIG_SKB_RECYCLER_MULTI_CPU + for_each_online_cpu(cpu) { + len = skb_queue_len(&per_cpu(recycle_spare_list, cpu)); + seq_printf(seq, "recycle_spare_list[%d]: %d\n", cpu, len); + total += len; + } + + for (i = 0; i < SKB_RECYCLE_MAX_SHARED_POOLS; i++) { + spin_lock_irqsave(&glob_recycler.lock, flags); + len = skb_queue_len(&glob_recycler.pool[i]); + spin_unlock_irqrestore(&glob_recycler.lock, flags); + seq_printf(seq, "global_list[%d]: %d\n", i, len); + total += len; + } +#endif + + seq_printf(seq, "total: %d\n", total); + return 0; +} + +static int proc_skb_count_open(struct inode *inode, struct file *file) +{ + return single_open(file, proc_skb_count_show, pde_data(inode)); +} + +static const struct proc_ops proc_skb_count_fops = { + .proc_open = proc_skb_count_open, + .proc_read = seq_read, + .proc_lseek = seq_lseek, + .proc_release = single_release, +}; + +/* procfs: flush + * Flush skbs + */ +static void skb_recycler_flush_task(struct work_struct *work) +{ + unsigned long flags; + struct sk_buff_head *h; + struct sk_buff_head tmp; + struct sk_buff *skb = NULL; + + skb_queue_head_init(&tmp); + + h = &get_cpu_var(recycle_list); + local_irq_save(flags); + skb_queue_splice_init(h, &tmp); + /* + * Update the sum for first skb present in tmp list. + * Since the skb is changed in splice init + */ + skb = skb_peek(&tmp); + skbuff_debugobj_sum_update(skb); + local_irq_restore(flags); + put_cpu_var(recycle_list); + skb_recycler_free_skb(&tmp); + +#ifdef CONFIG_SKB_RECYCLER_MULTI_CPU + h = &get_cpu_var(recycle_spare_list); + local_irq_save(flags); + skb_queue_splice_init(h, &tmp); + skb = skb_peek(&tmp); + skbuff_debugobj_sum_update(skb); + local_irq_restore(flags); + put_cpu_var(recycle_spare_list); + skb_recycler_free_skb(&tmp); +#endif +} + +static ssize_t proc_skb_flush_write(struct file *file, + const char __user *buf, + size_t count, + loff_t *ppos) +{ +#ifdef CONFIG_SKB_RECYCLER_MULTI_CPU + unsigned int i; + unsigned long flags; +#endif + schedule_on_each_cpu(&skb_recycler_flush_task); + +#ifdef CONFIG_SKB_RECYCLER_MULTI_CPU + spin_lock_irqsave(&glob_recycler.lock, flags); + for (i = 0; i < SKB_RECYCLE_MAX_SHARED_POOLS; i++) + skb_recycler_free_skb(&glob_recycler.pool[i]); + glob_recycler.head = 0; + glob_recycler.tail = 0; + spin_unlock_irqrestore(&glob_recycler.lock, flags); +#endif + return count; +} + +static const struct proc_ops proc_skb_flush_fops = { + .proc_write = proc_skb_flush_write, + .proc_open = simple_open, + .proc_lseek = noop_llseek, +}; + +/* procfs: max_skbs + * Show max skbs + */ +static int proc_skb_max_skbs_show(struct seq_file *seq, void *v) +{ + seq_printf(seq, "%d\n", skb_recycle_max_skbs); + return 0; +} + +static int proc_skb_max_skbs_open(struct inode *inode, struct file *file) +{ + return single_open(file, proc_skb_max_skbs_show, pde_data(inode)); +} + +static ssize_t proc_skb_max_skbs_write(struct file *file, + const char __user *buf, + size_t count, + loff_t *ppos) +{ + int ret; + int max; + char buffer[13]; + + memset(buffer, 0, sizeof(buffer)); + if (count > sizeof(buffer) - 1) + count = sizeof(buffer) - 1; + if (copy_from_user(buffer, buf, count) != 0) + return -EFAULT; + ret = kstrtoint(strstrip(buffer), 10, &max); + if (ret == 0 && max >= 0) + skb_recycle_max_skbs = max; + + return count; +} + +static const struct proc_ops proc_skb_max_skbs_fops = { + .proc_open = proc_skb_max_skbs_open, + .proc_read = seq_read, + .proc_write = proc_skb_max_skbs_write, + .proc_release = single_release, +}; + +#ifdef CONFIG_SKB_RECYCLER_MULTI_CPU +/* procfs: max_spare_skbs + * Show max spare skbs + */ +static int proc_skb_max_spare_skbs_show(struct seq_file *seq, void *v) +{ + seq_printf(seq, "%d\n", skb_recycle_spare_max_skbs); + return 0; +} + +static int proc_skb_max_spare_skbs_open(struct inode *inode, struct file *file) +{ + return single_open(file, + proc_skb_max_spare_skbs_show, + pde_data(inode)); +} + +static ssize_t +proc_skb_max_spare_skbs_write(struct file *file, + const char __user *buf, + size_t count, + loff_t *ppos) +{ + int ret; + int max; + char buffer[13]; + + memset(buffer, 0, sizeof(buffer)); + if (count > sizeof(buffer) - 1) + count = sizeof(buffer) - 1; + if (copy_from_user(buffer, buf, count) != 0) + return -EFAULT; + ret = kstrtoint(strstrip(buffer), 10, &max); + if (ret == 0 && max >= 0) + skb_recycle_spare_max_skbs = max; + + return count; +} + +static const struct proc_ops proc_skb_max_spare_skbs_fops = { + .proc_open = proc_skb_max_spare_skbs_open, + .proc_read = seq_read, + .proc_write = proc_skb_max_spare_skbs_write, + .proc_release = single_release, +}; +#endif /* CONFIG_SKB_RECYCLER_MULTI_CPU */ + +/* procfs: skb_recycler_enable + * By default, recycler is disabled for QSDK_512 profile. + * Can be enabled for alder/miami QSDK_512 profile. + */ +static int proc_skb_recycler_enable_show(struct seq_file *seq, void *v) { + seq_printf(seq, "%d\n", skb_recycling_enable); + return 0; +} + +static int proc_skb_recycle_enable_open(struct inode *inode, struct file *file) { + return single_open(file, proc_skb_recycler_enable_show, + pde_data(inode)); +} + +static ssize_t proc_skb_recycle_enable_write(struct file *file, + const char __user *buf, + size_t count, loff_t *ppos) { + int ret; + int enable; + char buffer[13]; + + memset(buffer, 0, sizeof(buffer)); + if (count > sizeof(buffer) - 1) + count = sizeof(buffer) - 1; + if (copy_from_user(buffer, buf, count) != 0) + return -EFAULT; + ret = kstrtoint(strstrip(buffer), 10, &enable); + if (ret == 0 && enable >= 0) + skb_recycling_enable = enable; + + return count; +} + +static const struct proc_ops proc_skb_recycle_enable_fops = { + .proc_open = proc_skb_recycle_enable_open, + .proc_read = seq_read, + .proc_write = proc_skb_recycle_enable_write, + .proc_release = single_release, +}; + +static void skb_recycler_init_procfs(void) +{ + proc_net_skbrecycler = proc_mkdir("skb_recycler", init_net.proc_net); + if (!proc_net_skbrecycler) { + pr_err("cannot create skb_recycle proc dir"); + return; + } + + if (!proc_create("count", + S_IRUGO, + proc_net_skbrecycler, + &proc_skb_count_fops)) + pr_err("cannot create proc net skb_recycle held\n"); + + if (!proc_create("flush", + S_IWUGO, + proc_net_skbrecycler, + &proc_skb_flush_fops)) + pr_err("cannot create proc net skb_recycle flush\n"); + + if (!proc_create("max_skbs", + S_IRUGO | S_IWUGO, + proc_net_skbrecycler, + &proc_skb_max_skbs_fops)) + pr_err("cannot create proc net skb_recycle max_skbs\n"); + +#ifdef CONFIG_SKB_RECYCLER_MULTI_CPU + if (!proc_create("max_spare_skbs", + S_IRUGO | S_IWUGO, + proc_net_skbrecycler, + &proc_skb_max_spare_skbs_fops)) + pr_err("cannot create proc net skb_recycle max_spare_skbs\n"); +#endif + + if (!proc_create("skb_recycler_enable", + S_IRUGO | S_IWUGO, + proc_net_skbrecycler, + &proc_skb_recycle_enable_fops)) + pr_err("cannot create proc net skb_recycle enable\n"); + +} + +void __init skb_recycler_init(void) +{ + int cpu; +#ifdef CONFIG_SKB_RECYCLER_MULTI_CPU + unsigned int i; +#endif + + for_each_possible_cpu(cpu) { + skb_queue_head_init(&per_cpu(recycle_list, cpu)); + } + +#ifdef CONFIG_SKB_RECYCLER_MULTI_CPU + for_each_possible_cpu(cpu) { + skb_queue_head_init(&per_cpu(recycle_spare_list, cpu)); + } + + spin_lock_init(&glob_recycler.lock); + + for (i = 0; i < SKB_RECYCLE_MAX_SHARED_POOLS; i++) + skb_queue_head_init(&glob_recycler.pool[i]); + glob_recycler.head = 0; + glob_recycler.tail = 0; +#endif + +#ifdef CONFIG_SKB_RECYCLER_PREALLOC + if (skb_prealloc_init_list()) + pr_err("Failed to preallocate SKBs for recycle list\n"); +#endif + cpuhp_setup_state_nocalls(CPUHP_SKB_RECYCLER_DEAD, "net/skbuff_recycler:dead:",NULL, skb_cpu_callback); + skbuff_debugobj_register_callback(); + skb_recycler_init_procfs(); +} + +void skb_recycler_print_all_lists(void) +{ + + unsigned long flags; + int cpu; +#ifdef CONFIG_SKB_RECYCLER_MULTI_CPU + int i; + struct sk_buff_head *h; + + cpu = get_cpu(); + spin_lock_irqsave(&glob_recycler.lock, flags); + for (i = 0; i < SKB_RECYCLE_MAX_SHARED_POOLS; i++) + skbuff_debugobj_print_skb_list((&glob_recycler.pool[i])->next, + "Global Pool", -1); + spin_unlock_irqrestore(&glob_recycler.lock, flags); + + preempt_disable(); + local_irq_save(flags); + + h = &per_cpu(recycle_spare_list, cpu); + skbuff_debugobj_print_skb_list(h->next, "Recycle Spare", cpu); + + local_irq_restore(flags); + preempt_enable(); +#endif + + preempt_disable(); + local_irq_save(flags); + h = &per_cpu(recycle_list, cpu); + skbuff_debugobj_print_skb_list(h->next, "Recycle List", cpu); + + local_irq_restore(flags); + preempt_enable(); + +} + +#ifdef CONFIG_SKB_FAST_RECYCLABLE_DEBUG_ENABLE +/** + * consume_skb_can_fast_recycle_debug - Debug API to flag any sanity check + * failures on a fast recycled skb + * @skb: buffer to be checked + * @min_skb_size: minimum skb size allowed + * @max_skb_size: maximum skb size allowed + * + * Returns false with warning message if any of the checks fail + */ +static inline bool consume_skb_can_fast_recycle_debug(const struct sk_buff *skb, + int min_skb_size, int max_skb_size) +{ + if (unlikely(irqs_disabled())) { + WARN(1, "skb_debug: irqs_disabled for skb = 0x%p \n", skb); + return false; + } + if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_DEV_ZEROCOPY)) { + WARN(1, "skb_debug: ZEROCOPY flag set for skb = 0x%p \n", skb); + return false; + } + if (unlikely(skb_is_nonlinear(skb))) { + WARN(1, "skb_debug: non-linear skb = 0x%p \n", skb); + return false; + } + if (unlikely(skb_shinfo(skb)->frag_list)) { + WARN(1, "skb_debug: set frag_list for skb = 0x%p \n", skb); + return false; + } + if (unlikely(skb_shinfo(skb)->nr_frags)) { + WARN(1, "skb_debug: set nr_frags for skb = 0x%p \n", skb); + return false; + } + if (unlikely(skb->fclone != SKB_FCLONE_UNAVAILABLE)) { + WARN(1, "skb_debug: FCLONE available for skb = 0x%p \n", skb); + return false; + } + min_skb_size = SKB_DATA_ALIGN(min_skb_size + NET_SKB_PAD); + if (unlikely(skb_end_pointer(skb) - skb->head < min_skb_size)) { + WARN(1, "skb_debug: invalid min size for skb = 0x%p \n", skb); + return false; + } + max_skb_size = SKB_DATA_ALIGN(max_skb_size + NET_SKB_PAD); + if (unlikely(skb_end_pointer(skb) - skb->head > max_skb_size)) { + WARN(1, "skb_debug: invalid max size for skb = 0x%p \n", skb); + return false; + } + if (unlikely(skb_cloned(skb))) { + WARN(1, "skb_debug: cloned skb = 0x%p \n", skb); + return false; + } + if (unlikely(skb_pfmemalloc(skb))) { + WARN(1, "skb_debug: enabled pfmemalloc for skb = 0x%p \n", skb); + return false; + } + if (skb->_skb_refdst) { + WARN(1, "skb_debug: _skb_refdst flag enabled = 0x%p \n", skb); + return false; + } + if (skb->destructor) { + WARN(1, "skb_debug: destructor flag enabled = 0x%p \n", skb); + return false; + } + if (skb->active_extensions) { + WARN(1, "skb_debug: active_extensions flag enabled = 0x%p \n", + skb); + return false; + } +#if IS_ENABLED(CONFIG_NF_CONNTRACK) + if (skb->_nfct & NFCT_PTRMASK) { + WARN(1, "skb_debug: nfctinfo bits set for skb = 0x%p \n", skb); + return false; + } +#endif + return true; +} + +/** + * check_skb_fast_recyclable - Debug API to flag any sanity check failures + * on a fast recycled skb + * @skb: buffer to be checked + * + * Checks skb recyclability + */ +void check_skb_fast_recyclable(struct sk_buff *skb) +{ + bool check = true; + check = consume_skb_can_fast_recycle_debug(skb, SKB_RECYCLE_MIN_SIZE, SKB_RECYCLE_MAX_SIZE); + if (!check) + BUG_ON(1); +} +EXPORT_SYMBOL(check_skb_fast_recyclable); +#endif diff --git a/target/linux/qualcommax/files/net/core/skbuff_recycle.h b/target/linux/qualcommax/files/net/core/skbuff_recycle.h new file mode 100644 index 0000000000..bfc4692017 --- /dev/null +++ b/target/linux/qualcommax/files/net/core/skbuff_recycle.h @@ -0,0 +1,186 @@ +/* + * Copyright (c) 2013-2017, The Linux Foundation. All rights reserved. + * + * Copyright (c) 2023 Qualcomm Innovation Center, Inc. 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. + * + */ +/* Definitions for the skb recycler functions */ + +#ifndef _LINUX_SKBUFF_RECYCLE_H +#define _LINUX_SKBUFF_RECYCLE_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef CONFIG_NET_CLS_ACT +#include +#endif +#include +#include +#include +#include +#include +#include + +#ifndef CONFIG_SKB_RECYCLE_SIZE +#define CONFIG_SKB_RECYCLE_SIZE 2304 +#endif +#define SKB_RECYCLE_SIZE CONFIG_SKB_RECYCLE_SIZE +#define SKB_RECYCLE_MIN_SIZE SKB_RECYCLE_SIZE +#define SKB_RECYCLE_MAX_SIZE SKB_RECYCLE_SIZE +#define SKB_RECYCLE_MAX_SKBS 1024 + +#define SKB_RECYCLE_SPARE_MAX_SKBS 256 + +#ifdef CONFIG_SKB_RECYCLER_PREALLOC +#define SKB_RECYCLE_MAX_PREALLOC_SKBS CONFIG_SKB_RECYCLE_MAX_PREALLOC_SKBS +#define SKB_RECYCLE_MAX_SHARED_POOLS \ + DIV_ROUND_UP(SKB_RECYCLE_MAX_PREALLOC_SKBS, \ + SKB_RECYCLE_SPARE_MAX_SKBS) +#else +#define SKB_RECYCLE_MAX_SHARED_POOLS 8 +#endif + +#define SKB_RECYCLE_MAX_SHARED_POOLS_MASK \ + (SKB_RECYCLE_MAX_SHARED_POOLS - 1) + +#ifdef CONFIG_SKB_RECYCLER_MULTI_CPU +struct global_recycler { + /* Global circular list which holds the shared skb pools */ + struct sk_buff_head pool[SKB_RECYCLE_MAX_SHARED_POOLS]; + u8 head; /* head of the circular list */ + u8 tail; /* tail of the circular list */ + spinlock_t lock; +}; +#endif + +static __always_inline void zero_struct(void *v, int size) +{ + u32 *s = (u32 *)v; + + /* We assume that size is word aligned; in fact, it's constant */ + WARN_ON((size & 3) != 0); + + /* This looks odd but we "know" size is a constant, and so the + * compiler can fold away all of the conditionals. The compiler is + * pretty smart here, and can fold away the loop, too! + */ + while (size > 0) { + if (size >= 4) + s[0] = 0; + if (size >= 8) + s[1] = 0; + if (size >= 12) + s[2] = 0; + if (size >= 16) + s[3] = 0; + if (size >= 20) + s[4] = 0; + if (size >= 24) + s[5] = 0; + if (size >= 28) + s[6] = 0; + if (size >= 32) + s[7] = 0; + if (size >= 36) + s[8] = 0; + if (size >= 40) + s[9] = 0; + if (size >= 44) + s[10] = 0; + if (size >= 48) + s[11] = 0; + if (size >= 52) + s[12] = 0; + if (size >= 56) + s[13] = 0; + if (size >= 60) + s[14] = 0; + if (size >= 64) + s[15] = 0; + size -= 64; + s += 16; + } +} + +static inline bool consume_skb_can_recycle(const struct sk_buff *skb, + int min_skb_size, int max_skb_size) +{ + if (unlikely(irqs_disabled())) + return false; + + if (unlikely(skb_shinfo(skb)->tx_flags & SKBFL_ZEROCOPY_ENABLE)) + return false; + + if (unlikely(skb->head_frag)) + return false; + + if (unlikely(skb_is_nonlinear(skb))) + return false; + + if (unlikely(skb_shinfo(skb)->frag_list)) + return false; + + if (unlikely(skb_shinfo(skb)->nr_frags)) + return false; + + if (unlikely(skb->fclone != SKB_FCLONE_UNAVAILABLE)) + return false; + + min_skb_size = SKB_DATA_ALIGN(min_skb_size + NET_SKB_PAD); + if (unlikely(skb_end_pointer(skb) - skb->head < min_skb_size)) + return false; + + max_skb_size = SKB_DATA_ALIGN(max_skb_size + NET_SKB_PAD); + if (unlikely(skb_end_pointer(skb) - skb->head > max_skb_size)) + return false; + + if (unlikely(skb_cloned(skb))) + return false; + + if (unlikely(skb_pfmemalloc(skb))) + return false; + + if (skb->active_extensions) + return false; + + return true; +} + +#ifdef CONFIG_SKB_RECYCLER +void __init skb_recycler_init(void); +struct sk_buff *skb_recycler_alloc(struct net_device *dev, unsigned int length, bool reset_skb); +bool skb_recycler_consume(struct sk_buff *skb); +bool skb_recycler_consume_list_fast(struct sk_buff_head *skb_list); +void skb_recycler_print_all_lists(void); +void skb_recycler_clear_flags(struct sk_buff *skb); +#else +#define skb_recycler_init() {} +#define skb_recycler_alloc(dev, len, reset_skb) NULL +#define skb_recycler_consume(skb) false +#define skb_recycler_consume_list_fast(skb_list) false +#define skb_recycler_print_all_lists() false +#define skb_recycler_clear_flags(skb) {} +#endif +#endif diff --git a/target/linux/qualcommax/files/net/netfilter/nf_conntrack_dscpremark_ext.c b/target/linux/qualcommax/files/net/netfilter/nf_conntrack_dscpremark_ext.c new file mode 100644 index 0000000000..678d27ac9d --- /dev/null +++ b/target/linux/qualcommax/files/net/netfilter/nf_conntrack_dscpremark_ext.c @@ -0,0 +1,61 @@ +/* + ************************************************************************** + * Copyright (c) 2014-2015, 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. + ************************************************************************** + */ + +/* DSCP remark handling conntrack extension registration. */ + +#include +#include +#include +#include +#include + +#include +#include +#include + +/* nf_conntrack_dscpremark_ext_set_dscp_rule_valid() + * Set DSCP rule validity flag in the extension + */ +int nf_conntrack_dscpremark_ext_set_dscp_rule_valid(struct nf_conn *ct) +{ + struct nf_ct_dscpremark_ext *ncde; + + ncde = nf_ct_dscpremark_ext_find(ct); + if (!ncde) + return -1; + + ncde->rule_flags = NF_CT_DSCPREMARK_EXT_DSCP_RULE_VALID; + return 0; +} +EXPORT_SYMBOL(nf_conntrack_dscpremark_ext_set_dscp_rule_valid); + +/* nf_conntrack_dscpremark_ext_get_dscp_rule_validity() + * Check if the DSCP rule flag is valid from the extension + */ +int nf_conntrack_dscpremark_ext_get_dscp_rule_validity(struct nf_conn *ct) +{ + struct nf_ct_dscpremark_ext *ncde; + + ncde = nf_ct_dscpremark_ext_find(ct); + if (!ncde) + return NF_CT_DSCPREMARK_EXT_RULE_NOT_VALID; + + if (ncde->rule_flags & NF_CT_DSCPREMARK_EXT_DSCP_RULE_VALID) + return NF_CT_DSCPREMARK_EXT_RULE_VALID; + + return NF_CT_DSCPREMARK_EXT_RULE_NOT_VALID; +} +EXPORT_SYMBOL(nf_conntrack_dscpremark_ext_get_dscp_rule_validity); diff --git a/target/linux/qualcommax/image/ipq50xx.mk b/target/linux/qualcommax/image/ipq50xx.mk index cf404d49cd..94e5ff8064 100644 --- a/target/linux/qualcommax/image/ipq50xx.mk +++ b/target/linux/qualcommax/image/ipq50xx.mk @@ -1,3 +1,17 @@ +define Device/jdcloud_re-cs-03 + $(call Device/FitImage) + $(call Device/EmmcImage) + DEVICE_VENDOR := JDCloud + DEVICE_MODEL := RE-CS-03 + BLOCKSIZE := 128k + KERNEL_SIZE := 6144k + SOC := ipq5018 + DEVICE_DTS_CONFIG := config@mp03.5-c2 + DEVICE_PACKAGES := ipq-wifi-jdcloud_re-cs-03 + IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-rootfs | append-metadata +endef +TARGET_DEVICES += jdcloud_re-cs-03 + define Device/linksys_ipq50xx_mx_base $(call Device/FitImageLzma) DEVICE_VENDOR := Linksys diff --git a/target/linux/qualcommax/image/ipq60xx.mk b/target/linux/qualcommax/image/ipq60xx.mk index c7e0be1181..a1c00ad952 100644 --- a/target/linux/qualcommax/image/ipq60xx.mk +++ b/target/linux/qualcommax/image/ipq60xx.mk @@ -34,11 +34,8 @@ define Device/linksys_mr7350 BLOCKSIZE := 128k PAGESIZE := 2048 IMAGE_SIZE := 75776k - IMAGES += factory.bin - IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | \ - append-ubi | linksys-image type=MR7350 - DEVICE_PACKAGES := ipq-wifi-linksys_mr7350 \ - kmod-leds-pca963x kmod-usb-ledtrig-usbport + IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | linksys-image type=MR7350 + DEVICE_PACKAGES := ipq-wifi-linksys_mr7350 kmod-leds-pca963x kmod-usb-ledtrig-usbport endef TARGET_DEVICES += linksys_mr7350 @@ -75,7 +72,7 @@ define Device/tplink_eap610-outdoor DEVICE_MODEL := EAP610-Outdoor BLOCKSIZE := 128k PAGESIZE := 2048 - SOC := ipq6018 + SOC := ipq6000 DEVICE_PACKAGES := ipq-wifi-tplink_eap610-outdoor IMAGES += web-ui-factory.bin IMAGE/web-ui-factory.bin := append-ubi | tplink-image-2022 @@ -94,9 +91,161 @@ define Device/yuncore_fap650 BLOCKSIZE := 128k PAGESIZE := 2048 DEVICE_DTS_CONFIG := config@cp03-c1 - SOC := ipq6018 + SOC := ipq6000 DEVICE_PACKAGES := ipq-wifi-yuncore_fap650 - IMAGES := factory.ubi factory.ubin sysupgrade.bin - IMAGE/factory.ubin := append-ubi | qsdk-ipq-factory-nand endef TARGET_DEVICES += yuncore_fap650 + +define Device/cmiot_ax18 + $(call Device/FitImage) + $(call Device/UbiFit) + DEVICE_VENDOR := CMIOT + DEVICE_MODEL := AX18 + BLOCKSIZE := 128k + PAGESIZE := 2048 + SOC := ipq6000 + DEVICE_DTS_CONFIG := config@cp03-c1 + DEVICE_PACKAGES := ipq-wifi-cmiot_ax18 +endef +TARGET_DEVICES += cmiot_ax18 + +define Device/glinet_gl-ax1800 + $(call Device/FitImage) + $(call Device/UbiFit) + DEVICE_VENDOR := GL-iNet + DEVICE_MODEL := GL-AX1800 + BLOCKSIZE := 128k + PAGESIZE := 2048 + SOC := ipq6000 + DEVICE_DTS_CONFIG := config@cp03-c1 + DEVICE_PACKAGES := ipq-wifi-glinet_gl-ax1800 +endef +TARGET_DEVICES += glinet_gl-ax1800 + +define Device/glinet_gl-axt1800 + $(call Device/FitImage) + $(call Device/UbiFit) + DEVICE_VENDOR := GL-iNet + DEVICE_MODEL := GL-AXT1800 + BLOCKSIZE := 128k + PAGESIZE := 2048 + SOC := ipq6000 + DEVICE_DTS_CONFIG := config@cp03-c1 + DEVICE_PACKAGES := ipq-wifi-glinet_gl-axt1800 +endef +TARGET_DEVICES += glinet_gl-axt1800 + +define Device/redmi_ax5 + $(call Device/FitImage) + $(call Device/UbiFit) + DEVICE_VENDOR := Redmi + DEVICE_MODEL := AX5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + SOC := ipq6000 + DEVICE_DTS_CONFIG := config@cp03-c1 + DEVICE_PACKAGES := ipq-wifi-redmi_ax5 +endef +TARGET_DEVICES += redmi_ax5 + +define Device/xiaomi_ax1800 + $(call Device/FitImage) + $(call Device/UbiFit) + DEVICE_VENDOR := Xiaomi + DEVICE_MODEL := AX1800 + BLOCKSIZE := 128k + PAGESIZE := 2048 + SOC := ipq6000 + DEVICE_DTS_CONFIG := config@cp03-c1 + DEVICE_PACKAGES := ipq-wifi-xiaomi_ax1800 +endef +TARGET_DEVICES += xiaomi_ax1800 + +define Device/zn_m2 + $(call Device/FitImage) + $(call Device/UbiFit) + DEVICE_VENDOR := ZN + DEVICE_MODEL := M2 + BLOCKSIZE := 128k + PAGESIZE := 2048 + SOC := ipq6000 + DEVICE_DTS_CONFIG := config@cp03-c1 + DEVICE_PACKAGES := ipq-wifi-zn_m2 +endef +TARGET_DEVICES += zn_m2 + +define Device/redmi_ax5-jdcloud + $(call Device/FitImage) + $(call Device/EmmcImage) + DEVICE_VENDOR := Redmi + DEVICE_MODEL := AX5 JDCloud + BLOCKSIZE := 128k + KERNEL_SIZE := 6144k + SOC := ipq6000 + DEVICE_DTS_CONFIG := config@cp03-c1 + DEVICE_PACKAGES := ipq-wifi-redmi_ax5-jdcloud + IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-rootfs | append-metadata +endef +TARGET_DEVICES += redmi_ax5-jdcloud + +define Device/link_nn6000-v1 + $(call Device/FitImage) + $(call Device/EmmcImage) + DEVICE_VENDOR := Link + DEVICE_MODEL := NN6000 v1 + BLOCKSIZE := 128k + KERNEL_SIZE := 6144k + SOC := ipq6000 + DEVICE_DTS_CONFIG := config@cp03-c2 + DEVICE_PACKAGES := ipq-wifi-link_nn6000 + IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-rootfs | append-metadata +endef +TARGET_DEVICES += link_nn6000-v1 + +define Device/link_nn6000-v2 + $(Device/link_nn6000-v1) + DEVICE_MODEL := NN6000 v2 +endef +TARGET_DEVICES += link_nn6000-v2 + +define Device/jdcloud_re-ss-01 + $(call Device/FitImage) + $(call Device/EmmcImage) + DEVICE_VENDOR := JDCloud + DEVICE_MODEL := RE-SS-01 + BLOCKSIZE := 128k + KERNEL_SIZE := 6144k + SOC := ipq6000 + DEVICE_DTS_CONFIG := config@cp03-c2 + DEVICE_PACKAGES := ipq-wifi-jdcloud_re-ss-01 + IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-rootfs | append-metadata +endef +TARGET_DEVICES += jdcloud_re-ss-01 + +define Device/jdcloud_re-cs-02 + $(call Device/FitImage) + $(call Device/EmmcImage) + DEVICE_VENDOR := JDCloud + DEVICE_MODEL := RE-CS-02 + BLOCKSIZE := 128k + KERNEL_SIZE := 6144k + SOC := ipq6010 + DEVICE_DTS_CONFIG := config@cp03-c3 + DEVICE_PACKAGES := ipq-wifi-jdcloud_re-cs-02 ath11k-firmware-qcn9074 kmod-ath11k-pci luci-app-athena-led luci-i18n-athena-led-zh-cn + IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-rootfs | append-metadata +endef +TARGET_DEVICES += jdcloud_re-cs-02 + +define Device/jdcloud_re-cs-07 + $(call Device/FitImage) + $(call Device/EmmcImage) + DEVICE_VENDOR := JDCloud + DEVICE_MODEL := RE-CS-07 + BLOCKSIZE := 128k + KERNEL_SIZE := 6144k + SOC := ipq6010 + DEVICE_DTS_CONFIG := config@cp03-c4 + DEVICE_PACKAGES := -ath11k-firmware-ipq6018 -ath11k-firmware-qcn9074 -kmod-ath11k -kmod-ath11k-ahb -kmod-ath11k-pci -hostapd-common -wpad-openssl + IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-rootfs | append-metadata +endef +TARGET_DEVICES += jdcloud_re-cs-07 diff --git a/target/linux/qualcommax/image/ipq807x.mk b/target/linux/qualcommax/image/ipq807x.mk index c50e2ca9c7..91fb45fe60 100644 --- a/target/linux/qualcommax/image/ipq807x.mk +++ b/target/linux/qualcommax/image/ipq807x.mk @@ -42,7 +42,7 @@ define Device/aliyun_ap8220 PAGESIZE := 2048 DEVICE_DTS_CONFIG := config@ac02 SOC := ipq8071 - DEVICE_PACKAGES := ipq-wifi-aliyun_ap8220 + DEVICE_PACKAGES := ipq-wifi-aliyun_ap8220 kmod-hci-uart kmod-bluetooth kmod-bluetooth-6lowpan endef TARGET_DEVICES += aliyun_ap8220 @@ -55,8 +55,7 @@ define Device/arcadyan_aw1000 PAGESIZE := 4096 DEVICE_DTS_CONFIG := config@hk09 SOC := ipq8072 - DEVICE_PACKAGES := ipq-wifi-arcadyan_aw1000 kmod-spi-gpio \ - kmod-gpio-nxp-74hc164 kmod-usb-serial-option uqmi + DEVICE_PACKAGES := ipq-wifi-arcadyan_aw1000 kmod-spi-gpio kmod-gpio-nxp-74hc164 kmod-usb-serial-option uqmi endef TARGET_DEVICES += arcadyan_aw1000 @@ -109,8 +108,6 @@ define Device/cmcc_rm2-6 PAGESIZE := 2048 DEVICE_DTS_CONFIG := config@ac02 SOC := ipq8070 - IMAGES += factory.bin - IMAGE/factory.bin := append-ubi | qsdk-ipq-factory-nand DEVICE_PACKAGES := ipq-wifi-cmcc_rm2-6 kmod-hwmon-gpiofan endef TARGET_DEVICES += cmcc_rm2-6 @@ -125,7 +122,6 @@ define Device/compex_wpq873 DEVICE_DTS_CONFIG := config@hk09.wpq873 SOC := ipq8072 DEVICE_PACKAGES := ipq-wifi-compex_wpq873 - IMAGE/factory.ubi := append-ubi | qsdk-ipq-factory-nand endef TARGET_DEVICES += compex_wpq873 @@ -152,7 +148,6 @@ define Device/edgecore_eap102 DEVICE_DTS_CONFIG := config@ac02 SOC := ipq8071 DEVICE_PACKAGES := ipq-wifi-edgecore_eap102 - IMAGE/factory.ubi := append-ubi | qsdk-ipq-factory-nand endef TARGET_DEVICES += edgecore_eap102 @@ -193,7 +188,6 @@ define Device/linksys_mx IMAGE_SIZE := 147456k NAND_SIZE := 512m SOC := ipq8072 - IMAGES += factory.bin IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | linksys-image type=$$$$(DEVICE_MODEL) DEVICE_PACKAGES := kmod-leds-pca963x endef @@ -232,16 +226,14 @@ TARGET_DEVICES += linksys_mx4300 define Device/linksys_mx5300 $(call Device/linksys_mx) DEVICE_MODEL := MX5300 - DEVICE_PACKAGES += kmod-rtc-ds1307 ipq-wifi-linksys_mx5300 \ - kmod-ath10k-ct ath10k-firmware-qca9984-ct + DEVICE_PACKAGES += kmod-rtc-ds1307 ipq-wifi-linksys_mx5300 kmod-ath10k ath10k-firmware-qca9984 endef TARGET_DEVICES += linksys_mx5300 define Device/linksys_mx8500 $(call Device/linksys_mx) DEVICE_MODEL := MX8500 - DEVICE_PACKAGES += ipq-wifi-linksys_mx8500 kmod-ath11k-pci \ - ath11k-firmware-qcn9074 kmod-hci-uart + DEVICE_PACKAGES += ipq-wifi-linksys_mx8500 kmod-ath11k-pci ath11k-firmware-qcn9074 kmod-hci-uart endef TARGET_DEVICES += linksys_mx8500 @@ -257,17 +249,11 @@ define Device/netgear_rax120v2 KERNEL_SIZE := 29696k NETGEAR_BOARD_ID := RAX120 NETGEAR_HW_ID := 29765589+0+512+1024+4x4+8x8 - DEVICE_PACKAGES := ipq-wifi-netgear_rax120v2 kmod-spi-gpio \ - kmod-spi-bitbang kmod-gpio-nxp-74hc164 kmod-hwmon-g762 + DEVICE_PACKAGES := ipq-wifi-netgear_rax120v2 kmod-spi-gpio kmod-spi-bitbang kmod-gpio-nxp-74hc164 kmod-hwmon-g762 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) - IMAGES += web-ui-factory.img - IMAGE/web-ui-factory.img := append-image initramfs-uImage.itb | \ - pad-offset $$$$(BLOCKSIZE) 64 | append-uImage-fakehdr filesystem | \ - netgear-dni + IMAGE/web-ui-factory.img := append-image initramfs-uImage.itb | pad-offset $$$$(BLOCKSIZE) 64 | append-uImage-fakehdr filesystem | netgear-dni endif - IMAGE/sysupgrade.bin := append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | \ - append-uImage-fakehdr filesystem | sysupgrade-tar kernel=$$$$@ | \ - append-metadata + IMAGE/sysupgrade.bin := append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | append-uImage-fakehdr filesystem | sysupgrade-tar kernel=$$$$@ | append-metadata endef TARGET_DEVICES += netgear_rax120v2 @@ -309,11 +295,9 @@ define Device/netgear_wax218 SOC := ipq8072 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) ARTIFACTS := web-ui-factory.fit - ARTIFACT/web-ui-factory.fit := append-image initramfs-uImage.itb | \ - ubinize-kernel | qsdk-ipq-factory-nand + ARTIFACT/web-ui-factory.fit := append-image initramfs-uImage.itb | ubinize-kernel | qsdk-ipq-factory-nand endif - DEVICE_PACKAGES := kmod-spi-gpio kmod-spi-bitbang kmod-gpio-nxp-74hc164 \ - ipq-wifi-netgear_wax218 + DEVICE_PACKAGES := kmod-spi-gpio kmod-spi-bitbang kmod-gpio-nxp-74hc164 ipq-wifi-netgear_wax218 endef TARGET_DEVICES += netgear_wax218 @@ -326,8 +310,7 @@ define Device/netgear_wax620 BLOCKSIZE := 128k PAGESIZE := 2048 SOC := ipq8072 - DEVICE_PACKAGES := kmod-spi-gpio kmod-gpio-nxp-74hc164 \ - ipq-wifi-netgear_wax620 + DEVICE_PACKAGES := kmod-spi-gpio kmod-gpio-nxp-74hc164 ipq-wifi-netgear_wax620 endef TARGET_DEVICES += netgear_wax620 @@ -340,7 +323,6 @@ define Device/netgear_wax630 BLOCKSIZE := 128k PAGESIZE := 2048 SOC := ipq8074 - IMAGES += ui-factory.tar IMAGE/ui-factory.tar := append-ubi | wax6xx-netgear-tar DEVICE_PACKAGES := kmod-spi-gpio ipq-wifi-netgear_wax630 endef @@ -353,8 +335,7 @@ define Device/prpl_haze DEVICE_MODEL := Haze DEVICE_DTS_CONFIG := config@hk09 SOC := ipq8072 - DEVICE_PACKAGES := ath11k-firmware-qcn9074 ipq-wifi-prpl_haze kmod-ath11k-pci \ - kmod-fs-f2fs f2fs-tools kmod-leds-lp5562 + DEVICE_PACKAGES := ath11k-firmware-qcn9074 ipq-wifi-prpl_haze kmod-ath11k-pci kmod-leds-lp5562 endef TARGET_DEVICES += prpl_haze @@ -366,7 +347,7 @@ define Device/qnap_301w DEVICE_DTS_CONFIG := config@hk01 KERNEL_SIZE := 16384k SOC := ipq8072 - DEVICE_PACKAGES := kmod-fs-f2fs f2fs-tools ipq-wifi-qnap_301w + DEVICE_PACKAGES := ipq-wifi-qnap_301w endef TARGET_DEVICES += qnap_301w @@ -374,7 +355,7 @@ define Device/redmi_ax6 $(call Device/xiaomi_ax3600) DEVICE_VENDOR := Redmi DEVICE_MODEL := AX6 - DEVICE_PACKAGES := ipq-wifi-redmi_ax6 -kmod-usb3 -kmod-usb-dwc3 -kmod-usb-dwc3-qcom -automount + DEVICE_PACKAGES := ipq-wifi-redmi_ax6 endef TARGET_DEVICES += redmi_ax6 @@ -396,8 +377,7 @@ define Device/spectrum_sax1v1k DEVICE_MODEL := SAX1V1K DEVICE_DTS_CONFIG := config@rt5010w-d187-rev6 SOC := ipq8072 - IMAGES := sysupgrade.bin - DEVICE_PACKAGES := kmod-fs-f2fs f2fs-tools ipq-wifi-spectrum_sax1v1k + DEVICE_PACKAGES := ipq-wifi-spectrum_sax1v1k endef TARGET_DEVICES += spectrum_sax1v1k @@ -440,8 +420,7 @@ define Device/xiaomi_ax3600 DEVICE_DTS_CONFIG := config@ac04 SOC := ipq8071 KERNEL_SIZE := 36608k - DEVICE_PACKAGES := ipq-wifi-xiaomi_ax3600 kmod-ath10k-ct-smallbuffers ath10k-firmware-qca9887-ct \ - -kmod-usb3 -kmod-usb-dwc3 -kmod-usb-dwc3-qcom -automount + DEVICE_PACKAGES := ipq-wifi-xiaomi_ax3600 kmod-ath10k-smallbuffers ath10k-firmware-qca9887 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) ARTIFACTS := initramfs-factory.ubi ARTIFACT/initramfs-factory.ubi := append-image-stage initramfs-uImage.itb | ubinize-kernel @@ -471,8 +450,7 @@ define Device/xiaomi_ax9000 DEVICE_DTS_CONFIG := config@hk14 SOC := ipq8072 KERNEL_SIZE := 57344k - DEVICE_PACKAGES := ipq-wifi-xiaomi_ax9000 kmod-ath11k-pci ath11k-firmware-qcn9074 \ - kmod-ath10k-ct ath10k-firmware-qca9887-ct + DEVICE_PACKAGES := ipq-wifi-xiaomi_ax9000 kmod-ath11k-pci ath11k-firmware-qcn9074 kmod-ath10k ath10k-firmware-qca9887 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) ARTIFACTS := initramfs-factory.ubi ARTIFACT/initramfs-factory.ubi := append-image-stage initramfs-uImage.itb | ubinize-kernel @@ -490,8 +468,6 @@ define Device/yuncore_ax880 DEVICE_DTS_CONFIG := config@hk09 SOC := ipq8072 DEVICE_PACKAGES := ipq-wifi-yuncore_ax880 - IMAGES += factory.bin - IMAGE/factory.bin := append-ubi | qsdk-ipq-factory-nand endef TARGET_DEVICES += yuncore_ax880 @@ -505,8 +481,6 @@ define Device/zbtlink_zbt-z800ax DEVICE_DTS_CONFIG := config@hk09 SOC := ipq8072 DEVICE_PACKAGES := ipq-wifi-zbtlink_zbt-z800ax - IMAGES += factory.bin - IMAGE/factory.bin := append-ubi | qsdk-ipq-factory-nand endef TARGET_DEVICES += zbtlink_zbt-z800ax @@ -544,7 +518,19 @@ define Device/zyxel_nbg7815 DEVICE_MODEL := NBG7815 DEVICE_DTS_CONFIG := config@nbg7815 SOC := ipq8074 - DEVICE_PACKAGES := kmod-fs-f2fs f2fs-tools ipq-wifi-zyxel_nbg7815 kmod-ath11k-pci \ - kmod-hci-uart kmod-hwmon-tmp103 + DEVICE_PACKAGES := ipq-wifi-zyxel_nbg7815 kmod-ath11k-pci kmod-hci-uart kmod-hwmon-tmp103 endef TARGET_DEVICES += zyxel_nbg7815 + +define Device/verizon_cr1000a + $(call Device/FitImage) + $(call Device/EmmcImage) + DEVICE_VENDOR := Verizon + DEVICE_MODEL := CR1000A + BLOCKSIZE := 128k + PAGESIZE := 2048 + DEVICE_DTS_CONFIG := config@verizon_cr1000a + SOC := ipq8072 + DEVICE_PACKAGES := ipq-wifi-verizon_cr1000a kmod-ath11k-pci ath11k-firmware-qcn9074 kmod-phy-aquantia kmod-phy-realtek +endef +TARGET_DEVICES += verizon_cr1000a diff --git a/target/linux/qualcommax/ipq50xx/base-files/etc/board.d/02_network b/target/linux/qualcommax/ipq50xx/base-files/etc/board.d/02_network old mode 100644 new mode 100755 index 6c8574c474..c480623e09 --- a/target/linux/qualcommax/ipq50xx/base-files/etc/board.d/02_network +++ b/target/linux/qualcommax/ipq50xx/base-files/etc/board.d/02_network @@ -7,6 +7,7 @@ ipq50xx_setup_interfaces() { local board="$1" case $board in + jdcloud,re-cs-03|\ linksys,mx2000|\ linksys,mx5500|\ linksys,spnmx56) diff --git a/target/linux/qualcommax/ipq50xx/base-files/etc/hotplug.d/firmware/11-ath11k-caldata b/target/linux/qualcommax/ipq50xx/base-files/etc/hotplug.d/firmware/11-ath11k-caldata old mode 100644 new mode 100755 index 4da2f2809e..cfc7ccc851 --- a/target/linux/qualcommax/ipq50xx/base-files/etc/hotplug.d/firmware/11-ath11k-caldata +++ b/target/linux/qualcommax/ipq50xx/base-files/etc/hotplug.d/firmware/11-ath11k-caldata @@ -9,6 +9,9 @@ board=$(board_name) case "$FIRMWARE" in "ath11k/IPQ5018/hw1.0/cal-ahb-c000000.wifi.bin") case "$board" in + jdcloud,re-cs-03) + caldata_extract_mmc "0:ART" 0x1000 0x20000 + ;; linksys,mx2000|\ linksys,mx5500|\ linksys,spnmx56) @@ -22,6 +25,9 @@ case "$FIRMWARE" in ;; "ath11k/QCN6122/hw1.0/cal-ahb-b00a040.wifi1.bin") case "$board" in + jdcloud,re-cs-03) + caldata_extract_mmc "0:ART" 0x26800 0x20000 + ;; linksys,mx2000) caldata_extract "0:ART" 0x26800 0x20000 label_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr) diff --git a/target/linux/qualcommax/ipq50xx/base-files/lib/upgrade/platform.sh b/target/linux/qualcommax/ipq50xx/base-files/lib/upgrade/platform.sh old mode 100644 new mode 100755 index bafbc7bbdb..f433d1c078 --- a/target/linux/qualcommax/ipq50xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/qualcommax/ipq50xx/base-files/lib/upgrade/platform.sh @@ -72,6 +72,11 @@ platform_check_image() { platform_do_upgrade() { case "$(board_name)" in + jdcloud,re-cs-03) + CI_KERNPART="0:HLOS" + CI_ROOTPART="rootfs" + emmc_do_upgrade "$1" + ;; linksys,mx2000|\ linksys,mx5500|\ linksys,spnmx56) @@ -83,3 +88,11 @@ platform_do_upgrade() { ;; esac } + +platform_copy_config() { + case "$(board_name)" in + jdcloud,re-cs-03) + emmc_copy_config + ;; + esac +} \ No newline at end of file diff --git a/target/linux/qualcommax/ipq60xx/base-files/etc/board.d/01_leds b/target/linux/qualcommax/ipq60xx/base-files/etc/board.d/01_leds old mode 100644 new mode 100755 index a9575eb4ef..e72aaecb9c --- a/target/linux/qualcommax/ipq60xx/base-files/etc/board.d/01_leds +++ b/target/linux/qualcommax/ipq60xx/base-files/etc/board.d/01_leds @@ -7,6 +7,17 @@ board_config_update board=$(board_name) case "$board" in +redmi,ax5|\ +redmi,ax5-jdcloud) + ucidef_set_led_netdev "wan" "WAN" "blue:network" "wan" + ;; +cmiot,ax18|\ +zn,m2) + ucidef_set_led_netdev "wan" "WAN" "blue:wan" "wan" + ucidef_set_led_netdev "wlan2g" "WLAN2G" "blue:wlan2g" "phy1-ap0" + ucidef_set_led_netdev "wlan5g" "WLAN5G" "blue:wlan5g" "phy0-ap0" + ucidef_set_led_netdev "lan" "LAN" "blue:lan" "br-lan" + ;; linksys,mr7350) ucidef_set_led_netdev "lan1-port-link" "LAN1-PORT-LINK" "90000.mdio-1:00:green:lan" "lan1" "link_10 link_100 link_1000" ucidef_set_led_netdev "lan1-port-traffic" "LAN1-PORT-TRAFFIC" "90000.mdio-1:00:orange:lan" "lan1" "tx rx link_10 link_100 link_1000" @@ -20,8 +31,8 @@ linksys,mr7350) ucidef_set_led_netdev "wan-port-traffic" "WAN-PORT-TRAFFIC" "90000.mdio-1:04:orange:wan" "wan" "tx rx link_10 link_100 link_1000" ;; yuncore,fap650) - ucidef_set_led_netdev "wlan5ghz" "WLAN 5GHz LED" "blue:wlan-5ghz" "wlan0" "tx rx" - ucidef_set_led_netdev "wlan2ghz" "WLAN 2.4GHz LED" "green:wlan-2ghz" "wlan1" "tx rx" + ucidef_set_led_netdev "wlan5ghz" "WLAN 5GHz LED" "blue:wlan-5ghz" "wlan0" + ucidef_set_led_netdev "wlan2ghz" "WLAN 2.4GHz LED" "green:wlan-2ghz" "wlan1" ;; esac 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 old mode 100644 new mode 100755 index 44c0ba7049..cc59afaf3a --- a/target/linux/qualcommax/ipq60xx/base-files/etc/board.d/02_network +++ b/target/linux/qualcommax/ipq60xx/base-files/etc/board.d/02_network @@ -11,21 +11,31 @@ ipq60xx_setup_interfaces() local board="$1" case "$board" in + glinet,gl-axt1800|\ + link,nn6000-v1|\ 8devices,mango-dvk) ucidef_set_interfaces_lan_wan "lan1 lan2" "wan" ;; cambiumnetworks,xe3-4) ucidef_set_interface_lan "lan1 lan2" "dhcp" ;; - netgear,wax214) - ucidef_set_interfaces_lan_wan "lan" - ;; - qihoo,360v6) - ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan" - ;; + netgear,wax214|\ tplink,eap610-outdoor) ucidef_set_interface_lan "lan" "dhcp" ;; + cmiot,ax18|\ + jdcloud,re-ss-01|\ + jdcloud,re-cs-07|\ + redmi,ax5|\ + redmi,ax5-jdcloud|\ + xiaomi,ax1800|\ + zn,m2|\ + qihoo,360v6) + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan" + ;; + glinet,gl-ax1800|\ + jdcloud,re-cs-02|\ + link,nn6000-v2|\ linksys,mr7350|\ yuncore,fap650) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan" @@ -43,11 +53,11 @@ ipq60xx_setup_macs() local wan_mac="" local label_mac="" - case $board in + case "$board" in linksys,mr7350) - label_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr) - lan_mac=$label_mac - wan_mac=$label_mac + wan_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr) + lan_mac=$(macaddr_add "$wan_mac" 1) + label_mac=$wan_mac ;; qihoo,360v6) lan_mac=$(mtd_get_mac_ascii factory lanMac) @@ -55,8 +65,8 @@ ipq60xx_setup_macs() label_mac=$lan_mac ;; tplink,eap610-outdoor) - label_mac=$(get_mac_binary /tmp/factory_data/default-mac 0) - lan_mac=$label_mac + lan_mac=$(get_mac_binary /tmp/factory_data/default-mac 0) + label_mac=$lan_mac ;; esac diff --git a/target/linux/qualcommax/ipq60xx/base-files/etc/hotplug.d/firmware/11-ath11k-caldata b/target/linux/qualcommax/ipq60xx/base-files/etc/hotplug.d/firmware/11-ath11k-caldata old mode 100644 new mode 100755 index cf3e400586..bd55ba5fbd --- a/target/linux/qualcommax/ipq60xx/base-files/etc/hotplug.d/firmware/11-ath11k-caldata +++ b/target/linux/qualcommax/ipq60xx/base-files/etc/hotplug.d/firmware/11-ath11k-caldata @@ -15,33 +15,30 @@ case "$FIRMWARE" in cambiumnetworks,xe3-4) caldata_extract "0:ART" 0x1000 0x10000 ;; - linksys,mr7350) + cmiot,ax18|\ + glinet,gl-ax1800|\ + glinet,gl-axt1800|\ + linksys,mr7350|\ + netgear,wax214|\ + qihoo,360v6|\ + redmi,ax5|\ + xiaomi,ax1800|\ + zn,m2) caldata_extract "0:art" 0x1000 0x10000 - addr=$(mtd_get_mac_ascii devinfo hw_mac_addr) - ath11k_patch_mac $(macaddr_add $addr 2) 0 - ath11k_patch_mac $(macaddr_add $addr 1) 1 - ath11k_set_macflag - ;; - netgear,wax214) - caldata_extract "0:art" 0x1000 0x10000 - ;; - qihoo,360v6) - caldata_extract "0:art" 0x1000 0x10000 - label_mac=$(mtd_get_mac_ascii factory lanMac) - ath11k_patch_mac $(macaddr_add $label_mac 3) 0 - ath11k_patch_mac $(macaddr_add $label_mac 2) 1 - ath11k_set_macflag ;; tplink,eap610-outdoor) caldata_from_file "/tmp/factory_data/radio" 0 0x10000 - label_mac=$(get_mac_binary /tmp/factory_data/default-mac 0) - ath11k_patch_mac $label_mac 1 - ath11k_patch_mac $(macaddr_add $label_mac 1) 0 - ath11k_set_macflag ;; yuncore,fap650) caldata_extract "0:art" 0x1000 0x20000 ;; + jdcloud,re-ss-01|\ + jdcloud,re-cs-02|\ + link,nn6000-v1|\ + link,nn6000-v2|\ + redmi,ax5-jdcloud) + caldata_extract_mmc "0:ART" 0x1000 0x10000 + ;; esac ;; "ath11k/QCN9074/hw1.0/cal-pci-0000:01:00.0.bin") @@ -49,6 +46,9 @@ case "$FIRMWARE" in cambiumnetworks,xe3-4) caldata_extract "0:ART" 0x26800 0x20000 ;; + jdcloud,re-cs-02) + caldata_extract_mmc "0:ART" 0x26800 0x20000 + ;; esac ;; *) diff --git a/target/linux/qualcommax/ipq60xx/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/qualcommax/ipq60xx/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac new file mode 100755 index 0000000000..41ce6f413d --- /dev/null +++ b/target/linux/qualcommax/ipq60xx/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -0,0 +1,46 @@ +[ "$ACTION" == "add" ] || exit 0 + +PHYNBR=${DEVPATH##*/phy} + +[ -n $PHYNBR ] || exit 0 + +. /lib/functions.sh +. /lib/functions/system.sh + +board=$(board_name) + +case "$board" in + cmiot,ax18|\ + zn,m2) + label_mac=$(mtd_get_mac_binary "0:art" 0x6) + [ "$PHYNBR" = "0" ] && macaddr_add $label_mac 1 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $label_mac 2 > /sys${DEVPATH}/macaddress + ;; + glinet,gl-ax1800|\ + glinet,gl-axt1800) + label_mac=$(get_mac_label) + [ "$PHYNBR" = "0" ] && macaddr_add $label_mac 2 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $label_mac 3 > /sys${DEVPATH}/macaddress + ;; + link,nn6000-v1|\ + link,nn6000-v2) + label_mac=$(mmc_get_mac_binary "0:ART" 0x18) + [ "$PHYNBR" = "0" ] && macaddr_add $label_mac 1 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $label_mac 2 > /sys${DEVPATH}/macaddress + ;; + linksys,mr7350) + label_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr) + [ "$PHYNBR" = "0" ] && macaddr_add $label_mac 2 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $label_mac 3 > /sys${DEVPATH}/macaddress + ;; + qihoo,360v6) + label_mac=$(mtd_get_mac_ascii factory lanMac) + [ "$PHYNBR" = "0" ] && macaddr_add $label_mac 2 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $label_mac 3 > /sys${DEVPATH}/macaddress + ;; + tplink,eap610-outdoor) + label_mac=$(get_mac_binary /tmp/factory_data/default-mac 0) + [ "$PHYNBR" = "0" ] && macaddr_add $label_mac 1 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $label_mac 2 > /sys${DEVPATH}/macaddress + ;; +esac diff --git a/target/linux/qualcommax/ipq60xx/base-files/lib/preinit/09_mount_factory_data b/target/linux/qualcommax/ipq60xx/base-files/lib/preinit/09_mount_factory_data deleted file mode 100644 index 97608db55d..0000000000 --- a/target/linux/qualcommax/ipq60xx/base-files/lib/preinit/09_mount_factory_data +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -preinit_mount_factory_data() { - local mtd_path - - . /lib/functions.sh - . /lib/functions/system.sh - - case $(board_name) in - tplink,eap610-outdoor) - mtd_path=$(find_mtd_chardev "factory_data") - ubiattach --dev-path="$mtd_path" --devn=1 - mkdir /tmp/factory_data - mount -o ro,noatime -t ubifs ubi1:ubi_factory_data /tmp/factory_data - ;; - esac -} - -boot_hook_add preinit_main preinit_mount_factory_data diff --git a/target/linux/qualcommax/ipq60xx/base-files/lib/upgrade/platform.sh b/target/linux/qualcommax/ipq60xx/base-files/lib/upgrade/platform.sh old mode 100644 new mode 100755 index f9d446ff1f..afda502c4d --- a/target/linux/qualcommax/ipq60xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/qualcommax/ipq60xx/base-files/lib/upgrade/platform.sh @@ -124,6 +124,12 @@ platform_do_upgrade() { fw_setenv auto_recovery yes nand_do_upgrade "$1" ;; + cmiot,ax18|\ + glinet,gl-ax1800|\ + glinet,gl-axt1800|\ + redmi,ax5|\ + xiaomi,ax1800|\ + zn,m2|\ netgear,wax214|\ qihoo,360v6) nand_do_upgrade "$1" @@ -143,8 +149,31 @@ platform_do_upgrade() { fw_setenv owrt_slotactive $((1 - active)) nand_do_upgrade "$1" ;; + jdcloud,re-ss-01|\ + jdcloud,re-cs-02|\ + jdcloud,re-cs-07|\ + link,nn6000-v1|\ + link,nn6000-v2|\ + redmi,ax5-jdcloud) + CI_KERNPART="0:HLOS" + CI_ROOTPART="rootfs" + emmc_do_upgrade "$1" + ;; *) default_do_upgrade "$1" ;; esac } + +platform_copy_config() { + case "$(board_name)" in + jdcloud,re-ss-01|\ + jdcloud,re-cs-02|\ + jdcloud,re-cs-07|\ + link,nn6000-v1|\ + link,nn6000-v2|\ + redmi,ax5-jdcloud) + emmc_copy_config + ;; + esac +} diff --git a/target/linux/qualcommax/ipq60xx/config-default b/target/linux/qualcommax/ipq60xx/config-default index 9ce4b04293..f97468ff6d 100644 --- a/target/linux/qualcommax/ipq60xx/config-default +++ b/target/linux/qualcommax/ipq60xx/config-default @@ -9,3 +9,9 @@ CONFIG_REGULATOR_CPR3=y # CONFIG_REGULATOR_CPR3_NPU is not set CONFIG_REGULATOR_CPR4_APSS=y CONFIG_REGULATOR_QCOM_SMD_RPM=y +CONFIG_THERMAL=y +CONFIG_HWMON=y +CONFIG_GPIOLIB=y +CONFIG_PWM=y +CONFIG_PWM_IPQ=y +CONFIG_PWM_SYSFS=y diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/board.d/01_leds b/target/linux/qualcommax/ipq807x/base-files/etc/board.d/01_leds old mode 100644 new mode 100755 index 571744682e..30c3951c61 --- a/target/linux/qualcommax/ipq807x/base-files/etc/board.d/01_leds +++ b/target/linux/qualcommax/ipq807x/base-files/etc/board.d/01_leds @@ -6,6 +6,11 @@ board_config_update board=$(board_name) case "$board" in +aliyun,ap8220|\ +edgecore,eap102) + ucidef_set_led_netdev "wlan2g" "WLAN2G" "2g:status" "phy1-ap0" + ucidef_set_led_netdev "wlan5g" "WLAN5G" "5g:status" "phy0-ap0" + ;; arcadyan,aw1000) ucidef_set_led_netdev "5g" "5G" "green:5g" "wwan0" ucidef_set_led_netdev "wan" "WAN" "green:internet" "wan" @@ -21,9 +26,6 @@ spectrum,sax1v1k) ucidef_set_led_netdev "wan-port-link-green" "WAN-PORT-LINK-GREEN" "90000.mdio-1:1c:green:wan" "wan" "link_2500" ucidef_set_led_netdev "wan-port-link-yellow" "WAN-PORT-LINK-YELLOW" "90000.mdio-1:1c:yellow:wan" "wan" "tx rx link_10 link_100 link_1000" ;; -edgecore,eap102) - ucidef_set_led_netdev "wan" "WAN" "green:wanpoe" "wan" - ;; netgear,rax120v2) ucidef_set_led_netdev "aqr" "AQR" "white:aqr" "lan5" ;; diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network b/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network old mode 100644 new mode 100755 index 06b8206d36..22465c63d4 --- a/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network +++ b/target/linux/qualcommax/ipq807x/base-files/etc/board.d/02_network @@ -12,7 +12,9 @@ ipq807x_setup_interfaces() case "$board" in aliyun,ap8220|\ + cmcc,rm2-6|\ edgecore,eap102|\ + verizon,cr1000a|\ yuncore,ax880|\ zte,mf269|\ zte,mf269-stock) @@ -30,9 +32,6 @@ ipq807x_setup_interfaces() zbtlink,zbt-z800ax) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan" ;; - cmcc,rm2-6) - ucidef_set_interfaces_lan_wan "lan plc" "wan" - ;; compex,wpq873|\ linksys,homewrk|\ linksys,mx4200v1|\ @@ -46,8 +45,12 @@ ipq807x_setup_interfaces() xiaomi,ax3600-stock) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan" ;; - edimax,cax1800) - ucidef_set_interface_lan "lan" + edimax,cax1800|\ + netgear,wax218|\ + netgear,wax620|\ + tplink,eap620hd-v1|\ + tplink,eap660hd-v1) + ucidef_set_interface_lan "lan" "dhcp" ;; netgear,rax120v2) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan5" "wan" @@ -56,20 +59,12 @@ ipq807x_setup_interfaces() netgear,sxs80) ucidef_set_interfaces_lan_wan "lan2 lan3 lan4 lan5" "wan" ;; - netgear,wax218|\ - netgear,wax620) - ucidef_set_interface_lan "lan" "dhcp" - ;; netgear,wax630) ucidef_set_interface_lan "lan1 lan2" "dhcp" ;; qnap,301w) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 10g-2" "10g-1" ;; - tplink,eap620hd-v1|\ - tplink,eap660hd-v1) - ucidef_set_interface_lan "lan" "dhcp" - ;; zyxel,nbg7815) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 10g" "wan" ;; @@ -89,31 +84,32 @@ ipq807x_setup_macs() case "$board" in aliyun,ap8220) wan_mac=$(mtd_get_mac_text product_info 0x4b) - lan_mac=$(macaddr_add "$wan_mac" 1) - label_mac="$wan_mac" + lan_mac=$(macaddr_add $wan_mac 1) + label_mac=$wan_mac ;; linksys,mx4200v2|\ - linksys,mx4300) - label_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr) - [ "$(mtd_get_mac_ascii u_env eth1addr)" != "$label_mac" ] && wan_mac=$label_mac - [ "$(mtd_get_mac_ascii u_env eth2addr)" != "$label_mac" ] && lan_mac=$label_mac - ;; + linksys,mx4300|\ linksys,mx8500) - label_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr) - lan_mac=$(macaddr_add $label_mac 1) - wan_mac=$label_mac + wan_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr) + lan_mac=$(macaddr_add $wan_mac 1) + label_mac=$wan_mac ;; tplink,eap620hd-v1|\ tplink,eap660hd-v1) - label_mac=$(get_mac_binary /tmp/factory_data/default-mac 0) - lan_mac=$label_mac + lan_mac=$(get_mac_binary /tmp/factory_data/default-mac 0) + label_mac=$lan_mac ;; - zte,mf269) - wan_mac="$(mtd_get_mac_binary mac 0x0)" - [ "$wan_mac" != "00:00:00:00:00:00" ] || wan_mac="$(get_mac_binary "$(find_mtd_chardev mac)" 0x20000)" - lan_mac="$(macaddr_add "$wan_mac" 1)" - label_mac="$wan_mac" - + zte,mf269|\ + zte,mf269-stock) + wan_mac=$(mtd_get_mac_binary mac 0x0) + [ "$wan_mac" != "00:00:00:00:00:00" ] || wan_mac=$(get_mac_binary $(find_mtd_chardev mac) 0x20000) + lan_mac=$(macaddr_add $wan_mac 1) + label_mac=$wan_mac + ;; + verizon,cr1000a) + wan_mac=$(mmc_get_mac_ascii "0:APPSBLENV" baseMAC) + lan_mac=$(macaddr_add "$wan_mac" 1) + label_mac=$wan_mac ;; esac diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/board.d/05_compat-version b/target/linux/qualcommax/ipq807x/base-files/etc/board.d/05_compat-version old mode 100644 new mode 100755 diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata old mode 100644 new mode 100755 diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata b/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata old mode 100644 new mode 100755 index aa1d767692..0256562214 --- a/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata +++ b/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/firmware/11-ath11k-caldata @@ -9,17 +9,11 @@ board=$(board_name) case "$FIRMWARE" in "ath11k/IPQ8074/hw2.0/cal-ahb-c000000.wifi.bin") case "$board" in - aliyun,ap8220) - caldata_extract "0:art" 0x1000 0x20000 - addr=$(mtd_get_mac_text product_info 0x4b) - ath11k_patch_mac $addr 0 - ath11k_patch_mac $(macaddr_add $addr 8) 1 - ath11k_set_macflag - ;; asus,rt-ax89x) CI_UBIPART="UBI_DEV" caldata_extract_ubi "Factory" 0x1000 0x20000 ;; + aliyun,ap8220|\ arcadyan,aw1000|\ buffalo,wxr-5950ax12|\ cmcc,rm2-6|\ @@ -27,8 +21,12 @@ case "$FIRMWARE" in dynalink,dl-wrx36|\ edgecore,eap102|\ edimax,cax1800|\ - linksys,mx5300|\ + netgear,rax120v2|\ + netgear,sxr80|\ + netgear,sxs80|\ netgear,wax218|\ + netgear,wax620|\ + netgear,wax630|\ qnap,301w|\ redmi,ax6|\ redmi,ax6-stock|\ @@ -36,91 +34,29 @@ case "$FIRMWARE" in xiaomi,ax3600-stock|\ xiaomi,ax9000|\ yuncore,ax880|\ + zbtlink,zbt-z800ax|\ zte,mf269|\ - zte,mf269-stock) + zte,mf269-stock|\ + zyxel,nbg7815) caldata_extract "0:art" 0x1000 0x20000 ;; linksys,homewrk|\ linksys,mx4200v1|\ + linksys,mx4200v2|\ + linksys,mx4300|\ + linksys,mx5300|\ linksys,mx8500) caldata_extract "0:art" 0x1000 0x20000 ath11k_remove_regdomain ;; - linksys,mx4200v2) - caldata_extract "0:art" 0x1000 0x20000 - label_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr) - ath11k_patch_mac $(macaddr_add $label_mac 2) 0 - ath11k_patch_mac $(macaddr_add $label_mac 1) 1 - ath11k_patch_mac $(macaddr_add $label_mac 3) 2 - ath11k_remove_regdomain - ath11k_set_macflag - ;; - linksys,mx4300) - caldata_extract "0:art" 0x1000 0x20000 - label_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr) - ath11k_patch_mac $(macaddr_add $label_mac 2) 0 - ath11k_patch_mac $(macaddr_add $label_mac 1) 1 - ath11k_patch_mac $(macaddr_add $label_mac 3) 2 - ath11k_remove_regdomain - ;; - netgear,rax120v2) - caldata_extract "0:art" 0x1000 0x20000 - ath11k_patch_mac $(mtd_get_mac_binary boarddata1 0xc) 0 - ath11k_patch_mac $(mtd_get_mac_binary boarddata1 0x0) 1 - ath11k_patch_mac $(mtd_get_mac_binary boarddata1 0x6) 2 - ath11k_set_macflag - ;; - netgear,sxr80|\ - netgear,sxs80) - caldata_extract "0:art" 0x1000 0x20000 - label_mac=$(get_mac_label) - ath11k_patch_mac $(mtd_get_mac_binary boarddata1 0x0c) 0 - #boarddata1 doesn't have a MAC for the 2G interface - ath11k_patch_mac $(macaddr_setbit_la $label_mac) 1 - ath11k_patch_mac $(mtd_get_mac_binary boarddata1 0x12) 2 - ath11k_set_macflag - ;; - netgear,wax620) - caldata_extract "0:art" 0x1000 0x20000 - label_mac=$(get_mac_label) - ath11k_patch_mac $(macaddr_add $label_mac -31) 1 - ath11k_patch_mac $(macaddr_add $label_mac 1) 0 - ath11k_set_macflag - ;; - netgear,wax630) - caldata_extract "0:art" 0x1000 0x20000 - label_mac=$(get_mac_label) - ath11k_patch_mac $(macaddr_add $label_mac -31) 1 - ath11k_patch_mac $(macaddr_add $label_mac 1) 0 - ath11k_patch_mac $(macaddr_add $label_mac 33) 2 - ath11k_set_macflag - ;; prpl,haze|\ - spectrum,sax1v1k) + spectrum,sax1v1k|\ + verizon,cr1000a) caldata_extract_mmc "0:ART" 0x1000 0x20000 ;; tplink,eap620hd-v1|\ tplink,eap660hd-v1) caldata_from_file "/tmp/factory_data/radio" 0 0x20000 - label_mac=$(get_mac_binary /tmp/factory_data/default-mac 0) - ath11k_patch_mac $label_mac 1 - ath11k_patch_mac $(macaddr_add $label_mac 1) 0 - ath11k_set_macflag - ;; - zbtlink,zbt-z800ax) - caldata_extract "0:art" 0x1000 0x20000 - label_mac=$(get_mac_label) - ath11k_patch_mac $(macaddr_add $label_mac -1) 0 - ath11k_patch_mac $(macaddr_add $label_mac -2) 1 - ath11k_set_macflag - ;; - zyxel,nbg7815) - caldata_extract "0:art" 0x1000 0x20000 - label_mac=$(get_mac_label) - ath11k_patch_mac $(macaddr_add $label_mac 3) 0 - ath11k_patch_mac $(macaddr_add $label_mac 2) 1 - ath11k_patch_mac $(macaddr_add $label_mac 4) 2 - ath11k_set_macflag ;; esac ;; @@ -131,7 +67,8 @@ case "$FIRMWARE" in caldata_extract "0:art" 0x26800 0x20000 ath11k_remove_regdomain ;; - prpl,haze) + prpl,haze|\ + verizon,cr1000a) caldata_extract_mmc "0:ART" 0x26800 0x20000 ;; xiaomi,ax9000) diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/ieee80211/05-wifi-migrate b/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/ieee80211/05-wifi-migrate deleted file mode 100644 index aa0069410a..0000000000 --- a/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/ieee80211/05-wifi-migrate +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/sh - -# This must run before 10-wifi-detect - -[ "${ACTION}" = "add" ] || return - -. /lib/functions.sh - -check_kernel() -{ - local kernel_current=$(uname -r) - if [ ${kernel_current//./} -lt "6600" ]; then - return 1 - fi -} - -do_migrate_radio() -{ - local cfg="$1" from="$2" to="$3" - - config_get path "$cfg" path - - [ "$path" = "$from" ] || return - - uci set "wireless.${cfg}.path=${to}" - WIRELESS_CHANGED=true - - logger -t wifi-migrate "Updated path of wireless.${cfg} from '${from}' to '${to}'" -} - -check_path() -{ - local config - config="$1" - - config_get path "$config" path - - to=${path/soc\//soc@0\/} - - # Checks if kernel version is less than 6.6.0, if it is and the path is using the new format, - # then path should be migrated to the old format. This would allow users on platforms with two partitions, - # to test 6.1 and 6.6. - check_kernel || to=${path/soc@0\//soc\/} - - [ "$path" = "$to" ] || do_migrate_radio "$config" "$path" "$to" -} - -migrate_radio() -{ - config_load wireless - - # Check if there is already a section with the target path: In this case, the system - # was already upgraded to a version without this migration script before; better bail out, - # as we can't be sure we don't break more than we fix. - config_foreach check_path wifi-device -} - -WIRELESS_CHANGED=false - -case "$(board_name)" in -*) - migrate_radio - ;; -esac - -$WIRELESS_CHANGED && uci commit wireless - -exit 0 diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac old mode 100644 new mode 100755 index 90f89ffa40..a1a5c89c15 --- a/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac +++ b/target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -10,23 +10,76 @@ PHYNBR=${DEVPATH##*/phy} board=$(board_name) case "$board" in + aliyun,ap8220) + label_mac=$(mtd_get_mac_text product_info 0x4b) + [ "$PHYNBR" = "0" ] && macaddr_add $label_mac 2 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $label_mac 3 > /sys${DEVPATH}/macaddress + ;; arcadyan,aw1000) - [ "$PHYNBR" = "0" ] && macaddr_add $(get_mac_label) 1 > /sys${DEVPATH}/macaddress - [ "$PHYNBR" = "1" ] && macaddr_add $(get_mac_label) 2 > /sys${DEVPATH}/macaddress + label_mac=$(get_mac_label) + [ "$PHYNBR" = "0" ] && macaddr_add $label_mac 1 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $label_mac 2 > /sys${DEVPATH}/macaddress ;; buffalo,wxr-5950ax12) - [ "$PHYNBR" = "0" ] && macaddr_add $(get_mac_label) 8 > /sys${DEVPATH}/macaddress - [ "$PHYNBR" = "1" ] && macaddr_add $(get_mac_label) 16 > /sys${DEVPATH}/macaddress + label_mac=$(get_mac_label) + [ "$PHYNBR" = "0" ] && macaddr_add $label_mac 8 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $label_mac 16 > /sys${DEVPATH}/macaddress ;; - cmcc,rm2-6|\ - zte,mf269) - [ "$PHYNBR" = "0" ] && macaddr_add $(get_mac_label) 2 > /sys${DEVPATH}/macaddress - [ "$PHYNBR" = "1" ] && macaddr_add $(get_mac_label) 3 > /sys${DEVPATH}/macaddress + cmcc,rm2-6) + label_mac=$(get_mac_label) + [ "$PHYNBR" = "0" ] && macaddr_add $label_mac 2 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $label_mac 3 > /sys${DEVPATH}/macaddress ;; + linksys,mx4200v2|\ + linksys,mx4300|\ + linksys,mx8500) + label_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr) + [ "$PHYNBR" = "0" ] && macaddr_add $label_mac 2 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $label_mac 1 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "2" ] && macaddr_add $label_mac 3 > /sys${DEVPATH}/macaddress + ;; + netgear,rax120v2|\ + netgear,sxr80|\ + netgear,sxs80) + [ "$PHYNBR" = "0" ] && mtd_get_mac_binary boarddata1 0xc > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && mtd_get_mac_binary boarddata1 0x0 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "2" ] && mtd_get_mac_binary boarddata1 0x6 > /sys${DEVPATH}/macaddress + ;; + netgear,wax620|\ + netgear,wax630) + label_mac=$(get_mac_label) + [ "$PHYNBR" = "0" ] && macaddr_add $label_mac 1 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $label_mac -31 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "2" ] && macaddr_add $label_mac 33 > /sys${DEVPATH}/macaddress + ;; + tplink,eap620hd-v1|\ + tplink,eap660hd-v1) + label_mac=$(get_mac_binary /tmp/factory_data/default-mac 0) + [ "$PHYNBR" = "0" ] && macaddr_add $label_mac 1 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $label_mac 2 > /sys${DEVPATH}/macaddress + ;; + verizon,cr1000a) + label_mac=$(mmc_get_mac_ascii "0:APPSBLENV" baseMAC) + [ "$PHYNBR" = "0" ] && macaddr_add $label_mac 2 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $label_mac 3 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "2" ] && macaddr_add $label_mac 4 > /sys${DEVPATH}/macaddress + ;; + zbtlink,zbt-z800ax) + label_mac=$(get_mac_label) + [ "$PHYNBR" = "0" ] && macaddr_add $label_mac -1 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $label_mac -2 > /sys${DEVPATH}/macaddress + ;; + zte,mf269|\ zte,mf269-stock) - mac_addr="$(mtd_get_mac_binary mac 0x0)" - [ "$mac_addr" != "00:00:00:00:00:00" ] || mac_addr="$(get_mac_binary "$(find_mtd_chardev mac)" 0x20000)" - [ "$PHYNBR" = "0" ] && macaddr_add "$mac_addr" 2 > "/sys${DEVPATH}/macaddress" - [ "$PHYNBR" = "1" ] && macaddr_add "$mac_addr" 3 > "/sys${DEVPATH}/macaddress" + label_mac=$(mtd_get_mac_binary mac 0x0) + [ "$label_mac" != "00:00:00:00:00:00" ] || label_mac=$(get_mac_binary $(find_mtd_chardev mac) 0x20000) + [ "$PHYNBR" = "0" ] && macaddr_add $label_mac 2 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $label_mac 3 > /sys${DEVPATH}/macaddress + ;; + zyxel,nbg7815) + label_mac=$(get_mac_label) + [ "$PHYNBR" = "0" ] && macaddr_add $label_mac 3 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $label_mac 2 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "2" ] && macaddr_add $label_mac 4 > /sys${DEVPATH}/macaddress ;; esac diff --git a/target/linux/qualcommax/ipq807x/base-files/etc/init.d/smp_affinity b/target/linux/qualcommax/ipq807x/base-files/etc/init.d/smp_affinity deleted file mode 100755 index ecf88aea09..0000000000 --- a/target/linux/qualcommax/ipq807x/base-files/etc/init.d/smp_affinity +++ /dev/null @@ -1,122 +0,0 @@ -#!/bin/sh /etc/rc.common -###################################################################### -# vim: set ft=bash -# shellcheck disable=2155,3019,3043,3057,3060 -###################################################################### - -START=93 - -PROG=smp_affinity - -log_msg() { - - local irq_name="$1" affinity="$2" irq="$3" - - msg="$(printf "Pinning IRQ($irq) %-24s to CPU ${affinity}\n" "$irq_name")" - - logger -t "$PROG" "$msg" -} - -###################################################################### -### Takes a comma, space separated, or range list of CPU numbers and -## returns a bitmask of CPUs. -## cpus_to_bitmask "0,1,2,3" -> f -## cpus_to_bitmask "0 1 2 3" -> f -## cpus_to_bitmask "0-3" -> f -## cpus_to_bitmask "3" -> 8 -####################################################################### - -cpus_to_bitmask() { - - local bitmask=0 - # shellcheck disable=2048 - for range in ${*//,/ }; do - start="${range%-*}" - end="${range#*-}" - if [ -z "$end" ]; then - bitmask="$((bitmask | 1 << start))" - else - bitmask="$((bitmask | (2 ** (end - start + 1) - 1) << start))" - fi - done - printf '%x' $bitmask -} - -###################################################################### -### Takes a bitmask of CPUs and returns a space separated list of -## CPU numbers. -## bitmask_to_cpus f -> 0 1 2 3 -###################################################################### - -bitmask_to_cpus() { - - [ "${1:0:2}" != "0x" ] && set -- "0x$1" - local bitmask="$(printf '%d' "$1")" - - local cpus="" - for i in $(seq 0 63); do - if [ $((bitmask & 1)) -ne 0 ]; then - cpus="$cpus $i" - fi - bitmask=$((bitmask >> 1)) - done - echo "${cpus# }" -} - -###################################################################### -### Sets the affinity of the IRQs with the given name to the given CPU. -## 1st argument: IRQ name ("reo2host-destination-ring1") (req) -## 2nd argument: CPU number (req) -###################################################################### - -set_affinity() { - - local irq_name="$1" affinity="$2" bitmask irq - awk -v irq_name="$1" '$0 ~ irq_name { print substr($1, 1, length($1)-1); exit }' /proc/interrupts \ - | while read -r irq; do - $enable_log && { - log_msg "$irq_name" "$affinity" "$irq" - } - bitmask=$(cpus_to_bitmask "$affinity") && echo "$bitmask" > "/proc/irq/$irq/smp_affinity" - done -} - -enable_affinity_ipq807x() { - - # assign 4 rx interrupts to each core - set_affinity 'reo2host-destination-ring1' 0 - set_affinity 'reo2host-destination-ring2' 1 - set_affinity 'reo2host-destination-ring3' 2 - set_affinity 'reo2host-destination-ring4' 3 - - # assign 3 tcl completions to last 3 CPUs - set_affinity 'wbm2host-tx-completions-ring1' 1 - set_affinity 'wbm2host-tx-completions-ring2' 2 - set_affinity 'wbm2host-tx-completions-ring3' 3 - - # assign 3 ppdu mac interrupts to last 3 cores - set_affinity 'ppdu-end-interrupts-mac1' 1 - set_affinity 'ppdu-end-interrupts-mac2' 2 - set_affinity 'ppdu-end-interrupts-mac3' 3 - - # assign 4 lan/wan to core 4 - set_affinity 'edma_txcmpl' 3 - set_affinity 'edma_rxfill' 3 - set_affinity 'edma_rxdesc' 3 - set_affinity 'edma_misc' 3 -} - -boot() { - - local enable - - config_load smp_affinity - - config_get_bool enable "general" enable 1 - config_get_bool enable_log "general" enable_log 1 - - [ "$enable" -eq 1 ] && enable=true || enable=false - [ "$enable_log" -eq 1 ] && enable_log=true || enable_log=false - - $enable && enable_affinity_ipq807x -} diff --git a/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh b/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh old mode 100644 new mode 100755 index 997348380a..264bce0fcd --- a/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh +++ b/target/linux/qualcommax/ipq807x/base-files/lib/upgrade/platform.sh @@ -166,13 +166,10 @@ platform_pre_upgrade() { platform_do_upgrade() { case "$(board_name)" in - aliyun,ap8220) - active="$(fw_printenv -n active)" - if [ "$active" -eq "1" ]; then - CI_UBIPART="rootfs1" - else - CI_UBIPART="rootfs2" - fi + aliyun,ap8220|\ + linksys,homewrk|\ + zte,mf269-stock) + CI_UBIPART="rootfs" nand_do_upgrade "$1" ;; arcadyan,aw1000|\ @@ -321,10 +318,6 @@ platform_do_upgrade() { CI_ROOT_UBIPART="rootfs" nand_do_upgrade "$1" ;; - zte,mf269-stock) - CI_UBIPART="rootfs" - nand_do_upgrade "$1" - ;; zyxel,nbg7815) local config_mtdnum="$(find_mtd_index 0:bootconfig)" [ -z "$config_mtdnum" ] && reboot @@ -338,6 +331,21 @@ platform_do_upgrade() { fi emmc_do_upgrade "$1" ;; + verizon,cr1000a) + CI_KERNPART="0:HLOS" + CI_ROOTPART="rootfs" + rootpart=$(find_mmc_part "$CI_ROOTPART") + mmcblk_hlos=$(find_mmc_part "$CI_KERNPART" | sed -e "s/^\/dev\///") + hlos_start=$(cat /sys/class/block/$mmcblk_hlos/start) + hlos_size=$(cat /sys/class/block/$mmcblk_hlos/size) + hlos_start_hex=$(printf "%X\n" "$hlos_start") + hlos_size_hex=$(printf "%X\n" "$hlos_size") + fw_setenv set_custom_bootargs "setenv bootargs console=ttyMSM0,115200n8 root=$rootpart rootwait fstools_ignore_partname=1" + fw_setenv read_hlos_emmc "mmc read 44000000 0x$hlos_start_hex 0x$hlos_size_hex" + fw_setenv setup_and_boot "run set_custom_bootargs;run read_hlos_emmc; bootm 44000000" + fw_setenv bootcmd "run setup_and_boot" + emmc_do_upgrade "$1" + ;; *) default_do_upgrade "$1" ;; @@ -349,7 +357,8 @@ platform_copy_config() { prpl,haze|\ qnap,301w|\ spectrum,sax1v1k|\ - zyxel,nbg7815) + zyxel,nbg7815|\ + verizon,cr1000a) emmc_copy_config ;; esac diff --git a/target/linux/qualcommax/ipq807x/target.mk b/target/linux/qualcommax/ipq807x/target.mk index 22a9b78d59..d5aff23ef7 100644 --- a/target/linux/qualcommax/ipq807x/target.mk +++ b/target/linux/qualcommax/ipq807x/target.mk @@ -1,6 +1,6 @@ SUBTARGET:=ipq807x BOARDNAME:=Qualcomm Atheros IPQ807x -DEFAULT_PACKAGES += kmod-phy-aquantia ath11k-firmware-ipq8074 +DEFAULT_PACKAGES += ath11k-firmware-ipq8074 define Target/Description Build firmware images for Qualcomm Atheros IPQ807x based boards. diff --git a/target/linux/qualcommax/patches-6.6/0054-v6.8-arm64-dts-qcom-ipq6018-use-CPUFreq-NVMEM.patch b/target/linux/qualcommax/patches-6.6/0054-v6.8-arm64-dts-qcom-ipq6018-use-CPUFreq-NVMEM.patch index 6198e24f38..fa73672c34 100644 --- a/target/linux/qualcommax/patches-6.6/0054-v6.8-arm64-dts-qcom-ipq6018-use-CPUFreq-NVMEM.patch +++ b/target/linux/qualcommax/patches-6.6/0054-v6.8-arm64-dts-qcom-ipq6018-use-CPUFreq-NVMEM.patch @@ -46,28 +46,28 @@ Signed-off-by: Bjorn Andersson opp-1320000000 { opp-hz = /bits/ 64 <1320000000>; opp-microvolt = <862500>; -+ opp-supported-hw = <0x3>; ++ opp-supported-hw = <0xf>; clock-latency-ns = <200000>; }; opp-1440000000 { opp-hz = /bits/ 64 <1440000000>; opp-microvolt = <925000>; -+ opp-supported-hw = <0x3>; ++ opp-supported-hw = <0xf>; clock-latency-ns = <200000>; }; opp-1608000000 { opp-hz = /bits/ 64 <1608000000>; opp-microvolt = <987500>; -+ opp-supported-hw = <0x1>; ++ opp-supported-hw = <0xf>; clock-latency-ns = <200000>; }; opp-1800000000 { opp-hz = /bits/ 64 <1800000000>; opp-microvolt = <1062500>; -+ opp-supported-hw = <0x1>; ++ opp-supported-hw = <0xf>; clock-latency-ns = <200000>; }; }; diff --git a/target/linux/qualcommax/patches-6.6/0102-arm64-dts-ipq8074-add-reserved-memory-nodes.patch b/target/linux/qualcommax/patches-6.6/0102-arm64-dts-ipq8074-add-reserved-memory-nodes.patch index 6d97641f65..50e67c4e1f 100644 --- a/target/linux/qualcommax/patches-6.6/0102-arm64-dts-ipq8074-add-reserved-memory-nodes.patch +++ b/target/linux/qualcommax/patches-6.6/0102-arm64-dts-ipq8074-add-reserved-memory-nodes.patch @@ -1,59 +1,48 @@ -From ad2d07f71739351eeea1d8a120c0918e2c4b265f Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Wed, 22 Dec 2021 12:23:34 +0100 -Subject: [PATCH] arm64: dts: ipq8074: add reserved memory nodes - -IPQ8074 has multiple reserved memory ranges, if they are not defined -then weird things tend to happen, board hangs and resets when PCI or -WLAN is used etc. - -So, to avoid all of that add the reserved memory nodes from the downstream -5.4 kernel from QCA. -This is their default layout meant for devices with 1GB of RAM, but -devices with lower ammounts can override the Q6 node. - -Signed-off-by: Robert Marko ---- - arch/arm64/boot/dts/qcom/ipq8074.dtsi | 35 +++++++++++++++++++++++++++ - 1 file changed, 35 insertions(+) - --- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi +++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi -@@ -86,6 +86,16 @@ +@@ -86,6 +86,11 @@ #size-cells = <2>; ranges; -+ nss@40000000 { ++ tzapp@4a400000 { ++ reg = <0x0 0x4a400000 0x0 0x200000>; + no-map; -+ reg = <0x0 0x40000000 0x0 0x01000000>; -+ }; -+ -+ tzapp_region: tzapp@4a400000 { -+ no-map; -+ reg = <0x0 0x4a400000 0x0 0x00200000>; + }; + bootloader@4a600000 { reg = <0x0 0x4a600000 0x0 0x400000>; no-map; -@@ -108,6 +118,21 @@ +@@ -108,6 +113,34 @@ reg = <0x0 0x4ac00000 0x0 0x400000>; no-map; }; + -+ q6_region: wcnss@4b000000 { ++ q6_region: q6@4b000000 { ++ reg = <0x0 0x4b000000 0x0 0x6000000>; + no-map; -+ reg = <0x0 0x4b000000 0x0 0x05f00000>; + }; + -+ q6_etr_region: q6_etr_dump@50f00000 { -+ no-map; -+ reg = <0x0 0x50f00000 0x0 0x00100000>; -+ }; -+ -+ m3_dump_region: m3_dump@51000000 { -+ no-map; ++ q6_etr_region: q6_etr@51000000 { + reg = <0x0 0x51000000 0x0 0x100000>; ++ no-map; ++ }; ++ ++ m3_dump_region: m3_dump@51100000 { ++ reg = <0x0 0x51100000 0x0 0x100000>; ++ no-map; ++ }; ++ ++ ramoops_region: ramoops@51200000 { ++ compatible = "ramoops"; ++ reg = <0x0 0x51200000 0x0 0x100000>; ++ no-map; ++ record-size = <0x4000>; ++ console-size = <0x4000>; ++ }; ++ ++ nss_region: nss@40000000 { ++ reg = <0x0 0x40000000 0x0 0x1000000>; ++ no-map; + }; }; diff --git a/target/linux/qualcommax/patches-6.6/0103-arm64-dts-ipq6018-add-reserved-memory-nodes.patch b/target/linux/qualcommax/patches-6.6/0103-arm64-dts-ipq6018-add-reserved-memory-nodes.patch new file mode 100644 index 0000000000..4d57049ebb --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/0103-arm64-dts-ipq6018-add-reserved-memory-nodes.patch @@ -0,0 +1,57 @@ +--- a/arch/arm64/boot/dts/qcom/ipq6018.dtsi ++++ b/arch/arm64/boot/dts/qcom/ipq6018.dtsi +@@ -189,7 +189,7 @@ + #size-cells = <2>; + ranges; + +- rpm_msg_ram: memory@60000 { ++ rpm_msg_ram: rpm_msg_ram@60000 { + reg = <0x0 0x00060000 0x0 0x6000>; + no-map; + }; +@@ -204,18 +204,41 @@ + no-map; + }; + +- tz: memory@4a600000 { ++ tz: tz@4a600000 { + reg = <0x0 0x4a600000 0x0 0x400000>; + no-map; + }; + +- smem_region: memory@4aa00000 { ++ smem_region: smem@4aa00000 { + reg = <0x0 0x4aa00000 0x0 0x100000>; + no-map; + }; + +- q6_region: memory@4ab00000 { +- reg = <0x0 0x4ab00000 0x0 0x5500000>; ++ q6_region: q6@4ab00000 { ++ reg = <0x0 0x4ab00000 0x0 0x6000000>; ++ no-map; ++ }; ++ ++ q6_etr_region: q6_etr@50b00000 { ++ reg = <0x0 0x50b00000 0x0 0x100000>; ++ no-map; ++ }; ++ ++ m3_dump_region: m3_dump@50c00000 { ++ reg = <0x0 0x50c00000 0x0 0x100000>; ++ no-map; ++ }; ++ ++ ramoops_region: ramoops@50d00000 { ++ compatible = "ramoops"; ++ reg = <0x0 0x50d00000 0x0 0x100000>; ++ no-map; ++ record-size = <0x4000>; ++ console-size = <0x4000>; ++ }; ++ ++ nss_region: nss@40000000 { ++ reg = <0x0 0x40000000 0x0 0x1000000>; + no-map; + }; + }; diff --git a/target/linux/qualcommax/patches-6.6/0110-arm64-dts-qcom-ipq8074-pass-QMP-PCI-PHY-PIPE-clocks-.patch b/target/linux/qualcommax/patches-6.6/0110-arm64-dts-qcom-ipq8074-pass-QMP-PCI-PHY-PIPE-clocks-.patch index 9753fa84d3..07fe39aefd 100644 --- a/target/linux/qualcommax/patches-6.6/0110-arm64-dts-qcom-ipq8074-pass-QMP-PCI-PHY-PIPE-clocks-.patch +++ b/target/linux/qualcommax/patches-6.6/0110-arm64-dts-qcom-ipq8074-pass-QMP-PCI-PHY-PIPE-clocks-.patch @@ -17,7 +17,7 @@ Signed-off-by: Robert Marko --- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi +++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi -@@ -407,8 +407,8 @@ +@@ -415,8 +415,8 @@ gcc: gcc@1800000 { compatible = "qcom,gcc-ipq8074"; reg = <0x01800000 0x80000>; diff --git a/target/linux/qualcommax/patches-6.6/0111-arm64-dts-qcom-ipq8074-use-msi-parent-for-PCIe.patch b/target/linux/qualcommax/patches-6.6/0111-arm64-dts-qcom-ipq8074-use-msi-parent-for-PCIe.patch index fdf7f84b92..8336fdd26d 100644 --- a/target/linux/qualcommax/patches-6.6/0111-arm64-dts-qcom-ipq8074-use-msi-parent-for-PCIe.patch +++ b/target/linux/qualcommax/patches-6.6/0111-arm64-dts-qcom-ipq8074-use-msi-parent-for-PCIe.patch @@ -12,7 +12,7 @@ Signed-off-by: Robert Marko --- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi +++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi -@@ -757,7 +757,7 @@ +@@ -765,7 +765,7 @@ reg = <0x0b000000 0x1000>, <0x0b002000 0x1000>; ranges = <0 0xb00a000 0xffd>; @@ -21,7 +21,7 @@ Signed-off-by: Robert Marko compatible = "arm,gic-v2m-frame"; msi-controller; reg = <0x0 0xffd>; -@@ -870,8 +870,7 @@ +@@ -878,8 +878,7 @@ ranges = <0x81000000 0x0 0x00000000 0x10200000 0x0 0x10000>, /* I/O */ <0x82000000 0x0 0x10220000 0x10220000 0x0 0xfde0000>; /* MEM */ @@ -31,7 +31,7 @@ Signed-off-by: Robert Marko #interrupt-cells = <1>; interrupt-map-mask = <0 0 0 0x7>; interrupt-map = <0 0 0 1 &intc 0 0 142 -@@ -932,8 +931,7 @@ +@@ -940,8 +939,7 @@ ranges = <0x81000000 0x0 0x00000000 0x20200000 0x0 0x10000>, /* I/O */ <0x82000000 0x0 0x20220000 0x20220000 0x0 0xfde0000>; /* MEM */ diff --git a/target/linux/qualcommax/patches-6.6/0120-arm64-dts-qcom-Enable-Q6v5-WCSS-for-ipq8074-SoC.patch b/target/linux/qualcommax/patches-6.6/0120-arm64-dts-qcom-Enable-Q6v5-WCSS-for-ipq8074-SoC.patch index 07f5144108..cf54d66b03 100644 --- a/target/linux/qualcommax/patches-6.6/0120-arm64-dts-qcom-Enable-Q6v5-WCSS-for-ipq8074-SoC.patch +++ b/target/linux/qualcommax/patches-6.6/0120-arm64-dts-qcom-Enable-Q6v5-WCSS-for-ipq8074-SoC.patch @@ -16,7 +16,7 @@ Signed-off-by: Robert Marko --- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi +++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi -@@ -142,6 +142,32 @@ +@@ -150,6 +150,32 @@ }; }; @@ -49,7 +49,7 @@ Signed-off-by: Robert Marko soc: soc@0 { #address-cells = <1>; #size-cells = <1>; -@@ -425,6 +451,11 @@ +@@ -433,6 +459,11 @@ reg = <0x01937000 0x21000>; }; @@ -61,7 +61,7 @@ Signed-off-by: Robert Marko spmi_bus: spmi@200f000 { compatible = "qcom,spmi-pmic-arb"; reg = <0x0200f000 0x001000>, -@@ -972,6 +1003,56 @@ +@@ -980,6 +1011,56 @@ "axi_s_sticky"; status = "disabled"; }; diff --git a/target/linux/qualcommax/patches-6.6/0121-arm64-dts-ipq8074-Add-WLAN-node.patch b/target/linux/qualcommax/patches-6.6/0121-arm64-dts-ipq8074-Add-WLAN-node.patch index ef34c50eca..440b610ba0 100644 --- a/target/linux/qualcommax/patches-6.6/0121-arm64-dts-ipq8074-Add-WLAN-node.patch +++ b/target/linux/qualcommax/patches-6.6/0121-arm64-dts-ipq8074-Add-WLAN-node.patch @@ -15,7 +15,7 @@ Signed-off-by: Robert Marko --- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi +++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi -@@ -1053,6 +1053,117 @@ +@@ -1061,6 +1061,117 @@ }; }; }; diff --git a/target/linux/qualcommax/patches-6.6/0129-arm64-dts-qcom-ipq8074-add-QFPROM-fuses.patch b/target/linux/qualcommax/patches-6.6/0129-arm64-dts-qcom-ipq8074-add-QFPROM-fuses.patch index 7730ad89f5..074f9ae085 100644 --- a/target/linux/qualcommax/patches-6.6/0129-arm64-dts-qcom-ipq8074-add-QFPROM-fuses.patch +++ b/target/linux/qualcommax/patches-6.6/0129-arm64-dts-qcom-ipq8074-add-QFPROM-fuses.patch @@ -12,7 +12,7 @@ Signed-off-by: Robert Marko --- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi +++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi -@@ -349,6 +349,106 @@ +@@ -357,6 +357,106 @@ reg = <0x000a4000 0x2000>; #address-cells = <1>; #size-cells = <1>; diff --git a/target/linux/qualcommax/patches-6.6/0137-arm64-dts-qcom-ipq6018-add-SDHCI-node.patch b/target/linux/qualcommax/patches-6.6/0137-arm64-dts-qcom-ipq6018-add-SDHCI-node.patch index e1296aa792..ccf9b54d0f 100644 --- a/target/linux/qualcommax/patches-6.6/0137-arm64-dts-qcom-ipq6018-add-SDHCI-node.patch +++ b/target/linux/qualcommax/patches-6.6/0137-arm64-dts-qcom-ipq6018-add-SDHCI-node.patch @@ -13,7 +13,7 @@ Tested-by: Robert Marko --- a/arch/arm64/boot/dts/qcom/ipq6018.dtsi +++ b/arch/arm64/boot/dts/qcom/ipq6018.dtsi -@@ -470,6 +470,29 @@ +@@ -493,6 +493,29 @@ }; }; diff --git a/target/linux/qualcommax/patches-6.6/0140-arm64-dts-qcom-ipq6018-add-NSS-reserved-memory.patch b/target/linux/qualcommax/patches-6.6/0140-arm64-dts-qcom-ipq6018-add-NSS-reserved-memory.patch deleted file mode 100644 index 84591c845d..0000000000 --- a/target/linux/qualcommax/patches-6.6/0140-arm64-dts-qcom-ipq6018-add-NSS-reserved-memory.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 7e102b1eb2ca3eff7a6f33ebeab17825e6f70956 Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Mon, 4 Nov 2024 22:01:24 +0100 -Subject: [PATCH] arm64: dts: qcom: ipq6018: add NSS reserved memory - -It seems that despite NSS not being supported in OpenWrt the memory it -usually uses needs to be reserved anyway for stability reasons. - -Signed-off-by: Robert Marko ---- - arch/arm64/boot/dts/qcom/ipq6018.dtsi | 5 +++++ - 1 file changed, 5 insertions(+) - ---- a/arch/arm64/boot/dts/qcom/ipq6018.dtsi -+++ b/arch/arm64/boot/dts/qcom/ipq6018.dtsi -@@ -199,6 +199,11 @@ - no-map; - }; - -+ nss_region: memory@40000000 { -+ reg = <0x0 0x40000000 0x0 0x01000000>; -+ no-map; -+ }; -+ - bootloader@4a100000 { - reg = <0x0 0x4a100000 0x0 0x400000>; - no-map; diff --git a/target/linux/qualcommax/patches-6.6/0143-arm64-dts-qcom-ipq6018-add-pwm-node.patch b/target/linux/qualcommax/patches-6.6/0143-arm64-dts-qcom-ipq6018-add-pwm-node.patch new file mode 100644 index 0000000000..3eafd0fe0e --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/0143-arm64-dts-qcom-ipq6018-add-pwm-node.patch @@ -0,0 +1,188 @@ +@ -1,187 +0,0 @@ +From patchwork Thu Oct 5 16:05:50 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +X-Patchwork-Submitter: Devi Priya +X-Patchwork-Id: 13410402 +Return-Path: +X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on + aws-us-west-2-korg-lkml-1.web.codeaurora.org +Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) + by smtp.lore.kernel.org (Postfix) with ESMTP id 0A952E71D4F + for ; + Thu, 5 Oct 2023 16:21:13 +0000 (UTC) +Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand + id S242309AbjJEQUs (ORCPT + ); + Thu, 5 Oct 2023 12:20:48 -0400 +Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36106 "EHLO + lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org + with ESMTP id S242451AbjJEQSB (ORCPT + ); + Thu, 5 Oct 2023 12:18:01 -0400 +Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com + [205.220.180.131]) + by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6E8D3F025; + Thu, 5 Oct 2023 09:06:56 -0700 (PDT) +Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) + by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id + 395CsRur015464; + Thu, 5 Oct 2023 16:06:41 GMT +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; + h=from : to : cc : + subject : date : message-id : in-reply-to : references : mime-version : + content-type : content-transfer-encoding; s=qcppdkim1; + bh=NSi6brrY0QDAZ3HzHxPaf2hgz27vKeKX8LZRRHNWQWc=; + b=bhnUe3rjnlfJlfGglxvqihGmTNQCt2GnP9fbZBkIsYd0LKp5VGtAlA0IYUcwsiTLb7RK + zTJfR/Llub7KabA70G7qxopCKO0GgBFRq3Xhug1Nnrpr08qcHCrAOSuS16i8viiv5tE/ + Lrn3/Dj59DKIWaBWzrTmI5pK0eLkK0nAPYsTjv03eE8JFtw3M0lHrMQdjuwtpNE7ivjl + CCkahl9YDirevdy+EdeBg17dBw4R3t/qo+3tDzom1COe5knM5DIJI79fxqY1ueFFOM6D + D5mVEsufaOcEQFeLv3y7PtEsPTmWdyN2PCiU8GpFFz6KH8iJLyhzHc6o5pItDDupV1EG uQ== +Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com + [129.46.96.20]) + by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3thn059cyw-1 + (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 + verify=NOT); + Thu, 05 Oct 2023 16:06:41 +0000 +Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com + [10.47.209.196]) + by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id + 395G6dfE025540 + (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 + verify=NOT); + Thu, 5 Oct 2023 16:06:40 GMT +Received: from hu-devipriy-blr.qualcomm.com (10.80.80.8) by + nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server + (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id + 15.2.1118.36; Thu, 5 Oct 2023 09:06:34 -0700 +From: Devi Priya +To: , , + , , , + , , + , , + , , + , , + , +CC: , , + +Subject: [PATCH V15 4/4] arm64: dts: qcom: ipq6018: add pwm node +Date: Thu, 5 Oct 2023 21:35:50 +0530 +Message-ID: <20231005160550.2423075-5-quic_devipriy@quicinc.com> +X-Mailer: git-send-email 2.34.1 +In-Reply-To: <20231005160550.2423075-1-quic_devipriy@quicinc.com> +References: <20231005160550.2423075-1-quic_devipriy@quicinc.com> +MIME-Version: 1.0 +X-Originating-IP: [10.80.80.8] +X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To + nalasex01a.na.qualcomm.com (10.47.209.196) +X-QCInternal: smtphost +X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 + signatures=585085 +X-Proofpoint-ORIG-GUID: pbCgYn8v-0OpdxaoHvIbH76mglvWkJsO +X-Proofpoint-GUID: pbCgYn8v-0OpdxaoHvIbH76mglvWkJsO +X-Proofpoint-Virus-Version: vendor=baseguard + engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 + definitions=2023-10-05_11,2023-10-05_01,2023-05-22_02 +X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 + adultscore=0 suspectscore=0 + impostorscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 priorityscore=1501 + mlxscore=0 malwarescore=0 lowpriorityscore=0 phishscore=0 clxscore=1015 + classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 + definitions=main-2310050125 +Precedence: bulk +List-ID: +X-Mailing-List: linux-arm-msm@vger.kernel.org + +Describe the PWM block on IPQ6018. + +The PWM is in the TCSR area. Make &tcsr "simple-mfd" compatible, and add +&pwm as child of &tcsr. + +Add also ipq6018 specific compatible string. + +Reviewed-by: Krzysztof Kozlowski +Co-developed-by: Baruch Siach +Signed-off-by: Baruch Siach +Signed-off-by: Devi Priya +--- +v15: + + Fixed the indentation of pwm node + +v14: + + Moved ranges just after reg as suggested by Krzysztof + + Picked up the R-b tag + +v13: + + No change + +v12: + + No change + +v11: + + No change + +v10: + + No change + +v9: + + Add 'ranges' property (Rob) + +v8: + + Add size cell to 'reg' (Rob) + +v7: + + Use 'reg' instead of 'offset' (Rob) + + Add qcom,tcsr-ipq6018 (Rob) + + Drop clock-names (Bjorn) + +v6: + + Make the PWM node child of TCSR (Rob Herring) + + Add assigned-clocks/assigned-clock-rates (Uwe Kleine-König) + +v5: Use qcom,pwm-regs for TCSR phandle instead of direct regs + +v3: s/qcom,pwm-ipq6018/qcom,ipq6018-pwm/ (Rob Herring) + + arch/arm64/boot/dts/qcom/ipq6018.dtsi | 15 ++++++++++++++- + 1 file changed, 14 insertions(+), 1 deletion(-) + +--- a/arch/arm64/boot/dts/qcom/ipq6018.dtsi ++++ b/arch/arm64/boot/dts/qcom/ipq6018.dtsi +@@ -453,8 +453,21 @@ + }; + + tcsr: syscon@1937000 { +- compatible = "qcom,tcsr-ipq6018", "syscon"; ++ compatible = "qcom,tcsr-ipq6018", "syscon", "simple-mfd"; + reg = <0x0 0x01937000 0x0 0x21000>; ++ ranges = <0x0 0x0 0x01937000 0x21000>; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ pwm: pwm@a010 { ++ compatible = "qcom,ipq6018-pwm"; ++ reg = <0xa010 0x20>; ++ clocks = <&gcc GCC_ADSS_PWM_CLK>; ++ assigned-clocks = <&gcc GCC_ADSS_PWM_CLK>; ++ assigned-clock-rates = <100000000>; ++ #pwm-cells = <2>; ++ status = "disabled"; ++ }; + }; + + usb2: usb@70f8800 { diff --git a/target/linux/qualcommax/patches-6.6/0170-clk-qcom-ipq8074-Support-added-for-necessary-clocks-and-reset.patch b/target/linux/qualcommax/patches-6.6/0170-clk-qcom-ipq8074-Support-added-for-necessary-clocks-and-reset.patch new file mode 100644 index 0000000000..056fba00aa --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/0170-clk-qcom-ipq8074-Support-added-for-necessary-clocks-and-reset.patch @@ -0,0 +1,311 @@ +From 6504bc9edeb1a2a54d813f4bb5d0267e7bf827f9 Mon Sep 17 00:00:00 2001 +From: Praveenkumar I +Date: Thu, 6 Feb 2020 17:35:42 +0530 +Subject: [PATCH 4/8] clk: ipq8074: Support added for necessary clocks and + reset + +Change-Id: I21a76a44185f766e9b6dcba274392ea8e599718b +Signed-off-by: Praveenkumar I +Signed-off-by: Rajkumar Ayyasamy +--- + drivers/clk/qcom/gcc-ipq8074.c | 238 ++++++++++++++++++- + include/dt-bindings/clock/qcom,gcc-ipq8074.h | 35 ++- + 2 files changed, 258 insertions(+), 15 deletions(-) + +--- a/drivers/clk/qcom/gcc-ipq8074.c ++++ b/drivers/clk/qcom/gcc-ipq8074.c +@@ -48,6 +48,22 @@ enum { + P_UNIPHY2_TX, + }; + ++static const char * const gcc_xo_gpll4_gpll0_gpll6_gpll0_div2[] = { ++ "xo", ++ "gpll4", ++ "gpll0", ++ "gpll6", ++ "gpll0_out_main_div2", ++}; ++ ++static const struct parent_map gcc_xo_gpll4_gpll0_gpll6_gpll0_div2_map[] = { ++ { P_XO, 0 }, ++ { P_GPLL4, 1 }, ++ { P_GPLL0, 2 }, ++ { P_GPLL6, 3 }, ++ { P_GPLL0_DIV2, 4 }, ++}; ++ + static struct clk_alpha_pll gpll0_main = { + .offset = 0x21000, + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT], +@@ -629,6 +645,12 @@ static const struct freq_tbl ftbl_pcie_a + { } + }; + ++struct freq_tbl ftbl_pcie_rchng_clk_src[] = { ++ F(19200000, P_XO, 1, 0, 0), ++ F(100000000, P_GPLL0, 8, 0, 0), ++ { } ++}; ++ + static struct clk_rcg2 pcie0_axi_clk_src = { + .cmd_rcgr = 0x75054, + .freq_tbl = ftbl_pcie_axi_clk_src, +@@ -2031,6 +2053,78 @@ static struct clk_rcg2 gp3_clk_src = { + }, + }; + ++struct freq_tbl ftbl_qdss_tsctr_clk_src[] = { ++ F(160000000, P_GPLL0_DIV2, 2.5, 0, 0), ++ F(320000000, P_GPLL0, 2.5, 0, 0), ++ F(600000000, P_GPLL6, 2, 0, 0), ++ { } ++}; ++ ++struct clk_rcg2 qdss_tsctr_clk_src = { ++ .cmd_rcgr = 0x29064, ++ .freq_tbl = ftbl_qdss_tsctr_clk_src, ++ .hid_width = 5, ++ .parent_map = gcc_xo_gpll4_gpll0_gpll6_gpll0_div2_map, ++ .clkr.hw.init = &(struct clk_init_data){ ++ .name = "qdss_tsctr_clk_src", ++ .parent_names = gcc_xo_gpll4_gpll0_gpll6_gpll0_div2, ++ .num_parents = 5, ++ .ops = &clk_rcg2_ops, ++ }, ++}; ++ ++static struct clk_fixed_factor qdss_dap_sync_clk_src = { ++ .mult = 1, ++ .div = 4, ++ .hw.init = &(struct clk_init_data){ ++ .name = "qdss_dap_sync_clk_src", ++ .parent_names = (const char *[]){ ++ "qdss_tsctr_clk_src" ++ }, ++ .num_parents = 1, ++ .ops = &clk_fixed_factor_ops, ++ }, ++}; ++ ++struct freq_tbl ftbl_qdss_at_clk_src[] = { ++ F(66670000, P_GPLL0_DIV2, 6, 0, 0), ++ F(240000000, P_GPLL6, 6, 0, 0), ++ { } ++}; ++ ++struct clk_rcg2 qdss_at_clk_src = { ++ .cmd_rcgr = 0x2900c, ++ .freq_tbl = ftbl_qdss_at_clk_src, ++ .hid_width = 5, ++ .parent_map = gcc_xo_gpll4_gpll0_gpll6_gpll0_div2_map, ++ .clkr.hw.init = &(struct clk_init_data){ ++ .name = "qdss_at_clk_src", ++ .parent_names = gcc_xo_gpll4_gpll0_gpll6_gpll0_div2, ++ .num_parents = 5, ++ .ops = &clk_rcg2_ops, ++ }, ++}; ++ ++ ++struct freq_tbl ftbl_adss_pwm_clk_src[] = { ++ F(19200000, P_XO, 1, 0, 0), ++ F(200000000, P_GPLL0, 4, 0, 0), ++ { } ++}; ++ ++struct clk_rcg2 adss_pwm_clk_src = { ++ .cmd_rcgr = 0x1c008, ++ .freq_tbl = ftbl_adss_pwm_clk_src, ++ .hid_width = 5, ++ .parent_map = gcc_xo_gpll0_map, ++ .clkr.hw.init = &(struct clk_init_data){ ++ .name = "adss_pwm_clk_src", ++ .parent_data = gcc_xo_gpll0, ++ .num_parents = 2, ++ .ops = &clk_rcg2_ops, ++ }, ++}; ++ + static struct clk_branch gcc_blsp1_ahb_clk = { + .halt_reg = 0x01008, + .clkr = { +@@ -4226,13 +4320,7 @@ static struct clk_branch gcc_gp3_clk = { + }, + }; + +-static const struct freq_tbl ftbl_pcie_rchng_clk_src[] = { +- F(19200000, P_XO, 1, 0, 0), +- F(100000000, P_GPLL0, 8, 0, 0), +- { } +-}; +- +-static struct clk_rcg2 pcie0_rchng_clk_src = { ++struct clk_rcg2 pcie0_rchng_clk_src = { + .cmd_rcgr = 0x75070, + .freq_tbl = ftbl_pcie_rchng_clk_src, + .hid_width = 5, +@@ -4324,6 +4412,114 @@ static const struct alpha_pll_config nss + .alpha_en_mask = BIT(24), + }; + ++static struct clk_branch gcc_snoc_bus_timeout2_ahb_clk = { ++ .halt_reg = 0x4700c, ++ .halt_bit = 31, ++ .clkr = { ++ .enable_reg = 0x4700c, ++ .enable_mask = BIT(0), ++ .hw.init = &(struct clk_init_data){ ++ .name = "gcc_snoc_bus_timeout2_ahb_clk", ++ .parent_names = (const char *[]){ ++ "usb0_master_clk_src" ++ }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT, ++ .ops = &clk_branch2_ops, ++ }, ++ }, ++}; ++ ++static struct clk_branch gcc_snoc_bus_timeout3_ahb_clk = { ++ .halt_reg = 0x47014, ++ .halt_bit = 31, ++ .clkr = { ++ .enable_reg = 0x47014, ++ .enable_mask = BIT(0), ++ .hw.init = &(struct clk_init_data){ ++ .name = "gcc_snoc_bus_timeout3_ahb_clk", ++ .parent_names = (const char *[]){ ++ "usb1_master_clk_src" ++ }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT, ++ .ops = &clk_branch2_ops, ++ }, ++ }, ++}; ++ ++static struct clk_branch gcc_dcc_clk = { ++ .halt_reg = 0x77004, ++ .halt_bit = 31, ++ .clkr = { ++ .enable_reg = 0x77004, ++ .enable_mask = BIT(0), ++ .hw.init = &(struct clk_init_data){ ++ .name = "gcc_dcc_clk", ++ .parent_names = (const char *[]){ ++ "pcnoc_clk_src" ++ }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT, ++ .ops = &clk_branch2_ops, ++ }, ++ }, ++}; ++ ++static struct clk_branch gcc_qdss_at_clk = { ++ .halt_reg = 0x29024, ++ .halt_bit = 31, ++ .clkr = { ++ .enable_reg = 0x29024, ++ .enable_mask = BIT(0), ++ .hw.init = &(struct clk_init_data){ ++ .name = "gcc_qdss_at_clk", ++ .parent_names = (const char *[]){ ++ "qdss_at_clk_src" ++ }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL, ++ .ops = &clk_branch2_ops, ++ }, ++ }, ++}; ++ ++static struct clk_branch gcc_qdss_dap_clk = { ++ .halt_reg = 0x29084, ++ .halt_bit = 31, ++ .clkr = { ++ .enable_reg = 0x29084, ++ .enable_mask = BIT(0), ++ .hw.init = &(struct clk_init_data){ ++ .name = "gcc_qdss_dap_clk", ++ .parent_names = (const char *[]){ ++ "qdss_dap_sync_clk_src" ++ }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT | CLK_IS_CRITICAL, ++ .ops = &clk_branch2_ops, ++ }, ++ }, ++}; ++ ++static struct clk_branch gcc_adss_pwm_clk = { ++ .halt_reg = 0x1c020, ++ .halt_bit = 31, ++ .clkr = { ++ .enable_reg = 0x1c020, ++ .enable_mask = BIT(0), ++ .hw.init = &(struct clk_init_data){ ++ .name = "gcc_adss_pwm_clk", ++ .parent_names = (const char *[]){ ++ "adss_pwm_clk_src" ++ }, ++ .num_parents = 1, ++ .flags = CLK_SET_RATE_PARENT, ++ .ops = &clk_branch2_ops, ++ }, ++ }, ++}; ++ + static struct clk_hw *gcc_ipq8074_hws[] = { + &gpll0_out_main_div2.hw, + &gpll6_out_main_div2.hw, +@@ -4332,6 +4528,7 @@ static struct clk_hw *gcc_ipq8074_hws[] + &gcc_xo_div4_clk_src.hw, + &nss_noc_clk_src.hw, + &nss_ppe_cdiv_clk_src.hw, ++ &qdss_dap_sync_clk_src.hw, + }; + + static struct clk_regmap *gcc_ipq8074_clks[] = { +@@ -4563,6 +4760,15 @@ static struct clk_regmap *gcc_ipq8074_cl + [GCC_PCIE0_RCHNG_CLK] = &gcc_pcie0_rchng_clk.clkr, + [GCC_PCIE0_AXI_S_BRIDGE_CLK] = &gcc_pcie0_axi_s_bridge_clk.clkr, + [GCC_CRYPTO_PPE_CLK] = &gcc_crypto_ppe_clk.clkr, ++ [GCC_SNOC_BUS_TIMEOUT2_AHB_CLK] = &gcc_snoc_bus_timeout2_ahb_clk.clkr, ++ [GCC_SNOC_BUS_TIMEOUT3_AHB_CLK] = &gcc_snoc_bus_timeout3_ahb_clk.clkr, ++ [GCC_DCC_CLK] = &gcc_dcc_clk.clkr, ++ [QDSS_TSCTR_CLK_SRC] = &qdss_tsctr_clk_src.clkr, ++ [QDSS_AT_CLK_SRC] = &qdss_at_clk_src.clkr, ++ [GCC_QDSS_AT_CLK] = &gcc_qdss_at_clk.clkr, ++ [GCC_QDSS_DAP_CLK] = &gcc_qdss_dap_clk.clkr, ++ [ADSS_PWM_CLK_SRC] = &adss_pwm_clk_src.clkr, ++ [GCC_ADSS_PWM_CLK] = &gcc_adss_pwm_clk.clkr, + }; + + static const struct qcom_reset_map gcc_ipq8074_resets[] = { +--- a/include/dt-bindings/clock/qcom,gcc-ipq8074.h ++++ b/include/dt-bindings/clock/qcom,gcc-ipq8074.h +@@ -230,10 +230,19 @@ + #define GCC_GP1_CLK 221 + #define GCC_GP2_CLK 222 + #define GCC_GP3_CLK 223 +-#define GCC_PCIE0_AXI_S_BRIDGE_CLK 224 +-#define GCC_PCIE0_RCHNG_CLK_SRC 225 +-#define GCC_PCIE0_RCHNG_CLK 226 +-#define GCC_CRYPTO_PPE_CLK 227 ++#define GCC_CRYPTO_PPE_CLK 224 ++#define GCC_PCIE0_RCHNG_CLK_SRC 225 ++#define GCC_PCIE0_RCHNG_CLK 226 ++#define GCC_PCIE0_AXI_S_BRIDGE_CLK 227 ++#define GCC_SNOC_BUS_TIMEOUT2_AHB_CLK 228 ++#define GCC_SNOC_BUS_TIMEOUT3_AHB_CLK 229 ++#define GCC_DCC_CLK 230 ++#define ADSS_PWM_CLK_SRC 231 ++#define GCC_ADSS_PWM_CLK 232 ++#define QDSS_TSCTR_CLK_SRC 233 ++#define QDSS_AT_CLK_SRC 234 ++#define GCC_QDSS_AT_CLK 235 ++#define GCC_QDSS_DAP_CLK 236 + + #define GCC_BLSP1_BCR 0 + #define GCC_BLSP1_QUP1_BCR 1 diff --git a/target/linux/qualcommax/patches-6.6/0171-1-clk-qcom-ipq8074-Fix-gcc_snoc_bus_timeout_ahb_clk-offset.patch b/target/linux/qualcommax/patches-6.6/0171-1-clk-qcom-ipq8074-Fix-gcc_snoc_bus_timeout_ahb_clk-offset.patch new file mode 100644 index 0000000000..96577d0eda --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/0171-1-clk-qcom-ipq8074-Fix-gcc_snoc_bus_timeout_ahb_clk-offset.patch @@ -0,0 +1,44 @@ +From 462aa0c53397ec5bf78e3e7f68aa8a3ca300f4ba Mon Sep 17 00:00:00 2001 +From: Selvam Sathappan Periakaruppan +Date: Tue, 24 Mar 2020 19:09:38 +0530 +Subject: [PATCH 5/8] clk: qcom: ipq8074: Fix gcc_snoc_bus_timeout_ahb_clk + offset + +By default, the ipq8074 V2 clks are provided in the gcc driver. +Updating the gcc_snoc_bus_timeout_ahb_clk offsets also as needed +in ipq8074 V2. + +Change-Id: I5a6e98d002f5c3354a804e55dd9ebb1f83f7f974 +Signed-off-by: Selvam Sathappan Periakaruppan +--- + drivers/clk/qcom/gcc-ipq8074.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/drivers/clk/qcom/gcc-ipq8074.c ++++ b/drivers/clk/qcom/gcc-ipq8074.c +@@ -4413,10 +4413,10 @@ static const struct alpha_pll_config nss + }; + + static struct clk_branch gcc_snoc_bus_timeout2_ahb_clk = { +- .halt_reg = 0x4700c, ++ .halt_reg = 0x47014, + .halt_bit = 31, + .clkr = { +- .enable_reg = 0x4700c, ++ .enable_reg = 0x47014, + .enable_mask = BIT(0), + .hw.init = &(struct clk_init_data){ + .name = "gcc_snoc_bus_timeout2_ahb_clk", +@@ -4431,10 +4431,10 @@ static struct clk_branch gcc_snoc_bus_ti + }; + + static struct clk_branch gcc_snoc_bus_timeout3_ahb_clk = { +- .halt_reg = 0x47014, ++ .halt_reg = 0x4701C, + .halt_bit = 31, + .clkr = { +- .enable_reg = 0x47014, ++ .enable_reg = 0x4701C, + .enable_mask = BIT(0), + .hw.init = &(struct clk_init_data){ + .name = "gcc_snoc_bus_timeout3_ahb_clk", diff --git a/target/linux/qualcommax/patches-6.6/0171-2-clk-qcom-ipq8074-Fix-gcc_blsp1_ahb_clk-properties.patch b/target/linux/qualcommax/patches-6.6/0171-2-clk-qcom-ipq8074-Fix-gcc_blsp1_ahb_clk-properties.patch new file mode 100644 index 0000000000..6e4adf685b --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/0171-2-clk-qcom-ipq8074-Fix-gcc_blsp1_ahb_clk-properties.patch @@ -0,0 +1,41 @@ +From 52315bec6ed633b6a71f28b746029602f8bd70b9 Mon Sep 17 00:00:00 2001 +From: Balaji Prakash J +Date: Wed, 22 Apr 2020 20:35:30 +0530 +Subject: [PATCH] clk: ipq8074: fix gcc_blsp1_ahb_clk properties + +All the voting enabled clocks does not support the enable +from CBCR register. So, updated gcc_blsp1_ahb_clk enable +register and mask to enable bit in APCS_CLOCK_BRANCH_ENA_VOTE. + +Also, the voting controlled clocks are shared among multiple +components like APSS, RPM, NSS, TZ, etc. So, turning the +voting off from APSS does not make the clock off if it has +been voted from another component. Added the flag +BRANCH_HALT_VOTED in order to skip checking the clock +disable status. + +This change is referred from the below commits, +1. 246b4fb3af9bd65d8af794aac2f0e7b1ed9cc2dd +2. c8374157d5ae91d3b3e0d513d62808a798b32d3a + +Signed-off-by: Balaji Prakash J +Change-Id: I505cb560b31ad27a02c165fbe13bb33a2fc7d230 +--- + drivers/clk/qcom/gcc-ipq8074.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/drivers/clk/qcom/gcc-ipq8074.c ++++ b/drivers/clk/qcom/gcc-ipq8074.c +@@ -2127,9 +2127,10 @@ struct clk_rcg2 adss_pwm_clk_src = { + + static struct clk_branch gcc_blsp1_ahb_clk = { + .halt_reg = 0x01008, ++ .halt_check = BRANCH_HALT_VOTED, + .clkr = { +- .enable_reg = 0x01008, +- .enable_mask = BIT(0), ++ .enable_reg = 0x0b004, ++ .enable_mask = BIT(10), + .hw.init = &(struct clk_init_data){ + .name = "gcc_blsp1_ahb_clk", + .parent_hws = (const struct clk_hw *[]){ diff --git a/target/linux/qualcommax/patches-6.6/0700-net-phy-qcom-qca807x-fix-condition-for-DAC_DSP_BIAS_CURRENT.patch b/target/linux/qualcommax/patches-6.6/0700-net-phy-qcom-qca807x-fix-condition-for-DAC_DSP_BIAS_CURRENT.patch new file mode 100644 index 0000000000..62a0419c5e --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/0700-net-phy-qcom-qca807x-fix-condition-for-DAC_DSP_BIAS_CURRENT.patch @@ -0,0 +1,20 @@ +From: George Moussalem +Date: Wed, 05 Feb 2025 17:11:37 +0400 +Subject: [PATCH]: net: phy: qcom: qca807x fix condition for DAC_DSP_BIAS_CURRENT + +While setting the DAC value, the wrong boolean value is evaluated to set +the DSP bias current. So let's correct the conditional statement and use +the right boolean value read from the DTS set in the priv. + +Signed-off-by: George Moussalem +--- a/drivers/net/phy/qcom/qca807x.c ++++ b/drivers/net/phy/qcom/qca807x.c +@@ -782,7 +782,7 @@ static int qca807x_config_init(struct ph + control_dac &= ~QCA807X_CONTROL_DAC_MASK; + if (!priv->dac_full_amplitude) + control_dac |= QCA807X_CONTROL_DAC_DSP_AMPLITUDE; +- if (!priv->dac_full_amplitude) ++ if (!priv->dac_full_bias_current) + control_dac |= QCA807X_CONTROL_DAC_DSP_BIAS_CURRENT; + if (!priv->dac_disable_bias_current_tweak) + control_dac |= QCA807X_CONTROL_DAC_BIAS_CURRENT_TWEAK; diff --git a/target/linux/qualcommax/patches-6.6/0906-arm64-dts-qcom-ipq6018-add-wifi-node.patch b/target/linux/qualcommax/patches-6.6/0906-arm64-dts-qcom-ipq6018-add-wifi-node.patch index d41244d65a..2999871daa 100644 --- a/target/linux/qualcommax/patches-6.6/0906-arm64-dts-qcom-ipq6018-add-wifi-node.patch +++ b/target/linux/qualcommax/patches-6.6/0906-arm64-dts-qcom-ipq6018-add-wifi-node.patch @@ -15,7 +15,7 @@ Signed-off-by: Mantas Pucka --- a/arch/arm64/boot/dts/qcom/ipq6018.dtsi +++ b/arch/arm64/boot/dts/qcom/ipq6018.dtsi -@@ -814,6 +814,102 @@ +@@ -845,6 +845,102 @@ }; }; diff --git a/target/linux/qualcommax/patches-6.6/0907-soc-qcom-fix-smp2p-ack-on-ipq6018.patch b/target/linux/qualcommax/patches-6.6/0907-soc-qcom-fix-smp2p-ack-on-ipq6018.patch index 5154aad531..717246b8d1 100644 --- a/target/linux/qualcommax/patches-6.6/0907-soc-qcom-fix-smp2p-ack-on-ipq6018.patch +++ b/target/linux/qualcommax/patches-6.6/0907-soc-qcom-fix-smp2p-ack-on-ipq6018.patch @@ -15,7 +15,7 @@ Signed-off-by: Mantas Pucka --- a/arch/arm64/boot/dts/qcom/ipq6018.dtsi +++ b/arch/arm64/boot/dts/qcom/ipq6018.dtsi -@@ -1162,6 +1162,7 @@ +@@ -1193,6 +1193,7 @@ wcss_smp2p_out: master-kernel { qcom,entry-name = "master-kernel"; diff --git a/target/linux/qualcommax/patches-6.6/0909-arm64-dts-qcom-ipq6018-assign-QDSS_AT-clock-to-wifi-.patch b/target/linux/qualcommax/patches-6.6/0909-arm64-dts-qcom-ipq6018-assign-QDSS_AT-clock-to-wifi-.patch deleted file mode 100644 index 993d60870b..0000000000 --- a/target/linux/qualcommax/patches-6.6/0909-arm64-dts-qcom-ipq6018-assign-QDSS_AT-clock-to-wifi-.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 71f30e25d21ae4981ecef6653a4ba7dfeb80db7b Mon Sep 17 00:00:00 2001 -From: Mantas Pucka -Date: Tue, 23 Jan 2024 11:04:57 +0200 -Subject: [PATCH] arm64: dts: qcom: ipq6018: assign QDSS_AT clock to wifi remoteproc - -IPQ6018 needs to enable QDSS_AT clock when loading wifi firmware, -add it to wifi remoteproc clock list. - -Signed-off-by: Mantas Pucka ---- - arch/arm64/boot/dts/qcom/ipq6018.dtsi | 15 ++++++++------- - 1 file changed, 9 insertions(+), 8 deletions(-) - ---- a/arch/arm64/boot/dts/qcom/ipq6018.dtsi -+++ b/arch/arm64/boot/dts/qcom/ipq6018.dtsi -@@ -935,8 +935,8 @@ - "wcss_reset", - "wcss_q6_reset"; - -- clocks = <&gcc GCC_PRNG_AHB_CLK>; -- clock-names = "prng"; -+ clocks = <&gcc GCC_PRNG_AHB_CLK>, <&gcc GCC_QDSS_AT_CLK>; -+ clock-names = "prng", "qdss" ; - - qcom,halt-regs = <&tcsr 0x18000 0x1b000 0xe000>; - diff --git a/target/linux/qualcommax/patches-6.6/0909-arm64-dts-qcom-ipq6018-assign-some-clock-to-wifi.patch b/target/linux/qualcommax/patches-6.6/0909-arm64-dts-qcom-ipq6018-assign-some-clock-to-wifi.patch new file mode 100644 index 0000000000..e154cc52da --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/0909-arm64-dts-qcom-ipq6018-assign-some-clock-to-wifi.patch @@ -0,0 +1,40 @@ +From 71f30e25d21ae4981ecef6653a4ba7dfeb80db7b Mon Sep 17 00:00:00 2001 +From: JiaY-shi +Date: Tue, 23 Jan 2024 11:04:57 +0200 +Subject: [PATCH] arm64: dts: qcom: ipq6018: assign some clock to wifi remoteproc + +--- + arch/arm64/boot/dts/qcom/ipq6018.dtsi | 15 ++++++++------- + 1 file changed, 9 insertions(+), 8 deletions(-) + +--- a/arch/arm64/boot/dts/qcom/ipq6018.dtsi ++++ b/arch/arm64/boot/dts/qcom/ipq6018.dtsi +@@ -966,8 +966,26 @@ + "wcss_reset", + "wcss_q6_reset"; + +- clocks = <&gcc GCC_PRNG_AHB_CLK>; +- clock-names = "prng"; ++ clocks = <&gcc GCC_PRNG_AHB_CLK>, ++ <&gcc GCC_QDSS_AT_CLK>, ++ <&gcc GCC_SYS_NOC_WCSS_AHB_CLK>, ++ <&gcc GCC_Q6SS_ATBM_CLK>, ++ <&gcc GCC_Q6SS_PCLKDBG_CLK>, ++ <&gcc GCC_Q6_TSCTR_1TO2_CLK>; ++ clock-names = "prng", ++ "qdss", ++ "gcc_sys_noc_wcss_ahb_clk", ++ "gcc_q6ss_atbm_clk", ++ "gcc_q6ss_pclkdbg_clk", ++ "gcc_q6_tsctr_1to2_clk"; ++ assigned-clocks = <&gcc GCC_SYS_NOC_WCSS_AHB_CLK>, ++ <&gcc GCC_Q6SS_PCLKDBG_CLK>, ++ <&gcc GCC_Q6_TSCTR_1TO2_CLK>, ++ <&gcc GCC_Q6SS_ATBM_CLK>; ++ assigned-clock-rates = <133333333>, ++ <600000000>, ++ <600000000>, ++ <240000000>; + + qcom,halt-regs = <&tcsr 0x18000 0x1b000 0xe000>; + diff --git a/target/linux/qualcommax/patches-6.6/0910-arm64-dts-qcom-ipq6018-change-voltage-to-perf-levels.patch b/target/linux/qualcommax/patches-6.6/0910-arm64-dts-qcom-ipq6018-change-voltage-to-perf-levels.patch index 25fa313670..a1601e511a 100644 --- a/target/linux/qualcommax/patches-6.6/0910-arm64-dts-qcom-ipq6018-change-voltage-to-perf-levels.patch +++ b/target/linux/qualcommax/patches-6.6/0910-arm64-dts-qcom-ipq6018-change-voltage-to-perf-levels.patch @@ -1,20 +1,6 @@ -From c67a1814bb1d0df290cf1e3f9c966f04aa41b9b9 Mon Sep 17 00:00:00 2001 -From: Mantas Pucka -Date: Tue, 30 Jan 2024 12:43:56 +0200 -Subject: [PATCH] arm64: dts: qcom: ipq6018: change voltage to perf levels for - CPR4 driver - -Current CPR4 driver requires opp-microvolt to be an abstract -performance level instead of actual voltage level. - -Signed-off-by: Mantas Pucka ---- - arch/arm64/boot/dts/qcom/ipq6018.dtsi | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - --- a/arch/arm64/boot/dts/qcom/ipq6018.dtsi +++ b/arch/arm64/boot/dts/qcom/ipq6018.dtsi -@@ -107,42 +107,42 @@ +@@ -107,42 +107,56 @@ opp-864000000 { opp-hz = /bits/ 64 <864000000>; @@ -28,6 +14,13 @@ Signed-off-by: Mantas Pucka opp-hz = /bits/ 64 <1056000000>; - opp-microvolt = <787500>; + opp-microvolt = <2>; ++ opp-supported-hw = <0xf>; ++ clock-latency-ns = <200000>; ++ }; ++ ++ opp-1200000000 { ++ opp-hz = /bits/ 64 <1200000000>; ++ opp-microvolt = <3>; opp-supported-hw = <0xf>; clock-latency-ns = <200000>; }; @@ -35,31 +28,38 @@ Signed-off-by: Mantas Pucka opp-1320000000 { opp-hz = /bits/ 64 <1320000000>; - opp-microvolt = <862500>; -+ opp-microvolt = <3>; - opp-supported-hw = <0x3>; ++ opp-microvolt = <4>; + opp-supported-hw = <0xf>; clock-latency-ns = <200000>; }; opp-1440000000 { opp-hz = /bits/ 64 <1440000000>; - opp-microvolt = <925000>; -+ opp-microvolt = <4>; - opp-supported-hw = <0x3>; ++ opp-microvolt = <5>; ++ opp-supported-hw = <0xf>; ++ clock-latency-ns = <200000>; ++ }; ++ ++ opp-1512000000 { ++ opp-hz = /bits/ 64 <1512000000>; ++ opp-microvolt = <6>; + opp-supported-hw = <0xf>; clock-latency-ns = <200000>; }; opp-1608000000 { opp-hz = /bits/ 64 <1608000000>; - opp-microvolt = <987500>; -+ opp-microvolt = <5>; - opp-supported-hw = <0x1>; ++ opp-microvolt = <7>; + opp-supported-hw = <0xf>; clock-latency-ns = <200000>; }; opp-1800000000 { opp-hz = /bits/ 64 <1800000000>; - opp-microvolt = <1062500>; -+ opp-microvolt = <6>; - opp-supported-hw = <0x1>; ++ opp-microvolt = <8>; + opp-supported-hw = <0xf>; clock-latency-ns = <200000>; }; diff --git a/target/linux/qualcommax/patches-6.6/0980-2-Revert-crypto-api-disallow-identical-driver-names.patch b/target/linux/qualcommax/patches-6.6/0980-2-Revert-crypto-api-disallow-identical-driver-names.patch new file mode 100644 index 0000000000..3f7f58dfee --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/0980-2-Revert-crypto-api-disallow-identical-driver-names.patch @@ -0,0 +1,10 @@ +--- a/crypto/algapi.c ++++ b/crypto/algapi.c +@@ -341,7 +341,6 @@ __crypto_register_alg(struct crypto_alg + } + + if (!strcmp(q->cra_driver_name, alg->cra_name) || +- !strcmp(q->cra_driver_name, alg->cra_driver_name) || + !strcmp(q->cra_name, alg->cra_driver_name)) + goto err; + } diff --git a/target/linux/qualcommax/patches-6.6/0980-3-mtd-silence-UBI-NAND-warnings.patch b/target/linux/qualcommax/patches-6.6/0980-3-mtd-silence-UBI-NAND-warnings.patch new file mode 100644 index 0000000000..646e683dc8 --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/0980-3-mtd-silence-UBI-NAND-warnings.patch @@ -0,0 +1,13 @@ +--- a/drivers/mtd/mtdblock.c ++++ b/drivers/mtd/mtdblock.c +@@ -261,10 +261,6 @@ static int mtdblock_open(struct mtd_blkt + return 0; + } + +- if (mtd_type_is_nand(mbd->mtd)) +- pr_warn_ratelimited("%s: MTD device '%s' is NAND, please consider using UBI block devices instead.\n", +- mbd->tr->name, mbd->mtd->name); +- + /* OK, it's not open. Create cache info for it */ + mtdblk->count = 1; + mutex_init(&mtdblk->cache_mutex); diff --git a/target/linux/qualcommax/patches-6.6/0981-1-qca-skb_recycler-support.patch b/target/linux/qualcommax/patches-6.6/0981-1-qca-skb_recycler-support.patch new file mode 100644 index 0000000000..a3ddef8d23 --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/0981-1-qca-skb_recycler-support.patch @@ -0,0 +1,431 @@ +--- a/include/linux/cpuhotplug.h ++++ b/include/linux/cpuhotplug.h +@@ -94,6 +94,7 @@ enum cpuhp_state { + CPUHP_RADIX_DEAD, + CPUHP_PAGE_ALLOC, + CPUHP_NET_DEV_DEAD, ++ CPUHP_SKB_RECYCLER_DEAD, + CPUHP_PCI_XGENE_DEAD, + CPUHP_IOMMU_IOVA_DEAD, + CPUHP_LUSTRE_CFS_DEAD, +--- a/include/linux/skbuff.h ++++ b/include/linux/skbuff.h +@@ -1055,6 +1055,10 @@ struct sk_buff { + /* only useable after checking ->active_extensions != 0 */ + struct skb_ext *extensions; + #endif ++ ++#ifdef CONFIG_DEBUG_OBJECTS_SKBUFF ++ void *free_addr; ++#endif + }; + + /* if you move pkt_type around you also must adapt those constants */ +@@ -1240,7 +1244,7 @@ static inline void kfree_skb_list(struct + kfree_skb_list_reason(segs, SKB_DROP_REASON_NOT_SPECIFIED); + } + +-#ifdef CONFIG_TRACEPOINTS ++#ifdef CONFIG_SKB_RECYCLER + void consume_skb(struct sk_buff *skb); + #else + static inline void consume_skb(struct sk_buff *skb) +@@ -1252,6 +1256,9 @@ static inline void consume_skb(struct sk + void __consume_stateless_skb(struct sk_buff *skb); + void __kfree_skb(struct sk_buff *skb); + extern struct kmem_cache *skbuff_cache; ++extern void kfree_skbmem(struct sk_buff *skb); ++extern void skb_release_data(struct sk_buff *skb, enum skb_drop_reason reason, ++ bool napi_safe); + + void kfree_skb_partial(struct sk_buff *skb, bool head_stolen); + bool skb_try_coalesce(struct sk_buff *to, struct sk_buff *from, +--- a/net/Kconfig ++++ b/net/Kconfig +@@ -369,6 +369,52 @@ config NET_FLOW_LIMIT + with many clients some protection against DoS by a single (spoofed) + flow that greatly exceeds average workload. + ++config SKB_RECYCLER ++ bool "Generic skb recycling" ++ default y ++ help ++ SKB_RECYCLER is used to implement RX-to-RX skb recycling. ++ This config enables the recycling scheme for bridging and ++ routing workloads. It can reduce skbuff freeing or ++ reallocation overhead. ++ ++config SKB_RECYCLER_MULTI_CPU ++ bool "Cross-CPU recycling for CPU-locked workloads" ++ depends on SMP && SKB_RECYCLER ++ default n ++ ++config SKB_RECYCLER_PREALLOC ++ bool "Enable preallocation of SKBs" ++ depends on SKB_RECYCLER ++ default n ++ help ++ Preallocates SKBs in recycling lists and the number of ++ SKBs are configured through CONFIG_SKB_RECYCLE_MAX_PREALLOC_SKBS. ++ This needs SKB_RECYCLER to be enabled. ++ The number of preallocated SKBs can be passed using ++ SKB_RECYCLE_MAX_PREALLOC_SKBS. ++ ++config SKB_RECYCLE_MAX_PREALLOC_SKBS ++ int "Number of SKBs to be preallocated" ++ depends on SKB_RECYCLER_PREALLOC ++ default 16384 ++ help ++ Number of SKBs each of 4K size to be preallocated for recycling ++ ++config SKB_RECYCLE_SIZE ++ int "Minimum size for a recycled buffer" ++ depends on SKB_RECYCLER ++ default 2304 ++ help ++ Minimum size for a recycled buffer ++ ++config ALLOC_SKB_PAGE_FRAG_DISABLE ++ bool "Disable page fragment based skbuff payload allocations" ++ depends on !SKB_RECYCLER ++ default n ++ help ++ Disable page fragment based allocations for skbuff payloads. ++ + menu "Network testing" + + config NET_PKTGEN +--- a/net/core/Makefile ++++ b/net/core/Makefile +@@ -41,3 +41,4 @@ obj-$(CONFIG_NET_SOCK_MSG) += skmsg.o + obj-$(CONFIG_BPF_SYSCALL) += sock_map.o + obj-$(CONFIG_BPF_SYSCALL) += bpf_sk_storage.o + obj-$(CONFIG_OF) += of_net.o ++obj-$(CONFIG_SKB_RECYCLER) += skbuff_recycle.o +--- a/net/core/dev.c ++++ b/net/core/dev.c +@@ -6052,10 +6052,16 @@ static int process_backlog(struct napi_s + + napi->weight = READ_ONCE(dev_rx_weight); + while (again) { +- struct sk_buff *skb; ++ struct sk_buff *skb, *next_skb; + + while ((skb = __skb_dequeue(&sd->process_queue))) { + rcu_read_lock(); ++ ++ next_skb = skb_peek(&sd->process_queue); ++ if (likely(next_skb)) { ++ prefetch(next_skb->data); ++ } ++ + __netif_receive_skb(skb); + rcu_read_unlock(); + input_queue_head_incr(sd); +--- a/net/core/skbuff.c ++++ b/net/core/skbuff.c +@@ -87,6 +87,38 @@ + + #include "dev.h" + #include "sock_destructor.h" ++#include "skbuff_recycle.h" ++ ++struct kmem_cache *skb_data_cache; ++struct kmem_cache *skb_data_cache_2100; ++/* ++ * For low memory profile, NSS_SKB_FIXED_SIZE_2K is enabled and ++ * CONFIG_SKB_RECYCLER is disabled. For premium and enterprise profile ++ * CONFIG_SKB_RECYCLER is enabled and NSS_SKB_FIXED_SIZE_2K is disabled. ++ * Irrespective of NSS_SKB_FIXED_SIZE_2K enabled/disabled, the ++ * CONFIG_SKB_RECYCLER and __LP64__ determines the value of SKB_DATA_CACHE_SIZE ++ */ ++#if defined(CONFIG_SKB_RECYCLER) ++/* ++ * Both caches are kept same size when recycler is enabled so that all the ++ * skbs could be recycled. 2688 for 64bit arch, 2624 for 32bit arch ++ */ ++#define SKB_DATA_CACHE_SIZE (SKB_DATA_ALIGN(SKB_RECYCLE_SIZE + NET_SKB_PAD) + SKB_DATA_ALIGN(sizeof(struct skb_shared_info))) ++#define SKB_DATA_CACHE_SIZE_2100 SKB_DATA_CACHE_SIZE ++#else ++/* ++ * DATA CACHE is 2368 for 64bit arch, 2176 for 32bit arch ++ * DATA_CACHE_2100 is 2496 for 64bit arch, 2432 for 32bit arch ++ * DATA CACHE size should always be lesser than that of DATA_CACHE_2100 size ++ */ ++#if defined(__LP64__) ++#define SKB_DATA_CACHE_SIZE (SKB_DATA_ALIGN(1984 + NET_SKB_PAD) + SKB_DATA_ALIGN(sizeof(struct skb_shared_info))) ++#define SKB_DATA_CACHE_SIZE_2100 (SKB_DATA_ALIGN(2100 + NET_SKB_PAD) + SKB_DATA_ALIGN(sizeof(struct skb_shared_info))) ++#else ++#define SKB_DATA_CACHE_SIZE (SKB_DATA_ALIGN(1856 + NET_SKB_PAD) + SKB_DATA_ALIGN(sizeof(struct skb_shared_info))) ++#define SKB_DATA_CACHE_SIZE_2100 (SKB_DATA_ALIGN(2100 + NET_SKB_PAD) + SKB_DATA_ALIGN(sizeof(struct skb_shared_info))) ++#endif ++#endif + + struct kmem_cache *skbuff_cache __ro_after_init; + static struct kmem_cache *skbuff_fclone_cache __ro_after_init; +@@ -551,21 +583,31 @@ static void *kmalloc_reserve(unsigned in + bool *pfmemalloc) + { + bool ret_pfmemalloc = false; +- size_t obj_size; ++ unsigned int obj_size = *size; + void *obj; + + obj_size = SKB_HEAD_ALIGN(*size); +- if (obj_size <= SKB_SMALL_HEAD_CACHE_SIZE && +- !(flags & KMALLOC_NOT_NORMAL_BITS)) { +- obj = kmem_cache_alloc_node(skb_small_head_cache, +- flags | __GFP_NOMEMALLOC | __GFP_NOWARN, +- node); +- *size = SKB_SMALL_HEAD_CACHE_SIZE; ++ if (obj_size > SZ_2K && obj_size <= SKB_DATA_CACHE_SIZE) { ++ obj = kmem_cache_alloc_node(skb_data_cache, ++ flags | __GFP_NOMEMALLOC | __GFP_NOWARN, ++ node); ++ *size = SKB_DATA_CACHE_SIZE; ++ if (obj || !(gfp_pfmemalloc_allowed(flags))) ++ goto out; ++ /* Try again but now we are using pfmemalloc reserves */ ++ ret_pfmemalloc = true; ++ obj = kmem_cache_alloc_node(skb_data_cache, flags, node); ++ goto out; ++ } else if (obj_size > SZ_2K && obj_size <= SKB_DATA_CACHE_SIZE_2100) { ++ obj = kmem_cache_alloc_node(skb_data_cache_2100, ++ flags | __GFP_NOMEMALLOC | __GFP_NOWARN, ++ node); ++ *size = SKB_DATA_CACHE_SIZE_2100; + if (obj || !(gfp_pfmemalloc_allowed(flags))) + goto out; + /* Try again but now we are using pfmemalloc reserves */ + ret_pfmemalloc = true; +- obj = kmem_cache_alloc_node(skb_small_head_cache, flags, node); ++ obj = kmem_cache_alloc_node(skb_data_cache_2100, flags, node); + goto out; + } + +@@ -648,10 +690,12 @@ struct sk_buff *__alloc_skb(unsigned int + * aligned memory blocks, unless SLUB/SLAB debug is enabled. + * Both skb->head and skb_shared_info are cache line aligned. + */ ++ size = SKB_DATA_ALIGN(size); ++ size += SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); + data = kmalloc_reserve(&size, gfp_mask, node, &pfmemalloc); + if (unlikely(!data)) + goto nodata; +- /* kmalloc_size_roundup() might give us more room than requested. ++ /* kmalloc_reserve(size) might give us more room than requested. + * Put skb_shared_info exactly at the end of allocated zone, + * to allow max possible filling before reallocation. + */ +@@ -686,7 +730,7 @@ EXPORT_SYMBOL(__alloc_skb); + /** + * __netdev_alloc_skb - allocate an skbuff for rx on a specific device + * @dev: network device to receive on +- * @len: length to allocate ++ * @length: length to allocate + * @gfp_mask: get_free_pages mask, passed to alloc_skb + * + * Allocate a new &sk_buff and assign it a usage count of one. The +@@ -696,29 +740,53 @@ EXPORT_SYMBOL(__alloc_skb); + * + * %NULL is returned if there is no free memory. + */ +-struct sk_buff *__netdev_alloc_skb(struct net_device *dev, unsigned int len, +- gfp_t gfp_mask) ++struct sk_buff *__netdev_alloc_skb(struct net_device *dev, ++ unsigned int length, gfp_t gfp_mask) + { +- struct page_frag_cache *nc; + struct sk_buff *skb; ++ unsigned int len = length; ++ ++#ifdef CONFIG_SKB_RECYCLER ++ skb = skb_recycler_alloc(dev, length, true); ++ if (likely(skb)) ++ return skb; ++ ++ len = SKB_RECYCLE_SIZE; ++ if (unlikely(length > SKB_RECYCLE_SIZE)) ++ len = length; ++ ++ skb = __alloc_skb(len + NET_SKB_PAD, gfp_mask, ++ SKB_ALLOC_RX, NUMA_NO_NODE); ++ if (!skb) ++ goto skb_fail; ++ goto skb_success; ++#else ++ struct page_frag_cache *nc; + bool pfmemalloc; ++ bool page_frag_alloc_enable = true; + void *data; + + len += NET_SKB_PAD; + ++ ++#ifdef CONFIG_ALLOC_SKB_PAGE_FRAG_DISABLE ++ page_frag_alloc_enable = false; ++#endif + /* If requested length is either too small or too big, + * we use kmalloc() for skb->head allocation. + */ + if (len <= SKB_WITH_OVERHEAD(1024) || + len > SKB_WITH_OVERHEAD(PAGE_SIZE) || +- (gfp_mask & (__GFP_DIRECT_RECLAIM | GFP_DMA))) { ++ (gfp_mask & (__GFP_DIRECT_RECLAIM | GFP_DMA)) || ++ !page_frag_alloc_enable) { + skb = __alloc_skb(len, gfp_mask, SKB_ALLOC_RX, NUMA_NO_NODE); + if (!skb) + goto skb_fail; + goto skb_success; + } + +- len = SKB_HEAD_ALIGN(len); ++ len += SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); ++ len = SKB_DATA_ALIGN(len); + + if (sk_memalloc_socks()) + gfp_mask |= __GFP_MEMALLOC; +@@ -747,6 +815,7 @@ struct sk_buff *__netdev_alloc_skb(struc + if (pfmemalloc) + skb->pfmemalloc = 1; + skb->head_frag = 1; ++#endif + + skb_success: + skb_reserve(skb, NET_SKB_PAD); +@@ -817,7 +886,8 @@ struct sk_buff *__napi_alloc_skb(struct + data = page_frag_alloc_1k(&nc->page_small, gfp_mask); + pfmemalloc = NAPI_SMALL_PAGE_PFMEMALLOC(nc->page_small); + } else { +- len = SKB_HEAD_ALIGN(len); ++ len += SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); ++ len = SKB_DATA_ALIGN(len); + + data = page_frag_alloc(&nc->page, len, gfp_mask); + pfmemalloc = nc->page.pfmemalloc; +@@ -975,7 +1045,7 @@ static void skb_free_head(struct sk_buff + } + } + +-static void skb_release_data(struct sk_buff *skb, enum skb_drop_reason reason, ++void skb_release_data(struct sk_buff *skb, enum skb_drop_reason reason, + bool napi_safe) + { + struct skb_shared_info *shinfo = skb_shinfo(skb); +@@ -1018,7 +1088,7 @@ exit: + /* + * Free an skbuff by memory without cleaning the state. + */ +-static void kfree_skbmem(struct sk_buff *skb) ++void kfree_skbmem(struct sk_buff *skb) + { + struct sk_buff_fclones *fclones; + +@@ -1282,7 +1352,6 @@ void skb_tx_error(struct sk_buff *skb) + } + EXPORT_SYMBOL(skb_tx_error); + +-#ifdef CONFIG_TRACEPOINTS + /** + * consume_skb - free an skbuff + * @skb: buffer to free +@@ -1291,13 +1360,48 @@ EXPORT_SYMBOL(skb_tx_error); + * Functions identically to kfree_skb, but kfree_skb assumes that the frame + * is being dropped after a failure and notes that + */ ++#ifdef CONFIG_SKB_RECYCLER + void consume_skb(struct sk_buff *skb) + { + if (!skb_unref(skb)) + return; ++ prefetch(&skb->destructor); ++ ++ /*Tian: Not sure if we need to continue using this since ++ * since unref does the work in 5.4 ++ */ ++ ++ /* ++ if (likely(atomic_read(&skb->users) == 1)) ++ smp_rmb(); ++ else if (likely(!atomic_dec_and_test(&skb->users))) ++ return; ++ */ + ++ /* If possible we'd like to recycle any skb rather than just free it, ++ * but in order to do that we need to release any head state too. ++ * We don't want to do this later because we'll be in a pre-emption ++ * disabled state. ++ */ ++ skb_release_head_state(skb); ++ ++ /* Can we recycle this skb? If we can then it will be much faster ++ * for us to recycle this one later than to allocate a new one ++ * from scratch. ++ */ ++ if (likely(skb->head) && likely(skb_recycler_consume(skb))) ++ return; ++ ++#ifdef CONFIG_TRACEPOINTS + trace_consume_skb(skb, __builtin_return_address(0)); +- __kfree_skb(skb); ++#endif ++ /* We're not recycling so now we need to do the rest of what we would ++ * have done in __kfree_skb (above and beyond the skb_release_head_state ++ * that we already did). ++ */ ++ if (likely(skb->head)) ++ skb_release_data(skb, SKB_CONSUMED, false); ++ kfree_skbmem(skb); + } + EXPORT_SYMBOL(consume_skb); + #endif +@@ -2112,6 +2216,8 @@ int pskb_expand_head(struct sk_buff *skb + + if (skb_pfmemalloc(skb)) + gfp_mask |= __GFP_MEMALLOC; ++ size = SKB_DATA_ALIGN(size); ++ size += SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); + + data = kmalloc_reserve(&size, gfp_mask, NUMA_NO_NODE, NULL); + if (!data) +@@ -4865,6 +4971,14 @@ static void skb_extensions_init(void) {} + + void __init skb_init(void) + { ++ skb_data_cache = kmem_cache_create_usercopy("skb_data_cache", ++ SKB_DATA_CACHE_SIZE, ++ 0, SLAB_PANIC, 0, SKB_DATA_CACHE_SIZE, ++ NULL); ++ skb_data_cache_2100 = kmem_cache_create_usercopy("skb_data_cache_2100", ++ SKB_DATA_CACHE_SIZE_2100, ++ 0, SLAB_PANIC, 0, SKB_DATA_CACHE_SIZE, ++ NULL); + skbuff_cache = kmem_cache_create_usercopy("skbuff_head_cache", + sizeof(struct sk_buff), + 0, +@@ -4890,6 +5004,7 @@ void __init skb_init(void) + SKB_SMALL_HEAD_HEADROOM, + NULL); + skb_extensions_init(); ++ skb_recycler_init(); + } + + static int +@@ -6393,6 +6508,8 @@ static int pskb_carve_inside_header(stru + if (skb_pfmemalloc(skb)) + gfp_mask |= __GFP_MEMALLOC; + ++ size = SKB_DATA_ALIGN(size); ++ size += SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); + data = kmalloc_reserve(&size, gfp_mask, NUMA_NO_NODE, NULL); + if (!data) + return -ENOMEM; +@@ -6509,6 +6626,8 @@ static int pskb_carve_inside_nonlinear(s + if (skb_pfmemalloc(skb)) + gfp_mask |= __GFP_MEMALLOC; + ++ size = SKB_DATA_ALIGN(size); ++ size += SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); + data = kmalloc_reserve(&size, gfp_mask, NUMA_NO_NODE, NULL); + if (!data) + return -ENOMEM; diff --git a/target/linux/qualcommax/patches-6.6/1001-arm64-dts-qcom-ipq6018-add-QUP5-I2C-node.patch b/target/linux/qualcommax/patches-6.6/1001-arm64-dts-qcom-ipq6018-add-QUP5-I2C-node.patch new file mode 100644 index 0000000000..9cce479ad9 --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/1001-arm64-dts-qcom-ipq6018-add-QUP5-I2C-node.patch @@ -0,0 +1,108 @@ +From patchwork Wed Nov 15 15:38:53 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Isaev Ruslan +X-Patchwork-Id: 13456969 +Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net + [23.128.96.19]) + (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) + (No client certificate requested) + by smtp.subspace.kernel.org (Postfix) with ESMTPS id E8CC639FF6; + Wed, 15 Nov 2023 15:39:07 +0000 (UTC) +Authentication-Results: smtp.subspace.kernel.org; + dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com + header.b="l/yCOwBz" +Received: from mail-vk1-xa2a.google.com (mail-vk1-xa2a.google.com + [IPv6:2607:f8b0:4864:20::a2a]) + by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC2C6C2; + Wed, 15 Nov 2023 07:39:06 -0800 (PST) +Received: by mail-vk1-xa2a.google.com with SMTP id + 71dfb90a1353d-4ac2c1a4b87so2729598e0c.0; + Wed, 15 Nov 2023 07:39:06 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=gmail.com; s=20230601; t=1700062746; x=1700667546; + darn=vger.kernel.org; + h=to:subject:message-id:date:from:mime-version:from:to:cc:subject + :date:message-id:reply-to; + bh=Ka6oEPkfLKrGnat5klQHHSJAKoZdHvZ4vqzdVi71ZtY=; + b=l/yCOwBzS7yxYMWD4KmFnlwyPnqDFYi0T0QNqRUoKH/nOo5AKHeAW4E0sygLRbffRG + cY4kAdSbJYkOdxIu01w7Mk5ONd/d2vK6GLzmlten5arLwxX/gHxHhWR4LMvz8tadoWwW + +A+wqmim6zy+PRjUlw5P+Q6g1Y7nY4jTX+8mJFQarLVNNMWWhxOfpeWp8QnhhkwreJZG + HIEkxOj7vK0KQ7DvcMkRjXK53JmlIj08uXKgTlzmSxC7TS2hMl2tzU/AnNgkzt5C7ybv + lsmeUVOJFu65ERNOYl/7EUrTkjoOkqLHrP4cY3P6OxUZFpqmGWBUn3EVkCmgoCa4vhnj + /eQw== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20230601; t=1700062746; x=1700667546; + h=to:subject:message-id:date:from:mime-version:x-gm-message-state + :from:to:cc:subject:date:message-id:reply-to; + bh=Ka6oEPkfLKrGnat5klQHHSJAKoZdHvZ4vqzdVi71ZtY=; + b=qT7b4q+D41P9B+qri4ZD3GvAnWZFoud/08ixeIdtoodmOWanJjLsbrhBP9I3C3cD3R + NkhS67VS0lIto7qriUjHBV8uJftDXtfrCtDf7bWu07s3xhFC7gXpB9WjhnFc5LMPjEko + 6+wIEqpWDJpexg5qD3BJPBZij/fImiN7V6Lxg1qjGnUy9unGrrv3BZqTrulW/x+c0RE4 + j3Pf5cO2xcrVVSbjRLbRMXJ9GovFOF/9UhbS4GDvfkeuWZ50xRGq9SmEwmRlYkYydP9o + kigNeSiUhfGsbjfGDijgEjCAWRZ1ro+dH3wyD/wezUc1Fg6prNO7GAwGntStC1gN9t5+ + ZiEQ== +X-Gm-Message-State: AOJu0YweRSqswyAf22dMU5Q1lg7XBxLscESF/uNfQJ01qp7JZkcFpeq2 + UFkOQLbMXXXg+hMGlY9WQ52NAkupS90I/aT3bswH195eDH+RG/a8lZk= +X-Google-Smtp-Source: + AGHT+IF2MHChcNxtzmpKThCzu49QGOdBWtNv/atMno9IuYGomNn4RXZcC8XOgVmbqV/mqWo+mBqJNKMtof6nBXYIDUM= +X-Received: by 2002:a05:6122:3bd0:b0:4ab:f4e6:7d7 with SMTP id + ft16-20020a0561223bd000b004abf4e607d7mr16288432vkb.0.1700062745848; Wed, 15 + Nov 2023 07:39:05 -0800 (PST) +Precedence: bulk +X-Mailing-List: linux-arm-msm@vger.kernel.org +List-Id: +List-Subscribe: +List-Unsubscribe: +MIME-Version: 1.0 +From: Isaev Ruslan +Date: Wed, 15 Nov 2023 18:38:53 +0300 +Message-ID: + +Subject: [PATCH v2] arm64: dts: qcom: ipq6018: add QUP5 I2C node +To: agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, + robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, + linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, + linux-kernel@vger.kernel.org + +Add node to support this bus inside of IPQ6018. +For example, this bus is used to work with the +voltage regulator (mp5496) on the Yuncore AX840 wireless AP. + + +Signed-off-by: Isaev Ruslan +--- +v1 -> v2: fix clocks typo; fix reg size warning. + + + arch/arm64/boot/dts/qcom/ipq6018.dtsi | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +-- +2.42.0 + +--- a/arch/arm64/boot/dts/qcom/ipq6018.dtsi ++++ b/arch/arm64/boot/dts/qcom/ipq6018.dtsi +@@ -676,6 +676,21 @@ + status = "disabled"; + }; + ++ blsp1_i2c6: i2c@78ba000 { ++ compatible = "qcom,i2c-qup-v2.2.1"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <0x0 0x078ba000 0x0 0x600>; ++ interrupts = ; ++ clocks = <&gcc GCC_BLSP1_QUP6_I2C_APPS_CLK>, ++ <&gcc GCC_BLSP1_AHB_CLK>; ++ clock-names = "core", "iface"; ++ clock-frequency = <400000>; ++ dmas = <&blsp_dma 22>, <&blsp_dma 23>; ++ dma-names = "tx", "rx"; ++ status = "disabled"; ++ }; ++ + qpic_bam: dma-controller@7984000 { + compatible = "qcom,bam-v1.7.0"; + reg = <0x0 0x07984000 0x0 0x1a000>; diff --git a/target/linux/qualcommax/patches-6.6/1002-arm64-dts-qcom-ipq6018-Add-missing-fixed-clocks.patch b/target/linux/qualcommax/patches-6.6/1002-arm64-dts-qcom-ipq6018-Add-missing-fixed-clocks.patch new file mode 100644 index 0000000000..97fb539029 --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/1002-arm64-dts-qcom-ipq6018-Add-missing-fixed-clocks.patch @@ -0,0 +1,40 @@ +From 48d8e82ed977f07211f827834d6ee6e6fe3336d8 Mon Sep 17 00:00:00 2001 +From: Alexandru Gagniuc +Date: Sat, 27 Aug 2022 17:33:37 -0500 +Subject: [PATCH 1004/1010] arm64: dts: qcom: ipq6018: Add missing fixed-clocks + +Signed-off-by: Alexandru Gagniuc +--- + arch/arm64/boot/dts/qcom/ipq6018.dtsi | 24 ++++++++++++++++++++++-- + 1 file changed, 22 insertions(+), 2 deletions(-) + +--- a/arch/arm64/boot/dts/qcom/ipq6018.dtsi ++++ b/arch/arm64/boot/dts/qcom/ipq6018.dtsi +@@ -28,6 +28,12 @@ + clock-frequency = <24000000>; + #clock-cells = <0>; + }; ++ ++ usb3phy_0_cc_pipe_clk: usb3phy-0-cc-pipe-clk { ++ compatible = "fixed-clock"; ++ clock-frequency = <125000000>; ++ #clock-cells = <0>; ++ }; + }; + + cpus: cpus { +@@ -454,8 +460,12 @@ + gcc: gcc@1800000 { + compatible = "qcom,gcc-ipq6018"; + reg = <0x0 0x01800000 0x0 0x80000>; +- clocks = <&xo>, <&sleep_clk>; +- clock-names = "xo", "sleep_clk"; ++ clocks = <&xo>, ++ <&sleep_clk>, ++ <&usb3phy_0_cc_pipe_clk>; ++ clock-names = "xo", ++ "sleep_clk", ++ "usb3phy_0_cc_pipe_clk"; + #clock-cells = <1>; + #reset-cells = <1>; + }; diff --git a/target/linux/qualcommax/patches-6.6/1003-arm64-dts-qcom-ipq6018-Add-QUP5-SPI-node.patch b/target/linux/qualcommax/patches-6.6/1003-arm64-dts-qcom-ipq6018-Add-QUP5-SPI-node.patch new file mode 100644 index 0000000000..4da99cf58d --- /dev/null +++ b/target/linux/qualcommax/patches-6.6/1003-arm64-dts-qcom-ipq6018-Add-QUP5-SPI-node.patch @@ -0,0 +1,77 @@ +From patchwork Sun Dec 3 15:40:03 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Chukun Pan +X-Patchwork-Id: 13477342 +Received: from mail-m17224.xmail.ntesmail.com (mail-m17224.xmail.ntesmail.com + [45.195.17.224]) + by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79C0EFC; + Sun, 3 Dec 2023 07:40:23 -0800 (PST) +Received: from Vostro-3710.lan (unknown [119.122.215.53]) + by mail-m121145.qiye.163.com (Hmail) with ESMTPA id DF26B80003D; + Sun, 3 Dec 2023 23:40:06 +0800 (CST) +From: Chukun Pan +To: Bjorn Andersson +Cc: Andy Gross , + Konrad Dybcio , + Krzysztof Kozlowski , + Conor Dooley , + Rob Herring , + linux-arm-msm@vger.kernel.org, + linux-kernel@vger.kernel.org, + devicetree@vger.kernel.org, + Chukun Pan +Subject: [PATCH v2 1/1] arm64: dts: qcom: ipq6018: Add QUP5 SPI node +Date: Sun, 3 Dec 2023 23:40:03 +0800 +Message-Id: <20231203154003.532765-1-amadeus@jmu.edu.cn> +X-Mailer: git-send-email 2.25.1 +Precedence: bulk +X-Mailing-List: linux-arm-msm@vger.kernel.org +List-Id: +List-Subscribe: +List-Unsubscribe: +MIME-Version: 1.0 +X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly + tZV1koWUFITzdXWS1ZQUlXWQ8JGhUIEh9ZQVkZS0kZVkkfSUodHkJMGk9ISFUTARMWGhIXJBQOD1 + lXWRgSC1lBWUpKQlVKSUlVSUpOVU5IWVdZFhoPEhUdFFlBWU9LSFVKSktISkNVSktLVUtZBg++ +X-HM-Tid: 0a8c30563ca5b03akuuudf26b80003d +X-HM-MType: 10 +X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6Mio6Mxw4Ezw0KAkqVjw4NwtK + CVEKCQFVSlVKTEtKTUpDS0tMQ0hLVTMWGhIXVRoWGh8eDgg7ERYOVR4fDlUYFUVZV1kSC1lBWUpK + QlVKSUlVSUpOVU5IWVdZCAFZQUlPSEI3Bg++ + +Add node to support the QUP5 SPI controller inside of IPQ6018. +Some routers use this bus to connect SPI TPM chips. + +Signed-off-by: Chukun Pan +--- +Changes in v2: +* No changes, resend due to error link to other threads. + + arch/arm64/boot/dts/qcom/ipq6018.dtsi | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +--- a/arch/arm64/boot/dts/qcom/ipq6018.dtsi ++++ b/arch/arm64/boot/dts/qcom/ipq6018.dtsi +@@ -656,6 +656,20 @@ + status = "disabled"; + }; + ++ blsp1_spi5: spi@78b9000 { ++ compatible = "qcom,spi-qup-v2.2.1"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ reg = <0x0 0x078b9000 0x0 0x600>; ++ interrupts = ; ++ clocks = <&gcc GCC_BLSP1_QUP5_SPI_APPS_CLK>, ++ <&gcc GCC_BLSP1_AHB_CLK>; ++ clock-names = "core", "iface"; ++ dmas = <&blsp_dma 20>, <&blsp_dma 21>; ++ dma-names = "tx", "rx"; ++ status = "disabled"; ++ }; ++ + blsp1_i2c2: i2c@78b6000 { + compatible = "qcom,i2c-qup-v2.2.1"; + #address-cells = <1>; diff --git a/target/linux/rockchip/Makefile b/target/linux/rockchip/Makefile index c40ff68316..6c017a2f1c 100644 --- a/target/linux/rockchip/Makefile +++ b/target/linux/rockchip/Makefile @@ -15,8 +15,7 @@ endef include $(INCLUDE_DIR)/target.mk -DEFAULT_PACKAGES += uboot-envtools partx-utils mkf2fs kmod-gpio-button-hotplug \ - fdisk automount cpufreq +DEFAULT_PACKAGES += uboot-envtools partx-utils mkf2fs kmod-gpio-button-hotplug fdisk automount cpufreq kmod-phy-realtek kmod-usb3 kmod-usb-dwc3 KERNELNAME:=Image dtbs diff --git a/target/linux/rockchip/armv8/base-files/etc/board.d/01_leds b/target/linux/rockchip/armv8/base-files/etc/board.d/01_leds old mode 100644 new mode 100755 diff --git a/target/linux/rockchip/armv8/base-files/etc/board.d/02_network b/target/linux/rockchip/armv8/base-files/etc/board.d/02_network old mode 100644 new mode 100755 index 394aeefe96..310c87be15 --- a/target/linux/rockchip/armv8/base-files/etc/board.d/02_network +++ b/target/linux/rockchip/armv8/base-files/etc/board.d/02_network @@ -30,6 +30,7 @@ rockchip_setup_interfaces() mmbox,anas3035|\ radxa,e25|\ radxa,rock-3b|\ + rumu3f,fine-3399|\ xunlong,orangepi-5-plus) ucidef_set_interfaces_lan_wan 'eth0' 'eth1' ;; @@ -77,6 +78,7 @@ rockchip_setup_macs() friendlyarm,nanopi-r2s|\ lunzn,fastrhino-r66s|\ lunzn,fastrhino-r68s|\ + rumu3f,fine-3399|\ mmbox,anas3035) wan_mac=$(macaddr_generate_from_mmc_cid mmcblk0) lan_mac=$(macaddr_add "$wan_mac" 1) diff --git a/target/linux/rockchip/armv8/base-files/etc/board.d/05_compat-version b/target/linux/rockchip/armv8/base-files/etc/board.d/05_compat-version old mode 100644 new mode 100755 diff --git a/target/linux/rockchip/armv8/base-files/etc/hotplug.d/net/40-net-smp-affinity b/target/linux/rockchip/armv8/base-files/etc/hotplug.d/net/40-net-smp-affinity old mode 100644 new mode 100755 diff --git a/target/linux/rockchip/armv8/base-files/lib/preinit/79_move_config b/target/linux/rockchip/armv8/base-files/lib/preinit/79_move_config old mode 100644 new mode 100755 diff --git a/target/linux/rockchip/armv8/base-files/lib/upgrade/platform.sh b/target/linux/rockchip/armv8/base-files/lib/upgrade/platform.sh old mode 100644 new mode 100755 diff --git a/target/linux/rockchip/files/arch/arm64/boot/dts/rockchip/rk3399-fine-3399.dts b/target/linux/rockchip/files/arch/arm64/boot/dts/rockchip/rk3399-fine-3399.dts new file mode 100644 index 0000000000..ad29137bf4 --- /dev/null +++ b/target/linux/rockchip/files/arch/arm64/boot/dts/rockchip/rk3399-fine-3399.dts @@ -0,0 +1,790 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +/dts-v1/; + +#include +#include +#include "rk3399.dtsi" +#include "rk3399-opp.dtsi" + +/ { + model = "RUMU3F Fine3399"; + compatible = "rumu3f,fine-3399","rockchip,rk3399"; + + aliases { + ethernet0 = &gmac; + mmc0 = &sdio0; + mmc1 = &sdmmc; + mmc2 = &sdhci; + }; + + chosen { + stdout-path = "serial2:1500000n8"; + }; + + clkin_gmac: external-gmac-clock { + compatible = "fixed-clock"; + clock-frequency = <125000000>; + clock-output-names = "clkin_gmac"; + #clock-cells = <0>; + }; + + dc_12v: dc-12v { + compatible = "regulator-fixed"; + regulator-name = "dc_12v"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <12000000>; + regulator-max-microvolt = <12000000>; + }; + + sdio_pwrseq: sdio-pwrseq { + compatible = "mmc-pwrseq-simple"; + clocks = <&rk808 1>; + clock-names = "ext_clock"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_reg_on_h>; + reset-gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_LOW>; + }; + + /* switched by pmic_sleep */ + vcc1v8_s3: vcca1v8_s3: vcc1v8-s3 { + compatible = "regulator-fixed"; + regulator-name = "vcc1v8_s3"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + vin-supply = <&vcc_1v8>; + }; + + vcc3v3_sys: vcc3v3-sys { + compatible = "regulator-fixed"; + regulator-name = "vcc3v3_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&dc_12v>; + }; + + vcc_sys: vcc-sys { + compatible = "regulator-fixed"; + regulator-name = "vcc_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&dc_12v>; + }; + + vcc_phy: vcc-phy-regulator { + compatible = "regulator-fixed"; + enable-active-high; + gpio = <&gpio0 RK_PB4 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc_phy_h>; + regulator-name = "vcc_phy"; + regulator-always-on; + regulator-boot-on; + }; + + vdd_log: vdd-log { + compatible = "pwm-regulator"; + pwms = <&pwm2 0 25000 1>; + regulator-name = "vdd_log"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <1400000>; + vin-supply = <&vcc_sys>; + }; + + leds: gpio-leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&user_led2>; + + user_led2 { + label = "blue:work_led"; + gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_LOW>; + linux,default-trigger = "heartbeat"; + }; + }; + + gpio-keys { + compatible = "gpio-keys"; + autorepeat; + pinctrl-names = "default"; + pinctrl-0 = <&power_key>; + + key-power { + debounce-interval = <100>; + gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>; + label = "GPIO Key Power"; + linux,code = ; + wakeup-source; + }; + }; + + fan0: pwm-fan { + compatible = "pwm-fan"; + cooling-levels = <0 25 50 75 100 150>; + #cooling-cells = <2>; + fan-supply = <&vcc_sys>; + pwms = <&pwm1 0 40000 0>; + }; + + backlight: backlight { + compatible = "pwm-backlight"; + brightness-levels = <0 36 72 108 144 180 216 255>; + default-brightness-level = <5>; + pwms = <&pwm0 0 1000000 0>; + }; + + ir-receiver { + compatible = "gpio-ir-receiver"; + gpios = <&gpio0 RK_PA6 GPIO_ACTIVE_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&ir_int>; + }; + + adc-keys { + compatible = "adc-keys"; + io-channels = <&saradc 1>; + io-channel-names = "buttons"; + keyup-threshold-microvolt = <1750000>; + poll-interval = <100>; + + recovery { + label = "Recovery"; + linux,code = ; + press-threshold-microvolt = <0>; + }; + }; +}; + +&cpu_l0 { + cpu-supply = <&vdd_cpu_l>; +}; + +&cpu_l1 { + cpu-supply = <&vdd_cpu_l>; +}; + +&cpu_l2 { + cpu-supply = <&vdd_cpu_l>; +}; + +&cpu_l3 { + cpu-supply = <&vdd_cpu_l>; +}; + +&cpu_b0 { + cpu-supply = <&vdd_cpu_b>; +}; + +&cpu_b1 { + cpu-supply = <&vdd_cpu_b>; +}; + +&gpu { + mali-supply = <&vdd_gpu>; + status = "okay"; +}; + +&cpu_thermal { + trips { + cpu_hot: cpu_hot { + hysteresis = <10000>; + temperature = <55000>; + type = "active"; + }; + }; + + cooling-maps { + map2 { + cooling-device = + <&fan0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + trip = <&cpu_hot>; + }; + }; +}; + +&emmc_phy { + status = "okay"; +}; + +&gmac { + assigned-clocks = <&cru SCLK_RMII_SRC>; + assigned-clock-parents = <&clkin_gmac>; + clock_in_out = "input"; + phy-supply = <&vcc_phy>; + phy-mode = "rgmii"; + pinctrl-names = "default"; + pinctrl-0 = <&rgmii_pins>; + snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; + snps,reset-active-low; + snps,reset-delays-us = <0 10000 50000>; + tx_delay = <0x28>; + rx_delay = <0x11>; + status = "okay"; +}; + +&hdmi { + ddc-i2c-bus = <&i2c3>; + pinctrl-names = "default"; + pinctrl-0 = <&hdmi_cec>; + status = "okay"; +}; + +&hdmi_sound { + status = "okay"; +}; + +&i2c0 { + clock-frequency = <400000>; + i2c-scl-rising-time-ns = <168>; + i2c-scl-falling-time-ns = <4>; + status = "okay"; + + rk808: pmic@1b { + compatible = "rockchip,rk808"; + reg = <0x1b>; + interrupt-parent = <&gpio1>; + interrupts = ; + #clock-cells = <1>; + clock-output-names = "xin32k", "rk808-clkout2"; + pinctrl-names = "default"; + pinctrl-0 = <&pmic_int_l &pmic_dvs2>; + rockchip,system-power-controller; + wakeup-source; + + vcc1-supply = <&vcc3v3_sys>; + vcc2-supply = <&vcc3v3_sys>; + vcc3-supply = <&vcc3v3_sys>; + vcc4-supply = <&vcc3v3_sys>; + vcc6-supply = <&vcc3v3_sys>; + vcc7-supply = <&vcc3v3_sys>; + vcc8-supply = <&vcc3v3_sys>; + vcc9-supply = <&vcc3v3_sys>; + vcc10-supply = <&vcc3v3_sys>; + vcc11-supply = <&vcc3v3_sys>; + vcc12-supply = <&vcc3v3_sys>; + vddio-supply = <&vcc1v8_pmu>; + + regulators { + vdd_center: DCDC_REG1 { + regulator-name = "vdd_center"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <750000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_cpu_l: DCDC_REG2 { + regulator-name = "vdd_cpu_l"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <750000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_ddr: DCDC_REG3 { + regulator-name = "vcc_ddr"; + regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vcc_1v8: DCDC_REG4 { + regulator-name = "vcc_1v8"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vcc1v8_dvp: LDO_REG1 { + regulator-name = "vcc1v8_dvp"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc3v0_tp: LDO_REG2 { + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-name = "vcc3v0_tp"; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc1v8_pmu: LDO_REG3 { + regulator-name = "vcc1v8_pmu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vcc_sd: LDO_REG4 { + regulator-name = "vcc_sd"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcca3v0_codec: LDO_REG5 { + regulator-name = "vcca3v0_codec"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_1v5: LDO_REG6 { + regulator-name = "vcc_1v5"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1500000>; + regulator-max-microvolt = <1500000>; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1500000>; + }; + }; + + vcca1v8_codec: LDO_REG7 { + regulator-name = "vcca1v8_codec"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_3v0: LDO_REG8 { + regulator-name = "vcc_3v0"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3000000>; + }; + }; + + vcc3v3_s3: SWITCH_REG1 { + regulator-name = "vcc3v3_s3"; + regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc3v3_s0: SWITCH_REG2 { + regulator-name = "vcc3v3_s0"; + regulator-always-on; + regulator-boot-on; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + }; + }; + + vdd_cpu_b: regulator@40 { + compatible = "silergy,syr827"; + reg = <0x40>; + fcs,suspend-voltage-selector = <1>; + pinctrl-names = "default"; + pinctrl-0 = <&cpu_b_sleep>; + regulator-name = "vdd_cpu_b"; + regulator-min-microvolt = <712500>; + regulator-max-microvolt = <1500000>; + regulator-ramp-delay = <1000>; + regulator-always-on; + regulator-boot-on; + vin-supply = <&vcc_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdd_gpu: regulator@41 { + compatible = "silergy,syr828"; + reg = <0x41>; + fcs,suspend-voltage-selector = <1>; + pinctrl-names = "default"; + pinctrl-0 = <&gpu_sleep>; + regulator-name = "vdd_gpu"; + regulator-min-microvolt = <712500>; + regulator-max-microvolt = <1500000>; + regulator-ramp-delay = <1000>; + regulator-always-on; + regulator-boot-on; + vin-supply = <&vcc_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; +}; + +&i2c3 { + i2c-scl-rising-time-ns = <450>; + i2c-scl-falling-time-ns = <15>; + status = "okay"; +}; + +&i2s2 { + #sound-dai-cells = <0>; + status = "okay"; +}; + +&iep_mmu { + status = "okay"; +}; + +&io_domains { + status = "okay"; + + bt656-supply = <&vcc_3v0>; + audio-supply = <&vcca1v8_codec>; + sdmmc-supply = <&vcc_sd>; + gpio1830-supply = <&vcc_3v0>; +}; + +&pmu_io_domains { + status = "okay"; + pmu1830-supply = <&vcc_1v8>; +}; + +&pcie_phy { + status = "okay"; +}; + +&pcie0 { + ep-gpios = <&gpio4 RK_PD3 GPIO_ACTIVE_HIGH>; + max-link-speed = <2>; + num-lanes = <2>; + pinctrl-names = "default"; + pinctrl-0 = <&pcie_clkreqn_cpm>; + status = "okay"; +}; + +&pinctrl { + pmic { + cpu_b_sleep: cpu-b-sleep { + rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>; + }; + + gpu_sleep: gpu-sleep { + rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>; + }; + + pmic_int_l: pmic-int-l { + rockchip,pins = <1 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>; + }; + + pmic_dvs2: pmic-dvs2 { + rockchip,pins = <1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_down>; + }; + }; + + sdio-pwrseq { + wifi_reg_on_h: wifi-reg-on-h { + rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + wifi { + wifi_host_wake_l: wifi-host-wake-l { + rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + bt { + bt_enable_h: bt-enable-h { + rockchip,pins = <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + bt_host_wake_l: bt-host-wake-l { + rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_down>; + }; + + bt_wake_l: bt-wake-l { + rockchip,pins = <2 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + gmac { + vcc_phy_h: vcc-phy-h { + rockchip,pins = <0 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + leds { + user_led2: user_led2 { + rockchip,pins = <2 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + ir { + ir_int: ir-int { + rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + buttons { + power_key: power_key { + rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; +}; + +&pwm0 { + status = "okay"; +}; + +&pwm1 { + status = "okay"; +}; + +&pwm2 { + status = "okay"; +}; + +&saradc { + vref-supply = <&vcca1v8_s3>; + status = "okay"; +}; + +// if kernel panic at system boot, try to disable WiFi +&sdio0 { + bus-width = <4>; + cap-sd-highspeed; + cap-sdio-irq; + clock-frequency = <50000000>; + disable-wp; + keep-power-in-suspend; + max-frequency = <50000000>; + mmc-pwrseq = <&sdio_pwrseq>; + non-removable; + pinctrl-names = "default"; + pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>; + sd-uhs-sdr104; + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + brcmf: wifi@1 { + reg = <1>; + compatible = "brcm,bcm4329-fmac"; + interrupt-parent = <&gpio0>; + interrupts = ; + interrupt-names = "host-wake"; + brcm,drive-strength = <5>; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_host_wake_l>; + }; +}; + +&sdmmc { + bus-width = <4>; + cap-sd-highspeed; + cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>; + clock-frequency = <150000000>; + disable-wp; + sd-uhs-sdr104; + max-frequency = <150000000>; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>; + vqmmc-supply = <&vcc_sd>; + status = "okay"; +}; + +&sdhci { + bus-width = <8>; + mmc-hs400-1_8v; + mmc-hs400-enhanced-strobe; + keep-power-in-suspend; + non-removable; + status = "okay"; +}; + +&spi2 { + status = "okay"; + + panel@0 { + compatible = "sitronix,st7735s", "sitronix,st7735r", "sitronix,st7789v", "jianda,jd-t18003-t01"; + reg = <0>; + rgb; + width = <80>; + height = <160>; + fps = <30>; + buswidth = <8>; + rotate = <270>; + backlight = <&backlight>; + dc-gpios = <&gpio4 RK_PD5 GPIO_ACTIVE_HIGH>; + reset-gpios = <&gpio4 RK_PD1 GPIO_ACTIVE_LOW>; + led-gpios = <&gpio4 RK_PC2 GPIO_ACTIVE_HIGH>; + spi-max-frequency = <32000000>; + debug = <0>; + spi-cpol; + spi-cpha; + }; +}; + +&tcphy0 { + status = "okay"; +}; + +&tcphy1 { + status = "okay"; +}; + +&tsadc { + /* tshut mode 0:CRU 1:GPIO */ + rockchip,hw-tshut-mode = <1>; + /* tshut polarity 0:LOW 1:HIGH */ + rockchip,hw-tshut-polarity = <1>; + status = "okay"; +}; + +&u2phy0 { + status = "okay"; + + u2phy0_otg: otg-port { + status = "okay"; + }; + + u2phy0_host: host-port { + status = "okay"; + }; +}; + +&u2phy1 { + status = "okay"; + + u2phy1_otg: otg-port { + status = "okay"; + }; + + u2phy1_host: host-port { + status = "okay"; + }; +}; + +&uart0 { + pinctrl-names = "default"; + pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>; + status = "okay"; + + bluetooth { + compatible = "brcm,bcm43438-bt"; + clocks = <&rk808 1>; + clock-names = "lpo"; + device-wakeup-gpios = <&gpio2 RK_PD2 GPIO_ACTIVE_HIGH>; + host-wakeup-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>; + shutdown-gpios = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>; + max-speed = <4000000>; + pinctrl-names = "default"; + pinctrl-0 = <&bt_host_wake_l &bt_wake_l &bt_enable_h>; + vbat-supply = <&vcc3v3_sys>; + vddio-supply = <&vcc_1v8>; + }; +}; + +&uart2 { + status = "okay"; +}; + +&usb_host0_ehci { + status = "okay"; +}; + +&usb_host0_ohci { + status = "okay"; +}; + +&usb_host1_ehci { + status = "okay"; +}; + +&usb_host1_ohci { + status = "okay"; +}; + +&usbdrd3_0 { + status = "okay"; +}; + +&usbdrd_dwc3_0 { + status = "okay"; + dr_mode = "host"; +}; + +&usbdrd3_1 { + status = "okay"; +}; + +&usbdrd_dwc3_1 { + status = "okay"; + dr_mode = "host"; +}; + +&vopb { + status = "okay"; +}; + +&vopb_mmu { + status = "okay"; +}; + +&vopl { + status = "okay"; +}; + +&vopl_mmu { + status = "okay"; +}; \ No newline at end of file diff --git a/target/linux/rockchip/image/armv8.mk b/target/linux/rockchip/image/armv8.mk index fe4b32cdf2..5b7f45c127 100644 --- a/target/linux/rockchip/image/armv8.mk +++ b/target/linux/rockchip/image/armv8.mk @@ -98,6 +98,16 @@ define Device/friendlyarm_nanopc-t4 endef TARGET_DEVICES += friendlyarm_nanopc-t4 +define Device/rumu3f_fine-3399 + DEVICE_VENDOR := RUMU3F + DEVICE_MODEL := Fine 3399 + SOC := rk3399 + UBOOT_DEVICE_NAME := fine3399-rk3399 + BOOT_FLOW := pine64-bin + DEVICE_PACKAGES := kmod-r8169 wpad-openssl brcmfmac-firmware-43430b0-sdio brcmfmac-nvram-43430b0-sdio +endef +TARGET_DEVICES += rumu3f_fine-3399 + define Device/friendlyarm_nanopc-t6 DEVICE_VENDOR := FriendlyARM DEVICE_MODEL := NanoPC T6 @@ -139,7 +149,7 @@ define Device/friendlyarm_nanopi-r3s DEVICE_MODEL := NanoPi R3S SOC := rk3566 BOOT_FLOW := pine64-img - DEVICE_PACKAGES := kmod-r8168 + DEVICE_PACKAGES := kmod-r8169 endef TARGET_DEVICES += friendlyarm_nanopi-r3s @@ -148,7 +158,7 @@ define Device/friendlyarm_nanopi-r4s DEVICE_MODEL := NanoPi R4S SOC := rk3399 BOOT_FLOW := pine64-bin - DEVICE_PACKAGES := kmod-r8168 + DEVICE_PACKAGES := kmod-r8169 endef TARGET_DEVICES += friendlyarm_nanopi-r4s @@ -157,7 +167,7 @@ define Device/friendlyarm_nanopi-r4se DEVICE_MODEL := NanoPi R4SE SOC := rk3399 BOOT_FLOW := pine64-bin - DEVICE_PACKAGES := kmod-r8168 + DEVICE_PACKAGES := kmod-r8169 endef TARGET_DEVICES += friendlyarm_nanopi-r4se @@ -167,7 +177,7 @@ define Device/friendlyarm_nanopi-r4s-enterprise SOC := rk3399 UBOOT_DEVICE_NAME := nanopi-r4s-rk3399 BOOT_FLOW := pine64-bin - DEVICE_PACKAGES := kmod-r8168 + DEVICE_PACKAGES := kmod-r8169 endef TARGET_DEVICES += friendlyarm_nanopi-r4s-enterprise @@ -212,7 +222,7 @@ define Device/huake_guangmiao-g4c DEVICE_MODEL := GuangMiao G4C SOC := rk3399 BOOT_FLOW := pine64-bin - DEVICE_PACKAGES := kmod-r8168 + DEVICE_PACKAGES := kmod-r8169 endef TARGET_DEVICES += huake_guangmiao-g4c diff --git a/target/linux/rockchip/patches-6.6/900-arm64-boot-add-dts-files.patch b/target/linux/rockchip/patches-6.6/900-arm64-boot-add-dts-files.patch index db2343938a..7ededb24a3 100644 --- a/target/linux/rockchip/patches-6.6/900-arm64-boot-add-dts-files.patch +++ b/target/linux/rockchip/patches-6.6/900-arm64-boot-add-dts-files.patch @@ -8,15 +8,17 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-hugsun-x99.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-khadas-edge.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-khadas-edge-captain.dtb -@@ -50,6 +51,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-na +@@ -50,7 +51,9 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-na dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-nanopi-m4b.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-nanopi-neo4.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-nanopi-r4s.dtb +dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-nanopi-r4se.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-nanopi-r4s-enterprise.dtb ++dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-fine-3399.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-orangepi.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-pinebook-pro.dtb -@@ -91,19 +93,25 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-so + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-pinephone-pro.dtb +@@ -91,19 +94,25 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-so dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-box-demo.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-lubancat-1.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3566-nanopi-r3s.dtb @@ -42,7 +44,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-edgeble-neu6a-io.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-edgeble-neu6b-io.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-evb1-v10.dtb -@@ -112,5 +120,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-or +@@ -112,5 +121,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-or dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-rock-5b.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588s-indiedroid-nova.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588s-khadas-edge2.dtb