diff --git a/.github/labeler.yml b/.github/labeler.yml index c8f8466d4a6100..1813b7f849543d 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -11,8 +11,6 @@ - "target/linux/at91/**" - "package/boot/at91bootstrap/**" - "package/boot/uboot-at91/**" -"target/ath25": - - "target/linux/ath25/**" "target/ath79": - "target/linux/ath79/**" "target/bcm27xx": diff --git a/config/Config-kernel.in b/config/Config-kernel.in index 78155eb5926d74..2e59bc95518f4c 100644 --- a/config/Config-kernel.in +++ b/config/Config-kernel.in @@ -144,7 +144,7 @@ config KERNEL_UBSAN_TRAP config KERNEL_KASAN bool "Compile the kernel with KASan: runtime memory debugger" select KERNEL_SLUB_DEBUG - depends on (x86_64 || aarch64) + depends on (x86_64 || aarch64 || arm || powerpc || riscv64) help Enables kernel address sanitizer - runtime memory debugger, designed to find out-of-bounds accesses and use-after-free bugs. diff --git a/include/kernel-5.15 b/include/kernel-5.15 index d93ae194b8aa1c..58573657d63256 100644 --- a/include/kernel-5.15 +++ b/include/kernel-5.15 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.15 = .148 -LINUX_KERNEL_HASH-5.15.148 = c48575c97fd9f4767cbe50a13b1b2b40ee42830aba3182fabd35a03259a6e5d8 +LINUX_VERSION-5.15 = .150 +LINUX_KERNEL_HASH-5.15.150 = ee05592b458e7fcdc515b43605883a10cc2f65f2e2b58d60af8a72b93467e4d4 diff --git a/include/kernel-6.1 b/include/kernel-6.1 index 95dede372aab0b..1d3d508822bdaf 100644 --- a/include/kernel-6.1 +++ b/include/kernel-6.1 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.1 = .78 -LINUX_KERNEL_HASH-6.1.78 = 65206b969831236849c9906eba267e715734a93808e9909fd9b4f12eea10d689 +LINUX_VERSION-6.1 = .81 +LINUX_KERNEL_HASH-6.1.81 = 0ebd861c6fd47bb0a9d3a09664d704833d1a54750c7bf9c4ad8b5e9cbd49342b diff --git a/include/kernel-6.6 b/include/kernel-6.6 new file mode 100644 index 00000000000000..b30a51434cf993 --- /dev/null +++ b/include/kernel-6.6 @@ -0,0 +1,2 @@ +LINUX_VERSION-6.6 = .22 +LINUX_KERNEL_HASH-6.6.22 = 23e3e7b56407250f5411bdab95763d0bc4e3a19dfa431d951df7eacabd61a2f4 diff --git a/include/u-boot.mk b/include/u-boot.mk index 06867a70e426b6..454880989b5ec0 100644 --- a/include/u-boot.mk +++ b/include/u-boot.mk @@ -69,6 +69,7 @@ endef TARGET_DEP = TARGET_$(BUILD_TARGET)$(if $(BUILD_SUBTARGET),_$(BUILD_SUBTARGET)) UBOOT_MAKE_FLAGS = \ + PATH=$(STAGING_DIR_HOST)/bin:$(PATH) \ HOSTCC="$(HOSTCC)" \ HOSTCFLAGS="$(HOST_CFLAGS) $(HOST_CPPFLAGS) -std=gnu11" \ HOSTLDFLAGS="$(HOST_LDFLAGS)" \ diff --git a/package/Makefile b/package/Makefile index 8e72d4ec726dbc..d72ce09a816b42 100644 --- a/package/Makefile +++ b/package/Makefile @@ -59,6 +59,7 @@ $(curdir)/merge-index: $(curdir)/merge (cd $(PACKAGE_DIR_ALL) && $(SCRIPT_DIR)/ipkg-make-index.sh . 2>&1 > Packages; ) ifndef SDK + $(curdir)//compile = $(STAGING_DIR)/.prepared $(BIN_DIR) $(curdir)/compile: $(curdir)/system/opkg/host/compile endif diff --git a/package/base-files/files/lib/upgrade/common.sh b/package/base-files/files/lib/upgrade/common.sh index af1182cb16a383..ef8d01e16896f3 100644 --- a/package/base-files/files/lib/upgrade/common.sh +++ b/package/base-files/files/lib/upgrade/common.sh @@ -165,6 +165,23 @@ part_magic_fat() { [ "$magic" = "FAT" ] || [ "$magic_fat32" = "FAT32" ] } +fitblk_get_bootdev() { + [ -e /sys/firmware/devicetree/base/chosen/rootdisk ] || return + + local rootdisk="$(cat /sys/firmware/devicetree/base/chosen/rootdisk)" + local handle bootdev + for handle in /sys/class/block/*/of_node/phandle /sys/class/block/*/device/of_node/phandle; do + [ ! -e "$handle" ] && continue + if [ "$rootdisk" = "$(cat $handle)" ]; then + bootdev="${handle%/of_node/phandle}" + bootdev="${bootdev%/device}" + bootdev="${bootdev#/sys/class/block/}" + echo "$bootdev" + break + fi + done +} + export_bootdevice() { local cmdline uuid blockdev uevent line class local MAJOR MINOR DEVNAME DEVTYPE @@ -196,6 +213,7 @@ export_bootdevice() { done ;; /dev/*) + [ "$rootpart" = "/dev/fit0" ] && rootpart="$(fitblk_get_bootdev)" uevent="/sys/class/block/${rootpart##*/}/../uevent" ;; 0x[a-f0-9][a-f0-9][a-f0-9] | 0x[a-f0-9][a-f0-9][a-f0-9][a-f0-9] | \ diff --git a/package/base-files/files/lib/upgrade/tar.sh b/package/base-files/files/lib/upgrade/tar.sh new file mode 100644 index 00000000000000..a9d1d559e6f7dd --- /dev/null +++ b/package/base-files/files/lib/upgrade/tar.sh @@ -0,0 +1,71 @@ +# SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +# Example usage: +# +# { +# tar_print_member "date.txt" "It's $(date +"%Y")" +# tar_print_trailer +# } > test.tar + +__tar_print_padding() { + dd if=/dev/zero bs=1 count=$1 2>/dev/null +} + +tar_print_member() { + local name="$1" + local content="$2" + local mtime="${3:-$(date +%s)}" + local mode=644 + local uid=0 + local gid=0 + local size=${#content} + local type=0 + local link="" + local username="root" + local groupname="root" + + # 100 byte of padding bytes, using 0x01 since the shell does not tolerate null bytes in strings + local pad=$'\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1' + + # validate name (strip leading slash if present) + name=${name#/} + + # truncate string header values to their maximum length + name=${name:0:100} + link=${link:0:100} + username=${username:0:32} + groupname=${groupname:0:32} + + # construct header part before checksum field + local header1="${name}${pad:0:$((100 - ${#name}))}" + header1="${header1}$(printf '%07d\1' $mode)" + header1="${header1}$(printf '%07o\1' $uid)" + header1="${header1}$(printf '%07o\1' $gid)" + header1="${header1}$(printf '%011o\1' $size)" + header1="${header1}$(printf '%011o\1' $mtime)" + + # construct header part after checksum field + local header2="$(printf '%d' $type)" + header2="${header2}${link}${pad:0:$((100 - ${#link}))}" + header2="${header2}ustar ${pad:0:1}" + header2="${header2}${username}${pad:0:$((32 - ${#username}))}" + header2="${header2}${groupname}${pad:0:$((32 - ${#groupname}))}" + + # calculate checksum over header fields + local checksum=0 + for byte in $(printf '%s%8s%s' "$header1" "" "$header2" | tr '\1' '\0' | hexdump -ve '1/1 "%u "'); do + checksum=$((checksum + byte)) + done + + # print member header, padded to 512 byte + printf '%s%06o\0 %s' "$header1" $checksum "$header2" | tr '\1' '\0' + __tar_print_padding 183 + + # print content data, padded to multiple of 512 byte + printf "%s" "$content" + __tar_print_padding $((512 - (size % 512))) +} + +tar_print_trailer() { + __tar_print_padding 1024 +} diff --git a/package/base-files/files/sbin/sysupgrade b/package/base-files/files/sbin/sysupgrade index 4bac1041d9665a..9b422107d8c7ab 100755 --- a/package/base-files/files/sbin/sysupgrade +++ b/package/base-files/files/sbin/sysupgrade @@ -4,26 +4,35 @@ . /lib/functions/system.sh . /usr/share/libubox/jshn.sh -# initialize defaults +# File-local constants +CONF_TAR=/tmp/sysupgrade.tgz +ETCBACKUP_DIR=/etc/backup +INSTALLED_PACKAGES=${ETCBACKUP_DIR}/installed_packages.txt +COMMAND=/lib/upgrade/do_stage2 + +# File-local globals +SAVE_OVERLAY=0 +SAVE_OVERLAY_PATH= +SAVE_PARTITIONS=1 +SAVE_INSTALLED_PKGS=0 +SKIP_UNCHANGED=0 +CONF_IMAGE= +CONF_BACKUP_LIST=0 +CONF_BACKUP= +CONF_RESTORE= +NEED_IMAGE= +HELP=0 +TEST=0 + +# Globals accessed in other files export MTD_ARGS="" export MTD_CONFIG_ARGS="" export INTERACTIVE=0 export VERBOSE=1 export SAVE_CONFIG=1 -export SAVE_OVERLAY=0 -export SAVE_OVERLAY_PATH= -export SAVE_PARTITIONS=1 -export SAVE_INSTALLED_PKGS=0 -export SKIP_UNCHANGED=0 -export CONF_IMAGE= -export CONF_BACKUP_LIST=0 -export CONF_BACKUP= -export CONF_RESTORE= export IGNORE_MINOR_COMPAT=0 -export NEED_IMAGE= -export HELP=0 export FORCE=0 -export TEST=0 +export CONFFILES=/tmp/sysupgrade.conffiles # parse options while [ -n "$1" ]; do @@ -32,18 +41,18 @@ while [ -n "$1" ]; do -v) export VERBOSE="$(($VERBOSE + 1))";; -q) export VERBOSE="$(($VERBOSE - 1))";; -n) export SAVE_CONFIG=0;; - -c) export SAVE_OVERLAY=1 SAVE_OVERLAY_PATH=/etc;; - -o) export SAVE_OVERLAY=1 SAVE_OVERLAY_PATH=/;; - -p) export SAVE_PARTITIONS=0;; - -k) export SAVE_INSTALLED_PKGS=1;; - -u) export SKIP_UNCHANGED=1;; - -b|--create-backup) export CONF_BACKUP="$2" NEED_IMAGE=1; shift;; - -r|--restore-backup) export CONF_RESTORE="$2" NEED_IMAGE=1; shift;; - -l|--list-backup) export CONF_BACKUP_LIST=1;; - -f) export CONF_IMAGE="$2"; shift;; + -c) SAVE_OVERLAY=1 SAVE_OVERLAY_PATH=/etc;; + -o) SAVE_OVERLAY=1 SAVE_OVERLAY_PATH=/;; + -p) SAVE_PARTITIONS=0;; + -k) SAVE_INSTALLED_PKGS=1;; + -u) SKIP_UNCHANGED=1;; + -b|--create-backup) CONF_BACKUP="$2" NEED_IMAGE=1; shift;; + -r|--restore-backup) CONF_RESTORE="$2" NEED_IMAGE=1; shift;; + -l|--list-backup) CONF_BACKUP_LIST=1;; + -f) CONF_IMAGE="$2"; shift;; -F|--force) export FORCE=1;; - -T|--test) export TEST=1;; - -h|--help) export HELP=1; break;; + -T|--test) TEST=1;; + -h|--help) HELP=1; break;; --ignore-minor-compat-version) export IGNORE_MINOR_COMPAT=1;; -*) echo "Invalid option: $1" >&2 @@ -54,14 +63,7 @@ while [ -n "$1" ]; do shift; done -export CONFFILES=/tmp/sysupgrade.conffiles -export CONF_TAR=/tmp/sysupgrade.tgz -export ETCBACKUP_DIR=/etc/backup -export INSTALLED_PACKAGES=${ETCBACKUP_DIR}/installed_packages.txt - -IMAGE="$1" - -[ -z "$IMAGE" -a -z "$NEED_IMAGE" -a $CONF_BACKUP_LIST -eq 0 -o $HELP -gt 0 ] && { +print_help() { cat <...] $0 [-q] [-i] [-c] [-u] [-o] [-k] @@ -101,9 +103,20 @@ backup-command: sysupgrade -b. Does not create a backup file. EOF - exit 1 } +IMAGE="$1" + +if [ $HELP -gt 0 ]; then + print_help + exit 0 +fi + +if [ -z "$IMAGE" -a -z "$NEED_IMAGE" -a $CONF_BACKUP_LIST -eq 0 ]; then + print_help + exit 1 +fi + [ -n "$IMAGE" -a -n "$NEED_IMAGE" ] && { cat <<-EOF -b|--create-backup and -r|--restore-backup do not perform a firmware upgrade. @@ -142,7 +155,7 @@ list_static_conffiles() { \( -type f -o -type l \) $filter 2>/dev/null } -add_conffiles() { +build_list_of_backup_config_files() { local file="$1" ( list_static_conffiles "$find_filter"; list_changed_conffiles ) | @@ -150,7 +163,7 @@ add_conffiles() { return 0 } -add_overlayfiles() { +build_list_of_backup_overlay_files() { local file="$1" local packagesfiles=$1.packagesfiles @@ -202,12 +215,12 @@ add_overlayfiles() { if [ $SAVE_OVERLAY = 1 ]; then [ ! -d /overlay/upper/etc ] && { - echo "Cannot find '/overlay/upper/etc', required for '-c'" >&2 + echo "Cannot find '/overlay/upper/etc', required for '-c' or '-o'" >&2 exit 1 } - sysupgrade_init_conffiles="add_overlayfiles" + sysupgrade_init_conffiles="build_list_of_backup_overlay_files" else - sysupgrade_init_conffiles="add_conffiles" + sysupgrade_init_conffiles="build_list_of_backup_config_files" fi find_filter="" @@ -221,68 +234,66 @@ fi include /lib/upgrade -do_save_conffiles() { +create_backup_archive() { local conf_tar="$1" - local tmp - local dir + local disabled + local err [ "$(rootfs_type)" = "tmpfs" ] && { echo "Cannot save config while running from ramdisk." >&2 ask_bool 0 "Abort" && exit - rm -f "$conf_tar" return 0 } run_hooks "$CONFFILES" $sysupgrade_init_conffiles ask_bool 0 "Edit config file list" && vi "$CONFFILES" - # Mount root directory with temporary overlay on top of it. - # This allows including extra (temporary) files in backup archive - # without messing actual rootfs. - tmp="$(mktemp -d -t overlay.XXXXXX)" - mkdir -p "$tmp/upper" "$tmp/work" "$tmp/backup" - dir="$tmp/backup" - if ! mount -t overlay overlay -o lowerdir=/,upperdir="$tmp/upper",workdir="$tmp/work" "$dir"; then - echo "Cannot mount backup overlay to $dir." >&2 - ask_bool 0 "Abort" && exit - dir="" - fi - - if [ "$SAVE_INSTALLED_PKGS" -eq 1 ]; then - echo "${INSTALLED_PACKAGES}" >> "$CONFFILES" - mkdir -p "$dir/$ETCBACKUP_DIR" - - # Format: pkg-name{rom,overlay,unkown} - # rom is used for pkgs in /rom, even if updated later - find /usr/lib/opkg/info -name "*.control" \( \ - \( -exec test -f /rom/{} \; -exec echo {} rom \; \) -o \ - \( -exec test -f /overlay/upper/{} \; -exec echo {} overlay \; \) -o \ - \( -exec echo {} unknown \; \) \ - \) | sed -e 's,.*/,,;s/\.control /\t/' > "$dir/${INSTALLED_PACKAGES}" - fi - - mkdir -p $dir/etc/uci-defaults/ - touch $dir/etc/uci-defaults/10_disable_services - for service in /etc/init.d/*; do - if ! $service enabled; then - echo "$service disable" >> $dir/etc/uci-defaults/10_disable_services - fi - done - echo "exit 0" >> $dir/etc/uci-defaults/10_disable_services - echo "/etc/uci-defaults/10_disable_services" >> "$CONFFILES" + [ "$conf_tar" != "-" ] || conf_tar="" v "Saving config files..." [ "$VERBOSE" -gt 1 ] && TAR_V="v" || TAR_V="" sed -i -e 's,^/,,' "$CONFFILES" - tar c${TAR_V}zf "$conf_tar" -C "${dir:-/}" -T "$CONFFILES" - local err=$? + set -o pipefail + { + local ret=0 + + if [ $ret -eq 0 ]; then + for service in /etc/init.d/*; do + if ! $service enabled; then + disabled="$disabled$service disable\n" + fi + done + disabled="$disabled\nexit 0" + tar_print_member "/etc/uci-defaults/10_disable_services" "$(echo -e $disabled)" || ret=1 + fi + + # Part of archive with installed packages info + if [ $ret -eq 0 ]; then + if [ "$SAVE_INSTALLED_PKGS" -eq 1 ]; then + # Format: pkg-name{rom,overlay,unknown} + # rom is used for pkgs in /rom, even if updated later + tar_print_member "$INSTALLED_PACKAGES" "$(find /usr/lib/opkg/info -name "*.control" \( \ + \( -exec test -f /rom/{} \; -exec echo {} rom \; \) -o \ + \( -exec test -f /overlay/upper/{} \; -exec echo {} overlay \; \) -o \ + \( -exec echo {} unknown \; \) \ + \) | sed -e 's,.*/,,;s/\.control /\t/')" || ret=1 + fi + fi + + # Rest of archive with config files and ending padding + if [ $ret -eq 0 ]; then + tar c${TAR_V} -C / -T "$CONFFILES" || ret=1 + fi + + [ $ret -eq 0 ] + } | gzip > "${conf_tar:-/proc/self/fd/1}" + err=$? + set +o pipefail + if [ "$err" -ne 0 ]; then echo "Failed to create the configuration backup." - rm -f "$conf_tar" + [ -f "$conf_tar" ] && rm -f "$conf_tar" fi - umount "$dir" - rm -rf "$tmp" - rm -f "$CONFFILES" return "$err" @@ -297,7 +308,7 @@ if [ $CONF_BACKUP_LIST -eq 1 ]; then fi if [ -n "$CONF_BACKUP" ]; then - do_save_conffiles "$CONF_BACKUP" + create_backup_archive "$CONF_BACKUP" exit fi @@ -309,7 +320,11 @@ if [ -n "$CONF_RESTORE" ]; then [ "$VERBOSE" -gt 1 ] && TAR_V="v" || TAR_V="" v "Restoring config files..." - tar -C / -x${TAR_V}zf "$CONF_RESTORE" + if [ "$(type -t platform_restore_backup)" == 'platform_restore_backup' ]; then + platform_restore_backup "$TAR_V" + else + tar -C / -x${TAR_V}zf "$CONF_RESTORE" + fi exit $? fi @@ -367,7 +382,7 @@ if [ -n "$CONF_IMAGE" ]; then get_image "$CONF_IMAGE" "cat" > "$CONF_TAR" export SAVE_CONFIG=1 elif ask_bool $SAVE_CONFIG "Keep config files over reflash"; then - [ $TEST -eq 1 ] || do_save_conffiles "$CONF_TAR" || exit + [ $TEST -eq 1 ] || create_backup_archive "$CONF_TAR" || exit export SAVE_CONFIG=1 else [ $TEST -eq 1 ] || rm -f "$CONF_TAR" @@ -381,8 +396,6 @@ fi install_bin /sbin/upgraded v "Commencing upgrade. Closing all shell sessions." -COMMAND='/lib/upgrade/do_stage2' - if [ -n "$FAILSAFE" ]; then printf '%s\x00%s\x00%s' "$RAM_ROOT" "$IMAGE" "$COMMAND" >/tmp/sysupgrade lock -u /tmp/.failsafe diff --git a/package/boot/opensbi/Makefile b/package/boot/opensbi/Makefile index 01348e50aad4a8..6bb33ad2aa02ac 100644 --- a/package/boot/opensbi/Makefile +++ b/package/boot/opensbi/Makefile @@ -29,7 +29,7 @@ include $(INCLUDE_DIR)/package.mk define Package/opensbi SECTION:=boot CATEGORY:=Boot Loaders - DEPENDS:=@TARGET_sifiveu + DEPENDS:=@(TARGET_sifiveu||TARGET_d1) URL:=https://github.com/riscv/opensbi/blob/master/README.md VARIANT:=$(subst _,/,$(subst opensbi_,,$(1))) TITLE:=OpenSBI generic diff --git a/package/boot/rkbin/Makefile b/package/boot/rkbin/Makefile index affdd7b4e19206..bb116bdcd2b8de 100644 --- a/package/boot/rkbin/Makefile +++ b/package/boot/rkbin/Makefile @@ -25,6 +25,12 @@ define Trusted-Firmware-A/Default BUILD_TARGET:=rockchip endef +define Trusted-Firmware-A/rk3566 + BUILD_SUBTARGET:=armv8 + ATF:=rk35/rk3568_bl31_v1.43.elf + TPL:=rk35/rk3566_ddr_1056MHz_v1.18.bin +endef + define Trusted-Firmware-A/rk3568 BUILD_SUBTARGET:=armv8 ATF:=rk35/rk3568_bl31_v1.43.elf @@ -32,6 +38,7 @@ define Trusted-Firmware-A/rk3568 endef TFA_TARGETS:= \ + rk3566 \ rk3568 define Build/Compile diff --git a/package/boot/uboot-d1/Makefile b/package/boot/uboot-d1/Makefile new file mode 100644 index 00000000000000..610dc5b49856dc --- /dev/null +++ b/package/boot/uboot-d1/Makefile @@ -0,0 +1,84 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Copyright (C) 2023 OpenWrt.org +# + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_VERSION:=2023.01 +PKG_RELEASE:=1 + +PKG_HASH:=69423bad380f89a0916636e89e6dcbd2e4512d584308d922d1039d1e4331950f + +include $(INCLUDE_DIR)/u-boot.mk +include $(INCLUDE_DIR)/package.mk + +include $(INCLUDE_DIR)/u-boot.mk +include $(INCLUDE_DIR)/package.mk + +define U-Boot/Default + BUILD_TARGET:=d1 + UBOOT_IMAGE:=u-boot-sunxi-with-spl.bin + UENV:=default + DTS_DIR:=arch/riscv/dts +endef + +define U-Boot/dongshan_nezha_stu + NAME:=Dongshan Nezha STU + OPENSBI:=generic + DEPENDS:=+opensbi_generic + UBOOT_DTS:=sun20i-d1-dongshan-nezha-stu.dtb + BUILD_DEVICES:=dongshan_nezha_stu +endef + +define U-Boot/lichee_rv_dock + NAME:=LicheePi RV (dock) + OPENSBI:=generic + DEPENDS:=+opensbi_generic + UBOOT_DTS:=sun20i-d1-lichee-rv-dock.dtb + BUILD_DEVICES:=lichee_rv_dock +endef + +define U-Boot/mangopi_mq_pro + NAME:=MangoPi MQ Pro + OPENSBI:=generic + DEPENDS:=+opensbi_generic + UBOOT_DTS:=sun20i-d1-mangopi-mq-pro.dtb + BUILD_DEVICES:=mangopi_mq_pro +endef + +define U-Boot/nezha + NAME:=Nezha D1 + OPENSBI:=generic + DEPENDS:=+opensbi_generic + UBOOT_DTS:=sun20i-d1-nezha.dtb + BUILD_DEVICES:=nezha +endef + +UBOOT_TARGETS := \ + dongshan_nezha_stu \ + lichee_rv_dock \ + mangopi_mq_pro \ + nezha \ + +UBOOT_MAKE_FLAGS += \ + OPENSBI=$(STAGING_DIR_IMAGE)/fw_dynamic-${OPENSBI}.bin + +define Build/Configure + $(call Build/Configure/U-Boot) + sed -i 's/CONFIG_TOOLS_LIBCRYPTO=y/# CONFIG_TOOLS_LIBCRYPTO is not set/' $(PKG_BUILD_DIR)/.config +endef + +define Build/InstallDev + $(INSTALL_DIR) $(STAGING_DIR_IMAGE) + $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(DTS_DIR)/$(UBOOT_DTS) $(STAGING_DIR_IMAGE)/$(UBOOT_DTS) + $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(UBOOT_IMAGE) $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-$(UBOOT_IMAGE) + mkimage -C none -A riscv -T script -d uEnv-$(UENV).txt \ + $(STAGING_DIR_IMAGE)/$(BUILD_DEVICES)-boot.scr +endef + +define Package/u-boot/install/default +endef + +$(eval $(call BuildPackage/U-Boot)) diff --git a/package/boot/uboot-d1/patches/0001-ARM-dts-sun8i-A33-Add-iNet-U70B-REV01.patch b/package/boot/uboot-d1/patches/0001-ARM-dts-sun8i-A33-Add-iNet-U70B-REV01.patch new file mode 100644 index 00000000000000..1dc6468c4b4e1b --- /dev/null +++ b/package/boot/uboot-d1/patches/0001-ARM-dts-sun8i-A33-Add-iNet-U70B-REV01.patch @@ -0,0 +1,197 @@ +From d45e64aad18e5e324425b9efbe6a0ec9e1a343da Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sat, 20 Nov 2021 13:19:13 -0600 +Subject: [PATCH 01/90] ARM: dts: sun8i: A33: Add iNet U70B REV01 + +Signed-off-by: Samuel Holland +--- + arch/arm/dts/Makefile | 1 + + arch/arm/dts/sun8i-a33-inet-u70b-rev1.dts | 172 ++++++++++++++++++++++ + 2 files changed, 173 insertions(+) + create mode 100644 arch/arm/dts/sun8i-a33-inet-u70b-rev1.dts + +--- a/arch/arm/dts/Makefile ++++ b/arch/arm/dts/Makefile +@@ -644,6 +644,7 @@ dtb-$(CONFIG_MACH_SUN8I_A33) += \ + sun8i-a33-et-q8-v1.6.dtb \ + sun8i-a33-ga10h-v1.1.dtb \ + sun8i-a33-inet-d978-rev2.dtb \ ++ sun8i-a33-inet-u70b-rev1.dtb \ + sun8i-a33-ippo-q8h-v1.2.dtb \ + sun8i-a33-olinuxino.dtb \ + sun8i-a33-q8-tablet.dtb \ +--- /dev/null ++++ b/arch/arm/dts/sun8i-a33-inet-u70b-rev1.dts +@@ -0,0 +1,172 @@ ++// SPDX-License-Identifier: (GPL-2.0+ or MIT) ++ ++/dts-v1/; ++ ++#include "sun8i-a33.dtsi" ++#include "sun8i-reference-design-tablet.dtsi" ++ ++/ { ++ model = "iNet U70B REV01"; ++ compatible = "inet-tek,inet-u70b-rev01", "allwinner,sun8i-a33"; ++ ++ aliases { ++ ethernet0 = &rtl8723cs; ++ }; ++ ++ panel: panel { ++ compatible = "panel-dpi"; ++ backlight = <&backlight>; ++ enable-gpios = <&pio 7 7 GPIO_ACTIVE_HIGH>; /* PH7 */ ++ power-supply = <®_dc1sw>; ++ ++ panel-timing { ++ clock-frequency = <51000000>; ++ hactive = <1024>; ++ vactive = <600>; ++ hfront-porch = <162>; ++ hback-porch = <158>; ++ hsync-len = <20>; ++ vback-porch = <25>; ++ vfront-porch = <10>; ++ vsync-len = <3>; ++ hsync-active = <1>; ++ vsync-active = <1>; ++ }; ++ ++ port { ++ panel_in_tcon0: endpoint { ++ remote-endpoint = <&tcon0_out_panel>; ++ }; ++ }; ++ }; ++ ++ speaker_amp: audio-amplifier { ++ compatible = "simple-audio-amplifier"; ++ enable-gpios = <&pio 7 9 GPIO_ACTIVE_HIGH>; /* PH9 */ ++ sound-name-prefix = "Speaker Amp"; ++ }; ++ ++ wifi_pwrseq: wifi-pwrseq { ++ compatible = "mmc-pwrseq-simple"; ++ reset-gpios = <&r_pio 0 6 GPIO_ACTIVE_LOW>; /* PL6 */ ++ post-power-on-delay-ms = <200>; ++ }; ++}; ++ ++&codec { ++ status = "okay"; ++}; ++ ++&dai { ++ status = "okay"; ++}; ++ ++&de { ++ status = "okay"; ++}; ++ ++&i2c1 { ++ clock-frequency = <400000>; ++ ++ accelerometer@18 { ++ compatible = "bosch,bma250"; ++ reg = <0x18>; ++ interrupt-parent = <&pio>; ++ interrupts = <7 10 IRQ_TYPE_EDGE_RISING>; /* PH10 / EINT10 */ ++ }; ++}; ++ ++&mmc1 { ++ pinctrl-0 = <&mmc1_pg_pins>; ++ pinctrl-names = "default"; ++ bus-width = <4>; ++ non-removable; ++ vmmc-supply = <®_dldo1>; ++ vqmmc-supply = <®_dldo2>; ++ status = "okay"; ++ ++ rtl8723cs: wifi@1 { ++ reg = <1>; ++ interrupt-parent = <&r_pio>; ++ interrupts = <0 7 IRQ_TYPE_LEVEL_LOW>; /* PL7 */ ++ }; ++}; ++ ++&nfc { ++ status = "okay"; ++ ++ nand@0 { ++ reg = <0>; ++ allwinner,rb = <0>; ++ nand-ecc-maximize; ++ }; ++}; ++ ++&r_uart { ++ status = "disabled"; ++}; ++ ++®_dldo2 { ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-name = "vcc-wifi-io"; ++}; ++ ++&simplefb_lcd { ++ status = "okay"; ++}; ++ ++&sound { ++ simple-audio-card,aux-devs = <&codec_analog>, <&speaker_amp>; ++ simple-audio-card,widgets = "Headphone", "Headphone Jack", ++ "Microphone", "Internal Microphone", ++ "Speaker", "Internal Speaker"; ++ simple-audio-card,routing = "Headphone Jack", "HP", ++ "Internal Speaker", "Speaker Amp OUTL", ++ "Internal Speaker", "Speaker Amp OUTR", ++ "Speaker Amp INL", "HP", /* PHONEOUT ??? */ ++ "Speaker Amp INR", "HP", /* PHONEOUT ??? */ ++ "Left DAC", "DACL", ++ "Right DAC", "DACR", ++ "ADCL", "Left ADC", ++ "ADCR", "Right ADC", ++ "MIC1", "Internal Microphone", ++ "MIC2", "Headset Microphone", ++ "Headset Microphone", "HBIAS", ++ "Internal Microphone", "MBIAS"; ++ status = "okay"; ++}; ++ ++&tcon0 { ++ pinctrl-0 = <&lcd_rgb666_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++}; ++ ++&tcon0_out { ++ tcon0_out_panel: endpoint { ++ remote-endpoint = <&panel_in_tcon0>; ++ }; ++}; ++ ++&touchscreen { ++ reg = <0x40>; ++ compatible = "silead,gsl1680"; ++ avdd-supply = <®_ldo_io1>; ++ touchscreen-size-x = <1024>; ++ touchscreen-size-y = <600>; ++ status = "okay"; ++}; ++ ++&uart1 { ++ pinctrl-0 = <&uart1_pg_pins>, <&uart1_cts_rts_pg_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++ ++ bluetooth { ++ compatible = "realtek,rtl8723cs-bt"; ++ device-wake-gpios = <&r_pio 0 10 GPIO_ACTIVE_LOW>; /* PL10 */ ++ enable-gpios = <&r_pio 0 8 GPIO_ACTIVE_HIGH>; /* PL8 */ ++ host-wake-gpios = <&r_pio 0 9 GPIO_ACTIVE_HIGH>; /* PL9 */ ++ }; ++}; diff --git a/package/boot/uboot-d1/patches/0002-sunxi-Add-iNet_U70B_rev1_defconfig.patch b/package/boot/uboot-d1/patches/0002-sunxi-Add-iNet_U70B_rev1_defconfig.patch new file mode 100644 index 00000000000000..40f649b7fe25da --- /dev/null +++ b/package/boot/uboot-d1/patches/0002-sunxi-Add-iNet_U70B_rev1_defconfig.patch @@ -0,0 +1,46 @@ +From ddb1f06d1c7758c538e286c0c7a9c8545d2af6b1 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sat, 20 Nov 2021 13:26:36 -0600 +Subject: [PATCH 02/90] sunxi: Add iNet_U70B_rev1_defconfig + +Signed-off-by: Samuel Holland +--- + configs/iNet_U70B_rev1_defconfig | 32 ++++++++++++++++++++++++++++++++ + 1 file changed, 32 insertions(+) + create mode 100644 configs/iNet_U70B_rev1_defconfig + +--- /dev/null ++++ b/configs/iNet_U70B_rev1_defconfig +@@ -0,0 +1,32 @@ ++CONFIG_ARM=y ++CONFIG_ARCH_SUNXI=y ++CONFIG_DEFAULT_DEVICE_TREE="sun8i-a33-inet-u70b-rev1" ++# CONFIG_SPL_SERIAL is not set ++CONFIG_SPL=y ++CONFIG_MACH_SUN8I_A33=y ++CONFIG_DRAM_CLK=480 ++CONFIG_DRAM_ZQ=31675 ++CONFIG_DRAM_ODT_EN=y ++CONFIG_MMC0_CD_PIN="PB4" ++CONFIG_VIDEO_LCD_MODE="x:1024,y:600,depth:18,pclk_khz:51000,le:158,ri:162,up:25,lo:10,hs:20,vs:3,sync:3,vmode:0" ++CONFIG_VIDEO_LCD_DCLK_PHASE=0 ++CONFIG_VIDEO_LCD_POWER="PH7" ++CONFIG_VIDEO_LCD_BL_EN="PH6" ++CONFIG_VIDEO_LCD_BL_PWM="PH0" ++# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set ++CONFIG_CMD_BIND=y ++CONFIG_CMD_CLK=y ++CONFIG_CMD_PWM=y ++CONFIG_CMD_I2C=y ++CONFIG_CMD_WDT=y ++CONFIG_CMD_PMIC=y ++CONFIG_CMD_REGULATOR=y ++# CONFIG_NET is not set ++CONFIG_AXP_GPIO=y ++CONFIG_REGULATOR_AXP=y ++CONFIG_REGULATOR_AXP_USB_POWER=y ++CONFIG_AXP_DLDO1_VOLT=3300 ++CONFIG_DM_PWM=y ++CONFIG_PWM_SUNXI=y ++# CONFIG_REQUIRE_SERIAL_CONSOLE is not set ++CONFIG_USB_MUSB_HOST=y diff --git a/package/boot/uboot-d1/patches/0003-Adapt-iNet-U70B-REV01-for-development-FEL-serial.patch b/package/boot/uboot-d1/patches/0003-Adapt-iNet-U70B-REV01-for-development-FEL-serial.patch new file mode 100644 index 00000000000000..03f1ca11754645 --- /dev/null +++ b/package/boot/uboot-d1/patches/0003-Adapt-iNet-U70B-REV01-for-development-FEL-serial.patch @@ -0,0 +1,85 @@ +From ef808412055d1ef6fe77ff130d3f5a9432fef2d7 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Tue, 3 May 2022 22:35:12 -0500 +Subject: [PATCH 03/90] Adapt iNet U70B REV01 for development (FEL + serial) + +Signed-off-by: Samuel Holland +--- + arch/arm/dts/sun8i-a33-inet-u70b-rev1.dts | 11 +++++++++++ + configs/iNet_U70B_rev1_defconfig | 14 +++++--------- + 2 files changed, 16 insertions(+), 9 deletions(-) + +--- a/arch/arm/dts/sun8i-a33-inet-u70b-rev1.dts ++++ b/arch/arm/dts/sun8i-a33-inet-u70b-rev1.dts +@@ -11,6 +11,7 @@ + + aliases { + ethernet0 = &rtl8723cs; ++ serial0 = &uart0; + }; + + panel: panel { +@@ -76,6 +77,10 @@ + }; + }; + ++&mmc0 { ++ status = "disabled"; ++}; ++ + &mmc1 { + pinctrl-0 = <&mmc1_pg_pins>; + pinctrl-names = "default"; +@@ -158,6 +163,12 @@ + status = "okay"; + }; + ++&uart0 { ++ pinctrl-0 = <&uart0_pf_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++}; ++ + &uart1 { + pinctrl-0 = <&uart1_pg_pins>, <&uart1_cts_rts_pg_pins>; + pinctrl-names = "default"; +--- a/configs/iNet_U70B_rev1_defconfig ++++ b/configs/iNet_U70B_rev1_defconfig +@@ -1,12 +1,12 @@ + CONFIG_ARM=y + CONFIG_ARCH_SUNXI=y + CONFIG_DEFAULT_DEVICE_TREE="sun8i-a33-inet-u70b-rev1" +-# CONFIG_SPL_SERIAL is not set + CONFIG_SPL=y + CONFIG_MACH_SUN8I_A33=y + CONFIG_DRAM_CLK=480 + CONFIG_DRAM_ZQ=31675 + CONFIG_DRAM_ODT_EN=y ++CONFIG_UART0_PORT_F=y + CONFIG_MMC0_CD_PIN="PB4" + CONFIG_VIDEO_LCD_MODE="x:1024,y:600,depth:18,pclk_khz:51000,le:158,ri:162,up:25,lo:10,hs:20,vs:3,sync:3,vmode:0" + CONFIG_VIDEO_LCD_DCLK_PHASE=0 +@@ -14,19 +14,15 @@ CONFIG_VIDEO_LCD_POWER="PH7" + CONFIG_VIDEO_LCD_BL_EN="PH6" + CONFIG_VIDEO_LCD_BL_PWM="PH0" + # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set +-CONFIG_CMD_BIND=y +-CONFIG_CMD_CLK=y +-CONFIG_CMD_PWM=y +-CONFIG_CMD_I2C=y +-CONFIG_CMD_WDT=y ++CONFIG_PREBOOT="fastboot usb 0" + CONFIG_CMD_PMIC=y + CONFIG_CMD_REGULATOR=y +-# CONFIG_NET is not set + CONFIG_AXP_GPIO=y + CONFIG_REGULATOR_AXP=y + CONFIG_REGULATOR_AXP_USB_POWER=y + CONFIG_AXP_DLDO1_VOLT=3300 + CONFIG_DM_PWM=y + CONFIG_PWM_SUNXI=y +-# CONFIG_REQUIRE_SERIAL_CONSOLE is not set +-CONFIG_USB_MUSB_HOST=y ++CONFIG_REMOTEPROC_SUN6I_AR100=y ++CONFIG_USB_MUSB_GADGET=y ++CONFIG_WATCHDOG_AUTOSTART=y diff --git a/package/boot/uboot-d1/patches/0004-ARM-dts-sun6i-mixtile-loftq-Add-USB1-VBUS-regulator.patch b/package/boot/uboot-d1/patches/0004-ARM-dts-sun6i-mixtile-loftq-Add-USB1-VBUS-regulator.patch new file mode 100644 index 00000000000000..b6685936ad44fb --- /dev/null +++ b/package/boot/uboot-d1/patches/0004-ARM-dts-sun6i-mixtile-loftq-Add-USB1-VBUS-regulator.patch @@ -0,0 +1,54 @@ +From 40a0ec0fdb6a110d69151de5480148772877f267 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Thu, 26 Aug 2021 20:39:33 -0500 +Subject: [PATCH 04/90] ARM: dts: sun6i: mixtile-loftq: Add USB1 VBUS regulator + +This board is configured with CONFIG_USB1_VBUS_PIN="PH24", but no +regulator exists in its device tree. Add the regulator, so USB will +continue to work when the PHY driver switches to using the regulator +uclass instead of a GPIO. + +Update the device tree here because it does not exist in Linux. + +Signed-off-by: Samuel Holland +--- + arch/arm/dts/sun6i-a31-mixtile-loftq.dts | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +--- a/arch/arm/dts/sun6i-a31-mixtile-loftq.dts ++++ b/arch/arm/dts/sun6i-a31-mixtile-loftq.dts +@@ -6,6 +6,9 @@ + */ + + /dts-v1/; ++ ++#include ++ + #include "sun6i-a31.dtsi" + + / { +@@ -19,6 +22,15 @@ + chosen { + stdout-path = "serial0:115200n8"; + }; ++ ++ reg_usb1_vbus: usb1-vbus { ++ compatible = "regulator-fixed"; ++ regulator-name = "usb1-vbus"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ enable-active-high; ++ gpio = <&pio 7 24 GPIO_ACTIVE_HIGH>; /* PH24 */ ++ }; + }; + + &ehci0 { +@@ -56,3 +68,8 @@ + pinctrl-0 = <&uart0_ph_pins>; + status = "okay"; + }; ++ ++&usbphy { ++ usb1_vbus-supply = <®_usb1_vbus>; ++ status = "okay"; ++}; diff --git a/package/boot/uboot-d1/patches/0005-power-regulator-Add-a-driver-for-the-AXP-USB-power-s.patch b/package/boot/uboot-d1/patches/0005-power-regulator-Add-a-driver-for-the-AXP-USB-power-s.patch new file mode 100644 index 00000000000000..62f81e3cd6137a --- /dev/null +++ b/package/boot/uboot-d1/patches/0005-power-regulator-Add-a-driver-for-the-AXP-USB-power-s.patch @@ -0,0 +1,97 @@ +From e07c1d516c1a7842510d22a7cf88666d500a9a9a Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sun, 22 Aug 2021 21:35:45 -0500 +Subject: [PATCH 05/90] power: regulator: Add a driver for the AXP USB power + supply + +This driver reports the presence/absence of voltage on the PMIC's USB +VBUS pin. This information is used by the USB PHY driver. The +corresponding Linux driver uses the power supply class, which does not +exist in U-Boot. UCLASS_REGULATOR seems to be the closest match. + +Signed-off-by: Samuel Holland +--- + drivers/power/regulator/Kconfig | 7 ++++ + drivers/power/regulator/Makefile | 1 + + drivers/power/regulator/axp_usb_power.c | 49 +++++++++++++++++++++++++ + 3 files changed, 57 insertions(+) + create mode 100644 drivers/power/regulator/axp_usb_power.c + +--- a/drivers/power/regulator/Kconfig ++++ b/drivers/power/regulator/Kconfig +@@ -43,6 +43,13 @@ config REGULATOR_AS3722 + but does not yet support change voltages. Currently this must be + done using direct register writes to the PMIC. + ++config REGULATOR_AXP_USB_POWER ++ bool "Enable driver for X-Powers AXP PMIC USB power supply" ++ depends on DM_REGULATOR && PMIC_AXP ++ help ++ Enable support for reading the USB power supply status from ++ X-Powers AXP2xx and AXP8xx PMICs. ++ + config DM_REGULATOR_BD71837 + bool "Enable Driver Model for ROHM BD71837/BD71847 regulators" + depends on DM_REGULATOR && DM_PMIC_BD71837 +--- a/drivers/power/regulator/Makefile ++++ b/drivers/power/regulator/Makefile +@@ -7,6 +7,7 @@ + obj-$(CONFIG_$(SPL_)DM_REGULATOR) += regulator-uclass.o + obj-$(CONFIG_REGULATOR_ACT8846) += act8846.o + obj-$(CONFIG_REGULATOR_AS3722) += as3722_regulator.o ++obj-$(CONFIG_$(SPL_)REGULATOR_AXP_USB_POWER) += axp_usb_power.o + obj-$(CONFIG_$(SPL_)DM_REGULATOR_DA9063) += da9063.o + obj-$(CONFIG_DM_REGULATOR_MAX77686) += max77686.o + obj-$(CONFIG_DM_REGULATOR_NPCM8XX) += npcm8xx_regulator.o +--- /dev/null ++++ b/drivers/power/regulator/axp_usb_power.c +@@ -0,0 +1,49 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++ ++#include ++#include ++#include ++#include ++ ++#define AXP_POWER_STATUS 0x00 ++#define AXP_POWER_STATUS_VBUS_PRESENT BIT(5) ++ ++static int axp_usb_power_get_enable(struct udevice *dev) ++{ ++ int ret; ++ ++ ret = pmic_reg_read(dev->parent, AXP_POWER_STATUS); ++ if (ret < 0) ++ return ret; ++ ++ return !!(ret & AXP_POWER_STATUS_VBUS_PRESENT); ++} ++ ++static const struct dm_regulator_ops axp_usb_power_ops = { ++ .get_enable = axp_usb_power_get_enable, ++}; ++ ++static int axp_usb_power_probe(struct udevice *dev) ++{ ++ struct dm_regulator_uclass_plat *uc_plat = dev_get_uclass_plat(dev); ++ ++ uc_plat->type = REGULATOR_TYPE_FIXED; ++ ++ return 0; ++} ++ ++static const struct udevice_id axp_usb_power_ids[] = { ++ { .compatible = "x-powers,axp202-usb-power-supply" }, ++ { .compatible = "x-powers,axp221-usb-power-supply" }, ++ { .compatible = "x-powers,axp223-usb-power-supply" }, ++ { .compatible = "x-powers,axp813-usb-power-supply" }, ++ { } ++}; ++ ++U_BOOT_DRIVER(axp_usb_power) = { ++ .name = "axp_usb_power", ++ .id = UCLASS_REGULATOR, ++ .of_match = axp_usb_power_ids, ++ .probe = axp_usb_power_probe, ++ .ops = &axp_usb_power_ops, ++}; diff --git a/package/boot/uboot-d1/patches/0006-gpio-axp-sunxi-Remove-virtual-VBUS-detection-GPIO.patch b/package/boot/uboot-d1/patches/0006-gpio-axp-sunxi-Remove-virtual-VBUS-detection-GPIO.patch new file mode 100644 index 00000000000000..e890583beae996 --- /dev/null +++ b/package/boot/uboot-d1/patches/0006-gpio-axp-sunxi-Remove-virtual-VBUS-detection-GPIO.patch @@ -0,0 +1,122 @@ +From c750151e1107a8d46ca0f9bd30c1da276b142ec1 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Thu, 26 Aug 2021 18:02:54 -0500 +Subject: [PATCH 06/90] gpio: axp/sunxi: Remove virtual VBUS detection GPIO + +Now that this functionality is modeled using the device tree and +regulator uclass, the named GPIO is not referenced anywhere. Remove it. + +Signed-off-by: Samuel Holland +--- + arch/arm/include/asm/arch-sunxi/gpio.h | 1 - + drivers/gpio/axp_gpio.c | 21 ++++----------------- + drivers/gpio/sunxi_gpio.c | 6 +----- + include/axp209.h | 1 - + include/axp221.h | 1 - + include/axp809.h | 1 - + include/axp818.h | 1 - + 7 files changed, 5 insertions(+), 27 deletions(-) + +--- a/arch/arm/include/asm/arch-sunxi/gpio.h ++++ b/arch/arm/include/asm/arch-sunxi/gpio.h +@@ -209,7 +209,6 @@ enum sunxi_gpio_number { + + /* Virtual AXP0 GPIOs */ + #define SUNXI_GPIO_AXP0_PREFIX "AXP0-" +-#define SUNXI_GPIO_AXP0_VBUS_DETECT 4 + #define SUNXI_GPIO_AXP0_VBUS_ENABLE 5 + #define SUNXI_GPIO_AXP0_GPIO_COUNT 6 + +--- a/drivers/gpio/axp_gpio.c ++++ b/drivers/gpio/axp_gpio.c +@@ -36,18 +36,11 @@ static int axp_gpio_direction_input(stru + { + u8 reg; + +- switch (pin) { +-#ifndef CONFIG_AXP152_POWER /* NA on axp152 */ +- case SUNXI_GPIO_AXP0_VBUS_DETECT: +- return 0; +-#endif +- default: +- reg = axp_get_gpio_ctrl_reg(pin); +- if (reg == 0) +- return -EINVAL; ++ reg = axp_get_gpio_ctrl_reg(pin); ++ if (reg == 0) ++ return -EINVAL; + +- return pmic_bus_write(reg, AXP_GPIO_CTRL_INPUT); +- } ++ return pmic_bus_write(reg, AXP_GPIO_CTRL_INPUT); + } + + static int axp_gpio_direction_output(struct udevice *dev, unsigned pin, +@@ -83,12 +76,6 @@ static int axp_gpio_get_value(struct ude + int ret; + + switch (pin) { +-#ifndef CONFIG_AXP152_POWER /* NA on axp152 */ +- case SUNXI_GPIO_AXP0_VBUS_DETECT: +- ret = pmic_bus_read(AXP_POWER_STATUS, &val); +- mask = AXP_POWER_STATUS_VBUS_PRESENT; +- break; +-#endif + #ifdef AXP_MISC_CTRL_N_VBUSEN_FUNC + /* Only available on later PMICs */ + case SUNXI_GPIO_AXP0_VBUS_ENABLE: +--- a/drivers/gpio/sunxi_gpio.c ++++ b/drivers/gpio/sunxi_gpio.c +@@ -117,11 +117,7 @@ int sunxi_name_to_gpio(const char *name) + #if !defined CONFIG_SPL_BUILD && defined CONFIG_AXP_GPIO + char lookup[8]; + +- if (strcasecmp(name, "AXP0-VBUS-DETECT") == 0) { +- sprintf(lookup, SUNXI_GPIO_AXP0_PREFIX "%d", +- SUNXI_GPIO_AXP0_VBUS_DETECT); +- name = lookup; +- } else if (strcasecmp(name, "AXP0-VBUS-ENABLE") == 0) { ++ if (strcasecmp(name, "AXP0-VBUS-ENABLE") == 0) { + sprintf(lookup, SUNXI_GPIO_AXP0_PREFIX "%d", + SUNXI_GPIO_AXP0_VBUS_ENABLE); + name = lookup; +--- a/include/axp209.h ++++ b/include/axp209.h +@@ -77,7 +77,6 @@ enum axp209_reg { + #ifdef CONFIG_AXP209_POWER + #define AXP_POWER_STATUS 0x00 + #define AXP_POWER_STATUS_ALDO_IN BIT(0) +-#define AXP_POWER_STATUS_VBUS_PRESENT BIT(5) + #define AXP_GPIO0_CTRL 0x90 + #define AXP_GPIO1_CTRL 0x92 + #define AXP_GPIO2_CTRL 0x93 +--- a/include/axp221.h ++++ b/include/axp221.h +@@ -53,7 +53,6 @@ + #ifdef CONFIG_AXP221_POWER + #define AXP_POWER_STATUS 0x00 + #define AXP_POWER_STATUS_ALDO_IN BIT(0) +-#define AXP_POWER_STATUS_VBUS_PRESENT BIT(5) + #define AXP_VBUS_IPSOUT 0x30 + #define AXP_VBUS_IPSOUT_DRIVEBUS (1 << 2) + #define AXP_MISC_CTRL 0x8f +--- a/include/axp809.h ++++ b/include/axp809.h +@@ -47,7 +47,6 @@ + #ifdef CONFIG_AXP809_POWER + #define AXP_POWER_STATUS 0x00 + #define AXP_POWER_STATUS_ALDO_IN BIT(0) +-#define AXP_POWER_STATUS_VBUS_PRESENT BIT(5) + #define AXP_VBUS_IPSOUT 0x30 + #define AXP_VBUS_IPSOUT_DRIVEBUS (1 << 2) + #define AXP_MISC_CTRL 0x8f +--- a/include/axp818.h ++++ b/include/axp818.h +@@ -61,7 +61,6 @@ + #ifdef CONFIG_AXP818_POWER + #define AXP_POWER_STATUS 0x00 + #define AXP_POWER_STATUS_ALDO_IN BIT(0) +-#define AXP_POWER_STATUS_VBUS_PRESENT BIT(5) + #define AXP_VBUS_IPSOUT 0x30 + #define AXP_VBUS_IPSOUT_DRIVEBUS (1 << 2) + #define AXP_MISC_CTRL 0x8f diff --git a/package/boot/uboot-d1/patches/0007-power-regulator-Add-a-driver-for-the-AXP-PMIC-drivev.patch b/package/boot/uboot-d1/patches/0007-power-regulator-Add-a-driver-for-the-AXP-PMIC-drivev.patch new file mode 100644 index 00000000000000..35b4597f9851c7 --- /dev/null +++ b/package/boot/uboot-d1/patches/0007-power-regulator-Add-a-driver-for-the-AXP-PMIC-drivev.patch @@ -0,0 +1,111 @@ +From 25434a394705d2de92c50981e31347db4074204a Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Thu, 26 Aug 2021 21:32:15 -0500 +Subject: [PATCH 07/90] power: regulator: Add a driver for the AXP PMIC + drivevbus + +The first AXP regulator converted to use the regulator uclass is the +drivevbus switch, since it is used by the USB PHY driver. + +Signed-off-by: Samuel Holland +--- + drivers/power/regulator/Kconfig | 14 ++++++ + drivers/power/regulator/Makefile | 1 + + drivers/power/regulator/axp_regulator.c | 58 +++++++++++++++++++++++++ + 3 files changed, 73 insertions(+) + create mode 100644 drivers/power/regulator/axp_regulator.c + +--- a/drivers/power/regulator/Kconfig ++++ b/drivers/power/regulator/Kconfig +@@ -43,6 +43,20 @@ config REGULATOR_AS3722 + but does not yet support change voltages. Currently this must be + done using direct register writes to the PMIC. + ++config REGULATOR_AXP ++ bool "Enable driver for X-Powers AXP PMIC regulators" ++ depends on DM_REGULATOR && PMIC_AXP ++ help ++ Enable support for the regulators (DCDCs, LDOs) in the ++ X-Powers AXP152, AXP2xx, and AXP8xx PMICs. ++ ++config SPL_REGULATOR_AXP ++ bool "Enable driver for X-Powers AXP PMIC regulators in SPL" ++ depends on SPL_DM_REGULATOR && SPL_PMIC_AXP ++ help ++ Enable support in SPL for the regulators (DCDCs, LDOs) in the ++ X-Powers AXP152, AXP2xx, and AXP8xx PMICs. ++ + config REGULATOR_AXP_USB_POWER + bool "Enable driver for X-Powers AXP PMIC USB power supply" + depends on DM_REGULATOR && PMIC_AXP +--- a/drivers/power/regulator/Makefile ++++ b/drivers/power/regulator/Makefile +@@ -7,6 +7,7 @@ + obj-$(CONFIG_$(SPL_)DM_REGULATOR) += regulator-uclass.o + obj-$(CONFIG_REGULATOR_ACT8846) += act8846.o + obj-$(CONFIG_REGULATOR_AS3722) += as3722_regulator.o ++obj-$(CONFIG_$(SPL_)REGULATOR_AXP) += axp_regulator.o + obj-$(CONFIG_$(SPL_)REGULATOR_AXP_USB_POWER) += axp_usb_power.o + obj-$(CONFIG_$(SPL_)DM_REGULATOR_DA9063) += da9063.o + obj-$(CONFIG_DM_REGULATOR_MAX77686) += max77686.o +--- /dev/null ++++ b/drivers/power/regulator/axp_regulator.c +@@ -0,0 +1,58 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++ ++#include ++#include ++#include ++#include ++ ++#define AXP_VBUS_IPSOUT 0x30 ++#define AXP_VBUS_IPSOUT_DRIVEBUS BIT(2) ++#define AXP_MISC_CTRL 0x8f ++#define AXP_MISC_CTRL_N_VBUSEN_FUNC BIT(4) ++ ++static int axp_drivevbus_get_enable(struct udevice *dev) ++{ ++ int ret; ++ ++ ret = pmic_reg_read(dev->parent, AXP_VBUS_IPSOUT); ++ if (ret < 0) ++ return ret; ++ ++ return !!(ret & AXP_VBUS_IPSOUT_DRIVEBUS); ++} ++ ++static int axp_drivevbus_set_enable(struct udevice *dev, bool enable) ++{ ++ return pmic_clrsetbits(dev->parent, AXP_VBUS_IPSOUT, ++ AXP_VBUS_IPSOUT_DRIVEBUS, ++ enable ? AXP_VBUS_IPSOUT_DRIVEBUS : 0); ++} ++ ++static const struct dm_regulator_ops axp_drivevbus_ops = { ++ .get_enable = axp_drivevbus_get_enable, ++ .set_enable = axp_drivevbus_set_enable, ++}; ++ ++static int axp_drivevbus_probe(struct udevice *dev) ++{ ++ struct dm_regulator_uclass_plat *uc_plat = dev_get_uclass_plat(dev); ++ int ret; ++ ++ uc_plat->type = REGULATOR_TYPE_FIXED; ++ ++ if (dev_read_bool(dev->parent, "x-powers,drive-vbus-en")) { ++ ret = pmic_clrsetbits(dev->parent, AXP_MISC_CTRL, ++ AXP_MISC_CTRL_N_VBUSEN_FUNC, 0); ++ if (ret) ++ return ret; ++ } ++ ++ return 0; ++} ++ ++U_BOOT_DRIVER(axp_drivevbus) = { ++ .name = "axp_drivevbus", ++ .id = UCLASS_REGULATOR, ++ .probe = axp_drivevbus_probe, ++ .ops = &axp_drivevbus_ops, ++}; diff --git a/package/boot/uboot-d1/patches/0008-power-pmic-axp-Probe-the-drivevbus-regulator-from-th.patch b/package/boot/uboot-d1/patches/0008-power-pmic-axp-Probe-the-drivevbus-regulator-from-th.patch new file mode 100644 index 00000000000000..2e8ed790ded419 --- /dev/null +++ b/package/boot/uboot-d1/patches/0008-power-pmic-axp-Probe-the-drivevbus-regulator-from-th.patch @@ -0,0 +1,41 @@ +From a588c97f146b67bae47099bc419cf10c02eca169 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Thu, 26 Aug 2021 21:34:33 -0500 +Subject: [PATCH 08/90] power: pmic: axp: Probe the drivevbus regulator from + the DT + +Now that some regulator driver exists for this PMIC, add support for +probing regulator drivers from the device tree subnodes. + +Signed-off-by: Samuel Holland +--- + drivers/power/pmic/axp.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/drivers/power/pmic/axp.c ++++ b/drivers/power/pmic/axp.c +@@ -45,14 +45,24 @@ static struct dm_pmic_ops axp_pmic_ops = + .write = dm_i2c_write, + }; + ++static const struct pmic_child_info axp_pmic_child_info[] = { ++ { "drivevbus", "axp_drivevbus" }, ++ { } ++}; ++ + static int axp_pmic_bind(struct udevice *dev) + { ++ ofnode regulators_node; + int ret; + + ret = dm_scan_fdt_dev(dev); + if (ret) + return ret; + ++ regulators_node = dev_read_subnode(dev, "regulators"); ++ if (ofnode_valid(regulators_node)) ++ pmic_bind_children(dev, regulators_node, axp_pmic_child_info); ++ + if (CONFIG_IS_ENABLED(SYSRESET)) { + ret = device_bind_driver_to_node(dev, "axp_sysreset", "axp_sysreset", + dev_ofnode(dev), NULL); diff --git a/package/boot/uboot-d1/patches/0009-phy-sun4i-usb-Control-USB-supplies-via-regulator-ucl.patch b/package/boot/uboot-d1/patches/0009-phy-sun4i-usb-Control-USB-supplies-via-regulator-ucl.patch new file mode 100644 index 00000000000000..bbbfd58617429e --- /dev/null +++ b/package/boot/uboot-d1/patches/0009-phy-sun4i-usb-Control-USB-supplies-via-regulator-ucl.patch @@ -0,0 +1,162 @@ +From e8fb34342dfb79cd2059431dd1a0f03202a244ca Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Thu, 26 Aug 2021 22:11:37 -0500 +Subject: [PATCH 09/90] phy: sun4i-usb: Control USB supplies via regulator + uclass + +The device tree binding for the PHY provides VBUS supplies as regulator +references. Now that all boards have the appropriate regulator uclass +drivers enabled, the PHY driver can switch to using them. This replaces +direct GPIO usage, which in some cases needed a special DM-incompatible +"virtual" GPIO from the PMIC. + +The following boards provided a value for CONFIG_USB0_VBUS_PIN, but are +missing the "usb0_vbus-supply" property in their device tree. None of +them have the MUSB controller enabled in host or OTG mode, so they +should see no impact: + - Ainol_AW1_defconfig / sun7i-a20-ainol-aw1 + - Ampe_A76_defconfig / sun5i-a13-ampe-a76 + - CHIP_pro_defconfig / sun5i-gr8-chip-pro + - Cubieboard4_defconfig / sun9i-a80-cubieboard4 + - Merrii_A80_Optimus_defconfig / sun9i-a80-optimus + - Sunchip_CX-A99_defconfig / sun9i-a80-cx-a99 + - Yones_Toptech_BD1078_defconfig / sun7i-a20-yones-toptech-bd1078 + - Yones_Toptech_BS1078_V2_defconfig / + sun6i-a31s-yones-toptech-bs1078-v2 + - iNet_3F_defconfig / sun4i-a10-inet-3f + - iNet_3W_defconfig / sun4i-a10-inet-3w + - iNet_86VS_defconfig / sun5i-a13-inet-86vs + - iNet_D978_rev2_defconfig / sun8i-a33-inet-d978-rev2 + - icnova-a20-swac_defconfig / sun7i-a20-icnova-swac + - sun8i_a23_evb_defconfig / sun8i-a23-evb + +Similarly, the following boards set CONFIG_USB1_VBUS_PIN, but do not +have "usb1_vbus-supply" in their device tree. Neither of them have USB +enabled at all, so again there should be no impact: + - Cubieboard4_defconfig / sun9i-a80-cubieboard4 (also for USB3) + - sun8i_a23_evb_defconfig / sun8i-a23-evb + +The following boards use a different pin for USB1 VBUS between their +defconfig and their device tree. Depending on which is correct, they +may be broken: + - Linksprite_pcDuino3_Nano_defconfig (PH11) / + sun7i-a20-pcduino3-nano (PD2) + - icnova-a20-swac_defconfig (PG10) / sun7i-a20-icnova-swac (PH6) + +Finally, this board has conflicting pins given for its USB2 VBUS: + - Lamobo_R1_defconfig (PH3) / sun7i-a20-lamobo-r1 (PH12) + +Signed-off-by: Samuel Holland +--- + drivers/phy/allwinner/phy-sun4i-usb.c | 41 +++++++++++++-------------- + 1 file changed, 19 insertions(+), 22 deletions(-) + +--- a/drivers/phy/allwinner/phy-sun4i-usb.c ++++ b/drivers/phy/allwinner/phy-sun4i-usb.c +@@ -97,27 +97,22 @@ struct sun4i_usb_phy_cfg { + }; + + struct sun4i_usb_phy_info { +- const char *gpio_vbus; + const char *gpio_vbus_det; + const char *gpio_id_det; + } phy_info[] = { + { +- .gpio_vbus = CONFIG_USB0_VBUS_PIN, + .gpio_vbus_det = CONFIG_USB0_VBUS_DET, + .gpio_id_det = CONFIG_USB0_ID_DET, + }, + { +- .gpio_vbus = CONFIG_USB1_VBUS_PIN, + .gpio_vbus_det = NULL, + .gpio_id_det = NULL, + }, + { +- .gpio_vbus = CONFIG_USB2_VBUS_PIN, + .gpio_vbus_det = NULL, + .gpio_id_det = NULL, + }, + { +- .gpio_vbus = CONFIG_USB3_VBUS_PIN, + .gpio_vbus_det = NULL, + .gpio_id_det = NULL, + }, +@@ -125,11 +120,11 @@ struct sun4i_usb_phy_info { + + struct sun4i_usb_phy_plat { + void __iomem *pmu; +- struct gpio_desc gpio_vbus; + struct gpio_desc gpio_vbus_det; + struct gpio_desc gpio_id_det; + struct clk clocks; + struct reset_ctl resets; ++ struct udevice *vbus; + int id; + }; + +@@ -218,14 +213,18 @@ static int sun4i_usb_phy_power_on(struct + { + struct sun4i_usb_phy_data *data = dev_get_priv(phy->dev); + struct sun4i_usb_phy_plat *usb_phy = &data->usb_phy[phy->id]; ++ int ret; + + if (initial_usb_scan_delay) { + mdelay(initial_usb_scan_delay); + initial_usb_scan_delay = 0; + } + +- if (dm_gpio_is_valid(&usb_phy->gpio_vbus)) +- dm_gpio_set_value(&usb_phy->gpio_vbus, 1); ++ if (usb_phy->vbus) { ++ ret = regulator_set_enable(usb_phy->vbus, true); ++ if (ret && ret != -ENOSYS) ++ return ret; ++ } + + return 0; + } +@@ -234,9 +233,13 @@ static int sun4i_usb_phy_power_off(struc + { + struct sun4i_usb_phy_data *data = dev_get_priv(phy->dev); + struct sun4i_usb_phy_plat *usb_phy = &data->usb_phy[phy->id]; ++ int ret; + +- if (dm_gpio_is_valid(&usb_phy->gpio_vbus)) +- dm_gpio_set_value(&usb_phy->gpio_vbus, 0); ++ if (usb_phy->vbus) { ++ ret = regulator_set_enable(usb_phy->vbus, false); ++ if (ret && ret != -ENOSYS) ++ return ret; ++ } + + return 0; + } +@@ -450,22 +453,16 @@ static int sun4i_usb_phy_probe(struct ud + for (i = 0; i < data->cfg->num_phys; i++) { + struct sun4i_usb_phy_plat *phy = &plat[i]; + struct sun4i_usb_phy_info *info = &phy_info[i]; +- char name[16]; ++ char name[20]; + + if (data->cfg->missing_phys & BIT(i)) + continue; + +- ret = dm_gpio_lookup_name(info->gpio_vbus, &phy->gpio_vbus); +- if (ret == 0) { +- ret = dm_gpio_request(&phy->gpio_vbus, "usb_vbus"); +- if (ret) +- return ret; +- ret = dm_gpio_set_dir_flags(&phy->gpio_vbus, +- GPIOD_IS_OUT); +- if (ret) +- return ret; +- ret = dm_gpio_set_value(&phy->gpio_vbus, 0); +- if (ret) ++ snprintf(name, sizeof(name), "usb%d_vbus-supply", i); ++ ret = device_get_supply_regulator(dev, name, &phy->vbus); ++ if (phy->vbus) { ++ ret = regulator_set_enable(phy->vbus, false); ++ if (ret && ret != -ENOSYS) + return ret; + } + diff --git a/package/boot/uboot-d1/patches/0010-sunxi-Remove-obsolete-USBx_VBUS_PIN-Kconfig-symbols.patch b/package/boot/uboot-d1/patches/0010-sunxi-Remove-obsolete-USBx_VBUS_PIN-Kconfig-symbols.patch new file mode 100644 index 00000000000000..edeae405eaf0aa --- /dev/null +++ b/package/boot/uboot-d1/patches/0010-sunxi-Remove-obsolete-USBx_VBUS_PIN-Kconfig-symbols.patch @@ -0,0 +1,58 @@ +From 649bb7845e30805c66f62fc5725c4dbf350f21cb Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Thu, 26 Aug 2021 22:26:40 -0500 +Subject: [PATCH 10/90] sunxi: Remove obsolete USBx_VBUS_PIN Kconfig symbols + +Now that the USB PHY driver uses the device tree to get VBUS supply +regulators, these Kconfig symbols are unused. Remove them. + +Signed-off-by: Samuel Holland +--- + arch/arm/mach-sunxi/Kconfig | 29 ----------------------------- + 1 file changed, 29 deletions(-) + +--- a/arch/arm/mach-sunxi/Kconfig ++++ b/arch/arm/mach-sunxi/Kconfig +@@ -693,13 +693,6 @@ config MMC_SUNXI_SLOT_EXTRA + slot or emmc on mmc1 - mmc3. Setting this to 1, 2 or 3 will enable + support for this. + +-config USB0_VBUS_PIN +- string "Vbus enable pin for usb0 (otg)" +- default "" +- ---help--- +- Set the Vbus enable pin for usb0 (otg). This takes a string in the +- format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H. +- + config USB0_VBUS_DET + string "Vbus detect pin for usb0 (otg)" + default "" +@@ -714,28 +707,6 @@ config USB0_ID_DET + Set the ID detect pin for usb0 (otg). This takes a string in the + format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H. + +-config USB1_VBUS_PIN +- string "Vbus enable pin for usb1 (ehci0)" +- default "PH6" if MACH_SUN4I || MACH_SUN7I +- default "PH27" if MACH_SUN6I +- ---help--- +- Set the Vbus enable pin for usb1 (ehci0, usb0 is the otg). This takes +- a string in the format understood by sunxi_name_to_gpio, e.g. +- PH1 for pin 1 of port H. +- +-config USB2_VBUS_PIN +- string "Vbus enable pin for usb2 (ehci1)" +- default "PH3" if MACH_SUN4I || MACH_SUN7I +- default "PH24" if MACH_SUN6I +- ---help--- +- See USB1_VBUS_PIN help text. +- +-config USB3_VBUS_PIN +- string "Vbus enable pin for usb3 (ehci2)" +- default "" +- ---help--- +- See USB1_VBUS_PIN help text. +- + config I2C0_ENABLE + bool "Enable I2C/TWI controller 0" + default y if MACH_SUN4I || MACH_SUN5I || MACH_SUN7I || MACH_SUN8I_R40 diff --git a/package/boot/uboot-d1/patches/0011-clk-sunxi-Add-support-for-the-D1-CCU.patch b/package/boot/uboot-d1/patches/0011-clk-sunxi-Add-support-for-the-D1-CCU.patch new file mode 100644 index 00000000000000..faa7f64327ba26 --- /dev/null +++ b/package/boot/uboot-d1/patches/0011-clk-sunxi-Add-support-for-the-D1-CCU.patch @@ -0,0 +1,393 @@ +From 73d6c82e34e89cfde880d1948b3e0dc714adead8 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sat, 30 Apr 2022 22:34:19 -0500 +Subject: [PATCH 11/90] clk: sunxi: Add support for the D1 CCU + +Since the D1 CCU binding is defined, we can add support for its +gates/resets, following the pattern of the existing drivers. + +Series-to: sunxi + +Signed-off-by: Samuel Holland +--- + drivers/clk/sunxi/Kconfig | 6 + + drivers/clk/sunxi/Makefile | 1 + + drivers/clk/sunxi/clk_d1.c | 82 ++++++++++++ + drivers/clk/sunxi/clk_sunxi.c | 5 + + include/dt-bindings/clock/sun20i-d1-ccu.h | 156 ++++++++++++++++++++++ + include/dt-bindings/reset/sun20i-d1-ccu.h | 77 +++++++++++ + 6 files changed, 327 insertions(+) + create mode 100644 drivers/clk/sunxi/clk_d1.c + create mode 100644 include/dt-bindings/clock/sun20i-d1-ccu.h + create mode 100644 include/dt-bindings/reset/sun20i-d1-ccu.h + +--- a/drivers/clk/sunxi/Kconfig ++++ b/drivers/clk/sunxi/Kconfig +@@ -87,6 +87,12 @@ config CLK_SUN8I_H3 + This enables common clock driver support for platforms based + on Allwinner H3/H5 SoC. + ++config CLK_SUN20I_D1 ++ bool "Clock driver for Allwinner D1" ++ help ++ This enables common clock driver support for platforms based ++ on Allwinner D1 SoC. ++ + config CLK_SUN50I_H6 + bool "Clock driver for Allwinner H6" + default MACH_SUN50I_H6 +--- a/drivers/clk/sunxi/Makefile ++++ b/drivers/clk/sunxi/Makefile +@@ -19,6 +19,7 @@ obj-$(CONFIG_CLK_SUN8I_R40) += clk_r40.o + obj-$(CONFIG_CLK_SUN8I_V3S) += clk_v3s.o + obj-$(CONFIG_CLK_SUN9I_A80) += clk_a80.o + obj-$(CONFIG_CLK_SUN8I_H3) += clk_h3.o ++obj-$(CONFIG_CLK_SUN20I_D1) += clk_d1.o + obj-$(CONFIG_CLK_SUN50I_H6) += clk_h6.o + obj-$(CONFIG_CLK_SUN50I_H6_R) += clk_h6_r.o + obj-$(CONFIG_CLK_SUN50I_H616) += clk_h616.o +--- /dev/null ++++ b/drivers/clk/sunxi/clk_d1.c +@@ -0,0 +1,82 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++/* ++ * Copyright (C) 2021 Samuel Holland ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++static struct ccu_clk_gate d1_gates[] = { ++ [CLK_BUS_MMC0] = GATE(0x84c, BIT(0)), ++ [CLK_BUS_MMC1] = GATE(0x84c, BIT(1)), ++ [CLK_BUS_MMC2] = GATE(0x84c, BIT(2)), ++ [CLK_BUS_UART0] = GATE(0x90c, BIT(0)), ++ [CLK_BUS_UART1] = GATE(0x90c, BIT(1)), ++ [CLK_BUS_UART2] = GATE(0x90c, BIT(2)), ++ [CLK_BUS_UART3] = GATE(0x90c, BIT(3)), ++ [CLK_BUS_UART4] = GATE(0x90c, BIT(4)), ++ [CLK_BUS_UART5] = GATE(0x90c, BIT(5)), ++ [CLK_BUS_I2C0] = GATE(0x91c, BIT(0)), ++ [CLK_BUS_I2C1] = GATE(0x91c, BIT(1)), ++ [CLK_BUS_I2C2] = GATE(0x91c, BIT(2)), ++ [CLK_BUS_I2C3] = GATE(0x91c, BIT(3)), ++ [CLK_SPI0] = GATE(0x940, BIT(31)), ++ [CLK_SPI1] = GATE(0x944, BIT(31)), ++ [CLK_BUS_SPI0] = GATE(0x96c, BIT(0)), ++ [CLK_BUS_SPI1] = GATE(0x96c, BIT(1)), ++ ++ [CLK_BUS_EMAC] = GATE(0x97c, BIT(0)), ++ ++ [CLK_USB_OHCI0] = GATE(0xa70, BIT(31)), ++ [CLK_USB_OHCI1] = GATE(0xa74, BIT(31)), ++ [CLK_BUS_OHCI0] = GATE(0xa8c, BIT(0)), ++ [CLK_BUS_OHCI1] = GATE(0xa8c, BIT(1)), ++ [CLK_BUS_EHCI0] = GATE(0xa8c, BIT(4)), ++ [CLK_BUS_EHCI1] = GATE(0xa8c, BIT(5)), ++ [CLK_BUS_OTG] = GATE(0xa8c, BIT(8)), ++ [CLK_BUS_LRADC] = GATE(0xa9c, BIT(0)), ++ ++ [CLK_RISCV] = GATE(0xd04, BIT(31)), ++}; ++ ++static struct ccu_reset d1_resets[] = { ++ [RST_BUS_MMC0] = RESET(0x84c, BIT(16)), ++ [RST_BUS_MMC1] = RESET(0x84c, BIT(17)), ++ [RST_BUS_MMC2] = RESET(0x84c, BIT(18)), ++ [RST_BUS_UART0] = RESET(0x90c, BIT(16)), ++ [RST_BUS_UART1] = RESET(0x90c, BIT(17)), ++ [RST_BUS_UART2] = RESET(0x90c, BIT(18)), ++ [RST_BUS_UART3] = RESET(0x90c, BIT(19)), ++ [RST_BUS_UART4] = RESET(0x90c, BIT(20)), ++ [RST_BUS_UART5] = RESET(0x90c, BIT(21)), ++ [RST_BUS_I2C0] = RESET(0x91c, BIT(16)), ++ [RST_BUS_I2C1] = RESET(0x91c, BIT(17)), ++ [RST_BUS_I2C2] = RESET(0x91c, BIT(18)), ++ [RST_BUS_I2C3] = RESET(0x91c, BIT(19)), ++ [RST_BUS_SPI0] = RESET(0x96c, BIT(16)), ++ [RST_BUS_SPI1] = RESET(0x96c, BIT(17)), ++ ++ [RST_BUS_EMAC] = RESET(0x97c, BIT(16)), ++ ++ [RST_USB_PHY0] = RESET(0xa70, BIT(30)), ++ [RST_USB_PHY1] = RESET(0xa74, BIT(30)), ++ [RST_BUS_OHCI0] = RESET(0xa8c, BIT(16)), ++ [RST_BUS_OHCI1] = RESET(0xa8c, BIT(17)), ++ [RST_BUS_EHCI0] = RESET(0xa8c, BIT(20)), ++ [RST_BUS_EHCI1] = RESET(0xa8c, BIT(21)), ++ [RST_BUS_OTG] = RESET(0xa8c, BIT(24)), ++ [RST_BUS_LRADC] = RESET(0xa9c, BIT(16)), ++}; ++ ++const struct ccu_desc d1_ccu_desc = { ++ .gates = d1_gates, ++ .resets = d1_resets, ++ .num_gates = ARRAY_SIZE(d1_gates), ++ .num_resets = ARRAY_SIZE(d1_resets), ++}; +--- a/drivers/clk/sunxi/clk_sunxi.c ++++ b/drivers/clk/sunxi/clk_sunxi.c +@@ -118,6 +118,7 @@ extern const struct ccu_desc a64_ccu_des + extern const struct ccu_desc a80_ccu_desc; + extern const struct ccu_desc a80_mmc_clk_desc; + extern const struct ccu_desc a83t_ccu_desc; ++extern const struct ccu_desc d1_ccu_desc; + extern const struct ccu_desc f1c100s_ccu_desc; + extern const struct ccu_desc h3_ccu_desc; + extern const struct ccu_desc h6_ccu_desc; +@@ -183,6 +184,10 @@ static const struct udevice_id sunxi_clk + { .compatible = "allwinner,sun9i-a80-mmc-config-clk", + .data = (ulong)&a80_mmc_clk_desc }, + #endif ++#ifdef CONFIG_CLK_SUN20I_D1 ++ { .compatible = "allwinner,sun20i-d1-ccu", ++ .data = (ulong)&d1_ccu_desc }, ++#endif + #ifdef CONFIG_CLK_SUN50I_A64 + { .compatible = "allwinner,sun50i-a64-ccu", + .data = (ulong)&a64_ccu_desc }, +--- /dev/null ++++ b/include/dt-bindings/clock/sun20i-d1-ccu.h +@@ -0,0 +1,156 @@ ++/* SPDX-License-Identifier: (GPL-2.0+ or MIT) */ ++/* ++ * Copyright (C) 2020 huangzhenwei@allwinnertech.com ++ * Copyright (C) 2021 Samuel Holland ++ */ ++ ++#ifndef _DT_BINDINGS_CLK_SUN20I_D1_CCU_H_ ++#define _DT_BINDINGS_CLK_SUN20I_D1_CCU_H_ ++ ++#define CLK_PLL_CPUX 0 ++#define CLK_PLL_DDR0 1 ++#define CLK_PLL_PERIPH0_4X 2 ++#define CLK_PLL_PERIPH0_2X 3 ++#define CLK_PLL_PERIPH0_800M 4 ++#define CLK_PLL_PERIPH0 5 ++#define CLK_PLL_PERIPH0_DIV3 6 ++#define CLK_PLL_VIDEO0_4X 7 ++#define CLK_PLL_VIDEO0_2X 8 ++#define CLK_PLL_VIDEO0 9 ++#define CLK_PLL_VIDEO1_4X 10 ++#define CLK_PLL_VIDEO1_2X 11 ++#define CLK_PLL_VIDEO1 12 ++#define CLK_PLL_VE 13 ++#define CLK_PLL_AUDIO0_4X 14 ++#define CLK_PLL_AUDIO0_2X 15 ++#define CLK_PLL_AUDIO0 16 ++#define CLK_PLL_AUDIO1 17 ++#define CLK_PLL_AUDIO1_DIV2 18 ++#define CLK_PLL_AUDIO1_DIV5 19 ++#define CLK_CPUX 20 ++#define CLK_CPUX_AXI 21 ++#define CLK_CPUX_APB 22 ++#define CLK_PSI_AHB 23 ++#define CLK_APB0 24 ++#define CLK_APB1 25 ++#define CLK_MBUS 26 ++#define CLK_DE 27 ++#define CLK_BUS_DE 28 ++#define CLK_DI 29 ++#define CLK_BUS_DI 30 ++#define CLK_G2D 31 ++#define CLK_BUS_G2D 32 ++#define CLK_CE 33 ++#define CLK_BUS_CE 34 ++#define CLK_VE 35 ++#define CLK_BUS_VE 36 ++#define CLK_BUS_DMA 37 ++#define CLK_BUS_MSGBOX0 38 ++#define CLK_BUS_MSGBOX1 39 ++#define CLK_BUS_MSGBOX2 40 ++#define CLK_BUS_SPINLOCK 41 ++#define CLK_BUS_HSTIMER 42 ++#define CLK_AVS 43 ++#define CLK_BUS_DBG 44 ++#define CLK_BUS_PWM 45 ++#define CLK_BUS_IOMMU 46 ++#define CLK_DRAM 47 ++#define CLK_MBUS_DMA 48 ++#define CLK_MBUS_VE 49 ++#define CLK_MBUS_CE 50 ++#define CLK_MBUS_TVIN 51 ++#define CLK_MBUS_CSI 52 ++#define CLK_MBUS_G2D 53 ++#define CLK_MBUS_RISCV 54 ++#define CLK_BUS_DRAM 55 ++#define CLK_MMC0 56 ++#define CLK_MMC1 57 ++#define CLK_MMC2 58 ++#define CLK_BUS_MMC0 59 ++#define CLK_BUS_MMC1 60 ++#define CLK_BUS_MMC2 61 ++#define CLK_BUS_UART0 62 ++#define CLK_BUS_UART1 63 ++#define CLK_BUS_UART2 64 ++#define CLK_BUS_UART3 65 ++#define CLK_BUS_UART4 66 ++#define CLK_BUS_UART5 67 ++#define CLK_BUS_I2C0 68 ++#define CLK_BUS_I2C1 69 ++#define CLK_BUS_I2C2 70 ++#define CLK_BUS_I2C3 71 ++#define CLK_SPI0 72 ++#define CLK_SPI1 73 ++#define CLK_BUS_SPI0 74 ++#define CLK_BUS_SPI1 75 ++#define CLK_EMAC_25M 76 ++#define CLK_BUS_EMAC 77 ++#define CLK_IR_TX 78 ++#define CLK_BUS_IR_TX 79 ++#define CLK_BUS_GPADC 80 ++#define CLK_BUS_THS 81 ++#define CLK_I2S0 82 ++#define CLK_I2S1 83 ++#define CLK_I2S2 84 ++#define CLK_I2S2_ASRC 85 ++#define CLK_BUS_I2S0 86 ++#define CLK_BUS_I2S1 87 ++#define CLK_BUS_I2S2 88 ++#define CLK_SPDIF_TX 89 ++#define CLK_SPDIF_RX 90 ++#define CLK_BUS_SPDIF 91 ++#define CLK_DMIC 92 ++#define CLK_BUS_DMIC 93 ++#define CLK_AUDIO_DAC 94 ++#define CLK_AUDIO_ADC 95 ++#define CLK_BUS_AUDIO 96 ++#define CLK_USB_OHCI0 97 ++#define CLK_USB_OHCI1 98 ++#define CLK_BUS_OHCI0 99 ++#define CLK_BUS_OHCI1 100 ++#define CLK_BUS_EHCI0 101 ++#define CLK_BUS_EHCI1 102 ++#define CLK_BUS_OTG 103 ++#define CLK_BUS_LRADC 104 ++#define CLK_BUS_DPSS_TOP 105 ++#define CLK_HDMI_24M 106 ++#define CLK_HDMI_CEC_32K 107 ++#define CLK_HDMI_CEC 108 ++#define CLK_BUS_HDMI 109 ++#define CLK_MIPI_DSI 110 ++#define CLK_BUS_MIPI_DSI 111 ++#define CLK_TCON_LCD0 112 ++#define CLK_BUS_TCON_LCD0 113 ++#define CLK_TCON_TV 114 ++#define CLK_BUS_TCON_TV 115 ++#define CLK_TVE 116 ++#define CLK_BUS_TVE_TOP 117 ++#define CLK_BUS_TVE 118 ++#define CLK_TVD 119 ++#define CLK_BUS_TVD_TOP 120 ++#define CLK_BUS_TVD 121 ++#define CLK_LEDC 122 ++#define CLK_BUS_LEDC 123 ++#define CLK_CSI_TOP 124 ++#define CLK_CSI_MCLK 125 ++#define CLK_BUS_CSI 126 ++#define CLK_TPADC 127 ++#define CLK_BUS_TPADC 128 ++#define CLK_BUS_TZMA 129 ++#define CLK_DSP 130 ++#define CLK_BUS_DSP_CFG 131 ++#define CLK_RISCV 132 ++#define CLK_RISCV_AXI 133 ++#define CLK_BUS_RISCV_CFG 134 ++#define CLK_FANOUT_24M 135 ++#define CLK_FANOUT_12M 136 ++#define CLK_FANOUT_16M 137 ++#define CLK_FANOUT_25M 138 ++#define CLK_FANOUT_32K 139 ++#define CLK_FANOUT_27M 140 ++#define CLK_FANOUT_PCLK 141 ++#define CLK_FANOUT0 142 ++#define CLK_FANOUT1 143 ++#define CLK_FANOUT2 144 ++ ++#endif /* _DT_BINDINGS_CLK_SUN20I_D1_CCU_H_ */ +--- /dev/null ++++ b/include/dt-bindings/reset/sun20i-d1-ccu.h +@@ -0,0 +1,77 @@ ++/* SPDX-License-Identifier: (GPL-2.0+ or MIT) */ ++/* ++ * Copyright (c) 2020 huangzhenwei@allwinnertech.com ++ * Copyright (C) 2021 Samuel Holland ++ */ ++ ++#ifndef _DT_BINDINGS_RST_SUN20I_D1_CCU_H_ ++#define _DT_BINDINGS_RST_SUN20I_D1_CCU_H_ ++ ++#define RST_MBUS 0 ++#define RST_BUS_DE 1 ++#define RST_BUS_DI 2 ++#define RST_BUS_G2D 3 ++#define RST_BUS_CE 4 ++#define RST_BUS_VE 5 ++#define RST_BUS_DMA 6 ++#define RST_BUS_MSGBOX0 7 ++#define RST_BUS_MSGBOX1 8 ++#define RST_BUS_MSGBOX2 9 ++#define RST_BUS_SPINLOCK 10 ++#define RST_BUS_HSTIMER 11 ++#define RST_BUS_DBG 12 ++#define RST_BUS_PWM 13 ++#define RST_BUS_DRAM 14 ++#define RST_BUS_MMC0 15 ++#define RST_BUS_MMC1 16 ++#define RST_BUS_MMC2 17 ++#define RST_BUS_UART0 18 ++#define RST_BUS_UART1 19 ++#define RST_BUS_UART2 20 ++#define RST_BUS_UART3 21 ++#define RST_BUS_UART4 22 ++#define RST_BUS_UART5 23 ++#define RST_BUS_I2C0 24 ++#define RST_BUS_I2C1 25 ++#define RST_BUS_I2C2 26 ++#define RST_BUS_I2C3 27 ++#define RST_BUS_SPI0 28 ++#define RST_BUS_SPI1 29 ++#define RST_BUS_EMAC 30 ++#define RST_BUS_IR_TX 31 ++#define RST_BUS_GPADC 32 ++#define RST_BUS_THS 33 ++#define RST_BUS_I2S0 34 ++#define RST_BUS_I2S1 35 ++#define RST_BUS_I2S2 36 ++#define RST_BUS_SPDIF 37 ++#define RST_BUS_DMIC 38 ++#define RST_BUS_AUDIO 39 ++#define RST_USB_PHY0 40 ++#define RST_USB_PHY1 41 ++#define RST_BUS_OHCI0 42 ++#define RST_BUS_OHCI1 43 ++#define RST_BUS_EHCI0 44 ++#define RST_BUS_EHCI1 45 ++#define RST_BUS_OTG 46 ++#define RST_BUS_LRADC 47 ++#define RST_BUS_DPSS_TOP 48 ++#define RST_BUS_HDMI_SUB 49 ++#define RST_BUS_HDMI_MAIN 50 ++#define RST_BUS_MIPI_DSI 51 ++#define RST_BUS_TCON_LCD0 52 ++#define RST_BUS_TCON_TV 53 ++#define RST_BUS_LVDS0 54 ++#define RST_BUS_TVE 55 ++#define RST_BUS_TVE_TOP 56 ++#define RST_BUS_TVD 57 ++#define RST_BUS_TVD_TOP 58 ++#define RST_BUS_LEDC 59 ++#define RST_BUS_CSI 60 ++#define RST_BUS_TPADC 61 ++#define RST_DSP 62 ++#define RST_BUS_DSP_CFG 63 ++#define RST_BUS_DSP_DBG 64 ++#define RST_BUS_RISCV_CFG 65 ++ ++#endif /* _DT_BINDINGS_RST_SUN20I_D1_CCU_H_ */ diff --git a/package/boot/uboot-d1/patches/0012-gpio-axp-Remove-virtual-VBUS-enable-GPIO.patch b/package/boot/uboot-d1/patches/0012-gpio-axp-Remove-virtual-VBUS-enable-GPIO.patch new file mode 100644 index 00000000000000..53f893c0ff7b73 --- /dev/null +++ b/package/boot/uboot-d1/patches/0012-gpio-axp-Remove-virtual-VBUS-enable-GPIO.patch @@ -0,0 +1,227 @@ +From cbb281e0ec847b9de41970e470348b3534bb9a9f Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Thu, 26 Aug 2021 18:02:54 -0500 +Subject: [PATCH 12/90] gpio: axp: Remove virtual VBUS enable GPIO + +Now that this functionality is modeled using the device tree and +regulator uclass, the named GPIO is not referenced anywhere. Remove +it, along with the rest of the support for AXP virtual GPIOs. + +Signed-off-by: Samuel Holland +--- + arch/arm/include/asm/arch-sunxi/gpio.h | 8 --- + drivers/gpio/axp_gpio.c | 75 ++++++++------------------ + drivers/gpio/sunxi_gpio.c | 8 --- + include/axp221.h | 4 -- + include/axp809.h | 4 -- + include/axp818.h | 4 -- + 6 files changed, 21 insertions(+), 82 deletions(-) + +--- a/arch/arm/include/asm/arch-sunxi/gpio.h ++++ b/arch/arm/include/asm/arch-sunxi/gpio.h +@@ -111,7 +111,6 @@ enum sunxi_gpio_number { + SUNXI_GPIO_L_START = 352, + SUNXI_GPIO_M_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_L), + SUNXI_GPIO_N_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_M), +- SUNXI_GPIO_AXP0_START = 1024, + }; + + /* SUNXI GPIO number definitions */ +@@ -128,8 +127,6 @@ enum sunxi_gpio_number { + #define SUNXI_GPM(_nr) (SUNXI_GPIO_M_START + (_nr)) + #define SUNXI_GPN(_nr) (SUNXI_GPIO_N_START + (_nr)) + +-#define SUNXI_GPAXP0(_nr) (SUNXI_GPIO_AXP0_START + (_nr)) +- + /* GPIO pin function config */ + #define SUNXI_GPIO_INPUT 0 + #define SUNXI_GPIO_OUTPUT 1 +@@ -207,11 +204,6 @@ enum sunxi_gpio_number { + #define SUNXI_GPIO_PULL_UP 1 + #define SUNXI_GPIO_PULL_DOWN 2 + +-/* Virtual AXP0 GPIOs */ +-#define SUNXI_GPIO_AXP0_PREFIX "AXP0-" +-#define SUNXI_GPIO_AXP0_VBUS_ENABLE 5 +-#define SUNXI_GPIO_AXP0_GPIO_COUNT 6 +- + struct sunxi_gpio_plat { + struct sunxi_gpio *regs; + char bank_name[3]; +--- a/drivers/gpio/axp_gpio.c ++++ b/drivers/gpio/axp_gpio.c +@@ -15,6 +15,9 @@ + #include + #include + ++#define AXP_GPIO_PREFIX "AXP0-" ++#define AXP_GPIO_COUNT 4 ++ + static int axp_gpio_set_value(struct udevice *dev, unsigned pin, int val); + + static u8 axp_get_gpio_ctrl_reg(unsigned pin) +@@ -46,28 +49,14 @@ static int axp_gpio_direction_input(stru + static int axp_gpio_direction_output(struct udevice *dev, unsigned pin, + int val) + { +- __maybe_unused int ret; + u8 reg; + +- switch (pin) { +-#ifdef AXP_MISC_CTRL_N_VBUSEN_FUNC +- /* Only available on later PMICs */ +- case SUNXI_GPIO_AXP0_VBUS_ENABLE: +- ret = pmic_bus_clrbits(AXP_MISC_CTRL, +- AXP_MISC_CTRL_N_VBUSEN_FUNC); +- if (ret) +- return ret; +- +- return axp_gpio_set_value(dev, pin, val); +-#endif +- default: +- reg = axp_get_gpio_ctrl_reg(pin); +- if (reg == 0) +- return -EINVAL; ++ reg = axp_get_gpio_ctrl_reg(pin); ++ if (reg == 0) ++ return -EINVAL; + +- return pmic_bus_write(reg, val ? AXP_GPIO_CTRL_OUTPUT_HIGH : +- AXP_GPIO_CTRL_OUTPUT_LOW); +- } ++ return pmic_bus_write(reg, val ? AXP_GPIO_CTRL_OUTPUT_HIGH : ++ AXP_GPIO_CTRL_OUTPUT_LOW); + } + + static int axp_gpio_get_value(struct udevice *dev, unsigned pin) +@@ -75,25 +64,16 @@ static int axp_gpio_get_value(struct ude + u8 reg, val, mask; + int ret; + +- switch (pin) { +-#ifdef AXP_MISC_CTRL_N_VBUSEN_FUNC +- /* Only available on later PMICs */ +- case SUNXI_GPIO_AXP0_VBUS_ENABLE: +- ret = pmic_bus_read(AXP_VBUS_IPSOUT, &val); +- mask = AXP_VBUS_IPSOUT_DRIVEBUS; +- break; +-#endif +- default: +- reg = axp_get_gpio_ctrl_reg(pin); +- if (reg == 0) +- return -EINVAL; ++ reg = axp_get_gpio_ctrl_reg(pin); ++ if (reg == 0) ++ return -EINVAL; + +- ret = pmic_bus_read(AXP_GPIO_STATE, &val); +- mask = 1 << (pin + AXP_GPIO_STATE_OFFSET); +- } ++ ret = pmic_bus_read(AXP_GPIO_STATE, &val); + if (ret) + return ret; + ++ mask = 1 << (pin + AXP_GPIO_STATE_OFFSET); ++ + return (val & mask) ? 1 : 0; + } + +@@ -101,25 +81,12 @@ static int axp_gpio_set_value(struct ude + { + u8 reg; + +- switch (pin) { +-#ifdef AXP_MISC_CTRL_N_VBUSEN_FUNC +- /* Only available on later PMICs */ +- case SUNXI_GPIO_AXP0_VBUS_ENABLE: +- if (val) +- return pmic_bus_setbits(AXP_VBUS_IPSOUT, +- AXP_VBUS_IPSOUT_DRIVEBUS); +- else +- return pmic_bus_clrbits(AXP_VBUS_IPSOUT, +- AXP_VBUS_IPSOUT_DRIVEBUS); +-#endif +- default: +- reg = axp_get_gpio_ctrl_reg(pin); +- if (reg == 0) +- return -EINVAL; ++ reg = axp_get_gpio_ctrl_reg(pin); ++ if (reg == 0) ++ return -EINVAL; + +- return pmic_bus_write(reg, val ? AXP_GPIO_CTRL_OUTPUT_HIGH : +- AXP_GPIO_CTRL_OUTPUT_LOW); +- } ++ return pmic_bus_write(reg, val ? AXP_GPIO_CTRL_OUTPUT_HIGH : ++ AXP_GPIO_CTRL_OUTPUT_LOW); + } + + static const struct dm_gpio_ops gpio_axp_ops = { +@@ -134,8 +101,8 @@ static int gpio_axp_probe(struct udevice + struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); + + /* Tell the uclass how many GPIOs we have */ +- uc_priv->bank_name = strdup(SUNXI_GPIO_AXP0_PREFIX); +- uc_priv->gpio_count = SUNXI_GPIO_AXP0_GPIO_COUNT; ++ uc_priv->bank_name = AXP_GPIO_PREFIX; ++ uc_priv->gpio_count = AXP_GPIO_COUNT; + + return 0; + } +--- a/drivers/gpio/sunxi_gpio.c ++++ b/drivers/gpio/sunxi_gpio.c +@@ -114,15 +114,7 @@ int sunxi_name_to_gpio(const char *name) + { + unsigned int gpio; + int ret; +-#if !defined CONFIG_SPL_BUILD && defined CONFIG_AXP_GPIO +- char lookup[8]; + +- if (strcasecmp(name, "AXP0-VBUS-ENABLE") == 0) { +- sprintf(lookup, SUNXI_GPIO_AXP0_PREFIX "%d", +- SUNXI_GPIO_AXP0_VBUS_ENABLE); +- name = lookup; +- } +-#endif + ret = gpio_lookup_name(name, NULL, NULL, &gpio); + + return ret ? ret : gpio; +--- a/include/axp221.h ++++ b/include/axp221.h +@@ -53,10 +53,6 @@ + #ifdef CONFIG_AXP221_POWER + #define AXP_POWER_STATUS 0x00 + #define AXP_POWER_STATUS_ALDO_IN BIT(0) +-#define AXP_VBUS_IPSOUT 0x30 +-#define AXP_VBUS_IPSOUT_DRIVEBUS (1 << 2) +-#define AXP_MISC_CTRL 0x8f +-#define AXP_MISC_CTRL_N_VBUSEN_FUNC (1 << 4) + #define AXP_GPIO0_CTRL 0x90 + #define AXP_GPIO1_CTRL 0x92 + #define AXP_GPIO_CTRL_OUTPUT_LOW 0x00 /* Drive pin low */ +--- a/include/axp809.h ++++ b/include/axp809.h +@@ -47,10 +47,6 @@ + #ifdef CONFIG_AXP809_POWER + #define AXP_POWER_STATUS 0x00 + #define AXP_POWER_STATUS_ALDO_IN BIT(0) +-#define AXP_VBUS_IPSOUT 0x30 +-#define AXP_VBUS_IPSOUT_DRIVEBUS (1 << 2) +-#define AXP_MISC_CTRL 0x8f +-#define AXP_MISC_CTRL_N_VBUSEN_FUNC (1 << 4) + #define AXP_GPIO0_CTRL 0x90 + #define AXP_GPIO1_CTRL 0x92 + #define AXP_GPIO_CTRL_OUTPUT_LOW 0x00 /* Drive pin low */ +--- a/include/axp818.h ++++ b/include/axp818.h +@@ -61,10 +61,6 @@ + #ifdef CONFIG_AXP818_POWER + #define AXP_POWER_STATUS 0x00 + #define AXP_POWER_STATUS_ALDO_IN BIT(0) +-#define AXP_VBUS_IPSOUT 0x30 +-#define AXP_VBUS_IPSOUT_DRIVEBUS (1 << 2) +-#define AXP_MISC_CTRL 0x8f +-#define AXP_MISC_CTRL_N_VBUSEN_FUNC (1 << 4) + #define AXP_GPIO0_CTRL 0x90 + #define AXP_GPIO1_CTRL 0x92 + #define AXP_GPIO_CTRL_OUTPUT_LOW 0x00 /* Drive pin low */ diff --git a/package/boot/uboot-d1/patches/0013-clk-sunxi-Add-a-driver-for-the-legacy-A31-A23-A33-PR.patch b/package/boot/uboot-d1/patches/0013-clk-sunxi-Add-a-driver-for-the-legacy-A31-A23-A33-PR.patch new file mode 100644 index 00000000000000..2c0029a29b8b37 --- /dev/null +++ b/package/boot/uboot-d1/patches/0013-clk-sunxi-Add-a-driver-for-the-legacy-A31-A23-A33-PR.patch @@ -0,0 +1,160 @@ +From 5a909f4d4d10f3a7a59b3b75eee502937e166891 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Mon, 2 May 2022 22:00:05 -0500 +Subject: [PATCH 13/90] clk: sunxi: Add a driver for the legacy A31/A23/A33 + PRCM + +Signed-off-by: Samuel Holland +--- + drivers/clk/sunxi/Kconfig | 13 ++++- + drivers/clk/sunxi/Makefile | 1 + + drivers/clk/sunxi/clk_a31_apb0.c | 97 ++++++++++++++++++++++++++++++++ + include/clk/sunxi.h | 1 + + 4 files changed, 110 insertions(+), 2 deletions(-) + create mode 100644 drivers/clk/sunxi/clk_a31_apb0.c + +--- a/drivers/clk/sunxi/Kconfig ++++ b/drivers/clk/sunxi/Kconfig +@@ -38,12 +38,21 @@ config CLK_SUN6I_A31 + This enables common clock driver support for platforms based + on Allwinner A31/A31s SoC. + ++config CLK_SUN6I_A31_APB0 ++ bool "Clock driver for Allwinner A31 generation PRCM (legacy)" ++ default MACH_SUN6I || MACH_SUN8I_A23 || MACH_SUN8I_A33 ++ help ++ This enables common clock driver support for the PRCM ++ in Allwinner A31/A31s/A23/A33 SoCs using the legacy PRCM ++ MFD binding. ++ + config CLK_SUN6I_A31_R +- bool "Clock driver for Allwinner A31 generation PRCM" ++ bool "Clock driver for Allwinner A31 generation PRCM (CCU)" + default SUNXI_GEN_SUN6I + help + This enables common clock driver support for the PRCM +- in Allwinner A31/A31s/A23/A33/A83T/H3/A64/H5 SoCs. ++ in Allwinner A31/A31s/A23/A33/A83T/H3/A64/H5 SoCs using ++ the new CCU binding. + + config CLK_SUN8I_A23 + bool "Clock driver for Allwinner A23/A33" +--- a/drivers/clk/sunxi/Makefile ++++ b/drivers/clk/sunxi/Makefile +@@ -12,6 +12,7 @@ obj-$(CONFIG_CLK_SUNIV_F1C100S) += clk_f + obj-$(CONFIG_CLK_SUN4I_A10) += clk_a10.o + obj-$(CONFIG_CLK_SUN5I_A10S) += clk_a10s.o + obj-$(CONFIG_CLK_SUN6I_A31) += clk_a31.o ++obj-$(CONFIG_CLK_SUN6I_A31_APB0) += clk_a31_apb0.o + obj-$(CONFIG_CLK_SUN6I_A31_R) += clk_a31_r.o + obj-$(CONFIG_CLK_SUN8I_A23) += clk_a23.o + obj-$(CONFIG_CLK_SUN8I_A83T) += clk_a83t.o +--- /dev/null ++++ b/drivers/clk/sunxi/clk_a31_apb0.c +@@ -0,0 +1,97 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++/* ++ * Copyright (C) Samuel Holland ++ */ ++ ++#include ++#include ++#include ++#include ++ ++static struct ccu_clk_gate sun6i_apb0_gates[] = { ++ [0] = GATE(0x028, BIT(0)), ++ [1] = GATE(0x028, BIT(1)), ++ [2] = GATE(0x028, BIT(2)), ++ [3] = GATE(0x028, BIT(3)), ++ [4] = GATE(0x028, BIT(4)), ++ [5] = GATE(0x028, BIT(5)), ++ [6] = GATE(0x028, BIT(6)), ++ [7] = GATE(0x028, BIT(7)), ++}; ++ ++static struct ccu_reset sun6i_apb0_resets[] = { ++ [0] = RESET(0x0b0, BIT(0)), ++ [1] = RESET(0x0b0, BIT(1)), ++ [2] = RESET(0x0b0, BIT(2)), ++ [3] = RESET(0x0b0, BIT(3)), ++ [4] = RESET(0x0b0, BIT(4)), ++ [5] = RESET(0x0b0, BIT(5)), ++ [6] = RESET(0x0b0, BIT(6)), ++ [7] = RESET(0x0b0, BIT(7)), ++}; ++ ++const struct ccu_desc sun6i_apb0_clk_desc = { ++ .gates = sun6i_apb0_gates, ++ .resets = sun6i_apb0_resets, ++ .num_gates = ARRAY_SIZE(sun6i_apb0_gates), ++ .num_resets = ARRAY_SIZE(sun6i_apb0_resets), ++}; ++ ++static int sun6i_apb0_of_to_plat(struct udevice *dev) ++{ ++ struct ccu_plat *plat = dev_get_plat(dev); ++ ++ plat->base = dev_read_addr_ptr(dev->parent); ++ if (!plat->base) ++ return -ENOMEM; ++ ++ plat->desc = (const struct ccu_desc *)dev_get_driver_data(dev); ++ if (!plat->desc) ++ return -EINVAL; ++ ++ return 0; ++} ++ ++static const struct udevice_id sun6i_apb0_clk_ids[] = { ++ { .compatible = "allwinner,sun6i-a31-apb0-gates-clk", ++ .data = (ulong)&sun6i_apb0_clk_desc }, ++ { .compatible = "allwinner,sun8i-a23-apb0-gates-clk", ++ .data = (ulong)&sun6i_apb0_clk_desc }, ++ { } ++}; ++ ++U_BOOT_DRIVER(sun6i_apb0_clk) = { ++ .name = "sun6i_apb0_clk", ++ .id = UCLASS_CLK, ++ .of_match = sun6i_apb0_clk_ids, ++ .of_to_plat = sun6i_apb0_of_to_plat, ++ .plat_auto = sizeof(struct ccu_plat), ++ .ops = &sunxi_clk_ops, ++}; ++ ++static const struct udevice_id sun6i_apb0_reset_ids[] = { ++ { .compatible = "allwinner,sun6i-a31-clock-reset", ++ .data = (ulong)&sun6i_apb0_clk_desc }, ++ { } ++}; ++ ++U_BOOT_DRIVER(sun6i_apb0_reset) = { ++ .name = "sun6i_apb0_reset", ++ .id = UCLASS_RESET, ++ .of_match = sun6i_apb0_reset_ids, ++ .of_to_plat = sun6i_apb0_of_to_plat, ++ .plat_auto = sizeof(struct ccu_plat), ++ .ops = &sunxi_reset_ops, ++}; ++ ++static const struct udevice_id sun6i_prcm_mfd_ids[] = { ++ { .compatible = "allwinner,sun6i-a31-prcm" }, ++ { .compatible = "allwinner,sun8i-a23-prcm" }, ++ { } ++}; ++ ++U_BOOT_DRIVER(sun6i_prcm_mfd) = { ++ .name = "sun6i_prcm_mfd", ++ .id = UCLASS_SIMPLE_BUS, ++ .of_match = sun6i_prcm_mfd_ids, ++}; +--- a/include/clk/sunxi.h ++++ b/include/clk/sunxi.h +@@ -86,5 +86,6 @@ struct ccu_plat { + }; + + extern struct clk_ops sunxi_clk_ops; ++extern struct reset_ops sunxi_reset_ops; + + #endif /* _CLK_SUNXI_H */ diff --git a/package/boot/uboot-d1/patches/0014-clk-sunxi-Use-the-right-symbol-in-the-Makefile.patch b/package/boot/uboot-d1/patches/0014-clk-sunxi-Use-the-right-symbol-in-the-Makefile.patch new file mode 100644 index 00000000000000..858af896aa5ff0 --- /dev/null +++ b/package/boot/uboot-d1/patches/0014-clk-sunxi-Use-the-right-symbol-in-the-Makefile.patch @@ -0,0 +1,21 @@ +From 3d97f99cb173422ee8a15b7ec1df83ff61e68204 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sun, 30 Oct 2022 14:28:23 -0500 +Subject: [PATCH 14/90] clk: sunxi: Use the right symbol in the Makefile + +Signed-off-by: Samuel Holland +--- + drivers/clk/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/clk/Makefile ++++ b/drivers/clk/Makefile +@@ -25,7 +25,7 @@ obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip/ + obj-$(CONFIG_ARCH_SOCFPGA) += altera/ + obj-$(CONFIG_ARCH_STM32) += stm32/ + obj-$(CONFIG_ARCH_STM32MP) += stm32/ +-obj-$(CONFIG_ARCH_SUNXI) += sunxi/ ++obj-$(CONFIG_CLK_SUNXI) += sunxi/ + obj-$(CONFIG_CLK_AT91) += at91/ + obj-$(CONFIG_CLK_BCM6345) += clk_bcm6345.o + obj-$(CONFIG_CLK_BOSTON) += clk_boston.o diff --git a/package/boot/uboot-d1/patches/0015-net-sun8i-emac-Use-common-syscon-setup-for-R40.patch b/package/boot/uboot-d1/patches/0015-net-sun8i-emac-Use-common-syscon-setup-for-R40.patch new file mode 100644 index 00000000000000..41e72bdd2f1193 --- /dev/null +++ b/package/boot/uboot-d1/patches/0015-net-sun8i-emac-Use-common-syscon-setup-for-R40.patch @@ -0,0 +1,100 @@ +From 9766169812418aee10dbc8d40aca27c1c576f521 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Thu, 14 Jul 2022 23:39:46 -0500 +Subject: [PATCH 15/90] net: sun8i-emac: Use common syscon setup for R40 + +While R40 puts the EMAC syscon register at a different address from +other variants, the relevant portion of the register's layout is the +same. Factor out the register offset so the same code can be shared +by all variants. This matches what the Linux driver does. + +This change provides two benefits beyond the simplification: + - R40 boards now respect the RX delays from the devicetree + - This resolves a warning on architectures where readl/writel + expect the address to have a pointer type, not phys_addr_t. + +Series-to: sunxi + +Cover-letter: +net: sun8i-emac: Allwinner D1 Support +D1 is a RISC-V SoC containing an EMAC compatible with the A64 EMAC. +However, there are a couple of issues with the driver preventing it +being built for RISC-V. These are resolved by patches 2-3. Patch 1 is +a general cleanup. +END + +Signed-off-by: Samuel Holland +--- + drivers/net/sun8i_emac.c | 29 ++++++++++++----------------- + 1 file changed, 12 insertions(+), 17 deletions(-) + +--- a/drivers/net/sun8i_emac.c ++++ b/drivers/net/sun8i_emac.c +@@ -162,7 +162,7 @@ struct emac_eth_dev { + + enum emac_variant variant; + void *mac_reg; +- phys_addr_t sysctl_reg; ++ void *sysctl_reg; + struct phy_device *phydev; + struct mii_dev *bus; + struct clk tx_clk; +@@ -317,18 +317,7 @@ static int sun8i_emac_set_syscon(struct + { + u32 reg; + +- if (priv->variant == R40_GMAC) { +- /* Select RGMII for R40 */ +- reg = readl(priv->sysctl_reg + 0x164); +- reg |= SC_ETCS_INT_GMII | +- SC_EPIT | +- (CONFIG_GMAC_TX_DELAY << SC_ETXDC_OFFSET); +- +- writel(reg, priv->sysctl_reg + 0x164); +- return 0; +- } +- +- reg = readl(priv->sysctl_reg + 0x30); ++ reg = readl(priv->sysctl_reg); + + reg = sun8i_emac_set_syscon_ephy(priv, reg); + +@@ -369,7 +358,7 @@ static int sun8i_emac_set_syscon(struct + reg |= ((pdata->rx_delay_ps / 100) << SC_ERXDC_OFFSET) + & SC_ERXDC_MASK; + +- writel(reg, priv->sysctl_reg + 0x30); ++ writel(reg, priv->sysctl_reg); + + return 0; + } +@@ -792,6 +781,7 @@ static int sun8i_emac_eth_of_to_plat(str + struct sun8i_eth_pdata *sun8i_pdata = dev_get_plat(dev); + struct eth_pdata *pdata = &sun8i_pdata->eth_pdata; + struct emac_eth_dev *priv = dev_get_priv(dev); ++ phys_addr_t syscon_base; + const fdt32_t *reg; + int node = dev_of_offset(dev); + int offset = 0; +@@ -837,13 +827,18 @@ static int sun8i_emac_eth_of_to_plat(str + __func__); + return -EINVAL; + } +- priv->sysctl_reg = fdt_translate_address((void *)gd->fdt_blob, +- offset, reg); +- if (priv->sysctl_reg == FDT_ADDR_T_NONE) { ++ ++ syscon_base = fdt_translate_address((void *)gd->fdt_blob, offset, reg); ++ if (syscon_base == FDT_ADDR_T_NONE) { + debug("%s: Cannot find syscon base address\n", __func__); + return -EINVAL; + } + ++ if (priv->variant == R40_GMAC) ++ priv->sysctl_reg = (void *)syscon_base + 0x164; ++ else ++ priv->sysctl_reg = (void *)syscon_base + 0x30; ++ + pdata->phy_interface = -1; + priv->phyaddr = -1; + priv->use_internal_phy = false; diff --git a/package/boot/uboot-d1/patches/0016-sunxi-mmc-ignore-card-detect-in-SPL.patch b/package/boot/uboot-d1/patches/0016-sunxi-mmc-ignore-card-detect-in-SPL.patch new file mode 100644 index 00000000000000..a8fe0cb8302dc1 --- /dev/null +++ b/package/boot/uboot-d1/patches/0016-sunxi-mmc-ignore-card-detect-in-SPL.patch @@ -0,0 +1,92 @@ +From 2cde6c8a7c41c13137298c19b4e104e4f5d6851c Mon Sep 17 00:00:00 2001 +From: Andre Przywara +Date: Wed, 13 Jul 2022 17:21:43 +0100 +Subject: [PATCH 16/90] sunxi: mmc: ignore card detect in SPL + +The sunxi MMC code does not use the DM in the SPL, as we don't have a +device tree available that early, also no space for it. +This also means we cannot access the card-detect GPIO information from +there, so we have Kconfig symbols called CONFIG_MMCx_CD_PIN, which each +board has to define. This is a burden, also requires extra GPIO code in +the SPL. +As the SPL is the natural successor of the BootROM (from which we are +loaded), we can actually ignore the CD pin completely, as this is what +the BootROM does as well: CD GPIOs are board specific, but the BootROM +is not, so accesses the MMC devices anyway. + +Remove the card detect code from the non-DM implementation of the sunxi +MMC driver, to get rid of this unneeded code. + +Signed-off-by: Andre Przywara +--- + drivers/mmc/sunxi_mmc.c | 37 ++----------------------------------- + 1 file changed, 2 insertions(+), 35 deletions(-) + +--- a/drivers/mmc/sunxi_mmc.c ++++ b/drivers/mmc/sunxi_mmc.c +@@ -44,22 +44,10 @@ struct sunxi_mmc_priv { + /* support 4 mmc hosts */ + struct sunxi_mmc_priv mmc_host[4]; + +-static int sunxi_mmc_getcd_gpio(int sdc_no) +-{ +- switch (sdc_no) { +- case 0: return sunxi_name_to_gpio(CONFIG_MMC0_CD_PIN); +- case 1: return sunxi_name_to_gpio(CONFIG_MMC1_CD_PIN); +- case 2: return sunxi_name_to_gpio(CONFIG_MMC2_CD_PIN); +- case 3: return sunxi_name_to_gpio(CONFIG_MMC3_CD_PIN); +- } +- return -EINVAL; +-} +- + static int mmc_resource_init(int sdc_no) + { + struct sunxi_mmc_priv *priv = &mmc_host[sdc_no]; + struct sunxi_ccm_reg *ccm = (struct sunxi_ccm_reg *)SUNXI_CCM_BASE; +- int cd_pin, ret = 0; + + debug("init mmc %d resource\n", sdc_no); + +@@ -90,16 +78,7 @@ static int mmc_resource_init(int sdc_no) + } + priv->mmc_no = sdc_no; + +- cd_pin = sunxi_mmc_getcd_gpio(sdc_no); +- if (cd_pin >= 0) { +- ret = gpio_request(cd_pin, "mmc_cd"); +- if (!ret) { +- sunxi_gpio_set_pull(cd_pin, SUNXI_GPIO_PULL_UP); +- ret = gpio_direction_input(cd_pin); +- } +- } +- +- return ret; ++ return 0; + } + #endif + +@@ -523,23 +502,11 @@ static int sunxi_mmc_send_cmd_legacy(str + return sunxi_mmc_send_cmd_common(priv, mmc, cmd, data); + } + +-static int sunxi_mmc_getcd_legacy(struct mmc *mmc) +-{ +- struct sunxi_mmc_priv *priv = mmc->priv; +- int cd_pin; +- +- cd_pin = sunxi_mmc_getcd_gpio(priv->mmc_no); +- if (cd_pin < 0) +- return 1; +- +- return !gpio_get_value(cd_pin); +-} +- ++/* .get_cd is not needed by the SPL */ + static const struct mmc_ops sunxi_mmc_ops = { + .send_cmd = sunxi_mmc_send_cmd_legacy, + .set_ios = sunxi_mmc_set_ios_legacy, + .init = sunxi_mmc_core_init, +- .getcd = sunxi_mmc_getcd_legacy, + }; + + struct mmc *sunxi_mmc_init(int sdc_no) diff --git a/package/boot/uboot-d1/patches/0017-sunxi-mmc-group-non-DM-specific-functions.patch b/package/boot/uboot-d1/patches/0017-sunxi-mmc-group-non-DM-specific-functions.patch new file mode 100644 index 00000000000000..6161c33187a45c --- /dev/null +++ b/package/boot/uboot-d1/patches/0017-sunxi-mmc-group-non-DM-specific-functions.patch @@ -0,0 +1,177 @@ +From 74afc3a4e0ff780eddd859a25de7142e4baeeed5 Mon Sep 17 00:00:00 2001 +From: Andre Przywara +Date: Wed, 13 Jul 2022 17:21:44 +0100 +Subject: [PATCH 17/90] sunxi: mmc: group non-DM specific functions + +As the SPL code for sunxi boards does not use the driver model, we have +two mmc_ops structures, one for DM, one for non-DM. The actual hardware +access code is shared, with the respective callback functions using that +common code. + +To make this more obvious and easier to read, reorder the functions to +group them: we first have the common code, then the non-DM bits, and +the proper DM implementation at the end. +Also document this structure in the comment at the beginning of the file. + +No functional change intended. + +Signed-off-by: Andre Przywara +--- + drivers/mmc/sunxi_mmc.c | 117 +++++++++++++++++++++------------------- + 1 file changed, 61 insertions(+), 56 deletions(-) + +--- a/drivers/mmc/sunxi_mmc.c ++++ b/drivers/mmc/sunxi_mmc.c +@@ -5,6 +5,12 @@ + * Aaron + * + * MMC driver for allwinner sunxi platform. ++ * ++ * This driver is used by the (ARM) SPL with the legacy MMC interface, and ++ * by U-Boot proper using the full DM interface. The actual hardware access ++ * code is common, and comes first in this file. ++ * The legacy MMC interface implementation comes next, followed by the ++ * proper DM_MMC implementation at the end. + */ + + #include +@@ -40,48 +46,6 @@ struct sunxi_mmc_priv { + struct mmc_config cfg; + }; + +-#if !CONFIG_IS_ENABLED(DM_MMC) +-/* support 4 mmc hosts */ +-struct sunxi_mmc_priv mmc_host[4]; +- +-static int mmc_resource_init(int sdc_no) +-{ +- struct sunxi_mmc_priv *priv = &mmc_host[sdc_no]; +- struct sunxi_ccm_reg *ccm = (struct sunxi_ccm_reg *)SUNXI_CCM_BASE; +- +- debug("init mmc %d resource\n", sdc_no); +- +- switch (sdc_no) { +- case 0: +- priv->reg = (struct sunxi_mmc *)SUNXI_MMC0_BASE; +- priv->mclkreg = &ccm->sd0_clk_cfg; +- break; +- case 1: +- priv->reg = (struct sunxi_mmc *)SUNXI_MMC1_BASE; +- priv->mclkreg = &ccm->sd1_clk_cfg; +- break; +-#ifdef SUNXI_MMC2_BASE +- case 2: +- priv->reg = (struct sunxi_mmc *)SUNXI_MMC2_BASE; +- priv->mclkreg = &ccm->sd2_clk_cfg; +- break; +-#endif +-#ifdef SUNXI_MMC3_BASE +- case 3: +- priv->reg = (struct sunxi_mmc *)SUNXI_MMC3_BASE; +- priv->mclkreg = &ccm->sd3_clk_cfg; +- break; +-#endif +- default: +- printf("Wrong mmc number %d\n", sdc_no); +- return -1; +- } +- priv->mmc_no = sdc_no; +- +- return 0; +-} +-#endif +- + /* + * All A64 and later MMC controllers feature auto-calibration. This would + * normally be detected via the compatible string, but we need something +@@ -269,19 +233,6 @@ static int sunxi_mmc_set_ios_common(stru + return 0; + } + +-#if !CONFIG_IS_ENABLED(DM_MMC) +-static int sunxi_mmc_core_init(struct mmc *mmc) +-{ +- struct sunxi_mmc_priv *priv = mmc->priv; +- +- /* Reset controller */ +- writel(SUNXI_MMC_GCTRL_RESET, &priv->reg->gctrl); +- udelay(1000); +- +- return 0; +-} +-#endif +- + static int mmc_trans_data_by_cpu(struct sunxi_mmc_priv *priv, struct mmc *mmc, + struct mmc_data *data) + { +@@ -486,7 +437,60 @@ out: + return error; + } + ++/* non-DM code here is used by the (ARM) SPL only */ ++ + #if !CONFIG_IS_ENABLED(DM_MMC) ++/* support 4 mmc hosts */ ++struct sunxi_mmc_priv mmc_host[4]; ++ ++static int mmc_resource_init(int sdc_no) ++{ ++ struct sunxi_mmc_priv *priv = &mmc_host[sdc_no]; ++ struct sunxi_ccm_reg *ccm = (struct sunxi_ccm_reg *)SUNXI_CCM_BASE; ++ ++ debug("init mmc %d resource\n", sdc_no); ++ ++ switch (sdc_no) { ++ case 0: ++ priv->reg = (struct sunxi_mmc *)SUNXI_MMC0_BASE; ++ priv->mclkreg = &ccm->sd0_clk_cfg; ++ break; ++ case 1: ++ priv->reg = (struct sunxi_mmc *)SUNXI_MMC1_BASE; ++ priv->mclkreg = &ccm->sd1_clk_cfg; ++ break; ++#ifdef SUNXI_MMC2_BASE ++ case 2: ++ priv->reg = (struct sunxi_mmc *)SUNXI_MMC2_BASE; ++ priv->mclkreg = &ccm->sd2_clk_cfg; ++ break; ++#endif ++#ifdef SUNXI_MMC3_BASE ++ case 3: ++ priv->reg = (struct sunxi_mmc *)SUNXI_MMC3_BASE; ++ priv->mclkreg = &ccm->sd3_clk_cfg; ++ break; ++#endif ++ default: ++ printf("Wrong mmc number %d\n", sdc_no); ++ return -1; ++ } ++ priv->mmc_no = sdc_no; ++ ++ return 0; ++} ++ ++static int sunxi_mmc_core_init(struct mmc *mmc) ++{ ++ struct sunxi_mmc_priv *priv = mmc->priv; ++ ++ /* Reset controller */ ++ writel(SUNXI_MMC_GCTRL_RESET, &priv->reg->gctrl); ++ udelay(1000); ++ ++ return 0; ++} ++ + static int sunxi_mmc_set_ios_legacy(struct mmc *mmc) + { + struct sunxi_mmc_priv *priv = mmc->priv; +@@ -562,7 +566,8 @@ struct mmc *sunxi_mmc_init(int sdc_no) + + return mmc_create(cfg, priv); + } +-#else ++ ++#else /* CONFIG_DM_MMC code below, as used by U-Boot proper */ + + static int sunxi_mmc_set_ios(struct udevice *dev) + { diff --git a/package/boot/uboot-d1/patches/0018-sunxi-remove-CONFIG_MMC-_CD_PIN.patch b/package/boot/uboot-d1/patches/0018-sunxi-remove-CONFIG_MMC-_CD_PIN.patch new file mode 100644 index 00000000000000..a87b6e26ce3bc1 --- /dev/null +++ b/package/boot/uboot-d1/patches/0018-sunxi-remove-CONFIG_MMC-_CD_PIN.patch @@ -0,0 +1,509 @@ +From bcc2e01668041c146d964ed5f77b819dcc35b3e2 Mon Sep 17 00:00:00 2001 +From: Zoltan HERPAI +Date: Tue, 6 Jun 2023 15:07:47 +0000 +Subject: [PATCH 18/90] sunxi: remove CONFIG_MMC?_CD_PIN + +For legacy reasons we were defining the card detect GPIO for all sunxi +boards in each board's defconfig. +There is actually no need for a card-detect check in the SPL code (which +consequently has been removed already), and also in U-Boot proper we +have DM code to query the CD GPIO name from the device tree. + +That means we don't have any user of that information left, so can +remove the definitions from the defconfigs. + +Signed-off-by: Andre Przywara +Signed-off-by: Zoltan HERPAI +--- + arch/arm/mach-sunxi/Kconfig | 27 -------------------- + configs/A10-OLinuXino-Lime_defconfig | 1 - + configs/A10s-OLinuXino-M_defconfig | 2 -- + configs/A13-OLinuXino_defconfig | 1 - + configs/A20-OLinuXino-Lime2-eMMC_defconfig | 1 - + configs/A20-OLinuXino-Lime_defconfig | 1 - + configs/A20-OLinuXino_MICRO-eMMC_defconfig | 1 - + configs/A20-OLinuXino_MICRO_defconfig | 2 -- + configs/A20-Olimex-SOM-EVB_defconfig | 2 -- + configs/A20-Olimex-SOM204-EVB-eMMC_defconfig | 1 - + configs/Bananapi_M2_Ultra_defconfig | 1 - + configs/Bananapi_m2m_defconfig | 1 - + configs/Cubieboard2_defconfig | 1 - + configs/Cubieboard4_defconfig | 1 - + configs/Cubieboard_defconfig | 1 - + configs/Itead_Ibox_A20_defconfig | 1 - + configs/Lamobo_R1_defconfig | 1 - + configs/Mele_M3_defconfig | 1 - + configs/Mele_M5_defconfig | 1 - + configs/Merrii_A80_Optimus_defconfig | 1 - + configs/Orangepi_mini_defconfig | 2 -- + configs/Sinlinx_SinA31s_defconfig | 1 - + configs/Sinlinx_SinA33_defconfig | 1 - + configs/Sunchip_CX-A99_defconfig | 1 - + configs/UTOO_P66_defconfig | 1 - + configs/Yones_Toptech_BD1078_defconfig | 2 -- + configs/bananapi_m2_zero_defconfig | 1 - + configs/bananapi_m64_defconfig | 1 - + configs/beelink_gs1_defconfig | 1 - + configs/nanopi_m1_plus_defconfig | 1 - + configs/oceanic_5205_5inmfd_defconfig | 1 - + configs/orangepi_3_defconfig | 1 - + configs/orangepi_lite2_defconfig | 1 - + configs/orangepi_one_plus_defconfig | 1 - + configs/orangepi_zero2_defconfig | 1 - + configs/orangepi_zero_plus2_defconfig | 1 - + configs/orangepi_zero_plus2_h3_defconfig | 1 - + configs/parrot_r16_defconfig | 1 - + configs/pine64-lts_defconfig | 1 - + configs/pine_h64_defconfig | 1 - + configs/sopine_baseboard_defconfig | 1 - + configs/tanix_tx6_defconfig | 1 - + 42 files changed, 73 deletions(-) + +--- a/arch/arm/mach-sunxi/Kconfig ++++ b/arch/arm/mach-sunxi/Kconfig +@@ -652,33 +652,6 @@ config MACPWR + Set the pin used to power the MAC. This takes a string in the format + understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H. + +-config MMC0_CD_PIN +- string "Card detect pin for mmc0" +- default "PF6" if MACH_SUN8I_A83T || MACH_SUNXI_H3_H5 || MACH_SUN50I +- default "" +- ---help--- +- Set the card detect pin for mmc0, leave empty to not use cd. This +- takes a string in the format understood by sunxi_name_to_gpio, e.g. +- PH1 for pin 1 of port H. +- +-config MMC1_CD_PIN +- string "Card detect pin for mmc1" +- default "" +- ---help--- +- See MMC0_CD_PIN help text. +- +-config MMC2_CD_PIN +- string "Card detect pin for mmc2" +- default "" +- ---help--- +- See MMC0_CD_PIN help text. +- +-config MMC3_CD_PIN +- string "Card detect pin for mmc3" +- default "" +- ---help--- +- See MMC0_CD_PIN help text. +- + config MMC1_PINS_PH + bool "Pins for mmc1 are on Port H" + depends on MACH_SUN4I || MACH_SUN7I || MACH_SUN8I_R40 +--- a/configs/A10-OLinuXino-Lime_defconfig ++++ b/configs/A10-OLinuXino-Lime_defconfig +@@ -6,7 +6,6 @@ CONFIG_MACH_SUN4I=y + CONFIG_DRAM_CLK=480 + CONFIG_DRAM_EMR1=4 + CONFIG_SYS_CLK_FREQ=912000000 +-CONFIG_MMC0_CD_PIN="PH1" + CONFIG_I2C1_ENABLE=y + CONFIG_SATAPWR="PC3" + CONFIG_AHCI=y +--- a/configs/A10s-OLinuXino-M_defconfig ++++ b/configs/A10s-OLinuXino-M_defconfig +@@ -4,8 +4,6 @@ CONFIG_DEFAULT_DEVICE_TREE="sun5i-a10s-o + CONFIG_SPL=y + CONFIG_MACH_SUN5I=y + CONFIG_DRAM_CLK=432 +-CONFIG_MMC0_CD_PIN="PG1" +-CONFIG_MMC1_CD_PIN="PG13" + CONFIG_MMC_SUNXI_SLOT_EXTRA=1 + CONFIG_USB1_VBUS_PIN="PB10" + # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set +--- a/configs/A13-OLinuXino_defconfig ++++ b/configs/A13-OLinuXino_defconfig +@@ -5,7 +5,6 @@ CONFIG_SPL=y + CONFIG_MACH_SUN5I=y + CONFIG_DRAM_CLK=408 + CONFIG_DRAM_EMR1=0 +-CONFIG_MMC0_CD_PIN="PG0" + CONFIG_USB0_VBUS_DET="PG1" + CONFIG_USB1_VBUS_PIN="PG11" + CONFIG_AXP_GPIO=y +--- a/configs/A20-OLinuXino-Lime2-eMMC_defconfig ++++ b/configs/A20-OLinuXino-Lime2-eMMC_defconfig +@@ -4,7 +4,6 @@ CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-ol + CONFIG_SPL=y + CONFIG_MACH_SUN7I=y + CONFIG_DRAM_CLK=384 +-CONFIG_MMC0_CD_PIN="PH1" + CONFIG_MMC_SUNXI_SLOT_EXTRA=2 + CONFIG_USB0_VBUS_PIN="PC17" + CONFIG_USB0_VBUS_DET="PH5" +--- a/configs/A20-OLinuXino-Lime_defconfig ++++ b/configs/A20-OLinuXino-Lime_defconfig +@@ -4,7 +4,6 @@ CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-ol + CONFIG_SPL=y + CONFIG_MACH_SUN7I=y + CONFIG_DRAM_CLK=384 +-CONFIG_MMC0_CD_PIN="PH1" + CONFIG_I2C1_ENABLE=y + CONFIG_SATAPWR="PC3" + CONFIG_AHCI=y +--- a/configs/A20-OLinuXino_MICRO-eMMC_defconfig ++++ b/configs/A20-OLinuXino_MICRO-eMMC_defconfig +@@ -4,7 +4,6 @@ CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-ol + CONFIG_SPL=y + CONFIG_MACH_SUN7I=y + CONFIG_DRAM_CLK=384 +-CONFIG_MMC0_CD_PIN="PH1" + CONFIG_MMC_SUNXI_SLOT_EXTRA=2 + CONFIG_I2C1_ENABLE=y + CONFIG_VIDEO_VGA=y +--- a/configs/A20-OLinuXino_MICRO_defconfig ++++ b/configs/A20-OLinuXino_MICRO_defconfig +@@ -4,8 +4,6 @@ CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-ol + CONFIG_SPL=y + CONFIG_MACH_SUN7I=y + CONFIG_DRAM_CLK=384 +-CONFIG_MMC0_CD_PIN="PH1" +-CONFIG_MMC3_CD_PIN="PH11" + CONFIG_MMC_SUNXI_SLOT_EXTRA=3 + CONFIG_I2C1_ENABLE=y + CONFIG_VIDEO_VGA=y +--- a/configs/A20-Olimex-SOM-EVB_defconfig ++++ b/configs/A20-Olimex-SOM-EVB_defconfig +@@ -4,8 +4,6 @@ CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-ol + CONFIG_SPL=y + CONFIG_MACH_SUN7I=y + CONFIG_DRAM_CLK=384 +-CONFIG_MMC0_CD_PIN="PH1" +-CONFIG_MMC3_CD_PIN="PH0" + CONFIG_MMC_SUNXI_SLOT_EXTRA=3 + CONFIG_USB0_VBUS_PIN="PB9" + CONFIG_USB0_VBUS_DET="PH5" +--- a/configs/A20-Olimex-SOM204-EVB-eMMC_defconfig ++++ b/configs/A20-Olimex-SOM204-EVB-eMMC_defconfig +@@ -4,7 +4,6 @@ CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-ol + CONFIG_SPL=y + CONFIG_MACH_SUN7I=y + CONFIG_DRAM_CLK=384 +-CONFIG_MMC0_CD_PIN="PH1" + CONFIG_MMC_SUNXI_SLOT_EXTRA=2 + CONFIG_USB0_VBUS_PIN="PC17" + CONFIG_USB0_VBUS_DET="PH5" +--- a/configs/Bananapi_M2_Ultra_defconfig ++++ b/configs/Bananapi_M2_Ultra_defconfig +@@ -5,7 +5,6 @@ CONFIG_SPL=y + CONFIG_MACH_SUN8I_R40=y + CONFIG_DRAM_CLK=576 + CONFIG_MACPWR="PA17" +-CONFIG_MMC0_CD_PIN="PH13" + CONFIG_MMC_SUNXI_SLOT_EXTRA=2 + CONFIG_USB1_VBUS_PIN="PH23" + CONFIG_USB2_VBUS_PIN="PH23" +--- a/configs/Bananapi_m2m_defconfig ++++ b/configs/Bananapi_m2m_defconfig +@@ -6,7 +6,6 @@ CONFIG_MACH_SUN8I_A33=y + CONFIG_DRAM_CLK=600 + CONFIG_DRAM_ZQ=15291 + CONFIG_DRAM_ODT_EN=y +-CONFIG_MMC0_CD_PIN="PB4" + CONFIG_MMC_SUNXI_SLOT_EXTRA=2 + CONFIG_USB0_ID_DET="PH8" + # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set +--- a/configs/Cubieboard2_defconfig ++++ b/configs/Cubieboard2_defconfig +@@ -4,7 +4,6 @@ CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-cu + CONFIG_SPL=y + CONFIG_MACH_SUN7I=y + CONFIG_DRAM_CLK=480 +-CONFIG_MMC0_CD_PIN="PH1" + CONFIG_SATAPWR="PB8" + CONFIG_AHCI=y + # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set +--- a/configs/Cubieboard4_defconfig ++++ b/configs/Cubieboard4_defconfig +@@ -4,7 +4,6 @@ CONFIG_DEFAULT_DEVICE_TREE="sun9i-a80-cu + CONFIG_SPL=y + CONFIG_MACH_SUN9I=y + CONFIG_DRAM_CLK=672 +-CONFIG_MMC0_CD_PIN="PH18" + CONFIG_MMC_SUNXI_SLOT_EXTRA=2 + CONFIG_USB0_VBUS_PIN="AXP0-VBUS-ENABLE" + CONFIG_USB0_VBUS_DET="AXP0-VBUS-DETECT" +--- a/configs/Cubieboard_defconfig ++++ b/configs/Cubieboard_defconfig +@@ -4,7 +4,6 @@ CONFIG_DEFAULT_DEVICE_TREE="sun4i-a10-cu + CONFIG_SPL=y + CONFIG_MACH_SUN4I=y + CONFIG_DRAM_CLK=480 +-CONFIG_MMC0_CD_PIN="PH1" + CONFIG_SATAPWR="PB8" + CONFIG_AHCI=y + # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set +--- a/configs/Itead_Ibox_A20_defconfig ++++ b/configs/Itead_Ibox_A20_defconfig +@@ -4,7 +4,6 @@ CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-it + CONFIG_SPL=y + CONFIG_MACH_SUN7I=y + CONFIG_DRAM_CLK=480 +-CONFIG_MMC0_CD_PIN="PH1" + CONFIG_SATAPWR="PB8" + CONFIG_AHCI=y + # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set +--- a/configs/Lamobo_R1_defconfig ++++ b/configs/Lamobo_R1_defconfig +@@ -5,7 +5,6 @@ CONFIG_SPL=y + CONFIG_MACH_SUN7I=y + CONFIG_DRAM_CLK=432 + CONFIG_MACPWR="PH23" +-CONFIG_MMC0_CD_PIN="PH10" + CONFIG_SATAPWR="PB3" + CONFIG_GMAC_TX_DELAY=4 + CONFIG_AHCI=y +--- a/configs/Mele_M3_defconfig ++++ b/configs/Mele_M3_defconfig +@@ -4,7 +4,6 @@ CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-m3 + CONFIG_SPL=y + CONFIG_MACH_SUN7I=y + CONFIG_DRAM_CLK=384 +-CONFIG_MMC0_CD_PIN="PH1" + CONFIG_MMC_SUNXI_SLOT_EXTRA=2 + CONFIG_VIDEO_VGA=y + CONFIG_VIDEO_COMPOSITE=y +--- a/configs/Mele_M5_defconfig ++++ b/configs/Mele_M5_defconfig +@@ -5,7 +5,6 @@ CONFIG_SPL=y + CONFIG_MACH_SUN7I=y + CONFIG_DRAM_CLK=432 + CONFIG_DRAM_ZQ=122 +-CONFIG_MMC0_CD_PIN="PH1" + CONFIG_VIDEO_COMPOSITE=y + CONFIG_AHCI=y + # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set +--- a/configs/Merrii_A80_Optimus_defconfig ++++ b/configs/Merrii_A80_Optimus_defconfig +@@ -4,7 +4,6 @@ CONFIG_DEFAULT_DEVICE_TREE="sun9i-a80-op + CONFIG_SPL=y + CONFIG_MACH_SUN9I=y + CONFIG_DRAM_CLK=672 +-CONFIG_MMC0_CD_PIN="PH18" + CONFIG_MMC_SUNXI_SLOT_EXTRA=2 + CONFIG_USB0_VBUS_PIN="AXP0-VBUS-ENABLE" + CONFIG_USB0_VBUS_DET="AXP0-VBUS-DETECT" +--- a/configs/Orangepi_mini_defconfig ++++ b/configs/Orangepi_mini_defconfig +@@ -5,8 +5,6 @@ CONFIG_SPL=y + CONFIG_MACH_SUN7I=y + CONFIG_DRAM_CLK=432 + CONFIG_MACPWR="PH23" +-CONFIG_MMC0_CD_PIN="PH10" +-CONFIG_MMC3_CD_PIN="PH11" + CONFIG_MMC_SUNXI_SLOT_EXTRA=3 + CONFIG_USB1_VBUS_PIN="PH26" + CONFIG_USB2_VBUS_PIN="PH22" +--- a/configs/Sinlinx_SinA31s_defconfig ++++ b/configs/Sinlinx_SinA31s_defconfig +@@ -5,7 +5,6 @@ CONFIG_SPL=y + CONFIG_MACH_SUN6I=y + CONFIG_DRAM_CLK=432 + CONFIG_DRAM_ZQ=251 +-CONFIG_MMC0_CD_PIN="PA4" + CONFIG_MMC_SUNXI_SLOT_EXTRA=3 + CONFIG_USB1_VBUS_PIN="" + CONFIG_USB2_VBUS_PIN="" +--- a/configs/Sinlinx_SinA33_defconfig ++++ b/configs/Sinlinx_SinA33_defconfig +@@ -5,7 +5,6 @@ CONFIG_SPL=y + CONFIG_MACH_SUN8I_A33=y + CONFIG_DRAM_CLK=552 + CONFIG_DRAM_ZQ=15291 +-CONFIG_MMC0_CD_PIN="PB4" + CONFIG_MMC_SUNXI_SLOT_EXTRA=2 + CONFIG_USB0_ID_DET="PH8" + CONFIG_VIDEO_LCD_MODE="x:1024,y:600,depth:18,pclk_khz:66000,le:90,ri:160,up:3,lo:127,hs:70,vs:20,sync:3,vmode:0" +--- a/configs/Sunchip_CX-A99_defconfig ++++ b/configs/Sunchip_CX-A99_defconfig +@@ -6,7 +6,6 @@ CONFIG_MACH_SUN9I=y + CONFIG_DRAM_CLK=600 + CONFIG_DRAM_ZQ=3881915 + CONFIG_DRAM_ODT_EN=y +-CONFIG_MMC0_CD_PIN="PH17" + CONFIG_MMC_SUNXI_SLOT_EXTRA=2 + CONFIG_USB0_VBUS_PIN="PH15" + CONFIG_USB1_VBUS_PIN="PL7" +--- a/configs/UTOO_P66_defconfig ++++ b/configs/UTOO_P66_defconfig +@@ -5,7 +5,6 @@ CONFIG_SPL=y + CONFIG_MACH_SUN5I=y + CONFIG_DRAM_CLK=432 + CONFIG_DRAM_EMR1=0 +-CONFIG_MMC0_CD_PIN="PG0" + CONFIG_MMC_SUNXI_SLOT_EXTRA=2 + CONFIG_USB0_VBUS_PIN="PB04" + CONFIG_USB0_VBUS_DET="PG01" +--- a/configs/Yones_Toptech_BD1078_defconfig ++++ b/configs/Yones_Toptech_BD1078_defconfig +@@ -4,8 +4,6 @@ CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-yo + CONFIG_SPL=y + CONFIG_MACH_SUN7I=y + CONFIG_DRAM_CLK=408 +-CONFIG_MMC0_CD_PIN="PH1" +-CONFIG_MMC1_CD_PIN="PH2" + CONFIG_MMC1_PINS_PH=y + CONFIG_MMC_SUNXI_SLOT_EXTRA=1 + CONFIG_USB0_VBUS_PIN="PB9" +--- a/configs/bananapi_m2_zero_defconfig ++++ b/configs/bananapi_m2_zero_defconfig +@@ -4,5 +4,4 @@ CONFIG_DEFAULT_DEVICE_TREE="sun8i-h2-plu + CONFIG_SPL=y + CONFIG_MACH_SUN8I_H3=y + CONFIG_DRAM_CLK=408 +-CONFIG_MMC0_CD_PIN="" + # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set +--- a/configs/bananapi_m64_defconfig ++++ b/configs/bananapi_m64_defconfig +@@ -4,7 +4,6 @@ CONFIG_DEFAULT_DEVICE_TREE="sun50i-a64-b + CONFIG_SPL=y + CONFIG_MACH_SUN50I=y + CONFIG_RESERVE_ALLWINNER_BOOT0_HEADER=y +-CONFIG_MMC0_CD_PIN="PH13" + CONFIG_MMC_SUNXI_SLOT_EXTRA=2 + # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set + CONFIG_SUPPORT_EMMC_BOOT=y +--- a/configs/beelink_gs1_defconfig ++++ b/configs/beelink_gs1_defconfig +@@ -4,7 +4,6 @@ CONFIG_DEFAULT_DEVICE_TREE="sun50i-h6-be + CONFIG_SPL=y + CONFIG_MACH_SUN50I_H6=y + CONFIG_SUNXI_DRAM_H6_LPDDR3=y +-CONFIG_MMC0_CD_PIN="PF6" + CONFIG_MMC_SUNXI_SLOT_EXTRA=2 + # CONFIG_PSCI_RESET is not set + # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set +--- a/configs/nanopi_m1_plus_defconfig ++++ b/configs/nanopi_m1_plus_defconfig +@@ -5,7 +5,6 @@ CONFIG_SPL=y + CONFIG_MACH_SUN8I_H3=y + CONFIG_DRAM_CLK=408 + CONFIG_MACPWR="PD6" +-CONFIG_MMC0_CD_PIN="PH13" + CONFIG_MMC_SUNXI_SLOT_EXTRA=2 + # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set + CONFIG_SUN8I_EMAC=y +--- a/configs/oceanic_5205_5inmfd_defconfig ++++ b/configs/oceanic_5205_5inmfd_defconfig +@@ -7,7 +7,6 @@ CONFIG_RESERVE_ALLWINNER_BOOT0_HEADER=y + CONFIG_SUNXI_DRAM_LPDDR3_STOCK=y + CONFIG_DRAM_CLK=552 + CONFIG_DRAM_ZQ=3881949 +-CONFIG_MMC0_CD_PIN="" + CONFIG_SPL_SPI_SUNXI=y + # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set + CONFIG_SUN8I_EMAC=y +--- a/configs/orangepi_3_defconfig ++++ b/configs/orangepi_3_defconfig +@@ -4,7 +4,6 @@ CONFIG_DEFAULT_DEVICE_TREE="sun50i-h6-or + CONFIG_SPL=y + CONFIG_MACH_SUN50I_H6=y + CONFIG_SUNXI_DRAM_H6_LPDDR3=y +-CONFIG_MMC0_CD_PIN="PF6" + CONFIG_MMC_SUNXI_SLOT_EXTRA=2 + CONFIG_BLUETOOTH_DT_DEVICE_FIXUP="brcm,bcm4345c5" + # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set +--- a/configs/orangepi_lite2_defconfig ++++ b/configs/orangepi_lite2_defconfig +@@ -4,7 +4,6 @@ CONFIG_DEFAULT_DEVICE_TREE="sun50i-h6-or + CONFIG_SPL=y + CONFIG_MACH_SUN50I_H6=y + CONFIG_SUNXI_DRAM_H6_LPDDR3=y +-CONFIG_MMC0_CD_PIN="PF6" + # CONFIG_PSCI_RESET is not set + # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set + CONFIG_USB_EHCI_HCD=y +--- a/configs/orangepi_one_plus_defconfig ++++ b/configs/orangepi_one_plus_defconfig +@@ -4,7 +4,6 @@ CONFIG_DEFAULT_DEVICE_TREE="sun50i-h6-or + CONFIG_SPL=y + CONFIG_MACH_SUN50I_H6=y + CONFIG_SUNXI_DRAM_H6_LPDDR3=y +-CONFIG_MMC0_CD_PIN="PF6" + # CONFIG_PSCI_RESET is not set + # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set + CONFIG_USB_EHCI_HCD=y +--- a/configs/orangepi_zero2_defconfig ++++ b/configs/orangepi_zero2_defconfig +@@ -7,7 +7,6 @@ CONFIG_DRAM_SUN50I_H616_READ_CALIBRATION + CONFIG_DRAM_SUN50I_H616_READ_TRAINING=y + CONFIG_DRAM_SUN50I_H616_WRITE_TRAINING=y + CONFIG_MACH_SUN50I_H616=y +-CONFIG_MMC0_CD_PIN="PF6" + CONFIG_R_I2C_ENABLE=y + CONFIG_SPL_SPI_SUNXI=y + # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set +--- a/configs/orangepi_zero_plus2_defconfig ++++ b/configs/orangepi_zero_plus2_defconfig +@@ -6,7 +6,6 @@ CONFIG_MACH_SUN50I_H5=y + CONFIG_DRAM_CLK=672 + CONFIG_DRAM_ZQ=3881977 + # CONFIG_DRAM_ODT_EN is not set +-CONFIG_MMC0_CD_PIN="PH13" + CONFIG_MMC_SUNXI_SLOT_EXTRA=2 + # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set + CONFIG_SUN8I_EMAC=y +--- a/configs/orangepi_zero_plus2_h3_defconfig ++++ b/configs/orangepi_zero_plus2_h3_defconfig +@@ -5,7 +5,6 @@ CONFIG_SPL=y + CONFIG_MACH_SUN8I_H3=y + CONFIG_DRAM_CLK=672 + # CONFIG_DRAM_ODT_EN is not set +-CONFIG_MMC0_CD_PIN="PH13" + CONFIG_MMC_SUNXI_SLOT_EXTRA=2 + # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set + CONFIG_SUN8I_EMAC=y +--- a/configs/parrot_r16_defconfig ++++ b/configs/parrot_r16_defconfig +@@ -5,7 +5,6 @@ CONFIG_SPL=y + CONFIG_MACH_SUN8I_A33=y + CONFIG_DRAM_CLK=600 + CONFIG_DRAM_ZQ=15291 +-CONFIG_MMC0_CD_PIN="PD14" + CONFIG_MMC_SUNXI_SLOT_EXTRA=2 + CONFIG_USB0_ID_DET="PD10" + CONFIG_USB1_VBUS_PIN="PD12" +--- a/configs/pine64-lts_defconfig ++++ b/configs/pine64-lts_defconfig +@@ -6,7 +6,6 @@ CONFIG_MACH_SUN50I=y + CONFIG_SUNXI_DRAM_LPDDR3_STOCK=y + CONFIG_DRAM_CLK=552 + CONFIG_DRAM_ZQ=3881949 +-CONFIG_MMC0_CD_PIN="" + CONFIG_MMC_SUNXI_SLOT_EXTRA=2 + CONFIG_SPL_SPI_SUNXI=y + # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set +--- a/configs/pine_h64_defconfig ++++ b/configs/pine_h64_defconfig +@@ -5,7 +5,6 @@ CONFIG_SPL=y + CONFIG_MACH_SUN50I_H6=y + CONFIG_SUNXI_DRAM_H6_LPDDR3=y + CONFIG_MACPWR="PC16" +-CONFIG_MMC0_CD_PIN="PF6" + CONFIG_MMC_SUNXI_SLOT_EXTRA=2 + CONFIG_USB3_VBUS_PIN="PL5" + CONFIG_SPL_SPI_SUNXI=y +--- a/configs/sopine_baseboard_defconfig ++++ b/configs/sopine_baseboard_defconfig +@@ -7,7 +7,6 @@ CONFIG_RESERVE_ALLWINNER_BOOT0_HEADER=y + CONFIG_SUNXI_DRAM_LPDDR3_STOCK=y + CONFIG_DRAM_CLK=552 + CONFIG_DRAM_ZQ=3881949 +-CONFIG_MMC0_CD_PIN="" + CONFIG_MMC_SUNXI_SLOT_EXTRA=2 + CONFIG_SPL_SPI_SUNXI=y + # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set +--- a/configs/tanix_tx6_defconfig ++++ b/configs/tanix_tx6_defconfig +@@ -5,6 +5,5 @@ CONFIG_SPL=y + CONFIG_MACH_SUN50I_H6=y + CONFIG_SUNXI_DRAM_H6_DDR3_1333=y + CONFIG_DRAM_CLK=648 +-CONFIG_MMC0_CD_PIN="PF6" + CONFIG_MMC_SUNXI_SLOT_EXTRA=2 + # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set diff --git a/package/boot/uboot-d1/patches/0019-sunxi-mmc-Move-header-to-the-driver-directory.patch b/package/boot/uboot-d1/patches/0019-sunxi-mmc-Move-header-to-the-driver-directory.patch new file mode 100644 index 00000000000000..3299ad49dea0a0 --- /dev/null +++ b/package/boot/uboot-d1/patches/0019-sunxi-mmc-Move-header-to-the-driver-directory.patch @@ -0,0 +1,323 @@ +From 4c0c00e7131baf410702555342337c178dd0de98 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sun, 30 Oct 2022 16:04:47 -0500 +Subject: [PATCH 19/90] sunxi: mmc: Move header to the driver directory + +The MMC controller driver is (and ought to be) the only user of these +register definitions. Put them in a header next to the driver to remove +the dependency on a specific ARM platform's headers. + +Due to the sunxi_mmc_init() prototype, the file was not renamed. None of +the register definitions were changed. + +Signed-off-by: Samuel Holland +--- + arch/arm/include/asm/arch-sunxi/mmc.h | 139 +------------------------- + drivers/mmc/sunxi_mmc.c | 4 + + drivers/mmc/sunxi_mmc.h | 138 +++++++++++++++++++++++++ + 3 files changed, 146 insertions(+), 135 deletions(-) + create mode 100644 drivers/mmc/sunxi_mmc.h + +--- a/arch/arm/include/asm/arch-sunxi/mmc.h ++++ b/arch/arm/include/asm/arch-sunxi/mmc.h +@@ -1,139 +1,8 @@ + /* SPDX-License-Identifier: GPL-2.0+ */ +-/* +- * (C) Copyright 2007-2011 +- * Allwinner Technology Co., Ltd. +- * Aaron +- * +- * MMC register definition for allwinner sunxi platform. +- */ + +-#ifndef _SUNXI_MMC_H +-#define _SUNXI_MMC_H +- +-#include +- +-struct sunxi_mmc { +- u32 gctrl; /* 0x00 global control */ +- u32 clkcr; /* 0x04 clock control */ +- u32 timeout; /* 0x08 time out */ +- u32 width; /* 0x0c bus width */ +- u32 blksz; /* 0x10 block size */ +- u32 bytecnt; /* 0x14 byte count */ +- u32 cmd; /* 0x18 command */ +- u32 arg; /* 0x1c argument */ +- u32 resp0; /* 0x20 response 0 */ +- u32 resp1; /* 0x24 response 1 */ +- u32 resp2; /* 0x28 response 2 */ +- u32 resp3; /* 0x2c response 3 */ +- u32 imask; /* 0x30 interrupt mask */ +- u32 mint; /* 0x34 masked interrupt status */ +- u32 rint; /* 0x38 raw interrupt status */ +- u32 status; /* 0x3c status */ +- u32 ftrglevel; /* 0x40 FIFO threshold watermark*/ +- u32 funcsel; /* 0x44 function select */ +- u32 cbcr; /* 0x48 CIU byte count */ +- u32 bbcr; /* 0x4c BIU byte count */ +- u32 dbgc; /* 0x50 debug enable */ +- u32 res0; /* 0x54 reserved */ +- u32 a12a; /* 0x58 Auto command 12 argument */ +- u32 ntsr; /* 0x5c New timing set register */ +- u32 res1[8]; +- u32 dmac; /* 0x80 internal DMA control */ +- u32 dlba; /* 0x84 internal DMA descr list base address */ +- u32 idst; /* 0x88 internal DMA status */ +- u32 idie; /* 0x8c internal DMA interrupt enable */ +- u32 chda; /* 0x90 */ +- u32 cbda; /* 0x94 */ +- u32 res2[26]; +-#if defined(CONFIG_SUNXI_GEN_SUN6I) || defined(CONFIG_SUN50I_GEN_H6) +- u32 res3[17]; +- u32 samp_dl; +- u32 res4[46]; +-#endif +- u32 fifo; /* 0x100 / 0x200 FIFO access address */ +-}; +- +-#define SUNXI_MMC_CLK_POWERSAVE (0x1 << 17) +-#define SUNXI_MMC_CLK_ENABLE (0x1 << 16) +-#define SUNXI_MMC_CLK_DIVIDER_MASK (0xff) +- +-#define SUNXI_MMC_GCTRL_SOFT_RESET (0x1 << 0) +-#define SUNXI_MMC_GCTRL_FIFO_RESET (0x1 << 1) +-#define SUNXI_MMC_GCTRL_DMA_RESET (0x1 << 2) +-#define SUNXI_MMC_GCTRL_RESET (SUNXI_MMC_GCTRL_SOFT_RESET|\ +- SUNXI_MMC_GCTRL_FIFO_RESET|\ +- SUNXI_MMC_GCTRL_DMA_RESET) +-#define SUNXI_MMC_GCTRL_DMA_ENABLE (0x1 << 5) +-#define SUNXI_MMC_GCTRL_ACCESS_BY_AHB (0x1 << 31) +- +-#define SUNXI_MMC_CMD_RESP_EXPIRE (0x1 << 6) +-#define SUNXI_MMC_CMD_LONG_RESPONSE (0x1 << 7) +-#define SUNXI_MMC_CMD_CHK_RESPONSE_CRC (0x1 << 8) +-#define SUNXI_MMC_CMD_DATA_EXPIRE (0x1 << 9) +-#define SUNXI_MMC_CMD_WRITE (0x1 << 10) +-#define SUNXI_MMC_CMD_AUTO_STOP (0x1 << 12) +-#define SUNXI_MMC_CMD_WAIT_PRE_OVER (0x1 << 13) +-#define SUNXI_MMC_CMD_SEND_INIT_SEQ (0x1 << 15) +-#define SUNXI_MMC_CMD_UPCLK_ONLY (0x1 << 21) +-#define SUNXI_MMC_CMD_START (0x1 << 31) +- +-#define SUNXI_MMC_RINT_RESP_ERROR (0x1 << 1) +-#define SUNXI_MMC_RINT_COMMAND_DONE (0x1 << 2) +-#define SUNXI_MMC_RINT_DATA_OVER (0x1 << 3) +-#define SUNXI_MMC_RINT_TX_DATA_REQUEST (0x1 << 4) +-#define SUNXI_MMC_RINT_RX_DATA_REQUEST (0x1 << 5) +-#define SUNXI_MMC_RINT_RESP_CRC_ERROR (0x1 << 6) +-#define SUNXI_MMC_RINT_DATA_CRC_ERROR (0x1 << 7) +-#define SUNXI_MMC_RINT_RESP_TIMEOUT (0x1 << 8) +-#define SUNXI_MMC_RINT_DATA_TIMEOUT (0x1 << 9) +-#define SUNXI_MMC_RINT_VOLTAGE_CHANGE_DONE (0x1 << 10) +-#define SUNXI_MMC_RINT_FIFO_RUN_ERROR (0x1 << 11) +-#define SUNXI_MMC_RINT_HARD_WARE_LOCKED (0x1 << 12) +-#define SUNXI_MMC_RINT_START_BIT_ERROR (0x1 << 13) +-#define SUNXI_MMC_RINT_AUTO_COMMAND_DONE (0x1 << 14) +-#define SUNXI_MMC_RINT_END_BIT_ERROR (0x1 << 15) +-#define SUNXI_MMC_RINT_SDIO_INTERRUPT (0x1 << 16) +-#define SUNXI_MMC_RINT_CARD_INSERT (0x1 << 30) +-#define SUNXI_MMC_RINT_CARD_REMOVE (0x1 << 31) +-#define SUNXI_MMC_RINT_INTERRUPT_ERROR_BIT \ +- (SUNXI_MMC_RINT_RESP_ERROR | \ +- SUNXI_MMC_RINT_RESP_CRC_ERROR | \ +- SUNXI_MMC_RINT_DATA_CRC_ERROR | \ +- SUNXI_MMC_RINT_RESP_TIMEOUT | \ +- SUNXI_MMC_RINT_DATA_TIMEOUT | \ +- SUNXI_MMC_RINT_VOLTAGE_CHANGE_DONE | \ +- SUNXI_MMC_RINT_FIFO_RUN_ERROR | \ +- SUNXI_MMC_RINT_HARD_WARE_LOCKED | \ +- SUNXI_MMC_RINT_START_BIT_ERROR | \ +- SUNXI_MMC_RINT_END_BIT_ERROR) /* 0xbfc2 */ +-#define SUNXI_MMC_RINT_INTERRUPT_DONE_BIT \ +- (SUNXI_MMC_RINT_AUTO_COMMAND_DONE | \ +- SUNXI_MMC_RINT_DATA_OVER | \ +- SUNXI_MMC_RINT_COMMAND_DONE | \ +- SUNXI_MMC_RINT_VOLTAGE_CHANGE_DONE) +- +-#define SUNXI_MMC_STATUS_RXWL_FLAG (0x1 << 0) +-#define SUNXI_MMC_STATUS_TXWL_FLAG (0x1 << 1) +-#define SUNXI_MMC_STATUS_FIFO_EMPTY (0x1 << 2) +-#define SUNXI_MMC_STATUS_FIFO_FULL (0x1 << 3) +-#define SUNXI_MMC_STATUS_CARD_PRESENT (0x1 << 8) +-#define SUNXI_MMC_STATUS_CARD_DATA_BUSY (0x1 << 9) +-#define SUNXI_MMC_STATUS_DATA_FSM_BUSY (0x1 << 10) +-#define SUNXI_MMC_STATUS_FIFO_LEVEL(reg) (((reg) >> 17) & 0x3fff) +- +-#define SUNXI_MMC_NTSR_MODE_SEL_NEW (0x1 << 31) +- +-#define SUNXI_MMC_IDMAC_RESET (0x1 << 0) +-#define SUNXI_MMC_IDMAC_FIXBURST (0x1 << 1) +-#define SUNXI_MMC_IDMAC_ENABLE (0x1 << 7) +- +-#define SUNXI_MMC_IDIE_TXIRQ (0x1 << 0) +-#define SUNXI_MMC_IDIE_RXIRQ (0x1 << 1) +- +-#define SUNXI_MMC_COMMON_CLK_GATE (1 << 16) +-#define SUNXI_MMC_COMMON_RESET (1 << 18) +- +-#define SUNXI_MMC_CAL_DL_SW_EN (0x1 << 7) ++#ifndef _ASM_ARCH_MMC_H_ ++#define _ASM_ARCH_MMC_H_ + + struct mmc *sunxi_mmc_init(int sdc_no); +-#endif /* _SUNXI_MMC_H */ ++ ++#endif /* _ASM_ARCH_MMC_H_ */ +--- a/drivers/mmc/sunxi_mmc.c ++++ b/drivers/mmc/sunxi_mmc.c +@@ -25,9 +25,13 @@ + #include + #include + #include ++#if !CONFIG_IS_ENABLED(DM_MMC) + #include ++#endif + #include + ++#include "sunxi_mmc.h" ++ + #ifndef CCM_MMC_CTRL_MODE_SEL_NEW + #define CCM_MMC_CTRL_MODE_SEL_NEW 0 + #endif +--- /dev/null ++++ b/drivers/mmc/sunxi_mmc.h +@@ -0,0 +1,138 @@ ++/* SPDX-License-Identifier: GPL-2.0+ */ ++/* ++ * (C) Copyright 2007-2011 ++ * Allwinner Technology Co., Ltd. ++ * Aaron ++ * ++ * MMC register definition for allwinner sunxi platform. ++ */ ++ ++#ifndef _SUNXI_MMC_H ++#define _SUNXI_MMC_H ++ ++#include ++ ++struct sunxi_mmc { ++ u32 gctrl; /* 0x00 global control */ ++ u32 clkcr; /* 0x04 clock control */ ++ u32 timeout; /* 0x08 time out */ ++ u32 width; /* 0x0c bus width */ ++ u32 blksz; /* 0x10 block size */ ++ u32 bytecnt; /* 0x14 byte count */ ++ u32 cmd; /* 0x18 command */ ++ u32 arg; /* 0x1c argument */ ++ u32 resp0; /* 0x20 response 0 */ ++ u32 resp1; /* 0x24 response 1 */ ++ u32 resp2; /* 0x28 response 2 */ ++ u32 resp3; /* 0x2c response 3 */ ++ u32 imask; /* 0x30 interrupt mask */ ++ u32 mint; /* 0x34 masked interrupt status */ ++ u32 rint; /* 0x38 raw interrupt status */ ++ u32 status; /* 0x3c status */ ++ u32 ftrglevel; /* 0x40 FIFO threshold watermark*/ ++ u32 funcsel; /* 0x44 function select */ ++ u32 cbcr; /* 0x48 CIU byte count */ ++ u32 bbcr; /* 0x4c BIU byte count */ ++ u32 dbgc; /* 0x50 debug enable */ ++ u32 res0; /* 0x54 reserved */ ++ u32 a12a; /* 0x58 Auto command 12 argument */ ++ u32 ntsr; /* 0x5c New timing set register */ ++ u32 res1[8]; ++ u32 dmac; /* 0x80 internal DMA control */ ++ u32 dlba; /* 0x84 internal DMA descr list base address */ ++ u32 idst; /* 0x88 internal DMA status */ ++ u32 idie; /* 0x8c internal DMA interrupt enable */ ++ u32 chda; /* 0x90 */ ++ u32 cbda; /* 0x94 */ ++ u32 res2[26]; ++#if defined(CONFIG_SUNXI_GEN_SUN6I) || defined(CONFIG_SUN50I_GEN_H6) ++ u32 res3[17]; ++ u32 samp_dl; ++ u32 res4[46]; ++#endif ++ u32 fifo; /* 0x100 / 0x200 FIFO access address */ ++}; ++ ++#define SUNXI_MMC_CLK_POWERSAVE (0x1 << 17) ++#define SUNXI_MMC_CLK_ENABLE (0x1 << 16) ++#define SUNXI_MMC_CLK_DIVIDER_MASK (0xff) ++ ++#define SUNXI_MMC_GCTRL_SOFT_RESET (0x1 << 0) ++#define SUNXI_MMC_GCTRL_FIFO_RESET (0x1 << 1) ++#define SUNXI_MMC_GCTRL_DMA_RESET (0x1 << 2) ++#define SUNXI_MMC_GCTRL_RESET (SUNXI_MMC_GCTRL_SOFT_RESET|\ ++ SUNXI_MMC_GCTRL_FIFO_RESET|\ ++ SUNXI_MMC_GCTRL_DMA_RESET) ++#define SUNXI_MMC_GCTRL_DMA_ENABLE (0x1 << 5) ++#define SUNXI_MMC_GCTRL_ACCESS_BY_AHB (0x1 << 31) ++ ++#define SUNXI_MMC_CMD_RESP_EXPIRE (0x1 << 6) ++#define SUNXI_MMC_CMD_LONG_RESPONSE (0x1 << 7) ++#define SUNXI_MMC_CMD_CHK_RESPONSE_CRC (0x1 << 8) ++#define SUNXI_MMC_CMD_DATA_EXPIRE (0x1 << 9) ++#define SUNXI_MMC_CMD_WRITE (0x1 << 10) ++#define SUNXI_MMC_CMD_AUTO_STOP (0x1 << 12) ++#define SUNXI_MMC_CMD_WAIT_PRE_OVER (0x1 << 13) ++#define SUNXI_MMC_CMD_SEND_INIT_SEQ (0x1 << 15) ++#define SUNXI_MMC_CMD_UPCLK_ONLY (0x1 << 21) ++#define SUNXI_MMC_CMD_START (0x1 << 31) ++ ++#define SUNXI_MMC_RINT_RESP_ERROR (0x1 << 1) ++#define SUNXI_MMC_RINT_COMMAND_DONE (0x1 << 2) ++#define SUNXI_MMC_RINT_DATA_OVER (0x1 << 3) ++#define SUNXI_MMC_RINT_TX_DATA_REQUEST (0x1 << 4) ++#define SUNXI_MMC_RINT_RX_DATA_REQUEST (0x1 << 5) ++#define SUNXI_MMC_RINT_RESP_CRC_ERROR (0x1 << 6) ++#define SUNXI_MMC_RINT_DATA_CRC_ERROR (0x1 << 7) ++#define SUNXI_MMC_RINT_RESP_TIMEOUT (0x1 << 8) ++#define SUNXI_MMC_RINT_DATA_TIMEOUT (0x1 << 9) ++#define SUNXI_MMC_RINT_VOLTAGE_CHANGE_DONE (0x1 << 10) ++#define SUNXI_MMC_RINT_FIFO_RUN_ERROR (0x1 << 11) ++#define SUNXI_MMC_RINT_HARD_WARE_LOCKED (0x1 << 12) ++#define SUNXI_MMC_RINT_START_BIT_ERROR (0x1 << 13) ++#define SUNXI_MMC_RINT_AUTO_COMMAND_DONE (0x1 << 14) ++#define SUNXI_MMC_RINT_END_BIT_ERROR (0x1 << 15) ++#define SUNXI_MMC_RINT_SDIO_INTERRUPT (0x1 << 16) ++#define SUNXI_MMC_RINT_CARD_INSERT (0x1 << 30) ++#define SUNXI_MMC_RINT_CARD_REMOVE (0x1 << 31) ++#define SUNXI_MMC_RINT_INTERRUPT_ERROR_BIT \ ++ (SUNXI_MMC_RINT_RESP_ERROR | \ ++ SUNXI_MMC_RINT_RESP_CRC_ERROR | \ ++ SUNXI_MMC_RINT_DATA_CRC_ERROR | \ ++ SUNXI_MMC_RINT_RESP_TIMEOUT | \ ++ SUNXI_MMC_RINT_DATA_TIMEOUT | \ ++ SUNXI_MMC_RINT_VOLTAGE_CHANGE_DONE | \ ++ SUNXI_MMC_RINT_FIFO_RUN_ERROR | \ ++ SUNXI_MMC_RINT_HARD_WARE_LOCKED | \ ++ SUNXI_MMC_RINT_START_BIT_ERROR | \ ++ SUNXI_MMC_RINT_END_BIT_ERROR) /* 0xbfc2 */ ++#define SUNXI_MMC_RINT_INTERRUPT_DONE_BIT \ ++ (SUNXI_MMC_RINT_AUTO_COMMAND_DONE | \ ++ SUNXI_MMC_RINT_DATA_OVER | \ ++ SUNXI_MMC_RINT_COMMAND_DONE | \ ++ SUNXI_MMC_RINT_VOLTAGE_CHANGE_DONE) ++ ++#define SUNXI_MMC_STATUS_RXWL_FLAG (0x1 << 0) ++#define SUNXI_MMC_STATUS_TXWL_FLAG (0x1 << 1) ++#define SUNXI_MMC_STATUS_FIFO_EMPTY (0x1 << 2) ++#define SUNXI_MMC_STATUS_FIFO_FULL (0x1 << 3) ++#define SUNXI_MMC_STATUS_CARD_PRESENT (0x1 << 8) ++#define SUNXI_MMC_STATUS_CARD_DATA_BUSY (0x1 << 9) ++#define SUNXI_MMC_STATUS_DATA_FSM_BUSY (0x1 << 10) ++#define SUNXI_MMC_STATUS_FIFO_LEVEL(reg) (((reg) >> 17) & 0x3fff) ++ ++#define SUNXI_MMC_NTSR_MODE_SEL_NEW (0x1 << 31) ++ ++#define SUNXI_MMC_IDMAC_RESET (0x1 << 0) ++#define SUNXI_MMC_IDMAC_FIXBURST (0x1 << 1) ++#define SUNXI_MMC_IDMAC_ENABLE (0x1 << 7) ++ ++#define SUNXI_MMC_IDIE_TXIRQ (0x1 << 0) ++#define SUNXI_MMC_IDIE_RXIRQ (0x1 << 1) ++ ++#define SUNXI_MMC_COMMON_CLK_GATE (1 << 16) ++#define SUNXI_MMC_COMMON_RESET (1 << 18) ++ ++#define SUNXI_MMC_CAL_DL_SW_EN (0x1 << 7) ++ ++#endif /* _SUNXI_MMC_H */ diff --git a/package/boot/uboot-d1/patches/0020-pinctrl-sunxi-Add-support-for-the-D1.patch b/package/boot/uboot-d1/patches/0020-pinctrl-sunxi-Add-support-for-the-D1.patch new file mode 100644 index 00000000000000..383db83d171b59 --- /dev/null +++ b/package/boot/uboot-d1/patches/0020-pinctrl-sunxi-Add-support-for-the-D1.patch @@ -0,0 +1,72 @@ +From fdf871a6089ee2f56439880b69d33a7d0d707d15 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sat, 28 Aug 2021 22:24:28 -0500 +Subject: [PATCH 20/90] pinctrl: sunxi: Add support for the D1 + +Signed-off-by: Samuel Holland +--- + drivers/pinctrl/sunxi/Kconfig | 5 +++++ + drivers/pinctrl/sunxi/pinctrl-sunxi.c | 31 +++++++++++++++++++++++++++ + 2 files changed, 36 insertions(+) + +--- a/drivers/pinctrl/sunxi/Kconfig ++++ b/drivers/pinctrl/sunxi/Kconfig +@@ -89,6 +89,11 @@ config PINCTRL_SUN9I_A80_R + default MACH_SUN9I + select PINCTRL_SUNXI + ++config PINCTRL_SUN20I_D1 ++ bool "Support for the Allwinner D1 PIO" ++ default TARGET_SUN20I_D1 ++ select PINCTRL_SUNXI ++ + config PINCTRL_SUN50I_A64 + bool "Support for the Allwinner A64 PIO" + default MACH_SUN50I +--- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c ++++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c +@@ -588,6 +588,31 @@ static const struct sunxi_pinctrl_desc _ + .num_banks = 3, + }; + ++static const struct sunxi_pinctrl_function sun20i_d1_pinctrl_functions[] = { ++ { "emac", 8 }, /* PE0-PE15 */ ++ { "gpio_in", 0 }, ++ { "gpio_out", 1 }, ++ { "i2c0", 4 }, /* PB10-PB11 */ ++ { "mmc0", 2 }, /* PF0-PF5 */ ++ { "mmc1", 2 }, /* PG0-PG5 */ ++ { "mmc2", 3 }, /* PC2-PC7 */ ++ { "spi0", 2 }, /* PC2-PC7 */ ++#if IS_ENABLED(CONFIG_UART0_PORT_F) ++ { "uart0", 3 }, /* PF2-PF4 */ ++#else ++ { "uart0", 6 }, /* PB8-PB9 */ ++#endif ++ { "uart1", 2 }, /* PG6-PG7 */ ++ { "uart2", 7 }, /* PB0-PB1 */ ++}; ++ ++static const struct sunxi_pinctrl_desc __maybe_unused sun20i_d1_pinctrl_desc = { ++ .functions = sun20i_d1_pinctrl_functions, ++ .num_functions = ARRAY_SIZE(sun20i_d1_pinctrl_functions), ++ .first_bank = SUNXI_GPIO_A, ++ .num_banks = 7, ++}; ++ + static const struct sunxi_pinctrl_function sun50i_a64_pinctrl_functions[] = { + { "emac", 4 }, /* PD8-PD23 */ + { "gpio_in", 0 }, +@@ -849,6 +874,12 @@ static const struct udevice_id sunxi_pin + .data = (ulong)&sun9i_a80_r_pinctrl_desc, + }, + #endif ++#ifdef CONFIG_PINCTRL_SUN20I_D1 ++ { ++ .compatible = "allwinner,sun20i-d1-pinctrl", ++ .data = (ulong)&sun20i_d1_pinctrl_desc, ++ }, ++#endif + #ifdef CONFIG_PINCTRL_SUN50I_A64 + { + .compatible = "allwinner,sun50i-a64-pinctrl", diff --git a/package/boot/uboot-d1/patches/0021-serial-ns16550-Enable-clocks-during-probe.patch b/package/boot/uboot-d1/patches/0021-serial-ns16550-Enable-clocks-during-probe.patch new file mode 100644 index 00000000000000..0e28782287f0b2 --- /dev/null +++ b/package/boot/uboot-d1/patches/0021-serial-ns16550-Enable-clocks-during-probe.patch @@ -0,0 +1,34 @@ +From 8fde85b609273f8389178d4c0d066390a0e0773d Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sun, 30 Oct 2022 14:56:10 -0500 +Subject: [PATCH 21/90] serial: ns16550: Enable clocks during probe + +If the UART bus or baud clock has a gate, it must be enabled before the +UART can be used. + +Signed-off-by: Samuel Holland +--- + drivers/serial/ns16550.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/drivers/serial/ns16550.c ++++ b/drivers/serial/ns16550.c +@@ -506,6 +506,7 @@ int ns16550_serial_probe(struct udevice + struct ns16550_plat *plat = dev_get_plat(dev); + struct ns16550 *const com_port = dev_get_priv(dev); + struct reset_ctl_bulk reset_bulk; ++ struct clk_bulk clk_bulk; + fdt_addr_t addr; + int ret; + +@@ -524,6 +525,10 @@ int ns16550_serial_probe(struct udevice + if (!ret) + reset_deassert_bulk(&reset_bulk); + ++ ret = clk_get_bulk(dev, &clk_bulk); ++ if (!ret) ++ clk_enable_bulk(&clk_bulk); ++ + com_port->plat = dev_get_plat(dev); + ns16550_init(com_port, -1); + diff --git a/package/boot/uboot-d1/patches/0022-fdt-Fix-bounds-check-in-devfdt_get_addr_index.patch b/package/boot/uboot-d1/patches/0022-fdt-Fix-bounds-check-in-devfdt_get_addr_index.patch new file mode 100644 index 00000000000000..88d4d670faf04a --- /dev/null +++ b/package/boot/uboot-d1/patches/0022-fdt-Fix-bounds-check-in-devfdt_get_addr_index.patch @@ -0,0 +1,28 @@ +From 0e4edc3a01f179337bb0bd0d31855dbce338a23e Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sun, 30 Oct 2022 14:53:45 -0500 +Subject: [PATCH 22/90] fdt: Fix bounds check in devfdt_get_addr_index + +reg must contain enough cells for the entire next address/size pair +after skipping `index` pairs. The previous code allows an out-of-bounds +read when na + ns > 1. + +Series-to: Simon Glass + +Fixes: 69b41388ba45 ("dm: core: Add a new api to get indexed device address") +Signed-off-by: Samuel Holland +--- + drivers/core/fdtaddr.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/core/fdtaddr.c ++++ b/drivers/core/fdtaddr.c +@@ -43,7 +43,7 @@ fdt_addr_t devfdt_get_addr_index(const s + } + + reg = fdt_getprop(gd->fdt_blob, offset, "reg", &len); +- if (!reg || (len <= (index * sizeof(fdt32_t) * (na + ns)))) { ++ if (!reg || (len < ((index + 1) * sizeof(fdt32_t) * (na + ns)))) { + debug("Req index out of range\n"); + return FDT_ADDR_T_NONE; + } diff --git a/package/boot/uboot-d1/patches/0023-Kconfig-Remove-an-impossible-condition.patch b/package/boot/uboot-d1/patches/0023-Kconfig-Remove-an-impossible-condition.patch new file mode 100644 index 00000000000000..285fd1e04042a9 --- /dev/null +++ b/package/boot/uboot-d1/patches/0023-Kconfig-Remove-an-impossible-condition.patch @@ -0,0 +1,25 @@ +From 2d85df851c590b454749ac989a778bb226637bfc Mon Sep 17 00:00:00 2001 +From: Zoltan HERPAI +Date: Tue, 6 Jun 2023 15:08:39 +0000 +Subject: [PATCH 23/90] Kconfig: Remove an impossible condition + +ARCH_SUNXI selects BINMAN, so the condition "!BINMAN && ARCH_SUNXI" +is impossible to satisfy. + +Signed-off-by: Samuel Holland +Signed-off-by: Zoltan HERPAI +--- + Kconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/Kconfig ++++ b/Kconfig +@@ -459,7 +459,7 @@ config BUILD_TARGET + default "u-boot-with-spl.kwb" if ARCH_MVEBU && SPL + default "u-boot-elf.srec" if RCAR_GEN3 + default "u-boot.itb" if !BINMAN && SPL_LOAD_FIT && (ARCH_ROCKCHIP || \ +- ARCH_SUNXI || RISCV || ARCH_ZYNQMP) ++ RISCV || ARCH_ZYNQMP) + default "u-boot.kwb" if ARCH_KIRKWOOD + default "u-boot-with-spl.bin" if ARCH_AT91 && SPL_NAND_SUPPORT + default "u-boot-with-spl.imx" if ARCH_MX6 && SPL diff --git a/package/boot/uboot-d1/patches/0024-binman-Prevent-entries-in-a-section-from-overlapping.patch b/package/boot/uboot-d1/patches/0024-binman-Prevent-entries-in-a-section-from-overlapping.patch new file mode 100644 index 00000000000000..2a7e544a7f4a6d --- /dev/null +++ b/package/boot/uboot-d1/patches/0024-binman-Prevent-entries-in-a-section-from-overlapping.patch @@ -0,0 +1,33 @@ +From b7150f7dd885012868c94b29ac4fe6152c065a95 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sat, 9 Oct 2021 10:43:56 -0500 +Subject: [PATCH 24/90] binman: Prevent entries in a section from overlapping + +Currently, if the "offset" property is given for an entry, the section's +running offset is completely ignored. This causes entries to overlap if +the provided offset is less than the size of the entries earlier in the +section. Avoid the overlap by only using the provided offset when it is +greater than the running offset. + +The motivation for this change is the rule used by SPL to find U-Boot on +sunxi boards: U-Boot starts 32 KiB after the start of SPL, unless SPL is +larger than 32 KiB, in which case U-Boot immediately follows SPL. + +Signed-off-by: Samuel Holland +--- + tools/binman/entry.py | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/tools/binman/entry.py ++++ b/tools/binman/entry.py +@@ -483,7 +483,9 @@ class Entry(object): + if self.offset_unset: + self.Raise('No offset set with offset-unset: should another ' + 'entry provide this correct offset?') +- self.offset = tools.align(offset, self.align) ++ elif self.offset > offset: ++ offset = self.offset ++ self.offset = tools.align(offset, self.align) + needed = self.pad_before + self.contents_size + self.pad_after + needed = tools.align(needed, self.align_size) + size = self.size diff --git a/package/boot/uboot-d1/patches/0025-sunxi-binman-Enable-SPL-FIT-loading-for-32-bit-SoCs.patch b/package/boot/uboot-d1/patches/0025-sunxi-binman-Enable-SPL-FIT-loading-for-32-bit-SoCs.patch new file mode 100644 index 00000000000000..7deee7a4691254 --- /dev/null +++ b/package/boot/uboot-d1/patches/0025-sunxi-binman-Enable-SPL-FIT-loading-for-32-bit-SoCs.patch @@ -0,0 +1,192 @@ +From b641ca5f4d272b83ef77ebcf5c75678cf139c69a Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sat, 17 Apr 2021 13:33:54 -0500 +Subject: [PATCH 25/90] sunxi: binman: Enable SPL FIT loading for 32-bit SoCs + +Now that Crust (SCP firmware) has support for H3, we need a FIT image to +load it. H3 also needs to load a SoC-specific eGon blob to support CPU 0 +hotplug. Let's first enable FIT support before adding extra firmware. + +Update the binman description to work on either 32-bit or 64-bit SoCs: + - Make BL31 optional, since it is not used on 32-bit SoCs (though BL32 + may be used in the future). + - Explicitly set the minimum offset of the FIT to 32 KiB, since SPL on + some boards is still only 24 KiB large even with FIT support enabled. + CONFIG_SPL_PAD_TO cannot be used because it is not defined for H616. + +FIT unlocks more features (signatures, multiple DTBs, etc.), so enable +it by default. A10 (sun4i) only has 24 KiB of SRAM A1, so it needs +SPL_FIT_IMAGE_TINY. For simplicity, enable that option everywhere. + +Cover-letter: +sunxi: SPL FIT support for 32-bit sunxi SoCs +This series makes the necessary changes so 32-bit sunxi SoCs can load +additional device trees or firmware from SPL along with U-Boot proper. + +There was no existing binman entry property that put the FIT at the +right offset. The minimum offset is 32k, but this matches neither the +SPL size (which is no more than 24k on some SoCs) nor the FIT alignment +(which is 512 bytes in practice due to SPL size constraints). So instead +of adding a new property, I fixed what is arguably a bug in the offset +property -- though this strategy will not work if someone is +intentionally creating overlapping entries. +END +Series-to: sunxi +Series-to: sjg +Signed-off-by: Samuel Holland +--- + arch/arm/Kconfig | 1 + + arch/arm/dts/sunxi-u-boot.dtsi | 46 ++++++++++++++++++++++------------ + common/spl/Kconfig | 9 +++---- + 3 files changed, 35 insertions(+), 21 deletions(-) + +--- a/arch/arm/Kconfig ++++ b/arch/arm/Kconfig +@@ -1135,6 +1135,7 @@ config ARCH_SUNXI + imply SPL_GPIO + imply SPL_LIBCOMMON_SUPPORT + imply SPL_LIBGENERIC_SUPPORT ++ imply SPL_LOAD_FIT + imply SPL_MMC if MMC + imply SPL_POWER + imply SPL_SERIAL +--- a/arch/arm/dts/sunxi-u-boot.dtsi ++++ b/arch/arm/dts/sunxi-u-boot.dtsi +@@ -1,13 +1,19 @@ + #include + +-#ifdef CONFIG_MACH_SUN50I_H6 +-#define BL31_ADDR 0x104000 +-#define SCP_ADDR 0x114000 +-#elif defined(CONFIG_MACH_SUN50I_H616) +-#define BL31_ADDR 0x40000000 ++#ifdef CONFIG_ARM64 ++#define ARCH "arm64" + #else +-#define BL31_ADDR 0x44000 +-#define SCP_ADDR 0x50000 ++#define ARCH "arm" ++#endif ++ ++#if defined(CONFIG_MACH_SUN50I) || defined(CONFIG_MACH_SUN50I_H5) ++#define BL31_ADDR 0x00044000 ++#define SCP_ADDR 0x00050000 ++#elif defined(CONFIG_MACH_SUN50I_H6) ++#define BL31_ADDR 0x00104000 ++#define SCP_ADDR 0x00114000 ++#elif defined(CONFIG_MACH_SUN50I_H616) ++#define BL31_ADDR 0x40000000 + #endif + + / { +@@ -34,30 +40,33 @@ + filename = "spl/sunxi-spl.bin"; + }; + +-#ifdef CONFIG_ARM64 ++#ifdef CONFIG_SPL_LOAD_FIT + fit { +- description = "Configuration to load ATF before U-Boot"; ++ description = "Configuration to load U-Boot and firmware"; ++ offset = <32768>; + #address-cells = <1>; + fit,fdt-list = "of-list"; + + images { + uboot { +- description = "U-Boot (64-bit)"; ++ description = "U-Boot"; + type = "standalone"; + os = "u-boot"; +- arch = "arm64"; ++ arch = ARCH; + compression = "none"; + load = ; ++ entry = ; + + u-boot-nodtb { + }; + }; + ++#ifdef BL31_ADDR + atf { + description = "ARM Trusted Firmware"; + type = "firmware"; + os = "arm-trusted-firmware"; +- arch = "arm64"; ++ arch = ARCH; + compression = "none"; + load = ; + entry = ; +@@ -67,6 +76,7 @@ + missing-msg = "atf-bl31-sunxi"; + }; + }; ++#endif + + #ifdef SCP_ADDR + scp { +@@ -95,19 +105,23 @@ + + @config-SEQ { + description = "NAME"; ++#ifdef BL31_ADDR + firmware = "atf"; +-#ifndef SCP_ADDR +- loadables = "uboot"; + #else +- loadables = "scp", "uboot"; ++ firmware = "uboot"; ++#endif ++ loadables = ++#ifdef SCP_ADDR ++ "scp", + #endif ++ "uboot"; + fdt = "fdt-SEQ"; + }; + }; + }; + #else + u-boot-img { +- offset = ; ++ offset = <32768>; + }; + #endif + }; +--- a/common/spl/Kconfig ++++ b/common/spl/Kconfig +@@ -76,12 +76,12 @@ config SPL_SIZE_LIMIT_PROVIDE_STACK + + config SPL_MAX_SIZE + hex "Maximum size of the SPL image, excluding BSS" ++ default 0x37fa0 if MACH_SUN50I_H616 + default 0x30000 if ARCH_MX6 && MX6_OCRAM_256KB ++ default 0x25fa0 if MACH_SUN50I_H6 + default 0x1b000 if AM33XX && !TI_SECURE_DEVICE + default 0x10000 if ARCH_MX6 && !MX6_OCRAM_256KB + default 0x7fa0 if SUNXI_SRAM_ADDRESS = 0x10000 +- default 0x7fa0 if SUNXI_SRAM_ADDRESS = 0x20000 && !MACH_SUN50I_H616 +- default 0xbfa0 if MACH_SUN50I_H616 + default 0x7000 if RCAR_GEN3 + default 0x5fa0 if SUNXI_SRAM_ADDRESS = 0x0 + default 0x10000 if ASPEED_AST2600 +@@ -97,7 +97,7 @@ config SPL_PAD_TO + default 0x31000 if ARCH_MX6 && MX6_OCRAM_256KB + default 0x11000 if ARCH_MX7 || (ARCH_MX6 && !MX6_OCRAM_256KB) + default 0x10000 if ARCH_KEYSTONE +- default 0x8000 if ARCH_SUNXI && !MACH_SUN50I_H616 ++ default 0x0 if ARCH_SUNXI + default 0x0 if ARCH_MTMIPS + default TPL_MAX_SIZE if TPL_MAX_SIZE > SPL_MAX_SIZE + default SPL_MAX_SIZE +@@ -575,8 +575,7 @@ config SPL_MD5 + config SPL_FIT_IMAGE_TINY + bool "Remove functionality from SPL FIT loading to reduce size" + depends on SPL_FIT +- default y if MACH_SUN50I || MACH_SUN50I_H5 || SUN50I_GEN_H6 +- default y if ARCH_IMX8M || ARCH_IMX9 ++ default y if ARCH_IMX8M || ARCH_IMX9 || ARCH_SUNXI + help + Enable this to reduce the size of the FIT image loading code + in SPL, if space for the SPL binary is very tight. diff --git a/package/boot/uboot-d1/patches/0026-sunxi-psci-Avoid-hanging-when-CPU-0-is-hot-unplugged.patch b/package/boot/uboot-d1/patches/0026-sunxi-psci-Avoid-hanging-when-CPU-0-is-hot-unplugged.patch new file mode 100644 index 00000000000000..e440351b0abecc --- /dev/null +++ b/package/boot/uboot-d1/patches/0026-sunxi-psci-Avoid-hanging-when-CPU-0-is-hot-unplugged.patch @@ -0,0 +1,51 @@ +From ca1e6f4491981432c3e88441131c8e25067da95e Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sat, 9 Oct 2021 22:00:22 -0500 +Subject: [PATCH 26/90] sunxi: psci: Avoid hanging when CPU 0 is hot-unplugged + +Do not try to send an SGI from CPU 0 to itself. Since FIQs are masked +when entering monitor mode, this will hang. Plus, CPU 0 cannot fully +power itself off anyway. Instead, have it turn FIQs back on and continue +servicing SGIs from other cores. + +Signed-off-by: Samuel Holland +--- + arch/arm/cpu/armv7/sunxi/psci.c | 20 +++++++++++++++++--- + 1 file changed, 17 insertions(+), 3 deletions(-) + +--- a/arch/arm/cpu/armv7/sunxi/psci.c ++++ b/arch/arm/cpu/armv7/sunxi/psci.c +@@ -38,6 +38,15 @@ + #define SUN8I_R40_PWR_CLAMP(cpu) (0x120 + (cpu) * 0x4) + #define SUN8I_R40_SRAMC_SOFT_ENTRY_REG0 (0xbc) + ++static inline u32 __secure cp15_read_mpidr(void) ++{ ++ u32 val; ++ ++ asm volatile ("mrc p15, 0, %0, c0, c0, 5" : "=r" (val)); ++ ++ return val; ++} ++ + static void __secure cp15_write_cntp_tval(u32 tval) + { + asm volatile ("mcr p15, 0, %0, c14, c2, 0" : : "r" (tval)); +@@ -281,9 +290,14 @@ s32 __secure psci_cpu_off(void) + { + psci_cpu_off_common(); + +- /* Ask CPU0 via SGI15 to pull the rug... */ +- writel(BIT(16) | 15, GICD_BASE + GICD_SGIR); +- dsb(); ++ if (cp15_read_mpidr() & 3) { ++ /* Ask CPU0 via SGI15 to pull the rug... */ ++ writel(BIT(16) | 15, GICD_BASE + GICD_SGIR); ++ dsb(); ++ } else { ++ /* Unmask FIQs to service SGI15. */ ++ asm volatile ("cpsie f"); ++ } + + /* Wait to be turned off */ + while (1) diff --git a/package/boot/uboot-d1/patches/0027-clk-sunxi-Add-NAND-clocks-and-resets.patch b/package/boot/uboot-d1/patches/0027-clk-sunxi-Add-NAND-clocks-and-resets.patch new file mode 100644 index 00000000000000..157c3cd4a25309 --- /dev/null +++ b/package/boot/uboot-d1/patches/0027-clk-sunxi-Add-NAND-clocks-and-resets.patch @@ -0,0 +1,295 @@ +From 2f48dfc23d612f6f1798ff761854fd3141d0671f Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sun, 15 May 2022 21:29:22 -0500 +Subject: [PATCH 27/90] clk: sunxi: Add NAND clocks and resets + +Currently NAND clock setup is done in board code, both in SPL and in +U-Boot proper. Add the NAND clocks/resets here so they can be used by +the "full" NAND driver once it is converted to the driver model. + +The bit locations are copied from the Linux CCU drivers. + +Signed-off-by: Samuel Holland +--- + drivers/clk/sunxi/clk_a10.c | 2 ++ + drivers/clk/sunxi/clk_a10s.c | 2 ++ + drivers/clk/sunxi/clk_a23.c | 3 +++ + drivers/clk/sunxi/clk_a31.c | 6 ++++++ + drivers/clk/sunxi/clk_a64.c | 3 +++ + drivers/clk/sunxi/clk_a80.c | 8 ++++++++ + drivers/clk/sunxi/clk_a83t.c | 3 +++ + drivers/clk/sunxi/clk_h3.c | 3 +++ + drivers/clk/sunxi/clk_h6.c | 6 ++++++ + drivers/clk/sunxi/clk_h616.c | 6 ++++++ + drivers/clk/sunxi/clk_r40.c | 3 +++ + 11 files changed, 45 insertions(+) + +--- a/drivers/clk/sunxi/clk_a10.c ++++ b/drivers/clk/sunxi/clk_a10.c +@@ -23,6 +23,7 @@ static struct ccu_clk_gate a10_gates[] = + [CLK_AHB_MMC1] = GATE(0x060, BIT(9)), + [CLK_AHB_MMC2] = GATE(0x060, BIT(10)), + [CLK_AHB_MMC3] = GATE(0x060, BIT(11)), ++ [CLK_AHB_NAND] = GATE(0x060, BIT(13)), + [CLK_AHB_EMAC] = GATE(0x060, BIT(17)), + [CLK_AHB_SPI0] = GATE(0x060, BIT(20)), + [CLK_AHB_SPI1] = GATE(0x060, BIT(21)), +@@ -47,6 +48,7 @@ static struct ccu_clk_gate a10_gates[] = + [CLK_APB1_UART6] = GATE(0x06c, BIT(22)), + [CLK_APB1_UART7] = GATE(0x06c, BIT(23)), + ++ [CLK_NAND] = GATE(0x080, BIT(31)), + [CLK_SPI0] = GATE(0x0a0, BIT(31)), + [CLK_SPI1] = GATE(0x0a4, BIT(31)), + [CLK_SPI2] = GATE(0x0a8, BIT(31)), +--- a/drivers/clk/sunxi/clk_a10s.c ++++ b/drivers/clk/sunxi/clk_a10s.c +@@ -20,6 +20,7 @@ static struct ccu_clk_gate a10s_gates[] + [CLK_AHB_MMC0] = GATE(0x060, BIT(8)), + [CLK_AHB_MMC1] = GATE(0x060, BIT(9)), + [CLK_AHB_MMC2] = GATE(0x060, BIT(10)), ++ [CLK_AHB_NAND] = GATE(0x060, BIT(13)), + [CLK_AHB_EMAC] = GATE(0x060, BIT(17)), + [CLK_AHB_SPI0] = GATE(0x060, BIT(20)), + [CLK_AHB_SPI1] = GATE(0x060, BIT(21)), +@@ -35,6 +36,7 @@ static struct ccu_clk_gate a10s_gates[] + [CLK_APB1_UART2] = GATE(0x06c, BIT(18)), + [CLK_APB1_UART3] = GATE(0x06c, BIT(19)), + ++ [CLK_NAND] = GATE(0x080, BIT(31)), + [CLK_SPI0] = GATE(0x0a0, BIT(31)), + [CLK_SPI1] = GATE(0x0a4, BIT(31)), + [CLK_SPI2] = GATE(0x0a8, BIT(31)), +--- a/drivers/clk/sunxi/clk_a23.c ++++ b/drivers/clk/sunxi/clk_a23.c +@@ -17,6 +17,7 @@ static struct ccu_clk_gate a23_gates[] = + [CLK_BUS_MMC0] = GATE(0x060, BIT(8)), + [CLK_BUS_MMC1] = GATE(0x060, BIT(9)), + [CLK_BUS_MMC2] = GATE(0x060, BIT(10)), ++ [CLK_BUS_NAND] = GATE(0x060, BIT(13)), + [CLK_BUS_SPI0] = GATE(0x060, BIT(20)), + [CLK_BUS_SPI1] = GATE(0x060, BIT(21)), + [CLK_BUS_OTG] = GATE(0x060, BIT(24)), +@@ -34,6 +35,7 @@ static struct ccu_clk_gate a23_gates[] = + [CLK_BUS_UART3] = GATE(0x06c, BIT(19)), + [CLK_BUS_UART4] = GATE(0x06c, BIT(20)), + ++ [CLK_NAND] = GATE(0x080, BIT(31)), + [CLK_SPI0] = GATE(0x0a0, BIT(31)), + [CLK_SPI1] = GATE(0x0a4, BIT(31)), + +@@ -52,6 +54,7 @@ static struct ccu_reset a23_resets[] = { + [RST_BUS_MMC0] = RESET(0x2c0, BIT(8)), + [RST_BUS_MMC1] = RESET(0x2c0, BIT(9)), + [RST_BUS_MMC2] = RESET(0x2c0, BIT(10)), ++ [RST_BUS_NAND] = RESET(0x2c0, BIT(13)), + [RST_BUS_SPI0] = RESET(0x2c0, BIT(20)), + [RST_BUS_SPI1] = RESET(0x2c0, BIT(21)), + [RST_BUS_OTG] = RESET(0x2c0, BIT(24)), +--- a/drivers/clk/sunxi/clk_a31.c ++++ b/drivers/clk/sunxi/clk_a31.c +@@ -18,6 +18,8 @@ static struct ccu_clk_gate a31_gates[] = + [CLK_AHB1_MMC1] = GATE(0x060, BIT(9)), + [CLK_AHB1_MMC2] = GATE(0x060, BIT(10)), + [CLK_AHB1_MMC3] = GATE(0x060, BIT(11)), ++ [CLK_AHB1_NAND1] = GATE(0x060, BIT(12)), ++ [CLK_AHB1_NAND0] = GATE(0x060, BIT(13)), + [CLK_AHB1_EMAC] = GATE(0x060, BIT(17)), + [CLK_AHB1_SPI0] = GATE(0x060, BIT(20)), + [CLK_AHB1_SPI1] = GATE(0x060, BIT(21)), +@@ -43,6 +45,8 @@ static struct ccu_clk_gate a31_gates[] = + [CLK_APB2_UART4] = GATE(0x06c, BIT(20)), + [CLK_APB2_UART5] = GATE(0x06c, BIT(21)), + ++ [CLK_NAND0] = GATE(0x080, BIT(31)), ++ [CLK_NAND1] = GATE(0x084, BIT(31)), + [CLK_SPI0] = GATE(0x0a0, BIT(31)), + [CLK_SPI1] = GATE(0x0a4, BIT(31)), + [CLK_SPI2] = GATE(0x0a8, BIT(31)), +@@ -65,6 +69,8 @@ static struct ccu_reset a31_resets[] = { + [RST_AHB1_MMC1] = RESET(0x2c0, BIT(9)), + [RST_AHB1_MMC2] = RESET(0x2c0, BIT(10)), + [RST_AHB1_MMC3] = RESET(0x2c0, BIT(11)), ++ [RST_AHB1_NAND1] = RESET(0x2c0, BIT(12)), ++ [RST_AHB1_NAND0] = RESET(0x2c0, BIT(13)), + [RST_AHB1_EMAC] = RESET(0x2c0, BIT(17)), + [RST_AHB1_SPI0] = RESET(0x2c0, BIT(20)), + [RST_AHB1_SPI1] = RESET(0x2c0, BIT(21)), +--- a/drivers/clk/sunxi/clk_a64.c ++++ b/drivers/clk/sunxi/clk_a64.c +@@ -19,6 +19,7 @@ static const struct ccu_clk_gate a64_gat + [CLK_BUS_MMC0] = GATE(0x060, BIT(8)), + [CLK_BUS_MMC1] = GATE(0x060, BIT(9)), + [CLK_BUS_MMC2] = GATE(0x060, BIT(10)), ++ [CLK_BUS_NAND] = GATE(0x060, BIT(13)), + [CLK_BUS_EMAC] = GATE(0x060, BIT(17)), + [CLK_BUS_SPI0] = GATE(0x060, BIT(20)), + [CLK_BUS_SPI1] = GATE(0x060, BIT(21)), +@@ -39,6 +40,7 @@ static const struct ccu_clk_gate a64_gat + [CLK_BUS_UART3] = GATE(0x06c, BIT(19)), + [CLK_BUS_UART4] = GATE(0x06c, BIT(20)), + ++ [CLK_NAND] = GATE(0x080, BIT(31)), + [CLK_SPI0] = GATE(0x0a0, BIT(31)), + [CLK_SPI1] = GATE(0x0a4, BIT(31)), + +@@ -58,6 +60,7 @@ static const struct ccu_reset a64_resets + [RST_BUS_MMC0] = RESET(0x2c0, BIT(8)), + [RST_BUS_MMC1] = RESET(0x2c0, BIT(9)), + [RST_BUS_MMC2] = RESET(0x2c0, BIT(10)), ++ [RST_BUS_NAND] = RESET(0x2c0, BIT(13)), + [RST_BUS_EMAC] = RESET(0x2c0, BIT(17)), + [RST_BUS_SPI0] = RESET(0x2c0, BIT(20)), + [RST_BUS_SPI1] = RESET(0x2c0, BIT(21)), +--- a/drivers/clk/sunxi/clk_a80.c ++++ b/drivers/clk/sunxi/clk_a80.c +@@ -14,12 +14,18 @@ + #include + + static const struct ccu_clk_gate a80_gates[] = { ++ [CLK_NAND0_0] = GATE(0x400, BIT(31)), ++ [CLK_NAND0_1] = GATE(0x404, BIT(31)), ++ [CLK_NAND1_0] = GATE(0x408, BIT(31)), ++ [CLK_NAND1_1] = GATE(0x40c, BIT(31)), + [CLK_SPI0] = GATE(0x430, BIT(31)), + [CLK_SPI1] = GATE(0x434, BIT(31)), + [CLK_SPI2] = GATE(0x438, BIT(31)), + [CLK_SPI3] = GATE(0x43c, BIT(31)), + + [CLK_BUS_MMC] = GATE(0x580, BIT(8)), ++ [CLK_BUS_NAND0] = GATE(0x580, BIT(12)), ++ [CLK_BUS_NAND1] = GATE(0x580, BIT(13)), + [CLK_BUS_SPI0] = GATE(0x580, BIT(20)), + [CLK_BUS_SPI1] = GATE(0x580, BIT(21)), + [CLK_BUS_SPI2] = GATE(0x580, BIT(22)), +@@ -42,6 +48,8 @@ static const struct ccu_clk_gate a80_gat + + static const struct ccu_reset a80_resets[] = { + [RST_BUS_MMC] = RESET(0x5a0, BIT(8)), ++ [RST_BUS_NAND0] = RESET(0x5a0, BIT(12)), ++ [RST_BUS_NAND1] = RESET(0x5a0, BIT(13)), + [RST_BUS_SPI0] = RESET(0x5a0, BIT(20)), + [RST_BUS_SPI1] = RESET(0x5a0, BIT(21)), + [RST_BUS_SPI2] = RESET(0x5a0, BIT(22)), +--- a/drivers/clk/sunxi/clk_a83t.c ++++ b/drivers/clk/sunxi/clk_a83t.c +@@ -17,6 +17,7 @@ static struct ccu_clk_gate a83t_gates[] + [CLK_BUS_MMC0] = GATE(0x060, BIT(8)), + [CLK_BUS_MMC1] = GATE(0x060, BIT(9)), + [CLK_BUS_MMC2] = GATE(0x060, BIT(10)), ++ [CLK_BUS_NAND] = GATE(0x060, BIT(13)), + [CLK_BUS_EMAC] = GATE(0x060, BIT(17)), + [CLK_BUS_SPI0] = GATE(0x060, BIT(20)), + [CLK_BUS_SPI1] = GATE(0x060, BIT(21)), +@@ -36,6 +37,7 @@ static struct ccu_clk_gate a83t_gates[] + [CLK_BUS_UART3] = GATE(0x06c, BIT(19)), + [CLK_BUS_UART4] = GATE(0x06c, BIT(20)), + ++ [CLK_NAND] = GATE(0x080, BIT(31)), + [CLK_SPI0] = GATE(0x0a0, BIT(31)), + [CLK_SPI1] = GATE(0x0a4, BIT(31)), + +@@ -54,6 +56,7 @@ static struct ccu_reset a83t_resets[] = + [RST_BUS_MMC0] = RESET(0x2c0, BIT(8)), + [RST_BUS_MMC1] = RESET(0x2c0, BIT(9)), + [RST_BUS_MMC2] = RESET(0x2c0, BIT(10)), ++ [RST_BUS_NAND] = RESET(0x2c0, BIT(13)), + [RST_BUS_EMAC] = RESET(0x2c0, BIT(17)), + [RST_BUS_SPI0] = RESET(0x2c0, BIT(20)), + [RST_BUS_SPI1] = RESET(0x2c0, BIT(21)), +--- a/drivers/clk/sunxi/clk_h3.c ++++ b/drivers/clk/sunxi/clk_h3.c +@@ -19,6 +19,7 @@ static struct ccu_clk_gate h3_gates[] = + [CLK_BUS_MMC0] = GATE(0x060, BIT(8)), + [CLK_BUS_MMC1] = GATE(0x060, BIT(9)), + [CLK_BUS_MMC2] = GATE(0x060, BIT(10)), ++ [CLK_BUS_NAND] = GATE(0x060, BIT(13)), + [CLK_BUS_EMAC] = GATE(0x060, BIT(17)), + [CLK_BUS_SPI0] = GATE(0x060, BIT(20)), + [CLK_BUS_SPI1] = GATE(0x060, BIT(21)), +@@ -44,6 +45,7 @@ static struct ccu_clk_gate h3_gates[] = + + [CLK_BUS_EPHY] = GATE(0x070, BIT(0)), + ++ [CLK_NAND] = GATE(0x080, BIT(31)), + [CLK_SPI0] = GATE(0x0a0, BIT(31)), + [CLK_SPI1] = GATE(0x0a4, BIT(31)), + +@@ -66,6 +68,7 @@ static struct ccu_reset h3_resets[] = { + [RST_BUS_MMC0] = RESET(0x2c0, BIT(8)), + [RST_BUS_MMC1] = RESET(0x2c0, BIT(9)), + [RST_BUS_MMC2] = RESET(0x2c0, BIT(10)), ++ [RST_BUS_NAND] = RESET(0x2c0, BIT(13)), + [RST_BUS_EMAC] = RESET(0x2c0, BIT(17)), + [RST_BUS_SPI0] = RESET(0x2c0, BIT(20)), + [RST_BUS_SPI1] = RESET(0x2c0, BIT(21)), +--- a/drivers/clk/sunxi/clk_h6.c ++++ b/drivers/clk/sunxi/clk_h6.c +@@ -18,6 +18,10 @@ static struct ccu_clk_gate h6_gates[] = + + [CLK_APB1] = GATE_DUMMY, + ++ [CLK_NAND0] = GATE(0x810, BIT(31)), ++ [CLK_NAND1] = GATE(0x814, BIT(31)), ++ [CLK_BUS_NAND] = GATE(0x82c, BIT(0)), ++ + [CLK_BUS_MMC0] = GATE(0x84c, BIT(0)), + [CLK_BUS_MMC1] = GATE(0x84c, BIT(1)), + [CLK_BUS_MMC2] = GATE(0x84c, BIT(2)), +@@ -58,6 +62,8 @@ static struct ccu_clk_gate h6_gates[] = + }; + + static struct ccu_reset h6_resets[] = { ++ [RST_BUS_NAND] = RESET(0x82c, BIT(16)), ++ + [RST_BUS_MMC0] = RESET(0x84c, BIT(16)), + [RST_BUS_MMC1] = RESET(0x84c, BIT(17)), + [RST_BUS_MMC2] = RESET(0x84c, BIT(18)), +--- a/drivers/clk/sunxi/clk_h616.c ++++ b/drivers/clk/sunxi/clk_h616.c +@@ -17,6 +17,10 @@ static struct ccu_clk_gate h616_gates[] + + [CLK_APB1] = GATE_DUMMY, + ++ [CLK_NAND0] = GATE(0x810, BIT(31)), ++ [CLK_NAND1] = GATE(0x814, BIT(31)), ++ [CLK_BUS_NAND] = GATE(0x82c, BIT(0)), ++ + [CLK_BUS_MMC0] = GATE(0x84c, BIT(0)), + [CLK_BUS_MMC1] = GATE(0x84c, BIT(1)), + [CLK_BUS_MMC2] = GATE(0x84c, BIT(2)), +@@ -67,6 +71,8 @@ static struct ccu_clk_gate h616_gates[] + }; + + static struct ccu_reset h616_resets[] = { ++ [RST_BUS_NAND] = RESET(0x82c, BIT(16)), ++ + [RST_BUS_MMC0] = RESET(0x84c, BIT(16)), + [RST_BUS_MMC1] = RESET(0x84c, BIT(17)), + [RST_BUS_MMC2] = RESET(0x84c, BIT(18)), +--- a/drivers/clk/sunxi/clk_r40.c ++++ b/drivers/clk/sunxi/clk_r40.c +@@ -18,6 +18,7 @@ static struct ccu_clk_gate r40_gates[] = + [CLK_BUS_MMC1] = GATE(0x060, BIT(9)), + [CLK_BUS_MMC2] = GATE(0x060, BIT(10)), + [CLK_BUS_MMC3] = GATE(0x060, BIT(11)), ++ [CLK_BUS_NAND] = GATE(0x060, BIT(13)), + [CLK_BUS_SPI0] = GATE(0x060, BIT(20)), + [CLK_BUS_SPI1] = GATE(0x060, BIT(21)), + [CLK_BUS_SPI2] = GATE(0x060, BIT(22)), +@@ -48,6 +49,7 @@ static struct ccu_clk_gate r40_gates[] = + [CLK_BUS_UART6] = GATE(0x06c, BIT(22)), + [CLK_BUS_UART7] = GATE(0x06c, BIT(23)), + ++ [CLK_NAND] = GATE(0x080, BIT(31)), + [CLK_SPI0] = GATE(0x0a0, BIT(31)), + [CLK_SPI1] = GATE(0x0a4, BIT(31)), + [CLK_SPI2] = GATE(0x0a8, BIT(31)), +@@ -70,6 +72,7 @@ static struct ccu_reset r40_resets[] = { + [RST_BUS_MMC1] = RESET(0x2c0, BIT(9)), + [RST_BUS_MMC2] = RESET(0x2c0, BIT(10)), + [RST_BUS_MMC3] = RESET(0x2c0, BIT(11)), ++ [RST_BUS_NAND] = RESET(0x2c0, BIT(13)), + [RST_BUS_SPI0] = RESET(0x2c0, BIT(20)), + [RST_BUS_SPI1] = RESET(0x2c0, BIT(21)), + [RST_BUS_SPI2] = RESET(0x2c0, BIT(22)), diff --git a/package/boot/uboot-d1/patches/0028-pinctrl-sunxi-Add-NAND-pinmuxes.patch b/package/boot/uboot-d1/patches/0028-pinctrl-sunxi-Add-NAND-pinmuxes.patch new file mode 100644 index 00000000000000..6ecba35890db80 --- /dev/null +++ b/package/boot/uboot-d1/patches/0028-pinctrl-sunxi-Add-NAND-pinmuxes.patch @@ -0,0 +1,120 @@ +From 7be2405244565973cff0a40196bbed08df90f6a3 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Mon, 16 May 2022 00:31:36 -0500 +Subject: [PATCH 28/90] pinctrl: sunxi: Add NAND pinmuxes + +NAND is always at function 2 on port C. + +Pin lists and mux values were taken from the Linux drivers. + +Signed-off-by: Samuel Holland +--- + drivers/pinctrl/sunxi/pinctrl-sunxi.c | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +--- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c ++++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c +@@ -269,6 +269,7 @@ static const struct sunxi_pinctrl_functi + #endif + { "mmc2", 3 }, /* PC6-PC15 */ + { "mmc3", 2 }, /* PI4-PI9 */ ++ { "nand0", 2 }, /* PC0-PC24 */ + { "spi0", 3 }, /* PC0-PC2, PC23 */ + #if IS_ENABLED(CONFIG_UART0_PORT_F) + { "uart0", 4 }, /* PF2-PF4 */ +@@ -293,6 +294,7 @@ static const struct sunxi_pinctrl_functi + { "mmc0", 2 }, /* PF0-PF5 */ + { "mmc1", 2 }, /* PG3-PG8 */ + { "mmc2", 3 }, /* PC6-PC15 */ ++ { "nand0", 2 }, /* PC0-PC19 */ + { "spi0", 3 }, /* PC0-PC3 */ + #if IS_ENABLED(CONFIG_UART0_PORT_F) + { "uart0", 4 }, /* PF2-PF4 */ +@@ -319,6 +321,7 @@ static const struct sunxi_pinctrl_functi + { "mmc1", 2 }, /* PG0-PG5 */ + { "mmc2", 3 }, /* PC6-PC15, PC24 */ + { "mmc3", 4 }, /* PC6-PC15, PC24 */ ++ { "nand0", 2 }, /* PC0-PC26 */ + { "spi0", 3 }, /* PC0-PC2, PC27 */ + #if IS_ENABLED(CONFIG_UART0_PORT_F) + { "uart0", 3 }, /* PF2-PF4 */ +@@ -363,6 +366,7 @@ static const struct sunxi_pinctrl_functi + { "mmc1", 4 }, /* PG0-PG5 */ + #endif + { "mmc2", 3 }, /* PC5-PC15, PC24 */ ++ { "nand0", 2 }, /* PC0-PC24 */ + { "spi0", 3 }, /* PC0-PC2, PC23 */ + #if IS_ENABLED(CONFIG_UART0_PORT_F) + { "uart0", 4 }, /* PF2-PF4 */ +@@ -386,6 +390,7 @@ static const struct sunxi_pinctrl_functi + { "mmc0", 2 }, /* PF0-PF5 */ + { "mmc1", 2 }, /* PG0-PG5 */ + { "mmc2", 3 }, /* PC5-PC16 */ ++ { "nand0", 2 }, /* PC0-PC16 */ + { "spi0", 3 }, /* PC0-PC3 */ + #if IS_ENABLED(CONFIG_UART0_PORT_F) + { "uart0", 3 }, /* PF2-PF4 */ +@@ -424,6 +429,7 @@ static const struct sunxi_pinctrl_functi + { "mmc0", 2 }, /* PF0-PF5 */ + { "mmc1", 2 }, /* PG0-PG5 */ + { "mmc2", 3 }, /* PC5-PC16 */ ++ { "nand0", 2 }, /* PC0-PC16 */ + { "spi0", 3 }, /* PC0-PC3 */ + #if IS_ENABLED(CONFIG_UART0_PORT_F) + { "uart0", 3 }, /* PF2-PF4 */ +@@ -450,6 +456,7 @@ static const struct sunxi_pinctrl_functi + { "mmc0", 2 }, /* PF0-PF5 */ + { "mmc1", 2 }, /* PG0-PG5 */ + { "mmc2", 3 }, /* PC5-PC16 */ ++ { "nand0", 2 }, /* PC0-PC18 */ + { "spi0", 3 }, /* PC0-PC3 */ + #if IS_ENABLED(CONFIG_UART0_PORT_F) + { "uart0", 3 }, /* PF2-PF4 */ +@@ -491,6 +498,7 @@ static const struct sunxi_pinctrl_functi + { "mmc0", 2 }, /* PF0-PF5 */ + { "mmc1", 2 }, /* PG0-PG5 */ + { "mmc2", 3 }, /* PC5-PC16 */ ++ { "nand0", 2 }, /* PC0-PC16 */ + { "spi0", 3 }, /* PC0-PC3 */ + #if IS_ENABLED(CONFIG_UART0_PORT_F) + { "uart0", 3 }, /* PF2-PF4 */ +@@ -557,6 +565,7 @@ static const struct sunxi_pinctrl_functi + { "mmc0", 2 }, /* PF0-PF5 */ + { "mmc1", 2 }, /* PG0-PG5 */ + { "mmc2", 3 }, /* PC6-PC16 */ ++ { "nand0", 2 }, /* PC0-PC18 */ + { "spi0", 3 }, /* PC0-PC2, PC19 */ + #if IS_ENABLED(CONFIG_UART0_PORT_F) + { "uart0", 4 }, /* PF2-PF4 */ +@@ -622,6 +631,7 @@ static const struct sunxi_pinctrl_functi + { "mmc0", 2 }, /* PF0-PF5 */ + { "mmc1", 2 }, /* PG0-PG5 */ + { "mmc2", 3 }, /* PC1-PC16 */ ++ { "nand0", 2 }, /* PC0-PC16 */ + { "pwm", 2 }, /* PD22 */ + { "spi0", 4 }, /* PC0-PC3 */ + #if IS_ENABLED(CONFIG_UART0_PORT_F) +@@ -664,6 +674,7 @@ static const struct sunxi_pinctrl_functi + { "mmc0", 2 }, /* PF0-PF5 */ + { "mmc1", 2 }, /* PG0-PG5 */ + { "mmc2", 3 }, /* PC1-PC16 */ ++ { "nand0", 2 }, /* PC0-PC16 */ + { "spi0", 3 }, /* PC0-PC3 */ + #if IS_ENABLED(CONFIG_UART0_PORT_F) + { "uart0", 3 }, /* PF2-PF4 */ +@@ -690,6 +701,7 @@ static const struct sunxi_pinctrl_functi + { "mmc0", 2 }, /* PF0-PF5 */ + { "mmc1", 2 }, /* PG0-PG5 */ + { "mmc2", 3 }, /* PC1-PC14 */ ++ { "nand0", 2 }, /* PC0-PC16 */ + { "spi0", 4 }, /* PC0-PC7 */ + #if IS_ENABLED(CONFIG_UART0_PORT_F) + { "uart0", 3 }, /* PF2-PF4 */ +@@ -728,6 +740,7 @@ static const struct sunxi_pinctrl_functi + { "mmc0", 2 }, /* PF0-PF5 */ + { "mmc1", 2 }, /* PG0-PG5 */ + { "mmc2", 3 }, /* PC0-PC16 */ ++ { "nand0", 2 }, /* PC0-PC16 */ + { "spi0", 4 }, /* PC0-PC7, PC15-PC16 */ + #if IS_ENABLED(CONFIG_UART0_PORT_F) + { "uart0", 3 }, /* PF2-PF4 */ diff --git a/package/boot/uboot-d1/patches/0029-mtd-nand-sunxi-Remove-an-unnecessary-check.patch b/package/boot/uboot-d1/patches/0029-mtd-nand-sunxi-Remove-an-unnecessary-check.patch new file mode 100644 index 00000000000000..807c31d922fad1 --- /dev/null +++ b/package/boot/uboot-d1/patches/0029-mtd-nand-sunxi-Remove-an-unnecessary-check.patch @@ -0,0 +1,32 @@ +From 8e793af8598a8429c9dc0f096c72a92adb360a57 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sun, 15 May 2022 21:51:47 -0500 +Subject: [PATCH 29/90] mtd: nand: sunxi: Remove an unnecessary check + +Each chip is required to have a unique CS number ("reg" property) in the +range 0-7, so there is no need to separately count the number of chips. + +Signed-off-by: Samuel Holland +--- + drivers/mtd/nand/raw/sunxi_nand.c | 10 ---------- + 1 file changed, 10 deletions(-) + +--- a/drivers/mtd/nand/raw/sunxi_nand.c ++++ b/drivers/mtd/nand/raw/sunxi_nand.c +@@ -1767,16 +1767,6 @@ static int sunxi_nand_chips_init(int nod + int ret, i = 0; + + for (nand_node = fdt_first_subnode(blob, node); nand_node >= 0; +- nand_node = fdt_next_subnode(blob, nand_node)) +- i++; +- +- if (i > 8) { +- dev_err(nfc->dev, "too many NAND chips: %d (max = 8)\n", i); +- return -EINVAL; +- } +- +- i = 0; +- for (nand_node = fdt_first_subnode(blob, node); nand_node >= 0; + nand_node = fdt_next_subnode(blob, nand_node)) { + ret = sunxi_nand_chip_init(nand_node, nfc, i++); + if (ret) diff --git a/package/boot/uboot-d1/patches/0030-mtd-nand-sunxi-Convert-from-fdtdec-to-ofnode.patch b/package/boot/uboot-d1/patches/0030-mtd-nand-sunxi-Convert-from-fdtdec-to-ofnode.patch new file mode 100644 index 00000000000000..c88fef4f966d9a --- /dev/null +++ b/package/boot/uboot-d1/patches/0030-mtd-nand-sunxi-Convert-from-fdtdec-to-ofnode.patch @@ -0,0 +1,203 @@ +From 61b63cbb3526e19a0e299f95a3435a237c7c4b4b Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sun, 15 May 2022 21:54:25 -0500 +Subject: [PATCH 30/90] mtd: nand: sunxi: Convert from fdtdec to ofnode + +As a first step toward converting this driver to the driver model, use +the ofnode abstraction to replace direct references to the FDT blob. + +Using ofnode_read_u32_index removes an extra pair of loops and makes the +allwinner,rb property optional, matching the devicetree binding. + +Signed-off-by: Samuel Holland +--- + drivers/mtd/nand/raw/sunxi_nand.c | 73 +++++++++++-------------------- + include/fdtdec.h | 1 - + lib/fdtdec.c | 1 - + 3 files changed, 26 insertions(+), 49 deletions(-) + +--- a/drivers/mtd/nand/raw/sunxi_nand.c ++++ b/drivers/mtd/nand/raw/sunxi_nand.c +@@ -25,11 +25,10 @@ + */ + + #include +-#include ++#include + #include + #include + #include +-#include + #include + #include + #include +@@ -45,8 +44,6 @@ + #include + #include + +-DECLARE_GLOBAL_DATA_PTR; +- + #define NFC_REG_CTL 0x0000 + #define NFC_REG_ST 0x0004 + #define NFC_REG_INT 0x0008 +@@ -1605,19 +1602,18 @@ static int sunxi_nand_ecc_init(struct mt + return 0; + } + +-static int sunxi_nand_chip_init(int node, struct sunxi_nfc *nfc, int devnum) ++static int sunxi_nand_chip_init(ofnode np, struct sunxi_nfc *nfc, int devnum) + { + const struct nand_sdr_timings *timings; +- const void *blob = gd->fdt_blob; + struct sunxi_nand_chip *chip; + struct mtd_info *mtd; + struct nand_chip *nand; + int nsels; + int ret; + int i; +- u32 cs[8], rb[8]; ++ u32 tmp; + +- if (!fdt_getprop(blob, node, "reg", &nsels)) ++ if (!ofnode_get_property(np, "reg", &nsels)) + return -EINVAL; + + nsels /= sizeof(u32); +@@ -1638,25 +1634,12 @@ static int sunxi_nand_chip_init(int node + chip->selected = -1; + + for (i = 0; i < nsels; i++) { +- cs[i] = -1; +- rb[i] = -1; +- } +- +- ret = fdtdec_get_int_array(gd->fdt_blob, node, "reg", cs, nsels); +- if (ret) { +- dev_err(nfc->dev, "could not retrieve reg property: %d\n", ret); +- return ret; +- } +- +- ret = fdtdec_get_int_array(gd->fdt_blob, node, "allwinner,rb", rb, +- nsels); +- if (ret) { +- dev_err(nfc->dev, "could not retrieve reg property: %d\n", ret); +- return ret; +- } +- +- for (i = 0; i < nsels; i++) { +- int tmp = cs[i]; ++ ret = ofnode_read_u32_index(np, "reg", i, &tmp); ++ if (ret) { ++ dev_err(nfc->dev, "could not retrieve reg property: %d\n", ++ ret); ++ return ret; ++ } + + if (tmp > NFC_MAX_CS) { + dev_err(nfc->dev, +@@ -1671,15 +1654,14 @@ static int sunxi_nand_chip_init(int node + + chip->sels[i].cs = tmp; + +- tmp = rb[i]; +- if (tmp >= 0 && tmp < 2) { ++ if (!ofnode_read_u32_index(np, "allwinner,rb", i, &tmp) && ++ tmp < 2) { + chip->sels[i].rb.type = RB_NATIVE; + chip->sels[i].rb.info.nativeid = tmp; + } else { +- ret = gpio_request_by_name_nodev(offset_to_ofnode(node), +- "rb-gpios", i, +- &chip->sels[i].rb.info.gpio, +- GPIOD_IS_IN); ++ ret = gpio_request_by_name_nodev(np, "rb-gpios", i, ++ &chip->sels[i].rb.info.gpio, ++ GPIOD_IS_IN); + if (ret) + chip->sels[i].rb.type = RB_GPIO; + else +@@ -1711,7 +1693,7 @@ static int sunxi_nand_chip_init(int node + * in the DT. + */ + nand->ecc.mode = NAND_ECC_HW; +- nand->flash_node = offset_to_ofnode(node); ++ nand->flash_node = np; + nand->select_chip = sunxi_nfc_select_chip; + nand->cmd_ctrl = sunxi_nfc_cmd_ctrl; + nand->read_buf = sunxi_nfc_read_buf; +@@ -1760,15 +1742,13 @@ static int sunxi_nand_chip_init(int node + return 0; + } + +-static int sunxi_nand_chips_init(int node, struct sunxi_nfc *nfc) ++static int sunxi_nand_chips_init(ofnode node, struct sunxi_nfc *nfc) + { +- const void *blob = gd->fdt_blob; +- int nand_node; ++ ofnode nand_np; + int ret, i = 0; + +- for (nand_node = fdt_first_subnode(blob, node); nand_node >= 0; +- nand_node = fdt_next_subnode(blob, nand_node)) { +- ret = sunxi_nand_chip_init(nand_node, nfc, i++); ++ ofnode_for_each_subnode(nand_np, node) { ++ ret = sunxi_nand_chip_init(nand_np, nfc, i++); + if (ret) + return ret; + } +@@ -1794,10 +1774,9 @@ static void sunxi_nand_chips_cleanup(str + + void sunxi_nand_init(void) + { +- const void *blob = gd->fdt_blob; + struct sunxi_nfc *nfc; +- fdt_addr_t regs; +- int node; ++ phys_addr_t regs; ++ ofnode node; + int ret; + + nfc = kzalloc(sizeof(*nfc), GFP_KERNEL); +@@ -1808,18 +1787,18 @@ void sunxi_nand_init(void) + init_waitqueue_head(&nfc->controller.wq); + INIT_LIST_HEAD(&nfc->chips); + +- node = fdtdec_next_compatible(blob, 0, COMPAT_SUNXI_NAND); +- if (node < 0) { ++ node = ofnode_by_compatible(ofnode_null(), "allwinner,sun4i-a10-nand"); ++ if (!ofnode_valid(node)) { + pr_err("unable to find nfc node in device tree\n"); + goto err; + } + +- if (!fdtdec_get_is_enabled(blob, node)) { ++ if (!ofnode_is_enabled(node)) { + pr_err("nfc disabled in device tree\n"); + goto err; + } + +- regs = fdtdec_get_addr(blob, node, "reg"); ++ regs = ofnode_get_addr(node); + if (regs == FDT_ADDR_T_NONE) { + pr_err("unable to find nfc address in device tree\n"); + goto err; +--- a/include/fdtdec.h ++++ b/include/fdtdec.h +@@ -187,7 +187,6 @@ enum fdt_compat_id { + COMPAT_INTEL_BAYTRAIL_FSP, /* Intel Bay Trail FSP */ + COMPAT_INTEL_BAYTRAIL_FSP_MDP, /* Intel FSP memory-down params */ + COMPAT_INTEL_IVYBRIDGE_FSP, /* Intel Ivy Bridge FSP */ +- COMPAT_SUNXI_NAND, /* SUNXI NAND controller */ + COMPAT_ALTERA_SOCFPGA_CLK, /* SoCFPGA Clock initialization */ + COMPAT_ALTERA_SOCFPGA_PINCTRL_SINGLE, /* SoCFPGA pinctrl-single */ + COMPAT_ALTERA_SOCFPGA_H2F_BRG, /* SoCFPGA hps2fpga bridge */ +--- a/lib/fdtdec.c ++++ b/lib/fdtdec.c +@@ -64,7 +64,6 @@ static const char * const compat_names[C + COMPAT(INTEL_BAYTRAIL_FSP, "intel,baytrail-fsp"), + COMPAT(INTEL_BAYTRAIL_FSP_MDP, "intel,baytrail-fsp-mdp"), + COMPAT(INTEL_IVYBRIDGE_FSP, "intel,ivybridge-fsp"), +- COMPAT(COMPAT_SUNXI_NAND, "allwinner,sun4i-a10-nand"), + COMPAT(ALTERA_SOCFPGA_CLK, "altr,clk-mgr"), + COMPAT(ALTERA_SOCFPGA_PINCTRL_SINGLE, "pinctrl-single"), + COMPAT(ALTERA_SOCFPGA_H2F_BRG, "altr,socfpga-hps2fpga-bridge"), diff --git a/package/boot/uboot-d1/patches/0031-mtd-nand-sunxi-Convert-to-the-driver-model.patch b/package/boot/uboot-d1/patches/0031-mtd-nand-sunxi-Convert-to-the-driver-model.patch new file mode 100644 index 00000000000000..d1bec458af6540 --- /dev/null +++ b/package/boot/uboot-d1/patches/0031-mtd-nand-sunxi-Convert-to-the-driver-model.patch @@ -0,0 +1,172 @@ +From 3411a9a1be9a8d8fef236a81edbce2a1a8218a32 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Mon, 16 May 2022 00:16:48 -0500 +Subject: [PATCH 31/90] mtd: nand: sunxi: Convert to the driver model + +Clocks, resets, and pinmuxes are now handled by the driver model, so the +only thing the "board" code needs to do is load the driver. This matches +the pattern used by other DM raw NAND drivers (there is no NAND uclass). + +The actual board code is now only needed in SPL. + +Signed-off-by: Samuel Holland +--- + board/sunxi/board.c | 5 +- + drivers/mtd/nand/raw/sunxi_nand.c | 81 ++++++++++++++++++------------- + 2 files changed, 49 insertions(+), 37 deletions(-) + +--- a/board/sunxi/board.c ++++ b/board/sunxi/board.c +@@ -311,7 +311,7 @@ int dram_init(void) + return 0; + } + +-#if defined(CONFIG_NAND_SUNXI) ++#if defined(CONFIG_NAND_SUNXI) && defined(CONFIG_SPL_BUILD) + static void nand_pinmux_setup(void) + { + unsigned int pin; +@@ -347,9 +347,6 @@ void board_nand_init(void) + { + nand_pinmux_setup(); + nand_clock_setup(); +-#ifndef CONFIG_SPL_BUILD +- sunxi_nand_init(); +-#endif + } + #endif /* CONFIG_NAND_SUNXI */ + +--- a/drivers/mtd/nand/raw/sunxi_nand.c ++++ b/drivers/mtd/nand/raw/sunxi_nand.c +@@ -24,11 +24,13 @@ + * GNU General Public License for more details. + */ + ++#include + #include + #include + #include + #include + #include ++#include + #include + #include + #include +@@ -260,7 +262,7 @@ static inline struct sunxi_nand_chip *to + * NAND Controller structure: stores sunxi NAND controller information + * + * @controller: base controller structure +- * @dev: parent device (used to print error messages) ++ * @dev: DM device (used to print error messages) + * @regs: NAND controller registers + * @ahb_clk: NAND Controller AHB clock + * @mod_clk: NAND Controller mod clock +@@ -273,7 +275,7 @@ static inline struct sunxi_nand_chip *to + */ + struct sunxi_nfc { + struct nand_hw_control controller; +- struct device *dev; ++ struct udevice *dev; + void __iomem *regs; + struct clk *ahb_clk; + struct clk *mod_clk; +@@ -1772,54 +1774,67 @@ static void sunxi_nand_chips_cleanup(str + } + #endif /* __UBOOT__ */ + +-void sunxi_nand_init(void) ++static int sunxi_nand_probe(struct udevice *dev) + { +- struct sunxi_nfc *nfc; +- phys_addr_t regs; +- ofnode node; ++ struct sunxi_nfc *nfc = dev_get_priv(dev); ++ struct reset_ctl_bulk rst_bulk; ++ struct clk_bulk clk_bulk; + int ret; + +- nfc = kzalloc(sizeof(*nfc), GFP_KERNEL); +- if (!nfc) +- return; +- ++ nfc->dev = dev; + spin_lock_init(&nfc->controller.lock); + init_waitqueue_head(&nfc->controller.wq); + INIT_LIST_HEAD(&nfc->chips); + +- node = ofnode_by_compatible(ofnode_null(), "allwinner,sun4i-a10-nand"); +- if (!ofnode_valid(node)) { +- pr_err("unable to find nfc node in device tree\n"); +- goto err; +- } +- +- if (!ofnode_is_enabled(node)) { +- pr_err("nfc disabled in device tree\n"); +- goto err; +- } +- +- regs = ofnode_get_addr(node); +- if (regs == FDT_ADDR_T_NONE) { +- pr_err("unable to find nfc address in device tree\n"); +- goto err; +- } ++ nfc->regs = dev_read_addr_ptr(dev); ++ if (!nfc->regs) ++ return -EINVAL; + +- nfc->regs = (void *)regs; ++ ret = reset_get_bulk(dev, &rst_bulk); ++ if (!ret) ++ reset_deassert_bulk(&rst_bulk); ++ ++ ret = clk_get_bulk(dev, &clk_bulk); ++ if (!ret) ++ clk_enable_bulk(&clk_bulk); + + ret = sunxi_nfc_rst(nfc); + if (ret) +- goto err; ++ return ret; + +- ret = sunxi_nand_chips_init(node, nfc); ++ ret = sunxi_nand_chips_init(dev_ofnode(dev), nfc); + if (ret) { +- dev_err(nfc->dev, "failed to init nand chips\n"); +- goto err; ++ dev_err(dev, "failed to init nand chips\n"); ++ return ret; + } + +- return; ++ return 0; ++} + +-err: +- kfree(nfc); ++static const struct udevice_id sunxi_nand_ids[] = { ++ { ++ .compatible = "allwinner,sun4i-a10-nand", ++ }, ++ { } ++}; ++ ++U_BOOT_DRIVER(sunxi_nand) = { ++ .name = "sunxi_nand", ++ .id = UCLASS_MTD, ++ .of_match = sunxi_nand_ids, ++ .probe = sunxi_nand_probe, ++ .priv_auto = sizeof(struct sunxi_nfc), ++}; ++ ++void board_nand_init(void) ++{ ++ struct udevice *dev; ++ int ret; ++ ++ ret = uclass_get_device_by_driver(UCLASS_MTD, ++ DM_DRIVER_GET(sunxi_nand), &dev); ++ if (ret && ret != -ENODEV) ++ pr_err("Failed to initialize sunxi NAND controller: %d\n", ret); + } + + MODULE_LICENSE("GPL v2"); diff --git a/package/boot/uboot-d1/patches/0032-sunxi-DT-H6-Add-USB3-to-Pine-H64-DTS.patch b/package/boot/uboot-d1/patches/0032-sunxi-DT-H6-Add-USB3-to-Pine-H64-DTS.patch new file mode 100644 index 00000000000000..87c9da924ceb42 --- /dev/null +++ b/package/boot/uboot-d1/patches/0032-sunxi-DT-H6-Add-USB3-to-Pine-H64-DTS.patch @@ -0,0 +1,31 @@ +From 6fdd7e8d2758f69f5c8e3cb2a0f06da47c1f2cb4 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sat, 17 Apr 2021 14:21:45 -0500 +Subject: [PATCH 32/90] sunxi: DT: H6: Add USB3 to Pine H64 DTS + +Signed-off-by: Samuel Holland +--- + arch/arm/dts/sun50i-h6-pine-h64.dts | 8 ++++++++ + 1 file changed, 8 insertions(+) + +--- a/arch/arm/dts/sun50i-h6-pine-h64.dts ++++ b/arch/arm/dts/sun50i-h6-pine-h64.dts +@@ -89,6 +89,10 @@ + status = "okay"; + }; + ++&dwc3 { ++ status = "okay"; ++}; ++ + &ehci0 { + status = "okay"; + }; +@@ -332,3 +336,7 @@ + usb3_vbus-supply = <®_usb_vbus>; + status = "okay"; + }; ++ ++&usb3phy { ++ status = "okay"; ++}; diff --git a/package/boot/uboot-d1/patches/0033-tools-mkimage-Add-Allwinner-TOC1-support.patch b/package/boot/uboot-d1/patches/0033-tools-mkimage-Add-Allwinner-TOC1-support.patch new file mode 100644 index 00000000000000..d443cdf36987a9 --- /dev/null +++ b/package/boot/uboot-d1/patches/0033-tools-mkimage-Add-Allwinner-TOC1-support.patch @@ -0,0 +1,441 @@ +From ff0e952a3a380ba191375d5f68609cdbe026d535 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sat, 7 Aug 2021 19:55:20 -0500 +Subject: [PATCH 33/90] tools: mkimage: Add Allwinner TOC1 support + +TOC1 is an container format used by Allwinner's boot0 that can hold +multiple images. It supports encryption and signatures, but that +functionality is not implemented, only the basic "non-secure" subset. + +A config file is used to provide the list of data files to include. Its +path is passed as the argument to "-d". It contains sections of the +following form: + + [name] + file = /path/to/file + addr = 0x12345678 + +Specific well-known names, such as "dtb", "opensbi", and "u-boot", are +used by the bootloader to distinguish the items inside the image. + +Cover-letter: +tools: mkimage: Add Allwinner TOC1 support + +The SPL port for the Allwinner D1 RISC-V SoC will probably take a while +longer than porting U-Boot proper, as none of the relevant drivers are +set up for DM in SPL. In the meantime, we are using[1][2] a fork[3] of +Allwinner's boot0 loader, which they also call "spl" in their BSP. boot0 +uses this TOC1 image format. + +The vendor tools for generating TOC1 images require a binary config file +generated by their FEX compiler. Instead of trying to support that, I +made up a simple human-readable config file format. I didn't see any +existing platform-agnostic parser for multi-image containers in mkimage. + +I am sending this as RFC because it is only of temporary/limited use. +It only works with one specific fork of boot0 which was modified to +"behave" (the the original vendor version monkey-patches a custom header +inside the U-Boot image during boot). So it will be obsolete once U-Boot +SPL is ported. And it is Yet Another Image Format. On the other hand, it +does work, and it is currently being used. + +[1]: https://linux-sunxi.org/Allwinner_Nezha#U-Boot +[2]: https://fedoraproject.org/wiki/Architectures/RISC-V/Allwinner +[3]: https://github.com/smaeul/sun20i_d1_spl +END +Series-prefix: RFC +Series-to: sunxi +Signed-off-by: Samuel Holland +--- + boot/image.c | 1 + + include/image.h | 1 + + include/sunxi_image.h | 26 ++++ + tools/Makefile | 1 + + tools/sunxi_toc1.c | 318 ++++++++++++++++++++++++++++++++++++++++++ + 5 files changed, 347 insertions(+) + create mode 100644 tools/sunxi_toc1.c + +--- a/boot/image.c ++++ b/boot/image.c +@@ -180,6 +180,7 @@ static const table_entry_t uimage_type[] + { IH_TYPE_COPRO, "copro", "Coprocessor Image"}, + { IH_TYPE_SUNXI_EGON, "sunxi_egon", "Allwinner eGON Boot Image" }, + { IH_TYPE_SUNXI_TOC0, "sunxi_toc0", "Allwinner TOC0 Boot Image" }, ++ { IH_TYPE_SUNXI_TOC1, "sunxi_toc1", "Allwinner TOC1 Boot Image" }, + { -1, "", "", }, + }; + +--- a/include/image.h ++++ b/include/image.h +@@ -229,6 +229,7 @@ enum image_type_t { + IH_TYPE_COPRO, /* Coprocessor Image for remoteproc*/ + IH_TYPE_SUNXI_EGON, /* Allwinner eGON Boot Image */ + IH_TYPE_SUNXI_TOC0, /* Allwinner TOC0 Boot Image */ ++ IH_TYPE_SUNXI_TOC1, /* Allwinner TOC1 Boot Image */ + + IH_TYPE_COUNT, /* Number of image types */ + }; +--- a/include/sunxi_image.h ++++ b/include/sunxi_image.h +@@ -116,4 +116,30 @@ struct __packed toc0_item_info { + #define TOC0_ITEM_INFO_NAME_KEY 0x00010303 + #define TOC0_ITEM_INFO_END "IIE;" + ++struct __packed toc1_main_info { ++ uint8_t name[16]; ++ __le32 magic; ++ __le32 checksum; ++ __le32 serial; ++ __le32 status; ++ __le32 num_items; ++ __le32 length; ++ __le32 major_version; ++ __le32 minor_version; ++ __le32 reserved[3]; ++ uint8_t end[4]; ++}; ++ ++struct __packed toc1_item_info { ++ uint8_t name[64]; ++ __le32 offset; ++ __le32 length; ++ __le32 encryption; ++ __le32 type; ++ __le32 load_addr; ++ __le32 index; ++ __le32 reserved[69]; ++ uint8_t end[4]; ++}; ++ + #endif +--- a/tools/Makefile ++++ b/tools/Makefile +@@ -132,6 +132,7 @@ dumpimage-mkimage-objs := aisimage.o \ + $(ROCKCHIP_OBS) \ + socfpgaimage.o \ + sunxi_egon.o \ ++ sunxi_toc1.o \ + lib/crc16-ccitt.o \ + lib/hash-checksum.o \ + lib/sha1.o \ +--- /dev/null ++++ b/tools/sunxi_toc1.c +@@ -0,0 +1,318 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++/* ++ * (C) Copyright 2018 Arm Ltd. ++ * (C) Copyright 2020-2021 Samuel Holland ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++#include "imagetool.h" ++#include "mkimage.h" ++ ++#define SECTOR_SIZE 512 ++ ++struct item_desc { ++ const char *name; ++ const char *file; ++ unsigned long addr; ++ long length; ++}; ++ ++static uint32_t toc1_header_length(uint32_t num_items) ++{ ++ return ALIGN(sizeof(struct toc1_main_info) + ++ sizeof(struct toc1_item_info) * num_items, SECTOR_SIZE); ++} ++ ++static int toc1_parse_cfg(const char *file, struct item_desc **desc, ++ uint32_t *main_length, uint32_t *num_items) ++{ ++ struct item_desc *descs = NULL; ++ int ret = EXIT_FAILURE; ++ FILE *cfg, *fp = NULL; ++ uint32_t ndescs = 0; ++ char *line = NULL; ++ size_t len = 0; ++ ++ *desc = NULL; ++ *main_length = 0; ++ *num_items = 0; ++ ++ cfg = fopen(file, "r"); ++ if (!cfg) ++ return ret; ++ ++ while (getline(&line, &len, cfg) > 0) { ++ char *end, *s; ++ ++ if (line[0] == '[') { ++ s = line + 1; ++ end = strchr(s, ']'); ++ if (!end || end[1] != '\n') ++ goto err; ++ end[0] = '\0'; ++ ++ ndescs++; ++ descs = reallocarray(descs, ndescs, sizeof(*descs)); ++ if (!descs) ++ goto err; ++ ++ descs[ndescs - 1].name = strdup(s); ++ } else if (line[0] != '#' && line[0] != '\n') { ++ s = strchr(line, '='); ++ if (!s) ++ goto err; ++ while ((++s)[0] == ' ') ++ ; ++ end = strchr(s, '\n'); ++ if (!end) ++ goto err; ++ end[0] = '\0'; ++ ++ if (!strncmp(line, "file", strlen("file"))) { ++ fp = fopen(s, "rb"); ++ if (!fp) ++ goto err; ++ if (fseek(fp, 0, SEEK_END) < 0) ++ goto err; ++ descs[ndescs - 1].file = strdup(s); ++ descs[ndescs - 1].length = ftell(fp); ++ *main_length += ALIGN(descs[ndescs - 1].length, ++ SECTOR_SIZE); ++ fclose(fp); ++ fp = NULL; ++ } else if (!strncmp(line, "addr", strlen("addr"))) { ++ descs[ndescs - 1].addr = strtoul(s, NULL, 0); ++ } else { ++ goto err; ++ } ++ } ++ } ++ ++ *desc = descs; ++ *main_length += toc1_header_length(ndescs); ++ *num_items = ndescs; ++ ++ ret = EXIT_SUCCESS; ++ ++err: ++ if (fp) ++ fclose(fp); ++ if (ret) ++ free(descs); ++ free(line); ++ fclose(cfg); ++ ++ return ret; ++} ++ ++static int toc1_create(uint8_t *buf, uint32_t len, ++ const struct item_desc *desc, uint32_t num_items) ++{ ++ struct toc1_main_info *main = (void *)buf; ++ struct toc1_item_info *item = (void *)(main + 1); ++ uint32_t item_offset, item_length; ++ uint32_t *buf32 = (void *)buf; ++ int ret = EXIT_FAILURE; ++ uint32_t checksum = 0; ++ FILE *fp = NULL; ++ int i; ++ ++ /* Create the main TOC1 header. */ ++ main->magic = cpu_to_le32(TOC0_MAIN_INFO_MAGIC); ++ main->checksum = cpu_to_le32(BROM_STAMP_VALUE); ++ main->num_items = cpu_to_le32(num_items); ++ memcpy(main->end, TOC0_MAIN_INFO_END, sizeof(main->end)); ++ ++ item_offset = 0; ++ item_length = toc1_header_length(num_items); ++ ++ for (i = 0; i < num_items; ++i, ++item, ++desc) { ++ item_offset = item_offset + item_length; ++ item_length = desc->length; ++ ++ /* Create the item header. */ ++ memcpy(item->name, desc->name, ++ strnlen(desc->name, sizeof(item->name))); ++ item->offset = cpu_to_le32(item_offset); ++ item->length = cpu_to_le32(item_length); ++ item->load_addr = cpu_to_le32(desc->addr); ++ memcpy(item->end, TOC0_ITEM_INFO_END, sizeof(item->end)); ++ ++ /* Read in the data. */ ++ fp = fopen(desc->file, "rb"); ++ if (!fp) ++ goto err; ++ if (!fread(buf + item_offset, item_length, 1, fp)) ++ goto err; ++ fclose(fp); ++ fp = NULL; ++ ++ /* Pad the sectors with 0xff to be flash-friendly. */ ++ item_offset = item_offset + item_length; ++ item_length = ALIGN(item_offset, SECTOR_SIZE) - item_offset; ++ memset(buf + item_offset, 0xff, item_length); ++ } ++ ++ /* Fill in the total padded file length. */ ++ item_offset = item_offset + item_length; ++ main->length = cpu_to_le32(item_offset); ++ ++ /* Verify enough space was provided when creating the image. */ ++ assert(len >= item_offset); ++ ++ /* Calculate the checksum. Yes, it's that simple. */ ++ for (i = 0; i < item_offset / 4; ++i) ++ checksum += le32_to_cpu(buf32[i]); ++ main->checksum = cpu_to_le32(checksum); ++ ++ ret = EXIT_SUCCESS; ++ ++err: ++ if (fp) ++ fclose(fp); ++ ++ return ret; ++} ++ ++static int toc1_verify(const uint8_t *buf, uint32_t len) ++{ ++ const struct toc1_main_info *main = (void *)buf; ++ const struct toc1_item_info *item = (void *)(main + 1); ++ uint32_t checksum = BROM_STAMP_VALUE; ++ uint32_t main_length, num_items; ++ uint32_t *buf32 = (void *)buf; ++ int ret = EXIT_FAILURE; ++ int i; ++ ++ num_items = le32_to_cpu(main->num_items); ++ main_length = le32_to_cpu(main->length); ++ ++ if (len < main_length || main_length < toc1_header_length(num_items)) ++ goto err; ++ ++ /* Verify the main header. */ ++ if (le32_to_cpu(main->magic) != TOC0_MAIN_INFO_MAGIC) ++ goto err; ++ /* Verify the checksum without modifying the buffer. */ ++ for (i = 0; i < main_length / 4; ++i) ++ checksum += le32_to_cpu(buf32[i]); ++ if (checksum != 2 * le32_to_cpu(main->checksum)) ++ goto err; ++ /* The length must be at least 512 byte aligned. */ ++ if (main_length % SECTOR_SIZE) ++ goto err; ++ if (memcmp(main->end, TOC0_MAIN_INFO_END, sizeof(main->end))) ++ goto err; ++ ++ /* Verify each item header. */ ++ for (i = 0; i < num_items; ++i, ++item) ++ if (memcmp(item->end, TOC0_ITEM_INFO_END, sizeof(item->end))) ++ goto err; ++ ++ ret = EXIT_SUCCESS; ++ ++err: ++ return ret; ++} ++ ++static int toc1_check_params(struct image_tool_params *params) ++{ ++ if (!params->dflag) ++ return -EINVAL; ++ ++ return 0; ++} ++ ++static int toc1_verify_header(unsigned char *buf, int image_size, ++ struct image_tool_params *params) ++{ ++ return toc1_verify(buf, image_size); ++} ++ ++static void toc1_print_header(const void *buf) ++{ ++ const struct toc1_main_info *main = buf; ++ const struct toc1_item_info *item = (void *)(main + 1); ++ uint32_t head_length, main_length, num_items; ++ uint32_t item_offset, item_length, item_addr; ++ int i; ++ ++ num_items = le32_to_cpu(main->num_items); ++ head_length = sizeof(*main) + num_items * sizeof(*item); ++ main_length = le32_to_cpu(main->length); ++ ++ printf("Allwinner TOC1 Image\n" ++ "Size: %d bytes\n" ++ "Contents: %d items\n" ++ " 00000000:%08x Headers\n", ++ main_length, num_items, head_length); ++ ++ for (i = 0; i < num_items; ++i, ++item) { ++ item_offset = le32_to_cpu(item->offset); ++ item_length = le32_to_cpu(item->length); ++ item_addr = le32_to_cpu(item->load_addr); ++ ++ printf(" %08x:%08x => %08x %s\n", ++ item_offset, item_length, item_addr, item->name); ++ } ++} ++ ++static void toc1_set_header(void *buf, struct stat *sbuf, int ifd, ++ struct image_tool_params *params) ++{ ++ /* Image is already written below. */ ++} ++ ++static int toc1_check_image_type(uint8_t type) ++{ ++ return type == IH_TYPE_SUNXI_TOC1 ? 0 : 1; ++} ++ ++static int toc1_vrec_header(struct image_tool_params *params, ++ struct image_type_params *tparams) ++{ ++ uint32_t main_length, num_items; ++ struct item_desc *desc; ++ int ret; ++ ++ /* This "header" contains the entire image. */ ++ params->skipcpy = 1; ++ ++ ret = toc1_parse_cfg(params->datafile, &desc, &main_length, &num_items); ++ if (ret) ++ exit(ret); ++ ++ tparams->header_size = main_length; ++ tparams->hdr = calloc(tparams->header_size, 1); ++ if (!tparams->hdr) ++ exit(ret); ++ ++ ret = toc1_create(tparams->hdr, tparams->header_size, desc, num_items); ++ if (ret) ++ exit(ret); ++ ++ return 0; ++} ++ ++U_BOOT_IMAGE_TYPE( ++ sunxi_toc1, ++ "Allwinner TOC1 Boot Image support", ++ 0, ++ NULL, ++ toc1_check_params, ++ toc1_verify_header, ++ toc1_print_header, ++ toc1_set_header, ++ NULL, ++ toc1_check_image_type, ++ NULL, ++ toc1_vrec_header ++); diff --git a/package/boot/uboot-d1/patches/0034-phy-sun4i-usb-Do-not-drive-VBUS-with-external-VBUS-p.patch b/package/boot/uboot-d1/patches/0034-phy-sun4i-usb-Do-not-drive-VBUS-with-external-VBUS-p.patch new file mode 100644 index 00000000000000..5a2efb16dc196c --- /dev/null +++ b/package/boot/uboot-d1/patches/0034-phy-sun4i-usb-Do-not-drive-VBUS-with-external-VBUS-p.patch @@ -0,0 +1,33 @@ +From 79f7d883d980beea9989d06f9fba4fcc0430176a Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Thu, 14 Jul 2022 22:14:38 -0500 +Subject: [PATCH 34/90] phy: sun4i-usb: Do not drive VBUS with external VBUS + present + +It is possible to use host-side USB with externally-provided VBUS. For +example, some USB OTG cables have an extra power input which powers +both the board and the USB peripheral. + +To support this setup, skip enabling the VBUS switch/regulator if VBUS +voltage is already present. This behavior matches the Linux PHY driver. + +Signed-off-by: Samuel Holland +--- + drivers/phy/allwinner/phy-sun4i-usb.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/phy/allwinner/phy-sun4i-usb.c ++++ b/drivers/phy/allwinner/phy-sun4i-usb.c +@@ -220,6 +220,12 @@ static int sun4i_usb_phy_power_on(struct + initial_usb_scan_delay = 0; + } + ++ /* For phy0 only turn on Vbus if we don't have an ext. Vbus */ ++ if (phy->id == 0 && sun4i_usb_phy_vbus_detect(phy)) { ++ dev_warn(phy->dev, "External vbus detected, not enabling our own vbus\n"); ++ return 0; ++ } ++ + if (usb_phy->vbus) { + ret = regulator_set_enable(usb_phy->vbus, true); + if (ret && ret != -ENOSYS) diff --git a/package/boot/uboot-d1/patches/0035-mtd-nand-sunxi-Pass-the-device-to-the-init-function.patch b/package/boot/uboot-d1/patches/0035-mtd-nand-sunxi-Pass-the-device-to-the-init-function.patch new file mode 100644 index 00000000000000..4963fbfd71a775 --- /dev/null +++ b/package/boot/uboot-d1/patches/0035-mtd-nand-sunxi-Pass-the-device-to-the-init-function.patch @@ -0,0 +1,163 @@ +From 4bc5cec5361dd6a2ae3bd044c79a4b5227bb9627 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Mon, 16 May 2022 00:47:32 -0500 +Subject: [PATCH 35/90] mtd: nand: sunxi: Pass the device to the init function + +This more closely matches the U-Boot driver to the Linux version. + +Series-to: sunxi + +Cover-letter: +mtd: nand: sunxi: Convert to devicetree and the driver model +This series converts the sunxi NAND driver to get its resources (clocks, +resets, pins) from the devicetree, and probe using the driver model. + +In addition to the immediate cleanup, this allows backporting more +patches (bugfixes, newer SoC support) from the Linux driver. +END + +Signed-off-by: Samuel Holland +--- + drivers/mtd/nand/raw/sunxi_nand.c | 39 ++++++++++++++++--------------- + 1 file changed, 20 insertions(+), 19 deletions(-) + +--- a/drivers/mtd/nand/raw/sunxi_nand.c ++++ b/drivers/mtd/nand/raw/sunxi_nand.c +@@ -1604,7 +1604,8 @@ static int sunxi_nand_ecc_init(struct mt + return 0; + } + +-static int sunxi_nand_chip_init(ofnode np, struct sunxi_nfc *nfc, int devnum) ++static int sunxi_nand_chip_init(struct udevice *dev, struct sunxi_nfc *nfc, ++ ofnode np, int devnum) + { + const struct nand_sdr_timings *timings; + struct sunxi_nand_chip *chip; +@@ -1620,7 +1621,7 @@ static int sunxi_nand_chip_init(ofnode n + + nsels /= sizeof(u32); + if (!nsels || nsels > 8) { +- dev_err(nfc->dev, "invalid reg property size\n"); ++ dev_err(dev, "invalid reg property size\n"); + return -EINVAL; + } + +@@ -1628,7 +1629,7 @@ static int sunxi_nand_chip_init(ofnode n + (nsels * sizeof(struct sunxi_nand_chip_sel)), + GFP_KERNEL); + if (!chip) { +- dev_err(nfc->dev, "could not allocate chip\n"); ++ dev_err(dev, "could not allocate chip\n"); + return -ENOMEM; + } + +@@ -1638,19 +1639,19 @@ static int sunxi_nand_chip_init(ofnode n + for (i = 0; i < nsels; i++) { + ret = ofnode_read_u32_index(np, "reg", i, &tmp); + if (ret) { +- dev_err(nfc->dev, "could not retrieve reg property: %d\n", ++ dev_err(dev, "could not retrieve reg property: %d\n", + ret); + return ret; + } + + if (tmp > NFC_MAX_CS) { +- dev_err(nfc->dev, ++ dev_err(dev, + "invalid reg value: %u (max CS = 7)\n", tmp); + return -EINVAL; + } + + if (test_and_set_bit(tmp, &nfc->assigned_cs)) { +- dev_err(nfc->dev, "CS %d already assigned\n", tmp); ++ dev_err(dev, "CS %d already assigned\n", tmp); + return -EINVAL; + } + +@@ -1661,9 +1662,9 @@ static int sunxi_nand_chip_init(ofnode n + chip->sels[i].rb.type = RB_NATIVE; + chip->sels[i].rb.info.nativeid = tmp; + } else { +- ret = gpio_request_by_name_nodev(np, "rb-gpios", i, +- &chip->sels[i].rb.info.gpio, +- GPIOD_IS_IN); ++ ret = gpio_request_by_name(dev, "rb-gpios", i, ++ &chip->sels[i].rb.info.gpio, ++ GPIOD_IS_IN); + if (ret) + chip->sels[i].rb.type = RB_GPIO; + else +@@ -1674,7 +1675,7 @@ static int sunxi_nand_chip_init(ofnode n + timings = onfi_async_timing_mode_to_sdr_timings(0); + if (IS_ERR(timings)) { + ret = PTR_ERR(timings); +- dev_err(nfc->dev, ++ dev_err(dev, + "could not retrieve timings for ONFI mode 0: %d\n", + ret); + return ret; +@@ -1682,7 +1683,7 @@ static int sunxi_nand_chip_init(ofnode n + + ret = sunxi_nand_chip_set_timings(nfc, chip, timings); + if (ret) { +- dev_err(nfc->dev, "could not configure chip timings: %d\n", ret); ++ dev_err(dev, "could not configure chip timings: %d\n", ret); + return ret; + } + +@@ -1717,25 +1718,25 @@ static int sunxi_nand_chip_init(ofnode n + + ret = sunxi_nand_chip_init_timings(nfc, chip); + if (ret) { +- dev_err(nfc->dev, "could not configure chip timings: %d\n", ret); ++ dev_err(dev, "could not configure chip timings: %d\n", ret); + return ret; + } + + ret = sunxi_nand_ecc_init(mtd, &nand->ecc); + if (ret) { +- dev_err(nfc->dev, "ECC init failed: %d\n", ret); ++ dev_err(dev, "ECC init failed: %d\n", ret); + return ret; + } + + ret = nand_scan_tail(mtd); + if (ret) { +- dev_err(nfc->dev, "nand_scan_tail failed: %d\n", ret); ++ dev_err(dev, "nand_scan_tail failed: %d\n", ret); + return ret; + } + + ret = nand_register(devnum, mtd); + if (ret) { +- dev_err(nfc->dev, "failed to register mtd device: %d\n", ret); ++ dev_err(dev, "failed to register mtd device: %d\n", ret); + return ret; + } + +@@ -1744,13 +1745,13 @@ static int sunxi_nand_chip_init(ofnode n + return 0; + } + +-static int sunxi_nand_chips_init(ofnode node, struct sunxi_nfc *nfc) ++static int sunxi_nand_chips_init(struct udevice *dev, struct sunxi_nfc *nfc) + { + ofnode nand_np; + int ret, i = 0; + +- ofnode_for_each_subnode(nand_np, node) { +- ret = sunxi_nand_chip_init(nand_np, nfc, i++); ++ dev_for_each_subnode(nand_np, dev) { ++ ret = sunxi_nand_chip_init(dev, nfc, nand_np, i++); + if (ret) + return ret; + } +@@ -1802,7 +1803,7 @@ static int sunxi_nand_probe(struct udevi + if (ret) + return ret; + +- ret = sunxi_nand_chips_init(dev_ofnode(dev), nfc); ++ ret = sunxi_nand_chips_init(dev, nfc); + if (ret) { + dev_err(dev, "failed to init nand chips\n"); + return ret; diff --git a/package/boot/uboot-d1/patches/0036-sunxi-Enable-PHY_SUN4I_USB-by-default-for-new-SoCs.patch b/package/boot/uboot-d1/patches/0036-sunxi-Enable-PHY_SUN4I_USB-by-default-for-new-SoCs.patch new file mode 100644 index 00000000000000..0d0bfc0fb41551 --- /dev/null +++ b/package/boot/uboot-d1/patches/0036-sunxi-Enable-PHY_SUN4I_USB-by-default-for-new-SoCs.patch @@ -0,0 +1,120 @@ +From b13140a914199dcdd80331fef6f33d47f008f1b4 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Fri, 5 Aug 2022 23:40:22 -0500 +Subject: [PATCH 36/90] sunxi: Enable PHY_SUN4I_USB by default for new SoCs + +With one exception (sun9i), all sunxi SoCs released to date use variants +of the same USB PHY. Instead of requiring each new SoC to duplicate the +PHY driver selection, enable it by default. + +Series-to: Andre Przywara +Series-to: Jagan Teki + +Signed-off-by: Samuel Holland +--- + arch/arm/mach-sunxi/Kconfig | 11 ----------- + drivers/phy/allwinner/Kconfig | 3 ++- + 2 files changed, 2 insertions(+), 12 deletions(-) + +--- a/arch/arm/mach-sunxi/Kconfig ++++ b/arch/arm/mach-sunxi/Kconfig +@@ -162,7 +162,6 @@ endif + + config MACH_SUNXI_H3_H5 + bool +- select PHY_SUN4I_USB + select SUNXI_DE2 + select SUNXI_DRAM_DW + select SUNXI_DRAM_DW_32BIT +@@ -191,7 +190,6 @@ config MACH_SUNIV + config MACH_SUN4I + bool "sun4i (Allwinner A10)" + select CPU_V7A +- select PHY_SUN4I_USB + select DRAM_SUN4I + select SUNXI_GEN_SUN4I + select SUPPORT_SPL +@@ -202,7 +200,6 @@ config MACH_SUN5I + bool "sun5i (Allwinner A13)" + select CPU_V7A + select DRAM_SUN4I +- select PHY_SUN4I_USB + select SUNXI_GEN_SUN4I + select SUPPORT_SPL + imply SPL_SYS_I2C_LEGACY +@@ -216,7 +213,6 @@ config MACH_SUN6I + select ARCH_SUPPORT_PSCI + select SPL_ARMV7_SET_CORTEX_SMPEN + select DRAM_SUN6I +- select PHY_SUN4I_USB + select SPL_I2C + select SUN6I_PRCM + select SUNXI_GEN_SUN6I +@@ -232,7 +228,6 @@ config MACH_SUN7I + select ARCH_SUPPORT_PSCI + select SPL_ARMV7_SET_CORTEX_SMPEN + select DRAM_SUN4I +- select PHY_SUN4I_USB + select SUNXI_GEN_SUN4I + select SUPPORT_SPL + select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT +@@ -246,7 +241,6 @@ config MACH_SUN8I_A23 + select CPU_V7_HAS_VIRT + select ARCH_SUPPORT_PSCI + select DRAM_SUN8I_A23 +- select PHY_SUN4I_USB + select SPL_I2C + select SUNXI_GEN_SUN6I + select SUPPORT_SPL +@@ -260,7 +254,6 @@ config MACH_SUN8I_A33 + select CPU_V7_HAS_VIRT + select ARCH_SUPPORT_PSCI + select DRAM_SUN8I_A33 +- select PHY_SUN4I_USB + select SPL_I2C + select SUNXI_GEN_SUN6I + select SUPPORT_SPL +@@ -271,7 +264,6 @@ config MACH_SUN8I_A83T + bool "sun8i (Allwinner A83T)" + select CPU_V7A + select DRAM_SUN8I_A83T +- select PHY_SUN4I_USB + select SPL_I2C + select SUNXI_GEN_SUN6I + select MMC_SUNXI_HAS_NEW_MODE +@@ -299,7 +291,6 @@ config MACH_SUN8I_R40 + select SUPPORT_SPL + select SUNXI_DRAM_DW + select SUNXI_DRAM_DW_32BIT +- select PHY_SUN4I_USB + imply SPL_SYS_I2C_LEGACY + + config MACH_SUN8I_V3S +@@ -327,7 +318,6 @@ config MACH_SUN9I + config MACH_SUN50I + bool "sun50i (Allwinner A64)" + select ARM64 +- select PHY_SUN4I_USB + select SUN6I_PRCM + select SUNXI_DE2 + select SUNXI_GEN_SUN6I +@@ -350,7 +340,6 @@ config MACH_SUN50I_H5 + config MACH_SUN50I_H6 + bool "sun50i (Allwinner H6)" + select ARM64 +- select PHY_SUN4I_USB + select DRAM_SUN50I_H6 + select SUN50I_GEN_H6 + +--- a/drivers/phy/allwinner/Kconfig ++++ b/drivers/phy/allwinner/Kconfig +@@ -3,7 +3,8 @@ + # + config PHY_SUN4I_USB + bool "Allwinner Sun4I USB PHY driver" +- depends on ARCH_SUNXI ++ depends on ARCH_SUNXI && !MACH_SUN9I ++ default y + select DM_REGULATOR + select PHY + help diff --git a/package/boot/uboot-d1/patches/0037-sunxi-psci-Add-support-for-H3-CPU-0-hotplug.patch b/package/boot/uboot-d1/patches/0037-sunxi-psci-Add-support-for-H3-CPU-0-hotplug.patch new file mode 100644 index 00000000000000..040bce409d6d66 --- /dev/null +++ b/package/boot/uboot-d1/patches/0037-sunxi-psci-Add-support-for-H3-CPU-0-hotplug.patch @@ -0,0 +1,183 @@ +From d11c5971f60d482c05f807c24f3ccd37cf7d0f70 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sat, 9 Oct 2021 17:12:57 -0500 +Subject: [PATCH 37/90] sunxi: psci: Add support for H3 CPU 0 hotplug + +Due to a bug in the H3 SoC, where the CPU 0 hotplug flag cannot be +written, resuming CPU 0 requires using the "Super Standby" code path in +the BROM instead of the hotplug path. This path requires jumping to an +eGON image in SRAM. + +Add support to the build system to generate this eGON image and include +it in the FIT, and add code to direct the BROM to its location in SRAM. + +Since the Super Standby code path in the BROM initializes the CPU and +AHB1 clocks to 24 MHz, those registers need to be restored after control +passes back to U-Boot. Furthermore, because the BROM lowers the AHB1 +clock divider to /1 before switching to the lower-frequency parent, +PLL_PERIPH0 must be bypassed to prevent AHB1 from temporarily running at +600 MHz. Otherwise, this locks up the SoC. + +Signed-off-by: Samuel Holland +--- + Makefile | 17 +++++++++++++++++ + arch/arm/cpu/armv7/sunxi/psci.c | 31 +++++++++++++++++++++++++++++++ + arch/arm/dts/sunxi-u-boot.dtsi | 23 ++++++++++++++++++++++- + include/configs/sun8i.h | 4 ++++ + 4 files changed, 74 insertions(+), 1 deletion(-) + +--- a/Makefile ++++ b/Makefile +@@ -1013,6 +1013,23 @@ INPUTS-y += u-boot.img + endif + endif + ++ifeq ($(CONFIG_MACH_SUN8I_H3)$(CONFIG_ARMV7_PSCI),yy) ++INPUTS-$(CONFIG_ARMV7_PSCI) += u-boot-resume.img ++ ++MKIMAGEFLAGS_u-boot-resume.img := -B 0x400 -T sunxi_egon ++ ++u-boot-resume.img: u-boot-resume.bin ++ $(call if_changed,mkimage) ++ ++OBJCOPYFLAGS_u-boot-resume.bin := -O binary ++ ++u-boot-resume.bin: u-boot-resume.o ++ $(call if_changed,objcopy) ++ ++u-boot-resume.S: u-boot ++ @sed -En 's/(0x[[:xdigit:]]+) +psci_cpu_entry/ldr pc, =\1/p' $<.map > $@ ++endif ++ + INPUTS-$(CONFIG_X86) += u-boot-x86-start16.bin u-boot-x86-reset16.bin \ + $(if $(CONFIG_SPL_X86_16BIT_INIT),spl/u-boot-spl.bin) \ + $(if $(CONFIG_TPL_X86_16BIT_INIT),tpl/u-boot-tpl.bin) +--- a/arch/arm/cpu/armv7/sunxi/psci.c ++++ b/arch/arm/cpu/armv7/sunxi/psci.c +@@ -10,6 +10,7 @@ + #include + #include + ++#include + #include + #include + #include +@@ -141,6 +142,13 @@ static void __secure sunxi_set_entry_add + (struct sunxi_cpucfg_reg *)SUNXI_CPUCFG_BASE; + + writel((u32)entry, &cpucfg->priv0); ++ ++#ifdef CONFIG_MACH_SUN8I_H3 ++ /* Redirect CPU 0 to the secure monitor via the resume shim. */ ++ writel(0x16aaefe8, &cpucfg->super_standy_flag); ++ writel(0xaa16efe8, &cpucfg->super_standy_flag); ++ writel(SUNXI_RESUME_BASE, &cpucfg->priv1); ++#endif + } + #endif + +@@ -255,9 +263,12 @@ out: + int __secure psci_cpu_on(u32 __always_unused unused, u32 mpidr, u32 pc, + u32 context_id) + { ++ struct sunxi_ccm_reg *ccu = (struct sunxi_ccm_reg *)SUNXI_CCM_BASE; + struct sunxi_cpucfg_reg *cpucfg = + (struct sunxi_cpucfg_reg *)SUNXI_CPUCFG_BASE; + u32 cpu = (mpidr & 0x3); ++ u32 cpu_clk; ++ u32 bus_clk; + + /* store target PC and context id */ + psci_save(cpu, pc, context_id); +@@ -274,12 +285,32 @@ int __secure psci_cpu_on(u32 __always_un + /* Lock CPU (Disable external debug access) */ + clrbits_le32(&cpucfg->dbg_ctrl1, BIT(cpu)); + ++ if (IS_ENABLED(CONFIG_MACH_SUN8I_H3) && cpu == 0) { ++ /* Save registers that will be clobbered by the BROM. */ ++ cpu_clk = readl(&ccu->cpu_axi_cfg); ++ bus_clk = readl(&ccu->ahb1_apb1_div); ++ ++ /* Bypass PLL_PERIPH0 so AHB1 frequency does not spike. */ ++ setbits_le32(&ccu->pll6_cfg, BIT(25)); ++ } ++ + /* Power up target CPU */ + sunxi_cpu_set_power(cpu, true); + + /* De-assert reset on target CPU */ + writel(BIT(1) | BIT(0), &cpucfg->cpu[cpu].rst); + ++ if (IS_ENABLED(CONFIG_MACH_SUN8I_H3) && cpu == 0) { ++ /* Spin until the BROM has clobbered the clock registers. */ ++ while (readl(&ccu->ahb1_apb1_div) != 0x00001100); ++ ++ /* Restore the registers and turn off PLL_PERIPH0 bypass. */ ++ writel(cpu_clk, &ccu->cpu_axi_cfg); ++ writel(bus_clk, &ccu->ahb1_apb1_div); ++ ++ clrbits_le32(&ccu->pll6_cfg, BIT(25)); ++ } ++ + /* Unlock CPU (Disable external debug access) */ + setbits_le32(&cpucfg->dbg_ctrl1, BIT(cpu)); + +--- a/arch/arm/dts/sunxi-u-boot.dtsi ++++ b/arch/arm/dts/sunxi-u-boot.dtsi +@@ -6,7 +6,11 @@ + #define ARCH "arm" + #endif + +-#if defined(CONFIG_MACH_SUN50I) || defined(CONFIG_MACH_SUN50I_H5) ++#if defined(CONFIG_MACH_SUN8I_H3) ++#ifdef CONFIG_ARMV7_PSCI ++#define RESUME_ADDR SUNXI_RESUME_BASE ++#endif ++#elif defined(CONFIG_MACH_SUN50I) || defined(CONFIG_MACH_SUN50I_H5) + #define BL31_ADDR 0x00044000 + #define SCP_ADDR 0x00050000 + #elif defined(CONFIG_MACH_SUN50I_H6) +@@ -78,6 +82,20 @@ + }; + #endif + ++#ifdef RESUME_ADDR ++ resume { ++ description = "Super Standby resume image"; ++ type = "standalone"; ++ arch = ARCH; ++ compression = "none"; ++ load = ; ++ ++ blob-ext { ++ filename = "u-boot-resume.img"; ++ }; ++ }; ++#endif ++ + #ifdef SCP_ADDR + scp { + description = "SCP firmware"; +@@ -111,6 +129,9 @@ + firmware = "uboot"; + #endif + loadables = ++#ifdef RESUME_ADDR ++ "resume", ++#endif + #ifdef SCP_ADDR + "scp", + #endif +--- a/include/configs/sun8i.h ++++ b/include/configs/sun8i.h +@@ -8,6 +8,10 @@ + #ifndef __CONFIG_H + #define __CONFIG_H + ++#define SUNXI_RESUME_BASE (CONFIG_ARMV7_SECURE_BASE + \ ++ CONFIG_ARMV7_SECURE_MAX_SIZE) ++#define SUNXI_RESUME_SIZE 1024 ++ + #include + + #endif /* __CONFIG_H */ diff --git a/package/boot/uboot-d1/patches/0038-remoteproc-Add-a-driver-for-the-Allwinner-AR100.patch b/package/boot/uboot-d1/patches/0038-remoteproc-Add-a-driver-for-the-Allwinner-AR100.patch new file mode 100644 index 00000000000000..1b0e002ee9f5fd --- /dev/null +++ b/package/boot/uboot-d1/patches/0038-remoteproc-Add-a-driver-for-the-Allwinner-AR100.patch @@ -0,0 +1,155 @@ +From 7585a12ffec6e42c62222d8ee4085413b3a197f7 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sat, 9 Oct 2021 14:58:27 -0500 +Subject: [PATCH 38/90] remoteproc: Add a driver for the Allwinner AR100 + +Signed-off-by: Samuel Holland +--- + drivers/remoteproc/Kconfig | 9 ++ + drivers/remoteproc/Makefile | 1 + + drivers/remoteproc/sun6i_ar100_rproc.c | 111 +++++++++++++++++++++++++ + 3 files changed, 121 insertions(+) + create mode 100644 drivers/remoteproc/sun6i_ar100_rproc.c + +--- a/drivers/remoteproc/Kconfig ++++ b/drivers/remoteproc/Kconfig +@@ -41,6 +41,15 @@ config REMOTEPROC_STM32_COPRO + Say 'y' here to add support for STM32 Cortex-M4 coprocessors via the + remoteproc framework. + ++config REMOTEPROC_SUN6I_AR100 ++ bool "Support for Allwinner AR100 SCP" ++ select REMOTEPROC ++ depends on ARCH_SUNXI ++ help ++ Say 'y' here to support Allwinner's AR100 System Control Processor ++ (SCP), found in various sun6i/sun8i/sun50i family SoCs, through the ++ remoteproc framework. ++ + config REMOTEPROC_TI_K3_ARM64 + bool "Support for TI's K3 based ARM64 remoteproc driver" + select REMOTEPROC +--- a/drivers/remoteproc/Makefile ++++ b/drivers/remoteproc/Makefile +@@ -10,6 +10,7 @@ obj-$(CONFIG_$(SPL_)REMOTEPROC) += rproc + obj-$(CONFIG_K3_SYSTEM_CONTROLLER) += k3_system_controller.o + obj-$(CONFIG_REMOTEPROC_SANDBOX) += sandbox_testproc.o + obj-$(CONFIG_REMOTEPROC_STM32_COPRO) += stm32_copro.o ++obj-$(CONFIG_REMOTEPROC_SUN6I_AR100) += sun6i_ar100_rproc.o + obj-$(CONFIG_REMOTEPROC_TI_K3_ARM64) += ti_k3_arm64_rproc.o + obj-$(CONFIG_REMOTEPROC_TI_K3_DSP) += ti_k3_dsp_rproc.o + obj-$(CONFIG_REMOTEPROC_TI_K3_R5F) += ti_k3_r5f_rproc.o +--- /dev/null ++++ b/drivers/remoteproc/sun6i_ar100_rproc.c +@@ -0,0 +1,111 @@ ++// SPDX-License-Identifier: GPL-2.0 ++ ++#include ++#include ++#include ++#include ++ ++#define SUNXI_SCP_MAGIC 0xb4400012 ++ ++#define OR1K_VEC_FIRST 0x01 ++#define OR1K_VEC_LAST 0x0e ++#define OR1K_VEC_ADDR(n) (0x100 * (n)) ++ ++struct sun6i_ar100_rproc_priv { ++ void *cfg_base; ++ ulong sram_base; ++}; ++ ++static int sun6i_ar100_rproc_load(struct udevice *dev, ulong addr, ulong size) ++{ ++ struct sun6i_ar100_rproc_priv *priv = dev_get_priv(dev); ++ ++ /* Check for a valid SCP firmware. */ ++ if (readl_relaxed(addr) != SUNXI_SCP_MAGIC) ++ return -ENOENT; ++ ++ /* Program exception vectors to the firmware entry point. */ ++ for (u32 i = OR1K_VEC_FIRST; i <= OR1K_VEC_LAST; ++i) { ++ ulong vector = priv->sram_base + OR1K_VEC_ADDR(i); ++ ulong offset = addr - vector; ++ ++ writel_relaxed(offset >> 2, vector); ++ } ++ ++ return 0; ++} ++ ++static int sun6i_ar100_rproc_start(struct udevice *dev) ++{ ++ struct sun6i_ar100_rproc_priv *priv = dev_get_priv(dev); ++ ++ setbits_le32(priv->cfg_base, BIT(0)); ++ ++ return 0; ++} ++ ++static int sun6i_ar100_rproc_stop(struct udevice *dev) ++{ ++ struct sun6i_ar100_rproc_priv *priv = dev_get_priv(dev); ++ ++ clrbits_le32(priv->cfg_base, BIT(0)); ++ ++ return 0; ++} ++ ++static int sun6i_ar100_rproc_reset(struct udevice *dev) ++{ ++ int ret; ++ ++ ret = sun6i_ar100_rproc_stop(dev); ++ if (ret) ++ return ret; ++ ++ return sun6i_ar100_rproc_start(dev); ++} ++ ++static int sun6i_ar100_rproc_is_running(struct udevice *dev) ++{ ++ struct sun6i_ar100_rproc_priv *priv = dev_get_priv(dev); ++ ++ return !(readl_relaxed(priv->cfg_base) & BIT(0)); ++} ++ ++static const struct dm_rproc_ops sun6i_ar100_rproc_ops = { ++ .load = sun6i_ar100_rproc_load, ++ .start = sun6i_ar100_rproc_start, ++ .stop = sun6i_ar100_rproc_stop, ++ .reset = sun6i_ar100_rproc_reset, ++ .is_running = sun6i_ar100_rproc_is_running, ++}; ++ ++static int sun6i_ar100_rproc_probe(struct udevice *dev) ++{ ++ struct sun6i_ar100_rproc_priv *priv = dev_get_priv(dev); ++ struct ofnode_phandle_args sram_handle; ++ int ret; ++ ++ priv->cfg_base = dev_read_addr_ptr(dev); ++ ++ ret = dev_read_phandle_with_args(dev, "sram", NULL, 0, 0, &sram_handle); ++ if (ret) ++ return ret; ++ ++ priv->sram_base = ofnode_get_addr(sram_handle.node); ++ ++ return 0; ++} ++ ++static const struct udevice_id sun6i_ar100_rproc_ids[] = { ++ { .compatible = "allwinner,sun6i-a31-ar100" }, ++ { } ++}; ++ ++U_BOOT_DRIVER(sun6i_ar100_rproc) = { ++ .name = "sun6i_ar100_rproc", ++ .id = UCLASS_REMOTEPROC, ++ .of_match = sun6i_ar100_rproc_ids, ++ .probe = sun6i_ar100_rproc_probe, ++ .priv_auto = sizeof(struct sun6i_ar100_rproc_priv), ++ .ops = &sun6i_ar100_rproc_ops, ++}; diff --git a/package/boot/uboot-d1/patches/0039-arm-dts-sunxi-h3-Add-nodes-for-AR100-remoteproc.patch b/package/boot/uboot-d1/patches/0039-arm-dts-sunxi-h3-Add-nodes-for-AR100-remoteproc.patch new file mode 100644 index 00000000000000..8efaee955c7cc6 --- /dev/null +++ b/package/boot/uboot-d1/patches/0039-arm-dts-sunxi-h3-Add-nodes-for-AR100-remoteproc.patch @@ -0,0 +1,40 @@ +From 2fdd94449c2668b4ff69326ff8d5daabdf2c9f00 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sat, 9 Oct 2021 15:04:16 -0500 +Subject: [PATCH 39/90] arm: dts: sunxi: h3: Add nodes for AR100 remoteproc + +Signed-off-by: Samuel Holland +--- + arch/arm/dts/sun8i-h3.dtsi | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +--- a/arch/arm/dts/sun8i-h3.dtsi ++++ b/arch/arm/dts/sun8i-h3.dtsi +@@ -170,6 +170,14 @@ + #size-cells = <1>; + ranges; + ++ sram_a2: sram@40000 { ++ compatible = "mmio-sram"; ++ reg = <0x00040000 0xc000>; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ranges = <0 0x00040000 0xc000>; ++ }; ++ + sram_c: sram@1d00000 { + compatible = "mmio-sram"; + reg = <0x01d00000 0x80000>; +@@ -239,6 +247,12 @@ + nvmem-cell-names = "calibration"; + #thermal-sensor-cells = <0>; + }; ++ ++ remoteproc@1f01c00 { ++ compatible = "allwinner,sun6i-a31-ar100"; ++ reg = <0x01f01c00 0x400>; ++ sram = <&sram_a2>; ++ }; + }; + + thermal-zones { diff --git a/package/boot/uboot-d1/patches/0040-sunxi-Enable-support-for-SCP-firmware-on-H3.patch b/package/boot/uboot-d1/patches/0040-sunxi-Enable-support-for-SCP-firmware-on-H3.patch new file mode 100644 index 00000000000000..12773fc6a88e30 --- /dev/null +++ b/package/boot/uboot-d1/patches/0040-sunxi-Enable-support-for-SCP-firmware-on-H3.patch @@ -0,0 +1,63 @@ +From aefe751d6f23c9d526bca447c6c28da97e45e528 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sat, 17 Apr 2021 13:33:54 -0500 +Subject: [PATCH 40/90] sunxi: Enable support for SCP firmware on H3 + +Now that issues with the BROM have been sorted out, we can implement +PSCI system suspend on H3 by delegating to SCP firmware. Let's start by +including the firmware in the FIT image and starting the coprocessor if +valid firmware is loaded. + +Signed-off-by: Samuel Holland +--- + arch/arm/dts/sunxi-u-boot.dtsi | 1 + + board/sunxi/board.c | 8 ++++++++ + include/configs/sun8i.h | 3 +++ + 3 files changed, 12 insertions(+) + +--- a/arch/arm/dts/sunxi-u-boot.dtsi ++++ b/arch/arm/dts/sunxi-u-boot.dtsi +@@ -9,6 +9,7 @@ + #if defined(CONFIG_MACH_SUN8I_H3) + #ifdef CONFIG_ARMV7_PSCI + #define RESUME_ADDR SUNXI_RESUME_BASE ++#define SCP_ADDR SUNXI_SCP_BASE + #endif + #elif defined(CONFIG_MACH_SUN50I) || defined(CONFIG_MACH_SUN50I_H5) + #define BL31_ADDR 0x00044000 +--- a/board/sunxi/board.c ++++ b/board/sunxi/board.c +@@ -19,6 +19,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -867,6 +868,13 @@ int board_late_init(void) + usb_ether_init(); + #endif + ++#ifdef CONFIG_REMOTEPROC_SUN6I_AR100 ++ if (!rproc_load(0, SUNXI_SCP_BASE, SUNXI_SCP_MAX_SIZE)) { ++ puts("Starting SCP...\n"); ++ rproc_start(0); ++ } ++#endif ++ + return 0; + } + +--- a/include/configs/sun8i.h ++++ b/include/configs/sun8i.h +@@ -12,6 +12,9 @@ + CONFIG_ARMV7_SECURE_MAX_SIZE) + #define SUNXI_RESUME_SIZE 1024 + ++#define SUNXI_SCP_BASE (SUNXI_RESUME_BASE + SUNXI_RESUME_SIZE) ++#define SUNXI_SCP_MAX_SIZE (16 * 1024) ++ + #include + + #endif /* __CONFIG_H */ diff --git a/package/boot/uboot-d1/patches/0041-arm-psci-Add-definitions-for-PSCI-v1.1.patch b/package/boot/uboot-d1/patches/0041-arm-psci-Add-definitions-for-PSCI-v1.1.patch new file mode 100644 index 00000000000000..535c156199d662 --- /dev/null +++ b/package/boot/uboot-d1/patches/0041-arm-psci-Add-definitions-for-PSCI-v1.1.patch @@ -0,0 +1,115 @@ +From f73116f62647c74eb0f06f0d8c29e5993d961d82 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sat, 9 Oct 2021 22:43:26 -0500 +Subject: [PATCH 41/90] arm: psci: Add definitions for PSCI v1.1 + +Add the new option, function IDs, and prototypes for PSCI v1.1 +implementations. In the process, fix some issues with the existing +definitions: + - Fix the incorrectly-named ARM_PSCI_0_2_FN64_SYSTEM_RESET2. + - Replace the deprecated "affinity_level" naming with "power_level". + +Signed-off-by: Samuel Holland +--- + arch/arm/cpu/armv7/Kconfig | 3 +++ + arch/arm/cpu/armv8/fwcall.c | 2 +- + arch/arm/include/asm/psci.h | 9 +++++++-- + arch/arm/include/asm/system.h | 14 +++++++++----- + arch/arm/lib/psci-dt.c | 2 ++ + 5 files changed, 22 insertions(+), 8 deletions(-) + +--- a/arch/arm/cpu/armv7/Kconfig ++++ b/arch/arm/cpu/armv7/Kconfig +@@ -80,6 +80,9 @@ choice + help + Select the supported PSCI version. + ++config ARMV7_PSCI_1_1 ++ bool "PSCI V1.1" ++ + config ARMV7_PSCI_1_0 + bool "PSCI V1.0" + +--- a/arch/arm/cpu/armv8/fwcall.c ++++ b/arch/arm/cpu/armv8/fwcall.c +@@ -103,7 +103,7 @@ void __noreturn psci_system_reset2(u32 r + { + struct pt_regs regs; + +- regs.regs[0] = ARM_PSCI_0_2_FN64_SYSTEM_RESET2; ++ regs.regs[0] = ARM_PSCI_1_1_FN64_SYSTEM_RESET2; + regs.regs[1] = PSCI_RESET2_TYPE_VENDOR | reset_level; + regs.regs[2] = cookie; + if (use_smc_for_psci) +--- a/arch/arm/include/asm/psci.h ++++ b/arch/arm/include/asm/psci.h +@@ -22,8 +22,9 @@ + #include + #endif + +-#define ARM_PSCI_VER_1_0 (0x00010000) + #define ARM_PSCI_VER_0_2 (0x00000002) ++#define ARM_PSCI_VER_1_0 (0x00010000) ++#define ARM_PSCI_VER_1_1 (0x00010001) + + /* PSCI 0.1 interface */ + #define ARM_PSCI_FN_BASE 0x95c1ba5e +@@ -68,7 +69,6 @@ + #define ARM_PSCI_0_2_FN64_AFFINITY_INFO ARM_PSCI_0_2_FN64(4) + #define ARM_PSCI_0_2_FN64_MIGRATE ARM_PSCI_0_2_FN64(5) + #define ARM_PSCI_0_2_FN64_MIGRATE_INFO_UP_CPU ARM_PSCI_0_2_FN64(7) +-#define ARM_PSCI_0_2_FN64_SYSTEM_RESET2 ARM_PSCI_0_2_FN64(18) + + /* PSCI 1.0 interface */ + #define ARM_PSCI_1_0_FN_PSCI_FEATURES ARM_PSCI_0_2_FN(10) +@@ -86,6 +86,11 @@ + #define ARM_PSCI_1_0_FN64_STAT_RESIDENCY ARM_PSCI_0_2_FN64(16) + #define ARM_PSCI_1_0_FN64_STAT_COUNT ARM_PSCI_0_2_FN64(17) + ++/* PSCI 1.1 interface */ ++#define ARM_PSCI_1_1_FN_SYSTEM_RESET2 ARM_PSCI_0_2_FN(18) ++ ++#define ARM_PSCI_1_1_FN64_SYSTEM_RESET2 ARM_PSCI_0_2_FN64(18) ++ + /* 1KB stack per core */ + #define ARM_PSCI_STACK_SHIFT 10 + #define ARM_PSCI_STACK_SIZE (1 << ARM_PSCI_STACK_SHIFT) +--- a/arch/arm/include/asm/system.h ++++ b/arch/arm/include/asm/system.h +@@ -557,16 +557,20 @@ void mmu_page_table_flush(unsigned long + #ifdef CONFIG_ARMV7_PSCI + void psci_arch_cpu_entry(void); + void psci_arch_init(void); ++ + u32 psci_version(void); +-s32 psci_features(u32 function_id, u32 psci_fid); ++s32 psci_cpu_suspend(u32 function_id, u32 power_state, u32 pc, u32 context_id); + s32 psci_cpu_off(void); +-s32 psci_cpu_on(u32 function_id, u32 target_cpu, u32 pc, +- u32 context_id); +-s32 psci_affinity_info(u32 function_id, u32 target_affinity, +- u32 lowest_affinity_level); ++s32 psci_cpu_on(u32 function_id, u32 target_cpu, u32 pc, u32 context_id); ++s32 psci_affinity_info(u32 function_id, u32 target_affinity, u32 power_level); + u32 psci_migrate_info_type(void); + void psci_system_off(void); + void psci_system_reset(void); ++s32 psci_features(u32 function_id, u32 psci_fid); ++s32 psci_cpu_default_suspend(u32 function_id, u32 pc, u32 context_id); ++s32 psci_node_hw_state(u32 function_id, u32 target_cpu, u32 power_level); ++s32 psci_system_suspend(u32 function_id, u32 pc, u32 context_id); ++s32 psci_system_reset2(u32 function_id, u32 reset_type, u32 cookie); + #endif + + #endif /* __ASSEMBLY__ */ +--- a/arch/arm/lib/psci-dt.c ++++ b/arch/arm/lib/psci-dt.c +@@ -66,6 +66,8 @@ int fdt_psci(void *fdt) + init_psci_node: + #if CONFIG_IS_ENABLED(ARMV8_SEC_FIRMWARE_SUPPORT) + psci_ver = sec_firmware_support_psci_version(); ++#elif defined(CONFIG_ARMV7_PSCI_1_1) ++ psci_ver = ARM_PSCI_VER_1_1; + #elif defined(CONFIG_ARMV7_PSCI_1_0) || defined(CONFIG_ARMV8_PSCI) + psci_ver = ARM_PSCI_VER_1_0; + #elif defined(CONFIG_ARMV7_PSCI_0_2) diff --git a/package/boot/uboot-d1/patches/0042-sunxi-Enable-remoteproc-on-some-H3-boards.patch b/package/boot/uboot-d1/patches/0042-sunxi-Enable-remoteproc-on-some-H3-boards.patch new file mode 100644 index 00000000000000..9aaee317a24503 --- /dev/null +++ b/package/boot/uboot-d1/patches/0042-sunxi-Enable-remoteproc-on-some-H3-boards.patch @@ -0,0 +1,29 @@ +From 6dc0da83dba9570740365d0f1b32f91ae8ba0998 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Mon, 11 Oct 2021 03:20:28 -0500 +Subject: [PATCH 42/90] sunxi: Enable remoteproc on some H3 boards + +Signed-off-by: Samuel Holland +--- + configs/orangepi_one_defconfig | 1 + + configs/orangepi_plus2e_defconfig | 1 + + 2 files changed, 2 insertions(+) + +--- a/configs/orangepi_one_defconfig ++++ b/configs/orangepi_one_defconfig +@@ -6,5 +6,6 @@ CONFIG_MACH_SUN8I_H3=y + CONFIG_DRAM_CLK=672 + # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set + CONFIG_SUN8I_EMAC=y ++CONFIG_REMOTEPROC_SUN6I_AR100=y + CONFIG_USB_EHCI_HCD=y + CONFIG_USB_OHCI_HCD=y +--- a/configs/orangepi_plus2e_defconfig ++++ b/configs/orangepi_plus2e_defconfig +@@ -12,5 +12,6 @@ CONFIG_SPL_SYS_I2C_LEGACY=y + CONFIG_SYS_I2C_MVTWSI=y + CONFIG_SUN8I_EMAC=y + CONFIG_SY8106A_POWER=y ++CONFIG_REMOTEPROC_SUN6I_AR100=y + CONFIG_USB_EHCI_HCD=y + CONFIG_USB_OHCI_HCD=y diff --git a/package/boot/uboot-d1/patches/0043-sunxi-psci-Delegate-PSCI-to-SCPI.patch b/package/boot/uboot-d1/patches/0043-sunxi-psci-Delegate-PSCI-to-SCPI.patch new file mode 100644 index 00000000000000..6d0c2b49d1b8ae --- /dev/null +++ b/package/boot/uboot-d1/patches/0043-sunxi-psci-Delegate-PSCI-to-SCPI.patch @@ -0,0 +1,497 @@ +From 650fab5c589a883b139b4164527101f9c849f1a5 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sat, 9 Oct 2021 23:01:05 -0500 +Subject: [PATCH 43/90] sunxi: psci: Delegate PSCI to SCPI + +This adds a new PSCI implementation which communicates with SCP firmware +running on the AR100 using the SCPI protocol. This allows it to support +the full set of PSCI v1.1 features, including CPU idle states, system +suspend, and multiple reset methods. + +Signed-off-by: Samuel Holland +--- + arch/arm/cpu/armv7/Kconfig | 1 + + arch/arm/cpu/armv7/sunxi/Makefile | 4 + + arch/arm/cpu/armv7/sunxi/psci-scpi.c | 451 +++++++++++++++++++++++++++ + 3 files changed, 456 insertions(+) + create mode 100644 arch/arm/cpu/armv7/sunxi/psci-scpi.c + +--- a/arch/arm/cpu/armv7/Kconfig ++++ b/arch/arm/cpu/armv7/Kconfig +@@ -75,6 +75,7 @@ config ARMV7_PSCI + choice + prompt "Supported PSCI version" + depends on ARMV7_PSCI ++ default ARMV7_PSCI_1_1 if MACH_SUN8I_H3 + default ARMV7_PSCI_0_1 if ARCH_SUNXI + default ARMV7_PSCI_1_0 + help +--- a/arch/arm/cpu/armv7/sunxi/Makefile ++++ b/arch/arm/cpu/armv7/sunxi/Makefile +@@ -13,8 +13,12 @@ obj-$(CONFIG_MACH_SUN6I) += sram.o + obj-$(CONFIG_MACH_SUN8I) += sram.o + + ifndef CONFIG_SPL_BUILD ++ifdef CONFIG_MACH_SUN8I_H3 ++obj-$(CONFIG_ARMV7_PSCI) += psci-scpi.o ++else + obj-$(CONFIG_ARMV7_PSCI) += psci.o + endif ++endif + + ifdef CONFIG_SPL_BUILD + obj-y += fel_utils.o +--- /dev/null ++++ b/arch/arm/cpu/armv7/sunxi/psci-scpi.c +@@ -0,0 +1,451 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (C) 2016 Chen-Yu Tsai ++ * Copyright (C) 2018-2021 Samuel Holland ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define GICD_BASE (SUNXI_GIC400_BASE + GIC_DIST_OFFSET) ++#define GICC_BASE (SUNXI_GIC400_BASE + GIC_CPU_OFFSET_A15) ++ ++#define HW_ON 0 ++#define HW_OFF 1 ++#define HW_STANDBY 2 ++ ++#define MPIDR_AFFLVL0(mpidr) (mpidr & 0xf) ++#define MPIDR_AFFLVL1(mpidr) (mpidr >> 8 & 0xf) ++ ++#define SCPI_SHMEM_BASE 0x0004be00 ++#define SCPI_SHMEM ((struct scpi_shmem *)SCPI_SHMEM_BASE) ++ ++#define SCPI_RX_CHANNEL 1 ++#define SCPI_TX_CHANNEL 0 ++#define SCPI_VIRTUAL_CHANNEL BIT(0) ++ ++#define SCPI_MESSAGE_SIZE 0x100 ++#define SCPI_PAYLOAD_SIZE (SCPI_MESSAGE_SIZE - sizeof(struct scpi_header)) ++ ++#define SUNXI_MSGBOX_BASE 0x01c17000 ++#define REMOTE_IRQ_STAT_REG (SUNXI_MSGBOX_BASE + 0x0050) ++#define LOCAL_IRQ_STAT_REG (SUNXI_MSGBOX_BASE + 0x0070) ++#define MSG_STAT_REG(n) (SUNXI_MSGBOX_BASE + 0x0140 + 0x4 * (n)) ++#define MSG_DATA_REG(n) (SUNXI_MSGBOX_BASE + 0x0180 + 0x4 * (n)) ++ ++#define RX_IRQ(n) BIT(0 + 2 * (n)) ++#define TX_IRQ(n) BIT(1 + 2 * (n)) ++ ++enum { ++ CORE_POWER_LEVEL = 0, ++ CLUSTER_POWER_LEVEL = 1, ++ CSS_POWER_LEVEL = 2, ++}; ++ ++enum { ++ SCPI_CMD_SCP_READY = 0x01, ++ SCPI_CMD_SET_CSS_POWER_STATE = 0x03, ++ SCPI_CMD_GET_CSS_POWER_STATE = 0x04, ++ SCPI_CMD_SET_SYS_POWER_STATE = 0x05, ++}; ++ ++enum { ++ SCPI_E_OK = 0, ++ SCPI_E_PARAM = 1, ++ SCPI_E_ALIGN = 2, ++ SCPI_E_SIZE = 3, ++ SCPI_E_HANDLER = 4, ++ SCPI_E_ACCESS = 5, ++ SCPI_E_RANGE = 6, ++ SCPI_E_TIMEOUT = 7, ++ SCPI_E_NOMEM = 8, ++ SCPI_E_PWRSTATE = 9, ++ SCPI_E_SUPPORT = 10, ++ SCPI_E_DEVICE = 11, ++ SCPI_E_BUSY = 12, ++ SCPI_E_OS = 13, ++ SCPI_E_DATA = 14, ++ SCPI_E_STATE = 15, ++}; ++ ++enum { ++ SCPI_POWER_ON = 0x00, ++ SCPI_POWER_RETENTION = 0x01, ++ SCPI_POWER_OFF = 0x03, ++}; ++ ++enum { ++ SCPI_SYSTEM_SHUTDOWN = 0x00, ++ SCPI_SYSTEM_REBOOT = 0x01, ++ SCPI_SYSTEM_RESET = 0x02, ++}; ++ ++struct scpi_header { ++ u8 command; ++ u8 sender; ++ u16 size; ++ u32 status; ++}; ++ ++struct scpi_message { ++ struct scpi_header header; ++ u8 payload[SCPI_PAYLOAD_SIZE]; ++}; ++ ++struct scpi_shmem { ++ struct scpi_message rx; ++ struct scpi_message tx; ++}; ++ ++static bool __secure_data gic_dist_init; ++ ++static u32 __secure_data lock; ++ ++static inline u32 __secure read_mpidr(void) ++{ ++ u32 val; ++ ++ asm volatile ("mrc p15, 0, %0, c0, c0, 5" : "=r" (val)); ++ ++ return val; ++} ++ ++static void __secure scpi_begin_command(void) ++{ ++ u32 mpidr = read_mpidr(); ++ ++ do { ++ while (readl(&lock)); ++ writel(mpidr, &lock); ++ dsb(); ++ } while (readl(&lock) != mpidr); ++ while (readl(REMOTE_IRQ_STAT_REG) & RX_IRQ(SCPI_TX_CHANNEL)); ++} ++ ++static void __secure scpi_send_command(void) ++{ ++ writel(SCPI_VIRTUAL_CHANNEL, MSG_DATA_REG(SCPI_TX_CHANNEL)); ++} ++ ++static void __secure scpi_wait_response(void) ++{ ++ while (!readl(MSG_STAT_REG(SCPI_RX_CHANNEL))); ++} ++ ++static void __secure scpi_end_command(void) ++{ ++ while (readl(MSG_STAT_REG(SCPI_RX_CHANNEL))) ++ readl(MSG_DATA_REG(SCPI_RX_CHANNEL)); ++ writel(RX_IRQ(SCPI_RX_CHANNEL), LOCAL_IRQ_STAT_REG); ++ writel(0, &lock); ++} ++ ++static void __secure scpi_set_css_power_state(u32 target_cpu, u32 core_state, ++ u32 cluster_state, u32 css_state) ++{ ++ struct scpi_shmem *shmem = SCPI_SHMEM; ++ ++ scpi_begin_command(); ++ ++ shmem->tx.header.command = SCPI_CMD_SET_CSS_POWER_STATE; ++ shmem->tx.header.size = 4; ++ ++ shmem->tx.payload[0] = target_cpu >> 4 | target_cpu; ++ shmem->tx.payload[1] = cluster_state << 4 | core_state; ++ shmem->tx.payload[2] = css_state; ++ shmem->tx.payload[3] = 0; ++ ++ scpi_send_command(); ++ scpi_end_command(); ++} ++ ++static s32 __secure scpi_get_css_power_state(u32 target_cpu, u8 *core_states, ++ u8 *cluster_state) ++{ ++ struct scpi_shmem *shmem = SCPI_SHMEM; ++ u32 cluster = MPIDR_AFFLVL1(target_cpu); ++ u32 offset; ++ s32 ret; ++ ++ scpi_begin_command(); ++ ++ shmem->tx.header.command = SCPI_CMD_GET_CSS_POWER_STATE; ++ shmem->tx.header.size = 0; ++ ++ scpi_send_command(); ++ scpi_wait_response(); ++ ++ for (offset = 0; offset < shmem->rx.header.size; offset += 2) { ++ if ((shmem->rx.payload[offset] & 0xf) == cluster) { ++ *cluster_state = shmem->rx.payload[offset+0] >> 4; ++ *core_states = shmem->rx.payload[offset+1]; ++ ++ break; ++ } ++ } ++ ++ ret = shmem->rx.header.status; ++ ++ scpi_end_command(); ++ ++ return ret; ++} ++ ++static s32 __secure scpi_set_sys_power_state(u32 sys_state) ++{ ++ struct scpi_shmem *shmem = SCPI_SHMEM; ++ s32 ret; ++ ++ scpi_begin_command(); ++ ++ shmem->tx.header.command = SCPI_CMD_SET_SYS_POWER_STATE; ++ shmem->tx.header.size = 1; ++ ++ shmem->tx.payload[0] = sys_state; ++ ++ scpi_send_command(); ++ scpi_wait_response(); ++ ++ ret = shmem->rx.header.status; ++ ++ scpi_end_command(); ++ ++ return ret; ++} ++ ++void psci_enable_smp(void); ++ ++static s32 __secure psci_suspend_common(u32 pc, u32 context_id, u32 core_state, ++ u32 cluster_state, u32 css_state) ++ ++{ ++ u32 target_cpu = read_mpidr(); ++ ++ if (core_state == SCPI_POWER_OFF) ++ psci_save(MPIDR_AFFLVL0(target_cpu), pc, context_id); ++ if (css_state == SCPI_POWER_OFF) ++ gic_dist_init = true; ++ ++ scpi_set_css_power_state(target_cpu, core_state, ++ cluster_state, css_state); ++ ++ psci_cpu_off_common(); ++ ++ wfi(); ++ ++ psci_enable_smp(); ++ ++ return ARM_PSCI_RET_SUCCESS; ++} ++ ++u32 __secure psci_version(void) ++{ ++ return ARM_PSCI_VER_1_1; ++} ++ ++s32 __secure psci_cpu_suspend(u32 __always_unused function_id, ++ u32 power_state, u32 pc, u32 context_id) ++{ ++ return psci_suspend_common(pc, context_id, ++ power_state >> 0 & 0xf, ++ power_state >> 4 & 0xf, ++ power_state >> 8 & 0xf); ++} ++ ++s32 __secure psci_cpu_off(void) ++{ ++ u32 pc = 0, context_id = 0; ++ ++ return psci_suspend_common(pc, context_id, SCPI_POWER_OFF, ++ SCPI_POWER_OFF, SCPI_POWER_ON); ++} ++ ++s32 __secure psci_cpu_on(u32 __always_unused function_id, ++ u32 target_cpu, u32 pc, u32 context_id) ++{ ++ psci_save(MPIDR_AFFLVL0(target_cpu), pc, context_id); ++ ++ scpi_set_css_power_state(target_cpu, SCPI_POWER_ON, ++ SCPI_POWER_ON, SCPI_POWER_ON); ++ ++ return ARM_PSCI_RET_SUCCESS; ++} ++ ++s32 __secure psci_affinity_info(u32 function_id, ++ u32 target_cpu, u32 power_level) ++{ ++ if (power_level != CORE_POWER_LEVEL) ++ return ARM_PSCI_RET_INVAL; ++ ++ /* This happens to have the same HW_ON/HW_OFF encoding. */ ++ return psci_node_hw_state(function_id, target_cpu, power_level); ++} ++ ++void __secure psci_system_off(void) ++{ ++ scpi_set_sys_power_state(SCPI_SYSTEM_SHUTDOWN); ++ ++ /* Wait to be turned off. */ ++ for (;;) wfi(); ++} ++ ++void __secure psci_system_reset(void) ++{ ++ scpi_set_sys_power_state(SCPI_SYSTEM_REBOOT); ++ ++ /* Wait to be turned off. */ ++ for (;;) wfi(); ++} ++ ++s32 __secure psci_features(u32 __always_unused function_id, ++ u32 psci_fid) ++{ ++ switch (psci_fid) { ++ case ARM_PSCI_0_2_FN_PSCI_VERSION: ++ case ARM_PSCI_0_2_FN_CPU_SUSPEND: ++ case ARM_PSCI_0_2_FN_CPU_OFF: ++ case ARM_PSCI_0_2_FN_CPU_ON: ++ case ARM_PSCI_0_2_FN_AFFINITY_INFO: ++ case ARM_PSCI_0_2_FN_SYSTEM_OFF: ++ case ARM_PSCI_0_2_FN_SYSTEM_RESET: ++ case ARM_PSCI_1_0_FN_PSCI_FEATURES: ++ case ARM_PSCI_1_0_FN_CPU_DEFAULT_SUSPEND: ++ case ARM_PSCI_1_0_FN_NODE_HW_STATE: ++ case ARM_PSCI_1_0_FN_SYSTEM_SUSPEND: ++ case ARM_PSCI_1_1_FN_SYSTEM_RESET2: ++ return ARM_PSCI_RET_SUCCESS; ++ default: ++ return ARM_PSCI_RET_NI; ++ } ++} ++ ++s32 __secure psci_cpu_default_suspend(u32 __always_unused function_id, ++ u32 pc, u32 context_id) ++{ ++ return psci_suspend_common(pc, context_id, SCPI_POWER_OFF, ++ SCPI_POWER_OFF, SCPI_POWER_RETENTION); ++} ++ ++s32 __secure psci_node_hw_state(u32 __always_unused function_id, ++ u32 target_cpu, u32 power_level) ++{ ++ u32 core = MPIDR_AFFLVL0(target_cpu); ++ u8 core_states, cluster_state; ++ ++ if (power_level >= CSS_POWER_LEVEL) ++ return HW_ON; ++ if (scpi_get_css_power_state(target_cpu, &core_states, &cluster_state)) ++ return ARM_PSCI_RET_NI; ++ if (power_level == CLUSTER_POWER_LEVEL) { ++ if (cluster_state == SCPI_POWER_ON) ++ return HW_ON; ++ if (cluster_state < SCPI_POWER_OFF) ++ return HW_STANDBY; ++ return HW_OFF; ++ } ++ ++ return (core_states & BIT(core)) ? HW_ON : HW_OFF; ++} ++ ++s32 __secure psci_system_suspend(u32 __always_unused function_id, ++ u32 pc, u32 context_id) ++{ ++ return psci_suspend_common(pc, context_id, SCPI_POWER_OFF, ++ SCPI_POWER_OFF, SCPI_POWER_OFF); ++} ++ ++s32 __secure psci_system_reset2(u32 __always_unused function_id, ++ u32 reset_type, u32 cookie) ++{ ++ s32 ret; ++ ++ if (reset_type) ++ return ARM_PSCI_RET_INVAL; ++ ++ ret = scpi_set_sys_power_state(SCPI_SYSTEM_RESET); ++ if (ret) ++ return ARM_PSCI_RET_INVAL; ++ ++ /* Wait to be turned off. */ ++ for (;;) wfi(); ++} ++ ++/* ++ * R40 is different from other single cluster SoCs. The secondary core ++ * entry address register is in the SRAM controller address range. ++ */ ++#define SUN8I_R40_SRAMC_SOFT_ENTRY_REG0 (0xbc) ++ ++#ifdef CONFIG_MACH_SUN8I_R40 ++/* secondary core entry address is programmed differently on R40 */ ++static void __secure sunxi_set_entry_address(void *entry) ++{ ++ writel((u32)entry, ++ SUNXI_SRAMC_BASE + SUN8I_R40_SRAMC_SOFT_ENTRY_REG0); ++} ++#else ++static void __secure sunxi_set_entry_address(void *entry) ++{ ++ struct sunxi_cpucfg_reg *cpucfg = ++ (struct sunxi_cpucfg_reg *)SUNXI_CPUCFG_BASE; ++ ++ writel((u32)entry, &cpucfg->priv0); ++ ++#ifdef CONFIG_MACH_SUN8I_H3 ++ /* Redirect CPU 0 to the secure monitor via the resume shim. */ ++ writel(0x16aaefe8, &cpucfg->super_standy_flag); ++ writel(0xaa16efe8, &cpucfg->super_standy_flag); ++ writel(SUNXI_RESUME_BASE, &cpucfg->priv1); ++#endif ++} ++#endif ++ ++void __secure psci_arch_init(void) ++{ ++ static bool __secure_data one_time_init = true; ++ ++ if (one_time_init) { ++ /* Set secondary core power-on PC. */ ++ sunxi_set_entry_address(psci_cpu_entry); ++ ++ /* Wait for the SCP firmware to boot. */ ++ scpi_begin_command(); ++ scpi_wait_response(); ++ scpi_end_command(); ++ ++ one_time_init = false; ++ } ++ ++ /* ++ * Copied from arch/arm/cpu/armv7/virt-v7.c ++ * See also gic_resume() in arch/arm/mach-imx/mx7/psci-mx7.c ++ */ ++ if (gic_dist_init) { ++ u32 i, itlinesnr; ++ ++ /* enable the GIC distributor */ ++ writel(readl(GICD_BASE + GICD_CTLR) | 0x03, GICD_BASE + GICD_CTLR); ++ ++ /* TYPER[4:0] contains an encoded number of available interrupts */ ++ itlinesnr = readl(GICD_BASE + GICD_TYPER) & 0x1f; ++ ++ /* set all bits in the GIC group registers to one to allow access ++ * from non-secure state. The first 32 interrupts are private per ++ * CPU and will be set later when enabling the GIC for each core ++ */ ++ for (i = 1; i <= itlinesnr; i++) ++ writel((unsigned)-1, GICD_BASE + GICD_IGROUPRn + 4 * i); ++ ++ gic_dist_init = false; ++ } ++ ++ /* Be cool with non-secure. */ ++ writel(0xff, GICC_BASE + GICC_PMR); ++} diff --git a/package/boot/uboot-d1/patches/0044-sunxi-Enable-SCP-SCPI-on-A33-as-well.patch b/package/boot/uboot-d1/patches/0044-sunxi-Enable-SCP-SCPI-on-A33-as-well.patch new file mode 100644 index 00000000000000..1c677a449f4d1d --- /dev/null +++ b/package/boot/uboot-d1/patches/0044-sunxi-Enable-SCP-SCPI-on-A33-as-well.patch @@ -0,0 +1,95 @@ +From 5a7a91bf9a78a3a73e26d6de975261e62f9fb127 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Wed, 8 Jun 2022 07:55:54 -0500 +Subject: [PATCH 44/90] sunxi: Enable SCP/SCPI on A33 as well + +Signed-off-by: Samuel Holland +--- + arch/arm/cpu/armv7/Kconfig | 2 +- + arch/arm/cpu/armv7/sunxi/Makefile | 2 +- + arch/arm/cpu/armv7/sunxi/psci-scpi.c | 4 ++++ + arch/arm/dts/sun8i-a23-a33.dtsi | 14 ++++++++++++++ + arch/arm/dts/sunxi-u-boot.dtsi | 4 ++-- + 5 files changed, 22 insertions(+), 4 deletions(-) + +--- a/arch/arm/cpu/armv7/Kconfig ++++ b/arch/arm/cpu/armv7/Kconfig +@@ -75,7 +75,7 @@ config ARMV7_PSCI + choice + prompt "Supported PSCI version" + depends on ARMV7_PSCI +- default ARMV7_PSCI_1_1 if MACH_SUN8I_H3 ++ default ARMV7_PSCI_1_1 if MACH_SUN8I_A33 || MACH_SUN8I_H3 + default ARMV7_PSCI_0_1 if ARCH_SUNXI + default ARMV7_PSCI_1_0 + help +--- a/arch/arm/cpu/armv7/sunxi/Makefile ++++ b/arch/arm/cpu/armv7/sunxi/Makefile +@@ -13,7 +13,7 @@ obj-$(CONFIG_MACH_SUN6I) += sram.o + obj-$(CONFIG_MACH_SUN8I) += sram.o + + ifndef CONFIG_SPL_BUILD +-ifdef CONFIG_MACH_SUN8I_H3 ++ifneq ($(CONFIG_MACH_SUN8I_A33)$(CONFIG_MACH_SUN8I_H3),) + obj-$(CONFIG_ARMV7_PSCI) += psci-scpi.o + else + obj-$(CONFIG_ARMV7_PSCI) += psci.o +--- a/arch/arm/cpu/armv7/sunxi/psci-scpi.c ++++ b/arch/arm/cpu/armv7/sunxi/psci-scpi.c +@@ -24,7 +24,11 @@ + #define MPIDR_AFFLVL0(mpidr) (mpidr & 0xf) + #define MPIDR_AFFLVL1(mpidr) (mpidr >> 8 & 0xf) + ++#if defined(CONFIG_MACH_SUN8I_H3) + #define SCPI_SHMEM_BASE 0x0004be00 ++#else ++#define SCPI_SHMEM_BASE 0x00053e00 ++#endif + #define SCPI_SHMEM ((struct scpi_shmem *)SCPI_SHMEM_BASE) + + #define SCPI_RX_CHANNEL 1 +--- a/arch/arm/dts/sun8i-a23-a33.dtsi ++++ b/arch/arm/dts/sun8i-a23-a33.dtsi +@@ -138,6 +138,14 @@ + #size-cells = <1>; + ranges; + ++ sram_a2: sram@40000 { ++ compatible = "mmio-sram"; ++ reg = <0x00040000 0x14000>; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ranges = <0 0x00040000 0x14000>; ++ }; ++ + sram_c: sram@1d00000 { + compatible = "mmio-sram"; + reg = <0x01d00000 0x80000>; +@@ -847,5 +855,11 @@ + #address-cells = <1>; + #size-cells = <0>; + }; ++ ++ remoteproc@1f01c00 { ++ compatible = "allwinner,sun6i-a31-ar100"; ++ reg = <0x01f01c00 0x400>; ++ sram = <&sram_a2>; ++ }; + }; + }; +--- a/arch/arm/dts/sunxi-u-boot.dtsi ++++ b/arch/arm/dts/sunxi-u-boot.dtsi +@@ -6,11 +6,11 @@ + #define ARCH "arm" + #endif + ++#if defined(CONFIG_ARMV7_PSCI) && (defined(CONFIG_MACH_SUN8I_A33) || defined(CONFIG_MACH_SUN8I_H3)) + #if defined(CONFIG_MACH_SUN8I_H3) +-#ifdef CONFIG_ARMV7_PSCI + #define RESUME_ADDR SUNXI_RESUME_BASE +-#define SCP_ADDR SUNXI_SCP_BASE + #endif ++#define SCP_ADDR SUNXI_SCP_BASE + #elif defined(CONFIG_MACH_SUN50I) || defined(CONFIG_MACH_SUN50I_H5) + #define BL31_ADDR 0x00044000 + #define SCP_ADDR 0x00050000 diff --git a/package/boot/uboot-d1/patches/0045-phy-sun4i-usb-Use-DM_GPIO-for-id-vbus_det-GPIOs.patch b/package/boot/uboot-d1/patches/0045-phy-sun4i-usb-Use-DM_GPIO-for-id-vbus_det-GPIOs.patch new file mode 100644 index 00000000000000..8da5fdb3e1ac71 --- /dev/null +++ b/package/boot/uboot-d1/patches/0045-phy-sun4i-usb-Use-DM_GPIO-for-id-vbus_det-GPIOs.patch @@ -0,0 +1,216 @@ +From afa281decfbb174f57341897e0ad50ee9ad3564f Mon Sep 17 00:00:00 2001 +From: Zoltan HERPAI +Date: Tue, 6 Jun 2023 17:59:24 +0000 +Subject: [PATCH 45/90] phy: sun4i-usb: Use DM_GPIO for id/vbus_det GPIOs + +Now that the sunxi_gpio driver handles pull-up/down via the driver +model, we can switch to DM_GPIO for these pins with no loss in +functionality. Since the driver now gets its pin configuration from +the device tree, we can remove the Kconfig symbols. + +Signed-off-by: Samuel Holland + +Signed-off-by: Zoltan HERPAI +--- + arch/arm/dts/sun5i-a13-ampe-a76.dts | 6 ++ + .../sun6i-a31s-yones-toptech-bs1078-v2.dts | 1 + + arch/arm/dts/sun8i-a33-sinlinx-sina33.dts | 1 + + arch/arm/mach-sunxi/Kconfig | 14 ---- + drivers/phy/allwinner/phy-sun4i-usb.c | 71 ++++--------------- + 5 files changed, 22 insertions(+), 71 deletions(-) + +--- a/arch/arm/dts/sun5i-a13-ampe-a76.dts ++++ b/arch/arm/dts/sun5i-a13-ampe-a76.dts +@@ -8,6 +8,8 @@ + /dts-v1/; + #include "sun5i-a13.dtsi" + ++#include ++ + / { + model = "Ampe A76"; + compatible = "ampe,a76", "allwinner,sun5i-a13"; +@@ -26,3 +28,7 @@ + pinctrl-0 = <&uart1_pg_pins>; + status = "okay"; + }; ++ ++&usbphy { ++ usb0_id_det-gpios = <&pio 6 2 GPIO_ACTIVE_HIGH>; /* PG2 */ ++}; +--- a/arch/arm/dts/sun6i-a31s-yones-toptech-bs1078-v2.dts ++++ b/arch/arm/dts/sun6i-a31s-yones-toptech-bs1078-v2.dts +@@ -176,6 +176,7 @@ + }; + + &usbphy { ++ usb0_id_det-gpios = <&pio 0 15 GPIO_ACTIVE_HIGH>; /* PA15 */ + usb1_vbus-supply = <®_dldo1>; + usb2_vbus-supply = <®_dc1sw>; + status = "okay"; +--- a/arch/arm/dts/sun8i-a33-sinlinx-sina33.dts ++++ b/arch/arm/dts/sun8i-a33-sinlinx-sina33.dts +@@ -271,5 +271,6 @@ + + &usbphy { + status = "okay"; ++ usb0_id_det-gpios = <&pio 7 8 GPIO_ACTIVE_HIGH>; /* PH8 */ + usb1_vbus-supply = <®_vcc5v0>; /* USB1 VBUS is always on */ + }; +--- a/arch/arm/mach-sunxi/Kconfig ++++ b/arch/arm/mach-sunxi/Kconfig +@@ -655,20 +655,6 @@ config MMC_SUNXI_SLOT_EXTRA + slot or emmc on mmc1 - mmc3. Setting this to 1, 2 or 3 will enable + support for this. + +-config USB0_VBUS_DET +- string "Vbus detect pin for usb0 (otg)" +- default "" +- ---help--- +- Set the Vbus detect pin for usb0 (otg). This takes a string in the +- format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H. +- +-config USB0_ID_DET +- string "ID detect pin for usb0 (otg)" +- default "" +- ---help--- +- Set the ID detect pin for usb0 (otg). This takes a string in the +- format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H. +- + config I2C0_ENABLE + bool "Enable I2C/TWI controller 0" + default y if MACH_SUN4I || MACH_SUN5I || MACH_SUN7I || MACH_SUN8I_R40 +--- a/drivers/phy/allwinner/phy-sun4i-usb.c ++++ b/drivers/phy/allwinner/phy-sun4i-usb.c +@@ -96,32 +96,8 @@ struct sun4i_usb_phy_cfg { + int missing_phys; + }; + +-struct sun4i_usb_phy_info { +- const char *gpio_vbus_det; +- const char *gpio_id_det; +-} phy_info[] = { +- { +- .gpio_vbus_det = CONFIG_USB0_VBUS_DET, +- .gpio_id_det = CONFIG_USB0_ID_DET, +- }, +- { +- .gpio_vbus_det = NULL, +- .gpio_id_det = NULL, +- }, +- { +- .gpio_vbus_det = NULL, +- .gpio_id_det = NULL, +- }, +- { +- .gpio_vbus_det = NULL, +- .gpio_id_det = NULL, +- }, +-}; +- + struct sun4i_usb_phy_plat { + void __iomem *pmu; +- struct gpio_desc gpio_vbus_det; +- struct gpio_desc gpio_id_det; + struct clk clocks; + struct reset_ctl resets; + struct udevice *vbus; +@@ -132,6 +108,8 @@ struct sun4i_usb_phy_data { + void __iomem *base; + const struct sun4i_usb_phy_cfg *cfg; + struct sun4i_usb_phy_plat *usb_phy; ++ struct gpio_desc id_det_gpio; ++ struct gpio_desc vbus_det_gpio; + struct udevice *vbus_power_supply; + }; + +@@ -393,11 +371,10 @@ static int sun4i_usb_phy_xlate(struct ph + int sun4i_usb_phy_vbus_detect(struct phy *phy) + { + struct sun4i_usb_phy_data *data = dev_get_priv(phy->dev); +- struct sun4i_usb_phy_plat *usb_phy = &data->usb_phy[phy->id]; + int err = 1, retries = 3; + +- if (dm_gpio_is_valid(&usb_phy->gpio_vbus_det)) { +- err = dm_gpio_get_value(&usb_phy->gpio_vbus_det); ++ if (dm_gpio_is_valid(&data->vbus_det_gpio)) { ++ err = dm_gpio_get_value(&data->vbus_det_gpio); + /* + * Vbus may have been provided by the board and just turned off + * some milliseconds ago on reset. What we're measuring then is +@@ -405,7 +382,7 @@ int sun4i_usb_phy_vbus_detect(struct phy + */ + while (err > 0 && retries--) { + mdelay(100); +- err = dm_gpio_get_value(&usb_phy->gpio_vbus_det); ++ err = dm_gpio_get_value(&data->vbus_det_gpio); + } + } else if (data->vbus_power_supply) { + err = regulator_get_enable(data->vbus_power_supply); +@@ -417,12 +394,11 @@ int sun4i_usb_phy_vbus_detect(struct phy + int sun4i_usb_phy_id_detect(struct phy *phy) + { + struct sun4i_usb_phy_data *data = dev_get_priv(phy->dev); +- struct sun4i_usb_phy_plat *usb_phy = &data->usb_phy[phy->id]; + +- if (!dm_gpio_is_valid(&usb_phy->gpio_id_det)) +- return -1; ++ if (!dm_gpio_is_valid(&data->id_det_gpio)) ++ return -EOPNOTSUPP; + +- return dm_gpio_get_value(&usb_phy->gpio_id_det); ++ return dm_gpio_get_value(&data->id_det_gpio); + } + + void sun4i_usb_phy_set_squelch_detect(struct phy *phy, bool enabled) +@@ -452,13 +428,18 @@ static int sun4i_usb_phy_probe(struct ud + if (IS_ERR(data->base)) + return PTR_ERR(data->base); + ++ gpio_request_by_name(dev, "usb0_id_det-gpios", 0, &data->id_det_gpio, ++ GPIOD_IS_IN | GPIOD_PULL_UP); ++ ++ gpio_request_by_name(dev, "usb0_vbus_det-gpios", 0, &data->vbus_det_gpio, ++ GPIOD_IS_IN); ++ + device_get_supply_regulator(dev, "usb0_vbus_power-supply", + &data->vbus_power_supply); + + data->usb_phy = plat; + for (i = 0; i < data->cfg->num_phys; i++) { + struct sun4i_usb_phy_plat *phy = &plat[i]; +- struct sun4i_usb_phy_info *info = &phy_info[i]; + char name[20]; + + if (data->cfg->missing_phys & BIT(i)) +@@ -472,30 +453,6 @@ static int sun4i_usb_phy_probe(struct ud + return ret; + } + +- ret = dm_gpio_lookup_name(info->gpio_vbus_det, +- &phy->gpio_vbus_det); +- if (ret == 0) { +- ret = dm_gpio_request(&phy->gpio_vbus_det, +- "usb_vbus_det"); +- if (ret) +- return ret; +- ret = dm_gpio_set_dir_flags(&phy->gpio_vbus_det, +- GPIOD_IS_IN); +- if (ret) +- return ret; +- } +- +- ret = dm_gpio_lookup_name(info->gpio_id_det, &phy->gpio_id_det); +- if (ret == 0) { +- ret = dm_gpio_request(&phy->gpio_id_det, "usb_id_det"); +- if (ret) +- return ret; +- ret = dm_gpio_set_dir_flags(&phy->gpio_id_det, +- GPIOD_IS_IN | GPIOD_PULL_UP); +- if (ret) +- return ret; +- } +- + if (data->cfg->dedicated_clocks) + snprintf(name, sizeof(name), "usb%d_phy", i); + else diff --git a/package/boot/uboot-d1/patches/0046-ARM-dts-sunxi-Add-AXP221-and-AXP809-GPIO-nodes.patch b/package/boot/uboot-d1/patches/0046-ARM-dts-sunxi-Add-AXP221-and-AXP809-GPIO-nodes.patch new file mode 100644 index 00000000000000..97b421eb9d1159 --- /dev/null +++ b/package/boot/uboot-d1/patches/0046-ARM-dts-sunxi-Add-AXP221-and-AXP809-GPIO-nodes.patch @@ -0,0 +1,45 @@ +From 9e34036e651528df9575c2ffb38d78ae1f613481 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sat, 21 Aug 2021 17:11:54 -0500 +Subject: [PATCH 46/90] ARM: dts: sunxi: Add AXP221 and AXP809 GPIO nodes + +These PMICs each have two GPIO pins, and are supported by the axp_gpio +driver. In order to convert the axp_gpio driver to probe using the +device tree, the corresponding device tree nodes must be present. Add +them, following the same binding as the AXP209 and AXP813. + +Signed-off-by: Samuel Holland +--- + arch/arm/dts/axp22x.dtsi | 6 ++++++ + arch/arm/dts/axp809.dtsi | 7 +++++++ + 2 files changed, 13 insertions(+) + +--- a/arch/arm/dts/axp22x.dtsi ++++ b/arch/arm/dts/axp22x.dtsi +@@ -67,6 +67,12 @@ + status = "disabled"; + }; + ++ axp_gpio: gpio { ++ compatible = "x-powers,axp221-gpio"; ++ gpio-controller; ++ #gpio-cells = <2>; ++ }; ++ + regulators { + /* Default work frequency for buck regulators */ + x-powers,dcdc-freq = <3000>; +--- a/arch/arm/dts/axp809.dtsi ++++ b/arch/arm/dts/axp809.dtsi +@@ -50,4 +50,11 @@ + compatible = "x-powers,axp809"; + interrupt-controller; + #interrupt-cells = <1>; ++ ++ axp_gpio: gpio { ++ compatible = "x-powers,axp809-gpio", ++ "x-powers,axp221-gpio"; ++ gpio-controller; ++ #gpio-cells = <2>; ++ }; + }; diff --git a/package/boot/uboot-d1/patches/0047-gpio-axp-Consistently-use-the-axp_gpio-order.patch b/package/boot/uboot-d1/patches/0047-gpio-axp-Consistently-use-the-axp_gpio-order.patch new file mode 100644 index 00000000000000..2deaadd584b3e2 --- /dev/null +++ b/package/boot/uboot-d1/patches/0047-gpio-axp-Consistently-use-the-axp_gpio-order.patch @@ -0,0 +1,58 @@ +From 7e85c2d6516e47b537b27132d1946d1eab3b8923 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Fri, 27 Aug 2021 17:39:36 -0500 +Subject: [PATCH 47/90] gpio: axp: Consistently use the "axp_gpio" order + +This is less confusing than half of the driver using "axp_gpio" and the +other half using "gpio_axp". + +Signed-off-by: Samuel Holland +--- + drivers/gpio/axp_gpio.c | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +--- a/drivers/gpio/axp_gpio.c ++++ b/drivers/gpio/axp_gpio.c +@@ -89,14 +89,14 @@ static int axp_gpio_set_value(struct ude + AXP_GPIO_CTRL_OUTPUT_LOW); + } + +-static const struct dm_gpio_ops gpio_axp_ops = { ++static const struct dm_gpio_ops axp_gpio_ops = { + .direction_input = axp_gpio_direction_input, + .direction_output = axp_gpio_direction_output, + .get_value = axp_gpio_get_value, + .set_value = axp_gpio_set_value, + }; + +-static int gpio_axp_probe(struct udevice *dev) ++static int axp_gpio_probe(struct udevice *dev) + { + struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); + +@@ -107,11 +107,11 @@ static int gpio_axp_probe(struct udevice + return 0; + } + +-U_BOOT_DRIVER(gpio_axp) = { +- .name = "gpio_axp", +- .id = UCLASS_GPIO, +- .ops = &gpio_axp_ops, +- .probe = gpio_axp_probe, ++U_BOOT_DRIVER(axp_gpio) = { ++ .name = "axp_gpio", ++ .id = UCLASS_GPIO, ++ .probe = axp_gpio_probe, ++ .ops = &axp_gpio_ops, + }; + + int axp_gpio_init(void) +@@ -124,7 +124,7 @@ int axp_gpio_init(void) + return ret; + + /* There is no devicetree support for the axp yet, so bind directly */ +- ret = device_bind_driver(dm_root(), "gpio_axp", "AXP-gpio", &dev); ++ ret = device_bind_driver(dm_root(), "axp_gpio", "AXP-gpio", &dev); + if (ret) + return ret; + diff --git a/package/boot/uboot-d1/patches/0048-gpio-axp-Bind-via-device-tree.patch b/package/boot/uboot-d1/patches/0048-gpio-axp-Bind-via-device-tree.patch new file mode 100644 index 00000000000000..dbc61875d2cb77 --- /dev/null +++ b/package/boot/uboot-d1/patches/0048-gpio-axp-Bind-via-device-tree.patch @@ -0,0 +1,139 @@ +From a39b1bd1ad0babb355a5cb6f6a3bd8e378433b54 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Fri, 27 Aug 2021 21:43:19 -0500 +Subject: [PATCH 48/90] gpio: axp: Bind via device tree + +Now that the PMIC has a DM driver and binds device tree subnodes, the +GPIO device can be bound that way, instead of from inside board code. + +Since the driver still uses the single set of register definitions from +axpXXX.h (as selected by AXPxxx_POWER), it does not differentiate among +the supported compatibles. + +Signed-off-by: Samuel Holland +--- + arch/arm/include/asm/arch-sunxi/gpio.h | 6 ----- + arch/arm/mach-sunxi/Kconfig | 6 ----- + board/sunxi/board.c | 4 --- + drivers/gpio/Kconfig | 8 ++++++ + drivers/gpio/axp_gpio.c | 34 +++++++++++--------------- + 5 files changed, 22 insertions(+), 36 deletions(-) + +--- a/arch/arm/include/asm/arch-sunxi/gpio.h ++++ b/arch/arm/include/asm/arch-sunxi/gpio.h +@@ -219,10 +219,4 @@ void sunxi_gpio_set_pull(u32 pin, u32 va + void sunxi_gpio_set_pull_bank(struct sunxi_gpio *pio, int bank_offset, u32 val); + int sunxi_name_to_gpio(const char *name); + +-#if !defined CONFIG_SPL_BUILD && defined CONFIG_AXP_GPIO +-int axp_gpio_init(void); +-#else +-static inline int axp_gpio_init(void) { return 0; } +-#endif +- + #endif /* _SUNXI_GPIO_H */ +--- a/arch/arm/mach-sunxi/Kconfig ++++ b/arch/arm/mach-sunxi/Kconfig +@@ -682,12 +682,6 @@ config R_I2C_ENABLE + Set this to y to enable the I2C controller which is part of the PRCM. + endif + +-config AXP_GPIO +- bool "Enable support for gpio-s on axp PMICs" +- depends on AXP_PMIC_BUS +- ---help--- +- Say Y here to enable support for the gpio pins of the axp PMIC ICs. +- + config AXP_DISABLE_BOOT_ON_POWERON + bool "Disable device boot on power plug-in" + depends on AXP209_POWER || AXP221_POWER || AXP809_POWER || AXP818_POWER +--- a/board/sunxi/board.c ++++ b/board/sunxi/board.c +@@ -221,10 +221,6 @@ int board_init(void) + } + #endif /* !CONFIG_ARM64 && !CONFIG_MACH_SUNIV */ + +- ret = axp_gpio_init(); +- if (ret) +- return ret; +- + /* strcmp() would look better, but doesn't get optimised away. */ + if (CONFIG_SATAPWR[0]) { + satapwr_pin = sunxi_name_to_gpio(CONFIG_SATAPWR); +--- a/drivers/gpio/Kconfig ++++ b/drivers/gpio/Kconfig +@@ -104,6 +104,14 @@ config ALTERA_PIO + Select this to enable PIO for Altera devices. Please find + details on the "Embedded Peripherals IP User Guide" of Altera. + ++config AXP_GPIO ++ bool "X-Powers AXP PMICs GPIO driver" ++ depends on DM_GPIO && PMIC_AXP ++ depends on AXP_PMIC_BUS ++ help ++ This driver supports the GPIO pins on ++ X-Powers AXP152, AXP2xx, and AXP8xx PMICs. ++ + config BCM2835_GPIO + bool "BCM2835 GPIO driver" + depends on DM_GPIO +--- a/drivers/gpio/axp_gpio.c ++++ b/drivers/gpio/axp_gpio.c +@@ -10,9 +10,6 @@ + #include + #include + #include +-#include +-#include +-#include + #include + + #define AXP_GPIO_PREFIX "AXP0-" +@@ -99,6 +96,11 @@ static const struct dm_gpio_ops axp_gpio + static int axp_gpio_probe(struct udevice *dev) + { + struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); ++ int ret; ++ ++ ret = pmic_bus_init(); ++ if (ret) ++ return ret; + + /* Tell the uclass how many GPIOs we have */ + uc_priv->bank_name = AXP_GPIO_PREFIX; +@@ -107,26 +109,18 @@ static int axp_gpio_probe(struct udevice + return 0; + } + ++static const struct udevice_id axp_gpio_ids[] = { ++ { .compatible = "x-powers,axp152-gpio" }, ++ { .compatible = "x-powers,axp209-gpio" }, ++ { .compatible = "x-powers,axp221-gpio" }, ++ { .compatible = "x-powers,axp813-gpio" }, ++ { } ++}; ++ + U_BOOT_DRIVER(axp_gpio) = { + .name = "axp_gpio", + .id = UCLASS_GPIO, ++ .of_match = axp_gpio_ids, + .probe = axp_gpio_probe, + .ops = &axp_gpio_ops, + }; +- +-int axp_gpio_init(void) +-{ +- struct udevice *dev; +- int ret; +- +- ret = pmic_bus_init(); +- if (ret) +- return ret; +- +- /* There is no devicetree support for the axp yet, so bind directly */ +- ret = device_bind_driver(dm_root(), "axp_gpio", "AXP-gpio", &dev); +- if (ret) +- return ret; +- +- return 0; +-} diff --git a/package/boot/uboot-d1/patches/0049-gpio-axp-Use-DM_PMIC-functions-for-register-access.patch b/package/boot/uboot-d1/patches/0049-gpio-axp-Use-DM_PMIC-functions-for-register-access.patch new file mode 100644 index 00000000000000..c95e81ac4630ca --- /dev/null +++ b/package/boot/uboot-d1/patches/0049-gpio-axp-Use-DM_PMIC-functions-for-register-access.patch @@ -0,0 +1,99 @@ +From 532b81ac600b6a70a1421f86503cb6d8543edf1b Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Tue, 17 Aug 2021 20:01:55 -0500 +Subject: [PATCH 49/90] gpio: axp: Use DM_PMIC functions for register access + +Now that the PMIC driver implements the DM_PMIC uclass, those functions +can be used instead of the platform-specific "pmic_bus" functions. + +Since the driver still uses the single set of register definitions from +axpXXX.h (as selected by AXPxxx_POWER), it still depends on one of those +choices, and therefore also AXP_PMIC_BUS. + +Signed-off-by: Samuel Holland +--- + drivers/gpio/axp_gpio.c | 27 ++++++++++++--------------- + 1 file changed, 12 insertions(+), 15 deletions(-) + +--- a/drivers/gpio/axp_gpio.c ++++ b/drivers/gpio/axp_gpio.c +@@ -6,11 +6,11 @@ + */ + + #include +-#include + #include + #include + #include + #include ++#include + + #define AXP_GPIO_PREFIX "AXP0-" + #define AXP_GPIO_COUNT 4 +@@ -40,7 +40,7 @@ static int axp_gpio_direction_input(stru + if (reg == 0) + return -EINVAL; + +- return pmic_bus_write(reg, AXP_GPIO_CTRL_INPUT); ++ return pmic_reg_write(dev->parent, reg, AXP_GPIO_CTRL_INPUT); + } + + static int axp_gpio_direction_output(struct udevice *dev, unsigned pin, +@@ -52,26 +52,27 @@ static int axp_gpio_direction_output(str + if (reg == 0) + return -EINVAL; + +- return pmic_bus_write(reg, val ? AXP_GPIO_CTRL_OUTPUT_HIGH : +- AXP_GPIO_CTRL_OUTPUT_LOW); ++ return pmic_reg_write(dev->parent, reg, ++ val ? AXP_GPIO_CTRL_OUTPUT_HIGH : ++ AXP_GPIO_CTRL_OUTPUT_LOW); + } + + static int axp_gpio_get_value(struct udevice *dev, unsigned pin) + { +- u8 reg, val, mask; ++ u8 reg, mask; + int ret; + + reg = axp_get_gpio_ctrl_reg(pin); + if (reg == 0) + return -EINVAL; + +- ret = pmic_bus_read(AXP_GPIO_STATE, &val); +- if (ret) ++ ret = pmic_reg_read(dev->parent, AXP_GPIO_STATE); ++ if (ret < 0) + return ret; + + mask = 1 << (pin + AXP_GPIO_STATE_OFFSET); + +- return (val & mask) ? 1 : 0; ++ return (ret & mask) ? 1 : 0; + } + + static int axp_gpio_set_value(struct udevice *dev, unsigned pin, int val) +@@ -82,8 +83,9 @@ static int axp_gpio_set_value(struct ude + if (reg == 0) + return -EINVAL; + +- return pmic_bus_write(reg, val ? AXP_GPIO_CTRL_OUTPUT_HIGH : +- AXP_GPIO_CTRL_OUTPUT_LOW); ++ return pmic_reg_write(dev->parent, reg, ++ val ? AXP_GPIO_CTRL_OUTPUT_HIGH : ++ AXP_GPIO_CTRL_OUTPUT_LOW); + } + + static const struct dm_gpio_ops axp_gpio_ops = { +@@ -96,11 +98,6 @@ static const struct dm_gpio_ops axp_gpio + static int axp_gpio_probe(struct udevice *dev) + { + struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); +- int ret; +- +- ret = pmic_bus_init(); +- if (ret) +- return ret; + + /* Tell the uclass how many GPIOs we have */ + uc_priv->bank_name = AXP_GPIO_PREFIX; diff --git a/package/boot/uboot-d1/patches/0050-gpio-axp-Select-variant-from-compatible-at-runtime.patch b/package/boot/uboot-d1/patches/0050-gpio-axp-Select-variant-from-compatible-at-runtime.patch new file mode 100644 index 00000000000000..c4dfcc94a67fb1 --- /dev/null +++ b/package/boot/uboot-d1/patches/0050-gpio-axp-Select-variant-from-compatible-at-runtime.patch @@ -0,0 +1,375 @@ +From 697eb56ed8c9b3814ddbd87ae0c6e749ccafc9e3 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sat, 28 Aug 2021 00:27:19 -0500 +Subject: [PATCH 50/90] gpio: axp: Select variant from compatible at runtime + +There are three major variants of the AXP PMIC GPIO functionality (plus +PMICs with no GPIOs at all). Except for GPIO3 on the AXP209, which uses +a different register layout, it is straightforward to support all three +variants with a single driver. Do this, and in the process remove the +GPIO-related definitions from the PMIC-specific headers, and therefore +the dependency on AXP_PMIC_BUS. + +Signed-off-by: Samuel Holland +--- + drivers/gpio/Kconfig | 1 - + drivers/gpio/axp_gpio.c | 137 +++++++++++++++++++++------------------- + drivers/power/axp209.c | 6 +- + drivers/power/axp221.c | 4 +- + include/axp152.h | 10 --- + include/axp209.h | 16 ++--- + include/axp221.h | 13 ++-- + include/axp809.h | 8 --- + include/axp818.h | 8 --- + 9 files changed, 89 insertions(+), 114 deletions(-) + +--- a/drivers/gpio/Kconfig ++++ b/drivers/gpio/Kconfig +@@ -107,7 +107,6 @@ config ALTERA_PIO + config AXP_GPIO + bool "X-Powers AXP PMICs GPIO driver" + depends on DM_GPIO && PMIC_AXP +- depends on AXP_PMIC_BUS + help + This driver supports the GPIO pins on + X-Powers AXP152, AXP2xx, and AXP8xx PMICs. +--- a/drivers/gpio/axp_gpio.c ++++ b/drivers/gpio/axp_gpio.c +@@ -7,110 +7,117 @@ + + #include + #include +-#include + #include ++#include + #include + #include + + #define AXP_GPIO_PREFIX "AXP0-" + #define AXP_GPIO_COUNT 4 + +-static int axp_gpio_set_value(struct udevice *dev, unsigned pin, int val); +- +-static u8 axp_get_gpio_ctrl_reg(unsigned pin) +-{ +- switch (pin) { +- case 0: return AXP_GPIO0_CTRL; +- case 1: return AXP_GPIO1_CTRL; +-#ifdef AXP_GPIO2_CTRL +- case 2: return AXP_GPIO2_CTRL; +-#endif +-#ifdef AXP_GPIO3_CTRL +- case 3: return AXP_GPIO3_CTRL; +-#endif +- } +- return 0; +-} +- +-static int axp_gpio_direction_input(struct udevice *dev, unsigned pin) +-{ +- u8 reg; +- +- reg = axp_get_gpio_ctrl_reg(pin); +- if (reg == 0) +- return -EINVAL; +- +- return pmic_reg_write(dev->parent, reg, AXP_GPIO_CTRL_INPUT); +-} +- +-static int axp_gpio_direction_output(struct udevice *dev, unsigned pin, +- int val) +-{ +- u8 reg; +- +- reg = axp_get_gpio_ctrl_reg(pin); +- if (reg == 0) +- return -EINVAL; +- +- return pmic_reg_write(dev->parent, reg, +- val ? AXP_GPIO_CTRL_OUTPUT_HIGH : +- AXP_GPIO_CTRL_OUTPUT_LOW); +-} ++#define AXP_GPIO_CTRL_MASK 0x7 ++#define AXP_GPIO_CTRL_OUTPUT_LOW 0 ++#define AXP_GPIO_CTRL_OUTPUT_HIGH 1 ++ ++struct axp_gpio_desc { ++ const u8 *pins; ++ u8 npins; ++ u8 status_reg; ++ u8 status_offset; ++ u8 input_mux; ++}; + + static int axp_gpio_get_value(struct udevice *dev, unsigned pin) + { +- u8 reg, mask; ++ const struct axp_gpio_desc *desc = dev_get_priv(dev); + int ret; + +- reg = axp_get_gpio_ctrl_reg(pin); +- if (reg == 0) +- return -EINVAL; +- +- ret = pmic_reg_read(dev->parent, AXP_GPIO_STATE); ++ ret = pmic_reg_read(dev->parent, desc->status_reg); + if (ret < 0) + return ret; + +- mask = 1 << (pin + AXP_GPIO_STATE_OFFSET); +- +- return (ret & mask) ? 1 : 0; ++ return !!(ret & BIT(desc->status_offset + pin)); + } + +-static int axp_gpio_set_value(struct udevice *dev, unsigned pin, int val) ++static int axp_gpio_set_flags(struct udevice *dev, unsigned pin, ulong flags) + { +- u8 reg; ++ const struct axp_gpio_desc *desc = dev_get_priv(dev); ++ u8 mux; + +- reg = axp_get_gpio_ctrl_reg(pin); +- if (reg == 0) ++ if (flags & (GPIOD_MASK_DSTYPE | GPIOD_MASK_PULL)) + return -EINVAL; + +- return pmic_reg_write(dev->parent, reg, +- val ? AXP_GPIO_CTRL_OUTPUT_HIGH : +- AXP_GPIO_CTRL_OUTPUT_LOW); ++ if (flags & GPIOD_IS_IN) ++ mux = desc->input_mux; ++ else if (flags & GPIOD_IS_OUT_ACTIVE) ++ mux = AXP_GPIO_CTRL_OUTPUT_HIGH; ++ else ++ mux = AXP_GPIO_CTRL_OUTPUT_LOW; ++ ++ return pmic_clrsetbits(dev->parent, desc->pins[pin], ++ AXP_GPIO_CTRL_MASK, mux); + } + + static const struct dm_gpio_ops axp_gpio_ops = { +- .direction_input = axp_gpio_direction_input, +- .direction_output = axp_gpio_direction_output, + .get_value = axp_gpio_get_value, +- .set_value = axp_gpio_set_value, ++ .xlate = gpio_xlate_offs_flags, ++ .set_flags = axp_gpio_set_flags, + }; + + static int axp_gpio_probe(struct udevice *dev) + { ++ struct axp_gpio_desc *desc = (void *)dev_get_driver_data(dev); + struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev); + ++ dev_set_priv(dev, desc); ++ + /* Tell the uclass how many GPIOs we have */ + uc_priv->bank_name = AXP_GPIO_PREFIX; +- uc_priv->gpio_count = AXP_GPIO_COUNT; ++ uc_priv->gpio_count = desc->npins; + + return 0; + } + ++static const u8 axp152_gpio_pins[] = { ++ 0x90, 0x91, 0x92, 0x93, ++}; ++ ++static const struct axp_gpio_desc axp152_gpio_desc = { ++ .pins = axp152_gpio_pins, ++ .npins = ARRAY_SIZE(axp152_gpio_pins), ++ .status_reg = 0x97, ++ .status_offset = 4, ++ .input_mux = 3, ++}; ++ ++static const u8 axp209_gpio_pins[] = { ++ 0x90, 0x92, 0x93, ++}; ++ ++static const struct axp_gpio_desc axp209_gpio_desc = { ++ .pins = axp209_gpio_pins, ++ .npins = ARRAY_SIZE(axp209_gpio_pins), ++ .status_reg = 0x94, ++ .status_offset = 4, ++ .input_mux = 2, ++}; ++ ++static const u8 axp221_gpio_pins[] = { ++ 0x90, 0x92, ++}; ++ ++static const struct axp_gpio_desc axp221_gpio_desc = { ++ .pins = axp221_gpio_pins, ++ .npins = ARRAY_SIZE(axp221_gpio_pins), ++ .status_reg = 0x94, ++ .input_mux = 2, ++}; ++ + static const struct udevice_id axp_gpio_ids[] = { +- { .compatible = "x-powers,axp152-gpio" }, +- { .compatible = "x-powers,axp209-gpio" }, +- { .compatible = "x-powers,axp221-gpio" }, +- { .compatible = "x-powers,axp813-gpio" }, ++ { .compatible = "x-powers,axp152-gpio", .data = (ulong)&axp152_gpio_desc }, ++ { .compatible = "x-powers,axp209-gpio", .data = (ulong)&axp209_gpio_desc }, ++ { .compatible = "x-powers,axp221-gpio", .data = (ulong)&axp221_gpio_desc }, ++ { .compatible = "x-powers,axp813-gpio", .data = (ulong)&axp221_gpio_desc }, + { } + }; + +--- a/drivers/power/axp209.c ++++ b/drivers/power/axp209.c +@@ -215,15 +215,15 @@ int axp_init(void) + * Turn off LDOIO regulators / tri-state GPIO pins, when rebooting + * from android these are sometimes on. + */ +- rc = pmic_bus_write(AXP_GPIO0_CTRL, AXP_GPIO_CTRL_INPUT); ++ rc = pmic_bus_write(AXP209_GPIO0_CTRL, AXP209_GPIO_CTRL_INPUT); + if (rc) + return rc; + +- rc = pmic_bus_write(AXP_GPIO1_CTRL, AXP_GPIO_CTRL_INPUT); ++ rc = pmic_bus_write(AXP209_GPIO1_CTRL, AXP209_GPIO_CTRL_INPUT); + if (rc) + return rc; + +- rc = pmic_bus_write(AXP_GPIO2_CTRL, AXP_GPIO_CTRL_INPUT); ++ rc = pmic_bus_write(AXP209_GPIO2_CTRL, AXP209_GPIO_CTRL_INPUT); + if (rc) + return rc; + +--- a/drivers/power/axp221.c ++++ b/drivers/power/axp221.c +@@ -226,11 +226,11 @@ int axp_init(void) + * Turn off LDOIO regulators / tri-state GPIO pins, when rebooting + * from android these are sometimes on. + */ +- ret = pmic_bus_write(AXP_GPIO0_CTRL, AXP_GPIO_CTRL_INPUT); ++ ret = pmic_bus_write(AXP221_GPIO0_CTRL, AXP221_GPIO_CTRL_INPUT); + if (ret) + return ret; + +- ret = pmic_bus_write(AXP_GPIO1_CTRL, AXP_GPIO_CTRL_INPUT); ++ ret = pmic_bus_write(AXP221_GPIO1_CTRL, AXP221_GPIO_CTRL_INPUT); + if (ret) + return ret; + +--- a/include/axp152.h ++++ b/include/axp152.h +@@ -14,17 +14,7 @@ enum axp152_reg { + + #define AXP152_POWEROFF (1 << 7) + +-/* For axp_gpio.c */ + #ifdef CONFIG_AXP152_POWER + #define AXP_POWER_STATUS 0x00 + #define AXP_POWER_STATUS_ALDO_IN BIT(0) +-#define AXP_GPIO0_CTRL 0x90 +-#define AXP_GPIO1_CTRL 0x91 +-#define AXP_GPIO2_CTRL 0x92 +-#define AXP_GPIO3_CTRL 0x93 +-#define AXP_GPIO_CTRL_OUTPUT_LOW 0x00 /* Drive pin low */ +-#define AXP_GPIO_CTRL_OUTPUT_HIGH 0x01 /* Drive pin high */ +-#define AXP_GPIO_CTRL_INPUT 0x02 /* Input */ +-#define AXP_GPIO_STATE 0x97 +-#define AXP_GPIO_STATE_OFFSET 0 + #endif +--- a/include/axp209.h ++++ b/include/axp209.h +@@ -21,6 +21,9 @@ enum axp209_reg { + AXP209_IRQ_ENABLE5 = 0x44, + AXP209_IRQ_STATUS5 = 0x4c, + AXP209_SHUTDOWN = 0x32, ++ AXP209_GPIO0_CTRL = 0x90, ++ AXP209_GPIO1_CTRL = 0x92, ++ AXP209_GPIO2_CTRL = 0x93, + }; + + #define AXP209_POWER_STATUS_ON_BY_DC BIT(0) +@@ -73,16 +76,11 @@ enum axp209_reg { + + #define AXP209_POWEROFF BIT(7) + +-/* For axp_gpio.c */ ++#define AXP209_GPIO_CTRL_OUTPUT_LOW 0x00 ++#define AXP209_GPIO_CTRL_OUTPUT_HIGH 0x01 ++#define AXP209_GPIO_CTRL_INPUT 0x02 ++ + #ifdef CONFIG_AXP209_POWER + #define AXP_POWER_STATUS 0x00 + #define AXP_POWER_STATUS_ALDO_IN BIT(0) +-#define AXP_GPIO0_CTRL 0x90 +-#define AXP_GPIO1_CTRL 0x92 +-#define AXP_GPIO2_CTRL 0x93 +-#define AXP_GPIO_CTRL_OUTPUT_LOW 0x00 /* Drive pin low */ +-#define AXP_GPIO_CTRL_OUTPUT_HIGH 0x01 /* Drive pin high */ +-#define AXP_GPIO_CTRL_INPUT 0x02 /* Input */ +-#define AXP_GPIO_STATE 0x94 +-#define AXP_GPIO_STATE_OFFSET 4 + #endif +--- a/include/axp221.h ++++ b/include/axp221.h +@@ -44,20 +44,17 @@ + #define AXP221_ALDO3_CTRL 0x2a + #define AXP221_SHUTDOWN 0x32 + #define AXP221_SHUTDOWN_POWEROFF (1 << 7) ++#define AXP221_GPIO0_CTRL 0x90 ++#define AXP221_GPIO1_CTRL 0x92 ++#define AXP221_GPIO_CTRL_OUTPUT_LOW 0x00 ++#define AXP221_GPIO_CTRL_OUTPUT_HIGH 0x01 ++#define AXP221_GPIO_CTRL_INPUT 0x02 + #define AXP221_PAGE 0xff + + /* Page 1 addresses */ + #define AXP221_SID 0x20 + +-/* For axp_gpio.c */ + #ifdef CONFIG_AXP221_POWER + #define AXP_POWER_STATUS 0x00 + #define AXP_POWER_STATUS_ALDO_IN BIT(0) +-#define AXP_GPIO0_CTRL 0x90 +-#define AXP_GPIO1_CTRL 0x92 +-#define AXP_GPIO_CTRL_OUTPUT_LOW 0x00 /* Drive pin low */ +-#define AXP_GPIO_CTRL_OUTPUT_HIGH 0x01 /* Drive pin high */ +-#define AXP_GPIO_CTRL_INPUT 0x02 /* Input */ +-#define AXP_GPIO_STATE 0x94 +-#define AXP_GPIO_STATE_OFFSET 0 + #endif +--- a/include/axp809.h ++++ b/include/axp809.h +@@ -43,15 +43,7 @@ + #define AXP809_SHUTDOWN 0x32 + #define AXP809_SHUTDOWN_POWEROFF (1 << 7) + +-/* For axp_gpio.c */ + #ifdef CONFIG_AXP809_POWER + #define AXP_POWER_STATUS 0x00 + #define AXP_POWER_STATUS_ALDO_IN BIT(0) +-#define AXP_GPIO0_CTRL 0x90 +-#define AXP_GPIO1_CTRL 0x92 +-#define AXP_GPIO_CTRL_OUTPUT_LOW 0x00 /* Drive pin low */ +-#define AXP_GPIO_CTRL_OUTPUT_HIGH 0x01 /* Drive pin high */ +-#define AXP_GPIO_CTRL_INPUT 0x02 /* Input */ +-#define AXP_GPIO_STATE 0x94 +-#define AXP_GPIO_STATE_OFFSET 0 + #endif +--- a/include/axp818.h ++++ b/include/axp818.h +@@ -57,15 +57,7 @@ + #define AXP818_SHUTDOWN 0x32 + #define AXP818_SHUTDOWN_POWEROFF (1 << 7) + +-/* For axp_gpio.c */ + #ifdef CONFIG_AXP818_POWER + #define AXP_POWER_STATUS 0x00 + #define AXP_POWER_STATUS_ALDO_IN BIT(0) +-#define AXP_GPIO0_CTRL 0x90 +-#define AXP_GPIO1_CTRL 0x92 +-#define AXP_GPIO_CTRL_OUTPUT_LOW 0x00 /* Drive pin low */ +-#define AXP_GPIO_CTRL_OUTPUT_HIGH 0x01 /* Drive pin high */ +-#define AXP_GPIO_CTRL_INPUT 0x02 /* Input */ +-#define AXP_GPIO_STATE 0x94 +-#define AXP_GPIO_STATE_OFFSET 0 + #endif diff --git a/package/boot/uboot-d1/patches/0051-gpio-axp-Add-support-for-getting-the-pin-function.patch b/package/boot/uboot-d1/patches/0051-gpio-axp-Add-support-for-getting-the-pin-function.patch new file mode 100644 index 00000000000000..b8ede75c2a51b9 --- /dev/null +++ b/package/boot/uboot-d1/patches/0051-gpio-axp-Add-support-for-getting-the-pin-function.patch @@ -0,0 +1,49 @@ +From 37e19d9b8a23c88413dd845dbb3dd58dd3636a6d Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sat, 28 Aug 2021 00:36:33 -0500 +Subject: [PATCH 51/90] gpio: axp: Add support for getting the pin function + +Implement the .get_function operation, so the gpio command can report +the current function. Since the GPIOF_FUNC (versus GPIOF_UNUSED) mux +values vary among the PMICs, report all non-GPIO mux values as UNKNOWN. + +Signed-off-by: Samuel Holland +--- + drivers/gpio/axp_gpio.c | 19 +++++++++++++++++++ + 1 file changed, 19 insertions(+) + +--- a/drivers/gpio/axp_gpio.c ++++ b/drivers/gpio/axp_gpio.c +@@ -39,6 +39,24 @@ static int axp_gpio_get_value(struct ude + return !!(ret & BIT(desc->status_offset + pin)); + } + ++static int axp_gpio_get_function(struct udevice *dev, unsigned pin) ++{ ++ const struct axp_gpio_desc *desc = dev_get_priv(dev); ++ int ret; ++ ++ ret = pmic_reg_read(dev->parent, desc->pins[pin]); ++ if (ret < 0) ++ return ret; ++ ++ ret &= AXP_GPIO_CTRL_MASK; ++ if (ret == desc->input_mux) ++ return GPIOF_INPUT; ++ if (ret == AXP_GPIO_CTRL_OUTPUT_HIGH || ret == AXP_GPIO_CTRL_OUTPUT_LOW) ++ return GPIOF_OUTPUT; ++ ++ return GPIOF_UNKNOWN; ++} ++ + static int axp_gpio_set_flags(struct udevice *dev, unsigned pin, ulong flags) + { + const struct axp_gpio_desc *desc = dev_get_priv(dev); +@@ -60,6 +78,7 @@ static int axp_gpio_set_flags(struct ude + + static const struct dm_gpio_ops axp_gpio_ops = { + .get_value = axp_gpio_get_value, ++ .get_function = axp_gpio_get_function, + .xlate = gpio_xlate_offs_flags, + .set_flags = axp_gpio_set_flags, + }; diff --git a/package/boot/uboot-d1/patches/0052-gpio-axp-Add-pull-down-support-for-AXP22x-AXP8xx-var.patch b/package/boot/uboot-d1/patches/0052-gpio-axp-Add-pull-down-support-for-AXP22x-AXP8xx-var.patch new file mode 100644 index 00000000000000..771e5c3866c69c --- /dev/null +++ b/package/boot/uboot-d1/patches/0052-gpio-axp-Add-pull-down-support-for-AXP22x-AXP8xx-var.patch @@ -0,0 +1,56 @@ +From 4be9f9082b0a2ac2626ae20b7e07006139827442 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sat, 28 Aug 2021 00:34:54 -0500 +Subject: [PATCH 52/90] gpio: axp: Add pull-down support for AXP22x/AXP8xx + variant + +The AXP221 and newer PMICs support a pull-down function on their GPIOs. +Add support for it. + +Signed-off-by: Samuel Holland +--- + drivers/gpio/axp_gpio.c | 15 ++++++++++++++- + 1 file changed, 14 insertions(+), 1 deletion(-) + +--- a/drivers/gpio/axp_gpio.c ++++ b/drivers/gpio/axp_gpio.c +@@ -24,6 +24,7 @@ struct axp_gpio_desc { + u8 npins; + u8 status_reg; + u8 status_offset; ++ u8 pull_reg; + u8 input_mux; + }; + +@@ -60,11 +61,22 @@ static int axp_gpio_get_function(struct + static int axp_gpio_set_flags(struct udevice *dev, unsigned pin, ulong flags) + { + const struct axp_gpio_desc *desc = dev_get_priv(dev); ++ bool pull_down = flags & GPIOD_PULL_DOWN; ++ int ret; + u8 mux; + +- if (flags & (GPIOD_MASK_DSTYPE | GPIOD_MASK_PULL)) ++ if (flags & (GPIOD_MASK_DSTYPE | GPIOD_PULL_UP)) ++ return -EINVAL; ++ if (pull_down && !desc->pull_reg) + return -EINVAL; + ++ if (desc->pull_reg) { ++ ret = pmic_clrsetbits(dev->parent, desc->pull_reg, ++ BIT(pin), pull_down ? BIT(pin) : 0); ++ if (ret) ++ return ret; ++ } ++ + if (flags & GPIOD_IS_IN) + mux = desc->input_mux; + else if (flags & GPIOD_IS_OUT_ACTIVE) +@@ -129,6 +141,7 @@ static const struct axp_gpio_desc axp221 + .pins = axp221_gpio_pins, + .npins = ARRAY_SIZE(axp221_gpio_pins), + .status_reg = 0x94, ++ .pull_reg = 0x97, + .input_mux = 2, + }; + diff --git a/package/boot/uboot-d1/patches/0053-gpio-axp-Report-the-correct-value-for-outputs.patch b/package/boot/uboot-d1/patches/0053-gpio-axp-Report-the-correct-value-for-outputs.patch new file mode 100644 index 00000000000000..a6d0eb4526e8bd --- /dev/null +++ b/package/boot/uboot-d1/patches/0053-gpio-axp-Report-the-correct-value-for-outputs.patch @@ -0,0 +1,28 @@ +From 52c172782d659750b447572281cd11835d1edf58 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sun, 31 Jul 2022 18:19:39 -0500 +Subject: [PATCH 53/90] gpio: axp: Report the correct value for outputs + +Signed-off-by: Samuel Holland +--- + drivers/gpio/axp_gpio.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +--- a/drivers/gpio/axp_gpio.c ++++ b/drivers/gpio/axp_gpio.c +@@ -33,6 +33,15 @@ static int axp_gpio_get_value(struct ude + const struct axp_gpio_desc *desc = dev_get_priv(dev); + int ret; + ++ ret = pmic_reg_read(dev->parent, desc->pins[pin]); ++ if (ret < 0) ++ return ret; ++ ++ if (ret == AXP_GPIO_CTRL_OUTPUT_LOW) ++ return 0; ++ if (ret == AXP_GPIO_CTRL_OUTPUT_HIGH) ++ return 1; ++ + ret = pmic_reg_read(dev->parent, desc->status_reg); + if (ret < 0) + return ret; diff --git a/package/boot/uboot-d1/patches/0054-sunxi-Fix-default-enablement-of-USB-host-drivers.patch b/package/boot/uboot-d1/patches/0054-sunxi-Fix-default-enablement-of-USB-host-drivers.patch new file mode 100644 index 00000000000000..52825dce21e62b --- /dev/null +++ b/package/boot/uboot-d1/patches/0054-sunxi-Fix-default-enablement-of-USB-host-drivers.patch @@ -0,0 +1,47 @@ +From 64de4fd71d35c6154a0f7b4c7c02cb24e978a4ce Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Fri, 5 Aug 2022 23:45:19 -0500 +Subject: [PATCH 54/90] sunxi: Fix default-enablement of USB host drivers + +We tried to enable USB_EHCI_GENERIC and USB_OHCI_GENERIC by default. +This did not work because those symbols depend on USB_EHCI_HCD and +USB_OHCI_HCD, which were not enabled. Fix this by implying all four. + +Signed-off-by: Samuel Holland +--- + arch/arm/Kconfig | 4 ++++ + drivers/usb/host/Kconfig | 2 -- + 2 files changed, 4 insertions(+), 2 deletions(-) + +--- a/arch/arm/Kconfig ++++ b/arch/arm/Kconfig +@@ -1142,7 +1142,11 @@ config ARCH_SUNXI + imply SYSRESET + imply SYSRESET_WATCHDOG + imply SYSRESET_WATCHDOG_AUTO ++ imply USB_EHCI_GENERIC ++ imply USB_EHCI_HCD + imply USB_GADGET ++ imply USB_OHCI_GENERIC ++ imply USB_OHCI_HCD + imply WDT + + config ARCH_U8500 +--- a/drivers/usb/host/Kconfig ++++ b/drivers/usb/host/Kconfig +@@ -281,7 +281,6 @@ config USB_EHCI_ZYNQ + config USB_EHCI_GENERIC + bool "Support for generic EHCI USB controller" + depends on DM_USB +- default ARCH_SUNXI + ---help--- + Enables support for generic EHCI controller. + +@@ -343,7 +342,6 @@ config USB_OHCI_PCI + + config USB_OHCI_GENERIC + bool "Support for generic OHCI USB controller" +- default ARCH_SUNXI + ---help--- + Enables support for generic OHCI controller. + diff --git a/package/boot/uboot-d1/patches/0055-sunxi-Remove-unnecessary-Kconfig-selections.patch b/package/boot/uboot-d1/patches/0055-sunxi-Remove-unnecessary-Kconfig-selections.patch new file mode 100644 index 00000000000000..6fd4ffdae330b6 --- /dev/null +++ b/package/boot/uboot-d1/patches/0055-sunxi-Remove-unnecessary-Kconfig-selections.patch @@ -0,0 +1,36 @@ +From 891fef47500dbf4aecb16e08c1d8ade3fbc8caec Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Thu, 4 Aug 2022 23:22:05 -0500 +Subject: [PATCH 55/90] sunxi: Remove unnecessary Kconfig selections + +Two of these selections are redundant and have no effect: + - DM_KEYBOARD is selected by USB_KEYBOARD + - DM_MMC is selected by MMC + +This selection has no effect by default and is unnecessarily strong: + - USB_STORAGE is implied by DISTRO_DEFAULTS + +Signed-off-by: Samuel Holland +--- + arch/arm/Kconfig | 3 --- + 1 file changed, 3 deletions(-) + +--- a/arch/arm/Kconfig ++++ b/arch/arm/Kconfig +@@ -1100,8 +1100,6 @@ config ARCH_SUNXI + select DM_I2C if I2C + select DM_SPI if SPI + select DM_SPI_FLASH if SPI +- select DM_KEYBOARD +- select DM_MMC if MMC + select DM_SCSI if SCSI + select DM_SERIAL + select GPIO_EXTRA_HEADER +@@ -1119,7 +1117,6 @@ config ARCH_SUNXI + select SYS_THUMB_BUILD if !ARM64 + select USB if DISTRO_DEFAULTS + select USB_KEYBOARD if DISTRO_DEFAULTS && USB_HOST +- select USB_STORAGE if DISTRO_DEFAULTS && USB_HOST + select SPL_USE_TINY_PRINTF + select USE_PREBOOT + select SYS_RELOC_GD_ENV_ADDR diff --git a/package/boot/uboot-d1/patches/0056-sunxi-Add-missing-dependencies-to-Kconfig-selections.patch b/package/boot/uboot-d1/patches/0056-sunxi-Add-missing-dependencies-to-Kconfig-selections.patch new file mode 100644 index 00000000000000..6adeeaef2b3e26 --- /dev/null +++ b/package/boot/uboot-d1/patches/0056-sunxi-Add-missing-dependencies-to-Kconfig-selections.patch @@ -0,0 +1,55 @@ +From 9e12a7fd80276092da3a43b7dbaf572bad294419 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Thu, 4 Aug 2022 23:29:13 -0500 +Subject: [PATCH 56/90] sunxi: Add missing dependencies to Kconfig selections + +Some of the selected symbols have a user-visible dependency. Make the +selections conditional on that dependency to avoid creating invalid +configurations. + +Signed-off-by: Samuel Holland +--- + arch/arm/Kconfig | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +--- a/arch/arm/Kconfig ++++ b/arch/arm/Kconfig +@@ -1090,30 +1090,30 @@ config ARCH_SOCFPGA + config ARCH_SUNXI + bool "Support sunxi (Allwinner) SoCs" + select BINMAN +- select CMD_GPIO ++ select CMD_GPIO if GPIO + select CMD_MMC if MMC + select CMD_USB if DISTRO_DEFAULTS && USB_HOST + select CLK + select DM +- select DM_ETH +- select DM_GPIO ++ select DM_ETH if NET ++ select DM_GPIO if GPIO + select DM_I2C if I2C ++ select DM_SCSI if BLK && SCSI ++ select DM_SERIAL if SERIAL + select DM_SPI if SPI + select DM_SPI_FLASH if SPI +- select DM_SCSI if SCSI +- select DM_SERIAL + select GPIO_EXTRA_HEADER + select OF_BOARD_SETUP + select OF_CONTROL + select OF_SEPARATE + select PINCTRL +- select SPECIFY_CONSOLE_INDEX ++ select SPECIFY_CONSOLE_INDEX if SERIAL + select SPL_SEPARATE_BSS if SPL + select SPL_STACK_R if SPL + select SPL_SYS_MALLOC_SIMPLE if SPL + select SPL_SYS_THUMB_BUILD if !ARM64 +- select SUNXI_GPIO +- select SYS_NS16550 ++ select SUNXI_GPIO if GPIO ++ select SYS_NS16550 if SERIAL + select SYS_THUMB_BUILD if !ARM64 + select USB if DISTRO_DEFAULTS + select USB_KEYBOARD if DISTRO_DEFAULTS && USB_HOST diff --git a/package/boot/uboot-d1/patches/0057-sunxi-Hide-image-type-selection-if-SPL-is-disabled.patch b/package/boot/uboot-d1/patches/0057-sunxi-Hide-image-type-selection-if-SPL-is-disabled.patch new file mode 100644 index 00000000000000..314720197e14dd --- /dev/null +++ b/package/boot/uboot-d1/patches/0057-sunxi-Hide-image-type-selection-if-SPL-is-disabled.patch @@ -0,0 +1,22 @@ +From 2ba626d36e622f29528ce953618dde9a01bdacd6 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Fri, 5 Aug 2022 21:56:43 -0500 +Subject: [PATCH 57/90] sunxi: Hide image type selection if SPL is disabled + +This choice is meaningless when SPL is disabled. Hide it to avoid any +possible confusion. + +Signed-off-by: Samuel Holland +--- + board/sunxi/Kconfig | 1 + + 1 file changed, 1 insertion(+) + +--- a/board/sunxi/Kconfig ++++ b/board/sunxi/Kconfig +@@ -1,5 +1,6 @@ + choice + prompt "SPL Image Type" ++ depends on SPL + default SPL_IMAGE_TYPE_SUNXI_EGON + + config SPL_IMAGE_TYPE_SUNXI_EGON diff --git a/package/boot/uboot-d1/patches/0058-sunxi-Share-the-board-Kconfig-across-architectures.patch b/package/boot/uboot-d1/patches/0058-sunxi-Share-the-board-Kconfig-across-architectures.patch new file mode 100644 index 00000000000000..dfae082cf5c85f --- /dev/null +++ b/package/boot/uboot-d1/patches/0058-sunxi-Share-the-board-Kconfig-across-architectures.patch @@ -0,0 +1,75 @@ +From 5d197433cd54085306e369ac260e09fe6077bfbb Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Thu, 4 Aug 2022 21:30:57 -0500 +Subject: [PATCH 58/90] sunxi: Share the board Kconfig across architectures + +With the introduction of the Allwinner D1, the sunxi board family now +spans multiple architectures (ARM and RISC-V). Since ARCH_SUNXI depends +on ARM, it cannot be used to gate architecture-independent options. +Specifically, this means the board Kconfig file cannot be sourced from +inside the "if ARCH_SUNXI" block. + +Introduce a new BOARD_SUNXI symbol that can be selected by both +ARCH_SUNXI now and the new RISC-V SoC symbols when they are added, and +use it to gate the architecture-independent board options. + +Signed-off-by: Samuel Holland +--- + arch/Kconfig | 1 + + arch/arm/Kconfig | 1 + + arch/arm/mach-sunxi/Kconfig | 2 -- + board/sunxi/Kconfig | 11 +++++++++++ + 4 files changed, 13 insertions(+), 2 deletions(-) + +--- a/arch/Kconfig ++++ b/arch/Kconfig +@@ -482,6 +482,7 @@ source "arch/Kconfig.nxp" + endif + + source "board/keymile/Kconfig" ++source "board/sunxi/Kconfig" + + if MIPS || MICROBLAZE + +--- a/arch/arm/Kconfig ++++ b/arch/arm/Kconfig +@@ -1090,6 +1090,7 @@ config ARCH_SOCFPGA + config ARCH_SUNXI + bool "Support sunxi (Allwinner) SoCs" + select BINMAN ++ select BOARD_SUNXI + select CMD_GPIO if GPIO + select CMD_MMC if MMC + select CMD_USB if DISTRO_DEFAULTS && USB_HOST +--- a/arch/arm/mach-sunxi/Kconfig ++++ b/arch/arm/mach-sunxi/Kconfig +@@ -959,8 +959,6 @@ config BLUETOOTH_DT_DEVICE_FIXUP + The used address is "bdaddr" if set, and "ethaddr" with the LSB + flipped elsewise. + +-source "board/sunxi/Kconfig" +- + endif + + config CHIP_DIP_SCAN +--- a/board/sunxi/Kconfig ++++ b/board/sunxi/Kconfig +@@ -1,3 +1,10 @@ ++config BOARD_SUNXI ++ bool ++ ++if BOARD_SUNXI ++ ++menu "sunxi board options" ++ + choice + prompt "SPL Image Type" + depends on SPL +@@ -23,3 +30,7 @@ config SPL_IMAGE_TYPE + string + default "sunxi_egon" if SPL_IMAGE_TYPE_SUNXI_EGON + default "sunxi_toc0" if SPL_IMAGE_TYPE_SUNXI_TOC0 ++ ++endmenu ++ ++endif diff --git a/package/boot/uboot-d1/patches/0059-sunxi-Move-most-Kconfig-selections-to-the-board-Kcon.patch b/package/boot/uboot-d1/patches/0059-sunxi-Move-most-Kconfig-selections-to-the-board-Kcon.patch new file mode 100644 index 00000000000000..e576d137e83c16 --- /dev/null +++ b/package/boot/uboot-d1/patches/0059-sunxi-Move-most-Kconfig-selections-to-the-board-Kcon.patch @@ -0,0 +1,140 @@ +From 963331be1cc924ad7c928f88b3ee46bc20a41bcd Mon Sep 17 00:00:00 2001 +From: Zoltan HERPAI +Date: Tue, 6 Jun 2023 18:06:20 +0000 +Subject: [PATCH 59/90] sunxi: Move most Kconfig selections to the board + Kconfig + +To maintain consistent behavior across architectures, most of the +options selected by ARCH_SUNXI should be selected for the D1 SoC as +well. To accomplish this, select them from BOARD_SUNXI instead. + +No functional change here. Lines are only moved and alphabetized. + +Signed-off-by: Samuel Holland + +Signed-off-by: Zoltan HERPAI +--- + arch/arm/Kconfig | 47 --------------------------------------------- + board/sunxi/Kconfig | 46 ++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 46 insertions(+), 47 deletions(-) + +--- a/arch/arm/Kconfig ++++ b/arch/arm/Kconfig +@@ -1089,63 +1089,16 @@ config ARCH_SOCFPGA + + config ARCH_SUNXI + bool "Support sunxi (Allwinner) SoCs" +- select BINMAN + select BOARD_SUNXI +- select CMD_GPIO if GPIO +- select CMD_MMC if MMC +- select CMD_USB if DISTRO_DEFAULTS && USB_HOST +- select CLK +- select DM +- select DM_ETH if NET +- select DM_GPIO if GPIO +- select DM_I2C if I2C +- select DM_SCSI if BLK && SCSI +- select DM_SERIAL if SERIAL +- select DM_SPI if SPI +- select DM_SPI_FLASH if SPI + select GPIO_EXTRA_HEADER +- select OF_BOARD_SETUP + select OF_CONTROL + select OF_SEPARATE +- select PINCTRL + select SPECIFY_CONSOLE_INDEX if SERIAL +- select SPL_SEPARATE_BSS if SPL + select SPL_STACK_R if SPL + select SPL_SYS_MALLOC_SIMPLE if SPL + select SPL_SYS_THUMB_BUILD if !ARM64 +- select SUNXI_GPIO if GPIO +- select SYS_NS16550 if SERIAL + select SYS_THUMB_BUILD if !ARM64 +- select USB if DISTRO_DEFAULTS +- select USB_KEYBOARD if DISTRO_DEFAULTS && USB_HOST + select SPL_USE_TINY_PRINTF +- select USE_PREBOOT +- select SYS_RELOC_GD_ENV_ADDR +- imply BOARD_LATE_INIT +- imply CMD_DM +- imply CMD_GPT +- imply CMD_UBI if MTD_RAW_NAND +- imply DISTRO_DEFAULTS +- imply FAT_WRITE +- imply FIT +- imply OF_LIBFDT_OVERLAY +- imply PRE_CONSOLE_BUFFER +- imply SPL_GPIO +- imply SPL_LIBCOMMON_SUPPORT +- imply SPL_LIBGENERIC_SUPPORT +- imply SPL_LOAD_FIT +- imply SPL_MMC if MMC +- imply SPL_POWER +- imply SPL_SERIAL +- imply SYSRESET +- imply SYSRESET_WATCHDOG +- imply SYSRESET_WATCHDOG_AUTO +- imply USB_EHCI_GENERIC +- imply USB_EHCI_HCD +- imply USB_GADGET +- imply USB_OHCI_GENERIC +- imply USB_OHCI_HCD +- imply WDT + + config ARCH_U8500 + bool "ST-Ericsson U8500 Series" +--- a/board/sunxi/Kconfig ++++ b/board/sunxi/Kconfig +@@ -1,5 +1,51 @@ + config BOARD_SUNXI + bool ++ select BINMAN ++ select CLK ++ select CMD_GPIO if GPIO ++ select CMD_MMC if MMC ++ select CMD_USB if DISTRO_DEFAULTS && USB_HOST ++ select DM ++ select DM_ETH if NET ++ select DM_GPIO if GPIO ++ select DM_I2C if I2C ++ select DM_SCSI if BLK && SCSI ++ select DM_SERIAL if SERIAL ++ select DM_SPI if SPI ++ select DM_SPI_FLASH if SPI ++ select OF_BOARD_SETUP ++ select PINCTRL ++ select SPL_SEPARATE_BSS if SPL ++ select SUNXI_GPIO if GPIO ++ select SYS_NS16550 if SERIAL ++ select SYS_RELOC_GD_ENV_ADDR ++ select USB if DISTRO_DEFAULTS ++ select USB_KEYBOARD if DISTRO_DEFAULTS && USB_HOST ++ select USE_PREBOOT ++ imply BOARD_LATE_INIT ++ imply CMD_DM ++ imply CMD_GPT ++ imply CMD_UBI if MTD_RAW_NAND ++ imply DISTRO_DEFAULTS ++ imply FAT_WRITE ++ imply FIT ++ imply OF_LIBFDT_OVERLAY ++ imply PRE_CONSOLE_BUFFER ++ imply SPL_GPIO ++ imply SPL_LIBCOMMON_SUPPORT ++ imply SPL_LIBGENERIC_SUPPORT ++ imply SPL_MMC if MMC ++ imply SPL_POWER ++ imply SPL_SERIAL ++ imply SYSRESET ++ imply SYSRESET_WATCHDOG ++ imply SYSRESET_WATCHDOG_AUTO ++ imply USB_EHCI_GENERIC ++ imply USB_EHCI_HCD ++ imply USB_GADGET ++ imply USB_OHCI_GENERIC ++ imply USB_OHCI_HCD ++ imply WDT + + if BOARD_SUNXI + diff --git a/package/boot/uboot-d1/patches/0060-sunxi-Globally-enable-SUPPORT_SPL.patch b/package/boot/uboot-d1/patches/0060-sunxi-Globally-enable-SUPPORT_SPL.patch new file mode 100644 index 00000000000000..0b59906f440c91 --- /dev/null +++ b/package/boot/uboot-d1/patches/0060-sunxi-Globally-enable-SUPPORT_SPL.patch @@ -0,0 +1,147 @@ +From 5838fd3a53e613312d46ab4cb6015a502c4c45d0 Mon Sep 17 00:00:00 2001 +From: Zoltan HERPAI +Date: Tue, 6 Jun 2023 18:07:24 +0000 +Subject: [PATCH 60/90] sunxi: Globally enable SUPPORT_SPL + +This was already supported by every machine type. It is unlikely that +any new SoC support will be added without SPL support. + +Signed-off-by: Samuel Holland +Signed-off-by: Zoltan HERPAI +--- + arch/arm/mach-sunxi/Kconfig | 14 -------------- + board/sunxi/Kconfig | 2 ++ + 2 files changed, 2 insertions(+), 14 deletions(-) + +--- a/arch/arm/mach-sunxi/Kconfig ++++ b/arch/arm/mach-sunxi/Kconfig +@@ -133,7 +133,6 @@ config SUN50I_GEN_H6 + select FIT + select SPL_LOAD_FIT + select MMC_SUNXI_HAS_NEW_MODE +- select SUPPORT_SPL + ---help--- + Select this for sunxi SoCs which have H6 like peripherals, clocks + and memory map. +@@ -166,7 +165,6 @@ config MACH_SUNXI_H3_H5 + select SUNXI_DRAM_DW + select SUNXI_DRAM_DW_32BIT + select SUNXI_GEN_SUN6I +- select SUPPORT_SPL + + # TODO: try out A80's 8GiB DRAM space + config SUNXI_DRAM_MAX_SIZE +@@ -183,7 +181,6 @@ config MACH_SUNIV + bool "suniv (Allwinner F1C100s/F1C200s/F1C600/R6)" + select CPU_ARM926EJS + select SUNXI_GEN_SUN6I +- select SUPPORT_SPL + select SKIP_LOWLEVEL_INIT_ONLY + select SPL_SKIP_LOWLEVEL_INIT_ONLY + +@@ -192,7 +189,6 @@ config MACH_SUN4I + select CPU_V7A + select DRAM_SUN4I + select SUNXI_GEN_SUN4I +- select SUPPORT_SPL + imply SPL_SYS_I2C_LEGACY + imply SYS_I2C_LEGACY + +@@ -201,7 +197,6 @@ config MACH_SUN5I + select CPU_V7A + select DRAM_SUN4I + select SUNXI_GEN_SUN4I +- select SUPPORT_SPL + imply SPL_SYS_I2C_LEGACY + imply SYS_I2C_LEGACY + +@@ -216,7 +211,6 @@ config MACH_SUN6I + select SPL_I2C + select SUN6I_PRCM + select SUNXI_GEN_SUN6I +- select SUPPORT_SPL + select SYS_I2C_SUN6I_P2WI + select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT + +@@ -229,7 +223,6 @@ config MACH_SUN7I + select SPL_ARMV7_SET_CORTEX_SMPEN + select DRAM_SUN4I + select SUNXI_GEN_SUN4I +- select SUPPORT_SPL + select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT + imply SPL_SYS_I2C_LEGACY + imply SYS_I2C_LEGACY +@@ -243,7 +236,6 @@ config MACH_SUN8I_A23 + select DRAM_SUN8I_A23 + select SPL_I2C + select SUNXI_GEN_SUN6I +- select SUPPORT_SPL + select SYS_I2C_SUN8I_RSB + select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT + +@@ -256,7 +248,6 @@ config MACH_SUN8I_A33 + select DRAM_SUN8I_A33 + select SPL_I2C + select SUNXI_GEN_SUN6I +- select SUPPORT_SPL + select SYS_I2C_SUN8I_RSB + select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT + +@@ -268,7 +259,6 @@ config MACH_SUN8I_A83T + select SUNXI_GEN_SUN6I + select MMC_SUNXI_HAS_NEW_MODE + select MMC_SUNXI_HAS_MODE_SWITCH +- select SUPPORT_SPL + select SYS_I2C_SUN8I_RSB + + config MACH_SUN8I_H3 +@@ -288,7 +278,6 @@ config MACH_SUN8I_R40 + select ARCH_SUPPORT_PSCI + select SUNXI_GEN_SUN6I + select MMC_SUNXI_HAS_NEW_MODE +- select SUPPORT_SPL + select SUNXI_DRAM_DW + select SUNXI_DRAM_DW_32BIT + imply SPL_SYS_I2C_LEGACY +@@ -302,7 +291,6 @@ config MACH_SUN8I_V3S + select SUNXI_GEN_SUN6I + select SUNXI_DRAM_DW + select SUNXI_DRAM_DW_16BIT +- select SUPPORT_SPL + select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT + + config MACH_SUN9I +@@ -313,7 +301,6 @@ config MACH_SUN9I + select SPL_I2C + select SUN6I_PRCM + select SUNXI_GEN_SUN6I +- select SUPPORT_SPL + + config MACH_SUN50I + bool "sun50i (Allwinner A64)" +@@ -322,7 +309,6 @@ config MACH_SUN50I + select SUNXI_DE2 + select SUNXI_GEN_SUN6I + select MMC_SUNXI_HAS_NEW_MODE +- select SUPPORT_SPL + select SUNXI_DRAM_DW + select SUNXI_DRAM_DW_32BIT + select FIT +--- a/board/sunxi/Kconfig ++++ b/board/sunxi/Kconfig +@@ -18,6 +18,7 @@ config BOARD_SUNXI + select SPL_SEPARATE_BSS if SPL + select SUNXI_GPIO if GPIO + select SYS_NS16550 if SERIAL ++ select SUPPORT_SPL + select SYS_RELOC_GD_ENV_ADDR + select USB if DISTRO_DEFAULTS + select USB_KEYBOARD if DISTRO_DEFAULTS && USB_HOST +@@ -31,6 +32,7 @@ config BOARD_SUNXI + imply FIT + imply OF_LIBFDT_OVERLAY + imply PRE_CONSOLE_BUFFER ++ imply SPL + imply SPL_GPIO + imply SPL_LIBCOMMON_SUPPORT + imply SPL_LIBGENERIC_SUPPORT diff --git a/package/boot/uboot-d1/patches/0061-sunxi-Downgrade-driver-selections-to-implications.patch b/package/boot/uboot-d1/patches/0061-sunxi-Downgrade-driver-selections-to-implications.patch new file mode 100644 index 00000000000000..e77c5cb080fa4f --- /dev/null +++ b/package/boot/uboot-d1/patches/0061-sunxi-Downgrade-driver-selections-to-implications.patch @@ -0,0 +1,33 @@ +From 6c8707fcd3372015829a1e8b8d5e8030c5806382 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sat, 6 Aug 2022 00:10:46 -0500 +Subject: [PATCH 61/90] sunxi: Downgrade driver selections to implications + +While not especially likely, it is plausible that someone wants to build +U-Boot without GPIO or UART support. Don't force building these drivers. + +Signed-off-by: Samuel Holland +--- + board/sunxi/Kconfig | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/board/sunxi/Kconfig ++++ b/board/sunxi/Kconfig +@@ -16,8 +16,6 @@ config BOARD_SUNXI + select OF_BOARD_SETUP + select PINCTRL + select SPL_SEPARATE_BSS if SPL +- select SUNXI_GPIO if GPIO +- select SYS_NS16550 if SERIAL + select SUPPORT_SPL + select SYS_RELOC_GD_ENV_ADDR + select USB if DISTRO_DEFAULTS +@@ -39,6 +37,8 @@ config BOARD_SUNXI + imply SPL_MMC if MMC + imply SPL_POWER + imply SPL_SERIAL ++ imply SUNXI_GPIO ++ imply SYS_NS16550 + imply SYSRESET + imply SYSRESET_WATCHDOG + imply SYSRESET_WATCHDOG_AUTO diff --git a/package/boot/uboot-d1/patches/0062-sunxi-Enable-the-I2C-driver-by-default.patch b/package/boot/uboot-d1/patches/0062-sunxi-Enable-the-I2C-driver-by-default.patch new file mode 100644 index 00000000000000..e6d963e812a888 --- /dev/null +++ b/package/boot/uboot-d1/patches/0062-sunxi-Enable-the-I2C-driver-by-default.patch @@ -0,0 +1,23 @@ +From ad619478827b825d7b88dce22eb9b5e1c6ea7eb0 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sat, 6 Aug 2022 00:11:54 -0500 +Subject: [PATCH 62/90] sunxi: Enable the I2C driver by default + +This is used by quite a large number of boards, for PMIC/regulator or +LCD panel control. + +Signed-off-by: Samuel Holland +--- + board/sunxi/Kconfig | 1 + + 1 file changed, 1 insertion(+) + +--- a/board/sunxi/Kconfig ++++ b/board/sunxi/Kconfig +@@ -38,6 +38,7 @@ config BOARD_SUNXI + imply SPL_POWER + imply SPL_SERIAL + imply SUNXI_GPIO ++ imply SYS_I2C_MVTWSI + imply SYS_NS16550 + imply SYSRESET + imply SYSRESET_WATCHDOG diff --git a/package/boot/uboot-d1/patches/0063-sunxi-Move-default-values-to-the-board-Kconfig.patch b/package/boot/uboot-d1/patches/0063-sunxi-Move-default-values-to-the-board-Kconfig.patch new file mode 100644 index 00000000000000..17bf8cb3ace5ed --- /dev/null +++ b/package/boot/uboot-d1/patches/0063-sunxi-Move-default-values-to-the-board-Kconfig.patch @@ -0,0 +1,190 @@ +From fde804c2ece090eb7802a218781e38c7c6d6f00d Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Fri, 5 Aug 2022 23:10:11 -0500 +Subject: [PATCH 63/90] sunxi: Move default values to the board Kconfig + +This keeps all of the defaults for sunxi platforms in one place. Most of +these only depend on architecture-independent features of the SoC (clock +tree or SRAM layout) anyway. + +No functional change; just some minor help text cleanup. + +Signed-off-by: Samuel Holland +--- + arch/arm/mach-sunxi/Kconfig | 67 ------------------------------------ + board/sunxi/Kconfig | 68 +++++++++++++++++++++++++++++++++++++ + 2 files changed, 68 insertions(+), 67 deletions(-) + +--- a/arch/arm/mach-sunxi/Kconfig ++++ b/arch/arm/mach-sunxi/Kconfig +@@ -1,8 +1,5 @@ + if ARCH_SUNXI + +-config IDENT_STRING +- default " Allwinner Technology" +- + config DRAM_SUN4I + bool + help +@@ -99,17 +96,6 @@ config AXP_PMIC_BUS + Select this PMIC bus access helpers for Sunxi platform PRCM or other + AXP family PMIC devices. + +-config SUNXI_SRAM_ADDRESS +- hex +- default 0x10000 if MACH_SUN9I || MACH_SUN50I || MACH_SUN50I_H5 +- default 0x20000 if SUN50I_GEN_H6 +- default 0x0 +- ---help--- +- Older Allwinner SoCs have their mask boot ROM mapped just below 4GB, +- with the first SRAM region being located at address 0. +- Some newer SoCs map the boot ROM at address 0 instead and move the +- SRAM to a different address. +- + config SUNXI_A64_TIMER_ERRATUM + bool + +@@ -562,48 +548,6 @@ config DRAM_ODT_CORRECTION + then the correction is negative. Usually the value for this is 0. + endif + +-config SYS_CLK_FREQ +- default 408000000 if MACH_SUNIV +- default 1008000000 if MACH_SUN4I +- default 1008000000 if MACH_SUN5I +- default 1008000000 if MACH_SUN6I +- default 912000000 if MACH_SUN7I +- default 816000000 if MACH_SUN50I || MACH_SUN50I_H5 +- default 1008000000 if MACH_SUN8I +- default 1008000000 if MACH_SUN9I +- default 888000000 if MACH_SUN50I_H6 +- default 1008000000 if MACH_SUN50I_H616 +- +-config SYS_CONFIG_NAME +- default "suniv" if MACH_SUNIV +- default "sun4i" if MACH_SUN4I +- default "sun5i" if MACH_SUN5I +- default "sun6i" if MACH_SUN6I +- default "sun7i" if MACH_SUN7I +- default "sun8i" if MACH_SUN8I +- default "sun9i" if MACH_SUN9I +- default "sun50i" if MACH_SUN50I +- default "sun50i" if MACH_SUN50I_H6 +- default "sun50i" if MACH_SUN50I_H616 +- +-config SYS_BOARD +- default "sunxi" +- +-config SYS_SOC +- default "sunxi" +- +-config SUNXI_MINIMUM_DRAM_MB +- int "minimum DRAM size" +- default 32 if MACH_SUNIV +- default 64 if MACH_SUN8I_V3S +- default 256 +- ---help--- +- Minimum DRAM size expected on the board. Traditionally we assumed +- 256 MB, so that U-Boot would load at 160MB. With co-packaged DRAM +- we have smaller sizes, though, so that U-Boot's own load address and +- the default payload addresses must be shifted down. +- This is expected to be fixed by the SoC selection. +- + config UART0_PORT_F + bool "UART0 on MicroSD breakout board" + ---help--- +@@ -898,17 +842,6 @@ config GMAC_TX_DELAY + ---help--- + Set the GMAC Transmit Clock Delay Chain value. + +-config SPL_STACK_R_ADDR +- default 0x81e00000 if MACH_SUNIV +- default 0x4fe00000 if MACH_SUN4I +- default 0x4fe00000 if MACH_SUN5I +- default 0x4fe00000 if MACH_SUN6I +- default 0x4fe00000 if MACH_SUN7I +- default 0x4fe00000 if MACH_SUN8I +- default 0x2fe00000 if MACH_SUN9I +- default 0x4fe00000 if MACH_SUN50I +- default 0x4fe00000 if SUN50I_GEN_H6 +- + config SPL_SPI_SUNXI + bool "Support for SPI Flash on Allwinner SoCs in SPL" + depends on MACH_SUN4I || MACH_SUN5I || MACH_SUN7I || MACH_SUNXI_H3_H5 || MACH_SUN50I || MACH_SUN8I_R40 || SUN50I_GEN_H6 || MACH_SUNIV +--- a/board/sunxi/Kconfig ++++ b/board/sunxi/Kconfig +@@ -52,6 +52,74 @@ config BOARD_SUNXI + + if BOARD_SUNXI + ++config IDENT_STRING ++ default " Allwinner Technology" ++ ++config SPL_STACK_R_ADDR ++ default 0x81e00000 if MACH_SUNIV ++ default 0x4fe00000 if MACH_SUN4I ++ default 0x4fe00000 if MACH_SUN5I ++ default 0x4fe00000 if MACH_SUN6I ++ default 0x4fe00000 if MACH_SUN7I ++ default 0x4fe00000 if MACH_SUN8I ++ default 0x2fe00000 if MACH_SUN9I ++ default 0x4fe00000 if MACH_SUN50I ++ default 0x4fe00000 if SUN50I_GEN_H6 ++ ++config SUNXI_MINIMUM_DRAM_MB ++ int "minimum DRAM size" ++ default 32 if MACH_SUNIV ++ default 64 if MACH_SUN8I_V3S ++ default 256 ++ help ++ Minimum DRAM size expected on the board. Traditionally we ++ assumed 256 MB, so that U-Boot would load at 160MB. With ++ co-packaged DRAM we have smaller sizes, though, so U-Boot's ++ own load address and the default payload addresses must be ++ shifted down. This is expected to be fixed by the SoC ++ selection. ++ ++config SUNXI_SRAM_ADDRESS ++ hex ++ default 0x10000 if MACH_SUN9I || MACH_SUN50I || MACH_SUN50I_H5 ++ default 0x20000 if SUN50I_GEN_H6 ++ default 0x0 ++ help ++ Older Allwinner SoCs have their boot mask ROM mapped just ++ below 4GB, with the first SRAM region located at address 0. ++ Newer SoCs map the boot ROM at address 0 instead and move the ++ SRAM to a different address. ++ ++config SYS_BOARD ++ default "sunxi" ++ ++config SYS_CLK_FREQ ++ default 408000000 if MACH_SUNIV ++ default 1008000000 if MACH_SUN4I ++ default 1008000000 if MACH_SUN5I ++ default 1008000000 if MACH_SUN6I ++ default 912000000 if MACH_SUN7I ++ default 1008000000 if MACH_SUN8I ++ default 1008000000 if MACH_SUN9I ++ default 816000000 if MACH_SUN50I || MACH_SUN50I_H5 ++ default 888000000 if MACH_SUN50I_H6 ++ default 1008000000 if MACH_SUN50I_H616 ++ ++config SYS_CONFIG_NAME ++ default "suniv" if MACH_SUNIV ++ default "sun4i" if MACH_SUN4I ++ default "sun5i" if MACH_SUN5I ++ default "sun6i" if MACH_SUN6I ++ default "sun7i" if MACH_SUN7I ++ default "sun8i" if MACH_SUN8I ++ default "sun9i" if MACH_SUN9I ++ default "sun50i" if MACH_SUN50I ++ default "sun50i" if MACH_SUN50I_H6 ++ default "sun50i" if MACH_SUN50I_H616 ++ ++config SYS_SOC ++ default "sunxi" ++ + menu "sunxi board options" + + choice diff --git a/package/boot/uboot-d1/patches/0064-sunxi-Hide-the-SUNXI_MINIMUM_DRAM_MB-symbol.patch b/package/boot/uboot-d1/patches/0064-sunxi-Hide-the-SUNXI_MINIMUM_DRAM_MB-symbol.patch new file mode 100644 index 00000000000000..76486485971bd2 --- /dev/null +++ b/package/boot/uboot-d1/patches/0064-sunxi-Hide-the-SUNXI_MINIMUM_DRAM_MB-symbol.patch @@ -0,0 +1,24 @@ +From 8377aa2162d0a7fda76597eae59725a298dda5e6 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Mon, 31 Oct 2022 22:14:36 -0500 +Subject: [PATCH 64/90] sunxi: Hide the SUNXI_MINIMUM_DRAM_MB symbol + +This option affects the ABI between SPL/U-Boot and U-Boot/scripts, so it +should not normally be changed by the user. + +Signed-off-by: Samuel Holland +--- + board/sunxi/Kconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/board/sunxi/Kconfig ++++ b/board/sunxi/Kconfig +@@ -67,7 +67,7 @@ config SPL_STACK_R_ADDR + default 0x4fe00000 if SUN50I_GEN_H6 + + config SUNXI_MINIMUM_DRAM_MB +- int "minimum DRAM size" ++ int + default 32 if MACH_SUNIV + default 64 if MACH_SUN8I_V3S + default 256 diff --git a/package/boot/uboot-d1/patches/0065-sunxi-Clean-up-the-SPL_STACK_R_ADDR-defaults.patch b/package/boot/uboot-d1/patches/0065-sunxi-Clean-up-the-SPL_STACK_R_ADDR-defaults.patch new file mode 100644 index 00000000000000..1a662bea2c32ab --- /dev/null +++ b/package/boot/uboot-d1/patches/0065-sunxi-Clean-up-the-SPL_STACK_R_ADDR-defaults.patch @@ -0,0 +1,33 @@ +From 41e5a94533e9744b8eac718dd2c359eca57573f8 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Fri, 5 Aug 2022 23:25:26 -0500 +Subject: [PATCH 65/90] sunxi: Clean up the SPL_STACK_R_ADDR defaults + +Update this option to be based on SUNXI_MINIMUM_DRAM_MB. This corrects +the value used on V3s, which previously was the MACH_SUN8I default, and +so relied on addresses wrapping modulo the DRAM size. + +Signed-off-by: Samuel Holland +--- + board/sunxi/Kconfig | 9 ++------- + 1 file changed, 2 insertions(+), 7 deletions(-) + +--- a/board/sunxi/Kconfig ++++ b/board/sunxi/Kconfig +@@ -57,14 +57,9 @@ config IDENT_STRING + + config SPL_STACK_R_ADDR + default 0x81e00000 if MACH_SUNIV +- default 0x4fe00000 if MACH_SUN4I +- default 0x4fe00000 if MACH_SUN5I +- default 0x4fe00000 if MACH_SUN6I +- default 0x4fe00000 if MACH_SUN7I +- default 0x4fe00000 if MACH_SUN8I + default 0x2fe00000 if MACH_SUN9I +- default 0x4fe00000 if MACH_SUN50I +- default 0x4fe00000 if SUN50I_GEN_H6 ++ default 0x4fe00000 if SUNXI_MINIMUM_DRAM_MB >= 256 ++ default 0x43e00000 if SUNXI_MINIMUM_DRAM_MB >= 64 + + config SUNXI_MINIMUM_DRAM_MB + int diff --git a/package/boot/uboot-d1/patches/0066-sunxi-Move-PRE_CON_BUF_ADDR-to-the-board-Kconfig.patch b/package/boot/uboot-d1/patches/0066-sunxi-Move-PRE_CON_BUF_ADDR-to-the-board-Kconfig.patch new file mode 100644 index 00000000000000..daaf0b5fc60ddd --- /dev/null +++ b/package/boot/uboot-d1/patches/0066-sunxi-Move-PRE_CON_BUF_ADDR-to-the-board-Kconfig.patch @@ -0,0 +1,42 @@ +From e947c7377b90897e4c638dad6e64201361dc8a9e Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sat, 6 Aug 2022 00:45:10 -0500 +Subject: [PATCH 66/90] sunxi: Move PRE_CON_BUF_ADDR to the board Kconfig + +This provides a default value for RISC-V when that is added, and it +makes sense to put this option next to the other DRAM layout options. + +While at it, provide sensible values for platforms with less DRAM. + +Signed-off-by: Samuel Holland +--- + board/sunxi/Kconfig | 6 ++++++ + common/Kconfig | 2 -- + 2 files changed, 6 insertions(+), 2 deletions(-) + +--- a/board/sunxi/Kconfig ++++ b/board/sunxi/Kconfig +@@ -55,6 +55,12 @@ if BOARD_SUNXI + config IDENT_STRING + default " Allwinner Technology" + ++config PRE_CON_BUF_ADDR ++ default 0x81000000 if MACH_SUNIV ++ default 0x2f000000 if MACH_SUN9I ++ default 0x4f000000 if SUNXI_MINIMUM_DRAM_MB >= 256 ++ default 0x43000000 if SUNXI_MINIMUM_DRAM_MB >= 64 ++ + config SPL_STACK_R_ADDR + default 0x81e00000 if MACH_SUNIV + default 0x2fe00000 if MACH_SUN9I +--- a/common/Kconfig ++++ b/common/Kconfig +@@ -195,8 +195,6 @@ config PRE_CON_BUF_SZ + config PRE_CON_BUF_ADDR + hex "Address of the pre-console buffer" + depends on PRE_CONSOLE_BUFFER +- default 0x2f000000 if ARCH_SUNXI && MACH_SUN9I +- default 0x4f000000 if ARCH_SUNXI && !MACH_SUN9I + default 0x0f000000 if ROCKCHIP_RK3288 + default 0x0f200000 if ROCKCHIP_RK3399 + help diff --git a/package/boot/uboot-d1/patches/0067-sunxi-Move-SPL_BSS_START_ADDR-to-the-board-Kconfig.patch b/package/boot/uboot-d1/patches/0067-sunxi-Move-SPL_BSS_START_ADDR-to-the-board-Kconfig.patch new file mode 100644 index 00000000000000..286b2b976b20f6 --- /dev/null +++ b/package/boot/uboot-d1/patches/0067-sunxi-Move-SPL_BSS_START_ADDR-to-the-board-Kconfig.patch @@ -0,0 +1,43 @@ +From 71796f9d47a6b7e0dd6bb276436950463039c1b8 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Mon, 31 Oct 2022 00:08:26 -0500 +Subject: [PATCH 67/90] sunxi: Move SPL_BSS_START_ADDR to the board Kconfig + +This provides a default value for RISC-V when that is added, and it +makes sense to put this option next to the other DRAM layout options. + +While at it, provide sensible values for platforms with less DRAM. + +Signed-off-by: Samuel Holland +--- + board/sunxi/Kconfig | 6 ++++++ + common/spl/Kconfig | 3 --- + 2 files changed, 6 insertions(+), 3 deletions(-) + +--- a/board/sunxi/Kconfig ++++ b/board/sunxi/Kconfig +@@ -61,6 +61,12 @@ config PRE_CON_BUF_ADDR + default 0x4f000000 if SUNXI_MINIMUM_DRAM_MB >= 256 + default 0x43000000 if SUNXI_MINIMUM_DRAM_MB >= 64 + ++config SPL_BSS_START_ADDR ++ default 0x81f80000 if MACH_SUNIV ++ default 0x2ff80000 if MACH_SUN9I ++ default 0x4ff80000 if SUNXI_MINIMUM_DRAM_MB >= 256 ++ default 0x43f80000 if SUNXI_MINIMUM_DRAM_MB >= 64 ++ + config SPL_STACK_R_ADDR + default 0x81e00000 if MACH_SUNIV + default 0x2fe00000 if MACH_SUN9I +--- a/common/spl/Kconfig ++++ b/common/spl/Kconfig +@@ -119,9 +119,6 @@ config SPL_BSS_START_ADDR + default 0x88200000 if (ARCH_MX6 && (MX6SX || MX6SL || MX6UL || MX6ULL)) || ARCH_MX7 + default 0x18200000 if ARCH_MX6 && !(MX6SX || MX6SL || MX6UL || MX6ULL) + default 0x80a00000 if ARCH_OMAP2PLUS +- default 0x81f80000 if ARCH_SUNXI && MACH_SUNIV +- default 0x4ff80000 if ARCH_SUNXI && !(MACH_SUN9I || MACH_SUNIV) +- default 0x2ff80000 if ARCH_SUNXI && MACH_SUN9I + default 0x1000 if ARCH_ZYNQMP + + choice diff --git a/package/boot/uboot-d1/patches/0068-sunxi-Move-SPL_TEXT_BASE-to-the-board-Kconfig.patch b/package/boot/uboot-d1/patches/0068-sunxi-Move-SPL_TEXT_BASE-to-the-board-Kconfig.patch new file mode 100644 index 00000000000000..77aa5929435261 --- /dev/null +++ b/package/boot/uboot-d1/patches/0068-sunxi-Move-SPL_TEXT_BASE-to-the-board-Kconfig.patch @@ -0,0 +1,39 @@ +From 5d60490d0f0ca0a5d414ba9a4e41ceea8a98b4d2 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sat, 6 Aug 2022 00:07:47 -0500 +Subject: [PATCH 68/90] sunxi: Move SPL_TEXT_BASE to the board Kconfig + +It makes sense to put this near the definition of SUNXI_SRAM_ADDRESS. + +Signed-off-by: Samuel Holland +--- + board/sunxi/Kconfig | 5 +++++ + common/spl/Kconfig | 3 --- + 2 files changed, 5 insertions(+), 3 deletions(-) + +--- a/board/sunxi/Kconfig ++++ b/board/sunxi/Kconfig +@@ -73,6 +73,11 @@ config SPL_STACK_R_ADDR + default 0x4fe00000 if SUNXI_MINIMUM_DRAM_MB >= 256 + default 0x43e00000 if SUNXI_MINIMUM_DRAM_MB >= 64 + ++config SPL_TEXT_BASE ++ default 0x10060 if MACH_SUN9I || MACH_SUN50I || MACH_SUN50I_H5 ++ default 0x20060 if SUN50I_GEN_H6 ++ default 0x00060 ++ + config SUNXI_MINIMUM_DRAM_MB + int + default 32 if MACH_SUNIV +--- a/common/spl/Kconfig ++++ b/common/spl/Kconfig +@@ -261,9 +261,6 @@ config SPL_TEXT_BASE + default 0x402F4000 if AM43XX + default 0x402F0400 if AM33XX + default 0x40301350 if OMAP54XX +- default 0x10060 if MACH_SUN50I || MACH_SUN50I_H5 || MACH_SUN9I +- default 0x20060 if SUN50I_GEN_H6 +- default 0x00060 if ARCH_SUNXI + default 0xfffc0000 if ARCH_ZYNQMP + default 0x0 + help diff --git a/package/boot/uboot-d1/patches/0069-sunxi-Move-SYS_LOAD_ADDR-to-the-board-Kconfig.patch b/package/boot/uboot-d1/patches/0069-sunxi-Move-SYS_LOAD_ADDR-to-the-board-Kconfig.patch new file mode 100644 index 00000000000000..3d6e3018daeca3 --- /dev/null +++ b/package/boot/uboot-d1/patches/0069-sunxi-Move-SYS_LOAD_ADDR-to-the-board-Kconfig.patch @@ -0,0 +1,40 @@ +From 03f3ba82e9dfb67f1ae0812f72aea6559aa61bb4 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Fri, 5 Aug 2022 23:23:34 -0500 +Subject: [PATCH 69/90] sunxi: Move SYS_LOAD_ADDR to the board Kconfig + +This will provide a default value for RISC-V when that is added, and it +makes sense to put this option next to the other DRAM layout options. + +Signed-off-by: Samuel Holland +--- + Kconfig | 3 --- + board/sunxi/Kconfig | 5 +++++ + 2 files changed, 5 insertions(+), 3 deletions(-) + +--- a/Kconfig ++++ b/Kconfig +@@ -508,9 +508,6 @@ config SYS_LOAD_ADDR + hex "Address in memory to use by default" + default 0x01000000 if ARCH_SOCFPGA + default 0x02000000 if PPC || X86 +- default 0x81000000 if MACH_SUNIV +- default 0x22000000 if MACH_SUN9I +- default 0x42000000 if ARCH_SUNXI + default 0x82000000 if ARCH_KEYSTONE || ARCH_OMAP2PLUS || ARCH_K3 + default 0x82000000 if ARCH_MX6 && (MX6SL || MX6SLL || MX6SX || MX6UL || MX6ULL) + default 0x12000000 if ARCH_MX6 && !(MX6SL || MX6SLL || MX6SX || MX6UL || MX6ULL) +--- a/board/sunxi/Kconfig ++++ b/board/sunxi/Kconfig +@@ -129,6 +129,11 @@ config SYS_CONFIG_NAME + default "sun50i" if MACH_SUN50I_H6 + default "sun50i" if MACH_SUN50I_H616 + ++config SYS_LOAD_ADDR ++ default 0x81000000 if MACH_SUNIV ++ default 0x22000000 if MACH_SUN9I ++ default 0x42000000 ++ + config SYS_SOC + default "sunxi" + diff --git a/package/boot/uboot-d1/patches/0070-sunxi-Move-TEXT_BASE-to-the-board-Kconfig.patch b/package/boot/uboot-d1/patches/0070-sunxi-Move-TEXT_BASE-to-the-board-Kconfig.patch new file mode 100644 index 00000000000000..910e02c0d27ed3 --- /dev/null +++ b/package/boot/uboot-d1/patches/0070-sunxi-Move-TEXT_BASE-to-the-board-Kconfig.patch @@ -0,0 +1,42 @@ +From 08b45a89c7b25eb7828589360cf4ca2d9910cc59 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Fri, 5 Aug 2022 21:48:53 -0500 +Subject: [PATCH 70/90] sunxi: Move TEXT_BASE to the board Kconfig + +This is how the vast majority of platforms provided TEXT_BASE. +sunxi was the exception here. + +Signed-off-by: Samuel Holland +--- + board/sunxi/Kconfig | 6 ++++++ + boot/Kconfig | 4 ---- + 2 files changed, 6 insertions(+), 4 deletions(-) + +--- a/board/sunxi/Kconfig ++++ b/board/sunxi/Kconfig +@@ -137,6 +137,12 @@ config SYS_LOAD_ADDR + config SYS_SOC + default "sunxi" + ++config TEXT_BASE ++ default 0x81700000 if MACH_SUNIV ++ default 0x2a000000 if MACH_SUN9I ++ default 0x4a000000 if SUNXI_MINIMUM_DRAM_MB >= 256 ++ default 0x42e00000 if SUNXI_MINIMUM_DRAM_MB >= 64 ++ + menu "sunxi board options" + + choice +--- a/boot/Kconfig ++++ b/boot/Kconfig +@@ -633,10 +633,6 @@ config TEXT_BASE + depends on HAVE_TEXT_BASE + default 0x0 if POSITION_INDEPENDENT + default 0x80800000 if ARCH_OMAP2PLUS || ARCH_K3 +- default 0x81700000 if MACH_SUNIV +- default 0x2a000000 if MACH_SUN9I +- default 0x4a000000 if SUNXI_MINIMUM_DRAM_MB >= 256 +- default 0x42e00000 if SUNXI_MINIMUM_DRAM_MB >= 64 + hex "Text Base" + help + The address in memory that U-Boot will be running from, initially. diff --git a/package/boot/uboot-d1/patches/0071-sunxi-Move-most-board-options-to-the-board-Kconfig.patch b/package/boot/uboot-d1/patches/0071-sunxi-Move-most-board-options-to-the-board-Kconfig.patch new file mode 100644 index 00000000000000..fdcd72568766cf --- /dev/null +++ b/package/boot/uboot-d1/patches/0071-sunxi-Move-most-board-options-to-the-board-Kconfig.patch @@ -0,0 +1,197 @@ +From 6a1b660a83b262237b6bebed26e44db923a86a6b Mon Sep 17 00:00:00 2001 +From: Zoltan HERPAI +Date: Tue, 6 Jun 2023 18:09:19 +0000 +Subject: [PATCH 71/90] sunxi: Move most board options to the board Kconfig + +This excludes options that are inherently ARM-specific or are specific +to legacy non-DM drivers. + +Some help text is cleaned up along the way. + +Signed-off-by: Samuel Holland +Signed-off-by: Zoltan HERPAI +--- + arch/arm/mach-sunxi/Kconfig | 71 ------------------------------------ + board/sunxi/Kconfig | 72 +++++++++++++++++++++++++++++++++++++ + 2 files changed, 72 insertions(+), 71 deletions(-) + +--- a/arch/arm/mach-sunxi/Kconfig ++++ b/arch/arm/mach-sunxi/Kconfig +@@ -548,16 +548,6 @@ config DRAM_ODT_CORRECTION + then the correction is negative. Usually the value for this is 0. + endif + +-config UART0_PORT_F +- bool "UART0 on MicroSD breakout board" +- ---help--- +- Repurpose the SD card slot for getting access to the UART0 serial +- console. Primarily useful only for low level u-boot debugging on +- tablets, where normal UART0 is difficult to access and requires +- device disassembly and/or soldering. As the SD card can't be used +- at the same time, the system can be only booted in the FEL mode. +- Only enable this if you really know what you are doing. +- + config OLD_SUNXI_KERNEL_COMPAT + bool "Enable workarounds for booting old kernels" + ---help--- +@@ -571,20 +561,6 @@ config MACPWR + Set the pin used to power the MAC. This takes a string in the format + understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H. + +-config MMC1_PINS_PH +- bool "Pins for mmc1 are on Port H" +- depends on MACH_SUN4I || MACH_SUN7I || MACH_SUN8I_R40 +- ---help--- +- Select this option for boards where mmc1 uses the Port H pinmux. +- +-config MMC_SUNXI_SLOT_EXTRA +- int "mmc extra slot number" +- default -1 +- ---help--- +- sunxi builds always enable mmc0, some boards also have a second sdcard +- slot or emmc on mmc1 - mmc3. Setting this to 1, 2 or 3 will enable +- support for this. +- + config I2C0_ENABLE + bool "Enable I2C/TWI controller 0" + default y if MACH_SUN4I || MACH_SUN5I || MACH_SUN7I || MACH_SUN8I_R40 +@@ -612,16 +588,6 @@ config R_I2C_ENABLE + Set this to y to enable the I2C controller which is part of the PRCM. + endif + +-config AXP_DISABLE_BOOT_ON_POWERON +- bool "Disable device boot on power plug-in" +- depends on AXP209_POWER || AXP221_POWER || AXP809_POWER || AXP818_POWER +- default n +- ---help--- +- Say Y here to prevent the device from booting up because of a plug-in +- event. When set, the device will boot into the SPL briefly to +- determine why it was powered on, and if it was determined because of +- a plug-in event instead of a button press event it will shut back off. +- + config VIDEO_SUNXI + bool "Enable graphical uboot console on HDMI, LCD or VGA" + depends on !MACH_SUN8I_A83T +@@ -850,41 +816,4 @@ config SPL_SPI_SUNXI + sunxi SPI Flash. It uses the same method as the boot ROM, so does + not need any extra configuration. + +-config PINE64_DT_SELECTION +- bool "Enable Pine64 device tree selection code" +- depends on MACH_SUN50I +- help +- The original Pine A64 and Pine A64+ are similar but different +- boards and can be differed by the DRAM size. Pine A64 has +- 512MiB DRAM, and Pine A64+ has 1GiB or 2GiB. By selecting this +- option, the device tree selection code specific to Pine64 which +- utilizes the DRAM size will be enabled. +- +-config PINEPHONE_DT_SELECTION +- bool "Enable PinePhone device tree selection code" +- depends on MACH_SUN50I +- help +- Enable this option to automatically select the device tree for the +- correct PinePhone hardware revision during boot. +- +-config BLUETOOTH_DT_DEVICE_FIXUP +- string "Fixup the Bluetooth controller address" +- default "" +- help +- This option specifies the DT compatible name of the Bluetooth +- controller for which to set the "local-bd-address" property. +- Set this option if your device ships with the Bluetooth controller +- default address. +- The used address is "bdaddr" if set, and "ethaddr" with the LSB +- flipped elsewise. +- + endif +- +-config CHIP_DIP_SCAN +- bool "Enable DIPs detection for CHIP board" +- select SUPPORT_EXTENSION_SCAN +- select W1 +- select W1_GPIO +- select W1_EEPROM +- select W1_EEPROM_DS24XXX +- select CMD_EXTENSION +--- a/board/sunxi/Kconfig ++++ b/board/sunxi/Kconfig +@@ -171,6 +171,78 @@ config SPL_IMAGE_TYPE + default "sunxi_egon" if SPL_IMAGE_TYPE_SUNXI_EGON + default "sunxi_toc0" if SPL_IMAGE_TYPE_SUNXI_TOC0 + ++config MMC_SUNXI_SLOT_EXTRA ++ int "MMC extra slot number" ++ default -1 ++ help ++ sunxi builds always enable mmc0. Some boards also have a ++ second SD card slot or eMMC on mmc1 - mmc3. Setting this to 1, ++ 2 or 3 will enable support for this. ++ ++config MMC1_PINS_PH ++ bool "MMC1 pins are on Port H" ++ depends on MACH_SUN4I || MACH_SUN7I || MACH_SUN8I_R40 ++ help ++ Select this option on boards where mmc1 uses the Port H pinmux. ++ ++config UART0_PORT_F ++ bool "UART0 pins are on Port F (MicroSD breakout board)" ++ help ++ Repurpose the SD card slot for getting access to the UART0 ++ serial console. Primarily useful only for low level u-boot ++ debugging on tablets, where normal UART0 is difficult to ++ access and requires device disassembly and/or soldering. As ++ the SD card can't be used at the same time, the system can be ++ only booted in FEL mode. Only enable this if you really know ++ what you are doing. ++ ++config AXP_DISABLE_BOOT_ON_POWERON ++ bool "Disable device boot on power plug-in" ++ depends on AXP209_POWER || AXP221_POWER || AXP809_POWER || AXP818_POWER ++ help ++ Say Y here to prevent the device from booting up because of a ++ plug-in event. When set, the device will boot into the SPL ++ briefly to determine why it was powered on, and if the board ++ was powered on because of a plug-in event instead of a button ++ press event, it will shut back off. ++ ++config CHIP_DIP_SCAN ++ bool "Enable DIPs detection for CHIP board" ++ select SUPPORT_EXTENSION_SCAN ++ select W1 ++ select W1_GPIO ++ select W1_EEPROM ++ select W1_EEPROM_DS24XXX ++ select CMD_EXTENSION ++ ++config PINE64_DT_SELECTION ++ bool "Enable Pine64 device tree selection code" ++ depends on MACH_SUN50I ++ help ++ The original Pine A64 and Pine A64+ are similar but different ++ boards and can be differed by the DRAM size. Pine A64 has ++ 512MiB DRAM, and Pine A64+ has 1GiB or 2GiB. By selecting this ++ option, the device tree selection code specific to Pine64 which ++ utilizes the DRAM size will be enabled. ++ ++config PINEPHONE_DT_SELECTION ++ bool "Enable PinePhone device tree selection code" ++ depends on MACH_SUN50I ++ help ++ Enable this option to automatically select the device tree for the ++ correct PinePhone hardware revision during boot. ++ ++config BLUETOOTH_DT_DEVICE_FIXUP ++ string "Fixup the Bluetooth controller address" ++ default "" ++ help ++ This option specifies the DT compatible name of the Bluetooth ++ controller for which to set the "local-bd-address" property. ++ Set this option if your device ships with the Bluetooth controller ++ default address. ++ The used address is "bdaddr" if set, and "ethaddr" with the LSB ++ flipped elsewise. ++ + endmenu + + endif diff --git a/package/boot/uboot-d1/patches/0072-env-sunxi-Replace-ARCH_SUNXI-with-BOARD_SUNXI.patch b/package/boot/uboot-d1/patches/0072-env-sunxi-Replace-ARCH_SUNXI-with-BOARD_SUNXI.patch new file mode 100644 index 00000000000000..3fcfc205953e2c --- /dev/null +++ b/package/boot/uboot-d1/patches/0072-env-sunxi-Replace-ARCH_SUNXI-with-BOARD_SUNXI.patch @@ -0,0 +1,69 @@ +From 27834df51087a005b0330f094492b984cc225f6a Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Fri, 5 Aug 2022 23:28:54 -0500 +Subject: [PATCH 72/90] env: sunxi: Replace ARCH_SUNXI with BOARD_SUNXI + +This ensures the same environment layout will be used across all sunxi +boards, regardless of CPU architecture. + +Signed-off-by: Samuel Holland +--- + env/Kconfig | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +--- a/env/Kconfig ++++ b/env/Kconfig +@@ -92,7 +92,7 @@ config ENV_IS_IN_FAT + bool "Environment is in a FAT filesystem" + depends on !CHAIN_OF_TRUST + default y if ARCH_BCM283X +- default y if ARCH_SUNXI && MMC ++ default y if BOARD_SUNXI && MMC + default y if MMC_OMAP_HS && TI_COMMON_CMD_OPTIONS + select FS_FAT + select FAT_WRITE +@@ -338,7 +338,7 @@ config ENV_IS_IN_SPI_FLASH + default y if NORTHBRIDGE_INTEL_IVYBRIDGE + default y if INTEL_QUARK + default y if INTEL_QUEENSBAY +- default y if ARCH_SUNXI ++ default y if BOARD_SUNXI + help + Define this if you have a SPI Flash memory device which you + want to use for the environment. +@@ -461,7 +461,7 @@ config ENV_FAT_DEVICE_AND_PART + depends on ENV_IS_IN_FAT + default "0:1" if TI_COMMON_CMD_OPTIONS + default "0:auto" if ARCH_ZYNQ || ARCH_ZYNQMP || ARCH_VERSAL +- default ":auto" if ARCH_SUNXI ++ default ":auto" if BOARD_SUNXI + default "0" if ARCH_AT91 + help + Define this to a string to specify the partition of the device. It can +@@ -555,7 +555,7 @@ config ENV_OFFSET + ENV_IS_IN_SPI_FLASH + default 0x3f8000 if ARCH_ROCKCHIP && ENV_IS_IN_MMC + default 0x140000 if ARCH_ROCKCHIP && ENV_IS_IN_SPI_FLASH +- default 0xF0000 if ARCH_SUNXI ++ default 0xF0000 if BOARD_SUNXI + default 0xE0000 if ARCH_ZYNQ + default 0x1E00000 if ARCH_ZYNQMP + default 0x7F40000 if ARCH_VERSAL || ARCH_VERSAL_NET +@@ -580,7 +580,7 @@ config ENV_SIZE + hex "Environment Size" + default 0x40000 if ENV_IS_IN_SPI_FLASH && ARCH_ZYNQMP + default 0x20000 if ARCH_ZYNQ || ARCH_OMAP2PLUS || ARCH_AT91 +- default 0x10000 if ARCH_SUNXI ++ default 0x10000 if BOARD_SUNXI + default 0x8000 if ARCH_ROCKCHIP && ENV_IS_IN_MMC + default 0x2000 if ARCH_ROCKCHIP && ENV_IS_IN_SPI_FLASH + default 0x8000 if ARCH_ZYNQMP || ARCH_VERSAL || ARCH_VERSAL_NET +@@ -596,7 +596,7 @@ config ENV_SECT_SIZE + default 0x40000 if ARCH_ZYNQMP || ARCH_VERSAL || ARCH_VERSAL_NET + default 0x20000 if ARCH_ZYNQ || ARCH_OMAP2PLUS || ARCH_AT91 + default 0x20000 if MICROBLAZE && ENV_IS_IN_SPI_FLASH +- default 0x10000 if ARCH_SUNXI && ENV_IS_IN_SPI_FLASH ++ default 0x10000 if BOARD_SUNXI && ENV_IS_IN_SPI_FLASH + help + Size of the sector containing the environment. + diff --git a/package/boot/uboot-d1/patches/0073-drivers-sunxi-Replace-ARCH_SUNXI-with-BOARD_SUNXI.patch b/package/boot/uboot-d1/patches/0073-drivers-sunxi-Replace-ARCH_SUNXI-with-BOARD_SUNXI.patch new file mode 100644 index 00000000000000..4e2386304037da --- /dev/null +++ b/package/boot/uboot-d1/patches/0073-drivers-sunxi-Replace-ARCH_SUNXI-with-BOARD_SUNXI.patch @@ -0,0 +1,264 @@ +From 666d3c2bc058268a976397ec3e258f532edcfeb2 Mon Sep 17 00:00:00 2001 +From: Zoltan HERPAI +Date: Tue, 6 Jun 2023 18:12:11 +0000 +Subject: [PATCH 73/90] drivers: sunxi: Replace ARCH_SUNXI with BOARD_SUNXI + +This provides a unified configuration across all sunxi boards, +regardless of CPU architecture. + +Signed-off-by: Samuel Holland +Signed-off-by: Zoltan HERPAI +--- + drivers/clk/sunxi/Kconfig | 2 +- + drivers/fastboot/Kconfig | 13 ++++++------- + drivers/gpio/Kconfig | 2 +- + drivers/mmc/Kconfig | 2 +- + drivers/net/phy/Kconfig | 4 ++-- + drivers/phy/allwinner/Kconfig | 2 +- + drivers/pinctrl/sunxi/Kconfig | 2 +- + drivers/reset/Kconfig | 2 +- + drivers/spi/Kconfig | 2 +- + drivers/usb/Kconfig | 2 +- + drivers/usb/gadget/Kconfig | 8 ++++---- + drivers/usb/musb-new/Kconfig | 2 +- + drivers/video/Kconfig | 2 +- + drivers/watchdog/Kconfig | 4 ++-- + 14 files changed, 24 insertions(+), 25 deletions(-) + +--- a/drivers/clk/sunxi/Kconfig ++++ b/drivers/clk/sunxi/Kconfig +@@ -1,6 +1,6 @@ + config CLK_SUNXI + bool "Clock support for Allwinner SoCs" +- depends on CLK && ARCH_SUNXI ++ depends on CLK && BOARD_SUNXI + select DM_RESET + select SPL_DM_RESET if SPL_CLK + default y +--- a/drivers/fastboot/Kconfig ++++ b/drivers/fastboot/Kconfig +@@ -8,7 +8,7 @@ config FASTBOOT + config USB_FUNCTION_FASTBOOT + bool "Enable USB fastboot gadget" + depends on USB_GADGET +- default y if ARCH_SUNXI && USB_MUSB_GADGET ++ default y if BOARD_SUNXI && USB_MUSB_GADGET + select FASTBOOT + select USB_GADGET_DOWNLOAD + help +@@ -32,10 +32,9 @@ if FASTBOOT + + config FASTBOOT_BUF_ADDR + hex "Define FASTBOOT buffer address" ++ default SYS_LOAD_ADDR if BOARD_SUNXI + default 0x82000000 if MX6SX || MX6SL || MX6UL || MX6SLL + default 0x81000000 if ARCH_OMAP2PLUS +- default 0x42000000 if ARCH_SUNXI && !MACH_SUN9I +- default 0x22000000 if ARCH_SUNXI && MACH_SUN9I + default 0x60800800 if ROCKCHIP_RK3036 || ROCKCHIP_RK3188 || \ + ROCKCHIP_RK322X + default 0x800800 if ROCKCHIP_RK3288 || ROCKCHIP_RK3329 || \ +@@ -52,7 +51,7 @@ config FASTBOOT_BUF_SIZE + hex "Define FASTBOOT buffer size" + default 0x8000000 if ARCH_ROCKCHIP + default 0x6000000 if ARCH_ZYNQMP +- default 0x2000000 if ARCH_SUNXI ++ default 0x2000000 if BOARD_SUNXI + default 0x8192 if SANDBOX + default 0x7000000 + help +@@ -71,7 +70,7 @@ config FASTBOOT_USB_DEV + + config FASTBOOT_FLASH + bool "Enable FASTBOOT FLASH command" +- default y if ARCH_SUNXI || ARCH_ROCKCHIP ++ default y if BOARD_SUNXI || ARCH_ROCKCHIP + depends on MMC || (MTD_RAW_NAND && CMD_MTDPARTS) + select IMAGE_SPARSE + help +@@ -105,8 +104,8 @@ config FASTBOOT_FLASH_MMC_DEV + int "Define FASTBOOT MMC FLASH default device" + depends on FASTBOOT_FLASH_MMC + default 0 if ARCH_ROCKCHIP +- default 0 if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA = -1 +- default 1 if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA != -1 ++ default 0 if BOARD_SUNXI && MMC_SUNXI_SLOT_EXTRA = -1 ++ default 1 if BOARD_SUNXI && MMC_SUNXI_SLOT_EXTRA != -1 + help + The fastboot "flash" command requires additional information + regarding the non-volatile storage device. Define this to +--- a/drivers/gpio/Kconfig ++++ b/drivers/gpio/Kconfig +@@ -370,7 +370,7 @@ config SANDBOX_GPIO_COUNT + + config SUNXI_GPIO + bool "Allwinner GPIO driver" +- depends on ARCH_SUNXI ++ depends on BOARD_SUNXI + select SPL_STRTO if SPL + help + Support the GPIO device in Allwinner SoCs. +--- a/drivers/mmc/Kconfig ++++ b/drivers/mmc/Kconfig +@@ -756,7 +756,7 @@ config ZYNQ_HISPD_BROKEN + + config MMC_SUNXI + bool "Allwinner sunxi SD/MMC Host Controller support" +- depends on ARCH_SUNXI ++ depends on BOARD_SUNXI + default y + help + This selects support for the SD/MMC Host Controller on +--- a/drivers/net/phy/Kconfig ++++ b/drivers/net/phy/Kconfig +@@ -19,14 +19,14 @@ if PHYLIB + + config PHY_ADDR_ENABLE + bool "Limit phy address" +- default y if ARCH_SUNXI ++ default y if BOARD_SUNXI + help + Select this if you want to control which phy address is used + + if PHY_ADDR_ENABLE + config PHY_ADDR + int "PHY address" +- default 1 if ARCH_SUNXI ++ default 1 if BOARD_SUNXI + default 0 + help + The address of PHY on MII bus. Usually in range of 0 to 31. +--- a/drivers/phy/allwinner/Kconfig ++++ b/drivers/phy/allwinner/Kconfig +@@ -3,7 +3,7 @@ + # + config PHY_SUN4I_USB + bool "Allwinner Sun4I USB PHY driver" +- depends on ARCH_SUNXI && !MACH_SUN9I ++ depends on depends on BOARD_SUNXI + default y + select DM_REGULATOR + select PHY +--- a/drivers/pinctrl/sunxi/Kconfig ++++ b/drivers/pinctrl/sunxi/Kconfig +@@ -1,6 +1,6 @@ + # SPDX-License-Identifier: GPL-2.0 + +-if ARCH_SUNXI ++if BOARD_SUNXI + + config PINCTRL_SUNXI + select PINCTRL_FULL +--- a/drivers/reset/Kconfig ++++ b/drivers/reset/Kconfig +@@ -137,7 +137,7 @@ config RESET_MTMIPS + + config RESET_SUNXI + bool "RESET support for Allwinner SoCs" +- depends on DM_RESET && ARCH_SUNXI ++ depends on DM_RESET && BOARD_SUNXI + default y + help + This enables support for common reset driver for +--- a/drivers/spi/Kconfig ++++ b/drivers/spi/Kconfig +@@ -453,7 +453,7 @@ config SOFT_SPI + + config SPI_SUNXI + bool "Allwinner SoC SPI controllers" +- default ARCH_SUNXI ++ default BOARD_SUNXI + help + Enable the Allwinner SoC SPi controller driver. + +--- a/drivers/usb/Kconfig ++++ b/drivers/usb/Kconfig +@@ -116,7 +116,7 @@ config USB_KEYBOARD_FN_KEYS + + choice + prompt "USB keyboard polling" +- default SYS_USB_EVENT_POLL_VIA_INT_QUEUE if ARCH_SUNXI ++ default SYS_USB_EVENT_POLL_VIA_INT_QUEUE if BOARD_SUNXI + default SYS_USB_EVENT_POLL + ---help--- + Enable a polling mechanism for USB keyboard. +--- a/drivers/usb/gadget/Kconfig ++++ b/drivers/usb/gadget/Kconfig +@@ -40,7 +40,7 @@ if USB_GADGET + + config USB_GADGET_MANUFACTURER + string "Vendor name of the USB device" +- default "Allwinner Technology" if ARCH_SUNXI ++ default "Allwinner Technology" if BOARD_SUNXI + default "Rockchip" if ARCH_ROCKCHIP + default "U-Boot" + help +@@ -49,7 +49,7 @@ config USB_GADGET_MANUFACTURER + + config USB_GADGET_VENDOR_NUM + hex "Vendor ID of the USB device" +- default 0x1f3a if ARCH_SUNXI ++ default 0x1f3a if BOARD_SUNXI + default 0x2207 if ARCH_ROCKCHIP + default 0x0 + help +@@ -59,7 +59,7 @@ config USB_GADGET_VENDOR_NUM + + config USB_GADGET_PRODUCT_NUM + hex "Product ID of the USB device" +- default 0x1010 if ARCH_SUNXI ++ default 0x1010 if BOARD_SUNXI + default 0x310a if ROCKCHIP_RK3036 + default 0x300a if ROCKCHIP_RK3066 + default 0x310c if ROCKCHIP_RK3128 +@@ -202,7 +202,7 @@ endif # USB_GADGET_DOWNLOAD + config USB_ETHER + bool "USB Ethernet Gadget" + depends on NET +- default y if ARCH_SUNXI && USB_MUSB_GADGET ++ default y if BOARD_SUNXI && USB_MUSB_GADGET + help + Creates an Ethernet network device through a USB peripheral + controller. This will create a network interface on both the device +--- a/drivers/usb/musb-new/Kconfig ++++ b/drivers/usb/musb-new/Kconfig +@@ -67,7 +67,7 @@ config USB_MUSB_PIC32 + + config USB_MUSB_SUNXI + bool "Enable sunxi OTG / DRC USB controller" +- depends on ARCH_SUNXI ++ depends on BOARD_SUNXI + select USB_MUSB_PIO_ONLY + default y + ---help--- +--- a/drivers/video/Kconfig ++++ b/drivers/video/Kconfig +@@ -183,7 +183,7 @@ config CONSOLE_TRUETYPE_MAX_METRICS + + config SYS_WHITE_ON_BLACK + bool "Display console as white on a black background" +- default y if ARCH_AT91 || ARCH_EXYNOS || ARCH_ROCKCHIP || ARCH_TEGRA || X86 || ARCH_SUNXI ++ default y if ARCH_AT91 || ARCH_EXYNOS || ARCH_ROCKCHIP || ARCH_TEGRA || X86 || BOARD_SUNXI + help + Normally the display is black on a white background, Enable this + option to invert this, i.e. white on a black background. This can be +--- a/drivers/watchdog/Kconfig ++++ b/drivers/watchdog/Kconfig +@@ -29,7 +29,7 @@ config WATCHDOG_TIMEOUT_MSECS + default 128000 if ARCH_MX31 || ARCH_MX5 || ARCH_MX6 + default 128000 if ARCH_MX7 || ARCH_VF610 + default 30000 if ARCH_SOCFPGA +- default 16000 if ARCH_SUNXI ++ default 16000 if BOARD_SUNXI + default 60000 + help + Watchdog timeout in msec +@@ -321,7 +321,7 @@ config WDT_STM32MP + + config WDT_SUNXI + bool "Allwinner sunxi watchdog timer support" +- depends on WDT && ARCH_SUNXI ++ depends on WDT && BOARD_SUNXI + default y + help + Enable support for the watchdog timer in Allwinner sunxi SoCs. diff --git a/package/boot/uboot-d1/patches/0074-disk-sunxi-Replace-ARCH_SUNXI-with-BOARD_SUNXI.patch b/package/boot/uboot-d1/patches/0074-disk-sunxi-Replace-ARCH_SUNXI-with-BOARD_SUNXI.patch new file mode 100644 index 00000000000000..68a3a684e02690 --- /dev/null +++ b/package/boot/uboot-d1/patches/0074-disk-sunxi-Replace-ARCH_SUNXI-with-BOARD_SUNXI.patch @@ -0,0 +1,42 @@ +From 98fb93ceb936b375d7f8f2908f0703a93e27fbc4 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sat, 6 Aug 2022 00:05:52 -0500 +Subject: [PATCH 74/90] disk: sunxi: Replace ARCH_SUNXI with BOARD_SUNXI + +This provides a unified configuration across all sunxi boards, +regardless of CPU architecture. + +Signed-off-by: Samuel Holland +--- + disk/Kconfig | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/disk/Kconfig ++++ b/disk/Kconfig +@@ -61,7 +61,7 @@ config SPL_DOS_PARTITION + bool "Enable MS Dos partition table for SPL" + depends on SPL + default n if ARCH_MVEBU +- default n if ARCH_SUNXI ++ default n if BOARD_SUNXI + default y if DOS_PARTITION + select SPL_PARTITIONS + +@@ -104,7 +104,7 @@ config EFI_PARTITION + config EFI_PARTITION_ENTRIES_NUMBERS + int "Number of the EFI partition entries" + depends on EFI_PARTITION +- default 56 if ARCH_SUNXI ++ default 56 if BOARD_SUNXI + default 128 + help + Specify the number of partition entries in the GPT. This is +@@ -132,7 +132,7 @@ config SPL_EFI_PARTITION + bool "Enable EFI GPT partition table for SPL" + depends on SPL + default n if ARCH_MVEBU +- default n if ARCH_SUNXI ++ default n if BOARD_SUNXI + default y if EFI_PARTITION + select SPL_PARTITIONS + diff --git a/package/boot/uboot-d1/patches/0075-spl-sunxi-Replace-ARCH_SUNXI-with-BOARD_SUNXI.patch b/package/boot/uboot-d1/patches/0075-spl-sunxi-Replace-ARCH_SUNXI-with-BOARD_SUNXI.patch new file mode 100644 index 00000000000000..81b6b45c7312af --- /dev/null +++ b/package/boot/uboot-d1/patches/0075-spl-sunxi-Replace-ARCH_SUNXI-with-BOARD_SUNXI.patch @@ -0,0 +1,81 @@ +From 7f06dca4df9302a22a8d27af887da50a67b7dd1d Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sat, 6 Aug 2022 00:09:38 -0500 +Subject: [PATCH 75/90] spl: sunxi: Replace ARCH_SUNXI with BOARD_SUNXI + +This provides a unified configuration across all sunxi boards, +regardless of CPU architecture. + +Signed-off-by: Samuel Holland +--- + common/spl/Kconfig | 12 ++++++------ + scripts/Makefile.spl | 2 +- + 2 files changed, 7 insertions(+), 7 deletions(-) + +--- a/common/spl/Kconfig ++++ b/common/spl/Kconfig +@@ -111,7 +111,7 @@ config SPL_PAD_TO + config SPL_HAS_BSS_LINKER_SECTION + depends on SPL_FRAMEWORK + bool "Use a specific address for the BSS via the linker script" +- default y if ARCH_SUNXI || ARCH_MX6 || ARCH_OMAP2PLUS || MIPS || RISCV || ARCH_ZYNQMP ++ default y if ARCH_MX6 || ARCH_OMAP2PLUS || ARCH_ZYNQMP || BOARD_SUNXI || MIPS || RISCV + + config SPL_BSS_START_ADDR + hex "Link address for the BSS within the SPL binary" +@@ -335,7 +335,7 @@ config SPL_SYS_MALLOC_SIMPLE + config SPL_SHARES_INIT_SP_ADDR + bool "SPL and U-Boot use the same initial stack pointer location" + depends on (ARM || ARCH_JZ47XX || MICROBLAZE || RISCV) && SPL_FRAMEWORK +- default n if ARCH_SUNXI || ARCH_MX6 || ARCH_MX7 ++ default n if BOARD_SUNXI || ARCH_MX6 || ARCH_MX7 + default y + help + In many cases, we can use the same initial stack pointer address for +@@ -453,7 +453,7 @@ config SPL_DISPLAY_PRINT + + config SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR + bool "MMC raw mode: by sector" +- default y if ARCH_SUNXI || ARCH_DAVINCI || ARCH_UNIPHIER || \ ++ default y if BOARD_SUNXI || ARCH_DAVINCI || ARCH_UNIPHIER || \ + ARCH_MX6 || ARCH_MX7 || \ + ARCH_ROCKCHIP || ARCH_MVEBU || ARCH_SOCFPGA || \ + ARCH_AT91 || ARCH_ZYNQ || ARCH_KEYSTONE || OMAP34XX || \ +@@ -466,7 +466,7 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_USE_SEC + config SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR + hex "Address on the MMC to load U-Boot from" + depends on SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR +- default 0x40 if ARCH_SUNXI ++ default 0x40 if BOARD_SUNXI + default 0x75 if ARCH_DAVINCI + default 0x8a if ARCH_MX6 || ARCH_MX7 + default 0x100 if ARCH_UNIPHIER +@@ -483,7 +483,7 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR + config SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET + hex "U-Boot main hardware partition image offset" + depends on SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR +- default 0x10 if ARCH_SUNXI ++ default 0x10 if BOARD_SUNXI + default 0x0 + help + On some platforms SPL location depends on hardware partition. The ROM +@@ -1308,7 +1308,7 @@ endif # SPL_SPI_FLASH_SUPPORT + + config SYS_SPI_U_BOOT_OFFS + hex "address of u-boot payload in SPI flash" +- default 0x8000 if ARCH_SUNXI ++ default 0x8000 if BOARD_SUNXI + default 0x0 + depends on SPL_SPI_LOAD || SPL_SPI_SUNXI + help +--- a/scripts/Makefile.spl ++++ b/scripts/Makefile.spl +@@ -264,7 +264,7 @@ endif + + INPUTS-$(CONFIG_TARGET_SOCFPGA_SOC64) += $(obj)/u-boot-spl-dtb.hex + +-ifdef CONFIG_ARCH_SUNXI ++ifdef CONFIG_BOARD_SUNXI + INPUTS-y += $(obj)/sunxi-spl.bin + + ifdef CONFIG_NAND_SUNXI diff --git a/package/boot/uboot-d1/patches/0076-riscv-cpu-Add-cache-operations-for-T-HEAD-CPUs.patch b/package/boot/uboot-d1/patches/0076-riscv-cpu-Add-cache-operations-for-T-HEAD-CPUs.patch new file mode 100644 index 00000000000000..0555b6d9b409d8 --- /dev/null +++ b/package/boot/uboot-d1/patches/0076-riscv-cpu-Add-cache-operations-for-T-HEAD-CPUs.patch @@ -0,0 +1,153 @@ +From b6da98cd39612bb5660afbcad06e3a6bac43563e Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sat, 11 Sep 2021 23:27:42 -0500 +Subject: [PATCH 76/90] riscv: cpu: Add cache operations for T-HEAD CPUs + +Signed-off-by: Samuel Holland +--- + arch/riscv/cpu/Makefile | 1 + + arch/riscv/cpu/thead/cache.c | 119 +++++++++++++++++++++++++++++++++++ + arch/riscv/lib/cache.c | 2 +- + 3 files changed, 121 insertions(+), 1 deletion(-) + create mode 100644 arch/riscv/cpu/thead/cache.c + +--- a/arch/riscv/cpu/Makefile ++++ b/arch/riscv/cpu/Makefile +@@ -5,3 +5,4 @@ + extra-y = start.o + + obj-y += cpu.o mtrap.o ++obj-y += thead/cache.o +--- /dev/null ++++ b/arch/riscv/cpu/thead/cache.c +@@ -0,0 +1,119 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++ ++#include ++#include ++ ++#define CSR_MHCR 0x7c1 ++#define CSR_MCOR 0x7c2 ++#define CSR_MHINT 0x7c5 ++ ++#define MHCR_IE BIT(0) /* icache enable */ ++#define MHCR_DE BIT(1) /* dcache enable */ ++#define MHCR_WA BIT(2) /* dcache write allocate */ ++#define MHCR_WB BIT(3) /* dcache write back */ ++#define MHCR_RS BIT(4) /* return stack enable */ ++#define MHCR_BPE BIT(5) /* branch prediction enable */ ++#define MHCR_BTB BIT(6) /* branch target prediction enable */ ++#define MHCR_WBR BIT(8) /* write burst enable */ ++#define MHCR_L0BTB BIT(12) ++ ++#define MCOR_CACHE_SEL_ICACHE (0x1 << 0) ++#define MCOR_CACHE_SEL_DCACHE (0x2 << 0) ++#define MCOR_CACHE_SEL_BOTH (0x3 << 0) ++#define MCOR_INV BIT(4) ++#define MCOR_CLR BIT(5) ++#define MCOR_BHT_INV BIT(16) ++#define MCOR_BTB_INV BIT(17) ++ ++#define MHINT_DPLD BIT(2) /* dcache prefetch enable */ ++#define MHINT_AMR_PAGE (0x0 << 3) ++#define MHINT_AMR_LIMIT_3 (0x1 << 3) ++#define MHINT_AMR_LIMIT_64 (0x2 << 3) ++#define MHINT_AMR_LIMIT_128 (0x3 << 3) ++#define MHINT_IPLD BIT(8) /* icache prefetch enable */ ++#define MHINT_IWPE BIT(9) /* icache prediction enable */ ++#define MHINT_DIS_PREFETCH_2 (0x0 << 13) ++#define MHINT_DIS_PREFETCH_4 (0x1 << 13) ++#define MHINT_DIS_PREFETCH_8 (0x2 << 13) ++#define MHINT_DIS_PREFETCH_16 (0x3 << 13) ++ ++#define sync_i() asm volatile (".long 0x01a0000b" ::: "memory") ++ ++void flush_dcache_all(void) ++{ ++ asm volatile (".long 0x0030000b" ::: "memory"); /* dcache.ciall */ ++ sync_i(); ++} ++ ++void flush_dcache_range(unsigned long start, unsigned long end) ++{ ++ register unsigned long i asm("a0") = start & -CONFIG_SYS_CACHELINE_SIZE; ++ ++ for (; i < end; i += CONFIG_SYS_CACHELINE_SIZE) ++ asm volatile (".long 0x02b5000b" ::: "memory"); /* dcache.cipa a0 */ ++ sync_i(); ++} ++ ++void invalidate_icache_range(unsigned long start, unsigned long end) ++{ ++ register unsigned long i asm("a0") = start & -CONFIG_SYS_CACHELINE_SIZE; ++ ++ for (; i < end; i += CONFIG_SYS_CACHELINE_SIZE) ++ asm volatile (".long 0x0385000b" ::: "memory"); /* icache.ipa a0 */ ++ sync_i(); ++} ++ ++void invalidate_dcache_range(unsigned long start, unsigned long end) ++{ ++ register unsigned long i asm("a0") = start & -CONFIG_SYS_CACHELINE_SIZE; ++ ++ for (; i < end; i += CONFIG_SYS_CACHELINE_SIZE) ++ asm volatile (".long 0x02a5000b" ::: "memory"); /* dcache.ipa a0 */ ++ sync_i(); ++} ++ ++#if 0 ++void icache_enable(void) ++{ ++ asm volatile (".long 0x0100000b" ::: "memory"); /* icache.iall */ ++ sync_i(); ++ csr_set(CSR_MHCR, MHCR_IE | MHCR_RS | MHCR_BPE | MHCR_BTB | MHCR_L0BTB); ++ csr_set(CSR_MHINT, MHINT_IPLD | MHINT_IWPE); ++} ++ ++void icache_disable(void) ++{ ++ csr_clear(CSR_MHCR, MHCR_IE); ++} ++ ++int icache_status(void) ++{ ++ return csr_read(CSR_MHCR) & MHCR_IE; ++} ++ ++void dcache_enable(void) ++{ ++ asm volatile (".long 0x0020000b" ::: "memory"); /* dcache.iall */ ++ sync_i(); ++ csr_set(CSR_MHCR, MHCR_DE | MHCR_WA | MHCR_WB | MHCR_WBR); ++ csr_set(CSR_MHINT, MHINT_DPLD | MHINT_AMR_LIMIT_3); ++} ++ ++void dcache_disable(void) ++{ ++ asm volatile (".long 0x0010000b" ::: "memory"); /* dcache.call */ ++ sync_i(); ++ csr_clear(CSR_MHCR, MHCR_DE); ++} ++ ++int dcache_status(void) ++{ ++ return csr_read(CSR_MHCR) & MHCR_DE; ++} ++ ++void enable_caches(void) ++{ ++ icache_enable(); ++ dcache_enable(); ++} ++#endif +--- a/arch/riscv/lib/cache.c ++++ b/arch/riscv/lib/cache.c +@@ -20,7 +20,7 @@ __weak void flush_dcache_range(unsigned + { + } + +-void invalidate_icache_range(unsigned long start, unsigned long end) ++__weak void invalidate_icache_range(unsigned long start, unsigned long end) + { + /* + * RISC-V does not have an instruction for invalidating parts of the diff --git a/package/boot/uboot-d1/patches/0077-riscv-Sort-target-configs-alphabetically.patch b/package/boot/uboot-d1/patches/0077-riscv-Sort-target-configs-alphabetically.patch new file mode 100644 index 00000000000000..64577d8bd64424 --- /dev/null +++ b/package/boot/uboot-d1/patches/0077-riscv-Sort-target-configs-alphabetically.patch @@ -0,0 +1,43 @@ +From 35da34adec7b5b06ad81455a21c67a9c1152e2c9 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sat, 7 Aug 2021 12:09:35 -0500 +Subject: [PATCH 77/90] riscv: Sort target configs alphabetically + +Signed-off-by: Samuel Holland +--- + arch/riscv/Kconfig | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/arch/riscv/Kconfig ++++ b/arch/riscv/Kconfig +@@ -14,6 +14,9 @@ config TARGET_AX25_AE350 + config TARGET_MICROCHIP_ICICLE + bool "Support Microchip PolarFire-SoC Icicle Board" + ++config TARGET_OPENPITON_RISCV64 ++ bool "Support RISC-V cores on OpenPiton SoC" ++ + config TARGET_QEMU_VIRT + bool "Support QEMU Virt Board" + +@@ -28,9 +31,6 @@ config TARGET_SIPEED_MAIX + bool "Support Sipeed Maix Board" + select SYS_CACHE_SHIFT_6 + +-config TARGET_OPENPITON_RISCV64 +- bool "Support RISC-V cores on OpenPiton SoC" +- + endchoice + + config SYS_ICACHE_OFF +@@ -61,9 +61,9 @@ config SPL_SYS_DCACHE_OFF + source "board/AndesTech/ax25-ae350/Kconfig" + source "board/emulation/qemu-riscv/Kconfig" + source "board/microchip/mpfs_icicle/Kconfig" ++source "board/openpiton/riscv64/Kconfig" + source "board/sifive/unleashed/Kconfig" + source "board/sifive/unmatched/Kconfig" +-source "board/openpiton/riscv64/Kconfig" + source "board/sipeed/maix/Kconfig" + + # platform-specific options below diff --git a/package/boot/uboot-d1/patches/0078-riscv-Add-Allwinner-D1-devicetrees.patch b/package/boot/uboot-d1/patches/0078-riscv-Add-Allwinner-D1-devicetrees.patch new file mode 100644 index 00000000000000..09054d7455d934 --- /dev/null +++ b/package/boot/uboot-d1/patches/0078-riscv-Add-Allwinner-D1-devicetrees.patch @@ -0,0 +1,2138 @@ +From ce792f7abd4294ebba76f76d9d7aa90c7970de8e Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Thu, 4 Aug 2022 23:35:09 -0500 +Subject: [PATCH 78/90] riscv: Add Allwinner D1 devicetrees + +Signed-off-by: Samuel Holland +--- + arch/riscv/dts/Makefile | 9 + + .../riscv/dts/sun20i-d1-clockworkpi-v3.14.dts | 242 +++++ + .../dts/sun20i-d1-common-regulators.dtsi | 51 + + arch/riscv/dts/sun20i-d1-devterm-v3.14.dts | 37 + + .../dts/sun20i-d1-dongshan-nezha-stu.dts | 114 +++ + .../dts/sun20i-d1-lichee-rv-86-panel-480p.dts | 29 + + .../dts/sun20i-d1-lichee-rv-86-panel-720p.dts | 10 + + .../dts/sun20i-d1-lichee-rv-86-panel.dtsi | 92 ++ + arch/riscv/dts/sun20i-d1-lichee-rv-dock.dts | 74 ++ + arch/riscv/dts/sun20i-d1-lichee-rv.dts | 84 ++ + arch/riscv/dts/sun20i-d1-mangopi-mq-pro.dts | 128 +++ + arch/riscv/dts/sun20i-d1-nezha.dts | 171 ++++ + arch/riscv/dts/sun20i-d1.dtsi | 900 ++++++++++++++++++ + arch/riscv/dts/sunxi-u-boot.dtsi | 68 ++ + include/dt-bindings/clock/sun20i-d1-r-ccu.h | 19 + + include/dt-bindings/reset/sun20i-d1-r-ccu.h | 16 + + 16 files changed, 2044 insertions(+) + create mode 100644 arch/riscv/dts/sun20i-d1-clockworkpi-v3.14.dts + create mode 100644 arch/riscv/dts/sun20i-d1-common-regulators.dtsi + create mode 100644 arch/riscv/dts/sun20i-d1-devterm-v3.14.dts + create mode 100644 arch/riscv/dts/sun20i-d1-dongshan-nezha-stu.dts + create mode 100644 arch/riscv/dts/sun20i-d1-lichee-rv-86-panel-480p.dts + create mode 100644 arch/riscv/dts/sun20i-d1-lichee-rv-86-panel-720p.dts + create mode 100644 arch/riscv/dts/sun20i-d1-lichee-rv-86-panel.dtsi + create mode 100644 arch/riscv/dts/sun20i-d1-lichee-rv-dock.dts + create mode 100644 arch/riscv/dts/sun20i-d1-lichee-rv.dts + create mode 100644 arch/riscv/dts/sun20i-d1-mangopi-mq-pro.dts + create mode 100644 arch/riscv/dts/sun20i-d1-nezha.dts + create mode 100644 arch/riscv/dts/sun20i-d1.dtsi + create mode 100644 arch/riscv/dts/sunxi-u-boot.dtsi + create mode 100644 include/dt-bindings/clock/sun20i-d1-r-ccu.h + create mode 100644 include/dt-bindings/reset/sun20i-d1-r-ccu.h + +--- a/arch/riscv/dts/Makefile ++++ b/arch/riscv/dts/Makefile +@@ -7,6 +7,15 @@ dtb-$(CONFIG_TARGET_OPENPITON_RISCV64) + + dtb-$(CONFIG_TARGET_SIFIVE_UNLEASHED) += hifive-unleashed-a00.dtb + dtb-$(CONFIG_TARGET_SIFIVE_UNMATCHED) += hifive-unmatched-a00.dtb + dtb-$(CONFIG_TARGET_SIPEED_MAIX) += k210-maix-bit.dtb ++dtb-$(CONFIG_TARGET_SUN20I_D1) += sun20i-d1-clockworkpi-v3.14.dtb ++dtb-$(CONFIG_TARGET_SUN20I_D1) += sun20i-d1-devterm-v3.14.dtb ++dtb-$(CONFIG_TARGET_SUN20I_D1) += sun20i-d1-dongshan-nezha-stu.dtb ++dtb-$(CONFIG_TARGET_SUN20I_D1) += sun20i-d1-lichee-rv-86-panel-480p.dtb ++dtb-$(CONFIG_TARGET_SUN20I_D1) += sun20i-d1-lichee-rv-86-panel-720p.dtb ++dtb-$(CONFIG_TARGET_SUN20I_D1) += sun20i-d1-lichee-rv-dock.dtb ++dtb-$(CONFIG_TARGET_SUN20I_D1) += sun20i-d1-lichee-rv.dtb ++dtb-$(CONFIG_TARGET_SUN20I_D1) += sun20i-d1-mangopi-mq-pro.dtb ++dtb-$(CONFIG_TARGET_SUN20I_D1) += sun20i-d1-nezha.dtb + + include $(srctree)/scripts/Makefile.dts + +--- /dev/null ++++ b/arch/riscv/dts/sun20i-d1-clockworkpi-v3.14.dts +@@ -0,0 +1,242 @@ ++// SPDX-License-Identifier: (GPL-2.0+ or MIT) ++// Copyright (C) 2022 Samuel Holland ++ ++/dts-v1/; ++ ++#include ++ ++#include "sun20i-d1.dtsi" ++#include "sun20i-d1-common-regulators.dtsi" ++ ++/ { ++ model = "ClockworkPi v3.14 (R-01)"; ++ compatible = "clockwork,r-01-clockworkpi-v3.14", "allwinner,sun20i-d1"; ++ ++ aliases { ++ ethernet0 = &ap6256; ++ mmc0 = &mmc0; ++ serial0 = &uart0; ++ }; ++ ++ chosen { ++ stdout-path = "serial0:115200n8"; ++ }; ++ ++ /* ++ * This regulator is PWM-controlled, but the PWM controller is not ++ * yet supported, so fix the regulator to its default voltage. ++ */ ++ reg_vdd_cpu: vdd-cpu { ++ compatible = "regulator-fixed"; ++ regulator-name = "vdd-cpu"; ++ regulator-min-microvolt = <1100000>; ++ regulator-max-microvolt = <1100000>; ++ vin-supply = <®_vcc>; ++ }; ++ ++ wifi_pwrseq: wifi-pwrseq { ++ compatible = "mmc-pwrseq-simple"; ++ reset-gpios = <&pio 6 11 GPIO_ACTIVE_LOW>; /* PG11/GPIO3 */ ++ }; ++}; ++ ++&cpu0 { ++ cpu-supply = <®_vdd_cpu>; ++}; ++ ++&ehci1 { ++ status = "okay"; ++}; ++ ++&i2c0 { ++ pinctrl-0 = <&i2c0_pb10_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++ ++ axp221: pmic@34 { ++ compatible = "x-powers,axp228", "x-powers,axp221"; ++ reg = <0x34>; ++ interrupt-parent = <&pio>; ++ interrupts = <4 9 IRQ_TYPE_LEVEL_LOW>; /* PE9/GPIO2 */ ++ interrupt-controller; ++ #interrupt-cells = <1>; ++ ++ ac_power_supply: ac-power { ++ compatible = "x-powers,axp221-ac-power-supply"; ++ }; ++ ++ axp_adc: adc { ++ compatible = "x-powers,axp221-adc"; ++ #io-channel-cells = <1>; ++ }; ++ ++ battery_power_supply: battery-power { ++ compatible = "x-powers,axp221-battery-power-supply"; ++ }; ++ ++ regulators { ++ x-powers,dcdc-freq = <3000>; ++ ++ reg_dcdc1: dcdc1 { ++ regulator-name = "sys-3v3"; ++ regulator-always-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ }; ++ ++ reg_dcdc3: dcdc3 { ++ regulator-name = "sys-1v8"; ++ regulator-always-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ }; ++ ++ reg_aldo1: aldo1 { ++ regulator-name = "aud-3v3"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ }; ++ ++ reg_aldo2: aldo2 { ++ regulator-name = "disp-3v3"; ++ regulator-always-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ }; ++ ++ reg_aldo3: aldo3 { ++ regulator-name = "vdd-wifi"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ }; ++ ++ /* DLDO1 and ELDO1-3 are connected in parallel. */ ++ reg_dldo1: dldo1 { ++ regulator-name = "vbat-wifi-a"; ++ regulator-always-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ }; ++ ++ /* DLDO2-DLDO4 are connected in parallel. */ ++ reg_dldo2: dldo2 { ++ regulator-name = "vcc-3v3-ext-a"; ++ regulator-always-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ }; ++ ++ reg_dldo3: dldo3 { ++ regulator-name = "vcc-3v3-ext-b"; ++ regulator-always-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ }; ++ ++ reg_dldo4: dldo4 { ++ regulator-name = "vcc-3v3-ext-c"; ++ regulator-always-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ }; ++ ++ reg_eldo1: eldo1 { ++ regulator-name = "vbat-wifi-b"; ++ regulator-always-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ }; ++ ++ reg_eldo2: eldo2 { ++ regulator-name = "vbat-wifi-c"; ++ regulator-always-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ }; ++ ++ reg_eldo3: eldo3 { ++ regulator-name = "vbat-wifi-d"; ++ regulator-always-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ }; ++ }; ++ ++ usb_power_supply: usb-power { ++ compatible = "x-powers,axp221-usb-power-supply"; ++ status = "disabled"; ++ }; ++ }; ++}; ++ ++&mmc0 { ++ broken-cd; ++ bus-width = <4>; ++ disable-wp; ++ vmmc-supply = <®_dcdc1>; ++ vqmmc-supply = <®_vcc_3v3>; ++ pinctrl-0 = <&mmc0_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++}; ++ ++&mmc1 { ++ bus-width = <4>; ++ mmc-pwrseq = <&wifi_pwrseq>; ++ non-removable; ++ vmmc-supply = <®_dldo1>; ++ vqmmc-supply = <®_aldo3>; ++ pinctrl-0 = <&mmc1_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++ ++ ap6256: wifi@1 { ++ compatible = "brcm,bcm43456-fmac", "brcm,bcm4329-fmac"; ++ reg = <1>; ++ interrupt-parent = <&pio>; ++ interrupts = <6 10 IRQ_TYPE_LEVEL_LOW>; /* PG10/GPIO4 */ ++ interrupt-names = "host-wake"; ++ }; ++}; ++ ++&ohci1 { ++ status = "okay"; ++}; ++ ++&pio { ++ vcc-pg-supply = <®_ldoa>; ++}; ++ ++&uart0 { ++ pinctrl-0 = <&uart0_pb8_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++}; ++ ++&uart1 { ++ uart-has-rtscts; ++ pinctrl-0 = <&uart1_pg6_pins>, <&uart1_pg8_rts_cts_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++ ++ bluetooth { ++ compatible = "brcm,bcm4345c5"; ++ interrupt-parent = <&pio>; ++ interrupts = <6 17 IRQ_TYPE_LEVEL_HIGH>; /* PG17/GPIO6 */ ++ device-wakeup-gpios = <&pio 6 16 GPIO_ACTIVE_HIGH>; /* PG16/GPIO7 */ ++ shutdown-gpios = <&pio 6 18 GPIO_ACTIVE_HIGH>; /* PG18/GPIO5 */ ++ max-speed = <1500000>; ++ vbat-supply = <®_dldo1>; ++ vddio-supply = <®_aldo3>; ++ }; ++}; ++ ++&usb_otg { ++ dr_mode = "peripheral"; ++ status = "okay"; ++}; ++ ++&usbphy { ++ usb0_vbus_power-supply = <&ac_power_supply>; ++ status = "okay"; ++}; +--- /dev/null ++++ b/arch/riscv/dts/sun20i-d1-common-regulators.dtsi +@@ -0,0 +1,51 @@ ++// SPDX-License-Identifier: (GPL-2.0+ or MIT) ++// Copyright (C) 2021-2022 Samuel Holland ++ ++/ { ++ reg_vcc: vcc { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ }; ++ ++ reg_vcc_3v3: vcc-3v3 { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc-3v3"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ vin-supply = <®_vcc>; ++ }; ++}; ++ ++&lradc { ++ vref-supply = <®_aldo>; ++}; ++ ++&pio { ++ vcc-pb-supply = <®_vcc_3v3>; ++ vcc-pc-supply = <®_vcc_3v3>; ++ vcc-pd-supply = <®_vcc_3v3>; ++ vcc-pe-supply = <®_vcc_3v3>; ++ vcc-pf-supply = <®_vcc_3v3>; ++ vcc-pg-supply = <®_vcc_3v3>; ++}; ++ ++®_aldo { ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ vdd33-supply = <®_vcc_3v3>; ++}; ++ ++®_hpldo { ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ hpldoin-supply = <®_vcc_3v3>; ++}; ++ ++®_ldoa { ++ regulator-always-on; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ ldo-in-supply = <®_vcc_3v3>; ++}; +--- /dev/null ++++ b/arch/riscv/dts/sun20i-d1-devterm-v3.14.dts +@@ -0,0 +1,37 @@ ++// SPDX-License-Identifier: (GPL-2.0+ or MIT) ++// Copyright (C) 2022 Samuel Holland ++ ++/dts-v1/; ++ ++#include "sun20i-d1-clockworkpi-v3.14.dts" ++ ++/ { ++ model = "Clockwork DevTerm (R-01)"; ++ compatible = "clockwork,r-01-devterm-v3.14", ++ "clockwork,r-01-clockworkpi-v3.14", ++ "allwinner,sun20i-d1"; ++ ++ fan { ++ compatible = "gpio-fan"; ++ gpios = <&pio 3 10 GPIO_ACTIVE_HIGH>; /* PD10/GPIO41 */ ++ gpio-fan,speed-map = <0 0>, ++ <6000 1>; ++ #cooling-cells = <2>; ++ }; ++ ++ i2c-gpio-0 { ++ compatible = "i2c-gpio"; ++ sda-gpios = <&pio 3 14 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; /* PD14/GPIO44 */ ++ scl-gpios = <&pio 3 15 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; /* PD15/GPIO45 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ adc@54 { ++ compatible = "ti,adc101c"; ++ reg = <0x54>; ++ interrupt-parent = <&pio>; ++ interrupts = <4 12 IRQ_TYPE_LEVEL_LOW>; /* PE12/GPIO35 */ ++ vref-supply = <®_dldo2>; ++ }; ++ }; ++}; +--- /dev/null ++++ b/arch/riscv/dts/sun20i-d1-dongshan-nezha-stu.dts +@@ -0,0 +1,114 @@ ++// SPDX-License-Identifier: (GPL-2.0+ or MIT) ++// Copyright (C) 2022 Samuel Holland ++ ++/dts-v1/; ++ ++#include ++#include ++ ++#include "sun20i-d1.dtsi" ++#include "sun20i-d1-common-regulators.dtsi" ++ ++/ { ++ model = "Dongshan Nezha STU"; ++ compatible = "100ask,dongshan-nezha-stu", "allwinner,sun20i-d1"; ++ ++ aliases { ++ ethernet0 = &emac; ++ mmc0 = &mmc0; ++ serial0 = &uart0; ++ }; ++ ++ chosen { ++ stdout-path = "serial0:115200n8"; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ led-0 { ++ color = ; ++ function = LED_FUNCTION_STATUS; ++ gpios = <&pio 2 1 GPIO_ACTIVE_HIGH>; /* PC1 */ ++ }; ++ }; ++ ++ reg_usbvbus: usbvbus { ++ compatible = "regulator-fixed"; ++ regulator-name = "usbvbus"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ gpio = <&pio 3 19 GPIO_ACTIVE_HIGH>; /* PD19 */ ++ enable-active-high; ++ vin-supply = <®_vcc>; ++ }; ++ ++ /* ++ * This regulator is PWM-controlled, but the PWM controller is not ++ * yet supported, so fix the regulator to its default voltage. ++ */ ++ reg_vdd_cpu: vdd-cpu { ++ compatible = "regulator-fixed"; ++ regulator-name = "vdd-cpu"; ++ regulator-min-microvolt = <1100000>; ++ regulator-max-microvolt = <1100000>; ++ vin-supply = <®_vcc>; ++ }; ++}; ++ ++&cpu0 { ++ cpu-supply = <®_vdd_cpu>; ++}; ++ ++&ehci0 { ++ status = "okay"; ++}; ++ ++&emac { ++ pinctrl-0 = <&rgmii_pe_pins>; ++ pinctrl-names = "default"; ++ phy-handle = <&ext_rgmii_phy>; ++ phy-mode = "rgmii-id"; ++ phy-supply = <®_vcc_3v3>; ++ status = "okay"; ++}; ++ ++&mdio { ++ ext_rgmii_phy: ethernet-phy@1 { ++ compatible = "ethernet-phy-ieee802.3-c22"; ++ reg = <1>; ++ }; ++}; ++ ++&mmc0 { ++ broken-cd; ++ bus-width = <4>; ++ disable-wp; ++ vmmc-supply = <®_vcc_3v3>; ++ vqmmc-supply = <®_vcc_3v3>; ++ pinctrl-0 = <&mmc0_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++}; ++ ++&ohci0 { ++ status = "okay"; ++}; ++ ++&uart0 { ++ pinctrl-0 = <&uart0_pb8_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++}; ++ ++&usb_otg { ++ dr_mode = "otg"; ++ status = "okay"; ++}; ++ ++&usbphy { ++ usb0_id_det-gpios = <&pio 3 21 GPIO_ACTIVE_HIGH>; /* PD21 */ ++ usb0_vbus_det-gpios = <&pio 3 20 GPIO_ACTIVE_HIGH>; /* PD20 */ ++ usb0_vbus-supply = <®_usbvbus>; ++ status = "okay"; ++}; +--- /dev/null ++++ b/arch/riscv/dts/sun20i-d1-lichee-rv-86-panel-480p.dts +@@ -0,0 +1,29 @@ ++// SPDX-License-Identifier: (GPL-2.0+ or MIT) ++// Copyright (C) 2022 Samuel Holland ++ ++#include "sun20i-d1-lichee-rv-86-panel.dtsi" ++ ++/ { ++ model = "Sipeed Lichee RV 86 Panel (480p)"; ++ compatible = "sipeed,lichee-rv-86-panel-480p", "sipeed,lichee-rv", ++ "allwinner,sun20i-d1"; ++}; ++ ++&i2c2 { ++ pinctrl-0 = <&i2c2_pb0_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++ ++ touchscreen@48 { ++ compatible = "focaltech,ft6236"; ++ reg = <0x48>; ++ interrupt-parent = <&pio>; ++ interrupts = <6 14 IRQ_TYPE_LEVEL_LOW>; /* PG14 */ ++ iovcc-supply = <®_vcc_3v3>; ++ reset-gpios = <&pio 6 15 GPIO_ACTIVE_LOW>; /* PG15 */ ++ touchscreen-size-x = <480>; ++ touchscreen-size-y = <480>; ++ vcc-supply = <®_vcc_3v3>; ++ wakeup-source; ++ }; ++}; +--- /dev/null ++++ b/arch/riscv/dts/sun20i-d1-lichee-rv-86-panel-720p.dts +@@ -0,0 +1,10 @@ ++// SPDX-License-Identifier: (GPL-2.0+ or MIT) ++// Copyright (C) 2022 Samuel Holland ++ ++#include "sun20i-d1-lichee-rv-86-panel.dtsi" ++ ++/ { ++ model = "Sipeed Lichee RV 86 Panel (720p)"; ++ compatible = "sipeed,lichee-rv-86-panel-720p", "sipeed,lichee-rv", ++ "allwinner,sun20i-d1"; ++}; +--- /dev/null ++++ b/arch/riscv/dts/sun20i-d1-lichee-rv-86-panel.dtsi +@@ -0,0 +1,92 @@ ++// SPDX-License-Identifier: (GPL-2.0+ or MIT) ++// Copyright (C) 2022 Samuel Holland ++ ++#include "sun20i-d1-lichee-rv.dts" ++ ++/ { ++ aliases { ++ ethernet0 = &emac; ++ ethernet1 = &xr829; ++ }; ++ ++ /* PC1 is repurposed as BT_WAKE_AP */ ++ /delete-node/ leds; ++ ++ wifi_pwrseq: wifi-pwrseq { ++ compatible = "mmc-pwrseq-simple"; ++ clocks = <&ccu CLK_FANOUT1>; ++ clock-names = "ext_clock"; ++ reset-gpios = <&pio 6 12 GPIO_ACTIVE_LOW>; /* PG12 */ ++ assigned-clocks = <&ccu CLK_FANOUT1>; ++ assigned-clock-rates = <32768>; ++ pinctrl-0 = <&clk_pg11_pin>; ++ pinctrl-names = "default"; ++ }; ++}; ++ ++&ehci1 { ++ status = "okay"; ++}; ++ ++&emac { ++ pinctrl-0 = <&rmii_pe_pins>; ++ pinctrl-names = "default"; ++ phy-handle = <&ext_rmii_phy>; ++ phy-mode = "rmii"; ++ phy-supply = <®_vcc_3v3>; ++ status = "okay"; ++}; ++ ++&mdio { ++ ext_rmii_phy: ethernet-phy@1 { ++ compatible = "ethernet-phy-ieee802.3-c22"; ++ reg = <1>; ++ reset-gpios = <&pio 4 16 GPIO_ACTIVE_LOW>; /* PE16 */ ++ }; ++}; ++ ++&mmc1 { ++ bus-width = <4>; ++ mmc-pwrseq = <&wifi_pwrseq>; ++ non-removable; ++ vmmc-supply = <®_vcc_3v3>; ++ vqmmc-supply = <®_vcc_3v3>; ++ pinctrl-0 = <&mmc1_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++ ++ xr829: wifi@1 { ++ reg = <1>; ++ }; ++}; ++ ++&ohci1 { ++ status = "okay"; ++}; ++ ++&pio { ++ clk_pg11_pin: clk-pg11-pin { ++ pins = "PG11"; ++ function = "clk"; ++ }; ++}; ++ ++&uart1 { ++ uart-has-rtscts; ++ pinctrl-0 = <&uart1_pg6_pins>, <&uart1_pg8_rts_cts_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++ ++ /* XR829 bluetooth is connected here */ ++}; ++ ++&usb_otg { ++ status = "disabled"; ++}; ++ ++&usbphy { ++ /* PD20 and PD21 are repurposed for the LCD panel */ ++ /delete-property/ usb0_id_det-gpios; ++ /delete-property/ usb0_vbus_det-gpios; ++ usb1_vbus-supply = <®_vcc>; ++}; +--- /dev/null ++++ b/arch/riscv/dts/sun20i-d1-lichee-rv-dock.dts +@@ -0,0 +1,74 @@ ++// SPDX-License-Identifier: (GPL-2.0+ or MIT) ++// Copyright (C) 2022 Jisheng Zhang ++// Copyright (C) 2022 Samuel Holland ++ ++#include ++ ++#include "sun20i-d1-lichee-rv.dts" ++ ++/ { ++ model = "Sipeed Lichee RV Dock"; ++ compatible = "sipeed,lichee-rv-dock", "sipeed,lichee-rv", ++ "allwinner,sun20i-d1"; ++ ++ aliases { ++ ethernet1 = &rtl8723ds; ++ }; ++ ++ wifi_pwrseq: wifi-pwrseq { ++ compatible = "mmc-pwrseq-simple"; ++ reset-gpios = <&pio 6 12 GPIO_ACTIVE_LOW>; /* PG12 */ ++ }; ++}; ++ ++&ehci1 { ++ status = "okay"; ++}; ++ ++&lradc { ++ status = "okay"; ++ ++ button-220 { ++ label = "OK"; ++ linux,code = ; ++ channel = <0>; ++ voltage = <220000>; ++ }; ++}; ++ ++&mmc1 { ++ bus-width = <4>; ++ mmc-pwrseq = <&wifi_pwrseq>; ++ non-removable; ++ vmmc-supply = <®_vcc_3v3>; ++ vqmmc-supply = <®_vcc_3v3>; ++ pinctrl-0 = <&mmc1_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++ ++ rtl8723ds: wifi@1 { ++ reg = <1>; ++ }; ++}; ++ ++&ohci1 { ++ status = "okay"; ++}; ++ ++&uart1 { ++ uart-has-rtscts; ++ pinctrl-0 = <&uart1_pg6_pins>, <&uart1_pg8_rts_cts_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++ ++ bluetooth { ++ compatible = "realtek,rtl8723ds-bt"; ++ device-wake-gpios = <&pio 6 15 GPIO_ACTIVE_HIGH>; /* PG16 */ ++ enable-gpios = <&pio 6 18 GPIO_ACTIVE_HIGH>; /* PG18 */ ++ host-wake-gpios = <&pio 6 17 GPIO_ACTIVE_HIGH>; /* PG17 */ ++ }; ++}; ++ ++&usbphy { ++ usb1_vbus-supply = <®_vcc>; ++}; +--- /dev/null ++++ b/arch/riscv/dts/sun20i-d1-lichee-rv.dts +@@ -0,0 +1,84 @@ ++// SPDX-License-Identifier: (GPL-2.0+ or MIT) ++// Copyright (C) 2022 Jisheng Zhang ++// Copyright (C) 2022 Samuel Holland ++ ++/dts-v1/; ++ ++#include ++#include ++ ++#include "sun20i-d1.dtsi" ++#include "sun20i-d1-common-regulators.dtsi" ++ ++/ { ++ model = "Sipeed Lichee RV"; ++ compatible = "sipeed,lichee-rv", "allwinner,sun20i-d1"; ++ ++ aliases { ++ mmc0 = &mmc0; ++ serial0 = &uart0; ++ }; ++ ++ chosen { ++ stdout-path = "serial0:115200n8"; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ led-0 { ++ color = ; ++ function = LED_FUNCTION_STATUS; ++ gpios = <&pio 2 1 GPIO_ACTIVE_HIGH>; /* PC1 */ ++ }; ++ }; ++ ++ reg_vdd_cpu: vdd-cpu { ++ compatible = "regulator-fixed"; ++ regulator-name = "vdd-cpu"; ++ regulator-min-microvolt = <900000>; ++ regulator-max-microvolt = <900000>; ++ vin-supply = <®_vcc>; ++ }; ++}; ++ ++&cpu0 { ++ cpu-supply = <®_vdd_cpu>; ++}; ++ ++&ehci0 { ++ status = "okay"; ++}; ++ ++&mmc0 { ++ broken-cd; ++ bus-width = <4>; ++ disable-wp; ++ vmmc-supply = <®_vcc_3v3>; ++ vqmmc-supply = <®_vcc_3v3>; ++ pinctrl-0 = <&mmc0_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++}; ++ ++&ohci0 { ++ status = "okay"; ++}; ++ ++&uart0 { ++ pinctrl-0 = <&uart0_pb8_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++}; ++ ++&usb_otg { ++ dr_mode = "otg"; ++ status = "okay"; ++}; ++ ++&usbphy { ++ usb0_id_det-gpios = <&pio 3 21 GPIO_ACTIVE_HIGH>; /* PD21 */ ++ usb0_vbus_det-gpios = <&pio 3 20 GPIO_ACTIVE_HIGH>; /* PD20 */ ++ usb0_vbus-supply = <®_vcc>; ++ status = "okay"; ++}; +--- /dev/null ++++ b/arch/riscv/dts/sun20i-d1-mangopi-mq-pro.dts +@@ -0,0 +1,128 @@ ++// SPDX-License-Identifier: (GPL-2.0+ or MIT) ++// Copyright (C) 2022 Samuel Holland ++ ++/dts-v1/; ++ ++#include ++ ++#include "sun20i-d1.dtsi" ++#include "sun20i-d1-common-regulators.dtsi" ++ ++/ { ++ model = "MangoPi MQ Pro"; ++ compatible = "widora,mangopi-mq-pro", "allwinner,sun20i-d1"; ++ ++ aliases { ++ ethernet0 = &rtl8723ds; ++ mmc0 = &mmc0; ++ serial0 = &uart0; ++ }; ++ ++ chosen { ++ stdout-path = "serial0:115200n8"; ++ }; ++ ++ reg_avdd2v8: avdd2v8 { ++ compatible = "regulator-fixed"; ++ regulator-name = "avdd2v8"; ++ regulator-min-microvolt = <2800000>; ++ regulator-max-microvolt = <2800000>; ++ vin-supply = <®_vcc_3v3>; ++ }; ++ ++ reg_dvdd: dvdd { ++ compatible = "regulator-fixed"; ++ regulator-name = "dvdd"; ++ regulator-min-microvolt = <1200000>; ++ regulator-max-microvolt = <1200000>; ++ vin-supply = <®_vcc_3v3>; ++ }; ++ ++ reg_vdd_cpu: vdd-cpu { ++ compatible = "regulator-fixed"; ++ regulator-name = "vdd-cpu"; ++ regulator-min-microvolt = <1100000>; ++ regulator-max-microvolt = <1100000>; ++ vin-supply = <®_vcc>; ++ }; ++ ++ wifi_pwrseq: wifi-pwrseq { ++ compatible = "mmc-pwrseq-simple"; ++ reset-gpios = <&pio 6 17 GPIO_ACTIVE_LOW>; /* PG17 */ ++ }; ++}; ++ ++&cpu0 { ++ cpu-supply = <®_vdd_cpu>; ++}; ++ ++&ehci1 { ++ status = "okay"; ++}; ++ ++&mmc0 { ++ bus-width = <4>; ++ cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; /* PF6 */ ++ disable-wp; ++ vmmc-supply = <®_vcc_3v3>; ++ vqmmc-supply = <®_vcc_3v3>; ++ pinctrl-0 = <&mmc0_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++}; ++ ++&mmc1 { ++ bus-width = <4>; ++ mmc-pwrseq = <&wifi_pwrseq>; ++ non-removable; ++ vmmc-supply = <®_vcc_3v3>; ++ vqmmc-supply = <®_vcc_3v3>; ++ pinctrl-0 = <&mmc1_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++ ++ rtl8723ds: wifi@1 { ++ reg = <1>; ++ interrupt-parent = <&pio>; ++ interrupts = <6 10 IRQ_TYPE_LEVEL_LOW>; /* PG10 */ ++ interrupt-names = "host-wake"; ++ }; ++}; ++ ++&ohci1 { ++ status = "okay"; ++}; ++ ++&pio { ++ vcc-pe-supply = <®_avdd2v8>; ++}; ++ ++&uart0 { ++ pinctrl-0 = <&uart0_pb8_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++}; ++ ++&uart1 { ++ uart-has-rtscts; ++ pinctrl-0 = <&uart1_pg6_pins>, <&uart1_pg8_rts_cts_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++ ++ bluetooth { ++ compatible = "realtek,rtl8723ds-bt"; ++ device-wake-gpios = <&pio 6 18 GPIO_ACTIVE_HIGH>; /* PG18 */ ++ enable-gpios = <&pio 6 15 GPIO_ACTIVE_HIGH>; /* PG15 */ ++ host-wake-gpios = <&pio 6 14 GPIO_ACTIVE_HIGH>; /* PG14 */ ++ }; ++}; ++ ++&usb_otg { ++ dr_mode = "peripheral"; ++ status = "okay"; ++}; ++ ++&usbphy { ++ usb0_vbus-supply = <®_vcc>; ++ status = "okay"; ++}; +--- /dev/null ++++ b/arch/riscv/dts/sun20i-d1-nezha.dts +@@ -0,0 +1,171 @@ ++// SPDX-License-Identifier: (GPL-2.0+ or MIT) ++// Copyright (C) 2021-2022 Samuel Holland ++ ++/dts-v1/; ++ ++#include ++#include ++ ++#include "sun20i-d1.dtsi" ++#include "sun20i-d1-common-regulators.dtsi" ++ ++/ { ++ model = "Allwinner D1 Nezha"; ++ compatible = "allwinner,d1-nezha", "allwinner,sun20i-d1"; ++ ++ aliases { ++ ethernet0 = &emac; ++ ethernet1 = &xr829; ++ mmc0 = &mmc0; ++ serial0 = &uart0; ++ }; ++ ++ chosen { ++ stdout-path = "serial0:115200n8"; ++ }; ++ ++ reg_usbvbus: usbvbus { ++ compatible = "regulator-fixed"; ++ regulator-name = "usbvbus"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ gpio = <&pio 3 19 GPIO_ACTIVE_HIGH>; /* PD19 */ ++ enable-active-high; ++ vin-supply = <®_vcc>; ++ }; ++ ++ /* ++ * This regulator is PWM-controlled, but the PWM controller is not ++ * yet supported, so fix the regulator to its default voltage. ++ */ ++ reg_vdd_cpu: vdd-cpu { ++ compatible = "regulator-fixed"; ++ regulator-name = "vdd-cpu"; ++ regulator-min-microvolt = <1100000>; ++ regulator-max-microvolt = <1100000>; ++ vin-supply = <®_vcc>; ++ }; ++ ++ wifi_pwrseq: wifi-pwrseq { ++ compatible = "mmc-pwrseq-simple"; ++ reset-gpios = <&pio 6 12 GPIO_ACTIVE_LOW>; /* PG12 */ ++ }; ++}; ++ ++&cpu0 { ++ cpu-supply = <®_vdd_cpu>; ++}; ++ ++&ehci0 { ++ status = "okay"; ++}; ++ ++&ehci1 { ++ status = "okay"; ++}; ++ ++&emac { ++ pinctrl-0 = <&rgmii_pe_pins>; ++ pinctrl-names = "default"; ++ phy-handle = <&ext_rgmii_phy>; ++ phy-mode = "rgmii-id"; ++ phy-supply = <®_vcc_3v3>; ++ status = "okay"; ++}; ++ ++&i2c2 { ++ pinctrl-0 = <&i2c2_pb0_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++ ++ pcf8574a: gpio@38 { ++ compatible = "nxp,pcf8574a"; ++ reg = <0x38>; ++ interrupt-parent = <&pio>; ++ interrupts = <1 2 IRQ_TYPE_LEVEL_LOW>; /* PB2 */ ++ interrupt-controller; ++ gpio-controller; ++ #gpio-cells = <2>; ++ #interrupt-cells = <2>; ++ }; ++}; ++ ++&lradc { ++ status = "okay"; ++ ++ button-160 { ++ label = "OK"; ++ linux,code = ; ++ channel = <0>; ++ voltage = <160000>; ++ }; ++}; ++ ++&mdio { ++ ext_rgmii_phy: ethernet-phy@1 { ++ compatible = "ethernet-phy-ieee802.3-c22"; ++ reg = <1>; ++ }; ++}; ++ ++&mmc0 { ++ bus-width = <4>; ++ cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; /* PF6 */ ++ disable-wp; ++ vmmc-supply = <®_vcc_3v3>; ++ vqmmc-supply = <®_vcc_3v3>; ++ pinctrl-0 = <&mmc0_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++}; ++ ++&mmc1 { ++ bus-width = <4>; ++ mmc-pwrseq = <&wifi_pwrseq>; ++ non-removable; ++ vmmc-supply = <®_vcc_3v3>; ++ vqmmc-supply = <®_vcc_3v3>; ++ pinctrl-0 = <&mmc1_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++ ++ xr829: wifi@1 { ++ reg = <1>; ++ }; ++}; ++ ++&ohci0 { ++ status = "okay"; ++}; ++ ++&ohci1 { ++ status = "okay"; ++}; ++ ++&uart0 { ++ pinctrl-0 = <&uart0_pb8_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++}; ++ ++&uart1 { ++ uart-has-rtscts; ++ pinctrl-0 = <&uart1_pg6_pins>, <&uart1_pg8_rts_cts_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++ ++ /* XR829 bluetooth is connected here */ ++}; ++ ++&usb_otg { ++ dr_mode = "otg"; ++ status = "okay"; ++}; ++ ++&usbphy { ++ usb0_id_det-gpios = <&pio 3 21 GPIO_ACTIVE_HIGH>; /* PD21 */ ++ usb0_vbus_det-gpios = <&pio 3 20 GPIO_ACTIVE_HIGH>; /* PD20 */ ++ usb0_vbus-supply = <®_usbvbus>; ++ usb1_vbus-supply = <®_vcc>; ++ status = "okay"; ++}; +--- /dev/null ++++ b/arch/riscv/dts/sun20i-d1.dtsi +@@ -0,0 +1,900 @@ ++// SPDX-License-Identifier: (GPL-2.0+ or MIT) ++// Copyright (C) 2021-2022 Samuel Holland ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++/ { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ cpus { ++ timebase-frequency = <24000000>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ cpu0: cpu@0 { ++ compatible = "thead,c906", "riscv"; ++ device_type = "cpu"; ++ reg = <0>; ++ clocks = <&ccu CLK_RISCV>; ++ clock-frequency = <24000000>; ++ d-cache-block-size = <64>; ++ d-cache-sets = <256>; ++ d-cache-size = <32768>; ++ i-cache-block-size = <64>; ++ i-cache-sets = <128>; ++ i-cache-size = <32768>; ++ mmu-type = "riscv,sv39"; ++ riscv,isa = "rv64imafdc"; ++ #cooling-cells = <2>; ++ ++ cpu0_intc: interrupt-controller { ++ compatible = "riscv,cpu-intc"; ++ interrupt-controller; ++ #address-cells = <0>; ++ #interrupt-cells = <1>; ++ }; ++ }; ++ }; ++ ++ de: display-engine { ++ compatible = "allwinner,sun20i-d1-display-engine"; ++ allwinner,pipelines = <&mixer0>, <&mixer1>; ++ status = "disabled"; ++ }; ++ ++ osc24M: osc24M-clk { ++ compatible = "fixed-clock"; ++ clock-frequency = <24000000>; ++ clock-output-names = "osc24M"; ++ #clock-cells = <0>; ++ }; ++ ++ soc { ++ compatible = "simple-bus"; ++ ranges; ++ interrupt-parent = <&plic>; ++ dma-noncoherent; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ dsp_wdt: watchdog@1700400 { ++ compatible = "allwinner,sun20i-d1-wdt"; ++ reg = <0x1700400 0x20>; ++ interrupts = <138 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&osc24M>, <&rtc CLK_OSC32K>; ++ clock-names = "hosc", "losc"; ++ status = "reserved"; ++ }; ++ ++ pio: pinctrl@2000000 { ++ compatible = "allwinner,sun20i-d1-pinctrl"; ++ reg = <0x2000000 0x800>; ++ interrupts = <85 IRQ_TYPE_LEVEL_HIGH>, ++ <87 IRQ_TYPE_LEVEL_HIGH>, ++ <89 IRQ_TYPE_LEVEL_HIGH>, ++ <91 IRQ_TYPE_LEVEL_HIGH>, ++ <93 IRQ_TYPE_LEVEL_HIGH>, ++ <95 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&ccu CLK_APB0>, ++ <&osc24M>, ++ <&rtc CLK_OSC32K>; ++ clock-names = "apb", "hosc", "losc"; ++ gpio-controller; ++ interrupt-controller; ++ #gpio-cells = <3>; ++ #interrupt-cells = <3>; ++ ++ /omit-if-no-ref/ ++ i2c0_pb10_pins: i2c0-pb10-pins { ++ pins = "PB10", "PB11"; ++ function = "i2c0"; ++ }; ++ ++ /omit-if-no-ref/ ++ i2c2_pb0_pins: i2c2-pb0-pins { ++ pins = "PB0", "PB1"; ++ function = "i2c2"; ++ }; ++ ++ /omit-if-no-ref/ ++ lcd_rgb666_pins: lcd-rgb666-pins { ++ pins = "PD0", "PD1", "PD2", "PD3", "PD4", "PD5", ++ "PD6", "PD7", "PD8", "PD9", "PD10", "PD11", ++ "PD12", "PD13", "PD14", "PD15", "PD16", "PD17", ++ "PD18", "PD19", "PD20", "PD21"; ++ function = "lcd0"; ++ }; ++ ++ /omit-if-no-ref/ ++ mmc0_pins: mmc0-pins { ++ pins = "PF0", "PF1", "PF2", "PF3", "PF4", "PF5"; ++ function = "mmc0"; ++ }; ++ ++ /omit-if-no-ref/ ++ mmc1_pins: mmc1-pins { ++ pins = "PG0", "PG1", "PG2", "PG3", "PG4", "PG5"; ++ function = "mmc1"; ++ }; ++ ++ /omit-if-no-ref/ ++ mmc2_pins: mmc2-pins { ++ pins = "PC2", "PC3", "PC4", "PC5", "PC6", "PC7"; ++ function = "mmc2"; ++ }; ++ ++ /omit-if-no-ref/ ++ rgmii_pe_pins: rgmii-pe-pins { ++ pins = "PE0", "PE1", "PE2", "PE3", "PE4", ++ "PE5", "PE6", "PE7", "PE8", "PE9", ++ "PE11", "PE12", "PE13", "PE14", "PE15"; ++ function = "emac"; ++ }; ++ ++ /omit-if-no-ref/ ++ rmii_pe_pins: rmii-pe-pins { ++ pins = "PE0", "PE1", "PE2", "PE3", "PE4", ++ "PE5", "PE6", "PE7", "PE8", "PE9"; ++ function = "emac"; ++ }; ++ ++ /omit-if-no-ref/ ++ uart0_pb8_pins: uart0-pb8-pins { ++ pins = "PB8", "PB9"; ++ function = "uart0"; ++ }; ++ ++ /omit-if-no-ref/ ++ uart1_pg6_pins: uart1-pg6-pins { ++ pins = "PG6", "PG7"; ++ function = "uart1"; ++ }; ++ ++ /omit-if-no-ref/ ++ uart1_pg8_rts_cts_pins: uart1-pg8-rts-cts-pins { ++ pins = "PG8", "PG9"; ++ function = "uart1"; ++ }; ++ }; ++ ++ ccu: clock-controller@2001000 { ++ compatible = "allwinner,sun20i-d1-ccu"; ++ reg = <0x2001000 0x1000>; ++ clocks = <&osc24M>, ++ <&rtc CLK_OSC32K>, ++ <&rtc CLK_IOSC>; ++ clock-names = "hosc", "losc", "iosc"; ++ #clock-cells = <1>; ++ #reset-cells = <1>; ++ }; ++ ++ lradc: keys@2009800 { ++ compatible = "allwinner,sun20i-d1-lradc", ++ "allwinner,sun50i-r329-lradc"; ++ reg = <0x2009800 0x400>; ++ interrupts = <77 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&ccu CLK_BUS_LRADC>; ++ resets = <&ccu RST_BUS_LRADC>; ++ status = "disabled"; ++ }; ++ ++ codec: audio-codec@2030000 { ++ compatible = "simple-mfd", "syscon"; ++ reg = <0x2030000 0x1000>; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ regulators@2030348 { ++ compatible = "allwinner,sun20i-d1-analog-ldos"; ++ reg = <0x2030348 0x4>; ++ nvmem-cells = <&bg_trim>; ++ nvmem-cell-names = "bg_trim"; ++ ++ reg_aldo: aldo { ++ }; ++ ++ reg_hpldo: hpldo { ++ }; ++ }; ++ }; ++ ++ i2s0: i2s@2032000 { ++ compatible = "allwinner,sun20i-d1-i2s", ++ "allwinner,sun50i-r329-i2s"; ++ reg = <0x2032000 0x1000>; ++ interrupts = <42 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&ccu CLK_BUS_I2S0>, ++ <&ccu CLK_I2S0>; ++ clock-names = "apb", "mod"; ++ resets = <&ccu RST_BUS_I2S0>; ++ dmas = <&dma 3>, <&dma 3>; ++ dma-names = "rx", "tx"; ++ status = "disabled"; ++ #sound-dai-cells = <0>; ++ }; ++ ++ i2s1: i2s@2033000 { ++ compatible = "allwinner,sun20i-d1-i2s", ++ "allwinner,sun50i-r329-i2s"; ++ reg = <0x2033000 0x1000>; ++ interrupts = <43 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&ccu CLK_BUS_I2S1>, ++ <&ccu CLK_I2S1>; ++ clock-names = "apb", "mod"; ++ resets = <&ccu RST_BUS_I2S1>; ++ dmas = <&dma 4>, <&dma 4>; ++ dma-names = "rx", "tx"; ++ status = "disabled"; ++ #sound-dai-cells = <0>; ++ }; ++ ++ i2s2: i2s@2034000 { ++ compatible = "allwinner,sun20i-d1-i2s", ++ "allwinner,sun50i-r329-i2s"; ++ reg = <0x2034000 0x1000>; ++ interrupts = <44 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&ccu CLK_BUS_I2S2>, ++ <&ccu CLK_I2S2>; ++ clock-names = "apb", "mod"; ++ resets = <&ccu RST_BUS_I2S2>; ++ dmas = <&dma 5>, <&dma 5>; ++ dma-names = "rx", "tx"; ++ status = "disabled"; ++ #sound-dai-cells = <0>; ++ }; ++ ++ timer: timer@2050000 { ++ compatible = "allwinner,sun20i-d1-timer", ++ "allwinner,sun8i-a23-timer"; ++ reg = <0x2050000 0xa0>; ++ interrupts = <75 IRQ_TYPE_LEVEL_HIGH>, ++ <76 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&osc24M>; ++ }; ++ ++ wdt: watchdog@20500a0 { ++ compatible = "allwinner,sun20i-d1-wdt-reset", ++ "allwinner,sun20i-d1-wdt"; ++ reg = <0x20500a0 0x20>; ++ interrupts = <79 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&osc24M>, <&rtc CLK_OSC32K>; ++ clock-names = "hosc", "losc"; ++ status = "reserved"; ++ }; ++ ++ uart0: serial@2500000 { ++ compatible = "snps,dw-apb-uart"; ++ reg = <0x2500000 0x400>; ++ reg-io-width = <4>; ++ reg-shift = <2>; ++ interrupts = <18 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&ccu CLK_BUS_UART0>; ++ resets = <&ccu RST_BUS_UART0>; ++ dmas = <&dma 14>, <&dma 14>; ++ dma-names = "rx", "tx"; ++ status = "disabled"; ++ }; ++ ++ uart1: serial@2500400 { ++ compatible = "snps,dw-apb-uart"; ++ reg = <0x2500400 0x400>; ++ reg-io-width = <4>; ++ reg-shift = <2>; ++ interrupts = <19 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&ccu CLK_BUS_UART1>; ++ resets = <&ccu RST_BUS_UART1>; ++ dmas = <&dma 15>, <&dma 15>; ++ dma-names = "rx", "tx"; ++ status = "disabled"; ++ }; ++ ++ uart2: serial@2500800 { ++ compatible = "snps,dw-apb-uart"; ++ reg = <0x2500800 0x400>; ++ reg-io-width = <4>; ++ reg-shift = <2>; ++ interrupts = <20 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&ccu CLK_BUS_UART2>; ++ resets = <&ccu RST_BUS_UART2>; ++ dmas = <&dma 16>, <&dma 16>; ++ dma-names = "rx", "tx"; ++ status = "disabled"; ++ }; ++ ++ uart3: serial@2500c00 { ++ compatible = "snps,dw-apb-uart"; ++ reg = <0x2500c00 0x400>; ++ reg-io-width = <4>; ++ reg-shift = <2>; ++ interrupts = <21 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&ccu CLK_BUS_UART3>; ++ resets = <&ccu RST_BUS_UART3>; ++ dmas = <&dma 17>, <&dma 17>; ++ dma-names = "rx", "tx"; ++ status = "disabled"; ++ }; ++ ++ uart4: serial@2501000 { ++ compatible = "snps,dw-apb-uart"; ++ reg = <0x2501000 0x400>; ++ reg-io-width = <4>; ++ reg-shift = <2>; ++ interrupts = <22 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&ccu CLK_BUS_UART4>; ++ resets = <&ccu RST_BUS_UART4>; ++ dmas = <&dma 18>, <&dma 18>; ++ dma-names = "rx", "tx"; ++ status = "disabled"; ++ }; ++ ++ uart5: serial@2501400 { ++ compatible = "snps,dw-apb-uart"; ++ reg = <0x2501400 0x400>; ++ reg-io-width = <4>; ++ reg-shift = <2>; ++ interrupts = <23 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&ccu CLK_BUS_UART5>; ++ resets = <&ccu RST_BUS_UART5>; ++ dmas = <&dma 19>, <&dma 19>; ++ dma-names = "rx", "tx"; ++ status = "disabled"; ++ }; ++ ++ i2c0: i2c@2502000 { ++ compatible = "allwinner,sun20i-d1-i2c", ++ "allwinner,sun8i-v536-i2c", ++ "allwinner,sun6i-a31-i2c"; ++ reg = <0x2502000 0x400>; ++ interrupts = <25 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&ccu CLK_BUS_I2C0>; ++ resets = <&ccu RST_BUS_I2C0>; ++ dmas = <&dma 43>, <&dma 43>; ++ dma-names = "rx", "tx"; ++ status = "disabled"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ }; ++ ++ i2c1: i2c@2502400 { ++ compatible = "allwinner,sun20i-d1-i2c", ++ "allwinner,sun8i-v536-i2c", ++ "allwinner,sun6i-a31-i2c"; ++ reg = <0x2502400 0x400>; ++ interrupts = <26 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&ccu CLK_BUS_I2C1>; ++ resets = <&ccu RST_BUS_I2C1>; ++ dmas = <&dma 44>, <&dma 44>; ++ dma-names = "rx", "tx"; ++ status = "disabled"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ }; ++ ++ i2c2: i2c@2502800 { ++ compatible = "allwinner,sun20i-d1-i2c", ++ "allwinner,sun8i-v536-i2c", ++ "allwinner,sun6i-a31-i2c"; ++ reg = <0x2502800 0x400>; ++ interrupts = <27 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&ccu CLK_BUS_I2C2>; ++ resets = <&ccu RST_BUS_I2C2>; ++ dmas = <&dma 45>, <&dma 45>; ++ dma-names = "rx", "tx"; ++ status = "disabled"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ }; ++ ++ i2c3: i2c@2502c00 { ++ compatible = "allwinner,sun20i-d1-i2c", ++ "allwinner,sun8i-v536-i2c", ++ "allwinner,sun6i-a31-i2c"; ++ reg = <0x2502c00 0x400>; ++ interrupts = <28 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&ccu CLK_BUS_I2C3>; ++ resets = <&ccu RST_BUS_I2C3>; ++ dmas = <&dma 46>, <&dma 46>; ++ dma-names = "rx", "tx"; ++ status = "disabled"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ }; ++ ++ syscon: syscon@3000000 { ++ compatible = "allwinner,sun20i-d1-system-control"; ++ reg = <0x3000000 0x1000>; ++ ranges; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ regulators@3000150 { ++ compatible = "allwinner,sun20i-d1-system-ldos"; ++ reg = <0x3000150 0x4>; ++ ++ reg_ldoa: ldoa { ++ }; ++ ++ reg_ldob: ldob { ++ }; ++ }; ++ }; ++ ++ dma: dma-controller@3002000 { ++ compatible = "allwinner,sun20i-d1-dma"; ++ reg = <0x3002000 0x1000>; ++ interrupts = <66 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&ccu CLK_BUS_DMA>, <&ccu CLK_MBUS_DMA>; ++ clock-names = "bus", "mbus"; ++ resets = <&ccu RST_BUS_DMA>; ++ dma-channels = <16>; ++ dma-requests = <48>; ++ #dma-cells = <1>; ++ }; ++ ++ sid: efuse@3006000 { ++ compatible = "allwinner,sun20i-d1-sid"; ++ reg = <0x3006000 0x1000>; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ ths_calib: ths-calib@14 { ++ reg = <0x14 0x4>; ++ }; ++ ++ bg_trim: bg-trim@28 { ++ reg = <0x28 0x4>; ++ bits = <16 8>; ++ }; ++ }; ++ ++ mbus: dram-controller@3102000 { ++ compatible = "allwinner,sun20i-d1-mbus"; ++ reg = <0x3102000 0x1000>, ++ <0x3103000 0x1000>; ++ reg-names = "mbus", "dram"; ++ interrupts = <59 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&ccu CLK_MBUS>, ++ <&ccu CLK_DRAM>, ++ <&ccu CLK_BUS_DRAM>; ++ clock-names = "mbus", "dram", "bus"; ++ dma-ranges = <0 0x40000000 0x80000000>; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ #interconnect-cells = <1>; ++ }; ++ ++ mmc0: mmc@4020000 { ++ compatible = "allwinner,sun20i-d1-mmc"; ++ reg = <0x4020000 0x1000>; ++ interrupts = <56 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&ccu CLK_BUS_MMC0>, <&ccu CLK_MMC0>; ++ clock-names = "ahb", "mmc"; ++ resets = <&ccu RST_BUS_MMC0>; ++ reset-names = "ahb"; ++ cap-sd-highspeed; ++ max-frequency = <150000000>; ++ no-mmc; ++ status = "disabled"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ }; ++ ++ mmc1: mmc@4021000 { ++ compatible = "allwinner,sun20i-d1-mmc"; ++ reg = <0x4021000 0x1000>; ++ interrupts = <57 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&ccu CLK_BUS_MMC1>, <&ccu CLK_MMC1>; ++ clock-names = "ahb", "mmc"; ++ resets = <&ccu RST_BUS_MMC1>; ++ reset-names = "ahb"; ++ cap-sd-highspeed; ++ max-frequency = <150000000>; ++ no-mmc; ++ status = "disabled"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ }; ++ ++ mmc2: mmc@4022000 { ++ compatible = "allwinner,sun20i-d1-emmc", ++ "allwinner,sun50i-a100-emmc"; ++ reg = <0x4022000 0x1000>; ++ interrupts = <58 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&ccu CLK_BUS_MMC2>, <&ccu CLK_MMC2>; ++ clock-names = "ahb", "mmc"; ++ resets = <&ccu RST_BUS_MMC2>; ++ reset-names = "ahb"; ++ cap-mmc-highspeed; ++ max-frequency = <150000000>; ++ mmc-ddr-1_8v; ++ mmc-ddr-3_3v; ++ no-sd; ++ no-sdio; ++ status = "disabled"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ }; ++ ++ usb_otg: usb@4100000 { ++ compatible = "allwinner,sun20i-d1-musb", ++ "allwinner,sun8i-a33-musb"; ++ reg = <0x4100000 0x400>; ++ interrupts = <45 IRQ_TYPE_LEVEL_HIGH>; ++ interrupt-names = "mc"; ++ clocks = <&ccu CLK_BUS_OTG>; ++ resets = <&ccu RST_BUS_OTG>; ++ extcon = <&usbphy 0>; ++ phys = <&usbphy 0>; ++ phy-names = "usb"; ++ status = "disabled"; ++ }; ++ ++ usbphy: phy@4100400 { ++ compatible = "allwinner,sun20i-d1-usb-phy"; ++ reg = <0x4100400 0x100>, ++ <0x4101800 0x100>, ++ <0x4200800 0x100>; ++ reg-names = "phy_ctrl", ++ "pmu0", ++ "pmu1"; ++ clocks = <&osc24M>, ++ <&osc24M>; ++ clock-names = "usb0_phy", ++ "usb1_phy"; ++ resets = <&ccu RST_USB_PHY0>, ++ <&ccu RST_USB_PHY1>; ++ reset-names = "usb0_reset", ++ "usb1_reset"; ++ status = "disabled"; ++ #phy-cells = <1>; ++ }; ++ ++ ehci0: usb@4101000 { ++ compatible = "allwinner,sun20i-d1-ehci", ++ "generic-ehci"; ++ reg = <0x4101000 0x100>; ++ interrupts = <46 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&ccu CLK_BUS_OHCI0>, ++ <&ccu CLK_BUS_EHCI0>, ++ <&ccu CLK_USB_OHCI0>; ++ resets = <&ccu RST_BUS_OHCI0>, ++ <&ccu RST_BUS_EHCI0>; ++ phys = <&usbphy 0>; ++ phy-names = "usb"; ++ status = "disabled"; ++ }; ++ ++ ohci0: usb@4101400 { ++ compatible = "allwinner,sun20i-d1-ohci", ++ "generic-ohci"; ++ reg = <0x4101400 0x100>; ++ interrupts = <47 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&ccu CLK_BUS_OHCI0>, ++ <&ccu CLK_USB_OHCI0>; ++ resets = <&ccu RST_BUS_OHCI0>; ++ phys = <&usbphy 0>; ++ phy-names = "usb"; ++ status = "disabled"; ++ }; ++ ++ ehci1: usb@4200000 { ++ compatible = "allwinner,sun20i-d1-ehci", ++ "generic-ehci"; ++ reg = <0x4200000 0x100>; ++ interrupts = <49 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&ccu CLK_BUS_OHCI1>, ++ <&ccu CLK_BUS_EHCI1>, ++ <&ccu CLK_USB_OHCI1>; ++ resets = <&ccu RST_BUS_OHCI1>, ++ <&ccu RST_BUS_EHCI1>; ++ phys = <&usbphy 1>; ++ phy-names = "usb"; ++ status = "disabled"; ++ }; ++ ++ ohci1: usb@4200400 { ++ compatible = "allwinner,sun20i-d1-ohci", ++ "generic-ohci"; ++ reg = <0x4200400 0x100>; ++ interrupts = <50 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&ccu CLK_BUS_OHCI1>, ++ <&ccu CLK_USB_OHCI1>; ++ resets = <&ccu RST_BUS_OHCI1>; ++ phys = <&usbphy 1>; ++ phy-names = "usb"; ++ status = "disabled"; ++ }; ++ ++ emac: ethernet@4500000 { ++ compatible = "allwinner,sun20i-d1-emac", ++ "allwinner,sun50i-a64-emac"; ++ reg = <0x4500000 0x10000>; ++ interrupts = <62 IRQ_TYPE_LEVEL_HIGH>; ++ interrupt-names = "macirq"; ++ clocks = <&ccu CLK_BUS_EMAC>; ++ clock-names = "stmmaceth"; ++ resets = <&ccu RST_BUS_EMAC>; ++ reset-names = "stmmaceth"; ++ syscon = <&syscon>; ++ status = "disabled"; ++ ++ mdio: mdio { ++ compatible = "snps,dwmac-mdio"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ }; ++ }; ++ ++ display_clocks: clock-controller@5000000 { ++ compatible = "allwinner,sun20i-d1-de2-clk", ++ "allwinner,sun50i-h5-de2-clk"; ++ reg = <0x5000000 0x10000>; ++ clocks = <&ccu CLK_BUS_DE>, <&ccu CLK_DE>; ++ clock-names = "bus", "mod"; ++ resets = <&ccu RST_BUS_DE>; ++ #clock-cells = <1>; ++ #reset-cells = <1>; ++ }; ++ ++ mixer0: mixer@5100000 { ++ compatible = "allwinner,sun20i-d1-de2-mixer-0"; ++ reg = <0x5100000 0x100000>; ++ clocks = <&display_clocks CLK_BUS_MIXER0>, ++ <&display_clocks CLK_MIXER0>; ++ clock-names = "bus", "mod"; ++ resets = <&display_clocks RST_MIXER0>; ++ ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ mixer0_out: port@1 { ++ reg = <1>; ++ ++ mixer0_out_tcon_top_mixer0: endpoint { ++ remote-endpoint = <&tcon_top_mixer0_in_mixer0>; ++ }; ++ }; ++ }; ++ }; ++ ++ mixer1: mixer@5200000 { ++ compatible = "allwinner,sun20i-d1-de2-mixer-1"; ++ reg = <0x5200000 0x100000>; ++ clocks = <&display_clocks CLK_BUS_MIXER1>, ++ <&display_clocks CLK_MIXER1>; ++ clock-names = "bus", "mod"; ++ resets = <&display_clocks RST_MIXER1>; ++ ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ mixer1_out: port@1 { ++ reg = <1>; ++ ++ mixer1_out_tcon_top_mixer1: endpoint { ++ remote-endpoint = <&tcon_top_mixer1_in_mixer1>; ++ }; ++ }; ++ }; ++ }; ++ ++ tcon_top: tcon-top@5460000 { ++ compatible = "allwinner,sun20i-d1-tcon-top"; ++ reg = <0x5460000 0x1000>; ++ clocks = <&ccu CLK_BUS_DPSS_TOP>, ++ <&ccu CLK_TCON_TV>, ++ <&ccu CLK_TVE>, ++ <&ccu CLK_TCON_LCD0>; ++ clock-names = "bus", "tcon-tv0", "tve0", "dsi"; ++ clock-output-names = "tcon-top-tv0", "tcon-top-dsi"; ++ resets = <&ccu RST_BUS_DPSS_TOP>; ++ #clock-cells = <1>; ++ ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ tcon_top_mixer0_in: port@0 { ++ reg = <0>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ tcon_top_mixer0_in_mixer0: endpoint@0 { ++ reg = <0>; ++ remote-endpoint = <&mixer0_out_tcon_top_mixer0>; ++ }; ++ }; ++ ++ tcon_top_mixer0_out: port@1 { ++ reg = <1>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ tcon_top_mixer0_out_tcon_lcd0: endpoint@0 { ++ reg = <0>; ++ remote-endpoint = <&tcon_lcd0_in_tcon_top_mixer0>; ++ }; ++ ++ tcon_top_mixer0_out_tcon_tv0: endpoint@2 { ++ reg = <2>; ++ remote-endpoint = <&tcon_tv0_in_tcon_top_mixer0>; ++ }; ++ }; ++ ++ tcon_top_mixer1_in: port@2 { ++ reg = <2>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ tcon_top_mixer1_in_mixer1: endpoint@1 { ++ reg = <1>; ++ remote-endpoint = <&mixer1_out_tcon_top_mixer1>; ++ }; ++ }; ++ ++ tcon_top_mixer1_out: port@3 { ++ reg = <3>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ tcon_top_mixer1_out_tcon_lcd0: endpoint@0 { ++ reg = <0>; ++ remote-endpoint = <&tcon_lcd0_in_tcon_top_mixer1>; ++ }; ++ ++ tcon_top_mixer1_out_tcon_tv0: endpoint@2 { ++ reg = <2>; ++ remote-endpoint = <&tcon_tv0_in_tcon_top_mixer1>; ++ }; ++ }; ++ ++ tcon_top_hdmi_in: port@4 { ++ reg = <4>; ++ ++ tcon_top_hdmi_in_tcon_tv0: endpoint { ++ remote-endpoint = <&tcon_tv0_out_tcon_top_hdmi>; ++ }; ++ }; ++ ++ tcon_top_hdmi_out: port@5 { ++ reg = <5>; ++ }; ++ }; ++ }; ++ ++ tcon_lcd0: lcd-controller@5461000 { ++ compatible = "allwinner,sun20i-d1-tcon-lcd"; ++ reg = <0x5461000 0x1000>; ++ interrupts = <106 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&ccu CLK_BUS_TCON_LCD0>, ++ <&ccu CLK_TCON_LCD0>; ++ clock-names = "ahb", "tcon-ch0"; ++ clock-output-names = "tcon-pixel-clock"; ++ resets = <&ccu RST_BUS_TCON_LCD0>, ++ <&ccu RST_BUS_LVDS0>; ++ reset-names = "lcd", "lvds"; ++ #clock-cells = <0>; ++ ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ tcon_lcd0_in: port@0 { ++ reg = <0>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ tcon_lcd0_in_tcon_top_mixer0: endpoint@0 { ++ reg = <0>; ++ remote-endpoint = <&tcon_top_mixer0_out_tcon_lcd0>; ++ }; ++ ++ tcon_lcd0_in_tcon_top_mixer1: endpoint@1 { ++ reg = <1>; ++ remote-endpoint = <&tcon_top_mixer1_out_tcon_lcd0>; ++ }; ++ }; ++ ++ tcon_lcd0_out: port@1 { ++ reg = <1>; ++ }; ++ }; ++ }; ++ ++ tcon_tv0: lcd-controller@5470000 { ++ compatible = "allwinner,sun20i-d1-tcon-tv"; ++ reg = <0x5470000 0x1000>; ++ interrupts = <107 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&ccu CLK_BUS_TCON_TV>, ++ <&tcon_top CLK_TCON_TOP_TV0>; ++ clock-names = "ahb", "tcon-ch1"; ++ resets = <&ccu RST_BUS_TCON_TV>; ++ reset-names = "lcd"; ++ ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ tcon_tv0_in: port@0 { ++ reg = <0>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ tcon_tv0_in_tcon_top_mixer0: endpoint@0 { ++ reg = <0>; ++ remote-endpoint = <&tcon_top_mixer0_out_tcon_tv0>; ++ }; ++ ++ tcon_tv0_in_tcon_top_mixer1: endpoint@1 { ++ reg = <1>; ++ remote-endpoint = <&tcon_top_mixer1_out_tcon_tv0>; ++ }; ++ }; ++ ++ tcon_tv0_out: port@1 { ++ reg = <1>; ++ ++ tcon_tv0_out_tcon_top_hdmi: endpoint { ++ remote-endpoint = <&tcon_top_hdmi_in_tcon_tv0>; ++ }; ++ }; ++ }; ++ }; ++ ++ riscv_wdt: watchdog@6011000 { ++ compatible = "allwinner,sun20i-d1-wdt"; ++ reg = <0x6011000 0x20>; ++ interrupts = <147 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&osc24M>, <&rtc CLK_OSC32K>; ++ clock-names = "hosc", "losc"; ++ }; ++ ++ r_ccu: clock-controller@7010000 { ++ compatible = "allwinner,sun20i-d1-r-ccu"; ++ reg = <0x7010000 0x400>; ++ clocks = <&osc24M>, ++ <&rtc CLK_OSC32K>, ++ <&rtc CLK_IOSC>, ++ <&ccu CLK_PLL_PERIPH0_DIV3>; ++ clock-names = "hosc", "losc", "iosc", "pll-periph"; ++ #clock-cells = <1>; ++ #reset-cells = <1>; ++ }; ++ ++ rtc: rtc@7090000 { ++ compatible = "allwinner,sun20i-d1-rtc", ++ "allwinner,sun50i-r329-rtc"; ++ reg = <0x7090000 0x400>; ++ interrupts = <160 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&r_ccu CLK_BUS_R_RTC>, ++ <&osc24M>, ++ <&r_ccu CLK_R_AHB>; ++ clock-names = "bus", "hosc", "ahb"; ++ #clock-cells = <1>; ++ }; ++ ++ plic: interrupt-controller@10000000 { ++ compatible = "allwinner,sun20i-d1-plic", ++ "thead,c900-plic"; ++ reg = <0x10000000 0x4000000>; ++ interrupts-extended = <&cpu0_intc 11>, ++ <&cpu0_intc 9>; ++ interrupt-controller; ++ riscv,ndev = <176>; ++ #address-cells = <0>; ++ #interrupt-cells = <2>; ++ }; ++ }; ++}; +--- /dev/null ++++ b/arch/riscv/dts/sunxi-u-boot.dtsi +@@ -0,0 +1,68 @@ ++// SPDX-License-Identifier: (GPL-2.0 OR MIT) ++ ++#include "binman.dtsi" ++ ++/ { ++ cpus { ++ u-boot,dm-spl; ++ }; ++ ++ soc { ++ u-boot,dm-spl; ++ }; ++}; ++ ++&binman { ++ u-boot-sunxi-with-spl { ++ filename = "u-boot-sunxi-with-spl.bin"; ++ pad-byte = <0xff>; ++ ++ blob@0 { ++ filename = "spl/sunxi-spl.bin"; ++ }; ++ ++ blob@1 { ++ filename = "u-boot.itb"; ++ }; ++ }; ++}; ++ ++&ccu { ++ u-boot,dm-spl; ++}; ++ ++&cpu0 { ++ u-boot,dm-spl; ++}; ++ ++&mbus { ++ u-boot,dm-spl; ++}; ++ ++&mmc0 { ++ u-boot,dm-spl; ++}; ++ ++&mmc0_pins { ++ u-boot,dm-spl; ++}; ++ ++&osc24M { ++ u-boot,dm-spl; ++}; ++ ++&pio { ++ u-boot,dm-spl; ++}; ++ ++&rtc { ++ u-boot,dm-spl; ++}; ++ ++&uart0 { ++ u-boot,dm-spl; ++}; ++ ++&uart0_pb8_pins { ++ u-boot,dm-spl; ++}; +--- /dev/null ++++ b/include/dt-bindings/clock/sun20i-d1-r-ccu.h +@@ -0,0 +1,19 @@ ++/* SPDX-License-Identifier: (GPL-2.0+ or MIT) */ ++/* ++ * Copyright (C) 2021 Samuel Holland ++ */ ++ ++#ifndef _DT_BINDINGS_CLK_SUN20I_D1_R_CCU_H_ ++#define _DT_BINDINGS_CLK_SUN20I_D1_R_CCU_H_ ++ ++#define CLK_R_AHB 0 ++ ++#define CLK_BUS_R_TIMER 2 ++#define CLK_BUS_R_TWD 3 ++#define CLK_BUS_R_PPU 4 ++#define CLK_R_IR_RX 5 ++#define CLK_BUS_R_IR_RX 6 ++#define CLK_BUS_R_RTC 7 ++#define CLK_BUS_R_CPUCFG 8 ++ ++#endif /* _DT_BINDINGS_CLK_SUN20I_D1_R_CCU_H_ */ +--- /dev/null ++++ b/include/dt-bindings/reset/sun20i-d1-r-ccu.h +@@ -0,0 +1,16 @@ ++/* SPDX-License-Identifier: (GPL-2.0+ or MIT) */ ++/* ++ * Copyright (C) 2021 Samuel Holland ++ */ ++ ++#ifndef _DT_BINDINGS_RST_SUN20I_D1_R_CCU_H_ ++#define _DT_BINDINGS_RST_SUN20I_D1_R_CCU_H_ ++ ++#define RST_BUS_R_TIMER 0 ++#define RST_BUS_R_TWD 1 ++#define RST_BUS_R_PPU 2 ++#define RST_BUS_R_IR_RX 3 ++#define RST_BUS_R_RTC 4 ++#define RST_BUS_R_CPUCFG 5 ++ ++#endif /* _DT_BINDINGS_RST_SUN20I_D1_R_CCU_H_ */ diff --git a/package/boot/uboot-d1/patches/0079-riscv-Add-CONFIG_TARGET_SUN20I_D1.patch b/package/boot/uboot-d1/patches/0079-riscv-Add-CONFIG_TARGET_SUN20I_D1.patch new file mode 100644 index 00000000000000..a3678243c14523 --- /dev/null +++ b/package/boot/uboot-d1/patches/0079-riscv-Add-CONFIG_TARGET_SUN20I_D1.patch @@ -0,0 +1,169 @@ +From 6b0c83a5c7b9189fb1c5cf56145ec4882d9e5588 Mon Sep 17 00:00:00 2001 +From: Zoltan HERPAI +Date: Tue, 6 Jun 2023 18:13:34 +0000 +Subject: [PATCH 79/90] riscv: Add CONFIG_TARGET_SUN20I_D1 + +Signed-off-by: Samuel Holland +Signed-off-by: Zoltan HERPAI +--- + arch/riscv/Kconfig | 5 +++++ + board/sunxi/Kconfig | 30 +++++++++++++++++++++++++++--- + common/spl/Kconfig | 1 + + drivers/clk/sunxi/Kconfig | 1 + + include/configs/sun20i.h | 11 +++++++++++ + 5 files changed, 45 insertions(+), 3 deletions(-) + create mode 100644 include/configs/sun20i.h + +--- a/arch/riscv/Kconfig ++++ b/arch/riscv/Kconfig +@@ -31,6 +31,11 @@ config TARGET_SIPEED_MAIX + bool "Support Sipeed Maix Board" + select SYS_CACHE_SHIFT_6 + ++config TARGET_SUN20I_D1 ++ bool "Support Allwinner D1 Boards" ++ select BOARD_SUNXI ++ select SYS_CACHE_SHIFT_6 ++ + endchoice + + config SYS_ICACHE_OFF +--- a/board/sunxi/Kconfig ++++ b/board/sunxi/Kconfig +@@ -13,8 +13,18 @@ config BOARD_SUNXI + select DM_SERIAL if SERIAL + select DM_SPI if SPI + select DM_SPI_FLASH if SPI ++ select GENERIC_RISCV if RISCV + select OF_BOARD_SETUP + select PINCTRL ++ select RAM if SPL_DM ++ select SPL_CLK if SPL_DM ++ select SPL_DM if RISCV && SPL ++ select SPL_DM_SPI if SPL_DM && SPL_SPI ++ select SPL_DM_SPI_FLASH if SPL_DM && SPL_SPI ++ select SPL_OF_CONTROL if SPL_DM ++ select SPL_PINCTRL if SPL_DM ++ select SPL_PINCONF if SPL_DM ++ select SPL_RAM if SPL_DM + select SPL_SEPARATE_BSS if SPL + select SUPPORT_SPL + select SYS_RELOC_GD_ENV_ADDR +@@ -28,12 +38,14 @@ config BOARD_SUNXI + imply DISTRO_DEFAULTS + imply FAT_WRITE + imply FIT ++ imply MMC + imply OF_LIBFDT_OVERLAY + imply PRE_CONSOLE_BUFFER + imply SPL + imply SPL_GPIO + imply SPL_LIBCOMMON_SUPPORT + imply SPL_LIBGENERIC_SUPPORT ++ imply SPL_LOAD_FIT + imply SPL_MMC if MMC + imply SPL_POWER + imply SPL_SERIAL +@@ -41,6 +53,7 @@ config BOARD_SUNXI + imply SYS_I2C_MVTWSI + imply SYS_NS16550 + imply SYSRESET ++ imply SYSRESET_SBI + imply SYSRESET_WATCHDOG + imply SYSRESET_WATCHDOG_AUTO + imply USB_EHCI_GENERIC +@@ -67,6 +80,12 @@ config SPL_BSS_START_ADDR + default 0x4ff80000 if SUNXI_MINIMUM_DRAM_MB >= 256 + default 0x43f80000 if SUNXI_MINIMUM_DRAM_MB >= 64 + ++config SPL_OPENSBI_LOAD_ADDR ++ default 0x40000000 if RISCV ++ ++config SPL_STACK ++ default 0x48000 if TARGET_SUN20I_D1 ++ + config SPL_STACK_R_ADDR + default 0x81e00000 if MACH_SUNIV + default 0x2fe00000 if MACH_SUN9I +@@ -75,13 +94,13 @@ config SPL_STACK_R_ADDR + + config SPL_TEXT_BASE + default 0x10060 if MACH_SUN9I || MACH_SUN50I || MACH_SUN50I_H5 +- default 0x20060 if SUN50I_GEN_H6 ++ default 0x20060 if SUN50I_GEN_H6 || TARGET_SUN20I_D1 + default 0x00060 + + config SUNXI_MINIMUM_DRAM_MB + int + default 32 if MACH_SUNIV +- default 64 if MACH_SUN8I_V3S ++ default 64 if MACH_SUN8I_V3S || TARGET_SUN20I_D1 + default 256 + help + Minimum DRAM size expected on the board. Traditionally we +@@ -94,7 +113,7 @@ config SUNXI_MINIMUM_DRAM_MB + config SUNXI_SRAM_ADDRESS + hex + default 0x10000 if MACH_SUN9I || MACH_SUN50I || MACH_SUN50I_H5 +- default 0x20000 if SUN50I_GEN_H6 ++ default 0x20000 if SUN50I_GEN_H6 || TARGET_SUN20I_D1 + default 0x0 + help + Older Allwinner SoCs have their boot mask ROM mapped just +@@ -113,6 +132,7 @@ config SYS_CLK_FREQ + default 912000000 if MACH_SUN7I + default 1008000000 if MACH_SUN8I + default 1008000000 if MACH_SUN9I ++ default 1008000000 if TARGET_SUN20I_D1 + default 816000000 if MACH_SUN50I || MACH_SUN50I_H5 + default 888000000 if MACH_SUN50I_H6 + default 1008000000 if MACH_SUN50I_H616 +@@ -125,10 +145,14 @@ config SYS_CONFIG_NAME + default "sun7i" if MACH_SUN7I + default "sun8i" if MACH_SUN8I + default "sun9i" if MACH_SUN9I ++ default "sun20i" if TARGET_SUN20I_D1 + default "sun50i" if MACH_SUN50I + default "sun50i" if MACH_SUN50I_H6 + default "sun50i" if MACH_SUN50I_H616 + ++config SYS_CPU ++ default "generic" if TARGET_SUN20I_D1 ++ + config SYS_LOAD_ADDR + default 0x81000000 if MACH_SUNIV + default 0x22000000 if MACH_SUN9I +--- a/common/spl/Kconfig ++++ b/common/spl/Kconfig +@@ -78,6 +78,7 @@ config SPL_MAX_SIZE + hex "Maximum size of the SPL image, excluding BSS" + default 0x37fa0 if MACH_SUN50I_H616 + default 0x30000 if ARCH_MX6 && MX6_OCRAM_256KB ++ default 0x27fa0 if TARGET_SUN20I_D1 + default 0x25fa0 if MACH_SUN50I_H6 + default 0x1b000 if AM33XX && !TI_SECURE_DEVICE + default 0x10000 if ARCH_MX6 && !MX6_OCRAM_256KB +--- a/drivers/clk/sunxi/Kconfig ++++ b/drivers/clk/sunxi/Kconfig +@@ -98,6 +98,7 @@ config CLK_SUN8I_H3 + + config CLK_SUN20I_D1 + bool "Clock driver for Allwinner D1" ++ default TARGET_SUN20I_D1 + help + This enables common clock driver support for platforms based + on Allwinner D1 SoC. +--- /dev/null ++++ b/include/configs/sun20i.h +@@ -0,0 +1,11 @@ ++/* SPDX-License-Identifier: GPL-2.0+ */ ++/* ++ * Placeholder wrapper to allow addressing Allwinner D1 (and later) sun20i ++ * CPU based devices separately. Please do not add anything in here. ++ */ ++#ifndef __CONFIG_H ++#define __CONFIG_H ++ ++#include ++ ++#endif /* __CONFIG_H */ diff --git a/package/boot/uboot-d1/patches/0080-gpio-sunxi-Hack-up-the-driver-for-the-D1.patch b/package/boot/uboot-d1/patches/0080-gpio-sunxi-Hack-up-the-driver-for-the-D1.patch new file mode 100644 index 00000000000000..42a5c28584499a --- /dev/null +++ b/package/boot/uboot-d1/patches/0080-gpio-sunxi-Hack-up-the-driver-for-the-D1.patch @@ -0,0 +1,134 @@ +From 28682ca027b9fa64f3de4cea99373642f36c4e6c Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sun, 8 Aug 2021 19:32:14 -0500 +Subject: [PATCH 80/90] gpio: sunxi: Hack up the driver for the D1 + +Signed-off-by: Samuel Holland +--- + arch/arm/include/asm/arch-sunxi/gpio.h | 12 ++++++++++-- + arch/arm/mach-sunxi/pinmux.c | 8 +++++++- + drivers/gpio/sunxi_gpio.c | 3 +++ + 3 files changed, 20 insertions(+), 3 deletions(-) + +--- a/arch/arm/include/asm/arch-sunxi/gpio.h ++++ b/arch/arm/include/asm/arch-sunxi/gpio.h +@@ -9,7 +9,9 @@ + #define _SUNXI_GPIO_H + + #include ++#if 0 + #include ++#endif + + /* + * sunxi has 9 banks of gpio, they are: +@@ -55,30 +57,36 @@ + struct sunxi_gpio { + u32 cfg[4]; + u32 dat; +- u32 drv[2]; ++ u32 drv[4]; + u32 pull[2]; ++ u32 reserved; + }; + + /* gpio interrupt control */ + struct sunxi_gpio_int { +- u32 cfg[3]; ++ u32 cfg[4]; + u32 ctl; + u32 sta; + u32 deb; /* interrupt debounce */ ++ u32 reserved; + }; + ++#if 0 + struct sunxi_gpio_reg { + struct sunxi_gpio gpio_bank[SUNXI_GPIO_BANKS]; + u8 res[0xbc]; + struct sunxi_gpio_int gpio_int; + }; ++#endif + + #define SUN50I_H6_GPIO_POW_MOD_SEL 0x340 + #define SUN50I_H6_GPIO_POW_MOD_VAL 0x348 + ++#if 0 + #define BANK_TO_GPIO(bank) (((bank) < SUNXI_GPIO_L) ? \ + &((struct sunxi_gpio_reg *)SUNXI_PIO_BASE)->gpio_bank[bank] : \ + &((struct sunxi_gpio_reg *)SUNXI_R_PIO_BASE)->gpio_bank[(bank) - SUNXI_GPIO_L]) ++#endif + + #define GPIO_BANK(pin) ((pin) >> 5) + #define GPIO_NUM(pin) ((pin) & 0x1f) +--- a/arch/arm/mach-sunxi/pinmux.c ++++ b/arch/arm/mach-sunxi/pinmux.c +@@ -7,7 +7,7 @@ + + #include + #include +-#include ++//#include + + void sunxi_gpio_set_cfgbank(struct sunxi_gpio *pio, int bank_offset, u32 val) + { +@@ -17,6 +17,7 @@ void sunxi_gpio_set_cfgbank(struct sunxi + clrsetbits_le32(&pio->cfg[index], 0xf << offset, val << offset); + } + ++#if !CONFIG_IS_ENABLED(DM_GPIO) + void sunxi_gpio_set_cfgpin(u32 pin, u32 val) + { + u32 bank = GPIO_BANK(pin); +@@ -24,6 +25,7 @@ void sunxi_gpio_set_cfgpin(u32 pin, u32 + + sunxi_gpio_set_cfgbank(pio, pin, val); + } ++#endif + + int sunxi_gpio_get_cfgbank(struct sunxi_gpio *pio, int bank_offset) + { +@@ -37,6 +39,7 @@ int sunxi_gpio_get_cfgbank(struct sunxi_ + return cfg & 0xf; + } + ++#if !CONFIG_IS_ENABLED(DM_GPIO) + int sunxi_gpio_get_cfgpin(u32 pin) + { + u32 bank = GPIO_BANK(pin); +@@ -52,6 +55,7 @@ void sunxi_gpio_set_drv(u32 pin, u32 val + + sunxi_gpio_set_drv_bank(pio, pin, val); + } ++#endif + + void sunxi_gpio_set_drv_bank(struct sunxi_gpio *pio, u32 bank_offset, u32 val) + { +@@ -61,6 +65,7 @@ void sunxi_gpio_set_drv_bank(struct sunx + clrsetbits_le32(&pio->drv[index], 0x3 << offset, val << offset); + } + ++#if !CONFIG_IS_ENABLED(DM_GPIO) + void sunxi_gpio_set_pull(u32 pin, u32 val) + { + u32 bank = GPIO_BANK(pin); +@@ -68,6 +73,7 @@ void sunxi_gpio_set_pull(u32 pin, u32 va + + sunxi_gpio_set_pull_bank(pio, pin, val); + } ++#endif + + void sunxi_gpio_set_pull_bank(struct sunxi_gpio *pio, int bank_offset, u32 val) + { +--- a/drivers/gpio/sunxi_gpio.c ++++ b/drivers/gpio/sunxi_gpio.c +@@ -18,6 +18,9 @@ + #include + #include + ++#include "../../arch/arm/include/asm/arch-sunxi/gpio.h" ++#include "../../arch/arm/mach-sunxi/pinmux.c" ++ + #if !CONFIG_IS_ENABLED(DM_GPIO) + static int sunxi_gpio_output(u32 pin, u32 val) + { diff --git a/package/boot/uboot-d1/patches/0081-mmc-sunxi-Hack-up-the-driver-for-the-D1.patch b/package/boot/uboot-d1/patches/0081-mmc-sunxi-Hack-up-the-driver-for-the-D1.patch new file mode 100644 index 00000000000000..3d8ddf45838e83 --- /dev/null +++ b/package/boot/uboot-d1/patches/0081-mmc-sunxi-Hack-up-the-driver-for-the-D1.patch @@ -0,0 +1,118 @@ +From 4df80766531bc35510981ebc5ea0bb07264beac9 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sun, 8 Aug 2021 19:31:20 -0500 +Subject: [PATCH 81/90] mmc: sunxi: Hack up the driver for the D1 + +Signed-off-by: Samuel Holland +--- + arch/riscv/include/asm/io.h | 1 + + drivers/mmc/sunxi_mmc.c | 29 +++++++++++++++++++++++++---- + drivers/mmc/sunxi_mmc.h | 2 -- + 3 files changed, 26 insertions(+), 6 deletions(-) + +--- a/arch/riscv/include/asm/io.h ++++ b/arch/riscv/include/asm/io.h +@@ -85,6 +85,7 @@ static inline u16 readw(const volatile v + return val; + } + ++#define readl_relaxed readl + static inline u32 readl(const volatile void __iomem *addr) + { + u32 val; +--- a/drivers/mmc/sunxi_mmc.c ++++ b/drivers/mmc/sunxi_mmc.c +@@ -23,9 +23,9 @@ + #include + #include + #include ++#if !CONFIG_IS_ENABLED(DM_MMC) + #include + #include +-#if !CONFIG_IS_ENABLED(DM_MMC) + #include + #endif + #include +@@ -36,6 +36,23 @@ + #define CCM_MMC_CTRL_MODE_SEL_NEW 0 + #endif + ++#include "../../arch/arm/include/asm/arch-sunxi/clock_sun50i_h6.h" ++ ++unsigned int clock_get_pll6(void) ++{ ++ uint32_t rval = readl((void *)0x2001020); ++ ++ int n = ((rval & CCM_PLL6_CTRL_N_MASK) >> CCM_PLL6_CTRL_N_SHIFT) + 1; ++ int m = ((rval >> 1) & 0x1) + 1; ++ int p0 = ((rval >> 16) & 0x7) + 1; ++ /* The register defines PLL6-2X, not plain PLL6 */ ++ uint32_t freq = 24000000UL * n / m / p0; ++ ++ printf("PLL reg = 0x%08x, freq = %d\n", rval, freq); ++ ++ return freq; ++} ++ + struct sunxi_mmc_plat { + struct mmc_config cfg; + struct mmc mmc; +@@ -60,7 +77,8 @@ static bool sunxi_mmc_can_calibrate(void + return IS_ENABLED(CONFIG_MACH_SUN50I) || + IS_ENABLED(CONFIG_MACH_SUN50I_H5) || + IS_ENABLED(CONFIG_SUN50I_GEN_H6) || +- IS_ENABLED(CONFIG_MACH_SUN8I_R40); ++ IS_ENABLED(CONFIG_MACH_SUN8I_R40) || ++ IS_ENABLED(CONFIG_TARGET_SUN20I_D1); + } + + static int mmc_set_mod_clk(struct sunxi_mmc_priv *priv, unsigned int hz) +@@ -194,7 +212,7 @@ static int mmc_config_clock(struct sunxi + rval &= ~SUNXI_MMC_CLK_DIVIDER_MASK; + writel(rval, &priv->reg->clkcr); + +-#if defined(CONFIG_SUNXI_GEN_SUN6I) || defined(CONFIG_SUN50I_GEN_H6) ++#if defined(CONFIG_SUNXI_GEN_SUN6I) || defined(CONFIG_SUN50I_GEN_H6) || defined(CONFIG_TARGET_SUN20I_D1) + /* A64 supports calibration of delays on MMC controller and we + * have to set delay of zero before starting calibration. + * Allwinner BSP driver sets a delay only in the case of +@@ -622,7 +640,8 @@ static unsigned get_mclk_offset(void) + if (IS_ENABLED(CONFIG_MACH_SUN9I_A80)) + return 0x410; + +- if (IS_ENABLED(CONFIG_SUN50I_GEN_H6)) ++ if (IS_ENABLED(CONFIG_SUN50I_GEN_H6) || ++ IS_ENABLED(CONFIG_TARGET_SUN20I_D1)) + return 0x830; + + return 0x88; +@@ -662,6 +681,7 @@ static int sunxi_mmc_probe(struct udevic + return ret; + ccu_reg = (u32 *)(uintptr_t)ofnode_get_addr(args.node); + ++#define SUNXI_MMC0_BASE 0x4020000 + priv->mmc_no = ((uintptr_t)priv->reg - SUNXI_MMC0_BASE) / 0x1000; + priv->mclkreg = (void *)ccu_reg + get_mclk_offset() + priv->mmc_no * 4; + +@@ -703,6 +723,7 @@ static const struct udevice_id sunxi_mmc + { .compatible = "allwinner,sun7i-a20-mmc" }, + { .compatible = "allwinner,sun8i-a83t-emmc" }, + { .compatible = "allwinner,sun9i-a80-mmc" }, ++ { .compatible = "allwinner,sun20i-d1-mmc" }, + { .compatible = "allwinner,sun50i-a64-mmc" }, + { .compatible = "allwinner,sun50i-a64-emmc" }, + { .compatible = "allwinner,sun50i-h6-mmc" }, +--- a/drivers/mmc/sunxi_mmc.h ++++ b/drivers/mmc/sunxi_mmc.h +@@ -45,11 +45,9 @@ struct sunxi_mmc { + u32 chda; /* 0x90 */ + u32 cbda; /* 0x94 */ + u32 res2[26]; +-#if defined(CONFIG_SUNXI_GEN_SUN6I) || defined(CONFIG_SUN50I_GEN_H6) + u32 res3[17]; + u32 samp_dl; + u32 res4[46]; +-#endif + u32 fifo; /* 0x100 / 0x200 FIFO access address */ + }; + diff --git a/package/boot/uboot-d1/patches/0082-pinctrl-sunxi-Hack-up-the-driver-for-the-D1.patch b/package/boot/uboot-d1/patches/0082-pinctrl-sunxi-Hack-up-the-driver-for-the-D1.patch new file mode 100644 index 00000000000000..06502d3186d801 --- /dev/null +++ b/package/boot/uboot-d1/patches/0082-pinctrl-sunxi-Hack-up-the-driver-for-the-D1.patch @@ -0,0 +1,29 @@ +From c33ca5c6a5be74711460756bf86c45b6c6fd0a3f Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Thu, 4 Nov 2021 17:49:15 -0500 +Subject: [PATCH 82/90] pinctrl: sunxi: Hack up the driver for the D1 + +Signed-off-by: Samuel Holland +--- + drivers/pinctrl/sunxi/pinctrl-sunxi.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c ++++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c +@@ -9,6 +9,7 @@ + #include + + #include ++#include "../../../arch/arm/include/asm/arch-sunxi/gpio.h" + + extern U_BOOT_DRIVER(gpio_sunxi); + +@@ -49,7 +50,7 @@ static const char *sunxi_pinctrl_get_pin + uint pin_selector) + { + const struct sunxi_pinctrl_desc *desc = dev_get_priv(dev); +- static char pin_name[sizeof("PN31")]; ++ static char pin_name[sizeof("PN31")] __section(".data"); + + snprintf(pin_name, sizeof(pin_name), "P%c%d", + pin_selector / SUNXI_GPIOS_PER_BANK + desc->first_bank + 'A', diff --git a/package/boot/uboot-d1/patches/0083-ram-sunxi-Add-Allwinner-D1-DRAM-driver.patch b/package/boot/uboot-d1/patches/0083-ram-sunxi-Add-Allwinner-D1-DRAM-driver.patch new file mode 100644 index 00000000000000..73e3b1060d4e53 --- /dev/null +++ b/package/boot/uboot-d1/patches/0083-ram-sunxi-Add-Allwinner-D1-DRAM-driver.patch @@ -0,0 +1,1943 @@ +From 9f612f3a1fd3d0759abca3720d488a17d159aa17 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sun, 30 Oct 2022 14:54:08 -0500 +Subject: [PATCH 83/90] ram: sunxi: Add Allwinner D1 DRAM driver + +Signed-off-by: Samuel Holland +--- + drivers/ram/Kconfig | 1 + + drivers/ram/Makefile | 1 + + drivers/ram/sunxi/Kconfig | 6 + + drivers/ram/sunxi/Makefile | 3 + + drivers/ram/sunxi/dram_v2.h | 65 + + drivers/ram/sunxi/mctl_hal-sun20iw1p1.c | 1771 +++++++++++++++++++++++ + drivers/ram/sunxi/sdram.h | 46 + + 7 files changed, 1893 insertions(+) + create mode 100644 drivers/ram/sunxi/Kconfig + create mode 100644 drivers/ram/sunxi/Makefile + create mode 100644 drivers/ram/sunxi/dram_v2.h + create mode 100644 drivers/ram/sunxi/mctl_hal-sun20iw1p1.c + create mode 100644 drivers/ram/sunxi/sdram.h + +--- a/drivers/ram/Kconfig ++++ b/drivers/ram/Kconfig +@@ -101,3 +101,4 @@ source "drivers/ram/rockchip/Kconfig" + source "drivers/ram/sifive/Kconfig" + source "drivers/ram/stm32mp1/Kconfig" + source "drivers/ram/octeon/Kconfig" ++source "drivers/ram/sunxi/Kconfig" +--- a/drivers/ram/Makefile ++++ b/drivers/ram/Makefile +@@ -20,5 +20,6 @@ obj-$(CONFIG_K3_DDRSS) += k3-ddrss/ + obj-$(CONFIG_IMXRT_SDRAM) += imxrt_sdram.o + + obj-$(CONFIG_RAM_SIFIVE) += sifive/ ++obj-$(CONFIG_RAM_SUNXI) += sunxi/ + + obj-$(CONFIG_ARCH_OCTEON) += octeon/ +--- /dev/null ++++ b/drivers/ram/sunxi/Kconfig +@@ -0,0 +1,6 @@ ++config RAM_SUNXI ++ bool "Ram drivers support for sunxi SoCs" ++ depends on RAM && BOARD_SUNXI ++ default y ++ help ++ This enables support for ram drivers of sunxi SoCs. +--- /dev/null ++++ b/drivers/ram/sunxi/Makefile +@@ -0,0 +1,3 @@ ++# SPDX-License-Identifier: GPL-2.0+ ++ ++obj-$(CONFIG_RAM_SUNXI) += mctl_hal-sun20iw1p1.o +--- /dev/null ++++ b/drivers/ram/sunxi/dram_v2.h +@@ -0,0 +1,65 @@ ++/* ++ * (C) Copyright 2007-2013 ++* SPDX-License-Identifier: GPL-2.0+ ++ * Allwinner Technology Co., Ltd. ++ * Jerry Wang ++ * ++ * See file CREDITS for list of people who contributed to this ++ * project. ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License as ++ * published by the Free Software Foundation; either version 2 of ++ * the License, or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, ++ * MA 02111-1307 USA ++ */ ++ ++#ifndef __dram_head_h__ ++#define __dram_head_h__ ++ ++struct dram_para_t ++{ ++ //normal configuration ++ unsigned int dram_clk; ++ unsigned int dram_type; //dram_type DDR2: 2 DDR3: 3 LPDDR2: 6 LPDDR3: 7 DDR3L: 31 ++ //unsigned int lpddr2_type; //LPDDR2 type S4:0 S2:1 NVM:2 ++ unsigned int dram_zq; //do not need ++ unsigned int dram_odt_en; ++ ++ //control configuration ++ unsigned int dram_para1; ++ unsigned int dram_para2; ++ ++ //timing configuration ++ unsigned int dram_mr0; ++ unsigned int dram_mr1; ++ unsigned int dram_mr2; ++ unsigned int dram_mr3; ++ unsigned int dram_tpr0; //DRAMTMG0 ++ unsigned int dram_tpr1; //DRAMTMG1 ++ unsigned int dram_tpr2; //DRAMTMG2 ++ unsigned int dram_tpr3; //DRAMTMG3 ++ unsigned int dram_tpr4; //DRAMTMG4 ++ unsigned int dram_tpr5; //DRAMTMG5 ++ unsigned int dram_tpr6; //DRAMTMG8 ++ //reserved for future use ++ unsigned int dram_tpr7; ++ unsigned int dram_tpr8; ++ unsigned int dram_tpr9; ++ unsigned int dram_tpr10; ++ unsigned int dram_tpr11; ++ unsigned int dram_tpr12; ++ unsigned int dram_tpr13; ++ ++}; ++ ++#endif +--- /dev/null ++++ b/drivers/ram/sunxi/mctl_hal-sun20iw1p1.c +@@ -0,0 +1,1771 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++ ++#include ++#include ++#include ++#include ++ ++#include "dram_v2.h" ++#include "sdram.h" ++ ++#define readl rv_readl ++#define writel rv_writel ++#include ++#undef readl ++#undef writel ++ ++#define readl(x) rv_readl((const volatile void __iomem *)(u64)(x)) ++#define writel(x, v) rv_writel(v, (volatile void __iomem *)(u64)(x)) ++ ++#if defined(CONFIG_SPL_BUILD) ++ ++char* memcpy_self(char* dst, char* src, int len) ++{ ++ int i; ++ for(i=0; i!=len; i++) { ++ dst[i] = src[i]; ++ } ++ return dst; ++} ++ ++void dram_vol_set(struct dram_para_t *para) ++{ ++ int reg, vol = 0; ++ ++ switch( para->dram_type ) { ++ case 2: vol = 47; break; ++ case 3: vol = 25; break; ++ default: vol = 0; ++ } ++vol = 25; // XXX ++ reg = readl(0x3000150); ++ reg &= ~(0xff00); ++ reg |= vol << 8; ++ reg &= ~(0x200000); ++ writel(0x3000150, reg); ++ ++ udelay(1); ++} ++ ++void paraconfig(unsigned int *para, unsigned int mask, unsigned int value) ++{ ++ *para &= ~(mask); ++ *para |= value; ++} ++ ++ ++void dram_enable_all_master(void) ++{ ++ writel(0x3102020, -1); ++ writel(0x3102024, 0xff); ++ writel(0x3102028, 0xffff); ++ udelay(10); ++} ++ ++ ++void dram_disable_all_master(void) ++{ ++ writel(0x3102020, 1); ++ writel(0x3102024, 0); ++ writel(0x3102028, 0); ++ udelay(10); ++} ++ ++ ++void eye_delay_compensation(struct dram_para_t *para) // s1 ++{ ++ unsigned int val, ptr; ++ ++ // DATn0IOCR, n = 0...7 ++ for (ptr = 0x3103310; ptr != 0x3103334; ptr += 4) { ++ val = readl(ptr); ++ val |= (para->dram_tpr11 << 9) & 0x1e00; ++ val |= (para->dram_tpr12 << 1) & 0x001e; ++ writel(ptr, val); ++ } ++ ++ // DATn1IOCR, n = 0...7 ++ for (ptr = 0x3103390; ptr != 0x31033b4; ptr += 4) { ++ val = readl(ptr); ++ val |= ((para->dram_tpr11 >> 4) << 9) & 0x1e00; ++ val |= ((para->dram_tpr12 >> 4) << 1) & 0x001e; ++ writel(ptr, val); ++ } ++ ++ // PGCR0: assert AC loopback FIFO reset ++ val = readl(0x3103100); ++ val &= 0xfbffffff; ++ writel(0x3103100, val); ++ ++ // ?? ++ val = readl(0x3103334); ++ val |= ((para->dram_tpr11 >> 16) << 9) & 0x1e00; ++ val |= ((para->dram_tpr12 >> 16) << 1) & 0x001e; ++ writel(0x3103334, val); ++ ++ val = readl(0x3103338); ++ val |= ((para->dram_tpr11 >> 16) << 9) & 0x1e00; ++ val |= ((para->dram_tpr12 >> 16) << 1) & 0x001e; ++ writel(0x3103338, val); ++ ++ val = readl(0x31033b4); ++ val |= ((para->dram_tpr11 >> 20) << 9) & 0x1e00; ++ val |= ((para->dram_tpr12 >> 20) << 1) & 0x001e; ++ writel(0x31033b4, val); ++ ++ val = readl(0x31033b8); ++ val |= ((para->dram_tpr11 >> 20) << 9) & 0x1e00; ++ val |= ((para->dram_tpr12 >> 20) << 1) & 0x001e; ++ writel(0x31033b8, val); ++ ++ val = readl(0x310333c); ++ val |= ((para->dram_tpr11 >> 16) << 25) & 0x1e000000; ++ writel(0x310333c, val); ++ ++ val = readl(0x31033bc); ++ val |= ((para->dram_tpr11 >> 20) << 25) & 0x1e000000; ++ writel(0x31033bc, val); ++ ++ // PGCR0: release AC loopback FIFO reset ++ val = readl(0x3103100); ++ val |= 0x04000000; ++ writel(0x3103100, val); ++ ++ udelay(1); ++ ++ for (ptr = 0x3103240; ptr != 0x310327c; ptr += 4) { ++ val = readl(ptr); ++ val |= ((para->dram_tpr10 >> 4) << 8) & 0x0f00; ++ writel(ptr, val); ++ } ++ ++ for (ptr = 0x3103228; ptr != 0x3103240; ptr += 4) { ++ val = readl(ptr); ++ val |= ((para->dram_tpr10 >> 4) << 8) & 0x0f00; ++ writel(ptr, val); ++ } ++ ++ val = readl(0x3103218); ++ val |= (para->dram_tpr10 << 8) & 0x0f00; ++ writel(0x3103218, val); ++ ++ val = readl(0x310321c); ++ val |= (para->dram_tpr10 << 8) & 0x0f00; ++ writel(0x310321c, val); ++ ++ val = readl(0x3103280); ++ val |= ((para->dram_tpr10 >> 12) << 8) & 0x0f00; ++ writel(0x3103280, val); ++} ++ ++ ++// Not used ?? ++// ++void bit_delay_compensation(void) ++{ ++ const unsigned int data0[44] = { ++ 0, 1, 2, 3, 2, 3, 3, 3, 0, 0, 0, ++ 6, 6, 6, 5, 5, 5, 5, 5, 0, 0, 0, ++ 0, 2, 4, 2, 6, 5, 5, 5, 0, 0, 0, ++ 3, 3, 3, 2, 2, 1, 1, 1, 0, 0, 0, ++ }; ++ const unsigned int data1[44] = { ++ 0, 1, 3, 3, 3, 3, 3, 4, 3, 3, 3, ++ 3, 3, 4, 4, 3, 3, 3, 3, 3, 3, 3, ++ 0, 3, 3, 1, 6, 6, 5, 6, 3, 3, 3, ++ 5, 5, 6, 6, 4, 5, 3, 3, 3, 3, 3, ++ }; ++ ++ unsigned int *start = (unsigned int *)0x3102310; // DATX0IOCR ++ unsigned int *end = (unsigned int *)0x3102510; // DATX0IOCR x + 4 * size ++ unsigned int *datxiocr; ++ unsigned int i, j, k, rval; ++ ++ rval = readl(0x3102100) & 0x03ffffff; ++ writel(0x3102100, rval); ++ ++ // Fill DATX0IOCR - DATX3IOCR, 11 registers per block, blocks 0x20 words apart ++ for(i = 0, datxiocr = start; datxiocr != end; i += 11, datxiocr += 0x20) { ++ for(j = 0, k = i; j != 11; j++, k++) { ++ rval = readl((unsigned int)datxiocr[j]); ++ rval += data1[k] << 8; ++ rval += data0[k]; ++ writel((unsigned int)datxiocr[j], rval); ++ } ++ } ++ ++ rval = readl(0x3102100) | 0x04000000; ++ writel(0x3102100, rval); ++} ++ ++// Not used ?? ++// ++void set_master_priority_pad(struct dram_para_t *para) ++{ ++ unsigned int val; ++ ++ val = readl(0x310200c) & 0xfffff000; ++ val |= (para->dram_clk >> 1) - 1; ++ writel(0x310200c, val); ++ ++ writel(0x3102200, 0x00001000); ++ writel(0x3102210, 0x01000009); ++ writel(0x3102214, 0x00500100); ++ writel(0x3102230, 0x0200000d); ++ writel(0x3102234, 0x00600100); ++ writel(0x3102240, 0x01000009); ++ writel(0x3102244, 0x00500100); ++ writel(0x3102260, 0x00640209); ++ writel(0x3102264, 0x00200040); ++ writel(0x3102290, 0x01000009); ++ writel(0x3102294, 0x00400080); ++ writel(0x3102470, 0); ++ writel(0x3102474, 0); ++ ++ writel(0x31031c0, 0x0f802f05); ++ writel(0x31031c8, 0x0f0000ff); ++ writel(0x31031d0, 0x3f00005f); ++} ++ ++int auto_cal_timing(unsigned int time, unsigned int freq) ++{ ++ unsigned int t = time*freq; ++ return t/1000 + ( ((t%1000) != 0) ? 1 : 0); ++} ++ ++// Main purpose of the auto_set_timing routine seems to be to calculate all ++// timing settings for the specific type of sdram used. Read together with ++// an sdram datasheet for context on the various variables. ++// ++void auto_set_timing_para(struct dram_para_t *para) // s5 ++{ ++ unsigned int freq; // s4 ++ unsigned int type; // s8 ++ unsigned int tpr13; // 80(sp) ++ unsigned int reg_val; ++ ++ unsigned char tccd; // 88(sp) ++ unsigned char trrd; // s7 ++ unsigned char trcd; // s3 ++ unsigned char trc; // s9 ++ unsigned char tfaw; // s10 ++ unsigned char tras; // s11 ++ unsigned char trp; // 0(sp) ++ unsigned char twtr; // s1 ++ unsigned char twr; // s6 ++ unsigned char trtp; // 64(sp) ++ unsigned char txp; // a6 ++ unsigned short trefi; // s2 ++ unsigned short trfc; // a5 / 8(sp) ++ ++ freq = para->dram_clk; ++ type = para->dram_type; ++ tpr13 = para->dram_tpr13; ++ ++ //printf("type = %d\n", type); ++ //printf("tpr13 = %p\n", tpr13); ++ ++ if (para->dram_tpr13 & 0x2) ++ { ++ //dram_tpr0 ++ tccd = ( (para->dram_tpr0 >> 21) & 0x7 ); // [23:21] ++ tfaw = ( (para->dram_tpr0 >> 15) & 0x3f ); // [20:15] ++ trrd = ( (para->dram_tpr0 >> 11) & 0xf ); // [14:11] ++ trcd = ( (para->dram_tpr0 >> 6) & 0x1f ); // [10:6 ] ++ trc = ( (para->dram_tpr0 >> 0) & 0x3f ); // [ 5:0 ] ++ //dram_tpr1 ++ txp = ( (para->dram_tpr1 >> 23) & 0x1f ); // [27:23] ++ twtr = ( (para->dram_tpr1 >> 20) & 0x7 ); // [22:20] ++ trtp = ( (para->dram_tpr1 >> 15) & 0x1f ); // [19:15] ++ twr = ( (para->dram_tpr1 >> 11) & 0xf ); // [14:11] ++ trp = ( (para->dram_tpr1 >> 6) & 0x1f ); // [10:6 ] ++ tras = ( (para->dram_tpr1 >> 0) & 0x3f ); // [ 5:0 ] ++ //dram_tpr2 ++ trfc = ( (para->dram_tpr2 >> 12)& 0x1ff); // [20:12] ++ trefi = ( (para->dram_tpr2 >> 0) & 0xfff); // [11:0 ] ++ } ++ else { ++ unsigned int frq2 = freq >> 1; // s0 ++ ++ if (type == 3) { ++ // DDR3 ++ trfc = auto_cal_timing( 350, frq2); ++ trefi = auto_cal_timing(7800, frq2) / 32 + 1; // XXX ++ twr = auto_cal_timing( 8, frq2); ++ trcd = auto_cal_timing( 15, frq2); ++ twtr = twr + 2; // + 2 ? XXX ++ if (twr < 2) twtr = 2; ++ twr = trcd; ++ if (trcd < 2) twr = 2; ++ if (freq <= 800) { ++ tfaw = auto_cal_timing(50, frq2); ++ trrd = auto_cal_timing(10, frq2); ++ if (trrd < 2) trrd = 2; ++ trc = auto_cal_timing(53, frq2); ++ tras = auto_cal_timing(38, frq2); ++ txp = trrd; // 10 ++ trp = trcd; // 15 ++ } ++ else { ++ tfaw = auto_cal_timing(35, frq2); ++ trrd = auto_cal_timing(10, frq2); ++ if (trrd < 2) trrd = 2; ++ trcd = auto_cal_timing(14, frq2); ++ trc = auto_cal_timing(48, frq2); ++ tras = auto_cal_timing(34, frq2); ++ txp = trrd; // 10 ++ trp = trcd; // 14 ++ } ++ } ++ else if (type == 2) { ++ // DDR2 ++ tfaw = auto_cal_timing( 50, frq2); ++ trrd = auto_cal_timing( 10, frq2); ++ trcd = auto_cal_timing( 20, frq2); ++ trc = auto_cal_timing( 65, frq2); ++ twtr = auto_cal_timing( 8, frq2); ++ trp = auto_cal_timing( 15, frq2); ++ tras = auto_cal_timing( 45, frq2); ++ trefi = auto_cal_timing(7800, frq2) / 32; ++ trfc = auto_cal_timing( 328, frq2); ++ txp = 2; ++ twr = trp; // 15 ++ } ++ else if (type == 6) { ++ // LPDDR2 ++ tfaw = auto_cal_timing( 50, frq2); ++ if (tfaw < 4) tfaw = 4; ++ trrd = auto_cal_timing( 10, frq2); ++ if (trrd == 0) trrd = 1; ++ trcd = auto_cal_timing( 24, frq2); ++ if (trcd < 2) trcd = 2; ++ trc = auto_cal_timing( 70, frq2); ++ txp = auto_cal_timing( 8, frq2); ++ if (txp == 0) { ++ txp = 1; ++ twtr = 2; ++ } ++ else { ++ twtr = txp; ++ if (txp < 2) { ++ txp = 2; ++ twtr = 2; ++ } ++ } ++ twr = auto_cal_timing( 15, frq2); ++ if (twr < 2) twr = 2; ++ trp = auto_cal_timing( 17, frq2); ++ tras = auto_cal_timing( 42, frq2); ++ trefi = auto_cal_timing(3900, frq2) / 32; ++ trfc = auto_cal_timing( 210, frq2); ++ } ++ else if (type == 7) { ++ // LPDDR3 ++ tfaw = auto_cal_timing( 50, frq2); ++ if (tfaw < 4) tfaw = 4; ++ trrd = auto_cal_timing( 10, frq2); ++ if (trrd == 0) trrd = 1; ++ trcd = auto_cal_timing( 24, frq2); ++ if (trcd < 2) trcd = 2; ++ trc = auto_cal_timing( 70, frq2); ++ twtr = auto_cal_timing( 8, frq2); ++ if (twtr < 2) twtr = 2; ++ twr = auto_cal_timing( 15, frq2); ++ if (twr < 2) twr = 2; ++ trp = auto_cal_timing( 17, frq2); ++ tras = auto_cal_timing( 42, frq2); ++ trefi = auto_cal_timing(3900, frq2) / 32; ++ trfc = auto_cal_timing( 210, frq2); ++ txp = twtr; ++ } ++ else { ++ // default ++ trfc = 128; ++ trp = 6; ++ trefi = 98; ++ txp = 10; ++ twr = 8; ++ twtr = 3; ++ tras = 14; ++ tfaw = 16; ++ trc = 20; ++ trcd = 6; ++ trrd = 3; ++ } ++ //assign the value back to the DRAM structure ++ tccd = 2; ++ trtp = 4; // not in .S ? ++ para->dram_tpr0 = (trc<<0) | (trcd<<6) | (trrd<<11) | (tfaw<<15) | (tccd<<21); ++ para->dram_tpr1 = (tras<<0) | (trp<<6) | (twr<<11) | (trtp<<15) | (twtr<<20) | (txp<<23); ++ para->dram_tpr2 = (trefi<<0) | (trfc<<12); ++ } ++ ++ unsigned int tcksrx; // t1 ++ unsigned int tckesr; // t4; ++ unsigned int trd2wr; // t6 ++ unsigned int trasmax; // t3; ++ unsigned int twtp; // s6 (was twr!) ++ unsigned int tcke; // s8 ++ unsigned int tmod; // t0 ++ unsigned int tmrd; // t5 ++ unsigned int tmrw; // a1 ++ unsigned int t_rdata_en;// a4 (was tcwl!) ++ unsigned int tcl; // a0 ++ unsigned int wr_latency;// a7 ++ unsigned int tcwl; // first a4, then a5 ++ unsigned int mr3; // s0 ++ unsigned int mr2; // t2 ++ unsigned int mr1; // s1 ++ unsigned int mr0; // a3 ++ unsigned int dmr3; // 72(sp) ++ //unsigned int trtp; // 64(sp) ++ unsigned int dmr1; // 56(sp) ++ unsigned int twr2rd; // 48(sp) ++ unsigned int tdinit3; // 40(sp) ++ unsigned int tdinit2; // 32(sp) ++ unsigned int tdinit1; // 24(sp) ++ unsigned int tdinit0; // 16(sp) ++ ++ dmr1 = para->dram_mr1; ++ dmr3 = para->dram_mr3; ++ ++ switch (type) { ++ ++ case 2: // DDR2 ++ { ++ trasmax = freq / 30; ++ if (freq < 409) { ++ tcl = 3; ++ t_rdata_en = 1; ++ mr0 = 0x06a3; ++ } ++ else { ++ t_rdata_en = 2; ++ tcl = 4; ++ mr0 = 0x0e73; ++ } ++ tmrd = 2; ++ twtp = twr + 5; ++ tcksrx = 5; ++ tckesr = 4; ++ trd2wr = 4; ++ tcke = 3; ++ tmod = 12; ++ wr_latency = 1; ++ mr3 = 0; ++ mr2 = 0; ++ tdinit0 = 200*freq + 1; ++ tdinit1 = 100*freq / 1000 + 1; ++ tdinit2 = 200*freq + 1; ++ tdinit3 = 1*freq + 1; ++ tmrw = 0; ++ twr2rd = twtr + 5; ++ tcwl = 0; ++ mr1 = dmr1; ++ break; ++ } ++ ++ case 3: // DDR3 ++ { ++ trasmax = freq / 30; ++ if (freq <= 800) { ++ mr0 = 0x1c70; ++ tcl = 6; ++ wr_latency = 2; ++ tcwl = 4; ++ mr2 = 24; ++ } ++ else { ++ mr0 = 0x1e14; ++ tcl = 7; ++ wr_latency = 3; ++ tcwl = 5; ++ mr2 = 32; ++ } ++ ++ twtp = tcwl + 2 + twtr; // WL+BL/2+tWTR ++ trd2wr = tcwl + 2 + twr; // WL+BL/2+tWR ++ twr2rd = tcwl + twtr; // WL+tWTR ++ ++ tdinit0 = 500*freq + 1; // 500 us ++ tdinit1 = 360*freq / 1000 + 1; // 360 ns ++ tdinit2 = 200*freq + 1; // 200 us ++ tdinit3 = 1*freq + 1; // 1 us ++ ++ if (((tpr13>>2) & 0x03) == 0x01 || freq < 912) { ++ mr1 = dmr1; ++ t_rdata_en = tcwl; // a5 <- a4 ++ tcksrx = 5; ++ tckesr = 4; ++ trd2wr = 5; ++ } ++ else { ++ mr1 = dmr1; ++ t_rdata_en = tcwl; // a5 <- a4 ++ tcksrx = 5; ++ tckesr = 4; ++ trd2wr = 6; ++ } ++ tcke = 3; // not in .S ? ++ tmod = 12; ++ tmrd = 4; ++ tmrw = 0; ++ mr3 = 0; ++ break; ++ } ++ ++ case 6: // LPDDR2 ++ { ++ trasmax = freq / 60; ++ mr3 = dmr3; ++ twtp = twr + 5; ++ mr2 = 6; ++ mr1 = 5; ++ tcksrx = 5; ++ tckesr = 5; ++ trd2wr = 10; ++ tcke = 2; ++ tmod = 5; ++ tmrd = 5; ++ tmrw = 3; ++ tcl = 4; ++ wr_latency = 1; ++ t_rdata_en = 1; ++ tdinit0 = 200*freq + 1; ++ tdinit1 = 100*freq / 1000 + 1; ++ tdinit2 = 11*freq + 1; ++ tdinit3 = 1*freq + 1; ++ twr2rd = twtr + 5; ++ tcwl = 2; ++ mr1 = 195; ++ mr0 = 0; ++ break; ++ } ++ ++ case 7: // LPDDR3 ++ { ++ trasmax = freq / 60; ++ if (freq < 800) { ++ tcwl = 4; ++ wr_latency = 3; ++ t_rdata_en = 6; ++ mr2 = 12; ++ } ++ else { ++ tcwl = 3; ++ tcke = 6; ++ wr_latency = 2; ++ t_rdata_en = 5; ++ mr2 = 10; ++ } ++ twtp = tcwl + 5; ++ tcl = 7; ++ mr3 = dmr3; ++ tcksrx = 5; ++ tckesr = 5; ++ trd2wr = 13; ++ tcke = 3; ++ tmod = 12; ++ tdinit0 = 400*freq + 1; ++ tdinit1 = 500*freq / 1000 + 1; ++ tdinit2 = 11*freq + 1; ++ tdinit3 = 1*freq + 1; ++ tmrd = 5; ++ tmrw = 5; ++ twr2rd = tcwl + twtr + 5; ++ mr1 = 195; ++ mr0 = 0; ++ break; ++ } ++ ++ default: ++ twr2rd = 8; // 48(sp) ++ tcksrx = 4; // t1 ++ tckesr = 3; // t4 ++ trd2wr = 4; // t6 ++ trasmax = 27; // t3 ++ twtp = 12; // s6 ++ tcke = 2; // s8 ++ tmod = 6; // t0 ++ tmrd = 2; // t5 ++ tmrw = 0; // a1 ++ tcwl = 3; // a5 ++ tcl = 3; // a0 ++ wr_latency = 1; // a7 ++ t_rdata_en = 1; // a4 ++ mr3 = 0; // s0 ++ mr2 = 0; // t2 ++ mr1 = 0; // s1 ++ mr0 = 0; // a3 ++ tdinit3 = 0; // 40(sp) ++ tdinit2 = 0; // 32(sp) ++ tdinit1 = 0; // 24(sp) ++ tdinit0 = 0; // 16(sp) ++ break; ++ } ++ if (trtp < tcl - trp + 2) { ++ trtp = tcl - trp + 2; ++ } ++ trtp = 4; ++ ++ // Update mode block when permitted ++ if ((para->dram_mr0 & 0xffff0000) == 0) para->dram_mr0 = mr0; ++ if ((para->dram_mr1 & 0xffff0000) == 0) para->dram_mr1 = mr1; ++ if ((para->dram_mr2 & 0xffff0000) == 0) para->dram_mr2 = mr2; ++ if ((para->dram_mr3 & 0xffff0000) == 0) para->dram_mr3 = mr3; ++ ++ // Set mode registers ++ writel(0x3103030, para->dram_mr0); ++ writel(0x3103034, para->dram_mr1); ++ writel(0x3103038, para->dram_mr2); ++ writel(0x310303c, para->dram_mr3); ++ writel(0x310302c, (para->dram_odt_en >> 4) & 0x3); // ?? ++ ++ // Set dram timing DRAMTMG0 - DRAMTMG5 ++ reg_val= (twtp<<24) | (tfaw<<16) | (trasmax<<8) | (tras<<0); ++ writel(0x3103058, reg_val); ++ reg_val= (txp<<16) | (trtp<<8) | (trc<<0); ++ writel(0x310305c, reg_val); ++ reg_val= (tcwl<<24) | (tcl<<16) | (trd2wr<<8) | (twr2rd<<0); ++ writel(0x3103060, reg_val); ++ reg_val= (tmrw<<16) | (tmrd<<12) | (tmod<<0); ++ writel(0x3103064, reg_val); ++ reg_val= (trcd<<24) | (tccd<<16) | (trrd<<8) | (trp<<0); ++ writel(0x3103068, reg_val); ++ reg_val= (tcksrx<<24) | (tcksrx<<16) | (tckesr<<8) | (tcke<<0); ++ writel(0x310306c, reg_val); ++ ++ // Set two rank timing ++ reg_val = readl(0x3103078); ++ reg_val &= 0x0fff0000; ++ reg_val |= (para->dram_clk < 800) ? 0xf0006600 : 0xf0007600; ++ reg_val |= 0x10; ++ writel(0x3103078, reg_val); ++ ++ // Set phy interface time PITMG0, PTR3, PTR4 ++ reg_val = (0x2<<24) | (t_rdata_en<<16) | (0x1<<8) | (wr_latency<<0); ++ writel(0x3103080, reg_val); ++ writel(0x3103050, ((tdinit0<<0)|(tdinit1<<20))); ++ writel(0x3103054, ((tdinit2<<0)|(tdinit3<<20))); ++ ++ // Set refresh timing and mode ++ reg_val = (trefi<<16) | (trfc<<0); ++ writel(0x3103090, reg_val); ++ reg_val = 0x0fff0000 & (trefi<<15); ++ writel(0x3103094, reg_val); ++} ++ ++// Not used ? ++// ++void ccm_get_sscg(void) ++{ ++ // NOTE: function is present in the assembly, but was not translated. ++} ++ ++// Not used ? ++// ++void ccm_set_pll_sscg(void) ++{ ++ // NOTE: function is present in the assembly, but was not translated. ++} ++ ++// Purpose of this routine seems to be to initialize the PLL driving ++// the MBUS and sdram. ++// ++int ccm_set_pll_ddr_clk(int index, struct dram_para_t *para) ++{ ++ unsigned int val, clk, n; ++ ++ clk = (para->dram_tpr13 & (1 << 6)) ? para->dram_tpr9 ++ : para->dram_clk; ++ ++ // set VCO clock divider ++ n = (clk * 2) / 24; ++ val = readl(0x2001010); ++ val &= 0xfff800fc; // clear dividers ++ val |= (n - 1) << 8; // set PLL division ++ val |= 0xc0000000; // enable PLL and LDO ++ writel(0x2001010, val); ++ ++ // Restart PLL locking ++ val &= 0xdfffffff; // disbable lock ++ val |= 0xc0000000; // enable PLL and LDO ++ writel(0x2001010, val); ++ val |= 0xe0000000; // re-enable lock ++ writel(0x2001010, val); ++ ++ // wait for PLL to lock ++ while ((readl(0x2001010) & 0x10000000) == 0) {;} ++ ++ udelay(20); ++ ++ // enable PLL output ++ val = readl(0x2001000); ++ val |= 0x08000000; ++ writel(0x2001000, val); ++ ++ // turn clock gate on ++ val = readl(0x2001800); ++ val &= 0xfcfffcfc; // select DDR clk source, n=1, m=1 ++ val |= 0x80000000; // turn clock on ++ writel(0x2001800, val); ++ ++ return n * 24; ++} ++ ++// Main purpose of sys_init seems to be to initalise the clocks for ++// the sdram controller. ++// ++void mctl_sys_init(struct dram_para_t *para) ++{ ++ unsigned int val; ++ ++ // s1 = 0x02001000 ++ ++ // assert MBUS reset ++ val = readl(0x2001540); ++ val &= 0xbfffffff; ++ writel(0x2001540, val); ++ ++ // turn off sdram clock gate, assert sdram reset ++ val = readl(0x200180c); ++ val &= 0xfffffffe; ++ writel(0x200180c, val); ++ val &= 0xfffefffe; ++ writel(0x200180c, val); ++ ++ // turn of bit 30 [??] ++ val = readl(0x2001800); ++ writel(0x2001800, val & 0xbfffffff); ++ // and toggle dram clock gating off + trigger update ++ val &= 0x7fffffff; ++ writel(0x2001800, val); ++ val |= 0x08000000; ++ writel(0x2001800, val); ++ udelay(10); ++ ++ // set ddr pll clock ++ val = ccm_set_pll_ddr_clk(0, para); ++ para->dram_clk = val >> 1; ++ udelay(100); ++ dram_disable_all_master(); ++ ++ // release sdram reset ++ val = readl(0x200180c); ++ val |= 0x00010000; ++ writel(0x200180c, val); ++ ++ // release MBUS reset ++ val = readl(0x2001540); ++ val |= 0x40000000; ++ writel(0x2001540, val); ++ ++ // turn bit 30 back on [?] ++ val = readl(0x2001800); ++ val |= 0x40000000; ++ writel(0x2001800, val); ++ udelay(5); ++ ++ // turn on sdram clock gate ++ val = readl(0x200180c); ++ val |= 0x0000001; // (1<<0) ++ writel(0x200180c, val); ++ ++ // turn dram clock gate on, trigger sdr clock update ++ val = readl(0x2001800); ++ val |= 0x80000000; ++ writel(0x2001800, val); ++ val |= 0x88000000; ++ writel(0x2001800, val); ++ udelay(5); ++ ++ // mCTL clock enable ++ writel(0x310300c, 0x00008000); ++ udelay(10); ++} ++ ++// The main purpose of this routine seems to be to copy an address configuration ++// from the dram_para1 and dram_para2 fields to the PHY configuration registers ++// (0x3102000, 0x3102004). ++// ++void mctl_com_init(struct dram_para_t *para) ++{ ++ unsigned int val, end, ptr; ++ int i; ++ ++ // purpose ?? ++ val = readl(0x3102008) & 0xffffc0ff; ++ val |= 0x2000; ++ writel(0x3102008, val); ++ ++ // Set sdram type and word width ++ val = readl(0x3102000) & 0xff000fff; ++ val |= (para->dram_type &0x7) << 16; // DRAM type ++ val |= (~para->dram_para2 & 0x1) << 12; // DQ width ++ if((para->dram_type) != 6 && (para->dram_type) != 7) { ++ val |= ((para->dram_tpr13 >> 5) & 0x1) << 19; // 2T or 1T ++ val |= 0x400000; ++ } ++ else { ++ val |= 0x480000; // type 6 and 7 must use 1T ++ } ++ writel(0x3102000, val); ++ ++ // init rank / bank / row for single/dual or two different ranks ++ val = para->dram_para2; ++ end = ((val & 0x100) && (((val >> 12) & 0xf) != 1)) ? 32 : 16; ++ ptr = 0x3102000; ++ ++ for (i = 0 ; i != end; i += 16) { ++ ++ val = readl(ptr) & 0xfffff000; ++ ++ val |= (para->dram_para2 >> 12) & 0x3; // rank ++ val |= ((para->dram_para1 >> (i + 12)) << 2) & 0x4; // bank - 2 ++ val |= (((para->dram_para1 >> (i + 4)) - 1) << 4) & 0xff; // row - 1 ++ ++ // convert from page size to column addr width - 3 ++ switch ((para->dram_para1 >> i) & 0xf) { ++ case 8: val |= 0xa00; break; ++ case 4: val |= 0x900; break; ++ case 2: val |= 0x800; break; ++ case 1: val |= 0x700; break; ++ default: val |= 0x600; break; ++ } ++ writel(ptr, val); ++ ptr += 4; ++ } ++ ++ // set ODTMAP based on number of ranks in use ++ val = (readl(0x3102000) & 0x1) ? 0x303 : 0x201; ++ writel(0x3103120, val); ++ ++ // set mctl reg 3c4 to zero when using half DQ ++ if (para->dram_para2 & (1 << 0)) { ++ writel(0x31033c4, 0); ++ } ++ ++ // purpose ?? ++ if (para->dram_tpr4) { ++ val = readl(0x3102000); ++ val |= (para->dram_tpr4 << 25) & 0x06000000; ++ writel(0x3102000, val); ++ ++ val = readl(0x3102004); ++ val |= ((para->dram_tpr4 >> 2) << 12) & 0x001ff000; ++ writel(0x3102004, val); ++ } ++} ++ ++// This routine seems to have several remapping tables for 22 lines. ++// It is unclear which lines are being remapped. It seems to pick ++// table cfg7 for the Nezha board. ++// ++void mctl_phy_ac_remapping(struct dram_para_t *para) ++{ ++ char cfg0[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; ++ static char cfg1[] = { 1, 9, 3, 7, 8, 18, 4, 13, 5, 6, 10, ++ 2, 14, 12, 0, 0, 21, 17, 20, 19, 11, 22 }; ++ static char cfg2[] = { 4, 9, 3, 7, 8, 18, 1, 13, 2, 6, 10, ++ 5, 14, 12, 0, 0, 21, 17, 20, 19, 11, 22 }; ++ static char cfg3[] = { 1, 7, 8, 12, 10, 18, 4, 13, 5, 6, 3, ++ 2, 9, 0, 0, 0, 21, 17, 20, 19, 11, 22 }; ++ static char cfg4[] = { 4, 12, 10, 7, 8, 18, 1, 13, 2, 6, 3, ++ 5, 9, 0, 0, 0, 21, 17, 20, 19, 11, 22 }; ++ static char cfg5[] = { 13, 2, 7, 9, 12, 19, 5, 1, 6, 3, 4, ++ 8, 10, 0, 0, 0, 21, 22, 18, 17, 11, 20 }; ++ static char cfg6[] = { 3, 10, 7, 13, 9, 11, 1, 2, 4, 6, 8, ++ 5, 12, 0, 0, 0, 20, 1, 0, 21, 22, 17 }; ++ static char cfg7[] = { 3, 2, 4, 7, 9, 1, 17, 12, 18, 14, 13, ++ 8, 15, 6, 10, 5, 19, 22, 16, 21, 20, 11 }; ++ ++ unsigned int fuse, val; ++ ++ // read SID info @ 0x228 ++ fuse = (readl(0x3002228) >> 8) & 0x4; ++ printf("ddr_efuse_type: 0x%x\n", fuse); ++ ++ if ((para->dram_tpr13 >> 18) & 0x3) { ++ memcpy_self(cfg0, cfg7, 22); ++ } ++ else { ++ switch (fuse) { ++ case 8: memcpy_self(cfg0, cfg2, 22); break; ++ case 9: memcpy_self(cfg0, cfg3, 22); break; ++ case 10: memcpy_self(cfg0, cfg5, 22); break; ++ case 11: memcpy_self(cfg0, cfg4, 22); break; ++ default: ++ case 12: memcpy_self(cfg0, cfg1, 22); break; ++ case 13: ++ case 14: break; ++ } ++ } ++ if (para->dram_type == 2) { ++ if (fuse == 15) return; ++ memcpy_self(cfg0, cfg6, 22); ++ } ++ if ( para->dram_type == 2 || para->dram_type == 3) { ++ ++ val = (cfg0[ 4] << 25) | (cfg0[ 3] << 20) | (cfg0[ 2] << 15) | ++ (cfg0[ 1] << 10) | (cfg0[ 0] << 5); ++ writel(0x3102500, val); ++ ++ val = (cfg0[10] << 25) | (cfg0[ 9] << 20) | (cfg0[ 8] << 15) | ++ (cfg0[ 7] << 10) | (cfg0[ 6] << 5) | cfg0[ 5]; ++ writel(0x3102504, val); ++ ++ val = (cfg0[15] << 20) | (cfg0[14] << 15) | ++ (cfg0[13] << 10) | (cfg0[12] << 5) | cfg0[11]; ++ writel(0x3102508, val); ++ ++ val = (cfg0[21] << 25) | (cfg0[20] << 20) | (cfg0[19] << 15) | ++ (cfg0[18] << 10) | (cfg0[17] << 5) | cfg0[16]; ++ writel(0x310250c, val); ++ ++ val = (cfg0[ 4] << 25) | (cfg0 [3] << 20) | (cfg0[2] << 15) | ++ (cfg0[ 1] << 10) | (cfg0 [0] << 5) | 1; ++ writel(0x3102500, val); ++ } ++} ++ ++// Init the controller channel. The key part is placing commands in the main ++// command register (PIR, 0x3103000) and checking command status (PGSR0, 0x3103010). ++// ++unsigned int mctl_channel_init(unsigned int ch_index, struct dram_para_t *para) ++{ ++ unsigned int val, dqs_gating_mode; ++ ++ dqs_gating_mode = (para->dram_tpr13 >> 2) & 0x3; ++ ++ // set DDR clock to half of CPU clock ++ val = readl(0x310200c) & 0xfffff000; ++ val |= (para->dram_clk >> 1 ) - 1; ++ writel(0x310200c, val); ++ ++ // MRCTRL0 nibble 3 undocumented ++ val = readl(0x3103108) & 0xfffff0ff; ++ val |= 0x300; ++ writel(0x3103108, val); ++ ++ // DX0GCR0 ++ val = readl(0x3103344) & 0xffffffcf; ++ val |= ((~para->dram_odt_en) << 5) & 0x20; ++ if (para->dram_clk > 672) { ++ val &= 0xffff09f1; ++ val |= 0x00000400; ++ } ++ else { ++ val &= 0xffff0ff1; ++ } ++ writel(0x3103344, val); ++ ++ // DX1GCR0 ++ val = readl(0x31033c4) & 0xffffffcf; ++ val |= ((~para->dram_odt_en) << 5) & 0x20; ++ if (para->dram_clk > 672) { ++ val &= 0xffff09f1; ++ val |= 0x00000400; ++ } ++ else { ++ val &= 0xffff0ff1; ++ } ++ writel(0x31033c4, val); ++ ++ // 0x3103208 undocumented ++ val = readl(0x3103208); ++ val |= 0x2; ++ writel(0x3103208, val); ++ ++ eye_delay_compensation(para); ++ ++ //set PLL SSCG ? ++ // ++ val = readl(0x3103108); ++ if (dqs_gating_mode == 1) { ++ ++ val &= ~(0xc0); ++ writel(0x3103108, val); ++ ++ val = readl(0x31030bc); ++ val &= 0xfffffef8; ++ writel(0x31030bc, val); ++ } ++ else if (dqs_gating_mode == 2) { ++ ++ val &= ~(0xc0); ++ val |= 0x80; ++ writel(0x3103108, val); ++ ++ val = readl(0x31030bc); ++ val &= 0xfffffef8; ++ val |= ((para->dram_tpr13 >> 16) & 0x1f) - 2; ++ val |= 0x100; ++ writel(0x31030bc, val); ++ ++ val = readl(0x310311c) & 0x7fffffff; ++ val |= 0x08000000; ++ writel(0x310311c, val); ++ } ++ else { ++ val &= ~(0x40); ++ writel(0x3103108, val); ++ ++ udelay(10); ++ ++ val = readl(0x3103108); ++ val |= 0xc0; ++ writel(0x3103108, val); ++ } ++ ++ if (para->dram_type == 6 || para->dram_type == 7) { ++ val = readl(0x310311c); ++ if (dqs_gating_mode == 1) { ++ val &= 0xf7ffff3f; ++ val |= 0x80000000; ++ } ++ else { ++ val &= 0x88ffffff; ++ val |= 0x22000000; ++ } ++ writel(0x310311c, val); ++ } ++ ++ val = readl(0x31030c0); ++ val &= 0xf0000000; ++ val |= (para->dram_para2 & (1 << 12)) ? 0x03000001 : 0x01000007; // 0x01003087 XXX ++ writel(0x31030c0, val); ++ ++ if (readl(0x70005d4) & (1 << 16)) { ++ val = readl(0x7010250); ++ val &= 0xfffffffd; ++ writel(0x7010250, val); ++ ++ udelay(10); ++ } ++ ++ // Set ZQ config ++ val = readl(0x3103140) & 0xfc000000; ++ val |= para->dram_zq & 0x00ffffff; ++ val |= 0x02000000; ++ writel(0x3103140, val); ++ ++ // Initialise DRAM controller ++ if (dqs_gating_mode == 1) { ++ writel(0x3103000, 0x52); // prep PHY reset + PLL init + z-cal ++ writel(0x3103000, 0x53); // Go ++ ++ while ((readl(0x3103010) & 0x1) == 0) {;} // wait for IDONE ++ udelay(10); ++ ++ // 0x520 = prep DQS gating + DRAM init + d-cal ++ val = (para->dram_type == 3) ? 0x5a0 // + DRAM reset ++ : 0x520; ++ } ++ else { ++ if ((readl(0x70005d4) & (1 << 16)) == 0) { ++ // prep DRAM init + PHY reset + d-cal + PLL init + z-cal ++ val = (para->dram_type == 3) ? 0x1f2 // + DRAM reset ++ : 0x172; ++ } ++ else { ++ // prep PHY reset + d-cal + z-cal ++ val = 0x62; ++ } ++ } ++ ++ writel(0x3103000, val); // Prep ++ val |= 1; ++ writel(0x3103000, val); // Go ++ ++ udelay(10); ++ while ((readl(0x3103010) & 0x1) == 0) {;} // wait for IDONE ++ ++ if (readl(0x70005d4) & (1 << 16)) { ++ ++ val = readl(0x310310c); ++ val &= 0xf9ffffff; ++ val |= 0x04000000; ++ writel(0x310310c, val); ++ ++ udelay(10); ++ ++ val = readl(0x3103004); ++ val |= 0x1; ++ writel(0x3103004, val); ++ ++ while ((readl(0x3103018) & 0x7) != 0x3) {;} ++ ++ val = readl(0x7010250); ++ val &= 0xfffffffe; ++ writel(0x7010250, val); ++ ++ udelay(10); ++ ++ val = readl(0x3103004); ++ val &= 0xfffffffe; ++ writel(0x3103004, val); ++ ++ while ((readl(0x3103018) & 0x7) != 0x1) {;} ++ ++ udelay(15); ++ ++ if (dqs_gating_mode == 1) { ++ ++ val = readl(0x3103108); ++ val &= 0xffffff3f; ++ writel(0x3103108, val); ++ ++ val = readl(0x310310c); ++ val &= 0xf9ffffff; ++ val |= 0x02000000; ++ writel(0x310310c, val); ++ ++ udelay(1); ++ writel(0x3103000, 0x401); ++ ++ while ((readl(0x3103010) & 0x1) == 0) {;} ++ } ++ } ++ ++ // Check for training error ++ val = readl(0x3103010); ++ if (((val >> 20) & 0xff) && (val & 0x100000)) { ++ printf("ZQ calibration error, check external 240 ohm resistor.\n"); ++ return 0; ++ } ++ ++ // STATR = Zynq STAT? Wait for status 'normal'? ++ while ((readl(0x3103018) & 0x1) == 0) {;} ++ ++ val = readl(0x310308c); ++ val |= 0x80000000; ++ writel(0x310308c, val); ++ ++ udelay(10); ++ ++ val = readl(0x310308c); ++ val &= 0x7fffffff; ++ writel(0x310308c, val); ++ ++ udelay(10); ++ ++ val = readl(0x3102014); ++ val |= 0x80000000; ++ writel(0x3102014, val); ++ ++ udelay(10); ++ ++ val = readl(0x310310c); ++ val &= 0xf9ffffff; ++ writel(0x310310c, val); ++ ++ if (dqs_gating_mode == 1) { ++ val = readl(0x310311c); ++ val &= 0xffffff3f; ++ val |= 0x00000040; ++ writel(0x310311c, val); ++ } ++ return 1; ++} ++ ++// The below routine reads the dram config registers and extracts ++// the number of address bits in each rank available. It then calculates ++// total memory size in MB. ++// ++int DRAMC_get_dram_size(void) ++{ ++ unsigned int rval, temp, size0, size1; ++ ++ rval = readl(0x3102000); // MC_WORK_MODE0 ++ ++ temp = (rval>>8) & 0xf; // page size - 3 ++ temp += (rval>>4) & 0xf; // row width - 1 ++ temp += (rval>>2) & 0x3; // bank count - 2 ++ temp -= 14; // 1MB = 20 bits, minus above 6 = 14 ++ size0 = 1 << temp; ++ ++ temp = rval & 0x3; // rank count = 0? -> done ++ if (temp == 0) { ++ return size0; ++ } ++ ++ rval = readl(0x3102004); // MC_WORK_MODE1 ++ ++ temp = rval & 0x3; ++ if (temp == 0) { // two identical ranks ++ return 2 * size0; ++ } ++ ++ temp = (rval>>8) & 0xf; // page size - 3 ++ temp += (rval>>4) & 0xf; // row width - 1 ++ temp += (rval>>2) & 0x3; // bank number - 2 ++ temp -= 14; // 1MB = 20 bits, minus above 6 = 14 ++ size1 = 1 << temp; ++ ++ return size0 + size1; // add size of each rank ++} ++ ++// The below routine reads the command status register to extract ++// DQ width and rank count. This follows the DQS training command in ++// channel_init. If error bit 22 is reset, we have two ranks and full DQ. ++// If there was an error, figure out whether it was half DQ, single rank, ++// or both. Set bit 12 and 0 in dram_para2 with the results. ++// ++int dqs_gate_detect(struct dram_para_t *para) ++{ ++ unsigned int rval, dx0, dx1; ++ ++ if (readl(0x3103010) & (1 << 22)) { ++ ++ dx0 = (readl(0x3103348) >> 24) & 0x3; ++ dx1 = (readl(0x31033c8) >> 24) & 0x3; ++ ++ if (dx0 == 2) { ++ rval = para->dram_para2; ++ rval &= 0xffff0ff0; ++ if (dx0 != dx1) { ++ rval |= 0x1; ++ para->dram_para2 = rval; ++ printf("[AUTO DEBUG] single rank and half DQ!\n"); ++ return 1; ++ } ++ para->dram_para2 = rval; ++ printf("[AUTO DEBUG] single rank and full DQ!\n"); ++ return 1; ++ } ++ else if (dx0 == 0) { ++ rval = para->dram_para2; ++ rval &= 0xfffffff0; ++ rval |= 0x00001001; ++ para->dram_para2 = rval; ++ printf("[AUTO DEBUG] dual rank and half DQ!\n"); ++ return 1; ++ } ++ else { ++ if (para->dram_tpr13 & (1 << 29)) { ++ printf("DX0 state:%d\n", dx0); ++ printf("DX1 state:%d\n", dx1); ++ } ++ return 0; ++ } ++ } ++ else { ++ rval = para->dram_para2; ++ rval &= 0xfffffff0; ++ rval |= 0x00001000; ++ para->dram_para2 = rval; ++ printf("[AUTO DEBUG] two rank and full DQ!\n"); ++ return 1; ++ } ++} ++ ++ ++#define SDRAM_BASE ((unsigned int *)0x40000000) ++#define uint unsigned int ++ ++int dramc_simple_wr_test(uint mem_mb, int len) ++{ ++ unsigned int offs = (mem_mb >> 1) << 18; // half of memory size ++ unsigned int patt1 = 0x01234567; ++ unsigned int patt2 = 0xfedcba98; ++ unsigned int *addr, v1, v2, i; ++ ++ addr = SDRAM_BASE; ++ for (i = 0; i != len; i++, addr++) { ++ writel(addr, patt1 + i); ++ writel(addr + offs, patt2 + i); ++ } ++ ++ addr = SDRAM_BASE; ++ for (i = 0; i != len; i++) { ++ v1 = readl(addr+i); ++ v2 = patt1 + i; ++ if (v1 != v2) { ++ printf("DRAM simple test FAIL.\n"); ++ printf("%x != %x at address %p\n", v1, v2, addr+i); ++ return 1; ++ } ++ v1 = readl(addr+offs+i); ++ v2 = patt2 + i; ++ if (v1 != v2) { ++ printf("DRAM simple test FAIL.\n"); ++ printf("%x != %x at address %p\n", v1, v2, addr+offs+i); ++ return 1; ++ } ++ } ++ printf("DRAM simple test OK.\n"); ++ return 0; ++} ++ ++// Set the Vref mode for the controller ++// ++void mctl_vrefzq_init(struct dram_para_t *para) ++{ ++ unsigned int val; ++ ++ if ((para->dram_tpr13 & (1 << 17)) == 0) { ++ val = readl(0x3103110) & 0x80808080; // IOCVR0 ++ val |= para->dram_tpr5; ++ writel(0x3103110, val); ++ ++ if ((para->dram_tpr13 & (1 << 16)) == 0) { ++ val = readl(0x3103114) & 0xffffff80; // IOCVR1 ++ val |= para->dram_tpr6 & 0x7f; ++ writel(0x3103114, val); ++ } ++ } ++} ++ ++// Perform an init of the controller. This is actually done 3 times. The first ++// time to establish the number of ranks and DQ width. The second time to ++// establish the actual ram size. The third time is final one, with the final ++// settings. ++// ++int mctl_core_init(struct dram_para_t *para) ++{ ++ mctl_sys_init(para); ++ mctl_vrefzq_init(para); ++ mctl_com_init(para); ++ mctl_phy_ac_remapping(para); ++ auto_set_timing_para(para); ++ return mctl_channel_init(0, para); ++} ++ ++ ++#define RAM_BASE (0x40000000) ++ ++// Autoscan sizes a dram device by cycling through address lines and figuring ++// out if it is connected to a real address line, or if the address is a mirror. ++// First the column and bank bit allocations are set to low values (2 and 9 address ++// lines. Then a maximum allocation (16 lines) is set for rows and this is tested. ++// Next the BA2 line is checked. This seems to be placed above the column, BA0-1 and ++// row addresses. Finally, the column address is allocated 13 lines and these are ++// tested. The results are placed in dram_para1 and dram_para2. ++// ++int auto_scan_dram_size(struct dram_para_t *para) // s7 ++{ ++ unsigned int rval, i, j, rank, maxrank, offs, mc_work_mode; ++ unsigned int chk, ptr, shft, banks; ++ ++ if (mctl_core_init(para) == 0) { ++ printf("[ERROR DEBUG] DRAM initialisation error : 0!\n"); ++ return 0; ++ } ++ ++ maxrank = (para->dram_para2 & 0xf000) ? 2 : 1; ++ mc_work_mode = 0x3102000; ++ offs = 0; ++ ++ // write test pattern ++ for (i = 0, ptr = RAM_BASE; i < 64; i++, ptr += 4) { ++ writel(ptr, (i & 1) ? ptr : ~ptr); ++ } ++ ++ for (rank = 0; rank < maxrank; ) { ++ ++ // Set row mode ++ rval = readl(mc_work_mode); ++ rval &= 0xfffff0f3; ++ rval |= 0x000006f0; ++ writel(mc_work_mode, rval); ++ while (readl(mc_work_mode) != rval); ++ ++ // Scan per address line, until address wraps (i.e. see shadow) ++ for(i = 11; i < 17; i++) { ++ chk = RAM_BASE + (1 << (i + 11)); ++ ptr = RAM_BASE; ++ for (j = 0; j < 64; j++) { ++ if (readl(chk) != ((j & 1) ? ptr : ~ptr)) ++ goto out1; ++ ptr += 4; ++ chk += 4; ++ } ++ break; ++ out1: ; ++ } ++ if (i > 16) i = 16; ++ printf("[AUTO DEBUG] rank %d row = %d\n", rank, i); ++ ++ // Store rows in para 1 ++ shft = 4 + offs; ++ rval = para->dram_para1; ++ rval &= ~(0xff << shft); ++ rval |= i << shft; ++ para->dram_para1 = rval; ++ ++ if (rank == 1) { ++ // Set bank mode for rank0 ++ rval = readl(0x3102000); ++ rval &= 0xfffff003; ++ rval |= 0x000006a4; ++ writel(0x3102000, rval); ++ } ++ ++ // Set bank mode for current rank ++ rval = readl(mc_work_mode); ++ rval &= 0xfffff003; ++ rval |= 0x000006a4; ++ writel(mc_work_mode, rval); ++ while (readl(mc_work_mode) != rval); ++ ++ // Test if bit A23 is BA2 or mirror XXX A22? ++ chk = RAM_BASE + (1 << 22); ++ ptr = RAM_BASE; ++ for (i = 0, j = 0; i < 64; i++) { ++ if (readl(chk) != ((i & 1) ? ptr : ~ptr)) { ++ j = 1; ++ break; ++ } ++ ptr += 4; ++ chk += 4; ++ } ++ banks = (j + 1) << 2; // 4 or 8 ++ printf("[AUTO DEBUG] rank %d bank = %d\n", rank, banks); ++ ++ // Store banks in para 1 ++ shft = 12 + offs; ++ rval = para->dram_para1; ++ rval &= ~(0xf << shft); ++ rval |= j << shft; ++ para->dram_para1 = rval; ++ ++ if (rank == 1) { ++ // Set page mode for rank0 ++ rval = readl(0x3102000); ++ rval &= 0xfffff003; ++ rval |= 0x00000aa0; ++ writel(0x3102000, rval); ++ } ++ ++ // Set page mode for current rank ++ rval = readl(mc_work_mode); ++ rval &= 0xfffff003; ++ rval |= 0x00000aa0; ++ writel(mc_work_mode, rval); ++ while (readl(mc_work_mode) != rval); ++ ++ // Scan per address line, until address wraps (i.e. see shadow) ++ for(i = 9; i < 14; i++) { ++ chk = RAM_BASE + (1 << i); ++ ptr = RAM_BASE; ++ for (j = 0; j < 64; j++) { ++ if (readl(chk) != ((j & 1) ? ptr : ~ptr)) ++ goto out2; ++ ptr += 4; ++ chk += 4; ++ } ++ break; ++ out2:; ++ } ++ if (i > 13) i = 13; ++ int pgsize = (i==9) ? 0 : (1 << (i-10)); ++ printf("[AUTO DEBUG] rank %d page size = %d KB\n", rank, pgsize); ++ ++ // Store page size ++ shft = offs; ++ rval = para->dram_para1; ++ rval &= ~(0xf << shft); ++ rval |= pgsize << shft; ++ para->dram_para1 = rval; ++ ++ // Move to next rank ++ rank++; ++ if (rank != maxrank) { ++ if (rank == 1) { ++ rval = readl(0x3202000); // MC_WORK_MODE ++ rval &= 0xfffff003; ++ rval |= 0x000006f0; ++ writel(0x3202000, rval); ++ ++ rval = readl(0x3202004); // MC_WORK_MODE2 ++ rval &= 0xfffff003; ++ rval |= 0x000006f0; ++ writel(0x3202004, rval); ++ } ++ offs += 16; // store rank1 config in upper half of para1 ++ mc_work_mode += 4; // move to MC_WORK_MODE2 ++ } ++ } ++ if (maxrank == 2) { ++ para->dram_para2 &= 0xfffff0ff; ++ // note: rval is equal to para->dram_para1 here ++ if ((rval & 0xffff) == ((rval >> 16) & 0xffff)) { ++ printf("rank1 config same as rank0\n"); ++ } ++ else { ++ para->dram_para2 |= 0x00000100; ++ printf("rank1 config different from rank0\n"); ++ } ++ } ++ return 1; ++} ++ ++// This routine sets up parameters with dqs_gating_mode equal to 1 and two ++// ranks enabled. It then configures the core and tests for 1 or 2 ranks and ++// full or half DQ width. it then resets the parameters to the original values. ++// dram_para2 is updated with the rank & width findings. ++// ++int auto_scan_dram_rank_width(struct dram_para_t *para) ++{ ++ unsigned int s1 = para->dram_tpr13; ++ unsigned int s2 = para->dram_para1; ++ unsigned int v; ++ ++ para->dram_para1 = 0x00b000b0; ++ v = (para->dram_para2 & 0xfffffff0) | 0x1000; ++ para->dram_para2 = v; ++ ++ v = (s1 & 0xfffffff7) | 0x5; // set DQS probe mode ++ para->dram_tpr13 = v; ++ ++ mctl_core_init(para); ++ if (readl(0x3103010) & (1 << 20)) { ++ return 0; ++ } ++ if (dqs_gate_detect(para) == 0) { ++ return 0; ++ } ++ ++ para->dram_tpr13 = s1; ++ para->dram_para1 = s2; ++ return 1; ++} ++ ++// This routine determines the sdram topology. It first establishes the number ++// of ranks and the DQ width. Then it scans the sdram address lines to establish ++// the size of each rank. It then updates dram_tpr13 to reflect that the sizes ++// are now known: a re-init will not repeat the autoscan. ++// ++int auto_scan_dram_config(struct dram_para_t *para) ++{ ++ if (((para->dram_tpr13 & (1 << 14)) == 0) && ++ (auto_scan_dram_rank_width(para) == 0)) ++ { ++ printf("[ERROR DEBUG] auto scan dram rank & width failed !\n"); ++ return 0; ++ } ++ if (((para->dram_tpr13 & (1 << 0)) == 0) && ++ (auto_scan_dram_size(para) == 0 )) ++ { ++ printf("[ERROR DEBUG] auto scan dram size failed !\n"); ++ return 0; ++ } ++ if ((para->dram_tpr13 & (1 << 15)) == 0) { ++ para->dram_tpr13 |= 0x6003; ++ } ++ return 1; ++} ++ ++ ++signed int init_DRAM(int type, struct dram_para_t *para) // s0 ++{ ++ int rc, mem_size; ++ ++ // Test ZQ status ++ if (para->dram_tpr13 & (1 << 16)) { ++ printf("DRAM only have internal ZQ!!\n"); ++ writel(0x3000160, readl(0x3000160) | 0x100); ++ writel(0x3000168, 0); ++ udelay(10); ++ } ++ else { ++ writel(0x7010254, 0); ++ writel(0x3000160, readl(0x3000160) & ~0x003); ++ udelay(10); ++ writel(0x3000160, readl(0x3000160) & ~0x108); ++ udelay(10); ++ writel(0x3000160, readl(0x3000160) | 0x001); ++ udelay(20); ++ printf("ZQ value = 0x%x***********\n", readl(0x3000172)); ++ } ++ ++ // Set voltage ++ dram_vol_set(para); ++ ++ // Set SDRAM controller auto config ++ if ( (para->dram_tpr13 & 0x1)==0 ) { ++ if ( auto_scan_dram_config(para)==0 ) { ++ return 0; ++ } ++ } ++ ++ // Print header message (too late) ++ printf("DRAM BOOT DRIVE INFO: %s\n", "V0.24"); ++ printf("DRAM CLK = %d MHz\n", para->dram_clk); ++ printf("DRAM Type = %d (2:DDR2,3:DDR3)\n", para->dram_type); ++ if ( (para->dram_odt_en & 0x1) == 0 ) { ++ printf("DRAMC read ODT off.\n"); ++ } ++ else { ++ printf("DRAMC ZQ value: 0x%x\n", para->dram_zq); ++ } ++ ++ // report ODT ++ rc = para->dram_mr1; ++ if ( (rc & 0x44)==0 ) { ++ printf("DRAM ODT off.\n"); ++ } ++ else { ++ printf("DRAM ODT value: 0x%x.\n", rc); ++ } ++ ++ // Init core, final run ++ if ( mctl_core_init(para)==0 ) { ++ printf("DRAM initialisation error : 1 !\n"); ++ return 0; ++ } ++ ++ // Get sdram size ++ rc = para->dram_para2; ++ if ( rc<0 ) { ++ rc = (rc & 0x7fff0000U) >> 16; ++ } ++ else { ++ rc = DRAMC_get_dram_size(); ++ printf("DRAM SIZE =%d M\n", rc); ++ para->dram_para2 = (para->dram_para2 & 0xffffu) | rc << 16; ++ } ++ mem_size = rc; ++ ++ // Purpose ?? ++ if ( para->dram_tpr13 & (1 << 30) ) { ++ rc = readl(¶->dram_tpr8); ++ if ( rc==0 ) { ++ rc = 0x10000200; ++ } ++ writel(0x31030a0, rc); ++ writel(0x310309c, 0x40a); ++ writel(0x3103004, readl(0x3103004) | 1 ); ++ printf("Enable Auto SR"); ++ } ++ else { ++ writel(0x31030a0, readl(0x31030a0) & 0xffff0000); ++ writel(0x3103004, readl(0x3103004) & (~0x1) ); ++ } ++ ++ // Pupose ?? ++ rc = readl(0x3103100) & ~(0xf000); ++ if ( (para->dram_tpr13 & 0x200)==0 ) { ++ if ( para->dram_type != 6 ) { ++ writel(0x3103100, rc); ++ } ++ } ++ else { ++ writel(0x3103100, rc | 0x5000); ++ } ++ ++ writel(0x3103140, readl(0x3103140) | (1 << 31)); ++ if (para->dram_tpr13 & (1 << 8)) { ++ writel(0x31030b8, readl(0x3103140) | 0x300); ++ } ++ ++ rc = readl(0x3103108); ++ if (para->dram_tpr13 & (1 << 16)) { ++ rc &= 0xffffdfff; ++ } ++ else { ++ rc |= 0x00002000; ++ } ++ writel(0x3103108, rc); ++ ++ ++ // Purpose ?? ++ if (para->dram_type == 7) { ++ rc = readl(0x310307c) & 0xfff0ffff; ++ rc |= 0x0001000; ++ writel(0x310307c, rc); ++ } ++ ++ dram_enable_all_master(); ++ //if (dramc_simple_wr_test(mem_size, 64)) return 0; ++ if (para->dram_tpr13 & (1 << 28)) { ++ rc = readl(0x70005d4); ++ if ( (rc & (1 << 16)) || dramc_simple_wr_test(mem_size, 4096) ) { ++ return 0; ++ } ++ } ++ ++ return mem_size; ++} ++ ++struct sunxi_ram_priv { ++ size_t size; ++}; ++ ++static struct dram_para_t dram_para = { ++ 0x00000318, ++ 0x00000003, ++ 0x007b7bfb, ++ 0x00000001, ++ 0x000010d2, ++ 0x00000000, ++ 0x00001c70, ++ 0x00000042, ++ 0x00000018, ++ 0x00000000, ++ 0x004a2195, ++ 0x02423190, ++ 0x0008b061, ++ 0xb4787896, ++ 0x00000000, ++ 0x48484848, ++ 0x00000048, ++ 0x1620121e, ++ 0x00000000, ++ 0x00000000, ++ 0x00000000, ++ 0x00870000, ++ 0x00000024, ++ 0x34050100, ++}; ++ ++static int sunxi_ram_probe(struct udevice *dev) ++{ ++ struct sunxi_ram_priv *priv = dev_get_priv(dev); ++ int ret; ++ ++ printf("%s: %s: probing\n", __func__, dev->name); ++ ++ ret = init_DRAM(0, &dram_para); ++ if (ret <= 0) { ++ printf("DRAM init failed: %d\n", ret); ++ return ret; ++ } ++ ++ priv->size = ret * 1024 * 1024; ++ ++ return 0; ++} ++ ++static int sunxi_ram_get_info(struct udevice *dev, struct ram_info *info) ++{ ++ struct sunxi_ram_priv *priv = dev_get_priv(dev); ++ ++ printf("%s: %s: getting info\n", __func__, dev->name); ++ ++ info->base = CONFIG_SYS_SDRAM_BASE; ++ info->size = priv->size; ++ ++ return 0; ++} ++ ++static struct ram_ops sunxi_ram_ops = { ++ .get_info = sunxi_ram_get_info, ++}; ++ ++static const struct udevice_id sunxi_ram_ids[] = { ++ { .compatible = "allwinner,sun20i-d1-mbus" }, ++ { } ++}; ++ ++U_BOOT_DRIVER(sunxi_ram) = { ++ .name = "sunxi_ram", ++ .id = UCLASS_RAM, ++ .of_match = sunxi_ram_ids, ++ .ops = &sunxi_ram_ops, ++ .probe = sunxi_ram_probe, ++ .priv_auto = sizeof(struct sunxi_ram_priv), ++}; ++ ++#endif +--- /dev/null ++++ b/drivers/ram/sunxi/sdram.h +@@ -0,0 +1,46 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++ ++/* ++ * dram_para1 bits: ++ * 16-19 = page size ++ * 20-27 = row count ++ * 28 = banks 4 or 8 ++ * ++ * dram_para2 bits: ++ * 0 = DQ width ++ * 4 = CS1 control ++ * 8-11 = rank flags? bit 8 = ranks differ in config ++ * 12-13 = rank ++ */ ++ ++/* MC_WORK_MODE bits ++ * 0- 1 = ranks code ++ * 2- 3 = banks, log2 - 2 2 3 2 ++ * 4- 7 = row width, log2 - 1 16 11 11 ++ * 8-11 = page size, log2 - 3 9 9 13 ++ * 12-15 = DQ width (or 12-14?) ++ * 16-18 = dram type (2=DDR2, 3=DDR3, 6=LPDDR2, 7=LPDDR3) ++ * 19 = 2T or 1T ++ * 23-24 = ranks code (again?) ++ */ ++ ++#define DRAM_MR0 ((void*)0x3103030) ++#define DRAM_MR1 ((void*)0x3103034) ++#define DRAM_MR2 ((void*)0x3103038) ++#define DRAM_MR3 ((void*)0x310303c) ++ ++#define DRAMTMG0 ((void*)0x3103058) ++#define DRAMTMG1 ((void*)0x310305c) ++#define DRAMTMG2 ((void*)0x3103060) ++#define DRAMTMG3 ((void*)0x3103064) ++#define DRAMTMG4 ((void*)0x3103068) ++#define DRAMTMG5 ((void*)0x310306c) ++#define DRAMTMG6 ((void*)0x3103070) ++#define DRAMTMG7 ((void*)0x3103074) ++#define DRAMTMG8 ((void*)0x3103078) ++ ++#define PITMG0 ((void*)0x3103080) ++#define PTR3 ((void*)0x3103050) ++#define PTR4 ((void*)0x3103054) ++#define RFSHTMG ((void*)0x3103090) ++#define RFSHCTL1 ((void*)0x3103094) diff --git a/package/boot/uboot-d1/patches/0084-spi-sunxi-Hack-up-the-driver-for-the-D1.patch b/package/boot/uboot-d1/patches/0084-spi-sunxi-Hack-up-the-driver-for-the-D1.patch new file mode 100644 index 00000000000000..1ce106e987909f --- /dev/null +++ b/package/boot/uboot-d1/patches/0084-spi-sunxi-Hack-up-the-driver-for-the-D1.patch @@ -0,0 +1,29 @@ +From 46f73ce33478734dabd5a93d425f7148b60198e1 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Wed, 8 Sep 2021 21:31:06 -0500 +Subject: [PATCH 84/90] spi: sunxi: Hack up the driver for the D1 + +Signed-off-by: Samuel Holland +--- + drivers/spi/spi-sunxi.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/spi/spi-sunxi.c ++++ b/drivers/spi/spi-sunxi.c +@@ -30,6 +30,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -85,7 +86,7 @@ DECLARE_GLOBAL_DATA_PTR; + #define SUN4I_SPI_DEFAULT_RATE 1000000 + #define SUN4I_SPI_TIMEOUT_MS 1000 + +-#define SPI_REG(priv, reg) ((priv)->base + \ ++#define SPI_REG(priv, reg) (void *)((priv)->base + \ + (priv)->variant->regs[reg]) + #define SPI_BIT(priv, bit) ((priv)->variant->bits[bit]) + #define SPI_CS(priv, cs) (((cs) << SPI_BIT(priv, SPI_TCR_CS_SEL)) & \ diff --git a/package/boot/uboot-d1/patches/0085-spi-sunxi-Add-support-for-the-D1.patch b/package/boot/uboot-d1/patches/0085-spi-sunxi-Add-support-for-the-D1.patch new file mode 100644 index 00000000000000..9ae2c144eb2ebd --- /dev/null +++ b/package/boot/uboot-d1/patches/0085-spi-sunxi-Add-support-for-the-D1.patch @@ -0,0 +1,23 @@ +From 4993c31d314d5c7ebad1d08e3e3f79694dca8738 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sat, 11 Sep 2021 23:12:06 -0500 +Subject: [PATCH 85/90] spi: sunxi: Add support for the D1 + +Signed-off-by: Samuel Holland +--- + drivers/spi/spi-sunxi.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/drivers/spi/spi-sunxi.c ++++ b/drivers/spi/spi-sunxi.c +@@ -558,6 +558,10 @@ static const struct udevice_id sun4i_spi + .compatible = "allwinner,sun8i-h3-spi", + .data = (ulong)&sun8i_h3_spi_variant, + }, ++ { ++ .compatible = "allwinner,sun50i-r329-spi", ++ .data = (ulong)&sun8i_h3_spi_variant, ++ }, + { /* sentinel */ } + }; + diff --git a/package/boot/uboot-d1/patches/0086-usb-musb-new-Hack-up-the-driver-for-the-D1.patch b/package/boot/uboot-d1/patches/0086-usb-musb-new-Hack-up-the-driver-for-the-D1.patch new file mode 100644 index 00000000000000..f76cb86131eb29 --- /dev/null +++ b/package/boot/uboot-d1/patches/0086-usb-musb-new-Hack-up-the-driver-for-the-D1.patch @@ -0,0 +1,91 @@ +From eb0cf5922cf0656a7e9f96d6b83397469a26825a Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sat, 11 Sep 2021 10:12:24 -0500 +Subject: [PATCH 86/90] usb: musb-new: Hack up the driver for the D1 + +Signed-off-by: Samuel Holland +--- + arch/riscv/include/asm/bitops.h | 1 + + arch/riscv/include/asm/io.h | 2 +- + arch/riscv/include/asm/processor.h | 2 ++ + drivers/usb/musb-new/musb_io.h | 2 +- + drivers/usb/musb-new/sunxi.c | 6 ++++-- + 5 files changed, 9 insertions(+), 4 deletions(-) + +--- a/arch/riscv/include/asm/bitops.h ++++ b/arch/riscv/include/asm/bitops.h +@@ -78,6 +78,7 @@ static inline int __test_and_set_bit(int + return retval; + } + ++#define test_and_clear_bit __test_and_clear_bit + static inline int __test_and_clear_bit(int nr, void *addr) + { + int mask, retval; +--- a/arch/riscv/include/asm/io.h ++++ b/arch/riscv/include/asm/io.h +@@ -218,6 +218,7 @@ static inline u64 readq(const volatile v + #define insb(p, d, l) readsb(__io(p), d, l) + #define insw(p, d, l) readsw(__io(p), d, l) + #define insl(p, d, l) readsl(__io(p), d, l) ++#endif + + static inline void readsb(unsigned int *addr, void *data, int bytelen) + { +@@ -308,7 +309,6 @@ static inline void writesl(unsigned int + longlen--; + } + } +-#endif + + #define outb_p(val, port) outb((val), (port)) + #define outw_p(val, port) outw((val), (port)) +--- a/arch/riscv/include/asm/processor.h ++++ b/arch/riscv/include/asm/processor.h +@@ -23,4 +23,6 @@ + * no one uses the macros defined in this head file. + **************************************************************/ + ++#define cpu_relax() barrier() ++ + #endif /* __ASM_RISCV_PROCESSOR_H */ +--- a/drivers/usb/musb-new/musb_io.h ++++ b/drivers/usb/musb-new/musb_io.h +@@ -23,7 +23,7 @@ + #if !defined(CONFIG_ARM) && !defined(CONFIG_SUPERH) \ + && !defined(CONFIG_PPC32) \ + && !defined(CONFIG_PPC64) && !defined(CONFIG_MIPS) \ +- && !defined(CONFIG_M68K) ++ && !defined(CONFIG_M68K) && !defined(CONFIG_RISCV) + static inline void readsl(const void __iomem *addr, void *buf, int len) + { insl((unsigned long)addr, buf, len); } + static inline void readsw(const void __iomem *addr, void *buf, int len) +--- a/drivers/usb/musb-new/sunxi.c ++++ b/drivers/usb/musb-new/sunxi.c +@@ -23,8 +23,8 @@ + #include + #include + #include +-#include +-#include ++//#include ++//#include + #include + #include + #include +@@ -174,6 +174,7 @@ static void USBC_ForceVbusValidToHigh(__ + + static void USBC_ConfigFIFO_Base(void) + { ++#if 0 + u32 reg_value; + + /* config usb fifo, 8kb mode */ +@@ -181,6 +182,7 @@ static void USBC_ConfigFIFO_Base(void) + reg_value &= ~(0x03 << 0); + reg_value |= BIT(0); + writel(reg_value, SUNXI_SRAMC_BASE + 0x04); ++#endif + } + + /****************************************************************************** diff --git a/package/boot/uboot-d1/patches/0087-sunxi-Add-temporary-RISC-V-version-of-board-code.patch b/package/boot/uboot-d1/patches/0087-sunxi-Add-temporary-RISC-V-version-of-board-code.patch new file mode 100644 index 00000000000000..c066f291628bd6 --- /dev/null +++ b/package/boot/uboot-d1/patches/0087-sunxi-Add-temporary-RISC-V-version-of-board-code.patch @@ -0,0 +1,725 @@ +From e3152c690732fb141500379f32fbe2203fa47059 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sat, 6 Aug 2022 00:48:38 -0500 +Subject: [PATCH 87/90] sunxi: Add temporary RISC-V version of board code + +Signed-off-by: Samuel Holland +--- + board/sunxi/Makefile | 3 +- + board/sunxi/board-riscv.c | 687 +++++++++++++++++++++++++++++++++ + include/configs/sunxi-common.h | 1 - + 3 files changed, 689 insertions(+), 2 deletions(-) + create mode 100644 board/sunxi/board-riscv.c + +--- a/board/sunxi/Makefile ++++ b/board/sunxi/Makefile +@@ -6,7 +6,8 @@ + # + # (C) Copyright 2000-2003 + # Wolfgang Denk, DENX Software Engineering, wd@denx.de. +-obj-y += board.o ++obj-$(CONFIG_ARM) += board.o ++obj-$(CONFIG_RISCV) += board-riscv.o + obj-$(CONFIG_SUN7I_GMAC) += gmac.o + obj-$(CONFIG_MACH_SUN4I) += dram_sun4i_auto.o + obj-$(CONFIG_MACH_SUN5I) += dram_sun5i_auto.o +--- /dev/null ++++ b/board/sunxi/board-riscv.c +@@ -0,0 +1,687 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++/* ++ * (C) Copyright 2012-2013 Henrik Nordstrom ++ * (C) Copyright 2013 Luke Kenneth Casson Leighton ++ * ++ * (C) Copyright 2007-2011 ++ * Allwinner Technology Co., Ltd. ++ * Tom Cubie ++ * ++ * Some board init for the Allwinner A10-evb board. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#ifdef CONFIG_RISCV ++int board_init(void) ++{ ++ /* https://lore.kernel.org/u-boot/31587574-4cd1-02da-9761-0134ac82b94b@sholland.org/ */ ++ return cpu_probe_all(); ++} ++ ++int sunxi_get_sid(unsigned int *sid) ++{ ++ return -ENODEV; ++} ++ ++#define SPL_ADDR CONFIG_SUNXI_SRAM_ADDRESS ++ ++/* The low 8-bits of the 'boot_media' field in the SPL header */ ++#define SUNXI_BOOTED_FROM_MMC0 0 ++#define SUNXI_BOOTED_FROM_NAND 1 ++#define SUNXI_BOOTED_FROM_MMC2 2 ++#define SUNXI_BOOTED_FROM_SPI 3 ++#define SUNXI_BOOTED_FROM_MMC0_HIGH 0x10 ++#define SUNXI_BOOTED_FROM_MMC2_HIGH 0x12 ++ ++#define SUNXI_INVALID_BOOT_SOURCE -1 ++ ++static int sunxi_egon_valid(struct boot_file_head *egon_head) ++{ ++ return !memcmp(egon_head->magic, BOOT0_MAGIC, 8); /* eGON.BT0 */ ++} ++ ++static int sunxi_toc0_valid(struct toc0_main_info *toc0_info) ++{ ++ return !memcmp(toc0_info->name, TOC0_MAIN_INFO_NAME, 8); /* TOC0.GLH */ ++} ++ ++static int sunxi_get_boot_source(void) ++{ ++ struct boot_file_head *egon_head = (void *)SPL_ADDR; ++ struct toc0_main_info *toc0_info = (void *)SPL_ADDR; ++ ++ /* ++ * On the ARMv5 SoCs, the SPL header in SRAM is overwritten by the ++ * exception vectors in U-Boot proper, so we won't find any ++ * information there. Also the FEL stash is only valid in the SPL, ++ * so we can't use that either. So if this is called from U-Boot ++ * proper, just return MMC0 as a placeholder, for now. ++ */ ++ if (IS_ENABLED(CONFIG_MACH_SUNIV) && ++ !IS_ENABLED(CONFIG_SPL_BUILD)) ++ return SUNXI_BOOTED_FROM_MMC0; ++ ++ if (sunxi_egon_valid(egon_head)) ++ return readb(&egon_head->boot_media); ++ if (sunxi_toc0_valid(toc0_info)) ++ return readb(&toc0_info->platform[0]); ++ ++ /* Not a valid image, so we must have been booted via FEL. */ ++ return SUNXI_INVALID_BOOT_SOURCE; ++} ++ ++/* The sunxi internal brom will try to loader external bootloader ++ * from mmc0, nand flash, mmc2. ++ */ ++uint32_t sunxi_get_boot_device(void) ++{ ++ int boot_source = sunxi_get_boot_source(); ++ ++ /* ++ * When booting from the SD card or NAND memory, the "eGON.BT0" ++ * signature is expected to be found in memory at the address 0x0004 ++ * (see the "mksunxiboot" tool, which generates this header). ++ * ++ * When booting in the FEL mode over USB, this signature is patched in ++ * memory and replaced with something else by the 'fel' tool. This other ++ * signature is selected in such a way, that it can't be present in a ++ * valid bootable SD card image (because the BROM would refuse to ++ * execute the SPL in this case). ++ * ++ * This checks for the signature and if it is not found returns to ++ * the FEL code in the BROM to wait and receive the main u-boot ++ * binary over USB. If it is found, it determines where SPL was ++ * read from. ++ */ ++ switch (boot_source) { ++ case SUNXI_INVALID_BOOT_SOURCE: ++ return BOOT_DEVICE_BOARD; ++ case SUNXI_BOOTED_FROM_MMC0: ++ case SUNXI_BOOTED_FROM_MMC0_HIGH: ++ return BOOT_DEVICE_MMC1; ++ case SUNXI_BOOTED_FROM_NAND: ++ return BOOT_DEVICE_NAND; ++ case SUNXI_BOOTED_FROM_MMC2: ++ case SUNXI_BOOTED_FROM_MMC2_HIGH: ++ return BOOT_DEVICE_MMC2; ++ case SUNXI_BOOTED_FROM_SPI: ++ return BOOT_DEVICE_SPI; ++ } ++ ++ panic("Unknown boot source %d\n", boot_source); ++ return -1; /* Never reached */ ++} ++ ++uint32_t sunxi_get_spl_size(void) ++{ ++ struct boot_file_head *egon_head = (void *)SPL_ADDR; ++ struct toc0_main_info *toc0_info = (void *)SPL_ADDR; ++ ++ if (sunxi_egon_valid(egon_head)) ++ return readl(&egon_head->length); ++ if (sunxi_toc0_valid(toc0_info)) ++ return readl(&toc0_info->length); ++ ++ /* Not a valid image, so use the default U-Boot offset. */ ++ return 0; ++} ++ ++/* ++ * The eGON SPL image can be located at 8KB or at 128KB into an SD card or ++ * an eMMC device. The boot source has bit 4 set in the latter case. ++ * By adding 120KB to the normal offset when booting from a "high" location ++ * we can support both cases. ++ * Also U-Boot proper is located at least 32KB after the SPL, but will ++ * immediately follow the SPL if that is bigger than that. ++ */ ++unsigned long spl_mmc_get_uboot_raw_sector(struct mmc *mmc, ++ unsigned long raw_sect) ++{ ++ unsigned long spl_size = sunxi_get_spl_size(); ++ unsigned long sector; ++ ++ sector = max(raw_sect, spl_size / 512); ++ ++ switch (sunxi_get_boot_source()) { ++ case SUNXI_BOOTED_FROM_MMC0_HIGH: ++ case SUNXI_BOOTED_FROM_MMC2_HIGH: ++ sector += (128 - 8) * 2; ++ break; ++ } ++ ++ printf("SPL size = %lu, sector = %lu\n", spl_size, sector); ++ ++ return sector; ++} ++ ++u32 spl_boot_device(void) ++{ ++ return sunxi_get_boot_device(); ++} ++ ++#define CSR_MXSTATUS 0x7c0 ++#define CSR_MHCR 0x7c1 ++#define CSR_MCOR 0x7c2 ++#define CSR_MHINT 0x7c5 ++ ++int spl_board_init_f(void) ++{ ++ int ret; ++ struct udevice *dev; ++ ++ /* DDR init */ ++ ret = uclass_get_device(UCLASS_RAM, 0, &dev); ++ if (ret) { ++ debug("DRAM init failed: %d\n", ret); ++ return ret; ++ } ++ ++ /* Initialize extension CSRs. */ ++ printf("mxstatus=0x%08lx mhcr=0x%08lx mcor=0x%08lx mhint=0x%08lx\n", ++ csr_read(CSR_MXSTATUS), ++ csr_read(CSR_MHCR), ++ csr_read(CSR_MCOR), ++ csr_read(CSR_MHINT)); ++ ++ csr_set(CSR_MXSTATUS, 0x638000); ++ csr_write(CSR_MCOR, 0x70013); ++ csr_write(CSR_MHCR, 0x11ff); ++ csr_write(CSR_MHINT, 0x16e30c); ++ ++ return 0; ++} ++ ++#ifdef CONFIG_SPL_BUILD ++void spl_perform_fixups(struct spl_image_info *spl_image) ++{ ++ struct ram_info info; ++ struct udevice *dev; ++ int ret; ++ ++ ret = uclass_get_device(UCLASS_RAM, 0, &dev); ++ if (ret) ++ panic("No RAM device"); ++ ++ ret = ram_get_info(dev, &info); ++ if (ret) ++ panic("No RAM info"); ++ ++ ret = fdt_fixup_memory(spl_image->fdt_addr, info.base, info.size); ++ if (ret) ++ panic("Failed to update DTB"); ++} ++#endif ++#endif ++ ++DECLARE_GLOBAL_DATA_PTR; ++ ++/* ++ * Try to use the environment from the boot source first. ++ * For MMC, this means a FAT partition on the boot device (SD or eMMC). ++ * If the raw MMC environment is also enabled, this is tried next. ++ * When booting from NAND we try UBI first, then NAND directly. ++ * SPI flash falls back to FAT (on SD card). ++ */ ++enum env_location env_get_location(enum env_operation op, int prio) ++{ ++ if (prio > 1) ++ return ENVL_UNKNOWN; ++ ++ /* NOWHERE is exclusive, no other option can be defined. */ ++ if (IS_ENABLED(CONFIG_ENV_IS_NOWHERE)) ++ return ENVL_NOWHERE; ++ ++ switch (sunxi_get_boot_device()) { ++ case BOOT_DEVICE_MMC1: ++ case BOOT_DEVICE_MMC2: ++ if (prio == 0 && IS_ENABLED(CONFIG_ENV_IS_IN_FAT)) ++ return ENVL_FAT; ++ if (IS_ENABLED(CONFIG_ENV_IS_IN_MMC)) ++ return ENVL_MMC; ++ break; ++ case BOOT_DEVICE_NAND: ++ if (prio == 0 && IS_ENABLED(CONFIG_ENV_IS_IN_UBI)) ++ return ENVL_UBI; ++ if (IS_ENABLED(CONFIG_ENV_IS_IN_NAND)) ++ return ENVL_NAND; ++ break; ++ case BOOT_DEVICE_SPI: ++ if (prio == 0 && IS_ENABLED(CONFIG_ENV_IS_IN_SPI_FLASH)) ++ return ENVL_SPI_FLASH; ++ if (IS_ENABLED(CONFIG_ENV_IS_IN_FAT)) ++ return ENVL_FAT; ++ break; ++ case BOOT_DEVICE_BOARD: ++ break; ++ default: ++ break; ++ } ++ ++ /* ++ * If we come here for the first time, we *must* return a valid ++ * environment location other than ENVL_UNKNOWN, or the setup sequence ++ * in board_f() will silently hang. This is arguably a bug in ++ * env_init(), but for now pick one environment for which we know for ++ * sure to have a driver for. For all defconfigs this is either FAT ++ * or UBI, or NOWHERE, which is already handled above. ++ */ ++ if (prio == 0) { ++ if (IS_ENABLED(CONFIG_ENV_IS_IN_FAT)) ++ return ENVL_FAT; ++ if (IS_ENABLED(CONFIG_ENV_IS_IN_UBI)) ++ return ENVL_UBI; ++ } ++ ++ return ENVL_UNKNOWN; ++} ++ ++/* ++ * On older SoCs the SPL is actually at address zero, so using NULL as ++ * an error value does not work. ++ */ ++#define INVALID_SPL_HEADER ((void *)~0UL) ++ ++static struct boot_file_head * get_spl_header(uint8_t req_version) ++{ ++ struct boot_file_head *spl = (void *)(ulong)SPL_ADDR; ++ uint8_t spl_header_version = spl->spl_signature[3]; ++ ++ /* Is there really the SPL header (still) there? */ ++ if (memcmp(spl->spl_signature, SPL_SIGNATURE, 3) != 0) ++ return INVALID_SPL_HEADER; ++ ++ if (spl_header_version < req_version) { ++ printf("sunxi SPL version mismatch: expected %u, got %u\n", ++ req_version, spl_header_version); ++ return INVALID_SPL_HEADER; ++ } ++ ++ return spl; ++} ++ ++static const char *get_spl_dt_name(void) ++{ ++ struct boot_file_head *spl = get_spl_header(SPL_DT_HEADER_VERSION); ++ ++ /* Check if there is a DT name stored in the SPL header. */ ++ if (spl != INVALID_SPL_HEADER && spl->dt_name_offset) ++ return (char *)spl + spl->dt_name_offset; ++ ++ return NULL; ++} ++ ++#if CONFIG_MMC_SUNXI_SLOT_EXTRA != -1 ++int mmc_get_env_dev(void) ++{ ++ switch (sunxi_get_boot_device()) { ++ case BOOT_DEVICE_MMC1: ++ return 0; ++ case BOOT_DEVICE_MMC2: ++ return 1; ++ default: ++ return CONFIG_SYS_MMC_ENV_DEV; ++ } ++} ++#endif ++ ++#ifdef CONFIG_SPL_BUILD ++void sunxi_board_init(void) ++{ ++#ifdef CONFIG_LED_STATUS ++ if (IS_ENABLED(CONFIG_SPL_DRIVERS_MISC)) ++ status_led_init(); ++#endif ++} ++#endif ++ ++#ifdef CONFIG_USB_GADGET ++int g_dnl_board_usb_cable_connected(void) ++{ ++ struct udevice *dev; ++ struct phy phy; ++ int ret; ++ ++ ret = uclass_get_device(UCLASS_USB_GADGET_GENERIC, 0, &dev); ++ if (ret) { ++ pr_err("%s: Cannot find USB device\n", __func__); ++ return ret; ++ } ++ ++ ret = generic_phy_get_by_name(dev, "usb", &phy); ++ if (ret) { ++ pr_err("failed to get %s USB PHY\n", dev->name); ++ return ret; ++ } ++ ++ ret = generic_phy_init(&phy); ++ if (ret) { ++ pr_debug("failed to init %s USB PHY\n", dev->name); ++ return ret; ++ } ++ ++ return sun4i_usb_phy_vbus_detect(&phy); ++} ++#endif ++ ++#ifdef CONFIG_SERIAL_TAG ++void get_board_serial(struct tag_serialnr *serialnr) ++{ ++ char *serial_string; ++ unsigned long long serial; ++ ++ serial_string = env_get("serial#"); ++ ++ if (serial_string) { ++ serial = simple_strtoull(serial_string, NULL, 16); ++ ++ serialnr->high = (unsigned int) (serial >> 32); ++ serialnr->low = (unsigned int) (serial & 0xffffffff); ++ } else { ++ serialnr->high = 0; ++ serialnr->low = 0; ++ } ++} ++#endif ++ ++/* ++ * Check the SPL header for the "sunxi" variant. If found: parse values ++ * that might have been passed by the loader ("fel" utility), and update ++ * the environment accordingly. ++ */ ++static void parse_spl_header(const uint32_t spl_addr) ++{ ++ struct boot_file_head *spl = get_spl_header(SPL_ENV_HEADER_VERSION); ++ ++ if (spl == INVALID_SPL_HEADER) ++ return; ++ ++ if (!spl->fel_script_address) ++ return; ++ ++ if (spl->fel_uEnv_length != 0) { ++ /* ++ * data is expected in uEnv.txt compatible format, so "env ++ * import -t" the string(s) at fel_script_address right away. ++ */ ++ himport_r(&env_htab, (char *)(uintptr_t)spl->fel_script_address, ++ spl->fel_uEnv_length, '\n', H_NOCLEAR, 0, 0, NULL); ++ return; ++ } ++ /* otherwise assume .scr format (mkimage-type script) */ ++ env_set_hex("fel_scriptaddr", spl->fel_script_address); ++} ++ ++static bool get_unique_sid(unsigned int *sid) ++{ ++ if (sunxi_get_sid(sid) != 0) ++ return false; ++ ++ if (!sid[0]) ++ return false; ++ ++ /* ++ * The single words 1 - 3 of the SID have quite a few bits ++ * which are the same on many models, so we take a crc32 ++ * of all 3 words, to get a more unique value. ++ * ++ * Note we only do this on newer SoCs as we cannot change ++ * the algorithm on older SoCs since those have been using ++ * fixed mac-addresses based on only using word 3 for a ++ * long time and changing a fixed mac-address with an ++ * u-boot update is not good. ++ */ ++#if !defined(CONFIG_MACH_SUN4I) && !defined(CONFIG_MACH_SUN5I) && \ ++ !defined(CONFIG_MACH_SUN6I) && !defined(CONFIG_MACH_SUN7I) && \ ++ !defined(CONFIG_MACH_SUN8I_A23) && !defined(CONFIG_MACH_SUN8I_A33) ++ sid[3] = crc32(0, (unsigned char *)&sid[1], 12); ++#endif ++ ++ /* Ensure the NIC specific bytes of the mac are not all 0 */ ++ if ((sid[3] & 0xffffff) == 0) ++ sid[3] |= 0x800000; ++ ++ return true; ++} ++ ++/* ++ * Note this function gets called multiple times. ++ * It must not make any changes to env variables which already exist. ++ */ ++static void setup_environment(const void *fdt) ++{ ++ char serial_string[17] = { 0 }; ++ unsigned int sid[4]; ++ uint8_t mac_addr[6]; ++ char ethaddr[16]; ++ int i; ++ ++ if (!get_unique_sid(sid)) ++ return; ++ ++ for (i = 0; i < 4; i++) { ++ sprintf(ethaddr, "ethernet%d", i); ++ if (!fdt_get_alias(fdt, ethaddr)) ++ continue; ++ ++ if (i == 0) ++ strcpy(ethaddr, "ethaddr"); ++ else ++ sprintf(ethaddr, "eth%daddr", i); ++ ++ if (env_get(ethaddr)) ++ continue; ++ ++ /* Non OUI / registered MAC address */ ++ mac_addr[0] = (i << 4) | 0x02; ++ mac_addr[1] = (sid[0] >> 0) & 0xff; ++ mac_addr[2] = (sid[3] >> 24) & 0xff; ++ mac_addr[3] = (sid[3] >> 16) & 0xff; ++ mac_addr[4] = (sid[3] >> 8) & 0xff; ++ mac_addr[5] = (sid[3] >> 0) & 0xff; ++ ++ eth_env_set_enetaddr(ethaddr, mac_addr); ++ } ++ ++ if (!env_get("serial#")) { ++ snprintf(serial_string, sizeof(serial_string), ++ "%08x%08x", sid[0], sid[3]); ++ ++ env_set("serial#", serial_string); ++ } ++} ++ ++int misc_init_r(void) ++{ ++ const char *spl_dt_name; ++ uint boot; ++ ++ env_set("fel_booted", NULL); ++ env_set("fel_scriptaddr", NULL); ++ env_set("mmc_bootdev", NULL); ++ ++ boot = sunxi_get_boot_device(); ++ /* determine if we are running in FEL mode */ ++ if (boot == BOOT_DEVICE_BOARD) { ++ env_set("fel_booted", "1"); ++ parse_spl_header(SPL_ADDR); ++ /* or if we booted from MMC, and which one */ ++ } else if (boot == BOOT_DEVICE_MMC1) { ++ env_set("mmc_bootdev", "0"); ++ } else if (boot == BOOT_DEVICE_MMC2) { ++ env_set("mmc_bootdev", "1"); ++ } ++ ++ /* Set fdtfile to match the FIT configuration chosen in SPL. */ ++ spl_dt_name = get_spl_dt_name(); ++ if (spl_dt_name) { ++ char *prefix = IS_ENABLED(CONFIG_ARM64) ? "allwinner/" : ""; ++ char str[64]; ++ ++ snprintf(str, sizeof(str), "%s%s.dtb", prefix, spl_dt_name); ++ env_set("fdtfile", str); ++ } ++ ++ setup_environment(gd->fdt_blob); ++ ++ return 0; ++} ++ ++int board_late_init(void) ++{ ++#ifdef CONFIG_USB_ETHER ++ usb_ether_init(); ++#endif ++ ++#ifdef SUNXI_SCP_BASE ++ if (!rproc_load(0, SUNXI_SCP_BASE, SUNXI_SCP_MAX_SIZE)) { ++ puts("Starting SCP...\n"); ++ rproc_start(0); ++ } ++#endif ++ ++ return 0; ++} ++ ++static void bluetooth_dt_fixup(void *blob) ++{ ++ /* Some devices ship with a Bluetooth controller default address. ++ * Set a valid address through the device tree. ++ */ ++ uchar tmp[ETH_ALEN], bdaddr[ETH_ALEN]; ++ unsigned int sid[4]; ++ int i; ++ ++ if (!CONFIG_BLUETOOTH_DT_DEVICE_FIXUP[0]) ++ return; ++ ++ if (eth_env_get_enetaddr("bdaddr", tmp)) { ++ /* Convert between the binary formats of the corresponding stacks */ ++ for (i = 0; i < ETH_ALEN; ++i) ++ bdaddr[i] = tmp[ETH_ALEN - i - 1]; ++ } else { ++ if (!get_unique_sid(sid)) ++ return; ++ ++ bdaddr[0] = ((sid[3] >> 0) & 0xff) ^ 1; ++ bdaddr[1] = (sid[3] >> 8) & 0xff; ++ bdaddr[2] = (sid[3] >> 16) & 0xff; ++ bdaddr[3] = (sid[3] >> 24) & 0xff; ++ bdaddr[4] = (sid[0] >> 0) & 0xff; ++ bdaddr[5] = 0x02; ++ } ++ ++ do_fixup_by_compat(blob, CONFIG_BLUETOOTH_DT_DEVICE_FIXUP, ++ "local-bd-address", bdaddr, ETH_ALEN, 1); ++} ++ ++int ft_board_setup(void *blob, struct bd_info *bd) ++{ ++ int __maybe_unused r; ++ ++ /* ++ * Call setup_environment and fdt_fixup_ethernet again ++ * in case the boot fdt has ethernet aliases the u-boot ++ * copy does not have. ++ */ ++ setup_environment(blob); ++ fdt_fixup_ethernet(blob); ++ ++ bluetooth_dt_fixup(blob); ++ ++#ifdef CONFIG_VIDEO_DT_SIMPLEFB ++ r = sunxi_simplefb_setup(blob); ++ if (r) ++ return r; ++#endif ++ return 0; ++} ++ ++#ifdef CONFIG_SPL_LOAD_FIT ++ ++static void set_spl_dt_name(const char *name) ++{ ++ struct boot_file_head *spl = get_spl_header(SPL_ENV_HEADER_VERSION); ++ ++ if (spl == INVALID_SPL_HEADER) ++ return; ++ ++ /* Promote the header version for U-Boot proper, if needed. */ ++ if (spl->spl_signature[3] < SPL_DT_HEADER_VERSION) ++ spl->spl_signature[3] = SPL_DT_HEADER_VERSION; ++ ++ strcpy((char *)&spl->string_pool, name); ++ spl->dt_name_offset = offsetof(struct boot_file_head, string_pool); ++} ++ ++int board_fit_config_name_match(const char *name) ++{ ++ const char *best_dt_name = get_spl_dt_name(); ++ int ret; ++ ++#ifdef CONFIG_DEFAULT_DEVICE_TREE ++ if (best_dt_name == NULL) ++ best_dt_name = CONFIG_DEFAULT_DEVICE_TREE; ++#endif ++ ++ if (best_dt_name == NULL) { ++ /* No DT name was provided, so accept the first config. */ ++ return 0; ++ } ++#ifdef CONFIG_PINE64_DT_SELECTION ++ if (strstr(best_dt_name, "-pine64-plus")) { ++ /* Differentiate the Pine A64 boards by their DRAM size. */ ++ if ((gd->ram_size == 512 * 1024 * 1024)) ++ best_dt_name = "sun50i-a64-pine64"; ++ } ++#endif ++#ifdef CONFIG_PINEPHONE_DT_SELECTION ++ if (strstr(best_dt_name, "-pinephone")) { ++ /* Differentiate the PinePhone revisions by GPIO inputs. */ ++ prcm_apb0_enable(PRCM_APB0_GATE_PIO); ++ sunxi_gpio_set_pull(SUNXI_GPL(6), SUNXI_GPIO_PULL_UP); ++ sunxi_gpio_set_cfgpin(SUNXI_GPL(6), SUNXI_GPIO_INPUT); ++ udelay(100); ++ ++ /* PL6 is pulled low by the modem on v1.2. */ ++ if (gpio_get_value(SUNXI_GPL(6)) == 0) ++ best_dt_name = "sun50i-a64-pinephone-1.2"; ++ else ++ best_dt_name = "sun50i-a64-pinephone-1.1"; ++ ++ sunxi_gpio_set_cfgpin(SUNXI_GPL(6), SUNXI_GPIO_DISABLE); ++ sunxi_gpio_set_pull(SUNXI_GPL(6), SUNXI_GPIO_PULL_DISABLE); ++ prcm_apb0_disable(PRCM_APB0_GATE_PIO); ++ } ++#endif ++ ++ ret = strcmp(name, best_dt_name); ++ ++ /* ++ * If one of the FIT configurations matches the most accurate DT name, ++ * update the SPL header to provide that DT name to U-Boot proper. ++ */ ++ if (ret == 0) ++ set_spl_dt_name(best_dt_name); ++ ++ return ret; ++} ++#endif +--- a/include/configs/sunxi-common.h ++++ b/include/configs/sunxi-common.h +@@ -12,7 +12,6 @@ + #ifndef _SUNXI_COMMON_CONFIG_H + #define _SUNXI_COMMON_CONFIG_H + +-#include + #include + + /* Serial & console */ diff --git a/package/boot/uboot-d1/patches/0088-sunxi-riscv-Copy-in-WIP-version-of-devicetrees.patch b/package/boot/uboot-d1/patches/0088-sunxi-riscv-Copy-in-WIP-version-of-devicetrees.patch new file mode 100644 index 00000000000000..95ed7b202718e6 --- /dev/null +++ b/package/boot/uboot-d1/patches/0088-sunxi-riscv-Copy-in-WIP-version-of-devicetrees.patch @@ -0,0 +1,1327 @@ +From 197d4096c697bcde8f9833b1d04b17eb2b232b85 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Mon, 31 Oct 2022 22:59:00 -0500 +Subject: [PATCH 88/90] sunxi: riscv: Copy in WIP version of devicetrees + +While the bindings still are not stable, this should help things work +out of the box. + +Signed-off-by: Samuel Holland +--- + .../riscv/dts/sun20i-d1-clockworkpi-v3.14.dts | 134 +++++++- + .../dts/sun20i-d1-common-regulators.dtsi | 13 + + arch/riscv/dts/sun20i-d1-devterm-v3.14.dts | 16 + + .../dts/sun20i-d1-dongshan-nezha-stu.dts | 48 ++- + .../dts/sun20i-d1-lichee-rv-86-panel-480p.dts | 51 +++ + .../dts/sun20i-d1-lichee-rv-86-panel.dtsi | 64 ++++ + arch/riscv/dts/sun20i-d1-lichee-rv-dock.dts | 98 ++++++ + arch/riscv/dts/sun20i-d1-lichee-rv.dts | 6 + + arch/riscv/dts/sun20i-d1-mangopi-mq-pro.dts | 41 +++ + arch/riscv/dts/sun20i-d1-nezha.dts | 117 ++++++- + arch/riscv/dts/sun20i-d1.dtsi | 314 +++++++++++++++++- + 11 files changed, 881 insertions(+), 21 deletions(-) + +--- a/arch/riscv/dts/sun20i-d1-clockworkpi-v3.14.dts ++++ b/arch/riscv/dts/sun20i-d1-clockworkpi-v3.14.dts +@@ -22,16 +22,78 @@ + stdout-path = "serial0:115200n8"; + }; + ++ audio_amplifier: audio-amplifier { ++ compatible = "simple-audio-amplifier"; ++ enable-gpios = <&pio 4 1 GPIO_ACTIVE_HIGH>; /* PE1/GPIO11 */ ++ sound-name-prefix = "Amplifier"; ++ VCC-supply = <®_vcc>; ++ }; ++ ++ /* ++ * FIXME: This is not really an amplifier, but the amplifier binding ++ * has the needed properties and behavior. ++ */ ++ audio_switch: audio-switch { ++ compatible = "simple-audio-amplifier"; ++ enable-gpios = <&pio 1 2 GPIO_ACTIVE_HIGH>; /* PB2/AUD_SWITCH */ ++ sound-name-prefix = "Switch"; ++ VCC-supply = <®_aldo1>; ++ }; ++ ++ backlight: backlight { ++ compatible = "pwm-backlight"; ++ power-supply = <®_vcc>; ++ pwms = <&pwm 4 50000 0>; /* PD20/GPIO9 */ ++ }; ++ ++ bt_sco_codec: bt-sco-codec { ++ #sound-dai-cells = <0>; ++ compatible = "linux,bt-sco"; ++ }; ++ ++ bt-sound { ++ compatible = "simple-audio-card"; ++ simple-audio-card,name = "Bluetooth"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ simple-audio-card,dai-link@0 { ++ format = "dsp_a"; ++ frame-master = <&bt_sound_cpu>; ++ bitclock-master = <&bt_sound_cpu>; ++ ++ bt_sound_cpu: cpu { ++ sound-dai = <&i2s1>; ++ }; ++ ++ codec { ++ sound-dai = <&bt_sco_codec>; ++ }; ++ }; ++ }; ++ ++ hdmi_connector: connector { ++ compatible = "hdmi-connector"; ++ type = "d"; ++ ++ port { ++ hdmi_connector_in: endpoint { ++ remote-endpoint = <&hdmi_out_connector>; ++ }; ++ }; ++ }; ++ + /* + * This regulator is PWM-controlled, but the PWM controller is not + * yet supported, so fix the regulator to its default voltage. + */ + reg_vdd_cpu: vdd-cpu { +- compatible = "regulator-fixed"; ++ compatible = "pwm-regulator"; ++ pwms = <&pwm 0 50000 0>; ++ pwm-supply = <®_vcc>; + regulator-name = "vdd-cpu"; +- regulator-min-microvolt = <1100000>; +- regulator-max-microvolt = <1100000>; +- vin-supply = <®_vcc>; ++ regulator-min-microvolt = <810000>; ++ regulator-max-microvolt = <1160000>; + }; + + wifi_pwrseq: wifi-pwrseq { +@@ -40,14 +102,51 @@ + }; + }; + ++&codec { ++ aux-devs = <&audio_amplifier>, <&audio_switch>; ++ hp-det-gpio = <&pio 1 12 GPIO_ACTIVE_HIGH>; /* PB12/GPIO10 */ ++ pin-switches = "Internal Speakers"; ++ routing = "Internal Speakers", "Amplifier OUTL", ++ "Internal Speakers", "Amplifier OUTR", ++ "Amplifier INL", "Switch OUTL", ++ "Amplifier INR", "Switch OUTR", ++ "Headphone Jack", "Switch OUTL", ++ "Headphone Jack", "Switch OUTR", ++ "Switch INL", "HPOUTL", ++ "Switch INR", "HPOUTR", ++ "MICIN3", "Headset Microphone", ++ "Headset Microphone", "HBIAS"; ++ widgets = "Microphone", "Headset Microphone", ++ "Headphone", "Headphone Jack", ++ "Speaker", "Internal Speakers"; ++}; ++ + &cpu0 { + cpu-supply = <®_vdd_cpu>; + }; + ++&de { ++ status = "okay"; ++}; ++ + &ehci1 { + status = "okay"; + }; + ++&hdmi { ++ status = "okay"; ++}; ++ ++&hdmi_out { ++ hdmi_out_connector: endpoint { ++ remote-endpoint = <&hdmi_connector_in>; ++ }; ++}; ++ ++&hdmi_phy { ++ status = "okay"; ++}; ++ + &i2c0 { + pinctrl-0 = <&i2c0_pb10_pins>; + pinctrl-names = "default"; +@@ -169,6 +268,12 @@ + }; + }; + ++&i2s1 { ++ pinctrl-0 = <&i2s1_clk_pins>, <&i2s1_din_pin>, <&i2s1_dout_pin>; ++ pinctrl-names = "default"; ++ status = "okay"; ++}; ++ + &mmc0 { + broken-cd; + bus-width = <4>; +@@ -205,6 +310,27 @@ + + &pio { + vcc-pg-supply = <®_ldoa>; ++ ++ i2s1_clk_pins: i2s1-clk-pins { ++ pins = "PG12", "PG13"; ++ function = "i2s1"; ++ }; ++ ++ i2s1_din_pin: i2s1-din-pin { ++ pins = "PG14"; ++ function = "i2s1_din"; ++ }; ++ ++ i2s1_dout_pin: i2s1-dout-pin { ++ pins = "PG15"; ++ function = "i2s1_dout"; ++ }; ++}; ++ ++&pwm { ++ pinctrl-0 = <&pwm0_pd16_pin>, <&pwm4_pd20_pin>; ++ pinctrl-names = "default"; ++ status = "okay"; + }; + + &uart0 { +--- a/arch/riscv/dts/sun20i-d1-common-regulators.dtsi ++++ b/arch/riscv/dts/sun20i-d1-common-regulators.dtsi +@@ -18,6 +18,15 @@ + }; + }; + ++&codec { ++ avcc-supply = <®_aldo>; ++ hpvcc-supply = <®_hpldo>; ++}; ++ ++&hdmi { ++ hvcc-supply = <®_ldoa>; ++}; ++ + &lradc { + vref-supply = <®_aldo>; + }; +@@ -49,3 +58,7 @@ + regulator-max-microvolt = <1800000>; + ldo-in-supply = <®_vcc_3v3>; + }; ++ ++&ths { ++ vref-supply = <®_aldo>; ++}; +--- a/arch/riscv/dts/sun20i-d1-devterm-v3.14.dts ++++ b/arch/riscv/dts/sun20i-d1-devterm-v3.14.dts +@@ -35,3 +35,19 @@ + }; + }; + }; ++ ++&dsi { ++ pinctrl-0 = <&dsi_4lane_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++ ++ panel@0 { ++ compatible = "clockwork,cwd686"; ++ reg = <0>; ++ backlight = <&backlight>; ++ reset-gpios = <&pio 3 19 GPIO_ACTIVE_LOW>; /* PD19/GPIO8 */ ++ rotation = <90>; ++ iovcc-supply = <®_dcdc3>; ++ vci-supply = <®_aldo2>; ++ }; ++}; +--- a/arch/riscv/dts/sun20i-d1-dongshan-nezha-stu.dts ++++ b/arch/riscv/dts/sun20i-d1-dongshan-nezha-stu.dts +@@ -23,6 +23,17 @@ + stdout-path = "serial0:115200n8"; + }; + ++ hdmi_connector: connector { ++ compatible = "hdmi-connector"; ++ type = "a"; ++ ++ port { ++ hdmi_connector_in: endpoint { ++ remote-endpoint = <&hdmi_out_connector>; ++ }; ++ }; ++ }; ++ + leds { + compatible = "gpio-leds"; + +@@ -43,16 +54,13 @@ + vin-supply = <®_vcc>; + }; + +- /* +- * This regulator is PWM-controlled, but the PWM controller is not +- * yet supported, so fix the regulator to its default voltage. +- */ + reg_vdd_cpu: vdd-cpu { +- compatible = "regulator-fixed"; ++ compatible = "pwm-regulator"; ++ pwms = <&pwm 0 50000 0>; ++ pwm-supply = <®_vcc>; + regulator-name = "vdd-cpu"; +- regulator-min-microvolt = <1100000>; +- regulator-max-microvolt = <1100000>; +- vin-supply = <®_vcc>; ++ regulator-min-microvolt = <810000>; ++ regulator-max-microvolt = <1160000>; + }; + }; + +@@ -60,6 +68,10 @@ + cpu-supply = <®_vdd_cpu>; + }; + ++&de { ++ status = "okay"; ++}; ++ + &ehci0 { + status = "okay"; + }; +@@ -73,6 +85,20 @@ + status = "okay"; + }; + ++&hdmi { ++ status = "okay"; ++}; ++ ++&hdmi_out { ++ hdmi_out_connector: endpoint { ++ remote-endpoint = <&hdmi_connector_in>; ++ }; ++}; ++ ++&hdmi_phy { ++ status = "okay"; ++}; ++ + &mdio { + ext_rgmii_phy: ethernet-phy@1 { + compatible = "ethernet-phy-ieee802.3-c22"; +@@ -95,6 +121,12 @@ + status = "okay"; + }; + ++&pwm { ++ pinctrl-0 = <&pwm0_pd16_pin>; ++ pinctrl-names = "default"; ++ status = "okay"; ++}; ++ + &uart0 { + pinctrl-0 = <&uart0_pb8_pins>; + pinctrl-names = "default"; +--- a/arch/riscv/dts/sun20i-d1-lichee-rv-86-panel-480p.dts ++++ b/arch/riscv/dts/sun20i-d1-lichee-rv-86-panel-480p.dts +@@ -7,6 +7,40 @@ + model = "Sipeed Lichee RV 86 Panel (480p)"; + compatible = "sipeed,lichee-rv-86-panel-480p", "sipeed,lichee-rv", + "allwinner,sun20i-d1"; ++ ++ backlight: backlight { ++ compatible = "pwm-backlight"; ++ power-supply = <®_vcc>; ++ pwms = <&pwm 7 50000 0>; ++ }; ++ ++ spi { ++ compatible = "spi-gpio"; ++ cs-gpios = <&pio 4 14 GPIO_ACTIVE_LOW>; /* PE14 */ ++ mosi-gpios = <&pio 4 12 GPIO_ACTIVE_HIGH>; /* PE12 */ ++ sck-gpios = <&pio 4 15 GPIO_ACTIVE_HIGH>; /* PE15 */ ++ num-chipselects = <1>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ panel@0 { ++ compatible = "sitronix,st7701s"; ++ reg = <0>; ++ backlight = <&backlight>; ++ reset-gpios = <&pio 6 13 GPIO_ACTIVE_LOW>; /* PG13 */ ++ spi-3wire; ++ ++ port { ++ panel_in_tcon_lcd0: endpoint { ++ remote-endpoint = <&tcon_lcd0_out_panel>; ++ }; ++ }; ++ }; ++ }; ++}; ++ ++&de { ++ status = "okay"; + }; + + &i2c2 { +@@ -27,3 +61,20 @@ + wakeup-source; + }; + }; ++ ++&pwm { ++ pinctrl-0 = <&pwm7_pd22_pin>; ++ pinctrl-names = "default"; ++ status = "okay"; ++}; ++ ++&tcon_lcd0 { ++ pinctrl-0 = <&lcd_rgb666_pins>; ++ pinctrl-names = "default"; ++}; ++ ++&tcon_lcd0_out { ++ tcon_lcd0_out_panel: endpoint { ++ remote-endpoint = <&panel_in_tcon_lcd0>; ++ }; ++}; +--- a/arch/riscv/dts/sun20i-d1-lichee-rv-86-panel.dtsi ++++ b/arch/riscv/dts/sun20i-d1-lichee-rv-86-panel.dtsi +@@ -9,6 +9,39 @@ + ethernet1 = &xr829; + }; + ++ audio_amplifier: audio-amplifier { ++ compatible = "simple-audio-amplifier"; ++ enable-gpios = <&pio 1 10 GPIO_ACTIVE_HIGH>; /* PB10 */ ++ sound-name-prefix = "Amplifier"; ++ }; ++ ++ dmic_codec: dmic-codec { ++ compatible = "dmic-codec"; ++ num-channels = <2>; ++ #sound-dai-cells = <0>; ++ }; ++ ++ dmic-sound { ++ compatible = "simple-audio-card"; ++ simple-audio-card,name = "DMIC"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ simple-audio-card,dai-link@0 { ++ format = "pdm"; ++ frame-master = <&link0_cpu>; ++ bitclock-master = <&link0_cpu>; ++ ++ link0_cpu: cpu { ++ sound-dai = <&dmic>; ++ }; ++ ++ link0_codec: codec { ++ sound-dai = <&dmic_codec>; ++ }; ++ }; ++ }; ++ + /* PC1 is repurposed as BT_WAKE_AP */ + /delete-node/ leds; + +@@ -24,6 +57,27 @@ + }; + }; + ++&codec { ++ aux-devs = <&audio_amplifier>; ++ routing = "Internal Speaker", "Amplifier OUTL", ++ "Internal Speaker", "Amplifier OUTR", ++ "Amplifier INL", "HPOUTL", ++ "Amplifier INR", "HPOUTR", ++ "LINEINL", "HPOUTL", ++ "LINEINR", "HPOUTR", ++ "MICIN3", "Internal Microphone", ++ "Internal Microphone", "HBIAS"; ++ widgets = "Microphone", "Internal Microphone", ++ "Speaker", "Internal Speaker"; ++ status = "okay"; ++}; ++ ++&dmic { ++ pinctrl-0 = <&dmic_pb11_d0_pin>, <&dmic_pe17_clk_pin>; ++ pinctrl-names = "default"; ++ status = "okay"; ++}; ++ + &ehci1 { + status = "okay"; + }; +@@ -69,6 +123,16 @@ + pins = "PG11"; + function = "clk"; + }; ++ ++ dmic_pb11_d0_pin: dmic-pb11-d0-pin { ++ pins = "PB11"; ++ function = "dmic"; ++ }; ++ ++ dmic_pe17_clk_pin: dmic-pe17-clk-pin { ++ pins = "PE17"; ++ function = "dmic"; ++ }; + }; + + &uart1 { +--- a/arch/riscv/dts/sun20i-d1-lichee-rv-dock.dts ++++ b/arch/riscv/dts/sun20i-d1-lichee-rv-dock.dts +@@ -15,16 +15,102 @@ + ethernet1 = &rtl8723ds; + }; + ++ dmic_codec: dmic-codec { ++ compatible = "dmic-codec"; ++ num-channels = <2>; ++ #sound-dai-cells = <0>; ++ }; ++ ++ dmic-sound { ++ compatible = "simple-audio-card"; ++ simple-audio-card,name = "DMIC"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ simple-audio-card,dai-link@0 { ++ format = "pdm"; ++ frame-master = <&link0_cpu>; ++ bitclock-master = <&link0_cpu>; ++ ++ link0_cpu: cpu { ++ sound-dai = <&dmic>; ++ }; ++ ++ link0_codec: codec { ++ sound-dai = <&dmic_codec>; ++ }; ++ }; ++ }; ++ ++ hdmi_connector: connector { ++ compatible = "hdmi-connector"; ++ type = "a"; ++ ++ port { ++ hdmi_connector_in: endpoint { ++ remote-endpoint = <&hdmi_out_connector>; ++ }; ++ }; ++ }; ++ + wifi_pwrseq: wifi-pwrseq { + compatible = "mmc-pwrseq-simple"; + reset-gpios = <&pio 6 12 GPIO_ACTIVE_LOW>; /* PG12 */ + }; + }; + ++&codec { ++ routing = "Internal Speaker", "HPOUTL", ++ "Internal Speaker", "HPOUTR", ++ "LINEINL", "HPOUTL", ++ "LINEINR", "HPOUTR", ++ "MICIN3", "Internal Microphone", ++ "Internal Microphone", "HBIAS"; ++ widgets = "Microphone", "Internal Microphone", ++ "Speaker", "Internal Speaker"; ++ status = "okay"; ++}; ++ ++&de { ++ status = "okay"; ++}; ++ ++&dmic { ++ pinctrl-0 = <&dmic_pb11_d0_pin>, <&dmic_pe17_clk_pin>; ++ pinctrl-names = "default"; ++ status = "okay"; ++}; ++ + &ehci1 { + status = "okay"; + }; + ++&hdmi { ++ status = "okay"; ++}; ++ ++&hdmi_out { ++ hdmi_out_connector: endpoint { ++ remote-endpoint = <&hdmi_connector_in>; ++ }; ++}; ++ ++&hdmi_phy { ++ status = "okay"; ++}; ++ ++&ledc { ++ pinctrl-0 = <&ledc_pc0_pin>; ++ pinctrl-names = "default"; ++ status = "okay"; ++ ++ multi-led@0 { ++ reg = <0x0>; ++ color = ; ++ function = LED_FUNCTION_STATUS; ++ }; ++}; ++ + &lradc { + status = "okay"; + +@@ -55,6 +141,18 @@ + status = "okay"; + }; + ++&pio { ++ dmic_pb11_d0_pin: dmic-pb11-d0-pin { ++ pins = "PB11"; ++ function = "dmic"; ++ }; ++ ++ dmic_pe17_clk_pin: dmic-pe17-clk-pin { ++ pins = "PE17"; ++ function = "dmic"; ++ }; ++}; ++ + &uart1 { + uart-has-rtscts; + pinctrl-0 = <&uart1_pg6_pins>, <&uart1_pg8_rts_cts_pins>; +--- a/arch/riscv/dts/sun20i-d1-lichee-rv.dts ++++ b/arch/riscv/dts/sun20i-d1-lichee-rv.dts +@@ -65,6 +65,12 @@ + status = "okay"; + }; + ++&spi0 { ++ pinctrl-0 = <&spi0_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++}; ++ + &uart0 { + pinctrl-0 = <&uart0_pb8_pins>; + pinctrl-names = "default"; +--- a/arch/riscv/dts/sun20i-d1-mangopi-mq-pro.dts ++++ b/arch/riscv/dts/sun20i-d1-mangopi-mq-pro.dts +@@ -4,6 +4,7 @@ + /dts-v1/; + + #include ++#include + + #include "sun20i-d1.dtsi" + #include "sun20i-d1-common-regulators.dtsi" +@@ -22,6 +23,28 @@ + stdout-path = "serial0:115200n8"; + }; + ++ hdmi_connector: connector { ++ compatible = "hdmi-connector"; ++ type = "c"; ++ ++ port { ++ hdmi_connector_in: endpoint { ++ remote-endpoint = <&hdmi_out_connector>; ++ }; ++ }; ++ }; ++ ++ leds { ++ compatible = "pwm-leds"; ++ ++ led { ++ color = ; ++ function = LED_FUNCTION_STATUS; ++ max-brightness = <255>; ++ pwms = <&pwm 2 50000 0>; ++ }; ++ }; ++ + reg_avdd2v8: avdd2v8 { + compatible = "regulator-fixed"; + regulator-name = "avdd2v8"; +@@ -56,10 +79,28 @@ + cpu-supply = <®_vdd_cpu>; + }; + ++&de { ++ status = "okay"; ++}; ++ + &ehci1 { + status = "okay"; + }; + ++&hdmi { ++ status = "okay"; ++}; ++ ++&hdmi_out { ++ hdmi_out_connector: endpoint { ++ remote-endpoint = <&hdmi_connector_in>; ++ }; ++}; ++ ++&hdmi_phy { ++ status = "okay"; ++}; ++ + &mmc0 { + bus-width = <4>; + cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; /* PF6 */ +--- a/arch/riscv/dts/sun20i-d1-nezha.dts ++++ b/arch/riscv/dts/sun20i-d1-nezha.dts +@@ -5,6 +5,7 @@ + + #include + #include ++#include + + #include "sun20i-d1.dtsi" + #include "sun20i-d1-common-regulators.dtsi" +@@ -18,12 +19,24 @@ + ethernet1 = &xr829; + mmc0 = &mmc0; + serial0 = &uart0; ++ spi0 = &spi0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + ++ hdmi_connector: connector { ++ compatible = "hdmi-connector"; ++ type = "a"; ++ ++ port { ++ hdmi_connector_in: endpoint { ++ remote-endpoint = <&hdmi_out_connector>; ++ }; ++ }; ++ }; ++ + reg_usbvbus: usbvbus { + compatible = "regulator-fixed"; + regulator-name = "usbvbus"; +@@ -34,16 +47,13 @@ + vin-supply = <®_vcc>; + }; + +- /* +- * This regulator is PWM-controlled, but the PWM controller is not +- * yet supported, so fix the regulator to its default voltage. +- */ + reg_vdd_cpu: vdd-cpu { +- compatible = "regulator-fixed"; ++ compatible = "pwm-regulator"; ++ pwms = <&pwm 0 50000 0>; ++ pwm-supply = <®_vcc>; + regulator-name = "vdd-cpu"; +- regulator-min-microvolt = <1100000>; +- regulator-max-microvolt = <1100000>; +- vin-supply = <®_vcc>; ++ regulator-min-microvolt = <810000>; ++ regulator-max-microvolt = <1160000>; + }; + + wifi_pwrseq: wifi-pwrseq { +@@ -52,10 +62,26 @@ + }; + }; + ++&codec { ++ routing = "Headphone Jack", "HPOUTL", ++ "Headphone Jack", "HPOUTR", ++ "LINEINL", "HPOUTL", ++ "LINEINR", "HPOUTR", ++ "MICIN3", "Headset Microphone", ++ "Headset Microphone", "HBIAS"; ++ widgets = "Microphone", "Headset Microphone", ++ "Headphone", "Headphone Jack"; ++ status = "okay"; ++}; ++ + &cpu0 { + cpu-supply = <®_vdd_cpu>; + }; + ++&de { ++ status = "okay"; ++}; ++ + &ehci0 { + status = "okay"; + }; +@@ -73,6 +99,20 @@ + status = "okay"; + }; + ++&hdmi { ++ status = "okay"; ++}; ++ ++&hdmi_out { ++ hdmi_out_connector: endpoint { ++ remote-endpoint = <&hdmi_connector_in>; ++ }; ++}; ++ ++&hdmi_phy { ++ status = "okay"; ++}; ++ + &i2c2 { + pinctrl-0 = <&i2c2_pb0_pins>; + pinctrl-names = "default"; +@@ -90,6 +130,18 @@ + }; + }; + ++&ledc { ++ pinctrl-0 = <&ledc_pc0_pin>; ++ pinctrl-names = "default"; ++ status = "okay"; ++ ++ multi-led@0 { ++ reg = <0x0>; ++ color = ; ++ function = LED_FUNCTION_STATUS; ++ }; ++}; ++ + &lradc { + status = "okay"; + +@@ -142,6 +194,55 @@ + status = "okay"; + }; + ++&pwm { ++ pinctrl-0 = <&pwm0_pd16_pin>; ++ pinctrl-names = "default"; ++ status = "okay"; ++}; ++ ++&spi0 { ++ pinctrl-0 = <&spi0_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++ ++ flash@0 { ++ compatible = "spi-nand"; ++ reg = <0>; ++ ++ partitions { ++ compatible = "fixed-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ partition@0 { ++ label = "boot0"; ++ reg = <0x00000000 0x00100000>; ++ }; ++ ++ partition@100000 { ++ label = "uboot"; ++ reg = <0x00100000 0x00300000>; ++ }; ++ ++ partition@400000 { ++ label = "secure_storage"; ++ reg = <0x00400000 0x00100000>; ++ }; ++ ++ partition@500000 { ++ label = "sys"; ++ reg = <0x00500000 0x0fb00000>; ++ }; ++ }; ++ }; ++}; ++ ++&spi1 { ++ pinctrl-0 = <&spi1_pd_pins>; ++ pinctrl-names = "default"; ++ status = "okay"; ++}; ++ + &uart0 { + pinctrl-0 = <&uart0_pb8_pins>; + pinctrl-names = "default"; +--- a/arch/riscv/dts/sun20i-d1.dtsi ++++ b/arch/riscv/dts/sun20i-d1.dtsi +@@ -59,6 +59,35 @@ + #clock-cells = <0>; + }; + ++ thermal-zones { ++ cpu-thermal { ++ polling-delay = <0>; ++ polling-delay-passive = <0>; ++ thermal-sensors = <&ths>; ++ ++ trips { ++ cpu_target: cpu-target { ++ hysteresis = <3000>; ++ temperature = <85000>; ++ type = "passive"; ++ }; ++ ++ cpu-crit { ++ hysteresis = <0>; ++ temperature = <110000>; ++ type = "critical"; ++ }; ++ }; ++ ++ cooling-maps { ++ map0 { ++ trip = <&cpu_target>; ++ cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; ++ }; ++ }; ++ }; ++ }; ++ + soc { + compatible = "simple-bus"; + ranges; +@@ -95,6 +124,14 @@ + #interrupt-cells = <3>; + + /omit-if-no-ref/ ++ dsi_4lane_pins: dsi-4lane-pins { ++ pins = "PD0", "PD1", "PD2", "PD3", "PD4", "PD5", ++ "PD6", "PD7", "PD8", "PD9"; ++ drive-strength = <30>; ++ function = "dsi"; ++ }; ++ ++ /omit-if-no-ref/ + i2c0_pb10_pins: i2c0-pb10-pins { + pins = "PB10", "PB11"; + function = "i2c0"; +@@ -116,6 +153,12 @@ + }; + + /omit-if-no-ref/ ++ ledc_pc0_pin: ledc-pc0-pin { ++ pins = "PC0"; ++ function = "ledc"; ++ }; ++ ++ /omit-if-no-ref/ + mmc0_pins: mmc0-pins { + pins = "PF0", "PF1", "PF2", "PF3", "PF4", "PF5"; + function = "mmc0"; +@@ -149,6 +192,48 @@ + }; + + /omit-if-no-ref/ ++ pwm0_pd16_pin: pwm0-pd16-pin { ++ pins = "PD16"; ++ function = "pwm0"; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm2_pd18_pin: pwm2-pd18-pin { ++ pins = "PD18"; ++ function = "pwm2"; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm4_pd20_pin: pwm4-pd20-pin { ++ pins = "PD20"; ++ function = "pwm4"; ++ }; ++ ++ /omit-if-no-ref/ ++ pwm7_pd22_pin: pwm7-pd22-pin { ++ pins = "PD22"; ++ function = "pwm7"; ++ }; ++ ++ /omit-if-no-ref/ ++ spi0_pins: spi0-pins { ++ pins = "PC2", "PC3", "PC4", "PC5", "PC6", "PC7"; ++ function = "spi0"; ++ }; ++ ++ /omit-if-no-ref/ ++ spi1_pb_pins: spi1-pb-pins { ++ pins = "PB0", "PB8", "PB9", "PB10", "PB11", "PB12"; ++ function = "spi1"; ++ }; ++ ++ /omit-if-no-ref/ ++ spi1_pd_pins: spi1-pd-pins { ++ pins = "PD10", "PD11", "PD12", "PD13", "PD14", "PD15"; ++ function = "spi1"; ++ }; ++ ++ /omit-if-no-ref/ + uart0_pb8_pins: uart0-pb8-pins { + pins = "PB8", "PB9"; + function = "uart0"; +@@ -167,6 +252,17 @@ + }; + }; + ++ pwm: pwm@2000c00 { ++ compatible = "allwinner,sun20i-d1-pwm"; ++ reg = <0x2000c00 0x400>; ++ interrupts = <34 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&ccu CLK_BUS_PWM>, <&osc24M>; ++ clock-names = "bus", "mod"; ++ resets = <&ccu RST_BUS_PWM>; ++ status = "disabled"; ++ #pwm-cells = <3>; ++ }; ++ + ccu: clock-controller@2001000 { + compatible = "allwinner,sun20i-d1-ccu"; + reg = <0x2001000 0x1000>; +@@ -178,6 +274,33 @@ + #reset-cells = <1>; + }; + ++ ledc: led-controller@2008000 { ++ compatible = "allwinner,sun20i-d1-ledc", ++ "allwinner,sun50i-a100-ledc"; ++ reg = <0x2008000 0x400>; ++ interrupts = <36 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&ccu CLK_BUS_LEDC>, <&ccu CLK_LEDC>; ++ clock-names = "bus", "mod"; ++ resets = <&ccu RST_BUS_LEDC>; ++ dmas = <&dma 42>; ++ dma-names = "tx"; ++ status = "disabled"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ }; ++ ++ ths: temperature-sensor@2009400 { ++ compatible = "allwinner,sun20i-d1-ths"; ++ reg = <0x2009400 0x400>; ++ interrupts = <74 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&ccu CLK_BUS_THS>, <&osc24M>; ++ clock-names = "bus", "mod"; ++ resets = <&ccu RST_BUS_THS>; ++ nvmem-cells = <&ths_calib>; ++ nvmem-cell-names = "calibration"; ++ #thermal-sensor-cells = <0>; ++ }; ++ + lradc: keys@2009800 { + compatible = "allwinner,sun20i-d1-lradc", + "allwinner,sun50i-r329-lradc"; +@@ -188,11 +311,30 @@ + status = "disabled"; + }; + ++ iommu: iommu@2010000 { ++ compatible = "allwinner,sun20i-d1-iommu"; ++ reg = <0x2010000 0x10000>; ++ interrupts = <80 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&ccu CLK_BUS_IOMMU>; ++ #iommu-cells = <1>; ++ }; ++ + codec: audio-codec@2030000 { +- compatible = "simple-mfd", "syscon"; ++ compatible = "allwinner,sun20i-d1-codec", "simple-mfd", "syscon"; + reg = <0x2030000 0x1000>; ++ interrupts = <41 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&ccu CLK_BUS_AUDIO>, ++ <&ccu CLK_AUDIO_ADC>, ++ <&ccu CLK_AUDIO_DAC>, ++ <&osc24M>, ++ <&rtc CLK_OSC32K>; ++ clock-names = "bus", "adc", "dac", "hosc", "losc"; ++ resets = <&ccu RST_BUS_AUDIO>; ++ dmas = <&dma 7>, <&dma 7>; ++ dma-names = "rx", "tx"; + #address-cells = <1>; + #size-cells = <1>; ++ #sound-dai-cells = <0>; + + regulators@2030348 { + compatible = "allwinner,sun20i-d1-analog-ldos"; +@@ -208,6 +350,21 @@ + }; + }; + ++ dmic: dmic@2031000 { ++ compatible = "allwinner,sun20i-d1-dmic", ++ "allwinner,sun50i-h6-dmic"; ++ reg = <0x2031000 0x400>; ++ interrupts = <40 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&ccu CLK_BUS_DMIC>, ++ <&ccu CLK_DMIC>; ++ clock-names = "bus", "mod"; ++ resets = <&ccu RST_BUS_DMIC>; ++ dmas = <&dma 8>; ++ dma-names = "rx"; ++ status = "disabled"; ++ #sound-dai-cells = <0>; ++ }; ++ + i2s0: i2s@2032000 { + compatible = "allwinner,sun20i-d1-i2s", + "allwinner,sun50i-r329-i2s"; +@@ -238,6 +395,7 @@ + #sound-dai-cells = <0>; + }; + ++ // TODO: how to integrate ASRC? same or separate node? + i2s2: i2s@2034000 { + compatible = "allwinner,sun20i-d1-i2s", + "allwinner,sun50i-r329-i2s"; +@@ -253,6 +411,22 @@ + #sound-dai-cells = <0>; + }; + ++ // TODO: add receive functionality ++ spdif: spdif@2036000 { ++ compatible = "allwinner,sun20i-d1-spdif"; ++ reg = <0x2036000 0x400>; ++ interrupts = <39 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&ccu CLK_BUS_SPDIF>, ++ <&ccu CLK_SPDIF_RX>, ++ <&ccu CLK_SPDIF_TX>; ++ clock-names = "apb", "rx", "tx"; ++ resets = <&ccu RST_BUS_SPDIF>; ++ dmas = <&dma 2>, <&dma 2>; ++ dma-names = "rx", "tx"; ++ status = "disabled"; ++ #sound-dai-cells = <0>; ++ }; ++ + timer: timer@2050000 { + compatible = "allwinner,sun20i-d1-timer", + "allwinner,sun8i-a23-timer"; +@@ -457,6 +631,18 @@ + }; + }; + ++ crypto: crypto@3040000 { ++ compatible = "allwinner,sun20i-d1-crypto"; ++ reg = <0x3040000 0x800>; ++ interrupts = <68 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&ccu CLK_BUS_CE>, ++ <&ccu CLK_CE>, ++ <&ccu CLK_MBUS_CE>, ++ <&rtc CLK_IOSC>; ++ clock-names = "bus", "mod", "ram", "trng"; ++ resets = <&ccu RST_BUS_CE>; ++ }; ++ + mbus: dram-controller@3102000 { + compatible = "allwinner,sun20i-d1-mbus"; + reg = <0x3102000 0x1000>, +@@ -525,6 +711,39 @@ + #size-cells = <0>; + }; + ++ spi0: spi@4025000 { ++ compatible = "allwinner,sun20i-d1-spi", ++ "allwinner,sun50i-r329-spi"; ++ reg = <0x4025000 0x1000>; ++ interrupts = <31 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&ccu CLK_BUS_SPI0>, <&ccu CLK_SPI0>; ++ clock-names = "ahb", "mod"; ++ resets = <&ccu RST_BUS_SPI0>; ++ dmas = <&dma 22>, <&dma 22>; ++ dma-names = "rx", "tx"; ++ num-cs = <1>; ++ status = "disabled"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ }; ++ ++ spi1: spi@4026000 { ++ compatible = "allwinner,sun20i-d1-spi-dbi", ++ "allwinner,sun50i-r329-spi-dbi", ++ "allwinner,sun50i-r329-spi"; ++ reg = <0x4026000 0x1000>; ++ interrupts = <32 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&ccu CLK_BUS_SPI1>, <&ccu CLK_SPI1>; ++ clock-names = "ahb", "mod"; ++ resets = <&ccu RST_BUS_SPI1>; ++ dmas = <&dma 23>, <&dma 23>; ++ dma-names = "rx", "tx"; ++ num-cs = <1>; ++ status = "disabled"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ }; ++ + usb_otg: usb@4100000 { + compatible = "allwinner,sun20i-d1-musb", + "allwinner,sun8i-a33-musb"; +@@ -653,6 +872,7 @@ + <&display_clocks CLK_MIXER0>; + clock-names = "bus", "mod"; + resets = <&display_clocks RST_MIXER0>; ++ iommus = <&iommu 2>; + + ports { + #address-cells = <1>; +@@ -675,6 +895,7 @@ + <&display_clocks CLK_MIXER1>; + clock-names = "bus", "mod"; + resets = <&display_clocks RST_MIXER1>; ++ iommus = <&iommu 2>; + + ports { + #address-cells = <1>; +@@ -690,6 +911,40 @@ + }; + }; + ++ dsi: dsi@5450000 { ++ compatible = "allwinner,sun20i-d1-mipi-dsi", ++ "allwinner,sun50i-a100-mipi-dsi"; ++ reg = <0x5450000 0x1000>; ++ interrupts = <108 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&ccu CLK_BUS_MIPI_DSI>, ++ <&tcon_top CLK_TCON_TOP_DSI>; ++ clock-names = "bus", "mod"; ++ resets = <&ccu RST_BUS_MIPI_DSI>; ++ phys = <&dphy>; ++ phy-names = "dphy"; ++ status = "disabled"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ port { ++ dsi_in_tcon_lcd0: endpoint { ++ remote-endpoint = <&tcon_lcd0_out_dsi>; ++ }; ++ }; ++ }; ++ ++ dphy: phy@5451000 { ++ compatible = "allwinner,sun20i-d1-mipi-dphy", ++ "allwinner,sun50i-a100-mipi-dphy"; ++ reg = <0x5451000 0x1000>; ++ interrupts = <108 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&ccu CLK_BUS_MIPI_DSI>, ++ <&ccu CLK_MIPI_DSI>; ++ clock-names = "bus", "mod"; ++ resets = <&ccu RST_BUS_MIPI_DSI>; ++ #phy-cells = <0>; ++ }; ++ + tcon_top: tcon-top@5460000 { + compatible = "allwinner,sun20i-d1-tcon-top"; + reg = <0x5460000 0x1000>; +@@ -770,6 +1025,10 @@ + + tcon_top_hdmi_out: port@5 { + reg = <5>; ++ ++ tcon_top_hdmi_out_hdmi: endpoint { ++ remote-endpoint = <&hdmi_in_tcon_top>; ++ }; + }; + }; + }; +@@ -785,6 +1044,8 @@ + resets = <&ccu RST_BUS_TCON_LCD0>, + <&ccu RST_BUS_LVDS0>; + reset-names = "lcd", "lvds"; ++ phys = <&dphy>; ++ phy-names = "lvds0"; + #clock-cells = <0>; + + ports { +@@ -809,6 +1070,13 @@ + + tcon_lcd0_out: port@1 { + reg = <1>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ tcon_lcd0_out_dsi: endpoint@1 { ++ reg = <1>; ++ remote-endpoint = <&dsi_in_tcon_lcd0>; ++ }; + }; + }; + }; +@@ -853,6 +1121,50 @@ + }; + }; + ++ hdmi: hdmi@5500000 { ++ compatible = "allwinner,sun20i-d1-dw-hdmi"; ++ reg = <0x5500000 0x10000>; ++ reg-io-width = <1>; ++ interrupts = <109 IRQ_TYPE_LEVEL_HIGH>; ++ clocks = <&ccu CLK_BUS_HDMI>, ++ <&ccu CLK_HDMI_24M>, ++ <&ccu CLK_HDMI_CEC>; ++ clock-names = "iahb", "isfr", "cec"; ++ resets = <&ccu RST_BUS_HDMI_SUB>; ++ reset-names = "ctrl"; ++ phys = <&hdmi_phy>; ++ phy-names = "phy"; ++ status = "disabled"; ++ ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ port@0 { ++ reg = <0>; ++ ++ hdmi_in_tcon_top: endpoint { ++ remote-endpoint = <&tcon_top_hdmi_out_hdmi>; ++ }; ++ }; ++ ++ hdmi_out: port@1 { ++ reg = <1>; ++ }; ++ }; ++ }; ++ ++ hdmi_phy: phy@5510000 { ++ compatible = "allwinner,sun20i-d1-hdmi-phy"; ++ reg = <0x5510000 0x10000>; ++ clocks = <&ccu CLK_BUS_HDMI>, <&ccu CLK_HDMI_24M>; ++ clock-names = "bus", "mod"; ++ resets = <&ccu RST_BUS_HDMI_MAIN>; ++ reset-names = "phy"; ++ status = "disabled"; ++ #phy-cells = <0>; ++ }; ++ + riscv_wdt: watchdog@6011000 { + compatible = "allwinner,sun20i-d1-wdt"; + reg = <0x6011000 0x20>; diff --git a/package/boot/uboot-d1/patches/0089-sunxi-riscv-Add-defconfigs-for-several-boards.patch b/package/boot/uboot-d1/patches/0089-sunxi-riscv-Add-defconfigs-for-several-boards.patch new file mode 100644 index 00000000000000..a1c2ac9ad90d92 --- /dev/null +++ b/package/boot/uboot-d1/patches/0089-sunxi-riscv-Add-defconfigs-for-several-boards.patch @@ -0,0 +1,108 @@ +From 0a4e7a1a19dd505bc5b6ff887b2ce39983aaa92d Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Mon, 31 Oct 2022 23:27:08 -0500 +Subject: [PATCH 89/90] sunxi: riscv: Add defconfigs for several boards + +Signed-off-by: Samuel Holland +--- + configs/devterm_r_01_defconfig | 10 ++++++++++ + configs/dongshan_nezha_stu_defconfig | 13 +++++++++++++ + configs/lichee_rv_86_panel_defconfig | 13 +++++++++++++ + configs/lichee_rv_dock_defconfig | 10 ++++++++++ + configs/mangopi_mq_pro_defconfig | 10 ++++++++++ + configs/nezha_defconfig | 13 +++++++++++++ + 6 files changed, 69 insertions(+) + create mode 100644 configs/devterm_r_01_defconfig + create mode 100644 configs/dongshan_nezha_stu_defconfig + create mode 100644 configs/lichee_rv_86_panel_defconfig + create mode 100644 configs/lichee_rv_dock_defconfig + create mode 100644 configs/mangopi_mq_pro_defconfig + create mode 100644 configs/nezha_defconfig + +--- /dev/null ++++ b/configs/devterm_r_01_defconfig +@@ -0,0 +1,10 @@ ++CONFIG_RISCV=y ++CONFIG_DEFAULT_DEVICE_TREE="sun20i-d1-devterm-v3.14" ++CONFIG_TARGET_SUN20I_D1=y ++CONFIG_ARCH_RV64I=y ++CONFIG_RISCV_SMODE=y ++# CONFIG_SPL_SMP is not set ++CONFIG_SYS_SPL_MALLOC=y ++CONFIG_SPL_OPENSBI_SCRATCH_OPTIONS=0x0 ++# CONFIG_SYS_I2C_MVTWSI is not set ++CONFIG_DM_REGULATOR_FIXED=y +--- /dev/null ++++ b/configs/dongshan_nezha_stu_defconfig +@@ -0,0 +1,13 @@ ++CONFIG_RISCV=y ++CONFIG_DEFAULT_DEVICE_TREE="sun20i-d1-dongshan-nezha-stu" ++CONFIG_TARGET_SUN20I_D1=y ++CONFIG_ARCH_RV64I=y ++CONFIG_RISCV_SMODE=y ++# CONFIG_SPL_SMP is not set ++CONFIG_SYS_SPL_MALLOC=y ++CONFIG_SPL_OPENSBI_SCRATCH_OPTIONS=0x0 ++CONFIG_NET_RANDOM_ETHADDR=y ++# CONFIG_SYS_I2C_MVTWSI is not set ++CONFIG_PHY_REALTEK=y ++CONFIG_SUN8I_EMAC=y ++CONFIG_DM_REGULATOR_FIXED=y +--- /dev/null ++++ b/configs/lichee_rv_86_panel_defconfig +@@ -0,0 +1,13 @@ ++CONFIG_RISCV=y ++CONFIG_DEFAULT_DEVICE_TREE="sun20i-d1-lichee-rv-86-panel-480p" ++CONFIG_TARGET_SUN20I_D1=y ++CONFIG_ARCH_RV64I=y ++CONFIG_RISCV_SMODE=y ++# CONFIG_SPL_SMP is not set ++CONFIG_SYS_SPL_MALLOC=y ++CONFIG_SPL_OPENSBI_SCRATCH_OPTIONS=0x0 ++CONFIG_NET_RANDOM_ETHADDR=y ++# CONFIG_SYS_I2C_MVTWSI is not set ++CONFIG_PHY_REALTEK=y ++CONFIG_SUN8I_EMAC=y ++CONFIG_DM_REGULATOR_FIXED=y +--- /dev/null ++++ b/configs/lichee_rv_dock_defconfig +@@ -0,0 +1,10 @@ ++CONFIG_RISCV=y ++CONFIG_DEFAULT_DEVICE_TREE="sun20i-d1-lichee-rv-dock" ++CONFIG_TARGET_SUN20I_D1=y ++CONFIG_ARCH_RV64I=y ++CONFIG_RISCV_SMODE=y ++# CONFIG_SPL_SMP is not set ++CONFIG_SYS_SPL_MALLOC=y ++CONFIG_SPL_OPENSBI_SCRATCH_OPTIONS=0x0 ++# CONFIG_SYS_I2C_MVTWSI is not set ++CONFIG_DM_REGULATOR_FIXED=y +--- /dev/null ++++ b/configs/mangopi_mq_pro_defconfig +@@ -0,0 +1,10 @@ ++CONFIG_RISCV=y ++CONFIG_DEFAULT_DEVICE_TREE="sun20i-d1-mangopi-mq-pro" ++CONFIG_TARGET_SUN20I_D1=y ++CONFIG_ARCH_RV64I=y ++CONFIG_RISCV_SMODE=y ++# CONFIG_SPL_SMP is not set ++CONFIG_SYS_SPL_MALLOC=y ++CONFIG_SPL_OPENSBI_SCRATCH_OPTIONS=0x0 ++# CONFIG_SYS_I2C_MVTWSI is not set ++CONFIG_DM_REGULATOR_FIXED=y +--- /dev/null ++++ b/configs/nezha_defconfig +@@ -0,0 +1,13 @@ ++CONFIG_RISCV=y ++CONFIG_DEFAULT_DEVICE_TREE="sun20i-d1-nezha" ++CONFIG_TARGET_SUN20I_D1=y ++CONFIG_ARCH_RV64I=y ++CONFIG_RISCV_SMODE=y ++# CONFIG_SPL_SMP is not set ++CONFIG_SYS_SPL_MALLOC=y ++CONFIG_SPL_OPENSBI_SCRATCH_OPTIONS=0x0 ++CONFIG_NET_RANDOM_ETHADDR=y ++# CONFIG_SYS_I2C_MVTWSI is not set ++CONFIG_PHY_REALTEK=y ++CONFIG_SUN8I_EMAC=y ++CONFIG_DM_REGULATOR_FIXED=y diff --git a/package/boot/uboot-d1/patches/0090-drivers-phy-fix-typo.patch b/package/boot/uboot-d1/patches/0090-drivers-phy-fix-typo.patch new file mode 100644 index 00000000000000..c9c3b9b959e8d5 --- /dev/null +++ b/package/boot/uboot-d1/patches/0090-drivers-phy-fix-typo.patch @@ -0,0 +1,21 @@ +From 62419798c137c9eec2d2c1011e417d1520aecffb Mon Sep 17 00:00:00 2001 +From: Zoltan HERPAI +Date: Tue, 6 Jun 2023 19:46:30 +0000 +Subject: [PATCH 90/90] drivers: phy: fix typo + +Signed-off-by: Zoltan HERPAI +--- + drivers/phy/allwinner/Kconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/phy/allwinner/Kconfig ++++ b/drivers/phy/allwinner/Kconfig +@@ -3,7 +3,7 @@ + # + config PHY_SUN4I_USB + bool "Allwinner Sun4I USB PHY driver" +- depends on depends on BOARD_SUNXI ++ depends on BOARD_SUNXI + default y + select DM_REGULATOR + select PHY diff --git a/package/boot/uboot-d1/patches/100-mkimage-check-environment-for-dtc-binary-location.patch b/package/boot/uboot-d1/patches/100-mkimage-check-environment-for-dtc-binary-location.patch new file mode 100644 index 00000000000000..789172f21b41e3 --- /dev/null +++ b/package/boot/uboot-d1/patches/100-mkimage-check-environment-for-dtc-binary-location.patch @@ -0,0 +1,35 @@ +From 637800493945ffed2f454756300437a4ec86e3b1 Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens +Date: Wed, 19 Jul 2017 22:23:15 +0200 +Subject: mkimage: check environment for dtc binary location + +Currently mkimage assumes the dtc binary is in the path and fails +otherwise. This patch makes it check the DTC environment variable first +for the dtc binary and then fall back to the default path. This makes +it possible to call the u-boot build with make DTC=... and build a fit +image with the dtc binary not being the the default path. + +Signed-off-by: Hauke Mehrtens +Cc: Simon Glass +--- + tools/fit_image.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +--- a/tools/fit_image.c ++++ b/tools/fit_image.c +@@ -729,9 +729,14 @@ static int fit_handle_file(struct image_ + } + *cmd = '\0'; + } else if (params->datafile) { ++ const char* dtc = getenv("DTC"); ++ ++ if (!dtc) ++ dtc = MKIMAGE_DTC; ++ + /* dtc -I dts -O dtb -p 500 -o tmpfile datafile */ + snprintf(cmd, sizeof(cmd), "%s %s -o \"%s\" \"%s\"", +- MKIMAGE_DTC, params->dtc, tmpfile, params->datafile); ++ dtc, params->dtc, tmpfile, params->datafile); + debug("Trying to execute \"%s\"\n", cmd); + } else { + snprintf(cmd, sizeof(cmd), "cp \"%s\" \"%s\"", diff --git a/package/boot/uboot-d1/patches/130-fix-mkimage-host-build.patch b/package/boot/uboot-d1/patches/130-fix-mkimage-host-build.patch new file mode 100644 index 00000000000000..cd65c1321fc320 --- /dev/null +++ b/package/boot/uboot-d1/patches/130-fix-mkimage-host-build.patch @@ -0,0 +1,24 @@ +--- a/tools/image-host.c ++++ b/tools/image-host.c +@@ -1125,6 +1125,7 @@ static int fit_config_add_verification_d + * 2) get public key (X509_get_pubkey) + * 3) provide der format (d2i_RSAPublicKey) + */ ++#ifdef CONFIG_TOOLS_LIBCRYPTO + static int read_pub_key(const char *keydir, const void *name, + unsigned char **pubkey, int *pubkey_len) + { +@@ -1178,6 +1179,13 @@ err_cert: + fclose(f); + return ret; + } ++#else ++static int read_pub_key(const char *keydir, const void *name, ++ unsigned char **pubkey, int *pubkey_len) ++{ ++ return -ENOSYS; ++} ++#endif + + int fit_pre_load_data(const char *keydir, void *keydest, void *fit) + { diff --git a/package/boot/uboot-d1/patches/211-no-kwbimage.patch b/package/boot/uboot-d1/patches/211-no-kwbimage.patch new file mode 100644 index 00000000000000..65d14f5bece8bd --- /dev/null +++ b/package/boot/uboot-d1/patches/211-no-kwbimage.patch @@ -0,0 +1,10 @@ +--- a/tools/Makefile ++++ b/tools/Makefile +@@ -119,7 +119,6 @@ dumpimage-mkimage-objs := aisimage.o \ + imximage.o \ + imx8image.o \ + imx8mimage.o \ +- kwbimage.o \ + lib/md5.o \ + lpc32xximage.o \ + mxsimage.o \ diff --git a/package/boot/uboot-d1/patches/300-force-pylibfdt-build.patch b/package/boot/uboot-d1/patches/300-force-pylibfdt-build.patch new file mode 100644 index 00000000000000..e2312eaa5a59f9 --- /dev/null +++ b/package/boot/uboot-d1/patches/300-force-pylibfdt-build.patch @@ -0,0 +1,30 @@ +--- a/Makefile ++++ b/Makefile +@@ -2045,26 +2045,7 @@ endif + # Check dtc and pylibfdt, if DTC is provided, else build them + PHONY += scripts_dtc + scripts_dtc: scripts_basic +- $(Q)if test "$(DTC)" = "$(DTC_INTREE)"; then \ +- $(MAKE) $(build)=scripts/dtc; \ +- else \ +- if ! $(DTC) -v >/dev/null; then \ +- echo '*** Failed to check dtc version: $(DTC)'; \ +- false; \ +- else \ +- if test "$(call dtc-version)" -lt $(DTC_MIN_VERSION); then \ +- echo '*** Your dtc is too old, please upgrade to dtc $(DTC_MIN_VERSION) or newer'; \ +- false; \ +- else \ +- if [ -n "$(CONFIG_PYLIBFDT)" ]; then \ +- if ! echo "import libfdt" | $(PYTHON3) 2>/dev/null; then \ +- echo '*** pylibfdt does not seem to be available with $(PYTHON3)'; \ +- false; \ +- fi; \ +- fi; \ +- fi; \ +- fi; \ +- fi ++ $(MAKE) $(build)=scripts/dtc + + # --------------------------------------------------------------------------- + quiet_cmd_cpp_lds = LDS $@ diff --git a/package/boot/uboot-d1/uEnv-default.txt b/package/boot/uboot-d1/uEnv-default.txt new file mode 100644 index 00000000000000..4f6f5fa172f69b --- /dev/null +++ b/package/boot/uboot-d1/uEnv-default.txt @@ -0,0 +1,4 @@ +setenv loadkernel fatload mmc 0:1 \$kernel_addr_r Image +setenv bootargs console=ttyS0,115200 earlycon=sbi root=/dev/mmcblk0p2 rootwait +setenv uenvcmd run loadkernel \&\& booti \$kernel_addr_r - \$fdtcontroladdr +run uenvcmd diff --git a/package/boot/uboot-envtools/files/ipq40xx b/package/boot/uboot-envtools/files/ipq40xx index 8d993fae3668b3..8cada7334b326d 100644 --- a/package/boot/uboot-envtools/files/ipq40xx +++ b/package/boot/uboot-envtools/files/ipq40xx @@ -53,7 +53,8 @@ aruba,ap-303) aruba,ap-365) ubootenv_add_uci_config "/dev/mtd8" "0x0" "0x10000" "0x10000" ;; -buffalo,wtr-m2133hp) +buffalo,wtr-m2133hp|\ +netgear,lbr20) ubootenv_add_uci_config "/dev/mtd8" "0x0" "0x40000" "0x20000" ;; linksys,ea6350v3) diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic index fcab697d904b5c..08d2bf782bdb1f 100644 --- a/package/boot/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-envtools/files/mediatek_filogic @@ -39,9 +39,9 @@ asus,rt-ax59u) bananapi,bpi-r3|\ bananapi,bpi-r3-mini|\ bananapi,bpi-r4) - . /lib/upgrade/platform.sh + . /lib/upgrade/common.sh - bootdev="$(platform_get_bootdev)" + bootdev="$(fitblk_get_bootdev)" case "$bootdev" in ubi*) ubootenv_add_ubi_default diff --git a/package/boot/uboot-envtools/files/mediatek_mt7622 b/package/boot/uboot-envtools/files/mediatek_mt7622 index b4b1698d3fddde..c8d385748449f3 100644 --- a/package/boot/uboot-envtools/files/mediatek_mt7622 +++ b/package/boot/uboot-envtools/files/mediatek_mt7622 @@ -35,8 +35,8 @@ linksys,e8450-ubi) ubootenv_add_ubi_default ;; bananapi,bpi-r64) - . /lib/upgrade/platform.sh - bootdev="$(platform_get_bootdev)" + . /lib/upgrade/common.sh + bootdev="$(fitblk_get_bootdev)" case "$bootdev" in mmc*) ubootenv_add_mmc_default "${bootdev%p[0-9]*}" diff --git a/package/boot/uboot-envtools/files/mediatek_mt7623 b/package/boot/uboot-envtools/files/mediatek_mt7623 index fd2a01006a8e08..008aff57853c6d 100644 --- a/package/boot/uboot-envtools/files/mediatek_mt7623 +++ b/package/boot/uboot-envtools/files/mediatek_mt7623 @@ -14,9 +14,8 @@ board=$(board_name) case "$board" in bananapi,bpi-r2) . /lib/upgrade/common.sh - export_bootdevice - export_partdevice ubootpart 1 - ubootenv_add_uci_config "/dev/$ubootpart" "0xb0000" "0x10000" "0x10000" "1" + bootdev="$(fitblk_get_bootdev)" + ubootenv_add_uci_config "/dev/${bootdev%p[0-9]*}p1" "0xb0000" "0x10000" "0x10000" "1" ;; unielec,u7623-02) ubootenv_add_uci_config "/dev/mmcblk0p1" "0xc0000" "0x10000" "0x10000" "1" diff --git a/package/boot/uboot-envtools/files/qualcommax_ipq60xx b/package/boot/uboot-envtools/files/qualcommax_ipq60xx new file mode 100644 index 00000000000000..33cb94f99d18f1 --- /dev/null +++ b/package/boot/uboot-envtools/files/qualcommax_ipq60xx @@ -0,0 +1,27 @@ +[ -e /etc/config/ubootenv ] && exit 0 + +touch /etc/config/ubootenv + +. /lib/uboot-envtools.sh +. /lib/functions.sh + +board=$(board_name) + +case "$board" in +8devices,mango-dvk|\ +8devices,mango-dvk-sfp) + idx="$(find_mtd_index 0:APPSBLENV)" + [ -n "$idx" ] && \ + ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x10000" + ;; +netgear,wax214) + idx="$(find_mtd_index 0:appsblenv)" + [ -n "$idx" ] && \ + ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000" "2" + ;; +esac + +config_load ubootenv +config_foreach ubootenv_add_app_config + +exit 0 diff --git a/package/boot/uboot-envtools/files/qualcommax_ipq807x b/package/boot/uboot-envtools/files/qualcommax_ipq807x index bcedfd9adc91ce..86e7062cfc3f47 100644 --- a/package/boot/uboot-envtools/files/qualcommax_ipq807x +++ b/package/boot/uboot-envtools/files/qualcommax_ipq807x @@ -30,7 +30,8 @@ edimax,cax1800) ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x20000" ;; linksys,mx4200v1|\ -linksys,mx4200v2) +linksys,mx4200v2|\ +linksys,mx5300) idx="$(find_mtd_index u_env)" [ -n "$idx" ] && \ ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000" "2" diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips index 30bf635b6df33b..317121f2beae83 100644 --- a/package/boot/uboot-envtools/files/ramips +++ b/package/boot/uboot-envtools/files/ramips @@ -73,6 +73,7 @@ belkin,rt1800|\ h3c,tx1800-plus|\ h3c,tx1801-plus|\ h3c,tx1806|\ +iptime,ax2004m|\ jcg,q20|\ linksys,e7350|\ netgear,eax12|\ @@ -92,6 +93,7 @@ ravpower,rp-wd03) ubootenv_add_uci_config "/dev/mtd$idx" "0x4000" "0x1000" "0x1000" ;; beeline,smartbox-flash|\ +iptime,t5004|\ linksys,ea6350-v4|\ linksys,ea7300-v1|\ linksys,ea7300-v2|\ diff --git a/package/boot/uboot-kirkwood/Makefile b/package/boot/uboot-kirkwood/Makefile index 7f9ae4e1517ab7..92a814ac4f61d7 100644 --- a/package/boot/uboot-kirkwood/Makefile +++ b/package/boot/uboot-kirkwood/Makefile @@ -65,6 +65,11 @@ define U-Boot/nas220 BUILD_DEVICES:=seagate_blackarmor-nas220 endef +define U-Boot/netgear_ms2110 + NAME:=Netgear Stora (MS2000/2110) + BUILD_DEVICES:=netgear_stora +endef + define U-Boot/nsa310 NAME:=Zyxel NSA310 BUILD_DEVICES:=zyxel_nsa310b @@ -107,6 +112,7 @@ UBOOT_TARGETS := \ iconnect iconnect_second_stage \ l-50 \ nas220 \ + netgear_ms2110 \ nsa310 \ nsa310s \ nsa325 \ diff --git a/package/boot/uboot-kirkwood/patches/180-netgear-stora.patch b/package/boot/uboot-kirkwood/patches/180-netgear-stora.patch new file mode 100644 index 00000000000000..5eed89d5e68c23 --- /dev/null +++ b/package/boot/uboot-kirkwood/patches/180-netgear-stora.patch @@ -0,0 +1,648 @@ +diff -ruN u-boot-2020.04.old/arch/arm/mach-kirkwood/Kconfig u-boot-2020.04/arch/arm/mach-kirkwood/Kconfig +--- u-boot-2020.04.old/arch/arm/mach-kirkwood/Kconfig 2020-07-09 00:46:15.000000000 +0200 ++++ u-boot-2020.04/arch/arm/mach-kirkwood/Kconfig 2020-07-09 01:07:00.309219477 +0200 +@@ -44,6 +44,9 @@ + config TARGET_NETSPACE_V2 + bool "LaCie netspace_v2 Board" + ++config TARGET_NETGEAR_MS2110 ++ bool "Netgear MS2110 Board" ++ + config TARGET_IB62X0 + bool "ib62x0 Board" + +@@ -92,6 +95,7 @@ + source "board/keymile/Kconfig" + source "board/LaCie/net2big_v2/Kconfig" + source "board/LaCie/netspace_v2/Kconfig" ++source "board/Marvell/netgear_ms2110/Kconfig" + source "board/raidsonic/ib62x0/Kconfig" + source "board/Seagate/dockstar/Kconfig" + source "board/Seagate/goflexhome/Kconfig" +diff -ruN u-boot-2020.04.old/board/Marvell/netgear_ms2110/Kconfig u-boot-2020.04/board/Marvell/netgear_ms2110/Kconfig +--- u-boot-2020.04.old/board/Marvell/netgear_ms2110/Kconfig 1970-01-01 01:00:00.000000000 +0100 ++++ u-boot-2020.04/board/Marvell/netgear_ms2110/Kconfig 2020-07-09 00:59:29.000000000 +0200 +@@ -0,0 +1,12 @@ ++if TARGET_NETGEAR_MS2110 ++ ++config SYS_BOARD ++ default "netgear_ms2110" ++ ++config SYS_VENDOR ++ default "Marvell" ++ ++config SYS_CONFIG_NAME ++ default "netgear_ms2110" ++ ++endif +diff -ruN u-boot-2020.04.old/board/Marvell/netgear_ms2110/kwbimage.cfg u-boot-2020.04/board/Marvell/netgear_ms2110/kwbimage.cfg +--- u-boot-2020.04.old/board/Marvell/netgear_ms2110/kwbimage.cfg 1970-01-01 01:00:00.000000000 +0100 ++++ u-boot-2020.04/board/Marvell/netgear_ms2110/kwbimage.cfg 2020-07-09 00:59:29.000000000 +0200 +@@ -0,0 +1,167 @@ ++# ++# (C) Copyright 2009 ++# Marvell Semiconductor ++# Written-by: Prafulla Wadaskar ++# ++# See file CREDITS for list of people who contributed to this ++# project. ++# ++# This program is free software; you can redistribute it and/or ++# modify it under the terms of the GNU General Public License as ++# published by the Free Software Foundation; either version 2 of ++# the License, or (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, ++# MA 02110-1301 USA ++# ++# Refer docs/README.kwimage for more details about how-to configure ++# and create kirkwood boot image ++# ++ ++# Boot Media configurations ++BOOT_FROM nand ++NAND_ECC_MODE default ++NAND_PAGE_SIZE 0x0800 ++ ++# SOC registers configuration using bootrom header extension ++# Maximum KWBIMAGE_MAX_CONFIG configurations allowed ++ ++# Configure RGMII-0 interface pad voltage to 1.8V ++DATA 0xFFD100e0 0x1b1b1b9b ++ ++#Dram initalization for SINGLE x16 CL=5 @ 400MHz ++DATA 0xFFD01400 0x43000c30 # DDR Configuration register ++# bit13-0: 0xc30 (3120 DDR2 clks refresh rate) ++# bit23-14: zero ++# bit24: 1= enable exit self refresh mode on DDR access ++# bit25: 1 required ++# bit29-26: zero ++# bit31-30: 01 ++ ++DATA 0xFFD01404 0x37543000 # DDR Controller Control Low ++# bit 4: 0=addr/cmd in smame cycle ++# bit 5: 0=clk is driven during self refresh, we don't care for APX ++# bit 6: 0=use recommended falling edge of clk for addr/cmd ++# bit14: 0=input buffer always powered up ++# bit18: 1=cpu lock transaction enabled ++# bit23-20: 5=recommended value for CL=5 and STARTBURST_DEL disabled bit31=0 ++# bit27-24: 7= CL+2, STARTBURST sample stages, for freqs 400MHz, unbuffered DIMM ++# bit30-28: 3 required ++# bit31: 0=no additional STARTBURST delay ++ ++DATA 0xFFD01408 0x22125451 # DDR Timing (Low) (active cycles value +1) ++# bit3-0: TRAS lsbs ++# bit7-4: TRCD ++# bit11- 8: TRP ++# bit15-12: TWR ++# bit19-16: TWTR ++# bit20: TRAS msb ++# bit23-21: 0x0 ++# bit27-24: TRRD ++# bit31-28: TRTP ++ ++DATA 0xFFD0140C 0x00000833 # DDR Timing (High) ++# bit6-0: TRFC ++# bit8-7: TR2R ++# bit10-9: TR2W ++# bit12-11: TW2W ++# bit31-13: zero required ++ ++DATA 0xFFD01410 0x00000099 # DDR Address Control ++# bit1-0: 00, Cs0width=x8 ++# bit3-2: 11, Cs0size=1Gb ++# bit5-4: 00, Cs1width=x8 ++# bit7-6: 11, Cs1size=1Gb ++# bit9-8: 00, Cs2width=nonexistent ++# bit11-10: 00, Cs2size =nonexistent ++# bit13-12: 00, Cs3width=nonexistent ++# bit15-14: 00, Cs3size =nonexistent ++# bit16: 0, Cs0AddrSel ++# bit17: 0, Cs1AddrSel ++# bit18: 0, Cs2AddrSel ++# bit19: 0, Cs3AddrSel ++# bit31-20: 0 required ++ ++DATA 0xFFD01414 0x00000000 # DDR Open Pages Control ++# bit0: 0, OpenPage enabled ++# bit31-1: 0 required ++ ++DATA 0xFFD01418 0x00000000 # DDR Operation ++# bit3-0: 0x0, DDR cmd ++# bit31-4: 0 required ++ ++DATA 0xFFD0141C 0x00000C52 # DDR Mode ++# bit2-0: 2, BurstLen=2 required ++# bit3: 0, BurstType=0 required ++# bit6-4: 4, CL=5 ++# bit7: 0, TestMode=0 normal ++# bit8: 0, DLL reset=0 normal ++# bit11-9: 6, auto-precharge write recovery ???????????? ++# bit12: 0, PD must be zero ++# bit31-13: 0 required ++ ++DATA 0xFFD01420 0x00000004 # DDR Extended Mode ++# bit0: 0, DDR DLL enabled ++# bit1: 0, DDR drive strenght normal ++# bit2: 1, DDR ODT control lsd (disabled) ++# bit5-3: 000, required ++# bit6: 0, DDR ODT control msb, (disabled) ++# bit9-7: 000, required ++# bit10: 0, differential DQS enabled ++# bit11: 0, required ++# bit12: 0, DDR output buffer enabled ++# bit31-13: 0 required ++ ++DATA 0xFFD01424 0x0000F17F # DDR Controller Control High ++# bit2-0: 111, required ++# bit3 : 1 , MBUS Burst Chop disabled ++# bit6-4: 111, required ++# bit7 : 0 ++# bit8 : 1 , add writepath sample stage, must be 1 for DDR freq >= 300MHz ++# bit9 : 0 , no half clock cycle addition to dataout ++# bit10 : 0 , 1/4 clock cycle skew enabled for addr/ctl signals ++# bit11 : 0 , 1/4 clock cycle skew disabled for write mesh ++# bit15-12: 1111 required ++# bit31-16: 0 required ++ ++DATA 0xFFD01428 0x00085520 # DDR2 ODT Read Timing (default values) ++DATA 0xFFD0147C 0x00008552 # DDR2 ODT Write Timing (default values) ++ ++DATA 0xFFD01500 0x00000000 # CS[0]n Base address to 0x0 ++DATA 0xFFD01504 0x03FFFFF1 # CS[0]n Size ++# bit0: 1, Window enabled ++# bit1: 0, Write Protect disabled ++# bit3-2: 00, CS0 hit selected ++# bit23-4: ones, required ++# bit31-24: 0x0F, Size (i.e. 256MB) ++ ++DATA 0xFFD01508 0x04000000 # CS[1]n Base address to 256Mb ++DATA 0xFFD0150C 0x03FFFFF5 # CS[1]n Size 256Mb Window enabled for CS1 ++ ++DATA 0xFFD01514 0x00000000 # CS[2]n Size, window disabled ++DATA 0xFFD0151C 0x00000000 # CS[3]n Size, window disabled ++ ++DATA 0xFFD01494 0x00120012 # DDR ODT Control (Low) ++# bit3-0: 2, ODT0Rd, MODT[0] asserted during read from DRAM CS1 ++# bit7-4: 1, ODT0Rd, MODT[0] asserted during read from DRAM CS0 ++# bit19-16:2, ODT0Wr, MODT[0] asserted during write to DRAM CS1 ++# bit23-20:1, ODT0Wr, MODT[0] asserted during write to DRAM CS0 ++ ++DATA 0xFFD01498 0x00000000 # DDR ODT Control (High) ++# bit1-0: 00, ODT0 controlled by ODT Control (low) register above ++# bit3-2: 01, ODT1 active NEVER! ++# bit31-4: zero, required ++ ++DATA 0xFFD0149C 0x0000E40F # CPU ODT Control ++DATA 0xFFD01480 0x00000001 # DDR Initialization Control ++#bit0=1, enable DDR init upon this register write ++ ++# End of Header extension ++DATA 0x0 0x0 +diff -ruN u-boot-2020.04.old/board/Marvell/netgear_ms2110/MAINTAINERS u-boot-2020.04/board/Marvell/netgear_ms2110/MAINTAINERS +--- u-boot-2020.04.old/board/Marvell/netgear_ms2110/MAINTAINERS 1970-01-01 01:00:00.000000000 +0100 ++++ u-boot-2020.04/board/Marvell/netgear_ms2110/MAINTAINERS 2020-07-09 00:59:29.000000000 +0200 +@@ -0,0 +1,6 @@ ++NETGEAR_MS2110 BOARD ++M: bodhi ++S: Maintained ++F: board/Marvell/netgear_ms2110 ++F: include/configs/netgear_ms2110.h ++F: configs/netgear_ms2110_defconfig +diff -ruN u-boot-2020.04.old/board/Marvell/netgear_ms2110/Makefile u-boot-2020.04/board/Marvell/netgear_ms2110/Makefile +--- u-boot-2020.04.old/board/Marvell/netgear_ms2110/Makefile 1970-01-01 01:00:00.000000000 +0100 ++++ u-boot-2020.04/board/Marvell/netgear_ms2110/Makefile 2020-07-09 00:59:29.000000000 +0200 +@@ -0,0 +1,13 @@ ++# ++# (C) Copyright 2014 bodhi ++# ++# Based on ++# (C) Copyright 2009 ++# Marvell Semiconductor ++# Written-by: Prafulla Wadaskar ++# ++# SPDX-License-Identifier: GPL-2.0+ ++# ++ ++obj-y := netgear_ms2110.o ++ +diff -ruN u-boot-2020.04.old/board/Marvell/netgear_ms2110/netgear_ms2110.c u-boot-2020.04/board/Marvell/netgear_ms2110/netgear_ms2110.c +--- u-boot-2020.04.old/board/Marvell/netgear_ms2110/netgear_ms2110.c 1970-01-01 01:00:00.000000000 +0100 ++++ u-boot-2020.04/board/Marvell/netgear_ms2110/netgear_ms2110.c 2020-07-09 00:59:29.000000000 +0200 +@@ -0,0 +1,151 @@ ++/* ++ * Copyright (C) 2014-2017 bodhi ++ * ++ * Based on Kirkwood support: ++ * (C) Copyright 2009 ++ * Marvell Semiconductor ++ * Written-by: Prafulla Wadaskar ++ * ++ * See file CREDITS for list of people who contributed to this ++ * project. ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License as ++ * published by the Free Software Foundation; either version 2 of ++ * the License, or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, ++ * MA 02110-1301 USA ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include "netgear_ms2110.h" ++#include ++ ++DECLARE_GLOBAL_DATA_PTR; ++int board_early_init_f(void) ++{ ++ /* ++ * default gpio configuration ++ * There are maximum 64 gpios controlled through 2 sets of registers ++ * the below configuration configures mainly initial LED status ++ */ ++ mvebu_config_gpio(NETGEAR_MS2110_OE_VAL_LOW, ++ NETGEAR_MS2110_OE_VAL_HIGH, ++ NETGEAR_MS2110_OE_LOW, NETGEAR_MS2110_OE_HIGH); ++ ++ /* Multi-Purpose Pins Functionality configuration */ ++ u32 kwmpp_config[] = { ++ MPP0_NF_IO2, ++ MPP1_NF_IO3, ++ MPP2_NF_IO4, ++ MPP3_NF_IO5, ++ MPP4_NF_IO6, ++ MPP5_NF_IO7, ++ MPP6_SYSRST_OUTn, ++ MPP7_SPI_SCn, ++ MPP8_TW_SDA, ++ MPP9_TW_SCK, ++ MPP10_UART0_TXD, ++ MPP11_UART0_RXD, ++ MPP12_SD_CLK, ++ MPP13_SD_CMD, ++ MPP14_SD_D0, ++ MPP15_SD_D1, ++ MPP16_SD_D2, ++ MPP17_SD_D3, ++ MPP18_NF_IO0, ++ MPP19_NF_IO1, ++ MPP20_SATA1_ACTn, ++ MPP21_SATA0_ACTn, ++ MPP22_GPIO, ++ MPP23_GPIO, ++ MPP24_GE1_4, ++ MPP25_GE1_5, ++ MPP26_GE1_6, ++ MPP27_GE1_7, ++ MPP28_GPIO, ++ MPP29_GPIO, ++ MPP30_GPIO, ++ MPP31_GPIO, ++ MPP32_GPIO, ++ MPP33_GE1_13, ++ MPP34_SATA1_ACTn, ++ MPP35_GPIO, ++ MPP36_GPIO, ++ MPP37_GPIO, ++ MPP38_GPIO, ++ MPP39_GPIO, ++ MPP40_GPIO, ++ MPP41_GPIO, ++ MPP42_GPIO, ++ MPP43_GPIO, ++ MPP44_GPIO, ++ MPP45_TDM_PCLK, ++ MPP46_TDM_FS, ++ MPP47_TDM_DRX, ++ MPP48_TDM_DTX, ++ MPP49_GPIO, ++ 0 ++ }; ++ kirkwood_mpp_conf(kwmpp_config, NULL); ++ return 0; ++} ++ ++int board_init(void) ++{ /* ++ * arch number of board ++ */ ++ gd->bd->bi_arch_number = MACH_TYPE_NETGEAR_MS2110; ++ ++ /* adress of boot parameters */ ++ gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100; ++ ++ return 0; ++} ++#ifdef CONFIG_RESET_PHY_R ++/* Configure and enable MV88E1116 PHY */ ++void reset_phy(void) ++{ ++ u16 reg; ++ u16 devadr; ++ char *name = "egiga0"; ++ ++ if (miiphy_set_current_dev(name)) ++ return; ++ ++ /* command to read PHY dev address */ ++ if (miiphy_read(name, 0xEE, 0xEE, (u16 *) &devadr)) { ++ printf("Err..%s could not read PHY dev address\n", ++ __FUNCTION__); ++ return; ++ } ++ ++ /* ++ * Enable RGMII delay on Tx and Rx for CPU port ++ * Ref: sec 4.7.2 of chip datasheet ++ */ ++ miiphy_write(name, devadr, MV88E1116_PGADR_REG, 2); ++ miiphy_read(name, devadr, MV88E1116_MAC_CTRL_REG, ®); ++ reg |= (MV88E1116_RGMII_RXTM_CTRL | MV88E1116_RGMII_TXTM_CTRL); ++ miiphy_write(name, devadr, MV88E1116_MAC_CTRL_REG, reg); ++ miiphy_write(name, devadr, MV88E1116_PGADR_REG, 0); ++ ++ /* reset the phy */ ++ miiphy_reset(name, devadr); ++ ++ printf("88E1116 Initialized on %s\n", name); ++} ++#endif /* CONFIG_RESET_PHY_R */ ++ +diff -ruN u-boot-2020.04.old/board/Marvell/netgear_ms2110/netgear_ms2110.h u-boot-2020.04/board/Marvell/netgear_ms2110/netgear_ms2110.h +--- u-boot-2020.04.old/board/Marvell/netgear_ms2110/netgear_ms2110.h 1970-01-01 01:00:00.000000000 +0100 ++++ u-boot-2020.04/board/Marvell/netgear_ms2110/netgear_ms2110.h 2020-07-09 00:59:29.000000000 +0200 +@@ -0,0 +1,41 @@ ++/* ++ * (C) Copyright 2009 ++ * Marvell Semiconductor ++ * Written-by: Prafulla Wadaskar ++ * ++ * See file CREDITS for list of people who contributed to this ++ * project. ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License as ++ * published by the Free Software Foundation; either version 2 of ++ * the License, or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, ++ * MA 02110-1301 USA ++ */ ++ ++#ifndef __NETGEAR_MS2110_H ++#define __NETGEAR_MS2110_H ++ ++#define NETGEAR_MS2110_OE_LOW (~(1 << 7)) ++#define NETGEAR_MS2110_OE_HIGH (~(1 << 2 | 1 << 12)) ++#define NETGEAR_MS2110_OE_VAL_LOW (0) ++#define NETGEAR_MS2110_OE_VAL_HIGH (1 << 12) ++ ++/* PHY related */ ++#define MV88E1116_LED_FCTRL_REG 10 ++#define MV88E1116_CPRSP_CR3_REG 21 ++#define MV88E1116_MAC_CTRL_REG 21 ++#define MV88E1116_PGADR_REG 22 ++#define MV88E1116_RGMII_TXTM_CTRL (1 << 4) ++#define MV88E1116_RGMII_RXTM_CTRL (1 << 5) ++ ++#endif /* __NETGEAR_MS2110_H */ +diff -ruN a/configs/netgear_ms2110_defconfig b/configs/netgear_ms2110_defconfig +--- a/configs/netgear_ms2110_defconfig 1970-01-01 01:00:00.000000000 +0100 ++++ b/configs/netgear_ms2110_defconfig 2020-07-14 17:59:18.000000000 +0200 +@@ -0,0 +1,50 @@ ++CONFIG_ARM=y ++CONFIG_KIRKWOOD=y ++CONFIG_SYS_DCACHE_OFF=y ++CONFIG_ARCH_CPU_INIT=y ++CONFIG_TARGET_NETGEAR_MS2110=y ++CONFIG_IDENT_STRING="\nNetgear Stora MS2110" ++CONFIG_SYS_PROMPT="Stora> " ++CONFIG_HUSH_PARSER=y ++CONFIG_SYS_TEXT_BASE=0x600000 ++# CONFIG_DISPLAY_BOARDINFO is not set ++# CONFIG_CMD_IMLS is not set ++# CONFIG_CMD_FLASH is not set ++CONFIG_CMD_IDE=y ++CONFIG_MVGBE=y ++CONFIG_MII=y ++CONFIG_SYS_NS16550=y ++CONFIG_OF_LIBFDT=y ++CONFIG_CMD_FDT=y ++CONFIG_CMD_BOOTZ=y ++CONFIG_CMD_SETEXPR=y ++CONFIG_CMD_DATE=y ++CONFIG_CMD_DHCP=y ++CONFIG_CMD_MII=y ++CONFIG_CMD_PING=y ++CONFIG_CMD_EXT2=y ++CONFIG_CMD_EXT4=y ++CONFIG_CMD_FAT=y ++CONFIG_CMD_JFFS2=y ++CONFIG_CMD_USB=y ++CONFIG_ISO_PARTITION=y ++CONFIG_EFI_PARTITION=y ++# CONFIG_MMC is not set ++CONFIG_MTD=y ++CONFIG_MTD_RAW_NAND=y ++CONFIG_MTDPARTS_DEFAULT="mtdparts=orion_nand:0xe0000@0x0(uboot),0x20000@0xe0000(uboot_env),-@0x100000(ubi)" ++CONFIG_CMD_MTDPARTS=y ++CONFIG_CMD_NAND=y ++CONFIG_ENV_IS_IN_NAND=y ++CONFIG_ENV_SIZE=0x20000 ++CONFIG_ENV_ADDR=0xe0000 ++CONFIG_ENV_OFFSET=0xe0000 ++CONFIG_ENV_SECT_SIZE=0x20000 ++CONFIG_CMD_UBI=y ++CONFIG_USB=y ++CONFIG_USB_EHCI_HCD=y ++CONFIG_USB_STORAGE=y ++CONFIG_BLK=y ++CONFIG_MVSATA_IDE=y ++CONFIG_DM_RTC=y ++CONFIG_RTC_MV=y +diff -ruN a/include/configs/netgear_ms2110.h b/include/configs/netgear_ms2110.h +--- a/include/configs/netgear_ms2110.h 1970-01-01 01:00:00.000000000 +0100 ++++ b/include/configs/netgear_ms2110.h 2020-07-14 17:49:15.000000000 +0200 +@@ -0,0 +1,155 @@ ++/* ++ * (C) Copyright 2014-2017 bodhi ++ * (C) Copyright 2020 Zoltan HERPAI ++ * ++ * Based on Kirkwood support: ++ * (C) Copyright 2009 ++ * Marvell Semiconductor ++ * Written-by: Prafulla Wadaskar ++ * ++ * See file CREDITS for list of people who contributed to this ++ * project. ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License as ++ * published by the Free Software Foundation; either version 2 of ++ * the License, or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, ++ * MA 02110-1301 USA ++ */ ++ ++#ifndef _CONFIG_NGMS2110_H ++#define _CONFIG_NGMS2110_H ++ ++/* ++ * High Level Configuration Options (easy to change) ++ */ ++#define CONFIG_MARVELL 1 ++#define CONFIG_ARM926EJS 1 /* Basic Architecture */ ++#define CONFIG_FEROCEON_88FR131 1 /* CPU Core subversion */ ++#define CONFIG_KIRKWOOD 1 /* SOC Family Name */ ++#define CONFIG_KW88F6281 1 /* SOC Name */ ++#define CONFIG_MACH_NETGEAR_MS2110 /* Machine type */ ++#define CONFIG_SKIP_LOWLEVEL_INIT /* disable board lowlevel_init */ ++ ++/* ++ * Commands configuration ++ */ ++#define CONFIG_SYS_NO_FLASH /* Declare no flash (NOR/SPI) */ ++#define CONFIG_SYS_MVFS /* Picks up Filesystem from mv-common.h */ ++#define CONFIG_CMD_ENV ++#define CONFIG_PREBOOT ++#define CONFIG_SYS_HUSH_PARSER ++#define CONFIG_SYS_PROMPT_HUSH_PS2 "> " ++ ++/* #define CONFIG_CMD_AUTOSCRIPT */ ++ ++/* ++ * mv-common.h should be defined after CMD configs since it used them ++ * to enable certain macros ++ */ ++#include "mv-common.h" ++ ++/* Remove or override few declarations from mv-common.h */ ++//#undef CONFIG_SYS_PROMPT /* previously defined in mv-common.h */ ++//#define CONFIG_SYS_PROMPT "Netgear Stora> " ++ ++/* ++ * NAND configuration ++ */ ++#ifdef CONFIG_CMD_NAND ++#define CONFIG_NAND_KIRKWOOD ++#define CONFIG_SYS_MAX_NAND_DEVICE 1 ++#define NAND_MAX_CHIPS 1 ++#define CONFIG_SYS_NAND_BASE 0xD8000000 /* KW_DEFADR_NANDF */ ++#define NAND_ALLOW_ERASE_ALL 1 ++#endif ++ ++/* ++ * Default environment variables ++*/ ++#define CONFIG_BOOTCOMMAND \ ++ "setenv bootargs ${console} ${mtdparts} ${bootargs_root}; " \ ++ "ubi part ubi; " \ ++ "ubifsmount ubi:rootfs; " \ ++ "ubi read 0x800000 kernel; " \ ++ "bootm 0x800000" ++ ++#define CONFIG_EXTRA_ENV_SETTINGS \ ++ "arcNumber=2743\0" \ ++ "console=console=ttyS0,115200\0" \ ++ "ethact=egiga0\0" \ ++ "ethaddr=52:3b:20:9c:11:51\0" \ ++ "ipaddr=192.168.0.231\0" \ ++ "mtdids=nand0=orion_nand\0" \ ++ "mtdparts="CONFIG_MTDPARTS_DEFAULT "\0" \ ++ "serverip=192.168.0.220\0" \ ++ "bootargs_root=\0" ++ ++/* size in bytes reserved for initial data */ ++#define CONFIG_SYS_GBL_DATA_SIZE 128 ++ ++/* ++ * Other required minimal configurations ++ */ ++#define CONFIG_STACKSIZE 0x00100000 /* regular stack- 1M */ ++ ++/* ++ * Ethernet Driver configuration ++ */ ++#ifdef CONFIG_CMD_NET ++#define CONFIG_NETCONSOLE /* include NetConsole support */ ++#define CONFIG_NET_MULTI /* specify more that one ports available */ ++#define CONFIG_KIRKWOOD_EGIGA_PORTS {1,0} /* enable first port */ ++#define CONFIG_MV88E61XX_MULTICHIP_ADRMODE ++#define CONFIG_DIS_AUTO_NEG_SPEED_GMII /*Disable Auto speed negociation */ ++#define CONFIG_PHY_SPEED _1000BASET /*Force PHYspeed to 1GBPs */ ++#define CONFIG_MVGBE_PORTS {1, 0} /* enable port 0 only */ ++#define CONFIG_PHY_BASE_ADR 0x0A ++#define CONFIG_RESET_PHY_R /* use reset_phy() to init PHY */ ++#endif /* CONFIG_CMD_NET */ ++ ++/* ++ * USB/EHCI ++ */ ++#ifdef CONFIG_CMD_USB ++#define CONFIG_USB_EHCI /* Enable EHCI USB support */ ++#define CONFIG_USB_EHCI_KIRKWOOD /* on Kirkwood platform */ ++#define CONFIG_EHCI_IS_TDI ++#define CONFIG_SUPPORT_VFAT ++#endif /* CONFIG_CMD_USB */ ++ ++/* ++ * File system ++ */ ++#define CONFIG_JFFS2_NAND ++#define CONFIG_JFFS2_LZO ++#define CONFIG_MTD_DEVICE /* needed for mtdparts commands */ ++ ++/* ++ * SATA ++ */ ++ ++#ifdef CONFIG_MVSATA_IDE ++#define CONFIG_SYS_ATA_IDE0_OFFSET MV_SATA_PORT0_OFFSET ++#define CONFIG_SYS_ATA_IDE1_OFFSET MV_SATA_PORT1_OFFSET ++#endif ++ ++/* ++ * Date Time ++ * */ ++#ifdef CONFIG_CMD_DATE ++#define CONFIG_RTC_MV ++#define CONFIG_CMD_SNTP ++#define CONFIG_CMD_DNS ++#endif /* CONFIG_CMD_DATE */ ++ ++#endif /* _CONFIG_NGMS2110_H */ diff --git a/package/boot/uboot-mediatek/Makefile b/package/boot/uboot-mediatek/Makefile index 61aaf4de2575e9..c96f7da8823278 100644 --- a/package/boot/uboot-mediatek/Makefile +++ b/package/boot/uboot-mediatek/Makefile @@ -417,7 +417,7 @@ define U-Boot/mt7986_bananapi_bpi-r3-nor endef define U-Boot/mt7986_bananapi_bpi-r3-mini-emmc - NAME:=BananaPi BPi-R3 + NAME:=BananaPi BPi-R3 Mini BUILD_SUBTARGET:=filogic BUILD_DEVICES:=bananapi_bpi-r3-mini UBOOT_CONFIG:=mt7986a_bpi-r3-mini-emmc @@ -429,7 +429,7 @@ define U-Boot/mt7986_bananapi_bpi-r3-mini-emmc endef define U-Boot/mt7986_bananapi_bpi-r3-mini-snand - NAME:=BananaPi BPi-R3 + NAME:=BananaPi BPi-R3 Mini BUILD_SUBTARGET:=filogic BUILD_DEVICES:=bananapi_bpi-r3-mini UBOOT_CONFIG:=mt7986a_bpi-r3-mini-snand diff --git a/package/boot/uboot-mediatek/patches/300-mt7623-fix-mmc-get-env-dev.patch b/package/boot/uboot-mediatek/patches/300-mt7623-fix-mmc-get-env-dev.patch new file mode 100644 index 00000000000000..86c48badda9706 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/300-mt7623-fix-mmc-get-env-dev.patch @@ -0,0 +1,46 @@ +--- a/board/mediatek/mt7623/mt7623_rfb.c ++++ b/board/mediatek/mt7623/mt7623_rfb.c +@@ -5,6 +5,7 @@ + + #include + #include ++#include + #include + + DECLARE_GLOBAL_DATA_PTR; +@@ -22,8 +23,9 @@ int mmc_get_boot_dev(void) + { + int g_mmc_devid = -1; + char *uflag = (char *)0x81DFFFF0; ++ struct blk_desc *desc; + +- if (!find_mmc_device(1)) ++ if (blk_get_device_by_str("mmc", "1", &desc) < 0) + return 0; + + if (strncmp(uflag,"eMMC",4)==0) { +@@ -38,6 +40,23 @@ int mmc_get_boot_dev(void) + + int mmc_get_env_dev(void) + { +- return mmc_get_boot_dev(); ++ struct udevice *dev; ++ const char *mmcdev; ++ ++ switch (mmc_get_boot_dev()) { ++ case 0: ++ mmcdev = "mmc@11230000"; ++ break; ++ case 1: ++ mmcdev = "mmc@11240000"; ++ break; ++ default: ++ return -1; ++ } ++ ++ if (uclass_get_device_by_name(UCLASS_MMC, mmcdev, &dev)) ++ return -1; ++ ++ return dev_seq(dev); + } + #endif diff --git a/package/boot/uboot-mediatek/patches/302-mt7623-generic-reset-button-ignore-env.patch b/package/boot/uboot-mediatek/patches/302-mt7623-generic-reset-button-ignore-env.patch index 928dfe8428a3de..b8d89058a2e93a 100644 --- a/package/boot/uboot-mediatek/patches/302-mt7623-generic-reset-button-ignore-env.patch +++ b/package/boot/uboot-mediatek/patches/302-mt7623-generic-reset-button-ignore-env.patch @@ -1,6 +1,6 @@ --- a/board/mediatek/mt7623/mt7623_rfb.c +++ b/board/mediatek/mt7623/mt7623_rfb.c -@@ -4,8 +4,17 @@ +@@ -4,9 +4,18 @@ */ #include @@ -9,6 +9,7 @@ +#include +#include #include + #include #include +#include + @@ -18,8 +19,8 @@ DECLARE_GLOBAL_DATA_PTR; -@@ -41,3 +50,25 @@ int mmc_get_env_dev(void) - return mmc_get_boot_dev(); +@@ -60,3 +69,25 @@ int mmc_get_env_dev(void) + return dev_seq(dev); } #endif + diff --git a/package/boot/uboot-mediatek/patches/311-mt7986-select-roodisk.patch b/package/boot/uboot-mediatek/patches/311-mt7986-select-rootdisk.patch similarity index 100% rename from package/boot/uboot-mediatek/patches/311-mt7986-select-roodisk.patch rename to package/boot/uboot-mediatek/patches/311-mt7986-select-rootdisk.patch diff --git a/package/boot/uboot-mediatek/patches/313-mt7623-select-rootdisk.patch b/package/boot/uboot-mediatek/patches/313-mt7623-select-rootdisk.patch new file mode 100644 index 00000000000000..0089307bbd6b84 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/313-mt7623-select-rootdisk.patch @@ -0,0 +1,46 @@ +--- a/board/mediatek/mt7623/mt7623_rfb.c ++++ b/board/mediatek/mt7623/mt7623_rfb.c +@@ -91,3 +91,43 @@ int board_late_init(void) + env_relocate(); + return 0; + } ++ ++int ft_system_setup(void *blob, struct bd_info *bd) ++{ ++ const u32 *media_handle_p; ++ int chosen, len, ret; ++ const char *media; ++ u32 media_handle; ++ ++#ifdef CONFIG_MMC ++ switch (mmc_get_boot_dev()) { ++ case 0: ++ media = "rootdisk-emmc"; ++ break ++ ;; ++ case 1: ++ media = "rootdisk-sd"; ++ break ++ ;; ++ } ++ ++ chosen = fdt_path_offset(blob, "/chosen"); ++ if (chosen <= 0) ++ return 0; ++ ++ media_handle_p = fdt_getprop(blob, chosen, media, &len); ++ if (media_handle_p <= 0 || len != 4) ++ return 0; ++ ++ media_handle = *media_handle_p; ++ ret = fdt_setprop(blob, chosen, "rootdisk", &media_handle, sizeof(media_handle)); ++ if (ret) { ++ printf("cannot set media phandle %s as rootdisk /chosen node\n", media); ++ return ret; ++ } ++ ++ printf("set /chosen/rootdisk to bootrom media: %s (phandle 0x%08x)\n", media, fdt32_to_cpu(media_handle)); ++#endif ++ ++ return 0; ++} diff --git a/package/boot/uboot-mediatek/patches/400-update-bpir2-defconfig.patch b/package/boot/uboot-mediatek/patches/400-update-bpir2-defconfig.patch index ca011aeca9609e..ab3424e6b591ba 100644 --- a/package/boot/uboot-mediatek/patches/400-update-bpir2-defconfig.patch +++ b/package/boot/uboot-mediatek/patches/400-update-bpir2-defconfig.patch @@ -1,6 +1,6 @@ --- a/configs/mt7623n_bpir2_defconfig +++ b/configs/mt7623n_bpir2_defconfig -@@ -7,34 +7,105 @@ CONFIG_SYS_MALLOC_F_LEN=0x4000 +@@ -7,34 +7,106 @@ CONFIG_SYS_MALLOC_F_LEN=0x4000 CONFIG_NR_DRAM_BANKS=1 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x81ffff10 @@ -18,6 +18,7 @@ +CONFIG_LED_GPIO=y +CONFIG_LOGLEVEL=7 +CONFIG_LOG=y ++CONFIG_OF_SYSTEM_SETUP=y +CONFIG_AUTOBOOT_KEYED=y +CONFIG_AUTOBOOT_MENU_SHOW=y +CONFIG_BOARD_LATE_INIT=y @@ -110,7 +111,7 @@ CONFIG_USE_IPADDR=y CONFIG_IPADDR="192.168.1.1" CONFIG_USE_SERVERIP=y -@@ -46,6 +117,12 @@ CONFIG_CLK=y +@@ -46,6 +118,12 @@ CONFIG_CLK=y CONFIG_SUPPORT_EMMC_BOOT=y CONFIG_MMC_HS400_SUPPORT=y CONFIG_MMC_MTK=y @@ -123,7 +124,7 @@ CONFIG_PHY_FIXED=y CONFIG_MEDIATEK_ETH=y CONFIG_PINCTRL=y -@@ -55,10 +132,13 @@ CONFIG_POWER_DOMAIN=y +@@ -55,10 +133,13 @@ CONFIG_POWER_DOMAIN=y CONFIG_MTK_POWER_DOMAIN=y CONFIG_DM_SERIAL=y CONFIG_MTK_SERIAL=y @@ -139,7 +140,7 @@ # CONFIG_EFI_GRUB_ARM32_WORKAROUND is not set --- /dev/null +++ b/bananapi_bpi-r2_env -@@ -0,0 +1,70 @@ +@@ -0,0 +1,69 @@ +ipaddr=192.168.1.1 +serverip=192.168.1.254 +loadaddr=0x88000000 @@ -192,14 +193,13 @@ +sdmmc_write_recovery=iminfo $fileaddr && mmc dev 1 && part start mmc 1 $part_recovery part_addr && part size mmc 1 $part_recovery part_size && run mmc_write_vol +_checkbootedfrom=setenv _checkbootedfrom ; if itest.l *81dffff0 == 434d4d65 ; then setenv bootedfrom eMMC ; else setenv bootedfrom SD ; fi +_init_env=setenv _init_env ; setenv _create_env ; saveenv ; saveenv -+_firstboot=setenv _firstboot ; led $bootled_pwr off ;led $bootled_rec on ; run _checkbootedfrom _switch_to_menu _update_bootdev _update_bootcmd _update_bootcmd2 _init_env boot_first ++_firstboot=setenv _firstboot ; led $bootled_pwr off ;led $bootled_rec on ; run _checkbootedfrom _switch_to_menu _update_bootcmd _update_bootcmd2 _init_env boot_first +_set_bootcmd_sdmmc=setenv boot_production "led $bootled_rec off ; led $bootled_pwr on ; run sdmmc_read_production && bootm $loadaddr ; led $bootled_pwr off" +_set_bootcmd_emmc=setenv boot_production "led $bootled_rec off ; led $bootled_pwr on ; run emmc_read_production && bootm $loadaddr ; led $bootled_pwr off" +_update_bootcmd=setenv _update_bootcmd ; if test "$bootedfrom" = "SD" ; then run _set_bootcmd_sdmmc ; else run _set_bootcmd_emmc ; fi ; setenv _set_bootcmd_sdmmc ; setenv _set_bootcmd_emmc +_set_bootcmd2_sdmmc=setenv boot_recovery "led $bootled_pwr off ; led $bootled_rec on ; run sdmmc_read_recovery && bootm $loadaddr ; led $bootled_rec off" +_set_bootcmd2_emmc=setenv boot_recovery "led $bootled_pwr off ; led $bootled_rec on ; run emmc_read_recovery && bootm $loadaddr ; led $bootled_rec off" +_update_bootcmd2=setenv _update_bootcmd2 ; if test "$bootedfrom" = "SD" ; then run _set_bootcmd2_sdmmc ; else run _set_bootcmd2_emmc ; fi ; setenv _set_bootcmd2_sdmmc ; setenv _set_bootcmd2_emmc -+_update_bootdev=setenv _update_bootdev ; if test "$bootedfrom" = "SD" ; then setenv bootargs "$console root=/dev/mmcblk1p65" ; else setenv bootargs "$console root=/dev/mmcblk0p65" ; fi +_switch_to_menu=setenv _switch_to_menu ; setenv bootdelay 3 ; setenv bootmenu_delay 3 ; setenv bootmenu_0 $bootmenu_0d ; setenv bootmenu_0d ; run _bootmenu_update_title +_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title [$bootedfrom] $ver" ; run _set_bm2 +_set_bm2=setenv _set_bm2 ; setenv bootmenu_2 "Boot production system from $bootedfrom.=run boot_production ; run bootmenu_confirm_return" ; run _set_bm3 diff --git a/package/boot/uboot-mediatek/patches/404-add-bananapi_bpi-r64_defconfigs.patch b/package/boot/uboot-mediatek/patches/404-add-bananapi_bpi-r64_defconfigs.patch index 1a9b859e7adce9..6ee87296740432 100644 --- a/package/boot/uboot-mediatek/patches/404-add-bananapi_bpi-r64_defconfigs.patch +++ b/package/boot/uboot-mediatek/patches/404-add-bananapi_bpi-r64_defconfigs.patch @@ -171,7 +171,7 @@ +ipaddr=192.168.1.1 +serverip=192.168.1.254 +loadaddr=0x48000000 -+bootargs=root=/dev/fit0 ++bootargs=root=/dev/fit0 rootwait +bootcmd=if pstore check ; then run boot_recovery ; else run boot_sdmmc ; fi +bootconf=config-1#mt7622-bananapi-bpi-r64-pcie1 +bootconf_pcie=config-1#mt7622-bananapi-bpi-r64-pcie1 @@ -242,7 +242,7 @@ +ubi_read_production=ubi read $loadaddr fit && iminfo $loadaddr && run ubi_prepare_rootfs +ubi_read_recovery=ubi check recovery && ubi read $loadaddr recovery +ubi_remove_rootfs=ubi check rootfs_data && ubi remove rootfs_data -+ubi_write_fip=ubi check fip && ubi remove fip ; ubi create fip 0x200000 static ; ubi write $loadaddr fip 0x200000 ++ubi_write_fip=run ubi_remove_rootfs ; ubi check fip && ubi remove fip ; ubi create fip 0x200000 static ; ubi write $loadaddr fip 0x200000 +ubi_write_production=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize +ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize +_init_env=setenv _init_env ; setenv _create_env ; saveenv ; saveenv @@ -411,7 +411,7 @@ +serverip=192.168.1.254 +loadaddr=0x48000000 +bootcmd=if pstore check ; then run boot_recovery ; else run boot_emmc ; fi -+bootargs=root=/dev/fit0 ++bootargs=root=/dev/fit0 rootwait +bootconf=config-1#mt7622-bananapi-bpi-r64-pcie1 +bootconf_pcie=config-1#mt7622-bananapi-bpi-r64-pcie1 +bootconf_sata=config-1#mt7622-bananapi-bpi-r64-sata @@ -617,7 +617,7 @@ +ipaddr=192.168.1.1 +serverip=192.168.1.254 +loadaddr=0x48000000 -+bootargs=ubi.block=0,fit root=/dev/fit0 ++bootargs=ubi.block=0,fit root=/dev/fit0 rootwait +bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi +bootconf=config-1#mt7622-bananapi-bpi-r64-pcie1 +bootconf_pcie=config-1#mt7622-bananapi-bpi-r64-pcie1 @@ -662,7 +662,7 @@ +ubi_read_production=ubi read $loadaddr fit && iminfo $loadaddr && run ubi_prepare_rootfs +ubi_read_recovery=ubi check recovery && ubi read $loadaddr recovery +ubi_remove_rootfs=ubi check rootfs_data && ubi remove rootfs_data -+ubi_write_fip=ubi check fip && ubi remove fip ; ubi create fip 0x200000 static ; ubi write $loadaddr fip 0x200000 ++ubi_write_fip=run ubi_remove_rootfs ; ubi check fip && ubi remove fip ; ubi create fip 0x200000 static ; ubi write $loadaddr fip 0x200000 +ubi_write_production=ubi check fit && env exists replacevol && ubi remove fit ; if ubi check fit ; then else run ubi_remove_rootfs ; ubi create fit $filesize dynamic 2 && ubi write $loadaddr fit $filesize ; fi +ubi_write_recovery=ubi check recovery && env exists replacevol && ubi remove recovery ; if ubi check recovery ; then else run ubi_remove_rootfs ; ubi create recovery $filesize dynamic 3 && ubi write $loadaddr recovery $filesize ; fi +_create_env=ubi create ubootenv 0x1f000 dynamic ; ubi create ubootenv2 0x1f000 dynamic diff --git a/package/boot/uboot-mediatek/patches/410-add-linksys-e8450.patch b/package/boot/uboot-mediatek/patches/410-add-linksys-e8450.patch index 08aee125aa87a8..ca8fb32bead132 100644 --- a/package/boot/uboot-mediatek/patches/410-add-linksys-e8450.patch +++ b/package/boot/uboot-mediatek/patches/410-add-linksys-e8450.patch @@ -370,7 +370,7 @@ mt7981-rfb.dtb \ --- /dev/null +++ b/linksys_e8450_env -@@ -0,0 +1,54 @@ +@@ -0,0 +1,55 @@ +ethaddr_factory=ubi read 0x40080000 factory && env readmem -b ethaddr 0x400ffff4 0x6 ; setenv ethaddr_factory +ipaddr=192.168.1.1 +serverip=192.168.1.254 @@ -418,7 +418,7 @@ +ubi_read_production=ubi read $loadaddr fit && iminfo $loadaddr && run ubi_prepare_rootfs +ubi_read_recovery=ubi check recovery && ubi read $loadaddr recovery +ubi_remove_rootfs=ubi check rootfs_data && ubi remove rootfs_data -+ubi_write_fip=ubi check fip || ubi create fip 0x200000 static ; ubi write $loadaddr fip 0x200000 ++ubi_write_fip=run ubi_remove_rootfs ; ubi check fip && ubi remove fip ; ubi create fip 0x200000 static ; ubi write $loadaddr fip 0x200000 +ubi_write_production=ubi check fit && env exists replacevol && ubi remove fit ; if ubi check fit ; then else run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize ; fi +ubi_write_recovery=ubi check recovery && env exists replacevol && ubi remove recovery ; if ubi check recovery ; then else run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize ; fi +_create_env=ubi create ubootenv 0x1f000 dynamic ; ubi create ubootenv2 0x1f000 dynamic diff --git a/package/boot/uboot-mediatek/patches/430-add-bpi-r3.patch b/package/boot/uboot-mediatek/patches/430-add-bpi-r3.patch index 398621537a3f79..cbcda89119516d 100644 --- a/package/boot/uboot-mediatek/patches/430-add-bpi-r3.patch +++ b/package/boot/uboot-mediatek/patches/430-add-bpi-r3.patch @@ -802,7 +802,7 @@ +serverip=192.168.1.254 +loadaddr=0x46000000 +console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0 -+bootargs=root=/dev/fit0 ++bootargs=root=/dev/fit0 rootwait +bootcmd=if pstore check ; then run boot_recovery ; else run boot_sdmmc ; fi +bootconf=config-mt7986a-bananapi-bpi-r3 +bootconf_base=config-mt7986a-bananapi-bpi-r3 @@ -871,7 +871,7 @@ +ubi_init_emmc_install=run sdmmc_read_emmc_install && run ubi_write_emmc_install +ubi_prepare_rootfs=if ubi check rootfs_data ; then else if env exists rootfs_data_max ; then ubi create rootfs_data $rootfs_data_max dynamic || ubi create rootfs_data - dynamic ; else ubi create rootfs_data - dynamic ; fi ; fi +ubi_remove_rootfs=ubi check rootfs_data && ubi remove rootfs_data -+ubi_write_fip=ubi check fip && ubi remove fip ; ubi create fip 0x200000 static ; ubi write $loadaddr fip 0x200000 ++ubi_write_fip=run ubi_remove_rootfs ; ubi check fip && ubi remove fip ; ubi create fip 0x200000 static ; ubi write $loadaddr fip 0x200000 +ubi_write_emmc_install=ubi check emmc_install && ubi remove emmc_install ; ubi create emmc_install 0x800000 dynamic ; ubi write $loadaddr emmc_install 0x800000 +ubi_write_production=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize +ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize @@ -886,7 +886,7 @@ +serverip=192.168.1.254 +loadaddr=0x46000000 +console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0 -+bootargs=root=/dev/fit0 ++bootargs=root=/dev/fit0 rootwait +bootcmd=if pstore check ; then run boot_recovery ; else run boot_nor ; fi +bootconf=config-mt7986a-bananapi-bpi-r3 +bootconf_base=config-mt7986a-bananapi-bpi-r3 @@ -949,7 +949,7 @@ +serverip=192.168.1.254 +loadaddr=0x46000000 +console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0 -+bootargs=root=/dev/fit0 ++bootargs=root=/dev/fit0 rootwait +bootconf=config-mt7986a-bananapi-bpi-r3 +bootconf_base=config-mt7986a-bananapi-bpi-r3 +bootconf_nor=mt7986a-bananapi-bpi-r3-nor @@ -1002,7 +1002,7 @@ +ubi_read_recovery=ubi check recovery && ubi read $loadaddr recovery +ubi_read_emmc_install=ubi check emmc_install && ubi read $loadaddr emmc_install +ubi_remove_rootfs=ubi check rootfs_data && ubi remove rootfs_data -+ubi_write_fip=ubi check fip && ubi remove fip ; ubi create fip 0x200000 static ; ubi write $loadaddr fip 0x200000 ++ubi_write_fip=run ubi_remove_rootfs ; ubi check fip && ubi remove fip ; ubi create fip 0x200000 static ; ubi write $loadaddr fip 0x200000 +ubi_write_production=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize +ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize +mmc_write_vol=imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc erase 0x$part_addr 0x$image_size && mmc write $loadaddr 0x$part_addr 0x$image_size @@ -1025,7 +1025,7 @@ +serverip=192.168.1.254 +loadaddr=0x46000000 +console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0 -+bootargs=root=/dev/fit0 ++bootargs=root=/dev/fit0 rootwait +bootcmd=if pstore check ; then run boot_recovery ; else run boot_emmc ; fi +bootconf=config-mt7986a-bananapi-bpi-r3 +bootconf_base=config-mt7986a-bananapi-bpi-r3 diff --git a/package/boot/uboot-mediatek/patches/440-add-jdcloud_re-cp-03.patch b/package/boot/uboot-mediatek/patches/441-add-jdcloud_re-cp-03.patch similarity index 100% rename from package/boot/uboot-mediatek/patches/440-add-jdcloud_re-cp-03.patch rename to package/boot/uboot-mediatek/patches/441-add-jdcloud_re-cp-03.patch diff --git a/package/boot/uboot-mediatek/patches/442-add-bpi-r3-mini.patch b/package/boot/uboot-mediatek/patches/442-add-bpi-r3-mini.patch index e54220878c2e0a..5409f7fa0de71e 100644 --- a/package/boot/uboot-mediatek/patches/442-add-bpi-r3-mini.patch +++ b/package/boot/uboot-mediatek/patches/442-add-bpi-r3-mini.patch @@ -417,7 +417,7 @@ +serverip=192.168.1.254 +loadaddr=0x46000000 +console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0 -+bootargs=root=ubi.block=0,fit root=/dev/fit0 ++bootargs=root=ubi.block=0,fit root=/dev/fit0 rootwait +bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi +bootconf=config-mt7986a-bananapi-bpi-r3-mini +bootdelay=0 @@ -466,7 +466,7 @@ +ubi_read_recovery=ubi check recovery && ubi read $loadaddr recovery +ubi_read_emmc_install=ubi check emmc_install && ubi read $loadaddr emmc_install +ubi_remove_rootfs=ubi check rootfs_data && ubi remove rootfs_data -+ubi_write_fip=ubi check fip && ubi remove fip ; ubi create fip 0x200000 static ; ubi write $loadaddr fip 0x200000 ++ubi_write_fip=run ubi_remove_rootfs ; ubi check fip && ubi remove fip ; ubi create fip 0x200000 static ; ubi write $loadaddr fip 0x200000 +ubi_write_en8811h_fw=ubi check en8811h-fw && ubi remove en8811h-fw ; ubi create en8811h-fw 0x24000 static ; ubi write $loadaddr en8811h-fw 0x24000 +ubi_write_production=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize +ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize @@ -481,7 +481,7 @@ +serverip=192.168.1.254 +loadaddr=0x46000000 +console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0 -+bootargs=root=/dev/fit0 ++bootargs=root=/dev/fit0 rootwait +bootcmd=if pstore check ; then run boot_recovery ; else run boot_emmc ; fi +bootconf=config-mt7986a-bananapi-bpi-r3-mini +bootdelay=0 diff --git a/package/boot/uboot-mediatek/patches/450-add-bpi-r4.patch b/package/boot/uboot-mediatek/patches/450-add-bpi-r4.patch index 0f08c032946bfb..5fb956a2e3a3d4 100644 --- a/package/boot/uboot-mediatek/patches/450-add-bpi-r4.patch +++ b/package/boot/uboot-mediatek/patches/450-add-bpi-r4.patch @@ -555,7 +555,7 @@ +ipaddr=192.168.1.1 +serverip=192.168.1.254 +loadaddr=0x50000000 -+bootargs=console=ttyS0,115200n1 pci=pcie_bus_perf root=/dev/fit0 ++bootargs=console=ttyS0,115200n1 pci=pcie_bus_perf root=/dev/fit0 rootwait +bootcmd=if pstore check ; then run boot_recovery ; else run boot_sdmmc ; fi +bootconf=config-mt7988a-bananapi-bpi-r4 +bootconf_sd=mt7988a-bananapi-bpi-r4-sd @@ -610,7 +610,7 @@ +ubi_init_emmc_install=run sdmmc_read_emmc_install && run ubi_write_emmc_install +ubi_prepare_rootfs=if ubi check rootfs_data ; then else if env exists rootfs_data_max ; then ubi create rootfs_data $rootfs_data_max dynamic || ubi create rootfs_data - dynamic ; else ubi create rootfs_data - dynamic ; fi ; fi +ubi_remove_rootfs=ubi check rootfs_data && ubi remove rootfs_data -+ubi_write_fip=ubi check fip && ubi remove fip ; ubi create fip 0x200000 static ; ubi write $loadaddr fip 0x200000 ++ubi_write_fip=run ubi_remove_rootfs ; ubi check fip && ubi remove fip ; ubi create fip 0x200000 static ; ubi write $loadaddr fip 0x200000 +ubi_write_emmc_install=ubi check emmc_install && ubi remove emmc_install ; ubi create emmc_install 0x800000 dynamic ; ubi write $loadaddr emmc_install 0x800000 +ubi_write_production=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize +ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize @@ -624,7 +624,7 @@ +ipaddr=192.168.1.1 +serverip=192.168.1.254 +loadaddr=0x50000000 -+bootargs=console=ttyS0,115200n1 pci=pcie_bus_perf root=/dev/fit0 ubi.block=0,fit ++bootargs=console=ttyS0,115200n1 pci=pcie_bus_perf root=/dev/fit0 rootwait ubi.block=0,fit +bootconf=config-mt7988a-bananapi-bpi-r4 +bootconf_extra=mt7988a-bananapi-bpi-r4-emmc +bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi @@ -672,7 +672,7 @@ +ubi_read_recovery=ubi check recovery && ubi read $loadaddr recovery +ubi_read_emmc_install=ubi check emmc_install && ubi read $loadaddr emmc_install +ubi_remove_rootfs=ubi check rootfs_data && ubi remove rootfs_data -+ubi_write_fip=ubi check fip && ubi remove fip ; ubi create fip 0x200000 static ; ubi write $loadaddr fip 0x200000 ++ubi_write_fip=run ubi_remove_rootfs ; ubi check fip && ubi remove fip ; ubi create fip 0x200000 static ; ubi write $loadaddr fip 0x200000 +ubi_write_production=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize +ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize +mmc_write_vol=imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc erase 0x$part_addr 0x$image_size && mmc write $loadaddr 0x$part_addr 0x$image_size @@ -694,7 +694,7 @@ +ipaddr=192.168.1.1 +serverip=192.168.1.254 +loadaddr=0x50000000 -+bootargs=console=ttyS0,115200n1 pci=pcie_bus_perf root=/dev/fit0 ++bootargs=console=ttyS0,115200n1 pci=pcie_bus_perf root=/dev/fit0 rootwait +bootcmd=if pstore check ; then run boot_recovery ; else run boot_emmc ; fi +bootconf=config-mt7988a-bananapi-bpi-r4 +bootconf_base=config-mt7988a-bananapi-bpi-r4 diff --git a/package/boot/uboot-mediatek/patches/500-board-mt7623-fix-mmc-detect.patch b/package/boot/uboot-mediatek/patches/500-board-mt7623-fix-mmc-detect.patch deleted file mode 100644 index 2f0ed85e53f22d..00000000000000 --- a/package/boot/uboot-mediatek/patches/500-board-mt7623-fix-mmc-detect.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/board/mediatek/mt7623/mt7623_rfb.c -+++ b/board/mediatek/mt7623/mt7623_rfb.c -@@ -9,6 +9,7 @@ - #include - #include - #include -+#include - #include - #include - -@@ -31,8 +32,9 @@ int mmc_get_boot_dev(void) - { - int g_mmc_devid = -1; - char *uflag = (char *)0x81DFFFF0; -+ struct blk_desc *desc; - -- if (!find_mmc_device(1)) -+ if (blk_get_device_by_str("mmc", "1", &desc) < 0) - return 0; - - if (strncmp(uflag,"eMMC",4)==0) { diff --git a/package/boot/uboot-rockchip/Makefile b/package/boot/uboot-rockchip/Makefile index 3d8059ae6050df..5bf2dcaac1a010 100644 --- a/package/boot/uboot-rockchip/Makefile +++ b/package/boot/uboot-rockchip/Makefile @@ -126,6 +126,22 @@ define U-Boot/rockpro64-rk3399 endef +# RK3566 boards + +define U-Boot/rk3566/Default + BUILD_SUBTARGET:=armv8 + DEPENDS:=+PACKAGE_u-boot-$(1):trusted-firmware-a-rk3566 + ATF:=rk3568_bl31_v1.43.elf + TPL:=rk3566_ddr_1056MHz_v1.18.bin +endef + +define U-Boot/radxa-cm3-io-rk3566 + $(U-Boot/rk3566/Default) + NAME:=CM3 IO + BUILD_DEVICES:= \ + radxa_cm3-io +endef + # RK3568 boards define U-Boot/rk3568/Default @@ -181,6 +197,7 @@ UBOOT_TARGETS := \ rock-pi-e-rk3328 \ opc-h68k-rk3568 \ station-p2-rk3568 \ + radxa-cm3-io-rk3566 \ nanopi-r5c-rk3568 \ nanopi-r5s-rk3568 @@ -192,7 +209,6 @@ UBOOT_CUSTOMIZE_CONFIG := \ --set-str MKIMAGE_DTC_PATH $(PKG_BUILD_DIR)/scripts/dtc/dtc UBOOT_MAKE_FLAGS += \ - PATH=$(STAGING_DIR_HOST)/bin:$(PATH) \ BL31=$(STAGING_DIR_IMAGE)/$(ATF) \ $(if $(TPL),ROCKCHIP_TPL=$(STAGING_DIR_IMAGE)/$(TPL)) diff --git a/package/firmware/ath11k-firmware/Makefile b/package/firmware/ath11k-firmware/Makefile index ea4977aa68ca1e..82555009c7e1f0 100644 --- a/package/firmware/ath11k-firmware/Makefile +++ b/package/firmware/ath11k-firmware/Makefile @@ -8,9 +8,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ath11k-firmware -PKG_SOURCE_DATE:=2023-08-22 -PKG_SOURCE_VERSION:=d8f82a98ff1aef330d65d8b5660b46d1a9809ee3 -PKG_MIRROR_HASH:=3dba19449758c3b17f117990d7ad4086554e012b579f1de16e9d9196a7fbaaa7 +PKG_SOURCE_DATE:=2024-03-14 +PKG_SOURCE_VERSION:=795809c7041582bd51bdfaa1f548b916ae8d4382 +PKG_MIRROR_HASH:=7d6d2946531c336a402f51e453d5b0e2b5c17201432d6cfa5482eb3626270212 PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git @@ -32,6 +32,11 @@ define Package/ath11k-firmware-default DEPENDS:= endef +define Package/ath11k-firmware-ipq6018 +$(Package/ath11k-firmware-default) + TITLE:=IPQ6018 ath11k firmware +endef + define Package/ath11k-firmware-ipq8074 $(Package/ath11k-firmware-default) TITLE:=IPQ8074 ath11k firmware @@ -50,28 +55,51 @@ QCN9074_BOARD_REV:=8e140c65f36137714b6d8934e09dcd73cb05c2f6 QCN9074_BOARD_FILE:=board-2.bin.$(QCN9074_BOARD_REV) define Download/qcn9074-board - URL:=https://github.com/kvalo/ath11k-firmware/raw/master/QCN9074/hw1.0/ + URL:=https://git.codelinaro.org/clo/ath-firmware/ath11k-firmware/-/raw/main/QCN9074/hw1.0/ URL_FILE:=board-2.bin FILE:=$(QCN9074_BOARD_FILE) HASH:=dbf0ca14aa1229eccd48f26f1026901b9718b143bd30b51b8ea67c84ba6207f1 endef $(eval $(call Download,qcn9074-board)) +define Download/ath11k-firmware-old + URL:=https://git.codelinaro.org/clo/ath-firmware/ath11k-firmware.git + VERSION:=540105aa5c0903b5f773d4e80b8501e8da5217e7 + PROTO:=git + FILE:=ath11k-firmware-old.tar.xz + SUBDIR:=ath11k-firmware-old + MIRROR_HASH:=a35a164726fab2adc4ad447c974c06746355ba74deab9b849d39f06b5187bb6d +endef +$(eval $(call Download,ath11k-firmware-old)) + +define Build/Prepare + $(call Build/Prepare/Default) + xzcat $(DL_DIR)/ath11k-firmware-old.tar.xz | tar -C $(PKG_BUILD_DIR)/ -xf - +endef + +define Package/ath11k-firmware-ipq6018/install + $(INSTALL_DIR) $(1)/lib/firmware/IPQ6018 + $(INSTALL_DATA) \ + $(PKG_BUILD_DIR)/ath11k-firmware-old/IPQ6018/hw1.0/2.4.0.1/WLAN.HK.2.4.0.1-01746-QCAHKSWPL_SILICONZ-1/* \ + $(1)/lib/firmware/IPQ6018/ +endef + define Package/ath11k-firmware-ipq8074/install $(INSTALL_DIR) $(1)/lib/firmware/IPQ8074 $(INSTALL_DATA) \ - $(PKG_BUILD_DIR)/ath11k-firmware/IPQ8074/hw2.0/2.9.0.1/WLAN.HK.2.9.0.1-01890-QCAHKSWPL_SILICONZ-1/* \ + $(PKG_BUILD_DIR)/ath11k-firmware/IPQ8074/hw2.0/2.9.0.1/WLAN.HK.2.9.0.1-01977-QCAHKSWPL_SILICONZ-1/* \ $(1)/lib/firmware/IPQ8074/ endef define Package/ath11k-firmware-qcn9074/install $(INSTALL_DIR) $(1)/lib/firmware/ath11k/QCN9074/hw1.0 $(INSTALL_DATA) \ - $(PKG_BUILD_DIR)/ath11k-firmware/QCN9074/hw1.0/2.9.0.1/WLAN.HK.2.9.0.1-01890-QCAHKSWPL_SILICONZ-1/* \ + $(PKG_BUILD_DIR)/ath11k-firmware/QCN9074/hw1.0/2.9.0.1/WLAN.HK.2.9.0.1-01977-QCAHKSWPL_SILICONZ-1/* \ $(1)/lib/firmware/ath11k/QCN9074/hw1.0/ $(INSTALL_BIN) \ $(DL_DIR)/$(QCN9074_BOARD_FILE) $(1)/lib/firmware/ath11k/QCN9074/hw1.0/board-2.bin endef +$(eval $(call BuildPackage,ath11k-firmware-ipq6018)) $(eval $(call BuildPackage,ath11k-firmware-ipq8074)) $(eval $(call BuildPackage,ath11k-firmware-qcn9074)) diff --git a/package/firmware/intel-microcode/Makefile b/package/firmware/intel-microcode/Makefile index 9e87dccc12b29e..91a697c673af04 100644 --- a/package/firmware/intel-microcode/Makefile +++ b/package/firmware/intel-microcode/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=intel-microcode -PKG_VERSION:=20230808 +PKG_VERSION:=20240312 PKG_RELEASE:=1 PKG_SOURCE:=intel-microcode_3.$(PKG_VERSION).1.tar.xz PKG_SOURCE_URL:=@DEBIAN/pool/non-free-firmware/i/intel-microcode/ -PKG_HASH:=29e77c275b3f60a691832c0844f70effbd94a4594d04af21e0c2e6e0c1ac1894 +PKG_HASH:=25f53bab1bf0c84aba927a77a97a9f1147c94199fa95b5187d874f839f022808 PKG_BUILD_DIR:=$(BUILD_DIR)/intel-microcode-3.$(PKG_VERSION).1 PKG_CPE_ID:=cpe:/a:intel:microcode diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index 34faf5c3db4cb4..ed4b26af3a20e4 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -2,13 +2,13 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/version.mk PKG_NAME:=ipq-wifi -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/firmware/qca-wireless.git -PKG_SOURCE_DATE:=2024-01-06 -PKG_SOURCE_VERSION:=71f45cff8944405b7cc2bf5c19df2bd8fe7f2421 -PKG_MIRROR_HASH:=90c3c1659c54cdb4685d0a71633746c1000230e459801eb8ce12c805a994cc37 +PKG_SOURCE_DATE:=2024-03-04 +PKG_SOURCE_VERSION:=38c02ae4302f9cb73f6914574239fe84799caa84 +PKG_MIRROR_HASH:=0f6a2dea8466ea0e8df3262bff643d60b1725f2218589c41d9f87fb37843c362 PKG_FLAGS:=nonshared @@ -28,6 +28,7 @@ endef # ALLWIFIBOARDS:= \ + 8devices_mango \ arcadyan_aw1000 \ buffalo_wxr-5950ax12 \ cmcc_rm2-6 \ @@ -36,7 +37,10 @@ ALLWIFIBOARDS:= \ edgecore_eap102 \ edimax_cax1800 \ linksys_mx4200 \ + linksys_mx5300 \ + netgear_lbr20 \ netgear_rax120v2 \ + netgear_wax214 \ netgear_wax218 \ netgear_wax620 \ netgear_wax630 \ @@ -49,7 +53,6 @@ ALLWIFIBOARDS:= \ yyets_le1 \ yuncore_ax880 \ zte_mf269 \ - zte_mf289f \ zte_mf287 \ zte_mf287plus \ zyxel_nbg7815 @@ -85,12 +88,14 @@ define ipq-wifi-install-one $(call ipq-wifi-install-one-to,$(1),$(2),QCA9984/hw1.0),\ $(if $(filter $(suffix $(1)),.QCA99X0 .qca99x0),\ $(call ipq-wifi-install-one-to,$(1),$(2),QCA99X0/hw2.0),\ - $(if $(filter $(suffix $(1)),.IPQ8074 .ipq8074 .ipq8174),\ + $(if $(filter $(suffix $(1)),.IPQ6018 .ipq6018),\ + $(call ipq-wifi-install-ath11-one-to,$(1),$(2),IPQ6018/hw1.0),\ + $(if $(filter $(suffix $(1)),.IPQ8074 .ipq8074),\ $(call ipq-wifi-install-ath11-one-to,$(1),$(2),IPQ8074/hw2.0),\ $(if $(filter $(suffix $(1)),.QCN9074 .qcn9074),\ $(call ipq-wifi-install-ath11-one-to,$(1),$(2),QCN9074/hw1.0),\ $(error Unrecognized board-file suffix '$(suffix $(1))' for '$(1)')\ - ))))))) + )))))))) endef # Blank line required at end of above define due to foreach context @@ -140,6 +145,7 @@ endef # Board files should follow this name structure: # board-. +$(eval $(call generate-ipq-wifi-package,8devices_mango,8devices Mango)) $(eval $(call generate-ipq-wifi-package,arcadyan_aw1000,Arcadyan AW1000)) $(eval $(call generate-ipq-wifi-package,buffalo_wxr-5950ax12,Buffalo WXR-5950AX12)) $(eval $(call generate-ipq-wifi-package,cmcc_rm2-6,CMCC RM2-6)) @@ -148,7 +154,10 @@ $(eval $(call generate-ipq-wifi-package,dynalink_dl-wrx36,Dynalink DL-WRX36)) $(eval $(call generate-ipq-wifi-package,edgecore_eap102,Edgecore EAP102)) $(eval $(call generate-ipq-wifi-package,edimax_cax1800,Edimax CAX1800)) $(eval $(call generate-ipq-wifi-package,linksys_mx4200,Linksys MX4200)) +$(eval $(call generate-ipq-wifi-package,linksys_mx5300,Linksys MX5300)) +$(eval $(call generate-ipq-wifi-package,netgear_lbr20,Netgear LBR20)) $(eval $(call generate-ipq-wifi-package,netgear_rax120v2,Netgear RAX120v2)) +$(eval $(call generate-ipq-wifi-package,netgear_wax214,Netgear WAX214)) $(eval $(call generate-ipq-wifi-package,netgear_wax218,Netgear WAX218)) $(eval $(call generate-ipq-wifi-package,netgear_wax620,Netgear WAX620)) $(eval $(call generate-ipq-wifi-package,netgear_wax630,Netgear WAX630)) @@ -161,7 +170,6 @@ $(eval $(call generate-ipq-wifi-package,xiaomi_ax9000,Xiaomi AX9000)) $(eval $(call generate-ipq-wifi-package,yyets_le1,YYeTs LE1)) $(eval $(call generate-ipq-wifi-package,yuncore_ax880,Yuncore AX880)) $(eval $(call generate-ipq-wifi-package,zte_mf269,ZTE MF269)) -$(eval $(call generate-ipq-wifi-package,zte_mf289f,ZTE MF289F)) $(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)) diff --git a/package/firmware/layerscape/ls-dpl/Makefile b/package/firmware/layerscape/ls-dpl/Makefile index 6c53b4541700fa..7ceba620bb9538 100644 --- a/package/firmware/layerscape/ls-dpl/Makefile +++ b/package/firmware/layerscape/ls-dpl/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ls-dpl -PKG_VERSION:=21.08 -PKG_RELEASE:=3 +PKG_VERSION:=10.38.0 +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/nxp-qoriq/mc-utils -PKG_SOURCE_VERSION:=LSDK-21.08 -PKG_MIRROR_HASH:=372498ff4b5c8a1ac64ead5856d03ee021332f57771989ed6fe066745372b242 +PKG_SOURCE_VERSION:=mc_release_10.38.0 +PKG_MIRROR_HASH:=c5032ad73a04cf7fa23a2afeee85108677e665871a6c48ca352f415eea9b6390 PKG_FLAGS:=nonshared diff --git a/package/firmware/layerscape/ls-mc/Makefile b/package/firmware/layerscape/ls-mc/Makefile index 49cdfdc0625790..3ef5a783272cb3 100644 --- a/package/firmware/layerscape/ls-mc/Makefile +++ b/package/firmware/layerscape/ls-mc/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ls-mc -PKG_VERSION:=21.08 -PKG_RELEASE:=3 +PKG_VERSION:=10.38.0 +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/NXP/qoriq-mc-binary.git -PKG_SOURCE_VERSION:=LSDK-21.08 -PKG_MIRROR_HASH:=ab22c16b2bce37886c15ffeed7b068e5b46d619eae58e5a6a005028f5ddb06b6 +PKG_SOURCE_VERSION:=mc_release_10.38.0 +PKG_MIRROR_HASH:=b4482690246f9bd6a8728c482fd391ccf9b25a104b02f08add6e5c5d43a5ad75 PKG_FLAGS:=nonshared @@ -32,11 +32,11 @@ endef define Build/InstallDev $(INSTALL_DIR) $(STAGING_DIR_IMAGE) - $(CP) $(PKG_BUILD_DIR)/ls1088a/mc_ls1088a_10.28.1.itb \ + $(CP) $(PKG_BUILD_DIR)/ls1088a/mc_ls1088a_$(PKG_VERSION).itb \ $(STAGING_DIR_IMAGE)/fsl_ls1088a-rdb-mc.itb - $(CP) $(PKG_BUILD_DIR)/ls2088a/mc_ls2088a_10.28.1.itb \ + $(CP) $(PKG_BUILD_DIR)/ls2088a/mc_ls2088a_$(PKG_VERSION).itb \ $(STAGING_DIR_IMAGE)/fsl_ls2088a-rdb-mc.itb - $(CP) $(PKG_BUILD_DIR)/lx216xa/mc_lx2160a_10.28.1.itb \ + $(CP) $(PKG_BUILD_DIR)/lx216xa/mc_lx2160a_$(PKG_VERSION).itb \ $(STAGING_DIR_IMAGE)/fsl_lx2160a-rdb-mc.itb endef diff --git a/package/firmware/linux-firmware/Makefile b/package/firmware/linux-firmware/Makefile index f7f1f978e30bed..d056140f45bf92 100644 --- a/package/firmware/linux-firmware/Makefile +++ b/package/firmware/linux-firmware/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=linux-firmware -PKG_VERSION:=20231211 -PKG_RELEASE:=2 +PKG_VERSION:=20240220 +PKG_RELEASE:=1 PKG_SOURCE_URL:=@KERNEL/linux/kernel/firmware PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_HASH:=96af7e4b5eabd37869cdb3dcbb7ab36911106d39b76e799fa1caab16a9dbe8bb +PKG_HASH:=bf0f239dc0801e9d6bf5d5fb3e2f549575632cf4688f4348184199cb02c2bcd7 PKG_MAINTAINER:=Felix Fietkau diff --git a/package/firmware/linux-firmware/realtek.mk b/package/firmware/linux-firmware/realtek.mk index b4880b6a7f2313..81e91ba085e1b6 100644 --- a/package/firmware/linux-firmware/realtek.mk +++ b/package/firmware/linux-firmware/realtek.mk @@ -29,6 +29,15 @@ define Package/rtl8188eu-firmware/install endef $(eval $(call BuildPackage,rtl8188eu-firmware)) +Package/rtl8188fu-firmware = $(call Package/firmware-default,RealTek RTL8188FU firmware) +define Package/rtl8188fu-firmware/install + $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi + $(CP) \ + $(PKG_BUILD_DIR)/rtlwifi/rtl8188fufw.bin \ + $(1)/lib/firmware/rtlwifi +endef +$(eval $(call BuildPackage,rtl8188fu-firmware)) + Package/rtl8192ce-firmware = $(call Package/firmware-default,RealTek RTL8192CE firmware) define Package/rtl8192ce-firmware/install $(INSTALL_DIR) $(1)/lib/firmware/rtlwifi diff --git a/package/kernel/ath10k-ct/patches/300-fix-fortify-checking-error.patch b/package/kernel/ath10k-ct/patches/300-fix-fortify-checking-error.patch new file mode 100644 index 00000000000000..6966a5a4877af6 --- /dev/null +++ b/package/kernel/ath10k-ct/patches/300-fix-fortify-checking-error.patch @@ -0,0 +1,11 @@ +--- a/ath10k-6.4/wmi.h ++++ b/ath10k-6.4/wmi.h +@@ -6341,7 +6341,7 @@ struct qca9880_set_ctl_table_cmd { + __le32 ctl_len; /* in bytes. This may be ignored in firmware, + * make sure ctl_info data is sizeof(qca9880_power_ctl) */ + /** ctl array (len adjusted to number of words) */ +- __le32 ctl_info[1]; /* data would be the qca9880_power_ctl table above */ ++ __le32 ctl_info[]; /* data would be the qca9880_power_ctl table above */ + }; + + /* Used by: WMI_PDEV_SET_MIMOGAIN_TABLE_CMDID */ diff --git a/package/kernel/cryptodev-linux/Makefile b/package/kernel/cryptodev-linux/Makefile index 0c1f63a6055a93..0b794a3cd9801f 100644 --- a/package/kernel/cryptodev-linux/Makefile +++ b/package/kernel/cryptodev-linux/Makefile @@ -10,12 +10,12 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=cryptodev-linux -PKG_VERSION:=1.12 +PKG_VERSION:=1.13 PKG_RELEASE:=1 PKG_SOURCE_URL:=https://codeload.github.com/$(PKG_NAME)/$(PKG_NAME)/tar.gz/$(PKG_NAME)-$(PKG_VERSION)? PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_HASH:=f51c2254749233b1b1d7ec9445158bd709f124f88e1c650fe2faac83c3a81938 +PKG_HASH:=33b7915c46eb39a37110e88c681423c0dd0df25d784b6e1475ac3196367f0db5 PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:=COPYING diff --git a/package/kernel/cryptodev-linux/patches/0001-cryptodev_verbosity-fix-build-for-linux-6.4.patch b/package/kernel/cryptodev-linux/patches/0001-cryptodev_verbosity-fix-build-for-linux-6.4.patch new file mode 100644 index 00000000000000..390faec9c29c1b --- /dev/null +++ b/package/kernel/cryptodev-linux/patches/0001-cryptodev_verbosity-fix-build-for-linux-6.4.patch @@ -0,0 +1,41 @@ +From 99ae2a39ddc3f89c66d9f09783b591c0f2dbf2e9 Mon Sep 17 00:00:00 2001 +From: Gaurav Jain +Date: Wed, 28 Jun 2023 12:44:32 +0530 +Subject: [PATCH] cryptodev_verbosity: Fix build for Linux 6.4 + +register_sysctl_table api is removed in kernel. +migrate to the new api register_sysctl. + +child is also removed in linux 6.4 ctl_table struct. + +Signed-off-by: Gaurav Jain +--- + ioctl.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/ioctl.c b/ioctl.c +index 8f241b86..4262bbd5 100644 +--- a/ioctl.c ++++ b/ioctl.c +@@ -1246,7 +1246,9 @@ static struct ctl_table verbosity_ctl_root[] = { + { + .procname = "ioctl", + .mode = 0555, ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0)) + .child = verbosity_ctl_dir, ++#endif + }, + {}, + }; +@@ -1267,7 +1269,11 @@ static int __init init_cryptodev(void) + return rc; + } + ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0)) + verbosity_sysctl_header = register_sysctl_table(verbosity_ctl_root); ++#else ++ verbosity_sysctl_header = register_sysctl(verbosity_ctl_root->procname, verbosity_ctl_dir); ++#endif + + pr_info(PFX "driver %s loaded.\n", VERSION); + diff --git a/package/kernel/cryptodev-linux/patches/0001-zero-copy-fix-build-for-linux-6.4.patch b/package/kernel/cryptodev-linux/patches/0001-zero-copy-fix-build-for-linux-6.4.patch new file mode 100644 index 00000000000000..0b8147d56ef792 --- /dev/null +++ b/package/kernel/cryptodev-linux/patches/0001-zero-copy-fix-build-for-linux-6.4.patch @@ -0,0 +1,34 @@ +From 592017c3a910a3905b1925aee88c4674e9a596b7 Mon Sep 17 00:00:00 2001 +From: Gaurav Jain +Date: Tue, 30 May 2023 17:09:42 +0530 +Subject: [PATCH] zero copy: Fix build for Linux 6.4 + +get_user_pages_remote api prototype is changed in kernel. +struct vm_area_struct **vmas argument is removed. +Migrate to the new API. + +Signed-off-by: Gaurav Jain +--- + zc.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/zc.c b/zc.c +index fdf7da17..6637945a 100644 +--- a/zc.c ++++ b/zc.c +@@ -80,10 +80,14 @@ int __get_userbuf(uint8_t __user *addr, uint32_t len, int write, + ret = get_user_pages_remote(task, mm, + (unsigned long)addr, pgcount, write ? FOLL_WRITE : 0, + pg, NULL, NULL); +-#else ++#elif (LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0)) + ret = get_user_pages_remote(mm, + (unsigned long)addr, pgcount, write ? FOLL_WRITE : 0, + pg, NULL, NULL); ++#else ++ ret = get_user_pages_remote(mm, ++ (unsigned long)addr, pgcount, write ? FOLL_WRITE : 0, ++ pg, NULL); + #endif + #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)) + up_read(&mm->mmap_sem); diff --git a/package/kernel/cryptodev-linux/patches/0003-move-recent-linux-version-ifdefs-from-v6.4-to-v6.5.patch b/package/kernel/cryptodev-linux/patches/0003-move-recent-linux-version-ifdefs-from-v6.4-to-v6.5.patch new file mode 100644 index 00000000000000..baf5b805cdd824 --- /dev/null +++ b/package/kernel/cryptodev-linux/patches/0003-move-recent-linux-version-ifdefs-from-v6.4-to-v6.5.patch @@ -0,0 +1,60 @@ +From bb8bc7cf60d2c0b097c8b3b0e807f805b577a53f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Joan=20Bruguera=20Mic=C3=B3?= +Date: Mon, 3 Jul 2023 00:46:02 +0000 +Subject: [PATCH] Move recent Linux version #ifdefs from v6.4 to v6.5 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The latest commits, meant to fix the build on Linux 6.4, are actually +fixing the build for API changes introduced in the merge window of the +yet-unreleased Linux 6.5, and actually break the build for Linux 6.4. + +In particular, the upstream commits introducing the API changes are the +following, which are *not* included in the Linux v6.4 tag: +* https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=19c4e618a1bc3d0cad1f04c857be8076cb05bbb2 +* https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ca5e863233e8f6acd1792fd85d6bc2729a1b2c10 + +Change to #ifdef's to v6.5, where they will most likely be included. + +Signed-off-by: Joan Bruguera Micó +--- + ioctl.c | 4 ++-- + zc.c | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/ioctl.c b/ioctl.c +index 4262bbd..e3eefe1 100644 +--- a/ioctl.c ++++ b/ioctl.c +@@ -1246,7 +1246,7 @@ static struct ctl_table verbosity_ctl_root[] = { + { + .procname = "ioctl", + .mode = 0555, +-#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0)) ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 5, 0)) + .child = verbosity_ctl_dir, + #endif + }, +@@ -1269,7 +1269,7 @@ static int __init init_cryptodev(void) + return rc; + } + +-#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0)) ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 5, 0)) + verbosity_sysctl_header = register_sysctl_table(verbosity_ctl_root); + #else + verbosity_sysctl_header = register_sysctl(verbosity_ctl_root->procname, verbosity_ctl_dir); +diff --git a/zc.c b/zc.c +index 6637945..00e00c1 100644 +--- a/zc.c ++++ b/zc.c +@@ -80,7 +80,7 @@ int __get_userbuf(uint8_t __user *addr, uint32_t len, int write, + ret = get_user_pages_remote(task, mm, + (unsigned long)addr, pgcount, write ? FOLL_WRITE : 0, + pg, NULL, NULL); +-#elif (LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0)) ++#elif (LINUX_VERSION_CODE < KERNEL_VERSION(6, 5, 0)) + ret = get_user_pages_remote(mm, + (unsigned long)addr, pgcount, write ? FOLL_WRITE : 0, + pg, NULL, NULL); diff --git a/package/kernel/cryptodev-linux/patches/0004-fix-build-for-linux-6.7-rc1.patch b/package/kernel/cryptodev-linux/patches/0004-fix-build-for-linux-6.7-rc1.patch new file mode 100644 index 00000000000000..3ef9e28ce70875 --- /dev/null +++ b/package/kernel/cryptodev-linux/patches/0004-fix-build-for-linux-6.7-rc1.patch @@ -0,0 +1,35 @@ +From 5e7121e45ff283d30097da381fd7e97c4bb61364 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Joan=20Bruguera=20Mic=C3=B3?= +Date: Sun, 10 Dec 2023 13:57:55 +0000 +Subject: [PATCH] Fix build for Linux 6.7-rc1 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Since Linux 6.7-rc1, no ahash algorithms set a nonzero alignmask, +and therefore `crypto_ahash_alignmask` has been removed. + +See also: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0f8660c82b79af595b056f6b9f4f227edeb88574 + https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c626910f3f1bbce6ad18bc613d895d2a089ed95e + +Signed-off-by: Joan Bruguera Micó +--- + cryptlib.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/cryptlib.c b/cryptlib.c +index 4d739e5..0e59d4c 100644 +--- a/cryptlib.c ++++ b/cryptlib.c +@@ -381,7 +381,11 @@ int cryptodev_hash_init(struct hash_data *hdata, const char *alg_name, + } + + hdata->digestsize = crypto_ahash_digestsize(hdata->async.s); ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 7, 0)) + hdata->alignmask = crypto_ahash_alignmask(hdata->async.s); ++#else ++ hdata->alignmask = 0; ++#endif + + init_completion(&hdata->async.result.completion); + diff --git a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c index e325fc59a9ac19..939e7367a2f766 100644 --- a/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c +++ b/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c @@ -538,8 +538,9 @@ static int gpio_keys_button_probe(struct platform_device *pdev, struct device_node *child = of_get_next_child(dev->of_node, prev); - bdata->gpiod = devm_gpiod_get_from_of_node(dev, - child, "gpios", 0, GPIOD_IN, desc); + bdata->gpiod = devm_fwnode_gpiod_get(dev, + of_fwnode_handle(child), NULL, GPIOD_IN, + desc); // Correct the gpio which used for log button->gpio = desc_to_gpio(bdata->gpiod); diff --git a/package/kernel/lantiq/ltq-vmmc/Makefile b/package/kernel/lantiq/ltq-vmmc/Makefile index c96cee819b6030..4972f1c374a98f 100644 --- a/package/kernel/lantiq/ltq-vmmc/Makefile +++ b/package/kernel/lantiq/ltq-vmmc/Makefile @@ -29,6 +29,7 @@ define KernelPackage/ltq-vmmc DEPENDS:=@(TARGET_lantiq_xway||TARGET_lantiq_xrx200) +kmod-ltq-tapi FILES:=$(PKG_BUILD_DIR)/src/drv_vmmc.ko AUTOLOAD:=$(call AutoProbe,drv_vmmc) + USERID:=:vmmc=386 endef define KernelPackage/ltq-vmmc/description diff --git a/package/kernel/lantiq/ltq-vmmc/files/vmmc.init b/package/kernel/lantiq/ltq-vmmc/files/vmmc.init index 402376e2942690..78efe80b980838 100644 --- a/package/kernel/lantiq/ltq-vmmc/files/vmmc.init +++ b/package/kernel/lantiq/ltq-vmmc/files/vmmc.init @@ -8,6 +8,7 @@ start() { for i in 10 11 12 13 14 15 16 17 18; do if ! [ -e /dev/vmmc$i ]; then mknod -m 664 /dev/vmmc$i c 122 $i + chown root:vmmc /dev/vmmc$i fi done } diff --git a/package/kernel/linux/modules/block.mk b/package/kernel/linux/modules/block.mk index 804fa2eea8a923..ba33cec47052cb 100644 --- a/package/kernel/linux/modules/block.mk +++ b/package/kernel/linux/modules/block.mk @@ -263,7 +263,7 @@ define KernelPackage/iscsi-initiator CONFIG_INET \ CONFIG_SCSI_LOWLEVEL=y \ CONFIG_ISCSI_TCP \ - CONFIG_SCSI_ISCSI_ATTRS=y + CONFIG_SCSI_ISCSI_ATTRS FILES:= \ $(LINUX_DIR)/drivers/scsi/iscsi_tcp.ko \ $(LINUX_DIR)/drivers/scsi/libiscsi.ko \ diff --git a/package/kernel/linux/modules/can.mk b/package/kernel/linux/modules/can.mk index 408b80feab28eb..b56a741734115f 100644 --- a/package/kernel/linux/modules/can.mk +++ b/package/kernel/linux/modules/can.mk @@ -13,6 +13,7 @@ define KernelPackage/can KCONFIG:=\ CONFIG_CAN=m \ CONFIG_CAN_DEV \ + CONFIG_CAN_NETLINK=y \ CONFIG_CAN_CALC_BITTIMING=y \ CONFIG_CAN_LEDS=y \ CONFIG_CAN_AT91=n \ @@ -119,7 +120,9 @@ $(eval $(call KernelPackage,can-c-can-platform)) define KernelPackage/can-flexcan TITLE:=Support for Freescale FLEXCAN based chips KCONFIG:=CONFIG_CAN_FLEXCAN - FILES:=$(LINUX_DIR)/drivers/net/can/flexcan.ko + FILES:= \ + $(LINUX_DIR)/drivers/net/can/flexcan.ko@lt5.17 \ + $(LINUX_DIR)/drivers/net/can/flexcan/flexcan.ko@ge5.17 AUTOLOAD:=$(call AutoProbe,flexcan) $(call AddDepends/can,@TARGET_imx) endef @@ -182,7 +185,9 @@ $(eval $(call KernelPackage,can-raw)) define KernelPackage/can-slcan TITLE:=Serial / USB serial CAN Adaptors (slcan) KCONFIG:=CONFIG_CAN_SLCAN - FILES:=$(LINUX_DIR)/drivers/net/can/slcan.ko + FILES:= \ + $(LINUX_DIR)/drivers/net/can/slcan.ko@lt6.0 \ + $(LINUX_DIR)/drivers/net/can/slcan/slcan.ko@ge6.0 AUTOLOAD:=$(call AutoProbe,slcan) $(call AddDepends/can) endef diff --git a/package/kernel/linux/modules/crypto.mk b/package/kernel/linux/modules/crypto.mk index dd17d868fa1522..21b7aa51bd5051 100644 --- a/package/kernel/linux/modules/crypto.mk +++ b/package/kernel/linux/modules/crypto.mk @@ -39,10 +39,11 @@ define KernelPackage/crypto-aead TITLE:=CryptoAPI AEAD support KCONFIG:= \ CONFIG_CRYPTO_AEAD \ - CONFIG_CRYPTO_AEAD2 + CONFIG_CRYPTO_AEAD2 \ + CONFIG_CRYPTO_GENIV@lt6.6 FILES:= \ $(LINUX_DIR)/crypto/aead.ko \ - $(LINUX_DIR)/crypto/geniv.ko + $(LINUX_DIR)/crypto/geniv.ko@lt6.6 AUTOLOAD:=$(call AutoLoad,09,aead,1) $(call AddDepends/crypto, +kmod-crypto-null) endef @@ -216,7 +217,7 @@ $(eval $(call KernelPackage,crypto-ecb)) define KernelPackage/crypto-ecdh TITLE:=ECDH algorithm - DEPENDS:=+kmod-crypto-kpp + DEPENDS:=+kmod-crypto-kpp +kmod-crypto-rng KCONFIG:= CONFIG_CRYPTO_ECDH FILES:= \ $(LINUX_DIR)/crypto/ecdh_generic.ko \ @@ -230,7 +231,7 @@ $(eval $(call KernelPackage,crypto-ecdh)) define KernelPackage/crypto-echainiv TITLE:=Encrypted Chain IV Generator - DEPENDS:=+kmod-crypto-aead + DEPENDS:=+kmod-crypto-aead +LINUX_6_6:kmod-crypto-geniv KCONFIG:=CONFIG_CRYPTO_ECHAINIV FILES:=$(LINUX_DIR)/crypto/echainiv.ko AUTOLOAD:=$(call AutoLoad,09,echainiv) @@ -289,8 +290,12 @@ $(eval $(call KernelPackage,crypto-xcbc)) define KernelPackage/crypto-gf128 TITLE:=GF(2^128) multiplication functions CryptoAPI module - KCONFIG:=CONFIG_CRYPTO_GF128MUL - FILES:=$(LINUX_DIR)/crypto/gf128mul.ko + KCONFIG:= \ + CONFIG_CRYPTO_GF128MUL \ + CONFIG_CRYPTO_LIB_GF128MUL + FILES:= \ + $(LINUX_DIR)/crypto/gf128mul.ko@lt6.2 \ + $(LINUX_DIR)/lib/crypto/gf128mul.ko@ge6.2 AUTOLOAD:=$(call AutoLoad,09,gf128mul) $(call AddDepends/crypto) endef @@ -846,7 +851,8 @@ define KernelPackage/crypto-rsa KCONFIG:= CONFIG_CRYPTO_RSA HIDDEN:=1 FILES:= \ - $(LINUX_DIR)/lib/mpi/mpi.ko \ + $(LINUX_DIR)/lib/mpi/mpi.ko@lt6.5 \ + $(LINUX_DIR)/lib/crypto/mpi/mpi.ko@ge6.5 \ $(LINUX_DIR)/crypto/akcipher.ko \ $(LINUX_DIR)/crypto/rsa_generic.ko AUTOLOAD:=$(call AutoLoad,10,rsa_generic) @@ -870,7 +876,7 @@ $(eval $(call KernelPackage,crypto-rmd160)) define KernelPackage/crypto-rng TITLE:=CryptoAPI random number generation - DEPENDS:=+kmod-crypto-hash +kmod-crypto-hmac +kmod-crypto-sha512 + DEPENDS:=+kmod-crypto-hash +kmod-crypto-hmac +kmod-crypto-sha512 +LINUX_6_6:kmod-crypto-sha3 KCONFIG:= \ CONFIG_CRYPTO_DRBG \ CONFIG_CRYPTO_DRBG_HMAC=y \ @@ -889,9 +895,22 @@ endef $(eval $(call KernelPackage,crypto-rng)) +define KernelPackage/crypto-geniv + TITLE:=CryptoAPI Shared IV generator + HIDDEN:=1 + DEPENDS:=+kmod-crypto-rng +kmod-crypto-aead @LINUX_6_6 + KCONFIG:=CONFIG_CRYPTO_GENIV + FILES:=$(LINUX_DIR)/crypto/geniv.ko + AUTOLOAD:=$(call AutoLoad,09,geniv) + $(call AddDepends/crypto) +endef + +$(eval $(call KernelPackage,crypto-geniv)) + + define KernelPackage/crypto-seqiv TITLE:=CryptoAPI Sequence Number IV Generator - DEPENDS:=+kmod-crypto-aead +kmod-crypto-rng + DEPENDS:=+kmod-crypto-aead +kmod-crypto-rng +LINUX_6_6:kmod-crypto-geniv KCONFIG:=CONFIG_CRYPTO_SEQIV FILES:=$(LINUX_DIR)/crypto/seqiv.ko AUTOLOAD:=$(call AutoLoad,09,seqiv) @@ -908,6 +927,7 @@ define KernelPackage/crypto-sha1 CONFIG_CRYPTO_SHA1 \ CONFIG_CRYPTO_SHA1_ARM \ CONFIG_CRYPTO_SHA1_ARM_NEON \ + CONFIG_CRYPTO_SHA1_ARM64_CE \ CONFIG_CRYPTO_SHA1_OCTEON \ CONFIG_CRYPTO_SHA1_PPC_SPE \ CONFIG_CRYPTO_SHA1_SSSE3 @@ -927,9 +947,20 @@ define KernelPackage/crypto-sha1/arm-neon AUTOLOAD+=$(call AutoLoad,09,sha1-arm-neon) endef +define KernelPackage/crypto-sha1/aarch64-ce + FILES+=$(LINUX_DIR)/arch/arm64/crypto/sha1-ce.ko + AUTOLOAD+=$(call AutoLoad,09,sha1-ce) +endef + KernelPackage/crypto-sha1/imx=$(KernelPackage/crypto-sha1/arm-neon) KernelPackage/crypto-sha1/ipq40xx=$(KernelPackage/crypto-sha1/arm-neon) +KernelPackage/crypto-sha1/mediatek/filogic=$(KernelPackage/crypto-sha1/aarch64-ce) +KernelPackage/crypto-sha1/mediatek/mt7622=$(KernelPackage/crypto-sha1/aarch64-ce) KernelPackage/crypto-sha1/mvebu/cortexa9=$(KernelPackage/crypto-sha1/arm-neon) +KernelPackage/crypto-sha1/mvebu/cortexa53=$(KernelPackage/crypto-sha1/aarch64-ce) +KernelPackage/crypto-sha1/mvebu/cortexa72=$(KernelPackage/crypto-sha1/aarch64-ce) +KernelPackage/crypto-sha1/qualcommax=$(KernelPackage/crypto-sha1/aarch64-ce) +KernelPackage/crypto-sha1/rockchip/armv8=$(KernelPackage/crypto-sha1/aarch64-ce) define KernelPackage/crypto-sha1/octeon FILES+=$(LINUX_DIR)/arch/mips/cavium-octeon/crypto/octeon-sha1.ko @@ -958,6 +989,18 @@ endif $(eval $(call KernelPackage,crypto-sha1)) +define KernelPackage/crypto-sha3 + TITLE:=SHA3 digest CryptoAPI module + DEPENDS:=+kmod-crypto-hash + KCONFIG:= CONFIG_CRYPTO_SHA3 + FILES:=$(LINUX_DIR)/crypto/sha3_generic.ko + AUTOLOAD:=$(call AutoLoad,09,sha3_generic) + $(call AddDepends/crypto) +endef + +$(eval $(call KernelPackage,crypto-sha3)) + + define KernelPackage/crypto-sha256 TITLE:=SHA224 SHA256 digest CryptoAPI module DEPENDS:=+kmod-crypto-hash @@ -965,6 +1008,8 @@ define KernelPackage/crypto-sha256 CONFIG_CRYPTO_SHA256 \ CONFIG_CRYPTO_SHA256_OCTEON \ CONFIG_CRYPTO_SHA256_PPC_SPE \ + CONFIG_CRYPTO_SHA256_ARM64 \ + CONFIG_CRYPTO_SHA2_ARM64_CE \ CONFIG_CRYPTO_SHA256_SSSE3 FILES:= \ $(LINUX_DIR)/crypto/sha256_generic.ko \ @@ -973,6 +1018,17 @@ define KernelPackage/crypto-sha256 $(call AddDepends/crypto) endef +define KernelPackage/crypto-sha256/aarch64 + FILES+=$(LINUX_DIR)/arch/arm64/crypto/sha256-arm64.ko + AUTOLOAD+=$(call AutoLoad,09,sha256-arm64) +endef + +define KernelPackage/crypto-sha256/aarch64-ce + $(call KernelPackage/crypto-sha256/aarch64) + FILES+=$(LINUX_DIR)/arch/arm64/crypto/sha2-ce.ko + AUTOLOAD+=$(call AutoLoad,09,sha2-ce) +endef + define KernelPackage/crypto-sha256/octeon FILES+=$(LINUX_DIR)/arch/mips/cavium-octeon/crypto/octeon-sha256.ko AUTOLOAD+=$(call AutoLoad,09,octeon-sha256) @@ -990,6 +1046,13 @@ define KernelPackage/crypto-sha256/x86_64 endef endif +KernelPackage/crypto-sha256/mediatek/filogic=$(KernelPackage/crypto-sha256/aarch64-ce) +KernelPackage/crypto-sha256/mediatek/mt7622=$(KernelPackage/crypto-sha256/aarch64-ce) +KernelPackage/crypto-sha256/mvebu/cortexa53=$(KernelPackage/crypto-sha256/aarch64-ce) +KernelPackage/crypto-sha256/mvebu/cortexa72=$(KernelPackage/crypto-sha256/aarch64-ce) +KernelPackage/crypto-sha256/qualcommax=$(KernelPackage/crypto-sha256/aarch64-ce) +KernelPackage/crypto-sha256/rockchip/armv8=$(KernelPackage/crypto-sha256/aarch64-ce) + ifdef KernelPackage/crypto-sha256/$(ARCH) KernelPackage/crypto-sha256/$(CRYPTO_TARGET)=\ $(KernelPackage/crypto-sha256/$(ARCH)) @@ -1004,6 +1067,7 @@ define KernelPackage/crypto-sha512 KCONFIG:= \ CONFIG_CRYPTO_SHA512 \ CONFIG_CRYPTO_SHA512_ARM \ + CONFIG_CRYPTO_SHA512_ARM64 \ CONFIG_CRYPTO_SHA512_OCTEON \ CONFIG_CRYPTO_SHA512_SSSE3 FILES:=$(LINUX_DIR)/crypto/sha512_generic.ko @@ -1016,6 +1080,11 @@ define KernelPackage/crypto-sha512/arm AUTOLOAD+=$(call AutoLoad,09,sha512-arm) endef +define KernelPackage/crypto-sha512/aarch64 + FILES+=$(LINUX_DIR)/arch/arm64/crypto/sha512-arm64.ko + AUTOLOAD+=$(call AutoLoad,09,sha512-arm64) +endef + KernelPackage/crypto-sha512/imx=$(KernelPackage/crypto-sha512/arm) KernelPackage/crypto-sha512/ipq40xx=$(KernelPackage/crypto-sha512/arm) KernelPackage/crypto-sha512/mvebu/cortexa9=$(KernelPackage/crypto-sha512/arm) @@ -1054,7 +1123,7 @@ $(eval $(call KernelPackage,crypto-test)) define KernelPackage/crypto-user TITLE:=CryptoAPI userspace interface - DEPENDS:=+kmod-crypto-hash +kmod-crypto-manager + DEPENDS:=+kmod-crypto-hash +kmod-crypto-manager +LINUX_6_6:kmod-crypto-rng KCONFIG:= \ CONFIG_CRYPTO_USER \ CONFIG_CRYPTO_USER_API \ diff --git a/package/kernel/linux/modules/fs.mk b/package/kernel/linux/modules/fs.mk index 58af180c280147..0d98c5a6815166 100644 --- a/package/kernel/linux/modules/fs.mk +++ b/package/kernel/linux/modules/fs.mk @@ -10,7 +10,7 @@ FS_MENU:=Filesystems define KernelPackage/fs-9p SUBMENU:=$(FS_MENU) TITLE:=Plan 9 Resource Sharing Support - DEPENDS:=+kmod-9pnet +LINUX_6_1:kmod-fs-netfs + DEPENDS:=+kmod-9pnet +LINUX_6_1:kmod-fs-netfs +LINUX_6_6:kmod-fs-netfs KCONFIG:=\ CONFIG_9P_FS \ CONFIG_9P_FS_POSIX_ACL=n \ @@ -87,6 +87,7 @@ define KernelPackage/fs-smbfs-common SUBMENU:=$(FS_MENU) TITLE:=SMBFS common dependencies support HIDDEN:=1 + DEPENDS:=+LINUX_6_6:kmod-fs-netfs +LINUX_6_6:kmod-nls-ucs2-utils KCONFIG:=\ CONFIG_SMBFS_COMMON@lt6.1 \ CONFIG_SMBFS@ge6.1 @@ -343,6 +344,7 @@ define KernelPackage/fs-jfs KCONFIG:=CONFIG_JFS_FS FILES:=$(LINUX_DIR)/fs/jfs/jfs.ko AUTOLOAD:=$(call AutoLoad,30,jfs,1) + DEPENDS:=+LINUX_6_6:kmod-nls-ucs2-utils $(call AddDepends/nls) endef @@ -470,8 +472,7 @@ define KernelPackage/fs-nfs-common FILES:= \ $(LINUX_DIR)/fs/lockd/lockd.ko \ $(LINUX_DIR)/net/sunrpc/sunrpc.ko \ - $(LINUX_DIR)/fs/nfs_common/grace.ko \ - $(LINUX_DIR)/fs/nfs_common/nfs_ssc.ko + $(LINUX_DIR)/fs/nfs_common/grace.ko AUTOLOAD:=$(call AutoLoad,30,grace sunrpc lockd) endef @@ -712,6 +713,7 @@ define KernelPackage/pstore CONFIG_PSTORE_DEFLATE_COMPRESS_DEFAULT=y FILES:= $(LINUX_DIR)/fs/pstore/pstore.ko AUTOLOAD:=$(call AutoLoad,30,pstore,1) + DEPENDS:=+LINUX_6_6:kmod-lib-zlib-deflate +LINUX_6_6:kmod-lib-zlib-inflate endef define KernelPackage/pstore/description diff --git a/package/kernel/linux/modules/hwmon.mk b/package/kernel/linux/modules/hwmon.mk index e2643099c17154..8fea8ef688e531 100644 --- a/package/kernel/linux/modules/hwmon.mk +++ b/package/kernel/linux/modules/hwmon.mk @@ -34,7 +34,7 @@ define KernelPackage/hwmon-ad7418 KCONFIG:=CONFIG_SENSORS_AD7418 FILES:=$(LINUX_DIR)/drivers/hwmon/ad7418.ko AUTOLOAD:=$(call AutoLoad,60,ad7418 ad7418) - $(call AddDepends/hwmon,+kmod-i2c-core) + $(call AddDepends/hwmon,+kmod-i2c-core +LINUX_6_6:kmod-regmap-core) endef define KernelPackage/hwmon-ad7418/description @@ -52,7 +52,7 @@ define KernelPackage/hwmon-adt7410 $(LINUX_DIR)/drivers/hwmon/adt7x10.ko \ $(LINUX_DIR)/drivers/hwmon/adt7410.ko AUTOLOAD:=$(call AutoLoad,60,adt7x10 adt7410) - $(call AddDepends/hwmon,+kmod-i2c-core +LINUX_6_1:kmod-regmap-core) + $(call AddDepends/hwmon,+kmod-i2c-core +!LINUX_5_15:kmod-regmap-core) endef define KernelPackage/hwmon-adt7410/description @@ -82,7 +82,7 @@ define KernelPackage/hwmon-coretemp KCONFIG:=CONFIG_SENSORS_CORETEMP FILES:=$(LINUX_DIR)/drivers/hwmon/coretemp.ko AUTOLOAD:=$(call AutoProbe,coretemp) - $(call AddDepends/hwmon,) + $(call AddDepends/hwmon,@TARGET_x86) endef define KernelPackage/hwmon-coretemp/description @@ -572,6 +572,21 @@ endef $(eval $(call KernelPackage,hwmon-sht3x)) +define KernelPackage/hwmon-tc654 + TITLE:=TC654 monitoring support + KCONFIG:=CONFIG_SENSORS_TC654 + FILES:=$(LINUX_DIR)/drivers/hwmon/tc654.ko + AUTOLOAD:=$(call AutoLoad,60,tc654) + $(call AddDepends/hwmon,+kmod-i2c-core) +endef + +define KernelPackage/hwmon-tc654/description + Kernel module for Microchip TC654/TC655 and compatibles +endef + +$(eval $(call KernelPackage,hwmon-tc654)) + + define KernelPackage/hwmon-tmp102 TITLE:=Texas Instruments TMP102 monitoring support KCONFIG:=CONFIG_SENSORS_TMP102 diff --git a/package/kernel/linux/modules/iio.mk b/package/kernel/linux/modules/iio.mk index f901f87ddd512e..7cf0952db3058c 100644 --- a/package/kernel/linux/modules/iio.mk +++ b/package/kernel/linux/modules/iio.mk @@ -383,7 +383,7 @@ $(eval $(call KernelPackage,iio-st_accel-spi)) define KernelPackage/iio-lsm6dsx - DEPENDS:=+kmod-iio-kfifo-buf +kmod-regmap-core + DEPENDS:=+kmod-iio-kfifo-buf +kmod-regmap-core +LINUX_6_6:kmod-industrialio-triggered-buffer TITLE:=ST LSM6DSx driver for IMU MEMS sensors KCONFIG:=CONFIG_IIO_ST_LSM6DSX FILES:=$(LINUX_DIR)/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.ko diff --git a/package/kernel/linux/modules/input.mk b/package/kernel/linux/modules/input.mk index 92587b1874cf05..89fba2900552a4 100644 --- a/package/kernel/linux/modules/input.mk +++ b/package/kernel/linux/modules/input.mk @@ -11,7 +11,7 @@ define KernelPackage/hid SUBMENU:=$(INPUT_MODULES_MENU) TITLE:=HID Devices DEPENDS:=+kmod-input-core +kmod-input-evdev - KCONFIG:=CONFIG_HID CONFIG_HIDRAW=y CONFIG_HID_BATTERY_STRENGTH=y + KCONFIG:=CONFIG_HID CONFIG_HID_SUPPORT=y CONFIG_HIDRAW=y CONFIG_HID_BATTERY_STRENGTH=y FILES:=$(LINUX_DIR)/drivers/hid/hid.ko AUTOLOAD:=$(call AutoLoad,61,hid) endef @@ -179,7 +179,7 @@ $(eval $(call KernelPackage,input-touchscreen-ads7846)) define KernelPackage/input-touchscreen-edt-ft5x06 SUBMENU:=$(INPUT_MODULES_MENU) TITLE:=EDT FT5x06 and Focaltech FT6236 based touchscreens - DEPENDS:=+kmod-i2c-core +kmod-input-core + DEPENDS:=+kmod-i2c-core +kmod-input-core +LINUX_6_6:kmod-regmap-i2c KCONFIG:= \ CONFIG_INPUT_TOUCHSCREEN=y \ CONFIG_TOUCHSCREEN_EDT_FT5X06 diff --git a/package/kernel/linux/modules/netdevices.mk b/package/kernel/linux/modules/netdevices.mk index 30f1f01325d888..163cd9ed6a6e4a 100644 --- a/package/kernel/linux/modules/netdevices.mk +++ b/package/kernel/linux/modules/netdevices.mk @@ -378,7 +378,7 @@ $(eval $(call KernelPackage,phy-smsc)) define KernelPackage/phy-airoha-en8811h SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Airoha EN8811H 2.5G Ethernet PHY - DEPENDS:=+airoha-en8811h-firmware +kmod-libphy @LINUX_6_1 + DEPENDS:=+airoha-en8811h-firmware +kmod-libphy @!LINUX_5_15 KCONFIG:=CONFIG_AIR_EN8811H_PHY FILES:= \ $(LINUX_DIR)/drivers/net/phy/air_en8811h.ko @@ -1379,7 +1379,7 @@ $(eval $(call KernelPackage,mlx4-core)) define KernelPackage/mlx5-core SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Mellanox ConnectX(R) mlx5 core Network Driver - DEPENDS:=@PCI_SUPPORT +kmod-ptp +kmod-mlxfw + DEPENDS:=@PCI_SUPPORT +kmod-ptp +kmod-mlxfw +LINUX_6_6:kmod-hwmon-core FILES:=$(LINUX_DIR)/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.ko KCONFIG:= CONFIG_MLX5_CORE \ CONFIG_MLX5_CORE_EN=y \ @@ -1592,7 +1592,7 @@ $(eval $(call KernelPackage,pcs-xpcs)) define KernelPackage/stmmac-core SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Synopsis Ethernet Controller core (NXP,STMMicro,others) - DEPENDS:=@TARGET_x86_64||TARGET_armsr_armv8 +kmod-pcs-xpcs +kmod-ptp + DEPENDS:=@TARGET_x86_64||TARGET_armsr_armv8 +kmod-pcs-xpcs +LINUX_6_6:kmod-of-mdio +kmod-ptp KCONFIG:=CONFIG_STMMAC_ETH \ CONFIG_STMMAC_SELFTESTS=n \ CONFIG_STMMAC_PLATFORM \ @@ -1783,6 +1783,23 @@ endef $(eval $(call KernelPackage,mhi-wwan-mbim)) + +define KernelPackage/mtk-t7xx + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=MediaTek T7xx 5G modem + DEPENDS:=@!LINUX_5_15 @PCI_SUPPORT +kmod-wwan + KCONFIG:=CONFIG_MTK_T7XX + FILES:=$(LINUX_DIR)/drivers/net/wwan/t7xx/mtk_t7xx.ko + AUTOLOAD:=$(call AutoProbe,mtk_t7xx) +endef + +define KernelPackage/mtk-t7xx/description + Driver for MediaTek PCIe 5G WWAN modem T7xx device +endef + +$(eval $(call KernelPackage,mtk-t7xx)) + + define KernelPackage/atlantic SUBMENU:=$(NETWORK_DEVICES_MENU) TITLE:=Aquantia AQtion 10Gbps Ethernet NIC diff --git a/package/kernel/linux/modules/netsupport.mk b/package/kernel/linux/modules/netsupport.mk index fcf327b434e12e..0ee58fada47bb8 100644 --- a/package/kernel/linux/modules/netsupport.mk +++ b/package/kernel/linux/modules/netsupport.mk @@ -907,10 +907,26 @@ endef $(eval $(call KernelPackage,sched-ipset)) +define KernelPackage/sched-mqprio-common + SUBMENU:=$(NETWORK_SUPPORT_MENU) + TITLE:=mqprio queue common dependencies support + DEPENDS:=@LINUX_6_6 + HIDDEN:=1 + KCONFIG:=CONFIG_NET_SCH_MQPRIO_LIB + FILES:=$(LINUX_DIR)/net/sched/sch_mqprio_lib.ko +endef + +define KernelPackage/sched-mqprio-common/description + Common library for manipulating mqprio queue configurations +endef + +$(eval $(call KernelPackage,sched-mqprio-common)) + + define KernelPackage/sched-mqprio SUBMENU:=$(NETWORK_SUPPORT_MENU) TITLE:=Multi-queue priority scheduler (MQPRIO) - DEPENDS:=+kmod-sched-core + DEPENDS:=+kmod-sched-core +LINUX_6_6:kmod-sched-mqprio-common KCONFIG:=CONFIG_NET_SCH_MQPRIO FILES:=$(LINUX_DIR)/net/sched/sch_mqprio.ko AUTOLOAD:=$(call AutoProbe, sch_mqprio) @@ -993,7 +1009,7 @@ endef $(eval $(call KernelPackage,bpf-test)) -SCHED_MODULES_EXTRA = sch_codel sch_dsmark sch_gred sch_multiq sch_sfq sch_teql sch_fq act_pedit act_simple act_skbmod act_csum em_cmp em_nbyte em_meta em_text +SCHED_MODULES_EXTRA = sch_codel sch_gred sch_multiq sch_sfq sch_teql sch_fq act_pedit act_simple act_skbmod act_csum em_cmp em_nbyte em_meta em_text SCHED_FILES_EXTRA = $(foreach mod,$(SCHED_MODULES_EXTRA),$(LINUX_DIR)/net/sched/$(mod).ko) define KernelPackage/sched @@ -1002,7 +1018,6 @@ define KernelPackage/sched DEPENDS:=+kmod-sched-core +kmod-lib-crc32c +kmod-lib-textsearch KCONFIG:= \ CONFIG_NET_SCH_CODEL \ - CONFIG_NET_SCH_DSMARK \ CONFIG_NET_SCH_GRED \ CONFIG_NET_SCH_MULTIQ \ CONFIG_NET_SCH_SFQ \ diff --git a/package/kernel/linux/modules/nls.mk b/package/kernel/linux/modules/nls.mk index 7450ed1ce56754..893ec9c23accf8 100644 --- a/package/kernel/linux/modules/nls.mk +++ b/package/kernel/linux/modules/nls.mk @@ -339,3 +339,20 @@ define KernelPackage/nls-utf8/description endef $(eval $(call KernelPackage,nls-utf8)) + + +define KernelPackage/nls-ucs2-utils + SUBMENU:=Native Language Support + TITLE:=UCS-2 common library + DEPENDS+=@LINUX_6_6 + HIDDEN:=1 + KCONFIG:=CONFIG_NLS_UCS2_UTILS + FILES:=$(LINUX_DIR)/fs/nls/nls_ucs2_utils.ko + $(call AddDepends/nls) +endef + +define KernelPackage/nls-ucs2-utils/description + UCS-2 common library +endef + +$(eval $(call KernelPackage,nls-ucs2-utils)) diff --git a/package/kernel/linux/modules/other.mk b/package/kernel/linux/modules/other.mk index 9761e52784cb6c..237a0a441908e2 100644 --- a/package/kernel/linux/modules/other.mk +++ b/package/kernel/linux/modules/other.mk @@ -578,6 +578,23 @@ endef $(eval $(call KernelPackage,rtc-isl1208)) +define KernelPackage/rtc-mv + SUBMENU:=$(OTHER_MENU) + TITLE:=Marvell SoC RTC support + DEFAULT:=m if ALL_KMODS && RTC_SUPPORT + KCONFIG:=CONFIG_RTC_DRV_MV \ + CONFIG_RTC_CLASS=y + FILES:=$(LINUX_DIR)/drivers/rtc/rtc-mv.ko + AUTOLOAD:=$(call AutoProbe,rtc-mv) +endef + +define KernelPackage/rtc-mv/description + Kernel module for Marvell SoC RTC. +endef + +$(eval $(call KernelPackage,rtc-mv)) + + define KernelPackage/rtc-pcf8563 SUBMENU:=$(OTHER_MENU) TITLE:=Philips PCF8563/Epson RTC8564 RTC support diff --git a/package/kernel/linux/modules/usb.mk b/package/kernel/linux/modules/usb.mk index 7f9e627fdb473f..7b680288b9dcd9 100644 --- a/package/kernel/linux/modules/usb.mk +++ b/package/kernel/linux/modules/usb.mk @@ -459,6 +459,44 @@ endef $(eval $(call KernelPackage,usb-dwc2-pci)) +define KernelPackage/usb-cdns + TITLE:=Cadence USB USB controller driver + DEPENDS:=+USB_GADGET_SUPPORT:kmod-usb-gadget +kmod-usb-roles + KCONFIG:= \ + CONFIG_USB_CDNS_SUPPORT + FILES:= $(LINUX_DIR)/drivers/usb/cdns3/cdns-usb-common.ko + AUTOLOAD:=$(call AutoLoad,50,cdns-usb-common,1) + $(call AddDepends/usb) +endef + +define KernelPackage/usb-cdns/description + This driver provides USB Device Controller support for the + Cadence USB Core +endef + +$(eval $(call KernelPackage,usb-cdns)) + + +define KernelPackage/usb-cdns3 + TITLE:=Cadence USB3 USB controller driver + DEPENDS:=+kmod-usb-cdns + KCONFIG:= \ + CONFIG_USB_CDNS3 \ + CONFIG_USB_CDNS3_GADGET=y \ + CONFIG_USB_CDNS3_HOST=y + FILES:= $(LINUX_DIR)/drivers/usb/cdns3/cdns3.ko + AUTOLOAD:=$(call AutoLoad,54,cdns3,1) + $(call AddDepends/usb) +endef + +define KernelPackage/usb-cdns3/description + This driver provides support for the Dual Role SuperSpeed + USB Controller based on the Cadence USB3 IP Core +endef + +$(eval $(call KernelPackage,usb-cdns3)) + + define KernelPackage/usb-dwc3 TITLE:=DWC3 USB controller driver KCONFIG:= \ @@ -1146,7 +1184,7 @@ define KernelPackage/usb-net-asix TITLE:=Kernel module for USB-to-Ethernet Asix convertors DEPENDS:= \ +kmod-libphy +kmod-net-selftests +kmod-mdio-devres +kmod-phy-ax88796b \ - +LINUX_6_1:kmod-phylink + +LINUX_6_1:kmod-phylink +LINUX_6_6:kmod-phylink KCONFIG:=CONFIG_USB_NET_AX8817X FILES:=$(LINUX_DIR)/drivers/$(USBNET_DIR)/asix.ko AUTOLOAD:=$(call AutoProbe,asix) @@ -1274,7 +1312,7 @@ $(eval $(call KernelPackage,usb-net-smsc75xx)) define KernelPackage/usb-net-smsc95xx TITLE:=SMSC LAN95XX based USB 2.0 10/100 ethernet devices - DEPENDS:=+kmod-libphy +kmod-phy-smsc +LINUX_6_1:kmod-net-selftests + DEPENDS:=+kmod-libphy +kmod-phy-smsc +!LINUX_5_15:kmod-net-selftests KCONFIG:=CONFIG_USB_NET_SMSC95XX FILES:=$(LINUX_DIR)/drivers/$(USBNET_DIR)/smsc95xx.ko AUTOLOAD:=$(call AutoProbe,smsc95xx) @@ -1567,7 +1605,7 @@ define KernelPackage/usb-hid-mcp2221 SUBMENU:=$(USB_MENU) TITLE:=Microchip USB 2.0 to I2C/UART Protocol Converter with GPIO KCONFIG:=CONFIG_HID_MCP2221 - DEPENDS:=@GPIO_SUPPORT +kmod-usb-hid +kmod-i2c-core + DEPENDS:=@GPIO_SUPPORT +kmod-usb-hid +kmod-i2c-core +LINUX_6_6:kmod-iio-core FILES:=$(LINUX_DIR)/drivers/hid/hid-mcp2221.ko AUTOLOAD:=$(call AutoProbe,hid-mcp2221) endef diff --git a/package/kernel/linux/modules/video.mk b/package/kernel/linux/modules/video.mk index 7e1bb3e7b0815d..1b87359e355299 100644 --- a/package/kernel/linux/modules/video.mk +++ b/package/kernel/linux/modules/video.mk @@ -262,7 +262,7 @@ $(eval $(call KernelPackage,drm)) define KernelPackage/drm-buddy SUBMENU:=$(VIDEO_MENU) TITLE:=A page based buddy allocator - DEPENDS:=@DISPLAY_SUPPORT +kmod-drm @LINUX_6_1 + DEPENDS:=@DISPLAY_SUPPORT +kmod-drm @LINUX_6_1||LINUX_6_6 KCONFIG:=CONFIG_DRM_BUDDY FILES:= $(LINUX_DIR)/drivers/gpu/drm/drm_buddy.ko AUTOLOAD:=$(call AutoProbe,drm_buddy) @@ -277,7 +277,7 @@ $(eval $(call KernelPackage,drm-buddy)) define KernelPackage/drm-display-helper SUBMENU:=$(VIDEO_MENU) TITLE:=DRM helpers for display adapters drivers - DEPENDS:=@DISPLAY_SUPPORT +kmod-drm-kms-helper @LINUX_6_1 + DEPENDS:=@DISPLAY_SUPPORT +kmod-drm-kms-helper @LINUX_6_1||LINUX_6_6 KCONFIG:=CONFIG_DRM_DISPLAY_HELPER FILES:=$(LINUX_DIR)/drivers/gpu/drm/display/drm_display_helper.ko AUTOLOAD:=$(call AutoProbe,drm_display_helper) @@ -289,6 +289,22 @@ endef $(eval $(call KernelPackage,drm-display-helper)) +define KernelPackage/drm-exec + SUBMENU:=$(VIDEO_MENU) + HIDDEN:=1 + TITLE:=Execution context for command submissions + DEPENDS:=@DISPLAY_SUPPORT +kmod-drm @LINUX_6_6 + KCONFIG:=CONFIG_DRM_EXEC + FILES:=$(LINUX_DIR)/drivers/gpu/drm/drm_exec.ko + AUTOLOAD:=$(call AutoProbe,drm_exec) +endef + +define KernelPackage/drm-exec/description + Execution context for command submissions. +endef + +$(eval $(call KernelPackage,drm-exec)) + define KernelPackage/drm-ttm SUBMENU:=$(VIDEO_MENU) TITLE:=GPU memory management subsystem @@ -337,19 +353,37 @@ endef $(eval $(call KernelPackage,drm-kms-helper)) +define KernelPackage/drm-suballoc-helper + SUBMENU:=$(VIDEO_MENU) + HIDDEN:=1 + TITLE:=DRM suballocation helper + DEPENDS:=@DISPLAY_SUPPORT +kmod-drm @LINUX_6_6 + KCONFIG:=CONFIG_DRM_SUBALLOC_HELPER + FILES:=$(LINUX_DIR)/drivers/gpu/drm/drm_suballoc_helper.ko + AUTOLOAD:=$(call AutoProbe,drm_suballoc_helper) +endef + +define KernelPackage/drm-suballoc-helper/description + DRM suballocation helper. +endef + +$(eval $(call KernelPackage,drm-suballoc-helper)) + define KernelPackage/drm-amdgpu SUBMENU:=$(VIDEO_MENU) TITLE:=AMDGPU DRM support DEPENDS:=@TARGET_x86 @DISPLAY_SUPPORT +kmod-backlight +kmod-drm-ttm \ +kmod-drm-ttm-helper +kmod-drm-kms-helper +kmod-i2c-algo-bit +amdgpu-firmware \ - +kmod-drm-display-helper +kmod-drm-buddy +kmod-acpi-video + +kmod-drm-display-helper +kmod-drm-buddy +kmod-acpi-video \ + +LINUX_6_6:kmod-drm-exec +LINUX_6_6:kmod-drm-suballoc-helper KCONFIG:=CONFIG_DRM_AMDGPU \ CONFIG_DRM_AMDGPU_SI=y \ CONFIG_DRM_AMDGPU_CIK=y \ CONFIG_DRM_AMD_DC=y \ CONFIG_DEBUG_KERNEL_DC=n FILES:=$(LINUX_DIR)/drivers/gpu/drm/amd/amdgpu/amdgpu.ko \ - $(LINUX_DIR)/drivers/gpu/drm/scheduler/gpu-sched.ko + $(LINUX_DIR)/drivers/gpu/drm/scheduler/gpu-sched.ko \ + $(LINUX_DIR)/drivers/gpu/drm/amd/amdxcp/amdxcp.ko@ge6.5 AUTOLOAD:=$(call AutoProbe,amdgpu) endef @@ -546,7 +580,7 @@ define KernelPackage/drm-radeon TITLE:=Radeon DRM support DEPENDS:=@TARGET_x86 @DISPLAY_SUPPORT +kmod-backlight +kmod-drm-kms-helper \ +kmod-drm-ttm +kmod-drm-ttm-helper +kmod-i2c-algo-bit +radeon-firmware \ - +kmod-drm-display-helper +kmod-acpi-video + +kmod-drm-display-helper +kmod-acpi-video +LINUX_6_6:kmod-drm-suballoc-helper KCONFIG:=CONFIG_DRM_RADEON FILES:=$(LINUX_DIR)/drivers/gpu/drm/radeon/radeon.ko AUTOLOAD:=$(call AutoProbe,radeon) @@ -626,7 +660,7 @@ $(eval $(call KernelPackage,video-videobuf2)) define KernelPackage/video-cpia2 TITLE:=CPIA2 video driver - DEPENDS:=@USB_SUPPORT +kmod-usb-core + DEPENDS:=@USB_SUPPORT +kmod-usb-core @LINUX_5_15 KCONFIG:=CONFIG_VIDEO_CPIA2 FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_USB_DIR)/cpia2/cpia2.ko AUTOLOAD:=$(call AutoProbe,cpia2) @@ -661,9 +695,10 @@ $(eval $(call KernelPackage,video-pwc)) define KernelPackage/video-uvc TITLE:=USB Video Class (UVC) support DEPENDS:=@USB_SUPPORT +kmod-usb-core +kmod-video-videobuf2 +kmod-input-core - KCONFIG:= CONFIG_USB_VIDEO_CLASS - FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_USB_DIR)/uvc/uvcvideo.ko - AUTOLOAD:=$(call AutoProbe,uvcvideo) + KCONFIG:= CONFIG_USB_VIDEO_CLASS CONFIG_UVC_COMMON@ge6.3 + FILES:=$(LINUX_DIR)/drivers/media/$(V4L2_USB_DIR)/uvc/uvcvideo.ko \ + $(LINUX_DIR)/drivers/media/common/uvc.ko@ge6.3 + AUTOLOAD:=$(call AutoProbe,uvc@ge6.3 uvcvideo) $(call AddDepends/camera) endef diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile index 6ca5c89cfaeb80..54a2bf4499273c 100644 --- a/package/kernel/mac80211/Makefile +++ b/package/kernel/mac80211/Makefile @@ -10,14 +10,13 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mac80211 -PKG_VERSION:=6.5 -PKG_RELEASE:=2 -# PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.15.58/ +PKG_VERSION:=6.6.15 +PKG_RELEASE:=1 PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources/ -PKG_HASH:=908c22dceba185eab83caa5a1e58ce6b3ebdc58f099c3fd3e11c7352ebfab2d7 +PKG_HASH:=3bbc461121134fda9089c084a5eed577d05e7837a157edf9a3797937172a3ece PKG_SOURCE:=backports-$(PKG_VERSION).tar.xz -PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/backports-$(PKG_VERSION) +PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(if $(BUILD_VARIANT),$(PKG_NAME)-$(BUILD_VARIANT)/)backports-$(PKG_VERSION) PKG_BUILD_PARALLEL:=1 PKG_MAINTAINER:=Felix Fietkau @@ -48,7 +47,13 @@ define KernelPackage/mac80211/Default MAINTAINER:=Felix Fietkau endef -config_package=$(if $(CONFIG_PACKAGE_kmod-$(1)),m) +# config_pacakge: +# 1 = OpenWrt KernelPackage name +# 2 = Optional list of variants for which the module may be selected: +# If empty, the module is only selected with the first variant +# Use $(ALL_VARIANTS) to allow module selection in all variants +config_package=$(if $(and $(CONFIG_PACKAGE_kmod-$(1)),$(call mac80211_variant_check,$(2))),m) +mac80211_variant_check=$(if $(ALL_VARIANTS),$(filter $(BUILD_VARIANT),$(if $(1),$(1),$(firstword $(ALL_VARIANTS)))),y) config-y:= \ WLAN \ @@ -73,10 +78,10 @@ config-y:= \ WLAN_VENDOR_TI \ WLAN_VENDOR_ZYDAS \ -config-$(call config_package,cfg80211) += CFG80211 +config-$(call config_package,cfg80211,$(ALL_VARIANTS)) += CFG80211 config-$(CONFIG_PACKAGE_CFG80211_TESTMODE) += NL80211_TESTMODE -config-$(call config_package,mac80211) += MAC80211 +config-$(call config_package,mac80211,$(ALL_VARIANTS)) += MAC80211 config-$(CONFIG_PACKAGE_MAC80211_MESH) += MAC80211_MESH include ath.mk diff --git a/package/kernel/mac80211/ath.mk b/package/kernel/mac80211/ath.mk index 881c89db253dc6..b0c3691a572ae6 100644 --- a/package/kernel/mac80211/ath.mk +++ b/package/kernel/mac80211/ath.mk @@ -37,7 +37,7 @@ ifdef CONFIG_PACKAGE_MAC80211_TRACING WIL6210_TRACING endif -config-$(call config_package,ath) += ATH_CARDS ATH_COMMON +config-$(call config_package,ath,regular smallbuffers) += ATH_CARDS ATH_COMMON config-$(CONFIG_PACKAGE_ATH_DEBUG) += ATH_DEBUG ATH10K_DEBUG ATH11K_DEBUG ATH9K_STATION_STATISTICS config-$(CONFIG_PACKAGE_ATH_DFS) += ATH9K_DFS_CERTIFIED ATH10K_DFS_CERTIFIED config-$(CONFIG_PACKAGE_ATH_SPECTRAL) += ATH9K_COMMON_SPECTRAL ATH10K_SPECTRAL ATH11K_SPECTRAL @@ -58,18 +58,13 @@ config-$(CONFIG_ATH10K_THERMAL) += ATH10K_THERMAL config-$(CONFIG_ATH11K_THERMAL) += ATH11K_THERMAL config-$(call config_package,ath9k-htc) += ATH9K_HTC -config-$(call config_package,ath10k) += ATH10K ATH10K_PCI -config-$(call config_package,ath10k-smallbuffers) += ATH10K ATH10K_PCI ATH10K_SMALLBUFFERS +config-$(call config_package,ath10k,regular) += ATH10K ATH10K_PCI +config-$(call config_package,ath10k-smallbuffers,smallbuffers) += ATH10K ATH10K_PCI ATH10K_SMALLBUFFERS config-$(call config_package,ath11k) += ATH11K config-$(call config_package,ath11k-ahb) += ATH11K_AHB config-$(call config_package,ath11k-pci) += ATH11K_PCI -config-$(call config_package,ath5k) += ATH5K -ifdef CONFIG_TARGET_ath25 - config-y += ATH5K_AHB -else - config-y += ATH5K_PCI -endif +config-$(call config_package,ath5k) += ATH5K ATH5K_PCI config-$(call config_package,ath6kl) += ATH6KL config-$(call config_package,ath6kl-sdio) += ATH6KL_SDIO @@ -133,7 +128,7 @@ endef define KernelPackage/ath $(call KernelPackage/mac80211/Default) TITLE:=Atheros common driver part - DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ath79||TARGET_ath25 +kmod-mac80211 + DEPENDS+= @PCI_SUPPORT||USB_SUPPORT||TARGET_ath79 +kmod-mac80211 FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath.ko MENU:=1 endef @@ -146,7 +141,7 @@ define KernelPackage/ath5k $(call KernelPackage/mac80211/Default) TITLE:=Atheros 5xxx wireless cards support URL:=https://wireless.wiki.kernel.org/en/users/drivers/ath5k - DEPENDS+= @(PCI_SUPPORT||TARGET_ath25) +kmod-ath + DEPENDS+= @PCI_SUPPORT +kmod-ath FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath5k/ath5k.ko AUTOLOAD:=$(call AutoProbe,ath5k) endef diff --git a/package/kernel/mac80211/broadcom.mk b/package/kernel/mac80211/broadcom.mk index d0b08890881baa..a6f42cd19af21b 100644 --- a/package/kernel/mac80211/broadcom.mk +++ b/package/kernel/mac80211/broadcom.mk @@ -434,6 +434,7 @@ define KernelPackage/brcmfmac/config bool "Enable SDIO bus interface support" default y if TARGET_bcm27xx default y if TARGET_imx_cortexa7 + default y if TARGET_starfive default y if TARGET_rockchip default y if TARGET_sunxi default n diff --git a/package/kernel/mac80211/patches/ath/100-wifi-ath-add-struct_group-for-struct-ath_cycle_count.patch b/package/kernel/mac80211/patches/ath/100-wifi-ath-add-struct_group-for-struct-ath_cycle_count.patch index 6c476e90581172..f464072d75084d 100644 --- a/package/kernel/mac80211/patches/ath/100-wifi-ath-add-struct_group-for-struct-ath_cycle_count.patch +++ b/package/kernel/mac80211/patches/ath/100-wifi-ath-add-struct_group-for-struct-ath_cycle_count.patch @@ -71,7 +71,7 @@ Signed-off-by: Shiji Yang /* --- a/drivers/net/wireless/ath/ath5k/mac80211-ops.c +++ b/drivers/net/wireless/ath/ath5k/mac80211-ops.c -@@ -665,7 +665,7 @@ ath5k_get_survey(struct ieee80211_hw *hw +@@ -664,7 +664,7 @@ ath5k_get_survey(struct ieee80211_hw *hw ah->survey.time_rx += cc->rx_frame / div; ah->survey.time_tx += cc->tx_frame / div; } diff --git a/package/kernel/mac80211/patches/ath11k/0001-wifi-ath11k-fix-band-selection-for-ppdu-received-in-.patch b/package/kernel/mac80211/patches/ath11k/0001-wifi-ath11k-fix-band-selection-for-ppdu-received-in-.patch deleted file mode 100644 index e6f9ac9e4c0aab..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0001-wifi-ath11k-fix-band-selection-for-ppdu-received-in-.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 72c8caf904aed2caed5d6e75233294b6159ddb5d Mon Sep 17 00:00:00 2001 -From: Aditya Kumar Singh -Date: Wed, 26 Jul 2023 10:16:24 +0530 -Subject: [PATCH 1/5] wifi: ath11k: fix band selection for ppdu received in - channel 177 of 5 GHz - -5 GHz band channel 177 support was added with the commit e5e94d10c856 ("wifi: -ath11k: add channel 177 into 5 GHz channel list"). However, during processing -for the received ppdu in ath11k_dp_rx_h_ppdu(), channel number is checked only -till 173. This leads to driver code checking for channel and then fetching the -band from it which is extra effort since firmware has already given the channel -number in the metadata. - -Fix this issue by checking the channel number till 177 since we support -it now. - -Found via code review. Compile tested only. - -Fixes: e5e94d10c856 ("wifi: ath11k: add channel 177 into 5 GHz channel list") -Signed-off-by: Aditya Kumar Singh -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230726044624.20507-1-quic_adisi@quicinc.com ---- - drivers/net/wireless/ath/ath11k/dp_rx.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/ath/ath11k/dp_rx.c -+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c -@@ -2408,7 +2408,7 @@ static void ath11k_dp_rx_h_ppdu(struct a - rx_status->freq = center_freq; - } else if (channel_num >= 1 && channel_num <= 14) { - rx_status->band = NL80211_BAND_2GHZ; -- } else if (channel_num >= 36 && channel_num <= 173) { -+ } else if (channel_num >= 36 && channel_num <= 177) { - rx_status->band = NL80211_BAND_5GHZ; - } else { - spin_lock_bh(&ar->data_lock); diff --git a/package/kernel/mac80211/patches/ath11k/0002-wifi-ath11k-simplify-ath11k_mac_validate_vht_he_fixe.patch b/package/kernel/mac80211/patches/ath11k/0002-wifi-ath11k-simplify-ath11k_mac_validate_vht_he_fixe.patch deleted file mode 100644 index ad761e6a909098..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0002-wifi-ath11k-simplify-ath11k_mac_validate_vht_he_fixe.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 6f092c98dcfa1e4cf37d45f9b8e4d4a3cbeb79d4 Mon Sep 17 00:00:00 2001 -From: Dmitry Antipov -Date: Wed, 26 Jul 2023 12:21:02 +0300 -Subject: [PATCH 2/5] wifi: ath11k: simplify - ath11k_mac_validate_vht_he_fixed_rate_settings() - -In ath11k_mac_validate_vht_he_fixed_rate_settings() ar->ab->peers -list is not altered so list_for_each_entry() should be safe. - -Compile tested only. - -Signed-off-by: Dmitry Antipov -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230726092113.78794-1-dmantipov@yandex.ru ---- - drivers/net/wireless/ath/ath11k/mac.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -8258,7 +8258,7 @@ ath11k_mac_validate_vht_he_fixed_rate_se - const struct cfg80211_bitrate_mask *mask) - { - bool he_fixed_rate = false, vht_fixed_rate = false; -- struct ath11k_peer *peer, *tmp; -+ struct ath11k_peer *peer; - const u16 *vht_mcs_mask, *he_mcs_mask; - struct ieee80211_link_sta *deflink; - u8 vht_nss, he_nss; -@@ -8281,7 +8281,7 @@ ath11k_mac_validate_vht_he_fixed_rate_se - - rcu_read_lock(); - spin_lock_bh(&ar->ab->base_lock); -- list_for_each_entry_safe(peer, tmp, &ar->ab->peers, list) { -+ list_for_each_entry(peer, &ar->ab->peers, list) { - if (peer->sta) { - deflink = &peer->sta->deflink; - diff --git a/package/kernel/mac80211/patches/ath11k/0003-wifi-ath11k-Split-coldboot-calibration-hw_param.patch b/package/kernel/mac80211/patches/ath11k/0003-wifi-ath11k-Split-coldboot-calibration-hw_param.patch deleted file mode 100644 index f8c7c937eabfa8..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0003-wifi-ath11k-Split-coldboot-calibration-hw_param.patch +++ /dev/null @@ -1,180 +0,0 @@ -From 011e5a3052a22d3758d17442bf0c04c68bf79bea Mon Sep 17 00:00:00 2001 -From: Seevalamuthu Mariappan -Date: Wed, 26 Jul 2023 19:40:30 +0530 -Subject: [PATCH 3/5] wifi: ath11k: Split coldboot calibration hw_param - -QCN9074 enables coldboot calibration only in Factory Test Mode (FTM). -Hence, split cold_boot_calib to two hw_params for mission and FTM -mode. - -Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Seevalamuthu Mariappan -Signed-off-by: Raj Kumar Bhagat -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230726141032.3061-2-quic_rajkbhag@quicinc.com ---- - drivers/net/wireless/ath/ath11k/ahb.c | 3 +-- - drivers/net/wireless/ath/ath11k/core.c | 36 ++++++++++++++++++++------ - drivers/net/wireless/ath/ath11k/core.h | 1 + - drivers/net/wireless/ath/ath11k/hw.h | 3 ++- - drivers/net/wireless/ath/ath11k/qmi.c | 6 ++--- - 5 files changed, 35 insertions(+), 14 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/ahb.c -+++ b/drivers/net/wireless/ath/ath11k/ahb.c -@@ -422,8 +422,7 @@ static int ath11k_ahb_fwreset_from_cold_ - { - int timeout; - -- if (ath11k_cold_boot_cal == 0 || ab->qmi.cal_done || -- ab->hw_params.cold_boot_calib == 0 || -+ if (!ath11k_core_coldboot_cal_support(ab) || ab->qmi.cal_done || - ab->hw_params.cbcal_restart_fw == 0) - return 0; - ---- a/drivers/net/wireless/ath/ath11k/core.c -+++ b/drivers/net/wireless/ath/ath11k/core.c -@@ -86,7 +86,8 @@ static const struct ath11k_hw_params ath - .supports_shadow_regs = false, - .idle_ps = false, - .supports_sta_ps = false, -- .cold_boot_calib = true, -+ .coldboot_cal_mm = true, -+ .coldboot_cal_ftm = true, - .cbcal_restart_fw = true, - .fw_mem_mode = 0, - .num_vdevs = 16 + 1, -@@ -167,7 +168,8 @@ static const struct ath11k_hw_params ath - .supports_shadow_regs = false, - .idle_ps = false, - .supports_sta_ps = false, -- .cold_boot_calib = true, -+ .coldboot_cal_mm = true, -+ .coldboot_cal_ftm = true, - .cbcal_restart_fw = true, - .fw_mem_mode = 0, - .num_vdevs = 16 + 1, -@@ -248,7 +250,8 @@ static const struct ath11k_hw_params ath - .supports_shadow_regs = true, - .idle_ps = true, - .supports_sta_ps = true, -- .cold_boot_calib = false, -+ .coldboot_cal_mm = false, -+ .coldboot_cal_ftm = false, - .cbcal_restart_fw = false, - .fw_mem_mode = 0, - .num_vdevs = 16 + 1, -@@ -332,7 +335,8 @@ static const struct ath11k_hw_params ath - .supports_shadow_regs = false, - .idle_ps = false, - .supports_sta_ps = false, -- .cold_boot_calib = false, -+ .coldboot_cal_mm = false, -+ .coldboot_cal_ftm = false, - .cbcal_restart_fw = false, - .fw_mem_mode = 2, - .num_vdevs = 8, -@@ -413,7 +417,8 @@ static const struct ath11k_hw_params ath - .supports_shadow_regs = true, - .idle_ps = true, - .supports_sta_ps = true, -- .cold_boot_calib = false, -+ .coldboot_cal_mm = false, -+ .coldboot_cal_ftm = false, - .cbcal_restart_fw = false, - .fw_mem_mode = 0, - .num_vdevs = 16 + 1, -@@ -495,7 +500,8 @@ static const struct ath11k_hw_params ath - .supports_shadow_regs = true, - .idle_ps = true, - .supports_sta_ps = true, -- .cold_boot_calib = false, -+ .coldboot_cal_mm = false, -+ .coldboot_cal_ftm = false, - .cbcal_restart_fw = false, - .fw_mem_mode = 0, - .num_vdevs = 16 + 1, -@@ -578,7 +584,8 @@ static const struct ath11k_hw_params ath - .supports_shadow_regs = true, - .idle_ps = true, - .supports_sta_ps = true, -- .cold_boot_calib = true, -+ .coldboot_cal_mm = true, -+ .coldboot_cal_ftm = true, - .cbcal_restart_fw = false, - .fw_mem_mode = 0, - .num_vdevs = 16 + 1, -@@ -667,7 +674,8 @@ static const struct ath11k_hw_params ath - .supports_suspend = false, - .hal_params = &ath11k_hw_hal_params_ipq8074, - .single_pdev_only = false, -- .cold_boot_calib = true, -+ .coldboot_cal_mm = true, -+ .coldboot_cal_ftm = true, - .cbcal_restart_fw = true, - .fix_l1ss = true, - .supports_dynamic_smps_6ghz = false, -@@ -749,6 +757,18 @@ void ath11k_fw_stats_free(struct ath11k_ - ath11k_fw_stats_bcn_free(&stats->bcn); - } - -+bool ath11k_core_coldboot_cal_support(struct ath11k_base *ab) -+{ -+ if (!ath11k_cold_boot_cal) -+ return false; -+ -+ if (ath11k_ftm_mode) -+ return ab->hw_params.coldboot_cal_ftm; -+ -+ else -+ return ab->hw_params.coldboot_cal_mm; -+} -+ - int ath11k_core_suspend(struct ath11k_base *ab) - { - int ret; ---- a/drivers/net/wireless/ath/ath11k/core.h -+++ b/drivers/net/wireless/ath/ath11k/core.h -@@ -1186,6 +1186,7 @@ void ath11k_core_halt(struct ath11k *ar) - int ath11k_core_resume(struct ath11k_base *ab); - int ath11k_core_suspend(struct ath11k_base *ab); - void ath11k_core_pre_reconfigure_recovery(struct ath11k_base *ab); -+bool ath11k_core_coldboot_cal_support(struct ath11k_base *ab); - - const struct firmware *ath11k_core_firmware_request(struct ath11k_base *ab, - const char *filename); ---- a/drivers/net/wireless/ath/ath11k/hw.h -+++ b/drivers/net/wireless/ath/ath11k/hw.h -@@ -187,7 +187,8 @@ struct ath11k_hw_params { - bool supports_shadow_regs; - bool idle_ps; - bool supports_sta_ps; -- bool cold_boot_calib; -+ bool coldboot_cal_mm; -+ bool coldboot_cal_ftm; - bool cbcal_restart_fw; - int fw_mem_mode; - u32 num_vdevs; ---- a/drivers/net/wireless/ath/ath11k/qmi.c -+++ b/drivers/net/wireless/ath/ath11k/qmi.c -@@ -2079,7 +2079,7 @@ static int ath11k_qmi_assign_target_mem_ - return -EINVAL; - } - -- if (ath11k_cold_boot_cal && ab->hw_params.cold_boot_calib) { -+ if (ath11k_core_coldboot_cal_support(ab)) { - if (hremote_node) { - ab->qmi.target_mem[idx].paddr = - res.start + host_ddr_sz; -@@ -3209,8 +3209,8 @@ static void ath11k_qmi_driver_event_work - break; - } - -- if (ath11k_cold_boot_cal && ab->qmi.cal_done == 0 && -- ab->hw_params.cold_boot_calib) { -+ if (ab->qmi.cal_done == 0 && -+ ath11k_core_coldboot_cal_support(ab)) { - ath11k_qmi_process_coldboot_calibration(ab); - } else { - clear_bit(ATH11K_FLAG_CRASH_FLUSH, diff --git a/package/kernel/mac80211/patches/ath11k/0004-wifi-ath11k-Add-coldboot-calibration-support-for-QCN.patch b/package/kernel/mac80211/patches/ath11k/0004-wifi-ath11k-Add-coldboot-calibration-support-for-QCN.patch deleted file mode 100644 index 9d51c1c3eaaef5..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0004-wifi-ath11k-Add-coldboot-calibration-support-for-QCN.patch +++ /dev/null @@ -1,176 +0,0 @@ -From bdfc967bf5fcd762473a01d39edb81f1165ba290 Mon Sep 17 00:00:00 2001 -From: Anilkumar Kolli -Date: Wed, 26 Jul 2023 19:40:31 +0530 -Subject: [PATCH 4/5] wifi: ath11k: Add coldboot calibration support for - QCN9074 - -QCN9074 supports 6 GHz, which has increased number of channels -compared to 5 GHz/2 GHz. So, to support coldboot calibration in -QCN9074 ATH11K_COLD_BOOT_FW_RESET_DELAY extended to 60 seconds. To -avoid code redundancy, fwreset_from_cold_boot moved to QMI and made -common for both ahb and pci. Coldboot calibration is enabled only in -FTM mode for QCN9074. QCN9074 requires firmware restart after coldboot, -hence enable cbcal_restart_fw in hw_params. - -This support can be enabled/disabled using hw params for different -hardware. Currently it is not enabled for QCA6390. - -Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Anilkumar Kolli -Signed-off-by: Seevalamuthu Mariappan -Signed-off-by: Raj Kumar Bhagat -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230726141032.3061-3-quic_rajkbhag@quicinc.com ---- - drivers/net/wireless/ath/ath11k/ahb.c | 28 ++------------------------ - drivers/net/wireless/ath/ath11k/core.c | 4 ++-- - drivers/net/wireless/ath/ath11k/pci.c | 2 ++ - drivers/net/wireless/ath/ath11k/qmi.c | 28 ++++++++++++++++++++++++++ - drivers/net/wireless/ath/ath11k/qmi.h | 3 ++- - 5 files changed, 36 insertions(+), 29 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/ahb.c -+++ b/drivers/net/wireless/ath/ath11k/ahb.c -@@ -14,6 +14,7 @@ - #include "ahb.h" - #include "debug.h" - #include "hif.h" -+#include "qmi.h" - #include - #include "pcic.h" - #include -@@ -418,31 +419,6 @@ static void ath11k_ahb_power_down(struct - rproc_shutdown(ab_ahb->tgt_rproc); - } - --static int ath11k_ahb_fwreset_from_cold_boot(struct ath11k_base *ab) --{ -- int timeout; -- -- if (!ath11k_core_coldboot_cal_support(ab) || ab->qmi.cal_done || -- ab->hw_params.cbcal_restart_fw == 0) -- return 0; -- -- ath11k_dbg(ab, ATH11K_DBG_AHB, "wait for cold boot done\n"); -- timeout = wait_event_timeout(ab->qmi.cold_boot_waitq, -- (ab->qmi.cal_done == 1), -- ATH11K_COLD_BOOT_FW_RESET_DELAY); -- if (timeout <= 0) { -- ath11k_cold_boot_cal = 0; -- ath11k_warn(ab, "Coldboot Calibration failed timed out\n"); -- } -- -- /* reset the firmware */ -- ath11k_ahb_power_down(ab); -- ath11k_ahb_power_up(ab); -- -- ath11k_dbg(ab, ATH11K_DBG_AHB, "exited from cold boot mode\n"); -- return 0; --} -- - static void ath11k_ahb_init_qmi_ce_config(struct ath11k_base *ab) - { - struct ath11k_qmi_ce_cfg *cfg = &ab->qmi.ce_cfg; -@@ -1225,7 +1201,7 @@ static int ath11k_ahb_probe(struct platf - goto err_ce_free; - } - -- ath11k_ahb_fwreset_from_cold_boot(ab); -+ ath11k_qmi_fwreset_from_cold_boot(ab); - - return 0; - ---- a/drivers/net/wireless/ath/ath11k/core.c -+++ b/drivers/net/wireless/ath/ath11k/core.c -@@ -336,8 +336,8 @@ static const struct ath11k_hw_params ath - .idle_ps = false, - .supports_sta_ps = false, - .coldboot_cal_mm = false, -- .coldboot_cal_ftm = false, -- .cbcal_restart_fw = false, -+ .coldboot_cal_ftm = true, -+ .cbcal_restart_fw = true, - .fw_mem_mode = 2, - .num_vdevs = 8, - .num_peers = 128, ---- a/drivers/net/wireless/ath/ath11k/pci.c -+++ b/drivers/net/wireless/ath/ath11k/pci.c -@@ -15,6 +15,7 @@ - #include "mhi.h" - #include "debug.h" - #include "pcic.h" -+#include "qmi.h" - - #define ATH11K_PCI_BAR_NUM 0 - #define ATH11K_PCI_DMA_MASK 32 -@@ -897,6 +898,7 @@ unsupported_wcn6855_soc: - ath11k_err(ab, "failed to init core: %d\n", ret); - goto err_irq_affinity_cleanup; - } -+ ath11k_qmi_fwreset_from_cold_boot(ab); - return 0; - - err_irq_affinity_cleanup: ---- a/drivers/net/wireless/ath/ath11k/qmi.c -+++ b/drivers/net/wireless/ath/ath11k/qmi.c -@@ -9,6 +9,7 @@ - #include "qmi.h" - #include "core.h" - #include "debug.h" -+#include "hif.h" - #include - #include - #include -@@ -2839,6 +2840,33 @@ int ath11k_qmi_firmware_start(struct ath - return 0; - } - -+int ath11k_qmi_fwreset_from_cold_boot(struct ath11k_base *ab) -+{ -+ int timeout; -+ -+ if (!ath11k_core_coldboot_cal_support(ab) || ab->qmi.cal_done || -+ ab->hw_params.cbcal_restart_fw == 0) -+ return 0; -+ -+ ath11k_dbg(ab, ATH11K_DBG_QMI, "wait for cold boot done\n"); -+ -+ timeout = wait_event_timeout(ab->qmi.cold_boot_waitq, -+ (ab->qmi.cal_done == 1), -+ ATH11K_COLD_BOOT_FW_RESET_DELAY); -+ -+ if (timeout <= 0) { -+ ath11k_warn(ab, "Coldboot Calibration timed out\n"); -+ return -ETIMEDOUT; -+ } -+ -+ /* reset the firmware */ -+ ath11k_hif_power_down(ab); -+ ath11k_hif_power_up(ab); -+ ath11k_dbg(ab, ATH11K_DBG_QMI, "exit wait for cold boot done\n"); -+ return 0; -+} -+EXPORT_SYMBOL(ath11k_qmi_fwreset_from_cold_boot); -+ - static int ath11k_qmi_process_coldboot_calibration(struct ath11k_base *ab) - { - int timeout; ---- a/drivers/net/wireless/ath/ath11k/qmi.h -+++ b/drivers/net/wireless/ath/ath11k/qmi.h -@@ -37,7 +37,7 @@ - - #define QMI_WLANFW_MAX_DATA_SIZE_V01 6144 - #define ATH11K_FIRMWARE_MODE_OFF 4 --#define ATH11K_COLD_BOOT_FW_RESET_DELAY (40 * HZ) -+#define ATH11K_COLD_BOOT_FW_RESET_DELAY (60 * HZ) - - #define ATH11K_QMI_DEVICE_BAR_SIZE 0x200000 - -@@ -519,5 +519,6 @@ void ath11k_qmi_msg_recv_work(struct wor - void ath11k_qmi_deinit_service(struct ath11k_base *ab); - int ath11k_qmi_init_service(struct ath11k_base *ab); - void ath11k_qmi_free_resource(struct ath11k_base *ab); -+int ath11k_qmi_fwreset_from_cold_boot(struct ath11k_base *ab); - - #endif diff --git a/package/kernel/mac80211/patches/ath11k/0005-wifi-ath11k-Remove-cal_done-check-during-probe.patch b/package/kernel/mac80211/patches/ath11k/0005-wifi-ath11k-Remove-cal_done-check-during-probe.patch deleted file mode 100644 index 884fd58d75b0ff..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0005-wifi-ath11k-Remove-cal_done-check-during-probe.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 13329d0cb7212b058bd8451a99d215a8f97645ea Mon Sep 17 00:00:00 2001 -From: Seevalamuthu Mariappan -Date: Wed, 26 Jul 2023 19:40:32 +0530 -Subject: [PATCH 5/5] wifi: ath11k: Remove cal_done check during probe - -In some race conditions, calibration done QMI message is received even -before host wait starts for calibration to be done. -Due to this, resetting firmware was not performed after calibration. - -Hence, remove cal_done check in ath11k_qmi_fwreset_from_cold_boot() -as this is called only from probe. - -Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1 - -Signed-off-by: Seevalamuthu Mariappan -Signed-off-by: Raj Kumar Bhagat -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230726141032.3061-4-quic_rajkbhag@quicinc.com ---- - drivers/net/wireless/ath/ath11k/qmi.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/ath/ath11k/qmi.c -+++ b/drivers/net/wireless/ath/ath11k/qmi.c -@@ -2844,7 +2844,7 @@ int ath11k_qmi_fwreset_from_cold_boot(st - { - int timeout; - -- if (!ath11k_core_coldboot_cal_support(ab) || ab->qmi.cal_done || -+ if (!ath11k_core_coldboot_cal_support(ab) || - ab->hw_params.cbcal_restart_fw == 0) - return 0; - diff --git a/package/kernel/mac80211/patches/ath11k/0006-wifi-ath11k-Don-t-drop-tx_status-when-peer-cannot-be.patch b/package/kernel/mac80211/patches/ath11k/0006-wifi-ath11k-Don-t-drop-tx_status-when-peer-cannot-be.patch deleted file mode 100644 index e404a7849e63f2..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0006-wifi-ath11k-Don-t-drop-tx_status-when-peer-cannot-be.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 400ece6c7f346b0a30867bd00b03b5b2563d4357 Mon Sep 17 00:00:00 2001 -From: Sven Eckelmann -Date: Tue, 22 Aug 2023 16:42:24 +0300 -Subject: [PATCH] wifi: ath11k: Don't drop tx_status when peer cannot be found - -When a station idles for a long time, hostapd will try to send a QoS Null -frame to the station as "poll". NL80211_CMD_PROBE_CLIENT is used for this -purpose. And the skb will be added to ack_status_frame - waiting for a -completion via ieee80211_report_ack_skb(). - -But when the peer was already removed before the tx_complete arrives, the -peer will be missing. And when using dev_kfree_skb_any (instead of going -through mac80211), the entry will stay inside ack_status_frames. This IDR -will therefore run full after 8K request were generated for such clients. -At this point, the access point will then just stall and not allow any new -clients because idr_alloc() for ack_status_frame will fail. - -ieee80211_free_txskb() on the other hand will (when required) call -ieee80211_report_ack_skb() and make sure that (when required) remove the -entry from the ack_status_frame. - -Tested-on: IPQ6018 hw1.0 WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1 - -Fixes: 6257c702264c ("wifi: ath11k: fix tx status reporting in encap offload mode") -Fixes: 94739d45c388 ("ath11k: switch to using ieee80211_tx_status_ext()") -Cc: stable@vger.kernel.org -Signed-off-by: Sven Eckelmann -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230802-ath11k-ack_status_leak-v2-1-c0af729d6229@narfation.org ---- - drivers/net/wireless/ath/ath11k/dp_tx.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/dp_tx.c -+++ b/drivers/net/wireless/ath/ath11k/dp_tx.c -@@ -369,7 +369,7 @@ ath11k_dp_tx_htt_tx_complete_buf(struct - "dp_tx: failed to find the peer with peer_id %d\n", - ts->peer_id); - spin_unlock_bh(&ab->base_lock); -- dev_kfree_skb_any(msdu); -+ ieee80211_free_txskb(ar->hw, msdu); - return; - } - spin_unlock_bh(&ab->base_lock); -@@ -624,7 +624,7 @@ static void ath11k_dp_tx_complete_msdu(s - "dp_tx: failed to find the peer with peer_id %d\n", - ts->peer_id); - spin_unlock_bh(&ab->base_lock); -- dev_kfree_skb_any(msdu); -+ ieee80211_free_txskb(ar->hw, msdu); - return; - } - arsta = (struct ath11k_sta *)peer->sta->drv_priv; diff --git a/package/kernel/mac80211/patches/ath11k/0007-wifi-ath11k-Cleanup-mac80211-references-on-failure-d.patch b/package/kernel/mac80211/patches/ath11k/0007-wifi-ath11k-Cleanup-mac80211-references-on-failure-d.patch deleted file mode 100644 index ae9cd05dd6220e..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0007-wifi-ath11k-Cleanup-mac80211-references-on-failure-d.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 29d15589f084d71a4ea8c544039c5839db0236e2 Mon Sep 17 00:00:00 2001 -From: Sven Eckelmann -Date: Tue, 22 Aug 2023 16:42:24 +0300 -Subject: [PATCH] wifi: ath11k: Cleanup mac80211 references on failure during - tx_complete - -When a function is using functions from mac80211 to free an skb then it -should do it consistently and not switch to the generic dev_kfree_skb_any -(or similar functions). Otherwise (like in the error handlers), mac80211 -will will not be aware of the freed skb and thus not clean up related -information in its internal data structures. - -Not doing so lead in the past to filled up structure which then prevented -new clients to connect. - -Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices") -Fixes: 6257c702264c ("wifi: ath11k: fix tx status reporting in encap offload mode") -Cc: stable@vger.kernel.org -Signed-off-by: Sven Eckelmann -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230802-ath11k-ack_status_leak-v2-2-c0af729d6229@narfation.org ---- - drivers/net/wireless/ath/ath11k/dp_tx.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/dp_tx.c -+++ b/drivers/net/wireless/ath/ath11k/dp_tx.c -@@ -344,7 +344,7 @@ ath11k_dp_tx_htt_tx_complete_buf(struct - dma_unmap_single(ab->dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE); - - if (!skb_cb->vif) { -- dev_kfree_skb_any(msdu); -+ ieee80211_free_txskb(ar->hw, msdu); - return; - } - -@@ -566,12 +566,12 @@ static void ath11k_dp_tx_complete_msdu(s - dma_unmap_single(ab->dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE); - - if (unlikely(!rcu_access_pointer(ab->pdevs_active[ar->pdev_idx]))) { -- dev_kfree_skb_any(msdu); -+ ieee80211_free_txskb(ar->hw, msdu); - return; - } - - if (unlikely(!skb_cb->vif)) { -- dev_kfree_skb_any(msdu); -+ ieee80211_free_txskb(ar->hw, msdu); - return; - } - diff --git a/package/kernel/mac80211/patches/ath11k/0008-wifi-ath11k-Consistently-use-ath11k_vif_to_arvif.patch b/package/kernel/mac80211/patches/ath11k/0008-wifi-ath11k-Consistently-use-ath11k_vif_to_arvif.patch deleted file mode 100644 index 218b3ac35fc13b..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0008-wifi-ath11k-Consistently-use-ath11k_vif_to_arvif.patch +++ /dev/null @@ -1,316 +0,0 @@ -From 9476cda44c136089f14f8951ae5197d63e91735c Mon Sep 17 00:00:00 2001 -From: Jeff Johnson -Date: Mon, 21 Aug 2023 07:13:36 -0700 -Subject: [PATCH] wifi: ath11k: Consistently use ath11k_vif_to_arvif() - -Helper function ath11k_vif_to_arvif() exists to retrieve a struct -ath11k_vif from a struct ieee80211_vif. However, in multiple places -this logic is open-coded with inline typecasting. Since the -typecasting prevents the compiler from type-checking the source and -destination, update the driver to consistently use the helper -function. - -No functional changes, compile tested only. - -Signed-off-by: Jeff Johnson -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230821-ath11k_vif_to_arvif-v1-1-fa2c3b60b5cf@quicinc.com ---- - drivers/net/wireless/ath/ath11k/mac.c | 64 +++++++++++----------- - drivers/net/wireless/ath/ath11k/testmode.c | 2 +- - 2 files changed, 33 insertions(+), 33 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/mac.c -+++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -566,7 +566,7 @@ static void ath11k_get_arvif_iter(void * - struct ieee80211_vif *vif) - { - struct ath11k_vif_iter *arvif_iter = data; -- struct ath11k_vif *arvif = (void *)vif->drv_priv; -+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); - - if (arvif->vdev_id == arvif_iter->vdev_id) - arvif_iter->arvif = arvif; -@@ -1464,7 +1464,7 @@ static int ath11k_mac_setup_bcn_tmpl_ema - u32 params = 0; - u8 i = 0; - -- tx_arvif = (void *)arvif->vif->mbssid_tx_vif->drv_priv; -+ tx_arvif = ath11k_vif_to_arvif(arvif->vif->mbssid_tx_vif); - - beacons = ieee80211_beacon_get_template_ema_list(tx_arvif->ar->hw, - tx_arvif->vif, 0); -@@ -1520,8 +1520,8 @@ static int ath11k_mac_setup_bcn_tmpl_mbs - struct sk_buff *bcn; - int ret; - -- if (arvif->vif->mbssid_tx_vif) { -- tx_arvif = (void *)arvif->vif->mbssid_tx_vif->drv_priv; -+ if (vif->mbssid_tx_vif) { -+ tx_arvif = ath11k_vif_to_arvif(vif->mbssid_tx_vif); - if (tx_arvif != arvif) { - ar = tx_arvif->ar; - ab = ar->ab; -@@ -1562,7 +1562,7 @@ static int ath11k_mac_setup_bcn_tmpl(str - * non-transmitting interfaces, and results in a crash if sent. - */ - if (vif->mbssid_tx_vif && -- arvif != (void *)vif->mbssid_tx_vif->drv_priv && arvif->is_up) -+ arvif != ath11k_vif_to_arvif(vif->mbssid_tx_vif) && arvif->is_up) - return 0; - - if (vif->bss_conf.ema_ap && vif->mbssid_tx_vif) -@@ -1626,7 +1626,7 @@ static void ath11k_control_beaconing(str - ether_addr_copy(arvif->bssid, info->bssid); - - if (arvif->vif->mbssid_tx_vif) -- tx_arvif = (struct ath11k_vif *)arvif->vif->mbssid_tx_vif->drv_priv; -+ tx_arvif = ath11k_vif_to_arvif(arvif->vif->mbssid_tx_vif); - - ret = ath11k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid, - arvif->bssid, -@@ -1649,7 +1649,7 @@ static void ath11k_mac_handle_beacon_ite - { - struct sk_buff *skb = data; - struct ieee80211_mgmt *mgmt = (void *)skb->data; -- struct ath11k_vif *arvif = (void *)vif->drv_priv; -+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); - - if (vif->type != NL80211_IFTYPE_STATION) - return; -@@ -1672,7 +1672,7 @@ static void ath11k_mac_handle_beacon_mis - struct ieee80211_vif *vif) - { - u32 *vdev_id = data; -- struct ath11k_vif *arvif = (void *)vif->drv_priv; -+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); - struct ath11k *ar = arvif->ar; - struct ieee80211_hw *hw = ar->hw; - -@@ -1718,7 +1718,7 @@ static void ath11k_peer_assoc_h_basic(st - struct ieee80211_sta *sta, - struct peer_assoc_params *arg) - { -- struct ath11k_vif *arvif = (void *)vif->drv_priv; -+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); - u32 aid; - - lockdep_assert_held(&ar->conf_mutex); -@@ -1746,7 +1746,7 @@ static void ath11k_peer_assoc_h_crypto(s - struct ieee80211_bss_conf *info = &vif->bss_conf; - struct cfg80211_chan_def def; - struct cfg80211_bss *bss; -- struct ath11k_vif *arvif = (struct ath11k_vif *)vif->drv_priv; -+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); - const u8 *rsnie = NULL; - const u8 *wpaie = NULL; - -@@ -1804,7 +1804,7 @@ static void ath11k_peer_assoc_h_rates(st - struct ieee80211_sta *sta, - struct peer_assoc_params *arg) - { -- struct ath11k_vif *arvif = (void *)vif->drv_priv; -+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); - struct wmi_rate_set_arg *rateset = &arg->peer_legacy_rates; - struct cfg80211_chan_def def; - const struct ieee80211_supported_band *sband; -@@ -1867,7 +1867,7 @@ static void ath11k_peer_assoc_h_ht(struc - struct peer_assoc_params *arg) - { - const struct ieee80211_sta_ht_cap *ht_cap = &sta->deflink.ht_cap; -- struct ath11k_vif *arvif = (void *)vif->drv_priv; -+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); - struct cfg80211_chan_def def; - enum nl80211_band band; - const u8 *ht_mcs_mask; -@@ -2064,7 +2064,7 @@ static void ath11k_peer_assoc_h_vht(stru - struct peer_assoc_params *arg) - { - const struct ieee80211_sta_vht_cap *vht_cap = &sta->deflink.vht_cap; -- struct ath11k_vif *arvif = (void *)vif->drv_priv; -+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); - struct cfg80211_chan_def def; - enum nl80211_band band; - u16 *vht_mcs_mask; -@@ -2261,7 +2261,7 @@ static void ath11k_peer_assoc_h_he(struc - struct ieee80211_sta *sta, - struct peer_assoc_params *arg) - { -- struct ath11k_vif *arvif = (void *)vif->drv_priv; -+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); - struct cfg80211_chan_def def; - const struct ieee80211_sta_he_cap *he_cap = &sta->deflink.he_cap; - enum nl80211_band band; -@@ -2584,7 +2584,7 @@ static void ath11k_peer_assoc_h_qos(stru - struct ieee80211_sta *sta, - struct peer_assoc_params *arg) - { -- struct ath11k_vif *arvif = (void *)vif->drv_priv; -+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); - - switch (arvif->vdev_type) { - case WMI_VDEV_TYPE_AP: -@@ -2747,7 +2747,7 @@ static void ath11k_peer_assoc_h_phymode( - struct ieee80211_sta *sta, - struct peer_assoc_params *arg) - { -- struct ath11k_vif *arvif = (void *)vif->drv_priv; -+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); - struct cfg80211_chan_def def; - enum nl80211_band band; - const u8 *ht_mcs_mask; -@@ -2933,7 +2933,7 @@ static bool ath11k_mac_vif_recalc_sta_he - struct ieee80211_vif *vif, - struct ieee80211_sta_he_cap *he_cap) - { -- struct ath11k_vif *arvif = (void *)vif->drv_priv; -+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); - struct ieee80211_he_cap_elem he_cap_elem = {0}; - struct ieee80211_sta_he_cap *cap_band = NULL; - struct cfg80211_chan_def def; -@@ -2995,7 +2995,7 @@ static void ath11k_bss_assoc(struct ieee - struct ieee80211_bss_conf *bss_conf) - { - struct ath11k *ar = hw->priv; -- struct ath11k_vif *arvif = (void *)vif->drv_priv; -+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); - struct peer_assoc_params peer_arg; - struct ieee80211_sta *ap_sta; - struct ath11k_peer *peer; -@@ -3111,7 +3111,7 @@ static void ath11k_bss_disassoc(struct i - struct ieee80211_vif *vif) - { - struct ath11k *ar = hw->priv; -- struct ath11k_vif *arvif = (void *)vif->drv_priv; -+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); - int ret; - - lockdep_assert_held(&ar->conf_mutex); -@@ -3160,7 +3160,7 @@ static void ath11k_recalculate_mgmt_rate - struct ieee80211_vif *vif, - struct cfg80211_chan_def *def) - { -- struct ath11k_vif *arvif = (void *)vif->drv_priv; -+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); - const struct ieee80211_supported_band *sband; - u8 basic_rate_idx; - int hw_rate_code; -@@ -4632,7 +4632,7 @@ static int ath11k_station_disassoc(struc - struct ieee80211_vif *vif, - struct ieee80211_sta *sta) - { -- struct ath11k_vif *arvif = (void *)vif->drv_priv; -+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); - int ret = 0; - - lockdep_assert_held(&ar->conf_mutex); -@@ -5160,7 +5160,7 @@ static int ath11k_mac_op_sta_set_txpwr(s - struct ieee80211_sta *sta) - { - struct ath11k *ar = hw->priv; -- struct ath11k_vif *arvif = (void *)vif->drv_priv; -+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); - int ret = 0; - s16 txpwr; - -@@ -5210,7 +5210,7 @@ static void ath11k_mac_op_sta_rc_update( - { - struct ath11k *ar = hw->priv; - struct ath11k_sta *arsta = (struct ath11k_sta *)sta->drv_priv; -- struct ath11k_vif *arvif = (void *)vif->drv_priv; -+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); - struct ath11k_peer *peer; - u32 bw, smps; - -@@ -5337,7 +5337,7 @@ static int ath11k_mac_op_conf_tx(struct - const struct ieee80211_tx_queue_params *params) - { - struct ath11k *ar = hw->priv; -- struct ath11k_vif *arvif = (void *)vif->drv_priv; -+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); - struct wmi_wmm_params_arg *p = NULL; - int ret; - -@@ -6458,7 +6458,7 @@ static int ath11k_mac_setup_vdev_params_ - return 0; - } - -- tx_arvif = (void *)tx_vif->drv_priv; -+ tx_arvif = ath11k_vif_to_arvif(tx_vif); - - if (arvif->vif->bss_conf.nontransmitted) { - if (ar->hw->wiphy != ieee80211_vif_to_wdev(tx_vif)->wiphy) -@@ -7411,7 +7411,7 @@ ath11k_mac_update_vif_chan(struct ath11k - /* TODO: Update ar->rx_channel */ - - for (i = 0; i < n_vifs; i++) { -- arvif = (void *)vifs[i].vif->drv_priv; -+ arvif = ath11k_vif_to_arvif(vifs[i].vif); - - if (WARN_ON(!arvif->is_started)) - continue; -@@ -7453,7 +7453,7 @@ ath11k_mac_update_vif_chan(struct ath11k - - mbssid_tx_vif = arvif->vif->mbssid_tx_vif; - if (mbssid_tx_vif) -- tx_arvif = (struct ath11k_vif *)mbssid_tx_vif->drv_priv; -+ tx_arvif = ath11k_vif_to_arvif(mbssid_tx_vif); - - ret = ath11k_wmi_vdev_up(arvif->ar, arvif->vdev_id, arvif->aid, - arvif->bssid, -@@ -7549,7 +7549,7 @@ static int ath11k_start_vdev_delay(struc - { - struct ath11k *ar = hw->priv; - struct ath11k_base *ab = ar->ab; -- struct ath11k_vif *arvif = (void *)vif->drv_priv; -+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); - int ret; - - if (WARN_ON(arvif->is_started)) -@@ -7599,7 +7599,7 @@ ath11k_mac_op_assign_vif_chanctx(struct - { - struct ath11k *ar = hw->priv; - struct ath11k_base *ab = ar->ab; -- struct ath11k_vif *arvif = (void *)vif->drv_priv; -+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); - int ret; - struct peer_create_params param; - -@@ -7689,7 +7689,7 @@ ath11k_mac_op_unassign_vif_chanctx(struc - { - struct ath11k *ar = hw->priv; - struct ath11k_base *ab = ar->ab; -- struct ath11k_vif *arvif = (void *)vif->drv_priv; -+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); - struct ath11k_peer *peer; - int ret; - -@@ -8310,7 +8310,7 @@ ath11k_mac_op_set_bitrate_mask(struct ie - struct ieee80211_vif *vif, - const struct cfg80211_bitrate_mask *mask) - { -- struct ath11k_vif *arvif = (void *)vif->drv_priv; -+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); - struct cfg80211_chan_def def; - struct ath11k_pdev_cap *cap; - struct ath11k *ar = arvif->ar; -@@ -8907,7 +8907,7 @@ static int ath11k_mac_op_remain_on_chann - enum ieee80211_roc_type type) - { - struct ath11k *ar = hw->priv; -- struct ath11k_vif *arvif = (void *)vif->drv_priv; -+ struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); - struct scan_req_params arg; - int ret; - u32 scan_time_msec; ---- a/drivers/net/wireless/ath/ath11k/testmode.c -+++ b/drivers/net/wireless/ath/ath11k/testmode.c -@@ -350,7 +350,7 @@ static int ath11k_tm_cmd_wmi(struct ath1 - if (ar->ab->fw_mode != ATH11K_FIRMWARE_MODE_FTM && - (tag == WMI_TAG_VDEV_SET_PARAM_CMD || tag == WMI_TAG_UNIT_TEST_CMD)) { - if (vif) { -- arvif = (struct ath11k_vif *)vif->drv_priv; -+ arvif = ath11k_vif_to_arvif(vif); - *ptr = arvif->vdev_id; - } else { - ret = -EINVAL; diff --git a/package/kernel/mac80211/patches/ath11k/0009-wifi-ath11k-Fix-a-few-spelling-errors.patch b/package/kernel/mac80211/patches/ath11k/0009-wifi-ath11k-Fix-a-few-spelling-errors.patch deleted file mode 100644 index b093f3e34211ba..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0009-wifi-ath11k-Fix-a-few-spelling-errors.patch +++ /dev/null @@ -1,50 +0,0 @@ -From d68a283bfc39aeed2a51c67804e014bf4b35c7e1 Mon Sep 17 00:00:00 2001 -From: Jeff Johnson -Date: Tue, 22 Aug 2023 07:50:49 -0700 -Subject: [PATCH] wifi: ath11k: Fix a few spelling errors - -Fix a few issues flagged by 'codespell'. - -Signed-off-by: Jeff Johnson -Acked-by: Randy Dunlap -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230822-ath_spelling-v1-2-8e2698759564@quicinc.com ---- - drivers/net/wireless/ath/ath11k/dp.h | 2 +- - drivers/net/wireless/ath/ath11k/dp_rx.c | 2 +- - drivers/net/wireless/ath/ath11k/dp_tx.c | 2 +- - 3 files changed, 3 insertions(+), 3 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/dp.h -+++ b/drivers/net/wireless/ath/ath11k/dp.h -@@ -635,7 +635,7 @@ enum htt_ppdu_stats_tag_type { - * b'24 - status_swap: 1 is to swap status TLV - * b'25 - pkt_swap: 1 is to swap packet TLV - * b'26:31 - rsvd1: reserved for future use -- * dword1 - b'0:16 - ring_buffer_size: size of bufferes referenced by rx ring, -+ * dword1 - b'0:16 - ring_buffer_size: size of buffers referenced by rx ring, - * in byte units. - * Valid only for HW_TO_SW_RING and SW_TO_HW_RING - * - b'16:31 - rsvd2: Reserved for future use ---- a/drivers/net/wireless/ath/ath11k/dp_rx.c -+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c -@@ -3423,7 +3423,7 @@ static int ath11k_dp_rx_h_defrag_reo_rei - ath11k_hal_rx_buf_addr_info_set(msdu0, paddr, cookie, - ab->hw_params.hal_params->rx_buf_rbm); - -- /* Fill mpdu details into reo entrace ring */ -+ /* Fill mpdu details into reo entrance ring */ - srng = &ab->hal.srng_list[ab->dp.reo_reinject_ring.ring_id]; - - spin_lock_bh(&srng->lock); ---- a/drivers/net/wireless/ath/ath11k/dp_tx.c -+++ b/drivers/net/wireless/ath/ath11k/dp_tx.c -@@ -238,7 +238,7 @@ tcl_ring_sel: - spin_unlock_bh(&tcl_ring->lock); - ret = -ENOMEM; - -- /* Checking for available tcl descritors in another ring in -+ /* Checking for available tcl descriptors in another ring in - * case of failure due to full tcl ring now, is better than - * checking this ring earlier for each pkt tx. - * Restart ring selection if some rings are not checked yet. diff --git a/package/kernel/mac80211/patches/ath11k/0010-wifi-ath11k-simplify-the-code-with-module_platform_d.patch b/package/kernel/mac80211/patches/ath11k/0010-wifi-ath11k-simplify-the-code-with-module_platform_d.patch deleted file mode 100644 index 19873339b23741..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0010-wifi-ath11k-simplify-the-code-with-module_platform_d.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 749a660b39030bfbacc366cd8670df2ee0e878b2 Mon Sep 17 00:00:00 2001 -From: Yang Yingliang -Date: Fri, 4 Aug 2023 17:12:55 +0800 -Subject: [PATCH] wifi: ath11k: simplify the code with module_platform_driver - -The init/exit() of driver only calls platform_driver_register/unregister, -it can be simpilfied with module_platform_driver. - -Signed-off-by: Yang Yingliang -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230804091255.1347178-1-yangyingliang@huawei.com ---- - drivers/net/wireless/ath/ath11k/ahb.c | 12 +----------- - 1 file changed, 1 insertion(+), 11 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/ahb.c -+++ b/drivers/net/wireless/ath/ath11k/ahb.c -@@ -1306,17 +1306,7 @@ static struct platform_driver ath11k_ahb - .shutdown = ath11k_ahb_shutdown, - }; - --static int ath11k_ahb_init(void) --{ -- return platform_driver_register(&ath11k_ahb_driver); --} --module_init(ath11k_ahb_init); -- --static void ath11k_ahb_exit(void) --{ -- platform_driver_unregister(&ath11k_ahb_driver); --} --module_exit(ath11k_ahb_exit); -+module_platform_driver(ath11k_ahb_driver); - - MODULE_DESCRIPTION("Driver support for Qualcomm Technologies 802.11ax WLAN AHB devices"); - MODULE_LICENSE("Dual BSD/GPL"); diff --git a/package/kernel/mac80211/patches/ath11k/0011-wifi-ath11k-fix-Wvoid-pointer-to-enum-cast-warning.patch b/package/kernel/mac80211/patches/ath11k/0011-wifi-ath11k-fix-Wvoid-pointer-to-enum-cast-warning.patch deleted file mode 100644 index f42b021375b654..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0011-wifi-ath11k-fix-Wvoid-pointer-to-enum-cast-warning.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 6763ef191d672ff3c2db0622652d49b0c0a60c4a Mon Sep 17 00:00:00 2001 -From: Krzysztof Kozlowski -Date: Thu, 10 Aug 2023 11:12:23 +0200 -Subject: [PATCH] wifi: ath11k: fix Wvoid-pointer-to-enum-cast warning - -'hw_rev' is an enum, thus cast of pointer on 64-bit compile test with W=1 -causes: - - h11k/ahb.c:1124:11: error: cast to smaller integer type 'enum ath11k_hw_rev' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast] - -Signed-off-by: Krzysztof Kozlowski -Acked-by: Jeff Johnson -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230810091224.70088-1-krzysztof.kozlowski@linaro.org ---- - drivers/net/wireless/ath/ath11k/ahb.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/ath/ath11k/ahb.c -+++ b/drivers/net/wireless/ath/ath11k/ahb.c -@@ -1096,7 +1096,7 @@ static int ath11k_ahb_probe(struct platf - return -EINVAL; - } - -- hw_rev = (enum ath11k_hw_rev)of_id->data; -+ hw_rev = (uintptr_t)of_id->data; - - switch (hw_rev) { - case ATH11K_HW_IPQ8074: diff --git a/package/kernel/mac80211/patches/ath11k/0012-wifi-ath11k-Remove-unused-declarations.patch b/package/kernel/mac80211/patches/ath11k/0012-wifi-ath11k-Remove-unused-declarations.patch deleted file mode 100644 index c318bbc3213e02..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0012-wifi-ath11k-Remove-unused-declarations.patch +++ /dev/null @@ -1,44 +0,0 @@ -From adb0b206709f4f2f1256a1ea20619ab98e99f2e7 Mon Sep 17 00:00:00 2001 -From: Yue Haibing -Date: Fri, 11 Aug 2023 18:44:13 +0800 -Subject: [PATCH] wifi: ath11k: Remove unused declarations - -Commit 2c3960c2253d ("ath11k: setup ce tasklet for control path") -declared but never implemented ath11k_ce_map_service_to_pipe(). -Commit e3396b8bddd2 ("ath11k: ce: support different CE configurations") -declared but never implemented ath11k_ce_attr_attach(). -Commit d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices") -declared but never implemented ath11k_qmi_event_work()/ath11k_qmi_msg_recv_work(). - -Signed-off-by: Yue Haibing -Acked-by: Jeff Johnson -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230811104413.33668-1-yuehaibing@huawei.com ---- - drivers/net/wireless/ath/ath11k/ce.h | 3 --- - drivers/net/wireless/ath/ath11k/qmi.h | 2 -- - 2 files changed, 5 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/ce.h -+++ b/drivers/net/wireless/ath/ath11k/ce.h -@@ -203,9 +203,6 @@ int ath11k_ce_alloc_pipes(struct ath11k_ - void ath11k_ce_free_pipes(struct ath11k_base *ab); - int ath11k_ce_get_attr_flags(struct ath11k_base *ab, int ce_id); - void ath11k_ce_poll_send_completed(struct ath11k_base *ab, u8 pipe_id); --int ath11k_ce_map_service_to_pipe(struct ath11k_base *ab, u16 service_id, -- u8 *ul_pipe, u8 *dl_pipe); --int ath11k_ce_attr_attach(struct ath11k_base *ab); - void ath11k_ce_get_shadow_config(struct ath11k_base *ab, - u32 **shadow_cfg, u32 *shadow_cfg_len); - void ath11k_ce_stop_shadow_timers(struct ath11k_base *ab); ---- a/drivers/net/wireless/ath/ath11k/qmi.h -+++ b/drivers/net/wireless/ath/ath11k/qmi.h -@@ -514,8 +514,6 @@ struct qmi_wlanfw_wlan_ini_resp_msg_v01 - int ath11k_qmi_firmware_start(struct ath11k_base *ab, - u32 mode); - void ath11k_qmi_firmware_stop(struct ath11k_base *ab); --void ath11k_qmi_event_work(struct work_struct *work); --void ath11k_qmi_msg_recv_work(struct work_struct *work); - void ath11k_qmi_deinit_service(struct ath11k_base *ab); - int ath11k_qmi_init_service(struct ath11k_base *ab); - void ath11k_qmi_free_resource(struct ath11k_base *ab); diff --git a/package/kernel/mac80211/patches/ath11k/0017-wifi-ath11k-fix-boot-failure-with-one-MSI-vector.patch b/package/kernel/mac80211/patches/ath11k/0017-wifi-ath11k-fix-boot-failure-with-one-MSI-vector.patch deleted file mode 100644 index 9101a1ea1ce557..00000000000000 --- a/package/kernel/mac80211/patches/ath11k/0017-wifi-ath11k-fix-boot-failure-with-one-MSI-vector.patch +++ /dev/null @@ -1,103 +0,0 @@ -From 39564b475ac5a589e6c22c43a08cbd283c295d2c Mon Sep 17 00:00:00 2001 -From: Baochen Qiang -Date: Thu, 7 Sep 2023 09:56:06 +0800 -Subject: [PATCH] wifi: ath11k: fix boot failure with one MSI vector - -Commit 5b32b6dd96633 ("ath11k: Remove core PCI references from -PCI common code") breaks with one MSI vector because it moves -affinity setting after IRQ request, see below log: - -[ 1417.278835] ath11k_pci 0000:02:00.0: failed to receive control response completion, polling.. -[ 1418.302829] ath11k_pci 0000:02:00.0: Service connect timeout -[ 1418.302833] ath11k_pci 0000:02:00.0: failed to connect to HTT: -110 -[ 1418.303669] ath11k_pci 0000:02:00.0: failed to start core: -110 - -The detail is, if do affinity request after IRQ activated, -which is done in request_irq(), kernel caches that request and -returns success directly. Later when a subsequent MHI interrupt is -fired, kernel will do the real affinity setting work, as a result, -changs the MSI vector. However at that time host has configured -old vector to hardware, so host never receives CE or DP interrupts. - -Fix it by setting affinity before registering MHI controller -where host is, for the first time, doing IRQ request. - -Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3 -Tested-on: WCN6855 hw2.1 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.23 -Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-01160-QCAMSLSWPLZ-1 - -Fixes: 5b32b6dd9663 ("ath11k: Remove core PCI references from PCI common code") -Signed-off-by: Baochen Qiang -Acked-by: Jeff Johnson -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/20230907015606.16297-1-quic_bqiang@quicinc.com ---- - drivers/net/wireless/ath/ath11k/pci.c | 24 ++++++++++++------------ - 1 file changed, 12 insertions(+), 12 deletions(-) - ---- a/drivers/net/wireless/ath/ath11k/pci.c -+++ b/drivers/net/wireless/ath/ath11k/pci.c -@@ -852,10 +852,16 @@ unsupported_wcn6855_soc: - if (ret) - goto err_pci_disable_msi; - -+ ret = ath11k_pci_set_irq_affinity_hint(ab_pci, cpumask_of(0)); -+ if (ret) { -+ ath11k_err(ab, "failed to set irq affinity %d\n", ret); -+ goto err_pci_disable_msi; -+ } -+ - ret = ath11k_mhi_register(ab_pci); - if (ret) { - ath11k_err(ab, "failed to register mhi: %d\n", ret); -- goto err_pci_disable_msi; -+ goto err_irq_affinity_cleanup; - } - - ret = ath11k_hal_srng_init(ab); -@@ -876,12 +882,6 @@ unsupported_wcn6855_soc: - goto err_ce_free; - } - -- ret = ath11k_pci_set_irq_affinity_hint(ab_pci, cpumask_of(0)); -- if (ret) { -- ath11k_err(ab, "failed to set irq affinity %d\n", ret); -- goto err_free_irq; -- } -- - /* kernel may allocate a dummy vector before request_irq and - * then allocate a real vector when request_irq is called. - * So get msi_data here again to avoid spurious interrupt -@@ -890,20 +890,17 @@ unsupported_wcn6855_soc: - ret = ath11k_pci_config_msi_data(ab_pci); - if (ret) { - ath11k_err(ab, "failed to config msi_data: %d\n", ret); -- goto err_irq_affinity_cleanup; -+ goto err_free_irq; - } - - ret = ath11k_core_init(ab); - if (ret) { - ath11k_err(ab, "failed to init core: %d\n", ret); -- goto err_irq_affinity_cleanup; -+ goto err_free_irq; - } - ath11k_qmi_fwreset_from_cold_boot(ab); - return 0; - --err_irq_affinity_cleanup: -- ath11k_pci_set_irq_affinity_hint(ab_pci, NULL); -- - err_free_irq: - ath11k_pcic_free_irq(ab); - -@@ -916,6 +913,9 @@ err_hal_srng_deinit: - err_mhi_unregister: - ath11k_mhi_unregister(ab_pci); - -+err_irq_affinity_cleanup: -+ ath11k_pci_set_irq_affinity_hint(ab_pci, NULL); -+ - err_pci_disable_msi: - ath11k_pci_free_msi(ab_pci); - diff --git a/package/kernel/mac80211/patches/ath11k/0019-wifi-ath11k-drop-redundant-check-in-ath11k_dp_rx_mon.patch b/package/kernel/mac80211/patches/ath11k/0019-wifi-ath11k-drop-redundant-check-in-ath11k_dp_rx_mon.patch index ace199315b2ff6..cf182739189275 100644 --- a/package/kernel/mac80211/patches/ath11k/0019-wifi-ath11k-drop-redundant-check-in-ath11k_dp_rx_mon.patch +++ b/package/kernel/mac80211/patches/ath11k/0019-wifi-ath11k-drop-redundant-check-in-ath11k_dp_rx_mon.patch @@ -22,7 +22,7 @@ Link: https://lore.kernel.org/r/20230824075121.121144-1-dmantipov@yandex.ru --- a/drivers/net/wireless/ath/ath11k/dp_rx.c +++ b/drivers/net/wireless/ath/ath11k/dp_rx.c -@@ -5094,13 +5094,6 @@ static void ath11k_dp_rx_mon_dest_proces +@@ -5100,13 +5100,6 @@ static void ath11k_dp_rx_mon_dest_proces mon_dst_srng = &ar->ab->hal.srng_list[ring_id]; diff --git a/package/kernel/mac80211/patches/ath11k/0022-wifi-ath11k-remove-unnecessary-void-conversions.patch b/package/kernel/mac80211/patches/ath11k/0022-wifi-ath11k-remove-unnecessary-void-conversions.patch index cbd664dad58d3c..81c1ca16b32036 100644 --- a/package/kernel/mac80211/patches/ath11k/0022-wifi-ath11k-remove-unnecessary-void-conversions.patch +++ b/package/kernel/mac80211/patches/ath11k/0022-wifi-ath11k-remove-unnecessary-void-conversions.patch @@ -44,7 +44,7 @@ Link: https://lore.kernel.org/r/20230919045150.524304-1-yunchuan@nfschina.com switch (tag) { case HTT_PPDU_STATS_TAG_COMMON: -@@ -4486,8 +4486,7 @@ int ath11k_dp_rx_monitor_link_desc_retur +@@ -4492,8 +4492,7 @@ int ath11k_dp_rx_monitor_link_desc_retur src_srng_desc = ath11k_hal_srng_src_get_next_entry(ar->ab, hal_srng); if (src_srng_desc) { @@ -54,7 +54,7 @@ Link: https://lore.kernel.org/r/20230919045150.524304-1-yunchuan@nfschina.com *src_desc = *((struct ath11k_buffer_addr *)p_last_buf_addr_info); } else { -@@ -4506,8 +4505,7 @@ void ath11k_dp_rx_mon_next_link_desc_get +@@ -4512,8 +4511,7 @@ void ath11k_dp_rx_mon_next_link_desc_get u8 *rbm, void **pp_buf_addr_info) { @@ -64,7 +64,7 @@ Link: https://lore.kernel.org/r/20230919045150.524304-1-yunchuan@nfschina.com struct ath11k_buffer_addr *buf_addr_info; buf_addr_info = (struct ath11k_buffer_addr *)&msdu_link->buf_addr_info; -@@ -4548,7 +4546,7 @@ static void ath11k_hal_rx_msdu_list_get( +@@ -4554,7 +4552,7 @@ static void ath11k_hal_rx_msdu_list_get( u32 first = FIELD_PREP(RX_MSDU_DESC_INFO0_FIRST_MSDU_IN_MPDU, 1); u8 tmp = 0; @@ -73,7 +73,7 @@ Link: https://lore.kernel.org/r/20230919045150.524304-1-yunchuan@nfschina.com msdu_details = &msdu_link->msdu_link[0]; for (i = 0; i < HAL_RX_NUM_MSDU_DESC; i++) { -@@ -4645,8 +4643,7 @@ ath11k_dp_rx_mon_mpdu_pop(struct ath11k +@@ -4651,8 +4649,7 @@ ath11k_dp_rx_mon_mpdu_pop(struct ath11k bool is_frag, is_first_msdu; bool drop_mpdu = false; struct ath11k_skb_rxcb *rxcb; diff --git a/package/kernel/mac80211/patches/ath11k/0026-wifi-ath11k-fix-Tx-power-value-during-active-CAC.patch b/package/kernel/mac80211/patches/ath11k/0026-wifi-ath11k-fix-Tx-power-value-during-active-CAC.patch index 79c1d735b8255f..c3aa8a49afd0bd 100644 --- a/package/kernel/mac80211/patches/ath11k/0026-wifi-ath11k-fix-Tx-power-value-during-active-CAC.patch +++ b/package/kernel/mac80211/patches/ath11k/0026-wifi-ath11k-fix-Tx-power-value-during-active-CAC.patch @@ -26,9 +26,9 @@ Link: https://lore.kernel.org/r/20230912051857.2284-4-quic_adisi@quicinc.com --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c -@@ -9060,6 +9060,14 @@ static int ath11k_mac_op_get_txpower(str - if (ar->state != ATH11K_STATE_ON) - goto err_fallback; +@@ -9068,6 +9068,14 @@ static int ath11k_mac_op_get_txpower(str + return -EAGAIN; + } + /* Firmware doesn't provide Tx power during CAC hence no need to fetch + * the stats. diff --git a/package/kernel/mac80211/patches/ath11k/0031-wifi-ath11k-Introduce-and-use-ath11k_sta_to_arsta.patch b/package/kernel/mac80211/patches/ath11k/0031-wifi-ath11k-Introduce-and-use-ath11k_sta_to_arsta.patch index 59af3b929795b9..1a6a701eeccd1f 100644 --- a/package/kernel/mac80211/patches/ath11k/0031-wifi-ath11k-Introduce-and-use-ath11k_sta_to_arsta.patch +++ b/package/kernel/mac80211/patches/ath11k/0031-wifi-ath11k-Introduce-and-use-ath11k_sta_to_arsta.patch @@ -230,7 +230,7 @@ Link: https://lore.kernel.org/r/20231009-ath11k_sta_to_arsta-v1-1-1563e3a307e8@q memset(&arsta->txrate, 0, sizeof(arsta->txrate)); -@@ -5242,7 +5242,7 @@ int ath11k_dp_rx_process_mon_status(stru +@@ -5248,7 +5248,7 @@ int ath11k_dp_rx_process_mon_status(stru goto next_skb; } diff --git a/package/kernel/mac80211/patches/ath11k/0906-wifi-ath11k-disable-coldboot-for-ipq6018.patch b/package/kernel/mac80211/patches/ath11k/0906-wifi-ath11k-disable-coldboot-for-ipq6018.patch new file mode 100644 index 00000000000000..db646f7620e89b --- /dev/null +++ b/package/kernel/mac80211/patches/ath11k/0906-wifi-ath11k-disable-coldboot-for-ipq6018.patch @@ -0,0 +1,26 @@ +From a3be23672b4a81256d275af31afc6edcce5c5a26 Mon Sep 17 00:00:00 2001 +From: Mantas Pucka +Date: Mon, 22 Jan 2024 11:38:28 +0200 +Subject: [PATCH] wifi: ath11k: disable coldboot for ipq6018 + +Coldboot calibration does not work at the moment and causes failure during +wifi startup. + +Signed-off-by: Mantas Pucka +--- + drivers/net/wireless/ath/ath11k/core.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/net/wireless/ath/ath11k/core.c ++++ b/drivers/net/wireless/ath/ath11k/core.c +@@ -168,8 +168,8 @@ static const struct ath11k_hw_params ath + .supports_shadow_regs = false, + .idle_ps = false, + .supports_sta_ps = false, +- .coldboot_cal_mm = true, +- .coldboot_cal_ftm = true, ++ .coldboot_cal_mm = false, ++ .coldboot_cal_ftm = false, + .cbcal_restart_fw = true, + .fw_mem_mode = 0, + .num_vdevs = 16 + 1, diff --git a/package/kernel/mac80211/patches/ath5k/440-ath5k_channel_bw_debugfs.patch b/package/kernel/mac80211/patches/ath5k/440-ath5k_channel_bw_debugfs.patch index a63f0c881bfc93..6ff95f95a30e37 100644 --- a/package/kernel/mac80211/patches/ath5k/440-ath5k_channel_bw_debugfs.patch +++ b/package/kernel/mac80211/patches/ath5k/440-ath5k_channel_bw_debugfs.patch @@ -109,7 +109,7 @@ drivers/net/wireless/ath/ath5k/debug.c | 86 ++++++++++++++++++++++++++++++++ /* debugfs: queues etc */ -@@ -997,6 +1088,8 @@ ath5k_debug_init_device(struct ath5k_hw +@@ -995,6 +1086,8 @@ ath5k_debug_init_device(struct ath5k_hw debugfs_create_file("queue", 0600, phydir, ah, &fops_queue); debugfs_create_bool("32khz_clock", 0600, phydir, &ah->ah_use_32khz_clock); diff --git a/package/kernel/mac80211/patches/ath9k/500-ath9k_eeprom_debugfs.patch b/package/kernel/mac80211/patches/ath9k/500-ath9k_eeprom_debugfs.patch index d23d70b2ce7d17..a0ec7ef972f023 100644 --- a/package/kernel/mac80211/patches/ath9k/500-ath9k_eeprom_debugfs.patch +++ b/package/kernel/mac80211/patches/ath9k/500-ath9k_eeprom_debugfs.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c -@@ -1471,6 +1471,7 @@ int ath9k_init_debug(struct ath_hw *ah) +@@ -1431,6 +1431,7 @@ int ath9k_init_debug(struct ath_hw *ah) ath9k_cmn_debug_base_eeprom(sc->debug.debugfs_phy, sc->sc_ah); ath9k_cmn_debug_modal_eeprom(sc->debug.debugfs_phy, sc->sc_ah); @@ -82,7 +82,7 @@ void ath9k_cmn_debug_recv(struct dentry *debugfs_phy, --- a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c -@@ -519,6 +519,7 @@ int ath9k_htc_init_debug(struct ath_hw * +@@ -514,6 +514,7 @@ int ath9k_htc_init_debug(struct ath_hw * ath9k_cmn_debug_base_eeprom(priv->debug.debugfs_phy, priv->ah); ath9k_cmn_debug_modal_eeprom(priv->debug.debugfs_phy, priv->ah); diff --git a/package/kernel/mac80211/patches/ath9k/512-ath9k_channelbw_debugfs.patch b/package/kernel/mac80211/patches/ath9k/512-ath9k_channelbw_debugfs.patch index 474fb3fdbeb006..3ec2d6ec6eb8df 100644 --- a/package/kernel/mac80211/patches/ath9k/512-ath9k_channelbw_debugfs.patch +++ b/package/kernel/mac80211/patches/ath9k/512-ath9k_channelbw_debugfs.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c -@@ -1472,6 +1472,7 @@ int ath9k_init_debug(struct ath_hw *ah) +@@ -1432,6 +1432,7 @@ int ath9k_init_debug(struct ath_hw *ah) ath9k_cmn_debug_base_eeprom(sc->debug.debugfs_phy, sc->sc_ah); ath9k_cmn_debug_modal_eeprom(sc->debug.debugfs_phy, sc->sc_ah); ath9k_cmn_debug_eeprom(sc->debug.debugfs_phy, sc->sc_ah); @@ -137,7 +137,7 @@ +EXPORT_SYMBOL(ath9k_cmn_debug_chanbw); --- a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c -@@ -520,6 +520,7 @@ int ath9k_htc_init_debug(struct ath_hw * +@@ -515,6 +515,7 @@ int ath9k_htc_init_debug(struct ath_hw * ath9k_cmn_debug_base_eeprom(priv->debug.debugfs_phy, priv->ah); ath9k_cmn_debug_modal_eeprom(priv->debug.debugfs_phy, priv->ah); ath9k_cmn_debug_eeprom(priv->debug.debugfs_phy, priv->ah); diff --git a/package/kernel/mac80211/patches/ath9k/530-ath9k_extra_leds.patch b/package/kernel/mac80211/patches/ath9k/530-ath9k_extra_leds.patch index 9568b091de3c13..1b2d4cb5d41b56 100644 --- a/package/kernel/mac80211/patches/ath9k/530-ath9k_extra_leds.patch +++ b/package/kernel/mac80211/patches/ath9k/530-ath9k_extra_leds.patch @@ -192,7 +192,7 @@ #endif --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c -@@ -128,6 +128,61 @@ static const struct file_operations fops +@@ -123,6 +123,61 @@ static const struct file_operations fops #define DMA_BUF_LEN 1024 @@ -254,7 +254,7 @@ static ssize_t read_file_ani(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) -@@ -1432,6 +1487,10 @@ int ath9k_init_debug(struct ath_hw *ah) +@@ -1392,6 +1447,10 @@ int ath9k_init_debug(struct ath_hw *ah) ath9k_tx99_init_debug(sc); ath9k_cmn_spectral_init_debug(&sc->spec_priv, sc->debug.debugfs_phy); diff --git a/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch b/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch index c54dbbb1884521..f00ce5f3dca4a7 100644 --- a/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch +++ b/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch @@ -1,6 +1,6 @@ --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c -@@ -1468,6 +1468,50 @@ void ath9k_deinit_debug(struct ath_softc +@@ -1428,6 +1428,50 @@ void ath9k_deinit_debug(struct ath_softc ath9k_cmn_spectral_deinit_debug(&sc->spec_priv); } @@ -51,7 +51,7 @@ int ath9k_init_debug(struct ath_hw *ah) { struct ath_common *common = ath9k_hw_common(ah); -@@ -1491,6 +1535,8 @@ int ath9k_init_debug(struct ath_hw *ah) +@@ -1451,6 +1495,8 @@ int ath9k_init_debug(struct ath_hw *ah) debugfs_create_file("gpio_led", S_IWUSR, sc->debug.debugfs_phy, sc, &fops_gpio_led); #endif diff --git a/package/kernel/mac80211/patches/build/060-no_local_ssb_bcma.patch b/package/kernel/mac80211/patches/build/060-no_local_ssb_bcma.patch index 451d0b79fcc854..2a0f9ede420c30 100644 --- a/package/kernel/mac80211/patches/build/060-no_local_ssb_bcma.patch +++ b/package/kernel/mac80211/patches/build/060-no_local_ssb_bcma.patch @@ -1,6 +1,6 @@ --- a/local-symbols +++ b/local-symbols -@@ -491,43 +491,6 @@ USB_VL600= +@@ -493,43 +493,6 @@ USB_VL600= USB_NET_CH9200= USB_NET_AQC111= USB_RTL8153_ECM= @@ -171,7 +171,7 @@ depends on CORDIC --- a/Kconfig.local +++ b/Kconfig.local -@@ -1477,117 +1477,6 @@ config BACKPORTED_USB_NET_AQC111 +@@ -1483,117 +1483,6 @@ config BACKPORTED_USB_NET_AQC111 config BACKPORTED_USB_RTL8153_ECM tristate default USB_RTL8153_ECM diff --git a/package/kernel/mac80211/patches/build/080-resv_start_op.patch b/package/kernel/mac80211/patches/build/080-resv_start_op.patch index 802a0e3fc8af3c..bbd9018bdf0787 100644 --- a/package/kernel/mac80211/patches/build/080-resv_start_op.patch +++ b/package/kernel/mac80211/patches/build/080-resv_start_op.patch @@ -12,7 +12,7 @@ }; --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c -@@ -17509,7 +17509,9 @@ static struct genl_family nl80211_fam __ +@@ -17551,7 +17551,9 @@ static struct genl_family nl80211_fam __ .n_ops = ARRAY_SIZE(nl80211_ops), .small_ops = nl80211_small_ops, .n_small_ops = ARRAY_SIZE(nl80211_small_ops), diff --git a/package/kernel/mac80211/patches/build/210-revert-split-op.patch b/package/kernel/mac80211/patches/build/210-revert-split-op.patch index a1fae5e07da561..4f1f8a7795a2eb 100644 --- a/package/kernel/mac80211/patches/build/210-revert-split-op.patch +++ b/package/kernel/mac80211/patches/build/210-revert-split-op.patch @@ -1,6 +1,6 @@ --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c -@@ -16400,8 +16400,7 @@ static u32 nl80211_internal_flags[] = { +@@ -16442,8 +16442,7 @@ static u32 nl80211_internal_flags[] = { #undef SELECTOR }; @@ -10,7 +10,7 @@ struct genl_info *info) { struct cfg80211_registered_device *rdev = NULL; -@@ -16502,8 +16501,7 @@ out_unlock: +@@ -16544,8 +16543,7 @@ out_unlock: return err; } diff --git a/package/kernel/mac80211/patches/build/230-backport_genl_info_userhdr.patch b/package/kernel/mac80211/patches/build/230-backport_genl_info_userhdr.patch new file mode 100644 index 00000000000000..38f86dc37a7130 --- /dev/null +++ b/package/kernel/mac80211/patches/build/230-backport_genl_info_userhdr.patch @@ -0,0 +1,32 @@ +--- a/backport-include/net/genetlink.h ++++ b/backport-include/net/genetlink.h +@@ -3,6 +3,7 @@ + #include_next + #include + ++#if LINUX_VERSION_IS_LESS(4,12,0) + static inline void __bp_genl_info_userhdr_set(struct genl_info *info, + void *userhdr) + { +@@ -14,7 +15,6 @@ static inline void *__bp_genl_info_userh + return info->userhdr; + } + +-#if LINUX_VERSION_IS_LESS(4,12,0) + #define GENL_SET_ERR_MSG(info, msg) NL_SET_ERR_MSG(genl_info_extack(info), msg) + + static inline int genl_err_attr(struct genl_info *info, int err, +@@ -44,11 +44,13 @@ static inline struct netlink_ext_ack *ge + #endif + } + ++#if LINUX_VERSION_IS_LESS(6,6,0) + /* this gets put in place of info->userhdr, since we use that above */ + static inline void *genl_info_userhdr(struct genl_info *info) + { + return (u8 *)info->genlhdr + GENL_HDRLEN; + } ++#endif + + #if LINUX_VERSION_IS_LESS(4,10,0) + #define __genl_ro_after_init diff --git a/package/kernel/mac80211/patches/build/240-backport_genl_split_ops.patch b/package/kernel/mac80211/patches/build/240-backport_genl_split_ops.patch new file mode 100644 index 00000000000000..b22804cf92af99 --- /dev/null +++ b/package/kernel/mac80211/patches/build/240-backport_genl_split_ops.patch @@ -0,0 +1,32 @@ +--- a/net/wireless/nl80211.c ++++ b/net/wireless/nl80211.c +@@ -16442,8 +16442,14 @@ static u32 nl80211_internal_flags[] = { + #undef SELECTOR + }; + ++#if LINUX_VERSION_IS_LESS(6,2,0) + static int nl80211_pre_doit(const struct genl_ops *ops, struct sk_buff *skb, + struct genl_info *info) ++#else ++static int nl80211_pre_doit(const struct genl_split_ops *ops, ++ struct sk_buff *skb, ++ struct genl_info *info) ++#endif + { + struct cfg80211_registered_device *rdev = NULL; + struct wireless_dev *wdev = NULL; +@@ -16543,8 +16549,14 @@ out_unlock: + return err; + } + ++#if LINUX_VERSION_IS_LESS(6,2,0) + static void nl80211_post_doit(const struct genl_ops *ops, struct sk_buff *skb, + struct genl_info *info) ++#else ++static void nl80211_post_doit(const struct genl_split_ops *ops, ++ struct sk_buff *skb, ++ struct genl_info *info) ++#endif + { + u32 internal_flags = nl80211_internal_flags[ops->internal_flags]; + diff --git a/package/kernel/mac80211/patches/build/250-backport_iwlwifi_thermal.patch b/package/kernel/mac80211/patches/build/250-backport_iwlwifi_thermal.patch new file mode 100644 index 00000000000000..631fdd710d8bf2 --- /dev/null +++ b/package/kernel/mac80211/patches/build/250-backport_iwlwifi_thermal.patch @@ -0,0 +1,160 @@ +--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +@@ -531,7 +531,11 @@ struct iwl_mvm_tt_mgmt { + * @tzone: thermal zone device data + */ + struct iwl_mvm_thermal_device { ++#if LINUX_VERSION_IS_LESS(6,6,0) + s16 temp_trips[IWL_MAX_DTS_TRIPS]; ++#else ++ struct thermal_trip trips[IWL_MAX_DTS_TRIPS]; ++#endif + u8 fw_trips_index[IWL_MAX_DTS_TRIPS]; + struct thermal_zone_device *tzone; + }; +--- a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c ++++ b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c +@@ -573,6 +573,7 @@ int iwl_mvm_send_temp_report_ths_cmd(str + * and uncompressed, the FW should get it compressed and sorted + */ + ++#if LINUX_VERSION_IS_LESS(6,6,0) + /* compress temp_trips to cmd array, remove uninitialized values*/ + for (i = 0; i < IWL_MAX_DTS_TRIPS; i++) { + if (mvm->tz_device.temp_trips[i] != S16_MIN) { +@@ -580,6 +581,15 @@ int iwl_mvm_send_temp_report_ths_cmd(str + cpu_to_le16(mvm->tz_device.temp_trips[i]); + } + } ++#else ++ /* compress trips to cmd array, remove uninitialized values*/ ++ for (i = 0; i < IWL_MAX_DTS_TRIPS; i++) { ++ if (mvm->tz_device.trips[i].temperature != INT_MIN) { ++ cmd.thresholds[idx++] = ++ cpu_to_le16((s16)(mvm->tz_device.trips[i].temperature / 1000)); ++ } ++ } ++#endif + cmd.num_temps = cpu_to_le32(idx); + + if (!idx) +@@ -593,8 +603,13 @@ int iwl_mvm_send_temp_report_ths_cmd(str + */ + for (i = 0; i < idx; i++) { + for (j = 0; j < IWL_MAX_DTS_TRIPS; j++) { ++#if LINUX_VERSION_IS_LESS(6,6,0) + if (le16_to_cpu(cmd.thresholds[i]) == + mvm->tz_device.temp_trips[j]) ++#else ++ if ((int)(le16_to_cpu(cmd.thresholds[i]) * 1000) == ++ mvm->tz_device.trips[j].temperature) ++#endif + mvm->tz_device.fw_trips_index[i] = j; + } + } +@@ -638,6 +653,7 @@ out: + return ret; + } + ++#if LINUX_VERSION_IS_LESS(6,6,0) + static int iwl_mvm_tzone_get_trip_temp(struct thermal_zone_device *device, + int trip, int *temp) + { +@@ -661,14 +677,19 @@ static int iwl_mvm_tzone_get_trip_type(s + + return 0; + } ++#endif + + static int iwl_mvm_tzone_set_trip_temp(struct thermal_zone_device *device, + int trip, int temp) + { + struct iwl_mvm *mvm = thermal_zone_device_priv(device); + struct iwl_mvm_thermal_device *tzone; ++#if LINUX_VERSION_IS_LESS(6,6,0) + int i, ret; + s16 temperature; ++#else ++ int ret; ++#endif + + mutex_lock(&mvm->mutex); + +@@ -678,17 +699,21 @@ static int iwl_mvm_tzone_set_trip_temp(s + goto out; + } + ++#if LINUX_VERSION_IS_LESS(6,6,0) + if (trip < 0 || trip >= IWL_MAX_DTS_TRIPS) { + ret = -EINVAL; + goto out; + } ++#endif + + if ((temp / 1000) > S16_MAX) { + ret = -EINVAL; + goto out; + } + ++#if LINUX_VERSION_IS_LESS(6,6,0) + temperature = (s16)(temp / 1000); ++#endif + tzone = &mvm->tz_device; + + if (!tzone) { +@@ -696,6 +721,7 @@ static int iwl_mvm_tzone_set_trip_temp(s + goto out; + } + ++#if LINUX_VERSION_IS_LESS(6,6,0) + /* no updates*/ + if (tzone->temp_trips[trip] == temperature) { + ret = 0; +@@ -711,6 +737,7 @@ static int iwl_mvm_tzone_set_trip_temp(s + } + + tzone->temp_trips[trip] = temperature; ++#endif + + ret = iwl_mvm_send_temp_report_ths_cmd(mvm); + out: +@@ -720,8 +747,10 @@ out: + + static struct thermal_zone_device_ops tzone_ops = { + .get_temp = iwl_mvm_tzone_get_temp, ++#if LINUX_VERSION_IS_LESS(6,6,0) + .get_trip_temp = iwl_mvm_tzone_get_trip_temp, + .get_trip_type = iwl_mvm_tzone_get_trip_type, ++#endif + .set_trip_temp = iwl_mvm_tzone_set_trip_temp, + }; + +@@ -743,7 +772,12 @@ static void iwl_mvm_thermal_zone_registe + BUILD_BUG_ON(ARRAY_SIZE(name) >= THERMAL_NAME_LENGTH); + + sprintf(name, "iwlwifi_%u", atomic_inc_return(&counter) & 0xFF); ++#if LINUX_VERSION_IS_LESS(6,6,0) + mvm->tz_device.tzone = thermal_zone_device_register(name, ++#else ++ mvm->tz_device.tzone = thermal_zone_device_register_with_trips(name, ++ mvm->tz_device.trips, ++#endif + IWL_MAX_DTS_TRIPS, + IWL_WRITABLE_TRIPS_MSK, + mvm, &tzone_ops, +@@ -766,8 +800,15 @@ static void iwl_mvm_thermal_zone_registe + /* 0 is a valid temperature, + * so initialize the array with S16_MIN which invalid temperature + */ ++#if LINUX_VERSION_IS_LESS(6,6,0) + for (i = 0 ; i < IWL_MAX_DTS_TRIPS; i++) + mvm->tz_device.temp_trips[i] = S16_MIN; ++#else ++ for (i = 0 ; i < IWL_MAX_DTS_TRIPS; i++) { ++ mvm->tz_device.trips[i].temperature = INT_MIN; ++ mvm->tz_device.trips[i].type = THERMAL_TRIP_PASSIVE; ++ } ++#endif + } + + static int iwl_mvm_tcool_get_max_state(struct thermal_cooling_device *cdev, diff --git a/package/kernel/mac80211/patches/mwl/950-mwifiex-Print-stringified-name-of-command-in-error-l.patch b/package/kernel/mac80211/patches/mwl/950-mwifiex-Print-stringified-name-of-command-in-error-l.patch index 628b9f8a1237cc..f4d97eeee2b9eb 100644 --- a/package/kernel/mac80211/patches/mwl/950-mwifiex-Print-stringified-name-of-command-in-error-l.patch +++ b/package/kernel/mac80211/patches/mwl/950-mwifiex-Print-stringified-name-of-command-in-error-l.patch @@ -152,7 +152,7 @@ Signed-off-by: Pali Rohár --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h -@@ -1100,6 +1100,8 @@ void mwifiex_cancel_all_pending_cmd(stru +@@ -1086,6 +1086,8 @@ void mwifiex_cancel_all_pending_cmd(stru void mwifiex_cancel_pending_scan_cmd(struct mwifiex_adapter *adapter); void mwifiex_cancel_scan(struct mwifiex_adapter *adapter); @@ -177,7 +177,7 @@ Signed-off-by: Pali Rohár adapter->cmd_wait_q.status = -1; --- a/drivers/net/wireless/marvell/mwifiex/uap_cmd.c +++ b/drivers/net/wireless/marvell/mwifiex/uap_cmd.c -@@ -794,7 +794,8 @@ int mwifiex_uap_prepare_cmd(struct mwifi +@@ -802,7 +802,8 @@ int mwifiex_uap_prepare_cmd(struct mwifi break; default: mwifiex_dbg(priv->adapter, ERROR, diff --git a/package/kernel/mac80211/patches/rt2x00/000-v6.6-wifi-rt2x00-correct-MAC_SYS_CTRL-register-RX-mask-i.patch b/package/kernel/mac80211/patches/rt2x00/000-v6.6-wifi-rt2x00-correct-MAC_SYS_CTRL-register-RX-mask-i.patch deleted file mode 100644 index c84b5a140840e4..00000000000000 --- a/package/kernel/mac80211/patches/rt2x00/000-v6.6-wifi-rt2x00-correct-MAC_SYS_CTRL-register-RX-mask-i.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 186f2432741f6d28d86ff723ac7830446affddfc Mon Sep 17 00:00:00 2001 -From: Shiji Yang -Date: Sat, 5 Aug 2023 17:17:28 +0800 -Subject: wifi: rt2x00: correct MAC_SYS_CTRL register RX mask in R-Calibration - -For MAC_SYS_CTRL register, Bit[2] controls MAC_TX_EN and Bit[3] -controls MAC_RX_EN (Bit index starts from 0). Therefore, 0x08 is -the correct mask for RX. - -Signed-off-by: Shiji Yang -Acked-by: Stanislaw Gruszka -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/TYAP286MB03150B571B67B896A504AC34BC0EA@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM ---- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -8561,7 +8561,7 @@ static void rt2800_r_calibration(struct - rt2x00_warn(rt2x00dev, "Wait MAC Tx Status to MAX !!!\n"); - - maccfg = rt2800_register_read(rt2x00dev, MAC_SYS_CTRL); -- maccfg &= (~0x04); -+ maccfg &= (~0x08); - rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, maccfg); - - if (unlikely(rt2800_wait_bbp_rf_ready(rt2x00dev, MAC_STATUS_CFG_BBP_RF_BUSY_RX))) diff --git a/package/kernel/mac80211/patches/rt2x00/001-v6.6-wifi-rt2x00-limit-MT7620-TX-power-based-on-eeprom.patch b/package/kernel/mac80211/patches/rt2x00/001-v6.6-wifi-rt2x00-limit-MT7620-TX-power-based-on-eeprom.patch deleted file mode 100644 index aa843d4219878d..00000000000000 --- a/package/kernel/mac80211/patches/rt2x00/001-v6.6-wifi-rt2x00-limit-MT7620-TX-power-based-on-eeprom.patch +++ /dev/null @@ -1,115 +0,0 @@ -From 821b5192c955144bd2f0aeea6cd153e1aedd16e1 Mon Sep 17 00:00:00 2001 -From: Shiji Yang -Date: Fri, 11 Aug 2023 14:34:54 +0800 -Subject: wifi: rt2x00: limit MT7620 TX power based on eeprom calibration - -In the vendor driver, the current channel power is queried from -EEPROM_TXPOWER_BG1 and EEPROM_TXPOWER_BG2. And then the mixed value -will be written into the low half-word of the TX_ALC_CFG_0 register. -The high half-word of the TX_ALC_CFG_0 is a fixed value 0x2f2f. - -We can't get the accurate TX power. Based on my tests and the new -MediaTek mt76 driver source code, the real TX power is approximately -equal to channel_power + (max) rate_power. Usually max rate_power is -the gain of the OFDM 6M rate, which can be readed from the offset -EEPROM_TXPOWER_BYRATE +1. - -Based on these eeprom values, this patch adds basic TX power control -for the MT7620 and limits its maximum TX power. This can avoid the -link speed decrease caused by chip overheating. rt2800_config_alc() -function has also been renamed to rt2800_config_alc_rt6352() because -it's only used by RT6352 (MT7620). - -Notice: -It's still need some work to sync the max channel power to the user -interface. This part is missing from the rt2x00 driver framework. If -we set the power exceed the calibration value, it won't take effect. - -Signed-off-by: Shiji Yang -Acked-by: Stanislaw Gruszka -Signed-off-by: Kalle Valo -Link: https://lore.kernel.org/r/TYAP286MB03159090ED14044215E59FD6BC10A@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM ---- - drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 57 ++++++++++++++++++-------- - 1 file changed, 40 insertions(+), 17 deletions(-) - ---- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c -@@ -3865,28 +3865,51 @@ static void rt2800_config_channel_rf7620 - } - } - --static void rt2800_config_alc(struct rt2x00_dev *rt2x00dev, -- struct ieee80211_channel *chan, -- int power_level) { -- u16 eeprom, target_power, max_power; -+static void rt2800_config_alc_rt6352(struct rt2x00_dev *rt2x00dev, -+ struct ieee80211_channel *chan, -+ int power_level) -+{ -+ int cur_channel = rt2x00dev->rf_channel; -+ u16 eeprom, chan_power, rate_power, target_power; -+ u16 tx_power[2]; -+ s8 *power_group[2]; - u32 mac_sys_ctrl; -- u32 reg; -+ u32 cnt, reg; - u8 bbp; - -- /* hardware unit is 0.5dBm, limited to 23.5dBm */ -- power_level *= 2; -- if (power_level > 0x2f) -- power_level = 0x2f; -- -- max_power = chan->max_power * 2; -- if (max_power > 0x2f) -- max_power = 0x2f; -+ if (WARN_ON(cur_channel < 1 || cur_channel > 14)) -+ return; -+ -+ /* get per chain power, 2 chains in total, unit is 0.5dBm */ -+ power_level = (power_level - 3) * 2; -+ -+ /* We can't get the accurate TX power. Based on some tests, the real -+ * TX power is approximately equal to channel_power + (max)rate_power. -+ * Usually max rate_power is the gain of the OFDM 6M rate. The antenna -+ * gain and externel PA gain are not included as we are unable to -+ * obtain these values. -+ */ -+ rate_power = rt2800_eeprom_read_from_array(rt2x00dev, -+ EEPROM_TXPOWER_BYRATE, 1); -+ rate_power &= 0x3f; -+ power_level -= rate_power; -+ if (power_level < 1) -+ power_level = 1; -+ -+ power_group[0] = rt2800_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG1); -+ power_group[1] = rt2800_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG2); -+ for (cnt = 0; cnt < 2; cnt++) { -+ chan_power = power_group[cnt][cur_channel - 1]; -+ if (chan_power >= 0x20 || chan_power == 0) -+ chan_power = 0x10; -+ tx_power[cnt] = power_level < chan_power ? power_level : chan_power; -+ } - - reg = rt2800_register_read(rt2x00dev, TX_ALC_CFG_0); -- rt2x00_set_field32(®, TX_ALC_CFG_0_CH_INIT_0, power_level); -- rt2x00_set_field32(®, TX_ALC_CFG_0_CH_INIT_1, power_level); -- rt2x00_set_field32(®, TX_ALC_CFG_0_LIMIT_0, max_power); -- rt2x00_set_field32(®, TX_ALC_CFG_0_LIMIT_1, max_power); -+ rt2x00_set_field32(®, TX_ALC_CFG_0_CH_INIT_0, tx_power[0]); -+ rt2x00_set_field32(®, TX_ALC_CFG_0_CH_INIT_1, tx_power[1]); -+ rt2x00_set_field32(®, TX_ALC_CFG_0_LIMIT_0, 0x2f); -+ rt2x00_set_field32(®, TX_ALC_CFG_0_LIMIT_1, 0x2f); - - eeprom = rt2800_eeprom_read(rt2x00dev, EEPROM_NIC_CONF1); - if (rt2x00_get_field16(eeprom, EEPROM_NIC_CONF1_INTERNAL_TX_ALC)) { -@@ -5268,7 +5291,7 @@ static void rt2800_config_txpower_rt6352 - rt2x00_set_field32(&pwreg, TX_PWR_CFG_9B_STBC_MCS7, t); - rt2800_register_write(rt2x00dev, TX_PWR_CFG_9, pwreg); - -- rt2800_config_alc(rt2x00dev, chan, power_level); -+ rt2800_config_alc_rt6352(rt2x00dev, chan, power_level); - - /* TODO: temperature compensation code! */ - } diff --git a/package/kernel/mac80211/patches/rt2x00/602-01-wifi-rt2x00-Add-support-for-loading-EEPROM-from-user.patch b/package/kernel/mac80211/patches/rt2x00/602-01-wifi-rt2x00-Add-support-for-loading-EEPROM-from-user.patch index 5040b5af621ea1..8b04473dbe0191 100644 --- a/package/kernel/mac80211/patches/rt2x00/602-01-wifi-rt2x00-Add-support-for-loading-EEPROM-from-user.patch +++ b/package/kernel/mac80211/patches/rt2x00/602-01-wifi-rt2x00-Add-support-for-loading-EEPROM-from-user.patch @@ -21,7 +21,7 @@ Signed-off-by: Christian Marangi --- a/local-symbols +++ b/local-symbols -@@ -350,6 +350,7 @@ RT2X00_LIB_FIRMWARE= +@@ -352,6 +352,7 @@ RT2X00_LIB_FIRMWARE= RT2X00_LIB_CRYPTO= RT2X00_LIB_LEDS= RT2X00_LIB_DEBUGFS= diff --git a/package/kernel/mac80211/patches/rtl/001-01-v6.9-wifi-rtl8xxxu-remove-assignment-of-priv-vif-in-rtl8x.patch b/package/kernel/mac80211/patches/rtl/001-01-v6.9-wifi-rtl8xxxu-remove-assignment-of-priv-vif-in-rtl8x.patch new file mode 100644 index 00000000000000..e0a01a8120da29 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/001-01-v6.9-wifi-rtl8xxxu-remove-assignment-of-priv-vif-in-rtl8x.patch @@ -0,0 +1,27 @@ +From d55cb6d8a99441aff55cb9ce663a07f7f1667e83 Mon Sep 17 00:00:00 2001 +From: Martin Kaistra +Date: Fri, 22 Dec 2023 11:14:22 +0100 +Subject: [PATCH 01/21] wifi: rtl8xxxu: remove assignment of priv->vif in + rtl8xxxu_bss_info_changed() + +priv->vif gets already set in rtl8xxxu_add_interface, there is no need +to set it also in rtl8xxxu_bss_info_changed(). + +Signed-off-by: Martin Kaistra +Reviewed-by: Ping-Ke Shih +Signed-off-by: Kalle Valo +Link: https://msgid.link/20231222101442.626837-2-martin.kaistra@linutronix.de +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -5004,7 +5004,6 @@ rtl8xxxu_bss_info_changed(struct ieee802 + + rtl8xxxu_update_ra_report(rarpt, highest_rate, sgi, bw); + +- priv->vif = vif; + priv->rssi_level = RTL8XXXU_RATR_STA_INIT; + + priv->fops->update_rate_mask(priv, ramask, 0, sgi, diff --git a/package/kernel/mac80211/patches/rtl/001-02-v6.9-wifi-rtl8xxxu-prepare-supporting-two-virtual-interfa.patch b/package/kernel/mac80211/patches/rtl/001-02-v6.9-wifi-rtl8xxxu-prepare-supporting-two-virtual-interfa.patch new file mode 100644 index 00000000000000..b1948bb7c269c4 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/001-02-v6.9-wifi-rtl8xxxu-prepare-supporting-two-virtual-interfa.patch @@ -0,0 +1,61 @@ +From 2bbd7d584046038ce655e476628bb15e1460fac6 Mon Sep 17 00:00:00 2001 +From: Martin Kaistra +Date: Fri, 22 Dec 2023 11:14:23 +0100 +Subject: [PATCH 02/21] wifi: rtl8xxxu: prepare supporting two virtual + interfaces + +To prepare for concurrent mode, add an array ("vifs") to rtl8xxxu_priv +to keep track of both interfaces. + +Keep the old priv->vif as long there are still users of it and let +priv->vifs[0] point to the same location. + +Signed-off-by: Martin Kaistra +Reviewed-by: Ping-Ke Shih +Signed-off-by: Kalle Valo +Link: https://msgid.link/20231222101442.626837-3-martin.kaistra@linutronix.de +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 2 ++ + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 10 +++++++--- + 2 files changed, 9 insertions(+), 3 deletions(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +@@ -1897,6 +1897,8 @@ struct rtl8xxxu_priv { + * is supported and no iface_combinations are provided. + */ + struct ieee80211_vif *vif; ++ ++ struct ieee80211_vif *vifs[2]; + struct delayed_work ra_watchdog; + struct work_struct c2hcmd_work; + struct sk_buff_head c2hcmd_queue; +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -6569,10 +6569,12 @@ static int rtl8xxxu_add_interface(struct + int ret; + u8 val8; + +- if (!priv->vif) ++ if (!priv->vif) { + priv->vif = vif; +- else ++ priv->vifs[0] = vif; ++ } else { + return -EOPNOTSUPP; ++ } + + switch (vif->type) { + case NL80211_IFTYPE_STATION: +@@ -6622,8 +6624,10 @@ static void rtl8xxxu_remove_interface(st + + dev_dbg(&priv->udev->dev, "%s\n", __func__); + +- if (priv->vif) ++ if (priv->vif) { + priv->vif = NULL; ++ priv->vifs[0] = NULL; ++ } + } + + static int rtl8xxxu_config(struct ieee80211_hw *hw, u32 changed) diff --git a/package/kernel/mac80211/patches/rtl/001-03-v6.9-wifi-rtl8xxxu-support-setting-linktype-for-both-inte.patch b/package/kernel/mac80211/patches/rtl/001-03-v6.9-wifi-rtl8xxxu-support-setting-linktype-for-both-inte.patch new file mode 100644 index 00000000000000..f473fad1182652 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/001-03-v6.9-wifi-rtl8xxxu-support-setting-linktype-for-both-inte.patch @@ -0,0 +1,102 @@ +From 7f444692cde83c1455682c2d0d2c9a666422b867 Mon Sep 17 00:00:00 2001 +From: Martin Kaistra +Date: Fri, 22 Dec 2023 11:14:24 +0100 +Subject: [PATCH 03/21] wifi: rtl8xxxu: support setting linktype for both + interfaces + +To prepare for concurrent mode, enhance the set_linktype function to be +able to set the linktype in the MSR register for both hardware ports. + +Until the users of set_linktype can handle multiple interfaces, use +port_num = 0. + +Signed-off-by: Martin Kaistra +Reviewed-by: Ping-Ke Shih +Signed-off-by: Kalle Valo +Link: https://msgid.link/20231222101442.626837-4-martin.kaistra@linutronix.de +--- + .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 37 +++++++++++-------- + 1 file changed, 22 insertions(+), 15 deletions(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -1633,33 +1633,41 @@ rtl8xxxu_gen1_set_tx_power(struct rtl8xx + } + + static void rtl8xxxu_set_linktype(struct rtl8xxxu_priv *priv, +- enum nl80211_iftype linktype) ++ enum nl80211_iftype linktype, int port_num) + { +- u8 val8; +- +- val8 = rtl8xxxu_read8(priv, REG_MSR); +- val8 &= ~MSR_LINKTYPE_MASK; ++ u8 val8, type; + + switch (linktype) { + case NL80211_IFTYPE_UNSPECIFIED: +- val8 |= MSR_LINKTYPE_NONE; ++ type = MSR_LINKTYPE_NONE; + break; + case NL80211_IFTYPE_ADHOC: +- val8 |= MSR_LINKTYPE_ADHOC; ++ type = MSR_LINKTYPE_ADHOC; + break; + case NL80211_IFTYPE_STATION: +- val8 |= MSR_LINKTYPE_STATION; ++ type = MSR_LINKTYPE_STATION; + break; + case NL80211_IFTYPE_AP: +- val8 |= MSR_LINKTYPE_AP; ++ type = MSR_LINKTYPE_AP; + break; + default: +- goto out; ++ return; ++ } ++ ++ switch (port_num) { ++ case 0: ++ val8 = rtl8xxxu_read8(priv, REG_MSR) & 0x0c; ++ val8 |= type; ++ break; ++ case 1: ++ val8 = rtl8xxxu_read8(priv, REG_MSR) & 0x03; ++ val8 |= type << 2; ++ break; ++ default: ++ return; + } + + rtl8xxxu_write8(priv, REG_MSR, val8); +-out: +- return; + } + + static void +@@ -4236,7 +4244,6 @@ static int rtl8xxxu_init_device(struct i + } + + rtl8xxxu_set_mac(priv); +- rtl8xxxu_set_linktype(priv, NL80211_IFTYPE_STATION); + + /* + * Configure initial WMAC settings +@@ -4964,7 +4971,7 @@ rtl8xxxu_bss_info_changed(struct ieee802 + if (changed & BSS_CHANGED_ASSOC) { + dev_dbg(dev, "Changed ASSOC: %i!\n", vif->cfg.assoc); + +- rtl8xxxu_set_linktype(priv, vif->type); ++ rtl8xxxu_set_linktype(priv, vif->type, 0); + + if (vif->cfg.assoc) { + u32 ramask; +@@ -6610,7 +6617,7 @@ static int rtl8xxxu_add_interface(struct + ret = -EOPNOTSUPP; + } + +- rtl8xxxu_set_linktype(priv, vif->type); ++ rtl8xxxu_set_linktype(priv, vif->type, 0); + ether_addr_copy(priv->mac_addr, vif->addr); + rtl8xxxu_set_mac(priv); + diff --git a/package/kernel/mac80211/patches/rtl/001-04-v6.9-wifi-rtl8xxxu-8188e-convert-usage-of-priv-vif-to-pri.patch b/package/kernel/mac80211/patches/rtl/001-04-v6.9-wifi-rtl8xxxu-8188e-convert-usage-of-priv-vif-to-pri.patch new file mode 100644 index 00000000000000..160a71adc74897 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/001-04-v6.9-wifi-rtl8xxxu-8188e-convert-usage-of-priv-vif-to-pri.patch @@ -0,0 +1,28 @@ +From a047e46a7b98de384a158b25a05dc09aa7d70c5f Mon Sep 17 00:00:00 2001 +From: Martin Kaistra +Date: Fri, 22 Dec 2023 11:14:25 +0100 +Subject: [PATCH 04/21] wifi: rtl8xxxu: 8188e: convert usage of priv->vif to + priv->vifs[0] + +The driver currently does not support AP or concurrent mode for 8188e, +so just use priv->vifs[0] instead of priv->vif for now. + +Signed-off-by: Martin Kaistra +Reviewed-by: Ping-Ke Shih +Signed-off-by: Kalle Valo +Link: https://msgid.link/20231222101442.626837-5-martin.kaistra@linutronix.de +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c +@@ -1699,7 +1699,7 @@ void rtl8188e_handle_ra_tx_report2(struc + /* We only use macid 0, so only the first item is relevant. + * AP mode will use more of them if it's ever implemented. + */ +- if (!priv->vif || priv->vif->type == NL80211_IFTYPE_STATION) ++ if (!priv->vifs[0] || priv->vifs[0]->type == NL80211_IFTYPE_STATION) + items = 1; + + for (macid = 0; macid < items; macid++) { diff --git a/package/kernel/mac80211/patches/rtl/001-05-v6.9-wifi-rtl8xxxu-support-setting-mac-address-register-f.patch b/package/kernel/mac80211/patches/rtl/001-05-v6.9-wifi-rtl8xxxu-support-setting-mac-address-register-f.patch new file mode 100644 index 00000000000000..c3e3fea45037e9 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/001-05-v6.9-wifi-rtl8xxxu-support-setting-mac-address-register-f.patch @@ -0,0 +1,72 @@ +From 00add60cad3c9690ac0f9d4f6685f96ccd607670 Mon Sep 17 00:00:00 2001 +From: Martin Kaistra +Date: Fri, 22 Dec 2023 11:14:26 +0100 +Subject: [PATCH 05/21] wifi: rtl8xxxu: support setting mac address register + for both interfaces + +To prepare for concurrent mode, enhance rtl8xxxu_set_mac() to write the +mac address of the respective interface to REG_MACID or REG_MACID1. + +Remove the call to rtl8xxxu_set_mac() from the init function as we set +it in rtl8xxxu_add_interface() later anyway. + +Until rtl8xxxu_add_interface() can handle both interfaces, call +rtl8xxxu_set_mac() with port_num = 0. + +Signed-off-by: Martin Kaistra +Reviewed-by: Ping-Ke Shih +Signed-off-by: Kalle Valo +Link: https://msgid.link/20231222101442.626837-6-martin.kaistra@linutronix.de +--- + .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 20 +++++++++++++------ + 1 file changed, 14 insertions(+), 6 deletions(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -3580,15 +3580,25 @@ void rtl8723a_phy_lc_calibrate(struct rt + rtl8xxxu_write8(priv, REG_TXPAUSE, 0x00); + } + +-static int rtl8xxxu_set_mac(struct rtl8xxxu_priv *priv) ++static int rtl8xxxu_set_mac(struct rtl8xxxu_priv *priv, int port_num) + { + int i; + u16 reg; + +- reg = REG_MACID; ++ switch (port_num) { ++ case 0: ++ reg = REG_MACID; ++ break; ++ case 1: ++ reg = REG_MACID1; ++ break; ++ default: ++ WARN_ONCE("%s: invalid port_num\n", __func__); ++ return -EINVAL; ++ } + + for (i = 0; i < ETH_ALEN; i++) +- rtl8xxxu_write8(priv, reg + i, priv->mac_addr[i]); ++ rtl8xxxu_write8(priv, reg + i, priv->vifs[port_num]->addr[i]); + + return 0; + } +@@ -4243,8 +4253,6 @@ static int rtl8xxxu_init_device(struct i + rtl8xxxu_write32(priv, REG_HIMR, 0xffffffff); + } + +- rtl8xxxu_set_mac(priv); +- + /* + * Configure initial WMAC settings + */ +@@ -6619,7 +6627,7 @@ static int rtl8xxxu_add_interface(struct + + rtl8xxxu_set_linktype(priv, vif->type, 0); + ether_addr_copy(priv->mac_addr, vif->addr); +- rtl8xxxu_set_mac(priv); ++ rtl8xxxu_set_mac(priv, 0); + + return ret; + } diff --git a/package/kernel/mac80211/patches/rtl/001-06-v6.9-wifi-rtl8xxxu-extend-wifi-connected-check-to-both-in.patch b/package/kernel/mac80211/patches/rtl/001-06-v6.9-wifi-rtl8xxxu-extend-wifi-connected-check-to-both-in.patch new file mode 100644 index 00000000000000..70879f861ffea0 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/001-06-v6.9-wifi-rtl8xxxu-extend-wifi-connected-check-to-both-in.patch @@ -0,0 +1,75 @@ +From 9aa776209ca31695bead52674ad943848ccc97d5 Mon Sep 17 00:00:00 2001 +From: Martin Kaistra +Date: Fri, 22 Dec 2023 11:14:27 +0100 +Subject: [PATCH 06/21] wifi: rtl8xxxu: extend wifi connected check to both + interfaces + +There are multiple places in the code where the current connection +status of wifi is checked. The driver will support two interfaces soon +and either one of them (or both) could be connected. + +Convert all uses of (vif && vif->cfg.assoc) to a new helper +function rtl8xxxu_is_assoc() which checks both interfaces. + +Signed-off-by: Martin Kaistra +Reviewed-by: Ping-Ke Shih +Signed-off-by: Kalle Valo +Link: https://msgid.link/20231222101442.626837-7-martin.kaistra@linutronix.de +--- + .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 20 +++++++++---------- + 1 file changed, 9 insertions(+), 11 deletions(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -6043,18 +6043,20 @@ void rtl8723bu_update_bt_link_info(struc + btcoex->bt_busy = false; + } + ++static inline bool rtl8xxxu_is_assoc(struct rtl8xxxu_priv *priv) ++{ ++ return (priv->vifs[0] && priv->vifs[0]->cfg.assoc) || ++ (priv->vifs[1] && priv->vifs[1]->cfg.assoc); ++} ++ + static + void rtl8723bu_handle_bt_inquiry(struct rtl8xxxu_priv *priv) + { +- struct ieee80211_vif *vif; + struct rtl8xxxu_btcoex *btcoex; +- bool wifi_connected; + +- vif = priv->vif; + btcoex = &priv->bt_coex; +- wifi_connected = (vif && vif->cfg.assoc); + +- if (!wifi_connected) { ++ if (!rtl8xxxu_is_assoc(priv)) { + rtl8723bu_set_ps_tdma(priv, 0x8, 0x0, 0x0, 0x0, 0x0); + rtl8723bu_set_coex_with_type(priv, 0); + } else if (btcoex->has_sco || btcoex->has_hid || btcoex->has_a2dp) { +@@ -6072,15 +6074,11 @@ void rtl8723bu_handle_bt_inquiry(struct + static + void rtl8723bu_handle_bt_info(struct rtl8xxxu_priv *priv) + { +- struct ieee80211_vif *vif; + struct rtl8xxxu_btcoex *btcoex; +- bool wifi_connected; + +- vif = priv->vif; + btcoex = &priv->bt_coex; +- wifi_connected = (vif && vif->cfg.assoc); + +- if (wifi_connected) { ++ if (rtl8xxxu_is_assoc(priv)) { + u32 val32 = 0; + u32 high_prio_tx = 0, high_prio_rx = 0; + +@@ -7103,7 +7101,7 @@ static void rtl8xxxu_track_cfo(struct rt + int cfo_khz_a, cfo_khz_b, cfo_average; + int crystal_cap; + +- if (!priv->vif || !priv->vif->cfg.assoc) { ++ if (!rtl8xxxu_is_assoc(priv)) { + /* Reset */ + cfo->adjust = true; + diff --git a/package/kernel/mac80211/patches/rtl/001-07-v6.9-wifi-rtl8xxxu-extend-check-for-matching-bssid-to-bot.patch b/package/kernel/mac80211/patches/rtl/001-07-v6.9-wifi-rtl8xxxu-extend-check-for-matching-bssid-to-bot.patch new file mode 100644 index 00000000000000..2c53aded289106 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/001-07-v6.9-wifi-rtl8xxxu-extend-check-for-matching-bssid-to-bot.patch @@ -0,0 +1,70 @@ +From 80fd8687db41b1e04f78c37137d090f2165cca6e Mon Sep 17 00:00:00 2001 +From: Martin Kaistra +Date: Fri, 22 Dec 2023 11:14:28 +0100 +Subject: [PATCH 07/21] wifi: rtl8xxxu: extend check for matching bssid to both + interfaces + +The driver will support two interfaces soon, which both can be in +station mode, so extend the check, whether cfo information should be +parsed, to cover both interfaces. + +For better code readability put the lines with priv->vifs[port_num] in a +separate function. + +Signed-off-by: Martin Kaistra +Reviewed-by: Ping-Ke Shih +Signed-off-by: Kalle Valo +Link: https://msgid.link/20231222101442.626837-8-martin.kaistra@linutronix.de +--- + .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 22 ++++++++++++------- + 1 file changed, 14 insertions(+), 8 deletions(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -5706,6 +5706,16 @@ static void rtl8xxxu_update_beacon_work_ + rtl8xxxu_send_beacon_frame(hw, vif); + } + ++static inline bool rtl8xxxu_is_packet_match_bssid(struct rtl8xxxu_priv *priv, ++ struct ieee80211_hdr *hdr, ++ int port_num) ++{ ++ return priv->vifs[port_num] && ++ priv->vifs[port_num]->type == NL80211_IFTYPE_STATION && ++ priv->vifs[port_num]->cfg.assoc && ++ ether_addr_equal(priv->vifs[port_num]->bss_conf.bssid, hdr->addr2); ++} ++ + void rtl8723au_rx_parse_phystats(struct rtl8xxxu_priv *priv, + struct ieee80211_rx_status *rx_status, + struct rtl8723au_phy_stats *phy_stats, +@@ -5722,12 +5732,10 @@ void rtl8723au_rx_parse_phystats(struct + rx_status->signal = priv->fops->cck_rssi(priv, phy_stats); + } else { + bool parse_cfo = priv->fops->set_crystal_cap && +- priv->vif && +- priv->vif->type == NL80211_IFTYPE_STATION && +- priv->vif->cfg.assoc && + !crc_icv_err && + !ieee80211_is_ctl(hdr->frame_control) && +- ether_addr_equal(priv->vif->bss_conf.bssid, hdr->addr2); ++ (rtl8xxxu_is_packet_match_bssid(priv, hdr, 0) || ++ rtl8xxxu_is_packet_match_bssid(priv, hdr, 1)); + + if (parse_cfo) { + priv->cfo_tracking.cfo_tail[0] = phy_stats->path_cfotail[0]; +@@ -5762,12 +5770,10 @@ static void jaguar2_rx_parse_phystats_ty + bool crc_icv_err) + { + bool parse_cfo = priv->fops->set_crystal_cap && +- priv->vif && +- priv->vif->type == NL80211_IFTYPE_STATION && +- priv->vif->cfg.assoc && + !crc_icv_err && + !ieee80211_is_ctl(hdr->frame_control) && +- ether_addr_equal(priv->vif->bss_conf.bssid, hdr->addr2); ++ (rtl8xxxu_is_packet_match_bssid(priv, hdr, 0) || ++ rtl8xxxu_is_packet_match_bssid(priv, hdr, 1)); + u8 pwdb_max = 0; + int rx_path; + diff --git a/package/kernel/mac80211/patches/rtl/001-08-v6.9-wifi-rtl8xxxu-don-t-parse-CFO-if-both-interfaces-are.patch b/package/kernel/mac80211/patches/rtl/001-08-v6.9-wifi-rtl8xxxu-don-t-parse-CFO-if-both-interfaces-are.patch new file mode 100644 index 00000000000000..bad1c3cb27de02 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/001-08-v6.9-wifi-rtl8xxxu-don-t-parse-CFO-if-both-interfaces-are.patch @@ -0,0 +1,51 @@ +From f86dd8eaf8da84ee5b803d90b8c311d7e2725d0b Mon Sep 17 00:00:00 2001 +From: Martin Kaistra +Date: Fri, 22 Dec 2023 11:14:29 +0100 +Subject: [PATCH 08/21] wifi: rtl8xxxu: don't parse CFO, if both interfaces are + connected in STA mode + +If both interfaces are in STATION mode and both are connected to an AP, +there might be conflicting CFO values for the two connections. Ignore +the CFO information in this case. + +Signed-off-by: Martin Kaistra +Reviewed-by: Ping-Ke Shih +Signed-off-by: Kalle Valo +Link: https://msgid.link/20231222101442.626837-9-martin.kaistra@linutronix.de +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -5716,6 +5716,14 @@ static inline bool rtl8xxxu_is_packet_ma + ether_addr_equal(priv->vifs[port_num]->bss_conf.bssid, hdr->addr2); + } + ++static inline bool rtl8xxxu_is_sta_sta(struct rtl8xxxu_priv *priv) ++{ ++ return (priv->vifs[0] && priv->vifs[0]->cfg.assoc && ++ priv->vifs[0]->type == NL80211_IFTYPE_STATION) && ++ (priv->vifs[1] && priv->vifs[1]->cfg.assoc && ++ priv->vifs[1]->type == NL80211_IFTYPE_STATION); ++} ++ + void rtl8723au_rx_parse_phystats(struct rtl8xxxu_priv *priv, + struct ieee80211_rx_status *rx_status, + struct rtl8723au_phy_stats *phy_stats, +@@ -5734,6 +5742,7 @@ void rtl8723au_rx_parse_phystats(struct + bool parse_cfo = priv->fops->set_crystal_cap && + !crc_icv_err && + !ieee80211_is_ctl(hdr->frame_control) && ++ !rtl8xxxu_is_sta_sta(priv) && + (rtl8xxxu_is_packet_match_bssid(priv, hdr, 0) || + rtl8xxxu_is_packet_match_bssid(priv, hdr, 1)); + +@@ -5772,6 +5781,7 @@ static void jaguar2_rx_parse_phystats_ty + bool parse_cfo = priv->fops->set_crystal_cap && + !crc_icv_err && + !ieee80211_is_ctl(hdr->frame_control) && ++ !rtl8xxxu_is_sta_sta(priv) && + (rtl8xxxu_is_packet_match_bssid(priv, hdr, 0) || + rtl8xxxu_is_packet_match_bssid(priv, hdr, 1)); + u8 pwdb_max = 0; diff --git a/package/kernel/mac80211/patches/rtl/001-09-v6.9-wifi-rtl8xxxu-support-setting-bssid-register-for-mul.patch b/package/kernel/mac80211/patches/rtl/001-09-v6.9-wifi-rtl8xxxu-support-setting-bssid-register-for-mul.patch new file mode 100644 index 00000000000000..def70343b0f9be --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/001-09-v6.9-wifi-rtl8xxxu-support-setting-bssid-register-for-mul.patch @@ -0,0 +1,67 @@ +From 3ff7a05996f901a7a10068b42e9dc8435f908a4c Mon Sep 17 00:00:00 2001 +From: Martin Kaistra +Date: Fri, 22 Dec 2023 11:14:30 +0100 +Subject: [PATCH 09/21] wifi: rtl8xxxu: support setting bssid register for + multiple interfaces + +To prepare for concurrent mode, enhance rtl8xxxu_set_bssid() to write the +BSSID of the respective interface to REG_BSSID or REG_BSSID1. + +Like done with rtl8xxxu_set_mac(), call rtl8xxxu_set_bssid() with +port_num = 0, until the callers also support multiple interfaces. + +Signed-off-by: Martin Kaistra +Reviewed-by: Ping-Ke Shih +Signed-off-by: Kalle Valo +Link: https://msgid.link/20231222101442.626837-10-martin.kaistra@linutronix.de +--- + .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 18 ++++++++++++++---- + 1 file changed, 14 insertions(+), 4 deletions(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -3603,14 +3603,24 @@ static int rtl8xxxu_set_mac(struct rtl8x + return 0; + } + +-static int rtl8xxxu_set_bssid(struct rtl8xxxu_priv *priv, const u8 *bssid) ++static int rtl8xxxu_set_bssid(struct rtl8xxxu_priv *priv, const u8 *bssid, int port_num) + { + int i; + u16 reg; + + dev_dbg(&priv->udev->dev, "%s: (%pM)\n", __func__, bssid); + +- reg = REG_BSSID; ++ switch (port_num) { ++ case 0: ++ reg = REG_BSSID; ++ break; ++ case 1: ++ reg = REG_BSSID1; ++ break; ++ default: ++ WARN_ONCE("%s: invalid port_num\n", __func__); ++ return -EINVAL; ++ } + + for (i = 0; i < ETH_ALEN; i++) + rtl8xxxu_write8(priv, reg + i, bssid[i]); +@@ -5068,7 +5078,7 @@ rtl8xxxu_bss_info_changed(struct ieee802 + + if (changed & BSS_CHANGED_BSSID) { + dev_dbg(dev, "Changed BSSID!\n"); +- rtl8xxxu_set_bssid(priv, bss_conf->bssid); ++ rtl8xxxu_set_bssid(priv, bss_conf->bssid, 0); + } + + if (changed & BSS_CHANGED_BASIC_RATES) { +@@ -5097,7 +5107,7 @@ static int rtl8xxxu_start_ap(struct ieee + struct device *dev = &priv->udev->dev; + + dev_dbg(dev, "Start AP mode\n"); +- rtl8xxxu_set_bssid(priv, vif->bss_conf.bssid); ++ rtl8xxxu_set_bssid(priv, vif->bss_conf.bssid, 0); + rtl8xxxu_write16(priv, REG_BCN_INTERVAL, vif->bss_conf.beacon_int); + priv->fops->report_connect(priv, RTL8XXXU_BC_MC_MACID, 0, true); + diff --git a/package/kernel/mac80211/patches/rtl/001-10-v6.9-wifi-rtl8xxxu-support-multiple-interfaces-in-set_aif.patch b/package/kernel/mac80211/patches/rtl/001-10-v6.9-wifi-rtl8xxxu-support-multiple-interfaces-in-set_aif.patch new file mode 100644 index 00000000000000..b8cb66dd922680 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/001-10-v6.9-wifi-rtl8xxxu-support-multiple-interfaces-in-set_aif.patch @@ -0,0 +1,44 @@ +From 43532c050f8eec4056a21978fdb5b958e1477553 Mon Sep 17 00:00:00 2001 +From: Martin Kaistra +Date: Fri, 22 Dec 2023 11:14:31 +0100 +Subject: [PATCH 10/21] wifi: rtl8xxxu: support multiple interfaces in + set_aifs() + +In concurrent mode supported by this driver, both interfaces will use +the same channel and same wireless mode. +It is therefore possible to get the wireless mode by checking the first +connected interface. + +Signed-off-by: Martin Kaistra +Reviewed-by: Ping-Ke Shih +Signed-off-by: Kalle Valo +Link: https://msgid.link/20231222101442.626837-11-martin.kaistra@linutronix.de +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -4913,14 +4913,20 @@ static void rtl8xxxu_set_aifs(struct rtl + u8 aifs, aifsn, sifs; + int i; + +- if (priv->vif) { ++ for (i = 0; i < ARRAY_SIZE(priv->vifs); i++) { ++ if (!priv->vifs[i]) ++ continue; ++ + struct ieee80211_sta *sta; + + rcu_read_lock(); +- sta = ieee80211_find_sta(priv->vif, priv->vif->bss_conf.bssid); ++ sta = ieee80211_find_sta(priv->vifs[i], priv->vifs[i]->bss_conf.bssid); + if (sta) + wireless_mode = rtl8xxxu_wireless_mode(priv->hw, sta); + rcu_read_unlock(); ++ ++ if (wireless_mode) ++ break; + } + + if (priv->hw->conf.chandef.chan->band == NL80211_BAND_5GHZ || diff --git a/package/kernel/mac80211/patches/rtl/001-11-v6.9-wifi-rtl8xxxu-support-multiple-interfaces-in-update_.patch b/package/kernel/mac80211/patches/rtl/001-11-v6.9-wifi-rtl8xxxu-support-multiple-interfaces-in-update_.patch new file mode 100644 index 00000000000000..63960e7ae79435 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/001-11-v6.9-wifi-rtl8xxxu-support-multiple-interfaces-in-update_.patch @@ -0,0 +1,28 @@ +From 05b22e9b7d84253f765cde01cb09d144094b61c9 Mon Sep 17 00:00:00 2001 +From: Martin Kaistra +Date: Fri, 22 Dec 2023 11:14:32 +0100 +Subject: [PATCH 11/21] wifi: rtl8xxxu: support multiple interfaces in + update_beacon_work_callback() + +As we only want to support AP mode/sending beacons on port 0, it is +enough to replace priv->vif with priv->vifs[0]. + +Signed-off-by: Martin Kaistra +Reviewed-by: Ping-Ke Shih +Signed-off-by: Kalle Valo +Link: https://msgid.link/20231222101442.626837-12-martin.kaistra@linutronix.de +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -5712,7 +5712,7 @@ static void rtl8xxxu_update_beacon_work_ + struct rtl8xxxu_priv *priv = + container_of(work, struct rtl8xxxu_priv, update_beacon_work); + struct ieee80211_hw *hw = priv->hw; +- struct ieee80211_vif *vif = priv->vif; ++ struct ieee80211_vif *vif = priv->vifs[0]; + + if (!vif) { + WARN_ONCE(true, "no vif to update beacon\n"); diff --git a/package/kernel/mac80211/patches/rtl/001-12-v6.9-wifi-rtl8xxxu-support-multiple-interfaces-in-configu.patch b/package/kernel/mac80211/patches/rtl/001-12-v6.9-wifi-rtl8xxxu-support-multiple-interfaces-in-configu.patch new file mode 100644 index 00000000000000..707236b7dc5a5f --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/001-12-v6.9-wifi-rtl8xxxu-support-multiple-interfaces-in-configu.patch @@ -0,0 +1,33 @@ +From 6b76638287055791e74b32c401a39ea1b91e7158 Mon Sep 17 00:00:00 2001 +From: Martin Kaistra +Date: Fri, 22 Dec 2023 11:14:33 +0100 +Subject: [PATCH 12/21] wifi: rtl8xxxu: support multiple interfaces in + configure_filter() + +As we only want to support AP mode/sending beacons on port 0, change +from priv->vif to priv->vifs[0] in the check for AP mode. +Additionally, if we are in AP mode, don't filter RX beacon and probe +response frames to still allow working STATION mode on the other +interface. + +Signed-off-by: Martin Kaistra +Reviewed-by: Ping-Ke Shih +Signed-off-by: Kalle Valo +Link: https://msgid.link/20231222101442.626837-13-martin.kaistra@linutronix.de +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -6794,8 +6794,8 @@ static void rtl8xxxu_configure_filter(st + else + rcr |= RCR_CHECK_BSSID_BEACON | RCR_CHECK_BSSID_MATCH; + +- if (priv->vif && priv->vif->type == NL80211_IFTYPE_AP) +- rcr &= ~RCR_CHECK_BSSID_MATCH; ++ if (priv->vifs[0] && priv->vifs[0]->type == NL80211_IFTYPE_AP) ++ rcr &= ~(RCR_CHECK_BSSID_MATCH | RCR_CHECK_BSSID_BEACON); + + if (*total_flags & FIF_CONTROL) + rcr |= RCR_ACCEPT_CTRL_FRAME; diff --git a/package/kernel/mac80211/patches/rtl/001-13-v6.9-wifi-rtl8xxxu-support-multiple-interfaces-in-watchdo.patch b/package/kernel/mac80211/patches/rtl/001-13-v6.9-wifi-rtl8xxxu-support-multiple-interfaces-in-watchdo.patch new file mode 100644 index 00000000000000..b174b704d73c35 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/001-13-v6.9-wifi-rtl8xxxu-support-multiple-interfaces-in-watchdo.patch @@ -0,0 +1,66 @@ +From 3f9baa99f8429ea6f56e7cc8d881c027518e9573 Mon Sep 17 00:00:00 2001 +From: Martin Kaistra +Date: Fri, 22 Dec 2023 11:14:34 +0100 +Subject: [PATCH 13/21] wifi: rtl8xxxu: support multiple interfaces in + watchdog_callback() + +Check first whether priv->vifs[0] exists and is of type STATION, then go +to priv->vifs[1]. Make sure to call refresh_rate_mask for both +interfaces. + +Signed-off-by: Martin Kaistra +Reviewed-by: Ping-Ke Shih +Signed-off-by: Kalle Valo +Link: https://msgid.link/20231222101442.626837-14-martin.kaistra@linutronix.de +--- + .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 19 +++++++++++-------- + 1 file changed, 11 insertions(+), 8 deletions(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -7200,11 +7200,15 @@ static void rtl8xxxu_watchdog_callback(s + { + struct ieee80211_vif *vif; + struct rtl8xxxu_priv *priv; ++ int i; + + priv = container_of(work, struct rtl8xxxu_priv, ra_watchdog.work); +- vif = priv->vif; ++ for (i = 0; i < ARRAY_SIZE(priv->vifs); i++) { ++ vif = priv->vifs[i]; ++ ++ if (!vif || vif->type != NL80211_IFTYPE_STATION) ++ continue; + +- if (vif && vif->type == NL80211_IFTYPE_STATION) { + int signal; + struct ieee80211_sta *sta; + +@@ -7215,22 +7219,21 @@ static void rtl8xxxu_watchdog_callback(s + + dev_dbg(dev, "%s: no sta found\n", __func__); + rcu_read_unlock(); +- goto out; ++ continue; + } + rcu_read_unlock(); + + signal = ieee80211_ave_rssi(vif); + +- priv->fops->report_rssi(priv, 0, ++ priv->fops->report_rssi(priv, rtl8xxxu_get_macid(priv, sta), + rtl8xxxu_signal_to_snr(signal)); + +- if (priv->fops->set_crystal_cap) +- rtl8xxxu_track_cfo(priv); +- + rtl8xxxu_refresh_rate_mask(priv, signal, sta, false); + } + +-out: ++ if (priv->fops->set_crystal_cap) ++ rtl8xxxu_track_cfo(priv); ++ + schedule_delayed_work(&priv->ra_watchdog, 2 * HZ); + } + diff --git a/package/kernel/mac80211/patches/rtl/001-14-v6.9-wifi-rtl8xxxu-support-multiple-interfaces-in-add-rem.patch b/package/kernel/mac80211/patches/rtl/001-14-v6.9-wifi-rtl8xxxu-support-multiple-interfaces-in-add-rem.patch new file mode 100644 index 00000000000000..7fcbb02afe11d0 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/001-14-v6.9-wifi-rtl8xxxu-support-multiple-interfaces-in-add-rem.patch @@ -0,0 +1,137 @@ +From eef55f1545c92c7181d5083453dee1296298ad3e Mon Sep 17 00:00:00 2001 +From: Martin Kaistra +Date: Fri, 22 Dec 2023 11:14:35 +0100 +Subject: [PATCH 14/21] wifi: rtl8xxxu: support multiple interfaces in + {add,remove}_interface() + +Add a custom struct to store in vif->drv_priv with a reference to +port_num and fill it when a new interface is added. Choose a free +port_num for the newly added interface. + +As we only want to support AP mode/sending beacons on port 0, only change +the beacon settings if a new interface is actually assigned to port 0. + +Call set_linktype() and set_mac() with the appropriate port_num. + +Signed-off-by: Martin Kaistra +Reviewed-by: Ping-Ke Shih +Signed-off-by: Kalle Valo +Link: https://msgid.link/20231222101442.626837-15-martin.kaistra@linutronix.de +--- + .../net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 4 ++ + .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 52 +++++++++++-------- + 2 files changed, 34 insertions(+), 22 deletions(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +@@ -1921,6 +1921,10 @@ struct rtl8xxxu_sta_info { + u8 macid; + }; + ++struct rtl8xxxu_vif { ++ int port_num; ++}; ++ + struct rtl8xxxu_rx_urb { + struct urb urb; + struct ieee80211_hw *hw; +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -6610,28 +6610,33 @@ error: + static int rtl8xxxu_add_interface(struct ieee80211_hw *hw, + struct ieee80211_vif *vif) + { ++ struct rtl8xxxu_vif *rtlvif = (struct rtl8xxxu_vif *)vif->drv_priv; + struct rtl8xxxu_priv *priv = hw->priv; +- int ret; ++ int port_num; + u8 val8; + +- if (!priv->vif) { +- priv->vif = vif; +- priv->vifs[0] = vif; +- } else { ++ if (!priv->vifs[0]) ++ port_num = 0; ++ else if (!priv->vifs[1]) ++ port_num = 1; ++ else + return -EOPNOTSUPP; +- } + + switch (vif->type) { + case NL80211_IFTYPE_STATION: +- rtl8xxxu_stop_tx_beacon(priv); ++ if (port_num == 0) { ++ rtl8xxxu_stop_tx_beacon(priv); + +- val8 = rtl8xxxu_read8(priv, REG_BEACON_CTRL); +- val8 |= BEACON_ATIM | BEACON_FUNCTION_ENABLE | +- BEACON_DISABLE_TSF_UPDATE; +- rtl8xxxu_write8(priv, REG_BEACON_CTRL, val8); +- ret = 0; ++ val8 = rtl8xxxu_read8(priv, REG_BEACON_CTRL); ++ val8 |= BEACON_ATIM | BEACON_FUNCTION_ENABLE | ++ BEACON_DISABLE_TSF_UPDATE; ++ rtl8xxxu_write8(priv, REG_BEACON_CTRL, val8); ++ } + break; + case NL80211_IFTYPE_AP: ++ if (port_num == 1) ++ return -EOPNOTSUPP; ++ + rtl8xxxu_write8(priv, REG_BEACON_CTRL, + BEACON_DISABLE_TSF_UPDATE | BEACON_CTRL_MBSSID); + rtl8xxxu_write8(priv, REG_ATIMWND, 0x0c); /* 12ms */ +@@ -6648,31 +6653,32 @@ static int rtl8xxxu_add_interface(struct + val8 = rtl8xxxu_read8(priv, REG_CCK_CHECK); + val8 &= ~BIT_BCN_PORT_SEL; + rtl8xxxu_write8(priv, REG_CCK_CHECK, val8); +- +- ret = 0; + break; + default: +- ret = -EOPNOTSUPP; ++ return -EOPNOTSUPP; + } + +- rtl8xxxu_set_linktype(priv, vif->type, 0); ++ priv->vifs[port_num] = vif; ++ priv->vif = vif; ++ rtlvif->port_num = port_num; ++ ++ rtl8xxxu_set_linktype(priv, vif->type, port_num); + ether_addr_copy(priv->mac_addr, vif->addr); +- rtl8xxxu_set_mac(priv, 0); ++ rtl8xxxu_set_mac(priv, port_num); + +- return ret; ++ return 0; + } + + static void rtl8xxxu_remove_interface(struct ieee80211_hw *hw, + struct ieee80211_vif *vif) + { ++ struct rtl8xxxu_vif *rtlvif = (struct rtl8xxxu_vif *)vif->drv_priv; + struct rtl8xxxu_priv *priv = hw->priv; + + dev_dbg(&priv->udev->dev, "%s\n", __func__); + +- if (priv->vif) { +- priv->vif = NULL; +- priv->vifs[0] = NULL; +- } ++ priv->vif = NULL; ++ priv->vifs[rtlvif->port_num] = NULL; + } + + static int rtl8xxxu_config(struct ieee80211_hw *hw, u32 changed) +@@ -7661,6 +7667,8 @@ static int rtl8xxxu_probe(struct usb_int + if (ret) + goto err_set_intfdata; + ++ hw->vif_data_size = sizeof(struct rtl8xxxu_vif); ++ + hw->wiphy->max_scan_ssids = 1; + hw->wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN; + if (priv->fops->max_macid_num) diff --git a/package/kernel/mac80211/patches/rtl/001-15-v6.9-wifi-rtl8xxxu-support-multiple-interfaces-in-bss_inf.patch b/package/kernel/mac80211/patches/rtl/001-15-v6.9-wifi-rtl8xxxu-support-multiple-interfaces-in-bss_inf.patch new file mode 100644 index 00000000000000..5c5c1948d3742a --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/001-15-v6.9-wifi-rtl8xxxu-support-multiple-interfaces-in-bss_inf.patch @@ -0,0 +1,57 @@ +From 073401c3b6b9eaea027240baf07f2b84dd2d2d26 Mon Sep 17 00:00:00 2001 +From: Martin Kaistra +Date: Fri, 22 Dec 2023 11:14:36 +0100 +Subject: [PATCH 15/21] wifi: rtl8xxxu: support multiple interfaces in + bss_info_changed() + +Call set_linktype and set_bssid now with correct port_num. Call +stop_tx_beacon only for port 0, as we don't support beacons on port 1. +Explicit changes to BEACON will only happen for AP type interfaces, so +we don't need an additional check there. + +Signed-off-by: Martin Kaistra +Reviewed-by: Ping-Ke Shih +Signed-off-by: Kalle Valo +Link: https://msgid.link/20231222101442.626837-16-martin.kaistra@linutronix.de +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -4983,6 +4983,7 @@ static void + rtl8xxxu_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, + struct ieee80211_bss_conf *bss_conf, u64 changed) + { ++ struct rtl8xxxu_vif *rtlvif = (struct rtl8xxxu_vif *)vif->drv_priv; + struct rtl8xxxu_priv *priv = hw->priv; + struct device *dev = &priv->udev->dev; + struct ieee80211_sta *sta; +@@ -4995,7 +4996,7 @@ rtl8xxxu_bss_info_changed(struct ieee802 + if (changed & BSS_CHANGED_ASSOC) { + dev_dbg(dev, "Changed ASSOC: %i!\n", vif->cfg.assoc); + +- rtl8xxxu_set_linktype(priv, vif->type, 0); ++ rtl8xxxu_set_linktype(priv, vif->type, rtlvif->port_num); + + if (vif->cfg.assoc) { + u32 ramask; +@@ -5042,7 +5043,8 @@ rtl8xxxu_bss_info_changed(struct ieee802 + + rtl8xxxu_write8(priv, REG_BCN_MAX_ERR, 0xff); + +- rtl8xxxu_stop_tx_beacon(priv); ++ if (rtlvif->port_num == 0) ++ rtl8xxxu_stop_tx_beacon(priv); + + /* joinbss sequence */ + rtl8xxxu_write16(priv, REG_BCN_PSR_RPT, +@@ -5084,7 +5086,7 @@ rtl8xxxu_bss_info_changed(struct ieee802 + + if (changed & BSS_CHANGED_BSSID) { + dev_dbg(dev, "Changed BSSID!\n"); +- rtl8xxxu_set_bssid(priv, bss_conf->bssid, 0); ++ rtl8xxxu_set_bssid(priv, bss_conf->bssid, rtlvif->port_num); + } + + if (changed & BSS_CHANGED_BASIC_RATES) { diff --git a/package/kernel/mac80211/patches/rtl/001-16-v6.9-wifi-rtl8xxxu-support-multiple-interface-in-start_ap.patch b/package/kernel/mac80211/patches/rtl/001-16-v6.9-wifi-rtl8xxxu-support-multiple-interface-in-start_ap.patch new file mode 100644 index 00000000000000..25d02384615bf8 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/001-16-v6.9-wifi-rtl8xxxu-support-multiple-interface-in-start_ap.patch @@ -0,0 +1,32 @@ +From 61fdbd9e2a9d74c716bf4d9684653de5efdee691 Mon Sep 17 00:00:00 2001 +From: Martin Kaistra +Date: Fri, 22 Dec 2023 11:14:37 +0100 +Subject: [PATCH 16/21] wifi: rtl8xxxu: support multiple interface in + start_ap() + +Call set_bssid() with the correct port_num now. + +Signed-off-by: Martin Kaistra +Reviewed-by: Ping-Ke Shih +Signed-off-by: Kalle Valo +Link: https://msgid.link/20231222101442.626837-17-martin.kaistra@linutronix.de +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -5111,11 +5111,12 @@ error: + static int rtl8xxxu_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif, + struct ieee80211_bss_conf *link_conf) + { ++ struct rtl8xxxu_vif *rtlvif = (struct rtl8xxxu_vif *)vif->drv_priv; + struct rtl8xxxu_priv *priv = hw->priv; + struct device *dev = &priv->udev->dev; + + dev_dbg(dev, "Start AP mode\n"); +- rtl8xxxu_set_bssid(priv, vif->bss_conf.bssid, 0); ++ rtl8xxxu_set_bssid(priv, vif->bss_conf.bssid, rtlvif->port_num); + rtl8xxxu_write16(priv, REG_BCN_INTERVAL, vif->bss_conf.beacon_int); + priv->fops->report_connect(priv, RTL8XXXU_BC_MC_MACID, 0, true); + diff --git a/package/kernel/mac80211/patches/rtl/001-17-v6.9-wifi-rtl8xxxu-add-macids-for-STA-mode.patch b/package/kernel/mac80211/patches/rtl/001-17-v6.9-wifi-rtl8xxxu-add-macids-for-STA-mode.patch new file mode 100644 index 00000000000000..9f8d0a3aaf0414 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/001-17-v6.9-wifi-rtl8xxxu-add-macids-for-STA-mode.patch @@ -0,0 +1,82 @@ +From 5ce0d7e8aee03e73b35f0fe1f1ebbdd4e45776f3 Mon Sep 17 00:00:00 2001 +From: Martin Kaistra +Date: Fri, 22 Dec 2023 11:14:38 +0100 +Subject: [PATCH 17/21] wifi: rtl8xxxu: add macids for STA mode + +Until now, the driver only assigned a dedicated macid for connections +made in AP mode, in STA mode the return value of rtl8xxxu_get_macid() +was simply 0. +To differentiate between port 0 and 1, when both are in STA mode, +allocate a second macid (with value 1) and set sta_info->macid according +to the used port_num in rtl8xxxu_sta_add(). + +Signed-off-by: Martin Kaistra +Reviewed-by: Ping-Ke Shih +Signed-off-by: Kalle Valo +Link: https://msgid.link/20231222101442.626837-18-martin.kaistra@linutronix.de +--- + .../net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 1 + + .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 18 +++++++++++++++++- + 2 files changed, 18 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +@@ -1774,6 +1774,7 @@ struct rtl8xxxu_cfo_tracking { + #define RTL8XXXU_HW_LED_CONTROL 2 + #define RTL8XXXU_MAX_MAC_ID_NUM 128 + #define RTL8XXXU_BC_MC_MACID 0 ++#define RTL8XXXU_BC_MC_MACID1 1 + + struct rtl8xxxu_priv { + struct ieee80211_hw *hw; +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -4053,10 +4053,13 @@ static inline u8 rtl8xxxu_get_macid(stru + { + struct rtl8xxxu_sta_info *sta_info; + +- if (!priv->vif || priv->vif->type == NL80211_IFTYPE_STATION || !sta) ++ if (!sta) + return 0; + + sta_info = (struct rtl8xxxu_sta_info *)sta->drv_priv; ++ if (!sta_info) ++ return 0; ++ + return sta_info->macid; + } + +@@ -4536,6 +4539,7 @@ static int rtl8xxxu_init_device(struct i + rtl8188e_ra_info_init_all(&priv->ra_info); + + set_bit(RTL8XXXU_BC_MC_MACID, priv->mac_id_map); ++ set_bit(RTL8XXXU_BC_MC_MACID1, priv->mac_id_map); + + exit: + return ret; +@@ -7375,6 +7379,7 @@ static int rtl8xxxu_sta_add(struct ieee8 + struct ieee80211_sta *sta) + { + struct rtl8xxxu_sta_info *sta_info = (struct rtl8xxxu_sta_info *)sta->drv_priv; ++ struct rtl8xxxu_vif *rtlvif = (struct rtl8xxxu_vif *)vif->drv_priv; + struct rtl8xxxu_priv *priv = hw->priv; + + if (vif->type == NL80211_IFTYPE_AP) { +@@ -7384,6 +7389,17 @@ static int rtl8xxxu_sta_add(struct ieee8 + + rtl8xxxu_refresh_rate_mask(priv, 0, sta, true); + priv->fops->report_connect(priv, sta_info->macid, H2C_MACID_ROLE_STA, true); ++ } else { ++ switch (rtlvif->port_num) { ++ case 0: ++ sta_info->macid = RTL8XXXU_BC_MC_MACID; ++ break; ++ case 1: ++ sta_info->macid = RTL8XXXU_BC_MC_MACID1; ++ break; ++ default: ++ break; ++ } + } + + return 0; diff --git a/package/kernel/mac80211/patches/rtl/001-18-v6.9-wifi-rtl8xxxu-remove-obsolete-priv-vif.patch b/package/kernel/mac80211/patches/rtl/001-18-v6.9-wifi-rtl8xxxu-remove-obsolete-priv-vif.patch new file mode 100644 index 00000000000000..5cf65eb519080c --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/001-18-v6.9-wifi-rtl8xxxu-remove-obsolete-priv-vif.patch @@ -0,0 +1,49 @@ +From f232e9d91bb84817c60c051a3e3b56dd2721a7b3 Mon Sep 17 00:00:00 2001 +From: Martin Kaistra +Date: Fri, 22 Dec 2023 11:14:39 +0100 +Subject: [PATCH 18/21] wifi: rtl8xxxu: remove obsolete priv->vif + +Now that all uses of priv->vif have been converted to priv->vifs[] +remove the old attribute. + +Signed-off-by: Martin Kaistra +Reviewed-by: Ping-Ke Shih +Signed-off-by: Kalle Valo +Link: https://msgid.link/20231222101442.626837-19-martin.kaistra@linutronix.de +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 5 ----- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 2 -- + 2 files changed, 7 deletions(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +@@ -1893,11 +1893,6 @@ struct rtl8xxxu_priv { + u8 rssi_level; + DECLARE_BITMAP(tx_aggr_started, IEEE80211_NUM_TIDS); + DECLARE_BITMAP(tid_tx_operational, IEEE80211_NUM_TIDS); +- /* +- * Only one virtual interface permitted because only STA mode +- * is supported and no iface_combinations are provided. +- */ +- struct ieee80211_vif *vif; + + struct ieee80211_vif *vifs[2]; + struct delayed_work ra_watchdog; +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -6666,7 +6666,6 @@ static int rtl8xxxu_add_interface(struct + } + + priv->vifs[port_num] = vif; +- priv->vif = vif; + rtlvif->port_num = port_num; + + rtl8xxxu_set_linktype(priv, vif->type, port_num); +@@ -6684,7 +6683,6 @@ static void rtl8xxxu_remove_interface(st + + dev_dbg(&priv->udev->dev, "%s\n", __func__); + +- priv->vif = NULL; + priv->vifs[rtlvif->port_num] = NULL; + } + diff --git a/package/kernel/mac80211/patches/rtl/001-19-v6.9-wifi-rtl8xxxu-add-hw-crypto-support-for-AP-mode.patch b/package/kernel/mac80211/patches/rtl/001-19-v6.9-wifi-rtl8xxxu-add-hw-crypto-support-for-AP-mode.patch new file mode 100644 index 00000000000000..b5f93074968a85 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/001-19-v6.9-wifi-rtl8xxxu-add-hw-crypto-support-for-AP-mode.patch @@ -0,0 +1,226 @@ +From b837f78fbffa5f8e7e7c59879db54793abf161ec Mon Sep 17 00:00:00 2001 +From: Martin Kaistra +Date: Fri, 22 Dec 2023 11:14:40 +0100 +Subject: [PATCH 19/21] wifi: rtl8xxxu: add hw crypto support for AP mode + +Add a custom function for allocating entries in the sec cam. This allows +us to store multiple keys with the same keyidx. + +The maximum number of sec cam entries for 8188f is 16 according to the +vendor driver. Add the number to rtl8xxxu_fileops, so that other chips +which might support more entries, can set a different number there. + +Set the bssid as mac address for group keys instead of just using the +ethernet broadcast address and use BIT(6) in the sec cam ctrl entry +for differentiating them from pairwise keys like in the vendor driver. + +Add the TXDESC_EN_DESC_ID bit and the hw_key_idx to tx +broadcast/multicast packets in AP mode. + +Finally, allow the usage of rtl8xxxu_set_key() for AP mode. + +Signed-off-by: Martin Kaistra +Reviewed-by: Ping-Ke Shih +Signed-off-by: Kalle Valo +Link: https://msgid.link/20231222101442.626837-20-martin.kaistra@linutronix.de +--- + .../net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 5 ++ + .../realtek/rtl8xxxu/rtl8xxxu_8188f.c | 1 + + .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 48 +++++++++++++++---- + 3 files changed, 44 insertions(+), 10 deletions(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +@@ -498,6 +498,7 @@ struct rtl8xxxu_txdesc40 { + #define DESC_RATE_ID_SHIFT 16 + #define DESC_RATE_ID_MASK 0xf + #define TXDESC_NAVUSEHDR BIT(20) ++#define TXDESC_EN_DESC_ID BIT(21) + #define TXDESC_SEC_RC4 0x00400000 + #define TXDESC_SEC_AES 0x00c00000 + #define TXDESC_PKT_OFFSET_SHIFT 26 +@@ -1775,6 +1776,7 @@ struct rtl8xxxu_cfo_tracking { + #define RTL8XXXU_MAX_MAC_ID_NUM 128 + #define RTL8XXXU_BC_MC_MACID 0 + #define RTL8XXXU_BC_MC_MACID1 1 ++#define RTL8XXXU_MAX_SEC_CAM_NUM 64 + + struct rtl8xxxu_priv { + struct ieee80211_hw *hw; +@@ -1908,6 +1910,7 @@ struct rtl8xxxu_priv { + char led_name[32]; + struct led_classdev led_cdev; + DECLARE_BITMAP(mac_id_map, RTL8XXXU_MAX_MAC_ID_NUM); ++ DECLARE_BITMAP(cam_map, RTL8XXXU_MAX_SEC_CAM_NUM); + }; + + struct rtl8xxxu_sta_info { +@@ -1919,6 +1922,7 @@ struct rtl8xxxu_sta_info { + + struct rtl8xxxu_vif { + int port_num; ++ u8 hw_key_idx; + }; + + struct rtl8xxxu_rx_urb { +@@ -1993,6 +1997,7 @@ struct rtl8xxxu_fileops { + u16 max_aggr_num; + u8 supports_ap:1; + u16 max_macid_num; ++ u16 max_sec_cam_num; + u32 adda_1t_init; + u32 adda_1t_path_on; + u32 adda_2t_path_on_a; +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c +@@ -1751,6 +1751,7 @@ struct rtl8xxxu_fileops rtl8188fu_fops = + .max_aggr_num = 0x0c14, + .supports_ap = 1, + .max_macid_num = 16, ++ .max_sec_cam_num = 16, + .adda_1t_init = 0x03c00014, + .adda_1t_path_on = 0x03c00014, + .trxff_boundary = 0x3f7f, +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -4559,8 +4559,10 @@ static void rtl8xxxu_cam_write(struct rt + * This is a bit of a hack - the lower bits of the cipher + * suite selector happens to match the cipher index in the CAM + */ +- addr = key->keyidx << CAM_CMD_KEY_SHIFT; ++ addr = key->hw_key_idx << CAM_CMD_KEY_SHIFT; + ctrl = (key->cipher & 0x0f) << 2 | key->keyidx | CAM_WRITE_VALID; ++ if (!(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) ++ ctrl |= BIT(6); + + for (j = 5; j >= 0; j--) { + switch (j) { +@@ -5546,13 +5548,14 @@ static void rtl8xxxu_tx(struct ieee80211 + struct rtl8xxxu_tx_urb *tx_urb; + struct ieee80211_sta *sta = NULL; + struct ieee80211_vif *vif = tx_info->control.vif; ++ struct rtl8xxxu_vif *rtlvif = (struct rtl8xxxu_vif *)vif->drv_priv; + struct device *dev = &priv->udev->dev; + u32 queue, rts_rate; + u16 pktlen = skb->len; + int tx_desc_size = priv->fops->tx_desc_size; + u8 macid; + int ret; +- bool ampdu_enable, sgi = false, short_preamble = false; ++ bool ampdu_enable, sgi = false, short_preamble = false, bmc = false; + + if (skb_headroom(skb) < tx_desc_size) { + dev_warn(dev, +@@ -5594,10 +5597,14 @@ static void rtl8xxxu_tx(struct ieee80211 + tx_desc->txdw0 = + TXDESC_OWN | TXDESC_FIRST_SEGMENT | TXDESC_LAST_SEGMENT; + if (is_multicast_ether_addr(ieee80211_get_DA(hdr)) || +- is_broadcast_ether_addr(ieee80211_get_DA(hdr))) ++ is_broadcast_ether_addr(ieee80211_get_DA(hdr))) { + tx_desc->txdw0 |= TXDESC_BROADMULTICAST; ++ bmc = true; ++ } ++ + + tx_desc->txdw1 = cpu_to_le32(queue << TXDESC_QUEUE_SHIFT); ++ macid = rtl8xxxu_get_macid(priv, sta); + + if (tx_info->control.hw_key) { + switch (tx_info->control.hw_key->cipher) { +@@ -5612,6 +5619,10 @@ static void rtl8xxxu_tx(struct ieee80211 + default: + break; + } ++ if (bmc && rtlvif->hw_key_idx != 0xff) { ++ tx_desc->txdw1 |= TXDESC_EN_DESC_ID; ++ macid = rtlvif->hw_key_idx; ++ } + } + + /* (tx_info->flags & IEEE80211_TX_CTL_AMPDU) && */ +@@ -5655,7 +5666,6 @@ static void rtl8xxxu_tx(struct ieee80211 + else + rts_rate = 0; + +- macid = rtl8xxxu_get_macid(priv, sta); + priv->fops->fill_txdesc(hw, hdr, tx_info, tx_desc, sgi, short_preamble, + ampdu_enable, rts_rate, macid); + +@@ -6667,6 +6677,7 @@ static int rtl8xxxu_add_interface(struct + + priv->vifs[port_num] = vif; + rtlvif->port_num = port_num; ++ rtlvif->hw_key_idx = 0xff; + + rtl8xxxu_set_linktype(priv, vif->type, port_num); + ether_addr_copy(priv->mac_addr, vif->addr); +@@ -6843,11 +6854,19 @@ static int rtl8xxxu_set_rts_threshold(st + return 0; + } + ++static int rtl8xxxu_get_free_sec_cam(struct ieee80211_hw *hw) ++{ ++ struct rtl8xxxu_priv *priv = hw->priv; ++ ++ return find_first_zero_bit(priv->cam_map, priv->fops->max_sec_cam_num); ++} ++ + static int rtl8xxxu_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, + struct ieee80211_vif *vif, + struct ieee80211_sta *sta, + struct ieee80211_key_conf *key) + { ++ struct rtl8xxxu_vif *rtlvif = (struct rtl8xxxu_vif *)vif->drv_priv; + struct rtl8xxxu_priv *priv = hw->priv; + struct device *dev = &priv->udev->dev; + u8 mac_addr[ETH_ALEN]; +@@ -6859,9 +6878,6 @@ static int rtl8xxxu_set_key(struct ieee8 + dev_dbg(dev, "%s: cmd %02x, cipher %08x, index %i\n", + __func__, cmd, key->cipher, key->keyidx); + +- if (vif->type != NL80211_IFTYPE_STATION) +- return -EOPNOTSUPP; +- + if (key->keyidx > 3) + return -EOPNOTSUPP; + +@@ -6885,7 +6901,7 @@ static int rtl8xxxu_set_key(struct ieee8 + ether_addr_copy(mac_addr, sta->addr); + } else { + dev_dbg(dev, "%s: group key\n", __func__); +- eth_broadcast_addr(mac_addr); ++ ether_addr_copy(mac_addr, vif->bss_conf.bssid); + } + + val16 = rtl8xxxu_read16(priv, REG_CR); +@@ -6899,16 +6915,28 @@ static int rtl8xxxu_set_key(struct ieee8 + + switch (cmd) { + case SET_KEY: +- key->hw_key_idx = key->keyidx; ++ ++ retval = rtl8xxxu_get_free_sec_cam(hw); ++ if (retval < 0) ++ return -EOPNOTSUPP; ++ ++ key->hw_key_idx = retval; ++ ++ if (vif->type == NL80211_IFTYPE_AP && !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) ++ rtlvif->hw_key_idx = key->hw_key_idx; ++ + key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; + rtl8xxxu_cam_write(priv, key, mac_addr); ++ set_bit(key->hw_key_idx, priv->cam_map); + retval = 0; + break; + case DISABLE_KEY: + rtl8xxxu_write32(priv, REG_CAM_WRITE, 0x00000000); + val32 = CAM_CMD_POLLING | CAM_CMD_WRITE | +- key->keyidx << CAM_CMD_KEY_SHIFT; ++ key->hw_key_idx << CAM_CMD_KEY_SHIFT; + rtl8xxxu_write32(priv, REG_CAM_CMD, val32); ++ rtlvif->hw_key_idx = 0xff; ++ clear_bit(key->hw_key_idx, priv->cam_map); + retval = 0; + break; + default: diff --git a/package/kernel/mac80211/patches/rtl/001-20-v6.9-wifi-rtl8xxxu-make-supporting-AP-mode-only-on-port-0.patch b/package/kernel/mac80211/patches/rtl/001-20-v6.9-wifi-rtl8xxxu-make-supporting-AP-mode-only-on-port-0.patch new file mode 100644 index 00000000000000..4b55b0ede78b50 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/001-20-v6.9-wifi-rtl8xxxu-make-supporting-AP-mode-only-on-port-0.patch @@ -0,0 +1,130 @@ +From 69abad618efd17e50bc6f880332ab36b660b0b34 Mon Sep 17 00:00:00 2001 +From: Martin Kaistra +Date: Fri, 22 Dec 2023 11:14:41 +0100 +Subject: [PATCH 20/21] wifi: rtl8xxxu: make supporting AP mode only on port 0 + transparent + +When the driver is used for concurrent mode, both virtual interfaces can +be set to station or AP mode, though only one can be in AP mode at the +same time. + +In order to keep the code simple, use only hw port 0 for AP mode. When +an interface is added in AP mode which would be assigned to port 1, use +a switch_port function to transparently swap the mapping between virtual +interface and hw port. + +Signed-off-by: Martin Kaistra +Reviewed-by: Ping-Ke Shih +Signed-off-by: Kalle Valo +Link: https://msgid.link/20231222101442.626837-21-martin.kaistra@linutronix.de +--- + .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 91 ++++++++++++++++++- + 1 file changed, 89 insertions(+), 2 deletions(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -6624,6 +6624,91 @@ error: + return ret; + } + ++static void rtl8xxxu_switch_ports(struct rtl8xxxu_priv *priv) ++{ ++ u8 macid[ETH_ALEN], bssid[ETH_ALEN], macid_1[ETH_ALEN], bssid_1[ETH_ALEN]; ++ u8 msr, bcn_ctrl, bcn_ctrl_1, atimwnd[2], atimwnd_1[2]; ++ struct rtl8xxxu_vif *rtlvif; ++ struct ieee80211_vif *vif; ++ u8 tsftr[8], tsftr_1[8]; ++ int i; ++ ++ msr = rtl8xxxu_read8(priv, REG_MSR); ++ bcn_ctrl = rtl8xxxu_read8(priv, REG_BEACON_CTRL); ++ bcn_ctrl_1 = rtl8xxxu_read8(priv, REG_BEACON_CTRL_1); ++ ++ for (i = 0; i < ARRAY_SIZE(atimwnd); i++) ++ atimwnd[i] = rtl8xxxu_read8(priv, REG_ATIMWND + i); ++ for (i = 0; i < ARRAY_SIZE(atimwnd_1); i++) ++ atimwnd_1[i] = rtl8xxxu_read8(priv, REG_ATIMWND_1 + i); ++ ++ for (i = 0; i < ARRAY_SIZE(tsftr); i++) ++ tsftr[i] = rtl8xxxu_read8(priv, REG_TSFTR + i); ++ for (i = 0; i < ARRAY_SIZE(tsftr); i++) ++ tsftr_1[i] = rtl8xxxu_read8(priv, REG_TSFTR1 + i); ++ ++ for (i = 0; i < ARRAY_SIZE(macid); i++) ++ macid[i] = rtl8xxxu_read8(priv, REG_MACID + i); ++ ++ for (i = 0; i < ARRAY_SIZE(bssid); i++) ++ bssid[i] = rtl8xxxu_read8(priv, REG_BSSID + i); ++ ++ for (i = 0; i < ARRAY_SIZE(macid_1); i++) ++ macid_1[i] = rtl8xxxu_read8(priv, REG_MACID1 + i); ++ ++ for (i = 0; i < ARRAY_SIZE(bssid_1); i++) ++ bssid_1[i] = rtl8xxxu_read8(priv, REG_BSSID1 + i); ++ ++ /* disable bcn function, disable update TSF */ ++ rtl8xxxu_write8(priv, REG_BEACON_CTRL, (bcn_ctrl & ++ (~BEACON_FUNCTION_ENABLE)) | BEACON_DISABLE_TSF_UPDATE); ++ rtl8xxxu_write8(priv, REG_BEACON_CTRL_1, (bcn_ctrl_1 & ++ (~BEACON_FUNCTION_ENABLE)) | BEACON_DISABLE_TSF_UPDATE); ++ ++ /* switch msr */ ++ msr = (msr & 0xf0) | ((msr & 0x03) << 2) | ((msr & 0x0c) >> 2); ++ rtl8xxxu_write8(priv, REG_MSR, msr); ++ ++ /* write port0 */ ++ rtl8xxxu_write8(priv, REG_BEACON_CTRL, bcn_ctrl_1 & ~BEACON_FUNCTION_ENABLE); ++ for (i = 0; i < ARRAY_SIZE(atimwnd_1); i++) ++ rtl8xxxu_write8(priv, REG_ATIMWND + i, atimwnd_1[i]); ++ for (i = 0; i < ARRAY_SIZE(tsftr_1); i++) ++ rtl8xxxu_write8(priv, REG_TSFTR + i, tsftr_1[i]); ++ for (i = 0; i < ARRAY_SIZE(macid_1); i++) ++ rtl8xxxu_write8(priv, REG_MACID + i, macid_1[i]); ++ for (i = 0; i < ARRAY_SIZE(bssid_1); i++) ++ rtl8xxxu_write8(priv, REG_BSSID + i, bssid_1[i]); ++ ++ /* write port1 */ ++ rtl8xxxu_write8(priv, REG_BEACON_CTRL_1, bcn_ctrl & ~BEACON_FUNCTION_ENABLE); ++ for (i = 0; i < ARRAY_SIZE(atimwnd); i++) ++ rtl8xxxu_write8(priv, REG_ATIMWND_1 + i, atimwnd[i]); ++ for (i = 0; i < ARRAY_SIZE(tsftr); i++) ++ rtl8xxxu_write8(priv, REG_TSFTR1 + i, tsftr[i]); ++ for (i = 0; i < ARRAY_SIZE(macid); i++) ++ rtl8xxxu_write8(priv, REG_MACID1 + i, macid[i]); ++ for (i = 0; i < ARRAY_SIZE(bssid); i++) ++ rtl8xxxu_write8(priv, REG_BSSID1 + i, bssid[i]); ++ ++ /* write bcn ctl */ ++ rtl8xxxu_write8(priv, REG_BEACON_CTRL, bcn_ctrl_1); ++ rtl8xxxu_write8(priv, REG_BEACON_CTRL_1, bcn_ctrl); ++ ++ vif = priv->vifs[0]; ++ priv->vifs[0] = priv->vifs[1]; ++ priv->vifs[1] = vif; ++ ++ /* priv->vifs[0] is NULL here, based on how this function is currently ++ * called from rtl8xxxu_add_interface(). ++ * When this function will be used in the future for a different ++ * scenario, please check whether vifs[0] or vifs[1] can be NULL and if ++ * necessary add code to set port_num = 1. ++ */ ++ rtlvif = (struct rtl8xxxu_vif *)priv->vifs[1]->drv_priv; ++ rtlvif->port_num = 1; ++} ++ + static int rtl8xxxu_add_interface(struct ieee80211_hw *hw, + struct ieee80211_vif *vif) + { +@@ -6651,8 +6736,10 @@ static int rtl8xxxu_add_interface(struct + } + break; + case NL80211_IFTYPE_AP: +- if (port_num == 1) +- return -EOPNOTSUPP; ++ if (port_num == 1) { ++ rtl8xxxu_switch_ports(priv); ++ port_num = 0; ++ } + + rtl8xxxu_write8(priv, REG_BEACON_CTRL, + BEACON_DISABLE_TSF_UPDATE | BEACON_CTRL_MBSSID); diff --git a/package/kernel/mac80211/patches/rtl/001-21-v6.9-wifi-rtl8xxxu-declare-concurrent-mode-support-for-81.patch b/package/kernel/mac80211/patches/rtl/001-21-v6.9-wifi-rtl8xxxu-declare-concurrent-mode-support-for-81.patch new file mode 100644 index 00000000000000..6322541434c6d2 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/001-21-v6.9-wifi-rtl8xxxu-declare-concurrent-mode-support-for-81.patch @@ -0,0 +1,76 @@ +From 1cd165adf314f6bf25cde58f02f4ff51d01730b0 Mon Sep 17 00:00:00 2001 +From: Martin Kaistra +Date: Fri, 22 Dec 2023 11:14:42 +0100 +Subject: [PATCH 21/21] wifi: rtl8xxxu: declare concurrent mode support for + 8188f + +Everything is in place now for concurrent mode, we can tell the system +that we support it. +We will allow a maximum of 2 virtual interfaces, one of them can be in +AP mode. + +Signed-off-by: Martin Kaistra +Reviewed-by: Ping-Ke Shih +Signed-off-by: Kalle Valo +Link: https://msgid.link/20231222101442.626837-22-martin.kaistra@linutronix.de +--- + .../net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 1 + + .../realtek/rtl8xxxu/rtl8xxxu_8188f.c | 1 + + .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 19 +++++++++++++++++++ + 3 files changed, 21 insertions(+) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +@@ -1992,6 +1992,7 @@ struct rtl8xxxu_fileops { + u8 init_reg_rxfltmap:1; + u8 init_reg_pkt_life_time:1; + u8 init_reg_hmtfr:1; ++ u8 supports_concurrent:1; + u8 ampdu_max_time; + u8 ustime_tsf_edca; + u16 max_aggr_num; +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c +@@ -1752,6 +1752,7 @@ struct rtl8xxxu_fileops rtl8188fu_fops = + .supports_ap = 1, + .max_macid_num = 16, + .max_sec_cam_num = 16, ++ .supports_concurrent = 1, + .adda_1t_init = 0x03c00014, + .adda_1t_path_on = 0x03c00014, + .trxff_boundary = 0x3f7f, +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -7665,6 +7665,20 @@ static void rtl8xxxu_deinit_led(struct r + led_classdev_unregister(led); + } + ++struct ieee80211_iface_limit rtl8xxxu_limits[] = { ++ { .max = 2, .types = BIT(NL80211_IFTYPE_STATION), }, ++ { .max = 1, .types = BIT(NL80211_IFTYPE_AP), }, ++}; ++ ++struct ieee80211_iface_combination rtl8xxxu_combinations[] = { ++ { ++ .limits = rtl8xxxu_limits, ++ .n_limits = ARRAY_SIZE(rtl8xxxu_limits), ++ .max_interfaces = 2, ++ .num_different_channels = 1, ++ }, ++}; ++ + static int rtl8xxxu_probe(struct usb_interface *interface, + const struct usb_device_id *id) + { +@@ -7810,6 +7824,11 @@ static int rtl8xxxu_probe(struct usb_int + hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP); + hw->queues = 4; + ++ if (priv->fops->supports_concurrent) { ++ hw->wiphy->iface_combinations = rtl8xxxu_combinations; ++ hw->wiphy->n_iface_combinations = ARRAY_SIZE(rtl8xxxu_combinations); ++ } ++ + sband = &rtl8xxxu_supported_band; + sband->ht_cap.ht_supported = true; + sband->ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K; diff --git a/package/kernel/mac80211/patches/rtl/002-01-v6.9-wifi-rtl8xxxu-Fix-LED-control-code-of-RTL8192FU.patch b/package/kernel/mac80211/patches/rtl/002-01-v6.9-wifi-rtl8xxxu-Fix-LED-control-code-of-RTL8192FU.patch new file mode 100644 index 00000000000000..d1a480d53fe8da --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/002-01-v6.9-wifi-rtl8xxxu-Fix-LED-control-code-of-RTL8192FU.patch @@ -0,0 +1,98 @@ +From 9475cc7ac31503521af95e38151e9d856e8ff30b Mon Sep 17 00:00:00 2001 +From: Bitterblue Smith +Date: Sun, 31 Dec 2023 00:45:54 +0200 +Subject: [PATCH 1/2] wifi: rtl8xxxu: Fix LED control code of RTL8192FU + +Some devices, like the Comfast CF-826F, use LED1, which already works. +Others, like Asus USB-N13 C1, use LED0, which doesn't work correctly. + +Write the right values to the LED control registers to make LED0 work +as well. + +This is unfortunately tested only with the Comfast CF-826F. + +Signed-off-by: Bitterblue Smith +Reviewed-by: Ping-Ke Shih +Signed-off-by: Kalle Valo +Link: https://msgid.link/7a2c3158-3a45-4466-b11e-fc09802b20e2@gmail.com +--- + .../realtek/rtl8xxxu/rtl8xxxu_8192f.c | 32 +++++++++++++------ + .../wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h | 15 +++++++++ + 2 files changed, 38 insertions(+), 9 deletions(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192f.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192f.c +@@ -2014,26 +2014,40 @@ static int rtl8192fu_led_brightness_set( + struct rtl8xxxu_priv *priv = container_of(led_cdev, + struct rtl8xxxu_priv, + led_cdev); +- u16 ledcfg; ++ u32 ledcfg; + + /* Values obtained by observing the USB traffic from the Windows driver. */ + rtl8xxxu_write32(priv, REG_SW_GPIO_SHARE_CTRL_0, 0x20080); + rtl8xxxu_write32(priv, REG_SW_GPIO_SHARE_CTRL_1, 0x1b0000); + +- ledcfg = rtl8xxxu_read16(priv, REG_LEDCFG0); ++ ledcfg = rtl8xxxu_read32(priv, REG_LEDCFG0); ++ ++ /* Comfast CF-826F uses LED1. Asus USB-N13 C1 uses LED0. Set both. */ ++ ++ u32p_replace_bits(&ledcfg, LED_GPIO_ENABLE, LEDCFG0_LED2EN); ++ u32p_replace_bits(&ledcfg, LED_IO_MODE_OUTPUT, LEDCFG0_LED0_IO_MODE); ++ u32p_replace_bits(&ledcfg, LED_IO_MODE_OUTPUT, LEDCFG0_LED1_IO_MODE); + + if (brightness == LED_OFF) { +- /* Value obtained like above. */ +- ledcfg = BIT(1) | BIT(7); ++ u32p_replace_bits(&ledcfg, LED_MODE_SW_CTRL, LEDCFG0_LED0CM); ++ u32p_replace_bits(&ledcfg, LED_SW_OFF, LEDCFG0_LED0SV); ++ u32p_replace_bits(&ledcfg, LED_MODE_SW_CTRL, LEDCFG0_LED1CM); ++ u32p_replace_bits(&ledcfg, LED_SW_OFF, LEDCFG0_LED1SV); + } else if (brightness == LED_ON) { +- /* Value obtained like above. */ +- ledcfg = BIT(1) | BIT(7) | BIT(11); ++ u32p_replace_bits(&ledcfg, LED_MODE_SW_CTRL, LEDCFG0_LED0CM); ++ u32p_replace_bits(&ledcfg, LED_SW_ON, LEDCFG0_LED0SV); ++ u32p_replace_bits(&ledcfg, LED_MODE_SW_CTRL, LEDCFG0_LED1CM); ++ u32p_replace_bits(&ledcfg, LED_SW_ON, LEDCFG0_LED1SV); + } else if (brightness == RTL8XXXU_HW_LED_CONTROL) { +- /* Value obtained by brute force. */ +- ledcfg = BIT(8) | BIT(9); ++ u32p_replace_bits(&ledcfg, LED_MODE_TX_OR_RX_EVENTS, ++ LEDCFG0_LED0CM); ++ u32p_replace_bits(&ledcfg, LED_SW_OFF, LEDCFG0_LED0SV); ++ u32p_replace_bits(&ledcfg, LED_MODE_TX_OR_RX_EVENTS, ++ LEDCFG0_LED1CM); ++ u32p_replace_bits(&ledcfg, LED_SW_OFF, LEDCFG0_LED1SV); + } + +- rtl8xxxu_write16(priv, REG_LEDCFG0, ledcfg); ++ rtl8xxxu_write32(priv, REG_LEDCFG0, ledcfg); + + return 0; + } +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_regs.h +@@ -146,6 +146,21 @@ + #define GPIO_INTM_EDGE_TRIG_IRQ BIT(9) + + #define REG_LEDCFG0 0x004c ++#define LEDCFG0_LED0CM GENMASK(2, 0) ++#define LEDCFG0_LED1CM GENMASK(10, 8) ++#define LED_MODE_SW_CTRL 0x0 ++#define LED_MODE_TX_OR_RX_EVENTS 0x3 ++#define LEDCFG0_LED0SV BIT(3) ++#define LEDCFG0_LED1SV BIT(11) ++#define LED_SW_OFF 0x0 ++#define LED_SW_ON 0x1 ++#define LEDCFG0_LED0_IO_MODE BIT(7) ++#define LEDCFG0_LED1_IO_MODE BIT(15) ++#define LED_IO_MODE_OUTPUT 0x0 ++#define LED_IO_MODE_INPUT 0x1 ++#define LEDCFG0_LED2EN BIT(21) ++#define LED_GPIO_DISABLE 0x0 ++#define LED_GPIO_ENABLE 0x1 + #define LEDCFG0_DPDT_SELECT BIT(23) + #define REG_LEDCFG1 0x004d + #define LEDCFG1_HW_LED_CONTROL BIT(1) diff --git a/package/kernel/mac80211/patches/rtl/002-02-v6.9-wifi-rtl8xxxu-Fix-off-by-one-initial-RTS-rate.patch b/package/kernel/mac80211/patches/rtl/002-02-v6.9-wifi-rtl8xxxu-Fix-off-by-one-initial-RTS-rate.patch new file mode 100644 index 00000000000000..7d1c67f2e08a2c --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/002-02-v6.9-wifi-rtl8xxxu-Fix-off-by-one-initial-RTS-rate.patch @@ -0,0 +1,36 @@ +From 80850ca041f2c7ee28fa5e47c5c1b106415f099f Mon Sep 17 00:00:00 2001 +From: Bitterblue Smith +Date: Tue, 2 Jan 2024 21:33:07 +0200 +Subject: [PATCH 2/2] wifi: rtl8xxxu: Fix off by one initial RTS rate + +rtl8xxxu_set_basic_rates() sets the wrong initial RTS rate. It sets the +next higher rate than the one it should set, e.g. 36M instead of 24M. + +The while loop was supposed to find the index of the most significant +bit which is 1, but it was copied incorrectly from the vendor driver. +Use __fls() instead. + +Signed-off-by: Bitterblue Smith +Reviewed-by: Ping-Ke Shih +Signed-off-by: Kalle Valo +Link: https://msgid.link/761e6836-6cd6-4930-91b6-0446834655c5@gmail.com +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -4870,10 +4870,9 @@ static void rtl8xxxu_set_basic_rates(str + + dev_dbg(&priv->udev->dev, "%s: rates %08x\n", __func__, rate_cfg); + +- while (rate_cfg) { +- rate_cfg = (rate_cfg >> 1); +- rate_idx++; +- } ++ if (rate_cfg) ++ rate_idx = __fls(rate_cfg); ++ + rtl8xxxu_write8(priv, REG_INIRTS_RATE_SEL, rate_idx); + } + diff --git a/package/kernel/mac80211/patches/rtl/003-01-v6.9-wifi-rtl8xxxu-add-cancel_work_sync-for-c2hcmd_work.patch b/package/kernel/mac80211/patches/rtl/003-01-v6.9-wifi-rtl8xxxu-add-cancel_work_sync-for-c2hcmd_work.patch new file mode 100644 index 00000000000000..612b5f87383176 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/003-01-v6.9-wifi-rtl8xxxu-add-cancel_work_sync-for-c2hcmd_work.patch @@ -0,0 +1,27 @@ +From 1213acb478a7181cd73eeaf00db430f1e45b1361 Mon Sep 17 00:00:00 2001 +From: Martin Kaistra +Date: Thu, 11 Jan 2024 17:36:27 +0100 +Subject: [PATCH 1/2] wifi: rtl8xxxu: add cancel_work_sync() for c2hcmd_work + +The workqueue might still be running, when the driver is stopped. To +avoid a use-after-free, call cancel_work_sync() in rtl8xxxu_stop(). + +Fixes: e542e66b7c2e ("rtl8xxxu: add bluetooth co-existence support for single antenna") +Signed-off-by: Martin Kaistra +Reviewed-by: Ping-Ke Shih +Signed-off-by: Kalle Valo +Link: https://msgid.link/20240111163628.320697-2-martin.kaistra@linutronix.de +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -7480,6 +7480,7 @@ static void rtl8xxxu_stop(struct ieee802 + if (priv->usb_interrupts) + rtl8xxxu_write32(priv, REG_USB_HIMR, 0); + ++ cancel_work_sync(&priv->c2hcmd_work); + cancel_delayed_work_sync(&priv->ra_watchdog); + + rtl8xxxu_free_rx_resources(priv); diff --git a/package/kernel/mac80211/patches/rtl/003-02-v6.9-wifi-rtl8xxxu-enable-channel-switch-support.patch b/package/kernel/mac80211/patches/rtl/003-02-v6.9-wifi-rtl8xxxu-enable-channel-switch-support.patch new file mode 100644 index 00000000000000..6c78d3901bab0b --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/003-02-v6.9-wifi-rtl8xxxu-enable-channel-switch-support.patch @@ -0,0 +1,100 @@ +From ece90a8622320bf5a24d3326da1f8e109891573c Mon Sep 17 00:00:00 2001 +From: Martin Kaistra +Date: Thu, 11 Jan 2024 17:36:28 +0100 +Subject: [PATCH 2/2] wifi: rtl8xxxu: enable channel switch support + +The CSA countdown in the beacon frames, which are sent out by firmware, +needs to get updated by the driver. To achieve this, convert +update_beacon_work to delayed_work and schedule it with the beacon +interval in case CSA is active and the countdown is not complete. + +Signed-off-by: Martin Kaistra +Reviewed-by: Ping-Ke Shih +Signed-off-by: Kalle Valo +Link: https://msgid.link/20240111163628.320697-3-martin.kaistra@linutronix.de +--- + .../net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 2 +- + .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 19 +++++++++++++++---- + 2 files changed, 16 insertions(+), 5 deletions(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +@@ -1900,7 +1900,7 @@ struct rtl8xxxu_priv { + struct delayed_work ra_watchdog; + struct work_struct c2hcmd_work; + struct sk_buff_head c2hcmd_queue; +- struct work_struct update_beacon_work; ++ struct delayed_work update_beacon_work; + struct rtl8xxxu_btcoex bt_coex; + struct rtl8xxxu_ra_report ra_report; + struct rtl8xxxu_cfo_tracking cfo_tracking; +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -4605,7 +4605,7 @@ static int rtl8xxxu_set_tim(struct ieee8 + { + struct rtl8xxxu_priv *priv = hw->priv; + +- schedule_work(&priv->update_beacon_work); ++ schedule_delayed_work(&priv->update_beacon_work, 0); + + return 0; + } +@@ -5107,7 +5107,7 @@ rtl8xxxu_bss_info_changed(struct ieee802 + } + + if (changed & BSS_CHANGED_BEACON) +- schedule_work(&priv->update_beacon_work); ++ schedule_delayed_work(&priv->update_beacon_work, 0); + + error: + return; +@@ -5726,7 +5726,7 @@ static void rtl8xxxu_send_beacon_frame(s + static void rtl8xxxu_update_beacon_work_callback(struct work_struct *work) + { + struct rtl8xxxu_priv *priv = +- container_of(work, struct rtl8xxxu_priv, update_beacon_work); ++ container_of(work, struct rtl8xxxu_priv, update_beacon_work.work); + struct ieee80211_hw *hw = priv->hw; + struct ieee80211_vif *vif = priv->vifs[0]; + +@@ -5735,6 +5735,14 @@ static void rtl8xxxu_update_beacon_work_ + return; + } + ++ if (vif->bss_conf.csa_active) { ++ if (ieee80211_beacon_cntdwn_is_complete(vif)) { ++ ieee80211_csa_finish(vif); ++ return; ++ } ++ schedule_delayed_work(&priv->update_beacon_work, ++ msecs_to_jiffies(vif->bss_conf.beacon_int)); ++ } + rtl8xxxu_send_beacon_frame(hw, vif); + } + +@@ -7482,6 +7490,7 @@ static void rtl8xxxu_stop(struct ieee802 + + cancel_work_sync(&priv->c2hcmd_work); + cancel_delayed_work_sync(&priv->ra_watchdog); ++ cancel_delayed_work_sync(&priv->update_beacon_work); + + rtl8xxxu_free_rx_resources(priv); + rtl8xxxu_free_tx_resources(priv); +@@ -7763,7 +7772,7 @@ static int rtl8xxxu_probe(struct usb_int + spin_lock_init(&priv->rx_urb_lock); + INIT_WORK(&priv->rx_urb_wq, rtl8xxxu_rx_urb_work); + INIT_DELAYED_WORK(&priv->ra_watchdog, rtl8xxxu_watchdog_callback); +- INIT_WORK(&priv->update_beacon_work, rtl8xxxu_update_beacon_work_callback); ++ INIT_DELAYED_WORK(&priv->update_beacon_work, rtl8xxxu_update_beacon_work_callback); + skb_queue_head_init(&priv->c2hcmd_queue); + + usb_set_intfdata(interface, hw); +@@ -7824,6 +7833,8 @@ static int rtl8xxxu_probe(struct usb_int + hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP); + hw->queues = 4; + ++ hw->wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH; ++ + if (priv->fops->supports_concurrent) { + hw->wiphy->iface_combinations = rtl8xxxu_combinations; + hw->wiphy->n_iface_combinations = ARRAY_SIZE(rtl8xxxu_combinations); diff --git a/package/kernel/mac80211/patches/rtl/004-01-v6.9-wifi-rtl8xxxu-convert-EN_DESC_ID-of-TX-descriptor-to.patch b/package/kernel/mac80211/patches/rtl/004-01-v6.9-wifi-rtl8xxxu-convert-EN_DESC_ID-of-TX-descriptor-to.patch new file mode 100644 index 00000000000000..a88a52231de758 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/004-01-v6.9-wifi-rtl8xxxu-convert-EN_DESC_ID-of-TX-descriptor-to.patch @@ -0,0 +1,31 @@ +From 426e7b4773921d07ab4ab8ba16fbad396d6c9971 Mon Sep 17 00:00:00 2001 +From: Ping-Ke Shih +Date: Tue, 16 Jan 2024 16:09:44 +0800 +Subject: [PATCH 1/2] wifi: rtl8xxxu: convert EN_DESC_ID of TX descriptor to + le32 type + +Fields of TX descriptor are little-endian order, so correct EN_DESC_ID +field to le32 type. + +Fixes: b837f78fbffa ("wifi: rtl8xxxu: add hw crypto support for AP mode") +Reported-by: kernel test robot +Closes: https://lore.kernel.org/oe-kbuild-all/202401161318.YtXoCkjU-lkp@intel.com/ +Cc: Martin Kaistra +Signed-off-by: Ping-Ke Shih +Signed-off-by: Kalle Valo +Link: https://msgid.link/20240116080945.20172-1-pkshih@realtek.com +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -5619,7 +5619,7 @@ static void rtl8xxxu_tx(struct ieee80211 + break; + } + if (bmc && rtlvif->hw_key_idx != 0xff) { +- tx_desc->txdw1 |= TXDESC_EN_DESC_ID; ++ tx_desc->txdw1 |= cpu_to_le32(TXDESC_EN_DESC_ID); + macid = rtlvif->hw_key_idx; + } + } diff --git a/package/kernel/mac80211/patches/rtl/004-02-v6.9-wifi-rtl8xxxu-make-instances-of-iface-limit-and-comb.patch b/package/kernel/mac80211/patches/rtl/004-02-v6.9-wifi-rtl8xxxu-make-instances-of-iface-limit-and-comb.patch new file mode 100644 index 00000000000000..68848e28e03b13 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/004-02-v6.9-wifi-rtl8xxxu-make-instances-of-iface-limit-and-comb.patch @@ -0,0 +1,36 @@ +From 92c7428f942da7dfcdc629b05b5114f80822d7a4 Mon Sep 17 00:00:00 2001 +From: Ping-Ke Shih +Date: Tue, 16 Jan 2024 16:09:45 +0800 +Subject: [PATCH 2/2] wifi: rtl8xxxu: make instances of iface limit and + combination to be static const + +rtl8xxxu_limits and rtl8xxxu_combinations can be static const, so add +modifiers as desire. Otherwise, Sparse reports warnings + +rtl8xxxu_core.c:7677:30: warning: symbol 'rtl8xxxu_limits' was not declared. Should it be static? +rtl8xxxu_core.c:7682:36: warning: symbol 'rtl8xxxu_combinations' was not declared. Should it be static? + +Signed-off-by: Ping-Ke Shih +Signed-off-by: Kalle Valo +Link: https://msgid.link/20240116080945.20172-2-pkshih@realtek.com +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -7674,12 +7674,12 @@ static void rtl8xxxu_deinit_led(struct r + led_classdev_unregister(led); + } + +-struct ieee80211_iface_limit rtl8xxxu_limits[] = { ++static const struct ieee80211_iface_limit rtl8xxxu_limits[] = { + { .max = 2, .types = BIT(NL80211_IFTYPE_STATION), }, + { .max = 1, .types = BIT(NL80211_IFTYPE_AP), }, + }; + +-struct ieee80211_iface_combination rtl8xxxu_combinations[] = { ++static const struct ieee80211_iface_combination rtl8xxxu_combinations[] = { + { + .limits = rtl8xxxu_limits, + .n_limits = ARRAY_SIZE(rtl8xxxu_limits), diff --git a/package/kernel/mac80211/patches/rtl/005-v6.9-wifi-rtl8xxxu-add-missing-number-of-sec-cam-entries-.patch b/package/kernel/mac80211/patches/rtl/005-v6.9-wifi-rtl8xxxu-add-missing-number-of-sec-cam-entries-.patch new file mode 100644 index 00000000000000..9fba6befef5330 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/005-v6.9-wifi-rtl8xxxu-add-missing-number-of-sec-cam-entries-.patch @@ -0,0 +1,100 @@ +From 563d5025cf3b51c7bf20e6966af433ed5f838875 Mon Sep 17 00:00:00 2001 +From: Martin Kaistra +Date: Tue, 16 Jan 2024 10:50:01 +0100 +Subject: [PATCH] wifi: rtl8xxxu: add missing number of sec cam entries for all + variants + +Commit b837f78fbffa ("wifi: rtl8xxxu: add hw crypto support for AP +mode") introduced max_sec_cam_num as a member of rtl8xxxu_fileops. +It was missed to set this number for all variants except 8188f, which +caused rtl8xxxu_get_free_sec_cam() to always return 0 and therefore breaking +encrypted traffic. + +Fix it by adding the numbers for all variants. The values are taken from +the vendor drivers and rtlwifi. + +Link: https://lore.kernel.org/linux-wireless/20240111163603.2325-1-zenmchen@gmail.com/ +Fixes: b837f78fbffa ("wifi: rtl8xxxu: add hw crypto support for AP mode") +Signed-off-by: Martin Kaistra +Signed-off-by: Kalle Valo +Link: https://msgid.link/20240116095001.399500-1-martin.kaistra@linutronix.de +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 1 + + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192c.c | 1 + + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c | 1 + + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192f.c | 1 + + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8710b.c | 1 + + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c | 1 + + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c | 1 + + 7 files changed, 7 insertions(+) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c +@@ -1882,6 +1882,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops = + .has_tx_report = 1, + .init_reg_pkt_life_time = 1, + .gen2_thermal_meter = 1, ++ .max_sec_cam_num = 32, + .adda_1t_init = 0x0b1b25a0, + .adda_1t_path_on = 0x0bdb25a0, + /* +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192c.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192c.c +@@ -613,6 +613,7 @@ struct rtl8xxxu_fileops rtl8192cu_fops = + .rx_agg_buf_size = 16000, + .tx_desc_size = sizeof(struct rtl8xxxu_txdesc32), + .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc16), ++ .max_sec_cam_num = 32, + .adda_1t_init = 0x0b1b25a0, + .adda_1t_path_on = 0x0bdb25a0, + .adda_2t_path_on_a = 0x04db25a4, +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c +@@ -1769,6 +1769,7 @@ struct rtl8xxxu_fileops rtl8192eu_fops = + .needs_full_init = 1, + .supports_ap = 1, + .max_macid_num = 128, ++ .max_sec_cam_num = 64, + .adda_1t_init = 0x0fc01616, + .adda_1t_path_on = 0x0fc01616, + .adda_2t_path_on_a = 0x0fc01616, +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192f.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192f.c +@@ -2095,6 +2095,7 @@ struct rtl8xxxu_fileops rtl8192fu_fops = + .max_aggr_num = 0x1f1f, + .supports_ap = 1, + .max_macid_num = 128, ++ .max_sec_cam_num = 64, + .trxff_boundary = 0x3f3f, + .pbp_rx = PBP_PAGE_SIZE_256, + .pbp_tx = PBP_PAGE_SIZE_256, +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8710b.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8710b.c +@@ -1877,6 +1877,7 @@ struct rtl8xxxu_fileops rtl8710bu_fops = + .max_aggr_num = 0x0c14, + .supports_ap = 1, + .max_macid_num = 16, ++ .max_sec_cam_num = 32, + .adda_1t_init = 0x03c00016, + .adda_1t_path_on = 0x03c00016, + .trxff_boundary = 0x3f7f, +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723a.c +@@ -510,6 +510,7 @@ struct rtl8xxxu_fileops rtl8723au_fops = + .rx_agg_buf_size = 16000, + .tx_desc_size = sizeof(struct rtl8xxxu_txdesc32), + .rx_desc_size = sizeof(struct rtl8xxxu_rxdesc16), ++ .max_sec_cam_num = 32, + .adda_1t_init = 0x0b1b25a0, + .adda_1t_path_on = 0x0bdb25a0, + .adda_2t_path_on_a = 0x04db25a4, +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c +@@ -1744,6 +1744,7 @@ struct rtl8xxxu_fileops rtl8723bu_fops = + .max_aggr_num = 0x0c14, + .supports_ap = 1, + .max_macid_num = 128, ++ .max_sec_cam_num = 64, + .adda_1t_init = 0x01c00014, + .adda_1t_path_on = 0x01c00014, + .adda_2t_path_on_a = 0x01c00014, diff --git a/package/kernel/mac80211/patches/rtl/006-v6.9-wifi-rtl8xxxu-fix-error-messages.patch b/package/kernel/mac80211/patches/rtl/006-v6.9-wifi-rtl8xxxu-fix-error-messages.patch new file mode 100644 index 00000000000000..961f613161f2c6 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/006-v6.9-wifi-rtl8xxxu-fix-error-messages.patch @@ -0,0 +1,37 @@ +From 17903a283593c1dbf9da041f836004163ca30f7b Mon Sep 17 00:00:00 2001 +From: Dan Carpenter +Date: Wed, 31 Jan 2024 10:10:07 +0300 +Subject: [PATCH] wifi: rtl8xxxu: fix error messages + +The first parameter of WARN_ONCE() is a condition so this code will end +up printing the function name instead of the proper message. + +Fixes: 3ff7a05996f9 ("wifi: rtl8xxxu: support setting bssid register for multiple interfaces") +Signed-off-by: Dan Carpenter +Reviewed-by: Ping-Ke Shih +Signed-off-by: Kalle Valo +Link: https://msgid.link/7b144531-a8da-4725-8911-9b614a525a35@moroto.mountain +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -3593,7 +3593,7 @@ static int rtl8xxxu_set_mac(struct rtl8x + reg = REG_MACID1; + break; + default: +- WARN_ONCE("%s: invalid port_num\n", __func__); ++ WARN_ONCE(1, "%s: invalid port_num\n", __func__); + return -EINVAL; + } + +@@ -3618,7 +3618,7 @@ static int rtl8xxxu_set_bssid(struct rtl + reg = REG_BSSID1; + break; + default: +- WARN_ONCE("%s: invalid port_num\n", __func__); ++ WARN_ONCE(1, "%s: invalid port_num\n", __func__); + return -EINVAL; + } + diff --git a/package/kernel/mac80211/patches/rtl/007-v6.9-wifi-rtl8xxxu-Add-TP-Link-TL-WN823N-V2.patch b/package/kernel/mac80211/patches/rtl/007-v6.9-wifi-rtl8xxxu-Add-TP-Link-TL-WN823N-V2.patch new file mode 100644 index 00000000000000..7ccc08c28d161a --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/007-v6.9-wifi-rtl8xxxu-Add-TP-Link-TL-WN823N-V2.patch @@ -0,0 +1,36 @@ +From 1209f487d452ff7e822dec30661fd6b5163fb8cf Mon Sep 17 00:00:00 2001 +From: Chun Qiu +Date: Mon, 29 Jan 2024 13:30:30 +0800 +Subject: [PATCH] wifi: rtl8xxxu: Add TP-Link TL-WN823N V2 + +TP-Link TL-WN823N V2 (2357:0135) is based on rtl8192fu and has been +tested to work with the rtl8xxxu driver. + +Signed-off-by: Chun Qiu +Signed-off-by: Kalle Valo +Link: https://msgid.link/20240129053030.16369-1-cqca@cock.lu +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -7733,7 +7733,7 @@ static int rtl8xxxu_probe(struct usb_int + untested = 0; + break; + case 0x2357: +- if (id->idProduct == 0x0109) ++ if (id->idProduct == 0x0109 || id->idProduct == 0x0135) + untested = 0; + break; + case 0x0b05: +@@ -8025,6 +8025,9 @@ static const struct usb_device_id dev_ta + .driver_info = (unsigned long)&rtl8192fu_fops}, + {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0x318b, 0xff, 0xff, 0xff), + .driver_info = (unsigned long)&rtl8192fu_fops}, ++/* TP-Link TL-WN823N V2 */ ++{USB_DEVICE_AND_INTERFACE_INFO(0x2357, 0x0135, 0xff, 0xff, 0xff), ++ .driver_info = (unsigned long)&rtl8192fu_fops}, + #ifdef CPTCFG_RTL8XXXU_UNTESTED + /* Still supported by rtlwifi */ + {USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_REALTEK, 0x8176, 0xff, 0xff, 0xff), diff --git a/package/kernel/mac80211/patches/rtl/008-v6.9-wifi-rtl8xxxu-update-rate-mask-per-sta.patch b/package/kernel/mac80211/patches/rtl/008-v6.9-wifi-rtl8xxxu-update-rate-mask-per-sta.patch new file mode 100644 index 00000000000000..66cd70c6b1942a --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/008-v6.9-wifi-rtl8xxxu-update-rate-mask-per-sta.patch @@ -0,0 +1,411 @@ +From 94dd7ce1885e530a7b10bbe50d5d68ba1bb99e6e Mon Sep 17 00:00:00 2001 +From: Martin Kaistra +Date: Mon, 5 Feb 2024 10:30:40 +0100 +Subject: [PATCH] wifi: rtl8xxxu: update rate mask per sta + +Until now, rtl8xxxu_watchdog_callback() only fetches RSSI and updates +the rate mask in station mode. This means, in AP mode only the default +rate mask is used. + +In order to have the rate mask reflect the actual connection quality, +extend rtl8xxxu_watchdog_callback() to iterate over every sta. Like in +the rtw88 driver, add a function to collect all currently present stas +and then iterate over a list of copies to ensure no RCU lock problems +for register access via USB. Remove the existing RCU lock in +rtl8xxxu_refresh_rate_mask(). + +Since the currently used ieee80211_ave_rssi() is only for 'vif', add +driver-level tracking of RSSI per sta. + +Signed-off-by: Martin Kaistra +Reviewed-by: Ping-Ke Shih +Signed-off-by: Kalle Valo +Link: https://msgid.link/20240205093040.1941140-1-martin.kaistra@linutronix.de +--- + .../net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 8 +- + .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 188 ++++++++++++++---- + 2 files changed, 158 insertions(+), 38 deletions(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +@@ -6,6 +6,7 @@ + */ + + #include ++#include + + #define RTL8XXXU_DEBUG_REG_WRITE 0x01 + #define RTL8XXXU_DEBUG_REG_READ 0x02 +@@ -1858,6 +1859,8 @@ struct rtl8xxxu_priv { + int next_mbox; + int nr_out_eps; + ++ /* Ensure no added or deleted stas while iterating */ ++ struct mutex sta_mutex; + struct mutex h2c_mutex; + /* Protect the indirect register accesses of RTL8710BU. */ + struct mutex syson_indirect_access_mutex; +@@ -1892,7 +1895,6 @@ struct rtl8xxxu_priv { + u8 pi_enabled:1; + u8 no_pape:1; + u8 int_buf[USB_INTR_CONTENT_LENGTH]; +- u8 rssi_level; + DECLARE_BITMAP(tx_aggr_started, IEEE80211_NUM_TIDS); + DECLARE_BITMAP(tid_tx_operational, IEEE80211_NUM_TIDS); + +@@ -1913,11 +1915,15 @@ struct rtl8xxxu_priv { + DECLARE_BITMAP(cam_map, RTL8XXXU_MAX_SEC_CAM_NUM); + }; + ++DECLARE_EWMA(rssi, 10, 16); ++ + struct rtl8xxxu_sta_info { + struct ieee80211_sta *sta; + struct ieee80211_vif *vif; + + u8 macid; ++ struct ewma_rssi avg_rssi; ++ u8 rssi_level; + }; + + struct rtl8xxxu_vif { +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -4991,10 +4991,11 @@ rtl8xxxu_bss_info_changed(struct ieee802 + struct rtl8xxxu_vif *rtlvif = (struct rtl8xxxu_vif *)vif->drv_priv; + struct rtl8xxxu_priv *priv = hw->priv; + struct device *dev = &priv->udev->dev; ++ struct rtl8xxxu_sta_info *sta_info; + struct ieee80211_sta *sta; + struct rtl8xxxu_ra_report *rarpt; ++ u8 val8, macid; + u32 val32; +- u8 val8; + + rarpt = &priv->ra_report; + +@@ -5017,6 +5018,7 @@ rtl8xxxu_bss_info_changed(struct ieee802 + rcu_read_unlock(); + goto error; + } ++ macid = rtl8xxxu_get_macid(priv, sta); + + if (sta->deflink.ht_cap.ht_supported) + dev_info(dev, "%s: HT supported\n", __func__); +@@ -5037,14 +5039,15 @@ rtl8xxxu_bss_info_changed(struct ieee802 + bw = RATE_INFO_BW_40; + else + bw = RATE_INFO_BW_20; ++ ++ sta_info = (struct rtl8xxxu_sta_info *)sta->drv_priv; ++ sta_info->rssi_level = RTL8XXXU_RATR_STA_INIT; + rcu_read_unlock(); + + rtl8xxxu_update_ra_report(rarpt, highest_rate, sgi, bw); + +- priv->rssi_level = RTL8XXXU_RATR_STA_INIT; +- + priv->fops->update_rate_mask(priv, ramask, 0, sgi, +- bw == RATE_INFO_BW_40, 0); ++ bw == RATE_INFO_BW_40, macid); + + rtl8xxxu_write8(priv, REG_BCN_MAX_ERR, 0xff); + +@@ -6317,6 +6320,76 @@ static void rtl8188e_c2hcmd_callback(str + } + } + ++#define rtl8xxxu_iterate_vifs_atomic(priv, iterator, data) \ ++ ieee80211_iterate_active_interfaces_atomic((priv)->hw, \ ++ IEEE80211_IFACE_ITER_NORMAL, iterator, data) ++ ++struct rtl8xxxu_rx_update_rssi_data { ++ struct rtl8xxxu_priv *priv; ++ struct ieee80211_hdr *hdr; ++ struct ieee80211_rx_status *rx_status; ++ u8 *bssid; ++}; ++ ++static void rtl8xxxu_rx_update_rssi_iter(void *data, u8 *mac, ++ struct ieee80211_vif *vif) ++{ ++ struct rtl8xxxu_rx_update_rssi_data *iter_data = data; ++ struct ieee80211_sta *sta; ++ struct ieee80211_hdr *hdr = iter_data->hdr; ++ struct rtl8xxxu_priv *priv = iter_data->priv; ++ struct rtl8xxxu_sta_info *sta_info; ++ struct ieee80211_rx_status *rx_status = iter_data->rx_status; ++ u8 *bssid = iter_data->bssid; ++ ++ if (!ether_addr_equal(vif->bss_conf.bssid, bssid)) ++ return; ++ ++ if (!(ether_addr_equal(vif->addr, hdr->addr1) || ++ ieee80211_is_beacon(hdr->frame_control))) ++ return; ++ ++ sta = ieee80211_find_sta_by_ifaddr(priv->hw, hdr->addr2, ++ vif->addr); ++ if (!sta) ++ return; ++ ++ sta_info = (struct rtl8xxxu_sta_info *)sta->drv_priv; ++ ewma_rssi_add(&sta_info->avg_rssi, -rx_status->signal); ++} ++ ++static inline u8 *get_hdr_bssid(struct ieee80211_hdr *hdr) ++{ ++ __le16 fc = hdr->frame_control; ++ u8 *bssid; ++ ++ if (ieee80211_has_tods(fc)) ++ bssid = hdr->addr1; ++ else if (ieee80211_has_fromds(fc)) ++ bssid = hdr->addr2; ++ else ++ bssid = hdr->addr3; ++ ++ return bssid; ++} ++ ++static void rtl8xxxu_rx_update_rssi(struct rtl8xxxu_priv *priv, ++ struct ieee80211_rx_status *rx_status, ++ struct ieee80211_hdr *hdr) ++{ ++ struct rtl8xxxu_rx_update_rssi_data data = {}; ++ ++ if (ieee80211_is_ctl(hdr->frame_control)) ++ return; ++ ++ data.priv = priv; ++ data.hdr = hdr; ++ data.rx_status = rx_status; ++ data.bssid = get_hdr_bssid(hdr); ++ ++ rtl8xxxu_iterate_vifs_atomic(priv, rtl8xxxu_rx_update_rssi_iter, &data); ++} ++ + int rtl8xxxu_parse_rxdesc16(struct rtl8xxxu_priv *priv, struct sk_buff *skb) + { + struct ieee80211_hw *hw = priv->hw; +@@ -6376,18 +6449,26 @@ int rtl8xxxu_parse_rxdesc16(struct rtl8x + skb_queue_tail(&priv->c2hcmd_queue, skb); + schedule_work(&priv->c2hcmd_work); + } else { ++ struct ieee80211_hdr *hdr; ++ + phy_stats = (struct rtl8723au_phy_stats *)skb->data; + + skb_pull(skb, drvinfo_sz + desc_shift); + + skb_trim(skb, pkt_len); + +- if (rx_desc->phy_stats) ++ hdr = (struct ieee80211_hdr *)skb->data; ++ if (rx_desc->phy_stats) { + priv->fops->parse_phystats( + priv, rx_status, phy_stats, + rx_desc->rxmcs, +- (struct ieee80211_hdr *)skb->data, ++ hdr, + rx_desc->crc32 || rx_desc->icverr); ++ if (!rx_desc->crc32 && !rx_desc->icverr) ++ rtl8xxxu_rx_update_rssi(priv, ++ rx_status, ++ hdr); ++ } + + rx_status->mactime = rx_desc->tsfl; + rx_status->flag |= RX_FLAG_MACTIME_START; +@@ -6484,10 +6565,15 @@ int rtl8xxxu_parse_rxdesc24(struct rtl8x + } else { + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; + +- if (rx_desc->phy_stats) ++ if (rx_desc->phy_stats) { + priv->fops->parse_phystats(priv, rx_status, phy_stats, + rx_desc->rxmcs, hdr, + rx_desc->crc32 || rx_desc->icverr); ++ if (!rx_desc->crc32 && !rx_desc->icverr) ++ rtl8xxxu_rx_update_rssi(priv, ++ rx_status, ++ hdr); ++ } + + rx_status->mactime = rx_desc->tsfl; + rx_status->flag |= RX_FLAG_MACTIME_START; +@@ -7111,6 +7197,7 @@ static void rtl8xxxu_refresh_rate_mask(s + int signal, struct ieee80211_sta *sta, + bool force) + { ++ struct rtl8xxxu_sta_info *sta_info = (struct rtl8xxxu_sta_info *)sta->drv_priv; + struct ieee80211_hw *hw = priv->hw; + u16 wireless_mode; + u8 rssi_level, ratr_idx; +@@ -7119,7 +7206,7 @@ static void rtl8xxxu_refresh_rate_mask(s + u8 go_up_gap = 5; + u8 macid = rtl8xxxu_get_macid(priv, sta); + +- rssi_level = priv->rssi_level; ++ rssi_level = sta_info->rssi_level; + snr = rtl8xxxu_signal_to_snr(signal); + snr_thresh_high = RTL8XXXU_SNR_THRESH_HIGH; + snr_thresh_low = RTL8XXXU_SNR_THRESH_LOW; +@@ -7144,18 +7231,16 @@ static void rtl8xxxu_refresh_rate_mask(s + else + rssi_level = RTL8XXXU_RATR_STA_LOW; + +- if (rssi_level != priv->rssi_level || force) { ++ if (rssi_level != sta_info->rssi_level || force) { + int sgi = 0; + u32 rate_bitmap = 0; + +- rcu_read_lock(); + rate_bitmap = (sta->deflink.supp_rates[0] & 0xfff) | + (sta->deflink.ht_cap.mcs.rx_mask[0] << 12) | + (sta->deflink.ht_cap.mcs.rx_mask[1] << 20); + if (sta->deflink.ht_cap.cap & + (IEEE80211_HT_CAP_SGI_40 | IEEE80211_HT_CAP_SGI_20)) + sgi = 1; +- rcu_read_unlock(); + + wireless_mode = rtl8xxxu_wireless_mode(hw, sta); + switch (wireless_mode) { +@@ -7236,7 +7321,7 @@ static void rtl8xxxu_refresh_rate_mask(s + break; + } + +- priv->rssi_level = rssi_level; ++ sta_info->rssi_level = rssi_level; + priv->fops->update_rate_mask(priv, rate_bitmap, ratr_idx, sgi, txbw_40mhz, macid); + } + } +@@ -7329,40 +7414,60 @@ static void rtl8xxxu_track_cfo(struct rt + rtl8xxxu_set_atc_status(priv, abs(cfo_average) >= CFO_TH_ATC); + } + +-static void rtl8xxxu_watchdog_callback(struct work_struct *work) ++static void rtl8xxxu_ra_iter(void *data, struct ieee80211_sta *sta) + { +- struct ieee80211_vif *vif; +- struct rtl8xxxu_priv *priv; +- int i; ++ struct rtl8xxxu_sta_info *sta_info = (struct rtl8xxxu_sta_info *)sta->drv_priv; ++ struct rtl8xxxu_priv *priv = data; ++ int signal = -ewma_rssi_read(&sta_info->avg_rssi); + +- priv = container_of(work, struct rtl8xxxu_priv, ra_watchdog.work); +- for (i = 0; i < ARRAY_SIZE(priv->vifs); i++) { +- vif = priv->vifs[i]; ++ priv->fops->report_rssi(priv, rtl8xxxu_get_macid(priv, sta), ++ rtl8xxxu_signal_to_snr(signal)); ++ rtl8xxxu_refresh_rate_mask(priv, signal, sta, false); ++} ++ ++struct rtl8xxxu_stas_entry { ++ struct list_head list; ++ struct ieee80211_sta *sta; ++}; + +- if (!vif || vif->type != NL80211_IFTYPE_STATION) +- continue; ++struct rtl8xxxu_iter_stas_data { ++ struct rtl8xxxu_priv *priv; ++ struct list_head list; ++}; + +- int signal; +- struct ieee80211_sta *sta; ++static void rtl8xxxu_collect_sta_iter(void *data, struct ieee80211_sta *sta) ++{ ++ struct rtl8xxxu_iter_stas_data *iter_stas = data; ++ struct rtl8xxxu_stas_entry *stas_entry; + +- rcu_read_lock(); +- sta = ieee80211_find_sta(vif, vif->bss_conf.bssid); +- if (!sta) { +- struct device *dev = &priv->udev->dev; ++ stas_entry = kmalloc(sizeof(*stas_entry), GFP_ATOMIC); ++ if (!stas_entry) ++ return; + +- dev_dbg(dev, "%s: no sta found\n", __func__); +- rcu_read_unlock(); +- continue; +- } +- rcu_read_unlock(); ++ stas_entry->sta = sta; ++ list_add_tail(&stas_entry->list, &iter_stas->list); ++} + +- signal = ieee80211_ave_rssi(vif); ++static void rtl8xxxu_watchdog_callback(struct work_struct *work) ++{ + +- priv->fops->report_rssi(priv, rtl8xxxu_get_macid(priv, sta), +- rtl8xxxu_signal_to_snr(signal)); ++ struct rtl8xxxu_iter_stas_data iter_data; ++ struct rtl8xxxu_stas_entry *sta_entry, *tmp; ++ struct rtl8xxxu_priv *priv; + +- rtl8xxxu_refresh_rate_mask(priv, signal, sta, false); ++ priv = container_of(work, struct rtl8xxxu_priv, ra_watchdog.work); ++ iter_data.priv = priv; ++ INIT_LIST_HEAD(&iter_data.list); ++ ++ mutex_lock(&priv->sta_mutex); ++ ieee80211_iterate_stations_atomic(priv->hw, rtl8xxxu_collect_sta_iter, ++ &iter_data); ++ list_for_each_entry_safe(sta_entry, tmp, &iter_data.list, list) { ++ list_del_init(&sta_entry->list); ++ rtl8xxxu_ra_iter(priv, sta_entry->sta); ++ kfree(sta_entry); + } ++ mutex_unlock(&priv->sta_mutex); + + if (priv->fops->set_crystal_cap) + rtl8xxxu_track_cfo(priv); +@@ -7504,10 +7609,15 @@ static int rtl8xxxu_sta_add(struct ieee8 + struct rtl8xxxu_vif *rtlvif = (struct rtl8xxxu_vif *)vif->drv_priv; + struct rtl8xxxu_priv *priv = hw->priv; + ++ mutex_lock(&priv->sta_mutex); ++ ewma_rssi_init(&sta_info->avg_rssi); + if (vif->type == NL80211_IFTYPE_AP) { ++ sta_info->rssi_level = RTL8XXXU_RATR_STA_INIT; + sta_info->macid = rtl8xxxu_acquire_macid(priv); +- if (sta_info->macid >= RTL8XXXU_MAX_MAC_ID_NUM) ++ if (sta_info->macid >= RTL8XXXU_MAX_MAC_ID_NUM) { ++ mutex_unlock(&priv->sta_mutex); + return -ENOSPC; ++ } + + rtl8xxxu_refresh_rate_mask(priv, 0, sta, true); + priv->fops->report_connect(priv, sta_info->macid, H2C_MACID_ROLE_STA, true); +@@ -7523,6 +7633,7 @@ static int rtl8xxxu_sta_add(struct ieee8 + break; + } + } ++ mutex_unlock(&priv->sta_mutex); + + return 0; + } +@@ -7534,8 +7645,10 @@ static int rtl8xxxu_sta_remove(struct ie + struct rtl8xxxu_sta_info *sta_info = (struct rtl8xxxu_sta_info *)sta->drv_priv; + struct rtl8xxxu_priv *priv = hw->priv; + ++ mutex_lock(&priv->sta_mutex); + if (vif->type == NL80211_IFTYPE_AP) + rtl8xxxu_release_macid(priv, sta_info->macid); ++ mutex_unlock(&priv->sta_mutex); + + return 0; + } +@@ -7766,6 +7879,7 @@ static int rtl8xxxu_probe(struct usb_int + mutex_init(&priv->usb_buf_mutex); + mutex_init(&priv->syson_indirect_access_mutex); + mutex_init(&priv->h2c_mutex); ++ mutex_init(&priv->sta_mutex); + INIT_LIST_HEAD(&priv->tx_urb_free_list); + spin_lock_init(&priv->tx_urb_lock); + INIT_LIST_HEAD(&priv->rx_urb_pending_list); diff --git a/package/kernel/mac80211/patches/rtl/009-v6.9-wifi-rtl8xxxu-check-vif-before-using-in-rtl8xxxu_tx.patch b/package/kernel/mac80211/patches/rtl/009-v6.9-wifi-rtl8xxxu-check-vif-before-using-in-rtl8xxxu_tx.patch new file mode 100644 index 00000000000000..600f7c37df709a --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/009-v6.9-wifi-rtl8xxxu-check-vif-before-using-in-rtl8xxxu_tx.patch @@ -0,0 +1,40 @@ +From 513c559ca9f05394da79fbf20a8f89eec5f53dce Mon Sep 17 00:00:00 2001 +From: Ping-Ke Shih +Date: Fri, 16 Feb 2024 11:39:23 +0800 +Subject: [PATCH] wifi: rtl8xxxu: check vif before using in rtl8xxxu_tx() + +The 'vif' is from tx_info of SKB, and other codes check 'vif' before using, +which raises smatch warnings: + +drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c:5656 rtl8xxxu_tx() + warn: variable dereferenced before check 'vif' (see line 5553) + +Compile tested only. + +Signed-off-by: Ping-Ke Shih +Signed-off-by: Kalle Valo +Link: https://msgid.link/20240216033923.34683-1-pkshih@realtek.com +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -5550,7 +5550,7 @@ static void rtl8xxxu_tx(struct ieee80211 + struct rtl8xxxu_tx_urb *tx_urb; + struct ieee80211_sta *sta = NULL; + struct ieee80211_vif *vif = tx_info->control.vif; +- struct rtl8xxxu_vif *rtlvif = (struct rtl8xxxu_vif *)vif->drv_priv; ++ struct rtl8xxxu_vif *rtlvif = vif ? (struct rtl8xxxu_vif *)vif->drv_priv : NULL; + struct device *dev = &priv->udev->dev; + u32 queue, rts_rate; + u16 pktlen = skb->len; +@@ -5621,7 +5621,7 @@ static void rtl8xxxu_tx(struct ieee80211 + default: + break; + } +- if (bmc && rtlvif->hw_key_idx != 0xff) { ++ if (bmc && rtlvif && rtlvif->hw_key_idx != 0xff) { + tx_desc->txdw1 |= cpu_to_le32(TXDESC_EN_DESC_ID); + macid = rtlvif->hw_key_idx; + } diff --git a/package/kernel/mac80211/patches/rtl/010-v6.9-wifi-rtl8xxxu-fix-mixed-declarations-and-code-warnin.patch b/package/kernel/mac80211/patches/rtl/010-v6.9-wifi-rtl8xxxu-fix-mixed-declarations-and-code-warnin.patch new file mode 100644 index 00000000000000..e1de784b09fa72 --- /dev/null +++ b/package/kernel/mac80211/patches/rtl/010-v6.9-wifi-rtl8xxxu-fix-mixed-declarations-and-code-warnin.patch @@ -0,0 +1,34 @@ +From a7e178259c5bc900da762b33d3a20b7ee1206f07 Mon Sep 17 00:00:00 2001 +From: Shiji Yang +Date: Fri, 23 Feb 2024 21:34:32 +0800 +Subject: [PATCH] wifi: rtl8xxxu: fix mixed declarations in rtl8xxxu_set_aifs() + +Moving struct ieee80211_sta *sta variable definition to the front +of the code to fix the ISO C90 forbids mixed declarations and code +warning. + +Fixes: 43532c050f8e ("wifi: rtl8xxxu: support multiple interfaces in set_aifs()") +Signed-off-by: Shiji Yang +Reviewed-by: Ping-Ke Shih +Signed-off-by: Kalle Valo +Link: https://msgid.link/TYAP286MB03157A408E0D69F2F6FBD88ABC552@TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -4919,11 +4919,11 @@ static void rtl8xxxu_set_aifs(struct rtl + int i; + + for (i = 0; i < ARRAY_SIZE(priv->vifs); i++) { ++ struct ieee80211_sta *sta; ++ + if (!priv->vifs[i]) + continue; + +- struct ieee80211_sta *sta; +- + rcu_read_lock(); + sta = ieee80211_find_sta(priv->vifs[i], priv->vifs[i]->bss_conf.bssid); + if (sta) diff --git a/package/kernel/mac80211/patches/subsys/001-wifi-mac80211-do-not-pass-ap_vlan-vif-pointer-to-dri.patch b/package/kernel/mac80211/patches/subsys/001-wifi-mac80211-do-not-pass-ap_vlan-vif-pointer-to-dri.patch deleted file mode 100644 index 43724aee1aeb84..00000000000000 --- a/package/kernel/mac80211/patches/subsys/001-wifi-mac80211-do-not-pass-ap_vlan-vif-pointer-to-dri.patch +++ /dev/null @@ -1,64 +0,0 @@ -From ee0db868ee4d88493dfdc82f59e3b4e449ddddd5 Mon Sep 17 00:00:00 2001 -From: Oldřich Jedlička -Date: Sat, 4 Nov 2023 15:13:33 +0100 -Subject: wifi: mac80211: do not pass AP_VLAN vif pointer to drivers during - flush -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -[ Upstream commit 3e3a2b645c043f7e3e488d5011478cefb69bbe8b ] - -This fixes WARN_ONs when using AP_VLANs after station removal. The flush -call passed AP_VLAN vif to driver, but because these vifs are virtual and -not registered with drivers, we need to translate to the correct AP vif -first. - -Closes: https://github.com/openwrt/openwrt/issues/12420 -Fixes: 0b75a1b1e42e ("wifi: mac80211: flush queues on STA removal") -Fixes: d00800a289c9 ("wifi: mac80211: add flush_sta method") -Tested-by: Konstantin Demin -Tested-by: Koen Vandeputte -Signed-off-by: Oldřich Jedlička -Link: https://lore.kernel.org/r/20231104141333.3710-1-oldium.pro@gmail.com -Signed-off-by: Johannes Berg -Signed-off-by: Sasha Levin ---- - net/mac80211/driver-ops.h | 9 +++++++-- - 1 file changed, 7 insertions(+), 2 deletions(-) - ---- a/net/mac80211/driver-ops.h -+++ b/net/mac80211/driver-ops.h -@@ -23,7 +23,7 @@ - static inline struct ieee80211_sub_if_data * - get_bss_sdata(struct ieee80211_sub_if_data *sdata) - { -- if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) -+ if (sdata && sdata->vif.type == NL80211_IFTYPE_AP_VLAN) - sdata = container_of(sdata->bss, struct ieee80211_sub_if_data, - u.ap); - -@@ -638,10 +638,13 @@ static inline void drv_flush(struct ieee - struct ieee80211_sub_if_data *sdata, - u32 queues, bool drop) - { -- struct ieee80211_vif *vif = sdata ? &sdata->vif : NULL; -+ struct ieee80211_vif *vif; - - might_sleep(); - -+ sdata = get_bss_sdata(sdata); -+ vif = sdata ? &sdata->vif : NULL; -+ - if (sdata && !check_sdata_in_driver(sdata)) - return; - -@@ -657,6 +660,8 @@ static inline void drv_flush_sta(struct - { - might_sleep(); - -+ sdata = get_bss_sdata(sdata); -+ - if (sdata && !check_sdata_in_driver(sdata)) - return; - diff --git a/package/kernel/mac80211/patches/subsys/110-mac80211_keep_keys_on_stop_ap.patch b/package/kernel/mac80211/patches/subsys/110-mac80211_keep_keys_on_stop_ap.patch index e3349dabd0b9c7..7bf99bec286674 100644 --- a/package/kernel/mac80211/patches/subsys/110-mac80211_keep_keys_on_stop_ap.patch +++ b/package/kernel/mac80211/patches/subsys/110-mac80211_keep_keys_on_stop_ap.patch @@ -9,7 +9,7 @@ Used for AP+STA support in OpenWrt - preserve AP mode keys across STA reconnect --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -1632,7 +1632,6 @@ static int ieee80211_stop_ap(struct wiph +@@ -1635,7 +1635,6 @@ static int ieee80211_stop_ap(struct wiph link_conf->bssid_indicator = 0; __sta_info_flush(sdata, true); diff --git a/package/kernel/mac80211/patches/subsys/130-disable_auto_vif.patch b/package/kernel/mac80211/patches/subsys/130-disable_auto_vif.patch index 9d8f781ac41ffa..43507f2985e4bb 100644 --- a/package/kernel/mac80211/patches/subsys/130-disable_auto_vif.patch +++ b/package/kernel/mac80211/patches/subsys/130-disable_auto_vif.patch @@ -1,6 +1,6 @@ --- a/net/mac80211/main.c +++ b/net/mac80211/main.c -@@ -1396,24 +1396,6 @@ int ieee80211_register_hw(struct ieee802 +@@ -1393,24 +1393,6 @@ int ieee80211_register_hw(struct ieee802 debugfs_hw_add(local); rate_control_add_debugfs(local); diff --git a/package/kernel/mac80211/patches/subsys/210-ap_scan.patch b/package/kernel/mac80211/patches/subsys/210-ap_scan.patch index 25b844a21b2ec9..1e9676fd0b69e8 100644 --- a/package/kernel/mac80211/patches/subsys/210-ap_scan.patch +++ b/package/kernel/mac80211/patches/subsys/210-ap_scan.patch @@ -8,7 +8,7 @@ Subject: [PATCH] mac80211: allow scans in access point mode (for site survey) --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c -@@ -2843,6 +2843,8 @@ static int ieee80211_scan(struct wiphy * +@@ -2847,6 +2847,8 @@ static int ieee80211_scan(struct wiphy * */ fallthrough; case NL80211_IFTYPE_AP: diff --git a/package/kernel/mac80211/patches/subsys/301-mac80211-sta-randomize-BA-session-dialog-token-alloc.patch b/package/kernel/mac80211/patches/subsys/301-mac80211-sta-randomize-BA-session-dialog-token-alloc.patch index ffa5c17e487fe6..1034e2c928fd22 100644 --- a/package/kernel/mac80211/patches/subsys/301-mac80211-sta-randomize-BA-session-dialog-token-alloc.patch +++ b/package/kernel/mac80211/patches/subsys/301-mac80211-sta-randomize-BA-session-dialog-token-alloc.patch @@ -28,11 +28,15 @@ Signed-off-by: Johannes Berg --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c -@@ -558,6 +558,7 @@ __sta_info_alloc(struct ieee80211_sub_if +@@ -561,6 +561,11 @@ __sta_info_alloc(struct ieee80211_sub_if INIT_WORK(&sta->drv_deliver_wk, sta_deliver_ps_frames); INIT_WORK(&sta->ampdu_mlme.work, ieee80211_ba_session_work); mutex_init(&sta->ampdu_mlme.mtx); ++#if LINUX_VERSION_IS_LESS(6,2,0) + sta->ampdu_mlme.dialog_token_allocator = prandom_u32_max(U8_MAX); ++#else ++ sta->ampdu_mlme.dialog_token_allocator = get_random_u32_below(U8_MAX); ++#endif #ifdef CPTCFG_MAC80211_MESH if (ieee80211_vif_is_mesh(&sdata->vif)) { sta->mesh = kzalloc(sizeof(*sta->mesh), gfp); diff --git a/package/kernel/mac80211/patches/subsys/305-mac80211-increase-quantum-for-airtime-scheduler.patch b/package/kernel/mac80211/patches/subsys/305-mac80211-increase-quantum-for-airtime-scheduler.patch index a27925e64ee77b..e4575ca7ba7452 100644 --- a/package/kernel/mac80211/patches/subsys/305-mac80211-increase-quantum-for-airtime-scheduler.patch +++ b/package/kernel/mac80211/patches/subsys/305-mac80211-increase-quantum-for-airtime-scheduler.patch @@ -23,7 +23,7 @@ Signed-off-by: Felix Fietkau --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -4059,7 +4059,7 @@ struct ieee80211_txq *ieee80211_next_txq +@@ -4060,7 +4060,7 @@ struct ieee80211_txq *ieee80211_next_txq if (deficit < 0) sta->airtime[txqi->txq.ac].deficit += @@ -32,7 +32,7 @@ Signed-off-by: Felix Fietkau if (deficit < 0 || !aql_check) { list_move_tail(&txqi->schedule_order, -@@ -4202,7 +4202,8 @@ bool ieee80211_txq_may_transmit(struct i +@@ -4203,7 +4203,8 @@ bool ieee80211_txq_may_transmit(struct i } sta = container_of(iter->txq.sta, struct sta_info, sta); if (ieee80211_sta_deficit(sta, ac) < 0) @@ -42,7 +42,7 @@ Signed-off-by: Felix Fietkau list_move_tail(&iter->schedule_order, &local->active_txqs[ac]); } -@@ -4210,7 +4211,7 @@ bool ieee80211_txq_may_transmit(struct i +@@ -4211,7 +4212,7 @@ bool ieee80211_txq_may_transmit(struct i if (sta->airtime[ac].deficit >= 0) goto out; diff --git a/package/kernel/mac80211/patches/subsys/310-mac80211-split-mesh-fast-tx-cache-into-local-proxied.patch b/package/kernel/mac80211/patches/subsys/310-mac80211-split-mesh-fast-tx-cache-into-local-proxied.patch index f362751e0a3ba4..4853cef723171e 100644 --- a/package/kernel/mac80211/patches/subsys/310-mac80211-split-mesh-fast-tx-cache-into-local-proxied.patch +++ b/package/kernel/mac80211/patches/subsys/310-mac80211-split-mesh-fast-tx-cache-into-local-proxied.patch @@ -82,7 +82,7 @@ Signed-off-by: Felix Fietkau struct ieee80211_fast_tx fast_tx; u8 hdr[sizeof(struct ieee80211s_hdr) + sizeof(rfc1042_header)]; -@@ -334,7 +358,8 @@ void mesh_path_tx_root_frame(struct ieee +@@ -333,7 +357,8 @@ void mesh_path_tx_root_frame(struct ieee bool mesh_action_is_path_sel(struct ieee80211_mgmt *mgmt); struct ieee80211_mesh_fast_tx * @@ -175,12 +175,12 @@ Signed-off-by: Felix Fietkau + ether_addr_copy(key.addr, addr); cache = &sdata->u.mesh.tx_cache; spin_lock_bh(&cache->walk_lock); -- entry = rhashtable_lookup(&cache->rht, addr, fast_tx_rht_params); +- entry = rhashtable_lookup_fast(&cache->rht, addr, fast_tx_rht_params); - if (entry) - mesh_fast_tx_entry_free(cache, entry); + for (i = MESH_FAST_TX_TYPE_LOCAL; i < MESH_FAST_TX_TYPE_FORWARDED; i++) { + key.type = i; -+ entry = rhashtable_lookup(&cache->rht, &key, fast_tx_rht_params); ++ entry = rhashtable_lookup_fast(&cache->rht, &key, fast_tx_rht_params); + if (entry) + mesh_fast_tx_entry_free(cache, entry); + } @@ -189,7 +189,7 @@ Signed-off-by: Felix Fietkau --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c -@@ -2727,7 +2727,10 @@ ieee80211_rx_mesh_fast_forward(struct ie +@@ -2726,7 +2726,10 @@ ieee80211_rx_mesh_fast_forward(struct ie struct sk_buff *skb, int hdrlen) { struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; @@ -201,7 +201,7 @@ Signed-off-by: Felix Fietkau struct ieee80211s_hdr *mesh_hdr; struct tid_ampdu_tx *tid_tx; struct sta_info *sta; -@@ -2736,9 +2739,13 @@ ieee80211_rx_mesh_fast_forward(struct ie +@@ -2735,9 +2738,13 @@ ieee80211_rx_mesh_fast_forward(struct ie mesh_hdr = (struct ieee80211s_hdr *)(skb->data + sizeof(eth)); if ((mesh_hdr->flags & MESH_FLAGS_AE) == MESH_FLAGS_AE_A5_A6) diff --git a/package/kernel/mac80211/patches/subsys/311-mac80211-fix-mesh-id-corruption-on-32-bit-systems.patch b/package/kernel/mac80211/patches/subsys/311-mac80211-fix-mesh-id-corruption-on-32-bit-systems.patch deleted file mode 100644 index c0c774a89d5bb9..00000000000000 --- a/package/kernel/mac80211/patches/subsys/311-mac80211-fix-mesh-id-corruption-on-32-bit-systems.patch +++ /dev/null @@ -1,62 +0,0 @@ -From: Felix Fietkau -Date: Tue, 12 Sep 2023 15:09:27 +0200 -Subject: [PATCH] mac80211: fix mesh id corruption on 32 bit systems -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Since the changed field size was increased to u64, mesh_bss_info_changed -pulls invalid bits from the first 3 bytes of the mesh id, clears them, and -passes them on to ieee80211_link_info_change_notify, because -ifmsh->mbss_changed was not updated to match its size. -Fix this by turning into ifmsh->mbss_changed into an unsigned long array with -64 bit size. - -Fixes: 15ddba5f4311 ("wifi: mac80211: consistently use u64 for BSS changes") -Reported-by: Thomas Hühn -Signed-off-by: Felix Fietkau ---- - ---- a/net/mac80211/ieee80211_i.h -+++ b/net/mac80211/ieee80211_i.h -@@ -678,7 +678,7 @@ struct ieee80211_if_mesh { - struct timer_list mesh_path_root_timer; - - unsigned long wrkq_flags; -- unsigned long mbss_changed; -+ unsigned long mbss_changed[64 / BITS_PER_LONG]; - - bool userspace_handles_dfs; - ---- a/net/mac80211/mesh.c -+++ b/net/mac80211/mesh.c -@@ -1181,7 +1181,7 @@ void ieee80211_mbss_info_change_notify(s - - /* if we race with running work, worst case this work becomes a noop */ - for_each_set_bit(bit, &bits, sizeof(changed) * BITS_PER_BYTE) -- set_bit(bit, &ifmsh->mbss_changed); -+ set_bit(bit, ifmsh->mbss_changed); - set_bit(MESH_WORK_MBSS_CHANGED, &ifmsh->wrkq_flags); - wiphy_work_queue(sdata->local->hw.wiphy, &sdata->work); - } -@@ -1263,7 +1263,7 @@ void ieee80211_stop_mesh(struct ieee8021 - - /* clear any mesh work (for next join) we may have accrued */ - ifmsh->wrkq_flags = 0; -- ifmsh->mbss_changed = 0; -+ memset(ifmsh->mbss_changed, 0, sizeof(ifmsh->mbss_changed)); - - local->fif_other_bss--; - atomic_dec(&local->iff_allmultis); -@@ -1730,9 +1730,9 @@ static void mesh_bss_info_changed(struct - u32 bit; - u64 changed = 0; - -- for_each_set_bit(bit, &ifmsh->mbss_changed, -+ for_each_set_bit(bit, ifmsh->mbss_changed, - sizeof(changed) * BITS_PER_BYTE) { -- clear_bit(bit, &ifmsh->mbss_changed); -+ clear_bit(bit, ifmsh->mbss_changed); - changed |= BIT(bit); - } - diff --git a/package/kernel/mac80211/patches/subsys/312-wifi-cfg80211-annotate-iftype_data-pointer-with-spar.patch b/package/kernel/mac80211/patches/subsys/312-wifi-cfg80211-annotate-iftype_data-pointer-with-spar.patch index 18420a80cf9e84..91ebfc6105f796 100644 --- a/package/kernel/mac80211/patches/subsys/312-wifi-cfg80211-annotate-iftype_data-pointer-with-spar.patch +++ b/package/kernel/mac80211/patches/subsys/312-wifi-cfg80211-annotate-iftype_data-pointer-with-spar.patch @@ -57,7 +57,7 @@ Signed-off-by: Johannes Berg --- a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c +++ b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c -@@ -1075,8 +1075,8 @@ static void iwl_init_he_hw_capab(struct +@@ -1078,8 +1078,8 @@ static void iwl_init_he_hw_capab(struct memcpy(iftype_data, iwl_he_eht_capa, sizeof(iwl_he_eht_capa)); @@ -70,7 +70,7 @@ Signed-off-by: Johannes Berg iwl_nvm_fixup_sband_iftd(trans, data, sband, &iftype_data[i], --- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c -@@ -1119,8 +1119,7 @@ void mt7915_set_stream_he_caps(struct mt +@@ -1127,8 +1127,7 @@ void mt7915_set_stream_he_caps(struct mt n = mt7915_init_he_caps(phy, NL80211_BAND_2GHZ, data); band = &phy->mt76->sband_2g.sband; @@ -80,7 +80,7 @@ Signed-off-by: Johannes Berg } if (phy->mt76->cap.has_5ghz) { -@@ -1128,8 +1127,7 @@ void mt7915_set_stream_he_caps(struct mt +@@ -1136,8 +1135,7 @@ void mt7915_set_stream_he_caps(struct mt n = mt7915_init_he_caps(phy, NL80211_BAND_5GHZ, data); band = &phy->mt76->sband_5g.sband; @@ -90,7 +90,7 @@ Signed-off-by: Johannes Berg } if (phy->mt76->cap.has_6ghz) { -@@ -1137,8 +1135,7 @@ void mt7915_set_stream_he_caps(struct mt +@@ -1145,8 +1143,7 @@ void mt7915_set_stream_he_caps(struct mt n = mt7915_init_he_caps(phy, NL80211_BAND_6GHZ, data); band = &phy->mt76->sband_6g.sband; @@ -133,7 +133,7 @@ Signed-off-by: Johannes Berg } --- a/drivers/net/wireless/mediatek/mt76/mt7996/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7996/init.c -@@ -823,8 +823,7 @@ __mt7996_set_stream_he_eht_caps(struct m +@@ -828,8 +828,7 @@ __mt7996_set_stream_he_eht_caps(struct m n++; } @@ -177,7 +177,7 @@ Signed-off-by: Johannes Berg kfree(wiphy->bands[band]->channels); --- a/drivers/net/wireless/realtek/rtw89/core.c +++ b/drivers/net/wireless/realtek/rtw89/core.c -@@ -3328,8 +3328,7 @@ static void rtw89_init_he_cap(struct rtw +@@ -3359,8 +3359,7 @@ static void rtw89_init_he_cap(struct rtw idx++; } @@ -187,7 +187,7 @@ Signed-off-by: Johannes Berg } static int rtw89_core_set_supported_band(struct rtw89_dev *rtwdev) -@@ -3374,11 +3373,11 @@ err: +@@ -3405,11 +3404,11 @@ err: hw->wiphy->bands[NL80211_BAND_5GHZ] = NULL; hw->wiphy->bands[NL80211_BAND_6GHZ] = NULL; if (sband_2ghz) @@ -202,7 +202,7 @@ Signed-off-by: Johannes Berg kfree(sband_2ghz); kfree(sband_5ghz); kfree(sband_6ghz); -@@ -3390,11 +3389,11 @@ static void rtw89_core_clr_supported_ban +@@ -3421,11 +3420,11 @@ static void rtw89_core_clr_supported_ban struct ieee80211_hw *hw = rtwdev->hw; if (hw->wiphy->bands[NL80211_BAND_2GHZ]) @@ -219,7 +219,7 @@ Signed-off-by: Johannes Berg kfree(hw->wiphy->bands[NL80211_BAND_6GHZ]); --- a/drivers/net/wireless/realtek/rtw89/regd.c +++ b/drivers/net/wireless/realtek/rtw89/regd.c -@@ -376,7 +376,7 @@ bottom: +@@ -377,7 +377,7 @@ bottom: return; wiphy->bands[NL80211_BAND_6GHZ] = NULL; @@ -230,7 +230,7 @@ Signed-off-by: Johannes Berg --- a/drivers/net/wireless/virtual/mac80211_hwsim.c +++ b/drivers/net/wireless/virtual/mac80211_hwsim.c -@@ -4900,25 +4900,19 @@ static const struct ieee80211_sband_ifty +@@ -4899,25 +4899,19 @@ static const struct ieee80211_sband_ifty static void mac80211_hwsim_sband_capab(struct ieee80211_supported_band *sband) { @@ -362,7 +362,7 @@ Signed-off-by: Johannes Berg } --- a/net/mac80211/main.c +++ b/net/mac80211/main.c -@@ -1055,6 +1055,7 @@ int ieee80211_register_hw(struct ieee802 +@@ -1052,6 +1052,7 @@ int ieee80211_register_hw(struct ieee802 supp_he = false; supp_eht = false; for (band = 0; band < NUM_NL80211_BANDS; band++) { @@ -370,7 +370,7 @@ Signed-off-by: Johannes Berg struct ieee80211_supported_band *sband; sband = local->hw.wiphy->bands[band]; -@@ -1101,11 +1102,7 @@ int ieee80211_register_hw(struct ieee802 +@@ -1098,11 +1099,7 @@ int ieee80211_register_hw(struct ieee802 supp_ht = supp_ht || sband->ht_cap.ht_supported; supp_vht = supp_vht || sband->vht_cap.vht_supported; @@ -415,7 +415,7 @@ Signed-off-by: Johannes Berg */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt -@@ -817,6 +817,7 @@ int wiphy_register(struct wiphy *wiphy) +@@ -819,6 +819,7 @@ int wiphy_register(struct wiphy *wiphy) /* sanity check supported bands/channels */ for (band = 0; band < NUM_NL80211_BANDS; band++) { @@ -423,7 +423,7 @@ Signed-off-by: Johannes Berg u16 types = 0; bool have_he = false; -@@ -873,14 +874,11 @@ int wiphy_register(struct wiphy *wiphy) +@@ -875,14 +876,11 @@ int wiphy_register(struct wiphy *wiphy) return -EINVAL; } @@ -441,7 +441,7 @@ Signed-off-by: Johannes Berg if (WARN_ON(types & iftd->types_mask)) --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c -@@ -1906,20 +1906,20 @@ static int nl80211_send_band_rateinfo(st +@@ -1907,20 +1907,20 @@ static int nl80211_send_band_rateinfo(st struct nlattr *nl_iftype_data = nla_nest_start_noflag(msg, NL80211_BAND_ATTR_IFTYPE_DATA); diff --git a/package/kernel/mac80211/patches/subsys/313-wifi-cfg80211-export-DFS-CAC-time-and-usable-state-h.patch b/package/kernel/mac80211/patches/subsys/313-wifi-cfg80211-export-DFS-CAC-time-and-usable-state-h.patch index 78ec030e18b772..a41a906c3c4188 100644 --- a/package/kernel/mac80211/patches/subsys/313-wifi-cfg80211-export-DFS-CAC-time-and-usable-state-h.patch +++ b/package/kernel/mac80211/patches/subsys/313-wifi-cfg80211-export-DFS-CAC-time-and-usable-state-h.patch @@ -79,7 +79,7 @@ Signed-off-by: Johannes Berg u32 center_freq, u32 bandwidth, --- a/net/wireless/core.h +++ b/net/wireless/core.h -@@ -469,29 +469,12 @@ int cfg80211_scan(struct cfg80211_regist +@@ -476,29 +476,12 @@ int cfg80211_scan(struct cfg80211_regist extern struct work_struct cfg80211_disconnect_work; diff --git a/package/kernel/mac80211/patches/subsys/314-wifi-mac80211-fix-race-condition-on-enabling-fast-xm.patch b/package/kernel/mac80211/patches/subsys/314-wifi-mac80211-fix-race-condition-on-enabling-fast-xm.patch index 191eb67e8eac9e..12ed2142abca2c 100644 --- a/package/kernel/mac80211/patches/subsys/314-wifi-mac80211-fix-race-condition-on-enabling-fast-xm.patch +++ b/package/kernel/mac80211/patches/subsys/314-wifi-mac80211-fix-race-condition-on-enabling-fast-xm.patch @@ -13,7 +13,7 @@ Signed-off-by: Felix Fietkau --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c -@@ -911,6 +911,7 @@ static int sta_info_insert_finish(struct +@@ -914,6 +914,7 @@ static int sta_info_insert_finish(struct if (ieee80211_vif_is_mesh(&sdata->vif)) mesh_accept_plinks_update(sdata); @@ -23,7 +23,7 @@ Signed-off-by: Felix Fietkau out_remove: --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c -@@ -3033,7 +3033,7 @@ void ieee80211_check_fast_xmit(struct st +@@ -3034,7 +3034,7 @@ void ieee80211_check_fast_xmit(struct st sdata->vif.type == NL80211_IFTYPE_STATION) goto out; diff --git a/package/kernel/mac80211/patches/subsys/320-cfg80211-allow-grace-period-for-DFS-available-after-.patch b/package/kernel/mac80211/patches/subsys/320-cfg80211-allow-grace-period-for-DFS-available-after-.patch index 28e2144f7f51ba..ec381303cebe96 100644 --- a/package/kernel/mac80211/patches/subsys/320-cfg80211-allow-grace-period-for-DFS-available-after-.patch +++ b/package/kernel/mac80211/patches/subsys/320-cfg80211-allow-grace-period-for-DFS-available-after-.patch @@ -113,7 +113,7 @@ Signed-off-by: Felix Fietkau { --- a/net/wireless/core.h +++ b/net/wireless/core.h -@@ -474,6 +474,8 @@ void cfg80211_set_dfs_state(struct wiphy +@@ -481,6 +481,8 @@ void cfg80211_set_dfs_state(struct wiphy enum nl80211_dfs_state dfs_state); void cfg80211_dfs_channels_update_work(struct work_struct *work); @@ -124,7 +124,7 @@ Signed-off-by: Felix Fietkau --- a/net/wireless/mlme.c +++ b/net/wireless/mlme.c -@@ -915,6 +915,8 @@ void cfg80211_dfs_channels_update_work(s +@@ -930,6 +930,8 @@ void cfg80211_dfs_channels_update_work(s if (c->dfs_state == NL80211_DFS_UNAVAILABLE) { time_dfs_update = IEEE80211_DFS_MIN_NOP_TIME_MS; radar_event = NL80211_RADAR_NOP_FINISHED; @@ -133,7 +133,7 @@ Signed-off-by: Felix Fietkau } else { if (regulatory_pre_cac_allowed(wiphy) || cfg80211_any_wiphy_oper_chan(wiphy, c)) -@@ -922,11 +924,10 @@ void cfg80211_dfs_channels_update_work(s +@@ -937,11 +939,10 @@ void cfg80211_dfs_channels_update_work(s time_dfs_update = REG_PRE_CAC_EXPIRY_GRACE_MS; radar_event = NL80211_RADAR_PRE_CAC_EXPIRED; diff --git a/package/kernel/mac80211/patches/subsys/330-mac80211-add-AQL-support-for-broadcast-packets.patch b/package/kernel/mac80211/patches/subsys/330-mac80211-add-AQL-support-for-broadcast-packets.patch new file mode 100644 index 00000000000000..d53afcf5919c3d --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/330-mac80211-add-AQL-support-for-broadcast-packets.patch @@ -0,0 +1,302 @@ +From: Felix Fietkau +Date: Fri, 9 Feb 2024 19:43:40 +0100 +Subject: [PATCH] mac80211: add AQL support for broadcast packets + +Excessive broadcast traffic with little competing unicast traffic can easily +flood hardware queues, leading to throughput issues. Additionally, filling +the hardware queues with too many packets breaks FQ for broadcast data. +Fix this by enabling AQL for broadcast packets. + +Signed-off-by: Felix Fietkau +--- + +--- a/include/net/cfg80211.h ++++ b/include/net/cfg80211.h +@@ -3324,6 +3324,7 @@ enum wiphy_params_flags { + /* The per TXQ device queue limit in airtime */ + #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L 5000 + #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H 12000 ++#define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_BC 50000 + + /* The per interface airtime threshold to switch to lower queue limit */ + #define IEEE80211_AQL_THRESHOLD 24000 +--- a/net/mac80211/debugfs.c ++++ b/net/mac80211/debugfs.c +@@ -215,11 +215,13 @@ static ssize_t aql_pending_read(struct f + "VI %u us\n" + "BE %u us\n" + "BK %u us\n" ++ "BC/MC %u us\n" + "total %u us\n", + atomic_read(&local->aql_ac_pending_airtime[IEEE80211_AC_VO]), + atomic_read(&local->aql_ac_pending_airtime[IEEE80211_AC_VI]), + atomic_read(&local->aql_ac_pending_airtime[IEEE80211_AC_BE]), + atomic_read(&local->aql_ac_pending_airtime[IEEE80211_AC_BK]), ++ atomic_read(&local->aql_bc_pending_airtime), + atomic_read(&local->aql_total_pending_airtime)); + return simple_read_from_buffer(user_buf, count, ppos, + buf, len); +@@ -245,7 +247,8 @@ static ssize_t aql_txq_limit_read(struct + "VO %u %u\n" + "VI %u %u\n" + "BE %u %u\n" +- "BK %u %u\n", ++ "BK %u %u\n" ++ "BC/MC %u\n", + local->aql_txq_limit_low[IEEE80211_AC_VO], + local->aql_txq_limit_high[IEEE80211_AC_VO], + local->aql_txq_limit_low[IEEE80211_AC_VI], +@@ -253,7 +256,8 @@ static ssize_t aql_txq_limit_read(struct + local->aql_txq_limit_low[IEEE80211_AC_BE], + local->aql_txq_limit_high[IEEE80211_AC_BE], + local->aql_txq_limit_low[IEEE80211_AC_BK], +- local->aql_txq_limit_high[IEEE80211_AC_BK]); ++ local->aql_txq_limit_high[IEEE80211_AC_BK], ++ local->aql_txq_limit_bc); + return simple_read_from_buffer(user_buf, count, ppos, + buf, len); + } +@@ -279,6 +283,11 @@ static ssize_t aql_txq_limit_write(struc + else + buf[count] = '\0'; + ++ if (sscanf(buf, "mcast %u", &q_limit_low) == 1) { ++ local->aql_txq_limit_bc = q_limit_low; ++ return count; ++ } ++ + if (sscanf(buf, "%u %u %u", &ac, &q_limit_low, &q_limit_high) != 3) + return -EINVAL; + +--- a/net/mac80211/ieee80211_i.h ++++ b/net/mac80211/ieee80211_i.h +@@ -1328,10 +1328,12 @@ struct ieee80211_local { + spinlock_t handle_wake_tx_queue_lock; + + u16 airtime_flags; ++ u32 aql_txq_limit_bc; + u32 aql_txq_limit_low[IEEE80211_NUM_ACS]; + u32 aql_txq_limit_high[IEEE80211_NUM_ACS]; + u32 aql_threshold; + atomic_t aql_total_pending_airtime; ++ atomic_t aql_bc_pending_airtime; + atomic_t aql_ac_pending_airtime[IEEE80211_NUM_ACS]; + + const struct ieee80211_ops *ops; +--- a/net/mac80211/main.c ++++ b/net/mac80211/main.c +@@ -788,6 +788,7 @@ struct ieee80211_hw *ieee80211_alloc_hw_ + spin_lock_init(&local->rx_path_lock); + spin_lock_init(&local->queue_stop_reason_lock); + ++ local->aql_txq_limit_bc = IEEE80211_DEFAULT_AQL_TXQ_LIMIT_BC; + for (i = 0; i < IEEE80211_NUM_ACS; i++) { + INIT_LIST_HEAD(&local->active_txqs[i]); + spin_lock_init(&local->active_txq_lock[i]); +--- a/net/mac80211/sta_info.c ++++ b/net/mac80211/sta_info.c +@@ -2343,13 +2343,28 @@ EXPORT_SYMBOL(ieee80211_sta_recalc_aggre + + void ieee80211_sta_update_pending_airtime(struct ieee80211_local *local, + struct sta_info *sta, u8 ac, +- u16 tx_airtime, bool tx_completed) ++ u16 tx_airtime, bool tx_completed, ++ bool mcast) + { + int tx_pending; + + if (!wiphy_ext_feature_isset(local->hw.wiphy, NL80211_EXT_FEATURE_AQL)) + return; + ++ if (mcast) { ++ if (!tx_completed) { ++ atomic_add(tx_airtime, &local->aql_bc_pending_airtime); ++ return; ++ } ++ ++ tx_pending = atomic_sub_return(tx_airtime, ++ &local->aql_bc_pending_airtime); ++ if (tx_pending < 0) ++ atomic_cmpxchg(&local->aql_bc_pending_airtime, ++ tx_pending, 0); ++ return; ++ } ++ + if (!tx_completed) { + if (sta) + atomic_add(tx_airtime, +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -2536,7 +2536,7 @@ static u16 ieee80211_store_ack_skb(struc + + spin_lock_irqsave(&local->ack_status_lock, flags); + id = idr_alloc(&local->ack_status_frames, ack_skb, +- 1, 0x2000, GFP_ATOMIC); ++ 1, 0x1000, GFP_ATOMIC); + spin_unlock_irqrestore(&local->ack_status_lock, flags); + + if (id >= 0) { +@@ -3958,20 +3958,20 @@ begin: + encap_out: + IEEE80211_SKB_CB(skb)->control.vif = vif; + +- if (tx.sta && +- wiphy_ext_feature_isset(local->hw.wiphy, NL80211_EXT_FEATURE_AQL)) { +- bool ampdu = txq->ac != IEEE80211_AC_VO; ++ if (wiphy_ext_feature_isset(local->hw.wiphy, NL80211_EXT_FEATURE_AQL)) { ++ bool ampdu = txq->sta && txq->ac != IEEE80211_AC_VO; + u32 airtime; + + airtime = ieee80211_calc_expected_tx_airtime(hw, vif, txq->sta, + skb->len, ampdu); +- if (airtime) { +- airtime = ieee80211_info_set_tx_time_est(info, airtime); +- ieee80211_sta_update_pending_airtime(local, tx.sta, +- txq->ac, +- airtime, +- false); +- } ++ if (!airtime) ++ return skb; ++ ++ airtime = ieee80211_info_set_tx_time_est(info, airtime); ++ info->tx_time_mc = !tx.sta; ++ ieee80211_sta_update_pending_airtime(local, tx.sta, txq->ac, ++ airtime, false, ++ info->tx_time_mc); + } + + return skb; +@@ -4026,6 +4026,7 @@ struct ieee80211_txq *ieee80211_next_txq + struct ieee80211_txq *ret = NULL; + struct txq_info *txqi = NULL, *head = NULL; + bool found_eligible_txq = false; ++ bool aql_check; + + spin_lock_bh(&local->active_txq_lock[ac]); + +@@ -4049,26 +4050,26 @@ struct ieee80211_txq *ieee80211_next_txq + if (!head) + head = txqi; + ++ aql_check = ieee80211_txq_airtime_check(hw, &txqi->txq); ++ if (aql_check) ++ found_eligible_txq = true; ++ + if (txqi->txq.sta) { + struct sta_info *sta = container_of(txqi->txq.sta, + struct sta_info, sta); +- bool aql_check = ieee80211_txq_airtime_check(hw, &txqi->txq); +- s32 deficit = ieee80211_sta_deficit(sta, txqi->txq.ac); +- +- if (aql_check) +- found_eligible_txq = true; +- +- if (deficit < 0) ++ if (ieee80211_sta_deficit(sta, txqi->txq.ac) < 0) { + sta->airtime[txqi->txq.ac].deficit += + sta->airtime_weight << AIRTIME_QUANTUM_SHIFT; +- +- if (deficit < 0 || !aql_check) { +- list_move_tail(&txqi->schedule_order, +- &local->active_txqs[txqi->txq.ac]); +- goto begin; ++ aql_check = false; + } + } + ++ if (!aql_check) { ++ list_move_tail(&txqi->schedule_order, ++ &local->active_txqs[txqi->txq.ac]); ++ goto begin; ++ } ++ + if (txqi->schedule_round == local->schedule_round[ac]) + goto out; + +@@ -4133,7 +4134,8 @@ bool ieee80211_txq_airtime_check(struct + return true; + + if (!txq->sta) +- return true; ++ return atomic_read(&local->aql_bc_pending_airtime) < ++ local->aql_txq_limit_bc; + + if (unlikely(txq->tid == IEEE80211_NUM_TIDS)) + return true; +@@ -4182,15 +4184,15 @@ bool ieee80211_txq_may_transmit(struct i + + spin_lock_bh(&local->active_txq_lock[ac]); + +- if (!txqi->txq.sta) +- goto out; +- + if (list_empty(&txqi->schedule_order)) + goto out; + + if (!ieee80211_txq_schedule_airtime_check(local, ac)) + goto out; + ++ if (!txqi->txq.sta) ++ goto out; ++ + list_for_each_entry_safe(iter, tmp, &local->active_txqs[ac], + schedule_order) { + if (iter == txqi) +--- a/include/net/mac80211.h ++++ b/include/net/mac80211.h +@@ -1116,6 +1116,7 @@ ieee80211_rate_get_vht_nss(const struct + * link the frame will be transmitted on + * @hw_queue: HW queue to put the frame on, skb_get_queue_mapping() gives the AC + * @ack_frame_id: internal frame ID for TX status, used internally ++ * @tx_time_mc: TX time is for a multicast packet + * @tx_time_est: TX time estimate in units of 4us, used internally + * @control: union part for control data + * @control.rates: TX rates array to try +@@ -1155,8 +1156,9 @@ struct ieee80211_tx_info { + /* common information */ + u32 flags; + u32 band:3, +- ack_frame_id:13, ++ ack_frame_id:12, + hw_queue:4, ++ tx_time_mc:1, + tx_time_est:10; + /* 2 free bits */ + +--- a/net/mac80211/sta_info.h ++++ b/net/mac80211/sta_info.h +@@ -147,7 +147,8 @@ struct airtime_info { + + void ieee80211_sta_update_pending_airtime(struct ieee80211_local *local, + struct sta_info *sta, u8 ac, +- u16 tx_airtime, bool tx_completed); ++ u16 tx_airtime, bool tx_completed, ++ bool mcast); + + struct sta_info; + +--- a/net/mac80211/status.c ++++ b/net/mac80211/status.c +@@ -716,7 +716,7 @@ static void ieee80211_report_used_skb(st + ieee80211_sta_update_pending_airtime(local, sta, + skb_get_queue_mapping(skb), + tx_time_est, +- true); ++ true, info->tx_time_mc); + rcu_read_unlock(); + } + +@@ -1127,10 +1127,11 @@ void ieee80211_tx_status_ext(struct ieee + /* Do this here to avoid the expensive lookup of the sta + * in ieee80211_report_used_skb(). + */ ++ bool mcast = IEEE80211_SKB_CB(skb)->tx_time_mc; + ieee80211_sta_update_pending_airtime(local, sta, + skb_get_queue_mapping(skb), + tx_time_est, +- true); ++ true, mcast); + ieee80211_info_set_tx_time_est(IEEE80211_SKB_CB(skb), 0); + } + diff --git a/package/kernel/mac80211/patches/subsys/331-wifi-mac80211-only-call-drv_sta_rc_update-for-upload.patch b/package/kernel/mac80211/patches/subsys/331-wifi-mac80211-only-call-drv_sta_rc_update-for-upload.patch new file mode 100644 index 00000000000000..167b9e3f7769ab --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/331-wifi-mac80211-only-call-drv_sta_rc_update-for-upload.patch @@ -0,0 +1,25 @@ +From: Felix Fietkau +Date: Wed, 21 Feb 2024 14:41:40 +0100 +Subject: [PATCH] wifi: mac80211: only call drv_sta_rc_update for uploaded + stations + +When a station has not been uploaded yet, receiving SMPS or channel width +notification action frames can lead to rate_control_rate_update calling +drv_sta_rc_update with uninitialized driver private data. +Fix this by adding a missing check for sta->uploaded. + +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/rate.c ++++ b/net/mac80211/rate.c +@@ -119,7 +119,8 @@ void rate_control_rate_update(struct iee + rcu_read_unlock(); + } + +- drv_sta_rc_update(local, sta->sdata, &sta->sta, changed); ++ if (sta->uploaded) ++ drv_sta_rc_update(local, sta->sdata, &sta->sta, changed); + } + + int ieee80211_rate_control_register(const struct rate_control_ops *ops) diff --git a/package/kernel/mac80211/patches/subsys/332-wifi-mac80211-check-clear-fast-rx-for-non-4addr-sta-.patch b/package/kernel/mac80211/patches/subsys/332-wifi-mac80211-check-clear-fast-rx-for-non-4addr-sta-.patch new file mode 100644 index 00000000000000..02b4345f2178f7 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/332-wifi-mac80211-check-clear-fast-rx-for-non-4addr-sta-.patch @@ -0,0 +1,35 @@ +From: Felix Fietkau +Date: Sat, 16 Mar 2024 08:37:21 +0100 +Subject: [PATCH] wifi: mac80211: check/clear fast rx for non-4addr sta VLAN + changes + +When moving a station out of a VLAN and deleting the VLAN afterwards, the +fast_rx entry still holds a pointer to the VLAN's netdev, which can cause +use-after-free bugs. Fix this by immediately calling ieee80211_check_fast_rx +after the VLAN change. + +Cc: stable@vger.kernel.org +Reported-by: ranygh@riseup.net +Signed-off-by: Felix Fietkau +--- + +--- a/net/mac80211/cfg.c ++++ b/net/mac80211/cfg.c +@@ -2184,15 +2184,14 @@ static int ieee80211_change_station(stru + } + + if (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN && +- sta->sdata->u.vlan.sta) { +- ieee80211_clear_fast_rx(sta); ++ sta->sdata->u.vlan.sta) + RCU_INIT_POINTER(sta->sdata->u.vlan.sta, NULL); +- } + + if (test_sta_flag(sta, WLAN_STA_AUTHORIZED)) + ieee80211_vif_dec_num_mcast(sta->sdata); + + sta->sdata = vlansdata; ++ ieee80211_check_fast_rx(sta); + ieee80211_check_fast_xmit(sta); + + if (test_sta_flag(sta, WLAN_STA_AUTHORIZED)) { diff --git a/package/kernel/mac80211/patches/subsys/400-allow-ibss-mixed.patch b/package/kernel/mac80211/patches/subsys/400-allow-ibss-mixed.patch index ad24dfda5a7775..7a96f9f2bec503 100644 --- a/package/kernel/mac80211/patches/subsys/400-allow-ibss-mixed.patch +++ b/package/kernel/mac80211/patches/subsys/400-allow-ibss-mixed.patch @@ -16,7 +16,7 @@ and we should ignore this. --- a/net/wireless/core.c +++ b/net/wireless/core.c -@@ -649,21 +649,6 @@ static int wiphy_verify_combinations(str +@@ -651,21 +651,6 @@ static int wiphy_verify_combinations(str c->limits[j].max > 1)) return -EINVAL; diff --git a/package/kernel/mac80211/patches/subsys/780-avoid-crashing-missing-band.patch b/package/kernel/mac80211/patches/subsys/780-avoid-crashing-missing-band.patch index 4bbd7860436ef2..35fa961d21a752 100644 --- a/package/kernel/mac80211/patches/subsys/780-avoid-crashing-missing-band.patch +++ b/package/kernel/mac80211/patches/subsys/780-avoid-crashing-missing-band.patch @@ -18,7 +18,7 @@ Signed-off-by: David Bauer --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c -@@ -2423,6 +2423,13 @@ static void sta_stats_decode_rate(struct +@@ -2445,6 +2445,13 @@ static void sta_stats_decode_rate(struct sband = local->hw.wiphy->bands[band]; diff --git a/package/kernel/mt76/patches/100-fix-build-on-linux-kernel-6.6.patch b/package/kernel/mt76/patches/100-fix-build-on-linux-kernel-6.6.patch new file mode 100644 index 00000000000000..4fdba0c472273f --- /dev/null +++ b/package/kernel/mt76/patches/100-fix-build-on-linux-kernel-6.6.patch @@ -0,0 +1,24 @@ +--- a/mac80211.c ++++ b/mac80211.c +@@ -4,7 +4,9 @@ + */ + #include + #include ++#if LINUX_VERSION_CODE < KERNEL_VERSION(6,6,0) + #include ++#endif + #include "mt76.h" + + #define CHAN2G(_idx, _freq) { \ +--- a/mt76.h ++++ b/mt76.h +@@ -13,6 +13,9 @@ + #include + #include + #include ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,6,0) ++#include ++#endif + #include + #include + #include "util.h" diff --git a/package/kernel/qca-ssdk/patches/102-qca-ssdk-support-selecting-PCS-channel-for-PORT3-on-.patch b/package/kernel/qca-ssdk/patches/102-qca-ssdk-support-selecting-PCS-channel-for-PORT3-on-.patch new file mode 100644 index 00000000000000..5e390d8ee339c0 --- /dev/null +++ b/package/kernel/qca-ssdk/patches/102-qca-ssdk-support-selecting-PCS-channel-for-PORT3-on-.patch @@ -0,0 +1,135 @@ +From 0116bb7359bd99c09bcad1b2051652cd1a04be3f Mon Sep 17 00:00:00 2001 +From: Mantas Pucka +Date: Mon, 12 Feb 2024 14:23:04 +0200 +Subject: [PATCH] qca-ssdk: support selecting PCS channel for PORT3 on IPQ6018 + +When QCA8072 is used in PSGMII mode with IPQ6018, PCS used for second +PHY port would overlap with one used by SGMII+ port. SoC has register +to select different PCS in such case. + +Original code used PHY_ID for this decision, which also had other +issues, but is no longer viable since we moved to upstream QCA807x +driver. + +Introduce DT property port3_pcs_channel to allow describing this in DT. +Default value is <2>, and for some QCA8072 designs <4> would be needed. + +Signed-off-by: Mantas Pucka +--- + include/init/ssdk_dts.h | 2 ++ + src/adpt/cppe/adpt_cppe_portctrl.c | 4 ++-- + src/adpt/hppe/adpt_hppe_uniphy.c | 7 +------ + src/init/ssdk_dts.c | 27 +++++++++++++++++++++++++++ + 4 files changed, 32 insertions(+), 8 deletions(-) + +--- a/include/init/ssdk_dts.h ++++ b/include/init/ssdk_dts.h +@@ -101,6 +101,7 @@ typedef struct + a_uint32_t emu_chip_ver; /*only valid when is_emulation is true*/ + a_uint32_t clk_mode; + a_uint32_t pcie_hw_base; ++ a_uint32_t port3_pcs_channel; + } ssdk_dt_cfg; + + #define SSDK_MAX_NR_ETH 6 +@@ -162,6 +163,7 @@ a_uint32_t ssdk_device_id_get(a_uint32_t + struct device_node *ssdk_dts_node_get(a_uint32_t dev_id); + struct clk *ssdk_dts_essclk_get(a_uint32_t dev_id); + struct clk *ssdk_dts_cmnclk_get(a_uint32_t dev_id); ++a_uint32_t ssdk_dts_port3_pcs_channel_get(a_uint32_t dev_id); + + int ssdk_switch_device_num_init(void); + void ssdk_switch_device_num_exit(void); +--- a/src/adpt/cppe/adpt_cppe_portctrl.c ++++ b/src/adpt/cppe/adpt_cppe_portctrl.c +@@ -33,6 +33,7 @@ + #include "hsl_phy.h" + #include "hsl_port_prop.h" + #include "hppe_init.h" ++#include "ssdk_dts.h" + #include "adpt.h" + #include "adpt_hppe.h" + #include "adpt_cppe_portctrl.h" +@@ -60,8 +61,7 @@ _adpt_cppe_port_mux_mac_set(a_uint32_t d + case SSDK_PHYSICAL_PORT3: + case SSDK_PHYSICAL_PORT4: + if (mode0 == PORT_WRAPPER_PSGMII) { +- if (hsl_port_phyid_get(dev_id, +- SSDK_PHYSICAL_PORT3) == MALIBU2PORT_PHY) { ++ if (ssdk_dts_port3_pcs_channel_get(dev_id) == 4) { + cppe_port_mux_ctrl.bf.port3_pcs_sel = + CPPE_PORT3_PCS_SEL_PCS0_CHANNEL4; + cppe_port_mux_ctrl.bf.port4_pcs_sel = +--- a/src/adpt/hppe/adpt_hppe_uniphy.c ++++ b/src/adpt/hppe/adpt_hppe_uniphy.c +@@ -1122,9 +1122,6 @@ __adpt_hppe_uniphy_psgmii_mode_set(a_uin + { + a_uint32_t i; + sw_error_t rv = SW_OK; +-#if defined(CPPE) +- a_uint32_t phy_type = 0; +-#endif + + union uniphy_mode_ctrl_u uniphy_mode_ctrl; + +@@ -1134,9 +1131,7 @@ __adpt_hppe_uniphy_psgmii_mode_set(a_uin + SSDK_DEBUG("uniphy %d is psgmii mode\n", uniphy_index); + #if defined(CPPE) + if (adpt_ppe_type_get(dev_id) == CPPE_TYPE) { +- phy_type = hsl_port_phyid_get(dev_id, +- SSDK_PHYSICAL_PORT3); +- if (phy_type == MALIBU2PORT_PHY) { ++ if (ssdk_dts_port3_pcs_channel_get(dev_id) == 4) { + SSDK_INFO("cypress uniphy %d is qca8072 psgmii mode\n", uniphy_index); + rv = __adpt_cppe_uniphy_mode_set(dev_id, uniphy_index, + PORT_WRAPPER_PSGMII); +--- a/src/init/ssdk_dts.c ++++ b/src/init/ssdk_dts.c +@@ -272,6 +272,13 @@ struct clk *ssdk_dts_cmnclk_get(a_uint32 + return cfg->cmnblk_clk; + } + ++a_uint32_t ssdk_dts_port3_pcs_channel_get(a_uint32_t dev_id) ++{ ++ ssdk_dt_cfg* cfg = ssdk_dt_global.ssdk_dt_switch_nodes[dev_id]; ++ ++ return cfg->port3_pcs_channel; ++} ++ + #ifndef BOARD_AR71XX + #if defined(CONFIG_OF) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) + static void ssdk_dt_parse_mac_mode(a_uint32_t dev_id, +@@ -306,6 +313,25 @@ static void ssdk_dt_parse_mac_mode(a_uin + + return; + } ++ ++static void ssdk_dt_parse_port3_pcs_channel(a_uint32_t dev_id, ++ struct device_node *switch_node, ssdk_init_cfg *cfg) ++{ ++ const __be32 *port3_pcs_channel; ++ a_uint32_t len = 0; ++ ++ port3_pcs_channel = of_get_property(switch_node, "port3_pcs_channel", &len); ++ if (!port3_pcs_channel) { ++ ssdk_dt_global.ssdk_dt_switch_nodes[dev_id]->port3_pcs_channel = 2; ++ } ++ else { ++ ssdk_dt_global.ssdk_dt_switch_nodes[dev_id]->port3_pcs_channel = ++ be32_to_cpup(port3_pcs_channel); ++ } ++ ++ return; ++} ++ + #ifdef IN_UNIPHY + static void ssdk_dt_parse_uniphy(a_uint32_t dev_id) + { +@@ -1292,6 +1318,7 @@ sw_error_t ssdk_dt_parse(ssdk_init_cfg * + rv = ssdk_dt_parse_access_mode(switch_node, ssdk_dt_priv); + SW_RTN_ON_ERROR(rv); + ssdk_dt_parse_mac_mode(*dev_id, switch_node, cfg); ++ ssdk_dt_parse_port3_pcs_channel(*dev_id, switch_node, cfg); + ssdk_dt_parse_mdio(*dev_id, switch_node, cfg); + ssdk_dt_parse_port_bmp(*dev_id, switch_node, cfg); + ssdk_dt_parse_interrupt(*dev_id, switch_node); diff --git a/package/kernel/rtl8812au-ct/patches/008-fix-ret-status-code-type.patch b/package/kernel/rtl8812au-ct/patches/008-fix-ret-status-code-type.patch new file mode 100644 index 00000000000000..2c776288bf6f7e --- /dev/null +++ b/package/kernel/rtl8812au-ct/patches/008-fix-ret-status-code-type.patch @@ -0,0 +1,11 @@ +--- a/core/rtw_bt_mp.c ++++ b/core/rtw_bt_mp.c +@@ -169,7 +169,7 @@ mptbt_CheckBtRspStatus( + PBT_EXT_C2H pExtC2h + ) + { +- BT_CTRL_STATUS retStatus=BT_OP_STATUS_SUCCESS; ++ BT_CTRL_STATUS retStatus=BT_STATUS_SUCCESS; + + switch(pExtC2h->statusCode) { + case BT_OP_STATUS_SUCCESS: diff --git a/package/libs/libevent2/Makefile b/package/libs/libevent2/Makefile index 92602607aea253..e0a080d60e240d 100644 --- a/package/libs/libevent2/Makefile +++ b/package/libs/libevent2/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libevent2 PKG_VERSION:=2.1.12 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=libevent-$(PKG_VERSION)-stable.tar.gz PKG_SOURCE_URL:=https://github.com/libevent/libevent/releases/download/release-$(PKG_VERSION)-stable diff --git a/package/libs/libevent2/patches/001-relative-cmake.patch b/package/libs/libevent2/patches/001-relative-cmake.patch new file mode 100644 index 00000000000000..38dc187df6b173 --- /dev/null +++ b/package/libs/libevent2/patches/001-relative-cmake.patch @@ -0,0 +1,58 @@ +From 81c6b8823c1b58d7837e827bb1098aa5f9e5956b Mon Sep 17 00:00:00 2001 +From: "Jeremy W. Murphy" +Date: Tue, 16 May 2023 05:07:36 +1000 +Subject: [PATCH] cmake: Only use relative paths for install DESTINATION option + (#1405) + +As described in #1404, the explicit use of CMAKE_INSTALL_PREFIX conflicts with using command-line --prefix. + +This simply removes all explicit use of CMAKE_INSTALL_PREFIX. + +Otherwise this path will be duplicated: + + $ cmake -DCMAKE_BUILD_TYPE=debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_INSTALL_PREFIX=inst .. + $ DESTDIR=inst ninja install + ... + -- Installing: inst/src/le/libevent/.cmake-debug/inst/include/event2/util.h + -- Installing: inst/src/le/libevent/.cmake-debug/inst/include/event2/ws.h + ... + +Fixes: #1404 +Co-authored-by: Jeremy Murphy +--- + CMakeLists.txt | 3 +-- + cmake/AddEventLibrary.cmake | 4 ++-- + 2 files changed, 3 insertions(+), 4 deletions(-) + +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1452,8 +1452,7 @@ endif() + # Installation preparation. + # + +-set(EVENT_INSTALL_CMAKE_DIR +- "${CMAKE_INSTALL_PREFIX}/lib/cmake/libevent") ++set(EVENT_INSTALL_CMAKE_DIR "lib/cmake/libevent") + + export(PACKAGE libevent) + +--- a/cmake/AddEventLibrary.cmake ++++ b/cmake/AddEventLibrary.cmake +@@ -31,7 +31,7 @@ macro(generate_pkgconfig LIB_NAME) + configure_file("lib${LIB_NAME}.pc.in" "lib${LIB_NAME}.pc" @ONLY) + install( + FILES "${CMAKE_CURRENT_BINARY_DIR}/lib${LIB_NAME}.pc" +- DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig" ++ DESTINATION "lib/pkgconfig" + ) + endmacro() + +@@ -150,7 +150,7 @@ macro(add_event_library LIB_NAME) + set_target_properties( + "${LIB_NAME}_shared" PROPERTIES + OUTPUT_NAME "${LIB_NAME}-${EVENT_PACKAGE_RELEASE}.${CURRENT_MINUS_AGE}" +- INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib" ++ INSTALL_NAME_DIR "lib" + LINK_FLAGS "-compatibility_version ${COMPATIBILITY_VERSION} -current_version ${COMPATIBILITY_VERSION}.${EVENT_ABI_LIBVERSION_REVISION}") + else() + math(EXPR CURRENT_MINUS_AGE "${EVENT_ABI_LIBVERSION_CURRENT}-${EVENT_ABI_LIBVERSION_AGE}") diff --git a/package/libs/mbedtls/Config.in b/package/libs/mbedtls/Config.in index 9fbe9f8a4a0ff4..ad0ecb6e611aa8 100644 --- a/package/libs/mbedtls/Config.in +++ b/package/libs/mbedtls/Config.in @@ -172,6 +172,13 @@ config MBEDTLS_SSL_TRUNCATED_HMAC bool "MBEDTLS_SSL_TRUNCATED_HMAC" default n +config MBEDTLS_THREADING_C + bool "MBEDTLS_THREADING_C" + default y + +config MBEDTLS_THREADING_PTHREAD + def_bool MBEDTLS_THREADING_C + config MBEDTLS_VERSION_C bool "MBEDTLS_VERSION_C" default n diff --git a/package/libs/mbedtls/Makefile b/package/libs/mbedtls/Makefile index ad13bbe846371c..502bf65ffc450f 100644 --- a/package/libs/mbedtls/Makefile +++ b/package/libs/mbedtls/Makefile @@ -70,6 +70,8 @@ MBEDTLS_BUILD_OPTS= \ CONFIG_MBEDTLS_SELF_TEST \ CONFIG_MBEDTLS_SSL_RENEGOTIATION \ CONFIG_MBEDTLS_SSL_TRUNCATED_HMAC \ + CONFIG_MBEDTLS_THREADING_C \ + CONFIG_MBEDTLS_THREADING_PTHREAD \ CONFIG_MBEDTLS_VERSION_C \ CONFIG_MBEDTLS_VERSION_FEATURES @@ -94,7 +96,7 @@ $(call Package/mbedtls/Default) CATEGORY:=Libraries SUBMENU:=SSL TITLE+= (library) - ABI_VERSION:=12 + ABI_VERSION:=13 MENU:=1 endef diff --git a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh index 49ffb219bcd3c4..55df71ee3d5857 100755 --- a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh +++ b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh @@ -432,9 +432,9 @@ mac80211_hostapd_setup_base() { he_bss_color:128 \ he_bss_color_enabled:1 - he_phy_cap=$(iw phy "$phy" info | sed -n '/HE Iftypes: AP/,$p' | awk -F "[()]" '/HE PHY Capabilities/ { print $2 }' | head -1) + he_phy_cap=$(iw phy "$phy" info | sed -n '/HE Iftypes: .*AP/,$p' | awk -F "[()]" '/HE PHY Capabilities/ { print $2 }' | head -1) he_phy_cap=${he_phy_cap:2} - he_mac_cap=$(iw phy "$phy" info | sed -n '/HE Iftypes: AP/,$p' | awk -F "[()]" '/HE MAC Capabilities/ { print $2 }' | head -1) + he_mac_cap=$(iw phy "$phy" info | sed -n '/HE Iftypes: .*AP/,$p' | awk -F "[()]" '/HE MAC Capabilities/ { print $2 }' | head -1) he_mac_cap=${he_mac_cap:2} append base_cfg "ieee80211ax=1" "$N" diff --git a/package/network/ipv6/ds-lite/Makefile b/package/network/ipv6/ds-lite/Makefile index 502da366a92e67..37c3449ab2a76c 100644 --- a/package/network/ipv6/ds-lite/Makefile +++ b/package/network/ipv6/ds-lite/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ds-lite -PKG_RELEASE:=8 +PKG_RELEASE:=9 PKG_LICENSE:=GPL-2.0 include $(INCLUDE_DIR)/package.mk @@ -17,13 +17,13 @@ define Package/ds-lite SECTION:=net CATEGORY:=Network DEPENDS:=@IPV6 +kmod-ip6-tunnel +resolveip - TITLE:=Dual-Stack Lite (DS-Lite) configuration support + TITLE:=IPv4 over IPv6 (RFC2473 and DS-Lite) configuration support MAINTAINER:=Steven Barth PKGARCH:=all endef define Package/ds-lite/description -Provides support for Dual-Stack Lite in /etc/config/network. +Provides support for IPv4 over IPv6 (RFC2473 and DS-Lite) in /etc/config/network. Refer to http://wiki.openwrt.org/doc/uci/network for configuration details. endef diff --git a/package/network/ipv6/ds-lite/files/dslite.sh b/package/network/ipv6/ds-lite/files/dslite.sh index 017963926db62b..325401b98b55e3 100644 --- a/package/network/ipv6/ds-lite/files/dslite.sh +++ b/package/network/ipv6/ds-lite/files/dslite.sh @@ -1,6 +1,9 @@ #!/bin/sh -# dslite.sh - IPv4-in-IPv6 tunnel backend +# dslite.sh - IPv4-in-IPv6 tunnel backend for ipip6 and ds-lite # Copyright (c) 2013 OpenWrt.org +# Copyright (c) 2013 Steven Barth +# Copyright (c) 2021 Kenji Uno +# Copyright (c) 2024 Arayuki Mago [ -n "$INCLUDE_ONLY" ] || { . /lib/functions.sh @@ -9,10 +12,13 @@ init_proto "$@" } -proto_dslite_setup() { +tnl_setup() { local cfg="$1" local iface="$2" - local link="ds-$cfg" + local tnl_type="$3" + local ip4addr="$4" + local ip4gateway="$5" + local link="$tnl_type-$cfg" local remoteip6 local mtu ttl peeraddr ip6addr tunlink zone weakif encaplimit @@ -59,7 +65,7 @@ proto_dslite_setup() { proto_init_update "$link" 1 proto_add_ipv4_route "0.0.0.0" 0 - proto_add_ipv4_address "192.0.0.2" "" "" "192.0.0.1" + proto_add_ipv4_address "$ip4addr" "" "" "$ip4gateway" proto_add_tunnel json_add_string mode ipip6 @@ -76,23 +82,22 @@ proto_dslite_setup() { proto_add_data [ -n "$zone" ] && json_add_string zone "$zone" - json_add_array firewall - json_add_object "" - json_add_string type nat - json_add_string target ACCEPT - json_close_object - json_close_array + if [ "$tnl_type" = "ds" ]; then + json_add_array firewall + json_add_object "" + json_add_string type nat + json_add_string target ACCEPT + json_close_object + json_close_array + fi + proto_close_data proto_send_update "$cfg" } -proto_dslite_teardown() { - local cfg="$1" -} - -proto_dslite_init_config() { - no_device=1 +init_config() { + no_device=1 available=1 proto_config_add_string "ip6addr" @@ -105,6 +110,34 @@ proto_dslite_init_config() { proto_config_add_string "weakif" } +proto_ipip6_init_config() { + init_config + proto_config_add_string "ip4ifaddr" +} + +proto_ipip6_setup() { + local ip4ifaddr + json_get_vars ip4ifaddr + tnl_setup "$1" "$2" "ipip6" "$ip4ifaddr" "0.0.0.0" +} + +proto_ipip6_teardown() { + local cfg="$1" +} + +proto_dslite_init_config() { + init_config +} + +proto_dslite_setup() { + tnl_setup "$1" "$2" "ds" "192.0.0.2" "192.0.0.1" +} + +proto_dslite_teardown() { + local cfg="$1" +} + [ -n "$INCLUDE_ONLY" ] || { - add_protocol dslite + add_protocol ipip6 + add_protocol dslite } diff --git a/package/network/services/dnsmasq/Makefile b/package/network/services/dnsmasq/Makefile index 241f3463e2fb1f..9020278d533631 100644 --- a/package/network/services/dnsmasq/Makefile +++ b/package/network/services/dnsmasq/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=dnsmasq -PKG_UPSTREAM_VERSION:=2.89 +PKG_UPSTREAM_VERSION:=2.90 PKG_VERSION:=$(subst test,~~test,$(subst rc,~rc,$(PKG_UPSTREAM_VERSION))) -PKG_RELEASE:=7 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_UPSTREAM_VERSION).tar.xz PKG_SOURCE_URL:=https://thekelleys.org.uk/dnsmasq/ -PKG_HASH:=02bd230346cf0b9d5909f5e151df168b2707103785eb616b56685855adebb609 +PKG_HASH:=8e50309bd837bfec9649a812e066c09b6988b73d749b7d293c06c57d46a109e4 PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:=COPYING diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init index 510d328cd23bd1..138a913f87f3d9 100755 --- a/package/network/services/dnsmasq/files/dnsmasq.init +++ b/package/network/services/dnsmasq/files/dnsmasq.init @@ -502,7 +502,7 @@ dhcp_boot_add() { [ -n "$serveraddress" ] && [ ! -n "$servername" ] && return 0 - xappend "--dhcp-boot=${networkid:+net:$networkid,}${filename}${servername:+,$servername}${serveraddress:+,$serveraddress}" + xappend "--dhcp-boot=${networkid:+tag:$networkid,}${filename}${servername:+,$servername}${serveraddress:+,$serveraddress}" config_get_bool force "$cfg" force 0 @@ -1244,10 +1244,11 @@ dnsmasq_stop() add_interface_trigger() { - local interface ignore + local interface ifname ignore config_get interface "$1" interface config_get_bool ignore "$1" ignore 0 + network_get_device ifname "$interface" || ignore=0 [ -n "$interface" ] && [ $ignore -eq 0 ] && procd_add_interface_trigger "interface.*" "$interface" /etc/init.d/dnsmasq reload } diff --git a/package/network/services/dnsmasq/patches/200-ubus_dns.patch b/package/network/services/dnsmasq/patches/200-ubus_dns.patch index ccbe70ab9c3cef..c1694d55519fc3 100644 --- a/package/network/services/dnsmasq/patches/200-ubus_dns.patch +++ b/package/network/services/dnsmasq/patches/200-ubus_dns.patch @@ -1,6 +1,23 @@ +diff --git a/src/dnsmasq.c b/src/dnsmasq.c +index 30fb419..776351a 100644 +--- a/src/dnsmasq.c ++++ b/src/dnsmasq.c +@@ -2025,6 +2025,10 @@ static void check_dns_listeners(time_t now) + daemon->pipe_to_parent = pipefd[1]; + } + ++#ifdef HAVE_UBUS ++ drop_ubus_listeners(); ++#endif ++ + /* start with no upstream connections. */ + for (s = daemon->servers; s; s = s->next) + s->tcpfd = -1; +diff --git a/src/dnsmasq.h b/src/dnsmasq.h +index e455c3f..c84ba48 100644 --- a/src/dnsmasq.h +++ b/src/dnsmasq.h -@@ -1631,14 +1631,26 @@ void emit_dbus_signal(int action, struct +@@ -1673,14 +1673,26 @@ void emit_dbus_signal(int action, struct dhcp_lease *lease, char *hostname); /* ubus.c */ #ifdef HAVE_UBUS @@ -11,6 +28,7 @@ void set_ubus_listeners(void); void check_ubus_listeners(void); +void drop_ubus_listeners(void); ++int ubus_dns_notify_has_subscribers(void); +struct blob_buf *ubus_dns_notify_prepare(void); +int ubus_dns_notify(const char *type, ubus_dns_notify_cb cb, void *priv); void ubus_event_bcast(const char *type, const char *mac, const char *ip, const char *name, const char *interface); @@ -19,14 +37,28 @@ void ubus_event_bcast_connmark_allowlist_resolved(u32 mark, const char *pattern, const char *ip, u32 ttl); # endif +#else -+struct blob_buf; -+static inline struct blob_buf *ubus_dns_notify_prepare(void) ++static inline int ubus_dns_notify_has_subscribers(void) +{ -+ return NULL; ++ return 0; +} #endif /* ipset.c */ +diff --git a/src/forward.c b/src/forward.c +index 32f37e4..3d28963 100644 +--- a/src/forward.c ++++ b/src/forward.c +@@ -803,7 +803,7 @@ static size_t process_reply(struct dns_header *header, time_t now, struct server + cache_secure = 0; + } + +- if (daemon->doctors && do_doctor(header, n, daemon->namebuff)) ++ if ((daemon->doctors || ubus_dns_notify_has_subscribers()) && do_doctor(header, n, daemon->namebuff)) + cache_secure = 0; + + /* check_for_bogus_wildcard() does it's own caching, so +diff --git a/src/rfc1035.c b/src/rfc1035.c +index 387d894..7bf7967 100644 --- a/src/rfc1035.c +++ b/src/rfc1035.c @@ -13,8 +13,10 @@ @@ -41,7 +73,7 @@ int extract_name(struct dns_header *header, size_t plen, unsigned char **pp, char *name, int isExtract, int extrabytes) -@@ -394,9 +396,64 @@ static int private_net6(struct in6_addr +@@ -384,10 +386,65 @@ static int private_net6(struct in6_addr *a, int ban_localhost) ((u32 *)a)[0] == htonl(0x20010db8); /* RFC 6303 4.6 */ } @@ -100,14 +132,15 @@ +} +#endif + - static unsigned char *do_doctor(unsigned char *p, int count, struct dns_header *header, size_t qlen, int *doctored) + int do_doctor(struct dns_header *header, size_t qlen, char *namebuff) { + unsigned char *p; - int i, qtype, qclass, rdlen; + int i, qtype, qclass, rdlen, ttl; - - for (i = count; i != 0; i--) - { -@@ -405,7 +462,7 @@ static unsigned char *do_doctor(unsigned + int done = 0; + + if (!(p = skip_questions(header, qlen))) +@@ -404,7 +461,7 @@ int do_doctor(struct dns_header *header, size_t qlen, char *namebuff) GETSHORT(qtype, p); GETSHORT(qclass, p); @@ -116,53 +149,36 @@ GETSHORT(rdlen, p); if (qclass == C_IN && qtype == T_A) -@@ -416,6 +473,9 @@ static unsigned char *do_doctor(unsigned +@@ -415,6 +472,9 @@ int do_doctor(struct dns_header *header, size_t qlen, char *namebuff) if (!CHECK_LEN(header, p, qlen, INADDRSZ)) - return 0; + return done; + if (ubus_dns_doctor(daemon->namebuff, ttl, p, AF_INET)) -+ *doctored = 1; ++ header->hb3 &= ~HB3_AA; + /* alignment */ - memcpy(&addr, p, INADDRSZ); + memcpy(&addr.addr4, p, INADDRSZ); -@@ -433,13 +493,22 @@ static unsigned char *do_doctor(unsigned - addr.s_addr &= ~doctor->mask.s_addr; - addr.s_addr |= (doctor->out.s_addr & doctor->mask.s_addr); - /* Since we munged the data, the server it came from is no longer authoritative */ -- header->hb3 &= ~HB3_AA; - *doctored = 1; - memcpy(p, &addr, INADDRSZ); +@@ -444,6 +504,14 @@ int do_doctor(struct dns_header *header, size_t qlen, char *namebuff) break; } } -- + else if (qclass == C_IN && qtype == T_AAAA) + { + if (!CHECK_LEN(header, p, qlen, IN6ADDRSZ)) + return 0; + + if (ubus_dns_doctor(daemon->namebuff, ttl, p, AF_INET6)) -+ *doctored = 1; ++ header->hb3 &= ~HB3_AA; + } -+ -+ if (*doctored) -+ header->hb3 &= ~HB3_AA; + if (!ADD_RDLEN(header, p, qlen, rdlen)) - return 0; /* bad packet */ - } -@@ -570,7 +639,7 @@ int extract_addresses(struct dns_header - cache_start_insert(); - - /* find_soa is needed for dns_doctor side effects, so don't call it lazily if there are any. */ -- if (daemon->doctors || option_bool(OPT_DNSSEC_VALID)) -+ if (daemon->doctors || option_bool(OPT_DNSSEC_VALID) || ubus_dns_notify_prepare()) - { - searched_soa = 1; - ttl = find_soa(header, qlen, doctored); + return done; /* bad packet */ +diff --git a/src/ubus.c b/src/ubus.c +index a5758e7..f2a75a8 100644 --- a/src/ubus.c +++ b/src/ubus.c -@@ -72,6 +72,13 @@ static struct ubus_object ubus_object = +@@ -72,6 +72,13 @@ static struct ubus_object ubus_object = { .subscribe_cb = ubus_subscribe_cb, }; @@ -176,7 +192,7 @@ static void ubus_subscribe_cb(struct ubus_context *ctx, struct ubus_object *obj) { (void)ctx; -@@ -105,13 +112,21 @@ static void ubus_disconnect_cb(struct ub +@@ -105,13 +112,21 @@ static void ubus_disconnect_cb(struct ubus_context *ubus) char *ubus_init() { struct ubus_context *ubus = NULL; @@ -216,15 +232,18 @@ static int ubus_handle_metrics(struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req, const char *method, struct blob_attr *msg) -@@ -328,6 +354,50 @@ fail: +@@ -328,6 +354,53 @@ fail: } \ } while (0) -+struct blob_buf *ubus_dns_notify_prepare(void) ++int ubus_dns_notify_has_subscribers(void) +{ -+ struct ubus_context *ubus = (struct ubus_context *)daemon->ubus; ++ return (daemon->ubus && ubus_dns_object.has_subscribers); ++} + -+ if (!ubus || !ubus_dns_object.has_subscribers) ++struct blob_buf *ubus_dns_notify_prepare(void) ++{ ++ if (!ubus_dns_notify_has_subscribers()) + return NULL; + + blob_buf_init(&b, 0); @@ -267,16 +286,3 @@ void ubus_event_bcast(const char *type, const char *mac, const char *ip, const char *name, const char *interface) { struct ubus_context *ubus = (struct ubus_context *)daemon->ubus; ---- a/src/dnsmasq.c -+++ b/src/dnsmasq.c -@@ -2003,6 +2003,10 @@ static void check_dns_listeners(time_t n - daemon->pipe_to_parent = pipefd[1]; - } - -+#ifdef HAVE_UBUS -+ drop_ubus_listeners(); -+#endif -+ - /* start with no upstream connections. */ - for (s = daemon->servers; s; s = s->next) - s->tcpfd = -1; diff --git a/package/network/services/lldpd/Makefile b/package/network/services/lldpd/Makefile index 1f8d1e546b0d5c..18cdda33ce725e 100644 --- a/package/network/services/lldpd/Makefile +++ b/package/network/services/lldpd/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=lldpd PKG_VERSION:=1.0.17 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/lldpd/lldpd/releases/download/$(PKG_VERSION)/ @@ -31,7 +31,7 @@ define Package/lldpd CATEGORY:=Network SUBMENU:=Routing and Redirection TITLE:=Link Layer Discovery Protocol daemon - URL:=https://vincentbernat.github.io/lldpd/ + URL:=https://lldpd.github.io/ DEPENDS:=+libcap +libevent2 +USE_GLIBC:libbsd +LLDPD_WITH_JSON:libjson-c +LLDPD_WITH_SNMP:libnetsnmp USERID:=lldp=121:lldp=129 MENU:=1 diff --git a/package/network/services/lldpd/files/lldpd.config b/package/network/services/lldpd/files/lldpd.config index 5e7c51ba7e593c..6df3f73bf727e5 100644 --- a/package/network/services/lldpd/files/lldpd.config +++ b/package/network/services/lldpd/files/lldpd.config @@ -7,7 +7,9 @@ config lldpd config option agentxsocket /var/run/agentx.sock option lldp_class 4 - option lldp_location "2:FR:6:Commercial Rd:3:Roseville:19:4" + # lldp_policy only needed for lldp_class 2-3 + # option lldp_policy 'application streaming-video unknown' + option lldp_location "address country EU" # if empty, the distribution description is sent #option lldp_description "OpenWrt System" diff --git a/package/network/services/lldpd/files/lldpd.init b/package/network/services/lldpd/files/lldpd.init index f90b4a237cd0b6..67ee011ae23541 100644 --- a/package/network/services/lldpd/files/lldpd.init +++ b/package/network/services/lldpd/files/lldpd.init @@ -1,5 +1,6 @@ #!/bin/sh /etc/rc.common # Copyright (C) 2008-2015 OpenWrt.org +# shellcheck disable=1091,2034,3037,3043,3045 START=90 STOP=01 @@ -39,43 +40,44 @@ get_config_restart_hash() { config_load 'lldpd' config_get v 'config' 'lldp_class'; append _string "$v" "," - if [ "$CONFIG_LLDPD_WITH_SNMP" == "y" ]; then + if [ "$CONFIG_LLDPD_WITH_SNMP" = "y" ]; then config_get v 'config' 'agentxsocket'; append _string "$v" "," fi config_get v 'config' 'cid_interface'; append _string "$v" "," config_get v 'config' 'filter'; append _string "$v" "," config_get_bool v 'config' 'readonly_mode'; append _string "$v" "," config_get_bool v 'config' 'lldp_no_version'; append _string "$v" "," - if [ "$CONFIG_LLDPD_WITH_LLDPMED" == "y" ]; then + if [ "$CONFIG_LLDPD_WITH_LLDPMED" = "y" ]; then config_get_bool v 'config' 'lldpmed_no_inventory'; append _string "$v" "," fi config_get_bool v 'config' 'enable_lldp' 1; append _string "$v" "," config_get_bool v 'config' 'force_lldp'; append _string "$v" "," - if [ "$CONFIG_LLDPD_WITH_CDP" == "y" ]; then + if [ "$CONFIG_LLDPD_WITH_CDP" = "y" ]; then config_get_bool v 'config' 'enable_cdp'; append _string "$v" "," config_get v 'config' 'cdp_version'; append _string "$v" "," config_get_bool v 'config' 'force_cdp'; append _string "$v" "," config_get_bool v 'config' 'force_cdpv2'; append _string "$v" "," fi - if [ "$CONFIG_LLDPD_WITH_EDP" == "y" ]; then + if [ "$CONFIG_LLDPD_WITH_EDP" = "y" ]; then config_get_bool v 'config' 'enable_edp'; append _string "$v" "," config_get_bool v 'config' 'force_edp'; append _string "$v" "," fi - if [ "$CONFIG_LLDPD_WITH_FDP" == "y" ]; then + if [ "$CONFIG_LLDPD_WITH_FDP" = "y" ]; then config_get_bool v 'config' 'enable_fdp'; append _string "$v" "," config_get_bool v 'config' 'force_fdp'; append _string "$v" "," fi - if [ "$CONFIG_LLDPD_WITH_SONMP" == "y" ]; then + if [ "$CONFIG_LLDPD_WITH_SONMP" = "y" ]; then config_get_bool v 'config' 'enable_sonmp'; append _string "$v" "," config_get_bool v 'config' 'force_sonmp'; append _string "$v" "," fi - _hash=`echo -n "${_string}" | md5sum | awk '{ print \$1 }'` + _hash=$(echo -n "${_string}" | md5sum | awk '{ print $1 }') export -n "$var=$_hash" } get_config_cid_ifaces() { - local _ifacesCONFIG_LLDPD_WITH_FDP + local _ifaces + config_get _ifaces 'config' "$2" local _iface _ifnames="" for _iface in $_ifaces; do @@ -98,16 +100,8 @@ write_lldpd_conf() local lldp_hostname config_get lldp_hostname 'config' 'lldp_hostname' "$(cat /proc/sys/kernel/hostname)" - local ifaces - config_get ifaces 'config' 'interface' - - local iface ifnames="" - for iface in $ifaces; do - local ifname="" - if network_get_device ifname "$iface" || [ -e "/sys/class/net/$iface" ]; then - append ifnames "${ifname:-$iface}" "," - fi - done + local ifnames + get_config_cid_ifaces ifnames "interface" local lldp_mgmt_ip config_get lldp_mgmt_ip 'config' 'lldp_mgmt_ip' @@ -115,12 +109,22 @@ write_lldpd_conf() local lldp_syscapabilities config_get lldp_syscapabilities 'config' 'lldp_syscapabilities' - if [ "$CONFIG_LLDPD_WITH_LLDPMED" == "y" ]; then + if [ "$CONFIG_LLDPD_WITH_LLDPMED" = "y" ]; then local lldpmed_fast_start config_get_bool lldpmed_fast_start 'config' 'lldpmed_fast_start' 0 local lldpmed_fast_start_tx_interval config_get lldpmed_fast_start_tx_interval 'config' 'lldpmed_fast_start_tx_interval' 0 + + local lldp_location + config_get lldp_location 'config' 'lldp_location' + + local lldp_class + config_get lldp_class 'config' 'lldp_class' + + local lldp_policy + config_get lldp_policy 'config' 'lldp_policy' + fi local lldp_agenttype @@ -140,26 +144,39 @@ write_lldpd_conf() # Clear out the config file first echo -n > "$LLDPD_CONF" - [ -n "$ifnames" ] && echo "configure system interface pattern" "$ifnames" >> "$LLDPD_CONF" + [ -n "$ifnames" ] && echo "configure system interface pattern $ifnames" >> "$LLDPD_CONF" [ -n "$lldp_description" ] && echo "configure system description" "\"$lldp_description\"" >> "$LLDPD_CONF" [ -n "$lldp_hostname" ] && echo "configure system hostname" "\"$lldp_hostname\"" >> "$LLDPD_CONF" [ -n "$lldp_mgmt_ip" ] && echo "configure system ip management pattern" "\"$lldp_mgmt_ip\"" >> "$LLDPD_CONF" - [ -n "$lldp_syscapabilities" ] && echo "configure system capabilities enabled" "\"$lldp_syscapabilities\"" >> "$LLDPD_CONF" - if [ "$CONFIG_LLDPD_WITH_LLDPMED" == "y" ] && [ $lldpmed_fast_start -gt 0 ]; then - if [ $lldpmed_fast_start_tx_interval -gt 0 ]; then - echo "configure med fast-start tx-interval" "\"$lldpmed_fast_start_tx_interval\"" >> "$LLDPD_CONF" + [ -n "$lldp_syscapabilities" ] && echo "configure system capabilities enabled $lldp_syscapabilities" >> "$LLDPD_CONF" + if [ "$CONFIG_LLDPD_WITH_LLDPMED" = "y" ] && [ "$lldpmed_fast_start" -gt 0 ]; then + if [ "$lldpmed_fast_start_tx_interval" -gt 0 ]; then + echo "configure med fast-start tx-interval $lldpmed_fast_start_tx_interval" >> "$LLDPD_CONF" else - echo "configure med fast-start" "enable" >> "$LLDPD_CONF" + echo "configure med fast-start enable" >> "$LLDPD_CONF" fi fi + if [ "$CONFIG_LLDPD_WITH_LLDPMED" = "y" ]; then + # other 'configure med xxx' statements go here + + [ -n "$lldp_location" ] && echo "configure med location" "$lldp_location" >> "$LLDPD_CONF" + + # Manual states that if Class (-M) is 2 or 3, at least one network policy must be defined + case "$lldp_class" in + 2 | 3 ) [ -n "$lldp_policy" ] && echo "configure med policy $lldp_policy" >> "$LLDPD_CONF" + ;; + esac + + fi + [ -n "$lldp_agenttype" ] && echo "configure lldp agent-type" "\"$lldp_agenttype\"" >> "$LLDPD_CONF" [ -n "$lldp_portidsubtype" ] && echo "configure lldp portidsubtype" "\"$lldp_portidsubtype\"" >> "$LLDPD_CONF" [ -n "$lldp_platform" ] && echo "configure system platform" "\"$lldp_platform\"" >> "$LLDPD_CONF" - [ $lldp_tx_interval -gt 0 ] && echo "configure lldp tx-interval" "$lldp_tx_interval" >> "$LLDPD_CONF" - [ $lldp_tx_hold -gt 0 ] && echo "configure lldp tx-hold" "$lldp_tx_hold" >> "$LLDPD_CONF" + [ -n "$lldp_tx_interval" ] && echo "configure lldp tx-interval $lldp_tx_interval" >> "$LLDPD_CONF" + [ "$lldp_tx_hold" -gt 0 ] && echo "configure lldp tx-hold $lldp_tx_hold" >> "$LLDPD_CONF" # Since lldpd's sysconfdir is /tmp, we'll symlink /etc/lldpd.d to /tmp/$LLDPD_CONFS_DIR - [ -e $LLDPD_CONFS_DIR ] || ln -s /etc/lldpd.d $LLDPD_CONFS_DIR + [ -e "$LLDPD_CONFS_DIR" ] || ln -s /etc/lldpd.d "$LLDPD_CONFS_DIR" } start_service() { @@ -177,7 +194,6 @@ start_service() { local enable_edp local force_edp local lldp_class - local lldp_location local lldp_no_version local lldpmed_no_inventory local readonly_mode @@ -187,32 +203,31 @@ start_service() { config_load 'lldpd' config_get_bool enable_lldp 'config' 'enable_lldp' 1 config_get_bool force_lldp 'config' 'force_lldp' 0 - if [ "$CONFIG_LLDPD_WITH_CDP" == "y" ]; then + if [ "$CONFIG_LLDPD_WITH_CDP" = "y" ]; then config_get_bool enable_cdp 'config' 'enable_cdp' 0 config_get cdp_version 'config' 'cdp_version' 'cdpv1v2' config_get_bool force_cdp 'config' 'force_cdp' 0 config_get_bool force_cdpv2 'config' 'force_cdpv2' 0 fi - if [ "$CONFIG_LLDPD_WITH_FDP" == "y" ]; then + if [ "$CONFIG_LLDPD_WITH_FDP" = "y" ]; then config_get_bool enable_fdp 'config' 'enable_fdp' 0 config_get_bool force_fdp 'config' 'force_fdp' 0 fi - if [ "$CONFIG_LLDPD_WITH_SONMP" == "y" ]; then + if [ "$CONFIG_LLDPD_WITH_SONMP" = "y" ]; then config_get_bool enable_sonmp 'config' 'enable_sonmp' 0 config_get_bool force_sonmp 'config' 'force_sonmp' 0 fi - if [ "$CONFIG_LLDPD_WITH_EDP" == "y" ]; then + if [ "$CONFIG_LLDPD_WITH_EDP" = "y" ]; then config_get_bool enable_edp 'config' 'enable_edp' 0 config_get_bool force_edp 'config' 'force_edp' 0 fi config_get lldp_class 'config' 'lldp_class' - config_get lldp_location 'config' 'lldp_location' config_get_bool lldp_no_version 'config' 'lldp_no_version' 0 - if [ "$CONFIG_LLDPD_WITH_LLDPMED" == "y" ]; then + if [ "$CONFIG_LLDPD_WITH_LLDPMED" = "y" ]; then config_get_bool lldpmed_no_inventory 'config' 'lldpmed_no_inventory' 0 fi config_get_bool readonly_mode 'config' 'readonly_mode' 0 - if [ "$CONFIG_LLDPD_WITH_SNMP" == "y" ]; then + if [ "$CONFIG_LLDPD_WITH_SNMP" = "y" ]; then config_get agentxsocket 'config' 'agentxsocket' fi config_get filter 'config' 'filter' 15 @@ -227,8 +242,8 @@ start_service() { procd_set_param command ${LLDPDBIN} procd_append_param command -d - if [ $enable_lldp -gt 0 ]; then - if [ $force_lldp -gt 0 ]; then + if [ "$enable_lldp" -gt 0 ]; then + if [ "$force_lldp" -gt 0 ]; then procd_append_param command '-l' fi else @@ -236,20 +251,20 @@ start_service() { procd_append_param command '-ll' fi - if [ "$CONFIG_LLDPD_WITH_CDP" == "y" ] && [ $enable_cdp -gt 0 ]; then - if [ $cdp_version == "cdpv2" ]; then - if [ $force_cdp -gt 0 ]; then + if [ "$CONFIG_LLDPD_WITH_CDP" = "y" ] && [ "$enable_cdp" -gt 0 ]; then + if [ "$cdp_version" = "cdpv2" ]; then + if [ "$force_cdp" -gt 0 ]; then # CDPv1 disabled, CDPv2 forced procd_append_param command '-ccccc' else # CDPv1 disabled, CDPv2 enabled procd_append_param command '-cccc' fi - elif [ $cdp_version == "cdpv1v2" ]; then - if [ $force_cdp -gt 0 ] && [ $force_cdpv2 -gt 0 ]; then + elif [ "$cdp_version" = "cdpv1v2" ]; then + if [ "$force_cdp" -gt 0 ] && [ "$force_cdpv2" -gt 0 ]; then # CDPv1 enabled, CDPv2 forced procd_append_param command '-ccc' - elif [ $force_cdp -gt 0 ]; then + elif [ "$force_cdp" -gt 0 ]; then # CDPv1 forced, CDPv2 enabled procd_append_param command '-cc' else @@ -259,9 +274,9 @@ start_service() { fi fi - if [ "$CONFIG_LLDPD_WITH_FDP" == "y" ] && [ $enable_fdp -gt 0 ]; then - if [ $force_fdp -gt 0 ]; then - # FDP enbled and forced + if [ "$CONFIG_LLDPD_WITH_FDP" = "y" ] && [ "$enable_fdp" -gt 0 ]; then + if [ "$force_fdp" -gt 0 ]; then + # FDP enabled and forced procd_append_param command '-ff' else # FDP enabled @@ -269,8 +284,8 @@ start_service() { fi fi - if [ "$CONFIG_LLDPD_WITH_SONMP" == "y" ] && [ $enable_sonmp -gt 0 ]; then - if [ $force_sonmp -gt 0 ]; then + if [ "$CONFIG_LLDPD_WITH_SONMP" = "y" ] && [ "$enable_sonmp" -gt 0 ]; then + if [ "$force_sonmp" -gt 0 ]; then # SONMP enabled and forced procd_append_param command '-ss' else @@ -279,26 +294,27 @@ start_service() { fi fi - if [ "$CONFIG_LLDPD_WITH_EDP" == "y" ] && [ $enable_edp -gt 0 ]; then - if [ $force_edp -gt 0 ]; then - # EDP enbled and forced + if [ "$CONFIG_LLDPD_WITH_EDP" = "y" ] && [ "$enable_edp" -gt 0 ]; then + if [ "$force_edp" -gt 0 ]; then + # EDP enabled and forced procd_append_param command '-ee' else - # EDP enbled + # EDP enabled procd_append_param command '-e' fi fi - [ $readonly_mode -gt 0 ] && procd_append_param command '-r' - [ $lldp_no_version -gt 0 ] && procd_append_param commanpackage/network/services/lldpd/Makefile package/network/services/lldpd/files/lldpd.initd '-k' - [ "$CONFIG_LLDPD_WITH_LLDPMED" == "y" ] && [ $lldpmed_no_inventory -gt 0 ] && procd_append_param command '-i' + [ "$readonly_mode" -gt 0 ] && procd_append_param command '-r' + [ "$lldp_no_version" -gt 0 ] && procd_append_param command '-k' + [ "$CONFIG_LLDPD_WITH_LLDPMED" = "y" ] && [ "$lldpmed_no_inventory" -gt 0 ] && procd_append_param command '-i' [ -n "$lldp_class" ] && procd_append_param command -M "$lldp_class" - [ "$CONFIG_LLDPD_WITH_SNMP" == "y" ] && [ -n "$agentxsocket" ] && procd_append_param command -x -X "$agentxsocket" + [ "$CONFIG_LLDPD_WITH_SNMP" = "y" ] && [ -n "$agentxsocket" ] && procd_append_param command -x -X "$agentxsocket" [ -n "$filter" ] && procd_append_param command -H "$filter" # ChassisID interfaces local ifnames - get_config_cid_ifaces ifnames + get_config_cid_ifaces ifnames "cid_interface" + [ -n "$ifnames" ] && procd_append_param command -C "$ifnames" # Overwrite default configuration locations processed by lldpcli at start @@ -306,7 +322,7 @@ start_service() { local restart_hash get_config_restart_hash restart_hash - echo -n "$restart_hash" > $LLDPD_RESTART_HASH + echo -n "$restart_hash" > "$LLDPD_RESTART_HASH" # set auto respawn behavior procd_set_param respawn @@ -324,7 +340,7 @@ reload_service() { local config_hash="" get_config_restart_hash config_hash - if [ -f ${LLDPD_RESTART_HASH} ]; then running_hash=`cat $LLDPD_RESTART_HASH`; fi + [ -f ${LLDPD_RESTART_HASH} ] && running_hash=$(cat "$LLDPD_RESTART_HASH") if [ "x$running_hash" != "x$config_hash" ]; then # Restart LLDPd @@ -333,7 +349,7 @@ reload_service() { return 0 fi - $LLDPCLI -u $LLDPSOCKET &> /dev/null <<-EOF + $LLDPCLI -u "$LLDPSOCKET" 2>&1 /dev/null <<-EOF pause unconfigure lldp custom-tlv unconfigure system interface pattern @@ -342,8 +358,8 @@ reload_service() { unconfigure system ip management pattern unconfigure system platform EOF - if [ "$CONFIG_LLDPD_WITH_LLDPMED" == "y" ]; then - $LLDPCLI -u $LLDPSOCKET &> /dev/null <<-EOF + if [ "$CONFIG_LLDPD_WITH_LLDPMED" = "y" ]; then + $LLDPCLI -u "$LLDPSOCKET" 2>&1 /dev/null <<-EOF unconfigure med fast-start EOF @@ -351,9 +367,9 @@ reload_service() { # Rewrite lldpd.conf # If something changed it should be included by the lldpcli call write_lldpd_conf - $LLDPCLI -u $LLDPSOCKET -c $LLDPD_CONF -c $LLDPD_CONFS_DIR &> /dev/null + $LLDPCLI -u "$LLDPSOCKET" -c "$LLDPD_CONF" -c "$LLDPD_CONFS_DIR" 2>&1 /dev/null # Broadcast update over the wire - $LLDPCLI -u $LLDPSOCKET &> /dev/null <<-EOF + $LLDPCLI -u "$LLDPSOCKET" 2>&1 /dev/null <<-EOF resume update EOF @@ -361,6 +377,6 @@ reload_service() { } stop_service() { - rm -rf ${LLDPD_RUN} $LLDPSOCKET 2>/dev/null + rm -rf ${LLDPD_RUN} "$LLDPSOCKET" 2> /dev/null } diff --git a/package/network/services/umdns/files/umdns.init b/package/network/services/umdns/files/umdns.init index 1ae1cccb039ca3..7f25595f2493aa 100644 --- a/package/network/services/umdns/files/umdns.init +++ b/package/network/services/umdns/files/umdns.init @@ -8,7 +8,7 @@ PROG=/usr/sbin/umdns IFACES="" load_ifaces() { - local network="$(uci get umdns.@umdns[-1].network)" + local network="$(uci -q get umdns.@umdns[-1].network)" for n in $network; do local device json_load "$(ifstatus $n)" @@ -29,7 +29,7 @@ reload_service() { } start_service() { - local network="$(uci get umdns.@umdns[-1].network)" + local network="$(uci -q get umdns.@umdns[-1].network)" procd_open_instance procd_set_param command "$PROG" @@ -42,7 +42,7 @@ start_service() { done procd_add_raw_trigger "instance.update" 5000 "/bin/ubus" "call" "umdns" "reload" procd_close_trigger - [ "$(uci get umdns.@umdns[-1].jail)" = 1 ] && procd_add_jail umdns ubus log + [ "$(uci -q get umdns.@umdns[-1].jail)" = 1 ] && procd_add_jail umdns ubus log procd_close_instance } diff --git a/package/network/utils/iwinfo/Makefile b/package/network/utils/iwinfo/Makefile index 4fef2babbb2ac9..e1941ca3a8e538 100644 --- a/package/network/utils/iwinfo/Makefile +++ b/package/network/utils/iwinfo/Makefile @@ -11,9 +11,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/iwinfo.git -PKG_SOURCE_DATE:=2023-11-19 -PKG_SOURCE_VERSION:=a34977c0760c93480491c8eb94da656b57d7f4cc -PKG_MIRROR_HASH:=cb01671a2a9155f8ba55751ab1fe28488c5821212dd97ba5b79653640abb787e +PKG_SOURCE_DATE:=2024-03-08 +PKG_SOURCE_VERSION:=8ffb8bfd1115ae95265aa52590aa948aba7672e4 +PKG_MIRROR_HASH:=77bb6018b5001268c0f442dbfd8159893db620c575c9810221b1a42a30be4b5f PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=GPL-2.0 diff --git a/package/system/procd/Makefile b/package/system/procd/Makefile index 0af90c7d4ade35..5cbc44f0c060cd 100644 --- a/package/system/procd/Makefile +++ b/package/system/procd/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/procd.git -PKG_MIRROR_HASH:=48e5d555b5beb15cf936e1d2433b8e614de64a4eaf25293f0211eeb9ac79d534 -PKG_SOURCE_DATE:=2023-11-28 -PKG_SOURCE_VERSION:=7e6c6efd6fbcc7955801c5e2ac915a90697e1fd9 +PKG_MIRROR_HASH:=fc7ea415ebb1946661c1204a16b2a2b129014d39521da5883524e5ced8c3c9b4 +PKG_SOURCE_DATE:=2024-02-24 +PKG_SOURCE_VERSION:=1901aba90b6841ec1a99a25224a92d2519c603fd CMAKE_INSTALL:=1 PKG_LICENSE:=GPL-2.0 diff --git a/package/system/rpcd/Makefile b/package/system/rpcd/Makefile index 977932f9d1cf22..ef360a2c12b2c3 100644 --- a/package/system/rpcd/Makefile +++ b/package/system/rpcd/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/rpcd.git -PKG_MIRROR_HASH:=76467ff072b50190f93d071b7792ade7c717674397a2547e995a8f819a48954e -PKG_SOURCE_DATE:=2023-07-01 -PKG_SOURCE_VERSION:=c07ab2f91061ad64209e9aaa1fb1b77061a1af25 +PKG_MIRROR_HASH:=cf77c8aca75f893315620e2e3abf7fa02d8c8a21f54808b238973e43c66d0059 +PKG_SOURCE_DATE:=2024-02-22 +PKG_SOURCE_VERSION:=8ef4c2587ac0041049c67befed281a70cf240769 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC diff --git a/package/system/ubox/Makefile b/package/system/ubox/Makefile index e74ae00b3f08f5..adfb68e55b01e8 100644 --- a/package/system/ubox/Makefile +++ b/package/system/ubox/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ubox -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/ubox.git @@ -47,6 +47,7 @@ define Package/logd DEPENDS:=+libubox +libubus +libblobmsg-json +libudebug TITLE:=OpenWrt system log implementation USERID:=logd=514:logd=514 + ALTERNATIVES:=200:/sbin/logread:/usr/libexec/logread-ubox endef define Package/getrandom/install @@ -63,9 +64,10 @@ define Package/ubox/install endef define Package/logd/install - $(INSTALL_DIR) $(1)/sbin $(1)/etc/init.d/ $(1)/usr/share/acl.d + $(INSTALL_DIR) $(1)/sbin $(1)/usr/libexec/ $(1)/etc/init.d/ $(1)/usr/share/acl.d - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/{logd,logread} $(1)/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/logd $(1)/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/logread $(1)/usr/libexec/logread-ubox $(INSTALL_BIN) ./files/log.init $(1)/etc/init.d/log $(INSTALL_DATA) ./files/logd.json $(1)/usr/share/acl.d endef diff --git a/package/system/uci/Makefile b/package/system/uci/Makefile index 86bfdfb978365d..5d68b8905d9440 100644 --- a/package/system/uci/Makefile +++ b/package/system/uci/Makefile @@ -11,7 +11,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=uci PKG_RELEASE:=1 -PKG_SOURCE_URL:=$(PROJECT_GIT)/project/uci.git +PKG_SOURCE_URL=$(PROJECT_GIT)/project/uci.git PKG_SOURCE_PROTO:=git PKG_SOURCE_DATE:=2023-08-10 PKG_SOURCE_VERSION:=5781664d5087ccc4b5ab58505883231212dbedbc diff --git a/package/utils/e2fsprogs/Makefile b/package/utils/e2fsprogs/Makefile index 2657077a16be29..9e2f2fafe55345 100644 --- a/package/utils/e2fsprogs/Makefile +++ b/package/utils/e2fsprogs/Makefile @@ -34,7 +34,7 @@ define Package/e2fsprogs SUBMENU:=Filesystem TITLE:=Ext2/3/4 filesystem utilities URL:=http://e2fsprogs.sourceforge.net/ - DEPENDS:=+libuuid +libext2fs + DEPENDS:=+libuuid +libext2fs +libe2p endef define Package/e2fsprogs/description @@ -55,6 +55,20 @@ define Package/libext2fs/description libext2fs is a library which can access ext2, ext3 and ext4 filesystems. endef +define Package/libe2p + SECTION:=libs + CATEGORY:=Libraries + TITLE:=ext2fs userspace programs utility library + URL:=http://e2fsprogs.sourceforge.net/ + DEPENDS:=+libuuid + ABI_VERSION:=2 +endef + +define Package/libe2p/description + This package contains libe2p, ext2fs userspace programs utility library + bundled with e2fsprogs. +endef + define Package/libss SECTION:=libs CATEGORY:=Libraries @@ -184,13 +198,17 @@ endef define Build/InstallDev $(INSTALL_DIR) $(1)/usr/lib/pkgconfig + $(CP) $(PKG_BUILD_DIR)/lib/ext2fs/ext2fs.pc $(1)/usr/lib/pkgconfig $(CP) $(PKG_BUILD_DIR)/lib/et/com_err.pc $(1)/usr/lib/pkgconfig + $(CP) $(PKG_BUILD_DIR)/lib/e2p/e2p.pc $(1)/usr/lib/pkgconfig + $(CP) $(PKG_BUILD_DIR)/lib/ss/ss.pc $(1)/usr/lib/pkgconfig $(INSTALL_DIR) $(1)/usr/lib $(CP) $(PKG_BUILD_DIR)/lib/libext2fs.{so,a}* $(1)/usr/lib $(CP) $(PKG_BUILD_DIR)/lib/libcom_err.{so,a}* $(1)/usr/lib $(CP) $(PKG_BUILD_DIR)/lib/libss.{so,a}* $(1)/usr/lib + $(CP) $(PKG_BUILD_DIR)/lib/libe2p.{so,a}* $(1)/usr/lib $(INSTALL_DIR) $(1)/usr/include/ext2fs $(CP) $(PKG_BUILD_DIR)/lib/ext2fs/*.h $(1)/usr/include/ext2fs @@ -203,6 +221,8 @@ define Build/InstallDev $(PKG_BUILD_DIR)/lib/ss/ss.h \ $(PKG_BUILD_DIR)/lib/ss/ss_err.h \ $(1)/usr/include/ss/ + $(INSTALL_DIR) $(1)/usr/include/e2p + $(CP) $(PKG_BUILD_DIR)/lib/e2p/e2p.h $(1)/usr/include/e2p endef define Host/Compile @@ -237,13 +257,17 @@ define Package/e2fsprogs/install $(LN) e2fsck $(1)/usr/sbin/fsck.ext3 $(LN) e2fsck $(1)/usr/sbin/fsck.ext4 $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/libe2p.so.* $(1)/usr/lib/ $(INSTALL_DIR) $(1)/etc/init.d $(INSTALL_DIR) $(1)/lib/functions/fsck $(INSTALL_DATA) ./files/e2fsck.sh $(1)/lib/functions/fsck/ $(INSTALL_DATA) ./files/e2fsck.conf $(1)/etc/e2fsck.conf endef +define Package/libe2p/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libe2p.so.* $(1)/usr/lib/ +endef + define Package/libcomerr/install $(INSTALL_DIR) $(1)/usr/lib $(CP) $(PKG_INSTALL_DIR)/usr/lib/libcom_err.so.* $(1)/usr/lib/ @@ -318,6 +342,7 @@ endef $(eval $(call BuildPackage,libcomerr)) $(eval $(call BuildPackage,libss)) $(eval $(call BuildPackage,libext2fs)) +$(eval $(call BuildPackage,libe2p)) $(eval $(call BuildPackage,e2fsprogs)) $(eval $(call BuildPackage,tune2fs)) $(eval $(call BuildPackage,resize2fs)) diff --git a/package/utils/fitblk/Makefile b/package/utils/fitblk/Makefile index cb9e7ebb400ab6..4da4dc46f1fdca 100644 --- a/package/utils/fitblk/Makefile +++ b/package/utils/fitblk/Makefile @@ -16,7 +16,7 @@ define Package/fitblk SECTION:=base CATEGORY:=Base system TITLE:=fitblk firmware release tool - DEPENDS:=@LINUX_6_1 + DEPENDS:=@!LINUX_5_15 endef define Package/fitblk/description diff --git a/package/utils/ucode/Makefile b/package/utils/ucode/Makefile index 51a378198ce7a5..e18f53ea322d63 100644 --- a/package/utils/ucode/Makefile +++ b/package/utils/ucode/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=https://github.com/jow-/ucode.git -PKG_SOURCE_DATE:=2024-02-13 -PKG_SOURCE_VERSION:=3f9811d2f7b730f1f1d030872ae1def7e8349be6 -PKG_MIRROR_HASH:=b05cdaa6ecaf8c4b79e67551085c5580d09c5940304b5837a859324abbb26e94 +PKG_SOURCE_DATE:=2024-02-21 +PKG_SOURCE_VERSION:=ba3855ae3775197f3594fc2615cac539075bd2fb +PKG_MIRROR_HASH:=82b8a73417575b58a234586354eba4d0b10180a80b441cd87a9a554227304d34 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC diff --git a/scripts/config/.gitignore b/scripts/config/.gitignore index 05c55c3c8e58e2..1cef9de10fbf75 100644 --- a/scripts/config/.gitignore +++ b/scripts/config/.gitignore @@ -1,16 +1,14 @@ # SPDX-License-Identifier: GPL-2.0-only /conf /[gmnq]conf -/[gmnq]conf-cfg +/[gmnq]conf-bin +/[gmnq]conf-cflags +/[gmnq]conf-libs /qconf-moc.cc -# From linux kconfig parent directories -.* - -# OpenWrt-generated files +# +# Added by openwrt +# mconf_check - -# Temporary files from older versions. They should be removed after the -# end of support for OpenWrt 19.07. -zconf.???.c -zconf.hash.c +# The next line should be removed after 23.05 is EOL +*conf-cfg diff --git a/scripts/config/Kbuild.include b/scripts/config/Kbuild.include new file mode 100644 index 00000000000000..7778cc97a4e042 --- /dev/null +++ b/scripts/config/Kbuild.include @@ -0,0 +1,279 @@ +# SPDX-License-Identifier: GPL-2.0 +#### +# kbuild: Generic definitions + +# Convenient variables +comma := , +quote := " +squote := ' +empty := +space := $(empty) $(empty) +space_escape := _-_SPACE_-_ +pound := \# +define newline + + +endef + +### +# Comparison macros. +# Usage: $(call test-lt, $(CONFIG_LLD_VERSION), 150000) +# +# Use $(intcmp ...) if supported. (Make >= 4.4) +# Otherwise, fall back to the 'test' shell command. +ifeq ($(intcmp 1,0,,,y),y) +test-ge = $(intcmp $(strip $1)0, $(strip $2)0,,y,y) +test-gt = $(intcmp $(strip $1)0, $(strip $2)0,,,y) +else +test-ge = $(shell test $(strip $1)0 -ge $(strip $2)0 && echo y) +test-gt = $(shell test $(strip $1)0 -gt $(strip $2)0 && echo y) +endif +test-le = $(call test-ge, $2, $1) +test-lt = $(call test-gt, $2, $1) + +### +# Name of target with a '.' as filename prefix. foo/bar.o => foo/.bar.o +dot-target = $(dir $@).$(notdir $@) + +### +# Name of target with a '.tmp_' as filename prefix. foo/bar.o => foo/.tmp_bar.o +tmp-target = $(dir $@).tmp_$(notdir $@) + +### +# The temporary file to save gcc -MMD generated dependencies must not +# contain a comma +depfile = $(subst $(comma),_,$(dot-target).d) + +### +# filename of target with directory and extension stripped +basetarget = $(basename $(notdir $@)) + +### +# real prerequisites without phony targets +real-prereqs = $(filter-out $(PHONY), $^) + +### +# Escape single quote for use in echo statements +escsq = $(subst $(squote),'\$(squote)',$1) + +### +# Quote a string to pass it to C files. foo => '"foo"' +stringify = $(squote)$(quote)$1$(quote)$(squote) + +### +# The path to Kbuild or Makefile. Kbuild has precedence over Makefile. +kbuild-dir = $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) +kbuild-file = $(or $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Makefile) + +### +# Read a file, replacing newlines with spaces +# +# Make 4.2 or later can read a file by using its builtin function. +ifneq ($(filter-out 3.% 4.0 4.1, $(MAKE_VERSION)),) +read-file = $(subst $(newline),$(space),$(file < $1)) +else +read-file = $(shell cat $1 2>/dev/null) +endif + +### +# Easy method for doing a status message + kecho := : + quiet_kecho := echo +silent_kecho := : +kecho := $($(quiet)kecho) + +### +# filechk is used to check if the content of a generated file is updated. +# Sample usage: +# +# filechk_sample = echo $(KERNELRELEASE) +# version.h: FORCE +# $(call filechk,sample) +# +# The rule defined shall write to stdout the content of the new file. +# The existing file will be compared with the new one. +# - If no file exist it is created +# - If the content differ the new file is used +# - If they are equal no change, and no timestamp update +define filechk + $(check-FORCE) + $(Q)set -e; \ + mkdir -p $(dir $@); \ + trap "rm -f $(tmp-target)" EXIT; \ + { $(filechk_$(1)); } > $(tmp-target); \ + if [ ! -r $@ ] || ! cmp -s $@ $(tmp-target); then \ + $(kecho) ' UPD $@'; \ + mv -f $(tmp-target) $@; \ + fi +endef + +### +# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj= +# Usage: +# $(Q)$(MAKE) $(build)=dir +build := -f $(srctree)/scripts/Makefile.build obj + +### +# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.dtbinst obj= +# Usage: +# $(Q)$(MAKE) $(dtbinst)=dir +dtbinst := -f $(srctree)/scripts/Makefile.dtbinst obj + +### +# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj= +# Usage: +# $(Q)$(MAKE) $(clean)=dir +clean := -f $(srctree)/scripts/Makefile.clean obj + +# pring log +# +# If quiet is "silent_", print nothing and sink stdout +# If quiet is "quiet_", print short log +# If quiet is empty, print short log and whole command +silent_log_print = exec >/dev/null; + quiet_log_print = $(if $(quiet_cmd_$1), echo ' $(call escsq,$(quiet_cmd_$1)$(why))';) + log_print = echo '$(pound) $(call escsq,$(or $(quiet_cmd_$1),cmd_$1 $@)$(why))'; \ + echo ' $(call escsq,$(cmd_$1))'; + +# Delete the target on interruption +# +# GNU Make automatically deletes the target if it has already been changed by +# the interrupted recipe. So, you can safely stop the build by Ctrl-C (Make +# will delete incomplete targets), and resume it later. +# +# However, this does not work when the stderr is piped to another program, like +# $ make >&2 | tee log +# Make dies with SIGPIPE before cleaning the targets. +# +# To address it, we clean the target in signal traps. +# +# Make deletes the target when it catches SIGHUP, SIGINT, SIGQUIT, SIGTERM. +# So, we cover them, and also SIGPIPE just in case. +# +# Of course, this is unneeded for phony targets. +delete-on-interrupt = \ + $(if $(filter-out $(PHONY), $@), \ + $(foreach sig, HUP INT QUIT TERM PIPE, \ + trap 'rm -f $@; trap - $(sig); kill -s $(sig) $$$$' $(sig);)) + +# print and execute commands +cmd = @$(if $(cmd_$(1)),set -e; $($(quiet)log_print) $(delete-on-interrupt) $(cmd_$(1)),:) + +### +# if_changed - execute command if any prerequisite is newer than +# target, or command line has changed +# if_changed_dep - as if_changed, but uses fixdep to reveal dependencies +# including used config symbols +# if_changed_rule - as if_changed but execute rule instead +# See Documentation/kbuild/makefiles.rst for more info + +ifneq ($(KBUILD_NOCMDDEP),1) +# Check if both commands are the same including their order. Result is empty +# string if equal. User may override this check using make KBUILD_NOCMDDEP=1 +# If the target does not exist, the *.cmd file should not be included so +# $(savedcmd_$@) gets empty. Then, target will be built even if $(newer-prereqs) +# happens to become empty. +cmd-check = $(filter-out $(subst $(space),$(space_escape),$(strip $(savedcmd_$@))), \ + $(subst $(space),$(space_escape),$(strip $(cmd_$1)))) +else +# We still need to detect missing targets. +cmd-check = $(if $(strip $(savedcmd_$@)),,1) +endif + +# Replace >$< with >$$< to preserve $ when reloading the .cmd file +# (needed for make) +# Replace >#< with >$(pound)< to avoid starting a comment in the .cmd file +# (needed for make) +# Replace >'< with >'\''< to be able to enclose the whole string in '...' +# (needed for the shell) +make-cmd = $(call escsq,$(subst $(pound),$$(pound),$(subst $$,$$$$,$(cmd_$(1))))) + +# Find any prerequisites that are newer than target or that do not exist. +# PHONY targets skipped in both cases. +# If there is no prerequisite other than phony targets, $(newer-prereqs) becomes +# empty even if the target does not exist. cmd-check saves this corner case. +newer-prereqs = $(filter-out $(PHONY),$?) + +# It is a typical mistake to forget the FORCE prerequisite. Check it here so +# no more breakage will slip in. +check-FORCE = $(if $(filter FORCE, $^),,$(warning FORCE prerequisite is missing)) + +if-changed-cond = $(newer-prereqs)$(cmd-check)$(check-FORCE) + +# Execute command if command has changed or prerequisite(s) are updated. +if_changed = $(if $(if-changed-cond),$(cmd_and_savecmd),@:) + +cmd_and_savecmd = \ + $(cmd); \ + printf '%s\n' 'savedcmd_$@ := $(make-cmd)' > $(dot-target).cmd + +# Execute the command and also postprocess generated .d dependencies file. +if_changed_dep = $(if $(if-changed-cond),$(cmd_and_fixdep),@:) + +cmd_and_fixdep = \ + $(cmd); \ + scripts/basic/fixdep $(depfile) $@ '$(make-cmd)' > $(dot-target).cmd;\ + rm -f $(depfile) + +# Usage: $(call if_changed_rule,foo) +# Will check if $(cmd_foo) or any of the prerequisites changed, +# and if so will execute $(rule_foo). +if_changed_rule = $(if $(if-changed-cond),$(rule_$(1)),@:) + +### +# why - tell why a target got built +# enabled by make V=2 +# Output (listed in the order they are checked): +# (1) - due to target is PHONY +# (2) - due to target missing +# (3) - due to: file1.h file2.h +# (4) - due to command line change +# (5) - due to missing .cmd file +# (6) - due to target not in $(targets) +# (1) PHONY targets are always build +# (2) No target, so we better build it +# (3) Prerequisite is newer than target +# (4) The command line stored in the file named dir/.target.cmd +# differed from actual command line. This happens when compiler +# options changes +# (5) No dir/.target.cmd file (used to store command line) +# (6) No dir/.target.cmd file and target not listed in $(targets) +# This is a good hint that there is a bug in the kbuild file +ifneq ($(findstring 2, $(KBUILD_VERBOSE)),) +_why = \ + $(if $(filter $@, $(PHONY)),- due to target is PHONY, \ + $(if $(wildcard $@), \ + $(if $(newer-prereqs),- due to: $(newer-prereqs), \ + $(if $(cmd-check), \ + $(if $(savedcmd_$@),- due to command line change, \ + $(if $(filter $@, $(targets)), \ + - due to missing .cmd file, \ + - due to $(notdir $@) not in $$(targets) \ + ) \ + ) \ + ) \ + ), \ + - due to target missing \ + ) \ + ) + +why = $(space)$(strip $(_why)) +endif + +############################################################################### + +# delete partially updated (i.e. corrupted) files on error +.DELETE_ON_ERROR: + +# do not delete intermediate files automatically +# +# .NOTINTERMEDIATE is more correct, but only available on newer Make versions. +# Make 4.4 introduced .NOTINTERMEDIATE, and it appears in .FEATURES, but the +# global .NOTINTERMEDIATE does not work. We can use it on Make > 4.4. +# Use .SECONDARY for older Make versions, but "newer-prereq" cannot detect +# deleted files. +ifneq ($(and $(filter notintermediate, $(.FEATURES)),$(filter-out 4.4,$(MAKE_VERSION))),) +.NOTINTERMEDIATE: +else +.SECONDARY: +endif diff --git a/scripts/config/Makefile b/scripts/config/Makefile index 5976a91b9abf8d..5e7dd9578ecfee 100644 --- a/scripts/config/Makefile +++ b/scripts/config/Makefile @@ -5,46 +5,21 @@ .PHONY: clean all all: conf mconf clean: - rm -f *.o lxdialog/*.o *.moc .*.cmd $(clean-files) + rm -f $(clean-files) $(hostprogs) -# This clean-files definition is here to ensure that temporary files from the -# previous version are removed by make config-clean. -# It should be emptied after the end of support for OpenWrt 19.07. -clean-files := zconf.tab.c zconf.lex.c zconf.hash.c .tmp_qtcheck +clean-files := *.o lxdialog/*.o *.moc qconf-moc.cc \ + *conf-cfg # <- This should be removed after 23.05 is EOL # =========================================================================== # Variables needed by the upstream Makefile -# Avoids displaying 'UPD mconf-cfg' in an otherwise quiet make menuconfig -kecho:=true - +export HOSTPKG_CONFIG=pkg-config CONFIG_SHELL:=$(SHELL) -srctree:=. -src:=. +src:=$(CURDIR) obj:=. Q:=$(if $V,,@) -cmd = $(cmd_$(1)) - -# some definitions taken from ../Kbuild.include -dot-target = $(dir $@).$(notdir $@) -squote := ' -escsq = $(subst $(squote),'\$(squote)',$1) -define filechk - $(Q)set -e; \ - mkdir -p $(dir $@); \ - trap "rm -f $(dot-target).tmp" EXIT; \ - { $(filechk_$(1)); } > $(dot-target).tmp; \ - if [ ! -r $@ ] || ! cmp -s $@ $(dot-target).tmp; then \ - $(kecho) ' UPD $@'; \ - mv -f $(dot-target).tmp $@; \ - fi -endef -cmd-check = $(if $(strip $(cmd_$@)),,1) -make-cmd = $(call escsq,$(subst $(pound),$$(pound),$(subst $$,$$$$,$(cmd_$(1))))) -newer-prereqs = $(filter-out $(PHONY),$?) -if_changed = $(if $(newer-prereqs)$(cmd-check), \ - $(cmd); \ - printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd, @:) +quiet:=$(if $V,,_silent) +include Kbuild.include ### Stripped down upstream Makefile follows: # =========================================================================== @@ -64,11 +39,12 @@ conf-objs := conf.o $(common-objs) hostprogs += nconf nconf-objs := nconf.o nconf.gui.o $(common-objs) -HOSTLDLIBS_nconf = $(shell . $(obj)/nconf-cfg && echo $$libs) -HOSTCFLAGS_nconf.o = $(shell . $(obj)/nconf-cfg && echo $$cflags) -HOSTCFLAGS_nconf.gui.o = $(shell . $(obj)/nconf-cfg && echo $$cflags) +HOSTLDLIBS_nconf = $(call read-file, $(obj)/nconf-libs) +HOSTCFLAGS_nconf.o = $(call read-file, $(obj)/nconf-cflags) +HOSTCFLAGS_nconf.gui.o = $(call read-file, $(obj)/nconf-cflags) -$(obj)/nconf.o $(obj)/nconf.gui.o: $(obj)/nconf-cfg +$(obj)/nconf: | $(obj)/nconf-libs +$(obj)/nconf.o $(obj)/nconf.gui.o: | $(obj)/nconf-cflags # mconf: Used for the menuconfig target based on lxdialog hostprogs += mconf @@ -76,45 +52,44 @@ lxdialog := $(addprefix lxdialog/, \ checklist.o inputbox.o menubox.o textbox.o util.o yesno.o) mconf-objs := mconf.o $(lxdialog) $(common-objs) -HOSTLDLIBS_mconf = $(shell . $(obj)/mconf-cfg && echo $$libs) +HOSTLDLIBS_mconf = $(call read-file, $(obj)/mconf-libs) $(foreach f, mconf.o $(lxdialog), \ - $(eval HOSTCFLAGS_$f = $$(shell . $(obj)/mconf-cfg && echo $$$$cflags))) + $(eval HOSTCFLAGS_$f = $$(call read-file, $(obj)/mconf-cflags))) -$(addprefix $(obj)/, mconf.o $(lxdialog)): $(obj)/mconf-cfg +$(obj)/mconf: | $(obj)/mconf-libs +$(addprefix $(obj)/, mconf.o $(lxdialog)): | $(obj)/mconf-cflags # qconf: Used for the xconfig target based on Qt hostprogs += qconf qconf-cxxobjs := qconf.o qconf-moc.o qconf-objs := images.o $(common-objs) -HOSTLDLIBS_qconf = $(shell . $(obj)/qconf-cfg && echo $$libs) -HOSTCXXFLAGS_qconf.o = $(shell . $(obj)/qconf-cfg && echo $$cflags) -HOSTCXXFLAGS_qconf-moc.o = $(shell . $(obj)/qconf-cfg && echo $$cflags) - -$(obj)/qconf.o: $(obj)/qconf-cfg +HOSTLDLIBS_qconf = $(call read-file, $(obj)/qconf-libs) +HOSTCXXFLAGS_qconf.o = -std=c++11 -fPIC $(call read-file, $(obj)/qconf-cflags) +HOSTCXXFLAGS_qconf-moc.o = -std=c++11 -fPIC $(call read-file, $(obj)/qconf-cflags) +$(obj)/qconf: | $(obj)/qconf-libs +$(obj)/qconf.o $(obj)/qconf-moc.o: | $(obj)/qconf-cflags quiet_cmd_moc = MOC $@ - cmd_moc = $(shell . $(obj)/qconf-cfg && echo $$moc) $< -o $@ + cmd_moc = $(call read-file, $(obj)/qconf-bin)/moc $< -o $@ -$(obj)/qconf-moc.cc: $(src)/qconf.h $(obj)/qconf-cfg FORCE +$(obj)/qconf-moc.cc: $(src)/qconf.h FORCE | $(obj)/qconf-bin $(call if_changed,moc) targets += qconf-moc.cc # check if necessary packages are available, and configure build flags -filechk_conf_cfg = $(CONFIG_SHELL) $< +cmd_conf_cfg = $< $(addprefix $(obj)/$*conf-, cflags libs bin); touch $(obj)/$*conf-bin -$(obj)/%conf-cfg: $(src)/%conf-cfg.sh FORCE - $(call filechk,conf_cfg) +$(obj)/%conf-cflags $(obj)/%conf-libs $(obj)/%conf-bin: $(src)/%conf-cfg.sh + $(call cmd,conf_cfg) -clean-files += *conf-cfg +clean-files += *conf-cflags *conf-libs *conf-bin # =========================================================================== # OpenWrt rules and final adjustments that need to be made after reading the # full upstream Makefile -clean-files += $(targets) $(hostprogs) - FORCE: ifdef BUILD_SHIPPED_FILES @@ -130,25 +105,21 @@ clean-files += $(shipped-files) flex -L -o$@ $< endif -$(foreach f,$(conf-objs) $(filter-out $(common-objs),$(mconf-objs) \ - $(qconf-objs) \ - $(nconf-objs)), \ - $(eval $(obj)/$f: CFLAGS+=$$(HOSTCFLAGS_$f))) - -$(foreach f,$(qconf-cxxobjs), \ - $(eval $(obj)/$f: CXXFLAGS+=$$(HOSTCXXFLAGS_$f))) +define link_rule +$(1): LDLIBS+=$$(HOSTLDLIBS_$(1)) +$(1): $($(1)-objs) $$($(1)-cxxobjs) +$(if $($(1)-cxxobjs), $(CXX) $$(LDFLAGS) -o $$@ $$^ $$(LDLIBS)) +all-objs += $($(1)-objs) +all-cxxobjs += $($(1)-cxxobjs) +endef -$(obj)/conf: $(addprefix $(obj)/,$(conf-objs)) +all-objs:= +all-cxxobjs:= +$(foreach f,$(hostprogs),$(eval $(call link_rule,$f))) -# The *conf-cfg file is used (then filtered out) as the first prerequisite to -# avoid sourcing it before the script is built, when trying to compute CFLAGS -# for the actual first prerequisite. This avoids errors like: -# '/bin/sh: ./mconf-cfg: No such file or directory' -$(obj)/mconf: mconf-cfg $(addprefix $(obj)/,$(mconf-objs)) - $(CC) -o $@ $(filter-out mconf-cfg,$^) $(HOSTLDLIBS_mconf) -$(obj)/nconf: nconf-cfg $(addprefix $(obj)/,$(nconf-objs)) - $(CC) -o $@ $(filter-out nconf-cfg,$^) $(HOSTLDLIBS_nconf) +$(foreach f,$(sort $(all-objs)), \ + $(eval $f: CFLAGS+=$$(HOSTCFLAGS_$f))) -$(obj)/qconf: qconf-cfg $(addprefix $(obj)/,$(qconf-cxxobjs) $(qconf-objs)) - $(CXX) -o $@ $(filter-out qconf-cfg,$^) $(HOSTLDLIBS_qconf) +$(foreach f,$(sort $(all-cxxobjs)), \ + $(eval $f: CXXFLAGS+=$$(HOSTCXXFLAGS_$f))) diff --git a/scripts/config/README b/scripts/config/README index 99a7d535ab25d2..e1ebf89cbf1dd4 100644 --- a/scripts/config/README +++ b/scripts/config/README @@ -1,6 +1,7 @@ -These files were taken from the Linux 5.14 Kernel Configuration System and -modified for the OpenWrt Buildroot: - - Removed nconf, gconf, tests and kernel configuration targets. +These files were taken from the Linux Kernel Configuration System v6.6.16, +at commit eb3e299184cc4f40d4bd84fda269b3a20ddcff80 (Feb 5, 2024), and modified +for the OpenWrt Buildroot: + - Removed gconf, tests and kernel configuration targets. - Adjusted the Makefile to compile outside the kernel. - Always use default file when running make all{no,mod,yes}config. - Added a 'reset' command to reset config when the target changes. @@ -23,4 +24,4 @@ modified for the OpenWrt Buildroot: BUILD_SHIPPED_FILES defined For a full list of changes, see the repository at: -https://github.com/cotequeiroz/linux/commits/openwrt-5.14/scripts/kconfig +https://github.com/cotequeiroz/linux/commits/openwrt-v6.6.16/scripts/kconfig diff --git a/scripts/config/conf.c b/scripts/config/conf.c index 978abebe654555..1bd6f4fa8ba612 100644 --- a/scripts/config/conf.c +++ b/scripts/config/conf.c @@ -35,6 +35,7 @@ enum input_mode { olddefconfig, yes2modconfig, mod2yesconfig, + mod2noconfig, fatalrecursive, }; static enum input_mode input_mode = oldaskconfig; @@ -164,8 +165,6 @@ enum conf_def_mode { def_default, def_yes, def_mod, - def_y2m, - def_m2y, def_no, def_random }; @@ -303,12 +302,10 @@ static bool conf_set_all_new_symbols(enum conf_def_mode mode) return has_changed; } -static void conf_rewrite_mod_or_yes(enum conf_def_mode mode) +static void conf_rewrite_tristates(tristate old_val, tristate new_val) { struct symbol *sym; int i; - tristate old_val = (mode == def_y2m) ? yes : mod; - tristate new_val = (mode == def_y2m) ? mod : yes; for_all_symbols(i, sym) { if (sym_get_type(sym) == S_TRISTATE && @@ -555,7 +552,7 @@ static int conf_choice(struct menu *menu) print_help(child); continue; } - sym_set_choice_value(sym, child->sym); + sym_set_tristate_value(child->sym, yes); for (child = child->list; child; child = child->next) { indent += 2; conf(child); @@ -647,19 +644,8 @@ static void check_conf(struct menu *menu) switch (input_mode) { case listnewconfig: - if (sym->name) { - const char *str; - - if (sym->type == S_STRING) { - str = sym_get_string_value(sym); - str = sym_escape_string_value(str); - printf("%s%s=%s\n", CONFIG_, sym->name, str); - free((void *)str); - } else { - str = sym_get_string_value(sym); - printf("%s%s=%s\n", CONFIG_, sym->name, str); - } - } + if (sym->name) + print_symbol_for_listconfig(sym); break; case helpnewconfig: printf("-----\n"); @@ -697,7 +683,8 @@ static const struct option long_opts[] = { {"olddefconfig", no_argument, &input_mode_opt, olddefconfig}, {"yes2modconfig", no_argument, &input_mode_opt, yes2modconfig}, {"mod2yesconfig", no_argument, &input_mode_opt, mod2yesconfig}, - {"fatalrecursive",no_argument, NULL, fatalrecursive}, + {"mod2noconfig", no_argument, &input_mode_opt, mod2noconfig}, + {"fatalrecursive",no_argument, &input_mode_opt, fatalrecursive}, {NULL, 0, NULL, 0} }; @@ -707,8 +694,10 @@ static void conf_usage(const char *progname) printf("\n"); printf("Generic options:\n"); printf(" -h, --help Print this message and exit.\n"); + printf(" -r Read as input.\n"); printf(" -s, --silent Do not print log.\n"); - printf(" --fatalrecursive Treat recursive depenendencies as a fatal error\n"); + printf(" -w Write config to .\n"); + printf(" --fatalrecursive Treat recursive dependency as error.\n"); printf("\n"); printf("Mode options:\n"); printf(" --listnewconfig List new options\n"); @@ -727,6 +716,7 @@ static void conf_usage(const char *progname) printf(" --randconfig New config with random answer to all options\n"); printf(" --yes2modconfig Change answers from yes to mod if possible\n"); printf(" --mod2yesconfig Change answers from mod to yes if possible\n"); + printf(" --mod2noconfig Change answers from mod to no if possible\n"); printf(" (If none of the above is given, --oldaskconfig is the default)\n"); } @@ -740,27 +730,23 @@ int main(int ac, char **av) tty_stdio = isatty(0) && isatty(1); - while ((opt = getopt_long(ac, av, "hr:sw:", long_opts, NULL)) != -1) { + while ((opt = getopt_long(ac, av, "hr:w:s", long_opts, NULL)) != -1) { switch (opt) { case 'h': conf_usage(progname); exit(1); break; - case 's': - conf_set_message_callback(NULL); - break; - case fatalrecursive: - recursive_is_error = 1; - continue; case 'r': input_file = optarg; break; + case 's': + conf_set_message_callback(NULL); + break; case 'w': output_file = optarg; break; case 0: - input_mode = input_mode_opt; - switch (input_mode) { + switch (input_mode_opt) { case syncconfig: /* * syncconfig is invoked during the build stage. @@ -777,9 +763,13 @@ int main(int ac, char **av) case randconfig: set_randconfig_seed(); break; + case fatalrecursive: + recursive_is_error = 1; + continue; default: break; } + input_mode = input_mode_opt; default: break; } @@ -812,6 +802,7 @@ int main(int ac, char **av) case olddefconfig: case yes2modconfig: case mod2yesconfig: + case mod2noconfig: case allnoconfig: case allyesconfig: case allmodconfig: @@ -858,10 +849,13 @@ int main(int ac, char **av) case savedefconfig: break; case yes2modconfig: - conf_rewrite_mod_or_yes(def_y2m); + conf_rewrite_tristates(yes, mod); break; case mod2yesconfig: - conf_rewrite_mod_or_yes(def_m2y); + conf_rewrite_tristates(mod, yes); + break; + case mod2noconfig: + conf_rewrite_tristates(mod, no); break; case oldaskconfig: rootEntry = &rootmenu; diff --git a/scripts/config/confdata.c b/scripts/config/confdata.c index dad0b471c7df31..e3f6fdfeb324e8 100644 --- a/scripts/config/confdata.c +++ b/scripts/config/confdata.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -129,41 +130,22 @@ static size_t depfile_prefix_len; /* touch depfile for symbol 'name' */ static int conf_touch_dep(const char *name) { - int fd, ret; - char *d; + int fd; /* check overflow: prefix + name + '\0' must fit in buffer. */ if (depfile_prefix_len + strlen(name) + 1 > sizeof(depfile_path)) return -1; - d = depfile_path + depfile_prefix_len; - strcpy(d, name); + strcpy(depfile_path + depfile_prefix_len, name); - /* Assume directory path already exists. */ fd = open(depfile_path, O_WRONLY | O_CREAT | O_TRUNC, 0644); - if (fd == -1) { - if (errno != ENOENT) - return -1; - - ret = make_parent_dir(depfile_path); - if (ret) - return ret; - - /* Try it again. */ - fd = open(depfile_path, O_WRONLY | O_CREAT | O_TRUNC, 0644); - if (fd == -1) - return -1; - } + if (fd == -1) + return -1; close(fd); return 0; } -struct conf_printer { - void (*print_symbol)(FILE *, struct symbol *, const char *, void *); - void (*print_comment)(FILE *, const char *, void *); -}; - static void conf_warning(const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); @@ -227,6 +209,20 @@ static const char *conf_get_autoconfig_name(void) return name ? name : "include/config/auto.conf"; } +static const char *conf_get_autoheader_name(void) +{ + char *name = getenv("KCONFIG_AUTOHEADER"); + + return name ? name : "include/generated/autoconf.h"; +} + +static const char *conf_get_rustccfg_name(void) +{ + char *name = getenv("KCONFIG_RUSTCCFG"); + + return name ? name : "include/generated/rustc_cfg"; +} + static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) { char *p2; @@ -255,19 +251,21 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) p, sym->name); return 1; case S_STRING: - if (*p++ != '"') - break; - for (p2 = p; (p2 = strpbrk(p2, "\"\\")); p2++) { - if (*p2 == '"') { - *p2 = 0; + /* No escaping for S_DEF_AUTO (include/config/auto.conf) */ + if (def != S_DEF_AUTO) { + if (*p++ != '"') break; + for (p2 = p; (p2 = strpbrk(p2, "\"\\")); p2++) { + if (*p2 == '"') { + *p2 = 0; + break; + } + memmove(p2, p2 + 1, strlen(p2)); } - memmove(p2, p2 + 1, strlen(p2)); - } - if (!p2) { - if (def != S_DEF_AUTO) + if (!p2) { conf_warning("invalid string found"); - return 1; + return 1; + } } /* fall through */ case S_INT: @@ -376,7 +374,11 @@ int conf_read_simple(const char *name, int def) char *p, *p2; struct symbol *sym; int def_flags; + const char *warn_unknown; + const char *werror; + warn_unknown = getenv("KCONFIG_WARN_UNKNOWN_SYMBOLS"); + werror = getenv("KCONFIG_WERROR"); if (name) { in = zconf_fopen(name); } else { @@ -448,6 +450,10 @@ int conf_read_simple(const char *name, int def) if (def == S_DEF_USER) { sym = sym_find(line + 2 + strlen(CONFIG_)); if (!sym) { + if (warn_unknown) + conf_warning("unknown symbol: %s", + line + 2 + strlen(CONFIG_)); + conf_set_changed(true); continue; } @@ -479,7 +485,7 @@ int conf_read_simple(const char *name, int def) sym = sym_find(line + strlen(CONFIG_)); if (!sym) { - if (def == S_DEF_AUTO) + if (def == S_DEF_AUTO) { /* * Reading from include/config/auto.conf * If CONFIG_FOO previously existed in @@ -487,8 +493,13 @@ int conf_read_simple(const char *name, int def) * include/config/FOO must be touched. */ conf_touch_dep(line + strlen(CONFIG_)); - else + } else { + if (warn_unknown) + conf_warning("unknown symbol: %s", + line + strlen(CONFIG_)); + conf_set_changed(true); + } continue; } @@ -524,6 +535,10 @@ int conf_read_simple(const char *name, int def) } free(line); fclose(in); + + if (conf_warnings && werror) + exit(1); + return 0; } @@ -597,169 +612,226 @@ int conf_read(const char *name) return 0; } -/* - * Kconfig configuration printer - * - * This printer is used when generating the resulting configuration after - * kconfig invocation and `defconfig' files. Unset symbol might be omitted by - * passing a non-NULL argument to the printer. - * - */ -static void -kconfig_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg) +struct comment_style { + const char *decoration; + const char *prefix; + const char *postfix; +}; + +static const struct comment_style comment_style_pound = { + .decoration = "#", + .prefix = "#", + .postfix = "#", +}; + +static const struct comment_style comment_style_c = { + .decoration = " *", + .prefix = "/*", + .postfix = " */", +}; + +static void conf_write_heading(FILE *fp, const struct comment_style *cs) { + if (!cs) + return; - switch (sym->type) { - case S_BOOLEAN: - case S_TRISTATE: - if (*value == 'n') { - bool skip_unset = (arg != NULL); + fprintf(fp, "%s\n", cs->prefix); - if (!skip_unset) - fprintf(fp, "# %s%s is not set\n", - CONFIG_, sym->name); - return; - } - break; - default: - break; - } + fprintf(fp, "%s Automatically generated file; DO NOT EDIT.\n", + cs->decoration); + + fprintf(fp, "%s %s\n", cs->decoration, rootmenu.prompt->text); - fprintf(fp, "%s%s=%s\n", CONFIG_, sym->name, value); + fprintf(fp, "%s\n", cs->postfix); } -static void -kconfig_print_comment(FILE *fp, const char *value, void *arg) +/* The returned pointer must be freed on the caller side */ +static char *escape_string_value(const char *in) { - const char *p = value; - size_t l; + const char *p; + char *out; + size_t len; - for (;;) { - l = strcspn(p, "\n"); - fprintf(fp, "#"); - if (l) { - fprintf(fp, " "); - xfwrite(p, l, 1, fp); - p += l; - } - fprintf(fp, "\n"); - if (*p++ == '\0') + len = strlen(in) + strlen("\"\"") + 1; + + p = in; + while (1) { + p += strcspn(p, "\"\\"); + + if (p[0] == '\0') break; + + len++; + p++; + } + + out = xmalloc(len); + out[0] = '\0'; + + strcat(out, "\""); + + p = in; + while (1) { + len = strcspn(p, "\"\\"); + strncat(out, p, len); + p += len; + + if (p[0] == '\0') + break; + + strcat(out, "\\"); + strncat(out, p++, 1); } + + strcat(out, "\""); + + return out; } -static struct conf_printer kconfig_printer_cb = +enum output_n { OUTPUT_N, OUTPUT_N_AS_UNSET, OUTPUT_N_NONE }; + +static void __print_symbol(FILE *fp, struct symbol *sym, enum output_n output_n, + bool escape_string) { - .print_symbol = kconfig_print_symbol, - .print_comment = kconfig_print_comment, -}; + const char *val; + char *escaped = NULL; -/* - * Header printer - * - * This printer is used when generating the `include/generated/autoconf.h' file. - */ -static void -header_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg) + if (sym->type == S_UNKNOWN) + return; + + val = sym_get_string_value(sym); + + if ((sym->type == S_BOOLEAN || sym->type == S_TRISTATE) && + output_n != OUTPUT_N && *val == 'n') { + if (output_n == OUTPUT_N_AS_UNSET) + fprintf(fp, "# %s%s is not set\n", CONFIG_, sym->name); + return; + } + + if (sym->type == S_STRING && escape_string) { + escaped = escape_string_value(val); + val = escaped; + } + + fprintf(fp, "%s%s=%s\n", CONFIG_, sym->name, val); + + free(escaped); +} + +static void print_symbol_for_dotconfig(FILE *fp, struct symbol *sym) { + __print_symbol(fp, sym, OUTPUT_N_AS_UNSET, true); +} + +static void print_symbol_for_autoconf(FILE *fp, struct symbol *sym) +{ + __print_symbol(fp, sym, OUTPUT_N_NONE, false); +} + +void print_symbol_for_listconfig(struct symbol *sym) +{ + __print_symbol(stdout, sym, OUTPUT_N, true); +} + +static void print_symbol_for_c(FILE *fp, struct symbol *sym) +{ + const char *val; + const char *sym_suffix = ""; + const char *val_prefix = ""; + char *escaped = NULL; + + if (sym->type == S_UNKNOWN) + return; + + val = sym_get_string_value(sym); switch (sym->type) { case S_BOOLEAN: - case S_TRISTATE: { - const char *suffix = ""; - - switch (*value) { + case S_TRISTATE: + switch (*val) { case 'n': - break; + return; case 'm': - suffix = "_MODULE"; + sym_suffix = "_MODULE"; /* fall through */ default: - fprintf(fp, "#define %s%s%s 1\n", - CONFIG_, sym->name, suffix); + val = "1"; } break; - } - case S_HEX: { - const char *prefix = ""; - - if (value[0] != '0' || (value[1] != 'x' && value[1] != 'X')) - prefix = "0x"; - fprintf(fp, "#define %s%s %s%s\n", - CONFIG_, sym->name, prefix, value); + case S_HEX: + if (val[0] != '0' || (val[1] != 'x' && val[1] != 'X')) + val_prefix = "0x"; break; - } case S_STRING: - case S_INT: - fprintf(fp, "#define %s%s %s\n", - CONFIG_, sym->name, value); - break; + escaped = escape_string_value(val); + val = escaped; default: break; } -} - -static void -header_print_comment(FILE *fp, const char *value, void *arg) -{ - const char *p = value; - size_t l; + fprintf(fp, "#define %s%s%s %s%s\n", CONFIG_, sym->name, sym_suffix, + val_prefix, val); - fprintf(fp, "/*\n"); - for (;;) { - l = strcspn(p, "\n"); - fprintf(fp, " *"); - if (l) { - fprintf(fp, " "); - xfwrite(p, l, 1, fp); - p += l; - } - fprintf(fp, "\n"); - if (*p++ == '\0') - break; - } - fprintf(fp, " */\n"); + free(escaped); } -static struct conf_printer header_printer_cb = +static void print_symbol_for_rustccfg(FILE *fp, struct symbol *sym) { - .print_symbol = header_print_symbol, - .print_comment = header_print_comment, -}; + const char *val; + const char *val_prefix = ""; + char *val_prefixed = NULL; + size_t val_prefixed_len; + char *escaped = NULL; -static void conf_write_symbol(FILE *fp, struct symbol *sym, - struct conf_printer *printer, void *printer_arg) -{ - const char *str; + if (sym->type == S_UNKNOWN) + return; + + val = sym_get_string_value(sym); switch (sym->type) { - case S_UNKNOWN: + case S_BOOLEAN: + case S_TRISTATE: + /* + * We do not care about disabled ones, i.e. no need for + * what otherwise are "comments" in other printers. + */ + if (*val == 'n') + return; + + /* + * To have similar functionality to the C macro `IS_ENABLED()` + * we provide an empty `--cfg CONFIG_X` here in both `y` + * and `m` cases. + * + * Then, the common `fprintf()` below will also give us + * a `--cfg CONFIG_X="y"` or `--cfg CONFIG_X="m"`, which can + * be used as the equivalent of `IS_BUILTIN()`/`IS_MODULE()`. + */ + fprintf(fp, "--cfg=%s%s\n", CONFIG_, sym->name); break; - case S_STRING: - str = sym_get_string_value(sym); - str = sym_escape_string_value(str); - printer->print_symbol(fp, sym, str, printer_arg); - free((void *)str); + case S_HEX: + if (val[0] != '0' || (val[1] != 'x' && val[1] != 'X')) + val_prefix = "0x"; break; default: - str = sym_get_string_value(sym); - printer->print_symbol(fp, sym, str, printer_arg); + break; } -} -static void -conf_write_heading(FILE *fp, struct conf_printer *printer, void *printer_arg) -{ - char buf[256]; + if (strlen(val_prefix) > 0) { + val_prefixed_len = strlen(val) + strlen(val_prefix) + 1; + val_prefixed = xmalloc(val_prefixed_len); + snprintf(val_prefixed, val_prefixed_len, "%s%s", val_prefix, val); + val = val_prefixed; + } + + /* All values get escaped: the `--cfg` option only takes strings */ + escaped = escape_string_value(val); + val = escaped; - snprintf(buf, sizeof(buf), - "\n" - "Automatically generated file; DO NOT EDIT.\n" - "%s\n", - rootmenu.prompt->text); + fprintf(fp, "--cfg=%s%s=%s\n", CONFIG_, sym->name, val); - printer->print_comment(fp, buf, printer_arg); + free(escaped); + free(val_prefixed); } /* @@ -818,7 +890,7 @@ int conf_write_defconfig(const char *filename) goto next_menu; } } - conf_write_symbol(out, sym, &kconfig_printer_cb, NULL); + print_symbol_for_dotconfig(out, sym); } next_menu: if (menu->list != NULL) { @@ -878,7 +950,7 @@ int conf_write(const char *name) if (!out) return 1; - conf_write_heading(out, &kconfig_printer_cb, NULL); + conf_write_heading(out, &comment_style_pound); if (!conf_get_changed()) sym_clear_all_valid(); @@ -905,7 +977,7 @@ int conf_write(const char *name) need_newline = false; } sym->flags |= SYMBOL_WRITTEN; - conf_write_symbol(out, sym, &kconfig_printer_cb, NULL); + print_symbol_for_dotconfig(out, sym); } next: @@ -913,19 +985,20 @@ int conf_write(const char *name) menu = menu->list; continue; } - if (menu->next) + +end_check: + if (!menu->sym && menu_is_visible(menu) && menu != &rootmenu && + menu->prompt->type == P_MENU) { + fprintf(out, "# end of %s\n", menu_get_prompt(menu)); + need_newline = true; + } + + if (menu->next) { menu = menu->next; - else while ((menu = menu->parent)) { - if (!menu->sym && menu_is_visible(menu) && - menu != &rootmenu) { - str = menu_get_prompt(menu); - fprintf(out, "# end of %s\n", str); - need_newline = true; - } - if (menu->next) { - menu = menu->next; - break; - } + } else { + menu = menu->parent; + if (menu) + goto end_check; } } fclose(out); @@ -955,45 +1028,69 @@ int conf_write(const char *name) } /* write a dependency file as used by kbuild to track dependencies */ -static int conf_write_dep(const char *name) +static int conf_write_autoconf_cmd(const char *autoconf_name) { + char name[PATH_MAX], tmp[PATH_MAX]; struct file *file; FILE *out; + int ret; - out = fopen("..config.tmp", "w"); - if (!out) - return 1; - fprintf(out, "deps_config := \\\n"); - for (file = file_list; file; file = file->next) { - if (file->next) - fprintf(out, "\t%s \\\n", file->name); - else - fprintf(out, "\t%s\n", file->name); + ret = snprintf(name, sizeof(name), "%s.cmd", autoconf_name); + if (ret >= sizeof(name)) /* check truncation */ + return -1; + + if (make_parent_dir(name)) + return -1; + + ret = snprintf(tmp, sizeof(tmp), "%s.cmd.tmp", autoconf_name); + if (ret >= sizeof(tmp)) /* check truncation */ + return -1; + + out = fopen(tmp, "w"); + if (!out) { + perror("fopen"); + return -1; } - fprintf(out, "\n%s: \\\n" - "\t$(deps_config)\n\n", conf_get_autoconfig_name()); - env_write_dep(out, conf_get_autoconfig_name()); + fprintf(out, "deps_config := \\\n"); + for (file = file_list; file; file = file->next) + fprintf(out, "\t%s \\\n", file->name); + + fprintf(out, "\n%s: $(deps_config)\n\n", autoconf_name); + + env_write_dep(out, autoconf_name); fprintf(out, "\n$(deps_config): ;\n"); + + fflush(out); + ret = ferror(out); /* error check for all fprintf() calls */ fclose(out); + if (ret) + return -1; + + if (rename(tmp, name)) { + perror("rename"); + return -1; + } - if (make_parent_dir(name)) - return 1; - rename("..config.tmp", name); return 0; } static int conf_touch_deps(void) { - const char *name; + const char *name, *tmp; struct symbol *sym; int res, i; - strcpy(depfile_path, "include/config/"); - depfile_prefix_len = strlen(depfile_path); - name = conf_get_autoconfig_name(); + tmp = strrchr(name, '/'); + depfile_prefix_len = tmp ? tmp - name + 1 : 0; + if (depfile_prefix_len + 1 > sizeof(depfile_path)) + return -1; + + strncpy(depfile_path, name, depfile_prefix_len); + depfile_path[depfile_prefix_len] = 0; + conf_read_simple(name, S_DEF_AUTO); sym_calc_value(modules_sym); @@ -1056,13 +1153,54 @@ static int conf_touch_deps(void) return 0; } +static int __conf_write_autoconf(const char *filename, + void (*print_symbol)(FILE *, struct symbol *), + const struct comment_style *comment_style) +{ + char tmp[PATH_MAX]; + FILE *file; + struct symbol *sym; + int ret, i; + + if (make_parent_dir(filename)) + return -1; + + ret = snprintf(tmp, sizeof(tmp), "%s.tmp", filename); + if (ret >= sizeof(tmp)) /* check truncation */ + return -1; + + file = fopen(tmp, "w"); + if (!file) { + perror("fopen"); + return -1; + } + + conf_write_heading(file, comment_style); + + for_all_symbols(i, sym) + if ((sym->flags & SYMBOL_WRITE) && sym->name) + print_symbol(file, sym); + + fflush(file); + /* check possible errors in conf_write_heading() and print_symbol() */ + ret = ferror(file); + fclose(file); + if (ret) + return -1; + + if (rename(tmp, filename)) { + perror("rename"); + return -1; + } + + return 0; +} + int conf_write_autoconf(int overwrite) { struct symbol *sym; - const char *name; const char *autoconf_name = conf_get_autoconfig_name(); - FILE *out, *out_h; - int i; + int ret, i; #ifndef OPENWRT_DOES_NOT_WANT_THIS return 0; @@ -1070,52 +1208,38 @@ int conf_write_autoconf(int overwrite) if (!overwrite && is_present(autoconf_name)) return 0; - conf_write_dep("include/config/auto.conf.cmd"); + ret = conf_write_autoconf_cmd(autoconf_name); + if (ret) + return -1; if (conf_touch_deps()) return 1; - out = fopen(".tmpconfig", "w"); - if (!out) - return 1; - - out_h = fopen(".tmpconfig.h", "w"); - if (!out_h) { - fclose(out); - return 1; - } - - conf_write_heading(out, &kconfig_printer_cb, NULL); - conf_write_heading(out_h, &header_printer_cb, NULL); - - for_all_symbols(i, sym) { + for_all_symbols(i, sym) sym_calc_value(sym); - if (!(sym->flags & SYMBOL_WRITE) || !sym->name) - continue; - /* write symbols to auto.conf and autoconf.h */ - conf_write_symbol(out, sym, &kconfig_printer_cb, (void *)1); - conf_write_symbol(out_h, sym, &header_printer_cb, NULL); - } - fclose(out); - fclose(out_h); + ret = __conf_write_autoconf(conf_get_autoheader_name(), + print_symbol_for_c, + &comment_style_c); + if (ret) + return ret; - name = getenv("KCONFIG_AUTOHEADER"); - if (!name) - name = "include/generated/autoconf.h"; - if (make_parent_dir(name)) - return 1; - if (rename(".tmpconfig.h", name)) - return 1; + ret = __conf_write_autoconf(conf_get_rustccfg_name(), + print_symbol_for_rustccfg, + NULL); + if (ret) + return ret; - if (make_parent_dir(autoconf_name)) - return 1; /* - * This must be the last step, kbuild has a dependency on auto.conf - * and this marks the successful completion of the previous steps. + * Create include/config/auto.conf. This must be the last step because + * Kbuild has a dependency on auto.conf and this marks the successful + * completion of the previous steps. */ - if (rename(".tmpconfig", autoconf_name)) - return 1; + ret = __conf_write_autoconf(conf_get_autoconfig_name(), + print_symbol_for_autoconf, + &comment_style_pound); + if (ret) + return ret; return 0; } @@ -1125,10 +1249,12 @@ static void (*conf_changed_callback)(void); void conf_set_changed(bool val) { - if (conf_changed_callback && conf_changed != val) - conf_changed_callback(); + bool changed = conf_changed != val; conf_changed = val; + + if (conf_changed_callback && changed) + conf_changed_callback(); } bool conf_get_changed(void) diff --git a/scripts/config/expr.h b/scripts/config/expr.h index c2fa804fe11402..005e27f130e16c 100644 --- a/scripts/config/expr.h +++ b/scripts/config/expr.h @@ -276,7 +276,6 @@ struct jump_key { struct list_head entries; size_t offset; struct menu *target; - int index; }; extern struct file *file_list; diff --git a/scripts/config/lexer.l b/scripts/config/lexer.l index 0df51ec468a7ab..e73b262539eb1a 100644 --- a/scripts/config/lexer.l +++ b/scripts/config/lexer.l @@ -86,8 +86,7 @@ static void warn_ignored_character(char chr) n [A-Za-z0-9_-] %% - int str = 0; - int ts, i; + char open_quote = 0; #.* /* ignore comment */ [ \t]* /* whitespaces */ @@ -137,7 +136,7 @@ n [A-Za-z0-9_-] ":=" return T_COLON_EQUAL; "+=" return T_PLUS_EQUAL; \"|\' { - str = yytext[0]; + open_quote = yytext[0]; new_string(); BEGIN(STRING); } @@ -174,7 +173,7 @@ n [A-Za-z0-9_-] append_string(yytext + 1, yyleng - 1); } \'|\" { - if (str == yytext[0]) { + if (open_quote == yytext[0]) { BEGIN(INITIAL); yylval.string = text; return T_WORD_QUOTE; @@ -199,6 +198,8 @@ n [A-Za-z0-9_-] { [ \t]+ { + int ts, i; + ts = 0; for (i = 0; i < yyleng; i++) { if (yytext[i] == '\t') diff --git a/scripts/config/lexer.lex.c b/scripts/config/lexer.lex.c index 826c06e4e7bdd0..c57119fa235caa 100644 --- a/scripts/config/lexer.lex.c +++ b/scripts/config/lexer.lex.c @@ -14,6 +14,7 @@ /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ + #include #include #include @@ -30,8 +31,8 @@ #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L -/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, - * if you want the limit (max/min) macros for int types. +/* C++ systems might need __STDC_LIMIT_MACROS defined before including + * , if you want the limit (max/min) macros for int types. */ #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS 1 @@ -2538,8 +2539,7 @@ YY_DECL { - int str = 0; - int ts, i; + char open_quote = 0; while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { @@ -2772,7 +2772,7 @@ return T_PLUS_EQUAL; case 48: YY_RULE_SETUP { - str = yytext[0]; + open_quote = yytext[0]; new_string(); BEGIN(STRING); } @@ -2837,7 +2837,7 @@ YY_RULE_SETUP case 58: YY_RULE_SETUP { - if (str == yytext[0]) { + if (open_quote == yytext[0]) { BEGIN(INITIAL); yylval.string = text; return T_WORD_QUOTE; @@ -2869,6 +2869,8 @@ case YY_STATE_EOF(STRING): case 60: YY_RULE_SETUP { + int ts, i; + ts = 0; for (i = 0; i < yyleng; i++) { if (yytext[i] == '\t') diff --git a/scripts/config/lkc.h b/scripts/config/lkc.h index a7b18b227635b7..1c8717de78e2c5 100644 --- a/scripts/config/lkc.h +++ b/scripts/config/lkc.h @@ -77,7 +77,7 @@ struct gstr str_new(void); void str_free(struct gstr *gs); void str_append(struct gstr *gs, const char *s); void str_printf(struct gstr *gs, const char *fmt, ...); -const char *str_get(struct gstr *gs); +char *str_get(struct gstr *gs); /* menu.c */ void _menu_init(void); @@ -100,10 +100,10 @@ bool menu_is_empty(struct menu *menu); bool menu_is_visible(struct menu *menu); bool menu_has_prompt(struct menu *menu); const char *menu_get_prompt(struct menu *menu); -struct menu *menu_get_root_menu(struct menu *menu); struct menu *menu_get_parent_menu(struct menu *menu); bool menu_has_help(struct menu *menu); const char *menu_get_help(struct menu *menu); +int get_jump_key_char(void); struct gstr get_relations_str(struct symbol **sym_arr, struct list_head *head); void menu_get_ext_help(struct menu *menu, struct gstr *help); @@ -126,11 +126,6 @@ static inline struct symbol *sym_get_choice_value(struct symbol *sym) return (struct symbol *)sym->curr.val; } -static inline bool sym_set_choice_value(struct symbol *ch, struct symbol *chval) -{ - return sym_set_tristate_value(chval, yes); -} - static inline bool sym_is_choice(struct symbol *sym) { return sym->flags & SYMBOL_CHOICE ? true : false; diff --git a/scripts/config/lkc_proto.h b/scripts/config/lkc_proto.h index ebedd230b32cc1..4babf6435a1980 100644 --- a/scripts/config/lkc_proto.h +++ b/scripts/config/lkc_proto.h @@ -19,7 +19,7 @@ extern struct symbol * symbol_hash[SYMBOL_HASHSIZE]; struct symbol * sym_lookup(const char *name, int flags); struct symbol * sym_find(const char *name); -const char * sym_escape_string_value(const char *in); +void print_symbol_for_listconfig(struct symbol *sym); struct symbol ** sym_re_search(const char *pattern); const char * sym_type_name(enum symbol_type type); void sym_calc_value(struct symbol *sym); diff --git a/scripts/config/lxdialog/dialog.h b/scripts/config/lxdialog/dialog.h index 3930d93a4adf0d..3128bd6d7664d7 100644 --- a/scripts/config/lxdialog/dialog.h +++ b/scripts/config/lxdialog/dialog.h @@ -18,22 +18,6 @@ #endif #include -/* - * Colors in ncurses 1.9.9e do not work properly since foreground and - * background colors are OR'd rather than separately masked. This version - * of dialog was hacked to work with ncurses 1.9.9e, making it incompatible - * with standard curses. The simplest fix (to make this work with standard - * curses) uses the wbkgdset() function, not used in the original hack. - * Turn it off if we're building with 1.9.9e, since it just confuses things. - */ -#if defined(NCURSES_VERSION) && defined(_NEED_WRAP) && !defined(GCC_PRINTFLIKE) -#define OLD_NCURSES 1 -#undef wbkgdset -#define wbkgdset(w,p) /*nothing */ -#else -#define OLD_NCURSES 0 -#endif - #define TR(params) _tracef params #define KEY_ESC 27 @@ -212,27 +196,12 @@ int first_alpha(const char *string, const char *exempt); int dialog_yesno(const char *title, const char *prompt, int height, int width); int dialog_msgbox(const char *title, const char *prompt, int height, int width, int pause); - - -typedef void (*update_text_fn)(char *buf, size_t start, size_t end, void - *_data); -int dialog_textbox(const char *title, char *tbuf, int initial_height, - int initial_width, int *keys, int *_vscroll, int *_hscroll, - update_text_fn update_text, void *data); +int dialog_textbox(const char *title, const char *tbuf, int initial_height, + int initial_width, int *_vscroll, int *_hscroll, + int (*extra_key_cb)(int, size_t, size_t, void *), void *data); int dialog_menu(const char *title, const char *prompt, const void *selected, int *s_scroll); int dialog_checklist(const char *title, const char *prompt, int height, int width, int list_height); int dialog_inputbox(const char *title, const char *prompt, int height, int width, const char *init); - -/* - * This is the base for fictitious keys, which activate - * the buttons. - * - * Mouse-generated keys are the following: - * -- the first 32 are used as numbers, in addition to '0'-'9' - * -- the lowercase are used to signal mouse-enter events (M_EVENT + 'o') - * -- uppercase chars are used to invoke the button (M_EVENT + 'O') - */ -#define M_EVENT (KEY_MAX+1) diff --git a/scripts/config/lxdialog/menubox.c b/scripts/config/lxdialog/menubox.c index 428774556674e6..bcdf3bbac99a8a 100644 --- a/scripts/config/lxdialog/menubox.c +++ b/scripts/config/lxdialog/menubox.c @@ -63,15 +63,7 @@ static void do_print_item(WINDOW * win, const char *item, int line_y, /* Clear 'residue' of last item */ wattrset(win, dlg.menubox.atr); wmove(win, line_y, 0); -#if OLD_NCURSES - { - int i; - for (i = 0; i < menu_width; i++) - waddch(win, ' '); - } -#else wclrtoeol(win); -#endif wattrset(win, selected ? dlg.item_selected.atr : dlg.item.atr); mvwaddstr(win, line_y, item_x, menu_item); if (hotkey) { diff --git a/scripts/config/lxdialog/textbox.c b/scripts/config/lxdialog/textbox.c index b5987735b06cd5..e02acb7493100d 100644 --- a/scripts/config/lxdialog/textbox.c +++ b/scripts/config/lxdialog/textbox.c @@ -8,41 +8,149 @@ #include "dialog.h" -static void back_lines(int n); -static void print_page(WINDOW *win, int height, int width, update_text_fn - update_text, void *data); -static void print_line(WINDOW *win, int row, int width); -static char *get_line(void); -static void print_position(WINDOW * win); - static int hscroll; static int begin_reached, end_reached, page_length; -static char *buf; -static char *page; +static const char *buf, *page; +static size_t start, end; + +/* + * Go back 'n' lines in text. Called by dialog_textbox(). + * 'page' will be updated to point to the desired line in 'buf'. + */ +static void back_lines(int n) +{ + int i; + + begin_reached = 0; + /* Go back 'n' lines */ + for (i = 0; i < n; i++) { + if (*page == '\0') { + if (end_reached) { + end_reached = 0; + continue; + } + } + if (page == buf) { + begin_reached = 1; + return; + } + page--; + do { + if (page == buf) { + begin_reached = 1; + return; + } + page--; + } while (*page != '\n'); + page++; + } +} + +/* + * Return current line of text. Called by dialog_textbox() and print_line(). + * 'page' should point to start of current line before calling, and will be + * updated to point to start of next line. + */ +static char *get_line(void) +{ + int i = 0; + static char line[MAX_LEN + 1]; + + end_reached = 0; + while (*page != '\n') { + if (*page == '\0') { + end_reached = 1; + break; + } else if (i < MAX_LEN) + line[i++] = *(page++); + else { + /* Truncate lines longer than MAX_LEN characters */ + if (i == MAX_LEN) + line[i++] = '\0'; + page++; + } + } + if (i <= MAX_LEN) + line[i] = '\0'; + if (!end_reached) + page++; /* move past '\n' */ + + return line; +} + +/* + * Print a new line of text. + */ +static void print_line(WINDOW *win, int row, int width) +{ + char *line; + + line = get_line(); + line += MIN(strlen(line), hscroll); /* Scroll horizontally */ + wmove(win, row, 0); /* move cursor to correct line */ + waddch(win, ' '); + waddnstr(win, line, MIN(strlen(line), width - 2)); + + /* Clear 'residue' of previous line */ + wclrtoeol(win); +} + +/* + * Print a new page of text. + */ +static void print_page(WINDOW *win, int height, int width) +{ + int i, passed_end = 0; + + page_length = 0; + for (i = 0; i < height; i++) { + print_line(win, i, width); + if (!passed_end) + page_length++; + if (end_reached && !passed_end) + passed_end = 1; + } + wnoutrefresh(win); +} + +/* + * Print current position + */ +static void print_position(WINDOW *win) +{ + int percent; + + wattrset(win, dlg.position_indicator.atr); + wbkgdset(win, dlg.position_indicator.atr & A_COLOR); + percent = (page - buf) * 100 / strlen(buf); + wmove(win, getmaxy(win) - 3, getmaxx(win) - 9); + wprintw(win, "(%3d%%)", percent); +} /* * refresh window content */ static void refresh_text_box(WINDOW *dialog, WINDOW *box, int boxh, int boxw, - int cur_y, int cur_x, update_text_fn update_text, - void *data) + int cur_y, int cur_x) { - print_page(box, boxh, boxw, update_text, data); + start = page - buf; + + print_page(box, boxh, boxw); print_position(dialog); wmove(dialog, cur_y, cur_x); /* Restore cursor position */ wrefresh(dialog); -} + end = page - buf; +} /* * Display text from a file in a dialog box. * * keys is a null-terminated array - * update_text() may not add or remove any '\n' or '\0' in tbuf */ -int dialog_textbox(const char *title, char *tbuf, int initial_height, - int initial_width, int *keys, int *_vscroll, int *_hscroll, - update_text_fn update_text, void *data) +int dialog_textbox(const char *title, const char *tbuf, int initial_height, + int initial_width, int *_vscroll, int *_hscroll, + int (*extra_key_cb)(int, size_t, size_t, void *), void *data) { int i, x, y, cur_x, cur_y, key = 0; int height, width, boxh, boxw; @@ -122,8 +230,7 @@ int dialog_textbox(const char *title, char *tbuf, int initial_height, /* Print first page of text */ attr_clear(box, boxh, boxw, dlg.dialog.atr); - refresh_text_box(dialog, box, boxh, boxw, cur_y, cur_x, update_text, - data); + refresh_text_box(dialog, box, boxh, boxw, cur_y, cur_x); while (!done) { key = wgetch(dialog); @@ -142,8 +249,7 @@ int dialog_textbox(const char *title, char *tbuf, int initial_height, begin_reached = 1; page = buf; refresh_text_box(dialog, box, boxh, boxw, - cur_y, cur_x, update_text, - data); + cur_y, cur_x); } break; case 'G': /* Last page */ @@ -153,8 +259,7 @@ int dialog_textbox(const char *title, char *tbuf, int initial_height, /* point to last char in buf */ page = buf + strlen(buf); back_lines(boxh); - refresh_text_box(dialog, box, boxh, boxw, cur_y, - cur_x, update_text, data); + refresh_text_box(dialog, box, boxh, boxw, cur_y, cur_x); break; case 'K': /* Previous line */ case 'k': @@ -163,8 +268,7 @@ int dialog_textbox(const char *title, char *tbuf, int initial_height, break; back_lines(page_length + 1); - refresh_text_box(dialog, box, boxh, boxw, cur_y, - cur_x, update_text, data); + refresh_text_box(dialog, box, boxh, boxw, cur_y, cur_x); break; case 'B': /* Previous page */ case 'b': @@ -173,8 +277,7 @@ int dialog_textbox(const char *title, char *tbuf, int initial_height, if (begin_reached) break; back_lines(page_length + boxh); - refresh_text_box(dialog, box, boxh, boxw, cur_y, - cur_x, update_text, data); + refresh_text_box(dialog, box, boxh, boxw, cur_y, cur_x); break; case 'J': /* Next line */ case 'j': @@ -183,8 +286,7 @@ int dialog_textbox(const char *title, char *tbuf, int initial_height, break; back_lines(page_length - 1); - refresh_text_box(dialog, box, boxh, boxw, cur_y, - cur_x, update_text, data); + refresh_text_box(dialog, box, boxh, boxw, cur_y, cur_x); break; case KEY_NPAGE: /* Next page */ case ' ': @@ -193,8 +295,7 @@ int dialog_textbox(const char *title, char *tbuf, int initial_height, break; begin_reached = 0; - refresh_text_box(dialog, box, boxh, boxw, cur_y, - cur_x, update_text, data); + refresh_text_box(dialog, box, boxh, boxw, cur_y, cur_x); break; case '0': /* Beginning of line */ case 'H': /* Scroll left */ @@ -209,8 +310,7 @@ int dialog_textbox(const char *title, char *tbuf, int initial_height, hscroll--; /* Reprint current page to scroll horizontally */ back_lines(page_length); - refresh_text_box(dialog, box, boxh, boxw, cur_y, - cur_x, update_text, data); + refresh_text_box(dialog, box, boxh, boxw, cur_y, cur_x); break; case 'L': /* Scroll right */ case 'l': @@ -220,8 +320,7 @@ int dialog_textbox(const char *title, char *tbuf, int initial_height, hscroll++; /* Reprint current page to scroll horizontally */ back_lines(page_length); - refresh_text_box(dialog, box, boxh, boxw, cur_y, - cur_x, update_text, data); + refresh_text_box(dialog, box, boxh, boxw, cur_y, cur_x); break; case KEY_ESC: if (on_key_esc(dialog) == KEY_ESC) @@ -234,11 +333,9 @@ int dialog_textbox(const char *title, char *tbuf, int initial_height, on_key_resize(); goto do_resize; default: - for (i = 0; keys[i]; i++) { - if (key == keys[i]) { - done = true; - break; - } + if (extra_key_cb && extra_key_cb(key, start, end, data)) { + done = true; + break; } } } @@ -259,137 +356,3 @@ int dialog_textbox(const char *title, char *tbuf, int initial_height, *_hscroll = hscroll; return key; } - -/* - * Go back 'n' lines in text. Called by dialog_textbox(). - * 'page' will be updated to point to the desired line in 'buf'. - */ -static void back_lines(int n) -{ - int i; - - begin_reached = 0; - /* Go back 'n' lines */ - for (i = 0; i < n; i++) { - if (*page == '\0') { - if (end_reached) { - end_reached = 0; - continue; - } - } - if (page == buf) { - begin_reached = 1; - return; - } - page--; - do { - if (page == buf) { - begin_reached = 1; - return; - } - page--; - } while (*page != '\n'); - page++; - } -} - -/* - * Print a new page of text. - */ -static void print_page(WINDOW *win, int height, int width, update_text_fn - update_text, void *data) -{ - int i, passed_end = 0; - - if (update_text) { - char *end; - - for (i = 0; i < height; i++) - get_line(); - end = page; - back_lines(height); - update_text(buf, page - buf, end - buf, data); - } - - page_length = 0; - for (i = 0; i < height; i++) { - print_line(win, i, width); - if (!passed_end) - page_length++; - if (end_reached && !passed_end) - passed_end = 1; - } - wnoutrefresh(win); -} - -/* - * Print a new line of text. - */ -static void print_line(WINDOW * win, int row, int width) -{ - char *line; - - line = get_line(); - line += MIN(strlen(line), hscroll); /* Scroll horizontally */ - wmove(win, row, 0); /* move cursor to correct line */ - waddch(win, ' '); - waddnstr(win, line, MIN(strlen(line), width - 2)); - - /* Clear 'residue' of previous line */ -#if OLD_NCURSES - { - int x = getcurx(win); - int i; - for (i = 0; i < width - x; i++) - waddch(win, ' '); - } -#else - wclrtoeol(win); -#endif -} - -/* - * Return current line of text. Called by dialog_textbox() and print_line(). - * 'page' should point to start of current line before calling, and will be - * updated to point to start of next line. - */ -static char *get_line(void) -{ - int i = 0; - static char line[MAX_LEN + 1]; - - end_reached = 0; - while (*page != '\n') { - if (*page == '\0') { - end_reached = 1; - break; - } else if (i < MAX_LEN) - line[i++] = *(page++); - else { - /* Truncate lines longer than MAX_LEN characters */ - if (i == MAX_LEN) - line[i++] = '\0'; - page++; - } - } - if (i <= MAX_LEN) - line[i] = '\0'; - if (!end_reached) - page++; /* move past '\n' */ - - return line; -} - -/* - * Print current position - */ -static void print_position(WINDOW * win) -{ - int percent; - - wattrset(win, dlg.position_indicator.atr); - wbkgdset(win, dlg.position_indicator.atr & A_COLOR); - percent = (page - buf) * 100 / strlen(buf); - wmove(win, getmaxy(win) - 3, getmaxx(win) - 9); - wprintw(win, "(%3d%%)", percent); -} diff --git a/scripts/config/mconf-cfg.sh b/scripts/config/mconf-cfg.sh index 35723692880e6b..4e48cc1d57b8d7 100755 --- a/scripts/config/mconf-cfg.sh +++ b/scripts/config/mconf-cfg.sh @@ -1,19 +1,22 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0-only +cflags=$1 +libs=$2 + PKG="ncursesw" PKG2="ncurses" -if [ -n "$(command -v pkg-config)" ]; then - if pkg-config --exists $PKG; then - echo cflags=\"$(pkg-config --cflags $PKG)\" - echo libs=\"$(pkg-config --libs $PKG)\" +if [ -n "$(command -v ${HOSTPKG_CONFIG})" ]; then + if ${HOSTPKG_CONFIG} --exists $PKG; then + ${HOSTPKG_CONFIG} --cflags ${PKG} > ${cflags} + ${HOSTPKG_CONFIG} --libs ${PKG} > ${libs} exit 0 fi - if pkg-config --exists $PKG2; then - echo cflags=\"$(pkg-config --cflags $PKG2)\" - echo libs=\"$(pkg-config --libs $PKG2)\" + if ${HOSTPKG_CONFIG} --exists ${PKG2}; then + ${HOSTPKG_CONFIG} --cflags ${PKG2} > ${cflags} + ${HOSTPKG_CONFIG} --libs ${PKG2} > ${libs} exit 0 fi fi @@ -22,22 +25,22 @@ fi # (Even if it is installed, some distributions such as openSUSE cannot # find ncurses by pkg-config.) if [ -f /usr/include/ncursesw/ncurses.h ]; then - echo cflags=\"-D_GNU_SOURCE -I/usr/include/ncursesw\" - echo libs=\"-lncursesw\" + echo -D_GNU_SOURCE -I/usr/include/ncursesw > ${cflags} + echo -lncursesw > ${libs} exit 0 fi if [ -f /usr/include/ncurses/ncurses.h ]; then - echo cflags=\"-D_GNU_SOURCE -I/usr/include/ncurses\" - echo libs=\"-lncurses\" + echo -D_GNU_SOURCE -I/usr/include/ncurses > ${cflags} + echo -lncurses > ${libs} exit 0 fi # As a final fallback before giving up, check if $HOSTCC knows of a default # ncurses installation (e.g. from a vendor-specific sysroot). if echo '#include ' | ${HOSTCC} -E - >/dev/null 2>&1; then - echo cflags=\"-D_GNU_SOURCE\" - echo libs=\"-lncurses\" + echo -D_GNU_SOURCE > ${cflags} + echo -lncurses > ${libs} exit 0 fi @@ -46,7 +49,7 @@ echo >&2 "* Unable to find the ncurses package." echo >&2 "* Install ncurses (ncurses-devel or libncurses-dev" echo >&2 "* depending on your distribution)." echo >&2 "*" -echo >&2 "* You may also need to install pkg-config to find the" +echo >&2 "* You may also need to install ${HOSTPKG_CONFIG} to find the" echo >&2 "* ncurses installed in a non-default location." echo >&2 "*" exit 1 diff --git a/scripts/config/mconf.c b/scripts/config/mconf.c index 81d232b66562bf..d357cf11003906 100644 --- a/scripts/config/mconf.c +++ b/scripts/config/mconf.c @@ -22,8 +22,6 @@ #include "lkc.h" #include "lxdialog/dialog.h" -#define JUMP_NB 9 - static const char mconf_readme[] = "OpenWrt config is based on Kernel kconfig\n" "so ipkg packages are referred here as modules.\n" @@ -164,6 +162,12 @@ static const char mconf_readme[] = "(especially with a larger number of unrolled categories) than the\n" "default mode.\n" "\n" + +"Search\n" +"-------\n" +"Pressing the forward-slash (/) anywhere brings up a search dialog box.\n" +"\n" + "Different color themes available\n" "--------------------------------\n" "It is possible to select different color themes using the variable\n" @@ -285,18 +289,9 @@ static int single_menu_mode; static int show_all_options; static int save_and_exit; static int silent; +static int jump_key_char; static void conf(struct menu *menu, struct menu *active_menu); -static void conf_choice(struct menu *menu); -static void conf_string(struct menu *menu); -static void conf_load(void); -static void conf_save(void); -static int show_textbox_ext(const char *title, char *text, int r, int c, - int *keys, int *vscroll, int *hscroll, - update_text_fn update_text, void *data); -static void show_textbox(const char *title, const char *text, int r, int c); -static void show_helptext(const char *title, const char *text); -static void show_help(struct menu *menu); static char filename[PATH_MAX+1]; static void set_config_filename(const char *config_filename) @@ -355,37 +350,87 @@ static void reset_subtitle(void) set_dialog_subtitles(subtitles); } +static int show_textbox_ext(const char *title, const char *text, int r, int c, + int *vscroll, int *hscroll, + int (*extra_key_cb)(int, size_t, size_t, void *), + void *data) +{ + dialog_clear(); + return dialog_textbox(title, text, r, c, vscroll, hscroll, + extra_key_cb, data); +} + +static void show_textbox(const char *title, const char *text, int r, int c) +{ + show_textbox_ext(title, text, r, c, NULL, NULL, NULL, NULL); +} + +static void show_helptext(const char *title, const char *text) +{ + show_textbox(title, text, 0, 0); +} + +static void show_help(struct menu *menu) +{ + struct gstr help = str_new(); + + help.max_width = getmaxx(stdscr) - 10; + menu_get_ext_help(menu, &help); + + show_helptext(menu_get_prompt(menu), str_get(&help)); + str_free(&help); +} + struct search_data { struct list_head *head; - struct menu **targets; - int *keys; + struct menu *target; }; -static void update_text(char *buf, size_t start, size_t end, void *_data) +static int next_jump_key(int key) +{ + if (key < '1' || key > '9') + return '1'; + + key++; + + if (key > '9') + key = '1'; + + return key; +} + +static int handle_search_keys(int key, size_t start, size_t end, void *_data) { struct search_data *data = _data; struct jump_key *pos; - int k = 0; + int index = 0; + + if (key < '1' || key > '9') + return 0; list_for_each_entry(pos, data->head, entries) { - if (pos->offset >= start && pos->offset < end) { - char header[4]; + index = next_jump_key(index); - if (k < JUMP_NB) { - int key = '0' + (pos->index % JUMP_NB) + 1; + if (pos->offset < start) + continue; - sprintf(header, "(%c)", key); - data->keys[k] = key; - data->targets[k] = pos->target; - k++; - } else { - sprintf(header, " "); - } + if (pos->offset >= end) + break; - memcpy(buf + pos->offset, header, sizeof(header) - 1); + if (key == index) { + data->target = pos->target; + return 1; } } - data->keys[k] = 0; + + return 0; +} + +int get_jump_key_char(void) +{ + jump_key_char = next_jump_key(jump_key_char); + + return jump_key_char; } static void search_conf(void) @@ -432,27 +477,23 @@ static void search_conf(void) sym_arr = sym_re_search(dialog_input); do { LIST_HEAD(head); - struct menu *targets[JUMP_NB]; - int keys[JUMP_NB + 1], i; struct search_data data = { .head = &head, - .targets = targets, - .keys = keys, }; struct jump_key *pos, *tmp; + jump_key_char = 0; res = get_relations_str(sym_arr, &head); set_subtitle(); - dres = show_textbox_ext("Search Results", (char *) - str_get(&res), 0, 0, keys, &vscroll, - &hscroll, &update_text, (void *) - &data); + dres = show_textbox_ext("Search Results", str_get(&res), 0, 0, + &vscroll, &hscroll, + handle_search_keys, &data); again = false; - for (i = 0; i < JUMP_NB && keys[i]; i++) - if (dres == keys[i]) { - conf(targets[i]->parent, targets[i]); - again = true; - } + if (dres >= '1' && dres <= '9') { + assert(data.target != NULL); + conf(data.target->parent, data.target); + again = true; + } str_free(&res); list_for_each_entry_safe(pos, tmp, &head, entries) free(pos); @@ -641,158 +682,6 @@ static void build_conf(struct menu *menu) indent -= doint; } -static void conf(struct menu *menu, struct menu *active_menu) -{ - struct menu *submenu; - const char *prompt = menu_get_prompt(menu); - struct subtitle_part stpart; - struct symbol *sym; - int res; - int s_scroll = 0; - - if (menu != &rootmenu) - stpart.text = menu_get_prompt(menu); - else - stpart.text = NULL; - list_add_tail(&stpart.entries, &trail); - - while (1) { - item_reset(); - current_menu = menu; - build_conf(menu); - if (!child_count) - break; - set_subtitle(); - dialog_clear(); - res = dialog_menu(prompt ? prompt : "Main Menu", - menu_instructions, - active_menu, &s_scroll); - if (res == 1 || res == KEY_ESC || res == -ERRDISPLAYTOOSMALL) - break; - if (item_count() != 0) { - if (!item_activate_selected()) - continue; - if (!item_tag()) - continue; - } - submenu = item_data(); - active_menu = item_data(); - if (submenu) - sym = submenu->sym; - else - sym = NULL; - - switch (res) { - case 0: - switch (item_tag()) { - case 'm': - if (single_menu_mode) - submenu->data = (void *) (long) !submenu->data; - else - conf(submenu, NULL); - break; - case 't': - if (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes) - conf_choice(submenu); - else if (submenu->prompt->type == P_MENU) - conf(submenu, NULL); - break; - case 's': - conf_string(submenu); - break; - } - break; - case 2: - if (sym) - show_help(submenu); - else { - reset_subtitle(); - show_helptext("README", mconf_readme); - } - break; - case 3: - reset_subtitle(); - conf_save(); - break; - case 4: - reset_subtitle(); - conf_load(); - break; - case 5: - if (item_is_tag('t')) { - if (sym_set_tristate_value(sym, yes)) - break; - if (sym_set_tristate_value(sym, mod)) - show_textbox(NULL, setmod_text, 6, 74); - } - break; - case 6: - if (item_is_tag('t')) - sym_set_tristate_value(sym, no); - break; - case 7: - if (item_is_tag('t')) - sym_set_tristate_value(sym, mod); - break; - case 8: - if (item_is_tag('t')) - sym_toggle_tristate_value(sym); - else if (item_is_tag('m')) - conf(submenu, NULL); - break; - case 9: - search_conf(); - break; - case 10: - show_all_options = !show_all_options; - break; - } - } - - list_del(trail.prev); -} - -static int show_textbox_ext(const char *title, char *text, int r, int c, int - *keys, int *vscroll, int *hscroll, update_text_fn - update_text, void *data) -{ - dialog_clear(); - return dialog_textbox(title, text, r, c, keys, vscroll, hscroll, - update_text, data); -} - -static void show_textbox(const char *title, const char *text, int r, int c) -{ - show_textbox_ext(title, (char *) text, r, c, (int []) {0}, NULL, NULL, - NULL, NULL); -} - -static void show_helptext(const char *title, const char *text) -{ - show_textbox(title, text, 0, 0); -} - -static void conf_message_callback(const char *s) -{ - if (save_and_exit) { - if (!silent) - printf("%s", s); - } else { - show_textbox(NULL, s, 6, 60); - } -} - -static void show_help(struct menu *menu) -{ - struct gstr help = str_new(); - - help.max_width = getmaxx(stdscr) - 10; - menu_get_ext_help(menu, &help); - - show_helptext(menu_get_prompt(menu), str_get(&help)); - str_free(&help); -} - static void conf_choice(struct menu *menu) { const char *prompt = menu_get_prompt(menu); @@ -958,6 +847,127 @@ static void conf_save(void) } } +static void conf(struct menu *menu, struct menu *active_menu) +{ + struct menu *submenu; + const char *prompt = menu_get_prompt(menu); + struct subtitle_part stpart; + struct symbol *sym; + int res; + int s_scroll = 0; + + if (menu != &rootmenu) + stpart.text = menu_get_prompt(menu); + else + stpart.text = NULL; + list_add_tail(&stpart.entries, &trail); + + while (1) { + item_reset(); + current_menu = menu; + build_conf(menu); + if (!child_count) + break; + set_subtitle(); + dialog_clear(); + res = dialog_menu(prompt ? prompt : "Main Menu", + menu_instructions, + active_menu, &s_scroll); + if (res == 1 || res == KEY_ESC || res == -ERRDISPLAYTOOSMALL) + break; + if (item_count() != 0) { + if (!item_activate_selected()) + continue; + if (!item_tag()) + continue; + } + submenu = item_data(); + active_menu = item_data(); + if (submenu) + sym = submenu->sym; + else + sym = NULL; + + switch (res) { + case 0: + switch (item_tag()) { + case 'm': + if (single_menu_mode) + submenu->data = (void *) (long) !submenu->data; + else + conf(submenu, NULL); + break; + case 't': + if (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes) + conf_choice(submenu); + else if (submenu->prompt->type == P_MENU) + conf(submenu, NULL); + break; + case 's': + conf_string(submenu); + break; + } + break; + case 2: + if (sym) + show_help(submenu); + else { + reset_subtitle(); + show_helptext("README", mconf_readme); + } + break; + case 3: + reset_subtitle(); + conf_save(); + break; + case 4: + reset_subtitle(); + conf_load(); + break; + case 5: + if (item_is_tag('t')) { + if (sym_set_tristate_value(sym, yes)) + break; + if (sym_set_tristate_value(sym, mod)) + show_textbox(NULL, setmod_text, 6, 74); + } + break; + case 6: + if (item_is_tag('t')) + sym_set_tristate_value(sym, no); + break; + case 7: + if (item_is_tag('t')) + sym_set_tristate_value(sym, mod); + break; + case 8: + if (item_is_tag('t')) + sym_toggle_tristate_value(sym); + else if (item_is_tag('m')) + conf(submenu, NULL); + break; + case 9: + search_conf(); + break; + case 10: + show_all_options = !show_all_options; + break; + } + } + + list_del(trail.prev); +} + +static void conf_message_callback(const char *s) +{ + if (save_and_exit) { + if (!silent) + printf("%s", s); + } else { + show_textbox(NULL, s, 6, 60); + } +} + static int handle_exit(void) { int res; diff --git a/scripts/config/menu.c b/scripts/config/menu.c index 22fd26a9f7147e..d41a61a73a490d 100644 --- a/scripts/config/menu.c +++ b/scripts/config/menu.c @@ -661,11 +661,6 @@ const char *menu_get_prompt(struct menu *menu) return NULL; } -struct menu *menu_get_root_menu(struct menu *menu) -{ - return &rootmenu; -} - struct menu *menu_get_parent_menu(struct menu *menu) { enum prop_type type; @@ -706,6 +701,11 @@ static void get_dep_str(struct gstr *r, struct expr *expr, const char *prefix) } } +int __attribute__((weak)) get_jump_key_char(void) +{ + return -1; +} + static void get_prompt_str(struct gstr *r, struct property *prop, struct list_head *head) { @@ -727,52 +727,41 @@ static void get_prompt_str(struct gstr *r, struct property *prop, if (!expr_eq(prop->menu->dep, prop->visible.expr)) get_dep_str(r, prop->visible.expr, " Visible if: "); - menu = prop->menu->parent; + menu = prop->menu; for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) { - bool accessible = menu_is_visible(menu); - submenu[i++] = menu; - if (location == NULL && accessible) + if (location == NULL && menu_is_visible(menu)) location = menu; } if (head && location) { jump = xmalloc(sizeof(struct jump_key)); + jump->target = location; + list_add_tail(&jump->entries, head); + } - if (menu_is_visible(prop->menu)) { - /* - * There is not enough room to put the hint at the - * beginning of the "Prompt" line. Put the hint on the - * last "Location" line even when it would belong on - * the former. - */ - jump->target = prop->menu; - } else - jump->target = location; + str_printf(r, " Location:\n"); + for (j = 0; --i >= 0; j++) { + int jk = -1; + int indent = 2 * j + 4; - if (list_empty(head)) - jump->index = 0; - else - jump->index = list_entry(head->prev, struct jump_key, - entries)->index + 1; + menu = submenu[i]; + if (jump && menu == location) { + jump->offset = strlen(r->s); + jk = get_jump_key_char(); + } - list_add_tail(&jump->entries, head); - } + if (jk >= 0) { + str_printf(r, "(%c)", jk); + indent -= 3; + } - if (i > 0) { - str_printf(r, " Location:\n"); - for (j = 4; --i >= 0; j += 2) { - menu = submenu[i]; - if (jump && menu == location) - jump->offset = strlen(r->s); - str_printf(r, "%*c-> %s", j, ' ', - menu_get_prompt(menu)); - if (menu->sym) { - str_printf(r, " (%s [=%s])", menu->sym->name ? - menu->sym->name : "", - sym_get_string_value(menu->sym)); - } - str_append(r, "\n"); + str_printf(r, "%*c-> %s", indent, ' ', menu_get_prompt(menu)); + if (menu->sym) { + str_printf(r, " (%s [=%s])", menu->sym->name ? + menu->sym->name : "", + sym_get_string_value(menu->sym)); } + str_append(r, "\n"); } } diff --git a/scripts/config/nconf-cfg.sh b/scripts/config/nconf-cfg.sh index a22730928397e3..9d4096074941e6 100755 --- a/scripts/config/nconf-cfg.sh +++ b/scripts/config/nconf-cfg.sh @@ -1,19 +1,22 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0-only +cflags=$1 +libs=$2 + PKG="ncursesw menuw panelw" PKG2="ncurses menu panel" -if [ -n "$(command -v pkg-config)" ]; then - if pkg-config --exists $PKG; then - echo cflags=\"$(pkg-config --cflags $PKG)\" - echo libs=\"$(pkg-config --libs $PKG)\" +if [ -n "$(command -v ${HOSTPKG_CONFIG})" ]; then + if ${HOSTPKG_CONFIG} --exists $PKG; then + ${HOSTPKG_CONFIG} --cflags ${PKG} > ${cflags} + ${HOSTPKG_CONFIG} --libs ${PKG} > ${libs} exit 0 fi - if pkg-config --exists $PKG2; then - echo cflags=\"$(pkg-config --cflags $PKG2)\" - echo libs=\"$(pkg-config --libs $PKG2)\" + if ${HOSTPKG_CONFIG} --exists $PKG2; then + ${HOSTPKG_CONFIG} --cflags ${PKG2} > ${cflags} + ${HOSTPKG_CONFIG} --libs ${PKG2} > ${libs} exit 0 fi fi @@ -22,20 +25,20 @@ fi # (Even if it is installed, some distributions such as openSUSE cannot # find ncurses by pkg-config.) if [ -f /usr/include/ncursesw/ncurses.h ]; then - echo cflags=\"-D_GNU_SOURCE -I/usr/include/ncursesw\" - echo libs=\"-lncursesw -lmenuw -lpanelw\" + echo -D_GNU_SOURCE -I/usr/include/ncursesw > ${cflags} + echo -lncursesw -lmenuw -lpanelw > ${libs} exit 0 fi if [ -f /usr/include/ncurses/ncurses.h ]; then - echo cflags=\"-D_GNU_SOURCE -I/usr/include/ncurses\" - echo libs=\"-lncurses -lmenu -lpanel\" + echo -D_GNU_SOURCE -I/usr/include/ncurses > ${cflags} + echo -lncurses -lmenu -lpanel > ${libs} exit 0 fi if [ -f /usr/include/ncurses.h ]; then - echo cflags=\"-D_GNU_SOURCE\" - echo libs=\"-lncurses -lmenu -lpanel\" + echo -D_GNU_SOURCE > ${cflags} + echo -lncurses -lmenu -lpanel > ${libs} exit 0 fi @@ -44,7 +47,7 @@ echo >&2 "* Unable to find the ncurses package." echo >&2 "* Install ncurses (ncurses-devel or libncurses-dev" echo >&2 "* depending on your distribution)." echo >&2 "*" -echo >&2 "* You may also need to install pkg-config to find the" +echo >&2 "* You may also need to install ${HOSTPKG_CONFIG} to find the" echo >&2 "* ncurses installed in a non-default location." echo >&2 "*" exit 1 diff --git a/scripts/config/nconf.c b/scripts/config/nconf.c index b75cabe017cabd..ece86726efd6ce 100644 --- a/scripts/config/nconf.c +++ b/scripts/config/nconf.c @@ -55,8 +55,8 @@ static const char nconf_global_help[] = "\n" "Menu navigation keys\n" "----------------------------------------------------------------------\n" -"Linewise up \n" -"Linewise down \n" +"Linewise up \n" +"Linewise down \n" "Pagewise up \n" "Pagewise down \n" "First entry \n" @@ -223,7 +223,7 @@ search_help[] = "Location:\n" " -> Bus options (PCI, PCMCIA, EISA, ISA)\n" " -> PCI support (PCI [ = y])\n" -" -> PCI access mode ( [ = y])\n" +"(1) -> PCI access mode ( [ = y])\n" "Selects: LIBCRC32\n" "Selected by: BAR\n" "-----------------------------------------------------------------\n" @@ -234,9 +234,13 @@ search_help[] = "o The 'Depends on:' line lists symbols that need to be defined for\n" " this symbol to be visible and selectable in the menu.\n" "o The 'Location:' lines tell, where in the menu structure this symbol\n" -" is located. A location followed by a [ = y] indicates that this is\n" -" a selectable menu item, and the current value is displayed inside\n" -" brackets.\n" +" is located.\n" +" A location followed by a [ = y] indicates that this is\n" +" a selectable menu item, and the current value is displayed inside\n" +" brackets.\n" +" Press the key in the (#) prefix to jump directly to that\n" +" location. You will be returned to the current search results\n" +" after exiting this new menu.\n" "o The 'Selects:' line tells, what symbol will be automatically selected\n" " if this symbol is selected (y or m).\n" "o The 'Selected by' line tells what symbol has selected this symbol.\n" @@ -278,7 +282,9 @@ static const char *current_instructions = menu_instructions; static char *dialog_input_result; static int dialog_input_result_len; +static int jump_key_char; +static void selected_conf(struct menu *menu, struct menu *active_menu); static void conf(struct menu *menu); static void conf_choice(struct menu *menu); static void conf_string(struct menu *menu); @@ -688,6 +694,57 @@ static int do_exit(void) return 0; } +struct search_data { + struct list_head *head; + struct menu *target; +}; + +static int next_jump_key(int key) +{ + if (key < '1' || key > '9') + return '1'; + + key++; + + if (key > '9') + key = '1'; + + return key; +} + +static int handle_search_keys(int key, size_t start, size_t end, void *_data) +{ + struct search_data *data = _data; + struct jump_key *pos; + int index = 0; + + if (key < '1' || key > '9') + return 0; + + list_for_each_entry(pos, data->head, entries) { + index = next_jump_key(index); + + if (pos->offset < start) + continue; + + if (pos->offset >= end) + break; + + if (key == index) { + data->target = pos->target; + return 1; + } + } + + return 0; +} + +int get_jump_key_char(void) +{ + jump_key_char = next_jump_key(jump_key_char); + + return jump_key_char; +} static void search_conf(void) { @@ -695,7 +752,8 @@ static void search_conf(void) struct gstr res; struct gstr title; char *dialog_input; - int dres; + int dres, vscroll = 0, hscroll = 0; + bool again; title = str_new(); str_printf( &title, "Enter (sub)string or regexp to search for " @@ -724,11 +782,28 @@ static void search_conf(void) dialog_input += strlen(CONFIG_); sym_arr = sym_re_search(dialog_input); - res = get_relations_str(sym_arr, NULL); + + do { + LIST_HEAD(head); + struct search_data data = { + .head = &head, + .target = NULL, + }; + jump_key_char = 0; + res = get_relations_str(sym_arr, &head); + dres = show_scroll_win_ext(main_window, + "Search Results", str_get(&res), + &vscroll, &hscroll, + handle_search_keys, &data); + again = false; + if (dres >= '1' && dres <= '9') { + assert(data.target != NULL); + selected_conf(data.target->parent, data.target); + again = true; + } + str_free(&res); + } while (again); free(sym_arr); - show_scroll_win(main_window, - "Search Results", str_get(&res)); - str_free(&res); str_free(&title); } @@ -1065,10 +1140,15 @@ static int do_match(int key, struct match_state *state, int *ans) } static void conf(struct menu *menu) +{ + selected_conf(menu, NULL); +} + +static void selected_conf(struct menu *menu, struct menu *active_menu) { struct menu *submenu = NULL; struct symbol *sym; - int res; + int i, res; int current_index = 0; int last_top_row = 0; struct match_state match_state = { @@ -1084,6 +1164,19 @@ static void conf(struct menu *menu) if (!child_count) break; + if (active_menu != NULL) { + for (i = 0; i < items_num; i++) { + struct mitem *mcur; + + mcur = (struct mitem *) item_userptr(curses_menu_items[i]); + if ((struct menu *) mcur->usrptr == active_menu) { + current_index = i; + break; + } + } + active_menu = NULL; + } + show_menu(menu_get_prompt(menu), menu_instructions, current_index, &last_top_row); keypad((menu_win(curses_menu)), TRUE); @@ -1108,9 +1201,11 @@ static void conf(struct menu *menu) break; switch (res) { case KEY_DOWN: + case 'j': menu_driver(curses_menu, REQ_DOWN_ITEM); break; case KEY_UP: + case 'k': menu_driver(curses_menu, REQ_UP_ITEM); break; case KEY_NPAGE: @@ -1291,9 +1386,11 @@ static void conf_choice(struct menu *menu) break; switch (res) { case KEY_DOWN: + case 'j': menu_driver(curses_menu, REQ_DOWN_ITEM); break; case KEY_UP: + case 'k': menu_driver(curses_menu, REQ_UP_ITEM); break; case KEY_NPAGE: diff --git a/scripts/config/nconf.gui.c b/scripts/config/nconf.gui.c index c72d61a7725e5a..48ba1c1a07f5ae 100644 --- a/scripts/config/nconf.gui.c +++ b/scripts/config/nconf.gui.c @@ -497,10 +497,17 @@ void refresh_all_windows(WINDOW *main_window) refresh(); } -/* layman's scrollable window... */ void show_scroll_win(WINDOW *main_window, const char *title, const char *text) +{ + (void)show_scroll_win_ext(main_window, title, (char *)text, NULL, NULL, NULL, NULL); +} + +/* layman's scrollable window... */ +int show_scroll_win_ext(WINDOW *main_window, const char *title, char *text, + int *vscroll, int *hscroll, + extra_key_cb_fn extra_key_cb, void *data) { int res; int total_lines = get_line_no(text); @@ -514,6 +521,12 @@ void show_scroll_win(WINDOW *main_window, WINDOW *win; WINDOW *pad; PANEL *panel; + bool done = false; + + if (hscroll) + start_x = *hscroll; + if (vscroll) + start_y = *vscroll; getmaxyx(stdscr, lines, columns); @@ -549,8 +562,7 @@ void show_scroll_win(WINDOW *main_window, panel = new_panel(win); /* handle scrolling */ - do { - + while (!done) { copywin(pad, win, start_y, start_x, 2, 2, text_lines, text_cols, 0); print_in_middle(win, @@ -593,8 +605,18 @@ void show_scroll_win(WINDOW *main_window, case 'l': start_x++; break; + default: + if (extra_key_cb) { + size_t start = (get_line(text, start_y) - text); + size_t end = (get_line(text, start_y + text_lines) - text); + + if (extra_key_cb(res, start, end, data)) { + done = true; + break; + } + } } - if (res == 10 || res == 27 || res == 'q' || + if (res == 0 || res == 10 || res == 27 || res == 'q' || res == KEY_F(F_HELP) || res == KEY_F(F_BACK) || res == KEY_F(F_EXIT)) break; @@ -606,9 +628,14 @@ void show_scroll_win(WINDOW *main_window, start_x = 0; if (start_x >= total_cols-text_cols) start_x = total_cols-text_cols; - } while (res); + } + if (hscroll) + *hscroll = start_x; + if (vscroll) + *vscroll = start_y; del_panel(panel); delwin(win); refresh_all_windows(main_window); + return res; } diff --git a/scripts/config/nconf.h b/scripts/config/nconf.h index 6e127c63d5773a..174b035fdef105 100644 --- a/scripts/config/nconf.h +++ b/scripts/config/nconf.h @@ -67,6 +67,8 @@ typedef enum { void set_colors(void); +typedef int (*extra_key_cb_fn)(int, size_t, size_t, void *); + /* this changes the windows attributes !!! */ void print_in_middle(WINDOW *win, int y, int width, const char *str, int attrs); int get_line_length(const char *line); @@ -78,6 +80,9 @@ int dialog_inputbox(WINDOW *main_window, const char *title, const char *prompt, const char *init, char **resultp, int *result_len); void refresh_all_windows(WINDOW *main_window); +int show_scroll_win_ext(WINDOW *main_window, const char *title, char *text, + int *vscroll, int *hscroll, + extra_key_cb_fn extra_key_cb, void *data); void show_scroll_win(WINDOW *main_window, const char *title, const char *text); diff --git a/scripts/config/parser.tab.c b/scripts/config/parser.tab.c index 18137050a9c2a3..93fdc257a603bb 100644 --- a/scripts/config/parser.tab.c +++ b/scripts/config/parser.tab.c @@ -1,4 +1,4 @@ -/* A Bison parser, made by GNU Bison 3.7.6. */ +/* A Bison parser, made by GNU Bison 3.8.2. */ /* Bison implementation for Yacc-like parsers in C @@ -46,10 +46,10 @@ USER NAME SPACE" below. */ /* Identify Bison output, and Bison version. */ -#define YYBISON 30706 +#define YYBISON 30802 /* Bison version string. */ -#define YYBISON_VERSION "3.7.6" +#define YYBISON_VERSION "3.8.2" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -379,12 +379,18 @@ typedef int yy_state_fast_t; # define YY_USE(E) /* empty */ #endif -#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ /* Suppress an incorrect diagnostic about yylval being uninitialized. */ -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ +#if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__ +# if __GNUC__ * 100 + __GNUC_MINOR__ < 407 +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") +# else +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ _Pragma ("GCC diagnostic push") \ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# endif # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ _Pragma ("GCC diagnostic pop") #else @@ -603,7 +609,7 @@ static const yytype_int8 yytranslate[] = }; #if YYDEBUG - /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ +/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_int16 yyrline[] = { 0, 110, 110, 110, 114, 119, 121, 122, 123, 124, @@ -661,20 +667,6 @@ yysymbol_name (yysymbol_kind_t yysymbol) } #endif -#ifdef YYPRINT -/* YYTOKNUM[NUM] -- (External) token number corresponding to the - (internal) symbol number NUM (which must be that of a token). */ -static const yytype_int16 yytoknum[] = -{ - 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305 -}; -#endif - #define YYPACT_NINF (-105) #define yypact_value_is_default(Yyn) \ @@ -685,8 +677,8 @@ static const yytype_int16 yytoknum[] = #define yytable_value_is_error(Yyn) \ 0 - /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ static const yytype_int16 yypact[] = { -5, 17, 37, -105, 57, 8, -105, 91, 39, 15, @@ -710,9 +702,9 @@ static const yytype_int16 yypact[] = -105, 136, -105, -105, -105, -105, -105 }; - /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. - Performed when YYTABLE does not specify something else to do. Zero - means the default is an error. */ +/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ static const yytype_int8 yydefact[] = { 5, 0, 0, 5, 0, 0, 1, 0, 0, 0, @@ -736,7 +728,7 @@ static const yytype_int8 yydefact[] = 30, 0, 32, 31, 48, 44, 34 }; - /* YYPGOTO[NTERM-NUM]. */ +/* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { -105, -105, -105, 3, 38, -105, -55, -105, -105, 138, @@ -746,7 +738,7 @@ static const yytype_int16 yypgoto[] = -46, -8, -65, -105, -105, -105, -105 }; - /* YYDEFGOTO[NTERM-NUM]. */ +/* YYDEFGOTO[NTERM-NUM]. */ static const yytype_uint8 yydefgoto[] = { 0, 2, 3, 4, 57, 17, 18, 19, 20, 54, @@ -756,9 +748,9 @@ static const yytype_uint8 yydefgoto[] = 48, 49, 50, 41, 32, 39, 64 }; - /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule whose - number is the opposite. If YYTABLE_NINF, syntax error. */ +/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int16 yytable[] = { 68, 69, 116, 118, 44, 120, 7, 52, 134, 135, @@ -807,8 +799,8 @@ static const yytype_int16 yycheck[] = 34, -1, -1, -1, 38 }; - /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ +/* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of + state STATE-NUM. */ static const yytype_int8 yystos[] = { 0, 24, 52, 53, 54, 5, 0, 54, 1, 4, @@ -832,7 +824,7 @@ static const yytype_int8 yystos[] = 40, 90, 40, 40, 40, 40, 40 }; - /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +/* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */ static const yytype_int8 yyr1[] = { 0, 51, 52, 52, 53, 54, 54, 54, 54, 54, @@ -848,7 +840,7 @@ static const yytype_int8 yyr1[] = 94, 95, 96, 96, 96, 97, 97 }; - /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ +/* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */ static const yytype_int8 yyr2[] = { 0, 2, 2, 1, 3, 0, 2, 2, 2, 2, @@ -873,6 +865,7 @@ enum { YYENOMEM = -2 }; #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab +#define YYNOMEM goto yyexhaustedlab #define YYRECOVERING() (!!yyerrstatus) @@ -913,10 +906,7 @@ do { \ YYFPRINTF Args; \ } while (0) -/* This macro is provided for backward compatibility. */ -# ifndef YY_LOCATION_PRINT -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -# endif + # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \ @@ -943,10 +933,6 @@ yy_symbol_value_print (FILE *yyo, YY_USE (yyoutput); if (!yyvaluep) return; -# ifdef YYPRINT - if (yykind < YYNTOKENS) - YYPRINT (yyo, yytoknum[yykind], *yyvaluep); -# endif YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN YY_USE (yykind); YY_IGNORE_MAYBE_UNINITIALIZED_END @@ -1162,6 +1148,7 @@ yyparse (void) YYDPRINTF ((stderr, "Starting parse\n")); yychar = YYEMPTY; /* Cause a token to be read. */ + goto yysetstate; @@ -1187,7 +1174,7 @@ yyparse (void) if (yyss + yystacksize - 1 <= yyssp) #if !defined yyoverflow && !defined YYSTACK_RELOCATE - goto yyexhaustedlab; + YYNOMEM; #else { /* Get the current used size of the three stacks, in elements. */ @@ -1215,7 +1202,7 @@ yyparse (void) # else /* defined YYSTACK_RELOCATE */ /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; + YYNOMEM; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; @@ -1226,7 +1213,7 @@ yyparse (void) YY_CAST (union yyalloc *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); if (! yyptr) - goto yyexhaustedlab; + YYNOMEM; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE @@ -1248,6 +1235,7 @@ yyparse (void) } #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ + if (yystate == YYFINAL) YYACCEPT; @@ -1832,6 +1820,7 @@ yyparse (void) label yyerrorlab therefore never appears in user code. */ if (0) YYERROR; + ++yynerrs; /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ @@ -1892,7 +1881,7 @@ yyparse (void) `-------------------------------------*/ yyacceptlab: yyresult = 0; - goto yyreturn; + goto yyreturnlab; /*-----------------------------------. @@ -1900,24 +1889,22 @@ yyparse (void) `-----------------------------------*/ yyabortlab: yyresult = 1; - goto yyreturn; + goto yyreturnlab; -#if !defined yyoverflow -/*-------------------------------------------------. -| yyexhaustedlab -- memory exhaustion comes here. | -`-------------------------------------------------*/ +/*-----------------------------------------------------------. +| yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. | +`-----------------------------------------------------------*/ yyexhaustedlab: yyerror (YY_("memory exhausted")); yyresult = 2; - goto yyreturn; -#endif + goto yyreturnlab; -/*-------------------------------------------------------. -| yyreturn -- parsing is finished, clean up and return. | -`-------------------------------------------------------*/ -yyreturn: +/*----------------------------------------------------------. +| yyreturnlab -- parsing is finished, clean up and return. | +`----------------------------------------------------------*/ +yyreturnlab: if (yychar != YYEMPTY) { /* Make sure we have latest lookahead translation. See comments at diff --git a/scripts/config/parser.tab.h b/scripts/config/parser.tab.h index aac457ce39a899..fa3eb3491bd16e 100644 --- a/scripts/config/parser.tab.h +++ b/scripts/config/parser.tab.h @@ -1,4 +1,4 @@ -/* A Bison parser, made by GNU Bison 3.7.6. */ +/* A Bison parser, made by GNU Bison 3.8.2. */ /* Bison interface for Yacc-like parsers in C @@ -128,6 +128,8 @@ typedef union YYSTYPE YYSTYPE; extern YYSTYPE yylval; + int yyparse (void); + #endif /* !YY_YY_PARSER_TAB_H_INCLUDED */ diff --git a/scripts/config/preprocess.c b/scripts/config/preprocess.c index 3c7a35a724703a..3c544b775ae0aa 100644 --- a/scripts/config/preprocess.c +++ b/scripts/config/preprocess.c @@ -141,7 +141,7 @@ static char *do_lineno(int argc, char *argv[]) static char *do_shell(int argc, char *argv[]) { FILE *p; - char buf[256]; + char buf[4096]; char *cmd; size_t nread; int i; @@ -396,6 +396,9 @@ static char *eval_clause(const char *str, size_t len, int argc, char *argv[]) p++; } + + if (new_argc >= FUNCTION_MAX_ARGS) + pperror("too many function arguments"); new_argv[new_argc++] = prev; /* diff --git a/scripts/config/qconf-cfg.sh b/scripts/config/qconf-cfg.sh index 609bb818e8fec2..203ddf4203406a 100755 --- a/scripts/config/qconf-cfg.sh +++ b/scripts/config/qconf-cfg.sh @@ -1,24 +1,40 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0-only -PKG="Qt5Core Qt5Gui Qt5Widgets" +cflags=$1 +libs=$2 +bin=$3 -if [ -z "$(command -v pkg-config)" ]; then +PKG5="Qt5Core Qt5Gui Qt5Widgets" +PKG6="Qt6Core Qt6Gui Qt6Widgets" + +if [ -z "$(command -v ${HOSTPKG_CONFIG})" ]; then echo >&2 "*" - echo >&2 "* 'make xconfig' requires 'pkg-config'. Please install it." + echo >&2 "* 'make xconfig' requires '${HOSTPKG_CONFIG}'. Please install it." echo >&2 "*" exit 1 fi -if pkg-config --exists $PKG; then - echo cflags=\"-std=c++11 -fPIC $(pkg-config --cflags $PKG)\" - echo libs=\"$(pkg-config --libs $PKG)\" - echo moc=\"$(pkg-config --variable=host_bins Qt5Core)/moc\" +if ${HOSTPKG_CONFIG} --exists $PKG6; then + ${HOSTPKG_CONFIG} --cflags ${PKG6} > ${cflags} + # Qt6 requires C++17. + echo -std=c++17 >> ${cflags} + ${HOSTPKG_CONFIG} --libs ${PKG6} > ${libs} + ${HOSTPKG_CONFIG} --variable=libexecdir Qt6Core > ${bin} + exit 0 +fi + +if ${HOSTPKG_CONFIG} --exists $PKG5; then + ${HOSTPKG_CONFIG} --cflags ${PKG5} > ${cflags} + ${HOSTPKG_CONFIG} --libs ${PKG5} > ${libs} + ${HOSTPKG_CONFIG} --variable=host_bins Qt5Core > ${bin} exit 0 fi echo >&2 "*" -echo >&2 "* Could not find Qt5 via pkg-config." -echo >&2 "* Please install Qt5 and make sure it's in PKG_CONFIG_PATH" +echo >&2 "* Could not find Qt6 or Qt5 via ${HOSTPKG_CONFIG}." +echo >&2 "* Please install Qt6 or Qt5 and make sure it's in PKG_CONFIG_PATH" +echo >&2 "* You need $PKG6 for Qt6" +echo >&2 "* You need $PKG5 for Qt5" echo >&2 "*" exit 1 diff --git a/scripts/config/qconf.cc b/scripts/config/qconf.cc index ed7b3e3e20e9b5..abf0d0b392b943 100644 --- a/scripts/config/qconf.cc +++ b/scripts/config/qconf.cc @@ -5,10 +5,10 @@ */ #include +#include #include #include #include -#include #include #include #include @@ -16,6 +16,8 @@ #include #include #include +#include +#include #include #include @@ -1126,7 +1128,7 @@ QString ConfigInfoView::debug_info(struct symbol *sym) QString ConfigInfoView::print_filter(const QString &str) { - QRegExp re("[<>&\"\\n]"); + QRegularExpression re("[<>&\"\\n]"); QString res = str; for (int i = 0; (i = res.indexOf(re, i)) >= 0;) { switch (res[i].toLatin1()) { @@ -1322,15 +1324,15 @@ ConfigMainWindow::ConfigMainWindow(void) int width, height; char title[256]; - QDesktopWidget *d = configApp->desktop(); snprintf(title, sizeof(title), "%s%s", rootmenu.prompt->text, "" ); setWindowTitle(title); - width = configSettings->value("/window width", d->width() - 64).toInt(); - height = configSettings->value("/window height", d->height() - 64).toInt(); + QRect g = configApp->primaryScreen()->geometry(); + width = configSettings->value("/window width", g.width() - 64).toInt(); + height = configSettings->value("/window height", g.height() - 64).toInt(); resize(width, height); x = configSettings->value("/window x"); y = configSettings->value("/window y"); @@ -1379,17 +1381,17 @@ ConfigMainWindow::ConfigMainWindow(void) this, &ConfigMainWindow::goBack); QAction *quitAction = new QAction("&Quit", this); - quitAction->setShortcut(Qt::CTRL + Qt::Key_Q); + quitAction->setShortcut(Qt::CTRL | Qt::Key_Q); connect(quitAction, &QAction::triggered, this, &ConfigMainWindow::close); QAction *loadAction = new QAction(QPixmap(xpm_load), "&Load", this); - loadAction->setShortcut(Qt::CTRL + Qt::Key_L); + loadAction->setShortcut(Qt::CTRL | Qt::Key_L); connect(loadAction, &QAction::triggered, this, &ConfigMainWindow::loadConfig); saveAction = new QAction(QPixmap(xpm_save), "&Save", this); - saveAction->setShortcut(Qt::CTRL + Qt::Key_S); + saveAction->setShortcut(Qt::CTRL | Qt::Key_S); connect(saveAction, &QAction::triggered, this, &ConfigMainWindow::saveConfig); @@ -1403,7 +1405,7 @@ ConfigMainWindow::ConfigMainWindow(void) connect(saveAsAction, &QAction::triggered, this, &ConfigMainWindow::saveConfigAs); QAction *searchAction = new QAction("&Find", this); - searchAction->setShortcut(Qt::CTRL + Qt::Key_F); + searchAction->setShortcut(Qt::CTRL | Qt::Key_F); connect(searchAction, &QAction::triggered, this, &ConfigMainWindow::searchConfig); singleViewAction = new QAction(QPixmap(xpm_single_view), "Single View", this); @@ -1750,11 +1752,21 @@ void ConfigMainWindow::closeEvent(QCloseEvent* e) e->accept(); return; } - QMessageBox mb("qconf", "Save configuration?", QMessageBox::Warning, - QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, QMessageBox::Cancel | QMessageBox::Escape); - mb.setButtonText(QMessageBox::Yes, "&Save Changes"); - mb.setButtonText(QMessageBox::No, "&Discard Changes"); - mb.setButtonText(QMessageBox::Cancel, "Cancel Exit"); + + QMessageBox mb(QMessageBox::Icon::Warning, "qconf", + "Save configuration?"); + + QPushButton *yb = mb.addButton(QMessageBox::Yes); + QPushButton *db = mb.addButton(QMessageBox::No); + QPushButton *cb = mb.addButton(QMessageBox::Cancel); + + yb->setText("&Save Changes"); + db->setText("&Discard Changes"); + cb->setText("Cancel Exit"); + + mb.setDefaultButton(yb); + mb.setEscapeButton(cb); + switch (mb.exec()) { case QMessageBox::Yes: if (saveConfig()) diff --git a/scripts/config/symbol.c b/scripts/config/symbol.c index d97b56ab0ece7a..6ef44adc057e41 100644 --- a/scripts/config/symbol.c +++ b/scripts/config/symbol.c @@ -123,9 +123,9 @@ static long long sym_get_range_val(struct symbol *sym, int base) static void sym_validate_range(struct symbol *sym) { struct property *prop; + struct symbol *range_sym; int base; long long val, val2; - char str[64]; switch (sym->type) { case S_INT: @@ -141,17 +141,15 @@ static void sym_validate_range(struct symbol *sym) if (!prop) return; val = strtoll(sym->curr.val, NULL, base); - val2 = sym_get_range_val(prop->expr->left.sym, base); + range_sym = prop->expr->left.sym; + val2 = sym_get_range_val(range_sym, base); if (val >= val2) { - val2 = sym_get_range_val(prop->expr->right.sym, base); + range_sym = prop->expr->right.sym; + val2 = sym_get_range_val(range_sym, base); if (val <= val2) return; } - if (sym->type == S_INT) - sprintf(str, "%lld", val2); - else - sprintf(str, "0x%llx", val2); - sym->curr.val = xstrdup(str); + sym->curr.val = range_sym->curr.val; } static void sym_set_changed(struct symbol *sym) @@ -851,49 +849,6 @@ struct symbol *sym_find(const char *name) return symbol; } -const char *sym_escape_string_value(const char *in) -{ - const char *p; - size_t reslen; - char *res; - size_t l; - - reslen = strlen(in) + strlen("\"\"") + 1; - - p = in; - for (;;) { - l = strcspn(p, "\"\\"); - p += l; - - if (p[0] == '\0') - break; - - reslen++; - p++; - } - - res = xmalloc(reslen); - res[0] = '\0'; - - strcat(res, "\""); - - p = in; - for (;;) { - l = strcspn(p, "\"\\"); - strncat(res, p, l); - p += l; - - if (p[0] == '\0') - break; - - strcat(res, "\\"); - strncat(res, p++, 1); - } - - strcat(res, "\""); - return res; -} - struct sym_match { struct symbol *sym; off_t so, eo; diff --git a/scripts/config/util.c b/scripts/config/util.c index 0bc415cd737e54..53e079e2e8af1a 100644 --- a/scripts/config/util.c +++ b/scripts/config/util.c @@ -74,7 +74,7 @@ void str_printf(struct gstr *gs, const char *fmt, ...) } /* Retrieve value of growable string */ -const char *str_get(struct gstr *gs) +char *str_get(struct gstr *gs) { return gs->s; } diff --git a/scripts/get_source_date_epoch.sh b/scripts/get_source_date_epoch.sh index d122acf385326b..727cb0372b0c5f 100755 --- a/scripts/get_source_date_epoch.sh +++ b/scripts/get_source_date_epoch.sh @@ -15,8 +15,8 @@ try_version() { } try_git() { - SOURCE_DATE_EPOCH=$(git -C "$SOURCE" log -1 --format=format:%ct \ - "$SOURCE" 2>/dev/null) + SOURCE_DATE_EPOCH=$(git -C "$SOURCE" log -1 --no-show-signature \ + --format=format:%ct "$SOURCE" 2>/dev/null) [ -n "$SOURCE_DATE_EPOCH" ] } diff --git a/scripts/kernel_bump.sh b/scripts/kernel_bump.sh new file mode 100755 index 00000000000000..5896bfc48fb252 --- /dev/null +++ b/scripts/kernel_bump.sh @@ -0,0 +1,225 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Copyright (C) 2024 Olliver Schinagl + +set -eu +if [ -n "${DEBUG_TRACE_SH:-}" ] && \ + [ "${DEBUG_TRACE_SH:-}" != "${DEBUG_TRACE_SH#*"$(basename "${0}")"*}" ] || \ + [ "${DEBUG_TRACE_SH:-}" = 'all' ]; then + set -x +fi + +REQUIRED_COMMANDS=' + [ + basename + command + echo + exit + git + printf + set + shift +' + +_msg() +{ + _level="${1:?Missing argument to function}" + shift + + if [ "${#}" -le 0 ]; then + echo "${_level}: No content for this message ..." + return + fi + + echo "${_level}: ${*}" +} + +e_err() +{ + _msg 'err' "${*}" >&2 +} + +e_warn() +{ + _msg 'warning' "${*}" +} + +e_notice() +{ + _msg 'notice' "${*}" +} + +usage() +{ + echo "Usage: ${0}" + echo 'Helper script to bump the target kernel version, whilst keeping history.' + echo " -p Optional Platform name (e.g. 'ath79' [PLATFORM_NAME]" + echo " -s Source version of kernel (e.g. 'v6.1' [SOURCE_VERSION])" + echo " -t Target version of kernel (e.g. 'v6.6' [TARGET_VERSION]')" + echo + echo 'All options can also be passed in environment variables (listed between [BRACKETS]).' + echo 'Example: scripts/kernel_bump.sh -p realtek -s v6.1 -t v6.6' +} + +cleanup() +{ + trap - EXIT HUP INT QUIT ABRT ALRM TERM + + if [ -n "${initial_branch:-}" ] && \ + [ "$(git rev-parse --abbrev-ref HEAD)" != "${initial_branch:-}" ]; then + git switch "${initial_branch}" + fi +} + +init() +{ + initial_branch="$(git rev-parse --abbrev-ref HEAD)" + initial_commitish="$(git rev-parse HEAD)" + + trap cleanup EXIT HUP INT QUIT ABRT ALRM TERM +} + +do_source_target() +{ + _target_dir="${1:?Missing argument to function}" + _op="${2:?Missing argument to function}" + +} + +bump_kernel() +{ + platform_name="${platform_name##*'/'}" + + if [ -z "${platform_name:-}" ]; then + platform_name="${PWD##*'/'}" + fi + + if [ "${PWD##*'/'}" = "${platform_name}" ]; then + _target_dir='./' + else + _target_dir="target/linux/${platform_name}" + fi + + if [ ! -d "${_target_dir}/image" ]; then + e_err 'Cannot find target linux directory.' + exit 1 + fi + + git switch --force-create '__openwrt_kernel_files_mover' + + for _path in "${_target_dir}/"*; do + if [ ! -s "${_path}" ] || \ + [ "${_path}" = "${_path%%"-${source_version}"}" ]; then + continue + fi + + _target_path="${_path%%"-${source_version}"}-${target_version}" + if [ -s "${_target_path}" ]; then + e_err "Target '${_target_path}' already exists!" + exit 1 + fi + + git mv \ + "${_path}" \ + "${_target_path}" + done + + find "${_target_dir}" -iname "config-${source_version}" | while read -r _config; do + _path="${_config%%"/config-${source_version}"}" + git mv "${_config}" "${_path}/config-${target_version}" + done + + git commit \ + --signoff \ + --message "kernel/${platform_name}: Create kernel files for v${target_version} (from v${source_version})" \ + --message 'This is an automatically generated commit.' \ + --message 'During a `git bisect` session, `git bisect --skip` is recommended.' + + git checkout 'HEAD~' "${_target_dir}" + git commit \ + --signoff \ + --message "kernel/${platform_name}: Restore kernel files for v${source_version}" \ + --message "$(printf "This is an automatically generated commit which aids following Kernel patch history,\nas git will see the move and copy as a rename thus defeating the purpose.\n\nSee: https://lists.openwrt.org/pipermail/openwrt-devel/2023-October/041673.html\nfor the original discussion.")" + git switch "${initial_branch:?Unable to switch back to original branch. Quitting.}" + GIT_EDITOR=true git merge --no-ff '__openwrt_kernel_files_mover' + git branch --delete '__openwrt_kernel_files_mover' + + echo "Original commitish was '${initial_commitish}'." + echo 'Kernel bump complete. Remember to use `git log --follow`.' +} + +check_requirements() +{ + for _cmd in ${REQUIRED_COMMANDS}; do + if ! _test_result="$(command -V "${_cmd}")"; then + _test_result_fail="${_test_result_fail:-}${_test_result}\n" + else + _test_result_pass="${_test_result_pass:-}${_test_result}\n" + fi + done + + echo 'Available commands:' + # As the results contain \n, we expect these to be interpreted. + # shellcheck disable=SC2059 + printf "${_test_result_pass:-none\n}" + echo + echo 'Missing commands:' + # shellcheck disable=SC2059 + printf "${_test_result_fail:-none\n}" + echo + + if [ -n "${_test_result_fail:-}" ]; then + echo 'Command test failed, missing programs.' + test_failed=1 + fi +} + +main() +{ + while getopts 'hp:s:t:' _options; do + case "${_options}" in + 'h') + usage + exit 0 + ;; + 'p') + platform_name="${OPTARG}" + ;; + 's') + source_version="${OPTARG#v}" + ;; + 't') + target_version="${OPTARG#v}" + ;; + ':') + e_err "Option -${OPTARG} requires an argument." + exit 1 + ;; + *) + e_err "Invalid option: -${OPTARG}" + exit 1 + ;; + esac + done + shift "$((OPTIND - 1))" + + platform_name="${platform_name:-${PLATFORM_NAME:-}}" + source_version="${source_version:-${SOURCE_VERSION:-}}" + target_version="${target_version:-${TARGET_VERSION:-}}" + + if [ -z "${source_version:-}" ] || [ -z "${target_version:-}" ]; then + e_err "Source (${source_version}) and target (${target_version}) versions need to be defined." + exit 1 + fi + + check_requirements + + init + bump_kernel + cleanup +} + +main "${@}" + +exit 0 diff --git a/scripts/package-metadata.pl b/scripts/package-metadata.pl index 9e0e6dd9e58934..a46f819ab50f0f 100755 --- a/scripts/package-metadata.pl +++ b/scripts/package-metadata.pl @@ -677,6 +677,7 @@ () license => "GPL-2.0", cpe_id => "cpe:/o:linux:linux_kernel", name => "kernel", + category => "operating-system", }; my %abimap; @@ -705,6 +706,7 @@ () if ($pkg->{category}) { my $category = $pkg->{category}; my %cat_type = ( + "operating-system" => "operating-system", "Firmware" => "firmware", "Libraries" => "library" ); diff --git a/scripts/patch-kernel.sh b/scripts/patch-kernel.sh index c2b7e7204952f9..52750dde6edf19 100755 --- a/scripts/patch-kernel.sh +++ b/scripts/patch-kernel.sh @@ -1,4 +1,4 @@ -#! /bin/sh +#!/bin/sh # A little script I whipped up to make it easy to # patch source trees and have sane error handling # -Erik diff --git a/target/Makefile b/target/Makefile index 83f9c4b0934a58..3bbb9f4131336d 100644 --- a/target/Makefile +++ b/target/Makefile @@ -19,6 +19,8 @@ $(curdir)/builddirs-install:=\ $(curdir)/sdk/install:=$(curdir)/linux/install $(curdir)/imagebuilder/install:=$(curdir)/linux/install +$(curdir)//compile = $(STAGING_DIR)/.prepared $(BIN_DIR) + $(eval $(call stampfile,$(curdir),target,prereq,.config)) $(eval $(call stampfile,$(curdir),target,compile,$(TMP_DIR)/.build)) $(eval $(call stampfile,$(curdir),target,install,$(TMP_DIR)/.build)) diff --git a/target/linux/airoha/Makefile b/target/linux/airoha/Makefile index 723bec8cd434dc..5906a1307e02a9 100644 --- a/target/linux/airoha/Makefile +++ b/target/linux/airoha/Makefile @@ -7,6 +7,7 @@ CPU_TYPE:=cortex-a7 FEATURES:=dt squashfs nand ramdisk gpio source-only KERNEL_PATCHVER:=5.15 +KERNEL_TESTING_PATCHVER:=6.1 include $(INCLUDE_DIR)/target.mk diff --git a/target/linux/airoha/config-6.1 b/target/linux/airoha/config-6.1 new file mode 100644 index 00000000000000..3402d779b2773d --- /dev/null +++ b/target/linux/airoha/config-6.1 @@ -0,0 +1,293 @@ +CONFIG_ALIGNMENT_TRAP=y +CONFIG_ARCH_32BIT_OFF_T=y +CONFIG_ARCH_AIROHA=y +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_ARCH_KEEP_MEMBLOCK=y +CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y +CONFIG_ARCH_MULTIPLATFORM=y +CONFIG_ARCH_MULTI_V6_V7=y +CONFIG_ARCH_MULTI_V7=y +CONFIG_ARCH_NR_GPIO=0 +CONFIG_ARCH_OPTIONAL_KERNEL_RWX=y +CONFIG_ARCH_OPTIONAL_KERNEL_RWX_DEFAULT=y +CONFIG_ARCH_SELECT_MEMORY_MODEL=y +CONFIG_ARCH_SPARSEMEM_ENABLE=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_ARM=y +CONFIG_ARM_AMBA=y +CONFIG_ARM_ARCH_TIMER=y +CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y +CONFIG_ARM_CPU_SUSPEND=y +CONFIG_ARM_GIC=y +CONFIG_ARM_GIC_V3=y +CONFIG_ARM_GIC_V3_ITS=y +CONFIG_ARM_GIC_V3_ITS_PCI=y +CONFIG_ARM_HAS_GROUP_RELOCS=y +CONFIG_ARM_HEAVY_MB=y +# CONFIG_ARM_HIGHBANK_CPUIDLE is not set +CONFIG_ARM_L1_CACHE_SHIFT=6 +CONFIG_ARM_L1_CACHE_SHIFT_6=y +CONFIG_ARM_PATCH_IDIV=y +CONFIG_ARM_PATCH_PHYS_VIRT=y +CONFIG_ARM_PSCI=y +CONFIG_ARM_PSCI_FW=y +# CONFIG_ARM_SMMU is not set +CONFIG_ARM_THUMB=y +CONFIG_ARM_UNWIND=y +CONFIG_ARM_VIRT_EXT=y +CONFIG_ATAGS=y +CONFIG_AUTO_ZRELADDR=y +CONFIG_BINFMT_FLAT_ARGVP_ENVP_ON_STACK=y +CONFIG_BLK_DEV_SD=y +CONFIG_BLK_MQ_PCI=y +CONFIG_BLK_PM=y +CONFIG_BSD_PROCESS_ACCT=y +CONFIG_BSD_PROCESS_ACCT_V3=y +CONFIG_CACHE_L2X0=y +CONFIG_CC_HAVE_STACKPROTECTOR_TLS=y +CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" +CONFIG_CC_NO_ARRAY_BOUNDS=y +CONFIG_CLONE_BACKWARDS=y +CONFIG_CMDLINE="rootfstype=squashfs,jffs2" +CONFIG_CMDLINE_FROM_BOOTLOADER=y +CONFIG_COMMON_CLK=y +CONFIG_COMMON_CLK_EN7523=y +CONFIG_COMPACT_UNEVICTABLE_DEFAULT=1 +CONFIG_COMPAT_32BIT_TIME=y +CONFIG_CONTEXT_TRACKING=y +CONFIG_CONTEXT_TRACKING_IDLE=y +CONFIG_CPU_32v6K=y +CONFIG_CPU_32v7=y +CONFIG_CPU_ABRT_EV7=y +CONFIG_CPU_CACHE_V7=y +CONFIG_CPU_CACHE_VIPT=y +CONFIG_CPU_COPY_V6=y +CONFIG_CPU_CP15=y +CONFIG_CPU_CP15_MMU=y +CONFIG_CPU_HAS_ASID=y +CONFIG_CPU_IDLE=y +CONFIG_CPU_IDLE_GOV_MENU=y +CONFIG_CPU_LITTLE_ENDIAN=y +CONFIG_CPU_PABRT_V7=y +CONFIG_CPU_PM=y +CONFIG_CPU_RMAP=y +CONFIG_CPU_SPECTRE=y +CONFIG_CPU_THUMB_CAPABLE=y +CONFIG_CPU_TLB_V7=y +CONFIG_CPU_V7=y +CONFIG_CRC16=y +CONFIG_CRYPTO_DEFLATE=y +CONFIG_CRYPTO_HASH_INFO=y +CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y +CONFIG_CRYPTO_LIB_SHA1=y +CONFIG_CRYPTO_LIB_UTILS=y +CONFIG_CRYPTO_LZO=y +CONFIG_CRYPTO_RNG2=y +CONFIG_CRYPTO_ZSTD=y +CONFIG_CURRENT_POINTER_IN_TPIDRURO=y +CONFIG_DCACHE_WORD_ACCESS=y +CONFIG_DEBUG_INFO=y +CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S" +CONFIG_DEBUG_MISC=y +CONFIG_DMA_OPS=y +CONFIG_DTC=y +CONFIG_EDAC_ATOMIC_SCRUB=y +CONFIG_EDAC_SUPPORT=y +CONFIG_EXCLUSIVE_SYSTEM_RAM=y +CONFIG_FIXED_PHY=y +CONFIG_FIX_EARLYCON_MEM=y +CONFIG_FWNODE_MDIO=y +CONFIG_FW_LOADER_PAGED_BUF=y +CONFIG_FW_LOADER_SYSFS=y +CONFIG_GCC11_NO_ARRAY_BOUNDS=y +CONFIG_GENERIC_ALLOCATOR=y +CONFIG_GENERIC_ARCH_TOPOLOGY=y +CONFIG_GENERIC_BUG=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y +CONFIG_GENERIC_CPU_AUTOPROBE=y +CONFIG_GENERIC_CPU_VULNERABILITIES=y +CONFIG_GENERIC_EARLY_IOREMAP=y +CONFIG_GENERIC_GETTIMEOFDAY=y +CONFIG_GENERIC_IDLE_POLL_SETUP=y +CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y +CONFIG_GENERIC_IRQ_MIGRATION=y +CONFIG_GENERIC_IRQ_MULTI_HANDLER=y +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_GENERIC_IRQ_SHOW_LEVEL=y +CONFIG_GENERIC_LIB_DEVMEM_IS_ALLOWED=y +CONFIG_GENERIC_MSI_IRQ=y +CONFIG_GENERIC_MSI_IRQ_DOMAIN=y +CONFIG_GENERIC_PCI_IOMAP=y +CONFIG_GENERIC_PHY=y +CONFIG_GENERIC_PINCONF=y +CONFIG_GENERIC_PINCTRL_GROUPS=y +CONFIG_GENERIC_PINMUX_FUNCTIONS=y +CONFIG_GENERIC_SCHED_CLOCK=y +CONFIG_GENERIC_SMP_IDLE_THREAD=y +CONFIG_GENERIC_STRNCPY_FROM_USER=y +CONFIG_GENERIC_STRNLEN_USER=y +CONFIG_GENERIC_TIME_VSYSCALL=y +CONFIG_GENERIC_VDSO_32=y +CONFIG_GPIOLIB_IRQCHIP=y +CONFIG_GPIO_CDEV=y +CONFIG_GPIO_EN7523=y +CONFIG_GPIO_GENERIC=y +CONFIG_HARDEN_BRANCH_PREDICTOR=y +CONFIG_HARDIRQS_SW_RESEND=y +CONFIG_HAS_DMA=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT_MAP=y +CONFIG_HAVE_SMP=y +CONFIG_HOTPLUG_CPU=y +CONFIG_HW_RANDOM=y +CONFIG_HZ_FIXED=0 +CONFIG_INITRAMFS_SOURCE="" +# CONFIG_IOMMU_DEBUGFS is not set +# CONFIG_IOMMU_IO_PGTABLE_ARMV7S is not set +# CONFIG_IOMMU_IO_PGTABLE_LPAE is not set +CONFIG_IOMMU_SUPPORT=y +CONFIG_IRQCHIP=y +CONFIG_IRQSTACKS=y +CONFIG_IRQ_DOMAIN=y +CONFIG_IRQ_DOMAIN_HIERARCHY=y +CONFIG_IRQ_FORCED_THREADING=y +CONFIG_IRQ_TIME_ACCOUNTING=y +CONFIG_IRQ_WORK=y +# CONFIG_LEDS_BRIGHTNESS_HW_CHANGED is not set +CONFIG_LIBFDT=y +CONFIG_LOCK_DEBUGGING_SUPPORT=y +CONFIG_LOCK_SPIN_ON_OWNER=y +CONFIG_LZO_COMPRESS=y +CONFIG_LZO_DECOMPRESS=y +CONFIG_MDIO_BUS=y +CONFIG_MDIO_DEVICE=y +CONFIG_MDIO_DEVRES=y +CONFIG_MEMFD_CREATE=y +CONFIG_MFD_SYSCON=y +CONFIG_MIGHT_HAVE_CACHE_L2X0=y +CONFIG_MIGRATION=y +CONFIG_MODULES_USE_ELF_REL=y +CONFIG_MTD_NAND_CORE=y +CONFIG_MTD_NAND_ECC=y +CONFIG_MTD_NAND_ECC_SW_HAMMING=y +CONFIG_MTD_SPI_NAND=y +CONFIG_MTD_SPI_NOR=y +CONFIG_MTD_SPLIT_FIRMWARE=y +CONFIG_MTD_SPLIT_FIT_FW=y +CONFIG_MTD_UBI=y +CONFIG_MTD_UBI_BEB_LIMIT=20 +CONFIG_MTD_UBI_BLOCK=y +CONFIG_MTD_UBI_WL_THRESHOLD=4096 +CONFIG_MUTEX_SPIN_ON_OWNER=y +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_NET_FLOW_LIMIT=y +CONFIG_NET_SELFTESTS=y +CONFIG_NLS=y +CONFIG_NO_HZ_COMMON=y +CONFIG_NO_HZ_IDLE=y +CONFIG_NR_CPUS=2 +CONFIG_NVMEM=y +CONFIG_NVMEM_LAYOUTS=y +CONFIG_NVMEM_SYSFS=y +CONFIG_OF=y +CONFIG_OF_ADDRESS=y +CONFIG_OF_EARLY_FLATTREE=y +CONFIG_OF_FLATTREE=y +CONFIG_OF_GPIO=y +CONFIG_OF_IRQ=y +CONFIG_OF_KOBJ=y +CONFIG_OF_MDIO=y +CONFIG_OLD_SIGACTION=y +CONFIG_OLD_SIGSUSPEND3=y +CONFIG_OUTER_CACHE=y +CONFIG_OUTER_CACHE_SYNC=y +CONFIG_PADATA=y +CONFIG_PAGE_OFFSET=0xC0000000 +CONFIG_PAGE_POOL=y +CONFIG_PAGE_SIZE_LESS_THAN_256KB=y +CONFIG_PAGE_SIZE_LESS_THAN_64KB=y +CONFIG_PAHOLE_HAS_LANG_EXCLUDE=y +CONFIG_PARTITION_PERCPU=y +CONFIG_PCI=y +CONFIG_PCIEAER=y +CONFIG_PCIEPORTBUS=y +CONFIG_PCIE_MEDIATEK=y +CONFIG_PCIE_PME=y +CONFIG_PCI_DOMAINS=y +CONFIG_PCI_DOMAINS_GENERIC=y +CONFIG_PCI_MSI=y +CONFIG_PCI_MSI_IRQ_DOMAIN=y +CONFIG_PERF_USE_VMALLOC=y +CONFIG_PGTABLE_LEVELS=2 +CONFIG_PHYLIB=y +CONFIG_PHYLIB_LEDS=y +CONFIG_PINCTRL=y +CONFIG_PM=y +CONFIG_PM_CLK=y +CONFIG_PREEMPT_NONE_BUILD=y +CONFIG_PTP_1588_CLOCK_OPTIONAL=y +CONFIG_PWM=y +CONFIG_PWM_SYSFS=y +CONFIG_RANDSTRUCT_NONE=y +CONFIG_RAS=y +CONFIG_RATIONAL=y +CONFIG_REGMAP=y +CONFIG_REGMAP_MMIO=y +CONFIG_RESET_CONTROLLER=y +CONFIG_RFS_ACCEL=y +CONFIG_RPS=y +CONFIG_RWSEM_SPIN_ON_OWNER=y +CONFIG_SCSI=y +CONFIG_SCSI_COMMON=y +CONFIG_SERIAL_8250_EXTENDED=y +CONFIG_SERIAL_8250_FSL=y +# CONFIG_SERIAL_8250_SHARE_IRQ is not set +CONFIG_SERIAL_MCTRL_GPIO=y +CONFIG_SERIAL_OF_PLATFORM=y +CONFIG_SGL_ALLOC=y +CONFIG_SG_POOL=y +CONFIG_SMP=y +CONFIG_SMP_ON_UP=y +CONFIG_SOCK_RX_QUEUE_MAPPING=y +CONFIG_SOFTIRQ_ON_OWN_STACK=y +CONFIG_SPARSE_IRQ=y +CONFIG_SPI=y +CONFIG_SPI_AIROHA_EN7523=y +CONFIG_SPI_MASTER=y +CONFIG_SPI_MEM=y +CONFIG_SRCU=y +CONFIG_STACKTRACE=y +# CONFIG_SWAP is not set +CONFIG_SWPHY=y +CONFIG_SWP_EMULATE=y +CONFIG_SYS_SUPPORTS_APM_EMULATION=y +CONFIG_THREAD_INFO_IN_TASK=y +CONFIG_TICK_CPU_ACCOUNTING=y +CONFIG_TIMER_OF=y +CONFIG_TIMER_PROBE=y +CONFIG_TREE_RCU=y +CONFIG_TREE_SRCU=y +CONFIG_UBIFS_FS=y +CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h" +CONFIG_UNWINDER_ARM=y +CONFIG_USB=y +CONFIG_USB_COMMON=y +CONFIG_USB_SUPPORT=y +CONFIG_USB_XHCI_HCD=y +# CONFIG_USB_XHCI_PLATFORM is not set +CONFIG_USE_OF=y +# CONFIG_VFP is not set +CONFIG_WATCHDOG_CORE=y +# CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set +CONFIG_XPS=y +CONFIG_XXHASH=y +CONFIG_XZ_DEC_ARM=y +CONFIG_XZ_DEC_BCJ=y +CONFIG_ZBOOT_ROM_BSS=0 +CONFIG_ZBOOT_ROM_TEXT=0 +CONFIG_ZLIB_DEFLATE=y +CONFIG_ZLIB_INFLATE=y +CONFIG_ZSTD_COMMON=y +CONFIG_ZSTD_COMPRESS=y +CONFIG_ZSTD_DECOMPRESS=y diff --git a/target/linux/airoha/dts/en7523.dtsi b/target/linux/airoha/dts/en7523.dtsi index 72478b225cbb07..024a89752acbe8 100644 --- a/target/linux/airoha/dts/en7523.dtsi +++ b/target/linux/airoha/dts/en7523.dtsi @@ -157,7 +157,7 @@ clocks = <&scu EN7523_CLK_PCIE>; clock-names = "sys_ck0"; bus-range = <0x00 0xff>; - ranges = <0x82000000 0 0x20000000 0x20000000 0 0x8000000>; + ranges = <0x82000000 0 0x20000000 0x20000000 0 0x2000000>; status = "disabled"; #interrupt-cells = <1>; @@ -186,7 +186,7 @@ clocks = <&scu EN7523_CLK_PCIE>; clock-names = "sys_ck1"; bus-range = <0x00 0xff>; - ranges = <0x82000000 0 0x28000000 0x28000000 0 0x8000000>; + ranges = <0x82000000 0 0x22000000 0x22000000 0 0x2000000>; status = "disabled"; #interrupt-cells = <1>; diff --git a/target/linux/airoha/files/arch/arm/mach-airoha/Makefile b/target/linux/airoha/files-5.15/arch/arm/mach-airoha/Makefile similarity index 100% rename from target/linux/airoha/files/arch/arm/mach-airoha/Makefile rename to target/linux/airoha/files-5.15/arch/arm/mach-airoha/Makefile diff --git a/target/linux/airoha/files/arch/arm/mach-airoha/airoha.c b/target/linux/airoha/files-5.15/arch/arm/mach-airoha/airoha.c similarity index 100% rename from target/linux/airoha/files/arch/arm/mach-airoha/airoha.c rename to target/linux/airoha/files-5.15/arch/arm/mach-airoha/airoha.c diff --git a/target/linux/airoha/files/drivers/clk/clk-en7523.c b/target/linux/airoha/files-5.15/drivers/clk/clk-en7523.c similarity index 100% rename from target/linux/airoha/files/drivers/clk/clk-en7523.c rename to target/linux/airoha/files-5.15/drivers/clk/clk-en7523.c diff --git a/target/linux/airoha/files/drivers/gpio/gpio-en7523.c b/target/linux/airoha/files-5.15/drivers/gpio/gpio-en7523.c similarity index 100% rename from target/linux/airoha/files/drivers/gpio/gpio-en7523.c rename to target/linux/airoha/files-5.15/drivers/gpio/gpio-en7523.c diff --git a/target/linux/airoha/files/include/dt-bindings/clock/en7523-clk.h b/target/linux/airoha/files-5.15/include/dt-bindings/clock/en7523-clk.h similarity index 100% rename from target/linux/airoha/files/include/dt-bindings/clock/en7523-clk.h rename to target/linux/airoha/files-5.15/include/dt-bindings/clock/en7523-clk.h diff --git a/target/linux/airoha/patches-6.1/0005-spi-Add-support-for-the-Airoha-EN7523-SoC-SPI-contro.patch b/target/linux/airoha/patches-6.1/0005-spi-Add-support-for-the-Airoha-EN7523-SoC-SPI-contro.patch new file mode 100644 index 00000000000000..dc28bd1df97a5e --- /dev/null +++ b/target/linux/airoha/patches-6.1/0005-spi-Add-support-for-the-Airoha-EN7523-SoC-SPI-contro.patch @@ -0,0 +1,341 @@ +--- a/drivers/spi/Kconfig ++++ b/drivers/spi/Kconfig +@@ -330,6 +330,12 @@ config SPI_DLN2 + This driver can also be built as a module. If so, the module + will be called spi-dln2. + ++config SPI_AIROHA_EN7523 ++ bool "Airoha EN7523 SPI controller support" ++ depends on ARCH_AIROHA ++ help ++ This enables SPI controller support for the Airoha EN7523 SoC. ++ + config SPI_EP93XX + tristate "Cirrus Logic EP93xx SPI controller" + depends on ARCH_EP93XX || COMPILE_TEST +--- a/drivers/spi/Makefile ++++ b/drivers/spi/Makefile +@@ -47,6 +47,7 @@ obj-$(CONFIG_SPI_DW_BT1) += spi-dw-bt1. + obj-$(CONFIG_SPI_DW_MMIO) += spi-dw-mmio.o + obj-$(CONFIG_SPI_DW_PCI) += spi-dw-pci.o + obj-$(CONFIG_SPI_EP93XX) += spi-ep93xx.o ++obj-$(CONFIG_SPI_AIROHA_EN7523) += spi-en7523.o + obj-$(CONFIG_SPI_FALCON) += spi-falcon.o + obj-$(CONFIG_SPI_FSI) += spi-fsi.o + obj-$(CONFIG_SPI_FSL_CPM) += spi-fsl-cpm.o +--- /dev/null ++++ b/drivers/spi/spi-en7523.c +@@ -0,0 +1,313 @@ ++// SPDX-License-Identifier: GPL-2.0 ++ ++#include ++#include ++#include ++#include ++ ++ ++#define ENSPI_READ_IDLE_EN 0x0004 ++#define ENSPI_MTX_MODE_TOG 0x0014 ++#define ENSPI_RDCTL_FSM 0x0018 ++#define ENSPI_MANUAL_EN 0x0020 ++#define ENSPI_MANUAL_OPFIFO_EMPTY 0x0024 ++#define ENSPI_MANUAL_OPFIFO_WDATA 0x0028 ++#define ENSPI_MANUAL_OPFIFO_FULL 0x002C ++#define ENSPI_MANUAL_OPFIFO_WR 0x0030 ++#define ENSPI_MANUAL_DFIFO_FULL 0x0034 ++#define ENSPI_MANUAL_DFIFO_WDATA 0x0038 ++#define ENSPI_MANUAL_DFIFO_EMPTY 0x003C ++#define ENSPI_MANUAL_DFIFO_RD 0x0040 ++#define ENSPI_MANUAL_DFIFO_RDATA 0x0044 ++#define ENSPI_IER 0x0090 ++#define ENSPI_NFI2SPI_EN 0x0130 ++ ++// TODO not in spi block ++#define ENSPI_CLOCK_DIVIDER ((void __iomem *)0x1fa201c4) ++ ++#define OP_CSH 0x00 ++#define OP_CSL 0x01 ++#define OP_CK 0x02 ++#define OP_OUTS 0x08 ++#define OP_OUTD 0x09 ++#define OP_OUTQ 0x0A ++#define OP_INS 0x0C ++#define OP_INS0 0x0D ++#define OP_IND 0x0E ++#define OP_INQ 0x0F ++#define OP_OS2IS 0x10 ++#define OP_OS2ID 0x11 ++#define OP_OS2IQ 0x12 ++#define OP_OD2IS 0x13 ++#define OP_OD2ID 0x14 ++#define OP_OD2IQ 0x15 ++#define OP_OQ2IS 0x16 ++#define OP_OQ2ID 0x17 ++#define OP_OQ2IQ 0x18 ++#define OP_OSNIS 0x19 ++#define OP_ODNID 0x1A ++ ++#define MATRIX_MODE_AUTO 1 ++#define CONF_MTX_MODE_AUTO 0 ++#define MANUALEN_AUTO 0 ++#define MATRIX_MODE_MANUAL 0 ++#define CONF_MTX_MODE_MANUAL 9 ++#define MANUALEN_MANUAL 1 ++ ++#define _ENSPI_MAX_XFER 0x1ff ++ ++#define REG(x) (iobase + x) ++ ++ ++static void __iomem *iobase; ++ ++ ++static void opfifo_write(u32 cmd, u32 len) ++{ ++ u32 tmp = ((cmd & 0x1f) << 9) | (len & 0x1ff); ++ ++ writel(tmp, REG(ENSPI_MANUAL_OPFIFO_WDATA)); ++ ++ /* Wait for room in OPFIFO */ ++ while (readl(REG(ENSPI_MANUAL_OPFIFO_FULL))) ++ ; ++ ++ /* Shift command into OPFIFO */ ++ writel(1, REG(ENSPI_MANUAL_OPFIFO_WR)); ++ ++ /* Wait for command to finish */ ++ while (!readl(REG(ENSPI_MANUAL_OPFIFO_EMPTY))) ++ ; ++} ++ ++static void set_cs(int state) ++{ ++ if (state) ++ opfifo_write(OP_CSH, 1); ++ else ++ opfifo_write(OP_CSL, 1); ++} ++ ++static void manual_begin_cmd(void) ++{ ++ /* Disable read idle state */ ++ writel(0, REG(ENSPI_READ_IDLE_EN)); ++ ++ /* Wait for FSM to reach idle state */ ++ while (readl(REG(ENSPI_RDCTL_FSM))) ++ ; ++ ++ /* Set SPI core to manual mode */ ++ writel(CONF_MTX_MODE_MANUAL, REG(ENSPI_MTX_MODE_TOG)); ++ writel(MANUALEN_MANUAL, REG(ENSPI_MANUAL_EN)); ++} ++ ++static void manual_end_cmd(void) ++{ ++ /* Set SPI core to auto mode */ ++ writel(CONF_MTX_MODE_AUTO, REG(ENSPI_MTX_MODE_TOG)); ++ writel(MANUALEN_AUTO, REG(ENSPI_MANUAL_EN)); ++ ++ /* Enable read idle state */ ++ writel(1, REG(ENSPI_READ_IDLE_EN)); ++} ++ ++static void dfifo_read(u8 *buf, int len) ++{ ++ int i; ++ ++ for (i = 0; i < len; i++) { ++ /* Wait for requested data to show up in DFIFO */ ++ while (readl(REG(ENSPI_MANUAL_DFIFO_EMPTY))) ++ ; ++ buf[i] = readl(REG(ENSPI_MANUAL_DFIFO_RDATA)); ++ /* Queue up next byte */ ++ writel(1, REG(ENSPI_MANUAL_DFIFO_RD)); ++ } ++} ++ ++static void dfifo_write(const u8 *buf, int len) ++{ ++ int i; ++ ++ for (i = 0; i < len; i++) { ++ /* Wait for room in DFIFO */ ++ while (readl(REG(ENSPI_MANUAL_DFIFO_FULL))) ++ ; ++ writel(buf[i], REG(ENSPI_MANUAL_DFIFO_WDATA)); ++ } ++} ++ ++#if 0 ++static void set_spi_clock_speed(int freq_mhz) ++{ ++ u32 tmp, val; ++ ++ tmp = readl(ENSPI_CLOCK_DIVIDER); ++ tmp &= 0xffff0000; ++ writel(tmp, ENSPI_CLOCK_DIVIDER); ++ ++ val = (400 / (freq_mhz * 2)); ++ tmp |= (val << 8) | 1; ++ writel(tmp, ENSPI_CLOCK_DIVIDER); ++} ++#endif ++ ++static void init_hw(void) ++{ ++ /* Disable manual/auto mode clash interrupt */ ++ writel(0, REG(ENSPI_IER)); ++ ++ // TODO via clk framework ++ // set_spi_clock_speed(50); ++ ++ /* Disable DMA */ ++ writel(0, REG(ENSPI_NFI2SPI_EN)); ++} ++ ++static int xfer_read(struct spi_transfer *xfer) ++{ ++ int opcode; ++ uint8_t *buf = xfer->rx_buf; ++ ++ switch (xfer->rx_nbits) { ++ case SPI_NBITS_SINGLE: ++ opcode = OP_INS; ++ break; ++ case SPI_NBITS_DUAL: ++ opcode = OP_IND; ++ break; ++ case SPI_NBITS_QUAD: ++ opcode = OP_INQ; ++ break; ++ } ++ ++ opfifo_write(opcode, xfer->len); ++ dfifo_read(buf, xfer->len); ++ ++ return xfer->len; ++} ++ ++static int xfer_write(struct spi_transfer *xfer, int next_xfer_is_rx) ++{ ++ int opcode; ++ const uint8_t *buf = xfer->tx_buf; ++ ++ if (next_xfer_is_rx) { ++ /* need to use Ox2Ix opcode to set the core to input afterwards */ ++ switch (xfer->tx_nbits) { ++ case SPI_NBITS_SINGLE: ++ opcode = OP_OS2IS; ++ break; ++ case SPI_NBITS_DUAL: ++ opcode = OP_OS2ID; ++ break; ++ case SPI_NBITS_QUAD: ++ opcode = OP_OS2IQ; ++ break; ++ } ++ } else { ++ switch (xfer->tx_nbits) { ++ case SPI_NBITS_SINGLE: ++ opcode = OP_OUTS; ++ break; ++ case SPI_NBITS_DUAL: ++ opcode = OP_OUTD; ++ break; ++ case SPI_NBITS_QUAD: ++ opcode = OP_OUTQ; ++ break; ++ } ++ } ++ ++ opfifo_write(opcode, xfer->len); ++ dfifo_write(buf, xfer->len); ++ ++ return xfer->len; ++} ++ ++size_t max_transfer_size(struct spi_device *spi) ++{ ++ return _ENSPI_MAX_XFER; ++} ++ ++int transfer_one_message(struct spi_controller *ctrl, struct spi_message *msg) ++{ ++ struct spi_transfer *xfer; ++ int next_xfer_is_rx = 0; ++ ++ manual_begin_cmd(); ++ set_cs(0); ++ list_for_each_entry(xfer, &msg->transfers, transfer_list) { ++ if (xfer->tx_buf) { ++ if (!list_is_last(&xfer->transfer_list, &msg->transfers) ++ && list_next_entry(xfer, transfer_list)->rx_buf != NULL) ++ next_xfer_is_rx = 1; ++ else ++ next_xfer_is_rx = 0; ++ msg->actual_length += xfer_write(xfer, next_xfer_is_rx); ++ } else if (xfer->rx_buf) { ++ msg->actual_length += xfer_read(xfer); ++ } ++ } ++ set_cs(1); ++ manual_end_cmd(); ++ ++ msg->status = 0; ++ spi_finalize_current_message(ctrl); ++ ++ return 0; ++} ++ ++static int spi_probe(struct platform_device *pdev) ++{ ++ struct spi_controller *ctrl; ++ int err; ++ ++ ctrl = devm_spi_alloc_master(&pdev->dev, 0); ++ if (!ctrl) { ++ dev_err(&pdev->dev, "Error allocating SPI controller\n"); ++ return -ENOMEM; ++ } ++ ++ iobase = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); ++ if (IS_ERR(iobase)) { ++ dev_err(&pdev->dev, "Could not map SPI register address"); ++ return -ENOMEM; ++ } ++ ++ init_hw(); ++ ++ ctrl->dev.of_node = pdev->dev.of_node; ++ ctrl->flags = SPI_CONTROLLER_HALF_DUPLEX; ++ ctrl->mode_bits = SPI_RX_DUAL | SPI_TX_DUAL; ++ ctrl->max_transfer_size = max_transfer_size; ++ ctrl->transfer_one_message = transfer_one_message; ++ err = devm_spi_register_controller(&pdev->dev, ctrl); ++ if (err) { ++ dev_err(&pdev->dev, "Could not register SPI controller\n"); ++ return -ENODEV; ++ } ++ ++ return 0; ++} ++ ++static const struct of_device_id spi_of_ids[] = { ++ { .compatible = "airoha,en7523-spi" }, ++ { /* sentinel */ } ++}; ++MODULE_DEVICE_TABLE(of, spi_of_ids); ++ ++static struct platform_driver spi_driver = { ++ .probe = spi_probe, ++ .driver = { ++ .name = "airoha-en7523-spi", ++ .of_match_table = spi_of_ids, ++ }, ++}; ++ ++module_platform_driver(spi_driver); ++ ++MODULE_LICENSE("GPL v2"); ++MODULE_AUTHOR("Bert Vermeulen "); ++MODULE_DESCRIPTION("Airoha EN7523 SPI driver"); diff --git a/target/linux/apm821xx/Makefile b/target/linux/apm821xx/Makefile index e5e2841fd34afc..66bbf3ef474815 100644 --- a/target/linux/apm821xx/Makefile +++ b/target/linux/apm821xx/Makefile @@ -9,8 +9,7 @@ CPU_TYPE:=464fp FEATURES:=fpu dt gpio ramdisk squashfs usb SUBTARGETS:=nand sata -KERNEL_PATCHVER:=5.15 -KERNEL_TESTING_PATCHVER:=6.1 +KERNEL_PATCHVER:=6.1 define Target/Description Build images for AppliedMicro APM821xx based boards. diff --git a/target/linux/apm821xx/config-5.15 b/target/linux/apm821xx/config-5.15 deleted file mode 100644 index adcccbe567c26b..00000000000000 --- a/target/linux/apm821xx/config-5.15 +++ /dev/null @@ -1,240 +0,0 @@ -# CONFIG_40x is not set -CONFIG_44x=y -CONFIG_4xx=y -CONFIG_4xx_SOC=y -# CONFIG_ADVANCED_OPTIONS is not set -CONFIG_APM821xx=y -# CONFIG_APOLLO3G is not set -# CONFIG_ARCHES is not set -CONFIG_ARCH_32BIT_OFF_T=y -CONFIG_ARCH_DMA_ADDR_T_64BIT=y -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_ARCH_KEEP_MEMBLOCK=y -CONFIG_ARCH_MAY_HAVE_PC_FDC=y -CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y -CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y -CONFIG_ARCH_MMAP_RND_BITS=11 -CONFIG_ARCH_MMAP_RND_BITS_MAX=17 -CONFIG_ARCH_MMAP_RND_BITS_MIN=11 -CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=17 -CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11 -CONFIG_ARCH_STACKWALK=y -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ARCH_WEAK_RELEASE_ACQUIRE=y -CONFIG_AUDIT_ARCH=y -# CONFIG_BAMBOO is not set -# CONFIG_BLK_DEV_INITRD is not set -CONFIG_BLK_MQ_PCI=y -CONFIG_BLUESTONE=y -CONFIG_BOOKE=y -CONFIG_BOOKE_WDT=y -# CONFIG_CANYONLANDS is not set -CONFIG_CLONE_BACKWARDS=y -CONFIG_CMDLINE="rootfstype=squashfs noinitrd" -CONFIG_CMDLINE_FROM_BOOTLOADER=y -CONFIG_COMMON_CLK=y -CONFIG_COMPAT_32BIT_TIME=y -CONFIG_CPU_BIG_ENDIAN=y -CONFIG_CRC16=y -# CONFIG_CRC32_SARWATE is not set -CONFIG_CRC32_SLICEBY8=y -CONFIG_CRYPTO_DEFLATE=y -CONFIG_CRYPTO_JITTERENTROPY=y -CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y -CONFIG_CRYPTO_LIB_POLY1305_RSIZE=1 -CONFIG_CRYPTO_LZO=y -# CONFIG_CRYPTO_MD5_PPC is not set -# CONFIG_CRYPTO_SHA1_PPC is not set -CONFIG_DATA_SHIFT=12 -CONFIG_DMADEVICES=y -CONFIG_DMA_DIRECT_REMAP=y -CONFIG_DMA_ENGINE=y -CONFIG_DMA_OF=y -CONFIG_DMA_REMAP=y -CONFIG_DTC=y -CONFIG_DW_DMAC=y -CONFIG_DW_DMAC_CORE=y -CONFIG_EARLY_PRINTK=y -# CONFIG_EBONY is not set -CONFIG_EDAC_ATOMIC_SCRUB=y -CONFIG_EDAC_SUPPORT=y -# CONFIG_EIGER is not set -CONFIG_EXTRA_TARGETS="uImage" -CONFIG_FIXED_PHY=y -CONFIG_FORCE_PCI=y -# CONFIG_FSL_LBC is not set -CONFIG_FWNODE_MDIO=y -CONFIG_FW_LOADER_PAGED_BUF=y -CONFIG_GENERIC_ALLOCATOR=y -CONFIG_GENERIC_ATOMIC64=y -CONFIG_GENERIC_BUG=y -CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CMOS_UPDATE=y -CONFIG_GENERIC_CPU_AUTOPROBE=y -CONFIG_GENERIC_EARLY_IOREMAP=y -CONFIG_GENERIC_GETTIMEOFDAY=y -CONFIG_GENERIC_IRQ_SHOW=y -CONFIG_GENERIC_IRQ_SHOW_LEVEL=y -CONFIG_GENERIC_ISA_DMA=y -CONFIG_GENERIC_MSI_IRQ=y -CONFIG_GENERIC_MSI_IRQ_DOMAIN=y -CONFIG_GENERIC_PCI_IOMAP=y -CONFIG_GENERIC_SMP_IDLE_THREAD=y -CONFIG_GENERIC_STRNCPY_FROM_USER=y -CONFIG_GENERIC_STRNLEN_USER=y -CONFIG_GENERIC_TIME_VSYSCALL=y -# CONFIG_GEN_RTC is not set -# CONFIG_GLACIER is not set -CONFIG_GPIO_CDEV=y -CONFIG_GPIO_GENERIC=y -CONFIG_GPIO_GENERIC_PLATFORM=y -CONFIG_HAS_DMA=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_IOPORT_MAP=y -CONFIG_I2C=y -CONFIG_I2C_BOARDINFO=y -CONFIG_I2C_CHARDEV=y -CONFIG_I2C_IBM_IIC=y -CONFIG_IBM_EMAC=y -CONFIG_IBM_EMAC_EMAC4=y -CONFIG_IBM_EMAC_POLL_WEIGHT=32 -CONFIG_IBM_EMAC_RGMII=y -CONFIG_IBM_EMAC_RXB=128 -CONFIG_IBM_EMAC_RX_COPY_THRESHOLD=256 -CONFIG_IBM_EMAC_TAH=y -CONFIG_IBM_EMAC_TXB=128 -# CONFIG_ICON is not set -CONFIG_ILLEGAL_POINTER_VALUE=0 -CONFIG_IRQCHIP=y -CONFIG_IRQ_DOMAIN=y -CONFIG_IRQ_DOMAIN_HIERARCHY=y -CONFIG_IRQ_FORCED_THREADING=y -CONFIG_IRQ_WORK=y -CONFIG_ISA_DMA_API=y -# CONFIG_JFFS2_FS is not set -# CONFIG_KATMAI is not set -CONFIG_KERNEL_START=0xc0000000 -CONFIG_LEDS_TRIGGER_MTD=y -CONFIG_LEDS_TRIGGER_PATTERN=y -CONFIG_LIBFDT=y -CONFIG_LOCK_DEBUGGING_SUPPORT=y -CONFIG_LOWMEM_SIZE=0x30000000 -CONFIG_LZO_COMPRESS=y -CONFIG_LZO_DECOMPRESS=y -# CONFIG_MATH_EMULATION is not set -CONFIG_MDIO_BUS=y -CONFIG_MDIO_DEVICE=y -CONFIG_MDIO_DEVRES=y -CONFIG_MEMFD_CREATE=y -CONFIG_MIGRATION=y -CONFIG_MMU_GATHER_PAGE_SIZE=y -CONFIG_MODULES_USE_ELF_RELA=y -CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS=y -CONFIG_MTD_CFI_ADV_OPTIONS=y -# CONFIG_MTD_CFI_GEOMETRY is not set -# CONFIG_MTD_SPLIT_SQUASHFS_ROOT is not set -CONFIG_NEED_DMA_MAP_STATE=y -CONFIG_NEED_PER_CPU_KM=y -CONFIG_NEED_SG_DMA_LENGTH=y -CONFIG_NET_SELFTESTS=y -CONFIG_NOT_COHERENT_CACHE=y -CONFIG_NO_HZ=y -CONFIG_NO_HZ_COMMON=y -CONFIG_NO_HZ_IDLE=y -CONFIG_NR_CPUS=1 -CONFIG_NR_IRQS=512 -CONFIG_NVMEM=y -CONFIG_NVMEM_SYSFS=y -CONFIG_OF=y -CONFIG_OF_ADDRESS=y -CONFIG_OF_EARLY_FLATTREE=y -CONFIG_OF_FLATTREE=y -CONFIG_OF_GPIO=y -CONFIG_OF_IRQ=y -CONFIG_OF_KOBJ=y -CONFIG_OF_MDIO=y -CONFIG_OLD_SIGACTION=y -CONFIG_OLD_SIGSUSPEND=y -CONFIG_PACKING=y -CONFIG_PAGE_OFFSET=0xc0000000 -CONFIG_PCI=y -CONFIG_PCIEAER=y -CONFIG_PCIEPORTBUS=y -CONFIG_PCI_DISABLE_COMMON_QUIRKS=y -CONFIG_PCI_DOMAINS=y -CONFIG_PCI_MSI=y -CONFIG_PCI_MSI_ARCH_FALLBACKS=y -CONFIG_PCI_MSI_IRQ_DOMAIN=y -CONFIG_PGTABLE_LEVELS=2 -CONFIG_PHYLIB=y -CONFIG_PHYSICAL_START=0x00000000 -CONFIG_PHYS_64BIT=y -CONFIG_PHYS_ADDR_T_64BIT=y -# CONFIG_PMU_SYSFS is not set -# CONFIG_POWERPC_CPU is not set -CONFIG_PPC=y -CONFIG_PPC32=y -CONFIG_PPC44x_SIMPLE=y -CONFIG_PPC4xx_GPIO=y -CONFIG_PPC4xx_MSI=y -CONFIG_PPC4xx_PCI_EXPRESS=y -# CONFIG_PPC64 is not set -# CONFIG_PPC_47x is not set -# CONFIG_PPC_85xx is not set -# CONFIG_PPC_8xx is not set -CONFIG_PPC_ADV_DEBUG_DACS=2 -CONFIG_PPC_ADV_DEBUG_DAC_RANGE=y -CONFIG_PPC_ADV_DEBUG_DVCS=2 -CONFIG_PPC_ADV_DEBUG_IACS=4 -CONFIG_PPC_ADV_DEBUG_REGS=y -# CONFIG_PPC_BOOK3S_32 is not set -CONFIG_PPC_DCR=y -CONFIG_PPC_DCR_NATIVE=y -# CONFIG_PPC_EARLY_DEBUG is not set -CONFIG_PPC_FPU=y -CONFIG_PPC_FPU_REGS=y -CONFIG_PPC_HAVE_KUEP=y -CONFIG_PPC_INDIRECT_PCI=y -CONFIG_PPC_KUEP=y -CONFIG_PPC_MMU_NOHASH=y -CONFIG_PPC_MSI_BITMAP=y -CONFIG_PPC_PAGE_SHIFT=12 -CONFIG_PPC_UDBG_16550=y -CONFIG_PPC_WERROR=y -CONFIG_PTE_64BIT=y -CONFIG_PTP_1588_CLOCK_OPTIONAL=y -# CONFIG_RAINIER is not set -CONFIG_RAS=y -CONFIG_RATIONAL=y -CONFIG_REGULATOR=y -CONFIG_RSEQ=y -# CONFIG_SAM440EP is not set -# CONFIG_SCOM_DEBUGFS is not set -# CONFIG_SEQUOIA is not set -CONFIG_SERIAL_8250_FSL=y -CONFIG_SERIAL_MCTRL_GPIO=y -CONFIG_SERIAL_OF_PLATFORM=y -CONFIG_SGL_ALLOC=y -CONFIG_SPARSE_IRQ=y -CONFIG_SRCU=y -CONFIG_SWPHY=y -CONFIG_SYSCTL_EXCEPTION_TRACE=y -# CONFIG_TAISHAN is not set -CONFIG_TASK_SIZE=0xc0000000 -CONFIG_THREAD_INFO_IN_TASK=y -CONFIG_THREAD_SHIFT=13 -CONFIG_TICK_CPU_ACCOUNTING=y -CONFIG_TINY_SRCU=y -CONFIG_TOOLCHAIN_DEFAULT_CPU=y -CONFIG_USB_SUPPORT=y -CONFIG_VDSO32=y -# CONFIG_VIRTIO_MENU is not set -# CONFIG_VIRT_CPU_ACCOUNTING_NATIVE is not set -# CONFIG_WARP is not set -CONFIG_WATCHDOG_CORE=y -CONFIG_XZ_DEC_BCJ=y -CONFIG_XZ_DEC_POWERPC=y -# CONFIG_YOSEMITE is not set -CONFIG_ZLIB_DEFLATE=y -CONFIG_ZLIB_INFLATE=y diff --git a/target/linux/apm821xx/config-6.1 b/target/linux/apm821xx/config-6.1 index 2979312101b602..bde05e2f122b75 100644 --- a/target/linux/apm821xx/config-6.1 +++ b/target/linux/apm821xx/config-6.1 @@ -153,6 +153,7 @@ CONFIG_NR_CPUS=1 CONFIG_NR_IRQS=512 CONFIG_NVMEM=y CONFIG_NVMEM_SYSFS=y +CONFIG_NVMEM_U_BOOT_ENV=y CONFIG_OF=y CONFIG_OF_ADDRESS=y CONFIG_OF_EARLY_FLATTREE=y diff --git a/target/linux/apm821xx/dts/meraki-mr24.dts b/target/linux/apm821xx/dts/meraki-mr24.dts index 14bedc59843c5b..a49a4de13fa1b3 100644 --- a/target/linux/apm821xx/dts/meraki-mr24.dts +++ b/target/linux/apm821xx/dts/meraki-mr24.dts @@ -63,10 +63,11 @@ * blocks (64KiB) in order to have spares * around for bad block management */ - label = "u-boot-env"; - reg = <0x00150000 0x00010000>; - read-only; - }; + label = "u-boot-env"; + compatible = "u-boot,env"; + reg = <0x00150000 0x00010000>; + read-only; + }; partition@160000 { /* diff --git a/target/linux/apm821xx/dts/meraki-mx60.dts b/target/linux/apm821xx/dts/meraki-mx60.dts index 0e343ed7825e2b..d9568d92635b4d 100644 --- a/target/linux/apm821xx/dts/meraki-mx60.dts +++ b/target/linux/apm821xx/dts/meraki-mx60.dts @@ -61,6 +61,7 @@ partition@100000 { label = "u-boot-env"; reg = <0x00100000 0x00100000>; + compatible = "u-boot,env"; read-only; }; diff --git a/target/linux/apm821xx/dts/netgear-wndap6x0.dtsi b/target/linux/apm821xx/dts/netgear-wndap6x0.dtsi index 144b17950e86a8..2921bfedb91370 100644 --- a/target/linux/apm821xx/dts/netgear-wndap6x0.dtsi +++ b/target/linux/apm821xx/dts/netgear-wndap6x0.dtsi @@ -47,11 +47,29 @@ }; partition@100000 { + compatible = "u-boot,env"; label = "u-boot-env"; - reg = <0x00100000 0x00010000>; + reg = <0x00100000 0x0004000>; read-only; + + ethaddr { + }; + + bootcmd { + }; + + serno { + }; + + ProductID { + }; + + HardwareVer { + }; }; + /* 0x104000 - 0x10ffff free */ + partition@110000 { label = "firmware"; reg = <0x00110000 0x01ac0000>; diff --git a/target/linux/apm821xx/dts/wd-mybooklive.dts b/target/linux/apm821xx/dts/wd-mybooklive.dts index 588f45078cd470..5ed865e286c849 100644 --- a/target/linux/apm821xx/dts/wd-mybooklive.dts +++ b/target/linux/apm821xx/dts/wd-mybooklive.dts @@ -21,30 +21,59 @@ &POB0 { ebc { nor_flash@0,0 { - status = "okay"; - compatible = "microchip,sst39vf040", "jedec-flash"; - bank-width = <1>; - reg = <0x00000000 0x00000000 0x00080000>; + status = "okay"; + compatible = "jedec-flash"; /* "microchip,sst39vf040 */ + bank-width = <1>; + reg = <0x00000000 0x00000000 0x00080000>; #address-cells = <1>; #size-cells = <1>; - partition@0 { - /* Part of bootrom - Don't use it without a jump */ - label = "free"; - reg = <0x00000000 0x0001e000>; - read-only; - }; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + /* Part of bootrom - Don't use it without a jump */ + label = "free"; + reg = <0x00000000 0x0001e000>; + read-only; + }; + + partition@1e000 { + compatible = "fixed-partitions"; + reg = <0x0001e000 0x00002000>; + label = "u-boot-env"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + compatible = "u-boot,env-redundant-bool"; + reg = <0x00000000 0x00001000>; + label = "u-boot-env-1"; + + ethaddr { + }; + }; + +/* + * Causes the following warning: * sysfs: cannot create duplicate filename '/bus/nvmem/devices/u-boot-env0' + * + * partition@1000 { + * compatible = "u-boot,env-redundant-bool"; + * reg = <0x00001000 0x00001000>; + * label = "u-boot-env-2"; + * + * }; + */ + }; - partition@1e000 { - label = "env"; - reg = <0x0001e000 0x00002000>; - read-only; - }; - partition@20000 { - label = "uboot"; - reg = <0x00020000 0x00050000>; - read-only; + partition@20000 { + label = "uboot"; + reg = <0x00020000 0x00050000>; + read-only; + }; }; }; }; diff --git a/target/linux/apm821xx/patches-5.15/010-hwmon-tc654-add-thermal_cooling-device.patch b/target/linux/apm821xx/patches-5.15/010-hwmon-tc654-add-thermal_cooling-device.patch deleted file mode 100644 index 74f8e38150f60a..00000000000000 --- a/target/linux/apm821xx/patches-5.15/010-hwmon-tc654-add-thermal_cooling-device.patch +++ /dev/null @@ -1,166 +0,0 @@ -From 4d49367c5303e3ebd17502a45b74de280f6be539 Mon Sep 17 00:00:00 2001 -From: Christian Lamparter -Date: Sun, 13 Feb 2022 01:47:33 +0100 -Subject: hwmon: (tc654) Add thermal_cooling device support - -Adds thermal_cooling device support to the tc654/tc655 -driver. This make it possible to integrate it into a -device-tree supported thermal-zone node as a -cooling device. - -I have been using this patch as part of the Netgear WNDR4700 -Centria NAS Router support within OpenWrt since 2016. - -Signed-off-by: Christian Lamparter -Link: https://lore.kernel.org/r/20220213004733.2421193-1-chunkeey@gmail.com -Signed-off-by: Guenter Roeck ---- ---- a/drivers/hwmon/tc654.c -+++ b/drivers/hwmon/tc654.c -@@ -15,6 +15,7 @@ - #include - #include - #include -+#include - #include - - enum tc654_regs { -@@ -379,28 +380,20 @@ static ssize_t pwm_show(struct device *d - return sprintf(buf, "%d\n", pwm); - } - --static ssize_t pwm_store(struct device *dev, struct device_attribute *da, -- const char *buf, size_t count) -+static int _set_pwm(struct tc654_data *data, unsigned long val) - { -- struct tc654_data *data = dev_get_drvdata(dev); - struct i2c_client *client = data->client; -- unsigned long val; - int ret; - -- if (kstrtoul(buf, 10, &val)) -- return -EINVAL; -- if (val > 255) -- return -EINVAL; -- - mutex_lock(&data->update_lock); - -- if (val == 0) -+ if (val == 0) { - data->config |= TC654_REG_CONFIG_SDM; -- else -+ data->duty_cycle = 0; -+ } else { - data->config &= ~TC654_REG_CONFIG_SDM; -- -- data->duty_cycle = find_closest(val, tc654_pwm_map, -- ARRAY_SIZE(tc654_pwm_map)); -+ data->duty_cycle = val - 1; -+ } - - ret = i2c_smbus_write_byte_data(client, TC654_REG_CONFIG, data->config); - if (ret < 0) -@@ -411,6 +404,24 @@ static ssize_t pwm_store(struct device * - - out: - mutex_unlock(&data->update_lock); -+ return ret; -+} -+ -+static ssize_t pwm_store(struct device *dev, struct device_attribute *da, -+ const char *buf, size_t count) -+{ -+ struct tc654_data *data = dev_get_drvdata(dev); -+ unsigned long val; -+ int ret; -+ -+ if (kstrtoul(buf, 10, &val)) -+ return -EINVAL; -+ if (val > 255) -+ return -EINVAL; -+ if (val > 0) -+ val = find_closest(val, tc654_pwm_map, ARRAY_SIZE(tc654_pwm_map)) + 1; -+ -+ ret = _set_pwm(data, val); - return ret < 0 ? ret : count; - } - -@@ -443,6 +454,58 @@ static struct attribute *tc654_attrs[] = - ATTRIBUTE_GROUPS(tc654); - - /* -+ * thermal cooling device functions -+ * -+ * Account for the "ShutDown Mode (SDM)" state by offsetting -+ * the 16 PWM duty cycle states by 1. -+ * -+ * State 0 = 0% PWM | Shutdown - Fan(s) are off -+ * State 1 = 30% PWM | duty_cycle = 0 -+ * State 2 = ~35% PWM | duty_cycle = 1 -+ * [...] -+ * State 15 = ~95% PWM | duty_cycle = 14 -+ * State 16 = 100% PWM | duty_cycle = 15 -+ */ -+#define TC654_MAX_COOLING_STATE 16 -+ -+static int tc654_get_max_state(struct thermal_cooling_device *cdev, unsigned long *state) -+{ -+ *state = TC654_MAX_COOLING_STATE; -+ return 0; -+} -+ -+static int tc654_get_cur_state(struct thermal_cooling_device *cdev, unsigned long *state) -+{ -+ struct tc654_data *data = tc654_update_client(cdev->devdata); -+ -+ if (IS_ERR(data)) -+ return PTR_ERR(data); -+ -+ if (data->config & TC654_REG_CONFIG_SDM) -+ *state = 0; /* FAN is off */ -+ else -+ *state = data->duty_cycle + 1; /* offset PWM States by 1 */ -+ -+ return 0; -+} -+ -+static int tc654_set_cur_state(struct thermal_cooling_device *cdev, unsigned long state) -+{ -+ struct tc654_data *data = tc654_update_client(cdev->devdata); -+ -+ if (IS_ERR(data)) -+ return PTR_ERR(data); -+ -+ return _set_pwm(data, clamp_val(state, 0, TC654_MAX_COOLING_STATE)); -+} -+ -+static const struct thermal_cooling_device_ops tc654_fan_cool_ops = { -+ .get_max_state = tc654_get_max_state, -+ .get_cur_state = tc654_get_cur_state, -+ .set_cur_state = tc654_set_cur_state, -+}; -+ -+/* - * device probe and removal - */ - -@@ -472,7 +535,18 @@ static int tc654_probe(struct i2c_client - hwmon_dev = - devm_hwmon_device_register_with_groups(dev, client->name, data, - tc654_groups); -- return PTR_ERR_OR_ZERO(hwmon_dev); -+ if (IS_ERR(hwmon_dev)) -+ return PTR_ERR(hwmon_dev); -+ -+ if (IS_ENABLED(CONFIG_THERMAL)) { -+ struct thermal_cooling_device *cdev; -+ -+ cdev = devm_thermal_of_cooling_device_register(dev, dev->of_node, client->name, -+ hwmon_dev, &tc654_fan_cool_ops); -+ return PTR_ERR_OR_ZERO(cdev); -+ } -+ -+ return 0; - } - - static const struct i2c_device_id tc654_id[] = { diff --git a/target/linux/apm821xx/patches-5.15/201-add-amcc-apollo3g-support.patch b/target/linux/apm821xx/patches-5.15/201-add-amcc-apollo3g-support.patch deleted file mode 100644 index e1889540947edc..00000000000000 --- a/target/linux/apm821xx/patches-5.15/201-add-amcc-apollo3g-support.patch +++ /dev/null @@ -1,30 +0,0 @@ ---- a/arch/powerpc/platforms/44x/Kconfig -+++ b/arch/powerpc/platforms/44x/Kconfig -@@ -121,6 +121,17 @@ config CANYONLANDS - help - This option enables support for the AMCC PPC460EX evaluation board. - -+config APOLLO3G -+ bool "Apollo3G" -+ depends on 44x -+ default n -+ select PPC44x_SIMPLE -+ select APM821xx -+ select IBM_EMAC_RGMII -+ select 460EX -+ help -+ This option enables support for the AMCC Apollo 3G board. -+ - config GLACIER - bool "Glacier" - depends on 44x ---- a/arch/powerpc/platforms/44x/ppc44x_simple.c -+++ b/arch/powerpc/platforms/44x/ppc44x_simple.c -@@ -47,6 +47,7 @@ machine_device_initcall(ppc44x_simple, p - * board.c file for it rather than adding it to this list. - */ - static char *board[] __initdata = { -+ "amcc,apollo3g", - "amcc,arches", - "amcc,bamboo", - "apm,bluestone", diff --git a/target/linux/apm821xx/patches-5.15/300-fix-atheros-nics-on-apm82181.patch b/target/linux/apm821xx/patches-5.15/300-fix-atheros-nics-on-apm82181.patch deleted file mode 100644 index 110726d258acb6..00000000000000 --- a/target/linux/apm821xx/patches-5.15/300-fix-atheros-nics-on-apm82181.patch +++ /dev/null @@ -1,51 +0,0 @@ ---- a/arch/powerpc/platforms/4xx/pci.c -+++ b/arch/powerpc/platforms/4xx/pci.c -@@ -1060,15 +1060,24 @@ static int __init apm821xx_pciex_init_po - u32 val; - - /* -- * Do a software reset on PCIe ports. -- * This code is to fix the issue that pci drivers doesn't re-assign -- * bus number for PCIE devices after Uboot -- * scanned and configured all the buses (eg. PCIE NIC IntelPro/1000 -- * PT quad port, SAS LSI 1064E) -+ * Only reset the PHY when no link is currently established. -+ * This is for the Atheros PCIe board which has problems to establish -+ * the link (again) after this PHY reset. All other currently tested -+ * PCIe boards don't show this problem. - */ -- -- mtdcri(SDR0, PESDR0_460EX_PHY_CTL_RST, 0x0); -- mdelay(10); -+ val = mfdcri(SDR0, port->sdr_base + PESDRn_LOOP); -+ if (!(val & 0x00001000)) { -+ /* -+ * Do a software reset on PCIe ports. -+ * This code is to fix the issue that pci drivers doesn't re-assign -+ * bus number for PCIE devices after Uboot -+ * scanned and configured all the buses (eg. PCIE NIC IntelPro/1000 -+ * PT quad port, SAS LSI 1064E) -+ */ -+ -+ mtdcri(SDR0, PESDR0_460EX_PHY_CTL_RST, 0x0); -+ mdelay(10); -+ } - - if (port->endpoint) - val = PTYPE_LEGACY_ENDPOINT << 20; -@@ -1085,9 +1094,12 @@ static int __init apm821xx_pciex_init_po - mtdcri(SDR0, PESDR0_460EX_L0DRV, 0x00000130); - mtdcri(SDR0, PESDR0_460EX_L0CLK, 0x00000006); - -- mtdcri(SDR0, PESDR0_460EX_PHY_CTL_RST, 0x10000000); -- mdelay(50); -- mtdcri(SDR0, PESDR0_460EX_PHY_CTL_RST, 0x30000000); -+ val = mfdcri(SDR0, port->sdr_base + PESDRn_LOOP); -+ if (!(val & 0x00001000)) { -+ mtdcri(SDR0, PESDR0_460EX_PHY_CTL_RST, 0x10000000); -+ mdelay(50); -+ mtdcri(SDR0, PESDR0_460EX_PHY_CTL_RST, 0x30000000); -+ } - - mtdcri(SDR0, port->sdr_base + PESDRn_RCSSET, - mfdcri(SDR0, port->sdr_base + PESDRn_RCSSET) | diff --git a/target/linux/apm821xx/patches-5.15/301-fix-memory-map-wndr4700.patch b/target/linux/apm821xx/patches-5.15/301-fix-memory-map-wndr4700.patch deleted file mode 100644 index 452d97e85aa0e9..00000000000000 --- a/target/linux/apm821xx/patches-5.15/301-fix-memory-map-wndr4700.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/arch/powerpc/platforms/4xx/pci.c -+++ b/arch/powerpc/platforms/4xx/pci.c -@@ -1902,9 +1902,9 @@ static void __init ppc4xx_configure_pcie - * if it works - */ - out_le32(mbase + PECFG_PIM0LAL, 0x00000000); -- out_le32(mbase + PECFG_PIM0LAH, 0x00000000); -+ out_le32(mbase + PECFG_PIM0LAH, 0x00000008); - out_le32(mbase + PECFG_PIM1LAL, 0x00000000); -- out_le32(mbase + PECFG_PIM1LAH, 0x00000000); -+ out_le32(mbase + PECFG_PIM1LAH, 0x0000000c); - out_le32(mbase + PECFG_PIM01SAH, 0xffff0000); - out_le32(mbase + PECFG_PIM01SAL, 0x00000000); - diff --git a/target/linux/apm821xx/patches-5.15/900-powerpc-bootwrapper-force-gzip-as-mkimage-s-compress.patch b/target/linux/apm821xx/patches-5.15/900-powerpc-bootwrapper-force-gzip-as-mkimage-s-compress.patch deleted file mode 100644 index 1ba8a45cb62ad9..00000000000000 --- a/target/linux/apm821xx/patches-5.15/900-powerpc-bootwrapper-force-gzip-as-mkimage-s-compress.patch +++ /dev/null @@ -1,29 +0,0 @@ -From c9395ad54e2cabb87d408becc37566f3d8248933 Mon Sep 17 00:00:00 2001 -From: Christian Lamparter -Date: Sun, 1 Dec 2019 02:08:23 +0100 -Subject: [PATCH] powerpc: bootwrapper: force gzip as mkimage's compression - method - -Due to CONFIG_KERNEL_XZ symbol, the bootwrapper code tries to -instruct the mkimage to use the xz compression, which isn't -supported. This patch forces the gzip compression, which is -supported and doesn't matter because the generated uImage for -the apm821xx target gets ignored as the OpenWrt toolchain will -do separate U-Boot kernel images for each device individually. - -Signed-off-by: Christian Lamparter ---- - arch/powerpc/boot/Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/arch/powerpc/boot/Makefile -+++ b/arch/powerpc/boot/Makefile -@@ -258,7 +258,7 @@ compressor-$(CONFIG_KERNEL_LZO) := lzo - - # args (to if_changed): 1 = (this rule), 2 = platform, 3 = dts 4=dtb 5=initrd - quiet_cmd_wrap = WRAP $@ -- cmd_wrap =$(CONFIG_SHELL) $(wrapper) -Z $(compressor-y) -c -o $@ -p $2 \ -+ cmd_wrap =$(CONFIG_SHELL) $(wrapper) -Z gzip -c -o $@ -p $2 \ - $(CROSSWRAP) $(if $3, -s $3)$(if $4, -d $4)$(if $5, -i $5) \ - vmlinux - diff --git a/target/linux/apm821xx/sata/config-default b/target/linux/apm821xx/sata/config-default index daff2d04bef2bf..7efb914885f3bd 100644 --- a/target/linux/apm821xx/sata/config-default +++ b/target/linux/apm821xx/sata/config-default @@ -54,3 +54,9 @@ CONFIG_PPC4xx_CPM=y CONFIG_REGULATOR_FIXED_VOLTAGE=y CONFIG_SUSPEND=y CONFIG_SUSPEND_FREEZER=y +CONFIG_USB=y +CONFIG_USB_COMMON=y +CONFIG_USB_DWC2=y +CONFIG_USB_DWC2_HOST=y +CONFIG_USB_ROLE_SWITCH=y +CONFIG_USB_STORAGE=y diff --git a/target/linux/archs38/Makefile b/target/linux/archs38/Makefile index 42b4edad8a9cea..5d69da9a4b67b7 100644 --- a/target/linux/archs38/Makefile +++ b/target/linux/archs38/Makefile @@ -12,6 +12,7 @@ FEATURES:=source-only SUBTARGETS:=generic KERNEL_PATCHVER:=5.15 +KERNEL_TESTING_PATCHVER:=6.1 DEVICE_TYPE:=basic diff --git a/target/linux/archs38/config-6.1 b/target/linux/archs38/config-6.1 new file mode 100644 index 00000000000000..9fe6ba2932dcfd --- /dev/null +++ b/target/linux/archs38/config-6.1 @@ -0,0 +1,268 @@ +# CONFIG_16KSTACKS is not set +CONFIG_ARC=y +CONFIG_ARCH_32BIT_OFF_T=y +CONFIG_ARC_BUILTIN_DTB_NAME="" +CONFIG_ARC_CACHE=y +CONFIG_ARC_CACHE_LINE_SHIFT=6 +CONFIG_ARC_CACHE_PAGES=y +CONFIG_ARC_CPU_HS=y +CONFIG_ARC_CURR_IN_REG=y +CONFIG_ARC_DBG=y +# CONFIG_ARC_DSP_AGU_USERSPACE is not set +# CONFIG_ARC_DSP_KERNEL is not set +CONFIG_ARC_DSP_NONE=y +# CONFIG_ARC_DSP_USERSPACE is not set +CONFIG_ARC_DW2_UNWIND=y +CONFIG_ARC_FPU_SAVE_RESTORE=y +CONFIG_ARC_HAS_ACCL_REGS=y +CONFIG_ARC_HAS_DCACHE=y +# CONFIG_ARC_HAS_DCCM is not set +CONFIG_ARC_HAS_DIV_REM=y +CONFIG_ARC_HAS_ICACHE=y +# CONFIG_ARC_HAS_ICCM is not set +CONFIG_ARC_HAS_LL64=y +CONFIG_ARC_HAS_LLSC=y +# CONFIG_ARC_HAS_PAE40 is not set +CONFIG_ARC_HAS_SWAPE=y +CONFIG_ARC_IRQ_NO_AUTOSAVE=y +CONFIG_ARC_KVADDR_SIZE=256 +# CONFIG_ARC_LPB_DISABLE is not set +CONFIG_ARC_MCIP=y +# CONFIG_ARC_METAWARE_HLINK is not set +CONFIG_ARC_MMU_V4=y +# CONFIG_ARC_PAGE_SIZE_16K is not set +# CONFIG_ARC_PAGE_SIZE_4K is not set +CONFIG_ARC_PAGE_SIZE_8K=y +CONFIG_ARC_PLAT_AXS10X=y +# CONFIG_ARC_PLAT_TB10X is not set +# CONFIG_ARC_SMP_HALT_ON_RESET is not set +CONFIG_ARC_SOC_HSDK=y +CONFIG_ARC_TIMERS=y +CONFIG_ARC_TIMERS_64BIT=y +CONFIG_ARC_TUNE_MCPU="" +CONFIG_ARC_USE_UNALIGNED_MEM_ACCESS=y +CONFIG_AXS103=y +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_COUNT=16 +CONFIG_BLK_DEV_RAM_SIZE=4096 +CONFIG_BLK_DEV_SD=y +CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" +CONFIG_CC_NO_ARRAY_BOUNDS=y +CONFIG_CLK_HSDK=y +CONFIG_CLONE_BACKWARDS=y +CONFIG_COMMON_CLK=y +CONFIG_COMPACT_UNEVICTABLE_DEFAULT=1 +CONFIG_COMPAT_32BIT_TIME=y +CONFIG_CONTEXT_TRACKING=y +CONFIG_CONTEXT_TRACKING_IDLE=y +CONFIG_CPU_RMAP=y +CONFIG_CRC16=y +CONFIG_CRYPTO_CRC32C=y +CONFIG_CRYPTO_DRBG=y +CONFIG_CRYPTO_DRBG_HMAC=y +CONFIG_CRYPTO_DRBG_MENU=y +CONFIG_CRYPTO_ECHAINIV=y +CONFIG_CRYPTO_HMAC=y +CONFIG_CRYPTO_JITTERENTROPY=y +CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y +CONFIG_CRYPTO_LIB_POLY1305_RSIZE=1 +CONFIG_CRYPTO_LIB_SHA1=y +CONFIG_CRYPTO_LIB_SHA256=y +CONFIG_CRYPTO_LIB_UTILS=y +CONFIG_CRYPTO_RNG=y +CONFIG_CRYPTO_RNG2=y +CONFIG_CRYPTO_RNG_DEFAULT=y +CONFIG_CRYPTO_SHA256=y +CONFIG_CRYPTO_SHA512=y +CONFIG_DEBUG_INFO=y +CONFIG_DMADEVICES=y +CONFIG_DMA_DIRECT_REMAP=y +CONFIG_DMA_ENGINE=y +CONFIG_DMA_OF=y +CONFIG_DMA_VIRTUAL_CHANNELS=y +CONFIG_DTC=y +CONFIG_DWMAC_ANARION=y +CONFIG_DWMAC_GENERIC=y +CONFIG_DW_APB_ICTL=y +CONFIG_DW_AXI_DMAC=y +CONFIG_EXCLUSIVE_SYSTEM_RAM=y +CONFIG_EXT4_FS=y +CONFIG_FAT_FS=y +CONFIG_FB=y +CONFIG_FB_CMDLINE=y +CONFIG_FIXED_PHY=y +CONFIG_FS_IOMAP=y +CONFIG_FS_MBCACHE=y +CONFIG_FS_POSIX_ACL=y +CONFIG_FWNODE_MDIO=y +CONFIG_FW_LOADER_PAGED_BUF=y +CONFIG_FW_LOADER_SYSFS=y +CONFIG_GCC11_NO_ARRAY_BOUNDS=y +CONFIG_GCC_ASM_GOTO_OUTPUT_WORKAROUND=y +CONFIG_GENERIC_ALLOCATOR=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_CSUM=y +CONFIG_GENERIC_IRQ_CHIP=y +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_GENERIC_PCI_IOMAP=y +CONFIG_GENERIC_PENDING_IRQ=y +CONFIG_GENERIC_SCHED_CLOCK=y +CONFIG_GENERIC_SMP_IDLE_THREAD=y +CONFIG_GENERIC_STRNCPY_FROM_USER=y +CONFIG_GENERIC_STRNLEN_USER=y +CONFIG_GPIOLIB_IRQCHIP=y +CONFIG_GPIO_CDEV=y +CONFIG_GPIO_DWAPB=y +CONFIG_GPIO_GENERIC=y +CONFIG_GPIO_SNPS_CREG=y +CONFIG_GRACE_PERIOD=y +CONFIG_HAS_DMA=y +CONFIG_HAS_IOMEM=y +CONFIG_HZ_PERIODIC=y +CONFIG_I2C=y +CONFIG_I2C_BOARDINFO=y +CONFIG_IIO=y +CONFIG_IIO_BUFFER=y +CONFIG_IIO_KFIFO_BUF=y +CONFIG_IIO_ST_PRESS=y +CONFIG_IIO_ST_PRESS_I2C=y +CONFIG_IIO_ST_PRESS_SPI=y +CONFIG_IIO_ST_SENSORS_CORE=y +CONFIG_IIO_ST_SENSORS_I2C=y +CONFIG_IIO_ST_SENSORS_SPI=y +CONFIG_IIO_TRIGGER=y +CONFIG_IIO_TRIGGERED_BUFFER=y +CONFIG_INITRAMFS_SOURCE="" +CONFIG_IRQCHIP=y +CONFIG_IRQ_DOMAIN=y +CONFIG_IRQ_DOMAIN_HIERARCHY=y +CONFIG_IRQ_WORK=y +# CONFIG_ISA_ARCOMPACT is not set +CONFIG_ISA_ARCV2=y +CONFIG_JBD2=y +CONFIG_KALLSYMS=y +CONFIG_KERNEL_GZIP=y +CONFIG_LIBFDT=y +CONFIG_LINUX_LINK_BASE=0x90000000 +CONFIG_LINUX_RAM_BASE=0x80000000 +CONFIG_LOCKD=y +CONFIG_LOCKUP_DETECTOR=y +CONFIG_LOCK_DEBUGGING_SUPPORT=y +CONFIG_LOCK_SPIN_ON_OWNER=y +CONFIG_MDIO_BUS=y +CONFIG_MDIO_DEVICE=y +CONFIG_MDIO_DEVRES=y +CONFIG_MEMFD_CREATE=y +CONFIG_MFD_SYSCON=y +CONFIG_MICREL_PHY=y +CONFIG_MIGRATION=y +CONFIG_MMC=y +CONFIG_MMC_BLOCK=y +CONFIG_MMC_DW=y +# CONFIG_MMC_DW_BLUEFIELD is not set +# CONFIG_MMC_DW_EXYNOS is not set +# CONFIG_MMC_DW_HI3798CV200 is not set +# CONFIG_MMC_DW_K3 is not set +CONFIG_MMC_DW_PLTFM=y +CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_PLTFM=y +CONFIG_MODULES_USE_ELF_RELA=y +CONFIG_MTD_SPI_NOR=y +CONFIG_MUTEX_SPIN_ON_OWNER=y +CONFIG_NAMESPACES=y +CONFIG_NATIONAL_PHY=y +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_NET_FLOW_LIMIT=y +CONFIG_NET_NS=y +CONFIG_NET_PTP_CLASSIFY=y +CONFIG_NET_SELFTESTS=y +CONFIG_NFS_ACL_SUPPORT=y +CONFIG_NFS_FS=y +CONFIG_NFS_V3_ACL=y +CONFIG_NLS=y +CONFIG_NLS_CODEPAGE_437=y +CONFIG_NLS_ISO8859_1=y +CONFIG_NO_IOPORT_MAP=y +CONFIG_NR_CPUS=4 +CONFIG_OF=y +CONFIG_OF_ADDRESS=y +CONFIG_OF_EARLY_FLATTREE=y +CONFIG_OF_FLATTREE=y +CONFIG_OF_GPIO=y +CONFIG_OF_IRQ=y +CONFIG_OF_KOBJ=y +CONFIG_OF_MDIO=y +CONFIG_PADATA=y +CONFIG_PAGE_POOL=y +CONFIG_PAGE_SIZE_LESS_THAN_256KB=y +CONFIG_PAGE_SIZE_LESS_THAN_64KB=y +CONFIG_PAHOLE_HAS_LANG_EXCLUDE=y +CONFIG_PCS_XPCS=y +CONFIG_PGTABLE_LEVELS=2 +CONFIG_PHYLIB=y +CONFIG_PHYLIB_LEDS=y +CONFIG_PHYLINK=y +CONFIG_PPS=y +CONFIG_PREEMPT=y +CONFIG_PREEMPTION=y +CONFIG_PREEMPT_BUILD=y +CONFIG_PREEMPT_COUNT=y +# CONFIG_PREEMPT_NONE is not set +CONFIG_PREEMPT_RCU=y +# CONFIG_PREVENT_FIRMWARE_BUILD is not set +CONFIG_PTP_1588_CLOCK=y +CONFIG_PTP_1588_CLOCK_OPTIONAL=y +CONFIG_RANDSTRUCT_NONE=y +CONFIG_RATIONAL=y +CONFIG_REGMAP=y +CONFIG_REGMAP_I2C=y +CONFIG_REGMAP_MMIO=y +CONFIG_REGMAP_SPI=y +CONFIG_RESET_AXS10X=y +CONFIG_RESET_CONTROLLER=y +CONFIG_RESET_HSDK=y +CONFIG_RESET_SIMPLE=y +CONFIG_RFS_ACCEL=y +CONFIG_RPS=y +CONFIG_RWSEM_SPIN_ON_OWNER=y +CONFIG_SCSI=y +CONFIG_SCSI_COMMON=y +CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y +CONFIG_SERIAL_8250_DW=y +CONFIG_SERIAL_8250_DWLIB=y +CONFIG_SERIAL_8250_NR_UARTS=4 +CONFIG_SERIAL_8250_RUNTIME_UARTS=4 +CONFIG_SERIAL_ARC=y +CONFIG_SERIAL_ARC_CONSOLE=y +CONFIG_SERIAL_ARC_NR_PORTS=1 +CONFIG_SERIAL_MCTRL_GPIO=y +CONFIG_SERIAL_OF_PLATFORM=y +CONFIG_SG_POOL=y +CONFIG_SMP=y +CONFIG_SOCK_RX_QUEUE_MAPPING=y +CONFIG_SOFTLOCKUP_DETECTOR=y +CONFIG_SPI=y +CONFIG_SPI_DESIGNWARE=y +# CONFIG_SPI_DW_DMA is not set +CONFIG_SPI_DW_MMIO=y +CONFIG_SPI_MASTER=y +CONFIG_SPI_MEM=y +CONFIG_SRCU=y +CONFIG_STACKTRACE=y +# CONFIG_STANDALONE is not set +CONFIG_STMMAC_ETH=y +CONFIG_STMMAC_PLATFORM=y +CONFIG_SUNRPC=y +CONFIG_SWPHY=y +CONFIG_TICK_CPU_ACCOUNTING=y +CONFIG_TIMER_OF=y +CONFIG_TIMER_PROBE=y +CONFIG_TI_ADC108S102=y +CONFIG_TREE_RCU=y +CONFIG_TREE_SRCU=y +CONFIG_UNINLINE_SPIN_UNLOCK=y +CONFIG_USB_SUPPORT=y +# CONFIG_USER_NS is not set +CONFIG_VFAT_FS=y +CONFIG_WATCHDOG_CORE=y +CONFIG_XPS=y diff --git a/target/linux/at91/patches-5.15/109-clk-use-clk_core_get_rate_recalc-in-clk_rate_get.patch b/target/linux/at91/patches-5.15/109-clk-use-clk_core_get_rate_recalc-in-clk_rate_get.patch index 32e760ac17543d..9d9715381ad15a 100644 --- a/target/linux/at91/patches-5.15/109-clk-use-clk_core_get_rate_recalc-in-clk_rate_get.patch +++ b/target/linux/at91/patches-5.15/109-clk-use-clk_core_get_rate_recalc-in-clk_rate_get.patch @@ -18,7 +18,7 @@ Signed-off-by: Stephen Boyd --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c -@@ -3131,7 +3131,10 @@ static int clk_rate_get(void *data, u64 +@@ -3142,7 +3142,10 @@ static int clk_rate_get(void *data, u64 { struct clk_core *core = data; diff --git a/target/linux/ath25/Makefile b/target/linux/ath25/Makefile deleted file mode 100644 index 84d22ca361f19a..00000000000000 --- a/target/linux/ath25/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -# -# Copyright (C) 2006-2013 OpenWrt.org - -include $(TOPDIR)/rules.mk - -ARCH:=mips -BOARD:=ath25 -BOARDNAME:=Atheros AR231x/AR5312 -FEATURES:=squashfs low_mem small_flash source-only -SUBTARGETS:=generic - -KERNEL_PATCHVER:=5.15 - -define Target/Description - Build firmware images for Atheros SoC boards -endef - -include $(INCLUDE_DIR)/target.mk - -DEFAULT_PACKAGES += wpad-basic-mbedtls kmod-ath5k swconfig kmod-gpio-button-hotplug - -$(eval $(call BuildTarget)) diff --git a/target/linux/ath25/base-files/etc/board.d/01_leds b/target/linux/ath25/base-files/etc/board.d/01_leds deleted file mode 100644 index b417d8acef035d..00000000000000 --- a/target/linux/ath25/base-files/etc/board.d/01_leds +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright 2012-2015 OpenWrt.org -# - -. /lib/functions/uci-defaults.sh - -board_config_update - -ucidef_set_led_netdev "wlan" "wlan" "wlan" "wlan0" - -board_config_flush - -exit 0 diff --git a/target/linux/ath25/base-files/etc/board.d/02_network b/target/linux/ath25/base-files/etc/board.d/02_network deleted file mode 100644 index 618ffddae8dff7..00000000000000 --- a/target/linux/ath25/base-files/etc/board.d/02_network +++ /dev/null @@ -1,27 +0,0 @@ - -. /lib/functions/uci-defaults.sh - -board_config_update - -if [ -e "/sys/bus/mdio_bus/drivers/IC+ IP175C/0:00" -o \ - -e "/sys/bus/mdio_bus/drivers/IC+ IP17xx/0:00" ] && \ - [ -x /sbin/swconfig ]; -then - ucidef_add_switch "eth0" \ - "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "5@eth0" - -elif [ -e "/sys/bus/mdio_bus/drivers/Infineon ADM6996/0:00" -o \ - -e "/sys/bus/mdio_bus/drivers/Marvell 88E6060/0:10" ]; -then - ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" - -elif [ -d /sys/class/net/eth1 ]; then - ucidef_set_interfaces_lan_wan "eth0" "eth1" - -else - ucidef_set_interface_lan "eth0" -fi - -board_config_flush - -exit 0 diff --git a/target/linux/ath25/base-files/lib/preinit/15_preinit_iface_atheros b/target/linux/ath25/base-files/lib/preinit/15_preinit_iface_atheros deleted file mode 100644 index b795aac45f9bfe..00000000000000 --- a/target/linux/ath25/base-files/lib/preinit/15_preinit_iface_atheros +++ /dev/null @@ -1,29 +0,0 @@ -preinit_ip() { - if [ -z "$pi_ifname" ]; then - grep -q 'Atheros AR231[567]' /proc/cpuinfo && { - if [ -e "/sys/bus/mdio_bus/drivers/Infineon ADM6996/0:00" -o \ - -e "/sys/bus/mdio_bus/drivers/Marvell 88E6060/0:10" ]; then - ip link set eth0 up - ip link add link eth0 name eth0.1 type vlan id 1 - ifname=eth0.1 - else - ifname=eth0 - fi - pi_ifname=$ifname - } - fi - [ -n "$pi_ifname" ] && grep -q "$pi_ifname" /proc/net/dev && { - ip addr add $pi_ip/$pi_netmask broadcast $pi_broadcast dev $pi_ifname - ip link set $pi_ifname up - } -} - -preinit_ip_deconfig() { - if [ -e "/sys/bus/mdio_bus/drivers/Infineon ADM6996/0:00" -o \ - -e "/sys/bus/mdio_bus/drivers/Marvell 88E6060/0:10" ]; then - ip link del eth0.1 2>/dev/null - ip link set $pi_ifname down - elif [ -n "$pi_ifname" ]; then - ip -4 addr flush dev $pi_ifname - fi -} diff --git a/target/linux/ath25/base-files/lib/upgrade/platform.sh b/target/linux/ath25/base-files/lib/upgrade/platform.sh deleted file mode 100644 index 778bbf5a39c105..00000000000000 --- a/target/linux/ath25/base-files/lib/upgrade/platform.sh +++ /dev/null @@ -1,76 +0,0 @@ -CI_BLKSZ=65536 -CI_LDADR=0x80041000 - -platform_find_partitions() { - local first dev size erasesize name - while read dev size erasesize name; do - name=${name#'"'}; name=${name%'"'} - case "$name" in - vmlinux.bin.l7|kernel|linux|rootfs) - if [ -z "$first" ]; then - first="$name" - else - echo "$erasesize:$first:$name" - break - fi - ;; - esac - done < /proc/mtd -} - -platform_find_kernelpart() { - local part - for part in "${1%:*}" "${1#*:}"; do - case "$part" in - vmlinux.bin.l7|kernel|linux) - echo "$part" - break - ;; - esac - done -} - -platform_check_image() { - [ "$#" -gt 1 ] && return 1 - - case "$(get_magic_word "$1")" in - # Combined Image - 4349) - local md5_img=$(dd if="$1" bs=2 skip=9 count=16 2>/dev/null) - local md5_chk=$(dd if="$1" bs=$CI_BLKSZ skip=1 2>/dev/null | md5sum -); md5_chk="${md5_chk%% *}" - - if [ -n "$md5_img" -a -n "$md5_chk" ] && [ "$md5_img" = "$md5_chk" ]; then - return 0 - else - echo "Invalid image. Contents do not match checksum (image:$md5_img calculated:$md5_chk)" - return 1 - fi - ;; - *) - echo "Invalid image. Use combined .img files on this platform" - return 1 - ;; - esac -} - -platform_do_upgrade() { - local partitions=$(platform_find_partitions) - local kernelpart=$(platform_find_kernelpart "${partitions#*:}") - local erase_size=$((0x${partitions%%:*})); partitions="${partitions#*:}" - local kern_length=0x$(dd if="$1" bs=2 skip=1 count=4 2>/dev/null) - local kern_blocks=$(($kern_length / $CI_BLKSZ)) - local root_blocks=$((0x$(dd if="$1" bs=2 skip=5 count=4 2>/dev/null) / $CI_BLKSZ)) - - if [ -n "$partitions" ] && [ -n "$kernelpart" ] && \ - [ ${kern_blocks:-0} -gt 0 ] && \ - [ ${root_blocks:-0} -gt ${kern_blocks:-0} ] && \ - [ ${erase_size:-0} -gt 0 ]; - then - local append="" - [ -f "$UPGRADE_BACKUP" ] && append="-j $UPGRADE_BACKUP" - - ( dd if="$1" bs=$CI_BLKSZ skip=1 count=$kern_blocks 2>/dev/null; \ - dd if="$1" bs=$CI_BLKSZ skip=$((1+$kern_blocks)) count=$root_blocks 2>/dev/null ) | \ - mtd -r $append -F$kernelpart:$kern_length:$CI_LDADR,rootfs write - $partitions - fi -} diff --git a/target/linux/ath25/config-5.15 b/target/linux/ath25/config-5.15 deleted file mode 100644 index a27ad4980fa002..00000000000000 --- a/target/linux/ath25/config-5.15 +++ /dev/null @@ -1,132 +0,0 @@ -CONFIG_ADM6996_PHY=y -CONFIG_AR2315_WDT=y -CONFIG_AR8216_PHY=y -CONFIG_ARCH_32BIT_OFF_T=y -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_ARCH_KEEP_MEMBLOCK=y -CONFIG_ARCH_MMAP_RND_BITS_MAX=15 -CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=15 -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_ATH25=y -CONFIG_BLK_MQ_PCI=y -CONFIG_CEVT_R4K=y -CONFIG_CLONE_BACKWARDS=y -CONFIG_CMDLINE="console=ttyS0,9600 rootfstype=squashfs,jffs2" -CONFIG_CMDLINE_BOOL=y -# CONFIG_CMDLINE_OVERRIDE is not set -# CONFIG_COMMON_CLK is not set -CONFIG_COMPAT_32BIT_TIME=y -CONFIG_CPU_BIG_ENDIAN=y -CONFIG_CPU_GENERIC_DUMP_TLB=y -CONFIG_CPU_HAS_PREFETCH=y -CONFIG_CPU_HAS_SYNC=y -CONFIG_CPU_MIPS32=y -CONFIG_CPU_MIPS32_R1=y -CONFIG_CPU_MIPSR1=y -CONFIG_CPU_NEEDS_NO_SMARTMIPS_OR_MICROMIPS=y -CONFIG_CPU_R4K_CACHE_TLB=y -CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y -CONFIG_CPU_SUPPORTS_HIGHMEM=y -CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y -CONFIG_CRYPTO_LIB_POLY1305_RSIZE=2 -CONFIG_CRYPTO_RNG2=y -CONFIG_CSRC_R4K=y -CONFIG_DMA_NONCOHERENT=y -CONFIG_EARLY_PRINTK=y -CONFIG_ETHERNET_PACKET_MANGLE=y -CONFIG_FORCE_PCI=y -CONFIG_FW_LOADER_PAGED_BUF=y -CONFIG_GENERIC_ATOMIC64=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CMOS_UPDATE=y -CONFIG_GENERIC_CPU_AUTOPROBE=y -CONFIG_GENERIC_FIND_FIRST_BIT=y -CONFIG_GENERIC_GETTIMEOFDAY=y -CONFIG_GENERIC_IOMAP=y -CONFIG_GENERIC_IRQ_CHIP=y -CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y -CONFIG_GENERIC_IRQ_SHOW=y -CONFIG_GENERIC_LIB_ASHLDI3=y -CONFIG_GENERIC_LIB_ASHRDI3=y -CONFIG_GENERIC_LIB_CMPDI2=y -CONFIG_GENERIC_LIB_LSHRDI3=y -CONFIG_GENERIC_LIB_UCMPDI2=y -CONFIG_GENERIC_PCI_IOMAP=y -CONFIG_GENERIC_SCHED_CLOCK=y -CONFIG_GENERIC_SMP_IDLE_THREAD=y -CONFIG_GENERIC_TIME_VSYSCALL=y -CONFIG_GPIO_AR2315=y -CONFIG_GPIO_AR5312=y -CONFIG_GPIO_CDEV=y -CONFIG_HANDLE_DOMAIN_IRQ=y -CONFIG_HARDWARE_WATCHPOINTS=y -CONFIG_HAS_DMA=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_IOPORT_MAP=y -CONFIG_HW_RANDOM=y -CONFIG_HZ_PERIODIC=y -CONFIG_INITRAMFS_SOURCE="" -CONFIG_IP17XX_PHY=y -CONFIG_IRQ_DOMAIN=y -CONFIG_IRQ_FORCED_THREADING=y -CONFIG_IRQ_MIPS_CPU=y -CONFIG_IRQ_WORK=y -CONFIG_LEDS_GPIO=y -CONFIG_LOCK_DEBUGGING_SUPPORT=y -CONFIG_MDIO_BUS=y -CONFIG_MDIO_DEVICE=y -CONFIG_MDIO_DEVRES=y -CONFIG_MEMFD_CREATE=y -CONFIG_MIGRATION=y -CONFIG_MIPS=y -CONFIG_MIPS_ASID_BITS=8 -CONFIG_MIPS_ASID_SHIFT=0 -CONFIG_MIPS_CLOCK_VSYSCALL=y -# CONFIG_MIPS_CMDLINE_BUILTIN_EXTEND is not set -CONFIG_MIPS_CMDLINE_FROM_BOOTLOADER=y -CONFIG_MIPS_EBPF_JIT=y -CONFIG_MIPS_L1_CACHE_SHIFT=5 -CONFIG_MIPS_LD_CAN_LINK_VDSO=y -CONFIG_MODULES_USE_ELF_REL=y -CONFIG_MTD_AR2315=y -CONFIG_MTD_CFI_ADV_OPTIONS=y -# CONFIG_MTD_CFI_GEOMETRY is not set -# CONFIG_MTD_CFI_INTELEXT is not set -CONFIG_MTD_MYLOADER_PARTS=y -CONFIG_MTD_PHYSMAP=y -CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-3 -CONFIG_MTD_REDBOOT_PARTS=y -CONFIG_MVSWITCH_PHY=y -CONFIG_NEED_DMA_MAP_STATE=y -CONFIG_NEED_PER_CPU_KM=y -CONFIG_NET_AR231X=y -CONFIG_NET_SELFTESTS=y -CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y -# CONFIG_OF is not set -CONFIG_PCI=y -CONFIG_PCI_AR2315=y -CONFIG_PCI_DISABLE_COMMON_QUIRKS=y -CONFIG_PCI_DOMAINS=y -CONFIG_PCI_DRIVERS_LEGACY=y -CONFIG_PERF_USE_VMALLOC=y -CONFIG_PGTABLE_LEVELS=2 -CONFIG_PHYLIB=y -CONFIG_PTP_1588_CLOCK_OPTIONAL=y -CONFIG_SERIAL_8250_NR_UARTS=1 -CONFIG_SERIAL_8250_RUNTIME_UARTS=1 -CONFIG_SERIAL_MCTRL_GPIO=y -CONFIG_SOC_AR2315=y -CONFIG_SOC_AR5312=y -CONFIG_SRCU=y -# CONFIG_SWAP is not set -CONFIG_SWCONFIG=y -CONFIG_SYSCTL_EXCEPTION_TRACE=y -CONFIG_SYS_HAS_CPU_MIPS32_R1=y -CONFIG_SYS_HAS_EARLY_PRINTK=y -CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y -CONFIG_SYS_SUPPORTS_ARBIT_HZ=y -CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y -CONFIG_TARGET_ISA_REV=1 -CONFIG_TICK_CPU_ACCOUNTING=y -CONFIG_TINY_SRCU=y -CONFIG_USB_SUPPORT=y diff --git a/target/linux/ath25/files/drivers/net/phy/mvswitch.c b/target/linux/ath25/files/drivers/net/phy/mvswitch.c deleted file mode 100644 index 285d306ef09d08..00000000000000 --- a/target/linux/ath25/files/drivers/net/phy/mvswitch.c +++ /dev/null @@ -1,454 +0,0 @@ -/* - * Marvell 88E6060 switch driver - * Copyright (c) 2008 Felix Fietkau - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License v2 as published by the - * Free Software Foundation - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include "mvswitch.h" - -/* Undefine this to use trailer mode instead. - * I don't know if header mode works with all chips */ -#define HEADER_MODE 1 - -MODULE_DESCRIPTION("Marvell 88E6060 Switch driver"); -MODULE_AUTHOR("Felix Fietkau"); -MODULE_LICENSE("GPL"); - -#define MVSWITCH_MAGIC 0x88E6060 - -struct mvswitch_priv { - netdev_features_t orig_features; - u8 vlans[16]; -}; - -#define to_mvsw(_phy) ((struct mvswitch_priv *) (_phy)->priv) - -static inline u16 -r16(struct phy_device *phydev, int addr, int reg) -{ - struct mii_bus *bus = phydev->mdio.bus; - - return bus->read(bus, addr, reg); -} - -static inline void -w16(struct phy_device *phydev, int addr, int reg, u16 val) -{ - struct mii_bus *bus = phydev->mdio.bus; - - bus->write(bus, addr, reg, val); -} - - -static struct sk_buff * -mvswitch_mangle_tx(struct net_device *dev, struct sk_buff *skb) -{ - struct mvswitch_priv *priv; - char *buf = NULL; - u16 vid; - - priv = dev->phy_ptr; - if (unlikely(!priv)) - goto error; - - if (unlikely(skb->len < 16)) - goto error; - -#ifdef HEADER_MODE - if (__vlan_hwaccel_get_tag(skb, &vid)) - goto error; - - if (skb_cloned(skb) || (skb->len <= 62) || (skb_headroom(skb) < MV_HEADER_SIZE)) { - if (pskb_expand_head(skb, MV_HEADER_SIZE, (skb->len < 62 ? 62 - skb->len : 0), GFP_ATOMIC)) - goto error_expand; - if (skb->len < 62) - skb->len = 62; - } - buf = skb_push(skb, MV_HEADER_SIZE); -#else - if (__vlan_get_tag(skb, &vid)) - goto error; - - if (unlikely((vid > 15 || !priv->vlans[vid]))) - goto error; - - if (skb->len <= 64) { - if (pskb_expand_head(skb, 0, 64 + MV_TRAILER_SIZE - skb->len, GFP_ATOMIC)) - goto error_expand; - - buf = skb->data + 64; - skb->len = 64 + MV_TRAILER_SIZE; - } else { - if (skb_cloned(skb) || unlikely(skb_tailroom(skb) < 4)) { - if (pskb_expand_head(skb, 0, 4, GFP_ATOMIC)) - goto error_expand; - } - buf = skb_put(skb, 4); - } - - /* move the ethernet header 4 bytes forward, overwriting the vlan tag */ - memmove(skb->data + 4, skb->data, 12); - skb->data += 4; - skb->len -= 4; - skb->mac_header += 4; -#endif - - if (!buf) - goto error; - - -#ifdef HEADER_MODE - /* prepend the tag */ - *((__be16 *) buf) = cpu_to_be16( - ((vid << MV_HEADER_VLAN_S) & MV_HEADER_VLAN_M) | - ((priv->vlans[vid] << MV_HEADER_PORTS_S) & MV_HEADER_PORTS_M) - ); -#else - /* append the tag */ - *((__be32 *) buf) = cpu_to_be32(( - (MV_TRAILER_OVERRIDE << MV_TRAILER_FLAGS_S) | - ((priv->vlans[vid] & MV_TRAILER_PORTS_M) << MV_TRAILER_PORTS_S) - )); -#endif - - return skb; - -error_expand: - if (net_ratelimit()) - printk("%s: failed to expand/update skb for the switch\n", dev->name); - -error: - /* any errors? drop the packet! */ - dev_kfree_skb_any(skb); - return NULL; -} - -static void -mvswitch_mangle_rx(struct net_device *dev, struct sk_buff *skb) -{ - struct mvswitch_priv *priv; - unsigned char *buf; - int vlan = -1; - int i; - - priv = dev->phy_ptr; - if (WARN_ON_ONCE(!priv)) - return; - -#ifdef HEADER_MODE - buf = skb->data; - skb_pull(skb, MV_HEADER_SIZE); -#else - buf = skb->data + skb->len - MV_TRAILER_SIZE; - if (buf[0] != 0x80) - return; -#endif - - /* look for the vlan matching the incoming port */ - for (i = 0; i < ARRAY_SIZE(priv->vlans); i++) { - if ((1 << buf[1]) & priv->vlans[i]) - vlan = i; - } - - if (vlan == -1) - return; - - __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan); -} - - -static int -mvswitch_wait_mask(struct phy_device *pdev, int addr, int reg, u16 mask, u16 val) -{ - int i = 100; - u16 r; - - do { - r = r16(pdev, addr, reg) & mask; - if (r == val) - return 0; - } while(--i > 0); - return -ETIMEDOUT; -} - -static int -mvswitch_config_init(struct phy_device *pdev) -{ - struct mvswitch_priv *priv = to_mvsw(pdev); - struct net_device *dev = pdev->attached_dev; - u8 vlmap = 0; - int i; - - if (!dev) - return -EINVAL; - - printk("%s: Marvell 88E6060 PHY driver attached.\n", dev->name); - linkmode_zero(pdev->supported); - linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, pdev->supported); - linkmode_copy(pdev->advertising, pdev->supported); - dev->phy_ptr = priv; - pdev->irq = PHY_POLL; -#ifdef HEADER_MODE - dev->flags |= IFF_PROMISC; -#endif - - /* initialize default vlans */ - for (i = 0; i < MV_PORTS; i++) - priv->vlans[(i == MV_WANPORT ? 2 : 1)] |= (1 << i); - - /* before entering reset, disable all ports */ - for (i = 0; i < MV_PORTS; i++) - w16(pdev, MV_PORTREG(CONTROL, i), 0x00); - - msleep(2); /* wait for the status change to settle in */ - - /* put the ATU in reset */ - w16(pdev, MV_SWITCHREG(ATU_CTRL), MV_ATUCTL_RESET); - - i = mvswitch_wait_mask(pdev, MV_SWITCHREG(ATU_CTRL), MV_ATUCTL_RESET, 0); - if (i < 0) { - printk("%s: Timeout waiting for the switch to reset.\n", dev->name); - return i; - } - - /* set the ATU flags */ - w16(pdev, MV_SWITCHREG(ATU_CTRL), - MV_ATUCTL_NO_LEARN | - MV_ATUCTL_ATU_1K | - MV_ATUCTL_AGETIME(MV_ATUCTL_AGETIME_MIN) /* minimum without disabling ageing */ - ); - - /* initialize the cpu port */ - w16(pdev, MV_PORTREG(CONTROL, MV_CPUPORT), -#ifdef HEADER_MODE - MV_PORTCTRL_HEADER | -#else - MV_PORTCTRL_RXTR | - MV_PORTCTRL_TXTR | -#endif - MV_PORTCTRL_ENABLED - ); - /* wait for the phy change to settle in */ - msleep(2); - for (i = 0; i < MV_PORTS; i++) { - u8 pvid = 0; - int j; - - vlmap = 0; - - /* look for the matching vlan */ - for (j = 0; j < ARRAY_SIZE(priv->vlans); j++) { - if (priv->vlans[j] & (1 << i)) { - vlmap = priv->vlans[j]; - pvid = j; - } - } - /* leave port unconfigured if it's not part of a vlan */ - if (!vlmap) - continue; - - /* add the cpu port to the allowed destinations list */ - vlmap |= (1 << MV_CPUPORT); - - /* take port out of its own vlan destination map */ - vlmap &= ~(1 << i); - - /* apply vlan settings */ - w16(pdev, MV_PORTREG(VLANMAP, i), - MV_PORTVLAN_PORTS(vlmap) | - MV_PORTVLAN_ID(i) - ); - - /* re-enable port */ - w16(pdev, MV_PORTREG(CONTROL, i), - MV_PORTCTRL_ENABLED - ); - } - - w16(pdev, MV_PORTREG(VLANMAP, MV_CPUPORT), - MV_PORTVLAN_ID(MV_CPUPORT) - ); - - /* set the port association vector */ - for (i = 0; i <= MV_PORTS; i++) { - w16(pdev, MV_PORTREG(ASSOC, i), - MV_PORTASSOC_PORTS(1 << i) - ); - } - - /* init switch control */ - w16(pdev, MV_SWITCHREG(CTRL), - MV_SWITCHCTL_MSIZE | - MV_SWITCHCTL_DROP - ); - - dev->eth_mangle_rx = mvswitch_mangle_rx; - dev->eth_mangle_tx = mvswitch_mangle_tx; - priv->orig_features = dev->features; - -#ifdef HEADER_MODE -#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,1,0) - dev->priv_flags |= IFF_NO_IP_ALIGN; -#else - dev->extra_priv_flags |= IFF_NO_IP_ALIGN; -#endif - dev->features |= NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX; -#else - dev->features |= NETIF_F_HW_VLAN_CTAG_RX; -#endif - - return 0; -} - -static int -mvswitch_read_status(struct phy_device *pdev) -{ - pdev->speed = SPEED_100; - pdev->duplex = DUPLEX_FULL; - pdev->link = 1; - - /* XXX ugly workaround: we can't force the switch - * to gracefully handle hosts moving from one port to another, - * so we have to regularly clear the ATU database */ - - /* wait for the ATU to become available */ - mvswitch_wait_mask(pdev, MV_SWITCHREG(ATU_OP), MV_ATUOP_INPROGRESS, 0); - - /* flush the ATU */ - w16(pdev, MV_SWITCHREG(ATU_OP), - MV_ATUOP_INPROGRESS | - MV_ATUOP_FLUSH_ALL - ); - - /* wait for operation to complete */ - mvswitch_wait_mask(pdev, MV_SWITCHREG(ATU_OP), MV_ATUOP_INPROGRESS, 0); - - return 0; -} - -static int -mvswitch_aneg_done(struct phy_device *phydev) -{ - return 1; /* Return any positive value */ -} - -static int -mvswitch_config_aneg(struct phy_device *phydev) -{ - return 0; -} - -static void -mvswitch_detach(struct phy_device *pdev) -{ - struct mvswitch_priv *priv = to_mvsw(pdev); - struct net_device *dev = pdev->attached_dev; - - if (!dev) - return; - - dev->phy_ptr = NULL; - dev->eth_mangle_rx = NULL; - dev->eth_mangle_tx = NULL; - dev->features = priv->orig_features; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,1,0) - dev->priv_flags &= ~IFF_NO_IP_ALIGN; -#else - dev->extra_priv_flags &= ~IFF_NO_IP_ALIGN; -#endif -} - -static void -mvswitch_remove(struct phy_device *pdev) -{ - struct mvswitch_priv *priv = to_mvsw(pdev); - - kfree(priv); -} - -static int -mvswitch_probe(struct phy_device *pdev) -{ - struct mvswitch_priv *priv; - - priv = kzalloc(sizeof(struct mvswitch_priv), GFP_KERNEL); - if (priv == NULL) - return -ENOMEM; - - pdev->priv = priv; - - return 0; -} - -static int -mvswitch_fixup(struct phy_device *dev) -{ - struct mii_bus *bus = dev->mdio.bus; - u16 reg; - - if (dev->mdio.addr != 0x10) - return 0; - - reg = bus->read(bus, MV_PORTREG(IDENT, 0)) & MV_IDENT_MASK; - if (reg != MV_IDENT_VALUE) - return 0; - - dev->phy_id = MVSWITCH_MAGIC; - return 0; -} - - -static struct phy_driver mvswitch_driver = { - .name = "Marvell 88E6060", - .phy_id = MVSWITCH_MAGIC, - .phy_id_mask = 0xffffffff, - .features = PHY_BASIC_FEATURES, - .probe = &mvswitch_probe, - .remove = &mvswitch_remove, - .detach = &mvswitch_detach, - .config_init = &mvswitch_config_init, - .config_aneg = &mvswitch_config_aneg, - .aneg_done = &mvswitch_aneg_done, - .read_status = &mvswitch_read_status, -}; - -static int __init -mvswitch_init(void) -{ - phy_register_fixup_for_id(PHY_ANY_ID, mvswitch_fixup); - return phy_driver_register(&mvswitch_driver, THIS_MODULE); -} - -static void __exit -mvswitch_exit(void) -{ - phy_driver_unregister(&mvswitch_driver); -} - -module_init(mvswitch_init); -module_exit(mvswitch_exit); diff --git a/target/linux/ath25/files/drivers/net/phy/mvswitch.h b/target/linux/ath25/files/drivers/net/phy/mvswitch.h deleted file mode 100644 index ab2a1a126e0d68..00000000000000 --- a/target/linux/ath25/files/drivers/net/phy/mvswitch.h +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Marvell 88E6060 switch driver - * Copyright (c) 2008 Felix Fietkau - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License v2 as published by the - * Free Software Foundation - */ -#ifndef __MVSWITCH_H -#define __MVSWITCH_H - -#define MV_HEADER_SIZE 2 -#define MV_HEADER_PORTS_M 0x001f -#define MV_HEADER_PORTS_S 0 -#define MV_HEADER_VLAN_M 0xf000 -#define MV_HEADER_VLAN_S 12 - -#define MV_TRAILER_SIZE 4 -#define MV_TRAILER_PORTS_M 0x1f -#define MV_TRAILER_PORTS_S 16 -#define MV_TRAILER_FLAGS_S 24 -#define MV_TRAILER_OVERRIDE 0x80 - - -#define MV_PORTS 5 -#define MV_WANPORT 4 -#define MV_CPUPORT 5 - -#define MV_BASE 0x10 - -#define MV_PHYPORT_BASE (MV_BASE + 0x0) -#define MV_PHYPORT(_n) (MV_PHYPORT_BASE + (_n)) -#define MV_SWITCHPORT_BASE (MV_BASE + 0x8) -#define MV_SWITCHPORT(_n) (MV_SWITCHPORT_BASE + (_n)) -#define MV_SWITCHREGS (MV_BASE + 0xf) - -enum { - MV_PHY_CONTROL = 0x00, - MV_PHY_STATUS = 0x01, - MV_PHY_IDENT0 = 0x02, - MV_PHY_IDENT1 = 0x03, - MV_PHY_ANEG = 0x04, - MV_PHY_LINK_ABILITY = 0x05, - MV_PHY_ANEG_EXPAND = 0x06, - MV_PHY_XMIT_NEXTP = 0x07, - MV_PHY_LINK_NEXTP = 0x08, - MV_PHY_CONTROL1 = 0x10, - MV_PHY_STATUS1 = 0x11, - MV_PHY_INTR_EN = 0x12, - MV_PHY_INTR_STATUS = 0x13, - MV_PHY_INTR_PORT = 0x14, - MV_PHY_RECV_COUNTER = 0x16, - MV_PHY_LED_PARALLEL = 0x16, - MV_PHY_LED_STREAM = 0x17, - MV_PHY_LED_CTRL = 0x18, - MV_PHY_LED_OVERRIDE = 0x19, - MV_PHY_VCT_CTRL = 0x1a, - MV_PHY_VCT_STATUS = 0x1b, - MV_PHY_CONTROL2 = 0x1e -}; -#define MV_PHYREG(_type, _port) MV_PHYPORT(_port), MV_PHY_##_type - -enum { - MV_PORT_STATUS = 0x00, - MV_PORT_IDENT = 0x03, - MV_PORT_CONTROL = 0x04, - MV_PORT_VLANMAP = 0x06, - MV_PORT_ASSOC = 0x0b, - MV_PORT_RXCOUNT = 0x10, - MV_PORT_TXCOUNT = 0x11, -}; -#define MV_PORTREG(_type, _port) MV_SWITCHPORT(_port), MV_PORT_##_type - -enum { - MV_PORTCTRL_BLOCK = (1 << 0), - MV_PORTCTRL_LEARN = (2 << 0), - MV_PORTCTRL_ENABLED = (3 << 0), - MV_PORTCTRL_VLANTUN = (1 << 7), /* Enforce VLANs on packets */ - MV_PORTCTRL_RXTR = (1 << 8), /* Enable Marvell packet trailer for ingress */ - MV_PORTCTRL_HEADER = (1 << 11), /* Enable Marvell packet header mode for port */ - MV_PORTCTRL_TXTR = (1 << 14), /* Enable Marvell packet trailer for egress */ - MV_PORTCTRL_FORCEFL = (1 << 15), /* force flow control */ -}; - -#define MV_PORTVLAN_ID(_n) (((_n) & 0xf) << 12) -#define MV_PORTVLAN_PORTS(_n) ((_n) & 0x3f) - -#define MV_PORTASSOC_PORTS(_n) ((_n) & 0x1f) -#define MV_PORTASSOC_MONITOR (1 << 15) - -enum { - MV_SWITCH_MAC0 = 0x01, - MV_SWITCH_MAC1 = 0x02, - MV_SWITCH_MAC2 = 0x03, - MV_SWITCH_CTRL = 0x04, - MV_SWITCH_ATU_CTRL = 0x0a, - MV_SWITCH_ATU_OP = 0x0b, - MV_SWITCH_ATU_DATA = 0x0c, - MV_SWITCH_ATU_MAC0 = 0x0d, - MV_SWITCH_ATU_MAC1 = 0x0e, - MV_SWITCH_ATU_MAC2 = 0x0f, -}; -#define MV_SWITCHREG(_type) MV_SWITCHREGS, MV_SWITCH_##_type - -enum { - MV_SWITCHCTL_EEIE = (1 << 0), /* EEPROM interrupt enable */ - MV_SWITCHCTL_PHYIE = (1 << 1), /* PHY interrupt enable */ - MV_SWITCHCTL_ATUDONE= (1 << 2), /* ATU done interrupt enable */ - MV_SWITCHCTL_ATUIE = (1 << 3), /* ATU interrupt enable */ - MV_SWITCHCTL_CTRMODE= (1 << 8), /* statistics for rx and tx errors */ - MV_SWITCHCTL_RELOAD = (1 << 9), /* reload registers from eeprom */ - MV_SWITCHCTL_MSIZE = (1 << 10), /* increase maximum frame size */ - MV_SWITCHCTL_DROP = (1 << 13), /* discard frames with excessive collisions */ -}; - -enum { -#define MV_ATUCTL_AGETIME_MIN 16 -#define MV_ATUCTL_AGETIME_MAX 4080 -#define MV_ATUCTL_AGETIME(_n) ((((_n) / 16) & 0xff) << 4) - MV_ATUCTL_ATU_256 = (0 << 12), - MV_ATUCTL_ATU_512 = (1 << 12), - MV_ATUCTL_ATU_1K = (2 << 12), - MV_ATUCTL_ATUMASK = (3 << 12), - MV_ATUCTL_NO_LEARN = (1 << 14), - MV_ATUCTL_RESET = (1 << 15), -}; - -enum { -#define MV_ATUOP_DBNUM(_n) ((_n) & 0x0f) - - MV_ATUOP_NOOP = (0 << 12), - MV_ATUOP_FLUSH_ALL = (1 << 12), - MV_ATUOP_FLUSH_U = (2 << 12), - MV_ATUOP_LOAD_DB = (3 << 12), - MV_ATUOP_GET_NEXT = (4 << 12), - MV_ATUOP_FLUSH_DB = (5 << 12), - MV_ATUOP_FLUSH_DB_UU= (6 << 12), - - MV_ATUOP_INPROGRESS = (1 << 15), -}; - -#define MV_IDENT_MASK 0xfff0 -#define MV_IDENT_VALUE 0x0600 - -#endif diff --git a/target/linux/ath25/image/Makefile b/target/linux/ath25/image/Makefile deleted file mode 100644 index 9cdcdf9e9572e4..00000000000000 --- a/target/linux/ath25/image/Makefile +++ /dev/null @@ -1,118 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -# -# Copyright (C) 2006-2010 OpenWrt.org - -include $(TOPDIR)/rules.mk -include $(INCLUDE_DIR)/image.mk - -define Build/mkfwimage - $(STAGING_DIR_HOST)/bin/mkfwimage \ - -B $(1).$(VERSION_DIST).$(REVISION) \ - -k $(IMAGE_KERNEL) \ - -r $(IMAGE_ROOTFS) \ - -o $@.new && \ - mv $@.new $@ -endef - -define Build/combined-image - -sh $(TOPDIR)/scripts/combined-image.sh \ - "$(IMAGE_KERNEL)" \ - "$(IMAGE_ROOTFS)" \ - "$@.new" && \ - mv $@.new $@ -endef - -define Build/mkmylofw - $(STAGING_DIR_HOST)/bin/mkmylofw -B $(1) \ - -p0x020000:0x130000:ah:0x80041000:linux:$(IMAGE_KERNEL) \ - -p0x150000:0x2a0000:::rootfs:$(IMAGE_ROOTFS) \ - $@.new && \ - mv $@.new $@ -endef - -define Build/gzip-kernel - gzip -9n -c $@ > $@.gz - dd if=$@.gz of=$@ bs=65536 conv=sync -endef - -define Build/lzma-kernel - $(STAGING_DIR_HOST)/bin/lzma e $@ $@.l7 - dd if=$@.l7 of=$@ bs=65536 conv=sync -endef - -define Build/copy-kernel - rm -f $@ $@.elf - cp $< $@ - cp $<.elf $@.elf -endef - -define Build/elf-kernel - cp $(IMAGE_KERNEL).elf $@ -endef - - -define Device/Default - PROFILES = Default $$(DEVICE_NAME) - KERNEL := copy-kernel | lzma-kernel - KERNEL_INITRAMFS = kernel-bin - KERNEL_INITRAMFS_NAME := vmlinux-initramfs.elf - KERNEL_INITRAMFS_SUFFIX := -kernel.elf - IMAGES := sysupgrade.bin - FILESYSTEMS := squashfs -endef - -define Device/generic - DEVICE_VENDOR := Atheros - DEVICE_MODEL := Generic AR2xxx board - IMAGES := kernel.lzma kernel.elf kernel.gz rootfs.bin sysupgrade.bin - IMAGE/kernel.gz := elf-kernel | gzip-kernel - IMAGE/kernel.elf := elf-kernel - IMAGE/kernel.lzma := elf-kernel | lzma-kernel - IMAGE/rootfs.bin := append-rootfs | pad-rootfs | pad-to 128k - IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | pad-to 128k | combined-image - DEVICE_IMG_NAME = $$(DEVICE_IMG_PREFIX)-$$(if $$(findstring kernel,$$(2)),,$$(1)-)$$(2) -endef -TARGET_DEVICES += generic - -define Device/ubnt_picostation-2 - DEVICE_VENDOR := Ubiquiti - DEVICE_MODEL := Picostation 2 (XS2-8) - IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | pad-to 128k | mkfwimage XS2-8 -v XS2.ar2316 -endef -TARGET_DEVICES += ubnt_picostation-2 - -define Device/ubnt_nanostation-2 - DEVICE_VENDOR := Ubiquiti - DEVICE_MODEL := Nanostation 2 (XS2) - IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | pad-to 128k | mkfwimage XS2 -v XS2.ar2316 - DEFAULT := n -endef -TARGET_DEVICES += ubnt_nanostation-2 - -define Device/ubnt_nanostation-5 - DEVICE_VENDOR := Ubiquiti - DEVICE_MODEL := Nanostation 5 (XS5) - IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | pad-to 128k | mkfwimage XS5 -v XS5.ar2313 - DEFAULT := n -endef -TARGET_DEVICES += ubnt_nanostation-5 - -define Device/compex_np25g - DEVICE_VENDOR := Compex - DEVICE_MODEL := NP25G - KERNEL := kernel-bin | gzip-kernel - IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | pad-to 128k | mkmylofw np25g - BROKEN := y -endef -TARGET_DEVICES += compex_np25g - -define Device/compex_wpe53g - DEVICE_VENDOR := Compex - DEVICE_MODEL := WPE53G - KERNEL := kernel-bin | gzip-kernel - IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | pad-to 128k | mkmylofw wpe53g - BROKEN := y -endef -TARGET_DEVICES += compex_wpe53g - -$(eval $(call BuildImage)) diff --git a/target/linux/ath25/patches-5.15/107-ar5312_gpio.patch b/target/linux/ath25/patches-5.15/107-ar5312_gpio.patch deleted file mode 100644 index 70d139621aab66..00000000000000 --- a/target/linux/ath25/patches-5.15/107-ar5312_gpio.patch +++ /dev/null @@ -1,212 +0,0 @@ ---- a/arch/mips/ath25/Kconfig -+++ b/arch/mips/ath25/Kconfig -@@ -2,6 +2,7 @@ - config SOC_AR5312 - bool "Atheros AR5312/AR2312+ SoC support" - depends on ATH25 -+ select GPIO_AR5312 - default y - - config SOC_AR2315 ---- a/arch/mips/ath25/ar5312.c -+++ b/arch/mips/ath25/ar5312.c -@@ -23,6 +23,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -177,6 +178,22 @@ static struct platform_device ar5312_phy - .num_resources = 1, - }; - -+static struct resource ar5312_gpio_res[] = { -+ { -+ .name = "ar5312-gpio", -+ .flags = IORESOURCE_MEM, -+ .start = AR5312_GPIO_BASE, -+ .end = AR5312_GPIO_BASE + AR5312_GPIO_SIZE - 1, -+ }, -+}; -+ -+static struct platform_device ar5312_gpio = { -+ .name = "ar5312-gpio", -+ .id = -1, -+ .resource = ar5312_gpio_res, -+ .num_resources = ARRAY_SIZE(ar5312_gpio_res), -+}; -+ - static void __init ar5312_flash_init(void) - { - void __iomem *flashctl_base; -@@ -244,6 +261,8 @@ void __init ar5312_init_devices(void) - - platform_device_register(&ar5312_physmap_flash); - -+ platform_device_register(&ar5312_gpio); -+ - switch (ath25_soc) { - case ATH25_SOC_AR5312: - if (!ath25_board.radio) ---- a/drivers/gpio/Kconfig -+++ b/drivers/gpio/Kconfig -@@ -143,6 +143,13 @@ config GPIO_AMDPT - driver for GPIO functionality on Promontory IOHub - Require ACPI ASL code to enumerate as a platform device. - -+config GPIO_AR5312 -+ bool "AR5312 SoC GPIO support" -+ default y if SOC_AR5312 -+ depends on SOC_AR5312 -+ help -+ Say yes here to enable GPIO support for Atheros AR5312/AR2312+ SoCs. -+ - config GPIO_ASPEED - tristate "Aspeed GPIO support" - depends on (ARCH_ASPEED || COMPILE_TEST) && OF_GPIO ---- a/drivers/gpio/Makefile -+++ b/drivers/gpio/Makefile -@@ -32,6 +32,7 @@ obj-$(CONFIG_GPIO_ALTERA) += gpio-alt - obj-$(CONFIG_GPIO_AMD8111) += gpio-amd8111.o - obj-$(CONFIG_GPIO_AMD_FCH) += gpio-amd-fch.o - obj-$(CONFIG_GPIO_AMDPT) += gpio-amdpt.o -+obj-$(CONFIG_GPIO_AR5312) += gpio-ar5312.o - obj-$(CONFIG_GPIO_ARIZONA) += gpio-arizona.o - obj-$(CONFIG_GPIO_ASPEED) += gpio-aspeed.o - obj-$(CONFIG_GPIO_ASPEED_SGPIO) += gpio-aspeed-sgpio.o ---- /dev/null -+++ b/drivers/gpio/gpio-ar5312.c -@@ -0,0 +1,121 @@ -+/* -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file "COPYING" in the main directory of this archive -+ * for more details. -+ * -+ * Copyright (C) 2003 Atheros Communications, Inc., All Rights Reserved. -+ * Copyright (C) 2006 FON Technology, SL. -+ * Copyright (C) 2006 Imre Kaloz -+ * Copyright (C) 2006-2009 Felix Fietkau -+ * Copyright (C) 2012 Alexandros C. Couloumbis -+ */ -+ -+#include -+#include -+#include -+#include -+ -+#define DRIVER_NAME "ar5312-gpio" -+ -+#define AR5312_GPIO_DO 0x00 /* output register */ -+#define AR5312_GPIO_DI 0x04 /* intput register */ -+#define AR5312_GPIO_CR 0x08 /* control register */ -+ -+#define AR5312_GPIO_CR_M(x) (1 << (x)) /* mask for i/o */ -+#define AR5312_GPIO_CR_O(x) (0 << (x)) /* mask for output */ -+#define AR5312_GPIO_CR_I(x) (1 << (x)) /* mask for input */ -+#define AR5312_GPIO_CR_INT(x) (1 << ((x)+8)) /* mask for interrupt */ -+#define AR5312_GPIO_CR_UART(x) (1 << ((x)+16)) /* uart multiplex */ -+ -+#define AR5312_GPIO_NUM 8 -+ -+static void __iomem *ar5312_mem; -+ -+static inline u32 ar5312_gpio_reg_read(unsigned reg) -+{ -+ return __raw_readl(ar5312_mem + reg); -+} -+ -+static inline void ar5312_gpio_reg_write(unsigned reg, u32 val) -+{ -+ __raw_writel(val, ar5312_mem + reg); -+} -+ -+static inline void ar5312_gpio_reg_mask(unsigned reg, u32 mask, u32 val) -+{ -+ ar5312_gpio_reg_write(reg, (ar5312_gpio_reg_read(reg) & ~mask) | val); -+} -+ -+static int ar5312_gpio_get_val(struct gpio_chip *chip, unsigned gpio) -+{ -+ return (ar5312_gpio_reg_read(AR5312_GPIO_DI) >> gpio) & 1; -+} -+ -+static void ar5312_gpio_set_val(struct gpio_chip *chip, unsigned gpio, int val) -+{ -+ u32 reg = ar5312_gpio_reg_read(AR5312_GPIO_DO); -+ -+ reg = val ? reg | (1 << gpio) : reg & ~(1 << gpio); -+ ar5312_gpio_reg_write(AR5312_GPIO_DO, reg); -+} -+ -+static int ar5312_gpio_dir_in(struct gpio_chip *chip, unsigned gpio) -+{ -+ ar5312_gpio_reg_mask(AR5312_GPIO_CR, 0, 1 << gpio); -+ return 0; -+} -+ -+static int ar5312_gpio_dir_out(struct gpio_chip *chip, unsigned gpio, int val) -+{ -+ ar5312_gpio_reg_mask(AR5312_GPIO_CR, 1 << gpio, 0); -+ ar5312_gpio_set_val(chip, gpio, val); -+ return 0; -+} -+ -+static struct gpio_chip ar5312_gpio_chip = { -+ .label = DRIVER_NAME, -+ .direction_input = ar5312_gpio_dir_in, -+ .direction_output = ar5312_gpio_dir_out, -+ .set = ar5312_gpio_set_val, -+ .get = ar5312_gpio_get_val, -+ .base = 0, -+ .ngpio = AR5312_GPIO_NUM, -+}; -+ -+static int ar5312_gpio_probe(struct platform_device *pdev) -+{ -+ struct device *dev = &pdev->dev; -+ struct resource *res; -+ int ret; -+ -+ if (ar5312_mem) -+ return -EBUSY; -+ -+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ ar5312_mem = devm_ioremap_resource(dev, res); -+ if (IS_ERR(ar5312_mem)) -+ return PTR_ERR(ar5312_mem); -+ -+ ar5312_gpio_chip.parent = dev; -+ ret = gpiochip_add(&ar5312_gpio_chip); -+ if (ret) { -+ dev_err(dev, "failed to add gpiochip\n"); -+ return ret; -+ } -+ -+ return 0; -+} -+ -+static struct platform_driver ar5312_gpio_driver = { -+ .probe = ar5312_gpio_probe, -+ .driver = { -+ .name = DRIVER_NAME, -+ .owner = THIS_MODULE, -+ } -+}; -+ -+static int __init ar5312_gpio_init(void) -+{ -+ return platform_driver_register(&ar5312_gpio_driver); -+} -+subsys_initcall(ar5312_gpio_init); ---- a/arch/mips/Kconfig -+++ b/arch/mips/Kconfig -@@ -232,6 +232,7 @@ config ATH25 - select CEVT_R4K - select CSRC_R4K - select DMA_NONCOHERENT -+ select GPIOLIB - select IRQ_MIPS_CPU - select IRQ_DOMAIN - select SYS_HAS_CPU_MIPS32_R1 diff --git a/target/linux/ath25/patches-5.15/108-ar2315_gpio.patch b/target/linux/ath25/patches-5.15/108-ar2315_gpio.patch deleted file mode 100644 index f2e1e4a9a321ef..00000000000000 --- a/target/linux/ath25/patches-5.15/108-ar2315_gpio.patch +++ /dev/null @@ -1,363 +0,0 @@ ---- a/arch/mips/ath25/Kconfig -+++ b/arch/mips/ath25/Kconfig -@@ -8,6 +8,7 @@ config SOC_AR5312 - config SOC_AR2315 - bool "Atheros AR2315+ SoC support" - depends on ATH25 -+ select GPIO_AR2315 - default y - - config PCI_AR2315 ---- a/arch/mips/ath25/ar2315.c -+++ b/arch/mips/ath25/ar2315.c -@@ -22,6 +22,8 @@ - #include - #include - #include -+#include -+#include - #include - #include - #include -@@ -165,11 +167,42 @@ void __init ar2315_arch_init_irq(void) - ar2315_misc_irq_domain = domain; - } - -+static struct resource ar2315_gpio_res[] = { -+ { -+ .name = "ar2315-gpio", -+ .flags = IORESOURCE_MEM, -+ .start = AR2315_RST_BASE + AR2315_GPIO, -+ .end = AR2315_RST_BASE + AR2315_GPIO + 0x10 - 1, -+ }, -+ { -+ .name = "ar2315-gpio", -+ .flags = IORESOURCE_IRQ, -+ }, -+ { -+ .name = "ar2315-gpio-irq-base", -+ .flags = IORESOURCE_IRQ, -+ .start = AR231X_GPIO_IRQ_BASE, -+ .end = AR231X_GPIO_IRQ_BASE, -+ } -+}; -+ -+static struct platform_device ar2315_gpio = { -+ .id = -1, -+ .name = "ar2315-gpio", -+ .resource = ar2315_gpio_res, -+ .num_resources = ARRAY_SIZE(ar2315_gpio_res) -+}; -+ - void __init ar2315_init_devices(void) - { - /* Find board configuration */ - ath25_find_config(AR2315_SPI_READ_BASE, AR2315_SPI_READ_SIZE); - -+ ar2315_gpio_res[1].start = irq_create_mapping(ar2315_misc_irq_domain, -+ AR2315_MISC_IRQ_GPIO); -+ ar2315_gpio_res[1].end = ar2315_gpio_res[1].start; -+ platform_device_register(&ar2315_gpio); -+ - ath25_add_wmac(0, AR2315_WLAN0_BASE, AR2315_IRQ_WLAN0); - } - -@@ -185,8 +218,8 @@ static void ar2315_restart(char *command - /* Cold reset does not work on the AR2315/6, use the GPIO reset bits - * a workaround. Give it some time to attempt a gpio based hardware - * reset (atheros reference design workaround) */ -- -- /* TODO: implement the GPIO reset workaround */ -+ gpio_request_one(AR2315_RESET_GPIO, GPIOF_OUT_INIT_LOW, "Reset"); -+ mdelay(100); - - /* Some boards (e.g. Senao EOC-2610) don't implement the reset logic - * workaround. Attempt to jump to the mips reset location - ---- a/drivers/gpio/Kconfig -+++ b/drivers/gpio/Kconfig -@@ -143,6 +143,13 @@ config GPIO_AMDPT - driver for GPIO functionality on Promontory IOHub - Require ACPI ASL code to enumerate as a platform device. - -+config GPIO_AR2315 -+ bool "AR2315 SoC GPIO support" -+ default y if SOC_AR2315 -+ depends on SOC_AR2315 -+ help -+ Say yes here to enable GPIO support for Atheros AR2315+ SoCs. -+ - config GPIO_AR5312 - bool "AR5312 SoC GPIO support" - default y if SOC_AR5312 ---- a/drivers/gpio/Makefile -+++ b/drivers/gpio/Makefile -@@ -32,6 +32,7 @@ obj-$(CONFIG_GPIO_ALTERA) += gpio-alt - obj-$(CONFIG_GPIO_AMD8111) += gpio-amd8111.o - obj-$(CONFIG_GPIO_AMD_FCH) += gpio-amd-fch.o - obj-$(CONFIG_GPIO_AMDPT) += gpio-amdpt.o -+obj-$(CONFIG_GPIO_AR2315) += gpio-ar2315.o - obj-$(CONFIG_GPIO_AR5312) += gpio-ar5312.o - obj-$(CONFIG_GPIO_ARIZONA) += gpio-arizona.o - obj-$(CONFIG_GPIO_ASPEED) += gpio-aspeed.o ---- /dev/null -+++ b/drivers/gpio/gpio-ar2315.c -@@ -0,0 +1,233 @@ -+/* -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file "COPYING" in the main directory of this archive -+ * for more details. -+ * -+ * Copyright (C) 2003 Atheros Communications, Inc., All Rights Reserved. -+ * Copyright (C) 2006 FON Technology, SL. -+ * Copyright (C) 2006 Imre Kaloz -+ * Copyright (C) 2006 Felix Fietkau -+ * Copyright (C) 2012 Alexandros C. Couloumbis -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+ -+#define DRIVER_NAME "ar2315-gpio" -+ -+#define AR2315_GPIO_DI 0x0000 -+#define AR2315_GPIO_DO 0x0008 -+#define AR2315_GPIO_DIR 0x0010 -+#define AR2315_GPIO_INT 0x0018 -+ -+#define AR2315_GPIO_DIR_M(x) (1 << (x)) /* mask for i/o */ -+#define AR2315_GPIO_DIR_O(x) (1 << (x)) /* output */ -+#define AR2315_GPIO_DIR_I(x) (0) /* input */ -+ -+#define AR2315_GPIO_INT_NUM_M 0x3F /* mask for GPIO num */ -+#define AR2315_GPIO_INT_TRIG(x) ((x) << 6) /* interrupt trigger */ -+#define AR2315_GPIO_INT_TRIG_M (0x3 << 6) /* mask for int trig */ -+ -+#define AR2315_GPIO_INT_TRIG_OFF 0 /* Triggerring off */ -+#define AR2315_GPIO_INT_TRIG_LOW 1 /* Low Level Triggered */ -+#define AR2315_GPIO_INT_TRIG_HIGH 2 /* High Level Triggered */ -+#define AR2315_GPIO_INT_TRIG_EDGE 3 /* Edge Triggered */ -+ -+#define AR2315_GPIO_NUM 22 -+ -+static u32 ar2315_gpio_intmask; -+static u32 ar2315_gpio_intval; -+static unsigned ar2315_gpio_irq_base; -+static void __iomem *ar2315_mem; -+ -+static inline u32 ar2315_gpio_reg_read(unsigned reg) -+{ -+ return __raw_readl(ar2315_mem + reg); -+} -+ -+static inline void ar2315_gpio_reg_write(unsigned reg, u32 val) -+{ -+ __raw_writel(val, ar2315_mem + reg); -+} -+ -+static inline void ar2315_gpio_reg_mask(unsigned reg, u32 mask, u32 val) -+{ -+ ar2315_gpio_reg_write(reg, (ar2315_gpio_reg_read(reg) & ~mask) | val); -+} -+ -+static void ar2315_gpio_irq_handler(struct irq_desc *desc) -+{ -+ u32 pend; -+ int bit = -1; -+ -+ /* only do one gpio interrupt at a time */ -+ pend = ar2315_gpio_reg_read(AR2315_GPIO_DI); -+ pend ^= ar2315_gpio_intval; -+ pend &= ar2315_gpio_intmask; -+ -+ if (pend) { -+ bit = fls(pend) - 1; -+ pend &= ~(1 << bit); -+ ar2315_gpio_intval ^= (1 << bit); -+ } -+ -+ /* Enable interrupt with edge detection */ -+ if ((ar2315_gpio_reg_read(AR2315_GPIO_DIR) & AR2315_GPIO_DIR_M(bit)) != -+ AR2315_GPIO_DIR_I(bit)) -+ return; -+ -+ if (bit >= 0) -+ generic_handle_irq(ar2315_gpio_irq_base + bit); -+} -+ -+static void ar2315_gpio_int_setup(unsigned gpio, int trig) -+{ -+ u32 reg = ar2315_gpio_reg_read(AR2315_GPIO_INT); -+ -+ reg &= ~(AR2315_GPIO_INT_NUM_M | AR2315_GPIO_INT_TRIG_M); -+ reg |= gpio | AR2315_GPIO_INT_TRIG(trig); -+ ar2315_gpio_reg_write(AR2315_GPIO_INT, reg); -+} -+ -+static void ar2315_gpio_irq_unmask(struct irq_data *d) -+{ -+ unsigned gpio = d->irq - ar2315_gpio_irq_base; -+ u32 dir = ar2315_gpio_reg_read(AR2315_GPIO_DIR); -+ -+ /* Enable interrupt with edge detection */ -+ if ((dir & AR2315_GPIO_DIR_M(gpio)) != AR2315_GPIO_DIR_I(gpio)) -+ return; -+ -+ ar2315_gpio_intmask |= (1 << gpio); -+ ar2315_gpio_int_setup(gpio, AR2315_GPIO_INT_TRIG_EDGE); -+} -+ -+static void ar2315_gpio_irq_mask(struct irq_data *d) -+{ -+ unsigned gpio = d->irq - ar2315_gpio_irq_base; -+ -+ /* Disable interrupt */ -+ ar2315_gpio_intmask &= ~(1 << gpio); -+ ar2315_gpio_int_setup(gpio, AR2315_GPIO_INT_TRIG_OFF); -+} -+ -+static struct irq_chip ar2315_gpio_irq_chip = { -+ .name = DRIVER_NAME, -+ .irq_unmask = ar2315_gpio_irq_unmask, -+ .irq_mask = ar2315_gpio_irq_mask, -+}; -+ -+static void ar2315_gpio_irq_init(unsigned irq) -+{ -+ unsigned i; -+ -+ ar2315_gpio_intval = ar2315_gpio_reg_read(AR2315_GPIO_DI); -+ for (i = 0; i < AR2315_GPIO_NUM; i++) { -+ unsigned _irq = ar2315_gpio_irq_base + i; -+ -+ irq_set_chip_and_handler(_irq, &ar2315_gpio_irq_chip, -+ handle_level_irq); -+ } -+ irq_set_chained_handler(irq, ar2315_gpio_irq_handler); -+} -+ -+static int ar2315_gpio_get_val(struct gpio_chip *chip, unsigned gpio) -+{ -+ return (ar2315_gpio_reg_read(AR2315_GPIO_DI) >> gpio) & 1; -+} -+ -+static void ar2315_gpio_set_val(struct gpio_chip *chip, unsigned gpio, int val) -+{ -+ u32 reg = ar2315_gpio_reg_read(AR2315_GPIO_DO); -+ -+ reg = val ? reg | (1 << gpio) : reg & ~(1 << gpio); -+ ar2315_gpio_reg_write(AR2315_GPIO_DO, reg); -+} -+ -+static int ar2315_gpio_dir_in(struct gpio_chip *chip, unsigned gpio) -+{ -+ ar2315_gpio_reg_mask(AR2315_GPIO_DIR, 1 << gpio, 0); -+ return 0; -+} -+ -+static int ar2315_gpio_dir_out(struct gpio_chip *chip, unsigned gpio, int val) -+{ -+ ar2315_gpio_reg_mask(AR2315_GPIO_DIR, 0, 1 << gpio); -+ ar2315_gpio_set_val(chip, gpio, val); -+ return 0; -+} -+ -+static int ar2315_gpio_to_irq(struct gpio_chip *chip, unsigned gpio) -+{ -+ return ar2315_gpio_irq_base + gpio; -+} -+ -+static struct gpio_chip ar2315_gpio_chip = { -+ .label = DRIVER_NAME, -+ .direction_input = ar2315_gpio_dir_in, -+ .direction_output = ar2315_gpio_dir_out, -+ .set = ar2315_gpio_set_val, -+ .get = ar2315_gpio_get_val, -+ .to_irq = ar2315_gpio_to_irq, -+ .base = 0, -+ .ngpio = AR2315_GPIO_NUM, -+}; -+ -+static int ar2315_gpio_probe(struct platform_device *pdev) -+{ -+ struct device *dev = &pdev->dev; -+ struct resource *res; -+ unsigned irq; -+ int ret; -+ -+ if (ar2315_mem) -+ return -EBUSY; -+ -+ res = platform_get_resource_byname(pdev, IORESOURCE_IRQ, -+ "ar2315-gpio-irq-base"); -+ if (!res) { -+ dev_err(dev, "not found GPIO IRQ base\n"); -+ return -ENXIO; -+ } -+ ar2315_gpio_irq_base = res->start; -+ -+ res = platform_get_resource_byname(pdev, IORESOURCE_IRQ, DRIVER_NAME); -+ if (!res) { -+ dev_err(dev, "not found IRQ number\n"); -+ return -ENXIO; -+ } -+ irq = res->start; -+ -+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, DRIVER_NAME); -+ ar2315_mem = devm_ioremap_resource(dev, res); -+ if (IS_ERR(ar2315_mem)) -+ return PTR_ERR(ar2315_mem); -+ -+ ar2315_gpio_chip.parent = dev; -+ ret = gpiochip_add(&ar2315_gpio_chip); -+ if (ret) { -+ dev_err(dev, "failed to add gpiochip\n"); -+ return ret; -+ } -+ -+ ar2315_gpio_irq_init(irq); -+ -+ return 0; -+} -+ -+static struct platform_driver ar2315_gpio_driver = { -+ .probe = ar2315_gpio_probe, -+ .driver = { -+ .name = DRIVER_NAME, -+ .owner = THIS_MODULE, -+ } -+}; -+ -+static int __init ar2315_gpio_init(void) -+{ -+ return platform_driver_register(&ar2315_gpio_driver); -+} -+subsys_initcall(ar2315_gpio_init); ---- a/arch/mips/ath25/devices.h -+++ b/arch/mips/ath25/devices.h -@@ -4,6 +4,11 @@ - - #include - -+#define AR231X_GPIO_IRQ_BASE 0x30 -+ -+/* GPIO number for AR2315/16 reset issue workaround */ -+#define AR2315_RESET_GPIO 5 -+ - #define ATH25_REG_MS(_val, _field) (((_val) & _field##_M) >> _field##_S) - - #define ATH25_IRQ_CPU_CLOCK (MIPS_CPU_IRQ_BASE + 7) /* C0_CAUSE: 0x8000 */ ---- a/arch/mips/ath25/ar2315_regs.h -+++ b/arch/mips/ath25/ar2315_regs.h -@@ -315,6 +315,9 @@ - #define AR2315_MEM_CFG_BANKADDR_BITS_M 0x00000018 - #define AR2315_MEM_CFG_BANKADDR_BITS_S 3 - -+/* GPIO MMR base address */ -+#define AR2315_GPIO 0x0088 -+ - /* - * Local Bus Interface Registers - */ diff --git a/target/linux/ath25/patches-5.15/110-ar2313_ethernet.patch b/target/linux/ath25/patches-5.15/110-ar2313_ethernet.patch deleted file mode 100644 index fcb6abff7d7f3c..00000000000000 --- a/target/linux/ath25/patches-5.15/110-ar2313_ethernet.patch +++ /dev/null @@ -1,1733 +0,0 @@ ---- a/drivers/net/ethernet/atheros/Makefile -+++ b/drivers/net/ethernet/atheros/Makefile -@@ -9,3 +9,4 @@ obj-$(CONFIG_ATL2) += atlx/ - obj-$(CONFIG_ATL1E) += atl1e/ - obj-$(CONFIG_ATL1C) += atl1c/ - obj-$(CONFIG_ALX) += alx/ -+obj-$(CONFIG_NET_AR231X) += ar231x/ ---- a/drivers/net/ethernet/atheros/Kconfig -+++ b/drivers/net/ethernet/atheros/Kconfig -@@ -6,7 +6,7 @@ - config NET_VENDOR_ATHEROS - bool "Atheros devices" - default y -- depends on (PCI || ATH79) -+ depends on (PCI || ATH25 || ATH79) - help - If you have a network (Ethernet) card belonging to this class, say Y. - -@@ -88,4 +88,10 @@ config ALX - To compile this driver as a module, choose M here. The module - will be called alx. - -+config NET_AR231X -+ tristate "Atheros AR231X built-in Ethernet support" -+ depends on ATH25 -+ help -+ Support for the AR231x/531x ethernet controller -+ - endif # NET_VENDOR_ATHEROS ---- /dev/null -+++ b/drivers/net/ethernet/atheros/ar231x/Makefile -@@ -0,0 +1 @@ -+obj-$(CONFIG_NET_AR231X) += ar231x.o ---- /dev/null -+++ b/drivers/net/ethernet/atheros/ar231x/ar231x.c -@@ -0,0 +1,1117 @@ -+/* -+ * ar231x.c: Linux driver for the Atheros AR231x Ethernet device. -+ * -+ * Copyright (C) 2004 by Sameer Dekate -+ * Copyright (C) 2006 Imre Kaloz -+ * Copyright (C) 2006-2009 Felix Fietkau -+ * -+ * Thanks to Atheros for providing hardware and documentation -+ * enabling me to write this driver. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * Additional credits: -+ * This code is taken from John Taylor's Sibyte driver and then -+ * modified for the AR2313. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define AR2313_MTU 1692 -+#define AR2313_PRIOS 1 -+#define AR2313_QUEUES (2*AR2313_PRIOS) -+#define AR2313_DESCR_ENTRIES 64 -+ -+#ifndef min -+#define min(a, b) (((a) < (b)) ? (a) : (b)) -+#endif -+ -+#ifndef SMP_CACHE_BYTES -+#define SMP_CACHE_BYTES L1_CACHE_BYTES -+#endif -+ -+#define AR2313_MBOX_SET_BIT 0x8 -+ -+#include "ar231x.h" -+ -+/** -+ * New interrupt handler strategy: -+ * -+ * An old interrupt handler worked using the traditional method of -+ * replacing an skbuff with a new one when a packet arrives. However -+ * the rx rings do not need to contain a static number of buffer -+ * descriptors, thus it makes sense to move the memory allocation out -+ * of the main interrupt handler and do it in a bottom half handler -+ * and only allocate new buffers when the number of buffers in the -+ * ring is below a certain threshold. In order to avoid starving the -+ * NIC under heavy load it is however necessary to force allocation -+ * when hitting a minimum threshold. The strategy for alloction is as -+ * follows: -+ * -+ * RX_LOW_BUF_THRES - allocate buffers in the bottom half -+ * RX_PANIC_LOW_THRES - we are very low on buffers, allocate -+ * the buffers in the interrupt handler -+ * RX_RING_THRES - maximum number of buffers in the rx ring -+ * -+ * One advantagous side effect of this allocation approach is that the -+ * entire rx processing can be done without holding any spin lock -+ * since the rx rings and registers are totally independent of the tx -+ * ring and its registers. This of course includes the kmalloc's of -+ * new skb's. Thus start_xmit can run in parallel with rx processing -+ * and the memory allocation on SMP systems. -+ * -+ * Note that running the skb reallocation in a bottom half opens up -+ * another can of races which needs to be handled properly. In -+ * particular it can happen that the interrupt handler tries to run -+ * the reallocation while the bottom half is either running on another -+ * CPU or was interrupted on the same CPU. To get around this the -+ * driver uses bitops to prevent the reallocation routines from being -+ * reentered. -+ * -+ * TX handling can also be done without holding any spin lock, wheee -+ * this is fun! since tx_csm is only written to by the interrupt -+ * handler. -+ */ -+ -+/** -+ * Threshold values for RX buffer allocation - the low water marks for -+ * when to start refilling the rings are set to 75% of the ring -+ * sizes. It seems to make sense to refill the rings entirely from the -+ * intrrupt handler once it gets below the panic threshold, that way -+ * we don't risk that the refilling is moved to another CPU when the -+ * one running the interrupt handler just got the slab code hot in its -+ * cache. -+ */ -+#define RX_RING_SIZE AR2313_DESCR_ENTRIES -+#define RX_PANIC_THRES (RX_RING_SIZE/4) -+#define RX_LOW_THRES ((3*RX_RING_SIZE)/4) -+#define CRC_LEN 4 -+#define RX_OFFSET 2 -+ -+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) -+#define VLAN_HDR 4 -+#else -+#define VLAN_HDR 0 -+#endif -+ -+#define AR2313_BUFSIZE (AR2313_MTU + VLAN_HDR + ETH_HLEN + CRC_LEN + \ -+ RX_OFFSET) -+ -+#ifdef MODULE -+MODULE_LICENSE("GPL"); -+MODULE_AUTHOR("Sameer Dekate , Imre Kaloz , Felix Fietkau "); -+MODULE_DESCRIPTION("AR231x Ethernet driver"); -+#endif -+ -+/* prototypes */ -+static void ar231x_halt(struct net_device *dev); -+static void rx_tasklet_func(unsigned long data); -+static void rx_tasklet_cleanup(struct net_device *dev); -+static void ar231x_multicast_list(struct net_device *dev); -+static void ar231x_tx_timeout(struct net_device *dev, unsigned int txqueue); -+ -+static int ar231x_mdiobus_read(struct mii_bus *bus, int phy_addr, int regnum); -+static int ar231x_mdiobus_write(struct mii_bus *bus, int phy_addr, int regnum, -+ u16 value); -+static int ar231x_mdiobus_reset(struct mii_bus *bus); -+static int ar231x_mdiobus_probe(struct net_device *dev); -+static void ar231x_adjust_link(struct net_device *dev); -+ -+#ifndef ERR -+#define ERR(fmt, args...) printk("%s: " fmt, __func__, ##args) -+#endif -+ -+#ifdef CONFIG_NET_POLL_CONTROLLER -+static void -+ar231x_netpoll(struct net_device *dev) -+{ -+ unsigned long flags; -+ -+ local_irq_save(flags); -+ ar231x_interrupt(dev->irq, dev); -+ local_irq_restore(flags); -+} -+#endif -+ -+static const struct net_device_ops ar231x_ops = { -+ .ndo_open = ar231x_open, -+ .ndo_stop = ar231x_close, -+ .ndo_start_xmit = ar231x_start_xmit, -+ .ndo_set_rx_mode = ar231x_multicast_list, -+ .ndo_do_ioctl = ar231x_ioctl, -+ .ndo_validate_addr = eth_validate_addr, -+ .ndo_set_mac_address = eth_mac_addr, -+ .ndo_tx_timeout = ar231x_tx_timeout, -+#ifdef CONFIG_NET_POLL_CONTROLLER -+ .ndo_poll_controller = ar231x_netpoll, -+#endif -+}; -+ -+static int ar231x_probe(struct platform_device *pdev) -+{ -+ struct net_device *dev; -+ struct ar231x_private *sp; -+ struct resource *res; -+ unsigned long ar_eth_base; -+ char buf[64]; -+ -+ dev = alloc_etherdev(sizeof(struct ar231x_private)); -+ -+ if (dev == NULL) { -+ printk(KERN_ERR -+ "ar231x: Unable to allocate net_device structure!\n"); -+ return -ENOMEM; -+ } -+ -+ platform_set_drvdata(pdev, dev); -+ -+ SET_NETDEV_DEV(dev, &pdev->dev); -+ -+ sp = netdev_priv(dev); -+ sp->dev = dev; -+ sp->pdev = pdev; -+ sp->cfg = pdev->dev.platform_data; -+ -+ sprintf(buf, "eth%d_membase", pdev->id); -+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, buf); -+ if (!res) -+ return -ENODEV; -+ -+ sp->link = 0; -+ ar_eth_base = res->start; -+ -+ sprintf(buf, "eth%d_irq", pdev->id); -+ dev->irq = platform_get_irq_byname(pdev, buf); -+ -+ spin_lock_init(&sp->lock); -+ -+ dev->features |= NETIF_F_HIGHDMA; -+ dev->netdev_ops = &ar231x_ops; -+ -+ tasklet_init(&sp->rx_tasklet, rx_tasklet_func, (unsigned long)dev); -+ tasklet_disable(&sp->rx_tasklet); -+ -+ sp->eth_regs = ioremap(ar_eth_base, sizeof(*sp->eth_regs)); -+ if (!sp->eth_regs) { -+ printk("Can't remap eth registers\n"); -+ return -ENXIO; -+ } -+ -+ /** -+ * When there's only one MAC, PHY regs are typically on ENET0, -+ * even though the MAC might be on ENET1. -+ * So remap PHY regs separately. -+ */ -+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "eth0_mii"); -+ if (!res) { -+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, -+ "eth1_mii"); -+ if (!res) -+ return -ENODEV; -+ } -+ sp->phy_regs = ioremap(res->start, resource_size(res)); -+ if (!sp->phy_regs) { -+ printk("Can't remap phy registers\n"); -+ return -ENXIO; -+ } -+ -+ sp->dma_regs = ioremap(ar_eth_base + 0x1000, -+ sizeof(*sp->dma_regs)); -+ if (!sp->dma_regs) { -+ printk("Can't remap DMA registers\n"); -+ return -ENXIO; -+ } -+ dev->base_addr = ar_eth_base + 0x1000; -+ -+ strncpy(sp->name, "Atheros AR231x", sizeof(sp->name) - 1); -+ sp->name[sizeof(sp->name) - 1] = '\0'; -+ memcpy(dev->dev_addr, sp->cfg->macaddr, 6); -+ -+ if (ar231x_init(dev)) { -+ /* ar231x_init() calls ar231x_init_cleanup() on error */ -+ kfree(dev); -+ return -ENODEV; -+ } -+ -+ if (register_netdev(dev)) { -+ printk("%s: register_netdev failed\n", __func__); -+ return -1; -+ } -+ -+ printk("%s: %s: %pM, irq %d\n", dev->name, sp->name, dev->dev_addr, -+ dev->irq); -+ -+ sp->mii_bus = mdiobus_alloc(); -+ if (sp->mii_bus == NULL) -+ return -1; -+ -+ sp->mii_bus->priv = dev; -+ sp->mii_bus->read = ar231x_mdiobus_read; -+ sp->mii_bus->write = ar231x_mdiobus_write; -+ sp->mii_bus->reset = ar231x_mdiobus_reset; -+ sp->mii_bus->name = "ar231x_eth_mii"; -+ snprintf(sp->mii_bus->id, MII_BUS_ID_SIZE, "%d", pdev->id); -+ -+ mdiobus_register(sp->mii_bus); -+ -+ if (ar231x_mdiobus_probe(dev) != 0) { -+ printk(KERN_ERR "%s: mdiobus_probe failed\n", dev->name); -+ rx_tasklet_cleanup(dev); -+ ar231x_init_cleanup(dev); -+ unregister_netdev(dev); -+ kfree(dev); -+ return -ENODEV; -+ } -+ -+ return 0; -+} -+ -+static void ar231x_multicast_list(struct net_device *dev) -+{ -+ struct ar231x_private *sp = netdev_priv(dev); -+ unsigned int filter; -+ -+ filter = sp->eth_regs->mac_control; -+ -+ if (dev->flags & IFF_PROMISC) -+ filter |= MAC_CONTROL_PR; -+ else -+ filter &= ~MAC_CONTROL_PR; -+ if ((dev->flags & IFF_ALLMULTI) || (netdev_mc_count(dev) > 0)) -+ filter |= MAC_CONTROL_PM; -+ else -+ filter &= ~MAC_CONTROL_PM; -+ -+ sp->eth_regs->mac_control = filter; -+} -+ -+static void rx_tasklet_cleanup(struct net_device *dev) -+{ -+ struct ar231x_private *sp = netdev_priv(dev); -+ -+ /** -+ * Tasklet may be scheduled. Need to get it removed from the list -+ * since we're about to free the struct. -+ */ -+ -+ sp->unloading = 1; -+ tasklet_enable(&sp->rx_tasklet); -+ tasklet_kill(&sp->rx_tasklet); -+} -+ -+static int ar231x_remove(struct platform_device *pdev) -+{ -+ struct net_device *dev = platform_get_drvdata(pdev); -+ struct ar231x_private *sp = netdev_priv(dev); -+ -+ rx_tasklet_cleanup(dev); -+ ar231x_init_cleanup(dev); -+ unregister_netdev(dev); -+ mdiobus_unregister(sp->mii_bus); -+ mdiobus_free(sp->mii_bus); -+ kfree(dev); -+ return 0; -+} -+ -+/** -+ * Restart the AR2313 ethernet controller. -+ */ -+static int ar231x_restart(struct net_device *dev) -+{ -+ /* disable interrupts */ -+ disable_irq(dev->irq); -+ -+ /* stop mac */ -+ ar231x_halt(dev); -+ -+ /* initialize */ -+ ar231x_init(dev); -+ -+ /* enable interrupts */ -+ enable_irq(dev->irq); -+ -+ return 0; -+} -+ -+static struct platform_driver ar231x_driver = { -+ .driver.name = "ar231x-eth", -+ .probe = ar231x_probe, -+ .remove = ar231x_remove, -+}; -+ -+module_platform_driver(ar231x_driver); -+ -+static void ar231x_free_descriptors(struct net_device *dev) -+{ -+ struct ar231x_private *sp = netdev_priv(dev); -+ -+ if (sp->rx_ring != NULL) { -+ kfree((void *)KSEG0ADDR(sp->rx_ring)); -+ sp->rx_ring = NULL; -+ sp->tx_ring = NULL; -+ } -+} -+ -+static int ar231x_allocate_descriptors(struct net_device *dev) -+{ -+ struct ar231x_private *sp = netdev_priv(dev); -+ int size; -+ int j; -+ ar231x_descr_t *space; -+ -+ if (sp->rx_ring != NULL) { -+ printk("%s: already done.\n", __func__); -+ return 0; -+ } -+ -+ size = sizeof(ar231x_descr_t) * (AR2313_DESCR_ENTRIES * AR2313_QUEUES); -+ space = kmalloc(size, GFP_KERNEL); -+ if (space == NULL) -+ return 1; -+ -+ /* invalidate caches */ -+ dma_cache_inv((unsigned int)space, size); -+ -+ /* now convert pointer to KSEG1 */ -+ space = (ar231x_descr_t *)KSEG1ADDR(space); -+ -+ memset((void *)space, 0, size); -+ -+ sp->rx_ring = space; -+ space += AR2313_DESCR_ENTRIES; -+ -+ sp->tx_ring = space; -+ space += AR2313_DESCR_ENTRIES; -+ -+ /* Initialize the transmit Descriptors */ -+ for (j = 0; j < AR2313_DESCR_ENTRIES; j++) { -+ ar231x_descr_t *td = &sp->tx_ring[j]; -+ -+ td->status = 0; -+ td->devcs = DMA_TX1_CHAINED; -+ td->addr = 0; -+ td->descr = virt_to_phys(&sp->tx_ring[DSC_NEXT(j)]); -+ } -+ -+ return 0; -+} -+ -+/** -+ * Generic cleanup handling data allocated during init. Used when the -+ * module is unloaded or if an error occurs during initialization -+ */ -+static void ar231x_init_cleanup(struct net_device *dev) -+{ -+ struct ar231x_private *sp = netdev_priv(dev); -+ struct sk_buff *skb; -+ int j; -+ -+ ar231x_free_descriptors(dev); -+ -+ if (sp->eth_regs) -+ iounmap((void *)sp->eth_regs); -+ if (sp->dma_regs) -+ iounmap((void *)sp->dma_regs); -+ if (sp->phy_regs) -+ iounmap((void *)sp->phy_regs); -+ -+ if (sp->rx_skb) { -+ for (j = 0; j < AR2313_DESCR_ENTRIES; j++) { -+ skb = sp->rx_skb[j]; -+ if (skb) { -+ sp->rx_skb[j] = NULL; -+ dev_kfree_skb(skb); -+ } -+ } -+ kfree(sp->rx_skb); -+ sp->rx_skb = NULL; -+ } -+ -+ if (sp->tx_skb) { -+ for (j = 0; j < AR2313_DESCR_ENTRIES; j++) { -+ skb = sp->tx_skb[j]; -+ if (skb) { -+ sp->tx_skb[j] = NULL; -+ dev_kfree_skb(skb); -+ } -+ } -+ kfree(sp->tx_skb); -+ sp->tx_skb = NULL; -+ } -+} -+ -+static int ar231x_reset_reg(struct net_device *dev) -+{ -+ struct ar231x_private *sp = netdev_priv(dev); -+ unsigned int ethsal, ethsah; -+ unsigned int flags; -+ -+ sp->cfg->reset_set(sp->cfg->reset_mac); -+ mdelay(10); -+ sp->cfg->reset_clear(sp->cfg->reset_mac); -+ mdelay(10); -+ sp->cfg->reset_set(sp->cfg->reset_phy); -+ mdelay(10); -+ sp->cfg->reset_clear(sp->cfg->reset_phy); -+ mdelay(10); -+ -+ sp->dma_regs->bus_mode = (DMA_BUS_MODE_SWR); -+ mdelay(10); -+ sp->dma_regs->bus_mode = -+ ((32 << DMA_BUS_MODE_PBL_SHIFT) | DMA_BUS_MODE_BLE); -+ -+ /* enable interrupts */ -+ sp->dma_regs->intr_ena = DMA_STATUS_AIS | DMA_STATUS_NIS | -+ DMA_STATUS_RI | DMA_STATUS_TI | -+ DMA_STATUS_FBE; -+ sp->dma_regs->xmt_base = virt_to_phys(sp->tx_ring); -+ sp->dma_regs->rcv_base = virt_to_phys(sp->rx_ring); -+ sp->dma_regs->control = -+ (DMA_CONTROL_SR | DMA_CONTROL_ST | DMA_CONTROL_SF); -+ -+ sp->eth_regs->flow_control = (FLOW_CONTROL_FCE); -+ sp->eth_regs->vlan_tag = (0x8100); -+ -+ /* Enable Ethernet Interface */ -+ flags = (MAC_CONTROL_TE | /* transmit enable */ -+ MAC_CONTROL_PM | /* pass mcast */ -+ MAC_CONTROL_F | /* full duplex */ -+ MAC_CONTROL_HBD); /* heart beat disabled */ -+ -+ if (dev->flags & IFF_PROMISC) { /* set promiscuous mode */ -+ flags |= MAC_CONTROL_PR; -+ } -+ sp->eth_regs->mac_control = flags; -+ -+ /* Set all Ethernet station address registers to their initial values */ -+ ethsah = (((u_int) (dev->dev_addr[5]) << 8) & (u_int) 0x0000FF00) | -+ (((u_int) (dev->dev_addr[4]) << 0) & (u_int) 0x000000FF); -+ -+ ethsal = (((u_int) (dev->dev_addr[3]) << 24) & (u_int) 0xFF000000) | -+ (((u_int) (dev->dev_addr[2]) << 16) & (u_int) 0x00FF0000) | -+ (((u_int) (dev->dev_addr[1]) << 8) & (u_int) 0x0000FF00) | -+ (((u_int) (dev->dev_addr[0]) << 0) & (u_int) 0x000000FF); -+ -+ sp->eth_regs->mac_addr[0] = ethsah; -+ sp->eth_regs->mac_addr[1] = ethsal; -+ -+ mdelay(10); -+ -+ return 0; -+} -+ -+static int ar231x_init(struct net_device *dev) -+{ -+ struct ar231x_private *sp = netdev_priv(dev); -+ int ecode = 0; -+ -+ /* Allocate descriptors */ -+ if (ar231x_allocate_descriptors(dev)) { -+ printk("%s: %s: ar231x_allocate_descriptors failed\n", -+ dev->name, __func__); -+ ecode = -EAGAIN; -+ goto init_error; -+ } -+ -+ /* Get the memory for the skb rings */ -+ if (sp->rx_skb == NULL) { -+ sp->rx_skb = -+ kmalloc(sizeof(struct sk_buff *) * AR2313_DESCR_ENTRIES, -+ GFP_KERNEL); -+ if (!(sp->rx_skb)) { -+ printk("%s: %s: rx_skb kmalloc failed\n", -+ dev->name, __func__); -+ ecode = -EAGAIN; -+ goto init_error; -+ } -+ } -+ memset(sp->rx_skb, 0, sizeof(struct sk_buff *) * AR2313_DESCR_ENTRIES); -+ -+ if (sp->tx_skb == NULL) { -+ sp->tx_skb = -+ kmalloc(sizeof(struct sk_buff *) * AR2313_DESCR_ENTRIES, -+ GFP_KERNEL); -+ if (!(sp->tx_skb)) { -+ printk("%s: %s: tx_skb kmalloc failed\n", -+ dev->name, __func__); -+ ecode = -EAGAIN; -+ goto init_error; -+ } -+ } -+ memset(sp->tx_skb, 0, sizeof(struct sk_buff *) * AR2313_DESCR_ENTRIES); -+ -+ /** -+ * Set tx_csm before we start receiving interrupts, otherwise -+ * the interrupt handler might think it is supposed to process -+ * tx ints before we are up and running, which may cause a null -+ * pointer access in the int handler. -+ */ -+ sp->rx_skbprd = 0; -+ sp->cur_rx = 0; -+ sp->tx_prd = 0; -+ sp->tx_csm = 0; -+ -+ /* Zero the stats before starting the interface */ -+ memset(&dev->stats, 0, sizeof(dev->stats)); -+ -+ /** -+ * We load the ring here as there seem to be no way to tell the -+ * firmware to wipe the ring without re-initializing it. -+ */ -+ ar231x_load_rx_ring(dev, RX_RING_SIZE); -+ -+ /* Init hardware */ -+ ar231x_reset_reg(dev); -+ -+ /* Get the IRQ */ -+ ecode = request_irq(dev->irq, &ar231x_interrupt, 0, -+ dev->name, dev); -+ if (ecode) { -+ printk(KERN_WARNING "%s: %s: Requested IRQ %d is busy\n", -+ dev->name, __func__, dev->irq); -+ goto init_error; -+ } -+ -+ tasklet_enable(&sp->rx_tasklet); -+ -+ return 0; -+ -+init_error: -+ ar231x_init_cleanup(dev); -+ return ecode; -+} -+ -+/** -+ * Load the rx ring. -+ * -+ * Loading rings is safe without holding the spin lock since this is -+ * done only before the device is enabled, thus no interrupts are -+ * generated and by the interrupt handler/tasklet handler. -+ */ -+static void ar231x_load_rx_ring(struct net_device *dev, int nr_bufs) -+{ -+ struct ar231x_private *sp = netdev_priv(dev); -+ short i, idx; -+ -+ idx = sp->rx_skbprd; -+ -+ for (i = 0; i < nr_bufs; i++) { -+ struct sk_buff *skb; -+ ar231x_descr_t *rd; -+ -+ if (sp->rx_skb[idx]) -+ break; -+ -+ skb = netdev_alloc_skb_ip_align(dev, AR2313_BUFSIZE); -+ if (!skb) { -+ printk("\n\n\n\n %s: No memory in system\n\n\n\n", -+ __func__); -+ break; -+ } -+ -+ /* Make sure IP header starts on a fresh cache line */ -+ skb->dev = dev; -+ sp->rx_skb[idx] = skb; -+ -+ rd = (ar231x_descr_t *)&sp->rx_ring[idx]; -+ -+ /* initialize dma descriptor */ -+ rd->devcs = ((AR2313_BUFSIZE << DMA_RX1_BSIZE_SHIFT) | -+ DMA_RX1_CHAINED); -+ rd->addr = virt_to_phys(skb->data); -+ rd->descr = virt_to_phys(&sp->rx_ring[DSC_NEXT(idx)]); -+ rd->status = DMA_RX_OWN; -+ -+ idx = DSC_NEXT(idx); -+ } -+ -+ if (i) -+ sp->rx_skbprd = idx; -+} -+ -+#define AR2313_MAX_PKTS_PER_CALL 64 -+ -+static int ar231x_rx_int(struct net_device *dev) -+{ -+ struct ar231x_private *sp = netdev_priv(dev); -+ struct sk_buff *skb, *skb_new; -+ ar231x_descr_t *rxdesc; -+ unsigned int status; -+ u32 idx; -+ int pkts = 0; -+ int rval; -+ -+ idx = sp->cur_rx; -+ -+ /* process at most the entire ring and then wait for another int */ -+ while (1) { -+ rxdesc = &sp->rx_ring[idx]; -+ status = rxdesc->status; -+ -+ if (status & DMA_RX_OWN) { -+ /* SiByte owns descriptor or descr not yet filled in */ -+ rval = 0; -+ break; -+ } -+ -+ if (++pkts > AR2313_MAX_PKTS_PER_CALL) { -+ rval = 1; -+ break; -+ } -+ -+ if ((status & DMA_RX_ERROR) && !(status & DMA_RX_LONG)) { -+ dev->stats.rx_errors++; -+ dev->stats.rx_dropped++; -+ -+ /* add statistics counters */ -+ if (status & DMA_RX_ERR_CRC) -+ dev->stats.rx_crc_errors++; -+ if (status & DMA_RX_ERR_COL) -+ dev->stats.rx_over_errors++; -+ if (status & DMA_RX_ERR_LENGTH) -+ dev->stats.rx_length_errors++; -+ if (status & DMA_RX_ERR_RUNT) -+ dev->stats.rx_over_errors++; -+ if (status & DMA_RX_ERR_DESC) -+ dev->stats.rx_over_errors++; -+ -+ } else { -+ /* alloc new buffer. */ -+ skb_new = netdev_alloc_skb_ip_align(dev, -+ AR2313_BUFSIZE); -+ if (skb_new != NULL) { -+ skb = sp->rx_skb[idx]; -+ /* set skb */ -+ skb_put(skb, ((status >> DMA_RX_LEN_SHIFT) & -+ 0x3fff) - CRC_LEN); -+ -+ dev->stats.rx_bytes += skb->len; -+ skb->protocol = eth_type_trans(skb, dev); -+ /* pass the packet to upper layers */ -+ netif_rx(skb); -+ -+ skb_new->dev = dev; -+ /* reset descriptor's curr_addr */ -+ rxdesc->addr = virt_to_phys(skb_new->data); -+ -+ dev->stats.rx_packets++; -+ sp->rx_skb[idx] = skb_new; -+ } else { -+ dev->stats.rx_dropped++; -+ } -+ } -+ -+ rxdesc->devcs = ((AR2313_BUFSIZE << DMA_RX1_BSIZE_SHIFT) | -+ DMA_RX1_CHAINED); -+ rxdesc->status = DMA_RX_OWN; -+ -+ idx = DSC_NEXT(idx); -+ } -+ -+ sp->cur_rx = idx; -+ -+ return rval; -+} -+ -+static void ar231x_tx_int(struct net_device *dev) -+{ -+ struct ar231x_private *sp = netdev_priv(dev); -+ u32 idx; -+ struct sk_buff *skb; -+ ar231x_descr_t *txdesc; -+ unsigned int status = 0; -+ -+ idx = sp->tx_csm; -+ -+ while (idx != sp->tx_prd) { -+ txdesc = &sp->tx_ring[idx]; -+ status = txdesc->status; -+ -+ if (status & DMA_TX_OWN) { -+ /* ar231x dma still owns descr */ -+ break; -+ } -+ /* done with this descriptor */ -+ dma_unmap_single(&sp->pdev->dev, txdesc->addr, -+ txdesc->devcs & DMA_TX1_BSIZE_MASK, -+ DMA_TO_DEVICE); -+ txdesc->status = 0; -+ -+ if (status & DMA_TX_ERROR) { -+ dev->stats.tx_errors++; -+ dev->stats.tx_dropped++; -+ if (status & DMA_TX_ERR_UNDER) -+ dev->stats.tx_fifo_errors++; -+ if (status & DMA_TX_ERR_HB) -+ dev->stats.tx_heartbeat_errors++; -+ if (status & (DMA_TX_ERR_LOSS | DMA_TX_ERR_LINK)) -+ dev->stats.tx_carrier_errors++; -+ if (status & (DMA_TX_ERR_LATE | DMA_TX_ERR_COL | -+ DMA_TX_ERR_JABBER | DMA_TX_ERR_DEFER)) -+ dev->stats.tx_aborted_errors++; -+ } else { -+ /* transmit OK */ -+ dev->stats.tx_packets++; -+ } -+ -+ skb = sp->tx_skb[idx]; -+ sp->tx_skb[idx] = NULL; -+ idx = DSC_NEXT(idx); -+ dev->stats.tx_bytes += skb->len; -+ dev_kfree_skb_irq(skb); -+ } -+ -+ sp->tx_csm = idx; -+} -+ -+static void rx_tasklet_func(unsigned long data) -+{ -+ struct net_device *dev = (struct net_device *)data; -+ struct ar231x_private *sp = netdev_priv(dev); -+ -+ if (sp->unloading) -+ return; -+ -+ if (ar231x_rx_int(dev)) { -+ tasklet_hi_schedule(&sp->rx_tasklet); -+ } else { -+ unsigned long flags; -+ -+ spin_lock_irqsave(&sp->lock, flags); -+ sp->dma_regs->intr_ena |= DMA_STATUS_RI; -+ spin_unlock_irqrestore(&sp->lock, flags); -+ } -+} -+ -+static void rx_schedule(struct net_device *dev) -+{ -+ struct ar231x_private *sp = netdev_priv(dev); -+ -+ sp->dma_regs->intr_ena &= ~DMA_STATUS_RI; -+ -+ tasklet_hi_schedule(&sp->rx_tasklet); -+} -+ -+static irqreturn_t ar231x_interrupt(int irq, void *dev_id) -+{ -+ struct net_device *dev = (struct net_device *)dev_id; -+ struct ar231x_private *sp = netdev_priv(dev); -+ unsigned int status, enabled; -+ -+ /* clear interrupt */ -+ /* Don't clear RI bit if currently disabled */ -+ status = sp->dma_regs->status; -+ enabled = sp->dma_regs->intr_ena; -+ sp->dma_regs->status = status & enabled; -+ -+ if (status & DMA_STATUS_NIS) { -+ /* normal status */ -+ /** -+ * Don't schedule rx processing if interrupt -+ * is already disabled. -+ */ -+ if (status & enabled & DMA_STATUS_RI) { -+ /* receive interrupt */ -+ rx_schedule(dev); -+ } -+ if (status & DMA_STATUS_TI) { -+ /* transmit interrupt */ -+ ar231x_tx_int(dev); -+ } -+ } -+ -+ /* abnormal status */ -+ if (status & (DMA_STATUS_FBE | DMA_STATUS_TPS)) -+ ar231x_restart(dev); -+ -+ return IRQ_HANDLED; -+} -+ -+static int ar231x_open(struct net_device *dev) -+{ -+ struct ar231x_private *sp = netdev_priv(dev); -+ unsigned int ethsal, ethsah; -+ -+ /* reset the hardware, in case the MAC address changed */ -+ ethsah = (((u_int) (dev->dev_addr[5]) << 8) & (u_int) 0x0000FF00) | -+ (((u_int) (dev->dev_addr[4]) << 0) & (u_int) 0x000000FF); -+ -+ ethsal = (((u_int) (dev->dev_addr[3]) << 24) & (u_int) 0xFF000000) | -+ (((u_int) (dev->dev_addr[2]) << 16) & (u_int) 0x00FF0000) | -+ (((u_int) (dev->dev_addr[1]) << 8) & (u_int) 0x0000FF00) | -+ (((u_int) (dev->dev_addr[0]) << 0) & (u_int) 0x000000FF); -+ -+ sp->eth_regs->mac_addr[0] = ethsah; -+ sp->eth_regs->mac_addr[1] = ethsal; -+ -+ mdelay(10); -+ -+ dev->mtu = 1500; -+ netif_start_queue(dev); -+ -+ sp->eth_regs->mac_control |= MAC_CONTROL_RE; -+ -+ phy_start(sp->phy_dev); -+ -+ return 0; -+} -+ -+static void ar231x_tx_timeout(struct net_device *dev, unsigned int txqueue) -+{ -+ struct ar231x_private *sp = netdev_priv(dev); -+ unsigned long flags; -+ -+ spin_lock_irqsave(&sp->lock, flags); -+ ar231x_restart(dev); -+ spin_unlock_irqrestore(&sp->lock, flags); -+} -+ -+static void ar231x_halt(struct net_device *dev) -+{ -+ struct ar231x_private *sp = netdev_priv(dev); -+ int j; -+ -+ tasklet_disable(&sp->rx_tasklet); -+ -+ /* kill the MAC */ -+ sp->eth_regs->mac_control &= ~(MAC_CONTROL_RE | /* disable Receives */ -+ MAC_CONTROL_TE); /* disable Transmits */ -+ /* stop dma */ -+ sp->dma_regs->control = 0; -+ sp->dma_regs->bus_mode = DMA_BUS_MODE_SWR; -+ -+ /* place phy and MAC in reset */ -+ sp->cfg->reset_set(sp->cfg->reset_mac); -+ sp->cfg->reset_set(sp->cfg->reset_phy); -+ -+ /* free buffers on tx ring */ -+ for (j = 0; j < AR2313_DESCR_ENTRIES; j++) { -+ struct sk_buff *skb; -+ ar231x_descr_t *txdesc; -+ -+ txdesc = &sp->tx_ring[j]; -+ txdesc->descr = 0; -+ -+ skb = sp->tx_skb[j]; -+ if (skb) { -+ dev_kfree_skb(skb); -+ sp->tx_skb[j] = NULL; -+ } -+ } -+} -+ -+/** -+ * close should do nothing. Here's why. It's called when -+ * 'ifconfig bond0 down' is run. If it calls free_irq then -+ * the irq is gone forever ! When bond0 is made 'up' again, -+ * the ar231x_open () does not call request_irq (). Worse, -+ * the call to ar231x_halt() generates a WDOG reset due to -+ * the write to reset register and the box reboots. -+ * Commenting this out is good since it allows the -+ * system to resume when bond0 is made up again. -+ */ -+static int ar231x_close(struct net_device *dev) -+{ -+ struct ar231x_private *sp = netdev_priv(dev); -+#if 0 -+ /* Disable interrupts */ -+ disable_irq(dev->irq); -+ -+ /** -+ * Without (or before) releasing irq and stopping hardware, this -+ * is an absolute non-sense, by the way. It will be reset instantly -+ * by the first irq. -+ */ -+ netif_stop_queue(dev); -+ -+ /* stop the MAC and DMA engines */ -+ ar231x_halt(dev); -+ -+ /* release the interrupt */ -+ free_irq(dev->irq, dev); -+ -+#endif -+ -+ phy_stop(sp->phy_dev); -+ -+ return 0; -+} -+ -+static int ar231x_start_xmit(struct sk_buff *skb, struct net_device *dev) -+{ -+ struct ar231x_private *sp = netdev_priv(dev); -+ ar231x_descr_t *td; -+ u32 idx; -+ -+ idx = sp->tx_prd; -+ td = &sp->tx_ring[idx]; -+ -+ if (td->status & DMA_TX_OWN) { -+ /* free skbuf and lie to the caller that we sent it out */ -+ dev->stats.tx_dropped++; -+ dev_kfree_skb(skb); -+ -+ /* restart transmitter in case locked */ -+ sp->dma_regs->xmt_poll = 0; -+ return 0; -+ } -+ -+ /* Setup the transmit descriptor. */ -+ td->devcs = ((skb->len << DMA_TX1_BSIZE_SHIFT) | -+ (DMA_TX1_LS | DMA_TX1_IC | DMA_TX1_CHAINED)); -+ td->addr = dma_map_single(&sp->pdev->dev, skb->data, skb->len, DMA_TO_DEVICE); -+ td->status = DMA_TX_OWN; -+ -+ /* kick transmitter last */ -+ sp->dma_regs->xmt_poll = 0; -+ -+ sp->tx_skb[idx] = skb; -+ idx = DSC_NEXT(idx); -+ sp->tx_prd = idx; -+ -+ return 0; -+} -+ -+static int ar231x_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) -+{ -+ struct ar231x_private *sp = netdev_priv(dev); -+ -+ switch (cmd) { -+ case SIOCGMIIPHY: -+ case SIOCGMIIREG: -+ case SIOCSMIIREG: -+ return phy_mii_ioctl(sp->phy_dev, ifr, cmd); -+ -+ default: -+ break; -+ } -+ -+ return -EOPNOTSUPP; -+} -+ -+static void ar231x_adjust_link(struct net_device *dev) -+{ -+ struct ar231x_private *sp = netdev_priv(dev); -+ struct phy_device *phydev = sp->phy_dev; -+ u32 mc; -+ -+ if (!phydev->link) { -+ if (sp->link) { -+ pr_info("%s: link down\n", dev->name); -+ sp->link = 0; -+ } -+ return; -+ } -+ sp->link = 1; -+ -+ pr_info("%s: link up (%uMbps/%s duplex)\n", dev->name, -+ phydev->speed, phydev->duplex ? "full" : "half"); -+ -+ mc = sp->eth_regs->mac_control; -+ if (phydev->duplex) -+ mc = (mc | MAC_CONTROL_F) & ~MAC_CONTROL_DRO; -+ else -+ mc = (mc | MAC_CONTROL_DRO) & ~MAC_CONTROL_F; -+ sp->eth_regs->mac_control = mc; -+ sp->duplex = phydev->duplex; -+} -+ -+#define MII_ADDR(phy, reg) \ -+ ((reg << MII_ADDR_REG_SHIFT) | (phy << MII_ADDR_PHY_SHIFT)) -+ -+static int -+ar231x_mdiobus_read(struct mii_bus *bus, int phy_addr, int regnum) -+{ -+ struct net_device *const dev = bus->priv; -+ struct ar231x_private *sp = netdev_priv(dev); -+ volatile MII *ethernet = sp->phy_regs; -+ -+ ethernet->mii_addr = MII_ADDR(phy_addr, regnum); -+ while (ethernet->mii_addr & MII_ADDR_BUSY) -+ ; -+ return ethernet->mii_data >> MII_DATA_SHIFT; -+} -+ -+static int -+ar231x_mdiobus_write(struct mii_bus *bus, int phy_addr, int regnum, u16 value) -+{ -+ struct net_device *const dev = bus->priv; -+ struct ar231x_private *sp = netdev_priv(dev); -+ volatile MII *ethernet = sp->phy_regs; -+ -+ while (ethernet->mii_addr & MII_ADDR_BUSY) -+ ; -+ ethernet->mii_data = value << MII_DATA_SHIFT; -+ ethernet->mii_addr = MII_ADDR(phy_addr, regnum) | MII_ADDR_WRITE; -+ -+ return 0; -+} -+ -+static int ar231x_mdiobus_reset(struct mii_bus *bus) -+{ -+ struct net_device *const dev = bus->priv; -+ -+ ar231x_reset_reg(dev); -+ -+ return 0; -+} -+ -+static int ar231x_mdiobus_probe(struct net_device *dev) -+{ -+ __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, }; -+ struct ar231x_private *const sp = netdev_priv(dev); -+ struct phy_device *phydev = NULL; -+ -+ /* find the first (lowest address) PHY on the current MAC's MII bus */ -+ phydev = phy_find_first(sp->mii_bus); -+ if (!phydev) { -+ printk(KERN_ERR "ar231x: %s: no PHY found\n", dev->name); -+ return -1; -+ } -+ -+ /* now we are supposed to have a proper phydev, to attach to... */ -+ BUG_ON(phydev->attached_dev); -+ -+ phydev = phy_connect(dev, phydev_name(phydev), &ar231x_adjust_link, -+ PHY_INTERFACE_MODE_MII); -+ if (IS_ERR(phydev)) { -+ printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name); -+ return PTR_ERR(phydev); -+ } -+ -+ /* mask with MAC supported features */ -+ linkmode_set_bit_array(phy_10_100_features_array, -+ ARRAY_SIZE(phy_10_100_features_array), -+ mask); -+ linkmode_set_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, mask); -+ linkmode_set_bit(ETHTOOL_LINK_MODE_MII_BIT, mask); -+ linkmode_set_bit(ETHTOOL_LINK_MODE_TP_BIT, mask); -+ -+ linkmode_and(phydev->supported, phydev->supported, mask); -+ linkmode_copy(phydev->advertising, phydev->supported); -+ -+ sp->phy_dev = phydev; -+ -+ printk(KERN_INFO "%s: attached PHY driver [%s] (mii_bus:phy_addr=%s)\n", -+ dev->name, phydev->drv->name, phydev_name(phydev)); -+ -+ return 0; -+} -+ ---- /dev/null -+++ b/drivers/net/ethernet/atheros/ar231x/ar231x.h -@@ -0,0 +1,282 @@ -+/* -+ * ar231x.h: Linux driver for the Atheros AR231x Ethernet device. -+ * -+ * Copyright (C) 2004 by Sameer Dekate -+ * Copyright (C) 2006 Imre Kaloz -+ * Copyright (C) 2006-2009 Felix Fietkau -+ * -+ * Thanks to Atheros for providing hardware and documentation -+ * enabling me to write this driver. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ */ -+ -+#ifndef _AR2313_H_ -+#define _AR2313_H_ -+ -+#include -+#include -+#include -+#include -+ -+/* probe link timer - 5 secs */ -+#define LINK_TIMER (5*HZ) -+ -+#define IS_DMA_TX_INT(X) (((X) & (DMA_STATUS_TI)) != 0) -+#define IS_DMA_RX_INT(X) (((X) & (DMA_STATUS_RI)) != 0) -+#define IS_DRIVER_OWNED(X) (((X) & (DMA_TX_OWN)) == 0) -+ -+#define AR2313_TX_TIMEOUT (HZ/4) -+ -+/* Rings */ -+#define DSC_RING_ENTRIES_SIZE (AR2313_DESCR_ENTRIES * sizeof(struct desc)) -+#define DSC_NEXT(idx) ((idx + 1) & (AR2313_DESCR_ENTRIES - 1)) -+ -+#define AR2313_MBGET 2 -+#define AR2313_MBSET 3 -+#define AR2313_PCI_RECONFIG 4 -+#define AR2313_PCI_DUMP 5 -+#define AR2313_TEST_PANIC 6 -+#define AR2313_TEST_NULLPTR 7 -+#define AR2313_READ_DATA 8 -+#define AR2313_WRITE_DATA 9 -+#define AR2313_GET_VERSION 10 -+#define AR2313_TEST_HANG 11 -+#define AR2313_SYNC 12 -+ -+#define DMA_RX_ERR_CRC BIT(1) -+#define DMA_RX_ERR_DRIB BIT(2) -+#define DMA_RX_ERR_MII BIT(3) -+#define DMA_RX_EV2 BIT(5) -+#define DMA_RX_ERR_COL BIT(6) -+#define DMA_RX_LONG BIT(7) -+#define DMA_RX_LS BIT(8) /* last descriptor */ -+#define DMA_RX_FS BIT(9) /* first descriptor */ -+#define DMA_RX_MF BIT(10) /* multicast frame */ -+#define DMA_RX_ERR_RUNT BIT(11) /* runt frame */ -+#define DMA_RX_ERR_LENGTH BIT(12) /* length error */ -+#define DMA_RX_ERR_DESC BIT(14) /* descriptor error */ -+#define DMA_RX_ERROR BIT(15) /* error summary */ -+#define DMA_RX_LEN_MASK 0x3fff0000 -+#define DMA_RX_LEN_SHIFT 16 -+#define DMA_RX_FILT BIT(30) -+#define DMA_RX_OWN BIT(31) /* desc owned by DMA controller */ -+ -+#define DMA_RX1_BSIZE_MASK 0x000007ff -+#define DMA_RX1_BSIZE_SHIFT 0 -+#define DMA_RX1_CHAINED BIT(24) -+#define DMA_RX1_RER BIT(25) -+ -+#define DMA_TX_ERR_UNDER BIT(1) /* underflow error */ -+#define DMA_TX_ERR_DEFER BIT(2) /* excessive deferral */ -+#define DMA_TX_COL_MASK 0x78 -+#define DMA_TX_COL_SHIFT 3 -+#define DMA_TX_ERR_HB BIT(7) /* hearbeat failure */ -+#define DMA_TX_ERR_COL BIT(8) /* excessive collisions */ -+#define DMA_TX_ERR_LATE BIT(9) /* late collision */ -+#define DMA_TX_ERR_LINK BIT(10) /* no carrier */ -+#define DMA_TX_ERR_LOSS BIT(11) /* loss of carrier */ -+#define DMA_TX_ERR_JABBER BIT(14) /* transmit jabber timeout */ -+#define DMA_TX_ERROR BIT(15) /* frame aborted */ -+#define DMA_TX_OWN BIT(31) /* descr owned by DMA controller */ -+ -+#define DMA_TX1_BSIZE_MASK 0x000007ff -+#define DMA_TX1_BSIZE_SHIFT 0 -+#define DMA_TX1_CHAINED BIT(24) /* chained descriptors */ -+#define DMA_TX1_TER BIT(25) /* transmit end of ring */ -+#define DMA_TX1_FS BIT(29) /* first segment */ -+#define DMA_TX1_LS BIT(30) /* last segment */ -+#define DMA_TX1_IC BIT(31) /* interrupt on completion */ -+ -+#define RCVPKT_LENGTH(X) (X >> 16) /* Received pkt Length */ -+ -+#define MAC_CONTROL_RE BIT(2) /* receive enable */ -+#define MAC_CONTROL_TE BIT(3) /* transmit enable */ -+#define MAC_CONTROL_DC BIT(5) /* Deferral check */ -+#define MAC_CONTROL_ASTP BIT(8) /* Auto pad strip */ -+#define MAC_CONTROL_DRTY BIT(10) /* Disable retry */ -+#define MAC_CONTROL_DBF BIT(11) /* Disable bcast frames */ -+#define MAC_CONTROL_LCC BIT(12) /* late collision ctrl */ -+#define MAC_CONTROL_HP BIT(13) /* Hash Perfect filtering */ -+#define MAC_CONTROL_HASH BIT(14) /* Unicast hash filtering */ -+#define MAC_CONTROL_HO BIT(15) /* Hash only filtering */ -+#define MAC_CONTROL_PB BIT(16) /* Pass Bad frames */ -+#define MAC_CONTROL_IF BIT(17) /* Inverse filtering */ -+#define MAC_CONTROL_PR BIT(18) /* promis mode (valid frames only) */ -+#define MAC_CONTROL_PM BIT(19) /* pass multicast */ -+#define MAC_CONTROL_F BIT(20) /* full-duplex */ -+#define MAC_CONTROL_DRO BIT(23) /* Disable Receive Own */ -+#define MAC_CONTROL_HBD BIT(28) /* heart-beat disabled (MUST BE SET) */ -+#define MAC_CONTROL_BLE BIT(30) /* big endian mode */ -+#define MAC_CONTROL_RA BIT(31) /* rcv all (valid and invalid frames) */ -+ -+#define MII_ADDR_BUSY BIT(0) -+#define MII_ADDR_WRITE BIT(1) -+#define MII_ADDR_REG_SHIFT 6 -+#define MII_ADDR_PHY_SHIFT 11 -+#define MII_DATA_SHIFT 0 -+ -+#define FLOW_CONTROL_FCE BIT(1) -+ -+#define DMA_BUS_MODE_SWR BIT(0) /* software reset */ -+#define DMA_BUS_MODE_BLE BIT(7) /* big endian mode */ -+#define DMA_BUS_MODE_PBL_SHIFT 8 /* programmable burst length 32 */ -+#define DMA_BUS_MODE_DBO BIT(20) /* big-endian descriptors */ -+ -+#define DMA_STATUS_TI BIT(0) /* transmit interrupt */ -+#define DMA_STATUS_TPS BIT(1) /* transmit process stopped */ -+#define DMA_STATUS_TU BIT(2) /* transmit buffer unavailable */ -+#define DMA_STATUS_TJT BIT(3) /* transmit buffer timeout */ -+#define DMA_STATUS_UNF BIT(5) /* transmit underflow */ -+#define DMA_STATUS_RI BIT(6) /* receive interrupt */ -+#define DMA_STATUS_RU BIT(7) /* receive buffer unavailable */ -+#define DMA_STATUS_RPS BIT(8) /* receive process stopped */ -+#define DMA_STATUS_ETI BIT(10) /* early transmit interrupt */ -+#define DMA_STATUS_FBE BIT(13) /* fatal bus interrupt */ -+#define DMA_STATUS_ERI BIT(14) /* early receive interrupt */ -+#define DMA_STATUS_AIS BIT(15) /* abnormal interrupt summary */ -+#define DMA_STATUS_NIS BIT(16) /* normal interrupt summary */ -+#define DMA_STATUS_RS_SHIFT 17 /* receive process state */ -+#define DMA_STATUS_TS_SHIFT 20 /* transmit process state */ -+#define DMA_STATUS_EB_SHIFT 23 /* error bits */ -+ -+#define DMA_CONTROL_SR BIT(1) /* start receive */ -+#define DMA_CONTROL_ST BIT(13) /* start transmit */ -+#define DMA_CONTROL_SF BIT(21) /* store and forward */ -+ -+typedef struct { -+ volatile unsigned int status; /* OWN, Device control and status. */ -+ volatile unsigned int devcs; /* pkt Control bits + Length */ -+ volatile unsigned int addr; /* Current Address. */ -+ volatile unsigned int descr; /* Next descriptor in chain. */ -+} ar231x_descr_t; -+ -+/** -+ * New Combo structure for Both Eth0 AND eth1 -+ * -+ * Don't directly access MII related regs since phy chip could be actually -+ * connected to another ethernet block. -+ */ -+typedef struct { -+ volatile unsigned int mac_control; /* 0x00 */ -+ volatile unsigned int mac_addr[2]; /* 0x04 - 0x08 */ -+ volatile unsigned int mcast_table[2]; /* 0x0c - 0x10 */ -+ volatile unsigned int __mii_addr; /* 0x14 */ -+ volatile unsigned int __mii_data; /* 0x18 */ -+ volatile unsigned int flow_control; /* 0x1c */ -+ volatile unsigned int vlan_tag; /* 0x20 */ -+ volatile unsigned int pad[7]; /* 0x24 - 0x3c */ -+ volatile unsigned int ucast_table[8]; /* 0x40-0x5c */ -+} ETHERNET_STRUCT; -+ -+typedef struct { -+ volatile unsigned int mii_addr; -+ volatile unsigned int mii_data; -+} MII; -+ -+/******************************************************************** -+ * Interrupt controller -+ ********************************************************************/ -+ -+typedef struct { -+ volatile unsigned int wdog_control; /* 0x08 */ -+ volatile unsigned int wdog_timer; /* 0x0c */ -+ volatile unsigned int misc_status; /* 0x10 */ -+ volatile unsigned int misc_mask; /* 0x14 */ -+ volatile unsigned int global_status; /* 0x18 */ -+ volatile unsigned int reserved; /* 0x1c */ -+ volatile unsigned int reset_control; /* 0x20 */ -+} INTERRUPT; -+ -+/******************************************************************** -+ * DMA controller -+ ********************************************************************/ -+typedef struct { -+ volatile unsigned int bus_mode; /* 0x00 (CSR0) */ -+ volatile unsigned int xmt_poll; /* 0x04 (CSR1) */ -+ volatile unsigned int rcv_poll; /* 0x08 (CSR2) */ -+ volatile unsigned int rcv_base; /* 0x0c (CSR3) */ -+ volatile unsigned int xmt_base; /* 0x10 (CSR4) */ -+ volatile unsigned int status; /* 0x14 (CSR5) */ -+ volatile unsigned int control; /* 0x18 (CSR6) */ -+ volatile unsigned int intr_ena; /* 0x1c (CSR7) */ -+ volatile unsigned int rcv_missed; /* 0x20 (CSR8) */ -+ volatile unsigned int reserved[11]; /* 0x24-0x4c (CSR9-19) */ -+ volatile unsigned int cur_tx_buf_addr; /* 0x50 (CSR20) */ -+ volatile unsigned int cur_rx_buf_addr; /* 0x50 (CSR21) */ -+} DMA; -+ -+/** -+ * Struct private for the Sibyte. -+ * -+ * Elements are grouped so variables used by the tx handling goes -+ * together, and will go into the same cache lines etc. in order to -+ * avoid cache line contention between the rx and tx handling on SMP. -+ * -+ * Frequently accessed variables are put at the beginning of the -+ * struct to help the compiler generate better/shorter code. -+ */ -+struct ar231x_private { -+ struct net_device *dev; -+ struct platform_device *pdev; -+ int version; -+ u32 mb[2]; -+ -+ volatile MII *phy_regs; -+ volatile ETHERNET_STRUCT *eth_regs; -+ volatile DMA *dma_regs; -+ struct ar231x_eth *cfg; -+ -+ spinlock_t lock; /* Serialise access to device */ -+ -+ /* RX and TX descriptors, must be adjacent */ -+ ar231x_descr_t *rx_ring; -+ ar231x_descr_t *tx_ring; -+ -+ struct sk_buff **rx_skb; -+ struct sk_buff **tx_skb; -+ -+ /* RX elements */ -+ u32 rx_skbprd; -+ u32 cur_rx; -+ -+ /* TX elements */ -+ u32 tx_prd; -+ u32 tx_csm; -+ -+ /* Misc elements */ -+ char name[48]; -+ struct { -+ u32 address; -+ u32 length; -+ char *mapping; -+ } desc; -+ -+ unsigned short link; /* 0 - link down, 1 - link up */ -+ unsigned short duplex; /* 0 - half, 1 - full */ -+ -+ struct tasklet_struct rx_tasklet; -+ int unloading; -+ -+ struct phy_device *phy_dev; -+ struct mii_bus *mii_bus; -+}; -+ -+/* Prototypes */ -+static int ar231x_init(struct net_device *dev); -+#ifdef TX_TIMEOUT -+static void ar231x_tx_timeout(struct net_device *dev); -+#endif -+static int ar231x_restart(struct net_device *dev); -+static void ar231x_load_rx_ring(struct net_device *dev, int bufs); -+static irqreturn_t ar231x_interrupt(int irq, void *dev_id); -+static int ar231x_open(struct net_device *dev); -+static int ar231x_start_xmit(struct sk_buff *skb, struct net_device *dev); -+static int ar231x_close(struct net_device *dev); -+static int ar231x_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd); -+static void ar231x_init_cleanup(struct net_device *dev); -+ -+#endif /* _AR2313_H_ */ ---- a/arch/mips/ath25/ar2315_regs.h -+++ b/arch/mips/ath25/ar2315_regs.h -@@ -57,6 +57,9 @@ - #define AR2315_PCI_EXT_BASE 0x80000000 /* PCI external */ - #define AR2315_PCI_EXT_SIZE 0x40000000 - -+/* MII registers offset inside Ethernet MMR region */ -+#define AR2315_ENET0_MII_BASE (AR2315_ENET0_BASE + 0x14) -+ - /* - * Configuration registers - */ ---- a/arch/mips/ath25/ar5312_regs.h -+++ b/arch/mips/ath25/ar5312_regs.h -@@ -64,6 +64,10 @@ - #define AR5312_AR5312_REV7 0x0057 /* AR5312 WMAC (AP30-040) */ - #define AR5312_AR2313_REV8 0x0058 /* AR2313 WMAC (AP43-030) */ - -+/* MII registers offset inside Ethernet MMR region */ -+#define AR5312_ENET0_MII_BASE (AR5312_ENET0_BASE + 0x14) -+#define AR5312_ENET1_MII_BASE (AR5312_ENET1_BASE + 0x14) -+ - /* Reset/Timer Block Address Map */ - #define AR5312_TIMER 0x0000 /* countdown timer */ - #define AR5312_RELOAD 0x0004 /* timer reload value */ ---- a/arch/mips/ath25/ar2315.c -+++ b/arch/mips/ath25/ar2315.c -@@ -132,6 +132,8 @@ static void ar2315_irq_dispatch(void) - - if (pending & CAUSEF_IP3) - do_IRQ(AR2315_IRQ_WLAN0); -+ else if (pending & CAUSEF_IP4) -+ do_IRQ(AR2315_IRQ_ENET0); - #ifdef CONFIG_PCI_AR2315 - else if (pending & CAUSEF_IP5) - do_IRQ(AR2315_IRQ_LCBUS_PCI); -@@ -167,6 +169,29 @@ void __init ar2315_arch_init_irq(void) - ar2315_misc_irq_domain = domain; - } - -+static void ar2315_device_reset_set(u32 mask) -+{ -+ u32 val; -+ -+ val = ar2315_rst_reg_read(AR2315_RESET); -+ ar2315_rst_reg_write(AR2315_RESET, val | mask); -+} -+ -+static void ar2315_device_reset_clear(u32 mask) -+{ -+ u32 val; -+ -+ val = ar2315_rst_reg_read(AR2315_RESET); -+ ar2315_rst_reg_write(AR2315_RESET, val & ~mask); -+} -+ -+static struct ar231x_eth ar2315_eth_data = { -+ .reset_set = ar2315_device_reset_set, -+ .reset_clear = ar2315_device_reset_clear, -+ .reset_mac = AR2315_RESET_ENET0, -+ .reset_phy = AR2315_RESET_EPHY0, -+}; -+ - static struct resource ar2315_gpio_res[] = { - { - .name = "ar2315-gpio", -@@ -203,6 +228,11 @@ void __init ar2315_init_devices(void) - ar2315_gpio_res[1].end = ar2315_gpio_res[1].start; - platform_device_register(&ar2315_gpio); - -+ ar2315_eth_data.macaddr = ath25_board.config->enet0_mac; -+ ath25_add_ethernet(0, AR2315_ENET0_BASE, "eth0_mii", -+ AR2315_ENET0_MII_BASE, AR2315_IRQ_ENET0, -+ &ar2315_eth_data); -+ - ath25_add_wmac(0, AR2315_WLAN0_BASE, AR2315_IRQ_WLAN0); - } - ---- a/arch/mips/ath25/ar5312.c -+++ b/arch/mips/ath25/ar5312.c -@@ -127,6 +127,10 @@ static void ar5312_irq_dispatch(void) - - if (pending & CAUSEF_IP2) - do_IRQ(AR5312_IRQ_WLAN0); -+ else if (pending & CAUSEF_IP3) -+ do_IRQ(AR5312_IRQ_ENET0); -+ else if (pending & CAUSEF_IP4) -+ do_IRQ(AR5312_IRQ_ENET1); - else if (pending & CAUSEF_IP5) - do_IRQ(AR5312_IRQ_WLAN1); - else if (pending & CAUSEF_IP6) -@@ -160,6 +164,36 @@ void __init ar5312_arch_init_irq(void) - ar5312_misc_irq_domain = domain; - } - -+static void ar5312_device_reset_set(u32 mask) -+{ -+ u32 val; -+ -+ val = ar5312_rst_reg_read(AR5312_RESET); -+ ar5312_rst_reg_write(AR5312_RESET, val | mask); -+} -+ -+static void ar5312_device_reset_clear(u32 mask) -+{ -+ u32 val; -+ -+ val = ar5312_rst_reg_read(AR5312_RESET); -+ ar5312_rst_reg_write(AR5312_RESET, val & ~mask); -+} -+ -+static struct ar231x_eth ar5312_eth0_data = { -+ .reset_set = ar5312_device_reset_set, -+ .reset_clear = ar5312_device_reset_clear, -+ .reset_mac = AR5312_RESET_ENET0, -+ .reset_phy = AR5312_RESET_EPHY0, -+}; -+ -+static struct ar231x_eth ar5312_eth1_data = { -+ .reset_set = ar5312_device_reset_set, -+ .reset_clear = ar5312_device_reset_clear, -+ .reset_mac = AR5312_RESET_ENET1, -+ .reset_phy = AR5312_RESET_EPHY1, -+}; -+ - static struct physmap_flash_data ar5312_flash_data = { - .width = 2, - }; -@@ -240,6 +274,7 @@ static void __init ar5312_flash_init(voi - void __init ar5312_init_devices(void) - { - struct ath25_boarddata *config; -+ u8 *c; - - ar5312_flash_init(); - -@@ -263,8 +298,30 @@ void __init ar5312_init_devices(void) - - platform_device_register(&ar5312_gpio); - -+ /* Fix up MAC addresses if necessary */ -+ if (is_broadcast_ether_addr(config->enet0_mac)) -+ ether_addr_copy(config->enet0_mac, config->enet1_mac); -+ -+ /* If ENET0 and ENET1 have the same mac address, -+ * increment the one from ENET1 */ -+ if (ether_addr_equal(config->enet0_mac, config->enet1_mac)) { -+ c = config->enet1_mac + 5; -+ while ((c >= config->enet1_mac) && !(++(*c))) -+ c--; -+ } -+ - switch (ath25_soc) { - case ATH25_SOC_AR5312: -+ ar5312_eth0_data.macaddr = config->enet0_mac; -+ ath25_add_ethernet(0, AR5312_ENET0_BASE, "eth0_mii", -+ AR5312_ENET0_MII_BASE, AR5312_IRQ_ENET0, -+ &ar5312_eth0_data); -+ -+ ar5312_eth1_data.macaddr = config->enet1_mac; -+ ath25_add_ethernet(1, AR5312_ENET1_BASE, "eth1_mii", -+ AR5312_ENET1_MII_BASE, AR5312_IRQ_ENET1, -+ &ar5312_eth1_data); -+ - if (!ath25_board.radio) - return; - -@@ -273,8 +330,18 @@ void __init ar5312_init_devices(void) - - ath25_add_wmac(0, AR5312_WLAN0_BASE, AR5312_IRQ_WLAN0); - break; -+ /* -+ * AR2312/3 ethernet uses the PHY of ENET0, but the MAC -+ * of ENET1. Atheros calls it 'twisted' for a reason :) -+ */ - case ATH25_SOC_AR2312: - case ATH25_SOC_AR2313: -+ ar5312_eth1_data.reset_phy = ar5312_eth0_data.reset_phy; -+ ar5312_eth1_data.macaddr = config->enet0_mac; -+ ath25_add_ethernet(1, AR5312_ENET1_BASE, "eth0_mii", -+ AR5312_ENET0_MII_BASE, AR5312_IRQ_ENET1, -+ &ar5312_eth1_data); -+ - if (!ath25_board.radio) - return; - break; ---- a/arch/mips/ath25/devices.h -+++ b/arch/mips/ath25/devices.h -@@ -33,6 +33,8 @@ extern struct ar231x_board_config ath25_ - extern void (*ath25_irq_dispatch)(void); - - int ath25_find_config(phys_addr_t offset, unsigned long size); -+int ath25_add_ethernet(int nr, u32 base, const char *mii_name, u32 mii_base, -+ int irq, void *pdata); - void ath25_serial_setup(u32 mapbase, int irq, unsigned int uartclk); - int ath25_add_wmac(int nr, u32 base, int irq); - ---- a/arch/mips/ath25/devices.c -+++ b/arch/mips/ath25/devices.c -@@ -13,6 +13,51 @@ - struct ar231x_board_config ath25_board; - enum ath25_soc_type ath25_soc = ATH25_SOC_UNKNOWN; - -+static struct resource ath25_eth0_res[] = { -+ { -+ .name = "eth0_membase", -+ .flags = IORESOURCE_MEM, -+ }, -+ { -+ .name = "eth0_mii", -+ .flags = IORESOURCE_MEM, -+ }, -+ { -+ .name = "eth0_irq", -+ .flags = IORESOURCE_IRQ, -+ } -+}; -+ -+static struct resource ath25_eth1_res[] = { -+ { -+ .name = "eth1_membase", -+ .flags = IORESOURCE_MEM, -+ }, -+ { -+ .name = "eth1_mii", -+ .flags = IORESOURCE_MEM, -+ }, -+ { -+ .name = "eth1_irq", -+ .flags = IORESOURCE_IRQ, -+ } -+}; -+ -+static struct platform_device ath25_eth[] = { -+ { -+ .id = 0, -+ .name = "ar231x-eth", -+ .resource = ath25_eth0_res, -+ .num_resources = ARRAY_SIZE(ath25_eth0_res) -+ }, -+ { -+ .id = 1, -+ .name = "ar231x-eth", -+ .resource = ath25_eth1_res, -+ .num_resources = ARRAY_SIZE(ath25_eth1_res) -+ } -+}; -+ - static struct resource ath25_wmac0_res[] = { - { - .name = "wmac0_membase", -@@ -71,6 +116,25 @@ const char *get_system_type(void) - return soc_type_strings[ath25_soc]; - } - -+int __init ath25_add_ethernet(int nr, u32 base, const char *mii_name, -+ u32 mii_base, int irq, void *pdata) -+{ -+ struct resource *res; -+ -+ ath25_eth[nr].dev.platform_data = pdata; -+ res = &ath25_eth[nr].resource[0]; -+ res->start = base; -+ res->end = base + 0x2000 - 1; -+ res++; -+ res->name = mii_name; -+ res->start = mii_base; -+ res->end = mii_base + 8 - 1; -+ res++; -+ res->start = irq; -+ res->end = irq; -+ return platform_device_register(&ath25_eth[nr]); -+} -+ - void __init ath25_serial_setup(u32 mapbase, int irq, unsigned int uartclk) - { - #ifdef CONFIG_SERIAL_8250_CONSOLE ---- a/arch/mips/include/asm/mach-ath25/ath25_platform.h -+++ b/arch/mips/include/asm/mach-ath25/ath25_platform.h -@@ -71,4 +71,15 @@ struct ar231x_board_config { - const char *radio; - }; - -+/* -+ * Platform device information for the Ethernet MAC -+ */ -+struct ar231x_eth { -+ void (*reset_set)(u32); -+ void (*reset_clear)(u32); -+ u32 reset_mac; -+ u32 reset_phy; -+ char *macaddr; -+}; -+ - #endif /* __ASM_MACH_ATH25_PLATFORM_H */ diff --git a/target/linux/ath25/patches-5.15/120-spiflash.patch b/target/linux/ath25/patches-5.15/120-spiflash.patch deleted file mode 100644 index b7a9607ac9b473..00000000000000 --- a/target/linux/ath25/patches-5.15/120-spiflash.patch +++ /dev/null @@ -1,631 +0,0 @@ ---- a/drivers/mtd/devices/Kconfig -+++ b/drivers/mtd/devices/Kconfig -@@ -120,6 +120,10 @@ config MTD_BCM47XXSFLASH - registered by bcma as platform devices. This enables driver for - serial flash memories. - -+config MTD_AR2315 -+ tristate "Atheros AR2315+ SPI Flash support" -+ depends on SOC_AR2315 -+ - config MTD_SLRAM - tristate "Uncached system RAM" - help ---- a/drivers/mtd/devices/Makefile -+++ b/drivers/mtd/devices/Makefile -@@ -16,6 +16,7 @@ obj-$(CONFIG_MTD_MCHP23K256) += mchp23k2 - obj-$(CONFIG_MTD_MCHP48L640) += mchp48l640.o - obj-$(CONFIG_MTD_SPEAR_SMI) += spear_smi.o - obj-$(CONFIG_MTD_SST25L) += sst25l.o -+obj-$(CONFIG_MTD_AR2315) += ar2315.o - obj-$(CONFIG_MTD_BCM47XXSFLASH) += bcm47xxsflash.o - obj-$(CONFIG_MTD_ST_SPI_FSM) += st_spi_fsm.o - obj-$(CONFIG_MTD_POWERNV_FLASH) += powernv_flash.o ---- /dev/null -+++ b/drivers/mtd/devices/ar2315.c -@@ -0,0 +1,456 @@ -+ -+/* -+ * MTD driver for the SPI Flash Memory support on Atheros AR2315 -+ * -+ * Copyright (c) 2005-2006 Atheros Communications Inc. -+ * Copyright (C) 2006-2007 FON Technology, SL. -+ * Copyright (C) 2006-2007 Imre Kaloz -+ * Copyright (C) 2006-2009 Felix Fietkau -+ * Copyright (C) 2012 Alexandros C. Couloumbis -+ * -+ * This code is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "ar2315_spiflash.h" -+ -+#define DRIVER_NAME "ar2315-spiflash" -+ -+#define busy_wait(_priv, _condition, _wait) do { \ -+ while (_condition) { \ -+ if (_wait > 1) \ -+ msleep(_wait); \ -+ else if ((_wait == 1) && need_resched()) \ -+ schedule(); \ -+ else \ -+ udelay(1); \ -+ } \ -+} while (0) -+ -+enum { -+ FLASH_NONE, -+ FLASH_1MB, -+ FLASH_2MB, -+ FLASH_4MB, -+ FLASH_8MB, -+ FLASH_16MB, -+}; -+ -+/* Flash configuration table */ -+struct flashconfig { -+ u32 byte_cnt; -+ u32 sector_cnt; -+ u32 sector_size; -+}; -+ -+static const struct flashconfig flashconfig_tbl[] = { -+ [FLASH_NONE] = { 0, 0, 0}, -+ [FLASH_1MB] = { STM_1MB_BYTE_COUNT, STM_1MB_SECTOR_COUNT, -+ STM_1MB_SECTOR_SIZE}, -+ [FLASH_2MB] = { STM_2MB_BYTE_COUNT, STM_2MB_SECTOR_COUNT, -+ STM_2MB_SECTOR_SIZE}, -+ [FLASH_4MB] = { STM_4MB_BYTE_COUNT, STM_4MB_SECTOR_COUNT, -+ STM_4MB_SECTOR_SIZE}, -+ [FLASH_8MB] = { STM_8MB_BYTE_COUNT, STM_8MB_SECTOR_COUNT, -+ STM_8MB_SECTOR_SIZE}, -+ [FLASH_16MB] = { STM_16MB_BYTE_COUNT, STM_16MB_SECTOR_COUNT, -+ STM_16MB_SECTOR_SIZE} -+}; -+ -+/* Mapping of generic opcodes to STM serial flash opcodes */ -+enum { -+ SPI_WRITE_ENABLE, -+ SPI_WRITE_DISABLE, -+ SPI_RD_STATUS, -+ SPI_WR_STATUS, -+ SPI_RD_DATA, -+ SPI_FAST_RD_DATA, -+ SPI_PAGE_PROGRAM, -+ SPI_SECTOR_ERASE, -+ SPI_BULK_ERASE, -+ SPI_DEEP_PWRDOWN, -+ SPI_RD_SIG, -+}; -+ -+struct opcodes { -+ __u16 code; -+ __s8 tx_cnt; -+ __s8 rx_cnt; -+}; -+ -+static const struct opcodes stm_opcodes[] = { -+ [SPI_WRITE_ENABLE] = {STM_OP_WR_ENABLE, 1, 0}, -+ [SPI_WRITE_DISABLE] = {STM_OP_WR_DISABLE, 1, 0}, -+ [SPI_RD_STATUS] = {STM_OP_RD_STATUS, 1, 1}, -+ [SPI_WR_STATUS] = {STM_OP_WR_STATUS, 1, 0}, -+ [SPI_RD_DATA] = {STM_OP_RD_DATA, 4, 4}, -+ [SPI_FAST_RD_DATA] = {STM_OP_FAST_RD_DATA, 5, 0}, -+ [SPI_PAGE_PROGRAM] = {STM_OP_PAGE_PGRM, 8, 0}, -+ [SPI_SECTOR_ERASE] = {STM_OP_SECTOR_ERASE, 4, 0}, -+ [SPI_BULK_ERASE] = {STM_OP_BULK_ERASE, 1, 0}, -+ [SPI_DEEP_PWRDOWN] = {STM_OP_DEEP_PWRDOWN, 1, 0}, -+ [SPI_RD_SIG] = {STM_OP_RD_SIG, 4, 1}, -+}; -+ -+/* Driver private data structure */ -+struct spiflash_priv { -+ struct mtd_info mtd; -+ void __iomem *readaddr; /* memory mapped data for read */ -+ void __iomem *mmraddr; /* memory mapped register space */ -+ struct mutex lock; /* serialize registers access */ -+}; -+ -+#define to_spiflash(_mtd) container_of(_mtd, struct spiflash_priv, mtd) -+ -+enum { -+ FL_READY, -+ FL_READING, -+ FL_ERASING, -+ FL_WRITING -+}; -+ -+/*****************************************************************************/ -+ -+static u32 -+spiflash_read_reg(struct spiflash_priv *priv, int reg) -+{ -+ return ioread32(priv->mmraddr + reg); -+} -+ -+static void -+spiflash_write_reg(struct spiflash_priv *priv, int reg, u32 data) -+{ -+ iowrite32(data, priv->mmraddr + reg); -+} -+ -+static u32 -+spiflash_wait_busy(struct spiflash_priv *priv) -+{ -+ u32 reg; -+ -+ busy_wait(priv, (reg = spiflash_read_reg(priv, SPI_FLASH_CTL)) & -+ SPI_CTL_BUSY, 0); -+ return reg; -+} -+ -+static u32 -+spiflash_sendcmd(struct spiflash_priv *priv, int opcode, u32 addr) -+{ -+ const struct opcodes *op; -+ u32 reg, mask; -+ -+ op = &stm_opcodes[opcode]; -+ reg = spiflash_wait_busy(priv); -+ spiflash_write_reg(priv, SPI_FLASH_OPCODE, -+ ((u32)op->code) | (addr << 8)); -+ -+ reg &= ~SPI_CTL_TX_RX_CNT_MASK; -+ reg |= SPI_CTL_START | op->tx_cnt | (op->rx_cnt << 4); -+ -+ spiflash_write_reg(priv, SPI_FLASH_CTL, reg); -+ spiflash_wait_busy(priv); -+ -+ if (!op->rx_cnt) -+ return 0; -+ -+ reg = spiflash_read_reg(priv, SPI_FLASH_DATA); -+ -+ switch (op->rx_cnt) { -+ case 1: -+ mask = 0x000000ff; -+ break; -+ case 2: -+ mask = 0x0000ffff; -+ break; -+ case 3: -+ mask = 0x00ffffff; -+ break; -+ default: -+ mask = 0xffffffff; -+ break; -+ } -+ reg &= mask; -+ -+ return reg; -+} -+ -+/* -+ * Probe SPI flash device -+ * Function returns 0 for failure. -+ * and flashconfig_tbl array index for success. -+ */ -+static int -+spiflash_probe_chip(struct platform_device *pdev, struct spiflash_priv *priv) -+{ -+ u32 sig = spiflash_sendcmd(priv, SPI_RD_SIG, 0); -+ int flash_size; -+ -+ switch (sig) { -+ case STM_8MBIT_SIGNATURE: -+ flash_size = FLASH_1MB; -+ break; -+ case STM_16MBIT_SIGNATURE: -+ flash_size = FLASH_2MB; -+ break; -+ case STM_32MBIT_SIGNATURE: -+ flash_size = FLASH_4MB; -+ break; -+ case STM_64MBIT_SIGNATURE: -+ flash_size = FLASH_8MB; -+ break; -+ case STM_128MBIT_SIGNATURE: -+ flash_size = FLASH_16MB; -+ break; -+ default: -+ dev_warn(&pdev->dev, "read of flash device signature failed!\n"); -+ return 0; -+ } -+ -+ return flash_size; -+} -+ -+static void -+spiflash_wait_complete(struct spiflash_priv *priv, unsigned int timeout) -+{ -+ busy_wait(priv, spiflash_sendcmd(priv, SPI_RD_STATUS, 0) & -+ SPI_STATUS_WIP, timeout); -+} -+ -+static int -+spiflash_erase(struct mtd_info *mtd, struct erase_info *instr) -+{ -+ struct spiflash_priv *priv = to_spiflash(mtd); -+ const struct opcodes *op; -+ u32 temp, reg; -+ -+ if (instr->addr + instr->len > mtd->size) -+ return -EINVAL; -+ -+ mutex_lock(&priv->lock); -+ -+ spiflash_sendcmd(priv, SPI_WRITE_ENABLE, 0); -+ reg = spiflash_wait_busy(priv); -+ -+ op = &stm_opcodes[SPI_SECTOR_ERASE]; -+ temp = ((u32)instr->addr << 8) | (u32)(op->code); -+ spiflash_write_reg(priv, SPI_FLASH_OPCODE, temp); -+ -+ reg &= ~SPI_CTL_TX_RX_CNT_MASK; -+ reg |= op->tx_cnt | SPI_CTL_START; -+ spiflash_write_reg(priv, SPI_FLASH_CTL, reg); -+ -+ spiflash_wait_complete(priv, 20); -+ -+ mutex_unlock(&priv->lock); -+ -+ return 0; -+} -+ -+static int -+spiflash_read(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, -+ u_char *buf) -+{ -+ struct spiflash_priv *priv = to_spiflash(mtd); -+ -+ if (!len) -+ return 0; -+ -+ if (from + len > mtd->size) -+ return -EINVAL; -+ -+ *retlen = len; -+ -+ mutex_lock(&priv->lock); -+ -+ memcpy_fromio(buf, priv->readaddr + from, len); -+ -+ mutex_unlock(&priv->lock); -+ -+ return 0; -+} -+ -+static int -+spiflash_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, -+ const u8 *buf) -+{ -+ struct spiflash_priv *priv = to_spiflash(mtd); -+ u32 opcode, bytes_left; -+ -+ *retlen = 0; -+ -+ if (!len) -+ return 0; -+ -+ if (to + len > mtd->size) -+ return -EINVAL; -+ -+ bytes_left = len; -+ -+ do { -+ u32 read_len, reg, page_offset, spi_data = 0; -+ -+ read_len = min(bytes_left, sizeof(u32)); -+ -+ /* 32-bit writes cannot span across a page boundary -+ * (256 bytes). This types of writes require two page -+ * program operations to handle it correctly. The STM part -+ * will write the overflow data to the beginning of the -+ * current page as opposed to the subsequent page. -+ */ -+ page_offset = (to & (STM_PAGE_SIZE - 1)) + read_len; -+ -+ if (page_offset > STM_PAGE_SIZE) -+ read_len -= (page_offset - STM_PAGE_SIZE); -+ -+ mutex_lock(&priv->lock); -+ -+ spiflash_sendcmd(priv, SPI_WRITE_ENABLE, 0); -+ spi_data = 0; -+ switch (read_len) { -+ case 4: -+ spi_data |= buf[3] << 24; -+ fallthrough; -+ case 3: -+ spi_data |= buf[2] << 16; -+ fallthrough; -+ case 2: -+ spi_data |= buf[1] << 8; -+ fallthrough; -+ case 1: -+ spi_data |= buf[0] & 0xff; -+ break; -+ default: -+ break; -+ } -+ -+ spiflash_write_reg(priv, SPI_FLASH_DATA, spi_data); -+ opcode = stm_opcodes[SPI_PAGE_PROGRAM].code | -+ (to & 0x00ffffff) << 8; -+ spiflash_write_reg(priv, SPI_FLASH_OPCODE, opcode); -+ -+ reg = spiflash_read_reg(priv, SPI_FLASH_CTL); -+ reg &= ~SPI_CTL_TX_RX_CNT_MASK; -+ reg |= (read_len + 4) | SPI_CTL_START; -+ spiflash_write_reg(priv, SPI_FLASH_CTL, reg); -+ -+ spiflash_wait_complete(priv, 1); -+ -+ mutex_unlock(&priv->lock); -+ -+ bytes_left -= read_len; -+ to += read_len; -+ buf += read_len; -+ -+ *retlen += read_len; -+ } while (bytes_left != 0); -+ -+ return 0; -+} -+ -+#if defined CONFIG_MTD_REDBOOT_PARTS || CONFIG_MTD_MYLOADER_PARTS -+static const char * const part_probe_types[] = { -+ "cmdlinepart", "RedBoot", "MyLoader", NULL -+}; -+#endif -+ -+static int -+spiflash_probe(struct platform_device *pdev) -+{ -+ struct spiflash_priv *priv; -+ struct mtd_info *mtd; -+ struct resource *res; -+ int index; -+ int result = 0; -+ -+ priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); -+ if (!priv) -+ return -ENOMEM; -+ -+ mutex_init(&priv->lock); -+ mtd = &priv->mtd; -+ -+ res = platform_get_resource(pdev, IORESOURCE_MEM, 1); -+ priv->mmraddr = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(priv->mmraddr)) { -+ dev_warn(&pdev->dev, "failed to map flash MMR\n"); -+ return PTR_ERR(priv->mmraddr); -+ } -+ -+ index = spiflash_probe_chip(pdev, priv); -+ if (!index) { -+ dev_warn(&pdev->dev, "found no flash device\n"); -+ return -ENODEV; -+ } -+ -+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ priv->readaddr = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(priv->readaddr)) { -+ dev_warn(&pdev->dev, "failed to map flash read mem\n"); -+ return PTR_ERR(priv->readaddr); -+ } -+ -+ platform_set_drvdata(pdev, priv); -+ mtd->name = "spiflash"; -+ mtd->type = MTD_NORFLASH; -+ mtd->flags = (MTD_CAP_NORFLASH|MTD_WRITEABLE); -+ mtd->size = flashconfig_tbl[index].byte_cnt; -+ mtd->erasesize = flashconfig_tbl[index].sector_size; -+ mtd->writesize = 1; -+ mtd->numeraseregions = 0; -+ mtd->eraseregions = NULL; -+ mtd->_erase = spiflash_erase; -+ mtd->_read = spiflash_read; -+ mtd->_write = spiflash_write; -+ mtd->owner = THIS_MODULE; -+ -+ dev_info(&pdev->dev, "%lld Kbytes flash detected\n", mtd->size >> 10); -+ -+#if defined CONFIG_MTD_REDBOOT_PARTS || CONFIG_MTD_MYLOADER_PARTS -+ /* parse redboot partitions */ -+ -+ result = mtd_device_parse_register(mtd, part_probe_types, -+ NULL, NULL, 0); -+#endif -+ -+ return result; -+} -+ -+static int -+spiflash_remove(struct platform_device *pdev) -+{ -+ struct spiflash_priv *priv = platform_get_drvdata(pdev); -+ -+ mtd_device_unregister(&priv->mtd); -+ -+ return 0; -+} -+ -+static struct platform_driver spiflash_driver = { -+ .driver.name = DRIVER_NAME, -+ .probe = spiflash_probe, -+ .remove = spiflash_remove, -+}; -+ -+module_platform_driver(spiflash_driver); -+ -+MODULE_LICENSE("GPL"); -+MODULE_AUTHOR("OpenWrt.org"); -+MODULE_AUTHOR("Atheros Communications Inc"); -+MODULE_DESCRIPTION("MTD driver for SPI Flash on Atheros AR2315+ SOC"); -+MODULE_ALIAS("platform:" DRIVER_NAME); -+ ---- /dev/null -+++ b/drivers/mtd/devices/ar2315_spiflash.h -@@ -0,0 +1,106 @@ -+/* -+ * Atheros AR2315 SPI Flash Memory support header file. -+ * -+ * Copyright (c) 2005, Atheros Communications Inc. -+ * Copyright (C) 2006 FON Technology, SL. -+ * Copyright (C) 2006 Imre Kaloz -+ * Copyright (C) 2006-2009 Felix Fietkau -+ * -+ * This code is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ */ -+#ifndef __AR2315_SPIFLASH_H -+#define __AR2315_SPIFLASH_H -+ -+#define STM_PAGE_SIZE 256 -+ -+#define SFI_WRITE_BUFFER_SIZE 4 -+#define SFI_FLASH_ADDR_MASK 0x00ffffff -+ -+#define STM_8MBIT_SIGNATURE 0x13 -+#define STM_M25P80_BYTE_COUNT 1048576 -+#define STM_M25P80_SECTOR_COUNT 16 -+#define STM_M25P80_SECTOR_SIZE 0x10000 -+ -+#define STM_16MBIT_SIGNATURE 0x14 -+#define STM_M25P16_BYTE_COUNT 2097152 -+#define STM_M25P16_SECTOR_COUNT 32 -+#define STM_M25P16_SECTOR_SIZE 0x10000 -+ -+#define STM_32MBIT_SIGNATURE 0x15 -+#define STM_M25P32_BYTE_COUNT 4194304 -+#define STM_M25P32_SECTOR_COUNT 64 -+#define STM_M25P32_SECTOR_SIZE 0x10000 -+ -+#define STM_64MBIT_SIGNATURE 0x16 -+#define STM_M25P64_BYTE_COUNT 8388608 -+#define STM_M25P64_SECTOR_COUNT 128 -+#define STM_M25P64_SECTOR_SIZE 0x10000 -+ -+#define STM_128MBIT_SIGNATURE 0x17 -+#define STM_M25P128_BYTE_COUNT 16777216 -+#define STM_M25P128_SECTOR_COUNT 256 -+#define STM_M25P128_SECTOR_SIZE 0x10000 -+ -+#define STM_1MB_BYTE_COUNT STM_M25P80_BYTE_COUNT -+#define STM_1MB_SECTOR_COUNT STM_M25P80_SECTOR_COUNT -+#define STM_1MB_SECTOR_SIZE STM_M25P80_SECTOR_SIZE -+#define STM_2MB_BYTE_COUNT STM_M25P16_BYTE_COUNT -+#define STM_2MB_SECTOR_COUNT STM_M25P16_SECTOR_COUNT -+#define STM_2MB_SECTOR_SIZE STM_M25P16_SECTOR_SIZE -+#define STM_4MB_BYTE_COUNT STM_M25P32_BYTE_COUNT -+#define STM_4MB_SECTOR_COUNT STM_M25P32_SECTOR_COUNT -+#define STM_4MB_SECTOR_SIZE STM_M25P32_SECTOR_SIZE -+#define STM_8MB_BYTE_COUNT STM_M25P64_BYTE_COUNT -+#define STM_8MB_SECTOR_COUNT STM_M25P64_SECTOR_COUNT -+#define STM_8MB_SECTOR_SIZE STM_M25P64_SECTOR_SIZE -+#define STM_16MB_BYTE_COUNT STM_M25P128_BYTE_COUNT -+#define STM_16MB_SECTOR_COUNT STM_M25P128_SECTOR_COUNT -+#define STM_16MB_SECTOR_SIZE STM_M25P128_SECTOR_SIZE -+ -+/* -+ * ST Microelectronics Opcodes for Serial Flash -+ */ -+ -+#define STM_OP_WR_ENABLE 0x06 /* Write Enable */ -+#define STM_OP_WR_DISABLE 0x04 /* Write Disable */ -+#define STM_OP_RD_STATUS 0x05 /* Read Status */ -+#define STM_OP_WR_STATUS 0x01 /* Write Status */ -+#define STM_OP_RD_DATA 0x03 /* Read Data */ -+#define STM_OP_FAST_RD_DATA 0x0b /* Fast Read Data */ -+#define STM_OP_PAGE_PGRM 0x02 /* Page Program */ -+#define STM_OP_SECTOR_ERASE 0xd8 /* Sector Erase */ -+#define STM_OP_BULK_ERASE 0xc7 /* Bulk Erase */ -+#define STM_OP_DEEP_PWRDOWN 0xb9 /* Deep Power-Down Mode */ -+#define STM_OP_RD_SIG 0xab /* Read Electronic Signature */ -+ -+#define STM_STATUS_WIP 0x01 /* Write-In-Progress */ -+#define STM_STATUS_WEL 0x02 /* Write Enable Latch */ -+#define STM_STATUS_BP0 0x04 /* Block Protect 0 */ -+#define STM_STATUS_BP1 0x08 /* Block Protect 1 */ -+#define STM_STATUS_BP2 0x10 /* Block Protect 2 */ -+#define STM_STATUS_SRWD 0x80 /* Status Register Write Disable */ -+ -+/* -+ * SPI Flash Interface Registers -+ */ -+ -+#define SPI_FLASH_CTL 0x00 -+#define SPI_FLASH_OPCODE 0x04 -+#define SPI_FLASH_DATA 0x08 -+ -+#define SPI_CTL_START 0x00000100 -+#define SPI_CTL_BUSY 0x00010000 -+#define SPI_CTL_TXCNT_MASK 0x0000000f -+#define SPI_CTL_RXCNT_MASK 0x000000f0 -+#define SPI_CTL_TX_RX_CNT_MASK 0x000000ff -+#define SPI_CTL_SIZE_MASK 0x00060000 -+ -+#define SPI_CTL_CLK_SEL_MASK 0x03000000 -+#define SPI_OPCODE_MASK 0x000000ff -+ -+#define SPI_STATUS_WIP STM_STATUS_WIP -+ -+#endif ---- a/arch/mips/ath25/ar2315.c -+++ b/arch/mips/ath25/ar2315.c -@@ -218,6 +218,28 @@ static struct platform_device ar2315_gpi - .num_resources = ARRAY_SIZE(ar2315_gpio_res) - }; - -+static struct resource ar2315_spiflash_res[] = { -+ { -+ .name = "spiflash_read", -+ .flags = IORESOURCE_MEM, -+ .start = AR2315_SPI_READ_BASE, -+ .end = AR2315_SPI_READ_BASE + AR2315_SPI_READ_SIZE - 1, -+ }, -+ { -+ .name = "spiflash_mmr", -+ .flags = IORESOURCE_MEM, -+ .start = AR2315_SPI_MMR_BASE, -+ .end = AR2315_SPI_MMR_BASE + AR2315_SPI_MMR_SIZE - 1, -+ }, -+}; -+ -+static struct platform_device ar2315_spiflash = { -+ .id = 0, -+ .name = "ar2315-spiflash", -+ .resource = ar2315_spiflash_res, -+ .num_resources = ARRAY_SIZE(ar2315_spiflash_res) -+}; -+ - void __init ar2315_init_devices(void) - { - /* Find board configuration */ -@@ -228,6 +250,8 @@ void __init ar2315_init_devices(void) - ar2315_gpio_res[1].end = ar2315_gpio_res[1].start; - platform_device_register(&ar2315_gpio); - -+ platform_device_register(&ar2315_spiflash); -+ - ar2315_eth_data.macaddr = ath25_board.config->enet0_mac; - ath25_add_ethernet(0, AR2315_ENET0_BASE, "eth0_mii", - AR2315_ENET0_MII_BASE, AR2315_IRQ_ENET0, diff --git a/target/linux/ath25/patches-5.15/130-watchdog.patch b/target/linux/ath25/patches-5.15/130-watchdog.patch deleted file mode 100644 index eb0bc5630d782e..00000000000000 --- a/target/linux/ath25/patches-5.15/130-watchdog.patch +++ /dev/null @@ -1,277 +0,0 @@ ---- /dev/null -+++ b/drivers/watchdog/ar2315-wtd.c -@@ -0,0 +1,209 @@ -+/* -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, see . -+ * -+ * Copyright (C) 2008 John Crispin -+ * Based on EP93xx and ifxmips wdt driver -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define DRIVER_NAME "ar2315-wdt" -+ -+#define CLOCK_RATE 40000000 -+#define HEARTBEAT(x) (x < 1 || x > 90 ? 20 : x) -+ -+#define WDT_REG_TIMER 0x00 -+#define WDT_REG_CTRL 0x04 -+ -+#define WDT_CTRL_ACT_NONE 0x00000000 /* No action */ -+#define WDT_CTRL_ACT_NMI 0x00000001 /* NMI on watchdog */ -+#define WDT_CTRL_ACT_RESET 0x00000002 /* reset on watchdog */ -+ -+static int wdt_timeout = 20; -+static int started; -+static int in_use; -+static void __iomem *wdt_base; -+ -+static inline void ar2315_wdt_wr(unsigned reg, u32 val) -+{ -+ iowrite32(val, wdt_base + reg); -+} -+ -+static void -+ar2315_wdt_enable(void) -+{ -+ ar2315_wdt_wr(WDT_REG_TIMER, wdt_timeout * CLOCK_RATE); -+} -+ -+static ssize_t -+ar2315_wdt_write(struct file *file, const char __user *data, size_t len, -+ loff_t *ppos) -+{ -+ if (len) -+ ar2315_wdt_enable(); -+ return len; -+} -+ -+static int -+ar2315_wdt_open(struct inode *inode, struct file *file) -+{ -+ if (in_use) -+ return -EBUSY; -+ ar2315_wdt_enable(); -+ in_use = 1; -+ started = 1; -+ return nonseekable_open(inode, file); -+} -+ -+static int -+ar2315_wdt_release(struct inode *inode, struct file *file) -+{ -+ in_use = 0; -+ return 0; -+} -+ -+static irqreturn_t -+ar2315_wdt_interrupt(int irq, void *dev) -+{ -+ struct platform_device *pdev = (struct platform_device *)dev; -+ -+ if (started) { -+ dev_crit(&pdev->dev, "watchdog expired, rebooting system\n"); -+ emergency_restart(); -+ } else { -+ ar2315_wdt_wr(WDT_REG_CTRL, 0); -+ ar2315_wdt_wr(WDT_REG_TIMER, 0); -+ } -+ return IRQ_HANDLED; -+} -+ -+static struct watchdog_info ident = { -+ .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, -+ .identity = "ar2315 Watchdog", -+}; -+ -+static long -+ar2315_wdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) -+{ -+ int new_wdt_timeout; -+ int ret = -ENOIOCTLCMD; -+ -+ switch (cmd) { -+ case WDIOC_GETSUPPORT: -+ ret = copy_to_user((void __user *)arg, &ident, sizeof(ident)) ? -+ -EFAULT : 0; -+ break; -+ case WDIOC_KEEPALIVE: -+ ar2315_wdt_enable(); -+ ret = 0; -+ break; -+ case WDIOC_SETTIMEOUT: -+ ret = get_user(new_wdt_timeout, (int __user *)arg); -+ if (ret) -+ break; -+ wdt_timeout = HEARTBEAT(new_wdt_timeout); -+ ar2315_wdt_enable(); -+ break; -+ case WDIOC_GETTIMEOUT: -+ ret = put_user(wdt_timeout, (int __user *)arg); -+ break; -+ } -+ return ret; -+} -+ -+static const struct file_operations ar2315_wdt_fops = { -+ .owner = THIS_MODULE, -+ .llseek = no_llseek, -+ .write = ar2315_wdt_write, -+ .unlocked_ioctl = ar2315_wdt_ioctl, -+ .open = ar2315_wdt_open, -+ .release = ar2315_wdt_release, -+}; -+ -+static struct miscdevice ar2315_wdt_miscdev = { -+ .minor = WATCHDOG_MINOR, -+ .name = "watchdog", -+ .fops = &ar2315_wdt_fops, -+}; -+ -+static int -+ar2315_wdt_probe(struct platform_device *dev) -+{ -+ struct resource *mem_res, *irq_res; -+ int ret = 0; -+ -+ if (wdt_base) -+ return -EBUSY; -+ -+ irq_res = platform_get_resource(dev, IORESOURCE_IRQ, 0); -+ if (!irq_res) { -+ dev_err(&dev->dev, "no IRQ resource\n"); -+ return -ENOENT; -+ } -+ -+ mem_res = platform_get_resource(dev, IORESOURCE_MEM, 0); -+ wdt_base = devm_ioremap_resource(&dev->dev, mem_res); -+ if (IS_ERR(wdt_base)) -+ return PTR_ERR(wdt_base); -+ -+ ret = devm_request_irq(&dev->dev, irq_res->start, ar2315_wdt_interrupt, -+ 0, DRIVER_NAME, dev); -+ if (ret) { -+ dev_err(&dev->dev, "failed to register inetrrupt\n"); -+ goto out; -+ } -+ -+ ret = misc_register(&ar2315_wdt_miscdev); -+ if (ret) -+ dev_err(&dev->dev, "failed to register miscdev\n"); -+ -+out: -+ return ret; -+} -+ -+static int -+ar2315_wdt_remove(struct platform_device *dev) -+{ -+ misc_deregister(&ar2315_wdt_miscdev); -+ return 0; -+} -+ -+static struct platform_driver ar2315_wdt_driver = { -+ .probe = ar2315_wdt_probe, -+ .remove = ar2315_wdt_remove, -+ .driver = { -+ .name = DRIVER_NAME, -+ .owner = THIS_MODULE, -+ }, -+}; -+ -+module_platform_driver(ar2315_wdt_driver); -+ -+MODULE_DESCRIPTION("Atheros AR2315 hardware watchdog driver"); -+MODULE_AUTHOR("John Crispin "); -+MODULE_LICENSE("GPL"); -+MODULE_ALIAS("platform:" DRIVER_NAME); ---- a/drivers/watchdog/Kconfig -+++ b/drivers/watchdog/Kconfig -@@ -1829,6 +1829,13 @@ config PIC32_DMT - To compile this driver as a loadable module, choose M here. - The module will be called pic32-dmt. - -+config AR2315_WDT -+ tristate "Atheros AR2315+ WiSoCs Watchdog Timer" -+ depends on ATH25 -+ help -+ Hardware driver for the built-in watchdog timer on the Atheros -+ AR2315/AR2316 WiSoCs. -+ - # PARISC Architecture - - # POWERPC Architecture ---- a/drivers/watchdog/Makefile -+++ b/drivers/watchdog/Makefile -@@ -161,6 +161,7 @@ obj-$(CONFIG_JZ4740_WDT) += jz4740_wdt.o - obj-$(CONFIG_WDT_MTX1) += mtx-1_wdt.o - obj-$(CONFIG_SIBYTE_WDOG) += sb_wdog.o - obj-$(CONFIG_AR7_WDT) += ar7_wdt.o -+obj-$(CONFIG_AR2315_WDT) += ar2315-wtd.o - obj-$(CONFIG_TXX9_WDT) += txx9wdt.o - obj-$(CONFIG_OCTEON_WDT) += octeon-wdt.o - octeon-wdt-y := octeon-wdt-main.o octeon-wdt-nmi.o ---- a/arch/mips/ath25/ar2315.c -+++ b/arch/mips/ath25/ar2315.c -@@ -218,6 +218,24 @@ static struct platform_device ar2315_gpi - .num_resources = ARRAY_SIZE(ar2315_gpio_res) - }; - -+static struct resource ar2315_wdt_res[] = { -+ { -+ .flags = IORESOURCE_MEM, -+ .start = AR2315_RST_BASE + AR2315_WDT_TIMER, -+ .end = AR2315_RST_BASE + AR2315_WDT_TIMER + 8 - 1, -+ }, -+ { -+ .flags = IORESOURCE_IRQ, -+ } -+}; -+ -+static struct platform_device ar2315_wdt = { -+ .id = 0, -+ .name = "ar2315-wdt", -+ .resource = ar2315_wdt_res, -+ .num_resources = ARRAY_SIZE(ar2315_wdt_res) -+}; -+ - static struct resource ar2315_spiflash_res[] = { - { - .name = "spiflash_read", -@@ -250,6 +268,11 @@ void __init ar2315_init_devices(void) - ar2315_gpio_res[1].end = ar2315_gpio_res[1].start; - platform_device_register(&ar2315_gpio); - -+ ar2315_wdt_res[1].start = irq_create_mapping(ar2315_misc_irq_domain, -+ AR2315_MISC_IRQ_WATCHDOG); -+ ar2315_wdt_res[1].end = ar2315_wdt_res[1].start; -+ platform_device_register(&ar2315_wdt); -+ - platform_device_register(&ar2315_spiflash); - - ar2315_eth_data.macaddr = ath25_board.config->enet0_mac; diff --git a/target/linux/ath25/patches-5.15/140-redboot_boardconfig.patch b/target/linux/ath25/patches-5.15/140-redboot_boardconfig.patch deleted file mode 100644 index 5f506aaa3abb5c..00000000000000 --- a/target/linux/ath25/patches-5.15/140-redboot_boardconfig.patch +++ /dev/null @@ -1,60 +0,0 @@ ---- a/drivers/mtd/parsers/redboot.c -+++ b/drivers/mtd/parsers/redboot.c -@@ -16,6 +16,8 @@ - #include - #include - -+#define BOARD_CONFIG_PART "boardconfig" -+ - struct fis_image_desc { - unsigned char name[16]; // Null terminated name - u32 flash_base; // Address within FLASH of image -@@ -73,6 +75,7 @@ static int parse_redboot_partitions(stru - const struct mtd_partition **pparts, - struct mtd_part_parser_data *data) - { -+ unsigned long max_offset = 0; - int nrparts = 0; - struct fis_image_desc *buf; - struct mtd_partition *parts; -@@ -239,14 +242,15 @@ nogood: - } - } - #endif -- parts = kzalloc(sizeof(*parts) * nrparts + nulllen + namelen, GFP_KERNEL); -+ parts = kzalloc(sizeof(*parts) * (nrparts + 1) + nulllen + namelen + -+ sizeof(BOARD_CONFIG_PART), GFP_KERNEL); - - if (!parts) { - ret = -ENOMEM; - goto out; - } - -- nullname = (char *)&parts[nrparts]; -+ nullname = (char *)&parts[nrparts + 1]; - #ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED - if (nulllen > 0) - strcpy(nullname, nullstring); -@@ -264,6 +268,8 @@ nogood: - } - #endif - for ( ; i < nrparts; i++) { -+ if (max_offset < buf[i].flash_base + buf[i].size) -+ max_offset = buf[i].flash_base + buf[i].size; - parts[i].size = fl->img->size; - parts[i].offset = fl->img->flash_base; - parts[i].name = names; -@@ -297,6 +303,13 @@ nogood: - fl = fl->next; - kfree(tmp_fl); - } -+ if (master->size - max_offset >= master->erasesize) { -+ parts[nrparts].size = master->size - max_offset; -+ parts[nrparts].offset = max_offset; -+ parts[nrparts].name = names; -+ strcpy(names, BOARD_CONFIG_PART); -+ nrparts++; -+ } - ret = nrparts; - *pparts = parts; - out: diff --git a/target/linux/ath25/patches-5.15/141-redboot_partition_scan.patch b/target/linux/ath25/patches-5.15/141-redboot_partition_scan.patch deleted file mode 100644 index f9c98c9a37a3fb..00000000000000 --- a/target/linux/ath25/patches-5.15/141-redboot_partition_scan.patch +++ /dev/null @@ -1,44 +0,0 @@ ---- a/drivers/mtd/parsers/redboot.c -+++ b/drivers/mtd/parsers/redboot.c -@@ -94,12 +94,18 @@ static int parse_redboot_partitions(stru - - parse_redboot_of(master); - -+ buf = vmalloc(master->erasesize); -+ if (!buf) -+ return -ENOMEM; -+ -+restart: - if (directory < 0) { - offset = master->size + directory * master->erasesize; - while (mtd_block_isbad(master, offset)) { - if (!offset) { - nogood: - pr_notice("Failed to find a non-bad block to check for RedBoot partition table\n"); -+ vfree(buf); - return -EIO; - } - offset -= master->erasesize; -@@ -112,10 +118,6 @@ nogood: - goto nogood; - } - } -- buf = vmalloc(master->erasesize); -- -- if (!buf) -- return -ENOMEM; - - pr_notice("Searching for RedBoot partition table in %s at offset 0x%lx\n", - master->name, offset); -@@ -187,6 +189,11 @@ nogood: - } - if (i == numslots) { - /* Didn't find it */ -+ if (offset + master->erasesize < master->size) { -+ /* not at the end of the flash yet, maybe next block */ -+ directory++; -+ goto restart; -+ } - pr_notice("No RedBoot partition table detected in %s\n", - master->name); - ret = 0; diff --git a/target/linux/ath25/patches-5.15/142-redboot_various_erase_size_fix.patch b/target/linux/ath25/patches-5.15/142-redboot_various_erase_size_fix.patch deleted file mode 100644 index ca9e6861770ab2..00000000000000 --- a/target/linux/ath25/patches-5.15/142-redboot_various_erase_size_fix.patch +++ /dev/null @@ -1,83 +0,0 @@ ---- a/drivers/mtd/parsers/redboot.c -+++ b/drivers/mtd/parsers/redboot.c -@@ -71,6 +71,22 @@ static void parse_redboot_of(struct mtd_ - directory = dirblock; - } - -+static uint32_t mtd_get_offset_erasesize(struct mtd_info *mtd, uint64_t offset) -+{ -+ struct mtd_erase_region_info *regions = mtd->eraseregions; -+ int i; -+ -+ for (i = 0; i < mtd->numeraseregions; i++) { -+ if (regions[i].offset + -+ regions[i].numblocks * regions[i].erasesize <= offset) -+ continue; -+ -+ return regions[i].erasesize; -+ } -+ -+ return mtd->erasesize; -+} -+ - static int parse_redboot_partitions(struct mtd_info *master, - const struct mtd_partition **pparts, - struct mtd_part_parser_data *data) -@@ -87,6 +103,7 @@ static int parse_redboot_partitions(stru - int namelen = 0; - int nulllen = 0; - int numslots; -+ int first_slot; - unsigned long offset; - #ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED - static char nullstring[] = "unallocated"; -@@ -134,7 +151,9 @@ nogood: - } - - numslots = (master->erasesize / sizeof(struct fis_image_desc)); -- for (i = 0; i < numslots; i++) { -+ first_slot = (buf[i].flash_base & (master->erasesize - 1)) / -+ sizeof(struct fis_image_desc); -+ for (i = first_slot; i < first_slot + numslots; i++) { - if (!memcmp(buf[i].name, "FIS directory", 14)) { - /* This is apparently the FIS directory entry for the - * FIS directory itself. The FIS directory size is -@@ -200,7 +219,10 @@ nogood: - goto out; - } - -- for (i = 0; i < numslots; i++) { -+ first_slot = (buf[i].flash_base & (master->erasesize - 1)) / -+ sizeof(struct fis_image_desc); -+ -+ for (i = first_slot; i < first_slot + numslots; i++) { - struct fis_list *new_fl, **prev; - - if (buf[i].name[0] == 0xff) { -@@ -275,12 +297,13 @@ nogood: - } - #endif - for ( ; i < nrparts; i++) { -- if (max_offset < buf[i].flash_base + buf[i].size) -- max_offset = buf[i].flash_base + buf[i].size; - parts[i].size = fl->img->size; - parts[i].offset = fl->img->flash_base; - parts[i].name = names; - -+ if (max_offset < parts[i].offset + parts[i].size) -+ max_offset = parts[i].offset + parts[i].size; -+ - strcpy(names, fl->img->name); - #ifdef CONFIG_MTD_REDBOOT_PARTS_READONLY - if (!memcmp(names, "RedBoot", 8) || -@@ -310,7 +333,9 @@ nogood: - fl = fl->next; - kfree(tmp_fl); - } -- if (master->size - max_offset >= master->erasesize) { -+ -+ if (master->size - max_offset >= -+ mtd_get_offset_erasesize(master, max_offset)) { - parts[nrparts].size = master->size - max_offset; - parts[nrparts].offset = max_offset; - parts[nrparts].name = names; diff --git a/target/linux/ath25/patches-5.15/210-reset_button.patch b/target/linux/ath25/patches-5.15/210-reset_button.patch deleted file mode 100644 index b3f7a14cda6835..00000000000000 --- a/target/linux/ath25/patches-5.15/210-reset_button.patch +++ /dev/null @@ -1,71 +0,0 @@ ---- a/arch/mips/ath25/Makefile -+++ b/arch/mips/ath25/Makefile -@@ -8,7 +8,7 @@ - # Copyright (C) 2006-2009 Felix Fietkau - # - --obj-y += board.o prom.o devices.o -+obj-y += board.o prom.o devices.o reset.o - - obj-$(CONFIG_EARLY_PRINTK) += early_printk.o - ---- /dev/null -+++ b/arch/mips/ath25/reset.c -@@ -0,0 +1,57 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+#include "devices.h" -+ -+static int __init -+ar231x_init_reset(void) -+{ -+ struct platform_device *pdev; -+ struct gpio_keys_platform_data pdata; -+ struct gpio_keys_button *p; -+ int err; -+ -+ if (ath25_board.config->reset_config_gpio == 0xffff) -+ return -ENODEV; -+ -+ p = kzalloc(sizeof(*p), GFP_KERNEL); -+ if (!p) -+ goto err; -+ -+ p->desc = "reset"; -+ p->type = EV_KEY; -+ p->code = KEY_RESTART; -+ p->debounce_interval = 60; -+ p->gpio = ath25_board.config->reset_config_gpio; -+ -+ memset(&pdata, 0, sizeof(pdata)); -+ pdata.poll_interval = 20; -+ pdata.buttons = p; -+ pdata.nbuttons = 1; -+ -+ pdev = platform_device_alloc("gpio-keys-polled", 0); -+ if (!pdev) -+ goto err_free; -+ -+ err = platform_device_add_data(pdev, &pdata, sizeof(pdata)); -+ if (err) -+ goto err_put_pdev; -+ -+ err = platform_device_add(pdev); -+ if (err) -+ goto err_put_pdev; -+ -+ return 0; -+ -+err_put_pdev: -+ platform_device_put(pdev); -+err_free: -+ kfree(p); -+err: -+ return -ENOMEM; -+} -+ -+device_initcall(ar231x_init_reset); diff --git a/target/linux/ath25/patches-5.15/220-enet_micrel_workaround.patch b/target/linux/ath25/patches-5.15/220-enet_micrel_workaround.patch deleted file mode 100644 index b97cb3622fcfc1..00000000000000 --- a/target/linux/ath25/patches-5.15/220-enet_micrel_workaround.patch +++ /dev/null @@ -1,111 +0,0 @@ ---- a/drivers/net/ethernet/atheros/ar231x/ar231x.c -+++ b/drivers/net/ethernet/atheros/ar231x/ar231x.c -@@ -133,6 +133,7 @@ static int ar231x_mdiobus_write(struct m - static int ar231x_mdiobus_reset(struct mii_bus *bus); - static int ar231x_mdiobus_probe(struct net_device *dev); - static void ar231x_adjust_link(struct net_device *dev); -+static bool no_phy; - - #ifndef ERR - #define ERR(fmt, args...) printk("%s: " fmt, __func__, ##args) -@@ -164,6 +165,32 @@ static const struct net_device_ops ar231 - #endif - }; - -+static int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id) -+{ -+ int phy_reg; -+ -+ /** -+ * Grab the bits from PHYIR1, and put them -+ * in the upper half. -+ */ -+ phy_reg = mdiobus_read(bus, addr, MII_PHYSID1); -+ -+ if (phy_reg < 0) -+ return -EIO; -+ -+ *phy_id = (phy_reg & 0xffff) << 16; -+ -+ /* Grab the bits from PHYIR2, and put them in the lower half */ -+ phy_reg = mdiobus_read(bus, addr, MII_PHYSID2); -+ -+ if (phy_reg < 0) -+ return -EIO; -+ -+ *phy_id |= (phy_reg & 0xffff); -+ -+ return 0; -+} -+ - static int ar231x_probe(struct platform_device *pdev) - { - struct net_device *dev; -@@ -271,6 +298,24 @@ static int ar231x_probe(struct platform_ - - mdiobus_register(sp->mii_bus); - -+ /** -+ * Workaround for Micrel switch, which is only available on -+ * one PHY and cannot be configured through MDIO. -+ */ -+ if (!no_phy) { -+ u32 phy_id = 0; -+ -+ get_phy_id(sp->mii_bus, 1, &phy_id); -+ if (phy_id == 0x00221450) -+ no_phy = true; -+ } -+ if (no_phy) { -+ sp->link = 1; -+ netif_carrier_on(dev); -+ return 0; -+ } -+ no_phy = true; -+ - if (ar231x_mdiobus_probe(dev) != 0) { - printk(KERN_ERR "%s: mdiobus_probe failed\n", dev->name); - rx_tasklet_cleanup(dev); -@@ -324,8 +369,10 @@ static int ar231x_remove(struct platform - rx_tasklet_cleanup(dev); - ar231x_init_cleanup(dev); - unregister_netdev(dev); -- mdiobus_unregister(sp->mii_bus); -- mdiobus_free(sp->mii_bus); -+ if (sp->mii_bus) { -+ mdiobus_unregister(sp->mii_bus); -+ mdiobus_free(sp->mii_bus); -+ } - kfree(dev); - return 0; - } -@@ -868,7 +915,8 @@ static int ar231x_open(struct net_device - - sp->eth_regs->mac_control |= MAC_CONTROL_RE; - -- phy_start(sp->phy_dev); -+ if (sp->phy_dev) -+ phy_start(sp->phy_dev); - - return 0; - } -@@ -949,7 +997,8 @@ static int ar231x_close(struct net_devic - - #endif - -- phy_stop(sp->phy_dev); -+ if (sp->phy_dev) -+ phy_stop(sp->phy_dev); - - return 0; - } -@@ -993,6 +1042,9 @@ static int ar231x_ioctl(struct net_devic - { - struct ar231x_private *sp = netdev_priv(dev); - -+ if (!sp->phy_dev) -+ return -ENODEV; -+ - switch (cmd) { - case SIOCGMIIPHY: - case SIOCGMIIREG: diff --git a/target/linux/ath25/patches-5.15/330-board_leds.patch b/target/linux/ath25/patches-5.15/330-board_leds.patch deleted file mode 100644 index 3d762db80e8420..00000000000000 --- a/target/linux/ath25/patches-5.15/330-board_leds.patch +++ /dev/null @@ -1,116 +0,0 @@ ---- a/arch/mips/ath25/ar2315.c -+++ b/arch/mips/ath25/ar2315.c -@@ -24,6 +24,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -258,6 +259,50 @@ static struct platform_device ar2315_spi - .num_resources = ARRAY_SIZE(ar2315_spiflash_res) - }; - -+#ifdef CONFIG_LEDS_GPIO -+static struct gpio_led ar2315_leds[6]; -+static struct gpio_led_platform_data ar2315_led_data = { -+ .leds = (void *)ar2315_leds, -+}; -+ -+static struct platform_device ar2315_gpio_leds = { -+ .name = "leds-gpio", -+ .id = -1, -+ .dev = { -+ .platform_data = (void *)&ar2315_led_data, -+ } -+}; -+ -+static void __init ar2315_init_gpio_leds(void) -+{ -+ static char led_names[6][6]; -+ int i, led = 0; -+ -+ ar2315_led_data.num_leds = 0; -+ for (i = 1; i < 8; i++) { -+ if ((i == AR2315_RESET_GPIO) || -+ (i == ath25_board.config->reset_config_gpio)) -+ continue; -+ -+ if (i == ath25_board.config->sys_led_gpio) -+ strcpy(led_names[led], "wlan"); -+ else -+ sprintf(led_names[led], "gpio%d", i); -+ -+ ar2315_leds[led].name = led_names[led]; -+ ar2315_leds[led].gpio = i; -+ ar2315_leds[led].active_low = 0; -+ led++; -+ } -+ ar2315_led_data.num_leds = led; -+ platform_device_register(&ar2315_gpio_leds); -+} -+#else -+static inline void ar2315_init_gpio_leds(void) -+{ -+} -+#endif -+ - void __init ar2315_init_devices(void) - { - /* Find board configuration */ -@@ -268,6 +313,8 @@ void __init ar2315_init_devices(void) - ar2315_gpio_res[1].end = ar2315_gpio_res[1].start; - platform_device_register(&ar2315_gpio); - -+ ar2315_init_gpio_leds(); -+ - ar2315_wdt_res[1].start = irq_create_mapping(ar2315_misc_irq_domain, - AR2315_MISC_IRQ_WATCHDOG); - ar2315_wdt_res[1].end = ar2315_wdt_res[1].start; ---- a/arch/mips/ath25/ar5312.c -+++ b/arch/mips/ath25/ar5312.c -@@ -24,6 +24,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -228,6 +229,23 @@ static struct platform_device ar5312_gpi - .num_resources = ARRAY_SIZE(ar5312_gpio_res), - }; - -+#ifdef CONFIG_LEDS_GPIO -+static struct gpio_led ar5312_leds[] = { -+ { .name = "wlan", .gpio = 0, .active_low = 1, }, -+}; -+ -+static const struct gpio_led_platform_data ar5312_led_data = { -+ .num_leds = ARRAY_SIZE(ar5312_leds), -+ .leds = (void *)ar5312_leds, -+}; -+ -+static struct platform_device ar5312_gpio_leds = { -+ .name = "leds-gpio", -+ .id = -1, -+ .dev.platform_data = (void *)&ar5312_led_data, -+}; -+#endif -+ - static void __init ar5312_flash_init(void) - { - void __iomem *flashctl_base; -@@ -298,6 +316,11 @@ void __init ar5312_init_devices(void) - - platform_device_register(&ar5312_gpio); - -+#ifdef CONFIG_LEDS_GPIO -+ ar5312_leds[0].gpio = config->sys_led_gpio; -+ platform_device_register(&ar5312_gpio_leds); -+#endif -+ - /* Fix up MAC addresses if necessary */ - if (is_broadcast_ether_addr(config->enet0_mac)) - ether_addr_copy(config->enet0_mac, config->enet1_mac); diff --git a/target/linux/ath25/patches-5.15/700-swconfig_mvswitch.patch b/target/linux/ath25/patches-5.15/700-swconfig_mvswitch.patch deleted file mode 100644 index dcfc019f1282d8..00000000000000 --- a/target/linux/ath25/patches-5.15/700-swconfig_mvswitch.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- a/drivers/net/phy/Kconfig -+++ b/drivers/net/phy/Kconfig -@@ -96,6 +96,10 @@ config IP17XX_PHY - tristate "Driver for IC+ IP17xx switches" - select SWCONFIG - -+config MVSWITCH_PHY -+ tristate "Driver for Marvell 88E6060 switches" -+ select ETHERNET_PACKET_MANGLE -+ - config PSB6970_PHY - tristate "Lantiq XWAY Tantos (PSB6970) Ethernet switch" - select SWCONFIG ---- a/drivers/net/phy/Makefile -+++ b/drivers/net/phy/Makefile -@@ -31,6 +31,7 @@ ar8xxx-y += ar8216.o - ar8xxx-y += ar8327.o - obj-$(CONFIG_SWCONFIG_B53) += b53/ - obj-$(CONFIG_IP17XX_PHY) += ip17xx.o -+obj-$(CONFIG_MVSWITCH_PHY) += mvswitch.o - obj-$(CONFIG_PSB6970_PHY) += psb6970.o - obj-$(CONFIG_RTL8306_PHY) += rtl8306.o - obj-$(CONFIG_RTL8366_SMI) += rtl8366_smi.o diff --git a/target/linux/ath25/profiles/00-default.mk b/target/linux/ath25/profiles/00-default.mk deleted file mode 100644 index 3aeb31064acc50..00000000000000 --- a/target/linux/ath25/profiles/00-default.mk +++ /dev/null @@ -1,13 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -# -# Copyright (C) 2011 OpenWrt.org - -define Profile/Default - NAME:=Default Profile - PRIORITY:=1 -endef - -define Profile/Default/Description - Default package set compatible with most boards. -endef -$(eval $(call Profile,Default)) diff --git a/target/linux/ath79/Makefile b/target/linux/ath79/Makefile index f7bb31c4ad8f54..3ef4b32c72fa54 100644 --- a/target/linux/ath79/Makefile +++ b/target/linux/ath79/Makefile @@ -8,8 +8,7 @@ SUBTARGETS:=generic mikrotik nand tiny FEATURES:=ramdisk squashfs usbgadget -KERNEL_PATCHVER:=5.15 -KERNEL_TESTING_PATCHVER:=6.1 +KERNEL_PATCHVER:=6.1 include $(INCLUDE_DIR)/target.mk diff --git a/target/linux/ath79/config-5.15 b/target/linux/ath79/config-5.15 deleted file mode 100644 index 5b1b0d5add67bd..00000000000000 --- a/target/linux/ath79/config-5.15 +++ /dev/null @@ -1,200 +0,0 @@ -CONFIG_AG71XX=y -# CONFIG_AG71XX_DEBUG is not set -CONFIG_AG71XX_DEBUG_FS=y -CONFIG_AR8216_PHY=y -CONFIG_AR8216_PHY_LEDS=y -CONFIG_ARCH_32BIT_OFF_T=y -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_ARCH_KEEP_MEMBLOCK=y -CONFIG_ARCH_MMAP_RND_BITS_MAX=15 -CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=15 -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_AT803X_PHY=y -CONFIG_ATH79=y -CONFIG_ATH79_WDT=y -CONFIG_BLK_MQ_PCI=y -CONFIG_CEVT_R4K=y -CONFIG_CLONE_BACKWARDS=y -CONFIG_CMDLINE="rootfstype=squashfs,jffs2" -CONFIG_CMDLINE_BOOL=y -# CONFIG_CMDLINE_OVERRIDE is not set -CONFIG_COMMON_CLK=y -CONFIG_COMPAT_32BIT_TIME=y -CONFIG_CPU_BIG_ENDIAN=y -CONFIG_CPU_GENERIC_DUMP_TLB=y -CONFIG_CPU_HAS_DIEI=y -CONFIG_CPU_HAS_PREFETCH=y -CONFIG_CPU_HAS_RIXI=y -CONFIG_CPU_HAS_SYNC=y -CONFIG_CPU_MIPS32=y -CONFIG_CPU_MIPS32_R2=y -CONFIG_CPU_MIPSR2=y -CONFIG_CPU_NEEDS_NO_SMARTMIPS_OR_MICROMIPS=y -CONFIG_CPU_R4K_CACHE_TLB=y -CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y -CONFIG_CPU_SUPPORTS_HIGHMEM=y -CONFIG_CPU_SUPPORTS_MSA=y -CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y -CONFIG_CRYPTO_LIB_POLY1305_RSIZE=2 -CONFIG_CRYPTO_RNG2=y -CONFIG_CSRC_R4K=y -CONFIG_DMA_NONCOHERENT=y -CONFIG_DTC=y -CONFIG_EARLY_PRINTK=y -CONFIG_ETHERNET_PACKET_MANGLE=y -CONFIG_FIXED_PHY=y -CONFIG_FWNODE_MDIO=y -CONFIG_FW_LOADER_PAGED_BUF=y -CONFIG_GENERIC_ATOMIC64=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CMOS_UPDATE=y -CONFIG_GENERIC_CPU_AUTOPROBE=y -CONFIG_GENERIC_FIND_FIRST_BIT=y -CONFIG_GENERIC_GETTIMEOFDAY=y -CONFIG_GENERIC_IOMAP=y -CONFIG_GENERIC_IRQ_CHIP=y -CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y -CONFIG_GENERIC_IRQ_SHOW=y -CONFIG_GENERIC_LIB_ASHLDI3=y -CONFIG_GENERIC_LIB_ASHRDI3=y -CONFIG_GENERIC_LIB_CMPDI2=y -CONFIG_GENERIC_LIB_LSHRDI3=y -CONFIG_GENERIC_LIB_UCMPDI2=y -CONFIG_GENERIC_PCI_IOMAP=y -CONFIG_GENERIC_PHY=y -CONFIG_GENERIC_PINCONF=y -CONFIG_GENERIC_PINCTRL_GROUPS=y -CONFIG_GENERIC_PINMUX_FUNCTIONS=y -CONFIG_GENERIC_SCHED_CLOCK=y -CONFIG_GENERIC_SMP_IDLE_THREAD=y -CONFIG_GENERIC_TIME_VSYSCALL=y -CONFIG_GPIOLIB_IRQCHIP=y -CONFIG_GPIO_74X164=y -CONFIG_GPIO_ATH79=y -CONFIG_GPIO_CDEV=y -CONFIG_GPIO_GENERIC=y -# CONFIG_GPIO_LATCH is not set -# CONFIG_GPIO_RB91X_KEY is not set -CONFIG_HANDLE_DOMAIN_IRQ=y -CONFIG_HARDWARE_WATCHPOINTS=y -CONFIG_HAS_DMA=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_IOPORT_MAP=y -CONFIG_HZ_PERIODIC=y -CONFIG_INITRAMFS_SOURCE="" -CONFIG_IRQCHIP=y -CONFIG_IRQ_DOMAIN=y -CONFIG_IRQ_FORCED_THREADING=y -CONFIG_IRQ_MIPS_CPU=y -CONFIG_IRQ_WORK=y -CONFIG_LEDS_GPIO=y -# CONFIG_LEDS_RESET is not set -CONFIG_LIBFDT=y -CONFIG_LOCK_DEBUGGING_SUPPORT=y -CONFIG_MDIO_BITBANG=y -CONFIG_MDIO_BUS=y -CONFIG_MDIO_DEVICE=y -CONFIG_MDIO_DEVRES=y -CONFIG_MDIO_GPIO=y -CONFIG_MEMFD_CREATE=y -# CONFIG_MFD_RB4XX_CPLD is not set -CONFIG_MFD_SYSCON=y -CONFIG_MIGRATION=y -CONFIG_MIPS=y -CONFIG_MIPS_ASID_BITS=8 -CONFIG_MIPS_ASID_SHIFT=0 -CONFIG_MIPS_CLOCK_VSYSCALL=y -# CONFIG_MIPS_CMDLINE_BUILTIN_EXTEND is not set -# CONFIG_MIPS_CMDLINE_FROM_BOOTLOADER is not set -CONFIG_MIPS_CMDLINE_FROM_DTB=y -CONFIG_MIPS_EBPF_JIT=y -CONFIG_MIPS_L1_CACHE_SHIFT=5 -CONFIG_MIPS_LD_CAN_LINK_VDSO=y -# CONFIG_MIPS_NO_APPENDED_DTB is not set -CONFIG_MIPS_RAW_APPENDED_DTB=y -CONFIG_MIPS_SPRAM=y -CONFIG_MODULES_USE_ELF_REL=y -CONFIG_MTD_CFI_ADV_OPTIONS=y -CONFIG_MTD_CFI_GEOMETRY=y -# CONFIG_MTD_CFI_I2 is not set -# CONFIG_MTD_CFI_INTELEXT is not set -CONFIG_MTD_CMDLINE_PARTS=y -# CONFIG_MTD_MAP_BANK_WIDTH_1 is not set -# CONFIG_MTD_MAP_BANK_WIDTH_4 is not set -CONFIG_MTD_PARSER_CYBERTAN=y -# CONFIG_MTD_PARSER_TPLINK_SAFELOADER is not set -CONFIG_MTD_PHYSMAP=y -CONFIG_MTD_SPI_NOR=y -CONFIG_MTD_SPLIT_ELF_FW=y -CONFIG_MTD_SPLIT_LZMA_FW=y -CONFIG_MTD_SPLIT_SEAMA_FW=y -CONFIG_MTD_SPLIT_TPLINK_FW=y -CONFIG_MTD_SPLIT_UIMAGE_FW=y -CONFIG_MTD_SPLIT_WRGG_FW=y -CONFIG_MTD_VIRT_CONCAT=y -CONFIG_NEED_DMA_MAP_STATE=y -CONFIG_NEED_PER_CPU_KM=y -CONFIG_NET_SELFTESTS=y -CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y -CONFIG_NVMEM=y -CONFIG_OF=y -CONFIG_OF_ADDRESS=y -CONFIG_OF_EARLY_FLATTREE=y -CONFIG_OF_FLATTREE=y -CONFIG_OF_GPIO=y -CONFIG_OF_IRQ=y -CONFIG_OF_KOBJ=y -CONFIG_OF_MDIO=y -CONFIG_PCI=y -CONFIG_PCI_AR71XX=y -CONFIG_PCI_AR724X=y -CONFIG_PCI_DISABLE_COMMON_QUIRKS=y -CONFIG_PCI_DOMAINS=y -CONFIG_PCI_DRIVERS_LEGACY=y -CONFIG_PERF_USE_VMALLOC=y -CONFIG_PGTABLE_LEVELS=2 -CONFIG_PHYLIB=y -# CONFIG_PHY_AR7100_USB is not set -# CONFIG_PHY_AR7200_USB is not set -# CONFIG_PHY_ATH79_USB is not set -CONFIG_PINCTRL=y -CONFIG_PTP_1588_CLOCK_OPTIONAL=y -CONFIG_RATIONAL=y -CONFIG_REGMAP=y -CONFIG_REGMAP_MMIO=y -CONFIG_REGULATOR=y -CONFIG_RESET_ATH79=y -CONFIG_RESET_CONTROLLER=y -CONFIG_SERIAL_8250_NR_UARTS=1 -CONFIG_SERIAL_8250_RUNTIME_UARTS=1 -CONFIG_SERIAL_AR933X=y -CONFIG_SERIAL_AR933X_CONSOLE=y -CONFIG_SERIAL_AR933X_NR_UARTS=2 -CONFIG_SERIAL_MCTRL_GPIO=y -CONFIG_SERIAL_OF_PLATFORM=y -CONFIG_SPI=y -CONFIG_SPI_AR934X=y -CONFIG_SPI_ATH79=y -CONFIG_SPI_BITBANG=y -CONFIG_SPI_GPIO=y -CONFIG_SPI_MASTER=y -CONFIG_SPI_MEM=y -# CONFIG_SPI_RB4XX is not set -CONFIG_SRCU=y -CONFIG_SWCONFIG=y -CONFIG_SWCONFIG_LEDS=y -CONFIG_SWPHY=y -CONFIG_SYSCTL_EXCEPTION_TRACE=y -CONFIG_SYS_HAS_CPU_MIPS32_R2=y -CONFIG_SYS_HAS_EARLY_PRINTK=y -CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y -CONFIG_SYS_SUPPORTS_ARBIT_HZ=y -CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y -CONFIG_SYS_SUPPORTS_MIPS16=y -CONFIG_SYS_SUPPORTS_ZBOOT=y -CONFIG_SYS_SUPPORTS_ZBOOT_UART_PROM=y -CONFIG_TARGET_ISA_REV=2 -CONFIG_TICK_CPU_ACCOUNTING=y -CONFIG_TINY_SRCU=y -CONFIG_USB_SUPPORT=y -CONFIG_USE_OF=y diff --git a/target/linux/ath79/config-6.1 b/target/linux/ath79/config-6.1 index e3119f99a1536c..f2a6969aa1e5dd 100644 --- a/target/linux/ath79/config-6.1 +++ b/target/linux/ath79/config-6.1 @@ -54,6 +54,7 @@ CONFIG_FWNODE_MDIO=y CONFIG_FW_LOADER_PAGED_BUF=y CONFIG_FW_LOADER_SYSFS=y CONFIG_GCC11_NO_ARRAY_BOUNDS=y +CONFIG_GCC_ASM_GOTO_OUTPUT_WORKAROUND=y CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_CLOCKEVENTS=y CONFIG_GENERIC_CMOS_UPDATE=y @@ -142,6 +143,7 @@ CONFIG_NEED_PER_CPU_KM=y CONFIG_NET_SELFTESTS=y CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y CONFIG_NVMEM=y +CONFIG_NVMEM_LAYOUTS=y CONFIG_OF=y CONFIG_OF_ADDRESS=y CONFIG_OF_EARLY_FLATTREE=y @@ -162,12 +164,14 @@ CONFIG_PCI_DRIVERS_LEGACY=y CONFIG_PERF_USE_VMALLOC=y CONFIG_PGTABLE_LEVELS=2 CONFIG_PHYLIB=y +CONFIG_PHYLIB_LEDS=y # CONFIG_PHY_AR7100_USB is not set # CONFIG_PHY_AR7200_USB is not set # CONFIG_PHY_ATH79_USB is not set CONFIG_PINCTRL=y CONFIG_PREEMPT_NONE_BUILD=y CONFIG_PTP_1588_CLOCK_OPTIONAL=y +CONFIG_QCOM_NET_PHYLIB=y CONFIG_RANDSTRUCT_NONE=y CONFIG_RATIONAL=y CONFIG_REGMAP=y diff --git a/target/linux/ath79/dts/qca9556_mikrotik_routerboard-wap-g-5hact2hnd.dts b/target/linux/ath79/dts/qca9556_mikrotik_routerboard-wap-g-5hact2hnd.dts index 485ef30e2c114f..9ae4dbe2d52e78 100644 --- a/target/linux/ath79/dts/qca9556_mikrotik_routerboard-wap-g-5hact2hnd.dts +++ b/target/linux/ath79/dts/qca9556_mikrotik_routerboard-wap-g-5hact2hnd.dts @@ -11,7 +11,6 @@ aliases { mdio-gpio1 = &mdio2; - serial0 = &uart; }; keys { diff --git a/target/linux/ath79/dts/qca9557_elecom_wab-s1167-ps.dts b/target/linux/ath79/dts/qca9557_elecom_wab-s1167-ps.dts new file mode 100644 index 00000000000000..facead974d3e38 --- /dev/null +++ b/target/linux/ath79/dts/qca9557_elecom_wab-s1167-ps.dts @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca955x_elecom_wab.dtsi" + +/ { + compatible = "elecom,wab-s1167-ps", "qca,qca9557"; + model = "ELECOM WAB-S1167-PS"; +}; diff --git a/target/linux/ath79/dts/qca9557_elecom_wab-s600-ps.dts b/target/linux/ath79/dts/qca9557_elecom_wab-s600-ps.dts new file mode 100644 index 00000000000000..8d4b1d3a852ebe --- /dev/null +++ b/target/linux/ath79/dts/qca9557_elecom_wab-s600-ps.dts @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca955x_elecom_wab.dtsi" + +/ { + compatible = "elecom,wab-s600-ps", "qca,qca9557"; + model = "ELECOM WAB-S600-PS"; +}; diff --git a/target/linux/ath79/dts/qca9557_meraki_mr18.dts b/target/linux/ath79/dts/qca9557_meraki_mr18.dts index 1df5d6125cc4c5..4e9b3d1e9a6a7b 100644 --- a/target/linux/ath79/dts/qca9557_meraki_mr18.dts +++ b/target/linux/ath79/dts/qca9557_meraki_mr18.dts @@ -171,10 +171,6 @@ }; }; -&uart { - status = "okay"; -}; - &mdio0 { status = "okay"; diff --git a/target/linux/ath79/dts/qca9558_comfast_cf-e380ac-v2.dts b/target/linux/ath79/dts/qca9558_comfast_cf-e380ac-v2.dts index febbccb4cb4ba0..703eead178cab6 100644 --- a/target/linux/ath79/dts/qca9558_comfast_cf-e380ac-v2.dts +++ b/target/linux/ath79/dts/qca9558_comfast_cf-e380ac-v2.dts @@ -11,7 +11,6 @@ model = "COMFAST CF-E380AC"; aliases { - serial0 = &uart; label-mac-device = ð1; led-boot = &led_lan; led-failsafe = &led_lan; diff --git a/target/linux/ath79/dts/qca9558_dlink_dir-629-a1.dts b/target/linux/ath79/dts/qca9558_dlink_dir-629-a1.dts index 137bff732cf8b6..2d490dcf4809a1 100644 --- a/target/linux/ath79/dts/qca9558_dlink_dir-629-a1.dts +++ b/target/linux/ath79/dts/qca9558_dlink_dir-629-a1.dts @@ -16,7 +16,6 @@ led-failsafe = &led_power; led-running = &led_power; led-upgrade = &led_power; - serial0 = &uart; }; keys { diff --git a/target/linux/ath79/dts/qca9558_elecom_wab-i1750-ps.dts b/target/linux/ath79/dts/qca9558_elecom_wab-i1750-ps.dts new file mode 100644 index 00000000000000..668f0ceadd5ee7 --- /dev/null +++ b/target/linux/ath79/dts/qca9558_elecom_wab-i1750-ps.dts @@ -0,0 +1,54 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca955x_elecom_wab.dtsi" + +/ { + compatible = "elecom,wab-i1750-ps", "qca,qca9558"; + model = "ELECOM WAB-I1750-PS"; +}; + +&gpio { + uart1-out { + gpio-hog; + gpios = <0 GPIO_ACTIVE_HIGH>, /* UART1_TD */ + <2 GPIO_ACTIVE_HIGH>; /* UART1_RTS */ + output-low; + }; + + uart1-in { + gpio-hog; + gpios = <1 GPIO_ACTIVE_HIGH>, /* UART1_RD */ + <3 GPIO_ACTIVE_HIGH>; /* UART1_CTS */ + input; + }; +}; + +&pinmux { + pmx_uart1_out_pins: uart1-out-pins { + /* + * mux as uart1 output + * + * GPIO0: UART1_TD (sel:18) + * GPIO2: UART1_RTS (sel:19) + */ + pinctrl-single,bits = <0x0 0x130012 0xff00ff>; + }; + + pmx_uart1_in_pins: uart1-in-pins { + /* + * mux as uart1 input + * + * GPIO1: UART1_RD + * GPIO3: UART1_CTS + */ + pinctrl-single,bits = <0x3c 0x3010000 0xffff0000>; + }; +}; + +/* "SERIAL" port (RJ-45) on the case */ +&uart1 { + pinctrl-names = "default"; + pinctrl-0 = <&pmx_uart1_in_pins &pmx_uart1_out_pins + &jtag_disable_pins>; + status = "okay"; +}; diff --git a/target/linux/ath79/dts/qca9558_mikrotik_routerboard-92x.dtsi b/target/linux/ath79/dts/qca9558_mikrotik_routerboard-92x.dtsi index bc85cad9b37b03..c2e1ab765b1413 100644 --- a/target/linux/ath79/dts/qca9558_mikrotik_routerboard-92x.dtsi +++ b/target/linux/ath79/dts/qca9558_mikrotik_routerboard-92x.dtsi @@ -10,7 +10,6 @@ led-boot = &led_user; led-failsafe = &led_user; led-upgrade = &led_user; - serial0 = &uart; }; leds { diff --git a/target/linux/ath79/dts/qca9558_mikrotik_routerboard-96x.dtsi b/target/linux/ath79/dts/qca9558_mikrotik_routerboard-96x.dtsi index 3cfc40cd86cef1..684ca8632a4852 100644 --- a/target/linux/ath79/dts/qca9558_mikrotik_routerboard-96x.dtsi +++ b/target/linux/ath79/dts/qca9558_mikrotik_routerboard-96x.dtsi @@ -10,7 +10,6 @@ led-boot = &led_user; led-failsafe = &led_user; led-upgrade = &led_user; - serial0 = &uart; }; leds { diff --git a/target/linux/ath79/dts/qca9558_openmesh_a60.dtsi b/target/linux/ath79/dts/qca9558_openmesh_a60.dtsi index 11a6e81f9f28f4..e908c26c0db87b 100644 --- a/target/linux/ath79/dts/qca9558_openmesh_a60.dtsi +++ b/target/linux/ath79/dts/qca9558_openmesh_a60.dtsi @@ -12,7 +12,6 @@ }; aliases { - serial0 = &uart; led-boot = &led_status_green; led-failsafe = &led_status_green; led-running = &led_status_green; diff --git a/target/linux/ath79/dts/qca9558_openmesh_mr.dtsi b/target/linux/ath79/dts/qca9558_openmesh_mr.dtsi index a5d3d3798788cb..03f2999083b36a 100644 --- a/target/linux/ath79/dts/qca9558_openmesh_mr.dtsi +++ b/target/linux/ath79/dts/qca9558_openmesh_mr.dtsi @@ -12,7 +12,6 @@ }; aliases { - serial0 = &uart; led-boot = &led_power_blue; led-failsafe = &led_power_blue; led-running = &led_power_blue; diff --git a/target/linux/ath79/dts/qca9558_openmesh_om5p-ac-v1.dts b/target/linux/ath79/dts/qca9558_openmesh_om5p-ac-v1.dts index f7c51578ba9aa6..8fd35a99d4d388 100644 --- a/target/linux/ath79/dts/qca9558_openmesh_om5p-ac-v1.dts +++ b/target/linux/ath79/dts/qca9558_openmesh_om5p-ac-v1.dts @@ -15,7 +15,6 @@ }; aliases { - serial0 = &uart; led-boot = &led_power_blue; led-failsafe = &led_power_blue; led-running = &led_power_blue; diff --git a/target/linux/ath79/dts/qca9558_openmesh_om5p-ac-v2.dts b/target/linux/ath79/dts/qca9558_openmesh_om5p-ac-v2.dts index b9eb0e91a9b6ad..2e27d3d6ee5f6d 100644 --- a/target/linux/ath79/dts/qca9558_openmesh_om5p-ac-v2.dts +++ b/target/linux/ath79/dts/qca9558_openmesh_om5p-ac-v2.dts @@ -15,7 +15,6 @@ }; aliases { - serial0 = &uart; led-boot = &led_power_blue; led-failsafe = &led_power_blue; led-running = &led_power_blue; diff --git a/target/linux/ath79/dts/qca955x.dtsi b/target/linux/ath79/dts/qca955x.dtsi index c17a15c55e8f06..9d410ceb461cbf 100644 --- a/target/linux/ath79/dts/qca955x.dtsi +++ b/target/linux/ath79/dts/qca955x.dtsi @@ -8,6 +8,11 @@ #address-cells = <1>; #size-cells = <1>; + aliases { + serial0 = &uart0; + serial1 = &uart1; + }; + chosen { bootargs = "console=ttyS0,115200n8"; }; @@ -41,7 +46,7 @@ #qca,ddr-wb-channel-cells = <1>; }; - uart: uart@18020000 { + uart0: uart@18020000 { compatible = "ns16550a"; reg = <0x18020000 0x20>; @@ -178,6 +183,18 @@ #reset-cells = <1>; }; + + uart1: uart@18500000 { + compatible = "qca,ar9330-uart"; + reg = <0x18500000 0x14>; + + interrupts = <6>; + + clocks = <&pll ATH79_CLK_REF>; + clock-names = "uart"; + + status = "disabled"; + }; }; gmac: gmac@18070000 { diff --git a/target/linux/ath79/dts/qca955x_elecom_wab.dtsi b/target/linux/ath79/dts/qca955x_elecom_wab.dtsi new file mode 100644 index 00000000000000..3e24c514a98e82 --- /dev/null +++ b/target/linux/ath79/dts/qca955x_elecom_wab.dtsi @@ -0,0 +1,257 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca955x.dtsi" + +#include +#include +#include + +/ { + aliases { + led-boot = &led_status; + led-failsafe = &led_status; + led-upgrade = &led_status; + }; + + leds { + compatible = "gpio-leds"; + + led-0 { + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + color = ; + function = LED_FUNCTION_WLAN; + function-enumerator = <24>; + linux,default-trigger = "phy1tpt"; + }; + + led_status: led-1 { + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + color = ; + function = LED_FUNCTION_STATUS; + }; + + led-2 { + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + color = ; + function = LED_FUNCTION_USB; + trigger-sources = <&usb_port1>; + linux,default-trigger = "usbport"; + }; + }; + + keys { + compatible = "gpio-keys"; + + button-wps { + label = "wps"; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + + button-reset { + label = "reset"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + + button-eject { + label = "eject"; + gpios = <&gpio 19 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + }; + + beeper { + compatible = "gpio-beeper"; + gpios = <&gpio 4 GPIO_ACTIVE_HIGH>; + }; + + reg_usb_vbus: regulator { + compatible = "regulator-fixed"; + regulator-name = "usb-vbus"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpio = <&gpio 11 GPIO_ACTIVE_HIGH>; + enable-active-high; + regulator-always-on; + }; + + watchdog { + compatible = "linux,wdt-gpio"; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + hw_algo = "toggle"; + hw_margin_ms = <300>; + always-running; + }; +}; + +&mdio0 { + status = "okay"; + + ethphy4: ethernet-phy@4 { + compatible = "ethernet-phy-id004d,d072", + "ethernet-phy-ieee802.3-c22"; + reg = <0x4>; + eee-broken-100tx; + eee-broken-1000t; + }; +}; + +ð0 { + status = "okay"; + + phy-handle = <ðphy4>; + phy-mode = "rgmii-rxid"; + pll-data = <0xae000000 0x80000101 0x80001313>; + + gmac-config { + device = <&gmac>; + + rxdv-delay = <3>; + rxd-delay = <3>; + txen-delay = <0>; + txd-delay = <0>; + rgmii-enabled = <1>; + }; +}; + +&mdio1 { + status = "okay"; + + ethphy1: ethernet-phy@1 { + compatible = "ethernet-phy-id004d,d074", + "ethernet-phy-ieee802.3-c22"; + reg = <0x1>; + at803x-override-sgmii-link-check; + }; +}; + +ð1 { + status = "okay"; + + phy-handle = <ðphy1>; + pll-data = <0x03000000 0x00000101 0x00001313>; + + qca955x-sgmii-fixup; +}; + +&pcie0 { + status = "okay"; + + wifi@0,0 { + compatible = "qcom,ath10k"; + reg = <0x0000 0 0 0 0>; + nvmem-cells = <&cal_art_5000>; + nvmem-cell-names = "calibration"; + }; +}; + +&spi { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x40000>; + read-only; + }; + + partition@40000 { + label = "u-boot-env"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "art"; + reg = <0x50000 0x10000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + cal_art_1000: calibration@1000 { + reg = <0x1000 0x440>; + }; + + cal_art_5000: calibration@5000 { + reg = <0x5000 0x844>; + }; + }; + }; + + partition@60000 { + label = "art2"; + reg = <0x60000 0x10000>; + read-only; + }; + + partition@70000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x70000 0xe00000>; + }; + + partition@e70000 { + label = "manufacture"; + reg = <0xe70000 0x100000>; + read-only; + }; + + partition@f70000 { + label = "backup"; + reg = <0xf70000 0x10000>; + read-only; + }; + + partition@f80000 { + label = "storage"; + reg = <0xf80000 0x80000>; + read-only; + }; + }; + }; +}; + +&usb_phy0 { + status = "okay"; +}; + +&usb0 { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + dr_mode = "host"; + vbus-supply = <®_usb_vbus>; + + usb_port1: port@1 { + reg = <1>; + #trigger-source-cells = <0>; + }; +}; + +&wdt { + status = "disabled"; +}; + +&wmac { + status = "okay"; + + nvmem-cells = <&cal_art_1000>; + nvmem-cell-names = "calibration"; +}; diff --git a/target/linux/ath79/dts/qca9563_dlink_covr-c1200-a1.dts b/target/linux/ath79/dts/qca9563_dlink_covr-c1200-a1.dts new file mode 100644 index 00000000000000..b4f0bb3b642dd1 --- /dev/null +++ b/target/linux/ath79/dts/qca9563_dlink_covr-c1200-a1.dts @@ -0,0 +1,40 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca9563_dlink_covr.dtsi" + +/ { + compatible = "dlink,covr-c1200-a1", "qca,qca9563"; + model = "D-Link COVR-C1200 A1"; + + aliases { + led-boot = &led_power_orange; + led-failsafe = &led_power_red; + led-running = &led_power_white; + led-upgrade = &led_power_red; + }; + + leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&jtag_disable_pins>; + + led_power_red: power_red { + function = LED_FUNCTION_POWER; + color = ; + gpios = <&gpio 6 GPIO_ACTIVE_HIGH>; + }; + + led_power_white: power_white { + function = LED_FUNCTION_POWER; + color = ; + gpios = <&gpio 7 GPIO_ACTIVE_HIGH>; + }; + + led_power_orange: power_orange { + function = LED_FUNCTION_POWER; + color = ; + gpios = <&gpio 8 GPIO_ACTIVE_HIGH>; + default-state = "on"; + }; + }; +}; diff --git a/target/linux/ath79/dts/qca9563_dlink_covr-p2500-a1.dts b/target/linux/ath79/dts/qca9563_dlink_covr-p2500-a1.dts index 3b0c2afb50d08a..19bf874b64568a 100644 --- a/target/linux/ath79/dts/qca9563_dlink_covr-p2500-a1.dts +++ b/target/linux/ath79/dts/qca9563_dlink_covr-p2500-a1.dts @@ -1,11 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -#include "qca956x.dtsi" - -#include -#include -#include -#include +#include "qca9563_dlink_covr.dtsi" / { compatible = "dlink,covr-p2500-a1", "qca,qca9563"; @@ -18,22 +13,6 @@ led-upgrade = &led_power_red; }; - keys { - compatible = "gpio-keys"; - - wps { - label = "wps"; - linux,code = ; - gpios = <&gpio 1 GPIO_ACTIVE_LOW>; - }; - - reset { - label = "reset"; - linux,code = ; - gpios = <&gpio 2 GPIO_ACTIVE_LOW>; - }; - }; - leds { compatible = "gpio-leds"; pinctrl-names = "default"; @@ -70,144 +49,4 @@ linux,default-trigger = "phy1radio"; }; }; - - virtual_flash { - compatible = "mtd-concat"; - - devices = <&fwconcat0 &fwconcat1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - compatible = "openwrt,uimage", "denx,uimage"; - openwrt,ih-magic = <0x68737173>; - label = "firmware"; - reg = <0x0 0x0>; - }; - }; - }; -}; - -&spi { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <50000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x0 0x40000>; - read-only; - }; - - partition@40000 { - label = "u-boot-env"; - reg = <0x40000 0x10000>; - read-only; - }; - - fwconcat0: partition@50000 { - label = "fwconcat0"; - reg = <0x50000 0xe30000>; - }; - - partition@e80000 { - label = "loader"; - reg = <0xe80000 0x10000>; - read-only; - }; - - fwconcat1: partition@e90000 { - label = "fwconcat1"; - reg = <0xe90000 0x160000>; - }; - - art: partition@ff0000 { - label = "art"; - reg = <0xff0000 0x10000>; - read-only; - - nvmem-layout { - compatible = "fixed-layout"; - #address-cells = <1>; - #size-cells = <1>; - - calibration_ath9k: calibration@1000 { - reg = <0x1000 0x440>; - }; - - precalibration_ath10k: pre-calibration@5000 { - reg = <0x5000 0x2f20>; - }; - }; - }; - }; - }; -}; - -&pcie { - status = "okay"; - - wifi@0,0 { - compatible = "qcom,ath10k"; - reg = <0 0 0 0 0>; - - nvmem-cells = <&precalibration_ath10k>; - nvmem-cell-names = "pre-calibration"; - }; -}; - -&gpio { - phy-reset { - gpio-hog; - gpios = <11 GPIO_ACTIVE_LOW>; - output-low; - line-name = "phy-reset"; - }; -}; - -&mdio0 { - status = "okay"; - - phy0: ethernet-phy@0 { - reg = <0>; - phy-mode = "sgmii"; - qca,mib-poll-interval = <500>; - - qca,ar8327-initvals = < - 0x04 0x00080080 /* PORT0 PAD MODE CTRL */ - 0x10 0x81000080 /* POWER_ON_STRAP */ - 0x50 0xcc35cc35 /* LED_CTRL0 */ - 0x54 0xcb37cb37 /* LED_CTRL1 */ - 0x58 0x00000000 /* LED_CTRL2 */ - 0x5c 0x00f3cf00 /* LED_CTRL3 */ - 0x7c 0x0000007e /* PORT0_STATUS */ - >; - }; -}; - -ð0 { - status = "okay"; - - pll-data = <0x03000101 0x00000101 0x00001919>; - - phy-mode = "sgmii"; - phy-handle = <&phy0>; -}; - -&wmac { - status = "okay"; - - nvmem-cells = <&calibration_ath9k>; - nvmem-cell-names = "calibration"; }; diff --git a/target/linux/ath79/dts/qca9563_dlink_covr.dtsi b/target/linux/ath79/dts/qca9563_dlink_covr.dtsi new file mode 100644 index 00000000000000..5138cbc7968dd9 --- /dev/null +++ b/target/linux/ath79/dts/qca9563_dlink_covr.dtsi @@ -0,0 +1,168 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca956x.dtsi" + +#include +#include +#include +#include + +/ { + keys { + compatible = "gpio-keys"; + + wps { + label = "wps"; + linux,code = ; + gpios = <&gpio 1 GPIO_ACTIVE_LOW>; + }; + + reset { + label = "reset"; + linux,code = ; + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; + }; + }; + + virtual_flash { + compatible = "mtd-concat"; + + devices = <&fwconcat0 &fwconcat1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + compatible = "openwrt,uimage", "denx,uimage"; + openwrt,ih-magic = <0x68737173>; + label = "firmware"; + reg = <0x0 0x0>; + }; + }; + }; +}; + +&spi { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <50000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x40000>; + read-only; + }; + + partition@40000 { + label = "u-boot-env"; + reg = <0x40000 0x10000>; + read-only; + }; + + fwconcat0: partition@50000 { + label = "fwconcat0"; + reg = <0x50000 0xe30000>; + }; + + partition@e80000 { + label = "loader"; + reg = <0xe80000 0x10000>; + read-only; + }; + + fwconcat1: partition@e90000 { + label = "fwconcat1"; + reg = <0xe90000 0x160000>; + }; + + art: partition@ff0000 { + label = "art"; + reg = <0xff0000 0x10000>; + read-only; + + compatible = "nvmem-cells"; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + calibration_ath9k: calibration@1000 { + reg = <0x1000 0x440>; + }; + + precalibration_ath10k: pre-calibration@5000 { + reg = <0x5000 0x2f20>; + }; + }; + }; + }; + }; +}; + +&pcie { + status = "okay"; + + wifi0: wifi@0,0 { + compatible = "qcom,ath10k"; + reg = <0 0 0 0 0>; + + nvmem-cells = <&precalibration_ath10k>; + nvmem-cell-names = "pre-calibration"; + }; +}; + +&gpio { + phy-reset { + gpio-hog; + gpios = <11 GPIO_ACTIVE_LOW>; + output-low; + line-name = "phy-reset"; + }; +}; + +&mdio0 { + status = "okay"; + + phy0: ethernet-phy@0 { + reg = <0>; + phy-mode = "sgmii"; + qca,mib-poll-interval = <500>; + + qca,ar8327-initvals = < + 0x04 0x00080080 /* PORT0 PAD MODE CTRL */ + 0x10 0x81000080 /* POWER_ON_STRAP */ + 0x50 0xcc35cc35 /* LED_CTRL0 */ + 0x54 0xcb37cb37 /* LED_CTRL1 */ + 0x58 0x00000000 /* LED_CTRL2 */ + 0x5c 0x00f3cf00 /* LED_CTRL3 */ + 0x7c 0x0000007e /* PORT0_STATUS */ + >; + }; +}; + +ð0 { + status = "okay"; + + pll-data = <0x03000101 0x00000101 0x00001919>; + + phy-mode = "sgmii"; + phy-handle = <&phy0>; +}; + +&wmac { + status = "okay"; + + nvmem-cells = <&calibration_ath9k>; + nvmem-cell-names = "calibration"; +}; diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ethtool.c b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ethtool.c index b022a3e9fb7a19..14c6560907a33e 100644 --- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ethtool.c +++ b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ethtool.c @@ -80,15 +80,11 @@ static void ag71xx_ethtool_set_msglevel(struct net_device *dev, u32 msg_level) ag->msg_enable = msg_level; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,17,0) -static void ag71xx_ethtool_get_ringparam(struct net_device *dev, - struct ethtool_ringparam *er, - struct kernel_ethtool_ringparam *kernel_ring, - struct netlink_ext_ack *extack) -#else -static void ag71xx_ethtool_get_ringparam(struct net_device *dev, - struct ethtool_ringparam *er) -#endif +static void +ag71xx_ethtool_get_ringparam(struct net_device *dev, + struct ethtool_ringparam *er, + struct kernel_ethtool_ringparam *kernel_ring, + struct netlink_ext_ack *extack) { struct ag71xx *ag = netdev_priv(dev); @@ -106,15 +102,11 @@ static void ag71xx_ethtool_get_ringparam(struct net_device *dev, er->tx_pending /= AG71XX_TX_RING_DS_PER_PKT; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,17,0) -static int ag71xx_ethtool_set_ringparam(struct net_device *dev, - struct ethtool_ringparam *er, - struct kernel_ethtool_ringparam *kernel_ring, - struct netlink_ext_ack *extack) -#else -static int ag71xx_ethtool_set_ringparam(struct net_device *dev, - struct ethtool_ringparam *er) -#endif +static int +ag71xx_ethtool_set_ringparam(struct net_device *dev, + struct ethtool_ringparam *er, + struct kernel_ethtool_ringparam *kernel_ring, + struct netlink_ext_ack *extack) { struct ag71xx *ag = netdev_priv(dev); unsigned tx_size; diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c index 8a5cd3bcde97ef..8132849a9ae12d 100644 --- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c +++ b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c @@ -1698,11 +1698,7 @@ static int ag71xx_probe(struct platform_device *pdev) break; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,19,0) netif_napi_add_weight(dev, &ag->napi, ag71xx_poll, AG71XX_NAPI_WEIGHT); -#else - netif_napi_add(dev, &ag->napi, ag71xx_poll, AG71XX_NAPI_WEIGHT); -#endif ag71xx_dump_regs(ag); diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network index 4ed5605fa22ead..6c1cb8623554bf 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -144,6 +144,9 @@ ath79_setup_interfaces() alfa-network,n5q|\ devolo,dvl1200e|\ devolo,dvl1750e|\ + elecom,wab-i1750-ps|\ + elecom,wab-s1167-ps|\ + elecom,wab-s600-ps|\ engenius,enstationac-v1|\ engenius,ews511ap|\ engenius,ews660ap|\ @@ -289,6 +292,10 @@ ath79_setup_interfaces() ucidef_add_switch "switch0" \ "0@eth0" "2:wan" "3:lan" "4:lan" ;; + dlink,covr-c1200-a1) + ucidef_add_switch "switch0" \ + "0@eth0" "1:wan" "2:lan" + ;; dlink,covr-p2500-a1) ucidef_add_switch "switch0" \ "0@eth0" "1:lan" "2:lan" "3:wan" "4:plc" @@ -641,6 +648,11 @@ ath79_setup_macs() devolo,magic-2-wifi) label_mac=$(macaddr_add "$(mtd_get_mac_binary art 0x1002)" 3) ;; + dlink,covr-c1200-a1) + lan_mac=$(mtd_get_mac_ascii art "protest_lan_mac") + wan_mac=$(mtd_get_mac_ascii art "protest_wan_mac") + label_mac=$lan_mac + ;; dlink,covr-p2500-a1) lan_mac=$(mtd_get_mac_ascii art "protest_lan_mac") wan_mac=$(mtd_get_mac_ascii art "protest_lan_mac") @@ -702,16 +714,19 @@ ath79_setup_macs() lan_mac=$(mtd_get_mac_ascii devdata "lanmac") wan_mac=$(mtd_get_mac_ascii devdata "wanmac") ;; - elecom,wrc-1750ghbk2-i|\ - elecom,wrc-300ghbk2-i) - wan_mac=$(mtd_get_mac_ascii hwconfig "HW.WAN.MAC.Address") - label_mac=$wan_mac - ;; + elecom,wab-i1750-ps|\ + elecom,wab-s1167-ps|\ + elecom,wab-s600-ps|\ engenius,ecb1200|\ engenius,ecb1750) lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr) label_mac=$lan_mac ;; + elecom,wrc-1750ghbk2-i|\ + elecom,wrc-300ghbk2-i) + wan_mac=$(mtd_get_mac_ascii hwconfig "HW.WAN.MAC.Address") + label_mac=$wan_mac + ;; engenius,epg5000|\ engenius,esr1200|\ engenius,esr1750|\ diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac index 1a845a4ed717fb..b90e382223ae50 100644 --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac @@ -17,6 +17,7 @@ case "$board" in adtran,bsap1840) macaddr_add "$(mtd_get_mac_binary 'Board data' 2)" $(($PHYNBR * 8 + 1)) > /sys${DEVPATH}/macaddress ;; + dlink,covr-c1200-a1|\ dlink,covr-p2500-a1) [ "$PHYNBR" -eq 0 ] && \ mtd_get_mac_ascii art "protest_ath1_mac" > /sys${DEVPATH}/macaddress @@ -41,6 +42,16 @@ case "$board" in [ "$PHYNBR" -eq 1 ] && \ mtd_get_mac_ascii bdcfg "wlanmac" > /sys${DEVPATH}/macaddress ;; + elecom,wab-i1750-ps|\ + elecom,wab-s1167-ps|\ + elecom,wab-s600-ps) + # set the 5G MAC address (= ethaddr + 1) + [ "$PHYNBR" -eq 0 ] && \ + macaddr_add "$(mtd_get_mac_ascii u-boot-env ethaddr)" 1 > /sys${DEVPATH}/macaddress + # set the 2.4G MAC address (= ethaddr) + [ "$PHYNBR" -eq 1 ] && \ + mtd_get_mac_ascii u-boot-env "ethaddr" > /sys${DEVPATH}/macaddress + ;; engenius,ecb1200|\ engenius,ecb1750) [ "$PHYNBR" -eq 0 ] && \ diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index 68c41055615130..e7960efbaa2de9 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -9,6 +9,7 @@ DEVICE_VARS += ADDPATTERN_ID ADDPATTERN_VERSION DEVICE_VARS += SEAMA_SIGNATURE SEAMA_MTDBLOCK DEVICE_VARS += KERNEL_INITRAMFS_PREFIX DAP_SIGNATURE DEVICE_VARS += EDIMAX_HEADER_MAGIC EDIMAX_HEADER_MODEL +DEVICE_VARS += ELECOM_HWID DEVICE_VARS += MOXA_MAGIC MOXA_HWID DEVICE_VARS += OPENMESH_CE_TYPE ZYXEL_MODEL_STRING DEVICE_VARS += SUPPORTED_TELTONIKA_DEVICES @@ -1006,21 +1007,35 @@ define Device/devolo_magic-2-wifi endef TARGET_DEVICES += devolo_magic-2-wifi -define Device/dlink_covr-p2500-a1 +define Device/dlink_covr $(Device/loader-okli-uimage) SOC := qca9563 DEVICE_VENDOR := D-Link - DEVICE_MODEL := COVR-P2500 - DEVICE_VARIANT := A1 DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca9888-ct LOADER_FLASH_OFFS := 0x050000 LOADER_KERNEL_MAGIC := 0x68737173 KERNEL := kernel-bin | append-dtb | lzma | uImage lzma -M 0x68737173 IMAGE_SIZE := 14528k - IMAGES += factory.bin recovery.bin IMAGE/recovery.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \ append-rootfs | pad-rootfs | check-size | pad-to 14528k | \ append-loader-okli-uimage $(1) | pad-to 15616k +endef + +define Device/dlink_covr-c1200-a1 + $(Device/dlink_covr) + DEVICE_MODEL := COVR-C1200 + DEVICE_VARIANT := A1 + IMAGES += factory.bin + IMAGE/factory.bin := $$(IMAGE/recovery.bin) | \ + dlink-sge-signature COVR-C1200 | dlink-sge-image COVR-C1200 +endef +TARGET_DEVICES += dlink_covr-c1200-a1 + +define Device/dlink_covr-p2500-a1 + $(Device/dlink_covr) + DEVICE_MODEL := COVR-P2500 + DEVICE_VARIANT := A1 + IMAGES += factory.bin recovery.bin IMAGE/factory.bin := $$(IMAGE/recovery.bin) | \ dlink-sge-image COVR-P2500 | dlink-sge-signature COVR-P2500 endef @@ -1316,6 +1331,40 @@ define Device/dlink_dir-869-a1 endef TARGET_DEVICES += dlink_dir-869-a1 +define Device/elecom_wab + DEVICE_VENDOR := ELECOM + IMAGE_SIZE := 14336k + IMAGES += factory.bin + IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | \ + pad-rootfs | check-size | elx-header $$$$(ELECOM_HWID) 8844A2D168B45A2D + DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct kmod-gpio-beeper \ + kmod-usb2 kmod-usb-ledtrig-usbport +endef + +define Device/elecom_wab-i1750-ps + $(Device/elecom_wab) + SOC := qca9558 + DEVICE_MODEL := WAB-I1750-PS + ELECOM_HWID := 0107000d +endef +TARGET_DEVICES += elecom_wab-i1750-ps + +define Device/elecom_wab-s1167-ps + $(Device/elecom_wab) + SOC := qca9557 + DEVICE_MODEL := WAB-S1167-PS + ELECOM_HWID := 0107000c +endef +TARGET_DEVICES += elecom_wab-s1167-ps + +define Device/elecom_wab-s600-ps + $(Device/elecom_wab) + SOC := qca9557 + DEVICE_MODEL := WAB-S600-PS + ELECOM_HWID := 01070028 +endef +TARGET_DEVICES += elecom_wab-s600-ps + define Device/elecom_wrc-1750ghbk2-i SOC := qca9563 DEVICE_VENDOR := ELECOM diff --git a/target/linux/ath79/image/nand.mk b/target/linux/ath79/image/nand.mk index 0b51982c4fa79f..1a7eebc92a96fa 100644 --- a/target/linux/ath79/image/nand.mk +++ b/target/linux/ath79/image/nand.mk @@ -312,6 +312,7 @@ define Device/meraki_mr18 # KERNEL_INITRAMFS := $$(KERNEL) KERNEL_INITRAMFS := IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + SUPPORTED_DEVICES += mr18 endef TARGET_DEVICES += meraki_mr18 diff --git a/target/linux/ath79/patches-5.15/010-v5.17-spi-ar934x-fix-transfer-and-word-delays.patch b/target/linux/ath79/patches-5.15/010-v5.17-spi-ar934x-fix-transfer-and-word-delays.patch deleted file mode 100644 index 7ce6df6d7bd6ae..00000000000000 --- a/target/linux/ath79/patches-5.15/010-v5.17-spi-ar934x-fix-transfer-and-word-delays.patch +++ /dev/null @@ -1,27 +0,0 @@ -From c70282457c380db7deb57c81a6894debc8f88efa Mon Sep 17 00:00:00 2001 -From: Oskari Lemmela -Date: Wed, 22 Dec 2021 07:59:58 +0200 -Subject: [PATCH] spi: ar934x: fix transfer and word delays - -Add missing delay between transferred messages and words. - -Signed-off-by: Oskari Lemmela -Link: https://lore.kernel.org/r/20211222055958.1383233-3-oskari@lemmela.net -Signed-off-by: Mark Brown ---- - drivers/spi/spi-ar934x.c | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/drivers/spi/spi-ar934x.c -+++ b/drivers/spi/spi-ar934x.c -@@ -137,8 +137,10 @@ static int ar934x_spi_transfer_one_messa - reg >>= 8; - } - } -+ spi_delay_exec(&t->word_delay, t); - } - m->actual_length += t->len; -+ spi_transfer_delay_exec(t); - } - - msg_done: diff --git a/target/linux/ath79/patches-5.15/011-v5.17-spi-ar934x-fix-transfer-size.patch b/target/linux/ath79/patches-5.15/011-v5.17-spi-ar934x-fix-transfer-size.patch deleted file mode 100644 index 87f5da2c60e4c4..00000000000000 --- a/target/linux/ath79/patches-5.15/011-v5.17-spi-ar934x-fix-transfer-size.patch +++ /dev/null @@ -1,62 +0,0 @@ -From ebe33e5a98dcf14a9630845f3f10c193584ac054 Mon Sep 17 00:00:00 2001 -From: Oskari Lemmela -Date: Wed, 22 Dec 2021 07:59:57 +0200 -Subject: [PATCH] spi: ar934x: fix transfer size - -If bits_per_word is configured, transfer only word amount -of data per iteration. - -Signed-off-by: Oskari Lemmela -Link: https://lore.kernel.org/r/20211222055958.1383233-2-oskari@lemmela.net -Signed-off-by: Mark Brown ---- - drivers/spi/spi-ar934x.c | 16 +++++++++++----- - 1 file changed, 11 insertions(+), 5 deletions(-) - ---- a/drivers/spi/spi-ar934x.c -+++ b/drivers/spi/spi-ar934x.c -@@ -82,7 +82,7 @@ static int ar934x_spi_transfer_one_messa - struct spi_device *spi = m->spi; - unsigned long trx_done, trx_cur; - int stat = 0; -- u8 term = 0; -+ u8 bpw, term = 0; - int div, i; - u32 reg; - const u8 *tx_buf; -@@ -90,6 +90,11 @@ static int ar934x_spi_transfer_one_messa - - m->actual_length = 0; - list_for_each_entry(t, &m->transfers, transfer_list) { -+ if (t->bits_per_word >= 8 && t->bits_per_word < 32) -+ bpw = t->bits_per_word >> 3; -+ else -+ bpw = 4; -+ - if (t->speed_hz) - div = ar934x_spi_clk_div(sp, t->speed_hz); - else -@@ -105,10 +110,10 @@ static int ar934x_spi_transfer_one_messa - iowrite32(reg, sp->base + AR934X_SPI_REG_CTRL); - iowrite32(0, sp->base + AR934X_SPI_DATAOUT); - -- for (trx_done = 0; trx_done < t->len; trx_done += 4) { -+ for (trx_done = 0; trx_done < t->len; trx_done += bpw) { - trx_cur = t->len - trx_done; -- if (trx_cur > 4) -- trx_cur = 4; -+ if (trx_cur > bpw) -+ trx_cur = bpw; - else if (list_is_last(&t->transfer_list, &m->transfers)) - term = 1; - -@@ -193,7 +198,8 @@ static int ar934x_spi_probe(struct platf - ctlr->mode_bits = SPI_LSB_FIRST; - ctlr->setup = ar934x_spi_setup; - ctlr->transfer_one_message = ar934x_spi_transfer_one_message; -- ctlr->bits_per_word_mask = SPI_BPW_MASK(8); -+ ctlr->bits_per_word_mask = SPI_BPW_MASK(32) | SPI_BPW_MASK(24) | -+ SPI_BPW_MASK(16) | SPI_BPW_MASK(8); - ctlr->dev.of_node = pdev->dev.of_node; - ctlr->num_chipselect = 3; - diff --git a/target/linux/ath79/patches-5.15/020-v5.18-spi-ath79-Implement-the-spi_mem-interface.patch b/target/linux/ath79/patches-5.15/020-v5.18-spi-ath79-Implement-the-spi_mem-interface.patch deleted file mode 100644 index 5746a889e8c1ac..00000000000000 --- a/target/linux/ath79/patches-5.15/020-v5.18-spi-ath79-Implement-the-spi_mem-interface.patch +++ /dev/null @@ -1,68 +0,0 @@ -From 8d8cdb4a6ccee5b62cc0dc64651c3946364514dc Mon Sep 17 00:00:00 2001 -From: Luiz Angelo Daros de Luca -Date: Mon, 10 Feb 2020 16:11:27 -0300 -Subject: [PATCH] spi: ath79: Implement the spi_mem interface - -Signed-off-by: Luiz Angelo Daros de Luca ---- - drivers/spi/spi-ath79.c | 35 +++++++++++++++++++++++++++++++++++ - 1 file changed, 35 insertions(+) - ---- a/drivers/spi/spi-ath79.c -+++ b/drivers/spi/spi-ath79.c -@@ -15,6 +15,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -133,6 +134,39 @@ static u32 ath79_spi_txrx_mode0(struct s - return ath79_spi_rr(sp, AR71XX_SPI_REG_RDS); - } - -+static int ath79_exec_mem_op(struct spi_mem *mem, -+ const struct spi_mem_op *op) -+{ -+ struct ath79_spi *sp = ath79_spidev_to_sp(mem->spi); -+ -+ /* Ensures that reading is performed on device connected -+ to hardware cs0 */ -+ if (mem->spi->chip_select || mem->spi->cs_gpiod) -+ return -ENOTSUPP; -+ -+ /* Only use for fast-read op. */ -+ if (op->cmd.opcode != 0x0b || op->data.dir != SPI_MEM_DATA_IN || -+ op->addr.nbytes != 3 || op->dummy.nbytes != 1) -+ return -ENOTSUPP; -+ -+ /* disable GPIO mode */ -+ ath79_spi_wr(sp, AR71XX_SPI_REG_FS, 0); -+ -+ memcpy_fromio(op->data.buf.in, sp->base + op->addr.val, op->data.nbytes); -+ -+ /* enable GPIO mode */ -+ ath79_spi_wr(sp, AR71XX_SPI_REG_FS, AR71XX_SPI_FS_GPIO); -+ -+ /* restore IOC register */ -+ ath79_spi_wr(sp, AR71XX_SPI_REG_IOC, sp->ioc_base); -+ -+ return 0; -+} -+ -+static const struct spi_controller_mem_ops ath79_mem_ops = { -+ .exec_op = ath79_exec_mem_op, -+}; -+ - static int ath79_spi_probe(struct platform_device *pdev) - { - struct spi_master *master; -@@ -165,6 +199,7 @@ static int ath79_spi_probe(struct platfo - ret = PTR_ERR(sp->base); - goto err_put_master; - } -+ master->mem_ops = &ath79_mem_ops; - - sp->clk = devm_clk_get(&pdev->dev, "ahb"); - if (IS_ERR(sp->clk)) { diff --git a/target/linux/ath79/patches-5.15/030-v5.18-ath79-add-support-for-booting-QCN550x.patch b/target/linux/ath79/patches-5.15/030-v5.18-ath79-add-support-for-booting-QCN550x.patch deleted file mode 100644 index 41ea5d2ef0ac72..00000000000000 --- a/target/linux/ath79/patches-5.15/030-v5.18-ath79-add-support-for-booting-QCN550x.patch +++ /dev/null @@ -1,48 +0,0 @@ -From: Wenli Looi -Date: Sun, 20 Jun 2021 23:32:28 -0700 -Subject: [PATCH] ath79: add support for booting QCN550x - -Based on wikidevi, QCN550x is a "Dragonfly" like QCA9561 and QCA9563. -Treating it as QCA956x seems to work. -Tested on Netgear EX7300v2 which boots successfully with -the same CPU clock as the stock firmware. - -Link: https://wikidevi.wi-cat.ru/Qualcomm#bgn -Link: https://wikidevi.wi-cat.ru/Qualcomm_Atheros#.28a.29bgn_2 -Signed-off-by: Wenli Looi - ---- a/arch/mips/ath79/early_printk.c -+++ b/arch/mips/ath79/early_printk.c -@@ -121,6 +121,7 @@ static void prom_putchar_init(void) - case REV_ID_MAJOR_QCA9558: - case REV_ID_MAJOR_TP9343: - case REV_ID_MAJOR_QCA956X: -+ case REV_ID_MAJOR_QCN550X: - _prom_putchar = prom_putchar_ar71xx; - break; - ---- a/arch/mips/ath79/setup.c -+++ b/arch/mips/ath79/setup.c -@@ -168,6 +168,12 @@ static void __init ath79_detect_sys_type - rev = id & QCA956X_REV_ID_REVISION_MASK; - break; - -+ case REV_ID_MAJOR_QCN550X: -+ ath79_soc = ATH79_SOC_QCA956X; -+ chip = "550X"; -+ rev = id & QCA956X_REV_ID_REVISION_MASK; -+ break; -+ - case REV_ID_MAJOR_TP9343: - ath79_soc = ATH79_SOC_TP9343; - chip = "9343"; ---- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -+++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -@@ -862,6 +862,7 @@ - #define REV_ID_MAJOR_QCA9558 0x1130 - #define REV_ID_MAJOR_TP9343 0x0150 - #define REV_ID_MAJOR_QCA956X 0x1150 -+#define REV_ID_MAJOR_QCN550X 0x2170 - - #define AR71XX_REV_ID_MINOR_MASK 0x3 - #define AR71XX_REV_ID_MINOR_AR7130 0x0 diff --git a/target/linux/ath79/patches-5.15/100-reset-ath79-read-back-reset-register.patch b/target/linux/ath79/patches-5.15/100-reset-ath79-read-back-reset-register.patch deleted file mode 100644 index 7aa501514df8a6..00000000000000 --- a/target/linux/ath79/patches-5.15/100-reset-ath79-read-back-reset-register.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 661edfc3dab943a67c8821353b63cc23057f7ce9 Mon Sep 17 00:00:00 2001 -From: David Bauer -Date: Tue, 9 Jan 2024 20:48:46 +0100 -Subject: [PATCH] reset: ath79: read back reset register - -Read back the reset register in order to flush the cache. This fixes -spurious reboot hangs on TP-Link TL-WDR3600 and TL-WDR4300 with Zentel -DRAM chips. - -This issue was fixed in the past, but switching to the reset-driver -specific implementation removed the old fix. - -Link: https://github.com/freifunk-gluon/gluon/issues/2904 -Link: https://github.com/openwrt/openwrt/issues/13043 -Link: https://dev.archive.openwrt.org/ticket/17839 -Link: f8a7bfe1cb2c ("MIPS: ath79: fix system restart") - -Signed-off-by: David Bauer ---- - drivers/reset/reset-ath79.c | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/drivers/reset/reset-ath79.c -+++ b/drivers/reset/reset-ath79.c -@@ -37,6 +37,8 @@ static int ath79_reset_update(struct res - else - val &= ~BIT(id); - writel(val, ath79_reset->base); -+ /* Flush cache */ -+ readl(ath79_reset->base); - spin_unlock_irqrestore(&ath79_reset->lock, flags); - - return 0; diff --git a/target/linux/ath79/patches-5.15/300-irqchip-irq-ath79-intc-add-irq-cascade-driver-for-QC.patch b/target/linux/ath79/patches-5.15/300-irqchip-irq-ath79-intc-add-irq-cascade-driver-for-QC.patch deleted file mode 100644 index ceda511c21af7c..00000000000000 --- a/target/linux/ath79/patches-5.15/300-irqchip-irq-ath79-intc-add-irq-cascade-driver-for-QC.patch +++ /dev/null @@ -1,168 +0,0 @@ -From f3eacff2310a60348a755c50a8da6fc251fc8587 Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Tue, 6 Mar 2018 09:55:13 +0100 -Subject: [PATCH 07/33] irqchip/irq-ath79-intc: add irq cascade driver for - QCA9556 SoCs - -Signed-off-by: John Crispin ---- - drivers/irqchip/Makefile | 1 + - drivers/irqchip/irq-ath79-intc.c | 142 +++++++++++++++++++++++++++++++++++++++ - 2 files changed, 143 insertions(+) - create mode 100644 drivers/irqchip/irq-ath79-intc.c - ---- a/drivers/irqchip/Makefile -+++ b/drivers/irqchip/Makefile -@@ -4,6 +4,7 @@ obj-$(CONFIG_IRQCHIP) += irqchip.o - obj-$(CONFIG_AL_FIC) += irq-al-fic.o - obj-$(CONFIG_ALPINE_MSI) += irq-alpine-msi.o - obj-$(CONFIG_ATH79) += irq-ath79-cpu.o -+obj-$(CONFIG_ATH79) += irq-ath79-intc.o - obj-$(CONFIG_ATH79) += irq-ath79-misc.o - obj-$(CONFIG_ARCH_BCM2835) += irq-bcm2835.o - obj-$(CONFIG_ARCH_BCM2835) += irq-bcm2836.o ---- /dev/null -+++ b/drivers/irqchip/irq-ath79-intc.c -@@ -0,0 +1,142 @@ -+/* -+ * Atheros AR71xx/AR724x/AR913x specific interrupt handling -+ * -+ * Copyright (C) 2018 John Crispin -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published -+ * by the Free Software Foundation. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+ -+#define ATH79_MAX_INTC_CASCADE 3 -+ -+struct ath79_intc { -+ struct irq_chip chip; -+ u32 irq; -+ u32 pending_mask; -+ u32 int_status; -+ u32 irq_mask[ATH79_MAX_INTC_CASCADE]; -+ u32 irq_wb_chan[ATH79_MAX_INTC_CASCADE]; -+}; -+ -+static void ath79_intc_irq_handler(struct irq_desc *desc) -+{ -+ struct irq_domain *domain = irq_desc_get_handler_data(desc); -+ struct ath79_intc *intc = domain->host_data; -+ u32 pending; -+ -+ pending = ath79_reset_rr(intc->int_status); -+ pending &= intc->pending_mask; -+ -+ if (pending) { -+ int i; -+ -+ for (i = 0; i < domain->hwirq_max; i++) -+ if (pending & intc->irq_mask[i]) { -+ if (intc->irq_wb_chan[i] != 0xffffffff) -+ ath79_ddr_wb_flush(intc->irq_wb_chan[i]); -+ generic_handle_irq(irq_find_mapping(domain, i)); -+ } -+ } else { -+ spurious_interrupt(); -+ } -+} -+ -+static void ath79_intc_irq_enable(struct irq_data *d) -+{ -+ struct ath79_intc *intc = d->domain->host_data; -+ enable_irq(intc->irq); -+} -+ -+static void ath79_intc_irq_disable(struct irq_data *d) -+{ -+ struct ath79_intc *intc = d->domain->host_data; -+ disable_irq(intc->irq); -+} -+ -+static int ath79_intc_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw) -+{ -+ struct ath79_intc *intc = d->host_data; -+ -+ irq_set_chip_and_handler(irq, &intc->chip, handle_level_irq); -+ -+ return 0; -+} -+ -+static const struct irq_domain_ops ath79_irq_domain_ops = { -+ .xlate = irq_domain_xlate_onecell, -+ .map = ath79_intc_map, -+}; -+ -+static int __init ath79_intc_of_init( -+ struct device_node *node, struct device_node *parent) -+{ -+ struct irq_domain *domain; -+ struct ath79_intc *intc; -+ int cnt, cntwb, i, err; -+ -+ cnt = of_property_count_u32_elems(node, "qca,pending-bits"); -+ if (cnt > ATH79_MAX_INTC_CASCADE) -+ panic("Too many INTC pending bits\n"); -+ -+ intc = kzalloc(sizeof(*intc), GFP_KERNEL); -+ if (!intc) -+ panic("Failed to allocate INTC memory\n"); -+ intc->chip = dummy_irq_chip; -+ intc->chip.name = "INTC"; -+ intc->chip.irq_disable = ath79_intc_irq_disable; -+ intc->chip.irq_enable = ath79_intc_irq_enable; -+ -+ if (of_property_read_u32(node, "qca,int-status-addr", &intc->int_status) < 0) { -+ panic("Missing address of interrupt status register\n"); -+ } -+ -+ of_property_read_u32_array(node, "qca,pending-bits", intc->irq_mask, cnt); -+ for (i = 0; i < cnt; i++) { -+ intc->pending_mask |= intc->irq_mask[i]; -+ intc->irq_wb_chan[i] = 0xffffffff; -+ } -+ -+ cntwb = of_count_phandle_with_args( -+ node, "qca,ddr-wb-channels", "#qca,ddr-wb-channel-cells"); -+ -+ for (i = 0; i < cntwb; i++) { -+ struct of_phandle_args args; -+ u32 irq = i; -+ -+ of_property_read_u32_index( -+ node, "qca,ddr-wb-channel-interrupts", i, &irq); -+ if (irq >= ATH79_MAX_INTC_CASCADE) -+ continue; -+ -+ err = of_parse_phandle_with_args( -+ node, "qca,ddr-wb-channels", -+ "#qca,ddr-wb-channel-cells", -+ i, &args); -+ if (err) -+ return err; -+ -+ intc->irq_wb_chan[irq] = args.args[0]; -+ } -+ -+ intc->irq = irq_of_parse_and_map(node, 0); -+ if (!intc->irq) -+ panic("Failed to get INTC IRQ"); -+ -+ domain = irq_domain_add_linear(node, cnt, &ath79_irq_domain_ops, intc); -+ irq_set_chained_handler_and_data(intc->irq, ath79_intc_irq_handler, domain); -+ -+ return 0; -+} -+IRQCHIP_DECLARE(ath79_intc, "qca,ar9340-intc", -+ ath79_intc_of_init); diff --git a/target/linux/ath79/patches-5.15/301-irqchip-irq-ath79-cpu-drop-OF-init-helper.patch b/target/linux/ath79/patches-5.15/301-irqchip-irq-ath79-cpu-drop-OF-init-helper.patch deleted file mode 100644 index 13117d9a8e6fb5..00000000000000 --- a/target/linux/ath79/patches-5.15/301-irqchip-irq-ath79-cpu-drop-OF-init-helper.patch +++ /dev/null @@ -1,23 +0,0 @@ -From e029f998594f151008ecbfa024e2957edd2a5189 Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Tue, 6 Mar 2018 09:58:19 +0100 -Subject: [PATCH 08/33] irqchip/irq-ath79-cpu: drop !OF init helper - -Signed-off-by: John Crispin ---- - drivers/irqchip/irq-ath79-cpu.c | 7 ------- - 1 file changed, 7 deletions(-) - ---- a/drivers/irqchip/irq-ath79-cpu.c -+++ b/drivers/irqchip/irq-ath79-cpu.c -@@ -85,10 +85,3 @@ static int __init ar79_cpu_intc_of_init( - } - IRQCHIP_DECLARE(ar79_cpu_intc, "qca,ar7100-cpu-intc", - ar79_cpu_intc_of_init); -- --void __init ath79_cpu_irq_init(unsigned irq_wb_chan2, unsigned irq_wb_chan3) --{ -- irq_wb_chan[2] = irq_wb_chan2; -- irq_wb_chan[3] = irq_wb_chan3; -- mips_cpu_irq_init(); --} diff --git a/target/linux/ath79/patches-5.15/310-dt-bindings-PCI-qcom-ar7100-adds-binding-doc.patch b/target/linux/ath79/patches-5.15/310-dt-bindings-PCI-qcom-ar7100-adds-binding-doc.patch deleted file mode 100644 index cf0a75c791eecf..00000000000000 --- a/target/linux/ath79/patches-5.15/310-dt-bindings-PCI-qcom-ar7100-adds-binding-doc.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 4a4f869ec58ed8910b9b2e68d0eee50957e9bb20 Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Mon, 25 Jun 2018 15:52:10 +0200 -Subject: [PATCH 17/33] dt-bindings: PCI: qcom,ar7100: adds binding doc - -With the driver being converted from platform_data to pure OF, we need to -also add some docs. - -Cc: Rob Herring -Cc: devicetree@vger.kernel.org -Signed-off-by: John Crispin ---- - .../devicetree/bindings/pci/qcom,ar7100-pci.txt | 38 ++++++++++++++++++++++ - 1 file changed, 38 insertions(+) - create mode 100644 Documentation/devicetree/bindings/pci/qcom,ar7100-pci.txt - ---- /dev/null -+++ b/Documentation/devicetree/bindings/pci/qcom,ar7100-pci.txt -@@ -0,0 +1,38 @@ -+* Qualcomm Atheros AR7100 PCI express root complex -+ -+Required properties: -+- compatible: should contain "qcom,ar7100-pci" to identify the core. -+- reg: Should contain the register ranges as listed in the reg-names property. -+- reg-names: Definition: Must include the following entries -+ - "cfg_base" IO Memory -+- #address-cells: set to <3> -+- #size-cells: set to <2> -+- ranges: ranges for the PCI memory and I/O regions -+- interrupt-map-mask and interrupt-map: standard PCI -+ properties to define the mapping of the PCIe interface to interrupt -+ numbers. -+- #interrupt-cells: set to <1> -+- interrupt-controller: define to enable the builtin IRQ cascade. -+ -+Optional properties: -+- interrupt-parent: phandle to the MIPS IRQ controller -+ -+* Example for ar7100 -+ pcie@180c0000 { -+ compatible = "qca,ar7100-pci"; -+ #address-cells = <3>; -+ #size-cells = <2>; -+ bus-range = <0x0 0x0>; -+ reg = <0x17010000 0x100>; -+ reg-names = "cfg_base"; -+ ranges = <0x2000000 0 0x10000000 0x10000000 0 0x07000000 -+ 0x1000000 0 0x00000000 0x00000000 0 0x00000001>; -+ interrupt-parent = <&cpuintc>; -+ interrupts = <2>; -+ -+ interrupt-controller; -+ #interrupt-cells = <1>; -+ -+ interrupt-map-mask = <0 0 0 1>; -+ interrupt-map = <0 0 0 0 &pcie0 0>; -+ }; diff --git a/target/linux/ath79/patches-5.15/311-MIPS-pci-ar71xx-convert-to-OF.patch b/target/linux/ath79/patches-5.15/311-MIPS-pci-ar71xx-convert-to-OF.patch deleted file mode 100644 index 9a315aed0b2655..00000000000000 --- a/target/linux/ath79/patches-5.15/311-MIPS-pci-ar71xx-convert-to-OF.patch +++ /dev/null @@ -1,206 +0,0 @@ -From 1855ab6b1d27f5b38a648baf57ff6a534afec26d Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Sat, 23 Jun 2018 15:07:23 +0200 -Subject: [PATCH 18/33] MIPS: pci-ar71xx: convert to OF - -With the ath79 target getting converted to pure OF, we can drop all the -platform data code and add the missing OF bits to the driver. We also add -a irq domain for the PCI/e controllers cascade, thus making it usable from -dts files. - -Signed-off-by: John Crispin ---- - arch/mips/pci/pci-ar71xx.c | 82 +++++++++++++++++++++++----------------------- - 1 file changed, 41 insertions(+), 41 deletions(-) - ---- a/arch/mips/pci/pci-ar71xx.c -+++ b/arch/mips/pci/pci-ar71xx.c -@@ -15,8 +15,11 @@ - #include - #include - #include -+#include - #include - #include -+#include -+#include - - #include - #include -@@ -46,12 +49,13 @@ - #define AR71XX_PCI_IRQ_COUNT 5 - - struct ar71xx_pci_controller { -+ struct device_node *np; - void __iomem *cfg_base; - int irq; -- int irq_base; - struct pci_controller pci_ctrl; - struct resource io_res; - struct resource mem_res; -+ struct irq_domain *domain; - }; - - /* Byte lane enable bits */ -@@ -225,29 +229,30 @@ static struct pci_ops ar71xx_pci_ops = { - - static void ar71xx_pci_irq_handler(struct irq_desc *desc) - { -- struct ar71xx_pci_controller *apc; - void __iomem *base = ath79_reset_base; -+ struct irq_chip *chip = irq_desc_get_chip(desc); -+ struct ar71xx_pci_controller *apc = irq_desc_get_handler_data(desc); - u32 pending; - -- apc = irq_desc_get_handler_data(desc); -- -+ chained_irq_enter(chip, desc); - pending = __raw_readl(base + AR71XX_RESET_REG_PCI_INT_STATUS) & - __raw_readl(base + AR71XX_RESET_REG_PCI_INT_ENABLE); - - if (pending & AR71XX_PCI_INT_DEV0) -- generic_handle_irq(apc->irq_base + 0); -+ generic_handle_irq(irq_linear_revmap(apc->domain, 1)); - - else if (pending & AR71XX_PCI_INT_DEV1) -- generic_handle_irq(apc->irq_base + 1); -+ generic_handle_irq(irq_linear_revmap(apc->domain, 2)); - - else if (pending & AR71XX_PCI_INT_DEV2) -- generic_handle_irq(apc->irq_base + 2); -+ generic_handle_irq(irq_linear_revmap(apc->domain, 3)); - - else if (pending & AR71XX_PCI_INT_CORE) -- generic_handle_irq(apc->irq_base + 4); -+ generic_handle_irq(irq_linear_revmap(apc->domain, 4)); - - else - spurious_interrupt(); -+ chained_irq_exit(chip, desc); - } - - static void ar71xx_pci_irq_unmask(struct irq_data *d) -@@ -258,7 +263,7 @@ static void ar71xx_pci_irq_unmask(struct - u32 t; - - apc = irq_data_get_irq_chip_data(d); -- irq = d->irq - apc->irq_base; -+ irq = irq_linear_revmap(apc->domain, d->irq); - - t = __raw_readl(base + AR71XX_RESET_REG_PCI_INT_ENABLE); - __raw_writel(t | (1 << irq), base + AR71XX_RESET_REG_PCI_INT_ENABLE); -@@ -275,7 +280,7 @@ static void ar71xx_pci_irq_mask(struct i - u32 t; - - apc = irq_data_get_irq_chip_data(d); -- irq = d->irq - apc->irq_base; -+ irq = irq_linear_revmap(apc->domain, d->irq); - - t = __raw_readl(base + AR71XX_RESET_REG_PCI_INT_ENABLE); - __raw_writel(t & ~(1 << irq), base + AR71XX_RESET_REG_PCI_INT_ENABLE); -@@ -291,24 +296,31 @@ static struct irq_chip ar71xx_pci_irq_ch - .irq_mask_ack = ar71xx_pci_irq_mask, - }; - -+static int ar71xx_pci_irq_map(struct irq_domain *d, -+ unsigned int irq, irq_hw_number_t hw) -+{ -+ struct ar71xx_pci_controller *apc = d->host_data; -+ -+ irq_set_chip_and_handler(irq, &ar71xx_pci_irq_chip, handle_level_irq); -+ irq_set_chip_data(irq, apc); -+ -+ return 0; -+} -+ -+static const struct irq_domain_ops ar71xx_pci_domain_ops = { -+ .xlate = irq_domain_xlate_onecell, -+ .map = ar71xx_pci_irq_map, -+}; -+ - static void ar71xx_pci_irq_init(struct ar71xx_pci_controller *apc) - { - void __iomem *base = ath79_reset_base; -- int i; - - __raw_writel(0, base + AR71XX_RESET_REG_PCI_INT_ENABLE); - __raw_writel(0, base + AR71XX_RESET_REG_PCI_INT_STATUS); - -- BUILD_BUG_ON(ATH79_PCI_IRQ_COUNT < AR71XX_PCI_IRQ_COUNT); -- -- apc->irq_base = ATH79_PCI_IRQ_BASE; -- for (i = apc->irq_base; -- i < apc->irq_base + AR71XX_PCI_IRQ_COUNT; i++) { -- irq_set_chip_and_handler(i, &ar71xx_pci_irq_chip, -- handle_level_irq); -- irq_set_chip_data(i, apc); -- } -- -+ apc->domain = irq_domain_add_linear(apc->np, AR71XX_PCI_IRQ_COUNT, -+ &ar71xx_pci_domain_ops, apc); - irq_set_chained_handler_and_data(apc->irq, ar71xx_pci_irq_handler, - apc); - } -@@ -325,10 +337,14 @@ static void ar71xx_pci_reset(void) - mdelay(100); - } - -+static const struct of_device_id ar71xx_pci_ids[] = { -+ { .compatible = "qca,ar7100-pci" }, -+ {}, -+}; -+ - static int ar71xx_pci_probe(struct platform_device *pdev) - { - struct ar71xx_pci_controller *apc; -- struct resource *res; - u32 t; - - apc = devm_kzalloc(&pdev->dev, sizeof(struct ar71xx_pci_controller), -@@ -345,26 +361,6 @@ static int ar71xx_pci_probe(struct platf - if (apc->irq < 0) - return -EINVAL; - -- res = platform_get_resource_byname(pdev, IORESOURCE_IO, "io_base"); -- if (!res) -- return -EINVAL; -- -- apc->io_res.parent = res; -- apc->io_res.name = "PCI IO space"; -- apc->io_res.start = res->start; -- apc->io_res.end = res->end; -- apc->io_res.flags = IORESOURCE_IO; -- -- res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mem_base"); -- if (!res) -- return -EINVAL; -- -- apc->mem_res.parent = res; -- apc->mem_res.name = "PCI memory space"; -- apc->mem_res.start = res->start; -- apc->mem_res.end = res->end; -- apc->mem_res.flags = IORESOURCE_MEM; -- - ar71xx_pci_reset(); - - /* setup COMMAND register */ -@@ -377,9 +373,11 @@ static int ar71xx_pci_probe(struct platf - - ar71xx_pci_irq_init(apc); - -+ apc->np = pdev->dev.of_node; - apc->pci_ctrl.pci_ops = &ar71xx_pci_ops; - apc->pci_ctrl.mem_resource = &apc->mem_res; - apc->pci_ctrl.io_resource = &apc->io_res; -+ pci_load_of_ranges(&apc->pci_ctrl, pdev->dev.of_node); - - register_pci_controller(&apc->pci_ctrl); - -@@ -390,6 +388,7 @@ static struct platform_driver ar71xx_pci - .probe = ar71xx_pci_probe, - .driver = { - .name = "ar71xx-pci", -+ .of_match_table = of_match_ptr(ar71xx_pci_ids), - }, - }; - diff --git a/target/linux/ath79/patches-5.15/312-dt-bindings-PCI-qcom-ar7240-adds-binding-doc.patch b/target/linux/ath79/patches-5.15/312-dt-bindings-PCI-qcom-ar7240-adds-binding-doc.patch deleted file mode 100644 index a32c9bdcdef870..00000000000000 --- a/target/linux/ath79/patches-5.15/312-dt-bindings-PCI-qcom-ar7240-adds-binding-doc.patch +++ /dev/null @@ -1,61 +0,0 @@ -From ea27764bc3ef2a05decf3ae05edffc289cd0d93c Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Mon, 25 Jun 2018 15:52:02 +0200 -Subject: [PATCH 19/33] dt-bindings: PCI: qcom,ar7240: adds binding doc - -With the driver being converted from platform_data to pure OF, we need to -also add some docs. - -Cc: Rob Herring -Cc: devicetree@vger.kernel.org -Signed-off-by: John Crispin ---- - .../devicetree/bindings/pci/qcom,ar7240-pci.txt | 42 ++++++++++++++++++++++ - 1 file changed, 42 insertions(+) - create mode 100644 Documentation/devicetree/bindings/pci/qcom,ar7240-pci.txt - ---- /dev/null -+++ b/Documentation/devicetree/bindings/pci/qcom,ar7240-pci.txt -@@ -0,0 +1,42 @@ -+* Qualcomm Atheros AR724X PCI express root complex -+ -+Required properties: -+- compatible: should contain "qcom,ar7240-pci" to identify the core. -+- reg: Should contain the register ranges as listed in the reg-names property. -+- reg-names: Definition: Must include the following entries -+ - "crp_base" Configuration registers -+ - "ctrl_base" Control registers -+ - "cfg_base" IO Memory -+- #address-cells: set to <3> -+- #size-cells: set to <2> -+- ranges: ranges for the PCI memory and I/O regions -+- interrupt-map-mask and interrupt-map: standard PCI -+ properties to define the mapping of the PCIe interface to interrupt -+ numbers. -+- #interrupt-cells: set to <1> -+- interrupt-parent: phandle to the MIPS IRQ controller -+ -+Optional properties: -+- interrupt-controller: define to enable the builtin IRQ cascade. -+ -+* Example for qca9557 -+ pcie@180c0000 { -+ compatible = "qcom,ar7240-pci"; -+ #address-cells = <3>; -+ #size-cells = <2>; -+ bus-range = <0x0 0x0>; -+ reg = <0x180c0000 0x1000>, -+ <0x180f0000 0x100>, -+ <0x14000000 0x1000>; -+ reg-names = "crp_base", "ctrl_base", "cfg_base"; -+ ranges = <0x2000000 0 0x10000000 0x10000000 0 0x04000000 -+ 0x1000000 0 0x00000000 0x00000000 0 0x00000001>; -+ interrupt-parent = <&intc2>; -+ interrupts = <1>; -+ -+ interrupt-controller; -+ #interrupt-cells = <1>; -+ -+ interrupt-map-mask = <0 0 0 1>; -+ interrupt-map = <0 0 0 0 &pcie0 0>; -+ }; diff --git a/target/linux/ath79/patches-5.15/313-MIPS-pci-ar724x-convert-to-OF.patch b/target/linux/ath79/patches-5.15/313-MIPS-pci-ar724x-convert-to-OF.patch deleted file mode 100644 index 7927c1cbf5f87c..00000000000000 --- a/target/linux/ath79/patches-5.15/313-MIPS-pci-ar724x-convert-to-OF.patch +++ /dev/null @@ -1,213 +0,0 @@ -From a522ee0199d5d3ea114ca2e211f6ac398d3e8e0b Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Sat, 23 Jun 2018 15:07:37 +0200 -Subject: [PATCH 20/33] MIPS: pci-ar724x: convert to OF - -With the ath79 target getting converted to pure OF, we can drop all the -platform data code and add the missing OF bits to the driver. We also add -a irq domain for the PCI/e controllers cascade, thus making it usable from -dts files. - -Signed-off-by: John Crispin ---- - arch/mips/pci/pci-ar724x.c | 88 ++++++++++++++++++++++------------------------ - 1 file changed, 42 insertions(+), 46 deletions(-) - ---- a/arch/mips/pci/pci-ar724x.c -+++ b/arch/mips/pci/pci-ar724x.c -@@ -11,8 +11,11 @@ - #include - #include - #include -+#include - #include - #include -+#include -+#include - - #define AR724X_PCI_REG_APP 0x00 - #define AR724X_PCI_REG_RESET 0x18 -@@ -42,17 +45,20 @@ struct ar724x_pci_controller { - void __iomem *crp_base; - - int irq; -- int irq_base; - - bool link_up; - bool bar0_is_cached; - u32 bar0_value; - -+ struct device_node *np; - struct pci_controller pci_controller; -+ struct irq_domain *domain; - struct resource io_res; - struct resource mem_res; - }; - -+static struct irq_chip ar724x_pci_irq_chip; -+ - static inline bool ar724x_pci_check_link(struct ar724x_pci_controller *apc) - { - u32 reset; -@@ -228,35 +234,31 @@ static struct pci_ops ar724x_pci_ops = { - - static void ar724x_pci_irq_handler(struct irq_desc *desc) - { -- struct ar724x_pci_controller *apc; -- void __iomem *base; -+ struct irq_chip *chip = irq_desc_get_chip(desc); -+ struct ar724x_pci_controller *apc = irq_desc_get_handler_data(desc); - u32 pending; - -- apc = irq_desc_get_handler_data(desc); -- base = apc->ctrl_base; -- -- pending = __raw_readl(base + AR724X_PCI_REG_INT_STATUS) & -- __raw_readl(base + AR724X_PCI_REG_INT_MASK); -+ chained_irq_enter(chip, desc); -+ pending = __raw_readl(apc->ctrl_base + AR724X_PCI_REG_INT_STATUS) & -+ __raw_readl(apc->ctrl_base + AR724X_PCI_REG_INT_MASK); - - if (pending & AR724X_PCI_INT_DEV0) -- generic_handle_irq(apc->irq_base + 0); -- -+ generic_handle_irq(irq_linear_revmap(apc->domain, 1)); - else - spurious_interrupt(); -+ chained_irq_exit(chip, desc); - } - - static void ar724x_pci_irq_unmask(struct irq_data *d) - { - struct ar724x_pci_controller *apc; - void __iomem *base; -- int offset; - u32 t; - - apc = irq_data_get_irq_chip_data(d); - base = apc->ctrl_base; -- offset = apc->irq_base - d->irq; - -- switch (offset) { -+ switch (irq_linear_revmap(apc->domain, d->irq)) { - case 0: - t = __raw_readl(base + AR724X_PCI_REG_INT_MASK); - __raw_writel(t | AR724X_PCI_INT_DEV0, -@@ -270,14 +272,12 @@ static void ar724x_pci_irq_mask(struct i - { - struct ar724x_pci_controller *apc; - void __iomem *base; -- int offset; - u32 t; - - apc = irq_data_get_irq_chip_data(d); - base = apc->ctrl_base; -- offset = apc->irq_base - d->irq; - -- switch (offset) { -+ switch (irq_linear_revmap(apc->domain, d->irq)) { - case 0: - t = __raw_readl(base + AR724X_PCI_REG_INT_MASK); - __raw_writel(t & ~AR724X_PCI_INT_DEV0, -@@ -302,26 +302,34 @@ static struct irq_chip ar724x_pci_irq_ch - .irq_mask_ack = ar724x_pci_irq_mask, - }; - -+static int ar724x_pci_irq_map(struct irq_domain *d, -+ unsigned int irq, irq_hw_number_t hw) -+{ -+ struct ar724x_pci_controller *apc = d->host_data; -+ -+ irq_set_chip_and_handler(irq, &ar724x_pci_irq_chip, handle_level_irq); -+ irq_set_chip_data(irq, apc); -+ -+ return 0; -+} -+ -+static const struct irq_domain_ops ar724x_pci_domain_ops = { -+ .xlate = irq_domain_xlate_onecell, -+ .map = ar724x_pci_irq_map, -+}; -+ - static void ar724x_pci_irq_init(struct ar724x_pci_controller *apc, - int id) - { - void __iomem *base; -- int i; - - base = apc->ctrl_base; - - __raw_writel(0, base + AR724X_PCI_REG_INT_MASK); - __raw_writel(0, base + AR724X_PCI_REG_INT_STATUS); - -- apc->irq_base = ATH79_PCI_IRQ_BASE + (id * AR724X_PCI_IRQ_COUNT); -- -- for (i = apc->irq_base; -- i < apc->irq_base + AR724X_PCI_IRQ_COUNT; i++) { -- irq_set_chip_and_handler(i, &ar724x_pci_irq_chip, -- handle_level_irq); -- irq_set_chip_data(i, apc); -- } -- -+ apc->domain = irq_domain_add_linear(apc->np, 2, -+ &ar724x_pci_domain_ops, apc); - irq_set_chained_handler_and_data(apc->irq, ar724x_pci_irq_handler, - apc); - } -@@ -360,7 +368,6 @@ static void ar724x_pci_hw_init(struct ar - static int ar724x_pci_probe(struct platform_device *pdev) - { - struct ar724x_pci_controller *apc; -- struct resource *res; - int id; - - id = pdev->id; -@@ -388,29 +395,11 @@ static int ar724x_pci_probe(struct platf - if (apc->irq < 0) - return -EINVAL; - -- res = platform_get_resource_byname(pdev, IORESOURCE_IO, "io_base"); -- if (!res) -- return -EINVAL; -- -- apc->io_res.parent = res; -- apc->io_res.name = "PCI IO space"; -- apc->io_res.start = res->start; -- apc->io_res.end = res->end; -- apc->io_res.flags = IORESOURCE_IO; -- -- res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mem_base"); -- if (!res) -- return -EINVAL; -- -- apc->mem_res.parent = res; -- apc->mem_res.name = "PCI memory space"; -- apc->mem_res.start = res->start; -- apc->mem_res.end = res->end; -- apc->mem_res.flags = IORESOURCE_MEM; -- -+ apc->np = pdev->dev.of_node; - apc->pci_controller.pci_ops = &ar724x_pci_ops; - apc->pci_controller.io_resource = &apc->io_res; - apc->pci_controller.mem_resource = &apc->mem_res; -+ pci_load_of_ranges(&apc->pci_controller, pdev->dev.of_node); - - /* - * Do the full PCIE Root Complex Initialization Sequence if the PCIe -@@ -432,10 +421,16 @@ static int ar724x_pci_probe(struct platf - return 0; - } - -+static const struct of_device_id ar724x_pci_ids[] = { -+ { .compatible = "qcom,ar7240-pci" }, -+ {}, -+}; -+ - static struct platform_driver ar724x_pci_driver = { - .probe = ar724x_pci_probe, - .driver = { - .name = "ar724x-pci", -+ .of_match_table = of_match_ptr(ar724x_pci_ids), - }, - }; - diff --git a/target/linux/ath79/patches-5.15/314-MIPS-ath79-remove-irq-code-from-pci.patch b/target/linux/ath79/patches-5.15/314-MIPS-ath79-remove-irq-code-from-pci.patch deleted file mode 100644 index 01549eec68d342..00000000000000 --- a/target/linux/ath79/patches-5.15/314-MIPS-ath79-remove-irq-code-from-pci.patch +++ /dev/null @@ -1,149 +0,0 @@ -From: John Crispin -Subject: ath79: fix remove irq code from pci driver patch - -This patch got mangled in the void while rebasing it. - -Submitted-by: John Crispin ---- - arch/mips/pci/pci-ar71xx.c | 107 ------------------ - 1 file changed, 141 deletions(-) - ---- a/arch/mips/pci/pci-ar71xx.c -+++ b/arch/mips/pci/pci-ar71xx.c -@@ -51,11 +51,9 @@ - struct ar71xx_pci_controller { - struct device_node *np; - void __iomem *cfg_base; -- int irq; - struct pci_controller pci_ctrl; - struct resource io_res; - struct resource mem_res; -- struct irq_domain *domain; - }; - - /* Byte lane enable bits */ -@@ -227,104 +225,6 @@ static struct pci_ops ar71xx_pci_ops = { - .write = ar71xx_pci_write_config, - }; - --static void ar71xx_pci_irq_handler(struct irq_desc *desc) --{ -- void __iomem *base = ath79_reset_base; -- struct irq_chip *chip = irq_desc_get_chip(desc); -- struct ar71xx_pci_controller *apc = irq_desc_get_handler_data(desc); -- u32 pending; -- -- chained_irq_enter(chip, desc); -- pending = __raw_readl(base + AR71XX_RESET_REG_PCI_INT_STATUS) & -- __raw_readl(base + AR71XX_RESET_REG_PCI_INT_ENABLE); -- -- if (pending & AR71XX_PCI_INT_DEV0) -- generic_handle_irq(irq_linear_revmap(apc->domain, 1)); -- -- else if (pending & AR71XX_PCI_INT_DEV1) -- generic_handle_irq(irq_linear_revmap(apc->domain, 2)); -- -- else if (pending & AR71XX_PCI_INT_DEV2) -- generic_handle_irq(irq_linear_revmap(apc->domain, 3)); -- -- else if (pending & AR71XX_PCI_INT_CORE) -- generic_handle_irq(irq_linear_revmap(apc->domain, 4)); -- -- else -- spurious_interrupt(); -- chained_irq_exit(chip, desc); --} -- --static void ar71xx_pci_irq_unmask(struct irq_data *d) --{ -- struct ar71xx_pci_controller *apc; -- unsigned int irq; -- void __iomem *base = ath79_reset_base; -- u32 t; -- -- apc = irq_data_get_irq_chip_data(d); -- irq = irq_linear_revmap(apc->domain, d->irq); -- -- t = __raw_readl(base + AR71XX_RESET_REG_PCI_INT_ENABLE); -- __raw_writel(t | (1 << irq), base + AR71XX_RESET_REG_PCI_INT_ENABLE); -- -- /* flush write */ -- __raw_readl(base + AR71XX_RESET_REG_PCI_INT_ENABLE); --} -- --static void ar71xx_pci_irq_mask(struct irq_data *d) --{ -- struct ar71xx_pci_controller *apc; -- unsigned int irq; -- void __iomem *base = ath79_reset_base; -- u32 t; -- -- apc = irq_data_get_irq_chip_data(d); -- irq = irq_linear_revmap(apc->domain, d->irq); -- -- t = __raw_readl(base + AR71XX_RESET_REG_PCI_INT_ENABLE); -- __raw_writel(t & ~(1 << irq), base + AR71XX_RESET_REG_PCI_INT_ENABLE); -- -- /* flush write */ -- __raw_readl(base + AR71XX_RESET_REG_PCI_INT_ENABLE); --} -- --static struct irq_chip ar71xx_pci_irq_chip = { -- .name = "AR71XX PCI", -- .irq_mask = ar71xx_pci_irq_mask, -- .irq_unmask = ar71xx_pci_irq_unmask, -- .irq_mask_ack = ar71xx_pci_irq_mask, --}; -- --static int ar71xx_pci_irq_map(struct irq_domain *d, -- unsigned int irq, irq_hw_number_t hw) --{ -- struct ar71xx_pci_controller *apc = d->host_data; -- -- irq_set_chip_and_handler(irq, &ar71xx_pci_irq_chip, handle_level_irq); -- irq_set_chip_data(irq, apc); -- -- return 0; --} -- --static const struct irq_domain_ops ar71xx_pci_domain_ops = { -- .xlate = irq_domain_xlate_onecell, -- .map = ar71xx_pci_irq_map, --}; -- --static void ar71xx_pci_irq_init(struct ar71xx_pci_controller *apc) --{ -- void __iomem *base = ath79_reset_base; -- -- __raw_writel(0, base + AR71XX_RESET_REG_PCI_INT_ENABLE); -- __raw_writel(0, base + AR71XX_RESET_REG_PCI_INT_STATUS); -- -- apc->domain = irq_domain_add_linear(apc->np, AR71XX_PCI_IRQ_COUNT, -- &ar71xx_pci_domain_ops, apc); -- irq_set_chained_handler_and_data(apc->irq, ar71xx_pci_irq_handler, -- apc); --} -- - static void ar71xx_pci_reset(void) - { - ath79_device_reset_set(AR71XX_RESET_PCI_BUS | AR71XX_RESET_PCI_CORE); -@@ -357,10 +257,6 @@ static int ar71xx_pci_probe(struct platf - if (IS_ERR(apc->cfg_base)) - return PTR_ERR(apc->cfg_base); - -- apc->irq = platform_get_irq(pdev, 0); -- if (apc->irq < 0) -- return -EINVAL; -- - ar71xx_pci_reset(); - - /* setup COMMAND register */ -@@ -371,8 +267,6 @@ static int ar71xx_pci_probe(struct platf - /* clear bus errors */ - ar71xx_pci_check_error(apc, 1); - -- ar71xx_pci_irq_init(apc); -- - apc->np = pdev->dev.of_node; - apc->pci_ctrl.pci_ops = &ar71xx_pci_ops; - apc->pci_ctrl.mem_resource = &apc->mem_res; diff --git a/target/linux/ath79/patches-5.15/315-MIPS-pci-ar724x-add-QCA9550-reset-sequence.patch b/target/linux/ath79/patches-5.15/315-MIPS-pci-ar724x-add-QCA9550-reset-sequence.patch deleted file mode 100644 index 375dec8ba2b675..00000000000000 --- a/target/linux/ath79/patches-5.15/315-MIPS-pci-ar724x-add-QCA9550-reset-sequence.patch +++ /dev/null @@ -1,130 +0,0 @@ -From: David Bauer -Date: Sat, 11 Apr 2020 14:03:12 +0200 -Subject: MIPS: pci-ar724x: add QCA9550 reset sequence - -The QCA9550 family of SoCs have a slightly different reset -sequence compared to older chips. - -Normally the bootloader performs this sequence, however -some bootloader implementation expect the operating system -to clear the reset. - -Also get the resets from OF to support handling of the second -PCIe root-complex on the QCA9558. - -Signed-off-by: David Bauer - ---- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -+++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -@@ -390,6 +390,7 @@ - #define QCA955X_PLL_CPU_CONFIG_REG 0x00 - #define QCA955X_PLL_DDR_CONFIG_REG 0x04 - #define QCA955X_PLL_CLK_CTRL_REG 0x08 -+#define QCA955X_PLL_PCIE_CONFIG_REG 0x0c - #define QCA955X_PLL_ETH_XMII_CONTROL_REG 0x28 - #define QCA955X_PLL_ETH_SGMII_CONTROL_REG 0x48 - #define QCA955X_PLL_ETH_SGMII_SERDES_REG 0x4c -@@ -475,6 +476,9 @@ - #define QCA956X_PLL_CLK_CTRL_CPU_DDRCLK_FROM_CPUPLL BIT(21) - #define QCA956X_PLL_CLK_CTRL_AHBCLK_FROM_DDRPLL BIT(24) - -+#define QCA955X_PLL_PCIE_CONFIG_PLL_PWD BIT(30) -+#define QCA955X_PLL_PCIE_CONFIG_PLL_BYPASS BIT(16) -+ - #define QCA956X_PLL_SWITCH_CLOCK_SPARE_I2C_CLK_SELB BIT(5) - #define QCA956X_PLL_SWITCH_CLOCK_SPARE_MDIO_CLK_SEL0_1 BIT(6) - #define QCA956X_PLL_SWITCH_CLOCK_SPARE_UART1_CLK_SEL BIT(7) ---- a/arch/mips/pci/pci-ar724x.c -+++ b/arch/mips/pci/pci-ar724x.c -@@ -8,6 +8,7 @@ - - #include - #include -+#include - #include - #include - #include -@@ -55,6 +56,9 @@ struct ar724x_pci_controller { - struct irq_domain *domain; - struct resource io_res; - struct resource mem_res; -+ -+ struct reset_control *hc_reset; -+ struct reset_control *phy_reset; - }; - - static struct irq_chip ar724x_pci_irq_chip; -@@ -340,18 +344,30 @@ static void ar724x_pci_hw_init(struct ar - int wait = 0; - - /* deassert PCIe host controller and PCIe PHY reset */ -- ath79_device_reset_clear(AR724X_RESET_PCIE); -- ath79_device_reset_clear(AR724X_RESET_PCIE_PHY); -+ reset_control_deassert(apc->hc_reset); -+ reset_control_deassert(apc->phy_reset); - -- /* remove the reset of the PCIE PLL */ -- ppl = ath79_pll_rr(AR724X_PLL_REG_PCIE_CONFIG); -- ppl &= ~AR724X_PLL_REG_PCIE_CONFIG_PPL_RESET; -- ath79_pll_wr(AR724X_PLL_REG_PCIE_CONFIG, ppl); -- -- /* deassert bypass for the PCIE PLL */ -- ppl = ath79_pll_rr(AR724X_PLL_REG_PCIE_CONFIG); -- ppl &= ~AR724X_PLL_REG_PCIE_CONFIG_PPL_BYPASS; -- ath79_pll_wr(AR724X_PLL_REG_PCIE_CONFIG, ppl); -+ if (of_device_is_compatible(apc->np, "qcom,qca9550-pci")) { -+ /* remove the reset of the PCIE PLL */ -+ ppl = ath79_pll_rr(QCA955X_PLL_PCIE_CONFIG_REG); -+ ppl &= ~QCA955X_PLL_PCIE_CONFIG_PLL_PWD; -+ ath79_pll_wr(QCA955X_PLL_PCIE_CONFIG_REG, ppl); -+ -+ /* deassert bypass for the PCIE PLL */ -+ ppl = ath79_pll_rr(QCA955X_PLL_PCIE_CONFIG_REG); -+ ppl &= ~QCA955X_PLL_PCIE_CONFIG_PLL_BYPASS; -+ ath79_pll_wr(QCA955X_PLL_PCIE_CONFIG_REG, ppl); -+ } else { -+ /* remove the reset of the PCIE PLL */ -+ ppl = ath79_pll_rr(AR724X_PLL_REG_PCIE_CONFIG); -+ ppl &= ~AR724X_PLL_REG_PCIE_CONFIG_PPL_RESET; -+ ath79_pll_wr(AR724X_PLL_REG_PCIE_CONFIG, ppl); -+ -+ /* deassert bypass for the PCIE PLL */ -+ ppl = ath79_pll_rr(AR724X_PLL_REG_PCIE_CONFIG); -+ ppl &= ~AR724X_PLL_REG_PCIE_CONFIG_PPL_BYPASS; -+ ath79_pll_wr(AR724X_PLL_REG_PCIE_CONFIG, ppl); -+ } - - /* set PCIE Application Control to ready */ - app = __raw_readl(apc->ctrl_base + AR724X_PCI_REG_APP); -@@ -395,6 +411,14 @@ static int ar724x_pci_probe(struct platf - if (apc->irq < 0) - return -EINVAL; - -+ apc->hc_reset = devm_reset_control_get_exclusive(&pdev->dev, "hc"); -+ if (IS_ERR(apc->hc_reset)) -+ return PTR_ERR(apc->hc_reset); -+ -+ apc->phy_reset = devm_reset_control_get_exclusive(&pdev->dev, "phy"); -+ if (IS_ERR(apc->phy_reset)) -+ return PTR_ERR(apc->phy_reset); -+ - apc->np = pdev->dev.of_node; - apc->pci_controller.pci_ops = &ar724x_pci_ops; - apc->pci_controller.io_resource = &apc->io_res; -@@ -405,7 +429,7 @@ static int ar724x_pci_probe(struct platf - * Do the full PCIE Root Complex Initialization Sequence if the PCIe - * host controller is in reset. - */ -- if (ath79_reset_rr(AR724X_RESET_REG_RESET_MODULE) & AR724X_RESET_PCIE) -+ if (reset_control_status(apc->hc_reset)) - ar724x_pci_hw_init(apc); - - apc->link_up = ar724x_pci_check_link(apc); -@@ -423,6 +447,7 @@ static int ar724x_pci_probe(struct platf - - static const struct of_device_id ar724x_pci_ids[] = { - { .compatible = "qcom,ar7240-pci" }, -+ { .compatible = "qcom,qca9550-pci" }, - {}, - }; - diff --git a/target/linux/ath79/patches-5.15/316-MIPS-ath79-swizzle-pci-address-for-ar71xx.patch b/target/linux/ath79/patches-5.15/316-MIPS-ath79-swizzle-pci-address-for-ar71xx.patch deleted file mode 100644 index 1e2715b84c3677..00000000000000 --- a/target/linux/ath79/patches-5.15/316-MIPS-ath79-swizzle-pci-address-for-ar71xx.patch +++ /dev/null @@ -1,109 +0,0 @@ -From: Gabor Juhos -Subject: [PATCH] ar71xx: swizzle address for PCI byte/word access on AR71xx - -Closes #11683. - -SVN-Revision: 32639 ---- - .../mips/include/asm/mach-ath79/mangle-port.h | 111 ++++++++++++++++++ - 1 file changed, 111 insertions(+) - create mode 100644 arch/mips/include/asm/mach-ath79/mangle-port.h - ---- /dev/null -+++ b/arch/mips/include/asm/mach-ath79/mangle-port.h -@@ -0,0 +1,37 @@ -+/* -+ * Copyright (C) 2012 Gabor Juhos -+ * -+ * This file was derived from: inlude/asm-mips/mach-generic/mangle-port.h -+ * Copyright (C) 2003, 2004 Ralf Baechle -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published -+ * by the Free Software Foundation. -+ */ -+ -+#ifndef __ASM_MACH_ATH79_MANGLE_PORT_H -+#define __ASM_MACH_ATH79_MANGLE_PORT_H -+ -+#ifdef CONFIG_PCI_AR71XX -+extern unsigned long (ath79_pci_swizzle_b)(unsigned long port); -+extern unsigned long (ath79_pci_swizzle_w)(unsigned long port); -+#else -+#define ath79_pci_swizzle_b(port) (port) -+#define ath79_pci_swizzle_w(port) (port) -+#endif -+ -+#define __swizzle_addr_b(port) ath79_pci_swizzle_b(port) -+#define __swizzle_addr_w(port) ath79_pci_swizzle_w(port) -+#define __swizzle_addr_l(port) (port) -+#define __swizzle_addr_q(port) (port) -+ -+# define ioswabb(a, x) (x) -+# define __mem_ioswabb(a, x) (x) -+# define ioswabw(a, x) (x) -+# define __mem_ioswabw(a, x) cpu_to_le16(x) -+# define ioswabl(a, x) (x) -+# define __mem_ioswabl(a, x) cpu_to_le32(x) -+# define ioswabq(a, x) (x) -+# define __mem_ioswabq(a, x) cpu_to_le64(x) -+ -+#endif /* __ASM_MACH_ATH79_MANGLE_PORT_H */ ---- a/arch/mips/pci/pci-ar71xx.c -+++ b/arch/mips/pci/pci-ar71xx.c -@@ -68,6 +68,45 @@ static const u32 ar71xx_pci_read_mask[8] - 0, 0xff, 0xffff, 0, 0xffffffff, 0, 0, 0 - }; - -+static unsigned long (*__ath79_pci_swizzle_b)(unsigned long port); -+static unsigned long (*__ath79_pci_swizzle_w)(unsigned long port); -+ -+static inline bool ar71xx_is_pci_addr(unsigned long port) -+{ -+ unsigned long phys = CPHYSADDR(port); -+ -+ return (phys >= AR71XX_PCI_MEM_BASE && -+ phys < AR71XX_PCI_MEM_BASE + AR71XX_PCI_MEM_SIZE); -+} -+ -+static unsigned long ar71xx_pci_swizzle_b(unsigned long port) -+{ -+ return ar71xx_is_pci_addr(port) ? port ^ 3 : port; -+} -+ -+static unsigned long ar71xx_pci_swizzle_w(unsigned long port) -+{ -+ return ar71xx_is_pci_addr(port) ? port ^ 2 : port; -+} -+ -+unsigned long ath79_pci_swizzle_b(unsigned long port) -+{ -+ if (__ath79_pci_swizzle_b) -+ return __ath79_pci_swizzle_b(port); -+ -+ return port; -+} -+EXPORT_SYMBOL(ath79_pci_swizzle_b); -+ -+unsigned long ath79_pci_swizzle_w(unsigned long port) -+{ -+ if (__ath79_pci_swizzle_w) -+ return __ath79_pci_swizzle_w(port); -+ -+ return port; -+} -+EXPORT_SYMBOL(ath79_pci_swizzle_w); -+ - static inline u32 ar71xx_pci_get_ble(int where, int size, int local) - { - u32 t; -@@ -275,6 +314,9 @@ static int ar71xx_pci_probe(struct platf - - register_pci_controller(&apc->pci_ctrl); - -+ __ath79_pci_swizzle_b = ar71xx_pci_swizzle_b; -+ __ath79_pci_swizzle_w = ar71xx_pci_swizzle_w; -+ - return 0; - } - diff --git a/target/linux/ath79/patches-5.15/330-missing-registers.patch b/target/linux/ath79/patches-5.15/330-missing-registers.patch deleted file mode 100644 index 74789437ec945f..00000000000000 --- a/target/linux/ath79/patches-5.15/330-missing-registers.patch +++ /dev/null @@ -1,20 +0,0 @@ -From: Christian Lamparter -Subject: [PATCH] ath79: gmac: add parsers for rxd(v)- and tx(d|en)-delay for - - ath79: gmac: add parsers for rxd(v)- and tx(d|en)-delay for AR9344 - - Signed-off-by: Christian Lamparter - ---- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -+++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -@@ -1231,6 +1231,10 @@ - #define AR934X_ETH_CFG_RDV_DELAY BIT(16) - #define AR934X_ETH_CFG_RDV_DELAY_MASK 0x3 - #define AR934X_ETH_CFG_RDV_DELAY_SHIFT 16 -+#define AR934X_ETH_CFG_TXD_DELAY_MASK 0x3 -+#define AR934X_ETH_CFG_TXD_DELAY_SHIFT 18 -+#define AR934X_ETH_CFG_TXE_DELAY_MASK 0x3 -+#define AR934X_ETH_CFG_TXE_DELAY_SHIFT 20 - - /* - * QCA953X GMAC Interface diff --git a/target/linux/ath79/patches-5.15/331-MIPS-ath79-add-missing-QCA955x-GMAC-registers.patch b/target/linux/ath79/patches-5.15/331-MIPS-ath79-add-missing-QCA955x-GMAC-registers.patch deleted file mode 100644 index c2f228dfe1e07b..00000000000000 --- a/target/linux/ath79/patches-5.15/331-MIPS-ath79-add-missing-QCA955x-GMAC-registers.patch +++ /dev/null @@ -1,90 +0,0 @@ -From 60efe35257b063ce584968f9f80b437030ce6ba6 Mon Sep 17 00:00:00 2001 -From: David Bauer -Date: Mon, 18 Mar 2019 00:54:06 +0100 -Subject: [PATCH] MIPS: ath79: add missing QCA955x GMAC registers - -This adds missing GMAC register definitions for the Qualcomm Atheros -QCA955X series MIPS SoCs. - -They originate from the platforms U-Boot code and the AVM FRITZ!WLAN -Repeater 450E's GPL tarball. - -Signed-off-by: David Bauer ---- - .../mips/include/asm/mach-ath79/ar71xx_regs.h | 54 +++++++++++++++++++ - 1 file changed, 54 insertions(+) - ---- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -+++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -@@ -1251,7 +1251,12 @@ - */ - - #define QCA955X_GMAC_REG_ETH_CFG 0x00 -+#define QCA955X_GMAC_REG_SGMII_RESET 0x14 - #define QCA955X_GMAC_REG_SGMII_SERDES 0x18 -+#define QCA955X_GMAC_REG_MR_AN_CONTROL 0x1c -+#define QCA955X_GMAC_REG_MR_AN_STATUS 0x20 -+#define QCA955X_GMAC_REG_SGMII_CONFIG 0x34 -+#define QCA955X_GMAC_REG_SGMII_DEBUG 0x58 - - #define QCA955X_ETH_CFG_RGMII_EN BIT(0) - #define QCA955X_ETH_CFG_MII_GE0 BIT(1) -@@ -1273,9 +1278,58 @@ - #define QCA955X_ETH_CFG_TXE_DELAY_MASK 0x3 - #define QCA955X_ETH_CFG_TXE_DELAY_SHIFT 20 - -+#define QCA955X_SGMII_RESET_RX_CLK_N_RESET 0 -+#define QCA955X_SGMII_RESET_RX_CLK_N BIT(0) -+#define QCA955X_SGMII_RESET_TX_CLK_N BIT(1) -+#define QCA955X_SGMII_RESET_RX_125M_N BIT(2) -+#define QCA955X_SGMII_RESET_TX_125M_N BIT(3) -+#define QCA955X_SGMII_RESET_HW_RX_125M_N BIT(4) -+ - #define QCA955X_SGMII_SERDES_LOCK_DETECT_STATUS BIT(15) - #define QCA955X_SGMII_SERDES_RES_CALIBRATION_SHIFT 23 - #define QCA955X_SGMII_SERDES_RES_CALIBRATION_MASK 0xf -+ -+#define QCA955X_MR_AN_CONTROL_SPEED_SEL1 BIT(6) -+#define QCA955X_MR_AN_CONTROL_DUPLEX_MODE BIT(8) -+#define QCA955X_MR_AN_CONTROL_RESTART_AN BIT(9) -+#define QCA955X_MR_AN_CONTROL_POWER_DOWN BIT(11) -+#define QCA955X_MR_AN_CONTROL_AN_ENABLE BIT(12) -+#define QCA955X_MR_AN_CONTROL_SPEED_SEL0 BIT(13) -+#define QCA955X_MR_AN_CONTROL_LOOPBACK BIT(14) -+#define QCA955X_MR_AN_CONTROL_PHY_RESET BIT(15) -+ -+#define QCA955X_MR_AN_STATUS_EXT_CAP BIT(0) -+#define QCA955X_MR_AN_STATUS_LINK_UP BIT(2) -+#define QCA955X_MR_AN_STATUS_AN_ABILITY BIT(3) -+#define QCA955X_MR_AN_STATUS_REMOTE_FAULT BIT(4) -+#define QCA955X_MR_AN_STATUS_AN_COMPLETE BIT(5) -+#define QCA955X_MR_AN_STATUS_NO_PREAMBLE BIT(6) -+#define QCA955X_MR_AN_STATUS_BASE_PAGE BIT(7) -+ -+#define QCA955X_SGMII_CONFIG_MODE_CTRL_SHIFT 0 -+#define QCA955X_SGMII_CONFIG_MODE_CTRL_MASK 0x7 -+#define QCA955X_SGMII_CONFIG_ENABLE_SGMII_TX_PAUSE BIT(3) -+#define QCA955X_SGMII_CONFIG_MR_REG4_CHANGED BIT(4) -+#define QCA955X_SGMII_CONFIG_FORCE_SPEED BIT(5) -+#define QCA955X_SGMII_CONFIG_SPEED_SHIFT 6 -+#define QCA955X_SGMII_CONFIG_SPEED_MASK 0xc0 -+#define QCA955X_SGMII_CONFIG_REMOTE_PHY_LOOPBACK BIT(8) -+#define QCA955X_SGMII_CONFIG_NEXT_PAGE_LOADED BIT(9) -+#define QCA955X_SGMII_CONFIG_MDIO_ENABLE BIT(10) -+#define QCA955X_SGMII_CONFIG_MDIO_PULSE BIT(11) -+#define QCA955X_SGMII_CONFIG_MDIO_COMPLETE BIT(12) -+#define QCA955X_SGMII_CONFIG_PRBS_ENABLE BIT(13) -+#define QCA955X_SGMII_CONFIG_BERT_ENABLE BIT(14) -+ -+#define QCA955X_SGMII_DEBUG_TX_STATE_MASK 0xff -+#define QCA955X_SGMII_DEBUG_TX_STATE_SHIFT 0 -+#define QCA955X_SGMII_DEBUG_RX_STATE_MASK 0xff00 -+#define QCA955X_SGMII_DEBUG_RX_STATE_SHIFT 8 -+#define QCA955X_SGMII_DEBUG_RX_SYNC_STATE_MASK 0xff0000 -+#define QCA955X_SGMII_DEBUG_RX_SYNC_STATE_SHIFT 16 -+#define QCA955X_SGMII_DEBUG_ARB_STATE_MASK 0xf000000 -+#define QCA955X_SGMII_DEBUG_ARB_STATE_SHIFT 24 -+ - /* - * QCA956X GMAC Interface - */ diff --git a/target/linux/ath79/patches-5.15/332-ath79-sgmii-config.patch b/target/linux/ath79/patches-5.15/332-ath79-sgmii-config.patch deleted file mode 100644 index a6a50e4a8ab492..00000000000000 --- a/target/linux/ath79/patches-5.15/332-ath79-sgmii-config.patch +++ /dev/null @@ -1,30 +0,0 @@ -From: David Bauer -Subject: [PATCH] ath79: force SGMII SerDes mode to MAC operation - -The mode on the SGMII SerDes on the QCA9563 is 1000 Base-X by default. -This only allows for 1000 Mbit/s links, however when used with an SGMII -PHY in 100 Mbit/s link mode, the link remains dead. - -This strictly has nothing to do with the SerDes calibration, however it -is done at the same point in the QCA reference U-Boot which is the -blueprint for everything happening here. As the current state is more or -less a hack, this should be fine. - -This fixes the issues outlined above on a TP-Link EAP-225 Outdoor. - -Reported-by: Tom Herbers -Tested-by: Tom Herbers -Submitted-by: David Bauer ---- - arch/mips/include/asm/mach-ath79/ar71xx_regs.h | 1 + - 1 files changed, 1 insertion(+) - ---- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -+++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -@@ -1380,5 +1380,6 @@ - - #define QCA956X_SGMII_CONFIG_MODE_CTRL_SHIFT 0 - #define QCA956X_SGMII_CONFIG_MODE_CTRL_MASK 0x7 -+#define QCA956X_SGMII_CONFIG_MODE_CTRL_SGMII_MAC 0x2 - - #endif /* __ASM_MACH_AR71XX_REGS_H */ diff --git a/target/linux/ath79/patches-5.15/340-register_gpio_driver_earlier.patch b/target/linux/ath79/patches-5.15/340-register_gpio_driver_earlier.patch deleted file mode 100644 index a8680ceac4f2e5..00000000000000 --- a/target/linux/ath79/patches-5.15/340-register_gpio_driver_earlier.patch +++ /dev/null @@ -1,26 +0,0 @@ -From: John Crispin -Subject: ath79: Register GPIO driver earlier - -HACK: register the GPIO driver earlier to ensure that gpio_request calls -from mach files succeed. - -Submitted-by: John Crispin ---- - drivers/gpio/gpio-ath79.c | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - ---- a/drivers/gpio/gpio-ath79.c -+++ b/drivers/gpio/gpio-ath79.c -@@ -297,7 +297,11 @@ static struct platform_driver ath79_gpio - .probe = ath79_gpio_probe, - }; - --module_platform_driver(ath79_gpio_driver); -+static int __init ath79_gpio_init(void) -+{ -+ return platform_driver_register(&ath79_gpio_driver); -+} -+postcore_initcall(ath79_gpio_init); - - MODULE_DESCRIPTION("Atheros AR71XX/AR724X/AR913X GPIO API support"); - MODULE_LICENSE("GPL v2"); diff --git a/target/linux/ath79/patches-5.15/350-MIPS-ath79-ath9k-exports.patch b/target/linux/ath79/patches-5.15/350-MIPS-ath79-ath9k-exports.patch deleted file mode 100644 index e460fe58f3fc04..00000000000000 --- a/target/linux/ath79/patches-5.15/350-MIPS-ath79-ath9k-exports.patch +++ /dev/null @@ -1,36 +0,0 @@ -From: John Crispin -Subject: [PATCH] ath79: make ahb wifi work - -Submitted-by: John Crispin ---- - arch/mips/ath79/common.c | 3 +++ - mips/include/asm/mach-ath79/ath79.h | 1+ - 1 file changed, 4 insertions(+) - ---- a/arch/mips/ath79/common.c -+++ b/arch/mips/ath79/common.c -@@ -31,11 +31,13 @@ EXPORT_SYMBOL_GPL(ath79_ddr_freq); - - enum ath79_soc_type ath79_soc; - unsigned int ath79_soc_rev; -+EXPORT_SYMBOL_GPL(ath79_soc_rev); - - void __iomem *ath79_pll_base; - void __iomem *ath79_reset_base; - EXPORT_SYMBOL_GPL(ath79_reset_base); --static void __iomem *ath79_ddr_base; -+void __iomem *ath79_ddr_base; -+EXPORT_SYMBOL_GPL(ath79_ddr_base); - static void __iomem *ath79_ddr_wb_flush_base; - static void __iomem *ath79_ddr_pci_win_base; - ---- a/arch/mips/include/asm/mach-ath79/ath79.h -+++ b/arch/mips/include/asm/mach-ath79/ath79.h -@@ -149,6 +149,7 @@ void ath79_ddr_wb_flush(unsigned int reg - void ath79_ddr_set_pci_windows(void); - - extern void __iomem *ath79_pll_base; -+extern void __iomem *ath79_ddr_base; - extern void __iomem *ath79_reset_base; - - static inline void ath79_pll_wr(unsigned reg, u32 val) diff --git a/target/linux/ath79/patches-5.15/351-MIPS-ath79-common-exports.patch b/target/linux/ath79/patches-5.15/351-MIPS-ath79-common-exports.patch deleted file mode 100644 index befcf2d50f1d80..00000000000000 --- a/target/linux/ath79/patches-5.15/351-MIPS-ath79-common-exports.patch +++ /dev/null @@ -1,26 +0,0 @@ -From: Luiz Angelo Daros de Luca -Subject: [PATCH] ath79: export ath79_pll_base - -This symbol is declared as extern but nobody exported it. -Any module including arch/mips/include/asm/mach-ath79/ath79.h -will not build. Without this export, ag71xx.ko will not build -as a module and the build will fail like this: - -ERROR: modpost: "ath79_pll_base" [drivers/net/ethernet/atheros/ag71xx/ag71xx.ko] undefined! - -The ath79_pll_base symbol is accessed in the ath79_pll_wr() inline function. - ---- - arch/mips/ath79/common.c | 1 + - 1 file changed, 1 insertions(+) - ---- a/arch/mips/ath79/common.c -+++ b/arch/mips/ath79/common.c -@@ -34,6 +34,7 @@ unsigned int ath79_soc_rev; - EXPORT_SYMBOL_GPL(ath79_soc_rev); - - void __iomem *ath79_pll_base; -+EXPORT_SYMBOL_GPL(ath79_pll_base); - void __iomem *ath79_reset_base; - EXPORT_SYMBOL_GPL(ath79_reset_base); - void __iomem *ath79_ddr_base; diff --git a/target/linux/ath79/patches-5.15/360-MIPS-ath79-export-UART1-reference-clock.patch b/target/linux/ath79/patches-5.15/360-MIPS-ath79-export-UART1-reference-clock.patch deleted file mode 100644 index b24ff216928f60..00000000000000 --- a/target/linux/ath79/patches-5.15/360-MIPS-ath79-export-UART1-reference-clock.patch +++ /dev/null @@ -1,67 +0,0 @@ -From: Daniel Golle -Subject: [PATCH] ath79: add support for Atheros AR934x HS UART - -AR934x chips also got the 'old' qca,ar9330-uart in addition to the -'new' ns16550a compatible one. Add support for UART1 clock selector as -well as device-tree bindings in ar934x.dtsi to make use of that uart. - -Reported-by: Piotr Dymacz -Submitted-by: Daniel Golle ---- - arch/mips/ath79/clock.c | 7 +++++++ - .../mips/include/asm/mach-ath79/ar71xx_regs.h | 1 + - include/dt-bindings/clock/ath79-clk.h | 3 ++- - 3 files changed, 10 insertions(+), 1 deletion(-) - ---- a/arch/mips/ath79/clock.c -+++ b/arch/mips/ath79/clock.c -@@ -40,6 +40,7 @@ static const char * const clk_names[ATH7 - [ATH79_CLK_AHB] = "ahb", - [ATH79_CLK_REF] = "ref", - [ATH79_CLK_MDIO] = "mdio", -+ [ATH79_CLK_UART1] = "uart1", - }; - - static const char * __init ath79_clk_name(int type) -@@ -344,6 +345,9 @@ static void __init ar934x_clocks_init(vo - if (clk_ctrl & AR934X_PLL_SWITCH_CLOCK_CONTROL_MDIO_CLK_SEL) - ath79_set_clk(ATH79_CLK_MDIO, 100 * 1000 * 1000); - -+ if (clk_ctrl & AR934X_PLL_SWITCH_CLOCK_CONTROL_UART1_CLK_SEL) -+ ath79_set_clk(ATH79_CLK_UART1, 100 * 1000 * 1000); -+ - iounmap(dpll_base); - } - -@@ -649,6 +653,9 @@ static void __init ath79_clocks_init_dt( - if (!clks[ATH79_CLK_MDIO]) - clks[ATH79_CLK_MDIO] = clks[ATH79_CLK_REF]; - -+ if (!clks[ATH79_CLK_UART1]) -+ clks[ATH79_CLK_UART1] = clks[ATH79_CLK_REF]; -+ - if (of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data)) { - pr_err("%pOF: could not register clk provider\n", np); - goto err_iounmap; ---- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -+++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h -@@ -348,6 +348,7 @@ - #define AR934X_PLL_CPU_DDR_CLK_CTRL_AHBCLK_FROM_DDRPLL BIT(24) - - #define AR934X_PLL_SWITCH_CLOCK_CONTROL_MDIO_CLK_SEL BIT(6) -+#define AR934X_PLL_SWITCH_CLOCK_CONTROL_UART1_CLK_SEL BIT(7) - - #define QCA953X_PLL_CPU_CONFIG_REG 0x00 - #define QCA953X_PLL_DDR_CONFIG_REG 0x04 ---- a/include/dt-bindings/clock/ath79-clk.h -+++ b/include/dt-bindings/clock/ath79-clk.h -@@ -11,7 +11,8 @@ - #define ATH79_CLK_AHB 2 - #define ATH79_CLK_REF 3 - #define ATH79_CLK_MDIO 4 -+#define ATH79_CLK_UART1 5 - --#define ATH79_CLK_END 5 -+#define ATH79_CLK_END 6 - - #endif /* __DT_BINDINGS_ATH79_CLK_H */ diff --git a/target/linux/ath79/patches-5.15/370-MIPS-ath79-sanitize-symbols.patch b/target/linux/ath79/patches-5.15/370-MIPS-ath79-sanitize-symbols.patch deleted file mode 100644 index 5eb23ba6c658f9..00000000000000 --- a/target/linux/ath79/patches-5.15/370-MIPS-ath79-sanitize-symbols.patch +++ /dev/null @@ -1,93 +0,0 @@ -From 3fc8585cf76022dba7496627074d42af88c30718 Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Sat, 23 Jun 2018 15:16:55 +0200 -Subject: [PATCH 32/33] MIPS: ath79: sanitize symbols - -We no longer need to select which SoCs are supported as the whole arch -code is always built. So lets drop all the SoC symbols - -Signed-off-by: John Crispin ---- - arch/mips/Kconfig | 2 ++ - arch/mips/ath79/Kconfig | 44 +++++--------------------------------------- - arch/mips/pci/Makefile | 2 +- - 3 files changed, 8 insertions(+), 40 deletions(-) - ---- a/arch/mips/Kconfig -+++ b/arch/mips/Kconfig -@@ -258,6 +258,8 @@ config ATH79 - select SYS_SUPPORTS_BIG_ENDIAN - select SYS_SUPPORTS_MIPS16 - select SYS_SUPPORTS_ZBOOT_UART_PROM -+ select HAVE_PCI -+ select USB_ARCH_HAS_EHCI - select USE_OF - select USB_EHCI_ROOT_HUB_TT if USB_EHCI_HCD_PLATFORM - help ---- a/arch/mips/ath79/Kconfig -+++ b/arch/mips/ath79/Kconfig -@@ -1,48 +1,14 @@ - # SPDX-License-Identifier: GPL-2.0 - if ATH79 - --config SOC_AR71XX -- select HAVE_PCI -- def_bool n -- --config SOC_AR724X -- select HAVE_PCI -- select PCI_AR724X if PCI -- def_bool n -- --config SOC_AR913X -- def_bool n -- --config SOC_AR933X -- def_bool n -- --config SOC_AR934X -- select HAVE_PCI -- select PCI_AR724X if PCI -- def_bool n -- --config SOC_QCA955X -- select HAVE_PCI -- select PCI_AR724X if PCI -+config PCI_AR71XX -+ bool "PCI support for AR7100 type SoCs" -+ depends on PCI - def_bool n - - config PCI_AR724X -- def_bool n -- --config ATH79_DEV_GPIO_BUTTONS -- def_bool n -- --config ATH79_DEV_LEDS_GPIO -- def_bool n -- --config ATH79_DEV_SPI -- def_bool n -- --config ATH79_DEV_USB -- def_bool n -- --config ATH79_DEV_WMAC -- depends on (SOC_AR913X || SOC_AR933X || SOC_AR934X || SOC_QCA955X) -+ bool "PCI support for AR724x type SoCs" -+ depends on PCI - def_bool n - - endif ---- a/arch/mips/pci/Makefile -+++ b/arch/mips/pci/Makefile -@@ -21,7 +21,7 @@ obj-$(CONFIG_BCM63XX) += pci-bcm63xx.o - ops-bcm63xx.o - obj-$(CONFIG_MIPS_ALCHEMY) += pci-alchemy.o - obj-$(CONFIG_PCI_AR2315) += pci-ar2315.o --obj-$(CONFIG_SOC_AR71XX) += pci-ar71xx.o -+obj-$(CONFIG_PCI_AR71XX) += pci-ar71xx.o - obj-$(CONFIG_PCI_AR724X) += pci-ar724x.o - obj-$(CONFIG_PCI_XTALK_BRIDGE) += pci-xtalk-bridge.o - # diff --git a/target/linux/ath79/patches-5.15/400-mtd-nor-support-mtd-name-from-device-tree.patch b/target/linux/ath79/patches-5.15/400-mtd-nor-support-mtd-name-from-device-tree.patch deleted file mode 100644 index 36f5331bd017f9..00000000000000 --- a/target/linux/ath79/patches-5.15/400-mtd-nor-support-mtd-name-from-device-tree.patch +++ /dev/null @@ -1,54 +0,0 @@ -From f32bc2aa01edcba2f2ed5db151cf183eac9ef919 Mon Sep 17 00:00:00 2001 -From: Abhimanyu Vishwakarma -Date: Sat, 25 Feb 2017 16:42:50 +0000 -Subject: mtd: nor: support mtd name from device tree - -Signed-off-by: Abhimanyu Vishwakarma ---- - drivers/mtd/spi-nor/spi-nor.c | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - ---- a/drivers/mtd/spi-nor/core.c -+++ b/drivers/mtd/spi-nor/core.c -@@ -3108,6 +3108,7 @@ int spi_nor_scan(struct spi_nor *nor, co - struct device *dev = nor->dev; - struct mtd_info *mtd = &nor->mtd; - struct device_node *np = spi_nor_get_flash_node(nor); -+ const char __maybe_unused *of_mtd_name = NULL; - int ret; - int i; - -@@ -3162,7 +3163,12 @@ int spi_nor_scan(struct spi_nor *nor, co - if (ret) - return ret; - -- if (!mtd->name) -+#ifdef CONFIG_MTD_OF_PARTS -+ of_property_read_string(np, "linux,mtd-name", &of_mtd_name); -+#endif -+ if (of_mtd_name) -+ mtd->name = of_mtd_name; -+ else if (!mtd->name) - mtd->name = dev_name(dev); - mtd->priv = nor; - mtd->type = MTD_NORFLASH; ---- a/drivers/mtd/mtdcore.c -+++ b/drivers/mtd/mtdcore.c -@@ -870,6 +870,17 @@ out_error: - */ - static void mtd_set_dev_defaults(struct mtd_info *mtd) - { -+#ifdef CONFIG_MTD_OF_PARTS -+ const char __maybe_unused *of_mtd_name = NULL; -+ struct device_node *np; -+ -+ np = mtd_get_of_node(mtd); -+ if (np && !mtd->name) { -+ of_property_read_string(np, "linux,mtd-name", &of_mtd_name); -+ if (of_mtd_name) -+ mtd->name = of_mtd_name; -+ } else -+#endif - if (mtd->dev.parent) { - if (!mtd->owner && mtd->dev.parent->driver) - mtd->owner = mtd->dev.parent->driver->owner; diff --git a/target/linux/ath79/patches-5.15/410-mtd-cybertan-trx-parser.patch b/target/linux/ath79/patches-5.15/410-mtd-cybertan-trx-parser.patch deleted file mode 100644 index 4e8e536e2945e4..00000000000000 --- a/target/linux/ath79/patches-5.15/410-mtd-cybertan-trx-parser.patch +++ /dev/null @@ -1,45 +0,0 @@ -From: Christian Lamparter -Subject: [PATCH] ath79: port cybertan_part from ar71xx - -This patch ports the cybertan_part code from ar71xx and converts the -driver to a DT-supported mtd parser. As a result, it will no longer -add the u-boot, nvram and art partitions, which were never part of -the special Cybertan header. - -Instead these partitions have to be specified in the DT, which has the -upside of making it possible to add properties (i.e.: read-only), labels -and references to these important partitions. - -Submitted-by: Christian Lamparter ---- - drivers/mtd/parsers/Makefile | 1 + - drivers/mtd/parsers/Kconfig | 8 ++++++++ - 2 files changed, 9 insertions(+) - ---- a/drivers/mtd/parsers/Makefile -+++ b/drivers/mtd/parsers/Makefile -@@ -8,6 +8,7 @@ obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o - ofpart-y += ofpart_core.o - ofpart-$(CONFIG_MTD_OF_PARTS_BCM4908) += ofpart_bcm4908.o - ofpart-$(CONFIG_MTD_OF_PARTS_LINKSYS_NS)+= ofpart_linksys_ns.o -+obj-$(CONFIG_MTD_PARSER_CYBERTAN) += parser_cybertan.o - obj-$(CONFIG_MTD_PARSER_IMAGETAG) += parser_imagetag.o - obj-$(CONFIG_MTD_AFS_PARTS) += afs.o - obj-$(CONFIG_MTD_PARSER_TPLINK_SAFELOADER) += tplink_safeloader.o ---- a/drivers/mtd/parsers/Kconfig -+++ b/drivers/mtd/parsers/Kconfig -@@ -102,6 +102,14 @@ config MTD_OF_PARTS_LINKSYS_NS - two "firmware" partitions. Currently used firmware has to be detected - using CFE environment variable. - -+config MTD_PARSER_CYBERTAN -+ tristate "Parser for Cybertan format partitions" -+ depends on MTD && (ATH79 || COMPILE_TEST) -+ help -+ Cybertan has a proprietory header than encompasses a Broadcom trx -+ header. This driver will parse the header and take care of the -+ special offsets that result in the extra headers. -+ - config MTD_PARSER_IMAGETAG - tristate "Parser for BCM963XX Image Tag format partitions" - depends on BCM63XX || BMIPS_GENERIC || COMPILE_TEST diff --git a/target/linux/ath79/patches-5.15/420-drivers-link-spi-before-mtd.patch b/target/linux/ath79/patches-5.15/420-drivers-link-spi-before-mtd.patch deleted file mode 100644 index 0cd96909eb9b4d..00000000000000 --- a/target/linux/ath79/patches-5.15/420-drivers-link-spi-before-mtd.patch +++ /dev/null @@ -1,20 +0,0 @@ -From: Gabor Juhos -Subject: [PATCH] ar71xx: Link SPI before MTD - -SVN-Revision: 22863 ---- - drivers/Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/Makefile -+++ b/drivers/Makefile -@@ -80,8 +80,8 @@ obj-y += scsi/ - obj-y += nvme/ - obj-$(CONFIG_ATA) += ata/ - obj-$(CONFIG_TARGET_CORE) += target/ --obj-$(CONFIG_MTD) += mtd/ - obj-$(CONFIG_SPI) += spi/ -+obj-$(CONFIG_MTD) += mtd/ - obj-$(CONFIG_SPMI) += spmi/ - obj-$(CONFIG_HSI) += hsi/ - obj-$(CONFIG_SLIMBUS) += slimbus/ diff --git a/target/linux/ath79/patches-5.15/430-mtd-ar934x-nand-driver.patch b/target/linux/ath79/patches-5.15/430-mtd-ar934x-nand-driver.patch deleted file mode 100644 index 63bc98e14c1533..00000000000000 --- a/target/linux/ath79/patches-5.15/430-mtd-ar934x-nand-driver.patch +++ /dev/null @@ -1,34 +0,0 @@ -From: Gabor Juhos -Subject: ar71xx: ar934x_nfc: experimental NAND Flash Controller driver for AR934x - -SVN-Revision: 33385 ---- - drivers/mtd/nand/raw/Kconfig | 8 ++++++++ - drivers/mtd/nand/raw/Makefile | 1 + - 2 files changed, 9 insertions(+) - ---- a/drivers/mtd/nand/raw/Kconfig -+++ b/drivers/mtd/nand/raw/Kconfig -@@ -555,4 +555,12 @@ config MTD_NAND_DISKONCHIP_BBTWRITE - load time (assuming you build diskonchip as a module) with the module - parameter "inftl_bbt_write=1". - -+config MTD_NAND_AR934X -+ tristate "Support for NAND controller on Qualcomm Atheros AR934x/QCA955x SoCs" -+ depends on ATH79 || COMPILE_TEST -+ depends on HAS_IOMEM -+ help -+ Enables support for NAND controller on Qualcomm Atheros SoCs. -+ This controller is found on AR934x and QCA955x SoCs. -+ - endif # MTD_RAW_NAND ---- a/drivers/mtd/nand/raw/Makefile -+++ b/drivers/mtd/nand/raw/Makefile -@@ -58,6 +58,7 @@ obj-$(CONFIG_MTD_NAND_ARASAN) += arasan - obj-$(CONFIG_MTD_NAND_INTEL_LGM) += intel-nand-controller.o - obj-$(CONFIG_MTD_NAND_ROCKCHIP) += rockchip-nand-controller.o - obj-$(CONFIG_MTD_NAND_PL35X) += pl35x-nand-controller.o -+obj-$(CONFIG_MTD_NAND_AR934X) += ar934x_nand.o - - nand-objs := nand_base.o nand_legacy.o nand_bbt.o nand_timings.o nand_ids.o - nand-objs += nand_onfi.o diff --git a/target/linux/ath79/patches-5.15/700-phy-add-ath79-usb-phys.patch b/target/linux/ath79/patches-5.15/700-phy-add-ath79-usb-phys.patch deleted file mode 100644 index 21b655a1098f94..00000000000000 --- a/target/linux/ath79/patches-5.15/700-phy-add-ath79-usb-phys.patch +++ /dev/null @@ -1,333 +0,0 @@ -From 08c9d6ceef01893678a5d2e8a15517c745417f21 Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Tue, 6 Mar 2018 10:04:05 +0100 -Subject: [PATCH 04/27] phy: add ath79 usb phys - -Signed-off-by: John Crispin ---- - drivers/phy/Kconfig | 16 ++++++ - drivers/phy/Makefile | 2 + - drivers/phy/phy-ar7100-usb.c | 124 +++++++++++++++++++++++++++++++++++++++++++ - drivers/phy/phy-ar7200-usb.c | 108 +++++++++++++++++++++++++++++++++++++ - 4 files changed, 250 insertions(+) - create mode 100644 drivers/phy/phy-ar7100-usb.c - create mode 100644 drivers/phy/phy-ar7200-usb.c - ---- a/drivers/phy/Kconfig -+++ b/drivers/phy/Kconfig -@@ -24,6 +24,22 @@ config GENERIC_PHY_MIPI_DPHY - Provides a number of helpers a core functions for MIPI D-PHY - drivers to us. - -+config PHY_AR7100_USB -+ tristate "Atheros AR7100 USB PHY driver" -+ depends on ATH79 || COMPILE_TEST -+ default y if USB_EHCI_HCD_PLATFORM -+ select GENERIC_PHY -+ help -+ Enable this to support the USB PHY on Atheros AR7100 SoCs. -+ -+config PHY_AR7200_USB -+ tristate "Atheros AR7200 USB PHY driver" -+ depends on ATH79 || COMPILE_TEST -+ default y if USB_EHCI_HCD_PLATFORM -+ select GENERIC_PHY -+ help -+ Enable this to support the USB PHY on Atheros AR7200 SoCs. -+ - config PHY_LPC18XX_USB_OTG - tristate "NXP LPC18xx/43xx SoC USB OTG PHY driver" - depends on OF && (ARCH_LPC18XX || COMPILE_TEST) ---- a/drivers/phy/Makefile -+++ b/drivers/phy/Makefile -@@ -4,6 +4,8 @@ - # - - obj-$(CONFIG_GENERIC_PHY) += phy-core.o -+obj-$(CONFIG_PHY_AR7100_USB) += phy-ar7100-usb.o -+obj-$(CONFIG_PHY_AR7200_USB) += phy-ar7200-usb.o - obj-$(CONFIG_GENERIC_PHY_MIPI_DPHY) += phy-core-mipi-dphy.o - obj-$(CONFIG_PHY_CAN_TRANSCEIVER) += phy-can-transceiver.o - obj-$(CONFIG_PHY_LPC18XX_USB_OTG) += phy-lpc18xx-usb-otg.o ---- /dev/null -+++ b/drivers/phy/phy-ar7100-usb.c -@@ -0,0 +1,140 @@ -+/* -+ * Copyright (C) 2018 John Crispin -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+ -+struct ar7100_usb_phy { -+ struct reset_control *rst_phy; -+ struct reset_control *rst_host; -+ struct reset_control *rst_ohci_dll; -+ void __iomem *io_base; -+ struct phy *phy; -+ int gpio; -+}; -+ -+static int ar7100_usb_phy_power_off(struct phy *phy) -+{ -+ struct ar7100_usb_phy *priv = phy_get_drvdata(phy); -+ int err = 0; -+ -+ err |= reset_control_assert(priv->rst_host); -+ err |= reset_control_assert(priv->rst_phy); -+ err |= reset_control_assert(priv->rst_ohci_dll); -+ -+ return err; -+} -+ -+static int ar7100_usb_phy_power_on(struct phy *phy) -+{ -+ struct ar7100_usb_phy *priv = phy_get_drvdata(phy); -+ int err = 0; -+ -+ err |= ar7100_usb_phy_power_off(phy); -+ mdelay(100); -+ err |= reset_control_deassert(priv->rst_ohci_dll); -+ err |= reset_control_deassert(priv->rst_phy); -+ err |= reset_control_deassert(priv->rst_host); -+ mdelay(500); -+ iowrite32(0xf0000, priv->io_base + AR71XX_USB_CTRL_REG_CONFIG); -+ iowrite32(0x20c00, priv->io_base + AR71XX_USB_CTRL_REG_FLADJ); -+ -+ return err; -+} -+ -+static const struct phy_ops ar7100_usb_phy_ops = { -+ .power_on = ar7100_usb_phy_power_on, -+ .power_off = ar7100_usb_phy_power_off, -+ .owner = THIS_MODULE, -+}; -+ -+static int ar7100_usb_phy_probe(struct platform_device *pdev) -+{ -+ struct phy_provider *phy_provider; -+ struct resource *res; -+ struct ar7100_usb_phy *priv; -+ -+ priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); -+ if (!priv) -+ return -ENOMEM; -+ -+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ priv->io_base = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(priv->io_base)) -+ return PTR_ERR(priv->io_base); -+ -+ priv->rst_phy = devm_reset_control_get(&pdev->dev, "usb-phy"); -+ if (IS_ERR(priv->rst_phy)) { -+ dev_err(&pdev->dev, "phy reset is missing\n"); -+ return PTR_ERR(priv->rst_phy); -+ } -+ -+ priv->rst_host = devm_reset_control_get(&pdev->dev, "usb-host"); -+ if (IS_ERR(priv->rst_host)) { -+ dev_err(&pdev->dev, "host reset is missing\n"); -+ return PTR_ERR(priv->rst_host); -+ } -+ -+ priv->rst_ohci_dll = devm_reset_control_get(&pdev->dev, "usb-ohci-dll"); -+ if (IS_ERR(priv->rst_ohci_dll)) { -+ dev_err(&pdev->dev, "ohci-dll reset is missing\n"); -+ return PTR_ERR(priv->rst_host); -+ } -+ -+ priv->phy = devm_phy_create(&pdev->dev, NULL, &ar7100_usb_phy_ops); -+ if (IS_ERR(priv->phy)) { -+ dev_err(&pdev->dev, "failed to create PHY\n"); -+ return PTR_ERR(priv->phy); -+ } -+ -+ priv->gpio = of_get_gpio(pdev->dev.of_node, 0); -+ if (priv->gpio >= 0) { -+ int ret = devm_gpio_request(&pdev->dev, priv->gpio, dev_name(&pdev->dev)); -+ -+ if (ret) { -+ dev_err(&pdev->dev, "failed to request gpio\n"); -+ return ret; -+ } -+ gpio_export_with_name(priv->gpio, 0, dev_name(&pdev->dev)); -+ gpio_set_value(priv->gpio, 1); -+ } -+ -+ phy_set_drvdata(priv->phy, priv); -+ -+ phy_provider = devm_of_phy_provider_register(&pdev->dev, of_phy_simple_xlate); -+ -+ -+ return PTR_ERR_OR_ZERO(phy_provider); -+} -+ -+static const struct of_device_id ar7100_usb_phy_of_match[] = { -+ { .compatible = "qca,ar7100-usb-phy" }, -+ {} -+}; -+MODULE_DEVICE_TABLE(of, ar7100_usb_phy_of_match); -+ -+static struct platform_driver ar7100_usb_phy_driver = { -+ .probe = ar7100_usb_phy_probe, -+ .driver = { -+ .of_match_table = ar7100_usb_phy_of_match, -+ .name = "ar7100-usb-phy", -+ } -+}; -+module_platform_driver(ar7100_usb_phy_driver); -+ -+MODULE_DESCRIPTION("ATH79 USB PHY driver"); -+MODULE_AUTHOR("Alban Bedel "); -+MODULE_LICENSE("GPL"); ---- /dev/null -+++ b/drivers/phy/phy-ar7200-usb.c -@@ -0,0 +1,136 @@ -+/* -+ * Copyright (C) 2015 Alban Bedel -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2 of the License, or -+ * (at your option) any later version. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+ -+struct ar7200_usb_phy { -+ struct reset_control *rst_phy; -+ struct reset_control *rst_phy_analog; -+ struct reset_control *suspend_override; -+ struct phy *phy; -+ int gpio; -+}; -+ -+static int ar7200_usb_phy_power_on(struct phy *phy) -+{ -+ struct ar7200_usb_phy *priv = phy_get_drvdata(phy); -+ int err = 0; -+ -+ if (priv->suspend_override) -+ err = reset_control_assert(priv->suspend_override); -+ if (priv->rst_phy) -+ err |= reset_control_deassert(priv->rst_phy); -+ if (priv->rst_phy_analog) -+ err |= reset_control_deassert(priv->rst_phy_analog); -+ -+ return err; -+} -+ -+static int ar7200_usb_phy_power_off(struct phy *phy) -+{ -+ struct ar7200_usb_phy *priv = phy_get_drvdata(phy); -+ int err = 0; -+ -+ if (priv->suspend_override) -+ err = reset_control_deassert(priv->suspend_override); -+ if (priv->rst_phy) -+ err |= reset_control_assert(priv->rst_phy); -+ if (priv->rst_phy_analog) -+ err |= reset_control_assert(priv->rst_phy_analog); -+ -+ return err; -+} -+ -+static const struct phy_ops ar7200_usb_phy_ops = { -+ .power_on = ar7200_usb_phy_power_on, -+ .power_off = ar7200_usb_phy_power_off, -+ .owner = THIS_MODULE, -+}; -+ -+static int ar7200_usb_phy_probe(struct platform_device *pdev) -+{ -+ struct phy_provider *phy_provider; -+ struct ar7200_usb_phy *priv; -+ -+ priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); -+ if (!priv) -+ return -ENOMEM; -+ -+ priv->rst_phy = devm_reset_control_get(&pdev->dev, "usb-phy"); -+ if (IS_ERR(priv->rst_phy)) { -+ if (PTR_ERR(priv->rst_phy) != -EPROBE_DEFER) -+ dev_err(&pdev->dev, "phy reset is missing\n"); -+ return PTR_ERR(priv->rst_phy); -+ } -+ -+ priv->rst_phy_analog = devm_reset_control_get_optional( -+ &pdev->dev, "usb-phy-analog"); -+ if (IS_ERR(priv->rst_phy_analog)) { -+ if (PTR_ERR(priv->rst_phy_analog) == -ENOENT) -+ priv->rst_phy_analog = NULL; -+ else -+ return PTR_ERR(priv->rst_phy_analog); -+ } -+ -+ priv->suspend_override = devm_reset_control_get_optional( -+ &pdev->dev, "usb-suspend-override"); -+ if (IS_ERR(priv->suspend_override)) { -+ if (PTR_ERR(priv->suspend_override) == -ENOENT) -+ priv->suspend_override = NULL; -+ else -+ return PTR_ERR(priv->suspend_override); -+ } -+ -+ priv->phy = devm_phy_create(&pdev->dev, NULL, &ar7200_usb_phy_ops); -+ if (IS_ERR(priv->phy)) { -+ dev_err(&pdev->dev, "failed to create PHY\n"); -+ return PTR_ERR(priv->phy); -+ } -+ -+ priv->gpio = of_get_gpio(pdev->dev.of_node, 0); -+ if (priv->gpio >= 0) { -+ int ret = devm_gpio_request(&pdev->dev, priv->gpio, dev_name(&pdev->dev)); -+ -+ if (ret) { -+ dev_err(&pdev->dev, "failed to request gpio\n"); -+ return ret; -+ } -+ gpio_export_with_name(priv->gpio, 0, dev_name(&pdev->dev)); -+ gpio_set_value(priv->gpio, 1); -+ } -+ -+ phy_set_drvdata(priv->phy, priv); -+ -+ phy_provider = devm_of_phy_provider_register(&pdev->dev, of_phy_simple_xlate); -+ -+ return PTR_ERR_OR_ZERO(phy_provider); -+} -+ -+static const struct of_device_id ar7200_usb_phy_of_match[] = { -+ { .compatible = "qca,ar7200-usb-phy" }, -+ {} -+}; -+MODULE_DEVICE_TABLE(of, ar7200_usb_phy_of_match); -+ -+static struct platform_driver ar7200_usb_phy_driver = { -+ .probe = ar7200_usb_phy_probe, -+ .driver = { -+ .of_match_table = ar7200_usb_phy_of_match, -+ .name = "ar7200-usb-phy", -+ } -+}; -+module_platform_driver(ar7200_usb_phy_driver); -+ -+MODULE_DESCRIPTION("ATH79 USB PHY driver"); -+MODULE_AUTHOR("Alban Bedel "); -+MODULE_LICENSE("GPL"); diff --git a/target/linux/ath79/patches-5.15/701-usb-add-more-OF-quirk-properties.patch b/target/linux/ath79/patches-5.15/701-usb-add-more-OF-quirk-properties.patch deleted file mode 100644 index d6d8cb69522225..00000000000000 --- a/target/linux/ath79/patches-5.15/701-usb-add-more-OF-quirk-properties.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 2201818e5bd33f389beceb3943fdfcf5a698fc5b Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Tue, 6 Mar 2018 10:01:43 +0100 -Subject: [PATCH 05/27] usb: add more OF/quirk properties - -Signed-off-by: John Crispin ---- - drivers/usb/host/ehci-platform.c | 5 +++++ - 1 file changed, 5 insertions(+) - ---- a/drivers/usb/host/ehci-platform.c -+++ b/drivers/usb/host/ehci-platform.c -@@ -277,6 +277,11 @@ static int ehci_platform_probe(struct pl - ehci = hcd_to_ehci(hcd); - - if (pdata == &ehci_platform_defaults && dev->dev.of_node) { -+ of_property_read_u32(dev->dev.of_node, "caps-offset", &pdata->caps_offset); -+ -+ if (of_property_read_bool(dev->dev.of_node, "has-synopsys-hc-bug")) -+ pdata->has_synopsys_hc_bug = 1; -+ - if (of_property_read_bool(dev->dev.of_node, "big-endian-regs")) - ehci->big_endian_mmio = 1; - diff --git a/target/linux/ath79/patches-5.15/710-net-use-downstream-ag71xx.patch b/target/linux/ath79/patches-5.15/710-net-use-downstream-ag71xx.patch deleted file mode 100644 index 54e64fb11cf8e9..00000000000000 --- a/target/linux/ath79/patches-5.15/710-net-use-downstream-ag71xx.patch +++ /dev/null @@ -1,42 +0,0 @@ -From: John Crispin -Subject: [PATCH] ath79: add new OF only target for QCA MIPS silicon - -This target aims to replace ar71xx mid-term. The big part that is still -missing is making the MMIO/AHB wifi work using OF. NAND and mikrotik -subtargets will follow. - -Submitted-by: John Crispin ---- - drivers/net/ethernet/atheros/Kconfig | 8 +------- - drivers/net/ethernet/atheros/Makefile | 2 +- - 2 files changed, 2 insertions(+), 8 deletions(-) - ---- a/drivers/net/ethernet/atheros/Kconfig -+++ b/drivers/net/ethernet/atheros/Kconfig -@@ -17,14 +17,7 @@ config NET_VENDOR_ATHEROS - - if NET_VENDOR_ATHEROS - --config AG71XX -- tristate "Atheros AR7XXX/AR9XXX built-in ethernet mac support" -- depends on ATH79 -- select PHYLINK -- imply NET_SELFTESTS -- help -- If you wish to compile a kernel for AR7XXX/91XXX and enable -- ethernet support, then you should always answer Y to this. -+source "drivers/net/ethernet/atheros/ag71xx/Kconfig" - - config ATL2 - tristate "Atheros L2 Fast Ethernet support" ---- a/drivers/net/ethernet/atheros/Makefile -+++ b/drivers/net/ethernet/atheros/Makefile -@@ -3,7 +3,7 @@ - # Makefile for the Atheros network device drivers. - # - --obj-$(CONFIG_AG71XX) += ag71xx.o -+obj-$(CONFIG_AG71XX) += ag71xx/ - obj-$(CONFIG_ATL1) += atlx/ - obj-$(CONFIG_ATL2) += atlx/ - obj-$(CONFIG_ATL1E) += atl1e/ diff --git a/target/linux/ath79/patches-5.15/720-mdio_bitbang_ignore_ta_value.patch b/target/linux/ath79/patches-5.15/720-mdio_bitbang_ignore_ta_value.patch deleted file mode 100644 index 5363bb37b03a1b..00000000000000 --- a/target/linux/ath79/patches-5.15/720-mdio_bitbang_ignore_ta_value.patch +++ /dev/null @@ -1,44 +0,0 @@ -From: Jonas Gorski -Subject: ar71xx: add a workaround for ar8316 not always driving the TA bit to low - -AR8316 behind a GPIO bitbanged MDIO bus fails to drive the turnaround bit -to low despite returning a valid value. Ignore it and just use the -returned value anyway. - -SVN-Revision: 28422 ---- - drivers/net/mdio/mdio-bitbang.c | 16 ++----------------- - 1 file changed, 2 insertions(+), 14 deletions(-) - ---- a/drivers/net/mdio/mdio-bitbang.c -+++ b/drivers/net/mdio/mdio-bitbang.c -@@ -152,7 +152,7 @@ static int mdiobb_cmd_addr(struct mdiobb - int mdiobb_read(struct mii_bus *bus, int phy, int reg) - { - struct mdiobb_ctrl *ctrl = bus->priv; -- int ret, i; -+ int ret; - - if (reg & MII_ADDR_C45) { - reg = mdiobb_cmd_addr(ctrl, phy, reg); -@@ -162,19 +162,7 @@ int mdiobb_read(struct mii_bus *bus, int - - ctrl->ops->set_mdio_dir(ctrl, 0); - -- /* check the turnaround bit: the PHY should be driving it to zero, if this -- * PHY is listed in phy_ignore_ta_mask as having broken TA, skip that -- */ -- if (mdiobb_get_bit(ctrl) != 0 && -- !(bus->phy_ignore_ta_mask & (1 << phy))) { -- /* PHY didn't drive TA low -- flush any bits it -- * may be trying to send. -- */ -- for (i = 0; i < 32; i++) -- mdiobb_get_bit(ctrl); -- -- return 0xffff; -- } -+ mdiobb_get_bit(ctrl); - - ret = mdiobb_get_num(ctrl, 16); - mdiobb_get_bit(ctrl); diff --git a/target/linux/ath79/patches-5.15/721-phy-mdio-bitbang-prevent-rescheduling-during-command.patch b/target/linux/ath79/patches-5.15/721-phy-mdio-bitbang-prevent-rescheduling-during-command.patch deleted file mode 100644 index e37d9a1f630bfa..00000000000000 --- a/target/linux/ath79/patches-5.15/721-phy-mdio-bitbang-prevent-rescheduling-during-command.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 66e584435ac0de6e0abeb6d7166fe4fe25d6bb73 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Tue, 16 Jun 2015 13:15:08 +0200 -Subject: [PATCH] phy/mdio-bitbang: prevent rescheduling during command - -It seems some phys have some maximum timings for accessing the MDIO line, -resulting in bit errors under cpu stress. Prevent this from happening by -disabling interrupts when sending commands. - -Signed-off-by: Jonas Gorski ---- - drivers/net/mdio/mdio-bitbang.c | 9 +++++++++ - 1 file changed, 9 insertions(+) - ---- a/drivers/net/mdio/mdio-bitbang.c -+++ b/drivers/net/mdio/mdio-bitbang.c -@@ -14,6 +14,7 @@ - * Vitaly Bordug - */ - -+#include - #include - #include - #include -@@ -153,7 +154,9 @@ int mdiobb_read(struct mii_bus *bus, int - { - struct mdiobb_ctrl *ctrl = bus->priv; - int ret; -+ unsigned long flags; - -+ local_irq_save(flags); - if (reg & MII_ADDR_C45) { - reg = mdiobb_cmd_addr(ctrl, phy, reg); - mdiobb_cmd(ctrl, MDIO_C45_READ, phy, reg); -@@ -166,6 +169,7 @@ int mdiobb_read(struct mii_bus *bus, int - - ret = mdiobb_get_num(ctrl, 16); - mdiobb_get_bit(ctrl); -+ local_irq_restore(flags); - return ret; - } - EXPORT_SYMBOL(mdiobb_read); -@@ -173,7 +177,9 @@ EXPORT_SYMBOL(mdiobb_read); - int mdiobb_write(struct mii_bus *bus, int phy, int reg, u16 val) - { - struct mdiobb_ctrl *ctrl = bus->priv; -+ unsigned long flags; - -+ local_irq_save(flags); - if (reg & MII_ADDR_C45) { - reg = mdiobb_cmd_addr(ctrl, phy, reg); - mdiobb_cmd(ctrl, MDIO_C45_WRITE, phy, reg); -@@ -188,6 +194,8 @@ int mdiobb_write(struct mii_bus *bus, in - - ctrl->ops->set_mdio_dir(ctrl, 0); - mdiobb_get_bit(ctrl); -+ local_irq_restore(flags); -+ - return 0; - } - EXPORT_SYMBOL(mdiobb_write); diff --git a/target/linux/ath79/patches-5.15/730-ar8216-make-reg-access-atomic.patch b/target/linux/ath79/patches-5.15/730-ar8216-make-reg-access-atomic.patch deleted file mode 100644 index 02f763534e43ab..00000000000000 --- a/target/linux/ath79/patches-5.15/730-ar8216-make-reg-access-atomic.patch +++ /dev/null @@ -1,59 +0,0 @@ -From b3797d1a92afe97c173b00fdb7824cedba24eef0 Mon Sep 17 00:00:00 2001 -From: Chuanhong Guo -Date: Sun, 20 Sep 2020 01:00:45 +0800 -Subject: [PATCH] ath79: ar8216: make switch register access atomic - -due to some unknown reason these register accesses sometimes fail -on the integrated switch without this patch. - -THIS ONLY WORKS ON ATH79 AND MAY BREAK THE DRIVER ON OTHER PLATFORMS! -The mdio bus on ath79 works in polling mode and doesn't rely on -any interrupt. This patch breaks the driver on any mdio master -with interrupts used. - ---- ---- a/drivers/net/phy/ar8216.c -+++ b/drivers/net/phy/ar8216.c -@@ -252,6 +252,7 @@ ar8xxx_mii_write32(struct ar8xxx_priv *p - u32 - ar8xxx_read(struct ar8xxx_priv *priv, int reg) - { -+ unsigned long flags; - struct mii_bus *bus = priv->mii_bus; - u16 r1, r2, page; - u32 val; -@@ -259,11 +260,13 @@ ar8xxx_read(struct ar8xxx_priv *priv, in - split_addr((u32) reg, &r1, &r2, &page); - - mutex_lock(&bus->mdio_lock); -+ local_irq_save(flags); - - bus->write(bus, 0x18, 0, page); - wait_for_page_switch(); - val = ar8xxx_mii_read32(priv, 0x10 | r2, r1); - -+ local_irq_restore(flags); - mutex_unlock(&bus->mdio_lock); - - return val; -@@ -272,17 +275,20 @@ ar8xxx_read(struct ar8xxx_priv *priv, in - void - ar8xxx_write(struct ar8xxx_priv *priv, int reg, u32 val) - { -+ unsigned long flags; - struct mii_bus *bus = priv->mii_bus; - u16 r1, r2, page; - - split_addr((u32) reg, &r1, &r2, &page); - - mutex_lock(&bus->mdio_lock); -+ local_irq_save(flags); - - bus->write(bus, 0x18, 0, page); - wait_for_page_switch(); - ar8xxx_mii_write32(priv, 0x10 | r2, r1, val); - -+ local_irq_restore(flags); - mutex_unlock(&bus->mdio_lock); - } - diff --git a/target/linux/ath79/patches-5.15/800-leds-add-reset-controller-based-driver.patch b/target/linux/ath79/patches-5.15/800-leds-add-reset-controller-based-driver.patch deleted file mode 100644 index bbf8d7ef8c5105..00000000000000 --- a/target/linux/ath79/patches-5.15/800-leds-add-reset-controller-based-driver.patch +++ /dev/null @@ -1,186 +0,0 @@ -From ecbd9c87f073f097d9fe56390353e64e963e866a Mon Sep 17 00:00:00 2001 -From: John Crispin -Date: Tue, 6 Mar 2018 10:03:03 +0100 -Subject: [PATCH 03/27] leds: add reset-controller based driver - -Signed-off-by: John Crispin ---- - drivers/leds/Kconfig | 11 ++++ - drivers/leds/Makefile | 1 + - drivers/leds/leds-reset.c | 137 ++++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 149 insertions(+) - create mode 100644 drivers/leds/leds-reset.c - ---- a/drivers/leds/Kconfig -+++ b/drivers/leds/Kconfig -@@ -878,6 +878,17 @@ source "drivers/leds/blink/Kconfig" - comment "Flash and Torch LED drivers" - source "drivers/leds/flash/Kconfig" - -+config LEDS_RESET -+ tristate "LED support for reset-controller API" -+ depends on LEDS_CLASS -+ depends on RESET_CONTROLLER -+ help -+ This option enables support for LEDs connected to pins driven by reset -+ controllers. Yes, DNI actual built HW like that. -+ -+ To compile this driver as a module, choose M here: the module -+ will be called leds-reset. -+ - comment "LED Triggers" - source "drivers/leds/trigger/Kconfig" - ---- /dev/null -+++ b/drivers/leds/leds-reset.c -@@ -0,0 +1,140 @@ -+/* -+ * Copyright (C) 2018 John Crispin -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ */ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+struct reset_led_data { -+ struct led_classdev cdev; -+ struct reset_control *rst; -+}; -+ -+static inline struct reset_led_data * -+ cdev_to_reset_led_data(struct led_classdev *led_cdev) -+{ -+ return container_of(led_cdev, struct reset_led_data, cdev); -+} -+ -+static void reset_led_set(struct led_classdev *led_cdev, -+ enum led_brightness value) -+{ -+ struct reset_led_data *led_dat = cdev_to_reset_led_data(led_cdev); -+ -+ if (value == LED_OFF) -+ reset_control_assert(led_dat->rst); -+ else -+ reset_control_deassert(led_dat->rst); -+} -+ -+struct reset_leds_priv { -+ int num_leds; -+ struct reset_led_data leds[]; -+}; -+ -+static inline int sizeof_reset_leds_priv(int num_leds) -+{ -+ return sizeof(struct reset_leds_priv) + -+ (sizeof(struct reset_led_data) * num_leds); -+} -+ -+static struct reset_leds_priv *reset_leds_create(struct platform_device *pdev) -+{ -+ struct device *dev = &pdev->dev; -+ struct fwnode_handle *child; -+ struct reset_leds_priv *priv; -+ int count, ret; -+ -+ count = device_get_child_node_count(dev); -+ if (!count) -+ return ERR_PTR(-ENODEV); -+ -+ priv = devm_kzalloc(dev, sizeof_reset_leds_priv(count), GFP_KERNEL); -+ if (!priv) -+ return ERR_PTR(-ENOMEM); -+ -+ device_for_each_child_node(dev, child) { -+ struct reset_led_data *led = &priv->leds[priv->num_leds]; -+ struct device_node *np = to_of_node(child); -+ -+ ret = fwnode_property_read_string(child, "label", &led->cdev.name); -+ if (!led->cdev.name) { -+ fwnode_handle_put(child); -+ return ERR_PTR(-EINVAL); -+ } -+ led->rst = __of_reset_control_get(np, NULL, 0, 0, 0, true); -+ if (IS_ERR(led->rst)) -+ return ERR_PTR(-EINVAL); -+ -+ fwnode_property_read_string(child, "linux,default-trigger", -+ &led->cdev.default_trigger); -+ -+ led->cdev.brightness_set = reset_led_set; -+ ret = devm_led_classdev_register(&pdev->dev, &led->cdev); -+ if (ret < 0) -+ return ERR_PTR(ret); -+ led->cdev.dev->of_node = np; -+ priv->num_leds++; -+ } -+ -+ return priv; -+} -+ -+static const struct of_device_id of_reset_leds_match[] = { -+ { .compatible = "reset-leds", }, -+ {}, -+}; -+ -+MODULE_DEVICE_TABLE(of, of_reset_leds_match); -+ -+static int reset_led_probe(struct platform_device *pdev) -+{ -+ struct reset_leds_priv *priv; -+ -+ priv = reset_leds_create(pdev); -+ if (IS_ERR(priv)) -+ return PTR_ERR(priv); -+ -+ platform_set_drvdata(pdev, priv); -+ -+ return 0; -+} -+ -+static void reset_led_shutdown(struct platform_device *pdev) -+{ -+ struct reset_leds_priv *priv = platform_get_drvdata(pdev); -+ int i; -+ -+ for (i = 0; i < priv->num_leds; i++) { -+ struct reset_led_data *led = &priv->leds[i]; -+ -+ if (!(led->cdev.flags & LED_RETAIN_AT_SHUTDOWN)) -+ reset_led_set(&led->cdev, LED_OFF); -+ } -+} -+ -+static struct platform_driver reset_led_driver = { -+ .probe = reset_led_probe, -+ .shutdown = reset_led_shutdown, -+ .driver = { -+ .name = "leds-reset", -+ .of_match_table = of_reset_leds_match, -+ }, -+}; -+ -+module_platform_driver(reset_led_driver); -+ -+MODULE_AUTHOR("John Crispin "); -+MODULE_DESCRIPTION("reset controller LED driver"); -+MODULE_LICENSE("GPL"); -+MODULE_ALIAS("platform:leds-reset"); ---- a/drivers/leds/Makefile -+++ b/drivers/leds/Makefile -@@ -87,6 +87,7 @@ obj-$(CONFIG_LEDS_TURRIS_OMNIA) += leds - obj-$(CONFIG_LEDS_WM831X_STATUS) += leds-wm831x-status.o - obj-$(CONFIG_LEDS_WM8350) += leds-wm8350.o - obj-$(CONFIG_LEDS_WRAP) += leds-wrap.o -+obj-$(CONFIG_LEDS_RESET) += leds-reset.o - - # LED SPI Drivers - obj-$(CONFIG_LEDS_CR0014114) += leds-cr0014114.o diff --git a/target/linux/ath79/patches-5.15/900-unaligned_access_hacks.patch b/target/linux/ath79/patches-5.15/900-unaligned_access_hacks.patch deleted file mode 100644 index 7bd6ae8b5606a9..00000000000000 --- a/target/linux/ath79/patches-5.15/900-unaligned_access_hacks.patch +++ /dev/null @@ -1,899 +0,0 @@ -From: Felix Fietkau -Subject: [PATCH] ar71xx: fix unaligned access in a few more places - -SVN-Revision: 35130 ---- - arch/mips/include/asm/checksum.h | 83 +++--------------- - include/uapi/linux/ip.h | 2 +- - include/uapi/linux/ipv6.h | 2 +- - include/uapi/linux/tcp.h | 4 ++-- - include/uapi/linux/udp.h | 2 +- - net/netfilter/nf_conntrack_core.c | 4 ++-- - include/uapi/linux/icmp.h | 2 +- - include/uapi/linux/in6.h | 2 +- - net/ipv6/tcp_ipv6.c | 9 +++-- - net/ipv6/datagram.c | 6 ++-- - net/ipv6/exthdrs.c | 2 +- - include/linux/types.h | 5 +++ - net/ipv4/af_inet.c | 4 ++-- - net/ipv4/tcp_output.c | 69 +++++++++-------- - include/uapi/linux/igmp.h | 8 +++--- - net/core/flow_dissector.c | 2 +- - include/uapi/linux/icmpv6.h | 2 +- - include/net/ndisc.h | 10 ++++---- - net/sched/cls_u32.c | 6 +++--- - net/ipv6/ip6_offload.c | 2 +- - include/net/addrconf.h | 2 +- - include/net/inet_ecn.h | 4 ++-- - include/net/ipv6.h | 23 +++++---- - include/net/secure_seq.h | 1 + - include/uapi/linux/in.h | 2 +- - net/ipv6/ip6_fib.h | 2 +- - net/netfilter/nf_conntrack_proto_tcp.c | 2 +- - net/xfrm/xfrm_input.c | 4 ++-- - net/ipv4/tcp_input.c | 12 ++++--- - include/uapi/linux/if_pppox.h | 1 + - net/ipv6/netfilter/nf_log_ipv6.c | 4 ++-- - include/net/neighbour.h | 6 +++-- - include/uapi/linux/netfilter_arp/arp_tables.h | 2 +- - net/core/utils.c | 10 +++++-- - include/linux/etherdevice.h | 11 ++++--- - net/ipv4/tcp_offload.c | 6 +++--- - net/ipv6/netfilter/ip6table_mangle.c | 4 ++-- - 37 file changed, 171 insertions(+), 141 deletions(-) - ---- a/arch/mips/include/asm/checksum.h -+++ b/arch/mips/include/asm/checksum.h -@@ -100,26 +100,30 @@ static inline __sum16 ip_fast_csum(const - const unsigned int *stop = word + ihl; - unsigned int csum; - int carry; -+ unsigned int w; - -- csum = word[0]; -- csum += word[1]; -- carry = (csum < word[1]); -+ csum = net_hdr_word(word++); -+ -+ w = net_hdr_word(word++); -+ csum += w; -+ carry = (csum < w); - csum += carry; - -- csum += word[2]; -- carry = (csum < word[2]); -+ w = net_hdr_word(word++); -+ csum += w; -+ carry = (csum < w); - csum += carry; - -- csum += word[3]; -- carry = (csum < word[3]); -+ w = net_hdr_word(word++); -+ csum += w; -+ carry = (csum < w); - csum += carry; - -- word += 4; - do { -- csum += *word; -- carry = (csum < *word); -+ w = net_hdr_word(word++); -+ csum += w; -+ carry = (csum < w); - csum += carry; -- word++; - } while (word != stop); - - return csum_fold(csum); -@@ -182,73 +186,6 @@ static inline __sum16 ip_compute_csum(co - return csum_fold(csum_partial(buff, len, 0)); - } - --#define _HAVE_ARCH_IPV6_CSUM --static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr, -- const struct in6_addr *daddr, -- __u32 len, __u8 proto, -- __wsum sum) --{ -- __wsum tmp; -- -- __asm__( -- " .set push # csum_ipv6_magic\n" -- " .set noreorder \n" -- " .set noat \n" -- " addu %0, %5 # proto (long in network byte order)\n" -- " sltu $1, %0, %5 \n" -- " addu %0, $1 \n" -- -- " addu %0, %6 # csum\n" -- " sltu $1, %0, %6 \n" -- " lw %1, 0(%2) # four words source address\n" -- " addu %0, $1 \n" -- " addu %0, %1 \n" -- " sltu $1, %0, %1 \n" -- -- " lw %1, 4(%2) \n" -- " addu %0, $1 \n" -- " addu %0, %1 \n" -- " sltu $1, %0, %1 \n" -- -- " lw %1, 8(%2) \n" -- " addu %0, $1 \n" -- " addu %0, %1 \n" -- " sltu $1, %0, %1 \n" -- -- " lw %1, 12(%2) \n" -- " addu %0, $1 \n" -- " addu %0, %1 \n" -- " sltu $1, %0, %1 \n" -- -- " lw %1, 0(%3) \n" -- " addu %0, $1 \n" -- " addu %0, %1 \n" -- " sltu $1, %0, %1 \n" -- -- " lw %1, 4(%3) \n" -- " addu %0, $1 \n" -- " addu %0, %1 \n" -- " sltu $1, %0, %1 \n" -- -- " lw %1, 8(%3) \n" -- " addu %0, $1 \n" -- " addu %0, %1 \n" -- " sltu $1, %0, %1 \n" -- -- " lw %1, 12(%3) \n" -- " addu %0, $1 \n" -- " addu %0, %1 \n" -- " sltu $1, %0, %1 \n" -- -- " addu %0, $1 # Add final carry\n" -- " .set pop" -- : "=&r" (sum), "=&r" (tmp) -- : "r" (saddr), "r" (daddr), -- "0" (htonl(len)), "r" (htonl(proto)), "r" (sum)); -- -- return csum_fold(sum); --} -- - #include - #endif /* CONFIG_GENERIC_CSUM */ - ---- a/include/uapi/linux/ip.h -+++ b/include/uapi/linux/ip.h -@@ -106,7 +106,7 @@ struct iphdr { - __be32 daddr; - ); - /*The options start here. */ --}; -+} __attribute__((packed, aligned(2))); - - - struct ip_auth_hdr { ---- a/include/uapi/linux/ipv6.h -+++ b/include/uapi/linux/ipv6.h -@@ -135,7 +135,7 @@ struct ipv6hdr { - struct in6_addr saddr; - struct in6_addr daddr; - ); --}; -+} __attribute__((packed, aligned(2))); - - - /* index values for the variables in ipv6_devconf */ ---- a/include/uapi/linux/tcp.h -+++ b/include/uapi/linux/tcp.h -@@ -55,7 +55,7 @@ struct tcphdr { - __be16 window; - __sum16 check; - __be16 urg_ptr; --}; -+} __attribute__((packed, aligned(2))); - - /* - * The union cast uses a gcc extension to avoid aliasing problems -@@ -65,7 +65,7 @@ struct tcphdr { - union tcp_word_hdr { - struct tcphdr hdr; - __be32 words[5]; --}; -+} __attribute__((packed, aligned(2))); - - #define tcp_flag_word(tp) (((union tcp_word_hdr *)(tp))->words[3]) - ---- a/include/uapi/linux/udp.h -+++ b/include/uapi/linux/udp.h -@@ -25,7 +25,7 @@ struct udphdr { - __be16 dest; - __be16 len; - __sum16 check; --}; -+} __attribute__((packed, aligned(2))); - - /* UDP socket options */ - #define UDP_CORK 1 /* Never send partially complete segments */ ---- a/net/netfilter/nf_conntrack_core.c -+++ b/net/netfilter/nf_conntrack_core.c -@@ -308,8 +308,8 @@ nf_ct_get_tuple(const struct sk_buff *sk - - switch (l3num) { - case NFPROTO_IPV4: -- tuple->src.u3.ip = ap[0]; -- tuple->dst.u3.ip = ap[1]; -+ tuple->src.u3.ip = net_hdr_word(ap++); -+ tuple->dst.u3.ip = net_hdr_word(ap); - break; - case NFPROTO_IPV6: - memcpy(tuple->src.u3.ip6, ap, sizeof(tuple->src.u3.ip6)); ---- a/include/uapi/linux/icmp.h -+++ b/include/uapi/linux/icmp.h -@@ -102,7 +102,7 @@ struct icmphdr { - } frag; - __u8 reserved[4]; - } un; --}; -+} __attribute__((packed, aligned(2))); - - - /* ---- a/include/uapi/linux/in6.h -+++ b/include/uapi/linux/in6.h -@@ -43,7 +43,7 @@ struct in6_addr { - #define s6_addr16 in6_u.u6_addr16 - #define s6_addr32 in6_u.u6_addr32 - #endif --}; -+} __attribute__((packed, aligned(2))); - #endif /* __UAPI_DEF_IN6_ADDR */ - - #if __UAPI_DEF_SOCKADDR_IN6 ---- a/net/ipv6/tcp_ipv6.c -+++ b/net/ipv6/tcp_ipv6.c -@@ -35,6 +35,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -944,10 +945,10 @@ static void tcp_v6_send_response(const s - topt = (__be32 *)(t1 + 1); - - if (tsecr) { -- *topt++ = htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | -- (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP); -- *topt++ = htonl(tsval); -- *topt++ = htonl(tsecr); -+ put_unaligned_be32((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | -+ (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP, topt++); -+ put_unaligned_be32(tsval, topt++); -+ put_unaligned_be32(tsecr, topt++); - } - - if (mrst) ---- a/include/linux/ipv6.h -+++ b/include/linux/ipv6.h -@@ -6,6 +6,7 @@ - - #define ipv6_optlen(p) (((p)->hdrlen+1) << 3) - #define ipv6_authlen(p) (((p)->hdrlen+2) << 2) -+ - /* - * This structure contains configuration options per IPv6 link. - */ ---- a/net/ipv6/datagram.c -+++ b/net/ipv6/datagram.c -@@ -492,7 +492,7 @@ int ipv6_recv_error(struct sock *sk, str - ipv6_iface_scope_id(&sin->sin6_addr, - IP6CB(skb)->iif); - } else { -- ipv6_addr_set_v4mapped(*(__be32 *)(nh + serr->addr_offset), -+ ipv6_addr_set_v4mapped(net_hdr_word(nh + serr->addr_offset), - &sin->sin6_addr); - sin->sin6_scope_id = 0; - } -@@ -846,12 +846,12 @@ int ip6_datagram_send_ctl(struct net *ne - } - - if (fl6->flowlabel&IPV6_FLOWINFO_MASK) { -- if ((fl6->flowlabel^*(__be32 *)CMSG_DATA(cmsg))&~IPV6_FLOWINFO_MASK) { -+ if ((fl6->flowlabel^net_hdr_word(CMSG_DATA(cmsg)))&~IPV6_FLOWINFO_MASK) { - err = -EINVAL; - goto exit_f; - } - } -- fl6->flowlabel = IPV6_FLOWINFO_MASK & *(__be32 *)CMSG_DATA(cmsg); -+ fl6->flowlabel = IPV6_FLOWINFO_MASK & net_hdr_word(CMSG_DATA(cmsg)); - break; - - case IPV6_2292HOPOPTS: ---- a/net/ipv6/exthdrs.c -+++ b/net/ipv6/exthdrs.c -@@ -1002,7 +1002,7 @@ static bool ipv6_hop_jumbo(struct sk_buf - goto drop; - } - -- pkt_len = ntohl(*(__be32 *)(nh + optoff + 2)); -+ pkt_len = ntohl(net_hdr_word(nh + optoff + 2)); - if (pkt_len <= IPV6_MAXPLEN) { - __IP6_INC_STATS(net, idev, IPSTATS_MIB_INHDRERRORS); - icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, optoff+2); ---- a/include/linux/types.h -+++ b/include/linux/types.h -@@ -231,5 +231,11 @@ typedef void (*swap_func_t)(void *a, voi - typedef int (*cmp_r_func_t)(const void *a, const void *b, const void *priv); - typedef int (*cmp_func_t)(const void *a, const void *b); - -+struct net_hdr_word { -+ u32 words[1]; -+} __attribute__((packed, aligned(2))); -+ -+#define net_hdr_word(_p) (((struct net_hdr_word *) (_p))->words[0]) -+ - #endif /* __ASSEMBLY__ */ - #endif /* _LINUX_TYPES_H */ ---- a/net/ipv4/af_inet.c -+++ b/net/ipv4/af_inet.c -@@ -1477,8 +1477,8 @@ struct sk_buff *inet_gro_receive(struct - if (unlikely(ip_fast_csum((u8 *)iph, 5))) - goto out_unlock; - -- id = ntohl(*(__be32 *)&iph->id); -- flush = (u16)((ntohl(*(__be32 *)iph) ^ skb_gro_len(skb)) | (id & ~IP_DF)); -+ id = ntohl(net_hdr_word(&iph->id)); -+ flush = (u16)((ntohl(net_hdr_word(iph)) ^ skb_gro_len(skb)) | (id & ~IP_DF)); - id >>= 16; - - list_for_each_entry(p, head, list) { ---- a/net/ipv4/tcp_output.c -+++ b/net/ipv4/tcp_output.c -@@ -609,48 +609,53 @@ static void tcp_options_write(__be32 *pt - u16 options = opts->options; /* mungable copy */ - - if (unlikely(OPTION_MD5 & options)) { -- *ptr++ = htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | -- (TCPOPT_MD5SIG << 8) | TCPOLEN_MD5SIG); -+ net_hdr_word(ptr++) = -+ htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | -+ (TCPOPT_MD5SIG << 8) | TCPOLEN_MD5SIG); - /* overload cookie hash location */ - opts->hash_location = (__u8 *)ptr; - ptr += 4; - } - - if (unlikely(opts->mss)) { -- *ptr++ = htonl((TCPOPT_MSS << 24) | -- (TCPOLEN_MSS << 16) | -- opts->mss); -+ net_hdr_word(ptr++) = -+ htonl((TCPOPT_MSS << 24) | (TCPOLEN_MSS << 16) | -+ opts->mss); - } - - if (likely(OPTION_TS & options)) { - if (unlikely(OPTION_SACK_ADVERTISE & options)) { -- *ptr++ = htonl((TCPOPT_SACK_PERM << 24) | -- (TCPOLEN_SACK_PERM << 16) | -- (TCPOPT_TIMESTAMP << 8) | -- TCPOLEN_TIMESTAMP); -+ net_hdr_word(ptr++) = -+ htonl((TCPOPT_SACK_PERM << 24) | -+ (TCPOLEN_SACK_PERM << 16) | -+ (TCPOPT_TIMESTAMP << 8) | -+ TCPOLEN_TIMESTAMP); - options &= ~OPTION_SACK_ADVERTISE; - } else { -- *ptr++ = htonl((TCPOPT_NOP << 24) | -- (TCPOPT_NOP << 16) | -- (TCPOPT_TIMESTAMP << 8) | -- TCPOLEN_TIMESTAMP); -+ net_hdr_word(ptr++) = -+ htonl((TCPOPT_NOP << 24) | -+ (TCPOPT_NOP << 16) | -+ (TCPOPT_TIMESTAMP << 8) | -+ TCPOLEN_TIMESTAMP); - } -- *ptr++ = htonl(opts->tsval); -- *ptr++ = htonl(opts->tsecr); -+ net_hdr_word(ptr++) = htonl(opts->tsval); -+ net_hdr_word(ptr++) = htonl(opts->tsecr); - } - - if (unlikely(OPTION_SACK_ADVERTISE & options)) { -- *ptr++ = htonl((TCPOPT_NOP << 24) | -- (TCPOPT_NOP << 16) | -- (TCPOPT_SACK_PERM << 8) | -- TCPOLEN_SACK_PERM); -+ net_hdr_word(ptr++) = -+ htonl((TCPOPT_NOP << 24) | -+ (TCPOPT_NOP << 16) | -+ (TCPOPT_SACK_PERM << 8) | -+ TCPOLEN_SACK_PERM); - } - - if (unlikely(OPTION_WSCALE & options)) { -- *ptr++ = htonl((TCPOPT_NOP << 24) | -- (TCPOPT_WINDOW << 16) | -- (TCPOLEN_WINDOW << 8) | -- opts->ws); -+ net_hdr_word(ptr++) = -+ htonl((TCPOPT_NOP << 24) | -+ (TCPOPT_WINDOW << 16) | -+ (TCPOLEN_WINDOW << 8) | -+ opts->ws); - } - - if (unlikely(opts->num_sack_blocks)) { -@@ -658,16 +663,17 @@ static void tcp_options_write(__be32 *pt - tp->duplicate_sack : tp->selective_acks; - int this_sack; - -- *ptr++ = htonl((TCPOPT_NOP << 24) | -- (TCPOPT_NOP << 16) | -- (TCPOPT_SACK << 8) | -- (TCPOLEN_SACK_BASE + (opts->num_sack_blocks * -+ net_hdr_word(ptr++) = -+ htonl((TCPOPT_NOP << 24) | -+ (TCPOPT_NOP << 16) | -+ (TCPOPT_SACK << 8) | -+ (TCPOLEN_SACK_BASE + (opts->num_sack_blocks * - TCPOLEN_SACK_PERBLOCK))); - - for (this_sack = 0; this_sack < opts->num_sack_blocks; - ++this_sack) { -- *ptr++ = htonl(sp[this_sack].start_seq); -- *ptr++ = htonl(sp[this_sack].end_seq); -+ net_hdr_word(ptr++) = htonl(sp[this_sack].start_seq); -+ net_hdr_word(ptr++) = htonl(sp[this_sack].end_seq); - } - - tp->rx_opt.dsack = 0; -@@ -680,13 +686,14 @@ static void tcp_options_write(__be32 *pt - - if (foc->exp) { - len = TCPOLEN_EXP_FASTOPEN_BASE + foc->len; -- *ptr = htonl((TCPOPT_EXP << 24) | (len << 16) | -+ net_hdr_word(ptr) = -+ htonl((TCPOPT_EXP << 24) | (len << 16) | - TCPOPT_FASTOPEN_MAGIC); - p += TCPOLEN_EXP_FASTOPEN_BASE; - } else { - len = TCPOLEN_FASTOPEN_BASE + foc->len; -- *p++ = TCPOPT_FASTOPEN; -- *p++ = len; -+ net_hdr_word(p++) = TCPOPT_FASTOPEN; -+ net_hdr_word(p++) = len; - } - - memcpy(p, foc->val, foc->len); ---- a/include/uapi/linux/igmp.h -+++ b/include/uapi/linux/igmp.h -@@ -33,7 +33,7 @@ struct igmphdr { - __u8 code; /* For newer IGMP */ - __sum16 csum; - __be32 group; --}; -+} __attribute__((packed, aligned(2))); - - /* V3 group record types [grec_type] */ - #define IGMPV3_MODE_IS_INCLUDE 1 -@@ -49,7 +49,7 @@ struct igmpv3_grec { - __be16 grec_nsrcs; - __be32 grec_mca; - __be32 grec_src[0]; --}; -+} __attribute__((packed, aligned(2))); - - struct igmpv3_report { - __u8 type; -@@ -58,7 +58,7 @@ struct igmpv3_report { - __be16 resv2; - __be16 ngrec; - struct igmpv3_grec grec[0]; --}; -+} __attribute__((packed, aligned(2))); - - struct igmpv3_query { - __u8 type; -@@ -79,7 +79,7 @@ struct igmpv3_query { - __u8 qqic; - __be16 nsrcs; - __be32 srcs[0]; --}; -+} __attribute__((packed, aligned(2))); - - #define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* From RFC1112 */ - #define IGMP_HOST_MEMBERSHIP_REPORT 0x12 /* Ditto */ ---- a/net/core/flow_dissector.c -+++ b/net/core/flow_dissector.c -@@ -129,7 +129,7 @@ __be32 __skb_flow_get_ports(const struct - ports = __skb_header_pointer(skb, thoff + poff, - sizeof(_ports), data, hlen, &_ports); - if (ports) -- return *ports; -+ return (__be32)net_hdr_word(ports); - } - - return 0; ---- a/include/uapi/linux/icmpv6.h -+++ b/include/uapi/linux/icmpv6.h -@@ -78,7 +78,7 @@ struct icmp6hdr { - #define icmp6_addrconf_other icmp6_dataun.u_nd_ra.other - #define icmp6_rt_lifetime icmp6_dataun.u_nd_ra.rt_lifetime - #define icmp6_router_pref icmp6_dataun.u_nd_ra.router_pref --}; -+} __attribute__((packed, aligned(2))); - - - #define ICMPV6_ROUTER_PREF_LOW 0x3 ---- a/include/net/ndisc.h -+++ b/include/net/ndisc.h -@@ -93,7 +93,7 @@ struct ra_msg { - struct icmp6hdr icmph; - __be32 reachable_time; - __be32 retrans_timer; --}; -+} __attribute__((packed, aligned(2))); - - struct rd_msg { - struct icmp6hdr icmph; -@@ -372,10 +372,10 @@ static inline u32 ndisc_hashfn(const voi - { - const u32 *p32 = pkey; - -- return (((p32[0] ^ hash32_ptr(dev)) * hash_rnd[0]) + -- (p32[1] * hash_rnd[1]) + -- (p32[2] * hash_rnd[2]) + -- (p32[3] * hash_rnd[3])); -+ return (((net_hdr_word(&p32[0]) ^ hash32_ptr(dev)) * hash_rnd[0]) + -+ (net_hdr_word(&p32[1]) * hash_rnd[1]) + -+ (net_hdr_word(&p32[2]) * hash_rnd[2]) + -+ (net_hdr_word(&p32[3]) * hash_rnd[3])); - } - - static inline struct neighbour *__ipv6_neigh_lookup_noref(struct net_device *dev, const void *pkey) ---- a/net/sched/cls_u32.c -+++ b/net/sched/cls_u32.c -@@ -155,7 +155,7 @@ next_knode: - data = skb_header_pointer(skb, toff, 4, &hdata); - if (!data) - goto out; -- if ((*data ^ key->val) & key->mask) { -+ if ((net_hdr_word(data) ^ key->val) & key->mask) { - n = rcu_dereference_bh(n->next); - goto next_knode; - } -@@ -206,8 +206,8 @@ check_terminal: - &hdata); - if (!data) - goto out; -- sel = ht->divisor & u32_hash_fold(*data, &n->sel, -- n->fshift); -+ sel = ht->divisor & u32_hash_fold(net_hdr_word(data), -+ &n->sel, n->fshift); - } - if (!(n->sel.flags & (TC_U32_VAROFFSET | TC_U32_OFFSET | TC_U32_EAT))) - goto next_ht; ---- a/net/ipv6/ip6_offload.c -+++ b/net/ipv6/ip6_offload.c -@@ -241,7 +241,7 @@ INDIRECT_CALLABLE_SCOPE struct sk_buff * - continue; - - iph2 = (struct ipv6hdr *)(p->data + off); -- first_word = *(__be32 *)iph ^ *(__be32 *)iph2; -+ first_word = net_hdr_word(iph) ^ net_hdr_word(iph2); - - /* All fields must match except length and Traffic Class. - * XXX skbs on the gro_list have all been parsed and pulled ---- a/include/net/addrconf.h -+++ b/include/net/addrconf.h -@@ -52,7 +52,7 @@ struct prefix_info { - __be32 reserved2; - - struct in6_addr prefix; --}; -+} __attribute__((packed, aligned(2))); - - /* rfc4861 4.6.2: IPv6 PIO is 32 bytes in size */ - static_assert(sizeof(struct prefix_info) == 32); ---- a/include/net/inet_ecn.h -+++ b/include/net/inet_ecn.h -@@ -138,9 +138,9 @@ static inline int IP6_ECN_set_ce(struct - if (INET_ECN_is_not_ect(ipv6_get_dsfield(iph))) - return 0; - -- from = *(__be32 *)iph; -+ from = net_hdr_word(iph); - to = from | htonl(INET_ECN_CE << 20); -- *(__be32 *)iph = to; -+ net_hdr_word(iph) = to; - if (skb->ip_summed == CHECKSUM_COMPLETE) - skb->csum = csum_add(csum_sub(skb->csum, (__force __wsum)from), - (__force __wsum)to); ---- a/include/net/ipv6.h -+++ b/include/net/ipv6.h -@@ -147,7 +147,7 @@ struct frag_hdr { - __u8 reserved; - __be16 frag_off; - __be32 identification; --}; -+} __attribute__((packed, aligned(2))); - - #define IP6_MF 0x0001 - #define IP6_OFFSET 0xFFF8 -@@ -561,8 +561,8 @@ static inline void __ipv6_addr_set_half( - } - #endif - #endif -- addr[0] = wh; -- addr[1] = wl; -+ net_hdr_word(&addr[0]) = wh; -+ net_hdr_word(&addr[1]) = wl; - } - - static inline void ipv6_addr_set(struct in6_addr *addr, -@@ -621,6 +621,8 @@ static inline bool ipv6_prefix_equal(con - const __be32 *a1 = addr1->s6_addr32; - const __be32 *a2 = addr2->s6_addr32; - unsigned int pdw, pbi; -+ /* Used for last <32-bit fraction of prefix */ -+ u32 pbia1, pbia2; - - /* check complete u32 in prefix */ - pdw = prefixlen >> 5; -@@ -629,7 +631,9 @@ static inline bool ipv6_prefix_equal(con - - /* check incomplete u32 in prefix */ - pbi = prefixlen & 0x1f; -- if (pbi && ((a1[pdw] ^ a2[pdw]) & htonl((0xffffffff) << (32 - pbi)))) -+ pbia1 = net_hdr_word(&a1[pdw]); -+ pbia2 = net_hdr_word(&a2[pdw]); -+ if (pbi && ((pbia1 ^ pbia2) & htonl((0xffffffff) << (32 - pbi)))) - return false; - - return true; -@@ -746,13 +750,13 @@ static inline void ipv6_addr_set_v4mappe - */ - static inline int __ipv6_addr_diff32(const void *token1, const void *token2, int addrlen) - { -- const __be32 *a1 = token1, *a2 = token2; -+ const struct in6_addr *a1 = token1, *a2 = token2; - int i; - - addrlen >>= 2; - - for (i = 0; i < addrlen; i++) { -- __be32 xb = a1[i] ^ a2[i]; -+ __be32 xb = a1->s6_addr32[i] ^ a2->s6_addr32[i]; - if (xb) - return i * 32 + 31 - __fls(ntohl(xb)); - } -@@ -946,17 +950,18 @@ static inline u32 ip6_multipath_hash_fie - static inline void ip6_flow_hdr(struct ipv6hdr *hdr, unsigned int tclass, - __be32 flowlabel) - { -- *(__be32 *)hdr = htonl(0x60000000 | (tclass << 20)) | flowlabel; -+ net_hdr_word((__be32 *)hdr) = -+ htonl(0x60000000 | (tclass << 20)) | flowlabel; - } - - static inline __be32 ip6_flowinfo(const struct ipv6hdr *hdr) - { -- return *(__be32 *)hdr & IPV6_FLOWINFO_MASK; -+ return net_hdr_word((__be32 *)hdr) & IPV6_FLOWINFO_MASK; - } - - static inline __be32 ip6_flowlabel(const struct ipv6hdr *hdr) - { -- return *(__be32 *)hdr & IPV6_FLOWLABEL_MASK; -+ return net_hdr_word((__be32 *)hdr) & IPV6_FLOWLABEL_MASK; - } - - static inline u8 ip6_tclass(__be32 flowinfo) ---- a/include/net/secure_seq.h -+++ b/include/net/secure_seq.h -@@ -3,6 +3,7 @@ - #define _NET_SECURE_SEQ - - #include -+#include - - u64 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport); - u64 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr, ---- a/include/uapi/linux/in.h -+++ b/include/uapi/linux/in.h -@@ -88,7 +88,7 @@ enum { - /* Internet address. */ - struct in_addr { - __be32 s_addr; --}; -+} __attribute__((packed, aligned(2))); - #endif - - #define IP_TOS 1 ---- a/net/ipv6/ip6_fib.c -+++ b/net/ipv6/ip6_fib.c -@@ -141,7 +141,7 @@ static __be32 addr_bit_set(const void *t - * See include/asm-generic/bitops/le.h. - */ - return (__force __be32)(1 << ((~fn_bit ^ BITOP_BE32_SWIZZLE) & 0x1f)) & -- addr[fn_bit >> 5]; -+ net_hdr_word(&addr[fn_bit >> 5]); - } - - struct fib6_info *fib6_info_alloc(gfp_t gfp_flags, bool with_fib6_nh) ---- a/net/netfilter/nf_conntrack_proto_tcp.c -+++ b/net/netfilter/nf_conntrack_proto_tcp.c -@@ -400,7 +400,7 @@ static void tcp_sack(const struct sk_buf - - /* Fast path for timestamp-only option */ - if (length == TCPOLEN_TSTAMP_ALIGNED -- && *(__be32 *)ptr == htonl((TCPOPT_NOP << 24) -+ && net_hdr_word(ptr) == htonl((TCPOPT_NOP << 24) - | (TCPOPT_NOP << 16) - | (TCPOPT_TIMESTAMP << 8) - | TCPOLEN_TIMESTAMP)) ---- a/net/xfrm/xfrm_input.c -+++ b/net/xfrm/xfrm_input.c -@@ -167,8 +167,8 @@ int xfrm_parse_spi(struct sk_buff *skb, - if (!pskb_may_pull(skb, hlen)) - return -EINVAL; - -- *spi = *(__be32 *)(skb_transport_header(skb) + offset); -- *seq = *(__be32 *)(skb_transport_header(skb) + offset_seq); -+ *spi = net_hdr_word(skb_transport_header(skb) + offset); -+ *seq = net_hdr_word(skb_transport_header(skb) + offset_seq); - return 0; - } - EXPORT_SYMBOL(xfrm_parse_spi); ---- a/net/ipv4/tcp_input.c -+++ b/net/ipv4/tcp_input.c -@@ -4175,14 +4175,16 @@ static bool tcp_parse_aligned_timestamp( - { - const __be32 *ptr = (const __be32 *)(th + 1); - -- if (*ptr == htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) -- | (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP)) { -+ if (net_hdr_word(ptr) == -+ htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | -+ (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP)) { - tp->rx_opt.saw_tstamp = 1; - ++ptr; -- tp->rx_opt.rcv_tsval = ntohl(*ptr); -+ tp->rx_opt.rcv_tsval = get_unaligned_be32(ptr); - ++ptr; -- if (*ptr) -- tp->rx_opt.rcv_tsecr = ntohl(*ptr) - tp->tsoffset; -+ if (net_hdr_word(ptr)) -+ tp->rx_opt.rcv_tsecr = get_unaligned_be32(ptr) - -+ tp->tsoffset; - else - tp->rx_opt.rcv_tsecr = 0; - return true; ---- a/include/uapi/linux/if_pppox.h -+++ b/include/uapi/linux/if_pppox.h -@@ -51,6 +51,7 @@ struct pppoe_addr { - */ - struct pptp_addr { - __u16 call_id; -+ __u16 pad; - struct in_addr sin_addr; - }; - ---- a/include/net/neighbour.h -+++ b/include/net/neighbour.h -@@ -270,8 +270,10 @@ static inline bool neigh_key_eq128(const - const u32 *n32 = (const u32 *)n->primary_key; - const u32 *p32 = pkey; - -- return ((n32[0] ^ p32[0]) | (n32[1] ^ p32[1]) | -- (n32[2] ^ p32[2]) | (n32[3] ^ p32[3])) == 0; -+ return ((n32[0] ^ net_hdr_word(&p32[0])) | -+ (n32[1] ^ net_hdr_word(&p32[1])) | -+ (n32[2] ^ net_hdr_word(&p32[2])) | -+ (n32[3] ^ net_hdr_word(&p32[3]))) == 0; - } - - static inline struct neighbour *___neigh_lookup_noref( ---- a/include/uapi/linux/netfilter_arp/arp_tables.h -+++ b/include/uapi/linux/netfilter_arp/arp_tables.h -@@ -70,7 +70,7 @@ struct arpt_arp { - __u8 flags; - /* Inverse flags */ - __u16 invflags; --}; -+} __attribute__((aligned(4))); - - /* Values for "flag" field in struct arpt_ip (general arp structure). - * No flags defined yet. ---- a/net/core/utils.c -+++ b/net/core/utils.c -@@ -460,8 +460,14 @@ void inet_proto_csum_replace16(__sum16 * - bool pseudohdr) - { - __be32 diff[] = { -- ~from[0], ~from[1], ~from[2], ~from[3], -- to[0], to[1], to[2], to[3], -+ ~net_hdr_word(&from[0]), -+ ~net_hdr_word(&from[1]), -+ ~net_hdr_word(&from[2]), -+ ~net_hdr_word(&from[3]), -+ net_hdr_word(&to[0]), -+ net_hdr_word(&to[1]), -+ net_hdr_word(&to[2]), -+ net_hdr_word(&to[3]), - }; - if (skb->ip_summed != CHECKSUM_PARTIAL) { - *sum = csum_fold(csum_partial(diff, sizeof(diff), ---- a/include/linux/etherdevice.h -+++ b/include/linux/etherdevice.h -@@ -525,7 +525,7 @@ static inline bool is_etherdev_addr(cons - * @b: Pointer to Ethernet header - * - * Compare two Ethernet headers, returns 0 if equal. -- * This assumes that the network header (i.e., IP header) is 4-byte -+ * This assumes that the network header (i.e., IP header) is 2-byte - * aligned OR the platform can handle unaligned access. This is the - * case for all packets coming into netif_receive_skb or similar - * entry points. -@@ -548,11 +548,12 @@ static inline unsigned long compare_ethe - fold |= *(unsigned long *)(a + 6) ^ *(unsigned long *)(b + 6); - return fold; - #else -- u32 *a32 = (u32 *)((u8 *)a + 2); -- u32 *b32 = (u32 *)((u8 *)b + 2); -+ const u16 *a16 = a; -+ const u16 *b16 = b; - -- return (*(u16 *)a ^ *(u16 *)b) | (a32[0] ^ b32[0]) | -- (a32[1] ^ b32[1]) | (a32[2] ^ b32[2]); -+ return (a16[0] ^ b16[0]) | (a16[1] ^ b16[1]) | (a16[2] ^ b16[2]) | -+ (a16[3] ^ b16[3]) | (a16[4] ^ b16[4]) | (a16[5] ^ b16[5]) | -+ (a16[6] ^ b16[6]); - #endif - } - ---- a/net/ipv4/tcp_offload.c -+++ b/net/ipv4/tcp_offload.c -@@ -223,7 +223,7 @@ struct sk_buff *tcp_gro_receive(struct l - - th2 = tcp_hdr(p); - -- if (*(u32 *)&th->source ^ *(u32 *)&th2->source) { -+ if (net_hdr_word(&th->source) ^ net_hdr_word(&th2->source)) { - NAPI_GRO_CB(p)->same_flow = 0; - continue; - } -@@ -241,8 +241,8 @@ found: - ~(TCP_FLAG_CWR | TCP_FLAG_FIN | TCP_FLAG_PSH)); - flush |= (__force int)(th->ack_seq ^ th2->ack_seq); - for (i = sizeof(*th); i < thlen; i += 4) -- flush |= *(u32 *)((u8 *)th + i) ^ -- *(u32 *)((u8 *)th2 + i); -+ flush |= net_hdr_word((u8 *)th + i) ^ -+ net_hdr_word((u8 *)th2 + i); - - /* When we receive our second frame we can made a decision on if we - * continue this flow as an atomic flow with a fixed ID or if we use ---- a/net/ipv6/netfilter/ip6table_mangle.c -+++ b/net/ipv6/netfilter/ip6table_mangle.c -@@ -44,7 +44,7 @@ ip6t_mangle_out(struct sk_buff *skb, con - hop_limit = ipv6_hdr(skb)->hop_limit; - - /* flowlabel and prio (includes version, which shouldn't change either */ -- flowlabel = *((u_int32_t *)ipv6_hdr(skb)); -+ flowlabel = net_hdr_word(ipv6_hdr(skb)); - - ret = ip6t_do_table(skb, state, priv); - -@@ -53,7 +53,7 @@ ip6t_mangle_out(struct sk_buff *skb, con - !ipv6_addr_equal(&ipv6_hdr(skb)->daddr, &daddr) || - skb->mark != mark || - ipv6_hdr(skb)->hop_limit != hop_limit || -- flowlabel != *((u_int32_t *)ipv6_hdr(skb)))) { -+ flowlabel != net_hdr_word(ipv6_hdr(skb)))) { - err = ip6_route_me_harder(state->net, state->sk, skb); - if (err < 0) - ret = NF_DROP_ERR(err); diff --git a/target/linux/ath79/patches-5.15/910-mikrotik-rb4xx.patch b/target/linux/ath79/patches-5.15/910-mikrotik-rb4xx.patch deleted file mode 100644 index 4743ad46e2522e..00000000000000 --- a/target/linux/ath79/patches-5.15/910-mikrotik-rb4xx.patch +++ /dev/null @@ -1,121 +0,0 @@ -From: Christopher Hill -Subject: [PATCH] ath79: add Mikrotik rb4xx series drivers - -This adds 3 Mikrotik rb4xx series drivers as follows: - -rb4xx-cpld: This is in the mfd subsystem, and is the parent CPLD device -that interfaces between the SoC SPI bus and its two children below. -rb4xx-gpio: This is the GPIO expander. -rb4xx-nand: This is the NAND driver. - -The history of this code comes in three phases. - -1. The first is a May 2015 attempt to push the equivalient ar71xx rb4xx -drivers upstream. See https://lore.kernel.org/patchwork/patch/940880/. - -Module-author: Gabor Juhos -Module-author: Imre Kaloz -Module-author: Bert Vermeulen - -2. Next several ar71xx patches were applied bringing the code current. - -commit 7bbf4117c6fe4b764d9d7c62fb2bcf6dd93bff2c -Submitted-by: Hauke Mehrtens - -commit af79fdbe4af32a287798b579141204bda056b8aa -commit 889272d92db689fd9c910243635e44c9d8323095 -commit e21cb649a235180563363b8af5ba8296b9ac0baa -commit 7c09fa4a7492ca436f2c94bd9a465b7c5bbeed6f -Submitted-by: Felix Fietkau - -3. Finally a heavy refactor to split the driver into the three new -subsystems, and updated to work with the device tree configuration, plus -updates and review feedback incorporated - -Reviewed-by: Thibaut VARÈNE -Submitted-by: Christopher Hill ---- - drivers/mfd/Kconfig | 8 ++++++++ - drivers/mfd/Makefile | 1 + - drivers/gpio/Kconfig | 6 ++++++ - drivers/gpio/Makefile | 1 + - drivers/mtd/nand/raw/Kconfig | 7 +++++++ - drivers/mtd/nand/raw/Makefile | 1 + - 6 files changed, 24 insertions(+) - ---- a/drivers/mfd/Kconfig -+++ b/drivers/mfd/Kconfig -@@ -2176,6 +2176,14 @@ config RAVE_SP_CORE - Select this to get support for the Supervisory Processor - device found on several devices in RAVE line of hardware. - -+config MFD_RB4XX_CPLD -+ tristate "CPLD driver for Mikrotik RB4xx series boards" -+ select MFD_CORE -+ depends on ATH79 || COMPILE_TEST -+ help -+ Enables support for the CPLD chip (NAND & GPIO) on Mikrotik -+ Routerboard RB4xx series. -+ - config SGI_MFD_IOC3 - bool "SGI IOC3 core driver" - depends on PCI && MIPS && 64BIT ---- a/drivers/mfd/Makefile -+++ b/drivers/mfd/Makefile -@@ -267,6 +267,7 @@ obj-$(CONFIG_MFD_KHADAS_MCU) += khadas- - obj-$(CONFIG_MFD_ACER_A500_EC) += acer-ec-a500.o - obj-$(CONFIG_MFD_QCOM_PM8008) += qcom-pm8008.o - -+obj-$(CONFIG_MFD_RB4XX_CPLD) += rb4xx-cpld.o - obj-$(CONFIG_SGI_MFD_IOC3) += ioc3.o - obj-$(CONFIG_MFD_SIMPLE_MFD_I2C) += simple-mfd-i2c.o - obj-$(CONFIG_MFD_INTEL_M10_BMC) += intel-m10-bmc.o ---- a/drivers/gpio/Kconfig -+++ b/drivers/gpio/Kconfig -@@ -1574,6 +1574,12 @@ config GPIO_SODAVILLE - help - Say Y here to support Intel Sodaville GPIO. - -+config GPIO_RB4XX -+ tristate "GPIO expander for Mikrotik RB4xx series boards" -+ depends on MFD_RB4XX_CPLD -+ help -+ GPIO driver for Mikrotik Routerboard RB4xx series. -+ - endmenu - - menu "SPI GPIO expanders" ---- a/drivers/gpio/Makefile -+++ b/drivers/gpio/Makefile -@@ -122,6 +122,7 @@ obj-$(CONFIG_GPIO_PL061) += gpio-pl061. - obj-$(CONFIG_GPIO_PMIC_EIC_SPRD) += gpio-pmic-eic-sprd.o - obj-$(CONFIG_GPIO_PXA) += gpio-pxa.o - obj-$(CONFIG_GPIO_RASPBERRYPI_EXP) += gpio-raspberrypi-exp.o -+obj-$(CONFIG_GPIO_RB4XX) += gpio-rb4xx.o - obj-$(CONFIG_GPIO_RC5T583) += gpio-rc5t583.o - obj-$(CONFIG_GPIO_RCAR) += gpio-rcar.o - obj-$(CONFIG_GPIO_RDA) += gpio-rda.o ---- a/drivers/mtd/nand/raw/Kconfig -+++ b/drivers/mtd/nand/raw/Kconfig -@@ -563,4 +563,11 @@ config MTD_NAND_AR934X - Enables support for NAND controller on Qualcomm Atheros SoCs. - This controller is found on AR934x and QCA955x SoCs. - -+config MTD_NAND_RB4XX -+ tristate "Support for NAND driver for Mikrotik RB4xx series boards" -+ depends on MFD_RB4XX_CPLD -+ help -+ Enables support for the NAND flash chip on Mikrotik Routerboard -+ RB4xx series. -+ - endif # MTD_RAW_NAND ---- a/drivers/mtd/nand/raw/Makefile -+++ b/drivers/mtd/nand/raw/Makefile -@@ -59,6 +59,7 @@ obj-$(CONFIG_MTD_NAND_INTEL_LGM) += inte - obj-$(CONFIG_MTD_NAND_ROCKCHIP) += rockchip-nand-controller.o - obj-$(CONFIG_MTD_NAND_PL35X) += pl35x-nand-controller.o - obj-$(CONFIG_MTD_NAND_AR934X) += ar934x_nand.o -+obj-$(CONFIG_MTD_NAND_RB4XX) += nand_rb4xx.o - - nand-objs := nand_base.o nand_legacy.o nand_bbt.o nand_timings.o nand_ids.o - nand-objs += nand_onfi.o diff --git a/target/linux/ath79/patches-5.15/911-mikrotik-rb91x.patch b/target/linux/ath79/patches-5.15/911-mikrotik-rb91x.patch deleted file mode 100644 index 94967bf674c471..00000000000000 --- a/target/linux/ath79/patches-5.15/911-mikrotik-rb91x.patch +++ /dev/null @@ -1,97 +0,0 @@ -From: Denis Kalashnikov -Subject: [PATCH] ath79: add support for reset key on MikroTik RB912UAG-2HPnD - -On MikroTik RB91x board series a reset key shares SoC gpio -line #15 with NAND ALE and NAND IO7. So we need a custom -gpio driver to manage this non-trivial connection schema. -Also rb91x-nand needs to have an ability to disable a polling -of the key while it works with NAND. - -While we've been integrating rb91x-key into a firmware, we've -figured out that: -* In the gpio-latch driver we need to add a "cansleep" suffix to -several gpiolib calls, -* When gpio-latch and rb91x-nand fail to get a gpio and an error -is -EPROBE_DEFER, they shouldn't report about this, since this -actually is not an error and occurs when the gpio-latch probe -function is called before the rb91x-key probe. -We fix these related things here too. - -Submitted-by: Denis Kalashnikov -Reviewed-by: Sergey Ryazanov -Tested-by: Koen Vandeputte ---- - drivers/gpio/Kconfig | 11 +++++++++++ - drivers/gpio/Makefile | 2 ++ - drivers/mtd/nand/raw/Kconfig | 6 ++++++ - drivers/mtd/nand/raw/Makefile | 1 + - 7 files changed, 20 insertions(+) - ---- a/drivers/gpio/Kconfig -+++ b/drivers/gpio/Kconfig -@@ -353,6 +353,13 @@ config GPIO_IXP4XX - IXP4xx series of chips. - - If unsure, say N. -+ -+config GPIO_LATCH -+ tristate "MikroTik RouterBOARD GPIO latch support" -+ depends on ATH79 -+ help -+ GPIO driver for latch on some MikroTik RouterBOARDs. -+ - config GPIO_LOGICVC - tristate "Xylon LogiCVC GPIO support" - depends on MFD_SYSCON && OF -@@ -529,6 +536,10 @@ config GPIO_ROCKCHIP - help - Say yes here to support GPIO on Rockchip SoCs. - -+config GPIO_RB91X_KEY -+ tristate "MikroTik RB91x board series reset key support" -+ depends on ATH79 -+ - config GPIO_SAMA5D2_PIOBU - tristate "SAMA5D2 PIOBU GPIO support" - depends on MFD_SYSCON ---- a/drivers/gpio/Makefile -+++ b/drivers/gpio/Makefile -@@ -75,6 +75,7 @@ obj-$(CONFIG_GPIO_IT87) += gpio-it87.o - obj-$(CONFIG_GPIO_IXP4XX) += gpio-ixp4xx.o - obj-$(CONFIG_GPIO_JANZ_TTL) += gpio-janz-ttl.o - obj-$(CONFIG_GPIO_KEMPLD) += gpio-kempld.o -+obj-$(CONFIG_GPIO_LATCH) += gpio-latch.o - obj-$(CONFIG_GPIO_LOGICVC) += gpio-logicvc.o - obj-$(CONFIG_GPIO_LOONGSON1) += gpio-loongson1.o - obj-$(CONFIG_GPIO_LOONGSON) += gpio-loongson.o -@@ -123,6 +124,7 @@ obj-$(CONFIG_GPIO_PMIC_EIC_SPRD) += gpio - obj-$(CONFIG_GPIO_PXA) += gpio-pxa.o - obj-$(CONFIG_GPIO_RASPBERRYPI_EXP) += gpio-raspberrypi-exp.o - obj-$(CONFIG_GPIO_RB4XX) += gpio-rb4xx.o -+obj-$(CONFIG_GPIO_RB91X_KEY) += gpio-rb91x-key.o - obj-$(CONFIG_GPIO_RC5T583) += gpio-rc5t583.o - obj-$(CONFIG_GPIO_RCAR) += gpio-rcar.o - obj-$(CONFIG_GPIO_RDA) += gpio-rda.o ---- a/drivers/mtd/nand/raw/Kconfig -+++ b/drivers/mtd/nand/raw/Kconfig -@@ -570,4 +570,10 @@ config MTD_NAND_RB4XX - Enables support for the NAND flash chip on Mikrotik Routerboard - RB4xx series. - -+config MTD_NAND_RB91X -+ tristate "MikroTik RB91x NAND driver support" -+ depends on ATH79 && MTD_RAW_NAND -+ help -+ Enables support for the NAND flash chip on MikroTik RB91x series. -+ - endif # MTD_RAW_NAND ---- a/drivers/mtd/nand/raw/Makefile -+++ b/drivers/mtd/nand/raw/Makefile -@@ -60,6 +60,7 @@ obj-$(CONFIG_MTD_NAND_ROCKCHIP) += rock - obj-$(CONFIG_MTD_NAND_PL35X) += pl35x-nand-controller.o - obj-$(CONFIG_MTD_NAND_AR934X) += ar934x_nand.o - obj-$(CONFIG_MTD_NAND_RB4XX) += nand_rb4xx.o -+obj-$(CONFIG_MTD_NAND_RB91X) += rb91x_nand.o - - nand-objs := nand_base.o nand_legacy.o nand_bbt.o nand_timings.o nand_ids.o - nand-objs += nand_onfi.o diff --git a/target/linux/ath79/patches-6.1/900-unaligned_access_hacks.patch b/target/linux/ath79/patches-6.1/900-unaligned_access_hacks.patch index b6f6d63f684725..e1c6835afde3f4 100644 --- a/target/linux/ath79/patches-6.1/900-unaligned_access_hacks.patch +++ b/target/linux/ath79/patches-6.1/900-unaligned_access_hacks.patch @@ -86,7 +86,7 @@ SVN-Revision: 35130 } while (word != stop); return csum_fold(csum); -@@ -179,73 +183,6 @@ static inline __sum16 ip_compute_csum(co +@@ -179,74 +183,6 @@ static inline __sum16 ip_compute_csum(co return csum_fold(csum_partial(buff, len, 0)); } @@ -152,7 +152,8 @@ SVN-Revision: 35130 - " .set pop" - : "=&r" (sum), "=&r" (tmp) - : "r" (saddr), "r" (daddr), -- "0" (htonl(len)), "r" (htonl(proto)), "r" (sum)); +- "0" (htonl(len)), "r" (htonl(proto)), "r" (sum) +- : "memory"); - - return csum_fold(sum); -} @@ -311,7 +312,7 @@ SVN-Revision: 35130 case IPV6_2292HOPOPTS: --- a/net/ipv6/exthdrs.c +++ b/net/ipv6/exthdrs.c -@@ -1003,7 +1003,7 @@ static bool ipv6_hop_jumbo(struct sk_buf +@@ -1013,7 +1013,7 @@ static bool ipv6_hop_jumbo(struct sk_buf goto drop; } diff --git a/target/linux/bcm27xx/base-files/lib/preinit/79_move_config b/target/linux/bcm27xx/base-files/lib/preinit/79_move_config index db5bf93b626b00..fed5278130589a 100644 --- a/target/linux/bcm27xx/base-files/lib/preinit/79_move_config +++ b/target/linux/bcm27xx/base-files/lib/preinit/79_move_config @@ -16,7 +16,10 @@ move_config() { insmod vfat mkdir -p /boot mount -t vfat -o rw,noatime /dev/$partdev /boot - [ -f "/boot/$BACKUP_FILE" ] && mv -f "/boot/$BACKUP_FILE" / + if [ -f "/boot/$BACKUP_FILE" ]; then + mv -f "/boot/$BACKUP_FILE" / + export BCM27XX_SET_ROOT_PART=1 + fi fi } diff --git a/target/linux/bcm27xx/base-files/lib/preinit/81_set_root_part b/target/linux/bcm27xx/base-files/lib/preinit/81_set_root_part new file mode 100644 index 00000000000000..a915150213a537 --- /dev/null +++ b/target/linux/bcm27xx/base-files/lib/preinit/81_set_root_part @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: GPL-2.0-only + +. /lib/upgrade/platform.sh + +do_set_root_part() { + if [ "$BCM27XX_SET_ROOT_PART" -eq "1" ]; then + bcm27xx_set_root_part + unset BCM27XX_SET_ROOT_PART + fi +} + +[ "$INITRAMFS" = "1" ] || boot_hook_add preinit_main do_set_root_part diff --git a/target/linux/bcm27xx/base-files/lib/upgrade/platform.sh b/target/linux/bcm27xx/base-files/lib/upgrade/platform.sh index 956bc1c7886ae1..69cc60e2bcb095 100644 --- a/target/linux/bcm27xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/bcm27xx/base-files/lib/upgrade/platform.sh @@ -85,15 +85,46 @@ platform_do_upgrade() { get_image "$@" | dd of="/dev/$diskdev" bs=1 skip=440 count=4 seek=440 conv=fsync } +bcm27xx_set_root_part() { + local root_part + + if [ -f "/boot/partuuid.txt" ]; then + root_part="PARTUUID=$(cat "/boot/partuuid.txt")-02" + else + root_part="/dev/mmcblk0p2" + fi + + sed -i "s#\broot=[^ ]*#root=${root_part}#g" "/boot/cmdline.txt" +} + platform_copy_config() { local partdev if export_partdevice partdev 1; then mkdir -p /boot - [ -f "/boot/kernel*.img" ] || mount -t vfat -o rw,noatime "/dev/$partdev" /boot - cp -af "$UPGRADE_BACKUP" "/boot/$BACKUP_FILE" + [ -f /boot/kernel*.img ] || mount -t vfat -o rw,noatime "/dev/$partdev" /boot + tar -C / -zxvf "$UPGRADE_BACKUP" boot/cmdline.txt boot/config.txt + bcm27xx_set_root_part + + local backup_tmp="/tmp/backup-update" + mkdir -p $backup_tmp + tar -C $backup_tmp -zxvf $UPGRADE_BACKUP + cp -af /boot/cmdline.txt $backup_tmp/boot/ + + local work_dir=$(pwd) + cd $backup_tmp + tar -C $backup_tmp -zcvf /boot/$BACKUP_FILE * + cd $work_dir + sync umount /boot fi } + +platform_restore_backup() { + local TAR_V=$1 + + tar -C / -x${TAR_V}zf "$CONF_RESTORE" + bcm27xx_set_root_part +} diff --git a/target/linux/bcm27xx/image/Makefile b/target/linux/bcm27xx/image/Makefile index 12ac0012a49169..9d41e47bac3d15 100644 --- a/target/linux/bcm27xx/image/Makefile +++ b/target/linux/bcm27xx/image/Makefile @@ -15,13 +15,19 @@ endef ### Image scripts ### define Build/boot-common + echo $(IMG_PART_SIGNATURE) > $@-partuuid.txt + sed \ + -e 's#@ROOT@#PARTUUID=$(IMG_PART_SIGNATURE)-02#g' \ + cmdline.txt > $@-cmdline.txt + rm -f $@.boot mkfs.fat -n boot -C $@.boot $(FAT32_BLOCKS) mcopy -i $@.boot $(KDIR)/COPYING.linux :: mcopy -i $@.boot $(KDIR)/LICENCE.broadcom :: - mcopy -i $@.boot cmdline.txt :: + mcopy -i $@.boot $@-cmdline.txt ::cmdline.txt mcopy -i $@.boot config.txt :: mcopy -i $@.boot distroconfig.txt :: + mcopy -i $@.boot $@-partuuid.txt ::partuuid.txt mcopy -i $@.boot $(IMAGE_KERNEL) ::$(KERNEL_IMG) $(foreach dts,$(shell echo $(DEVICE_DTS)),mcopy -i $@.boot $(DTS_DIR)/$(dts).dtb ::;) mmd -i $@.boot ::/overlays @@ -49,6 +55,7 @@ define Build/boot-2711 endef define Build/sdcard-img + SIGNATURE="$(IMG_PART_SIGNATURE)" \ ./gen_rpi_sdcard_img.sh $@ $@.boot $(IMAGE_ROOTFS) \ $(CONFIG_TARGET_KERNEL_PARTSIZE) $(CONFIG_TARGET_ROOTFS_PARTSIZE) endef diff --git a/target/linux/bcm27xx/image/cmdline.txt b/target/linux/bcm27xx/image/cmdline.txt index d9b7d867a70cbf..41f76f10af078a 100644 --- a/target/linux/bcm27xx/image/cmdline.txt +++ b/target/linux/bcm27xx/image/cmdline.txt @@ -1 +1 @@ -console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=squashfs,ext4 rootwait +console=serial0,115200 console=tty1 root=@ROOT@ rootfstype=squashfs,ext4 rootwait diff --git a/target/linux/bcm27xx/image/gen_rpi_sdcard_img.sh b/target/linux/bcm27xx/image/gen_rpi_sdcard_img.sh index 488a3517c735ae..8d33e4f54c1d7b 100755 --- a/target/linux/bcm27xx/image/gen_rpi_sdcard_img.sh +++ b/target/linux/bcm27xx/image/gen_rpi_sdcard_img.sh @@ -19,7 +19,7 @@ kernel_type=c rootfs_type=83 sect=63 -set $(ptgen -o $OUTPUT -h $head -s $sect -l $align -t $kernel_type -p ${BOOTFSSIZE}M -t $rootfs_type -p ${ROOTFSSIZE}M) +set $(ptgen -o $OUTPUT -h $head -s $sect -l $align -t $kernel_type -p ${BOOTFSSIZE}M -t $rootfs_type -p ${ROOTFSSIZE}M ${SIGNATURE:+-S 0x$SIGNATURE}) BOOTOFFSET="$(($1 / 512))" ROOTFSOFFSET="$(($3 / 512))" diff --git a/target/linux/bcm27xx/patches-6.1/950-0100-lan78xx-Enable-LEDs-and-auto-negotiation.patch b/target/linux/bcm27xx/patches-6.1/950-0100-lan78xx-Enable-LEDs-and-auto-negotiation.patch index 9c5a7333c4f386..b0c577587a689d 100644 --- a/target/linux/bcm27xx/patches-6.1/950-0100-lan78xx-Enable-LEDs-and-auto-negotiation.patch +++ b/target/linux/bcm27xx/patches-6.1/950-0100-lan78xx-Enable-LEDs-and-auto-negotiation.patch @@ -14,7 +14,7 @@ Signed-off-by: Phil Elwell --- a/drivers/net/usb/lan78xx.c +++ b/drivers/net/usb/lan78xx.c -@@ -2881,6 +2881,11 @@ static int lan78xx_reset(struct lan78xx_ +@@ -2883,6 +2883,11 @@ static int lan78xx_reset(struct lan78xx_ int ret; u32 buf; u8 sig; @@ -26,7 +26,7 @@ Signed-off-by: Phil Elwell ret = lan78xx_read_reg(dev, HW_CFG, &buf); if (ret < 0) -@@ -2945,6 +2950,10 @@ static int lan78xx_reset(struct lan78xx_ +@@ -2947,6 +2952,10 @@ static int lan78xx_reset(struct lan78xx_ buf |= HW_CFG_MEF_; @@ -37,7 +37,7 @@ Signed-off-by: Phil Elwell ret = lan78xx_write_reg(dev, HW_CFG, buf); if (ret < 0) return ret; -@@ -3043,6 +3052,9 @@ static int lan78xx_reset(struct lan78xx_ +@@ -3046,6 +3055,9 @@ static int lan78xx_reset(struct lan78xx_ buf |= MAC_CR_AUTO_DUPLEX_ | MAC_CR_AUTO_SPEED_; } } diff --git a/target/linux/bcm27xx/patches-6.1/950-0101-amba_pl011-Insert-mb-for-correct-FIFO-handling.patch b/target/linux/bcm27xx/patches-6.1/950-0101-amba_pl011-Insert-mb-for-correct-FIFO-handling.patch index 67a9eb97454d9e..8a351aebe315fa 100644 --- a/target/linux/bcm27xx/patches-6.1/950-0101-amba_pl011-Insert-mb-for-correct-FIFO-handling.patch +++ b/target/linux/bcm27xx/patches-6.1/950-0101-amba_pl011-Insert-mb-for-correct-FIFO-handling.patch @@ -17,7 +17,7 @@ Signed-off-by: Phil Elwell --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c -@@ -1426,6 +1426,7 @@ static bool pl011_tx_char(struct uart_am +@@ -1456,6 +1456,7 @@ static bool pl011_tx_char(struct uart_am return false; /* unable to transmit character */ pl011_write(c, uap, REG_DR); diff --git a/target/linux/bcm27xx/patches-6.1/950-0106-Add-dwc_otg-driver.patch b/target/linux/bcm27xx/patches-6.1/950-0106-Add-dwc_otg-driver.patch index 02fc0ed49a33bc..f8ab3b04a103f4 100644 --- a/target/linux/bcm27xx/patches-6.1/950-0106-Add-dwc_otg-driver.patch +++ b/target/linux/bcm27xx/patches-6.1/950-0106-Add-dwc_otg-driver.patch @@ -1185,7 +1185,7 @@ Signed-off-by: Jonathan Bell } --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c -@@ -5669,7 +5669,7 @@ static void port_event(struct usb_hub *h +@@ -5677,7 +5677,7 @@ static void port_event(struct usb_hub *h port_dev->over_current_count++; port_over_current_notify(port_dev); diff --git a/target/linux/bcm27xx/patches-6.1/950-0137-lan78xx-Read-initial-EEE-status-from-DT.patch b/target/linux/bcm27xx/patches-6.1/950-0137-lan78xx-Read-initial-EEE-status-from-DT.patch index 8d097c1ea91dfd..7c9268289c4776 100644 --- a/target/linux/bcm27xx/patches-6.1/950-0137-lan78xx-Read-initial-EEE-status-from-DT.patch +++ b/target/linux/bcm27xx/patches-6.1/950-0137-lan78xx-Read-initial-EEE-status-from-DT.patch @@ -15,7 +15,7 @@ Signed-off-by: Phil Elwell --- a/drivers/net/usb/lan78xx.c +++ b/drivers/net/usb/lan78xx.c -@@ -3108,6 +3108,22 @@ static int lan78xx_open(struct net_devic +@@ -3111,6 +3111,22 @@ static int lan78xx_open(struct net_devic netif_dbg(dev, ifup, dev->net, "phy initialised successfully"); diff --git a/target/linux/bcm27xx/patches-6.1/950-0142-net-lan78xx-Disable-TCP-Segmentation-Offload-TSO.patch b/target/linux/bcm27xx/patches-6.1/950-0142-net-lan78xx-Disable-TCP-Segmentation-Offload-TSO.patch index 22a67a0eb1d10d..ad16a61cbc8f88 100644 --- a/target/linux/bcm27xx/patches-6.1/950-0142-net-lan78xx-Disable-TCP-Segmentation-Offload-TSO.patch +++ b/target/linux/bcm27xx/patches-6.1/950-0142-net-lan78xx-Disable-TCP-Segmentation-Offload-TSO.patch @@ -37,7 +37,7 @@ Signed-off-by: Dave Stevenson static int lan78xx_read_reg(struct lan78xx_net *dev, u32 index, u32 *data) { u32 *buf; -@@ -3467,8 +3476,14 @@ static int lan78xx_bind(struct lan78xx_n +@@ -3470,8 +3479,14 @@ static int lan78xx_bind(struct lan78xx_n if (DEFAULT_RX_CSUM_ENABLE) dev->net->features |= NETIF_F_RXCSUM; diff --git a/target/linux/bcm27xx/patches-6.1/950-0143-lan78xx-Move-enabling-of-EEE-into-PHY-init-code.patch b/target/linux/bcm27xx/patches-6.1/950-0143-lan78xx-Move-enabling-of-EEE-into-PHY-init-code.patch index 66acf38301155d..f8016c66d2c207 100644 --- a/target/linux/bcm27xx/patches-6.1/950-0143-lan78xx-Move-enabling-of-EEE-into-PHY-init-code.patch +++ b/target/linux/bcm27xx/patches-6.1/950-0143-lan78xx-Move-enabling-of-EEE-into-PHY-init-code.patch @@ -16,7 +16,7 @@ Signed-off-by: Phil Elwell --- a/drivers/net/usb/lan78xx.c +++ b/drivers/net/usb/lan78xx.c -@@ -2417,6 +2417,22 @@ static int lan78xx_phy_init(struct lan78 +@@ -2419,6 +2419,22 @@ static int lan78xx_phy_init(struct lan78 mii_adv_to_linkmode_adv_t(fc, mii_adv); linkmode_or(phydev->advertising, fc, phydev->advertising); @@ -39,7 +39,7 @@ Signed-off-by: Phil Elwell if (phydev->mdio.dev.of_node) { u32 reg; int len; -@@ -3117,22 +3133,6 @@ static int lan78xx_open(struct net_devic +@@ -3120,22 +3136,6 @@ static int lan78xx_open(struct net_devic netif_dbg(dev, ifup, dev->net, "phy initialised successfully"); diff --git a/target/linux/bcm27xx/patches-6.1/950-0152-lan78xx-Debounce-link-events-to-minimize-poll-storm.patch b/target/linux/bcm27xx/patches-6.1/950-0152-lan78xx-Debounce-link-events-to-minimize-poll-storm.patch index 127ddbc537e020..85514feac45ed3 100644 --- a/target/linux/bcm27xx/patches-6.1/950-0152-lan78xx-Debounce-link-events-to-minimize-poll-storm.patch +++ b/target/linux/bcm27xx/patches-6.1/950-0152-lan78xx-Debounce-link-events-to-minimize-poll-storm.patch @@ -28,7 +28,7 @@ See: https://github.com/raspberrypi/linux/issues/2447 static int lan78xx_read_reg(struct lan78xx_net *dev, u32 index, u32 *data) { u32 *buf; -@@ -4454,7 +4459,13 @@ static int lan78xx_probe(struct usb_inte +@@ -4457,7 +4462,13 @@ static int lan78xx_probe(struct usb_inte if (ret < 0) goto out4; diff --git a/target/linux/bcm27xx/patches-6.1/950-0153-lan78xx-EEE-support-is-now-a-PHY-property.patch b/target/linux/bcm27xx/patches-6.1/950-0153-lan78xx-EEE-support-is-now-a-PHY-property.patch index b38c62273e4fb6..38510a6fd57274 100644 --- a/target/linux/bcm27xx/patches-6.1/950-0153-lan78xx-EEE-support-is-now-a-PHY-property.patch +++ b/target/linux/bcm27xx/patches-6.1/950-0153-lan78xx-EEE-support-is-now-a-PHY-property.patch @@ -15,7 +15,7 @@ Signed-off-by: Phil Elwell --- a/drivers/net/usb/lan78xx.c +++ b/drivers/net/usb/lan78xx.c -@@ -2422,7 +2422,7 @@ static int lan78xx_phy_init(struct lan78 +@@ -2424,7 +2424,7 @@ static int lan78xx_phy_init(struct lan78 mii_adv_to_linkmode_adv_t(fc, mii_adv); linkmode_or(phydev->advertising, fc, phydev->advertising); diff --git a/target/linux/bcm27xx/patches-6.1/950-0195-media-i2c-imx477-Support-for-the-Sony-IMX477-sensor.patch b/target/linux/bcm27xx/patches-6.1/950-0195-media-i2c-imx477-Support-for-the-Sony-IMX477-sensor.patch index 102b1e230947f5..4860bae933d9f5 100644 --- a/target/linux/bcm27xx/patches-6.1/950-0195-media-i2c-imx477-Support-for-the-Sony-IMX477-sensor.patch +++ b/target/linux/bcm27xx/patches-6.1/950-0195-media-i2c-imx477-Support-for-the-Sony-IMX477-sensor.patch @@ -343,7 +343,7 @@ Signed-off-by: Naushir Patuck +... --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -19283,6 +19283,14 @@ T: git git://linuxtv.org/media_tree.git +@@ -19290,6 +19290,14 @@ T: git git://linuxtv.org/media_tree.git F: Documentation/devicetree/bindings/media/i2c/sony,imx412.yaml F: drivers/media/i2c/imx412.c diff --git a/target/linux/bcm27xx/patches-6.1/950-0196-media-i2c-imx519-Support-for-the-Sony-IMX519-sensor.patch b/target/linux/bcm27xx/patches-6.1/950-0196-media-i2c-imx519-Support-for-the-Sony-IMX519-sensor.patch index bae8b88490f39f..662c057e9a4a93 100644 --- a/target/linux/bcm27xx/patches-6.1/950-0196-media-i2c-imx519-Support-for-the-Sony-IMX519-sensor.patch +++ b/target/linux/bcm27xx/patches-6.1/950-0196-media-i2c-imx519-Support-for-the-Sony-IMX519-sensor.patch @@ -177,7 +177,7 @@ Signed-off-by: Phil Elwell +... --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -19291,6 +19291,14 @@ T: git git://linuxtv.org/media_tree.git +@@ -19298,6 +19298,14 @@ T: git git://linuxtv.org/media_tree.git F: Documentation/devicetree/bindings/media/i2c/imx477.yaml F: drivers/media/i2c/imx477.c diff --git a/target/linux/bcm27xx/patches-6.1/950-0197-Documentation-devicetree-Add-documentation-for-imx37.patch b/target/linux/bcm27xx/patches-6.1/950-0197-Documentation-devicetree-Add-documentation-for-imx37.patch index 2a42b1feac12df..e1115b80bbae44 100644 --- a/target/linux/bcm27xx/patches-6.1/950-0197-Documentation-devicetree-Add-documentation-for-imx37.patch +++ b/target/linux/bcm27xx/patches-6.1/950-0197-Documentation-devicetree-Add-documentation-for-imx37.patch @@ -132,7 +132,7 @@ Signed-off-by: David Plowman +... --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -19288,6 +19288,7 @@ M: Raspberry Pi Kernel Maintenance } /********************************* -@@ -1496,7 +1512,6 @@ static int __init zswap_debugfs_init(voi +@@ -1498,7 +1514,6 @@ static int __init zswap_debugfs_init(voi **********************************/ static int __init init_zswap(void) { @@ -88,7 +88,7 @@ Signed-off-by: Phil Elwell int ret; zswap_init_started = true; -@@ -1520,33 +1535,23 @@ static int __init init_zswap(void) +@@ -1522,33 +1537,23 @@ static int __init init_zswap(void) if (ret) goto hp_fail; diff --git a/target/linux/bcm27xx/patches-6.1/950-0379-Patching-lan78xx-for-SOF_TIMESTAMPING_TX_SOFTWARE-su.patch b/target/linux/bcm27xx/patches-6.1/950-0379-Patching-lan78xx-for-SOF_TIMESTAMPING_TX_SOFTWARE-su.patch index 2d5c962d23eeca..10032530fe2b3c 100644 --- a/target/linux/bcm27xx/patches-6.1/950-0379-Patching-lan78xx-for-SOF_TIMESTAMPING_TX_SOFTWARE-su.patch +++ b/target/linux/bcm27xx/patches-6.1/950-0379-Patching-lan78xx-for-SOF_TIMESTAMPING_TX_SOFTWARE-su.patch @@ -10,7 +10,7 @@ Subject: [PATCH] Patching lan78xx for SOF_TIMESTAMPING_TX_SOFTWARE --- a/drivers/net/usb/lan78xx.c +++ b/drivers/net/usb/lan78xx.c -@@ -1953,6 +1953,7 @@ static const struct ethtool_ops lan78xx_ +@@ -1955,6 +1955,7 @@ static const struct ethtool_ops lan78xx_ .set_link_ksettings = lan78xx_set_link_ksettings, .get_regs_len = lan78xx_get_regs_len, .get_regs = lan78xx_get_regs, diff --git a/target/linux/bcm27xx/patches-6.1/950-0528-dtbindings-media-i2c-Add-IMX708-CMOS-sensor-binding.patch b/target/linux/bcm27xx/patches-6.1/950-0528-dtbindings-media-i2c-Add-IMX708-CMOS-sensor-binding.patch index 541f19f26152ec..efee9ebcd7ca98 100644 --- a/target/linux/bcm27xx/patches-6.1/950-0528-dtbindings-media-i2c-Add-IMX708-CMOS-sensor-binding.patch +++ b/target/linux/bcm27xx/patches-6.1/950-0528-dtbindings-media-i2c-Add-IMX708-CMOS-sensor-binding.patch @@ -138,7 +138,7 @@ Signed-off-by: Dave Stevenson +... --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -19332,6 +19332,14 @@ T: git git://linuxtv.org/media_tree.git +@@ -19339,6 +19339,14 @@ T: git git://linuxtv.org/media_tree.git F: Documentation/devicetree/bindings/media/i2c/imx519.yaml F: drivers/media/i2c/imx519.c diff --git a/target/linux/bcm27xx/patches-6.1/950-0593-dt-bindings-media-i2c-Add-IMX296-CMOS-sensor-binding.patch b/target/linux/bcm27xx/patches-6.1/950-0593-dt-bindings-media-i2c-Add-IMX296-CMOS-sensor-binding.patch index ece309fc06b501..003e0d4ccb7b8c 100644 --- a/target/linux/bcm27xx/patches-6.1/950-0593-dt-bindings-media-i2c-Add-IMX296-CMOS-sensor-binding.patch +++ b/target/linux/bcm27xx/patches-6.1/950-0593-dt-bindings-media-i2c-Add-IMX296-CMOS-sensor-binding.patch @@ -128,7 +128,7 @@ Signed-off-by: Sakari Ailus +... --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -19274,6 +19274,14 @@ T: git git://linuxtv.org/media_tree.git +@@ -19281,6 +19281,14 @@ T: git git://linuxtv.org/media_tree.git F: Documentation/devicetree/bindings/media/i2c/imx290.txt F: drivers/media/i2c/imx290.c diff --git a/target/linux/bcm27xx/patches-6.1/950-0594-media-i2c-IMX296-camera-sensor-driver.patch b/target/linux/bcm27xx/patches-6.1/950-0594-media-i2c-IMX296-camera-sensor-driver.patch index 9c084cc80f9bfb..853b2c757a4118 100644 --- a/target/linux/bcm27xx/patches-6.1/950-0594-media-i2c-IMX296-camera-sensor-driver.patch +++ b/target/linux/bcm27xx/patches-6.1/950-0594-media-i2c-IMX296-camera-sensor-driver.patch @@ -23,7 +23,7 @@ Signed-off-by: Sakari Ailus --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -19281,6 +19281,7 @@ L: linux-media@vger.kernel.org +@@ -19288,6 +19288,7 @@ L: linux-media@vger.kernel.org S: Maintained T: git git://linuxtv.org/media_tree.git F: Documentation/devicetree/bindings/media/i2c/sony,imx296.yaml diff --git a/target/linux/bcm27xx/patches-6.1/950-0649-media-dt-bindings-Convert-imx290.txt-to-YAML.patch b/target/linux/bcm27xx/patches-6.1/950-0649-media-dt-bindings-Convert-imx290.txt-to-YAML.patch index db0e89b1666422..b2417364c6d7bc 100644 --- a/target/linux/bcm27xx/patches-6.1/950-0649-media-dt-bindings-Convert-imx290.txt-to-YAML.patch +++ b/target/linux/bcm27xx/patches-6.1/950-0649-media-dt-bindings-Convert-imx290.txt-to-YAML.patch @@ -219,7 +219,7 @@ Signed-off-by: Sakari Ailus +... --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -19271,7 +19271,7 @@ M: Manivannan Sadhasivam +... --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -19346,7 +19346,7 @@ M: Raspberry Pi Kernel Maintenance } static int goodix_check_cfg_8(struct goodix_ts_data *ts, const u8 *cfg, int len) -@@ -1425,6 +1478,11 @@ static void goodix_ts_remove(struct i2c_ +@@ -1426,6 +1479,11 @@ static void goodix_ts_remove(struct i2c_ { struct goodix_ts_data *ts = i2c_get_clientdata(client); @@ -108,7 +108,7 @@ Signed-off-by: Dave Stevenson if (ts->load_cfg_from_disk) wait_for_completion(&ts->firmware_loading_complete); } -@@ -1440,7 +1498,7 @@ static int __maybe_unused goodix_suspend +@@ -1441,7 +1499,7 @@ static int __maybe_unused goodix_suspend /* We need gpio pins to suspend/resume */ if (ts->irq_pin_access_method == IRQ_PIN_ACCESS_NONE) { @@ -117,7 +117,7 @@ Signed-off-by: Dave Stevenson return 0; } -@@ -1484,7 +1542,7 @@ static int __maybe_unused goodix_resume( +@@ -1485,7 +1543,7 @@ static int __maybe_unused goodix_resume( int error; if (ts->irq_pin_access_method == IRQ_PIN_ACCESS_NONE) { diff --git a/target/linux/bcm27xx/patches-6.1/950-0918-irqchip-irq-brcmstb-l2-Add-config-for-2711-controlle.patch b/target/linux/bcm27xx/patches-6.1/950-0918-irqchip-irq-brcmstb-l2-Add-config-for-2711-controlle.patch index 5ea212d4a7b482..039c5fd74f073c 100644 --- a/target/linux/bcm27xx/patches-6.1/950-0918-irqchip-irq-brcmstb-l2-Add-config-for-2711-controlle.patch +++ b/target/linux/bcm27xx/patches-6.1/950-0918-irqchip-irq-brcmstb-l2-Add-config-for-2711-controlle.patch @@ -52,7 +52,7 @@ Signed-off-by: Dom Cobley /* L2 intc private data structure */ struct brcmstb_l2_intc_data { struct irq_domain *domain; -@@ -286,11 +296,18 @@ static int __init brcmstb_l2_lvl_intc_of +@@ -289,11 +299,18 @@ static int __init brcmstb_l2_lvl_intc_of return brcmstb_l2_intc_of_init(np, parent, &l2_lvl_intc_init); } diff --git a/target/linux/bcm27xx/patches-6.1/950-1165-input-goodix-Include-I2C-details-in-names-for-the-de.patch b/target/linux/bcm27xx/patches-6.1/950-1165-input-goodix-Include-I2C-details-in-names-for-the-de.patch index 4b529e66f5d611..6bbe2208f4c238 100644 --- a/target/linux/bcm27xx/patches-6.1/950-1165-input-goodix-Include-I2C-details-in-names-for-the-de.patch +++ b/target/linux/bcm27xx/patches-6.1/950-1165-input-goodix-Include-I2C-details-in-names-for-the-de.patch @@ -19,7 +19,7 @@ Signed-off-by: Dave Stevenson --- a/drivers/input/touchscreen/goodix.c +++ b/drivers/input/touchscreen/goodix.c -@@ -1211,7 +1211,10 @@ static int goodix_configure_dev(struct g +@@ -1212,7 +1212,10 @@ static int goodix_configure_dev(struct g return -ENOMEM; } diff --git a/target/linux/bcm27xx/patches-6.1/950-1194-media-dt-bindings-i2c-Add-Rohm-BU64754-bindings.patch b/target/linux/bcm27xx/patches-6.1/950-1194-media-dt-bindings-i2c-Add-Rohm-BU64754-bindings.patch index 5ea162577c8e24..c11fbe2ec67f62 100644 --- a/target/linux/bcm27xx/patches-6.1/950-1194-media-dt-bindings-i2c-Add-Rohm-BU64754-bindings.patch +++ b/target/linux/bcm27xx/patches-6.1/950-1194-media-dt-bindings-i2c-Add-Rohm-BU64754-bindings.patch @@ -67,7 +67,7 @@ Signed-off-by: Jacopo Mondi +... --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -17897,6 +17897,13 @@ S: Maintained +@@ -17904,6 +17904,13 @@ S: Maintained F: Documentation/devicetree/bindings/iio/light/bh1750.yaml F: drivers/iio/light/bh1750.c diff --git a/target/linux/bcm27xx/patches-6.1/950-1195-media-i2c-Add-driver-for-OmniVision-OV64A40.patch b/target/linux/bcm27xx/patches-6.1/950-1195-media-i2c-Add-driver-for-OmniVision-OV64A40.patch index 9888ad8ade99a2..01940e18e35bba 100644 --- a/target/linux/bcm27xx/patches-6.1/950-1195-media-i2c-Add-driver-for-OmniVision-OV64A40.patch +++ b/target/linux/bcm27xx/patches-6.1/950-1195-media-i2c-Add-driver-for-OmniVision-OV64A40.patch @@ -16,7 +16,7 @@ Signed-off-by: Jacopo Mondi --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -15323,6 +15323,14 @@ S: Maintained +@@ -15330,6 +15330,14 @@ S: Maintained T: git git://linuxtv.org/media_tree.git F: drivers/media/i2c/ov5695.c diff --git a/target/linux/bcm53xx/patches-5.15/030-v5.16-0019-ARM-dts-BCM53573-Describe-on-SoC-BCM53125-rev-4-swit.patch b/target/linux/bcm53xx/patches-5.15/030-v5.16-0019-ARM-dts-BCM53573-Describe-on-SoC-BCM53125-rev-4-swit.patch deleted file mode 100644 index 914117cb2cb872..00000000000000 --- a/target/linux/bcm53xx/patches-5.15/030-v5.16-0019-ARM-dts-BCM53573-Describe-on-SoC-BCM53125-rev-4-swit.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 9fb90ae6cae7f8fe4fbf626945f32cd9da2c3892 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Mon, 20 Sep 2021 16:10:23 +0200 -Subject: [PATCH] ARM: dts: BCM53573: Describe on-SoC BCM53125 rev 4 switch -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -BCM53573 family SoC have Ethernet switch connected to the first Ethernet -controller (accessible over MDIO). - -Signed-off-by: Rafał Miłecki -Signed-off-by: Florian Fainelli ---- - arch/arm/boot/dts/bcm53573.dtsi | 18 ++++++++++++++++++ - 1 file changed, 18 insertions(+) - ---- a/arch/arm/boot/dts/bcm53573.dtsi -+++ b/arch/arm/boot/dts/bcm53573.dtsi -@@ -183,6 +183,24 @@ - - gmac0: ethernet@5000 { - reg = <0x5000 0x1000>; -+ -+ mdio { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ -+ switch: switch@1e { -+ compatible = "brcm,bcm53125"; -+ reg = <0x1e>; -+ -+ status = "disabled"; -+ -+ /* ports are defined in board DTS */ -+ ports { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ }; -+ }; -+ }; - }; - - gmac1: ethernet@b000 { diff --git a/target/linux/bcm53xx/patches-5.15/034-v6.0-0001-ARM-dts-broadcom-align-gpio-key-node-names-with-dtsc.patch b/target/linux/bcm53xx/patches-5.15/034-v6.0-0001-ARM-dts-broadcom-align-gpio-key-node-names-with-dtsc.patch index f929dc3b6067a5..1c0708a5f0751e 100644 --- a/target/linux/bcm53xx/patches-5.15/034-v6.0-0001-ARM-dts-broadcom-align-gpio-key-node-names-with-dtsc.patch +++ b/target/linux/bcm53xx/patches-5.15/034-v6.0-0001-ARM-dts-broadcom-align-gpio-key-node-names-with-dtsc.patch @@ -781,7 +781,7 @@ Signed-off-by: Florian Fainelli gpios = <&chipcommon 17 GPIO_ACTIVE_LOW>; --- a/arch/arm/boot/dts/bcm47189-luxul-xap-1440.dts +++ b/arch/arm/boot/dts/bcm47189-luxul-xap-1440.dts -@@ -39,7 +39,7 @@ +@@ -38,7 +38,7 @@ gpio-keys { compatible = "gpio-keys"; @@ -792,7 +792,7 @@ Signed-off-by: Florian Fainelli gpios = <&chipcommon 7 GPIO_ACTIVE_LOW>; --- a/arch/arm/boot/dts/bcm47189-luxul-xap-810.dts +++ b/arch/arm/boot/dts/bcm47189-luxul-xap-810.dts -@@ -49,7 +49,7 @@ +@@ -47,7 +47,7 @@ gpio-keys { compatible = "gpio-keys"; diff --git a/target/linux/bcm53xx/patches-5.15/035-v6.2-0004-ARM-dts-broadcom-align-LED-node-names-with-dtschema.patch b/target/linux/bcm53xx/patches-5.15/035-v6.2-0004-ARM-dts-broadcom-align-LED-node-names-with-dtschema.patch index d6bf49d0cd2127..a53070a506f83b 100644 --- a/target/linux/bcm53xx/patches-5.15/035-v6.2-0004-ARM-dts-broadcom-align-LED-node-names-with-dtschema.patch +++ b/target/linux/bcm53xx/patches-5.15/035-v6.2-0004-ARM-dts-broadcom-align-LED-node-names-with-dtschema.patch @@ -1514,7 +1514,7 @@ Signed-off-by: Florian Fainelli }; --- a/arch/arm/boot/dts/bcm47189-luxul-xap-1440.dts +++ b/arch/arm/boot/dts/bcm47189-luxul-xap-1440.dts -@@ -23,13 +23,13 @@ +@@ -23,12 +23,12 @@ leds { compatible = "gpio-leds"; @@ -1522,7 +1522,6 @@ Signed-off-by: Florian Fainelli + led-wlan { label = "bcm53xx:blue:wlan"; gpios = <&chipcommon 10 GPIO_ACTIVE_LOW>; - linux,default-trigger = "default-off"; }; - system { @@ -1532,7 +1531,7 @@ Signed-off-by: Florian Fainelli linux,default-trigger = "timer"; --- a/arch/arm/boot/dts/bcm47189-luxul-xap-810.dts +++ b/arch/arm/boot/dts/bcm47189-luxul-xap-810.dts -@@ -20,26 +20,26 @@ +@@ -20,25 +20,25 @@ reg = <0x00000000 0x08000000>; }; @@ -1544,7 +1543,6 @@ Signed-off-by: Florian Fainelli + led-5ghz { label = "bcm53xx:blue:5ghz"; gpios = <&chipcommon 11 GPIO_ACTIVE_HIGH>; - linux,default-trigger = "default-off"; }; - system { @@ -1563,7 +1561,7 @@ Signed-off-by: Florian Fainelli + led-2ghz { label = "bcm53xx:blue:2ghz"; gpios = <&pcie0_chipcommon 3 GPIO_ACTIVE_HIGH>; - linux,default-trigger = "default-off"; + }; --- a/arch/arm/boot/dts/bcm47189-tenda-ac9.dts +++ b/arch/arm/boot/dts/bcm47189-tenda-ac9.dts @@ -20,37 +20,37 @@ diff --git a/target/linux/bcm53xx/patches-5.15/037-v6.6-0004-ARM-dts-BCM53573-Drop-nonexistent-default-off-LED-tr.patch b/target/linux/bcm53xx/patches-5.15/037-v6.6-0004-ARM-dts-BCM53573-Drop-nonexistent-default-off-LED-tr.patch deleted file mode 100644 index 8bad76edcaaf8d..00000000000000 --- a/target/linux/bcm53xx/patches-5.15/037-v6.6-0004-ARM-dts-BCM53573-Drop-nonexistent-default-off-LED-tr.patch +++ /dev/null @@ -1,57 +0,0 @@ -From be7e1e5b0f67c58ec4be0a54db23b6a4fa6e2116 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Fri, 7 Jul 2023 13:40:01 +0200 -Subject: [PATCH] ARM: dts: BCM53573: Drop nonexistent "default-off" LED - trigger -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -There is no such trigger documented or implemented in Linux. It was a -copy & paste mistake. - -This fixes: -arch/arm/boot/dts/broadcom/bcm47189-luxul-xap-1440.dtb: leds: led-wlan:linux,default-trigger: 'oneOf' conditional failed, one must be fixed: - 'default-off' is not one of ['backlight', 'default-on', 'heartbeat', 'disk-activity', 'disk-read', 'disk-write', 'timer', 'pattern', 'audio-micmute', 'audio-mute', 'bluetooth-power', 'flash', 'kbd-capslock', 'mtd', 'nand-disk', 'none', 'torch', 'usb-gadget', 'usb-host', 'usbport'] - 'default-off' does not match '^cpu[0-9]*$' - 'default-off' does not match '^hci[0-9]+-power$' - 'default-off' does not match '^mmc[0-9]+$' - 'default-off' does not match '^phy[0-9]+tx$' - From schema: Documentation/devicetree/bindings/leds/leds-gpio.yaml - -Signed-off-by: Rafał Miłecki -Link: https://lore.kernel.org/r/20230707114004.2740-1-zajec5@gmail.com -Signed-off-by: Florian Fainelli ---- - arch/arm/boot/dts/broadcom/bcm47189-luxul-xap-1440.dts | 1 - - arch/arm/boot/dts/broadcom/bcm47189-luxul-xap-810.dts | 2 -- - 2 files changed, 3 deletions(-) - ---- a/arch/arm/boot/dts/bcm47189-luxul-xap-1440.dts -+++ b/arch/arm/boot/dts/bcm47189-luxul-xap-1440.dts -@@ -26,7 +26,6 @@ - led-wlan { - label = "bcm53xx:blue:wlan"; - gpios = <&chipcommon 10 GPIO_ACTIVE_LOW>; -- linux,default-trigger = "default-off"; - }; - - led-system { ---- a/arch/arm/boot/dts/bcm47189-luxul-xap-810.dts -+++ b/arch/arm/boot/dts/bcm47189-luxul-xap-810.dts -@@ -26,7 +26,6 @@ - led-5ghz { - label = "bcm53xx:blue:5ghz"; - gpios = <&chipcommon 11 GPIO_ACTIVE_HIGH>; -- linux,default-trigger = "default-off"; - }; - - led-system { -@@ -42,7 +41,6 @@ - led-2ghz { - label = "bcm53xx:blue:2ghz"; - gpios = <&pcie0_chipcommon 3 GPIO_ACTIVE_HIGH>; -- linux,default-trigger = "default-off"; - }; - }; - diff --git a/target/linux/bcm53xx/patches-5.15/037-v6.6-0005-ARM-dts-BCM53573-Drop-nonexistent-usb-cells.patch b/target/linux/bcm53xx/patches-5.15/037-v6.6-0005-ARM-dts-BCM53573-Drop-nonexistent-usb-cells.patch deleted file mode 100644 index e7a1835d47a978..00000000000000 --- a/target/linux/bcm53xx/patches-5.15/037-v6.6-0005-ARM-dts-BCM53573-Drop-nonexistent-usb-cells.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 05d2c3d552b8c92fc397377d9d1112fc58e2cd59 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Fri, 7 Jul 2023 13:40:02 +0200 -Subject: [PATCH] ARM: dts: BCM53573: Drop nonexistent #usb-cells -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Such property simply doesn't exist (is not documented or used anywhere). - -This fixes: -arch/arm/boot/dts/broadcom/bcm47189-luxul-xap-1440.dtb: usb@d000: Unevaluated properties are not allowed ('#usb-cells' was unexpected) - From schema: Documentation/devicetree/bindings/usb/generic-ohci.yaml - -Signed-off-by: Rafał Miłecki -Link: https://lore.kernel.org/r/20230707114004.2740-2-zajec5@gmail.com -Signed-off-by: Florian Fainelli ---- - arch/arm/boot/dts/broadcom/bcm53573.dtsi | 2 -- - 1 file changed, 2 deletions(-) - ---- a/arch/arm/boot/dts/bcm53573.dtsi -+++ b/arch/arm/boot/dts/bcm53573.dtsi -@@ -159,8 +159,6 @@ - }; - - ohci: usb@d000 { -- #usb-cells = <0>; -- - compatible = "generic-ohci"; - reg = <0xd000 0x1000>; - interrupt-parent = <&gic>; diff --git a/target/linux/bcm53xx/patches-5.15/180-usb-xhci-add-support-for-performing-fake-doorbell.patch b/target/linux/bcm53xx/patches-5.15/180-usb-xhci-add-support-for-performing-fake-doorbell.patch index 49277ab251f647..1d3a21b6cdd782 100644 --- a/target/linux/bcm53xx/patches-5.15/180-usb-xhci-add-support-for-performing-fake-doorbell.patch +++ b/target/linux/bcm53xx/patches-5.15/180-usb-xhci-add-support-for-performing-fake-doorbell.patch @@ -109,7 +109,7 @@ it on BCM4708 family. --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h -@@ -1908,6 +1908,7 @@ struct xhci_hcd { +@@ -1907,6 +1907,7 @@ struct xhci_hcd { #define XHCI_RESET_TO_DEFAULT BIT_ULL(44) #define XHCI_ZHAOXIN_TRB_FETCH BIT_ULL(45) #define XHCI_ZHAOXIN_HOST BIT_ULL(46) diff --git a/target/linux/bcm63xx/Makefile b/target/linux/bcm63xx/Makefile deleted file mode 100644 index f206aed3d355b2..00000000000000 --- a/target/linux/bcm63xx/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -# -# Copyright (C) 2006-2019 OpenWrt.org -# Copyright (C) 2016 LEDE project - -include $(TOPDIR)/rules.mk - -ARCH:=mips -BOARD:=bcm63xx -BOARDNAME:=Broadcom BCM63xx -SUBTARGETS:=generic smp -FEATURES:=squashfs usb atm pci pcmcia usbgadget source-only - -KERNEL_PATCHVER:=5.15 - -define Target/Description - Build firmware images for Broadcom based xDSL/routers - currently supports BCM6338, BCM6348 and BCM6358 based devices. - (e.g. Inventel Livebox, Siemens SE515, Neufbox 4) -endef - -include $(INCLUDE_DIR)/target.mk - -DEFAULT_PACKAGES += swconfig kmod-gpio-button-hotplug - -$(eval $(call BuildTarget)) diff --git a/target/linux/bcm63xx/base-files/etc/board.d/01_leds b/target/linux/bcm63xx/base-files/etc/board.d/01_leds deleted file mode 100644 index 75e8afef9dfb4d..00000000000000 --- a/target/linux/bcm63xx/base-files/etc/board.d/01_leds +++ /dev/null @@ -1,101 +0,0 @@ -# -# Copyright (C) 2013-2015 OpenWrt.org -# - -. /lib/functions/uci-defaults.sh - -board_config_update - -board=$(board_name) - -case "$board" in -actiontec,r1000h) - ucidef_set_led_usbport "usb" "USB" "green:usb" "usb1-port1" "usb2-port1" - ;; -adb,a4001n|\ -adb,pdg-a4101n-a-000-1a1-ae|\ -comtrend,ar-5315u|\ -comtrend,vr-3032u|\ -d-link,dsl-2750u-c1|\ -huawei,hg253s-v2|\ -nucom,r5010un-v2|\ -sagem,fast-2704-v2) - ucidef_set_led_usbdev "usb" "USB" "green:usb" "1-1" - ;; -adb,a4001n1) - ucidef_set_led_netdev "lan" "LAN" "green:eth" "eth0" - ucidef_set_led_usbdev "usb" "USB" "green:3g" "1-1" - ;; -adb,pdg-a4001n-a-000-1a1-ax|\ -technicolor,tg582n|\ -technicolor,tg582n-telecom-italia) - ucidef_set_led_netdev "wlan0" "WIFI" "green:wifi" "wlan0" - ;; -adb,av4202n) - ucidef_set_led_netdev "wlan0" "WLAN" "blue:wifi" "wlan0" - ;; -bt,home-hub-2-a) - ucidef_set_led_netdev "lan" "LAN" "blue:broadband" "eth0.1" - ucidef_set_led_netdev "wlan0" "WIFI" "green:wireless" "wlan0" - ucidef_set_led_usbdev "usb1" "USB1" "blue:phone" "1-1" - ucidef_set_led_usbdev "usb2" "USB2" "green:phone" "2-1" - ;; -huawei,echolife-hg553) - ucidef_set_led_netdev "lan" "LAN" "blue:lan" "eth0" - ucidef_set_led_usbdev "usb1" "USB1" "red:hspa" "1-1" - ucidef_set_led_usbdev "usb2" "USB2" "blue:hspa" "1-2" - ;; -huawei,echolife-hg556a-a|\ -huawei,echolife-hg556a-b|\ -huawei,echolife-hg556a-c) - ucidef_set_led_netdev "lan" "LAN" "red:dsl" "eth0" - ucidef_set_led_usbdev "usb" "USB" "red:hspa" "1-2" - ;; -huawei,echolife-hg622|\ -huawei,echolife-hg655b) - ucidef_set_led_usbdev "usb" "USB" "green:usb" "1-2" - ;; -inventel,livebox-1) - ucidef_set_led_netdev "lan" "LAN" "red:traffic" "eth0" - ucidef_set_led_netdev "wan" "WAN" "red:adsl" "eth1" - ucidef_set_led_netdev "wlan0" "WIFI" "red:wifi" "wlan0" - ;; -netgear,dgnd3700-v1) - ucidef_set_led_netdev "lan" "LAN" "green:lan" "eth0.1" - ucidef_set_led_netdev "wan" "WAN" "green:inet" "eth0.2" - ucidef_set_led_netdev "wlan0" "WIFI2G" "green:wifi2g" "wlan0" - ucidef_set_led_netdev "wlan1" "WIFI5G" "blue:wifi5g" "wlan1" - ucidef_set_led_usbdev "usb1" "USB1" "green:usb-back" "1-1" - ucidef_set_led_usbdev "usb2" "USB2" "green:usb-front" "1-2" - ;; -netgear,dgnd3700-v2) - ucidef_set_led_netdev "lan" "LAN" "green:ethernet" "eth0" - ucidef_set_led_usbdev "usb1" "USB1" "green:usb1" "1-1" - ucidef_set_led_usbdev "usb2" "USB2" "green:usb2" "1-2" - ;; -netgear,evg2000) - ucidef_set_led_netdev "lan" "LAN" "green:lan" "eth0" - ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth1" - ucidef_set_led_netdev "wlan0" "WIFI" "green:wireless" "wlan0" - ucidef_set_led_usbdev "usb1" "USB1" "green:voip1" "1-1" - ucidef_set_led_usbdev "usb2" "USB2" "green:voip2" "1-2" - ;; -sagem,fast-2704n) - ucidef_set_led_netdev "wan" "WAN" "green:inet" "eth0.2" - ;; -sercomm,ad1018|\ -sercomm,ad1018-nor) - ucidef_set_led_netdev "wlan0" "WLAN" "green:wifi" "wlan0" - ;; -sercomm,h500-s-lowi|\ -sercomm,h500-s-vfes) - ucidef_set_led_netdev "wan" "WAN" "green:internet" "eth0.2" - ;; -telsey,cpva502plus) - ucidef_set_led_netdev "lan" "LAN" "amber:link" "eth0" - ;; -esac - -board_config_flush - -exit 0 diff --git a/target/linux/bcm63xx/base-files/etc/board.d/02_network b/target/linux/bcm63xx/base-files/etc/board.d/02_network deleted file mode 100644 index b48aa57d2ef5cc..00000000000000 --- a/target/linux/bcm63xx/base-files/etc/board.d/02_network +++ /dev/null @@ -1,169 +0,0 @@ -# -# Copyright (C) 2012-2015 OpenWrt.org -# - -. /lib/functions/uci-defaults.sh - -board_config_update - -case "$(board_name)" in -actiontec,r1000h|\ -dynalink,rta770bw|\ -dynalink,rta770w|\ -netgear,cvg834g|\ -netgear,dgnd3700-v2|\ -netgear,evg2000|\ -t-com,speedport-w-303v|\ -t-com,speedport-w-500v) - ucidef_set_interface_lan "eth0" - ;; -adb,a4001n1|\ -adb,a4001n|\ -adb,pdg-a4001n-a-000-1a1-ax|\ -adb,pdg-a4101n-a-000-1a1-ae|\ -adb,av4202n|\ -brcm,bcm963281tan|\ -brcm,bcm96328avng|\ -brcm,bcm96368mvngr|\ -comtrend,ar-5381u|\ -comtrend,ar-5387un|\ -comtrend,vr-3025u|\ -comtrend,vr-3025un|\ -comtrend,vr-3026e|\ -d-link,dsl-274xb-f1|\ -d-link,dsl-2750u-c1|\ -d-link,dsl-275xb-d1|\ -huawei,echolife-hg622|\ -huawei,echolife-hg655b|\ -nucom,r5010un-v2|\ -sagem,fast-2504n|\ -sagem,fast-2704-v2|\ -technicolor,tg582n|\ -technicolor,tg582n-telecom-italia|\ -zyxel,p870hw-51a-v2) - ucidef_add_switch "switch0" \ - "0:lan:1" "1:lan:2" "2:lan:3" "3:lan:4" "8t@eth0" - ;; -alcatel,rg100a|\ -belkin,f5d7633|\ -brcm,bcm96348gw|\ -brcm,bcm96348gw-10|\ -brcm,bcm96348gw-11|\ -brcm,bcm96358vw|\ -brcm,bcm96358vw2|\ -bt,voyager-2500v-bb|\ -davolink,dv-201amr|\ -d-link,dsl-2650u|\ -dynalink,rta1025w|\ -netgear,dg834gt-pn|\ -pirelli,agpf-s0|\ -sagem,fast-2404|\ -telsey,magic|\ -tp-link,td-w8900gb|\ -usrobotics,usr9108) - ucidef_set_interfaces_lan_wan "eth1" "eth0" - ucidef_add_switch "switch0" \ - "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5u@eth1" - ;; -asmax,ar-1004g|\ -brcm,bcm96338gw|\ -brcm,bcm96338w|\ -bt,voyager-2110|\ -comtrend,ct-5365|\ -comtrend,ct-536plus|\ -comtrend,ct-6373|\ -d-link,dsl-2640b-b|\ -d-link,dsl-2640u|\ -dynalink,rta1320|\ -netgear,dg834g-v4|\ -sagem,fast-2604|\ -telsey,cpva642) - ucidef_add_switch "switch0" \ - "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5u@eth0" - ;; -brcm,bcm963268bu-p300) - ucidef_add_switch "switch0" \ - "0:lan" "3:lan" "4:lan" "5:lan" "6:lan" "7:lan" "8t@eth0" - ;; -brcm,bcm96368mvwg) - ucidef_add_switch "switch0" \ - "1:lan" "2:lan" "4:lan" "5:lan" "8t@eth0" - ;; -bt,home-hub-2-a|\ -d-link,dsl-274xb-c2|\ -huawei,echolife-hg553|\ -huawei,echolife-hg556a-a|\ -huawei,echolife-hg556a-b|\ -huawei,echolife-hg556a-c) - ucidef_add_switch "switch0" \ - "0:lan:1" "1:lan:2" "2:lan:3" "3:lan:4" "5t@eth0" - ;; -comtrend,ar-5315u|\ -innacomm,w3400v6|\ -observa,vh4032n) - ucidef_add_switch "switch0" \ - "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "8t@eth0" - ;; -comtrend,vg-8050) - ucidef_add_switch "switch0" \ - "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4:wan" "8t@eth0" - ;; -comtrend,vr-3032u) - ucidef_add_switch "switch0" \ - "0:lan:2" "1:lan:3" "2:lan:4" "3:lan:1" "8t@eth0" - ;; -comtrend,wap-5813n) - ucidef_add_switch "switch0" \ - "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "5t@eth0" - ;; -d-link,dva-g3810bn-tl|\ -huawei,echolife-hg520v|\ -sfr,neufbox-4-foxconn-r1|\ -sfr,neufbox-4-sercomm-r0) - ucidef_set_interfaces_lan_wan "eth1.1" "eth0" - ucidef_add_switch "switch0" \ - "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5t@eth1" - ;; -huawei,hg253s-v2) - ucidef_add_switch "switch0" \ - "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "8t@eth0" - ;; -inteno,vg50) - ucidef_add_switch "switch0" \ - "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "8t@eth0" - ;; -inventel,livebox-1|\ -telsey,cpva502plus) - ucidef_set_interfaces_lan_wan "eth0" "eth1" - ;; -netgear,dgnd3700-v1) - ucidef_add_switch "switch0" \ - "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "0:wan" "8t@eth0" - ;; -sagem,fast-2704n|\ -sercomm,ad1018|\ -sercomm,ad1018-nor) - ucidef_add_switch "switch0" \ - "1:lan:3" "2:lan:2" "3:lan:1" "0:wan" "8t@eth0" - ;; -sercomm,h500-s-lowi|\ -sercomm,h500-s-vfes) - ucidef_add_switch "switch0" "4:lan" "3:wan" "8t@eth0" - ;; -sfr,neufbox-6-sercomm-r0) - ucidef_add_switch "switch0" \ - "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9t@eth0" - ;; -sky,sr102) - ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" - ucidef_add_switch "switch0" \ - "0:lan" "1:lan" "2:lan" "3:wan" "8t@eth0" - ;; -*) - ucidef_set_interfaces_lan_wan "eth1" "eth0" - ;; -esac - -board_config_flush - -exit 0 diff --git a/target/linux/bcm63xx/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom b/target/linux/bcm63xx/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom deleted file mode 100644 index 0e92481f08c69d..00000000000000 --- a/target/linux/bcm63xx/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh -# Based on gabors ralink wisoc implementation. - -[ -e /lib/firmware/$FIRMWARE ] && exit 0 - -. /lib/functions/caldata.sh - -board=$(board_name) - -case "$FIRMWARE" in -"rt2x00.eeprom" ) - case $board in - huawei,echolife-hg556a-c) - caldata_extract "cal_data" 0x1fe00 0x200 - ;; - huawei,echolife-hg622|\ - huawei,echolife-hg655b) - caldata_extract "cal_data" 0x0 0x200 - ;; - *) - caldata_die "board $board is not supported yet" - ;; - esac - ;; -esac diff --git a/target/linux/bcm63xx/base-files/etc/uci-defaults/04_led_migration b/target/linux/bcm63xx/base-files/etc/uci-defaults/04_led_migration deleted file mode 100644 index 33ec4d51f95277..00000000000000 --- a/target/linux/bcm63xx/base-files/etc/uci-defaults/04_led_migration +++ /dev/null @@ -1,21 +0,0 @@ -. /lib/functions/migrations.sh - -board=$(board_name) - -case "$board" in -brcm,bcm96318ref-p300|\ -brcm,bcm963281tan|\ -brcm,bcm96328avng|\ -d-link,dsl-2640b-b|\ -d-link,dva-g3810bn-tl|\ -netgear,dg834g-v4|\ -usrobotics,usr9108) - migrate_leds "^.*::=" - ;; -esac - -remove_devicename_leds - -migrations_apply system - -exit 0 diff --git a/target/linux/bcm63xx/base-files/etc/uci-defaults/09_fix_crc b/target/linux/bcm63xx/base-files/etc/uci-defaults/09_fix_crc deleted file mode 100644 index a176eb17350fbf..00000000000000 --- a/target/linux/bcm63xx/base-files/etc/uci-defaults/09_fix_crc +++ /dev/null @@ -1,45 +0,0 @@ -# -# Copyright (C) 2007 OpenWrt.org -# - -. /lib/functions.sh - -do_fixcrc() { - mtd fixtrx linux -} - -case "$(board_name)" in - actiontec,r1000h|\ - adb,a4001n|\ - adb,a4001n1|\ - adb,pdg-a4001n-a-000-1a1-ax|\ - adb,pdg-a4101n-a-000-1a1-ae|\ - brcm,bcm96328avng|\ - brcm,bcm963281tan|\ - bt,voyager-2110|\ - bt,voyager-2500v-bb|\ - comtrend,ar-5315u|\ - comtrend,ar-5381u|\ - comtrend,ar-5387un|\ - comtrend,vr-3025u|\ - comtrend,vr-3025un|\ - comtrend,vr-3026e|\ - comtrend,wap-5813n|\ - comtrend,ct-6373|\ - d-link,dsl-274xb-f1|\ - dynalink,rta770bw|\ - dynalink,rta770w|\ - huawei,echolife-hg622|\ - netgear,evg2000|\ - nucom,r5010un-v2|\ - observa,vh4032n|\ - t-com,speedport-w-303v|\ - technicolor,tg582n|\ - technicolor,tg582n-telecom-italia|\ - telsey,cpva502plus|\ - telsey,cpva642|\ - telsey,magic|\ - zyxel,p870hw-51a-v2) - do_fixcrc - ;; -esac diff --git a/target/linux/bcm63xx/base-files/lib/upgrade/platform.sh b/target/linux/bcm63xx/base-files/lib/upgrade/platform.sh deleted file mode 100644 index 620e0ab4f42b95..00000000000000 --- a/target/linux/bcm63xx/base-files/lib/upgrade/platform.sh +++ /dev/null @@ -1,52 +0,0 @@ -PART_NAME=linux -REQUIRE_IMAGE_METADATA=0 - -platform_check_image() { - [ "$#" -gt 1 ] && return 1 - - case "$(board_name)" in - comtrend,vg-8050|\ - comtrend,vr-3032u|\ - huawei,hg253s-v2|\ - netgear,dgnd3700-v2|\ - sercomm,ad1018|\ - sercomm,h500-s-lowi|\ - sercomm,h500-s-vfes) - # NAND sysupgrade - return 0 - ;; - esac - - case "$(get_magic_word "$1")" in - 3600|3700|3800) - # CFE tag versions - return 0 - ;; - *) - echo "Invalid image type. Please use only .bin files" - return 1 - ;; - esac -} - -platform_do_upgrade() { - case "$(board_name)" in - comtrend,vg-8050|\ - comtrend,vr-3032u|\ - huawei,hg253s-v2|\ - netgear,dgnd3700-v2) - REQUIRE_IMAGE_METADATA=1 - CI_JFFS2_CLEAN_MARKERS=1 - nand_do_upgrade "$1" - ;; - sercomm,ad1018|\ - sercomm,h500-s-lowi|\ - sercomm,h500-s-vfes) - REQUIRE_IMAGE_METADATA=1 - nand_do_upgrade "$1" - ;; - *) - default_do_upgrade "$1" - ;; - esac -} diff --git a/target/linux/bcm63xx/config-5.15 b/target/linux/bcm63xx/config-5.15 deleted file mode 100644 index f19d45362ef590..00000000000000 --- a/target/linux/bcm63xx/config-5.15 +++ /dev/null @@ -1,234 +0,0 @@ -CONFIG_ARCH_32BIT_OFF_T=y -CONFIG_ARCH_HIBERNATION_POSSIBLE=y -CONFIG_ARCH_KEEP_MEMBLOCK=y -CONFIG_ARCH_MMAP_RND_BITS_MAX=15 -CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=15 -CONFIG_ARCH_SUSPEND_POSSIBLE=y -CONFIG_BCM6345_EXT_IRQ=y -CONFIG_BCM6345_PERIPH_IRQ=y -CONFIG_BCM63XX=y -CONFIG_BCM63XX_CPU_3368=y -CONFIG_BCM63XX_CPU_6318=y -CONFIG_BCM63XX_CPU_63268=y -CONFIG_BCM63XX_CPU_6328=y -CONFIG_BCM63XX_CPU_6338=y -CONFIG_BCM63XX_CPU_6345=y -CONFIG_BCM63XX_CPU_6348=y -CONFIG_BCM63XX_CPU_6358=y -CONFIG_BCM63XX_CPU_6362=y -CONFIG_BCM63XX_CPU_6368=y -CONFIG_BCM63XX_EHCI=y -CONFIG_BCM63XX_ENET=y -CONFIG_BCM63XX_OHCI=y -CONFIG_BCM63XX_PHY=y -CONFIG_BCM63XX_WDT=y -CONFIG_BCMA=y -CONFIG_BCMA_BLOCKIO=y -# CONFIG_BCMA_DEBUG is not set -# CONFIG_BCMA_DRIVER_GMAC_CMN is not set -# CONFIG_BCMA_DRIVER_MIPS is not set -CONFIG_BCMA_DRIVER_PCI=y -# CONFIG_BCMA_DRIVER_PCI_HOSTMODE is not set -CONFIG_BCMA_HOST_PCI=y -CONFIG_BCMA_HOST_PCI_POSSIBLE=y -# CONFIG_BCMA_HOST_SOC is not set -CONFIG_BCM_NET_PHYLIB=y -CONFIG_BLK_MQ_PCI=y -CONFIG_BOARD_BCM63XX_DT=y -CONFIG_BOARD_BCM963XX=y -CONFIG_BOARD_LIVEBOX=y -CONFIG_CEVT_R4K=y -CONFIG_CLONE_BACKWARDS=y -CONFIG_COMPAT_32BIT_TIME=y -CONFIG_CPU_BIG_ENDIAN=y -CONFIG_CPU_BMIPS=y -CONFIG_CPU_BMIPS32_3300=y -CONFIG_CPU_BMIPS4350=y -CONFIG_CPU_BMIPS4380=y -CONFIG_CPU_GENERIC_DUMP_TLB=y -CONFIG_CPU_HAS_PREFETCH=y -CONFIG_CPU_HAS_RIXI=y -CONFIG_CPU_HAS_SYNC=y -CONFIG_CPU_MIPS32=y -CONFIG_CPU_NEEDS_NO_SMARTMIPS_OR_MICROMIPS=y -CONFIG_CPU_NO_EFFICIENT_FFS=y -CONFIG_CPU_R4K_CACHE_TLB=y -CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y -CONFIG_CPU_SUPPORTS_CPUFREQ=y -CONFIG_CPU_SUPPORTS_HIGHMEM=y -CONFIG_CRASH_CORE=y -CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y -CONFIG_CRYPTO_LIB_POLY1305_RSIZE=2 -CONFIG_CRYPTO_RNG2=y -CONFIG_CSRC_R4K=y -CONFIG_DMA_NONCOHERENT=y -CONFIG_DTC=y -CONFIG_EARLY_PRINTK=y -CONFIG_FIXED_PHY=y -CONFIG_FWNODE_MDIO=y -CONFIG_FW_LOADER_PAGED_BUF=y -CONFIG_GENERIC_ATOMIC64=y -CONFIG_GENERIC_CLOCKEVENTS=y -CONFIG_GENERIC_CMOS_UPDATE=y -CONFIG_GENERIC_CPU_AUTOPROBE=y -CONFIG_GENERIC_FIND_FIRST_BIT=y -CONFIG_GENERIC_GETTIMEOFDAY=y -CONFIG_GENERIC_IOMAP=y -CONFIG_GENERIC_IRQ_CHIP=y -CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y -CONFIG_GENERIC_IRQ_SHOW=y -CONFIG_GENERIC_LIB_ASHLDI3=y -CONFIG_GENERIC_LIB_ASHRDI3=y -CONFIG_GENERIC_LIB_CMPDI2=y -CONFIG_GENERIC_LIB_LSHRDI3=y -CONFIG_GENERIC_LIB_UCMPDI2=y -CONFIG_GENERIC_PCI_IOMAP=y -CONFIG_GENERIC_PINCONF=y -CONFIG_GENERIC_PINCTRL_GROUPS=y -CONFIG_GENERIC_PINMUX_FUNCTIONS=y -CONFIG_GENERIC_SCHED_CLOCK=y -CONFIG_GENERIC_SMP_IDLE_THREAD=y -CONFIG_GENERIC_TIME_VSYSCALL=y -CONFIG_GPIO_BCM63XX=y -CONFIG_GPIO_CDEV=y -CONFIG_GPIO_GENERIC=y -CONFIG_HANDLE_DOMAIN_IRQ=y -CONFIG_HAS_DMA=y -CONFIG_HAS_IOMEM=y -CONFIG_HAS_IOPORT_MAP=y -CONFIG_HW_RANDOM=y -CONFIG_HW_RANDOM_BCM2835=y -CONFIG_HZ_PERIODIC=y -CONFIG_INITRAMFS_SOURCE="" -CONFIG_IRQCHIP=y -CONFIG_IRQ_DOMAIN=y -CONFIG_IRQ_FORCED_THREADING=y -CONFIG_IRQ_MIPS_CPU=y -CONFIG_IRQ_WORK=y -CONFIG_KEXEC=y -CONFIG_KEXEC_CORE=y -# CONFIG_LEDS_BCM63138 is not set -CONFIG_LEDS_BCM6328=y -CONFIG_LEDS_BCM6358=y -CONFIG_LEDS_GPIO=y -CONFIG_LIBFDT=y -CONFIG_LOCK_DEBUGGING_SUPPORT=y -CONFIG_MDIO_BUS=y -CONFIG_MDIO_DEVICE=y -CONFIG_MDIO_DEVRES=y -CONFIG_MEMFD_CREATE=y -CONFIG_MFD_SYSCON=y -CONFIG_MIGRATION=y -CONFIG_MIPS=y -CONFIG_MIPS_ASID_BITS=8 -CONFIG_MIPS_ASID_SHIFT=0 -CONFIG_MIPS_CLOCK_VSYSCALL=y -# CONFIG_MIPS_CMDLINE_FROM_BOOTLOADER is not set -CONFIG_MIPS_CMDLINE_FROM_DTB=y -CONFIG_MIPS_EBPF_JIT=y -CONFIG_MIPS_EXTERNAL_TIMER=y -CONFIG_MIPS_L1_CACHE_SHIFT=6 -CONFIG_MIPS_L1_CACHE_SHIFT_4=y -CONFIG_MIPS_L1_CACHE_SHIFT_6=y -CONFIG_MIPS_LD_CAN_LINK_VDSO=y -# CONFIG_MIPS_NO_APPENDED_DTB is not set -CONFIG_MIPS_RAW_APPENDED_DTB=y -CONFIG_MODULES_USE_ELF_REL=y -CONFIG_MODULE_FORCE_LOAD=y -CONFIG_MODULE_FORCE_UNLOAD=y -CONFIG_MTD_BCM63XX_PARTS=y -CONFIG_MTD_CFI_ADV_OPTIONS=y -CONFIG_MTD_CFI_BE_BYTE_SWAP=y -# CONFIG_MTD_CFI_GEOMETRY is not set -# CONFIG_MTD_CFI_NOSWAP is not set -CONFIG_MTD_CFI_STAA=y -# CONFIG_MTD_COMPLEX_MAPPINGS is not set -CONFIG_MTD_JEDECPROBE=y -CONFIG_MTD_PARSER_IMAGETAG=y -CONFIG_MTD_PHYSMAP=y -CONFIG_MTD_REDBOOT_PARTS=y -CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED=y -CONFIG_MTD_SPI_NOR=y -CONFIG_NEED_DMA_MAP_STATE=y -CONFIG_NEED_PER_CPU_KM=y -CONFIG_NET_SELFTESTS=y -CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y -CONFIG_NVMEM=y -CONFIG_OF=y -CONFIG_OF_ADDRESS=y -CONFIG_OF_EARLY_FLATTREE=y -CONFIG_OF_FLATTREE=y -CONFIG_OF_GPIO=y -CONFIG_OF_IRQ=y -CONFIG_OF_KOBJ=y -CONFIG_OF_MDIO=y -CONFIG_PCI=y -CONFIG_PCIEPORTBUS=y -CONFIG_PCI_DOMAINS=y -CONFIG_PCI_DRIVERS_LEGACY=y -CONFIG_PERF_USE_VMALLOC=y -CONFIG_PGTABLE_LEVELS=2 -CONFIG_PHYLIB=y -CONFIG_PINCTRL=y -CONFIG_PINCTRL_BRCM6318=y -CONFIG_PINCTRL_BRCM63268=y -CONFIG_PINCTRL_BRCM6328=y -CONFIG_PINCTRL_BRCM6348=y -CONFIG_PINCTRL_BRCM6358=y -CONFIG_PINCTRL_BRCM6362=y -CONFIG_PINCTRL_BRCM6368=y -CONFIG_PINCTRL_BRCM63XX=y -CONFIG_POSIX_MQUEUE=y -CONFIG_POSIX_MQUEUE_SYSCTL=y -CONFIG_PTP_1588_CLOCK_OPTIONAL=y -CONFIG_REGMAP=y -CONFIG_REGMAP_MMIO=y -CONFIG_RELAY=y -CONFIG_RTL8366_SMI=y -CONFIG_RTL8367_PHY=y -# CONFIG_SERIAL_8250 is not set -CONFIG_SERIAL_BCM63XX=y -CONFIG_SERIAL_BCM63XX_CONSOLE=y -CONFIG_SPI=y -CONFIG_SPI_BCM63XX=y -CONFIG_SPI_BCM63XX_HSSPI=y -CONFIG_SPI_MASTER=y -CONFIG_SPI_MEM=y -CONFIG_SRCU=y -CONFIG_SSB=y -CONFIG_SSB_B43_PCI_BRIDGE=y -CONFIG_SSB_BLOCKIO=y -# CONFIG_SSB_DRIVER_MIPS is not set -CONFIG_SSB_DRIVER_PCICORE=y -CONFIG_SSB_DRIVER_PCICORE_POSSIBLE=y -CONFIG_SSB_PCIHOST=y -CONFIG_SSB_PCIHOST_POSSIBLE=y -CONFIG_SSB_SPROM=y -CONFIG_SWAP_IO_SPACE=y -CONFIG_SWCONFIG=y -CONFIG_SWCONFIG_B53=y -CONFIG_SWCONFIG_B53_MMAP_DRIVER=y -CONFIG_SWCONFIG_B53_PHY_DRIVER=y -CONFIG_SWCONFIG_B53_PHY_FIXUP=y -CONFIG_SWCONFIG_B53_SPI_DRIVER=y -CONFIG_SWPHY=y -CONFIG_SYNC_R4K=y -CONFIG_SYSCTL_EXCEPTION_TRACE=y -CONFIG_SYS_HAS_CPU_BMIPS=y -CONFIG_SYS_HAS_CPU_BMIPS32_3300=y -CONFIG_SYS_HAS_CPU_BMIPS4350=y -CONFIG_SYS_HAS_CPU_BMIPS4380=y -CONFIG_SYS_HAS_EARLY_PRINTK=y -CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y -CONFIG_SYS_SUPPORTS_ARBIT_HZ=y -CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y -CONFIG_SYS_SUPPORTS_HOTPLUG_CPU=y -CONFIG_SYS_SUPPORTS_SMP=y -CONFIG_TARGET_ISA_REV=0 -CONFIG_TICK_CPU_ACCOUNTING=y -CONFIG_TINY_SRCU=y -CONFIG_USB_SUPPORT=y -CONFIG_USE_OF=y -CONFIG_VM_EVENT_COUNTERS=y -CONFIG_WATCHDOG_NOWAYOUT=y -CONFIG_WEAK_ORDERING=y diff --git a/target/linux/bcm63xx/dts/bcm3368-netgear-cvg834g.dts b/target/linux/bcm63xx/dts/bcm3368-netgear-cvg834g.dts deleted file mode 100644 index 998ca6002a8643..00000000000000 --- a/target/linux/bcm63xx/dts/bcm3368-netgear-cvg834g.dts +++ /dev/null @@ -1,67 +0,0 @@ -#include "bcm3368.dtsi" - -#include -#include - -/ { - model = "Netgear CVG834G"; - compatible = "netgear,cvg834g", "brcm,bcm3368"; - - aliases { - led-boot = &led_power_green; - led-failsafe = &led_power_green; - led-running = &led_power_green; - led-upgrade = &led_power_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - leds { - compatible = "gpio-leds"; - - led_power_green: power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&gpio1 5 0>; - default-state = "on"; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x010000>; - read-only; - }; - - linux@10000 { - label = "linux"; - reg = <0x010000 0x3e0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@3f0000 { - label = "nvram"; - reg = <0x3f0000 0x010000>; - }; - }; -}; - -&uart0 { - status = "okay"; -}; - -&uart1 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm3368.dtsi b/target/linux/bcm63xx/dts/bcm3368.dtsi deleted file mode 100644 index 7c392227e28c63..00000000000000 --- a/target/linux/bcm63xx/dts/bcm3368.dtsi +++ /dev/null @@ -1,135 +0,0 @@ -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - compatible = "brcm,bcm3368"; - - aliases { - pflash = &pflash; - gpio0 = &gpio0; - gpio1 = &gpio1; - serial0 = &uart0; - serial1 = &uart1; - spi0 = &lsspi; - }; - - cpus { - #address-cells = <1>; - #size-cells = <0>; - - cpu@0 { - compatible = "brcm,bmips4350", "mips,mips4Kc"; - device_type = "cpu"; - reg = <0>; - }; - - cpu@1 { - compatible = "brcm,bmips4350", "mips,mips4Kc"; - device_type = "cpu"; - reg = <1>; - }; - }; - - cpu_intc: interrupt-controller { - #address-cells = <0>; - compatible = "mti,cpu-interrupt-controller"; - - interrupt-controller; - #interrupt-cells = <1>; - }; - - memory { device_type = "memory"; reg = <0 0>; }; - - pflash: nor@1e000000 { - compatible = "cfi-flash"; - reg = <0x1e000000 0x2000000>; - bank-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - - status = "disabled"; - }; - - ubus@fff00000 { - #address-cells = <1>; - #size-cells = <1>; - ranges; - compatible = "simple-bus"; - interrupt-parent = <&periph_intc>; - - periph_intc: interrupt-controller@fff8c00c { - compatible = "brcm,bcm6345-l1-intc"; - reg = <0xfff8c00c 0x8>; - - interrupt-controller; - #interrupt-cells = <1>; - - interrupt-parent = <&cpu_intc>; - interrupts = <2>; - }; - - ext_intc0: interrupt-controller@fff8c014 { - compatible = "brcm,bcm6345-ext-intc"; - reg = <0xfff8c014 0x4>; - - interrupt-controller; - #interrupt-cells = <2>; - - interrupts = <25>, <26>, <27>, <28>; - }; - - gpio1: gpio-controller@fff8c080 { - compatible = "brcm,bcm6345-gpio"; - reg = <0xfff8c080 4>, <0xfff8c088 4>; - - gpio-controller; - #gpio-cells = <2>; - - ngpios = <8>; - }; - - gpio0: gpio-controller@fff8c084 { - compatible = "brcm,bcm6345-gpio"; - reg = <0xfff8c084 4>, <0xfff8c08c 4>; - - gpio-controller; - #gpio-cells = <2>; - }; - - uart0: serial@fff8c100 { - compatible = "brcm,bcm6345-uart"; - reg = <0xfff8c100 0x18>; - - interrupt-parent = <&periph_intc>; - interrupts = <2>; - - /* clocks = <&periph_clk>; */ - /* clock-names = "refclk"; */ - - status = "disabled"; - }; - - uart1: serial@fff8c120 { - compatible = "brcm,bcm6345-uart"; - reg = <0xfff8c120 0x18>; - - interrupt-parent = <&periph_intc>; - interrupts = <3>; - - /* clocks = <&periph_clk>; */ - /* clock-names = "refclk"; */ - - status = "disabled"; - }; - - lsspi: spi@fff8c800 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "brcm,bcm6358-spi"; - reg = <0xfff8c800 0x70c>; - interrupts = <1>; - /* clocks = <&clkctl 9>; */ - }; - }; -}; diff --git a/target/linux/bcm63xx/dts/bcm63167-sercomm-h500-s-lowi.dts b/target/linux/bcm63xx/dts/bcm63167-sercomm-h500-s-lowi.dts deleted file mode 100644 index 90aa9e1c15181e..00000000000000 --- a/target/linux/bcm63xx/dts/bcm63167-sercomm-h500-s-lowi.dts +++ /dev/null @@ -1,13 +0,0 @@ -// SPDX-License-Identifier: (GPL-2.0-or-later OR MIT) -/* - * Device Tree file for Sercomm H500-s lowi - * - * Copyright (C) 2020 Daniel González Cabanelas - */ - -#include "bcm63167-sercomm-h500-s.dtsi" - -/ { - model = "Sercomm H500-s lowi"; - compatible = "sercomm,h500-s-lowi", "brcm,bcm63167", "brcm,bcm63268"; -}; diff --git a/target/linux/bcm63xx/dts/bcm63167-sercomm-h500-s-vfes.dts b/target/linux/bcm63xx/dts/bcm63167-sercomm-h500-s-vfes.dts deleted file mode 100644 index 5349a5435622b9..00000000000000 --- a/target/linux/bcm63xx/dts/bcm63167-sercomm-h500-s-vfes.dts +++ /dev/null @@ -1,13 +0,0 @@ -// SPDX-License-Identifier: (GPL-2.0-or-later OR MIT) -/* - * Device Tree file for Sercomm H500-s vfes - * - * Copyright (C) 2020 Daniel González Cabanelas - */ - -#include "bcm63167-sercomm-h500-s.dtsi" - -/ { - model = "Sercomm H500-s vfes"; - compatible = "sercomm,h500-s-vfes", "brcm,bcm63167", "brcm,bcm63268"; -}; diff --git a/target/linux/bcm63xx/dts/bcm63167-sercomm-h500-s.dtsi b/target/linux/bcm63xx/dts/bcm63167-sercomm-h500-s.dtsi deleted file mode 100644 index af633cadebf779..00000000000000 --- a/target/linux/bcm63xx/dts/bcm63167-sercomm-h500-s.dtsi +++ /dev/null @@ -1,197 +0,0 @@ -// SPDX-License-Identifier: (GPL-2.0-or-later OR MIT) -/* - * Device Tree file for Sercomm H500-s - * - * Copyright (C) 2020 Daniel González Cabanelas - */ - -#include "bcm63268.dtsi" - -#include -#include - -/ { - aliases { - led-boot = &led_power_green; - led-failsafe = &led_power_red; - led-running = &led_power_green; - led-upgrade = &led_power_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,ubifs noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - wps { - label = "wps"; - gpios = <&pinctrl 34 1>; - linux,code = ; - debounce-interval = <60>; - }; - - reset { - label = "reset"; - gpios = <&pinctrl 35 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; -}; - -&leds { - status = "okay"; - - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_leds>; - - mobile_red { - reg = <0>; - label = "red:mobile"; - }; - - mobile_green { - reg = <1>; - label = "green:mobile"; - }; - - led_power_red: power_red { - reg = <8>; - function = LED_FUNCTION_POWER; - color = ; - }; - - wifi_green { - reg = <9>; - label = "green:wifi"; - }; - - phone_red { - reg = <12>; - label = "red:phone"; - }; - - wifi_red { - reg = <13>; - label = "red:wifi"; - }; - - internet_red { - reg = <14>; - label = "red:internet"; - }; - - internet_green { - reg = <15>; - label = "green:internet"; - }; - - phone_green { - reg = <16>; - label = "green:phone"; - }; - - led_power_green: power_green { - reg = <17>; - function = LED_FUNCTION_POWER; - color = ; - default-state = "on"; - }; - - mobile_blue { - reg = <23>; - label = "blue:mobile"; - }; -}; - -&nflash { - status = "okay"; - - nandcs@0 { - compatible = "brcm,nandcs"; - #size-cells = <1>; - #address-cells = <1>; - reg = <0>; - nand-ecc-step-size = <512>; - nand-ecc-strength = <4>; - nand-on-flash-bbt; - brcm,nand-oob-sector-size = <64>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "cferom"; - reg = <0x0000000 0x0020000>; - read-only; - }; - - partition@20000 { - label = "part_map"; - reg = <0x0020000 0x00a0000>; - read-only; - }; - - partition@c0000 { - label = "cferam1"; - reg = <0x00c0000 0x0140000>; - read-only; - }; - - partition@200000 { - label = "cferam2"; - reg = <0x0200000 0x0140000>; - read-only; - }; - - partition@6920000 { - label = "bootflag1"; - reg = <0x6920000 0x0140000>; - }; - - partition@6a60000 { - label = "bootflag2"; - reg = <0x6a60000 0x0140000>; - }; - - partition@520000 { - compatible = "sercomm,wfi"; - label = "wfi"; - reg = <0x0520000 0x6400000>; /* 2 images, 97152 KiB */ - }; - - partition@6ba0000 { - label = "xml_cfg"; - reg = <0x6ba0000 0x0280000>; - read-only; - }; - - partition@6e20000 { - label = "app_data"; - reg = <0x6e20000 0x0280000>; - read-only; - }; - }; - }; -}; - -&pinctrl { - pinctrl_leds: leds { - function = "led"; - pins = "gpio0", "gpio1", "gpio8", "gpio9", - "gpio12", "gpio13", "gpio14", "gpio15", - "gpio16", "gpio17", "gpio23"; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm63168-comtrend-vr-3032u.dts b/target/linux/bcm63xx/dts/bcm63168-comtrend-vr-3032u.dts deleted file mode 100644 index 6627d67f8c0f68..00000000000000 --- a/target/linux/bcm63xx/dts/bcm63168-comtrend-vr-3032u.dts +++ /dev/null @@ -1,187 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "bcm63268.dtsi" - -#include -#include - -/ { - model = "Comtrend VR-3032u"; - compatible = "comtrend,vr-3032u", "brcm,bcm63168", "brcm,bcm63268"; - - aliases { - led-boot = &led_power_green; - led-failsafe = &led_power_green; - led-running = &led_power_green; - led-upgrade = &led_power_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,ubifs noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 33 1>; - linux,code = ; - debounce-interval = <60>; - }; - - wps { - label = "wps"; - gpios = <&pinctrl 34 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; -}; - -&leds { - status = "okay"; - brcm,serial-leds; - brcm,serial-dat-low; - brcm,serial-shift-inv; - - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_serial_led>; - - led@0 { - /* GPHY0 Spd 0 */ - reg = <0>; - brcm,hardware-controlled; - brcm,link-signal-sources = <0>; - }; - - led@1 { - /* GPHY0 Spd 1 */ - reg = <1>; - brcm,hardware-controlled; - brcm,link-signal-sources = <1>; - }; - - led@2 { - reg = <2>; - active-low; - label = "red:inet"; - }; - - led@3 { - reg = <3>; - active-low; - label = "green:dsl"; - }; - - led@4 { - reg = <4>; - active-low; - function = LED_FUNCTION_USB; - color = ; - }; - - led@7 { - reg = <7>; - active-low; - function = LED_FUNCTION_WPS; - color = ; - }; - - led@8 { - reg = <8>; - active-low; - label = "green:inet"; - }; - - led@9 { - /* EPHY0 Act */ - reg = <9>; - brcm,hardware-controlled; - }; - - led@10 { - /* EPHY1 Act */ - reg = <10>; - brcm,hardware-controlled; - }; - - led@11 { - /* EPHY2 Act */ - reg = <11>; - brcm,hardware-controlled; - }; - - led@12 { - /* GPHY0 Act */ - reg = <12>; - brcm,hardware-controlled; - }; - - led@13 { - /* EPHY0 Spd */ - reg = <13>; - brcm,hardware-controlled; - }; - - led@14 { - /* EPHY1 Spd */ - reg = <14>; - brcm,hardware-controlled; - }; - - led@15 { - /* EPHY2 Spd */ - reg = <15>; - brcm,hardware-controlled; - }; - - led_power_green: led@20 { - reg = <20>; - active-low; - function = LED_FUNCTION_POWER; - color = ; - default-state = "on"; - }; -}; - -&nflash { - status = "okay"; - - nandcs@0 { - compatible = "brcm,nandcs"; - #size-cells = <1>; - #address-cells = <1>; - reg = <0>; - nand-ecc-step-size = <512>; - nand-ecc-strength = <15>; - nand-on-flash-bbt; - brcm,nand-oob-sector-size = <64>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "cferom"; - reg = <0x0000000 0x0020000>; - read-only; - }; - - partition@20000 { - compatible = "brcm,wfi-split"; - label = "wfi"; - reg = <0x0020000 0x7ac0000>; - }; - }; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm63168-sky-sr102.dts b/target/linux/bcm63xx/dts/bcm63168-sky-sr102.dts deleted file mode 100644 index 4be787d09316be..00000000000000 --- a/target/linux/bcm63xx/dts/bcm63168-sky-sr102.dts +++ /dev/null @@ -1,126 +0,0 @@ -#include "bcm63268.dtsi" - -#include -#include - -/ { - model = "SKY SR102"; - compatible = "sky,sr102", "brcm,bcm63168", "brcm,bcm63268"; - - aliases { - led-boot = &led_power_white; - led-failsafe = &led_power_white; - led-running = &led_power_white; - led-upgrade = &led_power_white; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - wps { - label = "wps"; - gpios = <&pinctrl 33 0>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - lan1_green { - label = "green:lan1"; - gpios = <&pinctrl 1 1>; - }; - power_red { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 2 1>; - }; - wifi_red { - label = "red:wifi"; - gpios = <&pinctrl 3 1>; - }; - inet_red { - label = "red:inet"; - gpios = <&pinctrl 4 1>; - }; - inet_white { - label = "white:inet"; - gpios = <&pinctrl 5 0>; - }; - led_power_white: power_white { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 6 0>; - default-state = "on"; - }; - wifi_white { - label = "white:wifi"; - gpios = <&pinctrl 8 0>; - }; - lan2_red { - label = "red:lan2"; - gpios = <&pinctrl 9 1>; - }; - lan3_red { - label = "red:lan3"; - gpios = <&pinctrl 10 1>; - }; - lan4_red { - label = "red:lan4"; - gpios = <&pinctrl 11 1>; - }; - lan1_red { - label = "red:lan1"; - gpios = <&pinctrl 12 1>; - }; - lan2_green { - label = "green:lan2"; - gpios = <&pinctrl 13 0>; - }; - lan3_green { - label = "green:lan3"; - gpios = <&pinctrl 14 1>; - }; - lan4_green { - label = "green:lan4"; - gpios = <&pinctrl 15 1>; - }; - hd_white { - label = "white:hd"; - gpios = <&pinctrl 18 0>; - }; - }; -}; - -&hsspi { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - spi-max-frequency = <16666667>; - spi-tx-bus-width = <2>; - spi-rx-bus-width = <2>; - reg = <0>; - - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "brcm,bcm963xx-cfe-nor-partitions"; - }; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm63169-comtrend-vg-8050.dts b/target/linux/bcm63xx/dts/bcm63169-comtrend-vg-8050.dts deleted file mode 100644 index 373480b0130d1d..00000000000000 --- a/target/linux/bcm63xx/dts/bcm63169-comtrend-vg-8050.dts +++ /dev/null @@ -1,201 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "bcm63268.dtsi" - -#include -#include - -/ { - model = "Comtrend VG-8050"; - compatible = "comtrend,vg-8050", "brcm,bcm63169", "brcm,bcm63268"; - - aliases { - led-boot = &led_power_green; - led-failsafe = &led_power_green; - led-running = &led_power_green; - led-upgrade = &led_power_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,ubifs noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 33 1>; - linux,code = ; - debounce-interval = <60>; - }; - - wps { - label = "wps"; - gpios = <&pinctrl 34 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; -}; - -&leds { - status = "okay"; - brcm,serial-leds; - brcm,serial-dat-low; - brcm,serial-shift-inv; - - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_serial_led>; - - led@2 { - reg = <2>; - active-low; - label = "red:internet"; - }; - - led@3 { - reg = <3>; - active-low; - function = LED_FUNCTION_POWER; - color = ; - }; - - led_power_green: led@6 { - reg = <6>; - active-low; - function = LED_FUNCTION_POWER; - color = ; - default-state = "on"; - }; - - led@7 { - reg = <7>; - active-low; - function = LED_FUNCTION_WPS; - color = ; - }; - - led@8 { - reg = <8>; - active-low; - label = "green:internet"; - }; - - led@10 { - reg = <10>; - active-low; - label = "green:voip"; - }; - - led@12 { - reg = <12>; - active-low; - label = "red:voip"; - }; - - led@14 { - reg = <14>; - active-low; - function = LED_FUNCTION_WPS; - color = ; - }; -}; - -&hsspi { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_hsspi_cs5>; - - switch@5 { - compatible = "brcm,bcm53125"; - reg = <5>; - spi-max-frequency = <781000>; - spi-cpha; - spi-cpol; - - lede,alias = "eth0"; - - ports { - #address-cells = <1>; - #size-cells = <0>; - - lan@0 { - reg = <0>; - label = "lan4"; - }; - - lan@1 { - reg = <1>; - label = "lan3"; - }; - - lan@2 { - reg = <2>; - label = "lan2"; - }; - - lan@3 { - reg = <3>; - label = "lan1"; - }; - - wan@4 { - reg = <4>; - label = "wan"; - }; - - cpu@8 { - reg = <8>; - label = "cpu"; - - fixed-link { - speed = <1000>; - full-duplex; - asym-pause; - pause; - }; - }; - }; - }; -}; - -&nflash { - status = "okay"; - - nandcs@0 { - compatible = "brcm,nandcs"; - #size-cells = <1>; - #address-cells = <1>; - reg = <0>; - nand-ecc-step-size = <512>; - nand-ecc-strength = <15>; - nand-on-flash-bbt; - brcm,nand-oob-sector-size = <64>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "cferom"; - reg = <0x0000000 0x0020000>; - read-only; - }; - - partition@20000 { - compatible = "brcm,wfi-split"; - label = "wfi"; - reg = <0x0020000 0x7ac0000>; - }; - }; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6318-brcm-bcm96318ref-p300.dts b/target/linux/bcm63xx/dts/bcm6318-brcm-bcm96318ref-p300.dts deleted file mode 100644 index c6700bdd117209..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6318-brcm-bcm96318ref-p300.dts +++ /dev/null @@ -1,87 +0,0 @@ -#include "bcm6318.dtsi" - -#include - -/ { - model = "Broadcom BCM96318REF_P300 reference board"; - compatible = "brcm,bcm96318ref-p300", "brcm,bcm6318"; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - wps { - label = "wps"; - gpios = <&pinctrl 33 1>; - linux,code = ; - debounce-interval = <60>; - }; - - reset { - label = "reset"; - gpios = <&pinctrl 34 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - inet { - label = "green:inet"; - gpios = <&pinctrl 8 1>; - }; - - inet_fail { - label = "red:inet-fail"; - gpios = <&pinctrl 9 1>; - }; - - post_failed { - label = "red:post-failed"; - gpios = <&pinctrl 11 1>; - }; - - usb_pwron { - label = "usb-pwron"; - gpios = <&pinctrl 13 1>; - default-state = "on"; - }; - }; -}; - -&hsspi { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - spi-max-frequency = <62500000>; - spi-tx-bus-width = <2>; - spi-rx-bus-width = <2>; - reg = <0>; - - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "brcm,bcm963xx-cfe-nor-partitions"; - }; - }; -}; - -&pinctrl { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_usb_pwron>; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6318-brcm-bcm96318ref.dts b/target/linux/bcm63xx/dts/bcm6318-brcm-bcm96318ref.dts deleted file mode 100644 index 89649fa7392fb5..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6318-brcm-bcm96318ref.dts +++ /dev/null @@ -1,81 +0,0 @@ -#include "bcm6318.dtsi" - -#include - -/ { - model = "Broadcom BCM96318REF reference board"; - compatible = "brcm,bcm96318ref", "brcm,bcm6318"; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - wps { - label = "wps"; - gpios = <&pinctrl 33 1>; - linux,code = ; - debounce-interval = <60>; - }; - - reset { - label = "reset"; - gpios = <&pinctrl 34 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - inet { - label = "green:inet"; - gpios = <&pinctrl 8 1>; - }; - - inet_fail { - label = "red:inet-fail"; - gpios = <&pinctrl 9 1>; - }; - - post_failed { - label = "red:post-failed"; - gpios = <&pinctrl 11 1>; - }; - }; -}; - -&hsspi { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - spi-max-frequency = <62500000>; - spi-tx-bus-width = <2>; - spi-rx-bus-width = <2>; - reg = <0>; - - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "brcm,bcm963xx-cfe-nor-partitions"; - }; - }; -}; - -&pinctrl { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_usb_pwron>; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6318-comtrend-ar-5315u.dts b/target/linux/bcm63xx/dts/bcm6318-comtrend-ar-5315u.dts deleted file mode 100644 index a3a7d1a3c56d60..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6318-comtrend-ar-5315u.dts +++ /dev/null @@ -1,178 +0,0 @@ -#include "bcm6318.dtsi" - -#include -#include - -/ { - model = "Comtrend AR-5315u"; - compatible = "comtrend,ar-5315u", "brcm,bcm6318"; - - aliases { - led-boot = &led_power_green; - led-failsafe = &led_power_green; - led-running = &led_power_green; - led-upgrade = &led_power_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - wps { - label = "wps"; - gpios = <&pinctrl 3 1>; - linux,code = ; - debounce-interval = <60>; - }; - - reset { - label = "reset"; - gpios = <&pinctrl 33 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; -}; - -&hsspi { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - spi-max-frequency = <62500000>; - spi-tx-bus-width = <2>; - spi-rx-bus-width = <2>; - reg = <0>; - - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - reg = <0x000000 0x010000>; - label = "cfe"; - read-only; - }; - - linux@10000 { - reg = <0x010000 0xfe0000>; - label = "linux"; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@ff0000 { - reg = <0xff0000 0x010000>; - label = "nvram"; - }; - }; - }; -}; - -&leds { - status = "okay"; - - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_leds - &pinctrl_ephy0_act_led &pinctrl_ephy1_act_led - &pinctrl_ephy2_act_led &pinctrl_ephy3_act_led>; - - led@0 { - reg = <0>; - active-low; - function = LED_FUNCTION_WPS; - color = ; - }; - - led_power_green: led@1 { - reg = <1>; - active-low; - function = LED_FUNCTION_POWER; - color = ; - default-state = "on"; - }; - - led@2 { - reg = <2>; - active-low; - function = LED_FUNCTION_USB; - color = ; - }; - - led@4 { - reg = <4>; - brcm,hardware-controlled; - brcm,link-signal-sources = <4>; - /* EPHY0 Act */ - }; - - led@5 { - reg = <5>; - brcm,hardware-controlled; - brcm,link-signal-sources = <5>; - /* EPHY1 Act */ - }; - - led@6 { - reg = <6>; - brcm,hardware-controlled; - brcm,link-signal-sources = <6>; - /* EPHY2 Act */ - }; - - led@7 { - reg = <7>; - brcm,hardware-controlled; - brcm,link-signal-sources = <7>; - /* EPHY3 Act */ - }; - - led@8 { - reg = <8>; - active-low; - label = "green:inet"; - }; - - led@9 { - reg = <9>; - active-low; - label = "red:inet"; - }; - - led@10 { - reg = <10>; - active-low; - label = "green:dsl"; - }; - - led@11 { - reg = <11>; - active-low; - function = LED_FUNCTION_POWER; - color = ; - }; -}; - -&pinctrl { - pinctrl_leds: leds { - function = "led"; - pins = "gpio0", "gpio1", - "gpio2", "gpio8", - "gpio9", "gpio10", - "gpio11"; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6318-d-link-dsl-275xb-d1.dts b/target/linux/bcm63xx/dts/bcm6318-d-link-dsl-275xb-d1.dts deleted file mode 100644 index 31d05b96ae6320..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6318-d-link-dsl-275xb-d1.dts +++ /dev/null @@ -1,142 +0,0 @@ -#include "bcm6318.dtsi" - -#include -#include - -/ { - model = "D-Link DSL-2750B/DSL-2751 rev D1"; - compatible = "d-link,dsl-275xb-d1", "brcm,bcm6318"; - - aliases { - led-boot = &led_power_green; - led-failsafe = &led_power_green; - led-running = &led_power_green; - led-upgrade = &led_power_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - wifi { - label = "wifi"; - gpios = <&pinctrl 2 1>; - linux,code = ; - debounce-interval = <60>; - }; - - wps { - label = "wps"; - gpios = <&pinctrl 33 1>; - linux,code = ; - debounce-interval = <60>; - }; - - reset { - label = "reset"; - gpios = <&pinctrl 34 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - led_power_green: power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 3 1>; - default-state = "on"; - }; - - inet_green { - label = "green:inet"; - gpios = <&pinctrl 8 1>; - }; - - inet_red { - label = "red:inet-fail"; - gpios = <&pinctrl 9 1>; - }; - - power_red { - label = "red:post-failed"; - gpios = <&pinctrl 11 1>; - }; - - wps_blue { - function = LED_FUNCTION_WPS; - color = ; - gpios = <&pinctrl 16 1>; - }; - - dsl_green { - label = "green:dsl"; - gpios = <&pinctrl 17 1>; - }; - - usb_green { - /* not user controllable? */ - function = LED_FUNCTION_USB; - color = ; - gpios = <&pinctrl 49 1>; - }; - }; -}; - -&hsspi { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - spi-max-frequency = <62500000>; - spi-tx-bus-width = <2>; - spi-rx-bus-width = <2>; - reg = <0>; - - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - reg = <0x000000 0x010000>; - label = "cfe"; - read-only; - }; - - linux@10000 { - reg = <0x010000 0x7e0000>; - label = "linux"; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@7f0000 { - reg = <0x7f0000 0x010000>; - label = "nvram"; - }; - }; - }; -}; - -&pinctrl { - pinctrl-names = "default"; - - pinctrl-0 = <&pinctrl_ephy0_act_led &pinctrl_ephy1_act_led - &pinctrl_ephy2_act_led &pinctrl_ephy3_act_led>; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6318-sagem-fast-2704n.dts b/target/linux/bcm63xx/dts/bcm6318-sagem-fast-2704n.dts deleted file mode 100644 index 4d928f21553849..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6318-sagem-fast-2704n.dts +++ /dev/null @@ -1,145 +0,0 @@ -#include "bcm6318.dtsi" - -#include -#include - -/ { - model = "Sagem F@st 2704N"; - compatible = "sagem,fast-2704n", "brcm,bcm6318"; - - aliases { - led-boot = &led_power_red; - led-failsafe = &led_power_red; - led-running = &led_power_red; - led-upgrade = &led_power_red; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - wlan { - label = "wlan"; - gpios = <&pinctrl 1 0>; - linux,code = ; - debounce-interval = <60>; - }; - - wps { - label = "wps"; - gpios = <&pinctrl 33 1>; - linux,code = ; - debounce-interval = <60>; - }; - - reset { - label = "reset"; - gpios = <&pinctrl 34 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - wps_green { - function = LED_FUNCTION_WPS; - color = ; - gpios = <&pinctrl 2 1>; - }; - lan1_green { - label = "green:lan1"; - gpios = <&pinctrl 4 1>; - }; - lan2_green { - label = "green:lan2"; - gpios = <&pinctrl 5 1>; - }; - lan3_green { - label = "green:lan3"; - gpios = <&pinctrl 6 1>; - }; - lan4_green { - label = "green:lan4"; - gpios = <&pinctrl 7 1>; - }; - inet_green { - label = "green:inet"; - gpios = <&pinctrl 8 1>; - }; - inet_red { - label = "red:inet"; - gpios = <&pinctrl 9 1>; - }; - dsl_green { - label = "green:dsl"; - gpios = <&pinctrl 10 1>; - }; - led_power_red: power_red { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 11 1>; - }; - power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 47 1>; - default-state = "on"; - }; - usb_green { - function = LED_FUNCTION_USB; - color = ; - gpios = <&pinctrl 49 1>; - }; - }; -}; - -&hsspi { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - spi-max-frequency = <62500000>; - spi-tx-bus-width = <2>; - spi-rx-bus-width = <2>; - reg = <0>; - - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - reg = <0x000000 0x010000>; - label = "cfe"; - read-only; - }; - - linux@10000 { - reg = <0x010000 0x7e0000>; - label = "linux"; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@7f0000 { - reg = <0x7f0000 0x010000>; - label = "nvram"; - }; - }; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6318.dtsi b/target/linux/bcm63xx/dts/bcm6318.dtsi deleted file mode 100644 index ee7db04fe960c3..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6318.dtsi +++ /dev/null @@ -1,202 +0,0 @@ -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - compatible = "brcm,bcm6318"; - - aliases { - pinctrl = &pinctrl; - serial0 = &uart0; - spi1 = &hsspi; - }; - - cpus { - #address-cells = <1>; - #size-cells = <0>; - - cpu@0 { - compatible = "brcm,bmips3300", "mips,mips4Kc"; - device_type = "cpu"; - reg = <0>; - }; - }; - - cpu_intc: interrupt-controller { - #address-cells = <0>; - compatible = "mti,cpu-interrupt-controller"; - - interrupt-controller; - #interrupt-cells = <1>; - }; - - memory { device_type = "memory"; reg = <0 0>; }; - - ubus@10000000 { - #address-cells = <1>; - #size-cells = <1>; - ranges; - compatible = "simple-bus"; - interrupt-parent = <&periph_intc>; - - ext_intc: interrupt-controller@10000018 { - compatible = "brcm,bcm6318-ext-intc"; - reg = <0x10000018 0x4>; - - interrupt-controller; - #interrupt-cells = <2>; - - interrupts = <24>, <25>, <26>, <27>; - }; - - periph_intc: interrupt-controller@10000020 { - compatible = "brcm,bcm6345-l1-intc"; - reg = <0x10000020 0x20>; - - interrupt-controller; - #interrupt-cells = <1>; - - interrupt-parent = <&cpu_intc>; - interrupts = <2>; - }; - - pinctrl: pin-controller@10000080 { - compatible = "brcm,bcm6318-pinctrl"; - reg = <0x10000080 0x08>, - <0x10000088 0x08>, - <0x10000098 0x04>, - <0x1000009c 0x0c>, - <0x100000d4 0x18>; - reg-names = "dirout", "dat", "mode", "mux", "pad"; - - gpio-controller; - #gpio-cells = <2>; - - interrupt-parent = <&ext_intc>; - interrupts = <0 0>, <1 0>; - interrupt-names = "gpio33", "gpio34"; - - pinctrl_ephy0_spd_led: ephy0_spd_led { - function = "ephy0_spd_led"; - pins = "gpio0"; - }; - - pinctrl_ephy1_spd_led: ephy1_spd_led { - function = "ephy1_spd_led"; - pins = "gpio1"; - }; - - pinctrl_ephy2_spd_led: ephy2_spd_led { - function = "ephy2_spd_led"; - pins = "gpio2"; - }; - - pinctrl_ephy3_spd_led: ephy3_spd_led { - function = "ephy3_spd_led"; - pins = "gpio3"; - }; - - pinctrl_ephy0_act_led: ephy0_act_led { - function = "ephy0_act_led"; - pins = "gpio4"; - }; - - pinctrl_ephy1_act_led: ephy1_act_led { - function = "ephy1_act_led"; - pins = "gpio5"; - }; - - pinctrl_ephy2_act_led: ephy2_act_led { - function = "ephy2_act_led"; - pins = "gpio6"; - }; - - pinctrl_ephy3_act_led: ephy3_act_led { - function = "ephy3_act_led"; - pins = "gpio7"; - }; - - pinctrl_serial_led: serial_led { - pinctrl_serial_led_data: serial_led_data { - function = "serial_led_data"; - pins = "gpio6"; - }; - - pinctrl_serial_led_clk: serial_led_clk { - function = "serial_led_clk"; - pins = "gpio7"; - }; - }; - - pinctrl_inet_act_led: inet_act_led { - function = "inet_act_led"; - pins = "gpio8"; - }; - - pinctrl_inet_fail_led: inet_fail_led { - function = "inet_fail_led"; - pins = "gpio9"; - }; - - pinctrl_dsl_led: dsl_led { - function = "dsl_led"; - pins = "gpio10"; - }; - - pinctrl_post_fail_led: post_fail_led { - function = "post_fail_led"; - pins = "gpio11"; - }; - - pinctrl_wlan_wps_led: wlan_wps_led { - function = "wlan_wps_led"; - pins = "gpio12"; - }; - - pinctrl_usb_pwron: usb_pwron { - function = "usb_pwron"; - pins = "gpio13"; - }; - - pinctrl_usb_device_led: usb_device_led { - function = "usb_device_led"; - pins = "gpio13"; - }; - - pinctrl_usb_active: usb_active { - function = "usb_active"; - pins = "gpio40"; - }; - }; - - uart0: serial@10000100 { - compatible = "brcm,bcm6345-uart"; - reg = <0x10000100 0x18>; - - interrupt-parent = <&periph_intc>; - interrupts = <28>; - - /* clocks = <&periph_clk>; */ - /* clock-names = "refclk"; */ - - status = "disabled"; - }; - - leds: led-controller@10000200 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "brcm,bcm6328-leds"; - reg = <0x10000200 0x24>; - status = "disabled"; - }; - - hsspi: spi@10003000 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "brcm,bcm6328-hsspi"; - reg = <0x10003000 0x600>; - interrupts = <29>; - /* clocks = <&clkctl 25>; */ - }; - }; -}; diff --git a/target/linux/bcm63xx/dts/bcm63268-brcm-bcm963268bu-p300.dts b/target/linux/bcm63xx/dts/bcm63268-brcm-bcm963268bu-p300.dts deleted file mode 100644 index 08959ed15630f4..00000000000000 --- a/target/linux/bcm63xx/dts/bcm63268-brcm-bcm963268bu-p300.dts +++ /dev/null @@ -1,57 +0,0 @@ -#include "bcm63268.dtsi" - -#include - -/ { - model = "Broadcom BCM963268BU_P300 reference board"; - compatible = "brcm,bcm963268bu-p300", "brcm,bcm63268"; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 32 0>; - linux,code = ; - debounce-interval = <60>; - }; - - wps { - label = "wps"; - gpios = <&pinctrl 33 0>; - linux,code = ; - debounce-interval = <60>; - }; - }; -}; - -&hsspi { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - spi-max-frequency = <20000000>; - spi-tx-bus-width = <2>; - spi-rx-bus-width = <2>; - reg = <0>; - - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "brcm,bcm963xx-cfe-nor-partitions"; - }; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm63268-inteno-vg50.dts b/target/linux/bcm63xx/dts/bcm63268-inteno-vg50.dts deleted file mode 100644 index fa9856f337d091..00000000000000 --- a/target/linux/bcm63xx/dts/bcm63268-inteno-vg50.dts +++ /dev/null @@ -1,57 +0,0 @@ -#include "bcm63268.dtsi" - -#include - -/ { - model = "Inteno VG50"; - compatible = "inteno,vg50", "brcm,bcm63268"; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 32 0>; - linux,code = ; - debounce-interval = <60>; - }; - - wps { - label = "wps"; - gpios = <&pinctrl 34 0>; - linux,code = ; - debounce-interval = <60>; - }; - }; -}; - -&hsspi { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - spi-max-frequency = <20000000>; - spi-tx-bus-width = <2>; - spi-rx-bus-width = <2>; - reg = <0>; - - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "brcm,bcm963xx-cfe-nor-partitions"; - }; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm63268.dtsi b/target/linux/bcm63xx/dts/bcm63268.dtsi deleted file mode 100644 index 759e97e87d53d0..00000000000000 --- a/target/linux/bcm63xx/dts/bcm63268.dtsi +++ /dev/null @@ -1,277 +0,0 @@ -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - compatible = "brcm,bcm63268"; - - aliases { - nflash = &nflash; - pinctrl = &pinctrl; - serial0 = &uart0; - serial1 = &uart1; - spi0 = &lsspi; - spi1 = &hsspi; - }; - - cpus { - #address-cells = <1>; - #size-cells = <0>; - - cpu@0 { - compatible = "brcm,bmips4350", "mips,mips4Kc"; - device_type = "cpu"; - reg = <0>; - }; - - cpu@1 { - compatible = "brcm,bmips4350", "mips,mips4Kc"; - device_type = "cpu"; - reg = <1>; - }; - }; - - cpu_intc: interrupt-controller { - #address-cells = <0>; - compatible = "mti,cpu-interrupt-controller"; - - interrupt-controller; - #interrupt-cells = <1>; - }; - - memory { device_type = "memory"; reg = <0 0>; }; - - ubus@10000000 { - #address-cells = <1>; - #size-cells = <1>; - ranges; - compatible = "simple-bus"; - interrupt-parent = <&periph_intc>; - - ext_intc: interrupt-controller@10000018 { - compatible = "brcm,bcm6345-ext-intc"; - reg = <0x10000018 0x4>; - - interrupt-controller; - #interrupt-cells = <2>; - - interrupts = <44>, <45>, <46>, <47>; - }; - - periph_intc: interrupt-controller@10000020 { - compatible = "brcm,bcm6345-l1-intc"; - reg = <0x10000020 0x20>, - <0x10000040 0x20>; - - interrupt-controller; - #interrupt-cells = <1>; - - interrupt-parent = <&cpu_intc>; - interrupts = <2>, <3>; - }; - - pinctrl: pin-controller@100000c0 { - compatible = "brcm,bcm63268-pinctrl"; - reg = <0x100000c0 0x8>, - <0x100000c8 0x8>, - <0x100000d0 0x4>, - <0x100000d8 0x4>, - <0x100000dc 0x4>, - <0x100000f8 0x4>; - reg-names = "dirout", "dat", "led", "mode", - "ctrl", "basemode"; - - gpio-controller; - #gpio-cells = <2>; - - interrupt-parent = <&ext_intc>; - interrupts = <0 0>, <1 0>, <2 0>, <3 0>; - interrupt-names = "gpio32", "gpio33", "gpio34", "gpio35"; - - pinctrl_serial_led: serial_led { - pinctrl_serial_led_clk: serial_led_clk { - function = "serial_led_clk"; - pins = "gpio0"; - }; - - pinctrl_serial_led_data: serial_led_data { - function = "serial_led_data"; - pins = "gpio1"; - }; - }; - - pinctrl_hsspi_cs4: hsspi_cs4 { - function = "hsspi_cs4"; - pins = "gpio16"; - }; - - pinctrl_hsspi_cs5: hsspi_cs5 { - function = "hsspi_cs5"; - pins = "gpio17"; - }; - - pinctrl_hsspi_cs6: hsspi_cs6 { - function = "hsspi_cs6"; - pins = "gpio8"; - }; - - pinctrl_hsspi_cs7: hsspi_cs7 { - function = "hsspi_cs7"; - pins = "gpio9"; - }; - - pinctrl_adsl_spi: adsl_spi { - pinctrl_adsl_spi_miso: adsl_spi_miso { - function = "adsl_spi_miso"; - pins = "gpio18"; - }; - - pinctrl_adsl_spi_mosi: adsl_spi_mosi { - function = "adsl_spi_mosi"; - pins = "gpio19"; - }; - }; - - pinctrl_vreq_clk: vreq_clk { - function = "vreq_clk"; - pins = "gpio22"; - }; - - pinctrl_pcie_clkreq_b: pcie_clkreq_b { - function = "pcie_clkreq_b"; - pins = "gpio23"; - }; - - pinctrl_robosw_led_clk: robosw_led_clk { - function = "robosw_led_clk"; - pins = "gpio30"; - }; - - pinctrl_robosw_led_data: robosw_led_data { - function = "robosw_led_data"; - pins = "gpio31"; - }; - - pinctrl_nand: nand { - function = "nand"; - group = "nand_grp"; - }; - - pinctrl_gpio35_alt: gpio35_alt { - function = "gpio35_alt"; - pin = "gpio35"; - }; - - pinctrl_dectpd: dectpd { - function = "dectpd"; - group = "dectpd_grp"; - }; - - pinctrl_vdsl_phy_override_0: vdsl_phy_override_0 { - function = "vdsl_phy_override_0"; - group = "vdsl_phy_override_0_grp"; - }; - - pinctrl_vdsl_phy_override_1: vdsl_phy_override_1 { - function = "vdsl_phy_override_1"; - group = "vdsl_phy_override_1_grp"; - }; - - pinctrl_vdsl_phy_override_2: vdsl_phy_override_2 { - function = "vdsl_phy_override_2"; - group = "vdsl_phy_override_2_grp"; - }; - - pinctrl_vdsl_phy_override_3: vdsl_phy_override_3 { - function = "vdsl_phy_override_3"; - group = "vdsl_phy_override_3_grp"; - }; - - pinctrl_dsl_gpio8: dsl_gpio8 { - function = "dsl_gpio8"; - group = "dsl_gpio8"; - }; - - pinctrl_dsl_gpio9: dsl_gpio9 { - function = "dsl_gpio9"; - group = "dsl_gpio9"; - }; - }; - - uart0: serial@10000180 { - compatible = "brcm,bcm6345-uart"; - reg = <0x10000180 0x18>; - - interrupt-parent = <&periph_intc>; - interrupts = <5>; - - /* clocks = <&periph_clk>; */ - /* clock-names = "refclk"; */ - - status = "disabled"; - }; - - uart1: serial@100001a0 { - compatible = "brcm,bcm6345-uart"; - reg = <0x100001a0 0x18>; - - interrupt-parent = <&periph_intc>; - interrupts = <34>; - - /* clocks = <&periph_clk>; */ - /* clock-names = "refclk"; */ - - status = "disabled"; - }; - - lsspi: spi@10000800 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "brcm,bcm6358-spi"; - reg = <0x10000800 0x70c>; - interrupts = <80>; - /* clocks = <&clkctl 15>; */ - }; - - hsspi: spi@10001000 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "brcm,bcm6328-hsspi"; - reg = <0x10001000 0x600>; - interrupts = <6>; - /* clocks = <&clkctl 16>; */ - }; - - nflash: nand@10000200 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "brcm,nand-bcm6368", - "brcm,brcmnand-v4.0", - "brcm,brcmnand"; - reg = <0x10000200 0x180>, - <0x10000600 0x200>, - <0x100000b0 0x10>; - reg-names = "nand", - "nand-cache", - "nand-int-base"; - - interrupt-parent = <&periph_intc>; - interrupts = <50>; - - /* clocks = <&clkctl 20>; */ - - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_nand>; - - status = "disabled"; - }; - - leds: led-controller@10001900 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "brcm,bcm6328-leds"; - reg = <0x10001900 0x24>; - status = "disabled"; - }; - }; -}; diff --git a/target/linux/bcm63xx/dts/bcm63269-brcm-bcm963269bhr.dts b/target/linux/bcm63xx/dts/bcm63269-brcm-bcm963269bhr.dts deleted file mode 100644 index 186c208a1f9b4e..00000000000000 --- a/target/linux/bcm63xx/dts/bcm63269-brcm-bcm963269bhr.dts +++ /dev/null @@ -1,64 +0,0 @@ -#include "bcm63268.dtsi" - -#include - -/ { - model = "Broadcom BCM963269BHR reference board"; - compatible = "brcm,bcm963269bhr", "brcm,bcm63269", "brcm,bcm63268"; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 32 0>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - usb1 { - label = "green:usb1"; - gpios = <&pinctrl 9 1>; - }; - - usb2 { - label = "green:usb2"; - gpios = <&pinctrl 10 1>; - }; - }; -}; - -&hsspi { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - spi-max-frequency = <20000000>; - spi-tx-bus-width = <2>; - spi-rx-bus-width = <2>; - reg = <0>; - - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "brcm,bcm963xx-cfe-nor-partitions"; - }; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6328-adb-a4001n.dts b/target/linux/bcm63xx/dts/bcm6328-adb-a4001n.dts deleted file mode 100644 index 790320a206f055..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6328-adb-a4001n.dts +++ /dev/null @@ -1,110 +0,0 @@ -#include "bcm6328.dtsi" - -#include -#include - -/ { - model = "ADB P.DG A4001N"; - compatible = "adb,a4001n", "brcm,bcm6328"; - - aliases { - led-boot = &led_power_green; - led-failsafe = &led_power_green; - led-running = &led_power_green; - led-upgrade = &led_power_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 23 1>; - linux,code = ; - debounce-interval = <60>; - }; - - wps { - label = "wps"; - gpios = <&pinctrl 24 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - inet_red { - label = "red:inet"; - gpios = <&pinctrl 1 0>; - }; - power_red { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 4 0>; - }; - led_power_green: power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 8 0>; - default-state = "on"; - }; - usb_green { - function = LED_FUNCTION_USB; - color = ; - gpios = <&pinctrl 10 1>; - }; - dsl_green { - label = "green:dsl"; - gpios = <&pinctrl 11 1>; - }; - }; -}; - -&hsspi { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - spi-max-frequency = <16666667>; - spi-tx-bus-width = <2>; - spi-rx-bus-width = <2>; - reg = <0>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - reg = <0x000000 0x010000>; - label = "cfe"; - read-only; - }; - - linux@10000 { - reg = <0x010000 0x7e0000>; - label = "linux"; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@7f0000 { - reg = <0x7f0000 0x010000>; - label = "nvram"; - }; - }; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6328-adb-a4001n1.dts b/target/linux/bcm63xx/dts/bcm6328-adb-a4001n1.dts deleted file mode 100644 index f23716bd4d7304..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6328-adb-a4001n1.dts +++ /dev/null @@ -1,142 +0,0 @@ -#include "bcm6328.dtsi" - -#include -#include - -/ { - model = "ADB P.DG A4001N1"; - compatible = "adb,a4001n1", "brcm,bcm6328"; - - aliases { - led-boot = &led_power_green; - led-failsafe = &led_power_green; - led-running = &led_power_green; - led-upgrade = &led_power_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 23 1>; - linux,code = ; - debounce-interval = <60>; - }; - - wps { - label = "wlan"; - gpios = <&pinctrl 24 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - inet_red { - label = "red:inet"; - gpios = <&pinctrl 2 1>; - }; - ppp_green { - label = "green:ppp"; - gpios = <&pinctrl 3 1>; - }; - led_power_green: power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 4 1>; - default-state = "on"; - }; - ppp_red { - label = "red:ppp"; - gpios = <&pinctrl 5 1>; - }; - usb_green { - label = "green:3g"; - gpios = <&pinctrl 6 1>; - }; - usb_red { - label = "red:3g"; - gpios = <&pinctrl 7 1>; - }; - power_red { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 8 1>; - }; - wlan_green { - function = LED_FUNCTION_WLAN; - color = ; - gpios = <&pinctrl 9 1>; - }; - wlan_red { - function = LED_FUNCTION_WLAN; - color = ; - gpios = <&pinctrl 10 1>; - }; - inet_green { - label = "green:inet"; - gpios = <&pinctrl 11 1>; - }; - eth_red { - label = "red:eth"; - gpios = <&pinctrl 20 1>; - }; - eth_green { - label = "green:eth"; - gpios = <&pinctrl 31 1>; - }; - }; -}; - -&hsspi { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - spi-max-frequency = <16666667>; - spi-tx-bus-width = <2>; - spi-rx-bus-width = <2>; - reg = <0>; - - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - reg = <0x000000 0x010000>; - label = "cfe"; - read-only; - }; - - linux@10000 { - reg = <0x010000 0xfe0000>; - label = "linux"; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@ff0000 { - reg = <0xff0000 0x010000>; - label = "nvram"; - }; - }; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6328-adb-pdg-a4001n-a-000-1a1-ax.dts b/target/linux/bcm63xx/dts/bcm6328-adb-pdg-a4001n-a-000-1a1-ax.dts deleted file mode 100644 index b2f3ddfc401ddf..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6328-adb-pdg-a4001n-a-000-1a1-ax.dts +++ /dev/null @@ -1,162 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT - -#include "bcm6328.dtsi" - -#include -#include - -/ { - model = "ADB P.DG A4001N A-000-1A1-AX"; - compatible = "adb,pdg-a4001n-a-000-1a1-ax", "brcm,bcm6328"; - - aliases { - led-boot = &led_power_green; - led-failsafe = &led_power_green; - led-running = &led_power_green; - led-upgrade = &led_power_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 23 1>; - linux,code = ; - debounce-interval = <60>; - }; - - wps { - label = "wifi-led"; - gpios = <&pinctrl 24 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; -}; - -&leds { - status = "okay"; - - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_leds>; - - led@2 { - reg = <2>; - active-low; - label = "red:internet"; - }; - - led@3 { - reg = <3>; - active-low; - label = "green:adsl"; - }; - - led@5 { - reg = <5>; - active-low; - label = "red:adsl"; - }; - - led@6 { - reg = <6>; - active-low; - label = "green:service"; - }; - - led@7 { - reg = <7>; - active-low; - label = "red:service"; - }; - - led@8 { - reg = <8>; - active-low; - function = LED_FUNCTION_POWER; - color = ; - }; - - led@9 { - reg = <9>; - active-low; - label = "green:wifi"; - }; - - led@10 { - reg = <10>; - active-low; - label = "red:wifi"; - }; - - led@11 { - reg = <11>; - active-low; - label = "green:internet"; - }; - - led_power_green: led@12 { - reg = <12>; - active-low; - function = LED_FUNCTION_POWER; - color = ; - default-state = "on"; - }; -}; - -&hsspi { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - spi-max-frequency = <16666667>; - spi-tx-bus-width = <2>; - spi-rx-bus-width = <2>; - reg = <0>; - - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - reg = <0x000000 0x010000>; - label = "cfe"; - read-only; - }; - - partition@10000 { - reg = <0x010000 0xff0000>; - label = "linux"; - compatible = "brcm,bcm963xx-imagetag"; - }; - }; - }; -}; - -&pinctrl { - pinctrl_leds: leds { - function = "led"; - pins = "gpio2", "gpio3", - "gpio5", "gpio6", - "gpio7", "gpio8", - "gpio9", "gpio10", - "gpio11", "gpio12"; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6328-adb-pdg-a4101n-a-000-1a1-ae.dts b/target/linux/bcm63xx/dts/bcm6328-adb-pdg-a4101n-a-000-1a1-ae.dts deleted file mode 100644 index 16c9af574716e9..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6328-adb-pdg-a4101n-a-000-1a1-ae.dts +++ /dev/null @@ -1,144 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT - -#include "bcm6328.dtsi" - -#include -#include - -/ { - model = "ADB P.DG A4101N A-000-1A1-AE"; - compatible = "adb,pdg-a4101n-a-000-1a1-ae", "brcm,bcm6328"; - - aliases { - led-boot = &led_dsl_green; - led-failsafe = &led_dsl_green; - led-upgrade = &led_dsl_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - wifi { - label = "wifi"; - gpios = <&pinctrl 12 1>; - linux,code = ; - debounce-interval = <60>; - }; - - reset { - label = "reset"; - gpios = <&pinctrl 23 1>; - linux,code = ; - debounce-interval = <60>; - }; - - wps { - label = "wps"; - gpios = <&pinctrl 24 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - led@31 { - label = "green:tel"; - gpios = <&pinctrl 31 1>; - }; - }; -}; - -&leds { - status = "okay"; - - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_leds>; - - led_dsl_green: led@3 { - reg = <3>; - active-low; - label = "green:dsl"; - }; - - led@9 { - reg = <9>; - active-low; - function = LED_FUNCTION_WPS; - color = ; - }; - - led@10 { - reg = <10>; - active-low; - function = LED_FUNCTION_USB; - color = ; - }; - - led@11 { - reg = <11>; - active-low; - label = "green:internet"; - }; -}; - -&hsspi { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - spi-max-frequency = <16666667>; - spi-tx-bus-width = <2>; - spi-rx-bus-width = <2>; - reg = <0>; - - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - reg = <0x000000 0x010000>; - label = "cfe"; - read-only; - }; - - partition@10000 { - reg = <0x010000 0xff0000>; - label = "linux"; - compatible = "brcm,bcm963xx-imagetag"; - }; - }; - }; -}; - -&pinctrl { - pinctrl_leds: leds { - function = "led"; - pins = "gpio3", "gpio9", "gpio10", - "gpio11"; - }; - - green_internet_switch { - gpio-hog; - gpios = <2 1>; - output-low; - line-name = "green:internet-switch"; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6328-brcm-bcm963281tan.dts b/target/linux/bcm63xx/dts/bcm6328-brcm-bcm963281tan.dts deleted file mode 100644 index 0d494baeb708c4..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6328-brcm-bcm963281tan.dts +++ /dev/null @@ -1,73 +0,0 @@ -#include "bcm6328.dtsi" - -#include - -/ { - model = "Broadcom bcm963281TAN reference board"; - compatible = "brcm,bcm963281tan", "brcm,bcm6328"; - - aliases { - led-boot = &led_power; - led-failsafe = &led_power; - led-running = &led_power; - led-upgrade = &led_power; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - leds { - compatible = "gpio-leds"; - - inet { - label = "internet"; - gpios = <&pinctrl 1 1>; - }; - led_power: power { - label = "power"; - gpios = <&pinctrl 4 1>; - default-state = "on"; - }; - inet_fail { - label = "internet-fail"; - gpios = <&pinctrl 7 1>; - }; - power_fail { - label = "power-fail"; - gpios = <&pinctrl 8 1>; - }; - wps { - label = "wps"; - gpios = <&pinctrl 9 1>; - }; - dsl { - label = "dsl"; - gpios = <&pinctrl 11 1>; - }; - }; -}; - -&hsspi { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - spi-max-frequency = <16666667>; - spi-tx-bus-width = <2>; - spi-rx-bus-width = <2>; - reg = <0>; - - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "brcm,bcm963xx-cfe-nor-partitions"; - }; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6328-brcm-bcm96328avng.dts b/target/linux/bcm63xx/dts/bcm6328-brcm-bcm96328avng.dts deleted file mode 100644 index d047e3fa89c5e4..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6328-brcm-bcm96328avng.dts +++ /dev/null @@ -1,78 +0,0 @@ -#include "bcm6328.dtsi" - -#include - -/ { - model = "Broadcom BCM96328avng reference board"; - compatible = "brcm,bcm96328avng", "brcm,bcm6328"; - - aliases { - led-boot = &led_power; - led-failsafe = &led_power; - led-running = &led_power; - led-upgrade = &led_power; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - leds { - compatible = "gpio-leds"; - - inet_fail { - label = "internet-fail"; - gpios = <&pinctrl 2 1>; - }; - dsl { - label = "dsl"; - gpios = <&pinctrl 3 1>; - }; - led_power: power { - label = "power"; - gpios = <&pinctrl 4 1>; - default-state = "on"; - }; - power_fail { - label = "power-fail"; - gpios = <&pinctrl 8 1>; - }; - wps { - label = "wps"; - gpios = <&pinctrl 9 1>; - }; - inet { - label = "internet"; - gpios = <&pinctrl 11 1>; - }; - }; -}; - -&hsspi { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - spi-max-frequency = <16666667>; - spi-tx-bus-width = <2>; - spi-rx-bus-width = <2>; - reg = <0>; - - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "brcm,bcm963xx-cfe-nor-partitions"; - }; - }; -}; - -&pinctrl { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_usb_port1_device>; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6328-comtrend-ar-5381u.dts b/target/linux/bcm63xx/dts/bcm6328-comtrend-ar-5381u.dts deleted file mode 100644 index 7e196e5e68307f..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6328-comtrend-ar-5381u.dts +++ /dev/null @@ -1,112 +0,0 @@ -#include "bcm6328.dtsi" - -#include -#include - -/ { - model = "Comtrend AR-5381u"; - compatible = "comtrend,ar-5381u", "brcm,bcm6328"; - - aliases { - led-boot = &led_power_green; - led-failsafe = &led_alarm_red; - led-running = &led_power_green; - led-upgrade = &led_power_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 23 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; -}; - -&hsspi { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - spi-max-frequency = <16666667>; - spi-tx-bus-width = <2>; - spi-rx-bus-width = <2>; - reg = <0>; - - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - reg = <0x000000 0x010000>; - label = "cfe"; - read-only; - }; - - linux@10000 { - reg = <0x010000 0xfe0000>; - label = "linux"; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@ff0000 { - reg = <0xff0000 0x010000>; - label = "nvram"; - }; - }; - }; -}; - -&leds { - status = "okay"; - - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_leds>; - - led_alarm_red: led@2 { - reg = <2>; - active-low; - function = LED_FUNCTION_ALARM; - color = ; - }; - - led@3 { - reg = <3>; - active-low; - label = "green:inet"; - }; - - led_power_green: led@4 { - reg = <4>; - active-low; - function = LED_FUNCTION_POWER; - color = ; - default-state = "on"; - }; -}; - -&pinctrl { - pinctrl_leds: leds { - function = "led"; - pins = "gpio2", "gpio3", "gpio4"; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6328-comtrend-ar-5387un.dts b/target/linux/bcm63xx/dts/bcm6328-comtrend-ar-5387un.dts deleted file mode 100644 index a0f5691fb500b7..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6328-comtrend-ar-5387un.dts +++ /dev/null @@ -1,121 +0,0 @@ -#include "bcm6328.dtsi" - -#include -#include - -/ { - model = "Comtrend AR-5387un"; - compatible = "comtrend,ar-5387un", "brcm,bcm6328"; - - aliases { - led-boot = &led_power_green; - led-failsafe = &led_power_green; - led-running = &led_power_green; - led-upgrade = &led_power_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 23 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; -}; - -&hsspi { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - spi-max-frequency = <16666667>; - spi-tx-bus-width = <2>; - spi-rx-bus-width = <2>; - reg = <0>; - - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - reg = <0x000000 0x010000>; - label = "cfe"; - read-only; - }; - - linux@10000 { - reg = <0x010000 0xfe0000>; - label = "linux"; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@ff0000 { - reg = <0xff0000 0x010000>; - label = "nvram"; - }; - }; - }; -}; - -&leds { - status = "okay"; - - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_leds>; - - led@1 { - reg = <1>; - label = "red:inet"; - }; - - led@4 { - reg = <4>; - function = LED_FUNCTION_POWER; - color = ; - }; - - led@7 { - reg = <7>; - label = "green:inet"; - }; - - led_power_green: led@8 { - reg = <8>; - function = LED_FUNCTION_POWER; - color = ; - default-state = "on"; - }; - - led@11 { - reg = <11>; - active-low; - label = "green:dsl"; - }; -}; - -&pinctrl { - pinctrl_leds: leds { - function = "led"; - pins = "gpio1", "gpio4", "gpio7", - "gpio8", "gpio11"; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6328-d-link-dsl-274xb-f1.dts b/target/linux/bcm63xx/dts/bcm6328-d-link-dsl-274xb-f1.dts deleted file mode 100644 index f320be4aca8060..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6328-d-link-dsl-274xb-f1.dts +++ /dev/null @@ -1,130 +0,0 @@ -#include "bcm6328.dtsi" - -#include -#include - -/ { - model = "D-Link DSL-2740B/DSL-2741B rev F1"; - compatible = "d-link,dsl-274xb-f1", "brcm,bcm6328"; - - aliases { - led-boot = &led_power_green; - led-failsafe = &led_power_green; - led-running = &led_power_green; - led-upgrade = &led_power_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - wifi { - label = "wifi"; - gpios = <&pinctrl 10 1>; - linux,code = ; - debounce-interval = <60>; - }; - - reset { - label = "reset"; - gpios = <&pinctrl 23 1>; - linux,code = ; - debounce-interval = <60>; - }; - - wps { - label = "wps"; - gpios = <&pinctrl 24 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - inet_red { - label = "red:internet"; - gpios = <&pinctrl 2 1>; - }; - dsl_green { - label = "green:dsl"; - gpios = <&pinctrl 3 1>; - }; - led_power_green: power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 4 1>; - default-state = "on"; - }; - power_red { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 8 1>; - }; - wps_blue { - function = LED_FUNCTION_WPS; - color = ; - gpios = <&pinctrl 9 1>; - }; - inet_green { - label = "green:internet"; - gpios = <&pinctrl 11 1>; - }; - }; -}; - -&hsspi { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - spi-max-frequency = <16666667>; - spi-tx-bus-width = <2>; - spi-rx-bus-width = <2>; - reg = <0>; - - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - reg = <0x000000 0x010000>; - label = "cfe"; - read-only; - }; - - linux@10000 { - reg = <0x010000 0x7c0000>; - label = "linux"; - compatible = "brcm,bcm963xx-imagetag"; - }; - - cal_data@7d0000 { - reg = <0x7d0000 0x010000>; - label = "cal_data"; - read-only; - }; - - nvram@7e0000 { - reg = <0x7e0000 0x020000>; - label = "nvram"; - }; - }; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6328-d-link-dsl-2750u-c1.dts b/target/linux/bcm63xx/dts/bcm6328-d-link-dsl-2750u-c1.dts deleted file mode 100644 index cdbb5c2c5b2a3a..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6328-d-link-dsl-2750u-c1.dts +++ /dev/null @@ -1,151 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT - -#include "bcm6328.dtsi" - -#include -#include - -/ { - model = "D-Link DSL-2750U rev C1"; - compatible = "d-link,dsl-2750u-c1", "brcm,bcm6328"; - - aliases { - led-boot = &led_power_green; - led-failsafe = &led_power_green; - led-running = &led_power_green; - led-upgrade = &led_power_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - poll-interval = <20>; - - wifi { - label = "wifi"; - gpios = <&pinctrl 12 1>; - linux,code = ; - debounce-interval = <60>; - }; - - reset { - label = "reset"; - gpios = <&pinctrl 23 1>; - linux,code = ; - debounce-interval = <60>; - }; - - wps { - label = "wps"; - gpios = <&pinctrl 24 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; -}; - -&hsspi { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - spi-max-frequency = <16666667>; - spi-tx-bus-width = <2>; - spi-rx-bus-width = <2>; - reg = <0>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - reg = <0x000000 0x010000>; - label = "cfe"; - read-only; - }; - - linux@10000 { - reg = <0x010000 0x7e0000>; - label = "linux"; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@7f0000 { - reg = <0x7f0000 0x010000>; - label = "nvram"; - }; - }; - }; -}; - -&leds { - status = "okay"; - - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_leds>; - - led@1 { - reg = <1>; - active-low; - label = "green:inet"; - }; - - led_power_green: led@4 { - reg = <4>; - active-low; - function = LED_FUNCTION_POWER; - color = ; - default-state = "on"; - }; - - led@7 { - reg = <7>; - active-low; - label = "red:inet"; - }; - - led@8 { - reg = <8>; - active-low; - function = LED_FUNCTION_POWER; - color = ; - }; - - led@9 { - reg = <9>; - active-low; - function = LED_FUNCTION_WPS; - color = ; - }; - - led@10 { - reg = <10>; - active-low; - function = LED_FUNCTION_USB; - color = ; - }; - - led@11 { - reg = <11>; - active-low; - label = "green:dsl"; - }; -}; - -&pinctrl { - pinctrl_leds: leds { - function = "led"; - pins = "gpio1", "gpio4", "gpio7", - "gpio8", "gpio9", "gpio10", - "gpio11"; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6328-innacomm-w3400v6.dts b/target/linux/bcm63xx/dts/bcm6328-innacomm-w3400v6.dts deleted file mode 100644 index afedfe24508b26..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6328-innacomm-w3400v6.dts +++ /dev/null @@ -1,122 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "bcm6328.dtsi" - -#include -#include - -/ { - model = "Innacomm W3400V6"; - compatible = "innacomm,w3400v6", "brcm,bcm6328"; - - aliases { - led-boot = &led_power_green; - led-failsafe = &led_power_red; - led-running = &led_power_green; - led-upgrade = &led_power_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - wps { - label = "wps"; - gpios = <&pinctrl 15 1>; - linux,code = ; - debounce-interval = <60>; - }; - - reset { - label = "reset"; - gpios = <&pinctrl 23 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; -}; - -&hsspi { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - spi-max-frequency = <16666667>; - spi-tx-bus-width = <2>; - spi-rx-bus-width = <2>; - reg = <0>; - - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "brcm,bcm963xx-cfe-nor-partitions"; - }; - }; -}; - -&leds { - status = "okay"; - - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_leds>; - - led@1 { - reg = <1>; - active-low; - label = "green:inet"; - }; - - led@2 { - reg = <2>; - active-low; - label = "red:inet"; - }; - - led@3 { - reg = <3>; - active-low; - label = "green:dsl"; - }; - - led_power_green: led@4 { - reg = <4>; - active-low; - function = LED_FUNCTION_POWER; - color = ; - default-state = "on"; - }; - - led_power_red: led@5 { - reg = <5>; - active-low; - function = LED_FUNCTION_POWER; - color = ; - }; - - led@11 { - reg = <11>; - active-low; - function = LED_FUNCTION_WPS; - color = ; - }; -}; - -&pinctrl { - pinctrl_leds: leds { - function = "led"; - pins = "gpio1", "gpio2", "gpio3", - "gpio4", "gpio5", "gpio11"; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6328-nucom-r5010un-v2.dts b/target/linux/bcm63xx/dts/bcm6328-nucom-r5010un-v2.dts deleted file mode 100644 index e71e1436b52d45..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6328-nucom-r5010un-v2.dts +++ /dev/null @@ -1,121 +0,0 @@ -#include "bcm6328.dtsi" - -#include -#include - -/ { - model = "NuCom R5010UN v2"; - compatible = "nucom,r5010un-v2", "brcm,bcm6328"; - - aliases { - led-boot = &led_power_green; - led-failsafe = &led_power_green; - led-running = &led_power_green; - led-upgrade = &led_power_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 23 1>; - linux,code = ; - debounce-interval = <60>; - }; - - wps { - label = "wps"; - gpios = <&pinctrl 24 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - inet_green { - label = "green:inet"; - gpios = <&pinctrl 1 1>; - }; - inet_fail_red { - label = "red:inet-fail"; - gpios = <&pinctrl 2 1>; - }; - dsl_red { - label = "green:dsl"; - gpios = <&pinctrl 3 1>; - }; - led_power_green: power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 4 1>; - default-state = "on"; - }; - power_fail_red { - label = "red:power-fail"; - gpios = <&pinctrl 5 1>; - }; - wps_green { - function = LED_FUNCTION_WPS; - color = ; - gpios = <&pinctrl 10 1>; - }; - usb_green { - function = LED_FUNCTION_USB; - color = ; - gpios = <&pinctrl 11 1>; - }; - }; -}; - -&hsspi { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - spi-max-frequency = <16666667>; - spi-tx-bus-width = <2>; - spi-rx-bus-width = <2>; - reg = <0>; - - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - reg = <0x000000 0x010000>; - label = "cfe"; - read-only; - }; - - partition@10000 { - reg = <0x010000 0xfe0000>; - label = "linux"; - compatible = "brcm,bcm963xx-imagetag"; - }; - - partition@ff0000 { - reg = <0xff0000 0x010000>; - label = "nvram"; - }; - }; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6328-sagem-fast-2704-v2.dts b/target/linux/bcm63xx/dts/bcm6328-sagem-fast-2704-v2.dts deleted file mode 100644 index 06f314ca79da7a..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6328-sagem-fast-2704-v2.dts +++ /dev/null @@ -1,129 +0,0 @@ -#include "bcm6328.dtsi" - -#include -#include - -/ { - model = "Sagem F@st 2704 V2"; - compatible = "sagem,fast-2704-v2", "brcm,bcm6328"; - - aliases { - led-boot = &led_power_green; - led-failsafe = &led_power_green; - led-running = &led_power_green; - led-upgrade = &led_power_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - rfkill { - label = "rfkill"; - gpios = <&pinctrl 15 1>; - linux,code = ; - debounce-interval = <60>; - }; - - reset { - label = "reset"; - gpios = <&pinctrl 23 1>; - linux,code = ; - debounce-interval = <60>; - }; - - wps { - label = "wps"; - gpios = <&pinctrl 24 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - usb_green { - function = LED_FUNCTION_USB; - color = ; - gpios = <&pinctrl 1 1>; - }; - inet_red { - label = "red:inet"; - gpios = <&pinctrl 2 1>; - }; - dsl_green { - label = "green:dsl"; - gpios = <&pinctrl 3 1>; - }; - led_power_green: power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 4 1>; - default-state = "on"; - }; - power_red { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 5 1>; - }; - wps_green { - function = LED_FUNCTION_WPS; - color = ; - gpios = <&pinctrl 10 1>; - }; - inet_green { - label = "green:inet"; - gpios = <&pinctrl 11 1>; - }; - }; -}; - -&hsspi { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - spi-max-frequency = <16666667>; - spi-tx-bus-width = <2>; - spi-rx-bus-width = <2>; - reg = <0>; - - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - reg = <0x000000 0x010000>; - label = "cfe"; - read-only; - }; - - linux@10000 { - reg = <0x010000 0x7e0000>; - label = "linux"; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@7f0000 { - reg = <0x7f0000 0x010000>; - label = "nvram"; - }; - }; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6328-sercomm-ad1018-nor.dts b/target/linux/bcm63xx/dts/bcm6328-sercomm-ad1018-nor.dts deleted file mode 100644 index 1dda9d64f349d2..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6328-sercomm-ad1018-nor.dts +++ /dev/null @@ -1,179 +0,0 @@ -#include "bcm6328.dtsi" - -#include -#include - -/ { - model = "Sercomm AD1018 (SPI flash mod)"; - compatible = "sercomm,ad1018-nor", "brcm,bcm6328"; - - aliases { - led-boot = &led_power_green; - led-failsafe = &led_power_green; - led-running = &led_power_green; - led-upgrade = &led_power_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - wps { - label = "wps"; - gpios = <&pinctrl 24 1>; - linux,code = ; - debounce-interval = <60>; - }; - - wifi { - label = "wifi"; - gpios = <&pinctrl 25 1>; - linux,code = ; - debounce-interval = <60>; - }; - - reset { - label = "reset"; - gpios = <&pinctrl 31 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; -}; - -&pinctrl { - pinctrl_leds: leds { - function = "led"; - pins = "gpio0", "gpio1"; - }; -}; - -&leds { - status = "okay"; - - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_leds &pinctrl_serial_led - &pinctrl_ephy0_spd_led &pinctrl_ephy1_act_led - &pinctrl_ephy2_act_led &pinctrl_ephy3_act_led>; - - brcm,serial-leds; - brcm,serial-shift-inv; - brcm,serial-dat-low; - - inet_red@0 { - reg = <0>; - active-low; - label = "red:internet"; - }; - - inet_green@1 { - reg = <1>; - active-low; - label = "green:internet"; - }; - - led_power_green: power_green@8 { - reg = <8>; - active-low; - function = LED_FUNCTION_POWER; - color = ; - default-state = "on"; - }; - - adsl_green@10 { - reg = <10>; - active-low; - label = "green:adsl"; - }; - - adsl_red@11 { - reg = <11>; - active-low; - label = "red:adsl"; - }; - - phone_green@12 { - reg = <12>; - active-low; - label = "green:phone"; - }; - - wps_green@13 { - reg = <13>; - active-low; - function = LED_FUNCTION_WPS; - color = ; - }; - - wifi_green@14 { - reg = <14>; - active-low; - label = "green:wifi"; - }; - - usb_green@15 { - reg = <15>; - active-low; - function = LED_FUNCTION_USB; - color = ; - }; - - ephy0_spd@17 { - reg = <17>; - brcm,hardware-controlled; - }; -}; - -&hsspi { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - spi-max-frequency = <16666667>; - spi-tx-bus-width = <2>; - spi-rx-bus-width = <2>; - reg = <0>; - - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "brcm,bcm963xx-cfe-nor-partitions"; - }; - }; -}; - -&nflash { - status = "okay"; - - nandcs@0 { - compatible = "brcm,nandcs"; - reg = <0>; - nand-ecc-step-size = <512>; - nand-ecc-strength = <15>; - nand-on-flash-bbt; - brcm,nand-oob-sector-size = <64>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "storage"; - reg = <0 0>; /* autodetected size */ - }; - }; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6328-sercomm-ad1018.dts b/target/linux/bcm63xx/dts/bcm6328-sercomm-ad1018.dts deleted file mode 100644 index edd1d8c348a66f..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6328-sercomm-ad1018.dts +++ /dev/null @@ -1,224 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "bcm6328.dtsi" - -#include -#include - -/ { - model = "Sercomm AD1018"; - compatible = "sercomm,ad1018", "brcm,bcm6328"; - - aliases { - led-boot = &led_power_green; - led-failsafe = &led_power_green; - led-running = &led_power_green; - led-upgrade = &led_power_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - wps { - label = "wps"; - gpios = <&pinctrl 24 1>; - linux,code = ; - debounce-interval = <60>; - }; - - wifi { - label = "wifi"; - gpios = <&pinctrl 25 1>; - linux,code = ; - debounce-interval = <60>; - }; - - reset { - label = "reset"; - gpios = <&pinctrl 31 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; -}; - -&leds { - status = "okay"; - - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_leds &pinctrl_serial_led - &pinctrl_ephy0_spd_led &pinctrl_ephy1_act_led - &pinctrl_ephy2_act_led &pinctrl_ephy3_act_led>; - - brcm,serial-leds; - brcm,serial-shift-inv; - brcm,serial-dat-low; - - led@0 { - reg = <0>; - active-low; - label = "red:internet"; - }; - - led@1 { - reg = <1>; - active-low; - label = "green:internet"; - }; - - led_power_green: led@8 { - reg = <8>; - active-low; - function = LED_FUNCTION_POWER; - color = ; - default-state = "on"; - }; - - led@10 { - reg = <10>; - active-low; - label = "green:adsl"; - }; - - led@11 { - reg = <11>; - active-low; - label = "red:adsl"; - }; - - led@12 { - reg = <12>; - active-low; - label = "green:phone"; - }; - - led@13 { - reg = <13>; - active-low; - function = LED_FUNCTION_WPS; - color = ; - }; - - led@14 { - reg = <14>; - active-low; - label = "green:wifi"; - }; - - led@15 { - reg = <15>; - active-low; - function = LED_FUNCTION_USB; - color = ; - }; - - led@17 { - /* EPHY0 Spd */ - reg = <17>; - brcm,hardware-controlled; - }; -}; - -&nflash { - status = "okay"; - - nandcs@0 { - compatible = "brcm,nandcs"; - #size-cells = <1>; - #address-cells = <1>; - reg = <0>; - nand-ecc-step-size = <512>; - nand-ecc-strength = <15>; - nand-on-flash-bbt; - brcm,nand-oob-sector-size = <64>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "cferom"; - reg = <0x0000000 0x0020000>; - read-only; - }; - - partition@20000 { - label = "mmap"; - reg = <0x0020000 0x00a0000>; - read-only; - }; - - partition@c0000 { - label = "cferam1"; - reg = <0x00c0000 0x0140000>; - read-only; - }; - - partition@200000 { - label = "cferam2"; - reg = <0x0200000 0x0140000>; - read-only; - }; - - partition@340000 { - label = "serial"; - reg = <0x0340000 0x00a0000>; - read-only; - }; - - partition@3e0000 { - label = "protect"; - reg = <0x03e0000 0x0140000>; - read-only; - }; - - partition@6920000 { - label = "bootflag1"; - reg = <0x6920000 0x0140000>; - }; - - partition@6a60000 { - label = "bootflag2"; - reg = <0x6a60000 0x0140000>; - }; - - partition@520000 { - compatible = "sercomm,wfi"; - label = "wfi"; - reg = <0x0520000 0x6400000>; - }; - - partition@6ba0000 { - label = "xml_cfg"; - reg = <0x6ba0000 0x0280000>; - read-only; - }; - - partition@6e20000 { - label = "app_dat"; - reg = <0x6e20000 0x0280000>; - read-only; - }; - }; - }; -}; - -&pinctrl { - pinctrl_leds: leds { - function = "led"; - pins = "gpio0", "gpio1"; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6328-technicolor-tg582n-telecom-italia.dts b/target/linux/bcm63xx/dts/bcm6328-technicolor-tg582n-telecom-italia.dts deleted file mode 100644 index d88855f7a5a48d..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6328-technicolor-tg582n-telecom-italia.dts +++ /dev/null @@ -1,156 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT - -#include "bcm6328.dtsi" - -#include -#include - -/ { - model = "Technicolor TG582n Telecom Italia"; - compatible = "technicolor,tg582n-telecom-italia", "brcm,bcm6328"; - - aliases { - led-boot = &led_power_green; - led-failsafe = &led_power_green; - led-running = &led_power_green; - led-upgrade = &led_power_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 23 1>; - linux,code = ; - debounce-interval = <60>; - }; - - wps { - label = "wps"; - gpios = <&pinctrl 24 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; -}; - -&leds { - status = "okay"; - - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_leds>; - - led@1 { - reg = <1>; - active-low; - label = "green:wifi"; - }; - - led_power_green: led@4 { - reg = <4>; - active-low; - function = LED_FUNCTION_POWER; - color = ; - default-state = "on"; - }; - - led@5 { - reg = <5>; - active-low; - label = "green:adsl"; - }; - - led@7 { - reg = <7>; - active-low; - label = "red:wifi"; - }; - - led@8 { - reg = <8>; - active-low; - function = LED_FUNCTION_POWER; - color = ; - }; - - led@11 { - reg = <11>; - active-low; - label = "green:internet"; - }; - - led@14 { - reg = <14>; - active-low; - label = "red:internet"; - }; - - led@18 { - reg = <18>; - active-low; - label = "red:service"; - }; - - led@19 { - reg = <19>; - active-low; - label = "green:service"; - }; -}; - -&hsspi { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - spi-max-frequency = <16666667>; - spi-tx-bus-width = <2>; - spi-rx-bus-width = <2>; - reg = <0>; - - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - reg = <0x000000 0x010000>; - label = "cfe"; - read-only; - }; - - partition@10000 { - reg = <0x010000 0xff0000>; - label = "linux"; - compatible = "brcm,bcm963xx-imagetag"; - }; - }; - }; -}; - -&pinctrl { - pinctrl_leds: leds { - function = "led"; - pins = "gpio1", "gpio4", - "gpio5", "gpio7", - "gpio8", "gpio11", - "gpio14", "gpio18", - "gpio19"; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6328-technicolor-tg582n.dts b/target/linux/bcm63xx/dts/bcm6328-technicolor-tg582n.dts deleted file mode 100644 index 0bd7b72b3c775f..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6328-technicolor-tg582n.dts +++ /dev/null @@ -1,171 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT - -#include "bcm6328.dtsi" - -#include -#include - -/ { - model = "Technicolor TG582n"; - compatible = "technicolor,tg582n", "brcm,bcm6328"; - - aliases { - led-boot = &led_power_green; - led-failsafe = &led_power_green; - led-running = &led_power_green; - led-upgrade = &led_power_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - wifi { - label = "wifi"; - gpios = <&pinctrl 15 1>; - linux,code = ; - debounce-interval = <60>; - }; - - reset { - label = "reset"; - gpios = <&pinctrl 23 1>; - linux,code = ; - debounce-interval = <60>; - }; - - wps { - label = "wps"; - gpios = <&pinctrl 24 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; -}; - -&leds { - status = "okay"; - - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_leds>; - - led@1 { - reg = <1>; - active-low; - label = "green:internet"; - }; - - led@2 { - reg = <2>; - active-low; - label = "red:wifi"; - }; - - led@3 { - reg = <3>; - active-low; - label = "green:wifi"; - }; - - led_power_green: led@4 { - reg = <4>; - active-low; - function = LED_FUNCTION_POWER; - color = ; - default-state = "on"; - }; - - led@5 { - reg = <5>; - active-low; - label = "green:ethernet"; - }; - - led@7 { - reg = <7>; - active-low; - label = "red:internet"; - }; - - led@8 { - reg = <8>; - active-low; - function = LED_FUNCTION_POWER; - color = ; - }; - - led@9 { - reg = <9>; - active-low; - function = LED_FUNCTION_WPS; - color = ; - }; - - led@10 { - reg = <10>; - active-low; - function = LED_FUNCTION_WPS; - color = ; - }; - - led@11 { - reg = <11>; - active-low; - label = "green:broadband"; - }; -}; - -&hsspi { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - spi-max-frequency = <16666667>; - spi-tx-bus-width = <2>; - spi-rx-bus-width = <2>; - reg = <0>; - - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - reg = <0x000000 0x010000>; - label = "cfe"; - read-only; - }; - - partition@10000 { - reg = <0x010000 0xff0000>; - label = "linux"; - compatible = "brcm,bcm963xx-imagetag"; - }; - }; - }; -}; - -&pinctrl { - pinctrl_leds: leds { - function = "led"; - pins = "gpio1", "gpio2", - "gpio3", "gpio4", - "gpio5", "gpio7", - "gpio8", "gpio9", - "gpio10", "gpio11"; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6328.dtsi b/target/linux/bcm63xx/dts/bcm6328.dtsi deleted file mode 100644 index 9b7e078c6d3521..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6328.dtsi +++ /dev/null @@ -1,221 +0,0 @@ -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - compatible = "brcm,bcm6328"; - - aliases { - nflash = &nflash; - pinctrl = &pinctrl; - serial0 = &uart0; - serial1 = &uart1; - spi1 = &hsspi; - }; - - cpus { - #address-cells = <1>; - #size-cells = <0>; - - cpu@0 { - compatible = "brcm,bmips4350", "mips,mips4Kc"; - device_type = "cpu"; - reg = <0>; - }; - }; - - cpu_intc: interrupt-controller { - #address-cells = <0>; - compatible = "mti,cpu-interrupt-controller"; - - interrupt-controller; - #interrupt-cells = <1>; - }; - - memory { device_type = "memory"; reg = <0 0>; }; - - ubus@10000000 { - #address-cells = <1>; - #size-cells = <1>; - ranges; - compatible = "simple-bus"; - interrupt-parent = <&periph_intc>; - - ext_intc: interrupt-controller@10000018 { - compatible = "brcm,bcm6345-ext-intc"; - reg = <0x10000018 0x4>; - - interrupt-controller; - #interrupt-cells = <2>; - - interrupts = <24>, <25>, <26>, <27>; - }; - - periph_intc: interrupt-controller@10000020 { - compatible = "brcm,bcm6345-l1-intc"; - reg = <0x10000020 0x10>; - - interrupt-controller; - #interrupt-cells = <1>; - - interrupt-parent = <&cpu_intc>; - interrupts = <2>; - }; - - pinctrl: pin-controller@10000080 { - compatible = "brcm,bcm6328-pinctrl"; - reg = <0x10000080 0x8>, - <0x10000088 0x8>, - <0x10000098 0x4>, - <0x1000009c 0xc>; - reg-names = "dirout", "dat", "mode", "mux"; - - gpio-controller; - #gpio-cells = <2>; - - interrupt-parent = <&ext_intc>; - interrupts = <3 0>, <2 0>, <0 0>, <1 0>; - interrupt-names = "gpio12", "gpio15", - "gpio23", "gpio24"; - - pinctrl_serial_led: serial_led { - pinctrl_serial_led_data: serial_led_data { - function = "serial_led_data"; - pins = "gpio6"; - }; - - pinctrl_serial_led_clk: serial_led_clk { - function = "serial_led_clk"; - pins = "gpio7"; - }; - }; - - pinctrl_inet_act_led: inet_act_led { - function = "inet_act_led"; - pins = "gpio11"; - }; - - pinctrl_pcie_clkreq: pcie_clkreq { - function = "pcie_clkreq"; - pins = "gpio16"; - }; - - pinctrl_ephy0_spd_led: ephy0_spd_led { - function = "led"; - pins = "gpio17"; - }; - - pinctrl_ephy1_spd_led: ephy1_spd_led { - function = "led"; - pins = "gpio18"; - }; - - pinctrl_ephy2_spd_led: ephy2_spd_led { - function = "led"; - pins = "gpio19"; - }; - - pinctrl_ephy3_spd_led: ephy3_spd_led { - function = "led"; - pins = "gpio20"; - }; - - pinctrl_ephy0_act_led: ephy0_act_led { - function = "ephy0_act_led"; - pins = "gpio25"; - }; - - pinctrl_ephy1_act_led: ephy1_act_led { - function = "ephy1_act_led"; - pins = "gpio26"; - }; - - pinctrl_ephy2_act_led: ephy2_act_led { - function = "ephy2_act_led"; - pins = "gpio27"; - }; - - pinctrl_ephy3_act_led: ephy3_act_led { - function = "ephy3_act_led"; - pins = "gpio28"; - }; - - pinctrl_hsspi_cs1: hsspi_cs1 { - function = "hsspi_cs1"; - pins = "hsspi_cs1"; - }; - - pinctrl_usb_port1_device: usb_port1_device { - function = "usb_device_port"; - pins = "usb_port1"; - }; - - pinctrl_usb_port1_host: usb_port1_host { - function = "usb_host_port"; - pins = "usb_port1"; - }; - }; - - uart0: serial@10000100 { - compatible = "brcm,bcm6345-uart"; - reg = <0x10000100 0x18>; - - interrupt-parent = <&periph_intc>; - interrupts = <28>; - - /* clocks = <&periph_clk>; */ - /* clock-names = "refclk"; */ - - status = "disabled"; - }; - - uart1: serial@10000120 { - compatible = "brcm,bcm6345-uart"; - reg = <0x10000120 0x18>; - - interrupt-parent = <&periph_intc>; - interrupts = <39>; - - /* clocks = <&periph_clk>; */ - /* clock-names = "refclk"; */ - - status = "disabled"; - }; - - nflash: nand@10000200 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "brcm,nand-bcm6368", - "brcm,brcmnand-v2.2", - "brcm,brcmnand"; - reg = <0x10000200 0x180>, - <0x10000400 0x200>, - <0x10000070 0x10>; - reg-names = "nand", - "nand-cache", - "nand-int-base"; - - interrupt-parent = <&periph_intc>; - interrupts = <0>; - - status = "disabled"; - }; - - leds: led-controller@10000800 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "brcm,bcm6328-leds"; - reg = <0x10000800 0x24>; - status = "disabled"; - }; - - hsspi: spi@10001000 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "brcm,bcm6328-hsspi"; - reg = <0x10001000 0x600>; - interrupts = <29>; - /* clocks = <&clkctl 9>; */ - }; - }; -}; diff --git a/target/linux/bcm63xx/dts/bcm6338-brcm-bcm96338gw.dts b/target/linux/bcm63xx/dts/bcm6338-brcm-bcm96338gw.dts deleted file mode 100644 index 882e376d5bae49..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6338-brcm-bcm96338gw.dts +++ /dev/null @@ -1,53 +0,0 @@ -#include "bcm6338.dtsi" - -#include -#include - -/ { - model = "Broadcom BCM96338GW reference board"; - compatible = "brcm,bcm96338gw", "brcm,bcm6338"; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - leds { - compatible = "gpio-leds"; - - power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&gpio0 0 1>; - default-state = "on"; - }; - stop_green { - label = "green:stop"; - gpios = <&gpio0 1 1>; - }; - dsl_green { - label = "green:adsl"; - gpios = <&gpio0 3 1>; - }; - ppp_fail_green { - label = "green:ppp-fail"; - gpios = <&gpio0 4 1>; - }; - ses_green { - label = "green:ses"; - gpios = <&gpio0 5 1>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "brcm,bcm963xx-cfe-nor-partitions"; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6338-brcm-bcm96338w.dts b/target/linux/bcm63xx/dts/bcm6338-brcm-bcm96338w.dts deleted file mode 100644 index 4165ddc3254718..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6338-brcm-bcm96338w.dts +++ /dev/null @@ -1,53 +0,0 @@ -#include "bcm6338.dtsi" - -#include -#include - -/ { - model = "Broadcom BCM96338W reference board"; - compatible = "brcm,bcm96338w", "brcm,bcm6338"; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - leds { - compatible = "gpio-leds"; - - power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&gpio0 0 1>; - default-state = "on"; - }; - stop_green { - label = "green:stop"; - gpios = <&gpio0 1 1>; - }; - dsl_green { - label = "green:adsl"; - gpios = <&gpio0 3 1>; - }; - ppp_fail_green { - label = "green:ppp-fail"; - gpios = <&gpio0 4 1>; - }; - ses_green { - label = "green:ses"; - gpios = <&gpio0 5 1>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "brcm,bcm963xx-cfe-nor-partitions"; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6338-d-link-dsl-2640u.dts b/target/linux/bcm63xx/dts/bcm6338-d-link-dsl-2640u.dts deleted file mode 100644 index c463eaa4fac4fd..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6338-d-link-dsl-2640u.dts +++ /dev/null @@ -1,66 +0,0 @@ -#include "bcm6338.dtsi" - -#include -#include - -/ { - model = "D-Link DSL-2640U/BRU/C"; - compatible = "d-link,dsl-2640u", "brcm,bcm6338"; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - leds { - compatible = "gpio-leds"; - - green_power { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&gpio0 0 1>; - default-state = "on"; - }; - - green_stop { - label = "green:ppp"; - gpios = <&gpio0 4 1>; - }; - - green_adsl { - label = "green:ppp-fail"; - gpios = <&gpio0 5 1>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x010000>; - read-only; - }; - - linux@10000 { - label = "linux"; - reg = <0x010000 0x3e0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@3f0000 { - label = "nvram"; - reg = <0x3f0000 0x010000>; - }; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6338-dynalink-rta1320.dts b/target/linux/bcm63xx/dts/bcm6338-dynalink-rta1320.dts deleted file mode 100644 index 7148727b1deab7..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6338-dynalink-rta1320.dts +++ /dev/null @@ -1,68 +0,0 @@ -#include "bcm6338.dtsi" - -#include -#include - -/ { - model = "Dynalink RTA1320"; - compatible = "dynalink,rta1320", "brcm,bcm6338"; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - leds { - compatible = "gpio-leds"; - - green_power { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&gpio0 0 1>; - default-state = "on"; - }; - green_stop { - label = "green:stop"; - gpios = <&gpio0 1 1>; - }; - green_adsl { - label = "green:adsl"; - gpios = <&gpio0 3 1>; - }; - green_ppp { - label = "green:ppp"; - gpios = <&gpio0 4 1>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x010000>; - read-only; - }; - - linux@10000 { - label = "linux"; - reg = <0x010000 0x3e0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@3f0000 { - label = "nvram"; - reg = <0x3f0000 0x010000>; - }; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6338.dtsi b/target/linux/bcm63xx/dts/bcm6338.dtsi deleted file mode 100644 index fc8b2dfe51c30b..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6338.dtsi +++ /dev/null @@ -1,107 +0,0 @@ -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - compatible = "brcm,bcm6338"; - - aliases { - pflash = &pflash; - gpio0 = &gpio0; - serial0 = &uart0; - spi0 = &lsspi; - }; - - cpus { - #address-cells = <1>; - #size-cells = <0>; - - cpu@0 { - compatible = "brcm,bmips3300", "mips,mips4Kc"; - device_type = "cpu"; - reg = <0>; - }; - }; - - cpu_intc: interrupt-controller { - #address-cells = <0>; - compatible = "mti,cpu-interrupt-controller"; - - interrupt-controller; - #interrupt-cells = <1>; - }; - - memory { device_type = "memory"; reg = <0 0>; }; - - pflash: nor@1fc00000 { - compatible = "cfi-flash"; - reg = <0x1fc00000 0x400000>; - bank-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - - status = "disabled"; - }; - - ubus@fff00000 { - #address-cells = <1>; - #size-cells = <1>; - ranges; - compatible = "simple-bus"; - interrupt-parent = <&periph_intc>; - - periph_intc: interrupt-controller@fffe000c { - compatible = "brcm,bcm6345-l1-intc"; - reg = <0xfffe000c 0x8>; - - interrupt-controller; - #interrupt-cells = <1>; - - interrupt-parent = <&cpu_intc>; - interrupts = <2>; - }; - - ext_intc: interrupt-controller@fffe0014 { - compatible = "brcm,bcm6345-ext-intc"; - reg = <0xfffe0014 0x4>; - - interrupt-controller; - #interrupt-cells = <2>; - - interrupt-parent = <&cpu_intc>; - interrupts = <3>, <4>, <5>, <6>; - }; - - gpio0: gpio-controller@fffe0404 { - compatible = "brcm,bcm6345-gpio"; - reg = <0xfffe0404 4>, <0xfffe040c 4>; - - gpio-controller; - #gpio-cells = <2>; - - ngpios = <8>; - }; - - uart0: serial@fffe0300 { - compatible = "brcm,bcm6345-uart"; - reg = <0xfffe0300 0x18>; - - interrupt-parent = <&periph_intc>; - interrupts = <2>; - - /* clocks = <&periph_clk>; */ - /* clock-names = "refclk"; */ - - status = "disabled"; - }; - - lsspi: spi@fffe0c00 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "brcm,bcm6348-spi"; - reg = <0xfffe0c00 0x40>; - interrupts = <1>; - /* clocks = <&clkctl 9>; */ - }; - }; -}; diff --git a/target/linux/bcm63xx/dts/bcm6345-brcm-bcm96345gw2.dts b/target/linux/bcm63xx/dts/bcm6345-brcm-bcm96345gw2.dts deleted file mode 100644 index 515771904ea172..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6345-brcm-bcm96345gw2.dts +++ /dev/null @@ -1,25 +0,0 @@ -#include "bcm6345.dtsi" - -#include - -/ { - model = "Broadcom BCM96345GW2 reference board"; - compatible = "brcm,bcm96345gw2", "brcm,bcm6345"; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "brcm,bcm963xx-cfe-nor-partitions"; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6345-dynalink-rta770bw.dts b/target/linux/bcm63xx/dts/bcm6345-dynalink-rta770bw.dts deleted file mode 100644 index 0e4b91333e8767..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6345-dynalink-rta770bw.dts +++ /dev/null @@ -1,92 +0,0 @@ -#include "bcm6345.dtsi" - -#include -#include - -/ { - model = "Siemens Gigaset SE515"; - compatible = "dynalink,rta770bw", "brcm,bcm6345"; - - aliases { - led-boot = &led_diag; - led-failsafe = &led_diag; - led-running = &led_diag; - led-upgrade = &led_diag; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&gpio0 13 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - usb { - function = LED_FUNCTION_USB; - color = ; - gpios = <&gpio0 7 1>; - }; - - adsl { - label = "green:adsl"; - gpios = <&gpio0 8 0>; - }; - - led_diag: diag { - label = "green:diag"; - gpios = <&gpio0 10 1>; - }; - - wlan { - function = LED_FUNCTION_WLAN; - color = ; - gpios = <&gpio0 11 1>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x010000>; - read-only; - }; - - linux@10000 { - label = "linux"; - reg = <0x010000 0x3e0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@3f0000 { - label = "nvram"; - reg = <0x3f0000 0x010000>; - }; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6345-dynalink-rta770w.dts b/target/linux/bcm63xx/dts/bcm6345-dynalink-rta770w.dts deleted file mode 100644 index 4ca9f51aa758ab..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6345-dynalink-rta770w.dts +++ /dev/null @@ -1,92 +0,0 @@ -#include "bcm6345.dtsi" - -#include -#include - -/ { - model = "Dynalink RTA770W"; - compatible = "dynalink,rta770w", "brcm,bcm6345"; - - aliases { - led-boot = &led_diag; - led-failsafe = &led_diag; - led-running = &led_diag; - led-upgrade = &led_diag; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&gpio0 13 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - usb { - function = LED_FUNCTION_USB; - color = ; - gpios = <&gpio0 7 1>; - }; - - adsl { - label = "green:adsl"; - gpios = <&gpio0 8 0>; - }; - - led_diag: diag { - label = "green:diag"; - gpios = <&gpio0 10 1>; - }; - - wlan { - function = LED_FUNCTION_WLAN; - color = ; - gpios = <&gpio0 11 1>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x010000>; - read-only; - }; - - linux@10000 { - label = "linux"; - reg = <0x010000 0x3e0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@3f0000 { - label = "nvram"; - reg = <0x3f0000 0x010000>; - }; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6345.dtsi b/target/linux/bcm63xx/dts/bcm6345.dtsi deleted file mode 100644 index 095af836373f69..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6345.dtsi +++ /dev/null @@ -1,96 +0,0 @@ -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - compatible = "brcm,bcm6345"; - - aliases { - pflash = &pflash; - serial0 = &uart0; - gpio0 = &gpio0; - }; - - cpus { - #address-cells = <1>; - #size-cells = <0>; - - cpu@0 { - compatible = "brcm,bmips32", "mips,mips4Kc"; - device_type = "cpu"; - reg = <0>; - }; - }; - - cpu_intc: interrupt-controller { - #address-cells = <0>; - compatible = "mti,cpu-interrupt-controller"; - - interrupt-controller; - #interrupt-cells = <1>; - }; - - memory { device_type = "memory"; reg = <0 0>; }; - - pflash: nor@1fc00000 { - compatible = "cfi-flash"; - reg = <0x1fc00000 0x400000>; - bank-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - - status = "disabled"; - }; - - ubus@fff00000 { - #address-cells = <1>; - #size-cells = <1>; - ranges; - compatible = "simple-bus"; - - periph_intc: interrupt-controller@fffe000c { - compatible = "brcm,bcm6345-l1-intc"; - reg = <0xfffe000c 0x9>; - - interrupt-controller; - #interrupt-cells = <1>; - - interrupt-parent = <&cpu_intc>; - interrupts = <2>; - }; - - ext_intc: interrupt-controller@fffe0014 { - compatible = "brcm,bcm6345-ext-intc"; - reg = <0xfffe0014 0x4>; - - interrupt-controller; - #interrupt-cells = <2>; - - interrupt-parent = <&cpu_intc>; - interrupts = <3>, <4>, <5>, <6>; - }; - - uart0: serial@fffe0300 { - compatible = "brcm,bcm6345-uart"; - reg = <0xfffe0300 0x18>; - - interrupt-parent = <&periph_intc>; - interrupts = <2>; - - /* clocks = <&periph_clk>; */ - /* clock-names = "refclk"; */ - - status = "disabled"; - }; - - gpio0: gpio-controller@fffe0404 { - compatible = "brcm,bcm6345-gpio"; - reg = <0xfffe0404 4>, <0xfffe0408 4>; - - gpio-controller; - #gpio-cells = <2>; - - ngpios = <16>; - }; - }; -}; diff --git a/target/linux/bcm63xx/dts/bcm6348-asmax-ar-1004g.dts b/target/linux/bcm63xx/dts/bcm6348-asmax-ar-1004g.dts deleted file mode 100644 index 43cdb2da92c112..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6348-asmax-ar-1004g.dts +++ /dev/null @@ -1,91 +0,0 @@ -#include "bcm6348.dtsi" - -#include -#include - -/ { - model = "ASMAX AR 1004g"; - compatible = "asmax,ar-1004g", "brcm,bcm6348"; - - aliases { - led-boot = &led_power_green; - led-failsafe = &led_power_green; - led-running = &led_power_green; - led-upgrade = &led_power_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 33 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - led_power_green: power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 0 1>; - default-state = "on"; - }; - inet_green { - label = "green:inet"; - gpios = <&pinctrl 3 1>; - }; - power_red { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 6 1>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x010000>; - read-only; - }; - - linux@10000 { - label = "linux"; - reg = <0x010000 0x3e0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@3f0000 { - label = "nvram"; - reg = <0x3f0000 0x010000>; - }; - }; -}; - -&pinctrl { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_ext_mii &pinctrl_pci>; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6348-belkin-f5d7633.dts b/target/linux/bcm63xx/dts/bcm6348-belkin-f5d7633.dts deleted file mode 100644 index 7686c3deb4994d..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6348-belkin-f5d7633.dts +++ /dev/null @@ -1,91 +0,0 @@ -#include "bcm6348.dtsi" - -#include -#include - -/ { - model = "Belkin F5D7633"; - compatible = "belkin,f5d7633", "brcm,bcm6348"; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 6 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 0 1>; - default-state = "on"; - }; - stop_green { - label = "green:stop"; - gpios = <&pinctrl 1 1>; - }; - adsl_fail_green { - label = "green:adsl-fail"; - gpios = <&pinctrl 2 1>; - }; - ppp_green { - label = "green:ppp"; - gpios = <&pinctrl 3 1>; - }; - ppp_fail_green { - label = "green:ppp-fail"; - gpios = <&pinctrl 4 1>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x020000>; - read-only; - }; - - linux@20000 { - label = "linux"; - reg = <0x020000 0x3c0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@3e0000 { - label = "nvram"; - reg = <0x3e0000 0x020000>; - }; - }; -}; - -&pinctrl { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_pci &pinctrl_ext_mii &pinctrl_mii_pccard>; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6348-brcm-bcm96348gw-10.dts b/target/linux/bcm63xx/dts/bcm6348-brcm-bcm96348gw-10.dts deleted file mode 100644 index d683ac1f09d6cf..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6348-brcm-bcm96348gw-10.dts +++ /dev/null @@ -1,72 +0,0 @@ -#include "bcm6348.dtsi" - -#include -#include - -/ { - model = "Broadcom BCM96348GW-10 reference board"; - compatible = "brcm,bcm96348gw-10", "brcm,bcm6348"; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 6 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 0 1>; - default-state = "on"; - }; - stop_green { - label = "green:stop"; - gpios = <&pinctrl 1 1>; - }; - adsl_fail_green { - label = "green:adsl-fail"; - gpios = <&pinctrl 2 1>; - }; - ppp_green { - label = "green:ppp"; - gpios = <&pinctrl 3 1>; - }; - ppp_fail_green { - label = "green:ppp-fail"; - gpios = <&pinctrl 4 1>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "brcm,bcm963xx-cfe-nor-partitions"; - }; -}; - -&pinctrl { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_pci &pinctrl_ext_mii &pinctrl_mii_pccard>; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6348-brcm-bcm96348gw-11.dts b/target/linux/bcm63xx/dts/bcm6348-brcm-bcm96348gw-11.dts deleted file mode 100644 index 09378dd5147f11..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6348-brcm-bcm96348gw-11.dts +++ /dev/null @@ -1,79 +0,0 @@ -#include "bcm6348.dtsi" - -#include -#include - -/ { - model = "Broadcom BCM96348GW-11 reference board"; - compatible = "brcm,bcm96348gw-11", "brcm,bcm6348"; - - aliases { - led-boot = &led_power_green; - led-failsafe = &led_power_green; - led-running = &led_power_green; - led-upgrade = &led_power_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 33 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - led_power_green: power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 0 1>; - default-state = "on"; - }; - stop_green { - label = "green:stop"; - gpios = <&pinctrl 1 1>; - }; - adsl_fail_green { - label = "green:adsl-fail"; - gpios = <&pinctrl 2 1>; - }; - ppp_green { - label = "green:ppp"; - gpios = <&pinctrl 3 1>; - }; - ppp_fail_green { - label = "green:ppp-fail"; - gpios = <&pinctrl 4 1>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "brcm,bcm963xx-cfe-nor-partitions"; - }; -}; - -&pinctrl { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_pci &pinctrl_ext_mii &pinctrl_mii_pccard>; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6348-brcm-bcm96348gw.dts b/target/linux/bcm63xx/dts/bcm6348-brcm-bcm96348gw.dts deleted file mode 100644 index ea1eded5688f4f..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6348-brcm-bcm96348gw.dts +++ /dev/null @@ -1,79 +0,0 @@ -#include "bcm6348.dtsi" - -#include -#include - -/ { - model = "Broadcom BCM96348GW reference board"; - compatible = "brcm,bcm96348gw", "brcm,bcm6348"; - - aliases { - led-boot = &led_power_green; - led-failsafe = &led_power_green; - led-running = &led_power_green; - led-upgrade = &led_power_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 36 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - led_power_green: power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 0 1>; - default-state = "on"; - }; - stop_green { - label = "green:stop"; - gpios = <&pinctrl 1 1>; - }; - adsl_fail_green { - label = "green:adsl-fail"; - gpios = <&pinctrl 2 1>; - }; - ppp_green { - label = "green:ppp"; - gpios = <&pinctrl 3 1>; - }; - ppp_fail_green { - label = "green:ppp-fail"; - gpios = <&pinctrl 4 1>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "brcm,bcm963xx-cfe-nor-partitions"; - }; -}; - -&pinctrl { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_pci &pinctrl_ext_mii>; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6348-brcm-bcm96348r.dts b/target/linux/bcm63xx/dts/bcm6348-brcm-bcm96348r.dts deleted file mode 100644 index ff678dc0563caf..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6348-brcm-bcm96348r.dts +++ /dev/null @@ -1,58 +0,0 @@ -#include "bcm6348.dtsi" - -#include -#include - -/ { - model = "Broadcom 96348R reference board"; - compatible = "brcm,bcm96348r", "brcm,bcm6348"; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - leds { - compatible = "gpio-leds"; - - power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 0 1>; - default-state = "on"; - }; - stop_green { - label = "green:stop"; - gpios = <&pinctrl 1 1>; - }; - adsl_fail_green { - label = "green:adsl-fail"; - gpios = <&pinctrl 2 1>; - }; - ppp_green { - label = "green:ppp"; - gpios = <&pinctrl 3 1>; - }; - ppp_fail_green { - label = "green:ppp-fail"; - gpios = <&pinctrl 4 1>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "brcm,bcm963xx-cfe-nor-partitions"; - }; -}; - -&pinctrl { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_pci>; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6348-bt-voyager-2110.dts b/target/linux/bcm63xx/dts/bcm6348-bt-voyager-2110.dts deleted file mode 100644 index d80ed9a943be9b..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6348-bt-voyager-2110.dts +++ /dev/null @@ -1,98 +0,0 @@ -#include "bcm6348.dtsi" - -#include -#include - -/ { - model = "BT Voyager 2110"; - compatible = "bt,voyager-2110", "brcm,bcm6348"; - - aliases { - led-boot = &led_power_green; - led-failsafe = &led_power_green; - led-running = &led_power_green; - led-upgrade = &led_power_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 33 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - led_power_green: power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 0 1>; - }; - power_red { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 1 1>; - }; - adsl_green { - label = "green:adsl"; - gpios = <&pinctrl 2 1>; - }; - ppp_green { - label = "green:ppp"; - gpios = <&pinctrl 3 1>; - }; - wireless_green { - label = "green:wireless"; - gpios = <&pinctrl 6 1>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x010000>; - read-only; - }; - - linux@10000 { - label = "linux"; - reg = <0x010000 0x3e0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@3f0000 { - label = "nvram"; - reg = <0x3f0000 0x010000>; - }; - }; -}; - -&pinctrl { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_pci &pinctrl_ext_mii>; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6348-bt-voyager-2500v-bb.dts b/target/linux/bcm63xx/dts/bcm6348-bt-voyager-2500v-bb.dts deleted file mode 100644 index bc8616ada1c483..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6348-bt-voyager-2500v-bb.dts +++ /dev/null @@ -1,91 +0,0 @@ -#include "bcm6348.dtsi" - -#include -#include - -/ { - model = "BT Voyager 2500V"; - compatible = "bt,voyager-2500v-bb", "brcm,bcm6348"; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 31 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 0 1>; - }; - power_red { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 1 1>; - }; - adsl_green { - label = "green:adsl"; - gpios = <&pinctrl 2 1>; - }; - ppp_green { - label = "green:ppp"; - gpios = <&pinctrl 3 1>; - }; - wireless_green { - label = "green:wireless"; - gpios = <&pinctrl 6 1>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x010000>; - read-only; - }; - - linux@10000 { - label = "linux"; - reg = <0x010000 0x3e0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@3f0000 { - label = "nvram"; - reg = <0x3f0000 0x010000>; - }; - }; -}; - -&pinctrl { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_pci &pinctrl_ext_mii>; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6348-comtrend-ct-5365.dts b/target/linux/bcm63xx/dts/bcm6348-comtrend-ct-5365.dts deleted file mode 100644 index 4eef3139b74951..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6348-comtrend-ct-5365.dts +++ /dev/null @@ -1,99 +0,0 @@ -#include "bcm6348.dtsi" - -#include -#include - -/ { - model = "Comtrend CT-5365"; - compatible = "comtrend,ct-5365", "brcm,bcm6348"; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 33 1>; - linux,code = ; - debounce-interval = <60>; - }; - - wlan { - label = "wlan"; - gpios = <&pinctrl 34 1>; - linux,code = ; - debounce-interval = <60>; - }; - - wps { - label = "wps"; - gpios = <&pinctrl 35 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 0 1>; - default-state = "on"; - }; - alarm_red { - function = LED_FUNCTION_ALARM; - color = ; - gpios = <&pinctrl 2 1>; - }; - wps_green { - function = LED_FUNCTION_WPS; - color = ; - gpios = <&pinctrl 6 1>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x010000>; - read-only; - }; - - linux@10000 { - label = "linux"; - reg = <0x010000 0x3e0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@3f0000 { - label = "nvram"; - reg = <0x3f0000 0x010000>; - }; - }; -}; - -&pinctrl { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_pci &pinctrl_ext_mii>; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6348-comtrend-ct-536plus.dts b/target/linux/bcm63xx/dts/bcm6348-comtrend-ct-536plus.dts deleted file mode 100644 index 2460ccb10c34a3..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6348-comtrend-ct-536plus.dts +++ /dev/null @@ -1,86 +0,0 @@ -#include "bcm6348.dtsi" - -#include -#include - -/ { - model = "Comtrend CT-536+/CT-5621T"; - compatible = "comtrend,ct-536plus", "brcm,bcm6348"; - - aliases { - led-boot = &led_power_green; - led-failsafe = &led_power_green; - led-running = &led_power_green; - led-upgrade = &led_power_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 33 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - led_power_green: power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 0 1>; - default-state = "on"; - }; - adsl_fail_green { - label = "green:adsl-fail"; - gpios = <&pinctrl 2 1>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x010000>; - read-only; - }; - - linux@10000 { - label = "linux"; - reg = <0x010000 0x3e0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@3f0000 { - label = "nvram"; - reg = <0x3f0000 0x010000>; - }; - }; -}; - -&pinctrl { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_pci &pinctrl_ext_mii &pinctrl_mii_pccard>; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6348-d-link-dsl-2640b-b.dts b/target/linux/bcm63xx/dts/bcm6348-d-link-dsl-2640b-b.dts deleted file mode 100644 index f50992b02b6a7a..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6348-d-link-dsl-2640b-b.dts +++ /dev/null @@ -1,94 +0,0 @@ -#include "bcm6348.dtsi" - -#include -#include - -/ { - model = "D-Link DSL-2640B rev B2"; - compatible = "d-link,dsl-2640b-b", "brcm,bcm6348"; - - aliases { - led-boot = &led_power_green; - led-failsafe = &led_power_green; - led-running = &led_power_green; - led-upgrade = &led_power_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 7 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - led_power_green: power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 0 1>; - default-state = "on"; - }; - status { - label = "status"; - gpios = <&pinctrl 3 1>; - }; - inet_green { - label = "green:internet"; - gpios = <&pinctrl 4 1>; - }; - inet_red { - label = "red:internet"; - gpios = <&pinctrl 5 1>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x010000>; - read-only; - }; - - linux@10000 { - label = "linux"; - reg = <0x010000 0x3e0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@3f0000 { - label = "nvram"; - reg = <0x3f0000 0x010000>; - }; - }; -}; - -&pinctrl { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_pci &pinctrl_ext_mii>; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6348-davolink-dv-201amr.dts b/target/linux/bcm63xx/dts/bcm6348-davolink-dv-201amr.dts deleted file mode 100644 index abb2cc0ec78a0a..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6348-davolink-dv-201amr.dts +++ /dev/null @@ -1,49 +0,0 @@ -#include "bcm6348.dtsi" - -#include - -/ { - model = "Davolink DV-201AMR"; - compatible = "davolink,dv-201amr", "brcm,bcm6348"; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - backup@0 { - label = "backup"; - reg = <0x000000 0x400000>; - }; - - cfe@400000 { - label = "cfe"; - reg = <0x400000 0x010000>; - read-only; - }; - - linux@410000 { - label = "linux"; - reg = <0x410000 0x3f0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - }; -}; - -&pinctrl { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_pci &pinctrl_ext_mii>; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6348-dynalink-rta1025w.dts b/target/linux/bcm63xx/dts/bcm6348-dynalink-rta1025w.dts deleted file mode 100644 index e107337ea10d20..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6348-dynalink-rta1025w.dts +++ /dev/null @@ -1,49 +0,0 @@ -#include "bcm6348.dtsi" - -#include - -/ { - model = "Dynalink RTA1025W"; - compatible = "dynalink,rta1025w", "brcm,bcm6348"; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x010000>; - read-only; - }; - - linux@10000 { - label = "linux"; - reg = <0x010000 0x3e0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@3f0000 { - label = "nvram"; - reg = <0x3f0000 0x010000>; - }; - }; -}; - -&pinctrl { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_pci &pinctrl_ext_mii>; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6348-inventel-livebox-1.dts b/target/linux/bcm63xx/dts/bcm6348-inventel-livebox-1.dts deleted file mode 100644 index 0b541c6081115a..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6348-inventel-livebox-1.dts +++ /dev/null @@ -1,89 +0,0 @@ -#include "bcm6348.dtsi" - -#include - -/ { - model = "Inventel Livebox 1"; - compatible = "inventel,livebox-1", "brcm,bcm6348"; - - aliases { - led-boot = &led_red_adsl_fail; - led-failsafe = &led_red_adsl_fail; - led-running = &led_red_adsl_fail; - led-upgrade = &led_red_adsl_fail; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - button1 { - label = "1"; - gpios = <&pinctrl 36 1>; - linux,code = ; - debounce-interval = <60>; - }; - - button2 { - label = "2"; - gpios = <&pinctrl 7 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - led_red_adsl_fail: red_adsl_fail { - label = "red:adsl-fail-power"; - gpios = <&pinctrl 0 0>; - default-state = "on"; - }; - - red_adsl { - label = "red:adsl"; - gpios = <&pinctrl 1 0>; - }; - - red_traffic { - label = "red:traffic"; - gpios = <&pinctrl 2 0>; - }; - - red_phone { - label = "red:phone"; - gpios = <&pinctrl 3 0>; - }; - - red_wifi { - label = "red:wifi"; - gpios = <&pinctrl 4 0>; - }; - }; -}; - -&pflash { - reg = <0x1e400000 0x800000>; - status = "okay"; - - partitions { - compatible = "redboot-fis"; - }; -}; - -&pinctrl { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_pci &pinctrl_ext_mii &pinctrl_mii_pccard>; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6348-netgear-dg834g-v4.dts b/target/linux/bcm63xx/dts/bcm6348-netgear-dg834g-v4.dts deleted file mode 100644 index 318f12b66ca2bd..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6348-netgear-dg834g-v4.dts +++ /dev/null @@ -1,88 +0,0 @@ -#include "bcm6348.dtsi" - -#include -#include - -/ { - model = "Netgear DG834G v4"; - compatible = "netgear,dg834g-v4", "brcm,bcm6348"; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 6 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 0 1>; - default-state = "on"; - }; - status { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 1 1>; - }; - inet_green { - label = "adsl"; - gpios = <&pinctrl 2 1>; - }; - inet_red { - label = "internet"; - gpios = <&pinctrl 3 1>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x010000>; - read-only; - }; - - linux@10000 { - label = "linux"; - reg = <0x010000 0x3e0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@3f0000 { - label = "nvram"; - reg = <0x3f0000 0x010000>; - }; - }; -}; - -&pinctrl { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_pci &pinctrl_ext_mii>; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6348-netgear-dg834gt-pn.dts b/target/linux/bcm63xx/dts/bcm6348-netgear-dg834gt-pn.dts deleted file mode 100644 index eb20d4b6c8af6a..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6348-netgear-dg834gt-pn.dts +++ /dev/null @@ -1,91 +0,0 @@ -#include "bcm6348.dtsi" - -#include -#include - -/ { - model = "Netgear DG834GT/PN"; - compatible = "netgear,dg834gt-pn", "brcm,bcm6348"; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 6 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 0 1>; - default-state = "on"; - }; - stop_green { - label = "green:stop"; - gpios = <&pinctrl 1 1>; - }; - adsl_fail_green { - label = "green:adsl-fail"; - gpios = <&pinctrl 2 1>; - }; - ppp_green { - label = "green:ppp"; - gpios = <&pinctrl 3 1>; - }; - ppp_fail_green { - label = "green:ppp-fail"; - gpios = <&pinctrl 4 1>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x010000>; - read-only; - }; - - linux@10000 { - label = "linux"; - reg = <0x010000 0x3e0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@3f0000 { - label = "nvram"; - reg = <0x3f0000 0x010000>; - }; - }; -}; - -&pinctrl { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_pci &pinctrl_ext_mii &pinctrl_mii_pccard>; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6348-sagem-fast-2404.dts b/target/linux/bcm63xx/dts/bcm6348-sagem-fast-2404.dts deleted file mode 100644 index 4abd185ca600fb..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6348-sagem-fast-2404.dts +++ /dev/null @@ -1,49 +0,0 @@ -#include "bcm6348.dtsi" - -#include - -/ { - model = "Sagem F@st 2404"; - compatible = "sagem,fast-2404", "brcm,bcm6348"; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x010000>; - read-only; - }; - - linux@10000 { - label = "linux"; - reg = <0x010000 0x3e0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@3f0000 { - label = "nvram"; - reg = <0x3f0000 0x010000>; - }; - }; -}; - -&pinctrl { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_pci &pinctrl_ext_mii &pinctrl_mii_pccard>; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6348-sagem-fast-2604.dts b/target/linux/bcm63xx/dts/bcm6348-sagem-fast-2604.dts deleted file mode 100644 index 4a1862b71f0040..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6348-sagem-fast-2604.dts +++ /dev/null @@ -1,89 +0,0 @@ -#include "bcm6348.dtsi" - -#include -#include - -/ { - model = "Sagem F@st 2604"; - compatible = "sagem,fast-2604", "brcm,bcm6348"; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 33 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 0 1>; - default-state = "on"; - }; - power_red { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 1 1>; - }; - inet_red { - label = "red:inet"; - gpios = <&pinctrl 4 1>; - }; - wps_green { - function = LED_FUNCTION_WPS; - color = ; - gpios = <&pinctrl 5 1>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x010000>; - read-only; - }; - - linux@10000 { - label = "linux"; - reg = <0x010000 0x3e0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@3f0000 { - label = "nvram"; - reg = <0x3f0000 0x010000>; - }; - }; -}; - -&pinctrl { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_pci &pinctrl_ext_mii>; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6348-t-com-speedport-w-500v.dts b/target/linux/bcm63xx/dts/bcm6348-t-com-speedport-w-500v.dts deleted file mode 100644 index 29cc3fa64438e9..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6348-t-com-speedport-w-500v.dts +++ /dev/null @@ -1,99 +0,0 @@ -#include "bcm6348.dtsi" - -#include -#include - -/ { - model = "T-Com Speedport W 500V"; - compatible = "t-com,speedport-w-500v", "brcm,bcm6348"; - - aliases { - led-boot = &led_power_green; - led-failsafe = &led_power_green; - led-running = &led_power_green; - led-upgrade = &led_power_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 33 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - led_power_green: power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 0 1>; - default-state = "on"; - }; - power_red { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 1 1>; - }; - ppp_green { - label = "green:ppp"; - gpios = <&pinctrl 3 1>; - }; - pstn_green { - label = "green:pstn"; - gpios = <&pinctrl 28 1>; - }; - voip_green { - label = "green:voip"; - gpios = <&pinctrl 32 1>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x010000>; - read-only; - }; - - linux@10000 { - label = "linux"; - reg = <0x010000 0x3e0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@3f0000 { - label = "nvram"; - reg = <0x3f0000 0x010000>; - }; - }; -}; - -&pinctrl { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_pci>; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6348-tecom-gw6000.dts b/target/linux/bcm63xx/dts/bcm6348-tecom-gw6000.dts deleted file mode 100644 index a34cd49a46244d..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6348-tecom-gw6000.dts +++ /dev/null @@ -1,63 +0,0 @@ -#include "bcm6348.dtsi" - -#include - -/ { - model = "TECOM GW6000"; - compatible = "tecom,gw6000", "brcm,bcm6348"; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 36 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x010000>; - read-only; - }; - - linux@10000 { - label = "linux"; - reg = <0x010000 0x3e0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@3f0000 { - label = "nvram"; - reg = <0x3f0000 0x010000>; - }; - }; -}; - -&pinctrl { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_pci &pinctrl_ext_mii>; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6348-tecom-gw6200.dts b/target/linux/bcm63xx/dts/bcm6348-tecom-gw6200.dts deleted file mode 100644 index 5773077b547ade..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6348-tecom-gw6200.dts +++ /dev/null @@ -1,91 +0,0 @@ -#include "bcm6348.dtsi" - -#include - -/ { - model = "TECOM GW6200"; - compatible = "tecom,gw6200", "brcm,bcm6348"; - - aliases { - led-boot = &led_line1_green; - led-failsafe = &led_line1_green; - led-running = &led_line1_green; - led-upgrade = &led_line1_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 36 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - led_line1_green: line1_green { - label = "green:line1"; - gpios = <&pinctrl 4 1>; - }; - line2_green { - label = "green:line2"; - gpios = <&pinctrl 5 1>; - }; - line3_green { - label = "green:line3"; - gpios = <&pinctrl 6 1>; - }; - tel_green { - label = "green:tel"; - gpios = <&pinctrl 7 1>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x010000>; - read-only; - }; - - linux@10000 { - label = "linux"; - reg = <0x010000 0x7e0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@7f0000 { - label = "nvram"; - reg = <0x7f0000 0x010000>; - }; - }; -}; - -&pinctrl { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_pci &pinctrl_ext_mii &pinctrl_mii_pccard>; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6348-telsey-cpva502plus.dts b/target/linux/bcm63xx/dts/bcm6348-telsey-cpva502plus.dts deleted file mode 100644 index d0ec1cf15efed2..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6348-telsey-cpva502plus.dts +++ /dev/null @@ -1,77 +0,0 @@ -#include "bcm6348.dtsi" - -#include - -/ { - model = "Telsey CPVA502+"; - compatible = "telsey,cpva502plus", "brcm,bcm6348"; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 36 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - phone_green { - label = "green:phone"; - gpios = <&pinctrl 0 1>; - }; - - link_amber { - label = "amber:link"; - gpios = <&pinctrl 5 1>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x010000>; - read-only; - }; - - linux@10000 { - label = "linux"; - reg = <0x010000 0x3e0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@3f0000 { - label = "nvram"; - reg = <0x3f0000 0x010000>; - }; - }; -}; - -&pinctrl { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_pci &pinctrl_ext_mii>; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6348-telsey-magic.dts b/target/linux/bcm63xx/dts/bcm6348-telsey-magic.dts deleted file mode 100644 index c9d9989168c4f1..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6348-telsey-magic.dts +++ /dev/null @@ -1,92 +0,0 @@ -#include "bcm6348.dtsi" - -#include -#include - -/ { - model = "Alice W-Gate"; - compatible = "telsey,magic", "brcm,bcm6348"; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - leds { - compatible = "gpio-leds"; - - power { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 0 1>; - default-state = "on"; - }; - - stop { - label = "green:stop"; - gpios = <&pinctrl 1 1>; - }; - - hpna { - label = "green:hpna"; - gpios = <&pinctrl 4 1>; - }; - - status { - label = "green:adsl"; - gpios = <&pinctrl 5 1>; - }; - - voip { - label = "green:voip"; - gpios = <&pinctrl 22 1>; - }; - - wifi { - label = "green:wifi"; - gpios = <&pinctrl 28 0>; - }; - - usb { - function = LED_FUNCTION_USB; - color = ; - gpios = <&pinctrl 35 1>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x010000>; - read-only; - }; - - linux@10000 { - label = "linux"; - reg = <0x010000 0x3e0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@3f0000 { - label = "nvram"; - reg = <0x3f0000 0x010000>; - }; - }; -}; - -&pinctrl { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_pci &pinctrl_ext_mii &pinctrl_mii_pccard>; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6348-tp-link-td-w8900gb.dts b/target/linux/bcm63xx/dts/bcm6348-tp-link-td-w8900gb.dts deleted file mode 100644 index 6e1f7155d95d56..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6348-tp-link-td-w8900gb.dts +++ /dev/null @@ -1,91 +0,0 @@ -#include "bcm6348.dtsi" - -#include -#include - -/ { - model = "TP-Link TD-W8900GB"; - compatible = "tp-link,td-w8900gb", "brcm,bcm6348"; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 33 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 0 1>; - default-state = "on"; - }; - stop_green { - label = "green:stop"; - gpios = <&pinctrl 1 1>; - }; - adsl_fail_green { - label = "green:adsl-fail"; - gpios = <&pinctrl 2 1>; - }; - ppp_green { - label = "green:ppp"; - gpios = <&pinctrl 3 1>; - }; - ppp_fail_green { - label = "green:ppp-fail"; - gpios = <&pinctrl 4 1>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x020000>; - read-only; - }; - - linux@20000 { - label = "linux"; - reg = <0x020000 0x3d0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@3e0000 { - label = "nvram"; - reg = <0x3f0000 0x010000>; - }; - }; -}; - -&pinctrl { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_pci &pinctrl_ext_mii &pinctrl_mii_pccard>; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6348-usrobotics-usr9108.dts b/target/linux/bcm63xx/dts/bcm6348-usrobotics-usr9108.dts deleted file mode 100644 index 412d80a8c33756..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6348-usrobotics-usr9108.dts +++ /dev/null @@ -1,62 +0,0 @@ -#include "bcm6348.dtsi" - -#include - -/ { - model = "USRobotics USR9108"; - compatible = "usrobotics,usr9108", "brcm,bcm6348"; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - leds { - compatible = "gpio-leds"; - - usb { - label = "usb"; - gpios = <&pinctrl 0 1>; - }; - dsl { - label = "adsl"; - gpios = <&pinctrl 3 1>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x010000>; - read-only; - }; - - linux@10000 { - label = "linux"; - reg = <0x010000 0x3e0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@3f0000 { - label = "nvram"; - reg = <0x3f0000 0x010000>; - }; - }; -}; - -&pinctrl { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_pci &pinctrl_ext_mii>; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6348.dtsi b/target/linux/bcm63xx/dts/bcm6348.dtsi deleted file mode 100644 index 38bb71e53cc359..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6348.dtsi +++ /dev/null @@ -1,160 +0,0 @@ -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - compatible = "brcm,bcm6348"; - - aliases { - pflash = &pflash; - pinctrl = &pinctrl; - serial0 = &uart0; - spi0 = &lsspi; - }; - - cpus { - #address-cells = <1>; - #size-cells = <0>; - - cpu@0 { - compatible = "brcm,bmips3300", "mips,mips4Kc"; - device_type = "cpu"; - reg = <0>; - }; - }; - - cpu_intc: interrupt-controller { - #address-cells = <0>; - compatible = "mti,cpu-interrupt-controller"; - - interrupt-controller; - #interrupt-cells = <1>; - }; - - memory { device_type = "memory"; reg = <0 0>; }; - - pflash: nor@1fc00000 { - compatible = "cfi-flash"; - reg = <0x1fc00000 0x400000>; - bank-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - - status = "disabled"; - }; - - ubus@fff00000 { - #address-cells = <1>; - #size-cells = <1>; - ranges; - compatible = "simple-bus"; - interrupt-parent = <&periph_intc>; - - periph_intc: interrupt-controller@fffe000c { - compatible = "brcm,bcm6345-l1-intc"; - reg = <0xfffe000c 0x8>; - - interrupt-controller; - #interrupt-cells = <1>; - - interrupt-parent = <&cpu_intc>; - interrupts = <2>; - }; - - ext_intc: interrupt-controller@fffe0014 { - compatible = "brcm,bcm6345-ext-intc"; - reg = <0xfffe0014 0x4>; - - interrupt-controller; - #interrupt-cells = <2>; - - interrupt-parent = <&cpu_intc>; - interrupts = <3>, <4>, <5>, <6>; - - brcm,field-width = <5>; - }; - - pinctrl: pin-controller@fffe0400 { - compatible = "brcm,bcm6348-pinctrl"; - reg = <0xfffe0400 0x8>, - <0xfffe0408 0x8>, - <0xfffe0418 0x4>; - reg-names = "dirout", "dat", "mode"; - - gpio-controller; - #gpio-cells = <2>; - - interrupt-parent = <&ext_intc>; - interrupts = <0 0>, <1 0>, <2 0>, <3 0>; - interrupt-names = "gpio32", "gpio33", "gpio34", "gpio35"; - - pinctrl_ext_ephy: ext_ephy { - function = "ext_ephy"; - groups = "group1", "group4"; - }; - - pinctrl_mii_snoop: mii_snoop { - function = "mii_snoop"; - groups = "group1", "group4"; - }; - - pinctrl_legacy_led: legacy_led { - function = "legacy_led"; - groups = "group4"; - }; - - pinctrl_mii_pccard: mii_pccard { - function = "mii_pccard"; - groups = "group1"; - }; - - pinctrl_pci: pci { - function = "pci"; - groups = "group2"; - }; - - pinctrl_spi_master_uart: spi_master_uart { - function = "spi_master_uart"; - groups = "group1"; - }; - - pinctrl_ext_mii: ext_mii { - function = "ext_mii"; - groups = "group0", "group3"; - }; - - pinctrl_utopia: utopia { - function = "utopia"; - groups = "group1", "group3", "group4"; - }; - - pinctrl_diag: diag { - function = "diag"; - groups = "group0", "group1", "group2", "group3", "group4"; - }; - }; - - uart0: serial@fffe0300 { - compatible = "brcm,bcm6345-uart"; - reg = <0xfffe0300 0x18>; - - interrupt-parent = <&periph_intc>; - interrupts = <2>; - - /* clocks = <&periph_clk>; */ - /* clock-names = "refclk"; */ - - status = "disabled"; - }; - - lsspi: spi@fffe0c00 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "brcm,bcm6348-spi"; - reg = <0xfffe0c00 0x40>; - interrupts = <1>; - /* clocks = <&clkctl 9>; */ - - }; - }; -}; diff --git a/target/linux/bcm63xx/dts/bcm6358-alcatel-rg100a.dts b/target/linux/bcm63xx/dts/bcm6358-alcatel-rg100a.dts deleted file mode 100644 index 0b5abbd1f69ac7..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6358-alcatel-rg100a.dts +++ /dev/null @@ -1,68 +0,0 @@ -#include "bcm6358.dtsi" - -#include -#include - -/ { - model = "Alcatel RG100A"; - compatible = "alcatel,rg100a", "brcm,bcm6358"; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - leds { - compatible = "gpio-leds"; - - stop_green { - label = "green:stop"; - gpios = <&pinctrl 4 1>; - }; - power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 5 1>; - default-state = "on"; - }; - adsl_green { - label = "green:adsl"; - gpios = <&pinctrl 22 1>; - }; - ppp_fail_green { - label = "green:ppp-fail"; - gpios = <&pinctrl 23 0>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x020000>; - read-only; - }; - - linux@20000 { - label = "linux"; - reg = <0x020000 0xfc0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@fe0000 { - label = "nvram"; - reg = <0xfe0000 0x020000>; - }; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6358-brcm-bcm96358vw.dts b/target/linux/bcm63xx/dts/bcm6358-brcm-bcm96358vw.dts deleted file mode 100644 index 0a09b2d86c4993..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6358-brcm-bcm96358vw.dts +++ /dev/null @@ -1,53 +0,0 @@ -#include "bcm6358.dtsi" - -#include -#include - -/ { - model = "Broadcom BCM96358VW reference board"; - compatible = "brcm,bcm96358vw", "brcm,bcm6358"; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - leds { - compatible = "gpio-leds"; - - power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 4 0>; - default-state = "on"; - }; - stop_green { - label = "green:stop"; - gpios = <&pinctrl 5 0>; - }; - adsl_fail_green { - label = "green:adsl-fail"; - gpios = <&pinctrl 15 1>; - }; - ppp_green { - label = "green:ppp"; - gpios = <&pinctrl 22 1>; - }; - ppp_fail_green { - label = "green:ppp-fail"; - gpios = <&pinctrl 23 1>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "brcm,bcm963xx-cfe-nor-partitions"; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6358-brcm-bcm96358vw2.dts b/target/linux/bcm63xx/dts/bcm6358-brcm-bcm96358vw2.dts deleted file mode 100644 index a89fdb1fe4623a..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6358-brcm-bcm96358vw2.dts +++ /dev/null @@ -1,49 +0,0 @@ -#include "bcm6358.dtsi" - -#include -#include - -/ { - model = "Broadcom BCM96358VW2 reference board"; - compatible = "brcm,bcm96358vw2", "brcm,bcm6358"; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - leds { - compatible = "gpio-leds"; - - stop_green { - label = "green:stop"; - gpios = <&pinctrl 4 1>; - }; - power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 5 1>; - default-state = "on"; - }; - adsl_green { - label = "green:adsl"; - gpios = <&pinctrl 22 1>; - }; - ppp_fail_green { - label = "green:ppp-fail"; - gpios = <&pinctrl 23 0>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "brcm,bcm963xx-cfe-nor-partitions"; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6358-bt-home-hub-2-a.dts b/target/linux/bcm63xx/dts/bcm6358-bt-home-hub-2-a.dts deleted file mode 100644 index 809f3b39b4ca1e..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6358-bt-home-hub-2-a.dts +++ /dev/null @@ -1,180 +0,0 @@ -#include "bcm6358.dtsi" - -#include -#include - -/ { - model = "BT Home Hub 2.0 Type A"; - compatible = "bt,home-hub-2-a", "brcm,bcm6358"; - - aliases { - led-boot = &led_power_green; - led-failsafe = &led_power_green; - led-running = &led_power_green; - led-upgrade = &led_upgrading_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - phone { - label = "phone"; - gpios = <&pinctrl 1 1>; - linux,code = ; - debounce-interval = <60>; - }; - - reset { - label = "reset"; - gpios = <&pinctrl 9 1>; - linux,code = ; - debounce-interval = <60>; - }; - - wps { - label = "wps"; - gpios = <&pinctrl 11 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; -}; - -&leds { - status = "okay"; - - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_serial_led>; - - led@0 { - reg = <0>; - active-low; - function = LED_FUNCTION_POWER; - color = ; - }; - - led_power_green: led@1 { - reg = <1>; - active-low; - function = LED_FUNCTION_POWER; - color = ; - default-state = "on"; - }; - - led@2 { - reg = <2>; - active-low; - function = LED_FUNCTION_POWER; - color = ; - }; - - led@3 { - reg = <3>; - active-low; - label = "red:broadband"; - }; - - led@4 { - reg = <4>; - active-low; - label = "green:broadband"; - }; - - led@5 { - reg = <5>; - active-low; - label = "blue:broadband"; - }; - - led@6 { - reg = <6>; - active-low; - label = "red:wireless"; - }; - - led@7 { - reg = <7>; - active-low; - label = "green:wireless"; - }; - - led@8 { - reg = <8>; - active-low; - label = "blue:wireless"; - }; - - led@9 { - reg = <9>; - active-low; - label = "red:phone"; - }; - - led@10 { - reg = <10>; - active-low; - label = "green:phone"; - }; - - led@11 { - reg = <11>; - active-low; - label = "blue:phone"; - }; - - led@12 { - reg = <12>; - active-low; - label = "red:upgrading"; - }; - - led_upgrading_green: led@13 { - reg = <13>; - active-low; - label = "green:upgrading"; - }; - - led@14 { - reg = <14>; - active-low; - label = "blue:upgrading"; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x020000>; - }; - - linux@20000 { - label = "linux"; - reg = <0x020000 0xfc0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@fe0000 { - label = "nvram"; - reg = <0xfe0000 0x020000>; - }; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6358-comtrend-ct-6373.dts b/target/linux/bcm63xx/dts/bcm6358-comtrend-ct-6373.dts deleted file mode 100644 index 2dc85f6776349e..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6358-comtrend-ct-6373.dts +++ /dev/null @@ -1,111 +0,0 @@ -#include "bcm6358.dtsi" - -#include -#include - -/ { - model = "Comtrend CT-6373"; - compatible = "comtrend,ct-6373", "brcm,bcm6358"; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 35 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 0 0>; - default-state = "on"; - }; - usb_green { - function = LED_FUNCTION_USB; - color = ; - gpios = <&pinctrl 3 1>; - }; - wlan_green { - function = LED_FUNCTION_WLAN; - color = ; - gpios = <&pinctrl 9 1>; - }; - }; -}; - -&leds { - status = "okay"; - - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_serial_led>; - - led@0 { - reg = <0>; - active-low; - label = "green:adsl"; - }; - - led@1 { - reg = <1>; - active-low; - label = "green:line"; - }; - - led@2 { - reg = <2>; - active-low; - label = "green:fxs1"; - }; - - led@3 { - reg = <3>; - active-low; - label = "green:fxs2"; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x010000>; - read-only; - }; - - linux@10000 { - label = "linux"; - reg = <0x010000 0x7e0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@7f0000 { - label = "nvram"; - reg = <0x7f0000 0x010000>; - }; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6358-d-link-dsl-2650u.dts b/target/linux/bcm63xx/dts/bcm6358-d-link-dsl-2650u.dts deleted file mode 100644 index dbc4172f54d16c..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6358-d-link-dsl-2650u.dts +++ /dev/null @@ -1,68 +0,0 @@ -#include "bcm6358.dtsi" - -#include -#include - -/ { - model = "D-Link DSL-2650U"; - compatible = "d-link,dsl-2650u", "brcm,bcm6358"; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - leds { - compatible = "gpio-leds"; - - stop_green { - label = "green:stop"; - gpios = <&pinctrl 4 1>; - }; - power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 5 1>; - default-state = "on"; - }; - adsl_green { - label = "green:adsl"; - gpios = <&pinctrl 22 1>; - }; - ppp_fail_green { - label = "green:ppp-fail"; - gpios = <&pinctrl 23 0>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x010000>; - read-only; - }; - - linux@10000 { - label = "linux"; - reg = <0x010000 0x7e0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@7f0000 { - label = "nvram"; - reg = <0x7f0000 0x010000>; - }; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6358-d-link-dsl-274xb-c2.dts b/target/linux/bcm63xx/dts/bcm6358-d-link-dsl-274xb-c2.dts deleted file mode 100644 index 917fd6dc1dc566..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6358-d-link-dsl-274xb-c2.dts +++ /dev/null @@ -1,94 +0,0 @@ -#include "bcm6358.dtsi" - -#include -#include - -/ { - model = "D-Link DSL-2740B/DSL-2741B rev C2/3"; - compatible = "d-link,dsl-274xb-c2", "brcm,bcm6358"; - - aliases { - led-boot = &led_power_green; - led-failsafe = &led_power_green; - led-running = &led_power_green; - led-upgrade = &led_power_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 34 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - inet_green { - label = "green:internet"; - gpios = <&pinctrl 2 0>; - }; - power_red { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 4 1>; - }; - led_power_green: power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 5 1>; - default-state = "on"; - }; - dsl_green { - label = "green:adsl"; - gpios = <&pinctrl 9 1>; - }; - inet_red { - label = "red:internet"; - gpios = <&pinctrl 10 0>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x010000>; - read-only; - }; - - linux@10000 { - label = "linux"; - reg = <0x010000 0x3e0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@3f0000 { - label = "nvram"; - reg = <0x3f0000 0x010000>; - }; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6358-d-link-dva-g3810bn-tl.dts b/target/linux/bcm63xx/dts/bcm6358-d-link-dva-g3810bn-tl.dts deleted file mode 100644 index ef6ff862e50d2f..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6358-d-link-dva-g3810bn-tl.dts +++ /dev/null @@ -1,84 +0,0 @@ -#include "bcm6358.dtsi" - -#include - -/ { - model = "D-Link DVA-G3810BN/TL"; - compatible = "d-link,dva-g3810bn-tl", "brcm,bcm6358"; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 34 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - voip { - label = "voip"; - gpios = <&pinctrl 1 0>; - }; - power { - label = "power"; - gpios = <&pinctrl 4 0>; - default-state = "on"; - }; - stop { - label = "stop"; - gpios = <&pinctrl 5 0>; - }; - dsl { - label = "dsl"; - gpios = <&pinctrl 22 1>; - }; - inet { - label = "internet"; - gpios = <&pinctrl 23 1>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x010000>; - read-only; - }; - - linux@10000 { - label = "linux"; - reg = <0x010000 0x7e0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@7f0000 { - label = "nvram"; - reg = <0x7f0000 0x010000>; - }; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6358-huawei-echolife-hg553.dts b/target/linux/bcm63xx/dts/bcm6358-huawei-echolife-hg553.dts deleted file mode 100644 index 052262dca710c4..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6358-huawei-echolife-hg553.dts +++ /dev/null @@ -1,119 +0,0 @@ -#include "bcm6358.dtsi" - -#include -#include - -/ { - model = "Huawei EchoLife HG553"; - compatible = "huawei,echolife-hg553", "brcm,bcm6358"; - - aliases { - led-boot = &led_power_blue; - led-failsafe = &led_power_blue; - led-running = &led_power_blue; - led-upgrade = &led_power_blue; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - rfkill { - label = "rfkill"; - gpios = <&pinctrl 9 1>; - linux,code = ; - debounce-interval = <60>; - }; - - reset { - label = "reset"; - gpios = <&pinctrl 37 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - led_power_blue: power_blue { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 4 1>; - default-state = "on"; - }; - power_red { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 5 1>; - }; - hspa_red { - label = "red:hspa"; - gpios = <&pinctrl 12 1>; - }; - hspa_blue { - label = "blue:hspa"; - gpios = <&pinctrl 13 1>; - }; - lan_red { - function = LED_FUNCTION_LAN; - color = ; - gpios = <&pinctrl 22 1>; - }; - lan_blue { - function = LED_FUNCTION_LAN; - color = ; - gpios = <&pinctrl 23 1>; - }; - wifi_red { - label = "red:wifi"; - gpios = <&pinctrl 25 1>; - }; - dsl_red { - label = "red:adsl"; - gpios = <&pinctrl 34 1>; - }; - dsl_blue { - label = "blue:adsl"; - gpios = <&pinctrl 35 1>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x020000>; - read-only; - }; - - linux@20000 { - label = "linux"; - reg = <0x020000 0xfc0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@fe0000 { - label = "nvram"; - reg = <0xfe0000 0x020000>; - }; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6358-huawei-echolife-hg556a-a.dts b/target/linux/bcm63xx/dts/bcm6358-huawei-echolife-hg556a-a.dts deleted file mode 100644 index 76dbe4f92b59fb..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6358-huawei-echolife-hg556a-a.dts +++ /dev/null @@ -1,43 +0,0 @@ -#include "bcm6358-huawei-echolife-hg556a.dtsi" - -/ { - model = "Huawei EchoLife HG556a (version A)"; - compatible = "huawei,echolife-hg556a-a", "brcm,bcm6358"; -}; - -&gpiokeys { - help { - label = "help"; - gpios = <&pinctrl 8 1>; - linux,code = ; - debounce-interval = <60>; - }; -}; - -&gpioleds { - message_red { - label = "red:message"; - gpios = <&pinctrl 0 1>; - }; - - hspa_red { - label = "red:hspa"; - gpios = <&pinctrl 1 1>; - }; - - all_red { - label = "red:all"; - gpios = <&pinctrl 6 1>; - default-state = "on"; - }; - - lan1_green { - label = "green:lan1"; - gpios = <&pinctrl 12 1>; - }; - - lan2_green { - label = "green:lan2"; - gpios = <&pinctrl 15 1>; - }; -}; diff --git a/target/linux/bcm63xx/dts/bcm6358-huawei-echolife-hg556a-b.dts b/target/linux/bcm63xx/dts/bcm6358-huawei-echolife-hg556a-b.dts deleted file mode 100644 index c39e574b365685..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6358-huawei-echolife-hg556a-b.dts +++ /dev/null @@ -1,43 +0,0 @@ -#include "bcm6358-huawei-echolife-hg556a.dtsi" - -/ { - model = "Huawei EchoLife HG556a (version B)"; - compatible = "huawei,echolife-hg556a-b", "brcm,bcm6358"; -}; - -&gpiokeys { - help { - label = "help"; - gpios = <&pinctrl 8 1>; - linux,code = ; - debounce-interval = <60>; - }; -}; - -&gpioleds { - message_red { - label = "red:message"; - gpios = <&pinctrl 0 1>; - }; - - hspa_red { - label = "red:hspa"; - gpios = <&pinctrl 1 1>; - }; - - all_red { - label = "red:all"; - gpios = <&pinctrl 6 1>; - default-state = "on"; - }; - - lan1_green { - label = "green:lan1"; - gpios = <&pinctrl 12 1>; - }; - - lan2_green { - label = "green:lan2"; - gpios = <&pinctrl 15 1>; - }; -}; diff --git a/target/linux/bcm63xx/dts/bcm6358-huawei-echolife-hg556a-c.dts b/target/linux/bcm63xx/dts/bcm6358-huawei-echolife-hg556a-c.dts deleted file mode 100644 index 3f5931d7bd83d8..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6358-huawei-echolife-hg556a-c.dts +++ /dev/null @@ -1,37 +0,0 @@ -#include "bcm6358-huawei-echolife-hg556a.dtsi" - -/ { - model = "Huawei EchoLife HG556a (version C)"; - compatible = "huawei,echolife-hg556a-c", "brcm,bcm6358"; -}; - -&gpiokeys { - help { - label = "help"; - gpios = <&pinctrl 36 1>; - linux,code = ; - debounce-interval = <60>; - }; -}; - -&gpioleds { - lan1_green { - label = "green:lan1"; - gpios = <&pinctrl 0 1>; - }; - - lan2_green { - label = "green:lan2"; - gpios = <&pinctrl 1 1>; - }; - - message_red { - label = "red:message"; - gpios = <&pinctrl 12 1>; - }; - - hspa_red { - label = "red:hspa"; - gpios = <&pinctrl 15 1>; - }; -}; diff --git a/target/linux/bcm63xx/dts/bcm6358-huawei-echolife-hg556a.dtsi b/target/linux/bcm63xx/dts/bcm6358-huawei-echolife-hg556a.dtsi deleted file mode 100644 index f64e02e1c53c3f..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6358-huawei-echolife-hg556a.dtsi +++ /dev/null @@ -1,129 +0,0 @@ -#include "bcm6358.dtsi" - -#include -#include - -/ { - aliases { - led-boot = &led_power_red; - led-failsafe = &led_power_red; - led-running = &led_power_red; - led-upgrade = &led_power_red; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - gpiokeys: keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - wlan { - label = "wlan"; - gpios = <&pinctrl 9 1>; - linux,code = ; - debounce-interval = <60>; - }; - - restart { - label = "restart"; - gpios = <&pinctrl 10 1>; - linux,code = ; - debounce-interval = <60>; - }; - - reset { - label = "reset"; - gpios = <&pinctrl 11 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - gpioleds: leds { - compatible = "gpio-leds"; - - dsl_red { - label = "red:dsl"; - gpios = <&pinctrl 2 1>; - }; - - led_power_red: power_red { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 3 1>; - default-state = "on"; - }; - - lan1_red { - label = "red:lan1"; - gpios = <&pinctrl 13 1>; - }; - - lan2_red { - label = "red:lan2"; - gpios = <&pinctrl 22 1>; - }; - - lan3_green { - label = "green:lan3"; - gpios = <&pinctrl 23 1>; - }; - - lan3_red { - label = "red:lan3"; - gpios = <&pinctrl 26 1>; - }; - - lan4_green { - label = "green:lan4"; - gpios = <&pinctrl 27 1>; - }; - - lan4_red { - label = "red:lan4"; - gpios = <&pinctrl 28 1>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x020000>; - read-only; - }; - - linux@20000 { - label = "linux"; - reg = <0x020000 0xec0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - cal_data@ee0000 { - label = "cal_data"; - reg = <0xee0000 0x100000>; - read-only; - }; - - nvram@fe0000 { - label = "nvram"; - reg = <0xfe0000 0x020000>; - }; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6358-pirelli-a226.dtsi b/target/linux/bcm63xx/dts/bcm6358-pirelli-a226.dtsi deleted file mode 100644 index f6de31ccf91f16..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6358-pirelli-a226.dtsi +++ /dev/null @@ -1,98 +0,0 @@ -#include "bcm6358.dtsi" - -#include -#include - -/ { - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - wps { - label = "wps"; - gpios = <&pinctrl 34 1>; - linux,code = ; - debounce-interval = <60>; - }; - - reset { - label = "reset"; - gpios = <&pinctrl 37 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - voip_red { - label = "red:VoIP"; - gpios = <&pinctrl 0 1>; - }; - eth_red { - label = "red:ethernet"; - gpios = <&pinctrl 1 1>; - }; - dsl_green { - label = "green:ADSL"; - gpios = <&pinctrl 2 1>; - }; - usb_green { - function = LED_FUNCTION_USB; - color = ; - gpios = <&pinctrl 3 1>; - }; - power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 4 1>; - default-state = "on"; - }; - power_red { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 5 1>; - }; - inet_red { - label = "red:internet"; - gpios = <&pinctrl 6 1>; - }; - inet_green { - label = "green:internet"; - gpios = <&pinctrl 7 1>; - }; - eth_green { - label = "green:ethernet"; - gpios = <&pinctrl 8 1>; - }; - voip_green { - label = "green:VoIP"; - gpios = <&pinctrl 9 1>; - }; - wifi_red { - label = "red:wifi"; - gpios = <&pinctrl 10 1>; - }; - usb_red { - function = LED_FUNCTION_USB; - color = ; - gpios = <&pinctrl 11 1>; - }; - dsl_red { - label = "red:ADSL"; - gpios = <&pinctrl 12 1>; - }; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6358-pirelli-a226g.dts b/target/linux/bcm63xx/dts/bcm6358-pirelli-a226g.dts deleted file mode 100644 index 492fd2ed316f96..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6358-pirelli-a226g.dts +++ /dev/null @@ -1,33 +0,0 @@ -#include "bcm6358-pirelli-a226.dtsi" - -/ { - model = "Pirelli A226G"; - compatible = "pirelli,a226g", "brcm,bcm6358"; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x010000>; - read-only; - }; - - linux@10000 { - label = "linux"; - reg = <0x010000 0x7e0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@7f0000 { - label = "nvram"; - reg = <0x7f0000 0x010000>; - }; - }; -}; diff --git a/target/linux/bcm63xx/dts/bcm6358-pirelli-a226m-fwb.dts b/target/linux/bcm63xx/dts/bcm6358-pirelli-a226m-fwb.dts deleted file mode 100644 index 1a820fbcbf4ded..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6358-pirelli-a226m-fwb.dts +++ /dev/null @@ -1,33 +0,0 @@ -#include "bcm6358-pirelli-a226.dtsi" - -/ { - model = "Pirelli A226M-FWB"; - compatible = "pirelli,a226m-fwb", "brcm,bcm6358"; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "CFE"; - reg = <0x000000 0x020000>; - read-only; - }; - - partition@20000 { - label = "linux"; - reg = <0x020000 0xfc0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - partition@fe0000 { - label = "nvram"; - reg = <0xfe0000 0x020000>; - }; - }; -}; diff --git a/target/linux/bcm63xx/dts/bcm6358-pirelli-a226m.dts b/target/linux/bcm63xx/dts/bcm6358-pirelli-a226m.dts deleted file mode 100644 index ba1a8629b5885e..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6358-pirelli-a226m.dts +++ /dev/null @@ -1,33 +0,0 @@ -#include "bcm6358-pirelli-a226.dtsi" - -/ { - model = "Pirelli A226M"; - compatible = "pirelli,a226m", "brcm,bcm6358"; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x010000>; - read-only; - }; - - linux@10000 { - label = "linux"; - reg = <0x010000 0x7e0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@7f0000 { - label = "nvram"; - reg = <0x7f0000 0x010000>; - }; - }; -}; diff --git a/target/linux/bcm63xx/dts/bcm6358-pirelli-agpf-s0.dts b/target/linux/bcm63xx/dts/bcm6358-pirelli-agpf-s0.dts deleted file mode 100644 index 55cea95b84bce0..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6358-pirelli-agpf-s0.dts +++ /dev/null @@ -1,130 +0,0 @@ -#include "bcm6358.dtsi" - -#include -#include - -/ { - model = "Pirelli Alice Gate AGPF-S0"; - compatible = "pirelli,agpf-s0", "brcm,bcm6358"; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - wps { - label = "wps"; - gpios = <&pinctrl 34 1>; - linux,code = ; - debounce-interval = <60>; - }; - - reset { - label = "reset"; - gpios = <&pinctrl 37 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 4 1>; - default-state = "on"; - }; - power_red { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 5 1>; - }; - service_green { - label = "green:service"; - gpios = <&pinctrl 6 1>; - }; - service_red { - label = "red:service"; - gpios = <&pinctrl 7 1>; - }; - dsl_green { - label = "green:adsl"; - gpios = <&pinctrl 9 1>; - }; - dsl_red { - label = "red:adsl"; - gpios = <&pinctrl 10 1>; - }; - wifi_green { - label = "green:wifi"; - gpios = <&pinctrl 22 1>; - }; - wifi_red { - label = "red:wifi"; - gpios = <&pinctrl 23 1>; - }; - inet_red { - label = "red:internet"; - gpios = <&pinctrl 24 1>; - }; - inet_green { - label = "green:internet"; - gpios = <&pinctrl 25 1>; - }; - usr1_green { - label = "green:usr1"; - gpios = <&pinctrl 26 1>; - }; - usr1_red { - label = "red:usr1"; - gpios = <&pinctrl 27 1>; - }; - usr2_green { - label = "green:usr2"; - gpios = <&pinctrl 29 1>; - }; - usr2_red { - label = "red:usr2"; - gpios = <&pinctrl 30 1>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x020000>; - read-only; - }; - - linux@20000 { - label = "linux"; - reg = <0x020000 0xfc0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@fe0000 { - label = "nvram"; - reg = <0xfe0000 0x020000>; - }; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6358-sfr-neufbox-4-foxconn-r1.dts b/target/linux/bcm63xx/dts/bcm6358-sfr-neufbox-4-foxconn-r1.dts deleted file mode 100644 index c4c9ee9518163e..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6358-sfr-neufbox-4-foxconn-r1.dts +++ /dev/null @@ -1,31 +0,0 @@ -#include "bcm6358-sfr-neufbox-4.dtsi" - -/ { - model = "SFR Neufbox 4 (Foxconn)"; - compatible = "sfr,neufbox-4-foxconn-r1", "brcm,bcm6358"; - - leds { - compatible = "gpio-leds"; - - traffic_white { - label = "white:traffic"; - gpios = <&pinctrl 2 0>; - }; - service_blue { - label = "blue:service"; - gpios = <&pinctrl 4 0>; - }; - wifi_white { - label = "white:wifi"; - gpios = <&pinctrl 15 0>; - }; - service_red { - label = "red:service"; - gpios = <&pinctrl 29 0>; - }; - service_green { - label = "green:service"; - gpios = <&pinctrl 30 0>; - }; - }; -}; diff --git a/target/linux/bcm63xx/dts/bcm6358-sfr-neufbox-4-sercomm-r0.dts b/target/linux/bcm63xx/dts/bcm6358-sfr-neufbox-4-sercomm-r0.dts deleted file mode 100644 index fa23b68ef56f74..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6358-sfr-neufbox-4-sercomm-r0.dts +++ /dev/null @@ -1,31 +0,0 @@ -#include "bcm6358-sfr-neufbox-4.dtsi" - -/ { - model = "SFR Neufbox 4 (Sercomm)"; - compatible = "sfr,neufbox-4-sercomm-r0", "brcm,bcm6358"; - - leds { - compatible = "gpio-leds"; - - traffic_white { - label = "white:traffic"; - gpios = <&pinctrl 2 1>; - }; - service_blue { - label = "blue:service"; - gpios = <&pinctrl 4 1>; - }; - wifi_white { - label = "white:wifi"; - gpios = <&pinctrl 15 1>; - }; - service_red { - label = "red:service"; - gpios = <&pinctrl 29 1>; - }; - service_green { - label = "green:service"; - gpios = <&pinctrl 30 1>; - }; - }; -}; diff --git a/target/linux/bcm63xx/dts/bcm6358-sfr-neufbox-4.dtsi b/target/linux/bcm63xx/dts/bcm6358-sfr-neufbox-4.dtsi deleted file mode 100644 index 9be493ebd549f3..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6358-sfr-neufbox-4.dtsi +++ /dev/null @@ -1,90 +0,0 @@ -#include "bcm6358.dtsi" - -#include -#include - -/ { - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - service { - label = "service"; - gpios = <&pinctrl 27 1>; - linux,code = ; - debounce-interval = <60>; - }; - - clip { - label = "clip"; - gpios = <&pinctrl 31 1>; - linux,code = ; - debounce-interval = <60>; - }; - - reset { - label = "reset"; - gpios = <&pinctrl 34 1>; - linux,code = ; - debounce-interval = <60>; - }; - - wps { - label = "wps"; - gpios = <&pinctrl 37 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; -}; - -&leds { - status = "okay"; - - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_serial_led>; - - led@0 { - reg = <0>; - active-low; - function = LED_FUNCTION_ALARM; - color = ; - }; - - led@2 { - reg = <2>; - active-low; - label = "white:tv"; - }; - - led@3 { - reg = <3>; - active-low; - label = "white:tel"; - }; - - led@4 { - reg = <4>; - active-low; - label = "white:adsl"; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "brcm,bcm963xx-cfe-nor-partitions"; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6358-t-com-speedport-w-303v.dts b/target/linux/bcm63xx/dts/bcm6358-t-com-speedport-w-303v.dts deleted file mode 100644 index 7a66e680319af4..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6358-t-com-speedport-w-303v.dts +++ /dev/null @@ -1,102 +0,0 @@ -#include "bcm6358.dtsi" - -#include - -/ { - model = "T-Com Speedport W 303V"; - compatible = "t-com,speedport-w-303v", "brcm,bcm6358"; - - aliases { - led-boot = &led_power_adsl_green; - led-failsafe = &led_power_adsl_green; - led-running = &led_power_adsl_green; - led-upgrade = &led_power_adsl_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 11 0>; - linux,code = ; - debounce-interval = <60>; - }; - - ses { - label = "ses"; - gpios = <&pinctrl 37 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - ses_green { - label = "green:ses"; - gpios = <&pinctrl 0 1>; - }; - power_adsl_red { - label = "red:power+adsl"; - gpios = <&pinctrl 2 1>; - }; - ppp_green { - label = "green:ppp"; - gpios = <&pinctrl 5 1>; - }; - led_power_adsl_green: power_adsl_green { - label = "green:power+adsl"; - gpios = <&pinctrl 22 1>; - default-state = "on"; - }; - voip_green { - label = "green:voip"; - gpios = <&pinctrl 27 1>; - }; - pots_green { - label = "green:pots"; - gpios = <&pinctrl 31 1>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x010000>; - read-only; - }; - - linux@10000 { - label = "linux"; - reg = <0x010000 0x7e0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@7f0000 { - label = "nvram"; - reg = <0x7f0000 0x010000>; - }; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6358-telsey-cpva642.dts b/target/linux/bcm63xx/dts/bcm6358-telsey-cpva642.dts deleted file mode 100644 index 1a6b9658bb1649..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6358-telsey-cpva642.dts +++ /dev/null @@ -1,122 +0,0 @@ -#include "bcm6358.dtsi" - -#include -#include - -/ { - model = "Telsey CPVA642-type (CPA-ZNTE60T)"; - compatible = "telsey,cpva642", "brcm,bcm6358"; - - aliases { - led-boot = &led_power_green; - led-failsafe = &led_power_green; - led-running = &led_power_green; - led-upgrade = &led_power_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 36 1>; - linux,code = ; - debounce-interval = <60>; - }; - - wps { - label = "wps"; - gpios = <&pinctrl 37 0>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - eth_green { - label = "green:ether"; - gpios = <&pinctrl 1 1>; - }; - phone2_green { - label = "green:phone2"; - gpios = <&pinctrl 2 1>; - }; - usb_green { - function = LED_FUNCTION_USB; - color = ; - gpios = <&pinctrl 3 1>; - }; - phone1_green { - label = "green:phone1"; - gpios = <&pinctrl 4 1>; - }; - wifi_red { - label = "red:wifi"; - gpios = <&pinctrl 6 1>; - }; - link_red { - label = "red:link"; - gpios = <&pinctrl 9 1>; - }; - link_green { - label = "green:link"; - gpios = <&pinctrl 10 1>; - }; - led_power_green: power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 11 1>; - default-state = "on"; - }; - power_red { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 14 1>; - }; - wifi_green { - label = "green:wifi"; - gpios = <&pinctrl 28 0>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x010000>; - read-only; - }; - - linux@10000 { - label = "linux"; - reg = <0x010000 0x7e0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@7f0000 { - label = "nvram"; - reg = <0x7f0000 0x010000>; - }; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6358.dtsi b/target/linux/bcm63xx/dts/bcm6358.dtsi deleted file mode 100644 index c2e0a97bb24e5e..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6358.dtsi +++ /dev/null @@ -1,205 +0,0 @@ -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - compatible = "brcm,bcm6358"; - - aliases { - pflash = &pflash; - pinctrl = &pinctrl; - serial0 = &uart0; - serial1 = &uart1; - spi0 = &lsspi; - }; - - cpus { - #address-cells = <1>; - #size-cells = <0>; - - cpu@0 { - compatible = "brcm,bmips4350", "mips,mips4Kc"; - device_type = "cpu"; - reg = <0>; - }; - - cpu@1 { - compatible = "brcm,bmips4350", "mips,mips4Kc"; - device_type = "cpu"; - reg = <1>; - }; - }; - - cpu_intc: interrupt-controller { - #address-cells = <0>; - compatible = "mti,cpu-interrupt-controller"; - - interrupt-controller; - #interrupt-cells = <1>; - }; - - memory { device_type = "memory"; reg = <0 0>; }; - - pflash: nor@1e000000 { - compatible = "cfi-flash"; - reg = <0x1e000000 0x2000000>; - bank-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - - status = "disabled"; - }; - - ubus@fff00000 { - #address-cells = <1>; - #size-cells = <1>; - ranges; - compatible = "simple-bus"; - interrupt-parent = <&periph_intc>; - - periph_intc: interrupt-controller@fffe000c { - compatible = "brcm,bcm6345-l1-intc"; - reg = <0xfffe000c 0x8>, - <0xfffe0038 0x8>; - - interrupt-controller; - #interrupt-cells = <1>; - - interrupt-parent = <&cpu_intc>; - interrupts = <2>, <3>; - }; - - ext_intc0: interrupt-controller@fffe0014 { - compatible = "brcm,bcm6345-ext-intc"; - reg = <0xfffe0014 0x4>; - - interrupt-controller; - #interrupt-cells = <2>; - - interrupts = <25>, <26>, <27>, <28>; - }; - - ext_intc1: interrupt-controller@fffe001c { - compatible = "brcm,bcm6345-ext-intc"; - reg = <0xfffe001c 0x4>; - - interrupt-controller; - #interrupt-cells = <2>; - - interrupts = <20>, <21>; - }; - - pinctrl: pin-controller@fffe0080 { - compatible = "brcm,bcm6358-pinctrl"; - reg = <0xfffe0080 0x8>, - <0xfffe0088 0x8>; - reg-names = "dirout", "dat", "mode"; - brcm,gpiomode = <&gpiomode>; - - gpio-controller; - #gpio-cells = <2>; - - interrupts-extended = <&ext_intc1 0 0>, - <&ext_intc1 1 0>, - <&ext_intc0 0 0>, - <&ext_intc0 1 0>, - <&ext_intc0 2 0>, - <&ext_intc0 3 0>; - interrupt-names = "gpio32", "gpio33", "gpio34", "gpio35", - "gpio36", "gpio37"; - - pinctrl_ebi_cs: ebi_cs { - function = "ebi_cs"; - groups = "ebi_cs_grp"; - }; - - pinctrl_uart1: uart1 { - function = "uart1"; - groups = "uart1_grp"; - }; - - pinctrl_serial_led: serial_led { - function = "serial_led"; - groups = "serial_led_grp"; - }; - - pinctrl_legacy_led: legacy_led { - function = "legacy_led"; - groups = "legacy_led_grp"; - }; - - pinctrl_led: led { - function = "led"; - groups = "led_grp"; - }; - - pinctrl_spi_cs_23: spi_cs { - function = "spi_cs"; - groups = "spi_cs_grp"; - }; - - pinctrl_utopia: utopia { - function = "utopia"; - groups = "utopia_grp"; - }; - - pinctrl_pwm_syn_clk: pwm_syn_clk { - function = "pwm_syn_clk"; - groups = "pwm_syn_clk_grp"; - }; - - pinctrl_sys_irq: sys_irq { - function = "sys_irq"; - groups = "sys_irq_grp"; - }; - }; - - gpiomode: gpiomode@fffe0098 { - compatible = "brcm,bcm6358-gpiomode", "syscon"; - reg = <0xfffe0098 0x4>; - }; - - leds: led-controller@fffe00d0 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "brcm,bcm6358-leds"; - reg = <0xfffe00d0 0x8>; - status = "disabled"; - }; - - uart0: serial@fffe0100 { - compatible = "brcm,bcm6345-uart"; - reg = <0xfffe0100 0x18>; - - interrupt-parent = <&periph_intc>; - interrupts = <2>; - - /* clocks = <&periph_clk>; */ - /* clock-names = "refclk"; */ - - status = "disabled"; - }; - - uart1: serial@fffe0120 { - compatible = "brcm,bcm6345-uart"; - reg = <0xfffe0120 0x18>; - - interrupt-parent = <&periph_intc>; - interrupts = <3>; - - /* clocks = <&periph_clk>; */ - /* clock-names = "refclk"; */ - - status = "disabled"; - }; - - lsspi: spi@fffe0800 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "brcm,bcm6358-spi"; - reg = <0xfffe0800 0x70c>; - interrupts = <1>; - /* clocks = <&clkctl 9>; */ - }; - }; -}; diff --git a/target/linux/bcm63xx/dts/bcm6359-huawei-echolife-hg520v.dts b/target/linux/bcm63xx/dts/bcm6359-huawei-echolife-hg520v.dts deleted file mode 100644 index ec47764ccbbba0..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6359-huawei-echolife-hg520v.dts +++ /dev/null @@ -1,74 +0,0 @@ -#include "bcm6358.dtsi" - -#include - -/ { - model = "Huawei EchoLife HG520v"; - compatible = "huawei,echolife-hg520v", "brcm,bcm6359", "brcm,bcm6358"; - - aliases { - led-boot = &led_inet_green; - led-failsafe = &led_inet_green; - led-running = &led_inet_green; - led-upgrade = &led_inet_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 37 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - led_inet_green: inet_green { - label = "green:net"; - gpios = <&pinctrl 32 1>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x010000>; - read-only; - }; - - linux@10000 { - label = "linux"; - reg = <0x010000 0x3e0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@3f0000 { - label = "nvram"; - reg = <0x3f0000 0x010000>; - }; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6361-sfr-neufbox-6-sercomm-r0.dts b/target/linux/bcm63xx/dts/bcm6361-sfr-neufbox-6-sercomm-r0.dts deleted file mode 100644 index c7b6806810597c..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6361-sfr-neufbox-6-sercomm-r0.dts +++ /dev/null @@ -1,98 +0,0 @@ -#include "bcm6362.dtsi" - -#include - -/ { - model = "SFR Neufbox 6 (Sercomm)"; - compatible = "sfr,neufbox-6-sercomm-r0", "brcm,bcm6361", "brcm,bcm6362"; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - service { - label = "service"; - gpios = <&pinctrl 10 1>; - linux,code = ; - debounce-interval = <60>; - }; - - wlan { - label = "wlan"; - gpios = <&pinctrl 12 1>; - linux,code = ; - debounce-interval = <60>; - }; - - reset { - label = "reset"; - gpios = <&pinctrl 24 1>; - linux,code = ; - debounce-interval = <60>; - }; - - wps { - label = "wps"; - gpios = <&pinctrl 25 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - switch { - compatible = "realtek,rtl8367"; - gpio-sda = <&pinctrl 18 0>; - gpio-sck = <&pinctrl 20 0>; - - realtek,extif0 = <1 5 1 1 1 1 1 1 2>; - }; -}; - -&hsspi { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - spi-max-frequency = <20000000>; - spi-tx-bus-width = <2>; - spi-rx-bus-width = <2>; - reg = <0>; - - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - reg = <0x000000 0x010000>; - label = "cfe"; - read-only; - }; - - linux@10000 { - reg = <0x010000 0xfe0000>; - label = "linux"; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@ff0000 { - reg = <0xff0000 0x010000>; - label = "nvram"; - }; - }; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6362-huawei-hg253s-v2.dts b/target/linux/bcm63xx/dts/bcm6362-huawei-hg253s-v2.dts deleted file mode 100644 index 9217fd30989f6f..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6362-huawei-hg253s-v2.dts +++ /dev/null @@ -1,178 +0,0 @@ -#include "bcm6362.dtsi" - -#include -#include - -/ { - model = "Huawei HG253s v2"; - compatible = "huawei,hg253s-v2", "brcm,bcm6362"; - - aliases { - led-boot = &led_phone_green; - led-failsafe = &led_phone_green; - led-upgrade = &led_phone_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,ubifs noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 24 1>; - linux,code = ; - debounce-interval = <60>; - }; - - wlan { - label = "wlan"; - gpios = <&pinctrl 25 1>; - linux,code = ; - debounce-interval = <60>; - }; - - wps { - label = "wps"; - gpios = <&pinctrl 26 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - led_phone_green: led@28 { - label = "green:phone"; - gpios = <&pinctrl 28 1>; - }; - - led@30 { - function = LED_FUNCTION_USB; - color = ; - gpios = <&pinctrl 30 1>; - }; - }; -}; - -&leds { - status = "okay"; - - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_leds>; - - led@3 { - reg = <3>; - active-low; - label = "green:internet"; - }; - - led@5 { - reg = <5>; - active-low; - label = "green:wifi"; - }; -}; - -&lsspi { - switch@0 { - compatible = "brcm,bcm53125"; - reg = <0>; - spi-max-frequency = <781000>; - - lede,alias = "eth0"; - - ports { - #address-cells = <1>; - #size-cells = <0>; - - lan@1 { - reg = <1>; - label = "lan4"; - }; - - lan@2 { - reg = <2>; - label = "lan3"; - }; - - lan@3 { - reg = <3>; - label = "lan2"; - }; - - lan@4 { - reg = <4>; - label = "lan1"; - }; - - cpu@8 { - reg = <8>; - label = "cpu"; - - fixed-link { - speed = <1000>; - full-duplex; - asym-pause; - pause; - }; - }; - }; - }; -}; - -&nflash { - status = "okay"; - - nandcs@0 { - compatible = "brcm,nandcs"; - #size-cells = <1>; - #address-cells = <1>; - reg = <0>; - nand-ecc-step-size = <512>; - nand-ecc-strength = <15>; - nand-on-flash-bbt; - brcm,nand-oob-sector-size = <64>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "cferom"; - reg = <0x0000000 0x0020000>; - read-only; - }; - - partition@20000 { - compatible = "brcm,wfi"; - label = "wfi"; - reg = <0x0020000 0x7d80000>; - }; - - partition@7da0000 { - label = "nvram"; - reg = <0x7da0000 0x160000>; - }; - }; - }; -}; - -&pinctrl { - pinctrl_leds: leds { - function = "led"; - pins = "gpio3", "gpio5"; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6362-netgear-dgnd3700-v2.dts b/target/linux/bcm63xx/dts/bcm6362-netgear-dgnd3700-v2.dts deleted file mode 100644 index 8d457c906e1a97..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6362-netgear-dgnd3700-v2.dts +++ /dev/null @@ -1,219 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "bcm6362.dtsi" - -#include -#include - -/ { - model = "Netgear DGND3700v2"; - compatible = "netgear,dgnd3700-v2", "brcm,bcm6362"; - - aliases { - led-boot = &led_power_green; - led-failsafe = &led_power_green; - led-running = &led_power_green; - led-upgrade = &led_power_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,ubifs noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 24 1>; - linux,code = ; - debounce-interval = <60>; - }; - - wlan { - label = "wlan"; - gpios = <&pinctrl 25 1>; - linux,code = ; - debounce-interval = <60>; - }; - - wps { - label = "wps"; - gpios = <&pinctrl 26 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - led@28 { - label = "green:dsl"; - gpios = <&pinctrl 28 1>; - }; - - led@34 { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 34 1>; - }; - }; -}; - -&leds { - status = "okay"; - brcm,serial-leds; - brcm,serial-dat-low; - brcm,serial-shift-inv; - brcm,serial-mux; - - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_leds &pinctrl_serial_led>; - - led@1 { - reg = <1>; - active-low; - label = "green:internet"; - }; - - led_power_green: led@8 { - reg = <8>; - function = LED_FUNCTION_POWER; - color = ; - default-state = "on"; - }; - - led@9 { - reg = <9>; - active-low; - function = LED_FUNCTION_WPS; - color = ; - }; - - led@10 { - reg = <10>; - active-low; - label = "green:usb1"; - }; - - led@11 { - reg = <11>; - active-low; - label = "green:usb2"; - }; - - led@12 { - reg = <12>; - active-low; - label = "amber:internet"; - }; - - led@13 { - reg = <13>; - active-low; - label = "green:ethernet"; - }; - - led@14 { - reg = <14>; - active-low; - label = "amber:dsl"; - }; - - led@16 { - reg = <16>; - active-low; - label = "amber:usb1"; - }; - - led@17 { - reg = <17>; - active-low; - label = "amber:usb2"; - }; - - led@18 { - reg = <18>; - active-low; - label = "amber:ethernet"; - }; -}; - -&nflash { - status = "okay"; - - nandcs@0 { - compatible = "brcm,nandcs"; - #size-cells = <1>; - #address-cells = <1>; - reg = <0>; - nand-ecc-step-size = <512>; - nand-ecc-strength = <15>; - nand-on-flash-bbt; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "cferom"; - reg = <0x0000000 0x0004000>; - read-only; - }; - - partition@4000 { - compatible = "brcm,wfi"; - label = "wfi"; - reg = <0x0004000 0x1c7c000>; - brcm,cferam = "cfe"; - }; - - partition@1c80000 { - label = "flag"; - reg = <0x1c80000 0x0040000>; - read-only; - }; - - partition@1cc0000 { - label = "pcbasn"; - reg = <0x1cc0000 0x0040000>; - read-only; - }; - - partition@1d00000 { - label = "xxx"; - reg = <0x1d00000 0x0080000>; - read-only; - }; - - partition@1d80000 { - label = "language_dev"; - reg = <0x1d80000 0x0040000>; - read-only; - }; - - partition@1dc0000 { - label = "scnvram"; - reg = <0x1dc0000 0x0100000>; - read-only; - }; - }; - }; -}; - -&pinctrl { - pinctrl_leds: leds { - function = "led"; - pins = "gpio1"; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6362-sagem-fast-2504n.dts b/target/linux/bcm63xx/dts/bcm6362-sagem-fast-2504n.dts deleted file mode 100644 index 105e56a59692a0..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6362-sagem-fast-2504n.dts +++ /dev/null @@ -1,117 +0,0 @@ -#include "bcm6362.dtsi" - -#include -#include - -/ { - model = "Sagem F@st 2504N"; - compatible = "sagem,fast-2504n", "brcm,bcm6362"; - - aliases { - led-boot = &led_ok_green; - led-failsafe = &led_ok_green; - led-running = &led_ok_green; - led-upgrade = &led_ok_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 24 1>; - linux,code = ; - debounce-interval = <60>; - }; - - wps { - label = "wps"; - gpios = <&pinctrl 25 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - power_orange { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 2 1>; - }; - power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 10 1>; - default-state = "on"; - }; - inet_red { - label = "red:internet"; - gpios = <&pinctrl 26 1>; - }; - led_ok_green: ok_green { - label = "green:ok"; - gpios = <&pinctrl 28 1>; - }; - ok_orange { - label = "orange:ok"; - gpios = <&pinctrl 29 1>; - }; - wlan_orangee { - function = LED_FUNCTION_WLAN; - color = ; - gpios = <&pinctrl 30 1>; - }; - }; -}; - -&hsspi { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - spi-max-frequency = <20000000>; - spi-tx-bus-width = <2>; - spi-rx-bus-width = <2>; - reg = <0>; - - #address-cells = <1>; - #size-cells = <1>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - reg = <0x000000 0x010000>; - label = "cfe"; - read-only; - }; - - linux@10000 { - reg = <0x010000 0x7e0000>; - label = "linux"; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@7f0000 { - reg = <0x7f0000 0x010000>; - label = "nvram"; - }; - }; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6362.dtsi b/target/linux/bcm63xx/dts/bcm6362.dtsi deleted file mode 100644 index 0571b1e1ba48e0..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6362.dtsi +++ /dev/null @@ -1,321 +0,0 @@ -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - compatible = "brcm,bcm6362"; - - aliases { - nflash = &nflash; - pinctrl = &pinctrl; - serial0 = &uart0; - serial1 = &uart1; - spi0 = &lsspi; - spi1 = &hsspi; - }; - - cpus { - #address-cells = <1>; - #size-cells = <0>; - - cpu@0 { - compatible = "brcm,bmips4350", "mips,mips4Kc"; - device_type = "cpu"; - reg = <0>; - }; - - cpu@1 { - compatible = "brcm,bmips4350", "mips,mips4Kc"; - device_type = "cpu"; - reg = <1>; - }; - }; - - cpu_intc: interrupt-controller { - #address-cells = <0>; - compatible = "mti,cpu-interrupt-controller"; - - interrupt-controller; - #interrupt-cells = <1>; - }; - - memory { device_type = "memory"; reg = <0 0>; }; - - ubus@10000000 { - #address-cells = <1>; - #size-cells = <1>; - ranges; - compatible = "simple-bus"; - interrupt-parent = <&periph_intc>; - - ext_intc: interrupt-controller@10000018 { - compatible = "brcm,bcm6345-ext-intc"; - reg = <0x10000018 0x4>; - - interrupt-controller; - #interrupt-cells = <2>; - - interrupts = <40>, <41>, <42>, <43>; - }; - - periph_intc: interrupt-controller@10000020 { - compatible = "brcm,bcm6345-l1-intc"; - reg = <0x10000020 0x10>, - <0x10000030 0x10>; - - interrupt-controller; - #interrupt-cells = <1>; - - interrupt-parent = <&cpu_intc>; - interrupts = <2>, <3>; - }; - - pinctrl: pin-controller@10000080 { - compatible = "brcm,bcm6362-pinctrl"; - reg = <0x10000080 0x8>, - <0x10000088 0x8>, - <0x10000090 0x4>, - <0x10000098 0x4>, - <0x1000009c 0x4>, - <0x100000b8 0x4>; - reg-names = "dirout", "dat", "led", - "mode", "ctrl", "basemode"; - - gpio-controller; - #gpio-cells = <2>; - - interrupt-parent = <&ext_intc>; - interrupts = <0 0>, <1 0>, <2 0>, <3 0>; - interrupt-names = "gpio24", "gpio25", - "gpio26", "gpio27"; - - pinctrl_usb_device_led: usb_device_led { - function = "usb_device_led"; - pins = "gpio0"; - }; - - pinctrl_sys_irq: sys_irq { - function = "sys_irq"; - pins = "gpio1"; - }; - - pinctrl_serial_led: serial_led { - pinctrl_serial_led_clk: serial_led_clk { - function = "serial_led_clk"; - pins = "gpio2"; - }; - - pinctrl_serial_led_data: serial_led_data { - function = "serial_led_data"; - pins = "gpio3"; - }; - }; - - pinctrl_robosw_led_data: robosw_led_data { - function = "robosw_led_data"; - pins = "gpio4"; - }; - - pinctrl_robosw_led_clk: robosw_led_clk { - function = "robosw_led_clk"; - pins = "gpio5"; - }; - - pinctrl_robosw_led0: robosw_led0 { - function = "robosw_led0"; - pins = "gpio6"; - }; - - pinctrl_robosw_led1: robosw_led1 { - function = "robosw_led1"; - pins = "gpio7"; - }; - - pinctrl_inet_led: inet_led { - function = "inet_led"; - pins = "gpio8"; - }; - - pinctrl_spi_cs2: spi_cs2 { - function = "spi_cs2"; - pins = "gpio9"; - }; - - pinctrl_spi_cs3: spi_cs3 { - function = "spi_cs3"; - pins = "gpio10"; - }; - - pinctrl_ntr_pulse: ntr_pulse { - function = "ntr_pulse"; - pins = "gpio11"; - }; - - pinctrl_uart1_scts: uart1_scts { - function = "uart1_scts"; - pins = "gpio12"; - }; - - pinctrl_uart1_srts: uart1_srts { - function = "uart1_srts"; - pins = "gpio13"; - }; - - - pinctrl_uart1: uart1 { - pinctrl_uart1_sdin: uart1_sdin { - function = "uart1_sdin"; - pins = "gpio14"; - }; - - pinctrl_uart1_sdout: uart1_sdout { - function = "uart1_sdout"; - pins = "gpio15"; - }; - }; - - pinctrl_adsl_spi: adsl_spi { - pinctrl_adsl_spi_miso: adsl_spi_miso { - function = "adsl_spi_miso"; - pins = "gpio16"; - }; - - pinctrl_adsl_spi_mosi: adsl_spi_mosi { - function = "adsl_spi_mosi"; - pins = "gpio17"; - }; - - pinctrl_adsl_spi_clk: adsl_spi_clk { - function = "adsl_spi_clk"; - pins = "gpio18"; - }; - - pinctrl_adsl_spi_cs: adsl_spi_cs { - function = "adsl_spi_cs"; - pins = "gpio19"; - }; - }; - - pinctrl_ephy0_led: ephy0_led { - function = "ephy0_led"; - pins = "gpio20"; - }; - - pinctrl_ephy1_led: ephy1_led { - function = "ephy1_led"; - pins = "gpio21"; - }; - - pinctrl_ephy2_led: ephy2_led { - function = "ephy2_led"; - pins = "gpio22"; - }; - - pinctrl_ephy3_led: ephy3_led { - function = "ephy3_led"; - pins = "gpio23"; - }; - - pinctrl_ext_irq0: ext_irq0 { - function = "ext_irq0"; - pins = "gpio24"; - }; - - pinctrl_ext_irq1: ext_irq1 { - function = "ext_irq1"; - pins = "gpio25"; - }; - - pinctrl_ext_irq2: ext_irq2 { - function = "ext_irq2"; - pins = "gpio26"; - }; - - pinctrl_ext_irq3: ext_irq3 { - function = "ext_irq3"; - pins = "gpio27"; - }; - - pinctrl_nand: nand { - function = "nand"; - group = "nand_grp"; - }; - }; - - uart0: serial@10000100 { - compatible = "brcm,bcm6345-uart"; - reg = <0x10000100 0x18>; - - interrupt-parent = <&periph_intc>; - interrupts = <3>; - - /* clocks = <&periph_clk>; */ - /* clock-names = "refclk"; */ - - status = "disabled"; - }; - - uart1: serial@10000120 { - compatible = "brcm,bcm6345-uart"; - reg = <0x10000120 0x18>; - - interrupt-parent = <&periph_intc>; - interrupts = <4>; - - /* clocks = <&periph_clk>; */ - /* clock-names = "refclk"; */ - - status = "disabled"; - }; - - lsspi: spi@10000800 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "brcm,bcm6358-spi"; - reg = <0x10000800 0x70c>; - interrupts = <2>; - /* clocks = <&clkctl 15>; */ - }; - - hsspi: spi@10001000 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "brcm,bcm6328-hsspi"; - reg = <0x10001000 0x600>; - interrupts = <5>; - /* clocks = <&clkctl 16>; */ - }; - - nflash: nand@10000200 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "brcm,nand-bcm6368", - "brcm,brcmnand-v2.2", - "brcm,brcmnand"; - reg = <0x10000200 0x180>, - <0x10000600 0x200>, - <0x10000070 0x10>; - reg-names = "nand", - "nand-cache", - "nand-int-base"; - - interrupt-parent = <&periph_intc>; - interrupts = <12>; - - /* clocks = <&clkctl 20>; */ - - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_nand>; - - status = "disabled"; - }; - - leds: led-controller@10001900 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "brcm,bcm6328-leds"; - reg = <0x10001900 0x24>; - status = "disabled"; - }; - }; -}; diff --git a/target/linux/bcm63xx/dts/bcm6368-actiontec-r1000h.dts b/target/linux/bcm63xx/dts/bcm6368-actiontec-r1000h.dts deleted file mode 100644 index 3fe1693331a3e6..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6368-actiontec-r1000h.dts +++ /dev/null @@ -1,119 +0,0 @@ -#include "bcm6368.dtsi" - -#include -#include - -/ { - model = "Actiontec R1000H"; - compatible = "actiontec,r1000h", "brcm,bcm6368"; - - aliases { - led-boot = &led_power_green; - led-failsafe = &led_power_green; - led-running = &led_power_green; - led-upgrade = &led_power_green; - }; - - chosen { - bootargs = "rootfstype=squashfs noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 34 1>; - linux,code = ; - debounce-interval = <60>; - }; - - wps { - label = "wps"; - gpios = <&pinctrl 35 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - inet_green { - label = "green:inet"; - gpios = <&pinctrl 5 0>; - }; - - usb_green { - function = LED_FUNCTION_USB; - color = ; - gpios = <&pinctrl 21 1>; - }; - - led_power_green: power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 22 0>; - default-state = "on"; - }; - - wps_green { - function = LED_FUNCTION_WPS; - color = ; - gpios = <&pinctrl 23 1>; - }; - - power_red { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 24 0>; - }; - - wps_red { - function = LED_FUNCTION_WPS; - color = ; - gpios = <&pinctrl 30 1>; - }; - - inet_red { - label = "red:inet"; - gpios = <&pinctrl 31 0>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - CFE@0 { - reg = <0x000000 0x020000>; - read-only; - }; - - linux@20000 { - reg = <0x020000 0x1fc0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@1fe0000 { - reg = <0x1fe0000 0x20000>; - }; - }; -}; - -&uart0 { - status = "okay"; -}; - -&uart1 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6368-adb-av4202n.dts b/target/linux/bcm63xx/dts/bcm6368-adb-av4202n.dts deleted file mode 100644 index 45046f326a96e2..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6368-adb-av4202n.dts +++ /dev/null @@ -1,117 +0,0 @@ -#include "bcm6368.dtsi" - -#include -#include -#include - -/ { - model = "ADB P.DG AV4202N"; - compatible = "adb,av4202n", "brcm,bcm6368"; - - aliases { - led-boot = &led_power_white; - led-failsafe = &led_power_white; - led-running = &led_power_white; - led-upgrade = &led_power_white; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 34 GPIO_ACTIVE_LOW>; - linux,code = ; - debounce-interval = <60>; - }; - - wlan { - label = "wlan"; - gpios = <&pinctrl 37 GPIO_ACTIVE_LOW>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - led_power_white: power_white { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 10 GPIO_ACTIVE_LOW>; - default-state = "on"; - }; - power_red { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 11 GPIO_ACTIVE_LOW>; - }; - wan_white { - function = LED_FUNCTION_WAN; - color = ; - gpios = <&pinctrl 26 GPIO_ACTIVE_LOW>; - }; - wan_red { - function = LED_FUNCTION_WAN; - color = ; - gpios = <&pinctrl 27 GPIO_ACTIVE_LOW>; - }; - phone_white { - label = "white:phone"; - gpios = <&pinctrl 24 GPIO_ACTIVE_LOW>; - }; - phone_red { - label = "red:phone"; - gpios = <&pinctrl 25 GPIO_ACTIVE_LOW>; - }; - wifi { - label = "blue:wifi"; - gpios = <&pinctrl 22 GPIO_ACTIVE_LOW>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x020000>; - read-only; - }; - - linux@20000 { - label = "linux"; - reg = <0x020000 0xfc0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@fe0000 { - label = "nvram"; - reg = <0xfe0000 0x020000>; - }; - }; -}; - -&pinctrl { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_pci>; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6368-brcm-bcm96368mvngr.dts b/target/linux/bcm63xx/dts/bcm6368-brcm-bcm96368mvngr.dts deleted file mode 100644 index 6160ab636e64e8..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6368-brcm-bcm96368mvngr.dts +++ /dev/null @@ -1,59 +0,0 @@ -#include "bcm6368.dtsi" - -#include -#include - -/ { - model = "Broadcom BCM96368MVNgr reference board"; - compatible = "brcm,bcm96368mvngr", "brcm,bcm6368"; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - leds { - compatible = "gpio-leds"; - - dsl_green { - label = "green:adsl"; - gpios = <&pinctrl 2 1>; - }; - inet_fail_green { - label = "green:inet-fail"; - gpios = <&pinctrl 3 0>; - }; - inet_green { - label = "green:inet"; - gpios = <&pinctrl 5 0>; - }; - power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 22 0>; - default-state = "on"; - }; - wps_green { - function = LED_FUNCTION_WPS; - color = ; - gpios = <&pinctrl 23 1>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "brcm,bcm963xx-cfe-nor-partitions"; - }; -}; - -&pinctrl { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_pci>; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6368-brcm-bcm96368mvwg.dts b/target/linux/bcm63xx/dts/bcm6368-brcm-bcm96368mvwg.dts deleted file mode 100644 index 10f98511c0cdc2..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6368-brcm-bcm96368mvwg.dts +++ /dev/null @@ -1,59 +0,0 @@ -#include "bcm6368.dtsi" - -#include -#include - -/ { - model = "Broadcom BCM96368MVWG reference board"; - compatible = "brcm,bcm96368mvwg", "brcm,bcm6368"; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - leds { - compatible = "gpio-leds"; - - dsl_green { - label = "green:adsl"; - gpios = <&pinctrl 2 1>; - }; - ppp_green { - label = "green:ppp"; - gpios = <&pinctrl 5 0>; - }; - power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 22 0>; - default-state = "on"; - }; - wps_green { - function = LED_FUNCTION_WPS; - color = ; - gpios = <&pinctrl 23 1>; - }; - ppp_fail_red { - label = "red:ppp-fail"; - gpios = <&pinctrl 31 0>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "brcm,bcm963xx-cfe-nor-partitions"; - }; -}; - -&pinctrl { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_pci>; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6368-comtrend-vr-3025u.dts b/target/linux/bcm63xx/dts/bcm6368-comtrend-vr-3025u.dts deleted file mode 100644 index 12195de8013406..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6368-comtrend-vr-3025u.dts +++ /dev/null @@ -1,100 +0,0 @@ -#include "bcm6368.dtsi" - -#include -#include - -/ { - model = "Comtrend VR-3025u"; - compatible = "comtrend,vr-3025u", "brcm,bcm6368"; - - aliases { - led-boot = &led_power_green; - led-failsafe = &led_power_green; - led-running = &led_power_green; - led-upgrade = &led_power_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 34 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - dsl_green { - label = "green:dsl"; - gpios = <&pinctrl 2 1>; - }; - inet_green { - label = "green:inet"; - gpios = <&pinctrl 5 0>; - }; - led_power_green: power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 22 0>; - default-state = "on"; - }; - power_red { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 24 0>; - }; - inet_red { - label = "red:inet"; - gpios = <&pinctrl 31 0>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x0000000 0x0020000>; - read-only; - }; - - linux@20000 { - label = "linux"; - reg = <0x0020000 0x1fc0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@1fe0000 { - label = "nvram"; - reg = <0x1fe0000 0x020000>; - }; - }; -}; - -&pinctrl { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_pci &pinctrl_ephy0_led &pinctrl_ephy1_led - &pinctrl_ephy2_led &pinctrl_ephy3_led>; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6368-comtrend-vr-3025un.dts b/target/linux/bcm63xx/dts/bcm6368-comtrend-vr-3025un.dts deleted file mode 100644 index 6a17c49d120b9e..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6368-comtrend-vr-3025un.dts +++ /dev/null @@ -1,100 +0,0 @@ -#include "bcm6368.dtsi" - -#include -#include - -/ { - model = "Comtrend VR-3025un"; - compatible = "comtrend,vr-3025un", "brcm,bcm6368"; - - aliases { - led-boot = &led_power_green; - led-failsafe = &led_power_green; - led-running = &led_power_green; - led-upgrade = &led_power_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 34 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - dsl_green { - label = "green:dsl"; - gpios = <&pinctrl 2 1>; - }; - inet_green { - label = "green:inet"; - gpios = <&pinctrl 5 0>; - }; - led_power_green: power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 22 0>; - default-state = "on"; - }; - power_red { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 24 0>; - }; - inet_red { - label = "red:inet"; - gpios = <&pinctrl 31 0>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x010000>; - read-only; - }; - - linux@10000 { - label = "linux"; - reg = <0x010000 0x7e0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@7f0000 { - label = "nvram"; - reg = <0x7f0000 0x010000>; - }; - }; -}; - -&pinctrl { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_pci &pinctrl_ephy0_led &pinctrl_ephy1_led - &pinctrl_ephy2_led &pinctrl_ephy3_led>; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6368-comtrend-vr-3026e.dts b/target/linux/bcm63xx/dts/bcm6368-comtrend-vr-3026e.dts deleted file mode 100644 index b56f693243145e..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6368-comtrend-vr-3026e.dts +++ /dev/null @@ -1,100 +0,0 @@ -#include "bcm6368.dtsi" - -#include -#include - -/ { - model = "Comtrend VR-3026e"; - compatible = "comtrend,vr-3026e", "brcm,bcm6368"; - - aliases { - led-boot = &led_power_green; - led-failsafe = &led_power_green; - led-running = &led_power_green; - led-upgrade = &led_power_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 34 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - dsl_green { - label = "green:dsl"; - gpios = <&pinctrl 2 1>; - }; - inet_green { - label = "green:inet"; - gpios = <&pinctrl 5 0>; - }; - led_power_green: power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 22 0>; - default-state = "on"; - }; - power_red { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 24 0>; - }; - inet_red { - label = "red:inet"; - gpios = <&pinctrl 31 0>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x010000>; - read-only; - }; - - linux@10000 { - label = "linux"; - reg = <0x010000 0x7e0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@7f0000 { - label = "nvram"; - reg = <0x7f0000 0x010000>; - }; - }; -}; - -&pinctrl { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_pci &pinctrl_ephy0_led &pinctrl_ephy1_led - &pinctrl_ephy2_led &pinctrl_ephy3_led>; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6368-huawei-echolife-hg622.dts b/target/linux/bcm63xx/dts/bcm6368-huawei-echolife-hg622.dts deleted file mode 100644 index 89c9c26032d6ee..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6368-huawei-echolife-hg622.dts +++ /dev/null @@ -1,99 +0,0 @@ -#include "bcm6368.dtsi" - -#include -#include - -/ { - model = "Huawei EchoLife HG622"; - compatible = "huawei,echolife-hg622", "brcm,bcm6368"; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 34 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - dsl_green { - label = "green:dsl"; - gpios = <&pinctrl 2 1>; - }; - inet_green { - label = "green:inet"; - gpios = <&pinctrl 5 1>; - }; - usb_green { - function = LED_FUNCTION_USB; - color = ; - gpios = <&pinctrl 11 1>; - }; - power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 22 1>; - default-state = "on"; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x020000>; - read-only; - }; - - linux@20000 { - label = "linux"; - reg = <0x020000 0xf80000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - cal_data@fa0000 { - label = "cal_data"; - reg = <0xfa0000 0x020000>; - read-only; - }; - - nvram@fe0000 { - label = "nvram"; - reg = <0xfe0000 0x020000>; - }; - }; -}; - -&pinctrl { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_ephy0_led &pinctrl_ephy1_led - &pinctrl_ephy2_led &pinctrl_ephy3_led - &pinctrl_pci_gnt0 &pinctrl_pci_req0 - &pinctrl_pci_intb &pinctrl_pci_gnt1 - &pinctrl_pci_req1>; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6368-huawei-echolife-hg655b.dts b/target/linux/bcm63xx/dts/bcm6368-huawei-echolife-hg655b.dts deleted file mode 100644 index 778753558d4b78..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6368-huawei-echolife-hg655b.dts +++ /dev/null @@ -1,130 +0,0 @@ -#include "bcm6368.dtsi" - -#include -#include - -/ { - model = "Huawei EchoLife HG655b"; - compatible = "huawei,echolife-hg655b", "brcm,bcm6368"; - - aliases { - led-boot = &led_power_green; - led-failsafe = &led_power_green; - led-running = &led_power_green; - led-upgrade = &led_power_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - wps { - label = "wps"; - gpios = <&pinctrl 12 1>; - linux,code = ; - debounce-interval = <60>; - }; - - wlan { - label = "wlan"; - gpios = <&pinctrl 23 1>; - linux,code = ; - debounce-interval = <60>; - }; - - reset { - label = "reset"; - gpios = <&pinctrl 34 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - dsl_green { - label = "green:dsl"; - gpios = <&pinctrl 2 1>; - }; - internet_green { - label = "green:internet"; - gpios = <&pinctrl 5 1>; - }; - - usb_green { - function = LED_FUNCTION_USB; - color = ; - gpios = <&pinctrl 14 1>; - }; - led_power_green: power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 22 1>; - default-state = "on"; - }; - voip_green { - label = "green:voip"; - gpios = <&pinctrl 25 1>; - }; - wps_green { - function = LED_FUNCTION_WPS; - color = ; - gpios = <&pinctrl 27 1>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x020000>; - }; - - linux@20000 { - label = "linux"; - reg = <0x020000 0x770000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - board_data@790000 { - label = "board_data"; - reg = <0x790000 0x030000>; - }; - - cal_data@7c0000 { - label = "cal_data"; - reg = <0x7c0000 0x020000>; - read-only; - }; - - nvram@7d0000 { - label = "nvram"; - reg = <0x7e0000 0x020000>; - }; - }; -}; - -&pinctrl { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_pci &pinctrl_ephy0_led &pinctrl_ephy1_led - &pinctrl_ephy2_led &pinctrl_ephy3_led>; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6368-netgear-dgnd3700-v1.dts b/target/linux/bcm63xx/dts/bcm6368-netgear-dgnd3700-v1.dts deleted file mode 100644 index b1053903f2d446..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6368-netgear-dgnd3700-v1.dts +++ /dev/null @@ -1,221 +0,0 @@ -#include "bcm6368.dtsi" - -#include -#include - -/ { - model = "Netgear DGND3700v1/DGND3800B"; - compatible = "netgear,dgnd3700-v1", "brcm,bcm6368"; - - aliases { - led-boot = &led_power_green; - led-failsafe = &led_power_green; - led-running = &led_power_green; - led-upgrade = &led_power_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - wlan { - label = "wlan"; - gpios = <&pinctrl 10 1>; - linux,code = ; - debounce-interval = <60>; - }; - - reset { - label = "reset"; - gpios = <&pinctrl 12 1>; - linux,code = ; - debounce-interval = <60>; - }; - - wps { - label = "wps"; - gpios = <&pinctrl 35 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - dsl_green { - label = "green:dsl"; - gpios = <&pinctrl 2 1>; - }; - inet_red { - label = "red:inet"; - gpios = <&pinctrl 4 1>; - }; - inet_green { - label = "green:inet"; - gpios = <&pinctrl 5 1>; - }; - wps_green { - function = LED_FUNCTION_WPS; - color = ; - gpios = <&pinctrl 11 1>; - }; - usbfront_green { - label = "green:usb-front"; - gpios = <&pinctrl 13 1>; - }; - usbback_green { - label = "green:usb-back"; - gpios = <&pinctrl 14 1>; - }; - power_red { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 22 1>; - }; - lan_green { - function = LED_FUNCTION_LAN; - color = ; - gpios = <&pinctrl 23 1>; - }; - led_power_green: power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 24 1>; - default-state = "on"; - }; - wifi2g_green { - label = "green:wifi2g"; - gpios = <&pinctrl 26 1>; - }; - wifi5g_blue { - label = "blue:wifi5g"; - gpios = <&pinctrl 27 1>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x020000>; - read-only; - }; - - linux@20000 { - label = "linux"; - reg = <0x020000 0x1e20000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - board_data@1e40000 { - label = "board_data"; - reg = <0x1e40000 0x1a0000>; - read-only; - }; - - nvram@1fe0000 { - label = "nvram"; - reg = <0x1fe0000 0x20000>; - }; - }; -}; - -&pinctrl { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_pci>; -}; - -&lsspi { - switch@1 { - compatible = "brcm,bcm53115"; - reg = <1>; - spi-max-frequency = <781000>; - - lede,alias = "eth0"; - - ports { - #address-cells = <1>; - #size-cells = <0>; - - wan@0 { - reg = <0>; - label = "wan"; - }; - - lan@1 { - reg = <1>; - label = "lan4"; - }; - - lan@2 { - reg = <2>; - label = "lan3"; - }; - - lan@3 { - reg = <3>; - label = "lan2"; - }; - - lan@4 { - reg = <4>; - label = "lan1"; - }; - - cpu@8 { - reg = <8>; - label = "cpu"; - - fixed-link { - speed = <1000>; - full-duplex; - }; - }; - }; - }; -}; - -&nflash { - status = "okay"; - - nandcs@0 { - compatible = "brcm,nandcs"; - #size-cells = <1>; - #address-cells = <1>; - reg = <0>; - nand-ecc-step-size = <512>; - nand-ecc-strength = <15>; - nand-on-flash-bbt; - brcm,nand-oob-sector-size = <64>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "storage"; - reg = <0x0000000 0x8000000>; - }; - }; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6368-observa-vh4032n.dts b/target/linux/bcm63xx/dts/bcm6368-observa-vh4032n.dts deleted file mode 100644 index 7e018584a16fef..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6368-observa-vh4032n.dts +++ /dev/null @@ -1,126 +0,0 @@ -#include "bcm6368.dtsi" - -#include -#include - -/ { - model = "Observa VH4032N"; - compatible = "observa,vh4032n", "brcm,bcm6368"; - - aliases { - led-boot = &led_power_blue; - led-failsafe = &led_power_blue; - led-running = &led_power_blue; - led-upgrade = &led_power_blue; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 34 1>; - linux,code = ; - debounce-interval = <60>; - }; - - wlan { - label = "wlan"; - gpios = <&pinctrl 35 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - dsl_blue { - label = "blue:dsl"; - gpios = <&pinctrl 2 1>; - }; - dsl_red { - label = "red:dsl"; - gpios = <&pinctrl 5 1>; - }; - hspa_blue { - label = "blue:hspa"; - gpios = <&pinctrl 11 1>; - }; - hspa_red { - label = "red:hspa"; - gpios = <&pinctrl 12 1>; - }; - led_power_blue: power_blue { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 22 0>; - default-state = "on"; - }; - power_red { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 24 0>; - }; - voice_blue { - label = "blue:voice"; - gpios = <&pinctrl 25 1>; - }; - voice_red { - label = "red:voice"; - gpios = <&pinctrl 26 1>; - }; - }; -}; - -&pinctrl { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_pci &pinctrl_ephy0_led &pinctrl_ephy1_led - &pinctrl_ephy2_led &pinctrl_ephy3_led>; - - usb_hub_reset { - gpio-hog; - gpios = <27 0>; - output-high; - line-name = "usb-hub-reset-gpio"; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x0000000 0x0020000>; - read-only; - }; - - linux@20000 { - label = "linux"; - reg = <0x0020000 0x1fc0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@1fe0000 { - label = "nvram"; - reg = <0x1fe0000 0x020000>; - }; - }; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6368-zyxel-p870hw-51a-v2.dts b/target/linux/bcm63xx/dts/bcm6368-zyxel-p870hw-51a-v2.dts deleted file mode 100644 index 6118cd81117ec2..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6368-zyxel-p870hw-51a-v2.dts +++ /dev/null @@ -1,106 +0,0 @@ -#include "bcm6368.dtsi" - -#include -#include - -/ { - model = "Zyxel P870HW-51a v2"; - compatible = "zyxel,p870hw-51a-v2", "brcm,bcm6368"; - - aliases { - led-boot = &led_power_green; - led-failsafe = &led_power_green; - led-running = &led_power_green; - led-upgrade = &led_power_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 35 1>; - linux,code = ; - debounce-interval = <60>; - }; - - wps { - label = "wps"; - gpios = <&pinctrl 36 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - led_power_green: power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 0 0>; - default-state = "on"; - }; - dsl_green { - label = "green:dsl"; - gpios = <&pinctrl 2 1>; - }; - inet_green { - label = "green:inet"; - gpios = <&pinctrl 22 1>; - }; - wps_orange { - function = LED_FUNCTION_WPS; - color = ; - gpios = <&pinctrl 24 1>; - }; - inet_red { - label = "red:inet"; - gpios = <&pinctrl 33 1>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x010000>; - read-only; - }; - - linux@10000 { - label = "linux"; - reg = <0x010000 0x3e0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@3f0000 { - label = "nvram"; - reg = <0x3f0000 0x010000>; - }; - }; -}; - -&pinctrl { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_pci>; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6368.dtsi b/target/linux/bcm63xx/dts/bcm6368.dtsi deleted file mode 100644 index 0e9610dbc56d2f..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6368.dtsi +++ /dev/null @@ -1,343 +0,0 @@ -/dts-v1/; - -/ { - #address-cells = <1>; - #size-cells = <1>; - compatible = "brcm,bcm6368"; - - aliases { - nflash = &nflash; - pflash = &pflash; - pinctrl = &pinctrl; - serial0 = &uart0; - serial1 = &uart1; - spi0 = &lsspi; - }; - - cpus { - #address-cells = <1>; - #size-cells = <0>; - - cpu@0 { - compatible = "brcm,bmips4350", "mips,mips4Kc"; - device_type = "cpu"; - reg = <0>; - }; - - cpu@1 { - compatible = "brcm,bmips4350", "mips,mips4Kc"; - device_type = "cpu"; - reg = <1>; - }; - }; - - cpu_intc: interrupt-controller { - #address-cells = <0>; - compatible = "mti,cpu-interrupt-controller"; - - interrupt-controller; - #interrupt-cells = <1>; - }; - - memory { device_type = "memory"; reg = <0 0>; }; - - ubus@10000000 { - #address-cells = <1>; - #size-cells = <1>; - ranges; - compatible = "simple-bus"; - interrupt-parent = <&periph_intc>; - - ext_intc0: interrupt-controller@10000018 { - compatible = "brcm,bcm6345-ext-intc"; - reg = <0x10000018 0x4>; - - interrupt-controller; - #interrupt-cells = <2>; - - interrupts = <20>, <21>, <22>, <23>; - }; - - ext_intc1: interrupt-controller@1000001c { - compatible = "brcm,bcm6345-ext-intc"; - reg = <0x1000001c 0x4>; - - interrupt-controller; - #interrupt-cells = <2>; - - interrupts = <24>, <25>; - }; - - periph_intc: interrupt-controller@10000020 { - compatible = "brcm,bcm6345-l1-intc"; - reg = <0x10000020 0x10>, - <0x10000030 0x10>; - - interrupt-controller; - #interrupt-cells = <1>; - - interrupt-parent = <&cpu_intc>; - interrupts = <2>, <3>; - }; - - pinctrl: pin-controller@10000080 { - compatible = "brcm,bcm6368-pinctrl"; - reg = <0x10000080 0x8>, - <0x10000088 0x8>, - <0x10000098 0x4>; - reg-names = "dirout", "dat", "mode"; - brcm,gpiobasemode = <&gpiobasemode>; - - gpio-controller; - #gpio-cells = <2>; - - interrupts-extended = <&ext_intc1 0 0>, - <&ext_intc1 1 0>, - <&ext_intc0 0 0>, - <&ext_intc0 1 0>, - <&ext_intc0 2 0>, - <&ext_intc0 3 0>; - interrupt-names = "gpio32", "gpio33", "gpio34", "gpio35", - "gpio36", "gpio37"; - - pinctrl_analog_afe_0: analog_afe_0 { - function = "analog_afe_0"; - pins = "gpio0"; - }; - - pinctrl_analog_afe_1: analog_afe_1 { - function = "analog_afe_1"; - pins = "gpio1"; - }; - - pinctrl_sys_irq: sys_irq { - function = "sys_irq"; - pins = "gpio2"; - }; - - pinctrl_serial_led: serial_led { - pinctrl_serial_led_data: serial_led_data { - function = "serial_led_data"; - pins = "gpio3"; - }; - - pinctrl_serial_led_clk: serial_led_clk { - function = "serial_led_clk"; - pins = "gpio4"; - }; - }; - - pinctrl_inet_led: inet_led { - function = "inet_led"; - pins = "gpio5"; - }; - - pinctrl_ephy0_led: ephy0_led { - function = "ephy0_led"; - pins = "gpio6"; - }; - - pinctrl_ephy1_led: ephy1_led { - function = "ephy1_led"; - pins = "gpio7"; - }; - - pinctrl_ephy2_led: ephy2_led { - function = "ephy2_led"; - pins = "gpio8"; - }; - - pinctrl_ephy3_led: ephy3_led { - function = "ephy3_led"; - pins = "gpio9"; - }; - - pinctrl_robosw_led_data: robosw_led_data { - function = "robosw_led_data"; - pins = "gpio10"; - }; - - pinctrl_robosw_led_clk: robosw_led_clk { - function = "robosw_led_clk"; - pins = "gpio11"; - }; - - pinctrl_robosw_led0: robosw_led0 { - function = "robosw_led0"; - pins = "gpio12"; - }; - - pinctrl_robosw_led1: robosw_led1 { - function = "robosw_led1"; - pins = "gpio13"; - }; - - pinctrl_usb_device_led: usb_device_led { - function = "usb_device_led"; - pins = "gpio14"; - }; - - pinctrl_pci: pci { - pinctrl_pci_req1: pci_req1 { - function = "pci_req1"; - pins = "gpio16"; - }; - - pinctrl_pci_gnt1: pci_gnt1 { - function = "pci_gnt1"; - pins = "gpio17"; - }; - - pinctrl_pci_intb: pci_intb { - function = "pci_intb"; - pins = "gpio18"; - }; - - pinctrl_pci_req0: pci_req0 { - function = "pci_req0"; - pins = "gpio19"; - }; - - pinctrl_pci_gnt0: pci_gnt0 { - function = "pci_gnt0"; - pins = "gpio20"; - }; - }; - - pinctrl_pcmcia: pcmcia { - pinctrl_pcmcia_cd1: pcmcia_cd1 { - function = "pcmcia_cd1"; - pins = "gpio22"; - }; - - pinctrl_pcmcia_cd2: pcmcia_cd2 { - function = "pcmcia_cd2"; - pins = "gpio23"; - }; - - pinctrl_pcmcia_vs1: pcmcia_vs1 { - function = "pcmcia_vs1"; - pins = "gpio24"; - }; - - pinctrl_pcmcia_vs2: pcmcia_vs2 { - function = "pcmcia_vs2"; - pins = "gpio25"; - }; - }; - - pinctrl_ebi_cs2: ebi_cs2 { - function = "ebi_cs2"; - pins = "gpio26"; - }; - - pinctrl_ebi_cs3: ebi_cs3 { - function = "ebi_cs2"; - pins = "gpio27"; - }; - - pinctrl_spi_cs2: spi_cs2 { - function = "spi_cs2"; - pins = "gpio28"; - }; - - pinctrl_spi_cs3: spi_cs3 { - function = "spi_cs3"; - pins = "gpio29"; - }; - - pinctrl_spi_cs4: spi_cs4 { - function = "spi_cs4"; - pins = "gpio30"; - }; - - pinctrl_spi_cs5: spi_cs5 { - function = "spi_cs5"; - pins = "gpio31"; - }; - - pinctrl_uart1: uart1 { - function = "uart1"; - group = "uart1_grp"; - }; - }; - - gpiobasemode: gpiobasemode@100000b8 { - compatible = "brcm,bcm6368-gpiobasemode", "syscon"; - reg = <0x100000b8 0x4>; - }; - - leds: led-controller@100000d0 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "brcm,bcm6358-leds"; - reg = <0x100000d0 0x8>; - status = "disabled"; - }; - - uart0: serial@10000100 { - compatible = "brcm,bcm6345-uart"; - reg = <0x10000100 0x18>; - - interrupt-parent = <&periph_intc>; - interrupts = <2>; - - /* clocks = <&periph_clk>; */ - /* clock-names = "refclk"; */ - - status = "disabled"; - }; - - uart1: serial@10000120 { - compatible = "brcm,bcm6345-uart"; - reg = <0x10000120 0x18>; - - interrupt-parent = <&periph_intc>; - interrupts = <3>; - - /* clocks = <&periph_clk>; */ - /* clock-names = "refclk"; */ - - status = "disabled"; - }; - - nflash: nand@10000200 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "brcm,nand-bcm6368", - "brcm,brcmnand-v2.1", - "brcm,brcmnand"; - reg = <0x10000200 0x180>, - <0x10000600 0x200>, - <0x10000070 0x10>; - reg-names = "nand", - "nand-cache", - "nand-int-base"; - - interrupt-parent = <&periph_intc>; - interrupts = <10>; - - /* clocks = <&clkctl 17>; */ - - status = "disabled"; - }; - - lsspi: spi@10000800 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "brcm,bcm6358-spi"; - reg = <0x10000800 0x70c>; - interrupts = <1>; - /* clocks = <&clkctl 9>; */ - }; - }; - - pflash: nor@18000000 { - compatible = "cfi-flash"; - reg = <0x18000000 0x2000000>; - bank-width = <2>; - #address-cells = <1>; - #size-cells = <1>; - status = "disabled"; - }; -}; diff --git a/target/linux/bcm63xx/dts/bcm6369-comtrend-wap-5813n.dts b/target/linux/bcm63xx/dts/bcm6369-comtrend-wap-5813n.dts deleted file mode 100644 index a25ce69f00e7a6..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6369-comtrend-wap-5813n.dts +++ /dev/null @@ -1,166 +0,0 @@ -#include "bcm6368.dtsi" - -#include -#include - -/ { - model = "Comtrend WAP-5813n"; - compatible = "comtrend,wap-5813n", "brcm,bcm6369", "brcm,bcm6368"; - - aliases { - led-boot = &led_power_green; - led-failsafe = &led_power_green; - led-running = &led_power_green; - led-upgrade = &led_power_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - wlan { - label = "wlan"; - gpios = <&pinctrl 32 1>; - linux,code = ; - debounce-interval = <60>; - }; - - reset { - label = "reset"; - gpios = <&pinctrl 34 1>; - linux,code = ; - debounce-interval = <60>; - }; - - wps { - label = "wps"; - gpios = <&pinctrl 35 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - inet_green { - label = "green:inet"; - gpios = <&pinctrl 5 0>; - }; - led_power_green: power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 22 0>; - default-state = "on"; - }; - wps_green { - function = LED_FUNCTION_WPS; - color = ; - gpios = <&pinctrl 23 1>; - }; - power_red { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 24 0>; - }; - inet_red { - label = "red:inet"; - gpios = <&pinctrl 31 0>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x000000 0x010000>; - read-only; - }; - - linux@10000 { - label = "linux"; - reg = <0x010000 0x7e0000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - nvram@7f0000 { - label = "nvram"; - reg = <0x7f0000 0x010000>; - }; - }; -}; - -&lsspi { - switch@0 { - compatible = "brcm,bcm53115"; - reg = <0>; - spi-max-frequency = <781000>; - - lede,alias = "eth0"; - - ports { - #address-cells = <1>; - #size-cells = <0>; - - lan@0 { - reg = <0>; - label = "lan4"; - }; - - lan@1 { - reg = <1>; - label = "lan3"; - }; - - lan@2 { - reg = <2>; - label = "lan2"; - }; - - lan@3 { - reg = <3>; - label = "lan1"; - }; - - wan@4 { - reg = <4>; - label = "wan"; - }; - - cpu@5 { - reg = <5>; - label = "cpu"; - - fixed-link { - speed = <1000>; - full-duplex; - asym-pause; - pause; - }; - }; - }; - }; -}; - -&pinctrl { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_pci>; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/dts/bcm6369-netgear-evg2000.dts b/target/linux/bcm63xx/dts/bcm6369-netgear-evg2000.dts deleted file mode 100644 index 3e9d9e873cab0f..00000000000000 --- a/target/linux/bcm63xx/dts/bcm6369-netgear-evg2000.dts +++ /dev/null @@ -1,135 +0,0 @@ -#include "bcm6368.dtsi" - -#include -#include - -/ { - model = "Netgear EVG2000"; - compatible = "netgear,evg2000", "brcm,bcm6369", "brcm,bcm6368"; - - aliases { - led-boot = &led_power_green; - led-failsafe = &led_power_green; - led-running = &led_power_green; - led-upgrade = &led_power_green; - }; - - chosen { - bootargs = "rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"; - stdout-path = "serial0:115200n8"; - }; - - keys { - compatible = "gpio-keys-polled"; - #address-cells = <1>; - #size-cells = <0>; - poll-interval = <20>; - - reset { - label = "reset"; - gpios = <&pinctrl 25 1>; - linux,code = ; - debounce-interval = <60>; - }; - - wps { - label = "wps"; - gpios = <&pinctrl 26 1>; - linux,code = ; - debounce-interval = <60>; - }; - }; - - leds { - compatible = "gpio-leds"; - - voip1_green { - label = "green:voip1"; - gpios = <&pinctrl 14 1>; - }; - voip2_green { - label = "green:voip2"; - gpios = <&pinctrl 2 1>; - }; - inet_red { - label = "red:inet"; - gpios = <&pinctrl 4 1>; - }; - inet_green { - label = "green:inet"; - gpios = <&pinctrl 5 1>; - }; - usb_green { - function = LED_FUNCTION_USB; - color = ; - gpios = <&pinctrl 15 1>; - }; - led_power_green: power_green { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 22 1>; - default-state = "on"; - }; - power_red { - function = LED_FUNCTION_POWER; - color = ; - gpios = <&pinctrl 23 1>; - }; - lan_green { - function = LED_FUNCTION_LAN; - color = ; - gpios = <&pinctrl 24 1>; - }; - wireless_green { - label = "green:wireless"; - gpios = <&pinctrl 26 1>; - }; - wan_green { - function = LED_FUNCTION_WAN; - color = ; - gpios = <&pinctrl 27 1>; - }; - }; -}; - -&pflash { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - cfe@0 { - label = "CFE"; - reg = <0x00000000 0x00020000>; - read-only; - }; - - linux@20000 { - label = "linux"; - reg = <0x00020000 0x00f40000>; - compatible = "brcm,bcm963xx-imagetag"; - }; - - board_data@f60000 { - label = "board_data"; - reg = <0x00f60000 0x00080000>; - read-only; - }; - - nvram@fe0000 { - label = "nvram"; - reg = <0x00fe0000 0x00020000>; - }; - }; -}; - -&pinctrl { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_pci>; -}; - -&uart0 { - status = "okay"; -}; diff --git a/target/linux/bcm63xx/generic/target.mk b/target/linux/bcm63xx/generic/target.mk deleted file mode 100644 index d43a37c2a81e9a..00000000000000 --- a/target/linux/bcm63xx/generic/target.mk +++ /dev/null @@ -1,7 +0,0 @@ -BOARDNAME:=generic - -define Target/Description - Build firmware images for BCM63XX boards without SMP support. -endef - - diff --git a/target/linux/bcm63xx/image/Makefile b/target/linux/bcm63xx/image/Makefile deleted file mode 100644 index 45b526878d0eb3..00000000000000 --- a/target/linux/bcm63xx/image/Makefile +++ /dev/null @@ -1,321 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -# -# Copyright (C) 2006-2015 OpenWrt.org -# Copyright (C) 2016 LEDE project - -include $(TOPDIR)/rules.mk -include $(INCLUDE_DIR)/image.mk - -KERNEL_LOADADDR = 0x80010000 # RAM start + 64K -LOADER_ENTRY = 0x80a00000 # RAM start + 10M, for relocate -LZMA_TEXT_START = 0x81800000 # RAM start + 24M - -RELOCATE_MAKEOPTS= \ - CACHELINE_SIZE=16 \ - KERNEL_ADDR=$(KERNEL_LOADADDR) \ - CROSS_COMPILE=$(TARGET_CROSS) \ - LZMA_TEXT_START=$(LOADER_ENTRY) - -define Build/Compile - rm -rf $(KDIR)/relocate - $(CP) ../../generic/image/relocate $(KDIR) - $(MAKE) -C $(KDIR)/relocate $(RELOCATE_MAKEOPTS) -endef - -### Kernel scripts ### -define Build/hcs-initramfs - $(STAGING_DIR_HOST)/bin/hcsmakeimage --magic_bytes=$(HCS_MAGIC_BYTES) \ - --rev_maj=$(HCS_REV_MAJ) --rev_min=$(HCS_REV_MIN) --input_file=$@ \ - --output_file=$@.hcs --ldaddress=$(KERNEL_LOADADDR) - mv $@.hcs $@ -endef - -define Build/loader-lzma - rm -rf $@.src - $(MAKE) -C lzma-loader \ - KDIR=$(KDIR) \ - LOADER_ADDR=$(if $(DEVICE_LOADADDR),$(DEVICE_LOADADDR),$(LOADER_ENTRY)) \ - KERNEL_ADDR=$(KERNEL_LOADADDR) \ - LZMA_TEXT_START=$(LZMA_TEXT_START) \ - CHIP_ID=$(CHIP_ID) \ - PKG_BUILD_DIR="$@.src" \ - TARGET_DIR="$(dir $@)" \ - LOADER_DATA="$@" \ - LOADER_NAME="$(notdir $@)" \ - compile loader.$(1) - mv "$@.$(1)" "$@" - rm -rf $@.src -endef - -define Build/lzma-cfe - # CFE is a LZMA nazi! It took me hours to find out the parameters! - # Also I think lzma has a bug cause it generates different output depending on - # if you use stdin / stdout or not. Use files instead of stdio here, cause - # otherwise CFE will complain and not boot the image. - $(call Build/lzma-no-dict,-d22 -fb64 -a1) - # Strip out the length, CFE doesn't like this - dd if=$@ of=$@.new bs=5 count=1 - dd if=$@ of=$@.new ibs=13 obs=5 skip=1 seek=1 conv=notrunc - mv $@.new $@ -endef - -define Build/relocate-kernel - # CFE only allows ~4 MiB for the uncompressed kernels, but uncompressed - # kernel might get larger than that, so let CFE unpack and load at a - # higher address and make the kernel relocate itself to the expected - # location. - ( \ - dd if=$(KDIR)/relocate/loader.bin bs=32 conv=sync && \ - perl -e '@s = stat("$@"); print pack("N", @s[7])' && \ - cat $@ \ - ) > $@.relocate - mv $@.relocate $@ -endef - -### Image scripts ### -define rootfspad/jffs2-128k ---align-rootfs -endef -define rootfspad/jffs2-64k ---align-rootfs -endef -define rootfspad/squashfs -endef - -define Image/FileSystemStrip -$(firstword $(subst +,$(space),$(subst root.,,$(notdir $(1))))) -endef - -define Build/cfe-bin - $(STAGING_DIR_HOST)/bin/imagetag -i $(IMAGE_KERNEL) -f $(IMAGE_ROOTFS) \ - --output $@ --boardid $(CFE_BOARD_ID) --chipid $(CHIP_ID) \ - --entry $(LOADER_ENTRY) --load-addr $(LOADER_ENTRY) \ - --info1 "$(call ModelNameLimit16,$(DEVICE_NAME))" \ - --info2 "$(call Image/FileSystemStrip,$(IMAGE_ROOTFS))" \ - $(call rootfspad/$(call Image/FileSystemStrip,$(IMAGE_ROOTFS))) \ - $(CFE_EXTRAS) $(1) -endef - -define Build/cfe-jffs2 - $(STAGING_DIR_HOST)/bin/mkfs.jffs2 \ - --big-endian \ - --pad \ - --no-cleanmarkers \ - --eraseblock=$(patsubst %k,%KiB,$(BLOCKSIZE)) \ - --root=$(1) \ - --output=$@ \ - --compression-mode=none - - $(call Build/pad-to,$(BLOCKSIZE)) -endef - -define Build/cfe-jffs2-cferam - mv $@ $@.kernel - - rm -rf $@-cferam - mkdir -p $@-cferam - - # CFE ROM checks JFFS2 dirent version of cferam. - # If version is not > 0 it will ignore the fs entry. - # JFFS2 sets version 0 to the first fs entry and increments - # it on the following ones, so let's create a dummy file that - # will have version 0 and let cferam be the second (version 1). - touch $@-cferam/1-openwrt - # Add cferam as the last file in the JFFS2 partition - cp $(KDIR)/bcm63xx-cfe/$(CFE_RAM_FILE) $@-cferam/$(CFE_RAM_JFFS2_NAME) - - # The JFFS2 partition creation should result in the following - # layout: - # 1) 1-openwrt (version 0, ino 2) - # 2) cferam.000 (version 1, ino 3) - $(call Build/cfe-jffs2,$@-cferam) - - # Some devices need padding between CFE RAM and kernel - $(if $(CFE_RAM_JFFS2_PAD),$(call Build/pad-to,$(CFE_RAM_JFFS2_PAD))) - - # Add CFE partition tag - $(if $(CFE_PART_ID),$(call Build/cfe-part-tag)) - - # Append kernel - dd if=$@.kernel >> $@ - rm -f $@.kernel -endef - -define Build/cfe-jffs2-kernel - rm -rf $@-kernel - mkdir -p $@-kernel - - # CFE RAM checks JFFS2 dirent version of vmlinux. - # If version is not > 0 it will ignore the fs entry. - # JFFS2 sets version 0 to the first fs entry and increments - # it on the following ones, so let's create a dummy file that - # will have version 0 and let cferam be the second (version 1). - touch $@-kernel/1-openwrt - # vmlinux is located on a different JFFS2 partition, but CFE RAM - # ignores it, so let's create another dummy file that will match - # the JFFS2 ino of cferam entry on the first JFFS2 partition. - # CFE RAM won't be able to find vmlinux if cferam has the same - # ino as vmlinux. - touch $@-kernel/2-openwrt - # Add vmlinux as the last file in the JFFS2 partition - $(TOPDIR)/scripts/cfe-bin-header.py \ - --input-file $@ \ - --output-file $@-kernel/vmlinux.lz \ - --load-addr $(if $(DEVICE_LOADADDR),$(DEVICE_LOADADDR),$(LOADER_ENTRY)) \ - --entry-addr $(if $(DEVICE_LOADADDR),$(DEVICE_LOADADDR),$(LOADER_ENTRY)) - - # The JFFS2 partition creation should result in the following - # layout: - # 1) 1-openwrt (version 0, ino 2) - # 2) 2-openwrt (version 1, ino 3) - # 3) vmlinux.lz (version 2, ino 4) - $(call Build/cfe-jffs2,$@-kernel) -endef - -define Build/cfe-part-tag - mv $@ $@.part - - $(TOPDIR)/scripts/cfe-partition-tag.py \ - --input-file $@.part \ - --output-file $@ \ - --flags $(CFE_PART_FLAGS) \ - --id $(CFE_PART_ID) \ - --name $(VERSION_CODE) \ - --version $(DEVICE_NAME) - - $(call Build/pad-to,$(BLOCKSIZE)) - - dd if=$@.part >> $@ -endef - -define Build/cfe-sercomm-part - $(TOPDIR)/scripts/sercomm-partition-tag.py \ - --input-file $@ \ - --output-file $@.kernel_rootfs \ - --part-name kernel_rootfs \ - --part-version OpenWrt \ - --rootfs-version $(SERCOMM_VERSION) - - rm -rf $@-rootfs_lib - mkdir -p $@-rootfs_lib - echo $(SERCOMM_VERSION) > $@-rootfs_lib/lib_ver - $(call Build/cfe-jffs2,$@-rootfs_lib) - $(call Build/pad-to,$(BLOCKSIZE)) - $(TOPDIR)/scripts/sercomm-partition-tag.py \ - --input-file $@ \ - --output-file $@.rootfs_lib \ - --part-name rootfs_lib \ - --part-version $(SERCOMM_VERSION) - - mv $@.kernel_rootfs $@ - dd if=$@.rootfs_lib >> $@ -endef - -define Build/cfe-sercomm-load - $(TOPDIR)/scripts/sercomm-payload.py \ - --input-file $@ \ - --output-file $@.new \ - --pid "$(SERCOMM_PID)" - - mv $@.new $@ -endef - -define Build/cfe-sercomm-crypto - $(TOPDIR)/scripts/sercomm-crypto.py \ - --input-file $@ \ - --key-file $@.key \ - --output-file $@.ser \ - --version OpenWrt - $(STAGING_DIR_HOST)/bin/openssl enc -md md5 -aes-256-cbc \ - -in $@ -out $@.enc \ - -K `cat $@.key` \ - -iv 00000000000000000000000000000000 - dd if=$@.enc >> $@.ser - mv $@.ser $@ - rm -f $@.enc $@.key -endef - -define Build/cfe-old-bin - $(TOPDIR)/scripts/brcmImage.pl -t -p \ - -o $@ -b $(CFE_BOARD_ID) -c $(CHIP_ID) \ - -e $(LOADER_ENTRY) -a $(LOADER_ENTRY) \ - -k $(IMAGE_KERNEL) -r $(IMAGE_ROOTFS) \ - $(CFE_EXTRAS) -endef - -define Build/cfe-spw303v-bin - $(STAGING_DIR_HOST)/bin/imagetag -i $(IMAGE_KERNEL) -f $(IMAGE_ROOTFS) \ - --output $@ --boardid $(CFE_BOARD_ID) --chipid $(CHIP_ID) \ - --entry $(LOADER_ENTRY) --load-addr $(LOADER_ENTRY) \ - $(call rootfspad/$(call Image/FileSystemStrip,$(IMAGE_ROOTFS))) \ - $(CFE_EXTRAS) $(1) -endef - -define Build/cfe-wfi-tag - $(TOPDIR)/scripts/cfe-wfi-tag.py \ - --input-file $@ \ - --output-file $@.new \ - --version $(if $(1),$(1),$(CFE_WFI_VERSION)) \ - --chip-id $(CFE_WFI_CHIP_ID) \ - --flash-type $(CFE_WFI_FLASH_TYPE) \ - $(if $(CFE_WFI_FLAGS),--flags $(CFE_WFI_FLAGS)) - mv $@.new $@ -endef - -define Build/spw303v-bin - $(STAGING_DIR_HOST)/bin/spw303v -i $@ -o $@.spw303v - mv $@.spw303v $@ -endef - -define Build/zyxel-bin - $(STAGING_DIR_HOST)/bin/zyxbcm -i $@ -o $@.zyxel - mv $@.zyxel $@ -endef - -define Build/redboot-bin - # Prepare kernel and rootfs - dd if=$(IMAGE_KERNEL) of=$(BIN_DIR)/$(REDBOOT_PREFIX)-vmlinux.gz bs=65536 conv=sync - dd if=$(IMAGE_ROOTFS) of=$(BIN_DIR)/$(REDBOOT_PREFIX)-$(notdir $(IMAGE_ROOTFS)) bs=64k conv=sync - echo -ne \\xDE\\xAD\\xC0\\xDE >> $(BIN_DIR)/$(REDBOOT_PREFIX)-$(notdir $(IMAGE_ROOTFS)) - # Generate the scripted image - $(TOPDIR)/scripts/redboot-script.pl \ - -k $(BIN_DIR)/$(REDBOOT_PREFIX)-vmlinux.gz \ - -r $(BIN_DIR)/$(REDBOOT_PREFIX)-$(notdir $(IMAGE_ROOTFS)) \ - -a $(strip $(LOADER_ENTRY)) -f 0xbe430000 -l 0x7c0000 \ - -s 0x1000 -t 20 -o $@.redbootscript - dd if="$@.redbootscript" of="$@.redbootscript.padded" bs=4096 conv=sync - cat \ - "$@.redbootscript.padded" \ - "$(BIN_DIR)/$(REDBOOT_PREFIX)-vmlinux.gz" \ - "$(BIN_DIR)/$(REDBOOT_PREFIX)-$(notdir $(IMAGE_ROOTFS))" \ - > "$@" -endef - -define Device/Default - PROFILES = Default $$(DEVICE_NAME) - KERNEL_DEPENDS = $$(wildcard ../dts/$$(DEVICE_DTS).dts) - KERNEL_INITRAMFS_SUFFIX := .elf - DEVICE_DTS_DIR := ../dts - CHIP_ID := - SOC = bcm$$(CHIP_ID) - DEVICE_DTS = $$(SOC)-$(subst _,-,$(1)) - DEVICE_LOADADDR := -endef -DEVICE_VARS += CHIP_ID DEVICE_LOADADDR - -ATH5K_PACKAGES := kmod-ath5k wpad-basic-mbedtls -ATH9K_PACKAGES := kmod-ath9k wpad-basic-mbedtls -B43_PACKAGES := kmod-b43 wpad-basic-mbedtls -BRCMWL_PACKAGES := kmod-brcm-wl nas wlc -RT28_PACKAGES := kmod-rt2800-pci wpad-basic-mbedtls -RT61_PACKAGES := kmod-rt61-pci wpad-basic-mbedtls -USB1_PACKAGES := kmod-usb-ohci kmod-usb-ledtrig-usbport -USB2_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-usb-ledtrig-usbport - -include bcm63xx.mk - -ifeq ($(SUBTARGET),smp) -include bcm63xx_nand.mk -endif - -$(eval $(call BuildImage)) diff --git a/target/linux/bcm63xx/image/README.images-bcm63xx b/target/linux/bcm63xx/image/README.images-bcm63xx deleted file mode 100644 index 91b6d019eeae69..00000000000000 --- a/target/linux/bcm63xx/image/README.images-bcm63xx +++ /dev/null @@ -1,127 +0,0 @@ -The image neede to flash onto a Broadcom 63xx-series board depends on the -board, method you are using to flash, and, for web-based flash, on the version -of the Broadcom code your router uses. - -There are two major revisions of the Broadcom code as far as imagetags are -concerned, before 3.08 and after 3.08, however there are some variations -within in that, either due to vendor differences or due to changes at -Broadcom (it's not clear yet which is the case). In addtion Pirelli modified -the Broadcom code, so Alice Gate models use a different imagetag than any -other vendor. - -The imagetag format for flashing via CFE is the same for almost all the -boards, and is the same for all images generated by the imagetag utility. -Images flashable using cfe are labelled openwrt---cfe.bin - -The imagetags for tftp/ftp flashing is based on Broadcom 3.00-3.04 imagetags -and is known to be correct as the source code GPL and is available for reading. - -Broadcom code 2.21 is based on the BT Voyager firmware image I looked at. It -may in fact be BT Voyager-specific. 2.21 is actually more difficult to deal -with the imagetag from 3.00 as it has three different CRC calculations in -addtition to the header CRC. - -Broadcom 3.00-3.02 flashing has been tested on Comtrend CT-5261, CT-536 and -Tecom GW6000, and is the version of the flashing that was present before the -imagetags were split by broadcom code version (early June 2009) - -3.04 is guessed to be the same as 3.00-3.02 based on available information - -Broadom 3.06 is thought to be the same as 3.00-3.02, however the only 3.06 -this author (Daniel Dickinson) has seen is the Alice Gate (Pirelli) firmware -which is known to be different due to vendor (Pirelli) modifications to the -Broadcom code. - -Broadcom 3.10 uses an imagetag that is believed to apply to all 3.10 and 3.12 -versions, and has been tested on the Tecom GW6200. This version introdec changes to -the imagetag to deal with TR69 (a remote rouer management system developed by the -DSL forum). There is a field for vendor-specific information, that at least in some -cases is not optional. It is based on the hexedit of a neufbox4 firmware image, the -information in https://dev.openwrt.org/ticket/4987, and the hexedit of a Tecom -GW6200 image. - -Some boards share the same tag format, but require vendor-specific fields in -the board. In that case the tagid is shared, but the filename of the generated -image reflects the router for which the image was created. - -router |method | codever |filename -+-------------+-------------+---------+--------------------------------------- -|any |cfe+most web | any |openwrt---cfe.bin -|AGVoIP2+WiFi |cfe |alice3.06|openwrt-AGV2+W-cfe--cfe.bin -|AGVoIP2+WiFi |web |alice3.06|openwrt-AGV2+W-cfe--cfe.bin -|CT536 |web |3.02 |openwrt-CT536_CT5621--cfe.bin -|CT5621 |web |3.02 |openwrt-CT536_CT5621--cfe.bin -|DG834GT |web |3.02 |openwrt-DG834GT_DG834PN--cfe.bin -|DG834PN |web |3.02 |openwrt-DG834GT_DG834PN--cfe.bin -|DSL-2640B |web |3.10 |openwrt-DSL2640B--cfe.bin -|DSL-2740B |web |3.10 |openwrt-DSL2670B--cfe.bin -|F5D7633 |web |3.10 |openwrt-F5D7633--cfe.bin -|F@ST2404 |web |3.0X? |openwrt-F@ST2404-cfe--cfe.bin -|F@ST2404 |web |3.1X? |openwrt-F@ST2404--cfe.bin -|GW6000 |web |3.00 |openwrt-GW6000--cfe.bin -|GW6200 |web |3.10 |openwrt-GW6200--cfe.bin -|Neufbox4 |web |3.12 |openwrt-NEUFBOX4--cfe.bin -|TD8810A |web |3.06 |openwrt-TD8810--cfe.bin -|TD8810B |web |3.06 |openwrt-TD8810--cfe.bin -|TD8811A |web |3.06 |openwrt-TD8811--cfe.bin -|TD8811B |web |3.06 |openwrt-TD881--cfe.bin -|TD8900GB |web |3.06 |openwrt-TD8900DB-cfe.bin -|USR9108 |web |3.0X? |openwrt-USR9108--cfe.bin -|V2091_BTR |web |2.21 |openwrt-V2091_BTR--cfe.bin -|V2091_ROI |web |2.21 |openwrt-V2091--cfe.bin -|V2091_WB |web |2.21 |openwrt-V2091--cfe.bin -|V210_BTR |web |2.21 |openwrt-V210_BTR--cfe.bin -|V210_ROI |web |2.21 |openwrt-V210-ROI_WB-cfe.bin -|V210_WB |web |2.21 |openwrt-V210-ROI_WB-cfe.bin -|V2110 |web |2.21 |openwrt-V2110--cfe.bin -|V2110_AA |web |2.21 |openwrt-V2110--cfe.bin -|V2110_ROI |web |2.21 |openwrt-V2110--cfe.bin -|V2500V |web |2.21 |openwrt-V2500V-cfe.bin -|V2500V_AA |web |2.21 |openwrt-V2500V--cfe.bin -|V2500V_SIP_CLUB |web |2.21 |openwrt-V2500V--cfe.bin - -Old imagetag routers --------------------- -Davolink DV201AMR - -Redboot routers ---------------- -Inventel Livebox - -Known router->code versions ---------------------------- - -Vendor |Model |Code Ver ----------------------------+------------------------------------------+-------- -Belkin |F5D7633 |3.10 -British Telecom (BT) |Voyager V2091_BTR |2.21 -British Telecom (BT) |Voyager V2091_ROI |2.21 -British Telecom (BT) |Voyager V2091_WB |2.21 -British Telecom (BT) |Voyager V210_BTR |2.21 -British Telecom (BT) |Voyager V210_ROI |2.21 -British Telecom (BT) |Voyager V210_WB |2.21 -British Telecom (BT) |Voyager V2110 |2.21 -British Telecom (BT) |Voyager V2110_AA |2.21 -British Telecom (BT) |Voyager V2110_ROI |2.21 -British Telecom (BT) |Voyager V220V |2.21 -British Telecom (BT) |Voyager V2500V |2.21 -British Telecom (BT) |Voyager V2500V_AA |2.21 -British Telecom (BT) |Voyager V2500V_SIP_CLUB |2.21 -Comtrend |CT-5261 |3.02 -Comtrend |CT-536 |3.02 -D-Link |DSL-2640B |3.10 -D-Link |DSL-2670B |3.10 -NetGear |DG834GT |3.02 -NetGear |DG834PN |3.02 -Neuf Cegetel |Neufbox 4 |3.12 -Pirelli |Alice Gate Wi-Fi (+VoIP models?) |ag 3.06 -Sagem |F@ST2404 |? -TP-Link |TD-8810A |3.06 -TP-Link |TD-8810B |3.06 -TP-Link |TD-8811A |3.06 -TP-Link |TD-8811B |3.06 -TP-Link |TD-W8900GB |3.06 -Tecom |GW6000 |3.00 -Tecom |GW6200 |3.10 -USR |9108 |? - diff --git a/target/linux/bcm63xx/image/bcm63xx.mk b/target/linux/bcm63xx/image/bcm63xx.mk deleted file mode 100644 index 9c5cc9bce5baf5..00000000000000 --- a/target/linux/bcm63xx/image/bcm63xx.mk +++ /dev/null @@ -1,1260 +0,0 @@ - -# -# BCM33XX/BCM63XX Profiles -# - -DEVICE_VARS += HCS_MAGIC_BYTES HCS_REV_MIN HCS_REV_MAJ -DEVICE_VARS += BLOCK_SIZE FLASH_MB IMAGE_OFFSET -DEVICE_VARS += CFE_BOARD_ID CFE_EXTRAS -DEVICE_VARS += NETGEAR_BOARD_ID NETGEAR_REGION -DEVICE_VARS += REDBOOT_PREFIX - -define Device/bcm33xx - KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | loader-lzma bin | hcs-initramfs - IMAGES := - HCS_MAGIC_BYTES := - HCS_REV_MIN := - HCS_REV_MAJ := -endef - -define Device/bcm63xx - FILESYSTEMS := squashfs jffs2-64k jffs2-128k - KERNEL := kernel-bin | append-dtb | relocate-kernel | lzma - KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | loader-lzma elf - IMAGES := cfe.bin - IMAGE/cfe.bin := cfe-bin --pad $$$$(shell expr $$$$(FLASH_MB) / 2) - IMAGE/cfe-4M.bin := cfe-bin --pad 2 - IMAGE/cfe-8M.bin := cfe-bin --pad 4 - IMAGE/cfe-16M.bin := cfe-bin --pad 8 - IMAGE/cfe-bc221.bin := cfe-bin --layoutver 5 - IMAGE/cfe-old.bin := cfe-old-bin - IMAGE/sysupgrade.bin := cfe-bin - BLOCK_SIZE := 0x10000 - IMAGE_OFFSET := - FLASH_MB := 4 - CFE_BOARD_ID := - CFE_EXTRAS = --block-size $$(BLOCK_SIZE) --image-offset $$(if $$(IMAGE_OFFSET),$$(IMAGE_OFFSET),$$(BLOCK_SIZE)) -endef - -define Device/bcm63xx-legacy - $(Device/bcm63xx) - KERNEL := kernel-bin | append-dtb | relocate-kernel | lzma-cfe -endef - -define Device/bcm63xx_netgear - $(Device/bcm63xx) - DEVICE_VENDOR := NETGEAR - IMAGES := factory.chk sysupgrade.bin - IMAGE/factory.chk := cfe-bin | netgear-chk - NETGEAR_BOARD_ID := - NETGEAR_REGION := -endef - -define Device/bcm63xx_redboot - FILESYSTEMS := squashfs - KERNEL := kernel-bin | append-dtb | relocate-kernel | gzip - KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | loader-lzma elf - IMAGES := redboot.bin - IMAGE/redboot.bin := redboot-bin - REDBOOT_PREFIX := $$(DEVICE_IMG_PREFIX) -endef - -### Generic ### -define Device/brcm_bcm963281tan - $(Device/bcm63xx) - DEVICE_VENDOR := Generic - DEVICE_MODEL := 963281TAN - IMAGES := cfe-4M.bin cfe-8M.bin cfe-16M.bin - CFE_BOARD_ID := 963281TAN - CHIP_ID := 6328 -endef -TARGET_DEVICES += brcm_bcm963281tan - -define Device/brcm_bcm96328avng - $(Device/bcm63xx) - DEVICE_VENDOR := Generic - DEVICE_MODEL := 96328avng - IMAGES := cfe-4M.bin cfe-8M.bin cfe-16M.bin - CFE_BOARD_ID := 96328avng - CHIP_ID := 6328 -endef -TARGET_DEVICES += brcm_bcm96328avng - -define Device/brcm_bcm96338gw - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := Generic - DEVICE_MODEL := 96338GW - CFE_BOARD_ID := 6338GW - CHIP_ID := 6338 -endef -TARGET_DEVICES += brcm_bcm96338gw - -define Device/brcm_bcm96338w - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := Generic - DEVICE_MODEL := 96338W - CFE_BOARD_ID := 6338W - CHIP_ID := 6338 - DEFAULT := n -endef -TARGET_DEVICES += brcm_bcm96338w - -define Device/brcm_bcm96345gw2 - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := Generic - DEVICE_MODEL := 96345GW2 - IMAGES += cfe-bc221.bin - CFE_BOARD_ID := 96345GW2 - CHIP_ID := 6345 - DEFAULT := n -endef -TARGET_DEVICES += brcm_bcm96345gw2 - -define Device/brcm_bcm96348gw - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := Generic - DEVICE_MODEL := 96348GW - IMAGES += cfe-bc221.bin - CFE_BOARD_ID := 96348GW - CHIP_ID := 6348 - DEFAULT := n -endef -TARGET_DEVICES += brcm_bcm96348gw - -define Device/brcm_bcm96348gw-10 - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := Generic - DEVICE_MODEL := 96348GW-10 - CFE_BOARD_ID := 96348GW-10 - CHIP_ID := 6348 - DEFAULT := n -endef -TARGET_DEVICES += brcm_bcm96348gw-10 - -define Device/brcm_bcm96348gw-11 - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := Generic - DEVICE_MODEL := 96348GW-11 - CFE_BOARD_ID := 96348GW-11 - CHIP_ID := 6348 - DEFAULT := n -endef -TARGET_DEVICES += brcm_bcm96348gw-11 - -define Device/brcm_bcm96348r - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := Generic - DEVICE_MODEL := 96348R - CFE_BOARD_ID := 96348R - CHIP_ID := 6348 - DEFAULT := n -endef -TARGET_DEVICES += brcm_bcm96348r - -define Device/brcm_bcm96358vw - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := Generic - DEVICE_MODEL := 96358VW - CFE_BOARD_ID := 96358VW - CHIP_ID := 6358 -endef -TARGET_DEVICES += brcm_bcm96358vw - -define Device/brcm_bcm96358vw2 - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := Generic - DEVICE_MODEL := 96358VW2 - CFE_BOARD_ID := 96358VW2 - CHIP_ID := 6358 -endef -TARGET_DEVICES += brcm_bcm96358vw2 - -define Device/brcm_bcm96368mvngr - $(Device/bcm63xx) - DEVICE_VENDOR := Generic - DEVICE_MODEL := 96368MVNgr - CFE_BOARD_ID := 96368MVNgr - CHIP_ID := 6368 -endef -TARGET_DEVICES += brcm_bcm96368mvngr - -define Device/brcm_bcm96368mvwg - $(Device/bcm63xx) - DEVICE_VENDOR := Generic - DEVICE_MODEL := 96368MVWG - CFE_BOARD_ID := 96368MVWG - CHIP_ID := 6368 -endef -TARGET_DEVICES += brcm_bcm96368mvwg - -### Actiontec ### -define Device/actiontec_r1000h - $(Device/bcm63xx) - DEVICE_VENDOR := Actiontec - DEVICE_MODEL := R1000H - FILESYSTEMS := squashfs - CFE_BOARD_ID := 96368MVWG - CHIP_ID := 6368 - FLASH_MB := 32 - IMAGE_OFFSET := 0x20000 - DEVICE_PACKAGES := $(USB2_PACKAGES) $(BRCMWL_PACKAGES) -endef -TARGET_DEVICES += actiontec_r1000h - -### ADB ### -define Device/adb_a4001n - $(Device/bcm63xx) - DEVICE_VENDOR := ADB - DEVICE_MODEL := P.DG A4001N - CFE_BOARD_ID := 96328dg2x2 - CHIP_ID := 6328 - FLASH_MB := 8 - DEVICE_PACKAGES := $(USB2_PACKAGES) $(B43_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += adb_a4001n - -define Device/adb_a4001n1 - $(Device/bcm63xx) - DEVICE_VENDOR := ADB - DEVICE_MODEL := P.DG A4001N1 - IMAGES += sysupgrade.bin - CFE_BOARD_ID := 963281T_TEF - CHIP_ID := 6328 - FLASH_MB := 16 - DEVICE_PACKAGES := $(USB2_PACKAGES) $(B43_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += adb_a4001n1 - -define Device/adb_pdg-a4001n-a-000-1a1-ax - $(Device/bcm63xx) - DEVICE_VENDOR := ADB - DEVICE_MODEL := P.DG A4001N A-000-1A1-AX - IMAGES += sysupgrade.bin - CFE_BOARD_ID := 96328avng - CHIP_ID := 6328 - FLASH_MB := 16 - DEVICE_PACKAGES := $(USB2_PACKAGES) $(B43_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += adb_pdg-a4001n-a-000-1a1-ax - -define Device/adb_pdg-a4101n-a-000-1a1-ae - $(Device/bcm63xx) - DEVICE_VENDOR := ADB - DEVICE_MODEL := P.DG A4101N A-000-1A1-AE - IMAGES += sysupgrade.bin - CFE_BOARD_ID := 96328avngv - CHIP_ID := 6328 - FLASH_MB := 16 - DEVICE_PACKAGES := $(USB2_PACKAGES) $(B43_PACKAGES) -endef -TARGET_DEVICES += adb_pdg-a4101n-a-000-1a1-ae - -define Device/adb_av4202n - $(Device/bcm63xx) - DEVICE_VENDOR := ADB - DEVICE_MODEL := P.DG AV4202N - IMAGE_OFFSET := 0x20000 - CFE_BOARD_ID := 96368_Swiss_S1 - CHIP_ID := 6368 - DEVICE_PACKAGES := $(USB2_PACKAGES) $(B43_PACKAGES) -endef -TARGET_DEVICES += adb_av4202n - -### Alcatel ### -define Device/alcatel_rg100a - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := Alcatel - DEVICE_MODEL := RG100A - CFE_BOARD_ID := 96358VW2 - CHIP_ID := 6358 - BLOCK_SIZE := 0x20000 - DEVICE_PACKAGES := $(USB2_PACKAGES) $(B43_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += alcatel_rg100a - -### Asmax ### -define Device/asmax_ar-1004g - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := Asmax - DEVICE_MODEL := AR 1004g - CFE_BOARD_ID := 96348GW-10 - CHIP_ID := 6348 - DEVICE_PACKAGES := $(B43_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += asmax_ar-1004g - -### Belkin ### -define Device/belkin_f5d7633 - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := Belkin - DEVICE_MODEL := F5D7633 - CFE_BOARD_ID := 96348GW-10 - CHIP_ID := 6348 - BLOCK_SIZE := 0x20000 - DEVICE_PACKAGES := $(B43_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += belkin_f5d7633 - -### Broadcom ### -define Device/brcm_bcm96318ref - $(Device/bcm63xx) - DEVICE_VENDOR := Broadcom - DEVICE_MODEL := BCM96318REF reference board - IMAGES := - CFE_BOARD_ID := 96318REF - CHIP_ID := 6318 - DEVICE_PACKAGES := $(B43_PACKAGES) $(USB2_PACKAGES) kmod-bcm63xx-udc -endef -TARGET_DEVICES += brcm_bcm96318ref - -define Device/brcm_bcm96318ref-p300 - $(Device/bcm63xx) - DEVICE_VENDOR := Broadcom - DEVICE_MODEL := BCM96318REF_P300 reference board - IMAGES := - CFE_BOARD_ID := 96318REF_P300 - CHIP_ID := 6318 - DEVICE_PACKAGES := $(B43_PACKAGES) $(USB2_PACKAGES) kmod-bcm63xx-udc -endef -TARGET_DEVICES += brcm_bcm96318ref-p300 - -define Device/brcm_bcm963268bu-p300 - $(Device/bcm63xx) - DEVICE_VENDOR := Broadcom - DEVICE_MODEL := BCM963268BU_P300 reference board - IMAGES := - CFE_BOARD_ID := 963268BU_P300 - CHIP_ID := 63268 - DEVICE_PACKAGES := $(USB2_PACKAGES) kmod-bcm63xx-udc -endef -TARGET_DEVICES += brcm_bcm963268bu-p300 - -define Device/brcm_bcm963269bhr - $(Device/bcm63xx) - DEVICE_VENDOR := Broadcom - DEVICE_MODEL := BCM963269BHR reference board - IMAGES := - CFE_BOARD_ID := 963269BHR - CHIP_ID := 63268 - SOC := bcm63269 - DEVICE_PACKAGES := $(USB2_PACKAGES) kmod-bcm63xx-udc -endef -TARGET_DEVICES += brcm_bcm963269bhr - -### BT ### -define Device/bt_home-hub-2-a - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := British Telecom (BT) - DEVICE_MODEL := Home Hub 2.0 - DEVICE_VARIANT := A - CFE_BOARD_ID := HOMEHUB2A - CHIP_ID := 6358 - BLOCK_SIZE := 0x20000 - DEVICE_PACKAGES := $(B43_PACKAGES) $(USB2_PACKAGES) -endef -TARGET_DEVICES += bt_home-hub-2-a - -define Device/bt_voyager-2110 - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := British Telecom (BT) - DEVICE_MODEL := Voyager 2110 - CFE_BOARD_ID := V2110 - CHIP_ID := 6348 - CFE_EXTRAS += --layoutver 5 - DEVICE_PACKAGES := $(B43_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += bt_voyager-2110 - -define Device/bt_voyager-2500v-bb - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := British Telecom (BT) - DEVICE_MODEL := Voyager 2500V - CFE_BOARD_ID := V2500V_BB - CHIP_ID := 6348 - CFE_EXTRAS += --layoutver 5 - DEVICE_PACKAGES := $(B43_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += bt_voyager-2500v-bb - -### Comtrend ### -define Device/comtrend_ar-5315u - $(Device/bcm63xx) - DEVICE_VENDOR := Comtrend - DEVICE_MODEL := AR-5315u - IMAGES += sysupgrade.bin - CFE_BOARD_ID := 96318A-1441N1 - CHIP_ID := 6318 - FLASH_MB := 16 - DEVICE_PACKAGES := $(B43_PACKAGES) $(USB2_PACKAGES) -endef -TARGET_DEVICES += comtrend_ar-5315u - -define Device/comtrend_ar-5381u - $(Device/bcm63xx) - DEVICE_VENDOR := Comtrend - DEVICE_MODEL := AR-5381u - IMAGES += sysupgrade.bin - CFE_BOARD_ID := 96328A-1241N - CHIP_ID := 6328 - FLASH_MB := 16 - DEVICE_PACKAGES := $(B43_PACKAGES) $(USB2_PACKAGES) -endef -TARGET_DEVICES += comtrend_ar-5381u - -define Device/comtrend_ar-5387un - $(Device/bcm63xx) - DEVICE_VENDOR := Comtrend - DEVICE_MODEL := AR-5387un - IMAGES += sysupgrade.bin - CFE_BOARD_ID := 96328A-1441N1 - CHIP_ID := 6328 - FLASH_MB := 16 - DEVICE_PACKAGES := $(B43_PACKAGES) $(USB2_PACKAGES) -endef -TARGET_DEVICES += comtrend_ar-5387un - -define Device/comtrend_ct-536plus - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := Comtrend - DEVICE_MODEL := CT-536+ - DEVICE_ALT0_VENDOR := Comtrend - DEVICE_ALT0_MODEL := CT-5621 - CFE_BOARD_ID := 96348GW-11 - CHIP_ID := 6348 - DEVICE_PACKAGES := $(B43_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += comtrend_ct-536plus - -define Device/comtrend_ct-5365 - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := Comtrend - DEVICE_MODEL := CT-5365 - CFE_BOARD_ID := 96348A-122 - CHIP_ID := 6348 - DEVICE_PACKAGES := $(B43_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += comtrend_ct-5365 - -define Device/comtrend_ct-6373 - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := Comtrend - DEVICE_MODEL := CT-6373 - CFE_BOARD_ID := CT6373-1 - CHIP_ID := 6358 - DEVICE_PACKAGES := $(B43_PACKAGES) $(USB2_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += comtrend_ct-6373 - -define Device/comtrend_vr-3025u - $(Device/bcm63xx) - DEVICE_VENDOR := Comtrend - DEVICE_MODEL := VR-3025u - IMAGES += sysupgrade.bin - CFE_BOARD_ID := 96368M-1541N - CHIP_ID := 6368 - BLOCK_SIZE := 0x20000 - FLASH_MB := 32 - DEVICE_PACKAGES := $(B43_PACKAGES) $(USB2_PACKAGES) -endef -TARGET_DEVICES += comtrend_vr-3025u - -define Device/comtrend_vr-3025un - $(Device/bcm63xx) - DEVICE_VENDOR := Comtrend - DEVICE_MODEL := VR-3025un - CFE_BOARD_ID := 96368M-1341N - CHIP_ID := 6368 - FLASH_MB := 8 - DEVICE_PACKAGES := $(B43_PACKAGES) $(USB2_PACKAGES) -endef -TARGET_DEVICES += comtrend_vr-3025un - -define Device/comtrend_vr-3026e - $(Device/bcm63xx) - DEVICE_VENDOR := Comtrend - DEVICE_MODEL := VR-3026e - CFE_BOARD_ID := 96368MT-1341N1 - CHIP_ID := 6368 - FLASH_MB := 8 - DEVICE_PACKAGES := $(B43_PACKAGES) -endef -TARGET_DEVICES += comtrend_vr-3026e - -define Device/comtrend_wap-5813n - $(Device/bcm63xx) - DEVICE_VENDOR := Comtrend - DEVICE_MODEL := WAP-5813n - CFE_BOARD_ID := 96369R-1231N - CHIP_ID := 6368 - FLASH_MB := 8 - SOC := bcm6369 - DEVICE_PACKAGES := $(B43_PACKAGES) $(USB2_PACKAGES) -endef -TARGET_DEVICES += comtrend_wap-5813n - -### D-Link ### -define Device/d-link_dsl-2640b-b - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := D-Link - DEVICE_MODEL := DSL-2640B - DEVICE_VARIANT := B2 - CFE_BOARD_ID := D-4P-W - CHIP_ID := 6348 - DEVICE_PACKAGES := $(B43_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += d-link_dsl-2640b-b - -define Device/d-link_dsl-2640u - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := D-Link - DEVICE_MODEL := DSL-2640U - DEVICE_VARIANT := C1 - DEVICE_ALT0_VENDOR := D-Link - DEVICE_ALT0_MODEL := DSL-2640U/BRU/C - CFE_BOARD_ID := 96338W2_E7T - CHIP_ID := 6338 - DEVICE_PACKAGES := $(B43_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += d-link_dsl-2640u - -define Device/d-link_dsl-2650u - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := D-Link - DEVICE_MODEL := DSL-2650U - CFE_BOARD_ID := 96358VW2 - CHIP_ID := 6358 - DEVICE_PACKAGES := $(B43_PACKAGES) $(USB2_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += d-link_dsl-2650u - -define Device/d-link_dsl-274xb-c2 - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := D-Link - DEVICE_MODEL := DSL-2740B - DEVICE_VARIANT := C2 - DEVICE_ALT0_VENDOR := D-Link - DEVICE_ALT0_MODEL := DSL-2741B - DEVICE_ALT0_VARIANT := C2 - CFE_BOARD_ID := 96358GW - CHIP_ID := 6358 - DEVICE_PACKAGES := $(B43_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += d-link_dsl-274xb-c2 - -define Device/d-link_dsl-274xb-c3 - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := D-Link - DEVICE_MODEL := DSL-2740B - DEVICE_VARIANT := C3 - DEVICE_ALT0_VENDOR := D-Link - DEVICE_ALT0_MODEL := DSL-2741B - DEVICE_ALT0_VARIANT := C3 - DEVICE_DTS := bcm6358-d-link-dsl-274xb-c2 - CFE_BOARD_ID := AW4139 - CHIP_ID := 6358 - DEVICE_PACKAGES := $(B43_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += d-link_dsl-274xb-c3 - -define Device/d-link_dsl-274xb-f1 - $(Device/bcm63xx) - DEVICE_VENDOR := D-Link - DEVICE_MODEL := DSL-2740B - DEVICE_VARIANT := F1 - DEVICE_ALT0_VENDOR := D-Link - DEVICE_ALT0_MODEL := DSL-2741B - DEVICE_ALT0_VARIANT := F1 - CFE_BOARD_ID := AW4339U - CHIP_ID := 6328 - IMAGES := cfe-EU.bin cfe-AU.bin - IMAGE/cfe-AU.bin := cfe-bin --signature2 "4.06.01.AUF1" --pad 4 - IMAGE/cfe-EU.bin := cfe-bin --signature2 "4.06.01.EUF1" --pad 4 - DEVICE_PACKAGES := $(ATH9K_PACKAGES) -endef -TARGET_DEVICES += d-link_dsl-274xb-f1 - -define Device/d-link_dsl-2750u-c1 - $(Device/bcm63xx) - DEVICE_VENDOR := D-Link - DEVICE_MODEL := DSL-2750U - DEVICE_VARIANT := C1 - IMAGES += sysupgrade.bin - CFE_BOARD_ID := 963281TAVNG - CHIP_ID := 6328 - FLASH_MB := 8 - DEVICE_PACKAGES := $(USB2_PACKAGES) $(B43_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += d-link_dsl-2750u-c1 - -define Device/d-link_dsl-275xb-d1 - $(Device/bcm63xx) - DEVICE_VENDOR := D-Link - DEVICE_MODEL := DSL-2750B - DEVICE_VARIANT := D1 - DEVICE_ALT0_VENDOR := D-Link - DEVICE_ALT0_MODEL := DSL-2751 - DEVICE_ALT0_VARIANT := D1 - CFE_BOARD_ID := AW5200B - CHIP_ID := 6318 - FLASH_MB := 8 - DEVICE_PACKAGES := $(B43_PACKAGES) $(USB2_PACKAGES) -endef -TARGET_DEVICES += d-link_dsl-275xb-d1 - -define Device/d-link_dva-g3810bn-tl - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := D-Link - DEVICE_MODEL := DVA-G3810BN/TL - CFE_BOARD_ID := 96358VW - CHIP_ID := 6358 - DEVICE_PACKAGES := $(B43_PACKAGES) $(USB2_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += d-link_dva-g3810bn-tl - -### Davolink ### -define Device/davolink_dv-201amr - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := Davolink - DEVICE_MODEL := DV-201AMR - IMAGES := cfe-old.bin - CFE_BOARD_ID := DV201AMR - CHIP_ID := 6348 - DEVICE_PACKAGES := $(B43_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += davolink_dv-201amr - -### Dynalink ### -define Device/dynalink_rta770bw - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := Dynalink - DEVICE_MODEL := RTA770BW - DEVICE_ALT0_VENDOR := Siemens - DEVICE_ALT0_MODEL := SE515 - IMAGES = - CFE_BOARD_ID := RTA770BW - CHIP_ID := 6345 - CFE_EXTRAS += --layoutver 5 - DEVICE_PACKAGES := $(B43_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += dynalink_rta770bw - -define Device/dynalink_rta770w - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := Dynalink - DEVICE_MODEL := RTA770W - IMAGES = - CFE_BOARD_ID := RTA770W - CHIP_ID := 6345 - CFE_EXTRAS += --layoutver 5 - DEVICE_PACKAGES := $(B43_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += dynalink_rta770w - -define Device/dynalink_rta1025w - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := Dynalink - DEVICE_MODEL := RTA1025W - CFE_BOARD_ID := RTA1025W_16 - CHIP_ID := 6348 - CFE_EXTRAS += --layoutver 5 - DEVICE_PACKAGES := $(B43_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += dynalink_rta1025w - -define Device/dynalink_rta1320 - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := Dynalink - DEVICE_MODEL := RTA1320 - CFE_BOARD_ID := RTA1320_16M - CHIP_ID := 6338 - CFE_EXTRAS += --layoutver 5 - DEFAULT := n -endef -TARGET_DEVICES += dynalink_rta1320 - -### Huawei ### -define Device/huawei_echolife-hg520v - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := Huawei - DEVICE_MODEL := EchoLife HG520v - CFE_BOARD_ID := HW6358GW_B - CHIP_ID := 6358 - CFE_EXTRAS += --rsa-signature "EchoLife_HG520v" - SOC := bcm6359 - DEVICE_PACKAGES := $(B43_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += huawei_echolife-hg520v - -define Device/huawei_echolife-hg553 - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := Huawei - DEVICE_MODEL := EchoLife HG553 - CFE_BOARD_ID := HW553 - CHIP_ID := 6358 - CFE_EXTRAS += --rsa-signature "EchoLife_HG553" --tag-version 7 - BLOCK_SIZE := 0x20000 - DEVICE_PACKAGES := $(B43_PACKAGES) $(USB2_PACKAGES) -endef -TARGET_DEVICES += huawei_echolife-hg553 - -define Device/huawei_echolife-hg556a-a - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := Huawei - DEVICE_MODEL := EchoLife HG556a - DEVICE_VARIANT := A - DEVICE_DESCRIPTION = Build firmware images for Huawei HG556a version A (Atheros) - CFE_BOARD_ID := HW556 - CHIP_ID := 6358 - CFE_EXTRAS += --rsa-signature "EchoLife_HG556a" --tag-version 8 - IMAGE_OFFSET := 0x20000 - DEVICE_PACKAGES := $(ATH9K_PACKAGES) $(USB2_PACKAGES) -endef -TARGET_DEVICES += huawei_echolife-hg556a-a - -define Device/huawei_echolife-hg556a-b - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := Huawei - DEVICE_MODEL := EchoLife HG556a - DEVICE_VARIANT := B - DEVICE_DESCRIPTION = Build firmware images for Huawei HG556a version B (Atheros) - CFE_BOARD_ID := HW556 - CHIP_ID := 6358 - CFE_EXTRAS += --rsa-signature "EchoLife_HG556a" --tag-version 8 - BLOCK_SIZE := 0x20000 - DEVICE_PACKAGES := $(ATH9K_PACKAGES) $(USB2_PACKAGES) -endef -TARGET_DEVICES += huawei_echolife-hg556a-b - -define Device/huawei_echolife-hg556a-c - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := Huawei - DEVICE_MODEL := EchoLife HG556a - DEVICE_VARIANT := C - DEVICE_DESCRIPTION = Build firmware images for Huawei HG556a version C (Ralink) - CFE_BOARD_ID := HW556 - CHIP_ID := 6358 - CFE_EXTRAS += --rsa-signature "EchoLife_HG556a" --tag-version 8 - BLOCK_SIZE := 0x20000 - DEVICE_PACKAGES := $(RT28_PACKAGES) $(USB2_PACKAGES) -endef -TARGET_DEVICES += huawei_echolife-hg556a-c - -define Device/huawei_echolife-hg622 - $(Device/bcm63xx) - DEVICE_VENDOR := Huawei - DEVICE_MODEL := EchoLife HG622 - IMAGES += sysupgrade.bin - CFE_BOARD_ID := 96368MVWG_hg622 - CHIP_ID := 6368 - CFE_EXTRAS += --tag-version 7 - BLOCK_SIZE := 0x20000 - FLASH_MB := 16 - DEVICE_PACKAGES := $(RT28_PACKAGES) $(USB2_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += huawei_echolife-hg622 - -define Device/huawei_echolife-hg655b - $(Device/bcm63xx) - DEVICE_VENDOR := Huawei - DEVICE_MODEL := EchoLife HG655b - CFE_BOARD_ID := HW65x - CHIP_ID := 6368 - CFE_EXTRAS += --tag-version 7 - IMAGE_OFFSET := 0x20000 - FLASH_MB := 8 - DEVICE_PACKAGES := $(RT28_PACKAGES) $(USB2_PACKAGES) -endef -TARGET_DEVICES += huawei_echolife-hg655b - -### Innacomm ### -define Device/innacomm_w3400v6 - $(Device/bcm63xx) - DEVICE_VENDOR := Innacomm - DEVICE_MODEL := W3400V6 - CFE_BOARD_ID := 96328ang - CHIP_ID := 6328 - FLASH_MB := 8 - DEVICE_PACKAGES := $(B43_PACKAGES) -endef -TARGET_DEVICES += innacomm_w3400v6 - -### Inteno ### -define Device/inteno_vg50 - $(Device/bcm63xx) - DEVICE_VENDOR := Inteno - DEVICE_MODEL := VG50 Multi-WAN CPE - IMAGES := - CFE_BOARD_ID := VW6339GU - CHIP_ID := 63268 - DEVICE_PACKAGES := $(USB2_PACKAGES) -endef -TARGET_DEVICES += inteno_vg50 - -### Inventel ### -define Device/inventel_livebox-1 - $(Device/bcm63xx_redboot) - DEVICE_VENDOR := Inventel - DEVICE_MODEL := Livebox 1 - SOC := bcm6348 - DEVICE_PACKAGES := $(B43_PACKAGES) $(USB1_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += inventel_livebox-1 - -### Netgear ### -define Device/netgear_cvg834g - $(Device/bcm33xx) - DEVICE_VENDOR := NETGEAR - DEVICE_MODEL := CVG834G - CHIP_ID := 3368 - HCS_MAGIC_BYTES := 0xa020 - HCS_REV_MIN := 0001 - HCS_REV_MAJ := 0022 - DEFAULT := n -endef -TARGET_DEVICES += netgear_cvg834g - -define Device/netgear_dg834gt-pn - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := NETGEAR - DEVICE_MODEL := DG834GT - DEVICE_ALT0_VENDOR := NETGEAR - DEVICE_ALT0_MODEL := DG834PN - CFE_BOARD_ID := 96348GW-10 - CHIP_ID := 6348 - DEVICE_PACKAGES := $(ATH5K_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += netgear_dg834gt-pn - -define Device/netgear_dg834g-v4 - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := NETGEAR - DEVICE_MODEL := DG834G - DEVICE_VARIANT := v4 - IMAGES := - CFE_BOARD_ID := 96348W3 - CHIP_ID := 6348 - DEVICE_PACKAGES := $(B43_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += netgear_dg834g-v4 - -define Device/netgear_dgnd3700-v1 - $(Device/bcm63xx_netgear) - DEVICE_MODEL := DGND3700 - DEVICE_VARIANT := v1 - CFE_BOARD_ID := 96368MVWG - CHIP_ID := 6368 - BLOCK_SIZE := 0x20000 - NETGEAR_BOARD_ID := U12L144T01_NETGEAR_NEWLED - NETGEAR_REGION := 1 - DEVICE_PACKAGES := $(B43_PACKAGES) $(USB2_PACKAGES) -endef -TARGET_DEVICES += netgear_dgnd3700-v1 - -define Device/netgear_dgnd3800b - $(Device/bcm63xx_netgear) - DEVICE_MODEL := DGND3800B - DEVICE_DTS := bcm6368-netgear-dgnd3700-v1 - CFE_BOARD_ID := 96368MVWG - CHIP_ID := 6368 - BLOCK_SIZE := 0x20000 - NETGEAR_BOARD_ID := U12L144T11_NETGEAR_NEWLED - NETGEAR_REGION := 1 - DEVICE_PACKAGES := $(B43_PACKAGES) $(USB2_PACKAGES) -endef -TARGET_DEVICES += netgear_dgnd3800b - -define Device/netgear_evg2000 - $(Device/bcm63xx_netgear) - DEVICE_MODEL := EVG2000 - CFE_BOARD_ID := 96369PVG - CHIP_ID := 6368 - BLOCK_SIZE := 0x20000 - NETGEAR_BOARD_ID := U12H154T90_NETGEAR - NETGEAR_REGION := 1 - SOC := bcm6369 - DEVICE_PACKAGES := $(B43_PACKAGES) $(USB2_PACKAGES) -endef -TARGET_DEVICES += netgear_evg2000 - -### NuCom ### -define Device/nucom_r5010un-v2 - $(Device/bcm63xx) - DEVICE_VENDOR := NuCom - DEVICE_MODEL := R5010UN - DEVICE_VARIANT := v2 - IMAGES += sysupgrade.bin - CFE_BOARD_ID := 96328ang - CHIP_ID := 6328 - FLASH_MB := 16 - DEVICE_PACKAGES := $(B43_PACKAGES) -endef -TARGET_DEVICES += nucom_r5010un-v2 - -### Observa ### -define Device/observa_vh4032n - $(Device/bcm63xx) - DEVICE_VENDOR := Observa - DEVICE_MODEL := VH4032N - IMAGES += sysupgrade.bin - CFE_BOARD_ID := 96368VVW - CHIP_ID := 6368 - BLOCK_SIZE := 0x20000 - FLASH_MB := 32 - DEVICE_PACKAGES := $(B43_PACKAGES) $(USB2_PACKAGES) -endef -TARGET_DEVICES += observa_vh4032n - -### Pirelli ### -define Device/pirelli_a226g - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := Pirelli - DEVICE_MODEL := A226G - CFE_BOARD_ID := DWV-S0 - CHIP_ID := 6358 - CFE_EXTRAS += --signature2 IMAGE --tag-version 8 - DEVICE_PACKAGES := $(B43_PACKAGES) $(USB2_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += pirelli_a226g - -define Device/pirelli_a226m - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := Pirelli - DEVICE_MODEL := A226M - CFE_BOARD_ID := DWV-S0 - CHIP_ID := 6358 - CFE_EXTRAS += --signature2 IMAGE --tag-version 8 - DEVICE_PACKAGES := $(USB2_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += pirelli_a226m - -define Device/pirelli_a226m-fwb - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := Pirelli - DEVICE_MODEL := A226M-FWB - CFE_BOARD_ID := DWV-S0 - CHIP_ID := 6358 - CFE_EXTRAS += --signature2 IMAGE --tag-version 8 - BLOCK_SIZE := 0x20000 - DEVICE_PACKAGES := $(USB2_PACKAGES) -endef -TARGET_DEVICES += pirelli_a226m-fwb - -define Device/pirelli_agpf-s0 - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := Pirelli - DEVICE_MODEL := Alice Gate VoIP 2 Plus Wi-Fi AGPF-S0 - CFE_BOARD_ID := AGPF-S0 - CHIP_ID := 6358 - CFE_EXTRAS += --signature2 IMAGE --tag-version 8 - BLOCK_SIZE := 0x20000 - DEVICE_PACKAGES := $(B43_PACKAGES) $(USB2_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += pirelli_agpf-s0 - -### Sagem ### -define Device/sagem_fast-2404 - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := Sagemcom - DEVICE_MODEL := F@st 2404 - CFE_BOARD_ID := F@ST2404 - CHIP_ID := 6348 - DEVICE_PACKAGES := $(B43_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += sagem_fast-2404 - -define Device/sagem_fast-2504n - $(Device/bcm63xx) - DEVICE_VENDOR := Sagemcom - DEVICE_MODEL := F@st 2504N - CFE_BOARD_ID := F@ST2504n - CHIP_ID := 6362 - DEVICE_PACKAGES := $(B43_PACKAGES) -endef -TARGET_DEVICES += sagem_fast-2504n - -define Device/sagem_fast-2604 - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := Sagemcom - DEVICE_MODEL := F@st 2604 - CFE_BOARD_ID := F@ST2604 - CHIP_ID := 6348 - DEVICE_PACKAGES := $(B43_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += sagem_fast-2604 - -define Device/sagem_fast-2704n - $(Device/bcm63xx) - DEVICE_VENDOR := Sagemcom - DEVICE_MODEL := F@st 2704N - CFE_BOARD_ID := F@ST2704N - CHIP_ID := 6318 - FLASH_MB := 8 - DEVICE_PACKAGES := $(B43_PACKAGES) $(USB2_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += sagem_fast-2704n - -define Device/sagem_fast-2704-v2 - $(Device/bcm63xx) - DEVICE_VENDOR := Sagemcom - DEVICE_MODEL := F@st 2704 - DEVICE_VARIANT := V2 - CFE_BOARD_ID := F@ST2704V2 - CHIP_ID := 6328 - FLASH_MB := 8 - DEVICE_PACKAGES := $(B43_PACKAGES) $(USB2_PACKAGES) -endef -TARGET_DEVICES += sagem_fast-2704-v2 - -### Sercomm ### -define Device/sercomm_ad1018-nor - $(Device/bcm63xx) - DEVICE_VENDOR := Sercomm - DEVICE_MODEL := AD1018 - DEVICE_VARIANT := SPI flash mod - CFE_BOARD_ID := 96328avngr - CHIP_ID := 6328 - DEVICE_PACKAGES := $(B43_PACKAGES) $(USB2_PACKAGES) -endef -TARGET_DEVICES += sercomm_ad1018-nor - -### SFR ### -define Device/sfr_neufbox-4-sercomm-r0 - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := SFR - DEVICE_MODEL := Neufbox 4 - DEVICE_VARIANT := Sercomm - CFE_BOARD_ID := 96358VW - CHIP_ID := 6358 - CFE_EXTRAS += --rsa-signature "$(VERSION_DIST)-$(firstword $(subst -,$(space),$(REVISION)))" - DEVICE_PACKAGES := $(B43_PACKAGES) $(USB2_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += sfr_neufbox-4-sercomm-r0 - -define Device/sfr_neufbox-4-foxconn-r1 - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := SFR - DEVICE_MODEL := Neufbox 4 - DEVICE_VARIANT := Foxconn - CFE_BOARD_ID := 96358VW - CHIP_ID := 6358 - CFE_EXTRAS += --rsa-signature "$(VERSION_DIST)-$(firstword $(subst -,$(space),$(REVISION)))" - DEVICE_PACKAGES := $(B43_PACKAGES) $(USB2_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += sfr_neufbox-4-foxconn-r1 - -define Device/sfr_neufbox-6-sercomm-r0 - $(Device/bcm63xx) - DEVICE_VENDOR := SFR - DEVICE_MODEL := Neufbox 6 - CFE_BOARD_ID := NB6-SER-r0 - CHIP_ID := 6362 - CFE_EXTRAS += --rsa-signature "$(VERSION_DIST)-$(firstword $(subst -,$(space),$(REVISION)))" - SOC := bcm6361 - DEVICE_PACKAGES := $(USB2_PACKAGES) -endef -TARGET_DEVICES += sfr_neufbox-6-sercomm-r0 - -define Device/sky_sr102 - $(Device/bcm63xx) - DEVICE_VENDOR := SKY - DEVICE_MODEL := SR102 - CFE_BOARD_ID := BSKYB_63168 - CHIP_ID := 63268 - CFE_EXTRAS += --rsa-signature "$(VERSION_DIST)-$(firstword $(subst -,$(space),$(REVISION)))" - SOC := bcm63168 - DEVICE_PACKAGES := $(USB2_PACKAGES) -endef -TARGET_DEVICES += sky_sr102 - -### T-Com ### -define Device/t-com_speedport-w-303v - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := T-Com - DEVICE_MODEL := Speedport W 303V - IMAGES := factory.bin sysupgrade.bin - IMAGE/factory.bin := cfe-spw303v-bin --pad 4 | spw303v-bin | xor-image - IMAGE/sysupgrade.bin := cfe-spw303v-bin | spw303v-bin - CFE_BOARD_ID := 96358-502V - CHIP_ID := 6358 - DEVICE_PACKAGES := $(B43_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += t-com_speedport-w-303v - -define Device/t-com_speedport-w-500v - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := T-Com - DEVICE_MODEL := Speedport W 500V - CFE_BOARD_ID := 96348GW - CHIP_ID := 6348 - DEVICE_PACKAGES := $(B43_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += t-com_speedport-w-500v - -### Technicolor ### -define Device/technicolor_tg582n - $(Device/bcm63xx) - DEVICE_VENDOR := Technicolor - DEVICE_MODEL := TG582n - IMAGES += sysupgrade.bin - CFE_BOARD_ID := DANT-1 - CHIP_ID := 6328 - FLASH_MB := 16 - DEVICE_PACKAGES := $(USB2_PACKAGES) $(B43_PACKAGES) -endef -TARGET_DEVICES += technicolor_tg582n - -define Device/technicolor_tg582n-telecom-italia - $(Device/bcm63xx) - DEVICE_VENDOR := Technicolor - DEVICE_MODEL := TG582n - DEVICE_VARIANT := Telecom Italia - IMAGES += sysupgrade.bin - CFE_BOARD_ID := DANT-V - CHIP_ID := 6328 - FLASH_MB := 16 - DEVICE_PACKAGES := $(USB2_PACKAGES) $(B43_PACKAGES) -endef -TARGET_DEVICES += technicolor_tg582n-telecom-italia - -### Tecom ### -define Device/tecom_gw6000 - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := Tecom - DEVICE_MODEL := GW6000 - CFE_BOARD_ID := 96348GW - CHIP_ID := 6348 - DEVICE_PACKAGES := $(BRCMWL_PACKAGES) $(USB1_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += tecom_gw6000 - -define Device/tecom_gw6200 - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := Tecom - DEVICE_MODEL := GW6200 - CFE_BOARD_ID := 96348GW - CHIP_ID := 6348 - CFE_EXTRAS += --rsa-signature "$(shell printf '\x99')" - DEVICE_PACKAGES := $(BRCMWL_PACKAGES) $(USB1_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += tecom_gw6200 - -### Telsey ### -define Device/telsey_cpva502plus - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := Telsey - DEVICE_MODEL := CPVA502+ - CFE_BOARD_ID := CPVA502+ - CHIP_ID := 6348 - CFE_EXTRAS += --signature "Telsey Tlc" --signature2 "99.99.999" - DEVICE_PACKAGES := $(B43_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += telsey_cpva502plus - -define Device/telsey_cpva642 - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := Telsey - DEVICE_MODEL := CPVA642-type (CPA-ZNTE60T) - CFE_BOARD_ID := CPVA642 - CHIP_ID := 6358 - CFE_EXTRAS += --signature "Telsey Tlc" --signature2 "99.99.999" --second-image-flag "0" - FLASH_MB := 8 - DEVICE_PACKAGES := $(RT63_PACKAGES) $(USB2_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += telsey_cpva642 - -define Device/telsey_magic - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := Alice - DEVICE_MODEL := W-Gate - DEVICE_ALT0_VENDOR := Telsey - DEVICE_ALT0_MODEL := MAGIC - IMAGES := - CFE_BOARD_ID := MAGIC - CHIP_ID := 6348 - DEVICE_PACKAGES := $(RT63_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += telsey_magic - -### TP-Link ### -define Device/tp-link_td-w8900gb - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := TP-Link - DEVICE_MODEL := TD-W8900GB - CFE_BOARD_ID := 96348GW-11 - CHIP_ID := 6348 - CFE_EXTRAS += --rsa-signature "$(shell printf 'PRID\x89\x10\x00\x02')" - IMAGE_OFFSET := 0x20000 - DEVICE_PACKAGES := $(B43_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += tp-link_td-w8900gb - -### USRobotics ### -define Device/usrobotics_usr9108 - $(Device/bcm63xx-legacy) - DEVICE_VENDOR := USRobotics - DEVICE_MODEL := USR9108 - CFE_BOARD_ID := 96348GW-A - CHIP_ID := 6348 - DEVICE_PACKAGES := $(B43_PACKAGES) $(USB1_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += usrobotics_usr9108 - -### ZyXEL ### -define Device/zyxel_p870hw-51a-v2 - $(Device/bcm63xx) - DEVICE_VENDOR := ZyXEL - DEVICE_MODEL := P870HW-51a - DEVICE_VARIANT := v2 - IMAGES := factory.bin - IMAGE/factory.bin := cfe-bin | zyxel-bin - CFE_BOARD_ID := 96368VVW - CHIP_ID := 6368 - CFE_EXTRAS += --rsa-signature "ZyXEL" --signature "ZyXEL_0001" - DEVICE_PACKAGES := $(B43_PACKAGES) - DEFAULT := n -endef -TARGET_DEVICES += zyxel_p870hw-51a-v2 diff --git a/target/linux/bcm63xx/image/bcm63xx_nand.mk b/target/linux/bcm63xx/image/bcm63xx_nand.mk deleted file mode 100644 index 5903d03632d197..00000000000000 --- a/target/linux/bcm63xx/image/bcm63xx_nand.mk +++ /dev/null @@ -1,204 +0,0 @@ -# -# BCM63XX NAND Profiles -# - -DEVICE_VARS += CFE_PART_FLAGS CFE_PART_ID -DEVICE_VARS += CFE_RAM_FILE -DEVICE_VARS += CFE_RAM_JFFS2_NAME CFE_RAM_JFFS2_PAD -DEVICE_VARS += CFE_WFI_CHIP_ID CFE_WFI_FLASH_TYPE -DEVICE_VARS += CFE_WFI_FLAGS CFE_WFI_VERSION -DEVICE_VARS += SERCOMM_PID SERCOMM_VERSION - -# CFE expects a single JFFS2 partition with cferam and kernel. However, -# it's possible to fool CFE into properly loading both cferam and kernel -# from two different JFFS2 partitions by adding dummy files (see -# cfe-jffs2-cferam and cfe-jffs2-kernel). -# Separate JFFS2 partitions allow upgrading openwrt without reflashing cferam -# JFFS2 partition, which is much safer in case anything goes wrong. -define Device/bcm63xx-nand - FILESYSTEMS := squashfs ubifs - KERNEL := kernel-bin | append-dtb | relocate-kernel | lzma | cfe-jffs2-kernel - KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | loader-lzma elf - IMAGES := cfe.bin sysupgrade.bin - IMAGE/cfe.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | cfe-jffs2-cferam | append-ubi | cfe-wfi-tag - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata - KERNEL_SIZE := 5120k - CFE_PART_FLAGS := - CFE_PART_ID := - CFE_RAM_FILE := - CFE_RAM_JFFS2_NAME := - CFE_RAM_JFFS2_PAD := - CFE_WFI_VERSION := - CFE_WFI_CHIP_ID = 0x$$(CHIP_ID) - CFE_WFI_FLASH_TYPE := - CFE_WFI_FLAGS := - UBINIZE_OPTS := -E 5 - DEVICE_PACKAGES += nand-utils -endef - -define Device/sercomm-nand - $(Device/bcm63xx-nand) - IMAGES := factory.img sysupgrade.bin - IMAGE/factory.img := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | cfe-sercomm-part | gzip | cfe-sercomm-load | cfe-sercomm-crypto - SERCOM_PID := - SERCOMM_VERSION := -endef - -### Comtrend ### -define Device/comtrend_vg-8050 - $(Device/bcm63xx-nand) - DEVICE_VENDOR := Comtrend - DEVICE_MODEL := VG-8050 - CHIP_ID := 63268 - SOC := bcm63169 - CFE_RAM_FILE := comtrend,vg-8050/cferam.000 - CFE_RAM_JFFS2_NAME := cferam.000 - BLOCKSIZE := 128k - PAGESIZE := 2048 - SUBPAGESIZE := 512 - VID_HDR_OFFSET := 2048 - DEVICE_PACKAGES += $(USB2_PACKAGES) - CFE_WFI_VERSION := 0x5732 - CFE_WFI_FLASH_TYPE := 3 -endef -TARGET_DEVICES += comtrend_vg-8050 - -define Device/comtrend_vr-3032u - $(Device/bcm63xx-nand) - DEVICE_VENDOR := Comtrend - DEVICE_MODEL := VR-3032u - CHIP_ID := 63268 - SOC := bcm63168 - CFE_RAM_FILE := comtrend,vr-3032u/cferam.000 - CFE_RAM_JFFS2_NAME := cferam.000 - BLOCKSIZE := 128k - PAGESIZE := 2048 - SUBPAGESIZE := 512 - VID_HDR_OFFSET := 2048 - DEVICE_PACKAGES += $(USB2_PACKAGES) - CFE_WFI_VERSION := 0x5732 - CFE_WFI_FLASH_TYPE := 3 -endef -TARGET_DEVICES += comtrend_vr-3032u - -### Huawei ### -define Device/huawei_hg253s-v2 - $(Device/bcm63xx-nand) - IMAGES := flash.bin sysupgrade.bin - IMAGE/flash.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | cfe-jffs2-cferam | append-ubi - DEVICE_VENDOR := Huawei - DEVICE_MODEL := HG253s - DEVICE_VARIANT := v2 - CHIP_ID := 6362 - CFE_PART_FLAGS := 1 - CFE_PART_ID := 0x0001EFEE - CFE_RAM_FILE := huawei,hg253s-v2/cferam.000 - CFE_RAM_JFFS2_NAME := cferam.000 - BLOCKSIZE := 128k - PAGESIZE := 2048 - SUBPAGESIZE := 512 - VID_HDR_OFFSET := 2048 - DEVICE_PACKAGES += $(USB2_PACKAGES) - CFE_WFI_FLASH_TYPE := 3 -endef -TARGET_DEVICES += huawei_hg253s-v2 - -### Netgear ### -define Device/netgear_dgnd3700-v2 - $(Device/bcm63xx-nand) - DEVICE_VENDOR := NETGEAR - DEVICE_MODEL := DGND3700 - DEVICE_VARIANT := v2 - CHIP_ID := 6362 - CFE_RAM_FILE := netgear,dgnd3700-v2/cferam - CFE_RAM_JFFS2_NAME := cferam - CFE_RAM_JFFS2_PAD := 496k - BLOCKSIZE := 16k - PAGESIZE := 512 - DEVICE_PACKAGES += $(B43_PACKAGES) $(USB2_PACKAGES) - CFE_WFI_VERSION := 0x5731 - CFE_WFI_FLASH_TYPE := 2 -endef -TARGET_DEVICES += netgear_dgnd3700-v2 - -### Sercomm ### -define Device/sercomm_ad1018 - $(Device/sercomm-nand) - DEVICE_VENDOR := Sercomm - DEVICE_MODEL := AD1018 - CHIP_ID := 6328 - CFE_RAM_FILE := sercomm,ad1018/cferam - CFE_RAM_JFFS2_NAME := cferam - BLOCKSIZE := 128k - PAGESIZE := 2048 - SUBPAGESIZE := 512 - VID_HDR_OFFSET := 2048 - DEVICE_PACKAGES += $(B43_PACKAGES) $(USB2_PACKAGES) - CFE_WFI_FLASH_TYPE := 3 - CFE_WFI_VERSION := 0x5731 - SERCOMM_PID := \ - 30 30 30 30 30 30 30 31 34 31 35 31 35 33 30 30 \ - 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \ - 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \ - 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \ - 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \ - 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \ - 30 30 30 30 33 30 31 33 30 30 30 30 30 30 30 30 \ - 0D 0A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - SERCOMM_VERSION := 1001 -endef -TARGET_DEVICES += sercomm_ad1018 - -define Device/sercomm_h500-s-lowi - $(Device/sercomm-nand) - DEVICE_VENDOR := Sercomm - DEVICE_MODEL := H500-s - DEVICE_VARIANT := lowi - DEVICE_LOADADDR := $(KERNEL_LOADADDR) - KERNEL := kernel-bin | append-dtb | lzma | cfe-jffs2-kernel - CHIP_ID := 63268 - SOC := bcm63167 - BLOCKSIZE := 128k - PAGESIZE := 2048 - SUBPAGESIZE := 512 - VID_HDR_OFFSET := 2048 - DEVICE_PACKAGES += $(USB2_PACKAGES) - SERCOMM_PID := \ - 30 30 30 30 30 30 30 31 34 33 34 62 33 31 30 30 \ - 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \ - 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \ - 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \ - 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \ - 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \ - 30 30 30 30 33 33 30 35 30 30 30 30 30 30 30 30 \ - 0D 0A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - SERCOMM_VERSION := 1001 -endef -TARGET_DEVICES += sercomm_h500-s-lowi - -define Device/sercomm_h500-s-vfes - $(Device/sercomm-nand) - DEVICE_VENDOR := Sercomm - DEVICE_MODEL := H500-s - DEVICE_VARIANT := vfes - DEVICE_LOADADDR := $(KERNEL_LOADADDR) - KERNEL := kernel-bin | append-dtb | lzma | cfe-jffs2-kernel - CHIP_ID := 63268 - SOC := bcm63167 - BLOCKSIZE := 128k - PAGESIZE := 2048 - SUBPAGESIZE := 512 - VID_HDR_OFFSET := 2048 - DEVICE_PACKAGES += $(USB2_PACKAGES) - SERCOMM_PID := \ - 30 30 30 30 30 30 30 31 34 32 35 38 34 62 30 30 \ - 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \ - 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \ - 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \ - 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \ - 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \ - 30 30 30 30 33 34 31 37 30 30 30 30 30 30 30 30 \ - 0D 0A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - SERCOMM_VERSION := 1001 -endef -TARGET_DEVICES += sercomm_h500-s-vfes diff --git a/target/linux/bcm63xx/image/lzma-loader/Makefile b/target/linux/bcm63xx/image/lzma-loader/Makefile deleted file mode 100644 index 2be41c875af309..00000000000000 --- a/target/linux/bcm63xx/image/lzma-loader/Makefile +++ /dev/null @@ -1,75 +0,0 @@ -# -# Copyright (C) 2020 Álvaro Fernández Rojas -# Copyright (C) 2014 Jonas Gorski -# Copyright (C) 2011 OpenWrt.org -# Copyright (C) 2011 Gabor Juhos -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -include $(TOPDIR)/rules.mk - -LZMA_TEXT_START := 0x80a00000 -LOADER := loader.bin -LOADER_NAME := $(basename $(notdir $(LOADER))) -LOADER_DATA := -TARGET_DIR := - -UART_BASE_3329 := 0xb0000100 -UART_BASE_3368 := 0xfff8c100 -UART_BASE_3380 := 0xb4e00200 -UART_BASE_3383 := 0xb4e00500 -UART_BASE_3384 := 0xb4e00500 -UART_BASE_6318 := 0xb0000100 -UART_BASE_6328 := 0xb0000100 -UART_BASE_6338 := 0xfffe0300 -UART_BASE_6345 := 0xfffe0300 -UART_BASE_6348 := 0xfffe0300 -UART_BASE_6358 := 0xfffe0100 -UART_BASE_6362 := 0xb0000100 -UART_BASE_6368 := 0xb0000100 -UART_BASE_63268 := 0xb0000180 -UART_BASE_6816 := 0xb0000100 -UART_BASE_6818 := 0xb0000100 -UART_BASE_6828 := 0xb0000180 -UART_BASE := $(if $(UART_BASE_$(CHIP_ID)),$(UART_BASE_$(CHIP_ID)),0) - -ifeq ($(TARGET_DIR),) -TARGET_DIR := $(KDIR) -endif - -LOADER_BIN := $(TARGET_DIR)/$(LOADER_NAME).bin -LOADER_ELF := $(TARGET_DIR)/$(LOADER_NAME).elf - -PKG_NAME := lzma-loader -PKG_BUILD_DIR := $(KDIR)/$(PKG_NAME) - -.PHONY : loader-compile loader.bin loader.elf - -$(PKG_BUILD_DIR)/.prepared: - mkdir $(PKG_BUILD_DIR) - $(CP) ./src/* $(PKG_BUILD_DIR)/ - touch $@ - -loader-compile: $(PKG_BUILD_DIR)/.prepared - $(MAKE) -C $(PKG_BUILD_DIR) CROSS_COMPILE="$(TARGET_CROSS)" \ - LZMA_TEXT_START=$(LZMA_TEXT_START) \ - LOADER_DATA=$(LOADER_DATA) \ - UART_BASE=$(UART_BASE) \ - clean all - -loader.elf: $(PKG_BUILD_DIR)/loader.elf - $(CP) $< $(LOADER_ELF) - -loader.bin: $(PKG_BUILD_DIR)/loader.bin - $(CP) $< $(LOADER_BIN) - -download: -prepare: $(PKG_BUILD_DIR)/.prepared -compile: loader-compile - -install: - -clean: - rm -rf $(PKG_BUILD_DIR) diff --git a/target/linux/bcm63xx/image/lzma-loader/src/LzmaDecode.c b/target/linux/bcm63xx/image/lzma-loader/src/LzmaDecode.c deleted file mode 100644 index cb8345377ea8a0..00000000000000 --- a/target/linux/bcm63xx/image/lzma-loader/src/LzmaDecode.c +++ /dev/null @@ -1,584 +0,0 @@ -/* - LzmaDecode.c - LZMA Decoder (optimized for Speed version) - - LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01) - http://www.7-zip.org/ - - LZMA SDK is licensed under two licenses: - 1) GNU Lesser General Public License (GNU LGPL) - 2) Common Public License (CPL) - It means that you can select one of these two licenses and - follow rules of that license. - - SPECIAL EXCEPTION: - Igor Pavlov, as the author of this Code, expressly permits you to - statically or dynamically link your Code (or bind by name) to the - interfaces of this file without subjecting your linked Code to the - terms of the CPL or GNU LGPL. Any modifications or additions - to this file, however, are subject to the LGPL or CPL terms. -*/ - -#include "LzmaDecode.h" - -#define kNumTopBits 24 -#define kTopValue ((UInt32)1 << kNumTopBits) - -#define kNumBitModelTotalBits 11 -#define kBitModelTotal (1 << kNumBitModelTotalBits) -#define kNumMoveBits 5 - -#define RC_READ_BYTE (*Buffer++) - -#define RC_INIT2 Code = 0; Range = 0xFFFFFFFF; \ - { int i; for(i = 0; i < 5; i++) { RC_TEST; Code = (Code << 8) | RC_READ_BYTE; }} - -#ifdef _LZMA_IN_CB - -#define RC_TEST { if (Buffer == BufferLim) \ - { SizeT size; int result = InCallback->Read(InCallback, &Buffer, &size); if (result != LZMA_RESULT_OK) return result; \ - BufferLim = Buffer + size; if (size == 0) return LZMA_RESULT_DATA_ERROR; }} - -#define RC_INIT Buffer = BufferLim = 0; RC_INIT2 - -#else - -#define RC_TEST { if (Buffer == BufferLim) return LZMA_RESULT_DATA_ERROR; } - -#define RC_INIT(buffer, bufferSize) Buffer = buffer; BufferLim = buffer + bufferSize; RC_INIT2 - -#endif - -#define RC_NORMALIZE if (Range < kTopValue) { RC_TEST; Range <<= 8; Code = (Code << 8) | RC_READ_BYTE; } - -#define IfBit0(p) RC_NORMALIZE; bound = (Range >> kNumBitModelTotalBits) * *(p); if (Code < bound) -#define UpdateBit0(p) Range = bound; *(p) += (kBitModelTotal - *(p)) >> kNumMoveBits; -#define UpdateBit1(p) Range -= bound; Code -= bound; *(p) -= (*(p)) >> kNumMoveBits; - -#define RC_GET_BIT2(p, mi, A0, A1) IfBit0(p) \ - { UpdateBit0(p); mi <<= 1; A0; } else \ - { UpdateBit1(p); mi = (mi + mi) + 1; A1; } - -#define RC_GET_BIT(p, mi) RC_GET_BIT2(p, mi, ; , ;) - -#define RangeDecoderBitTreeDecode(probs, numLevels, res) \ - { int i = numLevels; res = 1; \ - do { CProb *p = probs + res; RC_GET_BIT(p, res) } while(--i != 0); \ - res -= (1 << numLevels); } - - -#define kNumPosBitsMax 4 -#define kNumPosStatesMax (1 << kNumPosBitsMax) - -#define kLenNumLowBits 3 -#define kLenNumLowSymbols (1 << kLenNumLowBits) -#define kLenNumMidBits 3 -#define kLenNumMidSymbols (1 << kLenNumMidBits) -#define kLenNumHighBits 8 -#define kLenNumHighSymbols (1 << kLenNumHighBits) - -#define LenChoice 0 -#define LenChoice2 (LenChoice + 1) -#define LenLow (LenChoice2 + 1) -#define LenMid (LenLow + (kNumPosStatesMax << kLenNumLowBits)) -#define LenHigh (LenMid + (kNumPosStatesMax << kLenNumMidBits)) -#define kNumLenProbs (LenHigh + kLenNumHighSymbols) - - -#define kNumStates 12 -#define kNumLitStates 7 - -#define kStartPosModelIndex 4 -#define kEndPosModelIndex 14 -#define kNumFullDistances (1 << (kEndPosModelIndex >> 1)) - -#define kNumPosSlotBits 6 -#define kNumLenToPosStates 4 - -#define kNumAlignBits 4 -#define kAlignTableSize (1 << kNumAlignBits) - -#define kMatchMinLen 2 - -#define IsMatch 0 -#define IsRep (IsMatch + (kNumStates << kNumPosBitsMax)) -#define IsRepG0 (IsRep + kNumStates) -#define IsRepG1 (IsRepG0 + kNumStates) -#define IsRepG2 (IsRepG1 + kNumStates) -#define IsRep0Long (IsRepG2 + kNumStates) -#define PosSlot (IsRep0Long + (kNumStates << kNumPosBitsMax)) -#define SpecPos (PosSlot + (kNumLenToPosStates << kNumPosSlotBits)) -#define Align (SpecPos + kNumFullDistances - kEndPosModelIndex) -#define LenCoder (Align + kAlignTableSize) -#define RepLenCoder (LenCoder + kNumLenProbs) -#define Literal (RepLenCoder + kNumLenProbs) - -#if Literal != LZMA_BASE_SIZE -StopCompilingDueBUG -#endif - -int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size) -{ - unsigned char prop0; - if (size < LZMA_PROPERTIES_SIZE) - return LZMA_RESULT_DATA_ERROR; - prop0 = propsData[0]; - if (prop0 >= (9 * 5 * 5)) - return LZMA_RESULT_DATA_ERROR; - { - for (propsRes->pb = 0; prop0 >= (9 * 5); propsRes->pb++, prop0 -= (9 * 5)); - for (propsRes->lp = 0; prop0 >= 9; propsRes->lp++, prop0 -= 9); - propsRes->lc = prop0; - /* - unsigned char remainder = (unsigned char)(prop0 / 9); - propsRes->lc = prop0 % 9; - propsRes->pb = remainder / 5; - propsRes->lp = remainder % 5; - */ - } - - #ifdef _LZMA_OUT_READ - { - int i; - propsRes->DictionarySize = 0; - for (i = 0; i < 4; i++) - propsRes->DictionarySize += (UInt32)(propsData[1 + i]) << (i * 8); - if (propsRes->DictionarySize == 0) - propsRes->DictionarySize = 1; - } - #endif - return LZMA_RESULT_OK; -} - -#define kLzmaStreamWasFinishedId (-1) - -int LzmaDecode(CLzmaDecoderState *vs, - #ifdef _LZMA_IN_CB - ILzmaInCallback *InCallback, - #else - const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed, - #endif - unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed) -{ - CProb *p = vs->Probs; - SizeT nowPos = 0; - Byte previousByte = 0; - UInt32 posStateMask = (1 << (vs->Properties.pb)) - 1; - UInt32 literalPosMask = (1 << (vs->Properties.lp)) - 1; - int lc = vs->Properties.lc; - - #ifdef _LZMA_OUT_READ - - UInt32 Range = vs->Range; - UInt32 Code = vs->Code; - #ifdef _LZMA_IN_CB - const Byte *Buffer = vs->Buffer; - const Byte *BufferLim = vs->BufferLim; - #else - const Byte *Buffer = inStream; - const Byte *BufferLim = inStream + inSize; - #endif - int state = vs->State; - UInt32 rep0 = vs->Reps[0], rep1 = vs->Reps[1], rep2 = vs->Reps[2], rep3 = vs->Reps[3]; - int len = vs->RemainLen; - UInt32 globalPos = vs->GlobalPos; - UInt32 distanceLimit = vs->DistanceLimit; - - Byte *dictionary = vs->Dictionary; - UInt32 dictionarySize = vs->Properties.DictionarySize; - UInt32 dictionaryPos = vs->DictionaryPos; - - Byte tempDictionary[4]; - - #ifndef _LZMA_IN_CB - *inSizeProcessed = 0; - #endif - *outSizeProcessed = 0; - if (len == kLzmaStreamWasFinishedId) - return LZMA_RESULT_OK; - - if (dictionarySize == 0) - { - dictionary = tempDictionary; - dictionarySize = 1; - tempDictionary[0] = vs->TempDictionary[0]; - } - - if (len == kLzmaNeedInitId) - { - { - UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp)); - UInt32 i; - for (i = 0; i < numProbs; i++) - p[i] = kBitModelTotal >> 1; - rep0 = rep1 = rep2 = rep3 = 1; - state = 0; - globalPos = 0; - distanceLimit = 0; - dictionaryPos = 0; - dictionary[dictionarySize - 1] = 0; - #ifdef _LZMA_IN_CB - RC_INIT; - #else - RC_INIT(inStream, inSize); - #endif - } - len = 0; - } - while(len != 0 && nowPos < outSize) - { - UInt32 pos = dictionaryPos - rep0; - if (pos >= dictionarySize) - pos += dictionarySize; - outStream[nowPos++] = dictionary[dictionaryPos] = dictionary[pos]; - if (++dictionaryPos == dictionarySize) - dictionaryPos = 0; - len--; - } - if (dictionaryPos == 0) - previousByte = dictionary[dictionarySize - 1]; - else - previousByte = dictionary[dictionaryPos - 1]; - - #else /* if !_LZMA_OUT_READ */ - - int state = 0; - UInt32 rep0 = 1, rep1 = 1, rep2 = 1, rep3 = 1; - int len = 0; - const Byte *Buffer; - const Byte *BufferLim; - UInt32 Range; - UInt32 Code; - - #ifndef _LZMA_IN_CB - *inSizeProcessed = 0; - #endif - *outSizeProcessed = 0; - - { - UInt32 i; - UInt32 numProbs = Literal + ((UInt32)LZMA_LIT_SIZE << (lc + vs->Properties.lp)); - for (i = 0; i < numProbs; i++) - p[i] = kBitModelTotal >> 1; - } - - #ifdef _LZMA_IN_CB - RC_INIT; - #else - RC_INIT(inStream, inSize); - #endif - - #endif /* _LZMA_OUT_READ */ - - while(nowPos < outSize) - { - CProb *prob; - UInt32 bound; - int posState = (int)( - (nowPos - #ifdef _LZMA_OUT_READ - + globalPos - #endif - ) - & posStateMask); - - prob = p + IsMatch + (state << kNumPosBitsMax) + posState; - IfBit0(prob) - { - int symbol = 1; - UpdateBit0(prob) - prob = p + Literal + (LZMA_LIT_SIZE * - ((( - (nowPos - #ifdef _LZMA_OUT_READ - + globalPos - #endif - ) - & literalPosMask) << lc) + (previousByte >> (8 - lc)))); - - if (state >= kNumLitStates) - { - int matchByte; - #ifdef _LZMA_OUT_READ - UInt32 pos = dictionaryPos - rep0; - if (pos >= dictionarySize) - pos += dictionarySize; - matchByte = dictionary[pos]; - #else - matchByte = outStream[nowPos - rep0]; - #endif - do - { - int bit; - CProb *probLit; - matchByte <<= 1; - bit = (matchByte & 0x100); - probLit = prob + 0x100 + bit + symbol; - RC_GET_BIT2(probLit, symbol, if (bit != 0) break, if (bit == 0) break) - } - while (symbol < 0x100); - } - while (symbol < 0x100) - { - CProb *probLit = prob + symbol; - RC_GET_BIT(probLit, symbol) - } - previousByte = (Byte)symbol; - - outStream[nowPos++] = previousByte; - #ifdef _LZMA_OUT_READ - if (distanceLimit < dictionarySize) - distanceLimit++; - - dictionary[dictionaryPos] = previousByte; - if (++dictionaryPos == dictionarySize) - dictionaryPos = 0; - #endif - if (state < 4) state = 0; - else if (state < 10) state -= 3; - else state -= 6; - } - else - { - UpdateBit1(prob); - prob = p + IsRep + state; - IfBit0(prob) - { - UpdateBit0(prob); - rep3 = rep2; - rep2 = rep1; - rep1 = rep0; - state = state < kNumLitStates ? 0 : 3; - prob = p + LenCoder; - } - else - { - UpdateBit1(prob); - prob = p + IsRepG0 + state; - IfBit0(prob) - { - UpdateBit0(prob); - prob = p + IsRep0Long + (state << kNumPosBitsMax) + posState; - IfBit0(prob) - { - #ifdef _LZMA_OUT_READ - UInt32 pos; - #endif - UpdateBit0(prob); - - #ifdef _LZMA_OUT_READ - if (distanceLimit == 0) - #else - if (nowPos == 0) - #endif - return LZMA_RESULT_DATA_ERROR; - - state = state < kNumLitStates ? 9 : 11; - #ifdef _LZMA_OUT_READ - pos = dictionaryPos - rep0; - if (pos >= dictionarySize) - pos += dictionarySize; - previousByte = dictionary[pos]; - dictionary[dictionaryPos] = previousByte; - if (++dictionaryPos == dictionarySize) - dictionaryPos = 0; - #else - previousByte = outStream[nowPos - rep0]; - #endif - outStream[nowPos++] = previousByte; - #ifdef _LZMA_OUT_READ - if (distanceLimit < dictionarySize) - distanceLimit++; - #endif - - continue; - } - else - { - UpdateBit1(prob); - } - } - else - { - UInt32 distance; - UpdateBit1(prob); - prob = p + IsRepG1 + state; - IfBit0(prob) - { - UpdateBit0(prob); - distance = rep1; - } - else - { - UpdateBit1(prob); - prob = p + IsRepG2 + state; - IfBit0(prob) - { - UpdateBit0(prob); - distance = rep2; - } - else - { - UpdateBit1(prob); - distance = rep3; - rep3 = rep2; - } - rep2 = rep1; - } - rep1 = rep0; - rep0 = distance; - } - state = state < kNumLitStates ? 8 : 11; - prob = p + RepLenCoder; - } - { - int numBits, offset; - CProb *probLen = prob + LenChoice; - IfBit0(probLen) - { - UpdateBit0(probLen); - probLen = prob + LenLow + (posState << kLenNumLowBits); - offset = 0; - numBits = kLenNumLowBits; - } - else - { - UpdateBit1(probLen); - probLen = prob + LenChoice2; - IfBit0(probLen) - { - UpdateBit0(probLen); - probLen = prob + LenMid + (posState << kLenNumMidBits); - offset = kLenNumLowSymbols; - numBits = kLenNumMidBits; - } - else - { - UpdateBit1(probLen); - probLen = prob + LenHigh; - offset = kLenNumLowSymbols + kLenNumMidSymbols; - numBits = kLenNumHighBits; - } - } - RangeDecoderBitTreeDecode(probLen, numBits, len); - len += offset; - } - - if (state < 4) - { - int posSlot; - state += kNumLitStates; - prob = p + PosSlot + - ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << - kNumPosSlotBits); - RangeDecoderBitTreeDecode(prob, kNumPosSlotBits, posSlot); - if (posSlot >= kStartPosModelIndex) - { - int numDirectBits = ((posSlot >> 1) - 1); - rep0 = (2 | ((UInt32)posSlot & 1)); - if (posSlot < kEndPosModelIndex) - { - rep0 <<= numDirectBits; - prob = p + SpecPos + rep0 - posSlot - 1; - } - else - { - numDirectBits -= kNumAlignBits; - do - { - RC_NORMALIZE - Range >>= 1; - rep0 <<= 1; - if (Code >= Range) - { - Code -= Range; - rep0 |= 1; - } - } - while (--numDirectBits != 0); - prob = p + Align; - rep0 <<= kNumAlignBits; - numDirectBits = kNumAlignBits; - } - { - int i = 1; - int mi = 1; - do - { - CProb *prob3 = prob + mi; - RC_GET_BIT2(prob3, mi, ; , rep0 |= i); - i <<= 1; - } - while(--numDirectBits != 0); - } - } - else - rep0 = posSlot; - if (++rep0 == (UInt32)(0)) - { - /* it's for stream version */ - len = kLzmaStreamWasFinishedId; - break; - } - } - - len += kMatchMinLen; - #ifdef _LZMA_OUT_READ - if (rep0 > distanceLimit) - #else - if (rep0 > nowPos) - #endif - return LZMA_RESULT_DATA_ERROR; - - #ifdef _LZMA_OUT_READ - if (dictionarySize - distanceLimit > (UInt32)len) - distanceLimit += len; - else - distanceLimit = dictionarySize; - #endif - - do - { - #ifdef _LZMA_OUT_READ - UInt32 pos = dictionaryPos - rep0; - if (pos >= dictionarySize) - pos += dictionarySize; - previousByte = dictionary[pos]; - dictionary[dictionaryPos] = previousByte; - if (++dictionaryPos == dictionarySize) - dictionaryPos = 0; - #else - previousByte = outStream[nowPos - rep0]; - #endif - len--; - outStream[nowPos++] = previousByte; - } - while(len != 0 && nowPos < outSize); - } - } - RC_NORMALIZE; - - #ifdef _LZMA_OUT_READ - vs->Range = Range; - vs->Code = Code; - vs->DictionaryPos = dictionaryPos; - vs->GlobalPos = globalPos + (UInt32)nowPos; - vs->DistanceLimit = distanceLimit; - vs->Reps[0] = rep0; - vs->Reps[1] = rep1; - vs->Reps[2] = rep2; - vs->Reps[3] = rep3; - vs->State = state; - vs->RemainLen = len; - vs->TempDictionary[0] = tempDictionary[0]; - #endif - - #ifdef _LZMA_IN_CB - vs->Buffer = Buffer; - vs->BufferLim = BufferLim; - #else - *inSizeProcessed = (SizeT)(Buffer - inStream); - #endif - *outSizeProcessed = nowPos; - return LZMA_RESULT_OK; -} diff --git a/target/linux/bcm63xx/image/lzma-loader/src/LzmaDecode.h b/target/linux/bcm63xx/image/lzma-loader/src/LzmaDecode.h deleted file mode 100644 index 2870eeb9c9c115..00000000000000 --- a/target/linux/bcm63xx/image/lzma-loader/src/LzmaDecode.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - LzmaDecode.h - LZMA Decoder interface - - LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01) - http://www.7-zip.org/ - - LZMA SDK is licensed under two licenses: - 1) GNU Lesser General Public License (GNU LGPL) - 2) Common Public License (CPL) - It means that you can select one of these two licenses and - follow rules of that license. - - SPECIAL EXCEPTION: - Igor Pavlov, as the author of this code, expressly permits you to - statically or dynamically link your code (or bind by name) to the - interfaces of this file without subjecting your linked code to the - terms of the CPL or GNU LGPL. Any modifications or additions - to this file, however, are subject to the LGPL or CPL terms. -*/ - -#ifndef __LZMADECODE_H -#define __LZMADECODE_H - -#include "LzmaTypes.h" - -/* #define _LZMA_IN_CB */ -/* Use callback for input data */ - -/* #define _LZMA_OUT_READ */ -/* Use read function for output data */ - -/* #define _LZMA_PROB32 */ -/* It can increase speed on some 32-bit CPUs, - but memory usage will be doubled in that case */ - -/* #define _LZMA_LOC_OPT */ -/* Enable local speed optimizations inside code */ - -#ifdef _LZMA_PROB32 -#define CProb UInt32 -#else -#define CProb UInt16 -#endif - -#define LZMA_RESULT_OK 0 -#define LZMA_RESULT_DATA_ERROR 1 - -#ifdef _LZMA_IN_CB -typedef struct _ILzmaInCallback -{ - int (*Read)(void *object, const unsigned char **buffer, SizeT *bufferSize); -} ILzmaInCallback; -#endif - -#define LZMA_BASE_SIZE 1846 -#define LZMA_LIT_SIZE 768 - -#define LZMA_PROPERTIES_SIZE 5 - -typedef struct _CLzmaProperties -{ - int lc; - int lp; - int pb; - #ifdef _LZMA_OUT_READ - UInt32 DictionarySize; - #endif -}CLzmaProperties; - -int LzmaDecodeProperties(CLzmaProperties *propsRes, const unsigned char *propsData, int size); - -#define LzmaGetNumProbs(Properties) (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((Properties)->lc + (Properties)->lp))) - -#define kLzmaNeedInitId (-2) - -typedef struct _CLzmaDecoderState -{ - CLzmaProperties Properties; - CProb *Probs; - - #ifdef _LZMA_IN_CB - const unsigned char *Buffer; - const unsigned char *BufferLim; - #endif - - #ifdef _LZMA_OUT_READ - unsigned char *Dictionary; - UInt32 Range; - UInt32 Code; - UInt32 DictionaryPos; - UInt32 GlobalPos; - UInt32 DistanceLimit; - UInt32 Reps[4]; - int State; - int RemainLen; - unsigned char TempDictionary[4]; - #endif -} CLzmaDecoderState; - -#ifdef _LZMA_OUT_READ -#define LzmaDecoderInit(vs) { (vs)->RemainLen = kLzmaNeedInitId; } -#endif - -int LzmaDecode(CLzmaDecoderState *vs, - #ifdef _LZMA_IN_CB - ILzmaInCallback *inCallback, - #else - const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed, - #endif - unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed); - -#endif diff --git a/target/linux/bcm63xx/image/lzma-loader/src/LzmaTypes.h b/target/linux/bcm63xx/image/lzma-loader/src/LzmaTypes.h deleted file mode 100644 index 9c27290757c4f7..00000000000000 --- a/target/linux/bcm63xx/image/lzma-loader/src/LzmaTypes.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -LzmaTypes.h - -Types for LZMA Decoder - -This file written and distributed to public domain by Igor Pavlov. -This file is part of LZMA SDK 4.40 (2006-05-01) -*/ - -#ifndef __LZMATYPES_H -#define __LZMATYPES_H - -#ifndef _7ZIP_BYTE_DEFINED -#define _7ZIP_BYTE_DEFINED -typedef unsigned char Byte; -#endif - -#ifndef _7ZIP_UINT16_DEFINED -#define _7ZIP_UINT16_DEFINED -typedef unsigned short UInt16; -#endif - -#ifndef _7ZIP_UINT32_DEFINED -#define _7ZIP_UINT32_DEFINED -#ifdef _LZMA_UINT32_IS_ULONG -typedef unsigned long UInt32; -#else -typedef unsigned int UInt32; -#endif -#endif - -/* #define _LZMA_NO_SYSTEM_SIZE_T */ -/* You can use it, if you don't want */ - -#ifndef _7ZIP_SIZET_DEFINED -#define _7ZIP_SIZET_DEFINED -#ifdef _LZMA_NO_SYSTEM_SIZE_T -typedef UInt32 SizeT; -#else -#include -typedef size_t SizeT; -#endif -#endif - -#endif diff --git a/target/linux/bcm63xx/image/lzma-loader/src/Makefile b/target/linux/bcm63xx/image/lzma-loader/src/Makefile deleted file mode 100644 index 0310051a93027a..00000000000000 --- a/target/linux/bcm63xx/image/lzma-loader/src/Makefile +++ /dev/null @@ -1,88 +0,0 @@ -# -# Makefile for the LZMA compressed kernel loader for -# Atheros AR7XXX/AR9XXX based boards -# -# Copyright (C) 2020 Álvaro Fernández Rojas -# Copyright (C) 2014 Jonas Gorski -# Copyright (C) 2011 Gabor Juhos -# -# Some parts of this file was based on the OpenWrt specific lzma-loader -# for the BCM47xx and ADM5120 based boards: -# Copyright (C) 2004 Manuel Novoa III (mjn3@codepoet.org) -# Copyright (C) 2005 Mineharu Takahara -# Copyright (C) 2005 by Oleg I. Vdovikin -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 as published -# by the Free Software Foundation. -# - -LOADER_ADDR := -KERNEL_ADDR := -LZMA_TEXT_START := 0x80a00000 -LOADER_DATA := - -CC := $(CROSS_COMPILE)gcc -LD := $(CROSS_COMPILE)ld -OBJCOPY := $(CROSS_COMPILE)objcopy -OBJDUMP := $(CROSS_COMPILE)objdump - -BIN_FLAGS := -O binary -R .reginfo -R .note -R .comment -R .mdebug \ - -R .MIPS.abiflags -S - -CFLAGS = -D__KERNEL__ -Wall -Wstrict-prototypes -Wno-trigraphs -Os \ - -fno-strict-aliasing -fno-common -fomit-frame-pointer -G 0 \ - -mno-abicalls -fno-pic -ffunction-sections -pipe \ - -ffreestanding -fhonour-copts \ - -mabi=32 -march=mips32 \ - -Wa,-32 -Wa,-march=mips32 -Wa,-mips32 -Wa,--trap -CFLAGS += -D_LZMA_PROB32 -CFLAGS += -DUART_BASE=$(UART_BASE) - -ASFLAGS = $(CFLAGS) -D__ASSEMBLY__ - -LDFLAGS = -static --gc-sections -no-warn-mismatch -LDFLAGS += -e startup -T loader.lds -Ttext $(LZMA_TEXT_START) - -O_FORMAT = $(shell $(OBJDUMP) -i | head -2 | grep elf32) - -OBJECTS := head.o loader.o cache.o board.o printf.o LzmaDecode.o - -ifneq ($(strip $(LOADER_DATA)),) -OBJECTS += data.o -CFLAGS += -DLZMA_WRAPPER=1 -DLOADADDR=$(KERNEL_ADDR) -endif - - -all: loader.elf - -# Don't build dependencies, this may die if $(CC) isn't gcc -dep: - -install: - -%.o : %.c - $(CC) $(CFLAGS) -c -o $@ $< - -%.o : %.S - $(CC) $(ASFLAGS) -c -o $@ $< - -data.o: $(LOADER_DATA) - $(LD) -r -b binary --oformat $(O_FORMAT) -T lzma-data.lds -o $@ $< - -loader: $(OBJECTS) - $(LD) $(LDFLAGS) -o $@ $(OBJECTS) - -loader.bin: loader - $(OBJCOPY) $(BIN_FLAGS) $< $@ - -loader2.o: loader.bin - $(LD) -r -b binary --oformat $(O_FORMAT) -o $@ $< - -loader.elf: loader2.o - $(LD) -e startup -T loader2.lds -Ttext $(LOADER_ADDR) -o $@ $< - -mrproper: clean - -clean: - rm -f loader *.elf *.bin *.o diff --git a/target/linux/bcm63xx/image/lzma-loader/src/board.c b/target/linux/bcm63xx/image/lzma-loader/src/board.c deleted file mode 100644 index 843710baeebf90..00000000000000 --- a/target/linux/bcm63xx/image/lzma-loader/src/board.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * BCM63XX specific implementation parts - * - * Copyright (C) 2020 Álvaro Fernández Rojas - * Copyright (C) 2014 Jonas Gorski - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - */ - -#include -#include "config.h" - -#define READREG(r) *(volatile unsigned int *)(r) -#define WRITEREG(r,v) *(volatile unsigned int *)(r) = v - -#define UART_IR_REG 0x10 -#define UART_FIFO_REG 0x14 - -static void wait_xfered(void) -{ - unsigned int val; - - do { - val = READREG(UART_BASE + UART_IR_REG); - if (val & (1 << 5)) - break; - } while (1); -} - -void board_putc(int ch) -{ - if (!UART_BASE) - return; - - wait_xfered(); - WRITEREG(UART_BASE + UART_FIFO_REG, ch); - wait_xfered(); -} diff --git a/target/linux/bcm63xx/image/lzma-loader/src/cache.c b/target/linux/bcm63xx/image/lzma-loader/src/cache.c deleted file mode 100644 index 93751c311ad00f..00000000000000 --- a/target/linux/bcm63xx/image/lzma-loader/src/cache.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * LZMA compressed kernel loader for Atheros AR7XXX/AR9XXX based boards - * - * Copyright (C) 2011 Gabor Juhos - * - * The cache manipulation routine has been taken from the U-Boot project. - * (C) Copyright 2003 - * Wolfgang Denk, DENX Software Engineering, - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include "cache.h" -#include "cacheops.h" -#include "config.h" -#include "printf.h" - -#define cache_op(op,addr) \ - __asm__ __volatile__( \ - " .set push \n" \ - " .set noreorder \n" \ - " .set mips3\n\t \n" \ - " cache %0, %1 \n" \ - " .set pop \n" \ - : \ - : "i" (op), "R" (*(unsigned char *)(addr))) - -void flush_cache(unsigned long start_addr, unsigned long size) -{ - unsigned long lsize = CONFIG_CACHELINE_SIZE; - unsigned long addr = start_addr & ~(lsize - 1); - unsigned long aend = (start_addr + size + (lsize - 1)) & ~(lsize - 1); - - printf("blasting from 0x%08x to 0x%08x (0x%08x - 0x%08x)\n", start_addr, size, addr, aend); - - while (1) { - cache_op(Hit_Writeback_Inv_D, addr); - cache_op(Hit_Invalidate_I, addr); - if (addr == aend) - break; - addr += lsize; - } -} diff --git a/target/linux/bcm63xx/image/lzma-loader/src/cache.h b/target/linux/bcm63xx/image/lzma-loader/src/cache.h deleted file mode 100644 index 506a235884d0be..00000000000000 --- a/target/linux/bcm63xx/image/lzma-loader/src/cache.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * LZMA compressed kernel loader for Atheros AR7XXX/AR9XXX based boards - * - * Copyright (C) 2011 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#ifndef __CACHE_H -#define __CACHE_H - -void flush_cache(unsigned long start_addr, unsigned long size); - -#endif /* __CACHE_H */ diff --git a/target/linux/bcm63xx/image/lzma-loader/src/cacheops.h b/target/linux/bcm63xx/image/lzma-loader/src/cacheops.h deleted file mode 100644 index 70bcad7694dfc4..00000000000000 --- a/target/linux/bcm63xx/image/lzma-loader/src/cacheops.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Cache operations for the cache instruction. - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * (C) Copyright 1996, 97, 99, 2002, 03 Ralf Baechle - * (C) Copyright 1999 Silicon Graphics, Inc. - */ -#ifndef __ASM_CACHEOPS_H -#define __ASM_CACHEOPS_H - -/* - * Cache Operations available on all MIPS processors with R4000-style caches - */ -#define Index_Invalidate_I 0x00 -#define Index_Writeback_Inv_D 0x01 -#define Index_Load_Tag_I 0x04 -#define Index_Load_Tag_D 0x05 -#define Index_Store_Tag_I 0x08 -#define Index_Store_Tag_D 0x09 -#if defined(CONFIG_CPU_LOONGSON2) -#define Hit_Invalidate_I 0x00 -#else -#define Hit_Invalidate_I 0x10 -#endif -#define Hit_Invalidate_D 0x11 -#define Hit_Writeback_Inv_D 0x15 - -/* - * R4000-specific cacheops - */ -#define Create_Dirty_Excl_D 0x0d -#define Fill 0x14 -#define Hit_Writeback_I 0x18 -#define Hit_Writeback_D 0x19 - -/* - * R4000SC and R4400SC-specific cacheops - */ -#define Index_Invalidate_SI 0x02 -#define Index_Writeback_Inv_SD 0x03 -#define Index_Load_Tag_SI 0x06 -#define Index_Load_Tag_SD 0x07 -#define Index_Store_Tag_SI 0x0A -#define Index_Store_Tag_SD 0x0B -#define Create_Dirty_Excl_SD 0x0f -#define Hit_Invalidate_SI 0x12 -#define Hit_Invalidate_SD 0x13 -#define Hit_Writeback_Inv_SD 0x17 -#define Hit_Writeback_SD 0x1b -#define Hit_Set_Virtual_SI 0x1e -#define Hit_Set_Virtual_SD 0x1f - -/* - * R5000-specific cacheops - */ -#define R5K_Page_Invalidate_S 0x17 - -/* - * RM7000-specific cacheops - */ -#define Page_Invalidate_T 0x16 - -/* - * R10000-specific cacheops - * - * Cacheops 0x02, 0x06, 0x0a, 0x0c-0x0e, 0x16, 0x1a and 0x1e are unused. - * Most of the _S cacheops are identical to the R4000SC _SD cacheops. - */ -#define Index_Writeback_Inv_S 0x03 -#define Index_Load_Tag_S 0x07 -#define Index_Store_Tag_S 0x0B -#define Hit_Invalidate_S 0x13 -#define Cache_Barrier 0x14 -#define Hit_Writeback_Inv_S 0x17 -#define Index_Load_Data_I 0x18 -#define Index_Load_Data_D 0x19 -#define Index_Load_Data_S 0x1b -#define Index_Store_Data_I 0x1c -#define Index_Store_Data_D 0x1d -#define Index_Store_Data_S 0x1f - -#endif /* __ASM_CACHEOPS_H */ diff --git a/target/linux/bcm63xx/image/lzma-loader/src/config.h b/target/linux/bcm63xx/image/lzma-loader/src/config.h deleted file mode 100644 index bee78c1658fa74..00000000000000 --- a/target/linux/bcm63xx/image/lzma-loader/src/config.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * LZMA compressed kernel loader for Atheros AR7XXX/AR9XXX based boards - * - * Copyright (C) 2011 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#ifndef _CONFIG_H_ -#define _CONFIG_H_ - -#define CONFIG_ICACHE_SIZE (32 * 1024) -#define CONFIG_DCACHE_SIZE (32 * 1024) -#define CONFIG_CACHELINE_SIZE 16 - -#endif /* _CONFIG_H_ */ diff --git a/target/linux/bcm63xx/image/lzma-loader/src/cp0regdef.h b/target/linux/bcm63xx/image/lzma-loader/src/cp0regdef.h deleted file mode 100644 index 0d824f44443d39..00000000000000 --- a/target/linux/bcm63xx/image/lzma-loader/src/cp0regdef.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 1994, 1995, 1996, 1997, 2000, 2001 by Ralf Baechle - * - * Copyright (C) 2001, Monta Vista Software - * Author: jsun@mvista.com or jsun@junsun.net - */ -#ifndef _cp0regdef_h_ -#define _cp0regdef_h_ - -#define CP0_INDEX $0 -#define CP0_RANDOM $1 -#define CP0_ENTRYLO0 $2 -#define CP0_ENTRYLO1 $3 -#define CP0_CONTEXT $4 -#define CP0_PAGEMASK $5 -#define CP0_WIRED $6 -#define CP0_BADVADDR $8 -#define CP0_COUNT $9 -#define CP0_ENTRYHI $10 -#define CP0_COMPARE $11 -#define CP0_STATUS $12 -#define CP0_CAUSE $13 -#define CP0_EPC $14 -#define CP0_PRID $15 -#define CP0_CONFIG $16 -#define CP0_LLADDR $17 -#define CP0_WATCHLO $18 -#define CP0_WATCHHI $19 -#define CP0_XCONTEXT $20 -#define CP0_FRAMEMASK $21 -#define CP0_DIAGNOSTIC $22 -#define CP0_PERFORMANCE $25 -#define CP0_ECC $26 -#define CP0_CACHEERR $27 -#define CP0_TAGLO $28 -#define CP0_TAGHI $29 -#define CP0_ERROREPC $30 - -#define read_32bit_c0_register(reg,sel) \ -({ int __res; \ - if (sel == 0) \ - __asm__ __volatile__( \ - "mfc0\t%0, " #reg "\n\t" \ - : "=r" (__res)); \ - else \ - __asm__ __volatile__( \ - ".set\tmips32\n\t" \ - "mfc0\t%0, " #reg ", " #sel "\n\t" \ - ".set mips0\n\t" \ - : "=r" (__res)); \ - __res; \ -}) - -#endif diff --git a/target/linux/bcm63xx/image/lzma-loader/src/head.S b/target/linux/bcm63xx/image/lzma-loader/src/head.S deleted file mode 100644 index 47a7c9bd6300ad..00000000000000 --- a/target/linux/bcm63xx/image/lzma-loader/src/head.S +++ /dev/null @@ -1,121 +0,0 @@ -/* - * LZMA compressed kernel loader for Atheros AR7XXX/AR9XXX based boards - * - * Copyright (C) 2011 Gabor Juhos - * - * Some parts of this code was based on the OpenWrt specific lzma-loader - * for the BCM47xx and ADM5120 based boards: - * Copyright (C) 2004 Manuel Novoa III (mjn3@codepoet.org) - * Copyright (C) 2005 by Oleg I. Vdovikin - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - */ - -#include -#include -#include "cp0regdef.h" -#include "cacheops.h" -#include "config.h" - -#define KSEG0 0x80000000 - - .macro ehb - sll zero, 3 - .endm - - .text - -LEAF(startup) - .set noreorder - .set mips32 - - mtc0 zero, CP0_WATCHLO # clear watch registers - mtc0 zero, CP0_WATCHHI - mtc0 zero, CP0_CAUSE # clear before writing status register - - mfc0 t0, CP0_STATUS - li t1, 0x1000001f - or t0, t1 - xori t0, 0x1f - mtc0 t0, CP0_STATUS - ehb - - mtc0 zero, CP0_COUNT - mtc0 zero, CP0_COMPARE - ehb - - la t0, __reloc_label # get linked address of label - bal __reloc_label # branch and link to label to - nop # get actual address -__reloc_label: - subu t0, ra, t0 # get reloc_delta - - beqz t0, __reloc_done # if delta is 0 we are in the right place - nop - - /* Copy our code to the right place */ - la t1, _code_start # get linked address of _code_start - la t2, _code_end # get linked address of _code_end - addu t0, t0, t1 # calculate actual address of _code_start - -__reloc_copy: - lw t3, 0(t0) - sw t3, 0(t1) - add t1, 4 - blt t1, t2, __reloc_copy - add t0, 4 - - /* flush cache */ - la t0, _code_start - la t1, _code_end - - li t2, ~(CONFIG_CACHELINE_SIZE - 1) - and t0, t2 - and t1, t2 - li t2, CONFIG_CACHELINE_SIZE - - b __flush_check - nop - -__flush_line: - cache Hit_Writeback_Inv_D, 0(t0) - cache Hit_Invalidate_I, 0(t0) - add t0, t2 - -__flush_check: - bne t0, t1, __flush_line - nop - - sync - -__reloc_done: - - /* clear bss */ - la t0, _bss_start - la t1, _bss_end - b __bss_check - nop - -__bss_fill: - sw zero, 0(t0) - addi t0, 4 - -__bss_check: - bne t0, t1, __bss_fill - nop - - /* Setup new "C" stack */ - la sp, _stack - - /* reserve stack space for a0-a3 registers */ - subu sp, 16 - - /* jump to the decompressor routine */ - la t0, loader_main - jr t0 - nop - - .set reorder -END(startup) diff --git a/target/linux/bcm63xx/image/lzma-loader/src/loader.c b/target/linux/bcm63xx/image/lzma-loader/src/loader.c deleted file mode 100644 index 37f42e5cef3bdc..00000000000000 --- a/target/linux/bcm63xx/image/lzma-loader/src/loader.c +++ /dev/null @@ -1,172 +0,0 @@ -/* - * LZMA compressed kernel loader for Atheros AR7XXX/AR9XXX based boards - * - * Copyright (C) 2011 Gabor Juhos - * - * Some parts of this code was based on the OpenWrt specific lzma-loader - * for the BCM47xx and ADM5120 based boards: - * Copyright (C) 2004 Manuel Novoa III (mjn3@codepoet.org) - * Copyright (C) 2005 Mineharu Takahara - * Copyright (C) 2005 by Oleg I. Vdovikin - * - * The image_header structure has been taken from the U-Boot project. - * (C) Copyright 2008 Semihalf - * (C) Copyright 2000-2005 - * Wolfgang Denk, DENX Software Engineering, wd@denx.de. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - */ - -#include -#include - -#include "config.h" -#include "cache.h" -#include "printf.h" -#include "LzmaDecode.h" - -#define KSEG0 0x80000000 -#define KSEG1 0xa0000000 - -#define KSEG1ADDR(a) ((((unsigned)(a)) & 0x1fffffffU) | KSEG1) - -#undef LZMA_DEBUG - -#ifdef LZMA_DEBUG -# define DBG(f, a...) printf(f, ## a) -#else -# define DBG(f, a...) do {} while (0) -#endif - -/* beyond the image end, size not known in advance */ -extern unsigned char workspace[]; - - -static CLzmaDecoderState lzma_state; -static unsigned char *lzma_data; -static unsigned long lzma_datasize; -static unsigned long lzma_outsize; -static unsigned long kernel_la; - -static void halt(void) -{ - printf("\nSystem halted!\n"); - for(;;); -} - -static __inline__ unsigned char lzma_get_byte(void) -{ - unsigned char c; - - lzma_datasize--; - c = *lzma_data++; - - return c; -} - -static int lzma_init_props(void) -{ - unsigned char props[LZMA_PROPERTIES_SIZE]; - int res; - int i; - - /* read lzma properties */ - for (i = 0; i < LZMA_PROPERTIES_SIZE; i++) - props[i] = lzma_get_byte(); - - /* read the lower half of uncompressed size in the header */ - lzma_outsize = ((SizeT) lzma_get_byte()) + - ((SizeT) lzma_get_byte() << 8) + - ((SizeT) lzma_get_byte() << 16) + - ((SizeT) lzma_get_byte() << 24); - - /* skip rest of the header (upper half of uncompressed size) */ - for (i = 0; i < 4; i++) - lzma_get_byte(); - - res = LzmaDecodeProperties(&lzma_state.Properties, props, - LZMA_PROPERTIES_SIZE); - return res; -} - -static int lzma_decompress(unsigned char *outStream) -{ - SizeT ip, op; - int ret; - - lzma_state.Probs = (CProb *) workspace; - - ret = LzmaDecode(&lzma_state, lzma_data, lzma_datasize, &ip, outStream, - lzma_outsize, &op); - - if (ret != LZMA_RESULT_OK) { - int i; - - DBG("LzmaDecode error %d at %08x, osize:%d ip:%d op:%d\n", - ret, lzma_data + ip, lzma_outsize, ip, op); - - for (i = 0; i < 16; i++) - DBG("%02x ", lzma_data[ip + i]); - - DBG("\n"); - } - - return ret; -} - -static void lzma_init_data(void) -{ - extern unsigned char _lzma_data_start[]; - extern unsigned char _lzma_data_end[]; - - kernel_la = LOADADDR; - lzma_data = _lzma_data_start; - lzma_datasize = _lzma_data_end - _lzma_data_start; -} - -void loader_main(unsigned long reg_a0, unsigned long reg_a1, - unsigned long reg_a2, unsigned long reg_a3) -{ - void (*kernel_entry) (unsigned long, unsigned long, unsigned long, - unsigned long); - int res; - - printf("\n\nOpenWrt kernel loader for BCM63XX\n"); - printf("Copyright (C) 2011 Gabor Juhos \n"); - printf("Copyright (C) 2014 Jonas Gorski \n"); - printf("Copyright (C) 2020 Alvaro Fernandez Rojas \n"); - - lzma_init_data(); - - res = lzma_init_props(); - if (res != LZMA_RESULT_OK) { - printf("Incorrect LZMA stream properties!\n"); - halt(); - } - - printf("Decompressing kernel... "); - - res = lzma_decompress((unsigned char *) kernel_la); - if (res != LZMA_RESULT_OK) { - printf("failed, "); - switch (res) { - case LZMA_RESULT_DATA_ERROR: - printf("data error!\n"); - break; - default: - printf("unknown error %d!\n", res); - } - halt(); - } else { - printf("done!\n"); - } - - flush_cache(kernel_la, lzma_outsize); - - printf("Starting kernel at %08x...\n\n", kernel_la); - - kernel_entry = (void *) kernel_la; - kernel_entry(reg_a0, reg_a1, reg_a2, reg_a3); -} diff --git a/target/linux/bcm63xx/image/lzma-loader/src/loader.lds b/target/linux/bcm63xx/image/lzma-loader/src/loader.lds deleted file mode 100644 index 01ff85236147dc..00000000000000 --- a/target/linux/bcm63xx/image/lzma-loader/src/loader.lds +++ /dev/null @@ -1,34 +0,0 @@ -OUTPUT_ARCH(mips) -SECTIONS { - .text : { - _code_start = .; - *(.text) - *(.text.*) - *(.rodata) - *(.rodata.*) - *(.data.lzma) - } - - . = ALIGN(32); - .data : { - *(.data) - *(.data.*) - } - - . = ALIGN(32); - _code_end = .; - - _bss_start = .; - .bss : { - *(.bss) - *(.bss.*) - } - - . = ALIGN(32); - _bss_end = .; - - . = . + 8192; - _stack = .; - - workspace = .; -} diff --git a/target/linux/bcm63xx/image/lzma-loader/src/loader2.lds b/target/linux/bcm63xx/image/lzma-loader/src/loader2.lds deleted file mode 100644 index db0bb464242fb3..00000000000000 --- a/target/linux/bcm63xx/image/lzma-loader/src/loader2.lds +++ /dev/null @@ -1,10 +0,0 @@ -OUTPUT_ARCH(mips) -SECTIONS { - .text : { - startup = .; - *(.text) - *(.text.*) - *(.data) - *(.data.*) - } -} diff --git a/target/linux/bcm63xx/image/lzma-loader/src/lzma-data.lds b/target/linux/bcm63xx/image/lzma-loader/src/lzma-data.lds deleted file mode 100644 index abf756ba13a587..00000000000000 --- a/target/linux/bcm63xx/image/lzma-loader/src/lzma-data.lds +++ /dev/null @@ -1,8 +0,0 @@ -OUTPUT_ARCH(mips) -SECTIONS { - .data.lzma : { - _lzma_data_start = .; - *(.data) - _lzma_data_end = .; - } -} diff --git a/target/linux/bcm63xx/image/lzma-loader/src/printf.c b/target/linux/bcm63xx/image/lzma-loader/src/printf.c deleted file mode 100644 index 7bb5a86e187d44..00000000000000 --- a/target/linux/bcm63xx/image/lzma-loader/src/printf.c +++ /dev/null @@ -1,350 +0,0 @@ -/* - * Copyright (C) 2001 MontaVista Software Inc. - * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - */ - -#include "printf.h" - -extern void board_putc(int ch); - -/* this is the maximum width for a variable */ -#define LP_MAX_BUF 256 - -/* macros */ -#define IsDigit(x) ( ((x) >= '0') && ((x) <= '9') ) -#define Ctod(x) ( (x) - '0') - -/* forward declaration */ -static int PrintChar(char *, char, int, int); -static int PrintString(char *, char *, int, int); -static int PrintNum(char *, unsigned long, int, int, int, int, char, int); - -/* private variable */ -static const char theFatalMsg[] = "fatal error in lp_Print!"; - -/* -*- - * A low level printf() function. - */ -static void -lp_Print(void (*output)(void *, char *, int), - void * arg, - char *fmt, - va_list ap) -{ - -#define OUTPUT(arg, s, l) \ - { if (((l) < 0) || ((l) > LP_MAX_BUF)) { \ - (*output)(arg, (char*)theFatalMsg, sizeof(theFatalMsg)-1); for(;;); \ - } else { \ - (*output)(arg, s, l); \ - } \ - } - - char buf[LP_MAX_BUF]; - - char c; - char *s; - long int num; - - int longFlag; - int negFlag; - int width; - int prec; - int ladjust; - char padc; - - int length; - - for(;;) { - { - /* scan for the next '%' */ - char *fmtStart = fmt; - while ( (*fmt != '\0') && (*fmt != '%')) { - fmt ++; - } - - /* flush the string found so far */ - OUTPUT(arg, fmtStart, fmt-fmtStart); - - /* are we hitting the end? */ - if (*fmt == '\0') break; - } - - /* we found a '%' */ - fmt ++; - - /* check for long */ - if (*fmt == 'l') { - longFlag = 1; - fmt ++; - } else { - longFlag = 0; - } - - /* check for other prefixes */ - width = 0; - prec = -1; - ladjust = 0; - padc = ' '; - - if (*fmt == '-') { - ladjust = 1; - fmt ++; - } - - if (*fmt == '0') { - padc = '0'; - fmt++; - } - - if (IsDigit(*fmt)) { - while (IsDigit(*fmt)) { - width = 10 * width + Ctod(*fmt++); - } - } - - if (*fmt == '.') { - fmt ++; - if (IsDigit(*fmt)) { - prec = 0; - while (IsDigit(*fmt)) { - prec = prec*10 + Ctod(*fmt++); - } - } - } - - - /* check format flag */ - negFlag = 0; - switch (*fmt) { - case 'b': - if (longFlag) { - num = va_arg(ap, long int); - } else { - num = va_arg(ap, int); - } - length = PrintNum(buf, num, 2, 0, width, ladjust, padc, 0); - OUTPUT(arg, buf, length); - break; - - case 'd': - case 'D': - if (longFlag) { - num = va_arg(ap, long int); - } else { - num = va_arg(ap, int); - } - if (num < 0) { - num = - num; - negFlag = 1; - } - length = PrintNum(buf, num, 10, negFlag, width, ladjust, padc, 0); - OUTPUT(arg, buf, length); - break; - - case 'o': - case 'O': - if (longFlag) { - num = va_arg(ap, long int); - } else { - num = va_arg(ap, int); - } - length = PrintNum(buf, num, 8, 0, width, ladjust, padc, 0); - OUTPUT(arg, buf, length); - break; - - case 'u': - case 'U': - if (longFlag) { - num = va_arg(ap, long int); - } else { - num = va_arg(ap, int); - } - length = PrintNum(buf, num, 10, 0, width, ladjust, padc, 0); - OUTPUT(arg, buf, length); - break; - - case 'x': - if (longFlag) { - num = va_arg(ap, long int); - } else { - num = va_arg(ap, int); - } - length = PrintNum(buf, num, 16, 0, width, ladjust, padc, 0); - OUTPUT(arg, buf, length); - break; - - case 'X': - if (longFlag) { - num = va_arg(ap, long int); - } else { - num = va_arg(ap, int); - } - length = PrintNum(buf, num, 16, 0, width, ladjust, padc, 1); - OUTPUT(arg, buf, length); - break; - - case 'c': - c = (char)va_arg(ap, int); - length = PrintChar(buf, c, width, ladjust); - OUTPUT(arg, buf, length); - break; - - case 's': - s = (char*)va_arg(ap, char *); - length = PrintString(buf, s, width, ladjust); - OUTPUT(arg, buf, length); - break; - - case '\0': - fmt --; - break; - - default: - /* output this char as it is */ - OUTPUT(arg, fmt, 1); - } /* switch (*fmt) */ - - fmt ++; - } /* for(;;) */ - - /* special termination call */ - OUTPUT(arg, "\0", 1); -} - - -/* --------------- local help functions --------------------- */ -static int -PrintChar(char * buf, char c, int length, int ladjust) -{ - int i; - - if (length < 1) length = 1; - if (ladjust) { - *buf = c; - for (i=1; i< length; i++) buf[i] = ' '; - } else { - for (i=0; i< length-1; i++) buf[i] = ' '; - buf[length - 1] = c; - } - return length; -} - -static int -PrintString(char * buf, char* s, int length, int ladjust) -{ - int i; - int len=0; - char* s1 = s; - while (*s1++) len++; - if (length < len) length = len; - - if (ladjust) { - for (i=0; i< len; i++) buf[i] = s[i]; - for (i=len; i< length; i++) buf[i] = ' '; - } else { - for (i=0; i< length-len; i++) buf[i] = ' '; - for (i=length-len; i < length; i++) buf[i] = s[i-length+len]; - } - return length; -} - -static int -PrintNum(char * buf, unsigned long u, int base, int negFlag, - int length, int ladjust, char padc, int upcase) -{ - /* algorithm : - * 1. prints the number from left to right in reverse form. - * 2. fill the remaining spaces with padc if length is longer than - * the actual length - * TRICKY : if left adjusted, no "0" padding. - * if negtive, insert "0" padding between "0" and number. - * 3. if (!ladjust) we reverse the whole string including paddings - * 4. otherwise we only reverse the actual string representing the num. - */ - - int actualLength =0; - char *p = buf; - int i; - - do { - int tmp = u %base; - if (tmp <= 9) { - *p++ = '0' + tmp; - } else if (upcase) { - *p++ = 'A' + tmp - 10; - } else { - *p++ = 'a' + tmp - 10; - } - u /= base; - } while (u != 0); - - if (negFlag) { - *p++ = '-'; - } - - /* figure out actual length and adjust the maximum length */ - actualLength = p - buf; - if (length < actualLength) length = actualLength; - - /* add padding */ - if (ladjust) { - padc = ' '; - } - if (negFlag && !ladjust && (padc == '0')) { - for (i = actualLength-1; i< length-1; i++) buf[i] = padc; - buf[length -1] = '-'; - } else { - for (i = actualLength; i< length; i++) buf[i] = padc; - } - - - /* prepare to reverse the string */ - { - int begin = 0; - int end; - if (ladjust) { - end = actualLength - 1; - } else { - end = length -1; - } - - while (end > begin) { - char tmp = buf[begin]; - buf[begin] = buf[end]; - buf[end] = tmp; - begin ++; - end --; - } - } - - /* adjust the string pointer */ - return length; -} - -static void printf_output(void *arg, char *s, int l) -{ - int i; - - // special termination call - if ((l==1) && (s[0] == '\0')) return; - - for (i=0; i< l; i++) { - board_putc(s[i]); - if (s[i] == '\n') board_putc('\r'); - } -} - -void printf(char *fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - lp_Print(printf_output, 0, fmt, ap); - va_end(ap); -} diff --git a/target/linux/bcm63xx/image/lzma-loader/src/printf.h b/target/linux/bcm63xx/image/lzma-loader/src/printf.h deleted file mode 100644 index 9b1c1df2328611..00000000000000 --- a/target/linux/bcm63xx/image/lzma-loader/src/printf.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (C) 2001 MontaVista Software Inc. - * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - */ - -#ifndef _printf_h_ -#define _printf_h_ - -#include -void printf(char *fmt, ...); - -#endif /* _printf_h_ */ diff --git a/target/linux/bcm63xx/modules.mk b/target/linux/bcm63xx/modules.mk deleted file mode 100644 index c329f3865ad760..00000000000000 --- a/target/linux/bcm63xx/modules.mk +++ /dev/null @@ -1,35 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -# -# Copyright (C) 2010 OpenWrt.org - -define KernelPackage/pcmcia-bcm63xx - SUBMENU:=$(PCMCIA_MENU) - TITLE:=Broadcom BCM63xx PCMCIA support - DEPENDS:=@TARGET_bcm63xx +kmod-pcmcia-rsrc - KCONFIG:=CONFIG_PCMCIA_BCM63XX - FILES:=$(LINUX_DIR)/drivers/pcmcia/bcm63xx_pcmcia.ko - AUTOLOAD:=$(call AutoLoad,41,bcm63xx_pcmcia) -endef - -define KernelPackage/pcmcia-bcm63xx/description - Kernel support for PCMCIA/CardBus controller on the BCM63xx SoC -endef - -$(eval $(call KernelPackage,pcmcia-bcm63xx)) - -define KernelPackage/bcm63xx-udc - SUBMENU:=$(USB_MENU) - TITLE:=Broadcom BCM63xx UDC support - DEPENDS:=@TARGET_bcm63xx +kmod-usb-gadget - KCONFIG:=CONFIG_USB_BCM63XX_UDC - FILES:= \ - $(LINUX_DIR)/drivers/usb/gadget/udc/bcm63xx_udc.ko - AUTOLOAD:=$(call AutoLoad,51,bcm63xx_udc) - $(call AddDepends/usb) -endef - -define KernelPackage/bcm63xx-udc/description - Kernel support for the USB gadget (device) controller on the BCM63xx SoC -endef - -$(eval $(call KernelPackage,bcm63xx-udc)) diff --git a/target/linux/bcm63xx/patches-5.15/100-MIPS-BCM63XX-add-USB-host-clock-enable-delay.patch b/target/linux/bcm63xx/patches-5.15/100-MIPS-BCM63XX-add-USB-host-clock-enable-delay.patch deleted file mode 100644 index 3974b9bd302c63..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/100-MIPS-BCM63XX-add-USB-host-clock-enable-delay.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 80a2f983e9f44dbc3e01ae31c62d877846a7f791 Mon Sep 17 00:00:00 2001 -From: Florian Fainelli -Date: Mon, 28 Jan 2013 20:06:19 +0100 -Subject: [PATCH 01/11] MIPS: BCM63XX: add USB host clock enable delay - -Knowledge of the clock setup delay should remain at the clock level (so -it can be clock specific and CPU specific). Add the 100 milliseconds -required clock delay for the USB host clock when it gets enabled. - -Signed-off-by: Florian Fainelli ---- - arch/mips/bcm63xx/clk.c | 5 +++++ - 1 file changed, 5 insertions(+) - ---- a/arch/mips/bcm63xx/clk.c -+++ b/arch/mips/bcm63xx/clk.c -@@ -214,6 +214,11 @@ static void usbh_set(struct clk *clk, in - bcm_hwclock_set(CKCTL_6362_USBH_EN, enable); - else if (BCMCPU_IS_6368()) - bcm_hwclock_set(CKCTL_6368_USBH_EN, enable); -+ else -+ return; -+ -+ if (enable) -+ msleep(100); - } - - static struct clk clk_usbh = { diff --git a/target/linux/bcm63xx/patches-5.15/100-macronix_nand_block_protection_support.patch b/target/linux/bcm63xx/patches-5.15/100-macronix_nand_block_protection_support.patch deleted file mode 100644 index cee69dd8c610b5..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/100-macronix_nand_block_protection_support.patch +++ /dev/null @@ -1,18 +0,0 @@ -bcm63xx: fix booting with Kernel 5.10 - -This is a workaround to make the target overall bootable. With this more -people should be able to test the Kernel 5.10 and report further issues. - -Suggested-by: Daniel González Cabanelas -Signed-off-by: Paul Spooren ---- a/drivers/mtd/nand/raw/nand_macronix.c -+++ b/drivers/mtd/nand/raw/nand_macronix.c -@@ -323,7 +323,7 @@ static int macronix_nand_init(struct nan - - macronix_nand_fix_broken_get_timings(chip); - macronix_nand_onfi_init(chip); -- macronix_nand_block_protection_support(chip); -+ //macronix_nand_block_protection_support(chip); - macronix_nand_deep_power_down_support(chip); - - return 0; diff --git a/target/linux/bcm63xx/patches-5.15/101-MIPS-BCM63XX-add-USB-device-clock-enable-delay-to-cl.patch b/target/linux/bcm63xx/patches-5.15/101-MIPS-BCM63XX-add-USB-device-clock-enable-delay-to-cl.patch deleted file mode 100644 index a761e0fc921392..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/101-MIPS-BCM63XX-add-USB-device-clock-enable-delay-to-cl.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 8e9bf528a122741f0171b89c297b63041116d704 Mon Sep 17 00:00:00 2001 -From: Florian Fainelli -Date: Mon, 28 Jan 2013 20:06:20 +0100 -Subject: [PATCH 02/11] MIPS: BCM63XX: add USB device clock enable delay to - clock code - -This patch adds the required 10 micro seconds delay to the USB device -clock enable operation. Put this where the correct clock knowledege is, -which is in the clock code, and remove this delay from the bcm63xx_udc -gadget driver where it was before. - -Signed-off-by: Florian Fainelli ---- - arch/mips/bcm63xx/clk.c | 5 +++++ - drivers/usb/gadget/bcm63xx_udc.c | 1 - - 2 files changed, 5 insertions(+), 1 deletion(-) - ---- a/arch/mips/bcm63xx/clk.c -+++ b/arch/mips/bcm63xx/clk.c -@@ -236,6 +236,11 @@ static void usbd_set(struct clk *clk, in - bcm_hwclock_set(CKCTL_6362_USBD_EN, enable); - else if (BCMCPU_IS_6368()) - bcm_hwclock_set(CKCTL_6368_USBD_EN, enable); -+ else -+ return; -+ -+ if (enable) -+ udelay(10); - } - - static struct clk clk_usbd = { ---- a/drivers/usb/gadget/udc/bcm63xx_udc.c -+++ b/drivers/usb/gadget/udc/bcm63xx_udc.c -@@ -400,7 +400,6 @@ static inline void set_clocks(struct bcm - if (is_enabled) { - clk_enable(udc->usbh_clk); - clk_enable(udc->usbd_clk); -- udelay(10); - } else { - clk_disable(udc->usbd_clk); - clk_disable(udc->usbh_clk); diff --git a/target/linux/bcm63xx/patches-5.15/102-MIPS-BCM63XX-move-code-touching-the-USB-private-regi.patch b/target/linux/bcm63xx/patches-5.15/102-MIPS-BCM63XX-move-code-touching-the-USB-private-regi.patch deleted file mode 100644 index d3716b5d930684..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/102-MIPS-BCM63XX-move-code-touching-the-USB-private-regi.patch +++ /dev/null @@ -1,151 +0,0 @@ -From ac9b0b574d54be28b300bf99ffe092a2c589484f Mon Sep 17 00:00:00 2001 -From: Florian Fainelli -Date: Mon, 28 Jan 2013 20:06:21 +0100 -Subject: [PATCH 03/11] MIPS: BCM63XX: move code touching the USB private - register - -This patch moves the code touching the USB private register in the -bcm63xx USB gadget driver to arch/mips/bcm63xx/usb-common.c in -preparation for adding support for OHCI and EHCI host controllers which -will also touch the USB private register. - -Signed-off-by: Florian Fainelli ---- - arch/mips/bcm63xx/Makefile | 2 +- - arch/mips/bcm63xx/usb-common.c | 53 ++++++++++++++++++++ - .../include/asm/mach-bcm63xx/bcm63xx_usb_priv.h | 9 ++++ - drivers/usb/gadget/bcm63xx_udc.c | 27 ++-------- - 4 files changed, 67 insertions(+), 24 deletions(-) - create mode 100644 arch/mips/bcm63xx/usb-common.c - create mode 100644 arch/mips/include/asm/mach-bcm63xx/bcm63xx_usb_priv.h - ---- a/arch/mips/bcm63xx/Makefile -+++ b/arch/mips/bcm63xx/Makefile -@@ -2,7 +2,7 @@ - obj-y += clk.o cpu.o cs.o gpio.o irq.o nvram.o prom.o reset.o \ - setup.o timer.o dev-enet.o dev-flash.o dev-pcmcia.o \ - dev-rng.o dev-spi.o dev-hsspi.o dev-uart.o dev-wdt.o \ -- dev-usb-usbd.o -+ dev-usb-usbd.o usb-common.o - obj-$(CONFIG_EARLY_PRINTK) += early_printk.o - - obj-y += boards/ ---- /dev/null -+++ b/arch/mips/bcm63xx/usb-common.c -@@ -0,0 +1,53 @@ -+/* -+ * Broadcom BCM63xx common USB device configuration code -+ * -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file "COPYING" in the main directory of this archive -+ * for more details. -+ * -+ * Copyright (C) 2012 Kevin Cernekee -+ * Copyright (C) 2012 Broadcom Corporation -+ * -+ */ -+#include -+ -+#include -+#include -+#include -+#include -+ -+void bcm63xx_usb_priv_select_phy_mode(u32 portmask, bool is_device) -+{ -+ u32 val; -+ -+ val = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_UTMI_CTL_6368_REG); -+ if (is_device) { -+ val |= (portmask << USBH_PRIV_UTMI_CTL_HOSTB_SHIFT); -+ val |= (portmask << USBH_PRIV_UTMI_CTL_NODRIV_SHIFT); -+ } else { -+ val &= ~(portmask << USBH_PRIV_UTMI_CTL_HOSTB_SHIFT); -+ val &= ~(portmask << USBH_PRIV_UTMI_CTL_NODRIV_SHIFT); -+ } -+ bcm_rset_writel(RSET_USBH_PRIV, val, USBH_PRIV_UTMI_CTL_6368_REG); -+ -+ val = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6368_REG); -+ if (is_device) -+ val |= USBH_PRIV_SWAP_USBD_MASK; -+ else -+ val &= ~USBH_PRIV_SWAP_USBD_MASK; -+ bcm_rset_writel(RSET_USBH_PRIV, val, USBH_PRIV_SWAP_6368_REG); -+} -+EXPORT_SYMBOL(bcm63xx_usb_priv_select_phy_mode); -+ -+void bcm63xx_usb_priv_select_pullup(u32 portmask, bool is_on) -+{ -+ u32 val; -+ -+ val = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_UTMI_CTL_6368_REG); -+ if (is_on) -+ val &= ~(portmask << USBH_PRIV_UTMI_CTL_NODRIV_SHIFT); -+ else -+ val |= (portmask << USBH_PRIV_UTMI_CTL_NODRIV_SHIFT); -+ bcm_rset_writel(RSET_USBH_PRIV, val, USBH_PRIV_UTMI_CTL_6368_REG); -+} -+EXPORT_SYMBOL(bcm63xx_usb_priv_select_pullup); ---- /dev/null -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_usb_priv.h -@@ -0,0 +1,9 @@ -+#ifndef BCM63XX_USB_PRIV_H_ -+#define BCM63XX_USB_PRIV_H_ -+ -+#include -+ -+void bcm63xx_usb_priv_select_phy_mode(u32 portmask, bool is_device); -+void bcm63xx_usb_priv_select_pullup(u32 portmask, bool is_on); -+ -+#endif /* BCM63XX_USB_PRIV_H_ */ ---- a/drivers/usb/gadget/udc/bcm63xx_udc.c -+++ b/drivers/usb/gadget/udc/bcm63xx_udc.c -@@ -36,6 +36,7 @@ - #include - #include - #include -+#include - - #define DRV_MODULE_NAME "bcm63xx_udc" - -@@ -877,22 +878,7 @@ static void bcm63xx_select_phy_mode(stru - bcm_gpio_writel(val, GPIO_PINMUX_OTHR_REG); - } - -- val = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_UTMI_CTL_6368_REG); -- if (is_device) { -- val |= (portmask << USBH_PRIV_UTMI_CTL_HOSTB_SHIFT); -- val |= (portmask << USBH_PRIV_UTMI_CTL_NODRIV_SHIFT); -- } else { -- val &= ~(portmask << USBH_PRIV_UTMI_CTL_HOSTB_SHIFT); -- val &= ~(portmask << USBH_PRIV_UTMI_CTL_NODRIV_SHIFT); -- } -- bcm_rset_writel(RSET_USBH_PRIV, val, USBH_PRIV_UTMI_CTL_6368_REG); -- -- val = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6368_REG); -- if (is_device) -- val |= USBH_PRIV_SWAP_USBD_MASK; -- else -- val &= ~USBH_PRIV_SWAP_USBD_MASK; -- bcm_rset_writel(RSET_USBH_PRIV, val, USBH_PRIV_SWAP_6368_REG); -+ bcm63xx_usb_priv_select_phy_mode(portmask, is_device); - } - - /** -@@ -906,14 +892,9 @@ static void bcm63xx_select_phy_mode(stru - */ - static void bcm63xx_select_pullup(struct bcm63xx_udc *udc, bool is_on) - { -- u32 val, portmask = BIT(udc->pd->port_no); -+ u32 portmask = BIT(udc->pd->port_no); - -- val = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_UTMI_CTL_6368_REG); -- if (is_on) -- val &= ~(portmask << USBH_PRIV_UTMI_CTL_NODRIV_SHIFT); -- else -- val |= (portmask << USBH_PRIV_UTMI_CTL_NODRIV_SHIFT); -- bcm_rset_writel(RSET_USBH_PRIV, val, USBH_PRIV_UTMI_CTL_6368_REG); -+ bcm63xx_usb_priv_select_pullup(portmask, is_on); - } - - /** diff --git a/target/linux/bcm63xx/patches-5.15/103-MIPS-BCM63XX-add-OHCI-EHCI-configuration-bits-to-com.patch b/target/linux/bcm63xx/patches-5.15/103-MIPS-BCM63XX-add-OHCI-EHCI-configuration-bits-to-com.patch deleted file mode 100644 index 40bbe083a7bd8b..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/103-MIPS-BCM63XX-add-OHCI-EHCI-configuration-bits-to-com.patch +++ /dev/null @@ -1,169 +0,0 @@ -From 28758a9da77954ed323f86123ef448c6a563c037 Mon Sep 17 00:00:00 2001 -From: Florian Fainelli -Date: Mon, 28 Jan 2013 20:06:22 +0100 -Subject: [PATCH 04/11] MIPS: BCM63XX: add OHCI/EHCI configuration bits to - common USB code - -This patch updates the common USB code touching the USB private -registers with the specific bits to properly enable OHCI and EHCI -controllers on BCM63xx SoCs. As a result we now need to protect access -to Read Modify Write sequences using a spinlock because we cannot -guarantee that any of the exposed helper will not be called -concurrently. - -Signed-off-by: Maxime Bizon -Signed-off-by: Florian Fainelli ---- - arch/mips/bcm63xx/usb-common.c | 97 ++++++++++++++++++++ - .../include/asm/mach-bcm63xx/bcm63xx_usb_priv.h | 2 + - 2 files changed, 99 insertions(+) - ---- a/arch/mips/bcm63xx/usb-common.c -+++ b/arch/mips/bcm63xx/usb-common.c -@@ -5,10 +5,12 @@ - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * -+ * Copyright (C) 2008 Maxime Bizon - * Copyright (C) 2012 Kevin Cernekee - * Copyright (C) 2012 Broadcom Corporation - * - */ -+#include - #include - - #include -@@ -16,9 +18,14 @@ - #include - #include - -+static DEFINE_SPINLOCK(usb_priv_reg_lock); -+ - void bcm63xx_usb_priv_select_phy_mode(u32 portmask, bool is_device) - { - u32 val; -+ unsigned long flags; -+ -+ spin_lock_irqsave(&usb_priv_reg_lock, flags); - - val = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_UTMI_CTL_6368_REG); - if (is_device) { -@@ -36,12 +43,17 @@ void bcm63xx_usb_priv_select_phy_mode(u3 - else - val &= ~USBH_PRIV_SWAP_USBD_MASK; - bcm_rset_writel(RSET_USBH_PRIV, val, USBH_PRIV_SWAP_6368_REG); -+ -+ spin_unlock_irqrestore(&usb_priv_reg_lock, flags); - } - EXPORT_SYMBOL(bcm63xx_usb_priv_select_phy_mode); - - void bcm63xx_usb_priv_select_pullup(u32 portmask, bool is_on) - { - u32 val; -+ unsigned long flags; -+ -+ spin_lock_irqsave(&usb_priv_reg_lock, flags); - - val = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_UTMI_CTL_6368_REG); - if (is_on) -@@ -49,5 +61,90 @@ void bcm63xx_usb_priv_select_pullup(u32 - else - val |= (portmask << USBH_PRIV_UTMI_CTL_NODRIV_SHIFT); - bcm_rset_writel(RSET_USBH_PRIV, val, USBH_PRIV_UTMI_CTL_6368_REG); -+ -+ spin_unlock_irqrestore(&usb_priv_reg_lock, flags); - } - EXPORT_SYMBOL(bcm63xx_usb_priv_select_pullup); -+ -+/* The following array represents the meaning of the DESC/DATA -+ * endian swapping with respect to the CPU configured endianness -+ * -+ * DATA ENDN mmio descriptor -+ * 0 0 BE invalid -+ * 0 1 BE LE -+ * 1 0 BE BE -+ * 1 1 BE invalid -+ * -+ * Since BCM63XX SoCs are configured to be in big-endian mode -+ * we want configuration at line 3. -+ */ -+void bcm63xx_usb_priv_ohci_cfg_set(void) -+{ -+ u32 reg; -+ unsigned long flags; -+ -+ spin_lock_irqsave(&usb_priv_reg_lock, flags); -+ -+ if (BCMCPU_IS_6348()) -+ bcm_rset_writel(RSET_OHCI_PRIV, 0, OHCI_PRIV_REG); -+ else if (BCMCPU_IS_6358()) { -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6358_REG); -+ reg &= ~USBH_PRIV_SWAP_OHCI_ENDN_MASK; -+ reg |= USBH_PRIV_SWAP_OHCI_DATA_MASK; -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SWAP_6358_REG); -+ /* -+ * The magic value comes for the original vendor BSP -+ * and is needed for USB to work. Datasheet does not -+ * help, so the magic value is used as-is. -+ */ -+ bcm_rset_writel(RSET_USBH_PRIV, 0x1c0020, -+ USBH_PRIV_TEST_6358_REG); -+ -+ } else if (BCMCPU_IS_6328() || BCMCPU_IS_6362() || BCMCPU_IS_6368()) { -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6368_REG); -+ reg &= ~USBH_PRIV_SWAP_OHCI_ENDN_MASK; -+ reg |= USBH_PRIV_SWAP_OHCI_DATA_MASK; -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SWAP_6368_REG); -+ -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SETUP_6368_REG); -+ reg |= USBH_PRIV_SETUP_IOC_MASK; -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SETUP_6368_REG); -+ } -+ -+ spin_unlock_irqrestore(&usb_priv_reg_lock, flags); -+} -+ -+void bcm63xx_usb_priv_ehci_cfg_set(void) -+{ -+ u32 reg; -+ unsigned long flags; -+ -+ spin_lock_irqsave(&usb_priv_reg_lock, flags); -+ -+ if (BCMCPU_IS_6358()) { -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6358_REG); -+ reg &= ~USBH_PRIV_SWAP_EHCI_ENDN_MASK; -+ reg |= USBH_PRIV_SWAP_EHCI_DATA_MASK; -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SWAP_6358_REG); -+ -+ /* -+ * The magic value comes for the original vendor BSP -+ * and is needed for USB to work. Datasheet does not -+ * help, so the magic value is used as-is. -+ */ -+ bcm_rset_writel(RSET_USBH_PRIV, 0x1c0020, -+ USBH_PRIV_TEST_6358_REG); -+ -+ } else if (BCMCPU_IS_6328() || BCMCPU_IS_6362() || BCMCPU_IS_6368()) { -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6368_REG); -+ reg &= ~USBH_PRIV_SWAP_EHCI_ENDN_MASK; -+ reg |= USBH_PRIV_SWAP_EHCI_DATA_MASK; -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SWAP_6368_REG); -+ -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SETUP_6368_REG); -+ reg |= USBH_PRIV_SETUP_IOC_MASK; -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SETUP_6368_REG); -+ } -+ -+ spin_unlock_irqrestore(&usb_priv_reg_lock, flags); -+} ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_usb_priv.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_usb_priv.h -@@ -5,5 +5,7 @@ - - void bcm63xx_usb_priv_select_phy_mode(u32 portmask, bool is_device); - void bcm63xx_usb_priv_select_pullup(u32 portmask, bool is_on); -+void bcm63xx_usb_priv_ohci_cfg_set(void); -+void bcm63xx_usb_priv_ehci_cfg_set(void); - - #endif /* BCM63XX_USB_PRIV_H_ */ diff --git a/target/linux/bcm63xx/patches-5.15/104-MIPS-BCM63XX-introduce-BCM63XX_OHCI-configuration-sy.patch b/target/linux/bcm63xx/patches-5.15/104-MIPS-BCM63XX-introduce-BCM63XX_OHCI-configuration-sy.patch deleted file mode 100644 index ec90909d13bf4c..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/104-MIPS-BCM63XX-introduce-BCM63XX_OHCI-configuration-sy.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 94ec618bd1a6b07fafbbfc9bcc54e7f9360ff9a0 Mon Sep 17 00:00:00 2001 -From: Florian Fainelli -Date: Mon, 28 Jan 2013 20:06:23 +0100 -Subject: [PATCH 05/11] MIPS: BCM63XX: introduce BCM63XX_OHCI configuration - symbol - -This configuration symbol can be used by CPUs supporting the on-chip -OHCI controller, and ensures that all relevant OHCI-related -configuration options are correctly selected. So far, OHCI support is -available for the 6328, 6348, 6358 and 6358 SoCs. - -Signed-off-by: Florian Fainelli ---- - arch/mips/bcm63xx/Kconfig | 15 ++++++++++----- - 1 file changed, 10 insertions(+), 5 deletions(-) - ---- a/arch/mips/bcm63xx/Kconfig -+++ b/arch/mips/bcm63xx/Kconfig -@@ -7,10 +7,17 @@ config BCM63XX_CPU_3368 - select SYS_HAS_CPU_BMIPS4350 - select HAVE_PCI - -+config BCM63XX_OHCI -+ bool -+ select USB_ARCH_HAS_OHCI -+ select USB_OHCI_BIG_ENDIAN_DESC if USB_OHCI_HCD -+ select USB_OHCI_BIG_ENDIAN_MMIO if USB_OHCI_HCD -+ - config BCM63XX_CPU_6328 - bool "support 6328 CPU" - select SYS_HAS_CPU_BMIPS4350 - select HAVE_PCI -+ select BCM63XX_OHCI - - config BCM63XX_CPU_6338 - bool "support 6338 CPU" -@@ -25,21 +32,25 @@ config BCM63XX_CPU_6348 - bool "support 6348 CPU" - select SYS_HAS_CPU_BMIPS32_3300 - select HAVE_PCI -+ select BCM63XX_OHCI - - config BCM63XX_CPU_6358 - bool "support 6358 CPU" - select SYS_HAS_CPU_BMIPS4350 - select HAVE_PCI -+ select BCM63XX_OHCI - - config BCM63XX_CPU_6362 - bool "support 6362 CPU" - select SYS_HAS_CPU_BMIPS4350 - select HAVE_PCI -+ select BCM63XX_OHCI - - config BCM63XX_CPU_6368 - bool "support 6368 CPU" - select SYS_HAS_CPU_BMIPS4350 - select HAVE_PCI -+ select BCM63XX_OHCI - endmenu - - source "arch/mips/bcm63xx/boards/Kconfig" diff --git a/target/linux/bcm63xx/patches-5.15/105-MIPS-BCM63XX-add-support-for-the-on-chip-OHCI-contro.patch b/target/linux/bcm63xx/patches-5.15/105-MIPS-BCM63XX-add-support-for-the-on-chip-OHCI-contro.patch deleted file mode 100644 index 8a532fe5d4a9c4..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/105-MIPS-BCM63XX-add-support-for-the-on-chip-OHCI-contro.patch +++ /dev/null @@ -1,138 +0,0 @@ -From 30d22baef255c99a12c4858ce4ab0d45f0d8c9ae Mon Sep 17 00:00:00 2001 -From: Florian Fainelli -Date: Mon, 28 Jan 2013 20:06:24 +0100 -Subject: [PATCH 06/11] MIPS: BCM63XX: add support for the on-chip OHCI - controller - -Broadcom BCM63XX SoCs include an on-chip OHCI controller which can be -driven by the ohci-platform generic driver by using specific power -on/off/suspend callback to manage clocks and hardware specific -configuration. - -Signed-off-by: Maxime Bizon -Signed-off-by: Florian Fainelli ---- - arch/mips/bcm63xx/Makefile | 2 +- - arch/mips/bcm63xx/dev-usb-ohci.c | 94 ++++++++++++++++++++ - .../asm/mach-bcm63xx/bcm63xx_dev_usb_ohci.h | 6 ++ - 3 files changed, 101 insertions(+), 1 deletion(-) - create mode 100644 arch/mips/bcm63xx/dev-usb-ohci.c - create mode 100644 arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ohci.h - ---- a/arch/mips/bcm63xx/Makefile -+++ b/arch/mips/bcm63xx/Makefile -@@ -2,7 +2,7 @@ - obj-y += clk.o cpu.o cs.o gpio.o irq.o nvram.o prom.o reset.o \ - setup.o timer.o dev-enet.o dev-flash.o dev-pcmcia.o \ - dev-rng.o dev-spi.o dev-hsspi.o dev-uart.o dev-wdt.o \ -- dev-usb-usbd.o usb-common.o -+ dev-usb-ohci.o dev-usb-usbd.o usb-common.o - obj-$(CONFIG_EARLY_PRINTK) += early_printk.o - - obj-y += boards/ ---- /dev/null -+++ b/arch/mips/bcm63xx/dev-usb-ohci.c -@@ -0,0 +1,94 @@ -+/* -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file "COPYING" in the main directory of this archive -+ * for more details. -+ * -+ * Copyright (C) 2008 Maxime Bizon -+ * Copyright (C) 2013 Florian Fainelli -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+static struct resource ohci_resources[] = { -+ { -+ .start = -1, /* filled at runtime */ -+ .end = -1, /* filled at runtime */ -+ .flags = IORESOURCE_MEM, -+ }, -+ { -+ .start = -1, /* filled at runtime */ -+ .flags = IORESOURCE_IRQ, -+ }, -+}; -+ -+static u64 ohci_dmamask = DMA_BIT_MASK(32); -+ -+static struct clk *usb_host_clock; -+ -+static int bcm63xx_ohci_power_on(struct platform_device *pdev) -+{ -+ usb_host_clock = clk_get(&pdev->dev, "usbh"); -+ if (IS_ERR_OR_NULL(usb_host_clock)) -+ return -ENODEV; -+ -+ clk_prepare_enable(usb_host_clock); -+ -+ bcm63xx_usb_priv_ohci_cfg_set(); -+ -+ return 0; -+} -+ -+static void bcm63xx_ohci_power_off(struct platform_device *pdev) -+{ -+ if (!IS_ERR_OR_NULL(usb_host_clock)) { -+ clk_disable_unprepare(usb_host_clock); -+ clk_put(usb_host_clock); -+ } -+} -+ -+static struct usb_ohci_pdata bcm63xx_ohci_pdata = { -+ .big_endian_desc = 1, -+ .big_endian_mmio = 1, -+ .no_big_frame_no = 1, -+ .num_ports = 1, -+ .power_on = bcm63xx_ohci_power_on, -+ .power_off = bcm63xx_ohci_power_off, -+ .power_suspend = bcm63xx_ohci_power_off, -+}; -+ -+static struct platform_device bcm63xx_ohci_device = { -+ .name = "ohci-platform", -+ .id = -1, -+ .num_resources = ARRAY_SIZE(ohci_resources), -+ .resource = ohci_resources, -+ .dev = { -+ .platform_data = &bcm63xx_ohci_pdata, -+ .dma_mask = &ohci_dmamask, -+ .coherent_dma_mask = DMA_BIT_MASK(32), -+ }, -+}; -+ -+int __init bcm63xx_ohci_register(void) -+{ -+ if (BCMCPU_IS_6345() || BCMCPU_IS_6338()) -+ return -ENODEV; -+ -+ ohci_resources[0].start = bcm63xx_regset_address(RSET_OHCI0); -+ ohci_resources[0].end = ohci_resources[0].start; -+ ohci_resources[0].end += RSET_OHCI_SIZE - 1; -+ ohci_resources[1].start = bcm63xx_get_irq_number(IRQ_OHCI0); -+ -+ return platform_device_register(&bcm63xx_ohci_device); -+} ---- /dev/null -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ohci.h -@@ -0,0 +1,6 @@ -+#ifndef BCM63XX_DEV_USB_OHCI_H_ -+#define BCM63XX_DEV_USB_OHCI_H_ -+ -+int bcm63xx_ohci_register(void); -+ -+#endif /* BCM63XX_DEV_USB_OHCI_H_ */ diff --git a/target/linux/bcm63xx/patches-5.15/106-MIPS-BCM63XX-register-OHCI-controller-if-board-enabl.patch b/target/linux/bcm63xx/patches-5.15/106-MIPS-BCM63XX-register-OHCI-controller-if-board-enabl.patch deleted file mode 100644 index c11f4f17d4df07..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/106-MIPS-BCM63XX-register-OHCI-controller-if-board-enabl.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 33ef960aed15f9a98a2c51d8d794cd72418e0be4 Mon Sep 17 00:00:00 2001 -From: Florian Fainelli -Date: Mon, 28 Jan 2013 20:06:25 +0100 -Subject: [PATCH 07/11] MIPS: BCM63XX: register OHCI controller if board - enables it - -BCM63XX-based boards can control the registration of the OHCI controller -by setting their has_ohci0 flag to 1. Handle this in the generic -code dealing with board registration and call the actual helper to -register the OHCI controller. - -Signed-off-by: Florian Fainelli ---- - arch/mips/bcm63xx/boards/board_bcm963xx.c | 4 ++++ - 1 file changed, 4 insertions(+) - ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -24,6 +24,7 @@ - #include - #include - #include -+#include - #include - #include - -@@ -879,6 +880,9 @@ int __init board_register_devices(void) - if (board.has_usbd) - bcm63xx_usbd_register(&board.usbd); - -+ if (board.has_ohci0) -+ bcm63xx_ohci_register(); -+ - /* Generate MAC address for WLAN and register our SPROM, - * do this after registering enet devices - */ diff --git a/target/linux/bcm63xx/patches-5.15/107-MIPS-BCM63XX-introduce-BCM63XX_EHCI-configuration-sy.patch b/target/linux/bcm63xx/patches-5.15/107-MIPS-BCM63XX-introduce-BCM63XX_EHCI-configuration-sy.patch deleted file mode 100644 index fed826c4cd14f6..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/107-MIPS-BCM63XX-introduce-BCM63XX_EHCI-configuration-sy.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 00da1683364e58c6430a4577123d01037f8faddc Mon Sep 17 00:00:00 2001 -From: Florian Fainelli -Date: Mon, 28 Jan 2013 20:06:26 +0100 -Subject: [PATCH 08/11] MIPS: BCM63XX: introduce BCM63XX_EHCI configuration - symbol - -This configuration symbol can be used by CPUs supporting the on-chip -EHCI controller, and ensures that all relevant EHCI-related -configuration options are selected. So far BCM6328, BCM6358 and BCM6368 -have an EHCI controller and do select this symbol. Update -drivers/usb/host/Kconfig with BCM63XX to update direct unmet -dependencies. - -Signed-off-by: Florian Fainelli ---- - arch/mips/bcm63xx/Kconfig | 9 +++++++++ - drivers/usb/host/Kconfig | 5 +++-- - 2 files changed, 12 insertions(+), 2 deletions(-) - ---- a/arch/mips/bcm63xx/Kconfig -+++ b/arch/mips/bcm63xx/Kconfig -@@ -13,11 +13,18 @@ config BCM63XX_OHCI - select USB_OHCI_BIG_ENDIAN_DESC if USB_OHCI_HCD - select USB_OHCI_BIG_ENDIAN_MMIO if USB_OHCI_HCD - -+config BCM63XX_EHCI -+ bool -+ select USB_ARCH_HAS_EHCI -+ select USB_EHCI_BIG_ENDIAN_DESC if USB_EHCI_HCD -+ select USB_EHCI_BIG_ENDIAN_MMIO if USB_EHCI_HCD -+ - config BCM63XX_CPU_6328 - bool "support 6328 CPU" - select SYS_HAS_CPU_BMIPS4350 - select HAVE_PCI - select BCM63XX_OHCI -+ select BCM63XX_EHCI - - config BCM63XX_CPU_6338 - bool "support 6338 CPU" -@@ -39,18 +46,21 @@ config BCM63XX_CPU_6358 - select SYS_HAS_CPU_BMIPS4350 - select HAVE_PCI - select BCM63XX_OHCI -+ select BCM63XX_EHCI - - config BCM63XX_CPU_6362 - bool "support 6362 CPU" - select SYS_HAS_CPU_BMIPS4350 - select HAVE_PCI - select BCM63XX_OHCI -+ select BCM63XX_EHCI - - config BCM63XX_CPU_6368 - bool "support 6368 CPU" - select SYS_HAS_CPU_BMIPS4350 - select HAVE_PCI - select BCM63XX_OHCI -+ select BCM63XX_EHCI - endmenu - - source "arch/mips/bcm63xx/boards/Kconfig" diff --git a/target/linux/bcm63xx/patches-5.15/108-MIPS-BCM63XX-add-support-for-the-on-chip-EHCI-contro.patch b/target/linux/bcm63xx/patches-5.15/108-MIPS-BCM63XX-add-support-for-the-on-chip-EHCI-contro.patch deleted file mode 100644 index 7d0a35c6226343..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/108-MIPS-BCM63XX-add-support-for-the-on-chip-EHCI-contro.patch +++ /dev/null @@ -1,136 +0,0 @@ -From e38f13bd6408769c0b565bb1079024f496eee121 Mon Sep 17 00:00:00 2001 -From: Florian Fainelli -Date: Mon, 28 Jan 2013 20:06:27 +0100 -Subject: [PATCH 09/11] MIPS: BCM63XX: add support for the on-chip EHCI - controller - -Broadcom BCM63XX SoCs include an on-chip EHCI controller which can be -driven by the generic ehci-platform driver by using specific power -on/off/suspend callbacks to manage clocks and hardware specific -configuration. - -Signed-off-by: Maxime Bizon -Signed-off-by: Florian Fainelli ---- - arch/mips/bcm63xx/Makefile | 2 +- - arch/mips/bcm63xx/dev-usb-ehci.c | 92 ++++++++++++++++++++ - .../asm/mach-bcm63xx/bcm63xx_dev_usb_ehci.h | 6 ++ - 3 files changed, 99 insertions(+), 1 deletion(-) - create mode 100644 arch/mips/bcm63xx/dev-usb-ehci.c - create mode 100644 arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ehci.h - ---- a/arch/mips/bcm63xx/Makefile -+++ b/arch/mips/bcm63xx/Makefile -@@ -2,7 +2,7 @@ - obj-y += clk.o cpu.o cs.o gpio.o irq.o nvram.o prom.o reset.o \ - setup.o timer.o dev-enet.o dev-flash.o dev-pcmcia.o \ - dev-rng.o dev-spi.o dev-hsspi.o dev-uart.o dev-wdt.o \ -- dev-usb-ohci.o dev-usb-usbd.o usb-common.o -+ dev-usb-ehci.o dev-usb-ohci.o dev-usb-usbd.o usb-common.o - obj-$(CONFIG_EARLY_PRINTK) += early_printk.o - - obj-y += boards/ ---- /dev/null -+++ b/arch/mips/bcm63xx/dev-usb-ehci.c -@@ -0,0 +1,92 @@ -+/* -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file "COPYING" in the main directory of this archive -+ * for more details. -+ * -+ * Copyright (C) 2008 Maxime Bizon -+ * Copyright (C) 2013 Florian Fainelli -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+ -+static struct resource ehci_resources[] = { -+ { -+ .start = -1, /* filled at runtime */ -+ .end = -1, /* filled at runtime */ -+ .flags = IORESOURCE_MEM, -+ }, -+ { -+ .start = -1, /* filled at runtime */ -+ .flags = IORESOURCE_IRQ, -+ }, -+}; -+ -+static u64 ehci_dmamask = DMA_BIT_MASK(32); -+ -+static struct clk *usb_host_clock; -+ -+static int bcm63xx_ehci_power_on(struct platform_device *pdev) -+{ -+ usb_host_clock = clk_get(&pdev->dev, "usbh"); -+ if (IS_ERR_OR_NULL(usb_host_clock)) -+ return -ENODEV; -+ -+ clk_prepare_enable(usb_host_clock); -+ -+ bcm63xx_usb_priv_ehci_cfg_set(); -+ -+ return 0; -+} -+ -+static void bcm63xx_ehci_power_off(struct platform_device *pdev) -+{ -+ if (!IS_ERR_OR_NULL(usb_host_clock)) { -+ clk_disable_unprepare(usb_host_clock); -+ clk_put(usb_host_clock); -+ } -+} -+ -+static struct usb_ehci_pdata bcm63xx_ehci_pdata = { -+ .big_endian_desc = 1, -+ .big_endian_mmio = 1, -+ .power_on = bcm63xx_ehci_power_on, -+ .power_off = bcm63xx_ehci_power_off, -+ .power_suspend = bcm63xx_ehci_power_off, -+}; -+ -+static struct platform_device bcm63xx_ehci_device = { -+ .name = "ehci-platform", -+ .id = -1, -+ .num_resources = ARRAY_SIZE(ehci_resources), -+ .resource = ehci_resources, -+ .dev = { -+ .platform_data = &bcm63xx_ehci_pdata, -+ .dma_mask = &ehci_dmamask, -+ .coherent_dma_mask = DMA_BIT_MASK(32), -+ }, -+}; -+ -+int __init bcm63xx_ehci_register(void) -+{ -+ if (!BCMCPU_IS_6328() && !BCMCPU_IS_6358() && !BCMCPU_IS_6362() && !BCMCPU_IS_6368()) -+ return 0; -+ -+ ehci_resources[0].start = bcm63xx_regset_address(RSET_EHCI0); -+ ehci_resources[0].end = ehci_resources[0].start; -+ ehci_resources[0].end += RSET_EHCI_SIZE - 1; -+ ehci_resources[1].start = bcm63xx_get_irq_number(IRQ_EHCI0); -+ -+ return platform_device_register(&bcm63xx_ehci_device); -+} ---- /dev/null -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ehci.h -@@ -0,0 +1,6 @@ -+#ifndef BCM63XX_DEV_USB_EHCI_H_ -+#define BCM63XX_DEV_USB_EHCI_H_ -+ -+int bcm63xx_ehci_register(void); -+ -+#endif /* BCM63XX_DEV_USB_EHCI_H_ */ diff --git a/target/linux/bcm63xx/patches-5.15/109-MIPS-BCM63XX-register-EHCI-controller-if-board-enabl.patch b/target/linux/bcm63xx/patches-5.15/109-MIPS-BCM63XX-register-EHCI-controller-if-board-enabl.patch deleted file mode 100644 index b8610420f922f5..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/109-MIPS-BCM63XX-register-EHCI-controller-if-board-enabl.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 709ef2034f5ba06da35f89856ad7baf2b7a41287 Mon Sep 17 00:00:00 2001 -From: Florian Fainelli -Date: Mon, 28 Jan 2013 20:06:28 +0100 -Subject: [PATCH 10/11] MIPS: BCM63XX: register EHCI controller if board - enables it - -BCM63XX-based board can control the registration of the EHCI controller -by setting their has_ehci0 flag to 1. Handle this in the generic -code dealing with board registration and call the actual helper to register -the EHCI controller. - -Signed-off-by: Florian Fainelli ---- - arch/mips/bcm63xx/boards/board_bcm963xx.c | 4 ++++ - 1 file changed, 4 insertions(+) - ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -24,6 +24,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -880,6 +881,9 @@ int __init board_register_devices(void) - if (board.has_usbd) - bcm63xx_usbd_register(&board.usbd); - -+ if (board.has_ehci0) -+ bcm63xx_ehci_register(); -+ - if (board.has_ohci0) - bcm63xx_ohci_register(); - diff --git a/target/linux/bcm63xx/patches-5.15/110-MIPS-BCM63XX-EHCI-controller-does-not-support-overcu.patch b/target/linux/bcm63xx/patches-5.15/110-MIPS-BCM63XX-EHCI-controller-does-not-support-overcu.patch deleted file mode 100644 index 582216648572e5..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/110-MIPS-BCM63XX-EHCI-controller-does-not-support-overcu.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 111bbd770441ab34f9da5bb1d85767a9b75227b4 Mon Sep 17 00:00:00 2001 -From: Florian Fainelli -Date: Mon, 28 Jan 2013 20:06:30 +0100 -Subject: [PATCH 12/12] MIPS: BCM63XX: EHCI controller does not support - overcurrent - -This patch sets the spurious_oc flag for the BCM63XX EHCI controller as it -does not support proper overcurrent reporting. - -Signed-off-by: Florian Fainelli ---- - arch/mips/bcm63xx/dev-usb-ehci.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/arch/mips/bcm63xx/dev-usb-ehci.c -+++ b/arch/mips/bcm63xx/dev-usb-ehci.c -@@ -61,6 +61,7 @@ static void bcm63xx_ehci_power_off(struc - static struct usb_ehci_pdata bcm63xx_ehci_pdata = { - .big_endian_desc = 1, - .big_endian_mmio = 1, -+ .spurious_oc = 1, - .power_on = bcm63xx_ehci_power_on, - .power_off = bcm63xx_ehci_power_off, - .power_suspend = bcm63xx_ehci_power_off, diff --git a/target/linux/bcm63xx/patches-5.15/111-drivers-mtd-nand-macronix-comment-unused-function.patch b/target/linux/bcm63xx/patches-5.15/111-drivers-mtd-nand-macronix-comment-unused-function.patch deleted file mode 100644 index 38f3b8bc774f28..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/111-drivers-mtd-nand-macronix-comment-unused-function.patch +++ /dev/null @@ -1,154 +0,0 @@ -From 00cf359b486a3d14c29014e9d57d92ab81972866 Mon Sep 17 00:00:00 2001 -From: Christian Marangi -Date: Tue, 9 May 2023 14:03:08 +0200 -Subject: [PATCH] drivers: mtd: nand: macronix: comment unused function - -Comment unused function since macronix_nand_block_protection_support -cause booting problems. - -Signed-off-by: Christian Marangi ---- - drivers/mtd/nand/raw/nand_macronix.c | 132 +++++++++++++-------------- - 1 file changed, 66 insertions(+), 66 deletions(-) - ---- a/drivers/mtd/nand/raw/nand_macronix.c -+++ b/drivers/mtd/nand/raw/nand_macronix.c -@@ -179,72 +179,72 @@ static void macronix_nand_fix_broken_get - ONFI_FEATURE_ADDR_TIMING_MODE, 1); - } - --/* -- * Macronix NAND supports Block Protection by Protectoin(PT) pin; -- * active high at power-on which protects the entire chip even the #WP is -- * disabled. Lock/unlock protection area can be partition according to -- * protection bits, i.e. upper 1/2 locked, upper 1/4 locked and so on. -- */ --static int mxic_nand_lock(struct nand_chip *chip, loff_t ofs, uint64_t len) --{ -- u8 feature[ONFI_SUBFEATURE_PARAM_LEN]; -- int ret; -- -- feature[0] = MXIC_BLOCK_PROTECTION_ALL_LOCK; -- nand_select_target(chip, 0); -- ret = nand_set_features(chip, ONFI_FEATURE_ADDR_MXIC_PROTECTION, -- feature); -- nand_deselect_target(chip); -- if (ret) -- pr_err("%s all blocks failed\n", __func__); -- -- return ret; --} -- --static int mxic_nand_unlock(struct nand_chip *chip, loff_t ofs, uint64_t len) --{ -- u8 feature[ONFI_SUBFEATURE_PARAM_LEN]; -- int ret; -- -- feature[0] = MXIC_BLOCK_PROTECTION_ALL_UNLOCK; -- nand_select_target(chip, 0); -- ret = nand_set_features(chip, ONFI_FEATURE_ADDR_MXIC_PROTECTION, -- feature); -- nand_deselect_target(chip); -- if (ret) -- pr_err("%s all blocks failed\n", __func__); -- -- return ret; --} -- --static void macronix_nand_block_protection_support(struct nand_chip *chip) --{ -- u8 feature[ONFI_SUBFEATURE_PARAM_LEN]; -- int ret; -- -- bitmap_set(chip->parameters.get_feature_list, -- ONFI_FEATURE_ADDR_MXIC_PROTECTION, 1); -- -- feature[0] = MXIC_BLOCK_PROTECTION_ALL_UNLOCK; -- nand_select_target(chip, 0); -- ret = nand_get_features(chip, ONFI_FEATURE_ADDR_MXIC_PROTECTION, -- feature); -- nand_deselect_target(chip); -- if (ret || feature[0] != MXIC_BLOCK_PROTECTION_ALL_LOCK) { -- if (ret) -- pr_err("Block protection check failed\n"); -- -- bitmap_clear(chip->parameters.get_feature_list, -- ONFI_FEATURE_ADDR_MXIC_PROTECTION, 1); -- return; -- } -- -- bitmap_set(chip->parameters.set_feature_list, -- ONFI_FEATURE_ADDR_MXIC_PROTECTION, 1); -- -- chip->ops.lock_area = mxic_nand_lock; -- chip->ops.unlock_area = mxic_nand_unlock; --} -+// /* -+// * Macronix NAND supports Block Protection by Protectoin(PT) pin; -+// * active high at power-on which protects the entire chip even the #WP is -+// * disabled. Lock/unlock protection area can be partition according to -+// * protection bits, i.e. upper 1/2 locked, upper 1/4 locked and so on. -+// */ -+// static int mxic_nand_lock(struct nand_chip *chip, loff_t ofs, uint64_t len) -+// { -+// u8 feature[ONFI_SUBFEATURE_PARAM_LEN]; -+// int ret; -+ -+// feature[0] = MXIC_BLOCK_PROTECTION_ALL_LOCK; -+// nand_select_target(chip, 0); -+// ret = nand_set_features(chip, ONFI_FEATURE_ADDR_MXIC_PROTECTION, -+// feature); -+// nand_deselect_target(chip); -+// if (ret) -+// pr_err("%s all blocks failed\n", __func__); -+ -+// return ret; -+// } -+ -+// static int mxic_nand_unlock(struct nand_chip *chip, loff_t ofs, uint64_t len) -+// { -+// u8 feature[ONFI_SUBFEATURE_PARAM_LEN]; -+// int ret; -+ -+// feature[0] = MXIC_BLOCK_PROTECTION_ALL_UNLOCK; -+// nand_select_target(chip, 0); -+// ret = nand_set_features(chip, ONFI_FEATURE_ADDR_MXIC_PROTECTION, -+// feature); -+// nand_deselect_target(chip); -+// if (ret) -+// pr_err("%s all blocks failed\n", __func__); -+ -+// return ret; -+// } -+ -+// static void macronix_nand_block_protection_support(struct nand_chip *chip) -+// { -+// u8 feature[ONFI_SUBFEATURE_PARAM_LEN]; -+// int ret; -+ -+// bitmap_set(chip->parameters.get_feature_list, -+// ONFI_FEATURE_ADDR_MXIC_PROTECTION, 1); -+ -+// feature[0] = MXIC_BLOCK_PROTECTION_ALL_UNLOCK; -+// nand_select_target(chip, 0); -+// ret = nand_get_features(chip, ONFI_FEATURE_ADDR_MXIC_PROTECTION, -+// feature); -+// nand_deselect_target(chip); -+// if (ret || feature[0] != MXIC_BLOCK_PROTECTION_ALL_LOCK) { -+// if (ret) -+// pr_err("Block protection check failed\n"); -+ -+// bitmap_clear(chip->parameters.get_feature_list, -+// ONFI_FEATURE_ADDR_MXIC_PROTECTION, 1); -+// return; -+// } -+ -+// bitmap_set(chip->parameters.set_feature_list, -+// ONFI_FEATURE_ADDR_MXIC_PROTECTION, 1); -+ -+// chip->ops.lock_area = mxic_nand_lock; -+// chip->ops.unlock_area = mxic_nand_unlock; -+// } - - static int nand_power_down_op(struct nand_chip *chip) - { diff --git a/target/linux/bcm63xx/patches-5.15/130-pinctrl-add-bcm63xx-base-code.patch b/target/linux/bcm63xx/patches-5.15/130-pinctrl-add-bcm63xx-base-code.patch deleted file mode 100644 index 0fdb4babb0173b..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/130-pinctrl-add-bcm63xx-base-code.patch +++ /dev/null @@ -1,226 +0,0 @@ -From ab2f33e35e35905a76204138143875251f3e1088 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Fri, 24 Jun 2016 22:07:42 +0200 -Subject: [PATCH 01/13] pinctrl: add bcm63xx base code - -Setup directory and add a helper for bcm63xx pinctrl support. - -Signed-off-by: Jonas Gorski ---- - drivers/pinctrl/Kconfig | 1 + - drivers/pinctrl/Makefile | 1 + - drivers/pinctrl/bcm63xx/Kconfig | 3 + - drivers/pinctrl/bcm63xx/Makefile | 1 + - drivers/pinctrl/bcm63xx/pinctrl-bcm63xx.c | 142 ++++++++++++++++++++++++++++++ - drivers/pinctrl/bcm63xx/pinctrl-bcm63xx.h | 14 +++ - 7 files changed, 163 insertions(+) - create mode 100644 drivers/pinctrl/bcm63xx/Kconfig - create mode 100644 drivers/pinctrl/bcm63xx/Makefile - create mode 100644 drivers/pinctrl/bcm63xx/pinctrl-bcm63xx.c - create mode 100644 drivers/pinctrl/bcm63xx/pinctrl-bcm63xx.h - ---- a/drivers/pinctrl/Kconfig -+++ b/drivers/pinctrl/Kconfig -@@ -429,6 +429,7 @@ config PINCTRL_KEEMBAY - source "drivers/pinctrl/actions/Kconfig" - source "drivers/pinctrl/aspeed/Kconfig" - source "drivers/pinctrl/bcm/Kconfig" -+source "drivers/pinctrl/bcm63xx/Kconfig" - source "drivers/pinctrl/berlin/Kconfig" - source "drivers/pinctrl/freescale/Kconfig" - source "drivers/pinctrl/intel/Kconfig" ---- a/drivers/pinctrl/Makefile -+++ b/drivers/pinctrl/Makefile -@@ -52,6 +52,7 @@ obj-$(CONFIG_PINCTRL_KEEMBAY) += pinctrl - obj-y += actions/ - obj-$(CONFIG_ARCH_ASPEED) += aspeed/ - obj-y += bcm/ -+obj-y += bcm63xx/ - obj-$(CONFIG_PINCTRL_BERLIN) += berlin/ - obj-y += freescale/ - obj-$(CONFIG_X86) += intel/ ---- /dev/null -+++ b/drivers/pinctrl/bcm63xx/Kconfig -@@ -0,0 +1,3 @@ -+config PINCTRL_BRCM63XX -+ bool -+ select GPIO_GENERIC ---- /dev/null -+++ b/drivers/pinctrl/bcm63xx/Makefile -@@ -0,0 +1 @@ -+obj-$(CONFIG_PINCTRL_BRCM63XX) += pinctrl-bcm63xx.o ---- /dev/null -+++ b/drivers/pinctrl/bcm63xx/pinctrl-bcm63xx.c -@@ -0,0 +1,155 @@ -+/* -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file "COPYING" in the main directory of this archive -+ * for more details. -+ * -+ * Copyright (C) 2016 Jonas Gorski -+ */ -+ -+#include -+#include -+#include -+#include -+ -+#include "pinctrl-bcm63xx.h" -+#include "../core.h" -+ -+#define BANK_SIZE sizeof(u32) -+#define PINS_PER_BANK (BANK_SIZE * BITS_PER_BYTE) -+ -+#ifdef CONFIG_OF -+static int bcm63xx_gpio_of_xlate(struct gpio_chip *gc, -+ const struct of_phandle_args *gpiospec, -+ u32 *flags) -+{ -+ struct gpio_chip *base = gpiochip_get_data(gc); -+ int pin = gpiospec->args[0]; -+ -+ if (gc != &base[pin / PINS_PER_BANK]) -+ return -EINVAL; -+ -+ pin = pin % PINS_PER_BANK; -+ -+ if (pin >= gc->ngpio) -+ return -EINVAL; -+ -+ if (flags) -+ *flags = gpiospec->args[1]; -+ -+ return pin; -+} -+#endif -+ -+static int bcm63xx_gpio_to_irq(struct gpio_chip *chip, unsigned gpio) -+{ -+ struct gpio_chip *base = gpiochip_get_data(chip); -+ char irq_name[7]; /* "gpioXX" */ -+ -+ /* FIXME: this is ugly */ -+ sprintf(irq_name, "gpio%d", gpio + PINS_PER_BANK * (chip - base)); -+ return of_irq_get_byname(chip->of_node, irq_name); -+} -+ -+static int bcm63xx_setup_gpio(struct device *dev, struct gpio_chip *gc, -+ void __iomem *dirout, void __iomem *data, -+ size_t sz, int ngpio) -+ -+{ -+ int banks, chips, i, ret = -EINVAL; -+ -+ chips = DIV_ROUND_UP(ngpio, PINS_PER_BANK); -+ banks = sz / BANK_SIZE; -+ -+ for (i = 0; i < chips; i++) { -+ int offset, pins; -+ int reg_offset; -+ char *label; -+ -+ label = devm_kasprintf(dev, GFP_KERNEL, "bcm63xx-gpio.%i", i); -+ if (!label) -+ return -ENOMEM; -+ -+ offset = i * PINS_PER_BANK; -+ pins = min_t(int, ngpio - offset, PINS_PER_BANK); -+ -+ /* the registers are treated like a huge big endian register */ -+ reg_offset = (banks - i - 1) * BANK_SIZE; -+ -+ ret = bgpio_init(&gc[i], dev, BANK_SIZE, data + reg_offset, -+ NULL, NULL, dirout + reg_offset, NULL, -+ BGPIOF_BIG_ENDIAN_BYTE_ORDER); -+ if (ret) -+ return ret; -+ -+ gc[i].request = gpiochip_generic_request; -+ gc[i].free = gpiochip_generic_free; -+ -+ if (of_get_property(dev->of_node, "interrupt-names", NULL)) -+ gc[i].to_irq = bcm63xx_gpio_to_irq; -+ -+#ifdef CONFIG_OF -+ gc[i].of_gpio_n_cells = 2; -+ gc[i].of_xlate = bcm63xx_gpio_of_xlate; -+#endif -+ -+ gc[i].label = label; -+ gc[i].ngpio = pins; -+ -+ devm_gpiochip_add_data(dev, &gc[i], gc); -+ } -+ -+ return 0; -+} -+ -+static void bcm63xx_setup_pinranges(struct gpio_chip *gc, const char *name, -+ int ngpio) -+{ -+ int i, chips = DIV_ROUND_UP(ngpio, PINS_PER_BANK); -+ -+ for (i = 0; i < chips; i++) { -+ int offset, pins; -+ -+ offset = i * PINS_PER_BANK; -+ pins = min_t(int, ngpio - offset, PINS_PER_BANK); -+ -+ gpiochip_add_pin_range(&gc[i], name, 0, offset, pins); -+ } -+} -+ -+struct pinctrl_dev *bcm63xx_pinctrl_register(struct platform_device *pdev, -+ struct pinctrl_desc *desc, -+ void *priv, struct gpio_chip *gc, -+ int ngpio) -+{ -+ struct pinctrl_dev *pctldev; -+ struct resource *res; -+ void __iomem *dirout, *data; -+ size_t sz; -+ int ret; -+ -+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dirout"); -+ dirout = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(dirout)) -+ return ERR_CAST(dirout); -+ -+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dat"); -+ data = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(data)) -+ return ERR_CAST(data); -+ -+ sz = resource_size(res); -+ -+ ret = bcm63xx_setup_gpio(&pdev->dev, gc, dirout, data, sz, ngpio); -+ if (ret) -+ return ERR_PTR(ret); -+ -+ pctldev = devm_pinctrl_register(&pdev->dev, desc, priv); -+ if (IS_ERR(pctldev)) -+ return pctldev; -+ -+ bcm63xx_setup_pinranges(gc, pinctrl_dev_get_devname(pctldev), ngpio); -+ -+ dev_info(&pdev->dev, "registered at mmio %p\n", dirout); -+ -+ return pctldev; -+} ---- /dev/null -+++ b/drivers/pinctrl/bcm63xx/pinctrl-bcm63xx.h -@@ -0,0 +1,14 @@ -+#ifndef __PINCTRL_BRCM63XX -+#define __PINCTRL_BRCM63XX -+ -+#include -+#include -+#include -+#include -+ -+struct pinctrl_dev *bcm63xx_pinctrl_register(struct platform_device *pdev, -+ struct pinctrl_desc *desc, -+ void *priv, struct gpio_chip *gc, -+ int ngpio); -+ -+#endif diff --git a/target/linux/bcm63xx/patches-5.15/131-Documentation-add-BCM6328-pincontroller-binding-docu.patch b/target/linux/bcm63xx/patches-5.15/131-Documentation-add-BCM6328-pincontroller-binding-docu.patch deleted file mode 100644 index 3a2a7811db77f2..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/131-Documentation-add-BCM6328-pincontroller-binding-docu.patch +++ /dev/null @@ -1,78 +0,0 @@ -From 4bdd40849632608d5cb7d3a64380cd76e7eea07b Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Wed, 27 Jul 2016 11:33:56 +0200 -Subject: [PATCH 02/16] Documentation: add BCM6328 pincontroller binding - documentation - -Add binding documentation for the pincontrol core found in BCM6328 SoCs. - -Signed-off-by: Jonas Gorski ---- - .../bindings/pinctrl/brcm,bcm6328-pinctrl.txt | 61 ++++++++++++++++++++++ - 1 file changed, 61 insertions(+) - create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6328-pinctrl.txt - ---- /dev/null -+++ b/Documentation/devicetree/bindings/pinctrl/brcm,bcm6328-pinctrl.txt -@@ -0,0 +1,61 @@ -+* Broadcom BCM6328 pin controller -+ -+Required properties: -+- compatible: Must be "brcm,bcm6328-pinctrl". -+- reg: Register specifies of dirout, dat, mode, mux registers. -+- reg-names: Must be "dirout", "dat", "mode", "mux". -+- gpio-controller: Identifies this node as a GPIO controller. -+- #gpio-cells: Must be <2> -+ -+Example: -+ -+pinctrl: pin-controller@10000080 { -+ compatible = "brcm,bcm6328-pinctrl"; -+ reg = <0x10000080 0x8>, -+ <0x10000088 0x8>, -+ <0x10000098 0x4>, -+ <0x1000009c 0xc>; -+ reg-names = "dirout", "dat", "mode", "mux"; -+ -+ gpio-controller; -+ #gpio-cells = <2>; -+}; -+ -+Available pins/groups and functions: -+ -+name pins functions -+----------------------------------------------------------- -+gpio0 0 led -+gpio1 1 led -+gpio2 2 led -+gpio3 3 led -+gpio4 4 led -+gpio5 5 led -+gpio6 6 led, serial_led_data -+gpio7 7 led, serial_led_clk -+gpio8 8 led -+gpio9 9 led -+gpio10 10 led -+gpio11 11 led -+gpio12 12 led -+gpio13 13 led -+gpio14 14 led -+gpio15 15 led -+gpio16 16 led, pcie_clkreq -+gpio17 17 led -+gpio18 18 led -+gpio19 19 led -+gpio20 20 led -+gpio21 21 led -+gpio22 22 led -+gpio23 23 led -+gpio24 24 - -+gpio25 25 ephy0_act_led -+gpio26 26 ephy1_act_led -+gpio27 27 ephy2_act_led -+gpio28 28 ephy3_act_led -+gpio29 29 - -+gpio30 30 - -+gpio31 31 - -+hsspi_cs1 - hsspi_cs1 -+usb_port1 - usb_host_port, usb_device_port diff --git a/target/linux/bcm63xx/patches-5.15/132-pinctrl-add-a-pincontrol-driver-for-BCM6328.patch b/target/linux/bcm63xx/patches-5.15/132-pinctrl-add-a-pincontrol-driver-for-BCM6328.patch deleted file mode 100644 index 4251526c9f2b32..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/132-pinctrl-add-a-pincontrol-driver-for-BCM6328.patch +++ /dev/null @@ -1,495 +0,0 @@ -From 393e9753f6492c1fdf55891ddee60d955ae8b119 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Fri, 24 Jun 2016 22:12:50 +0200 -Subject: [PATCH 03/16] pinctrl: add a pincontrol driver for BCM6328 - -Add a pincontrol driver for BCM6328. BCM628 supports muxing 32 pins as -GPIOs, as LEDs for the integrated LED controller, or various other -functions. Its pincontrol mux registers also control other aspects, like -switching the second USB port between host and device mode. - -Signed-off-by: Jonas Gorski ---- - drivers/pinctrl/bcm63xx/Kconfig | 7 + - drivers/pinctrl/bcm63xx/Makefile | 1 + - drivers/pinctrl/bcm63xx/pinctrl-bcm6328.c | 456 ++++++++++++++++++++++++++++++ - 3 files changed, 464 insertions(+) - create mode 100644 drivers/pinctrl/bcm63xx/pinctrl-bcm6328.c - ---- a/drivers/pinctrl/bcm63xx/Kconfig -+++ b/drivers/pinctrl/bcm63xx/Kconfig -@@ -1,3 +1,10 @@ - config PINCTRL_BRCM63XX - bool - select GPIO_GENERIC -+ -+config PINCTRL_BRCM6328 -+ bool "BCM6328 pincontrol driver" if COMPILE_TEST -+ select PINMUX -+ select PINCONF -+ select PINCTRL_BRCM63XX -+ select GENERIC_PINCONF ---- a/drivers/pinctrl/bcm63xx/Makefile -+++ b/drivers/pinctrl/bcm63xx/Makefile -@@ -1 +1,2 @@ - obj-$(CONFIG_PINCTRL_BRCM63XX) += pinctrl-bcm63xx.o -+obj-$(CONFIG_PINCTRL_BRCM6328) += pinctrl-bcm6328.o ---- /dev/null -+++ b/drivers/pinctrl/bcm63xx/pinctrl-bcm6328.c -@@ -0,0 +1,456 @@ -+/* -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file "COPYING" in the main directory of this archive -+ * for more details. -+ * -+ * Copyright (C) 2016 Jonas Gorski -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include "../core.h" -+#include "../pinctrl-utils.h" -+ -+#include "pinctrl-bcm63xx.h" -+ -+#define BCM6328_MUX_LO_REG 0x4 -+#define BCM6328_MUX_HI_REG 0x0 -+#define BCM6328_MUX_OTHER_REG 0x8 -+ -+#define BCM6328_NGPIO 32 -+ -+struct bcm6328_pingroup { -+ const char *name; -+ const unsigned * const pins; -+ const unsigned num_pins; -+}; -+ -+struct bcm6328_function { -+ const char *name; -+ const char * const *groups; -+ const unsigned num_groups; -+ -+ unsigned mode_val:1; -+ unsigned mux_val:2; -+}; -+ -+struct bcm6328_pinctrl { -+ struct pinctrl_dev *pctldev; -+ struct pinctrl_desc desc; -+ -+ void __iomem *mode; -+ void __iomem *mux[3]; -+ -+ /* register access lock */ -+ spinlock_t lock; -+ -+ struct gpio_chip gpio; -+}; -+ -+static const struct pinctrl_pin_desc bcm6328_pins[] = { -+ PINCTRL_PIN(0, "gpio0"), -+ PINCTRL_PIN(1, "gpio1"), -+ PINCTRL_PIN(2, "gpio2"), -+ PINCTRL_PIN(3, "gpio3"), -+ PINCTRL_PIN(4, "gpio4"), -+ PINCTRL_PIN(5, "gpio5"), -+ PINCTRL_PIN(6, "gpio6"), -+ PINCTRL_PIN(7, "gpio7"), -+ PINCTRL_PIN(8, "gpio8"), -+ PINCTRL_PIN(9, "gpio9"), -+ PINCTRL_PIN(10, "gpio10"), -+ PINCTRL_PIN(11, "gpio11"), -+ PINCTRL_PIN(12, "gpio12"), -+ PINCTRL_PIN(13, "gpio13"), -+ PINCTRL_PIN(14, "gpio14"), -+ PINCTRL_PIN(15, "gpio15"), -+ PINCTRL_PIN(16, "gpio16"), -+ PINCTRL_PIN(17, "gpio17"), -+ PINCTRL_PIN(18, "gpio18"), -+ PINCTRL_PIN(19, "gpio19"), -+ PINCTRL_PIN(20, "gpio20"), -+ PINCTRL_PIN(21, "gpio21"), -+ PINCTRL_PIN(22, "gpio22"), -+ PINCTRL_PIN(23, "gpio23"), -+ PINCTRL_PIN(24, "gpio24"), -+ PINCTRL_PIN(25, "gpio25"), -+ PINCTRL_PIN(26, "gpio26"), -+ PINCTRL_PIN(27, "gpio27"), -+ PINCTRL_PIN(28, "gpio28"), -+ PINCTRL_PIN(29, "gpio29"), -+ PINCTRL_PIN(30, "gpio30"), -+ PINCTRL_PIN(31, "gpio31"), -+ -+ /* -+ * No idea where they really are; so let's put them according -+ * to their mux offsets. -+ */ -+ PINCTRL_PIN(36, "hsspi_cs1"), -+ PINCTRL_PIN(38, "usb_p2"), -+}; -+ -+static unsigned gpio0_pins[] = { 0 }; -+static unsigned gpio1_pins[] = { 1 }; -+static unsigned gpio2_pins[] = { 2 }; -+static unsigned gpio3_pins[] = { 3 }; -+static unsigned gpio4_pins[] = { 4 }; -+static unsigned gpio5_pins[] = { 5 }; -+static unsigned gpio6_pins[] = { 6 }; -+static unsigned gpio7_pins[] = { 7 }; -+static unsigned gpio8_pins[] = { 8 }; -+static unsigned gpio9_pins[] = { 9 }; -+static unsigned gpio10_pins[] = { 10 }; -+static unsigned gpio11_pins[] = { 11 }; -+static unsigned gpio12_pins[] = { 12 }; -+static unsigned gpio13_pins[] = { 13 }; -+static unsigned gpio14_pins[] = { 14 }; -+static unsigned gpio15_pins[] = { 15 }; -+static unsigned gpio16_pins[] = { 16 }; -+static unsigned gpio17_pins[] = { 17 }; -+static unsigned gpio18_pins[] = { 18 }; -+static unsigned gpio19_pins[] = { 19 }; -+static unsigned gpio20_pins[] = { 20 }; -+static unsigned gpio21_pins[] = { 21 }; -+static unsigned gpio22_pins[] = { 22 }; -+static unsigned gpio23_pins[] = { 23 }; -+static unsigned gpio24_pins[] = { 24 }; -+static unsigned gpio25_pins[] = { 25 }; -+static unsigned gpio26_pins[] = { 26 }; -+static unsigned gpio27_pins[] = { 27 }; -+static unsigned gpio28_pins[] = { 28 }; -+static unsigned gpio29_pins[] = { 29 }; -+static unsigned gpio30_pins[] = { 30 }; -+static unsigned gpio31_pins[] = { 31 }; -+ -+static unsigned hsspi_cs1_pins[] = { 36 }; -+static unsigned usb_port1_pins[] = { 38 }; -+ -+#define BCM6328_GROUP(n) \ -+ { \ -+ .name = #n, \ -+ .pins = n##_pins, \ -+ .num_pins = ARRAY_SIZE(n##_pins), \ -+ } -+ -+static struct bcm6328_pingroup bcm6328_groups[] = { -+ BCM6328_GROUP(gpio0), -+ BCM6328_GROUP(gpio1), -+ BCM6328_GROUP(gpio2), -+ BCM6328_GROUP(gpio3), -+ BCM6328_GROUP(gpio4), -+ BCM6328_GROUP(gpio5), -+ BCM6328_GROUP(gpio6), -+ BCM6328_GROUP(gpio7), -+ BCM6328_GROUP(gpio8), -+ BCM6328_GROUP(gpio9), -+ BCM6328_GROUP(gpio10), -+ BCM6328_GROUP(gpio11), -+ BCM6328_GROUP(gpio12), -+ BCM6328_GROUP(gpio13), -+ BCM6328_GROUP(gpio14), -+ BCM6328_GROUP(gpio15), -+ BCM6328_GROUP(gpio16), -+ BCM6328_GROUP(gpio17), -+ BCM6328_GROUP(gpio18), -+ BCM6328_GROUP(gpio19), -+ BCM6328_GROUP(gpio20), -+ BCM6328_GROUP(gpio21), -+ BCM6328_GROUP(gpio22), -+ BCM6328_GROUP(gpio23), -+ BCM6328_GROUP(gpio24), -+ BCM6328_GROUP(gpio25), -+ BCM6328_GROUP(gpio26), -+ BCM6328_GROUP(gpio27), -+ BCM6328_GROUP(gpio28), -+ BCM6328_GROUP(gpio29), -+ BCM6328_GROUP(gpio30), -+ BCM6328_GROUP(gpio31), -+ -+ BCM6328_GROUP(hsspi_cs1), -+ BCM6328_GROUP(usb_port1), -+}; -+ -+/* GPIO_MODE */ -+static const char * const led_groups[] = { -+ "gpio0", -+ "gpio1", -+ "gpio2", -+ "gpio3", -+ "gpio4", -+ "gpio5", -+ "gpio6", -+ "gpio7", -+ "gpio8", -+ "gpio9", -+ "gpio10", -+ "gpio11", -+ "gpio12", -+ "gpio13", -+ "gpio14", -+ "gpio15", -+ "gpio16", -+ "gpio17", -+ "gpio18", -+ "gpio19", -+ "gpio20", -+ "gpio21", -+ "gpio22", -+ "gpio23", -+}; -+ -+/* PINMUX_SEL */ -+static const char * const serial_led_data_groups[] = { -+ "gpio6", -+}; -+ -+static const char * const serial_led_clk_groups[] = { -+ "gpio7", -+}; -+ -+static const char * const inet_act_led_groups[] = { -+ "gpio11", -+}; -+ -+static const char * const pcie_clkreq_groups[] = { -+ "gpio16", -+}; -+ -+static const char * const ephy0_act_led_groups[] = { -+ "gpio25", -+}; -+ -+static const char * const ephy1_act_led_groups[] = { -+ "gpio26", -+}; -+ -+static const char * const ephy2_act_led_groups[] = { -+ "gpio27", -+}; -+ -+static const char * const ephy3_act_led_groups[] = { -+ "gpio28", -+}; -+ -+static const char * const hsspi_cs1_groups[] = { -+ "hsspi_cs1" -+}; -+ -+static const char * const usb_host_port_groups[] = { -+ "usb_port1", -+}; -+ -+static const char * const usb_device_port_groups[] = { -+ "usb_port1", -+}; -+ -+#define BCM6328_MODE_FUN(n) \ -+ { \ -+ .name = #n, \ -+ .groups = n##_groups, \ -+ .num_groups = ARRAY_SIZE(n##_groups), \ -+ .mode_val = 1, \ -+ } -+ -+#define BCM6328_MUX_FUN(n, mux) \ -+ { \ -+ .name = #n, \ -+ .groups = n##_groups, \ -+ .num_groups = ARRAY_SIZE(n##_groups), \ -+ .mux_val = mux, \ -+ } -+ -+static const struct bcm6328_function bcm6328_funcs[] = { -+ BCM6328_MODE_FUN(led), -+ BCM6328_MUX_FUN(serial_led_data, 2), -+ BCM6328_MUX_FUN(serial_led_clk, 2), -+ BCM6328_MUX_FUN(inet_act_led, 1), -+ BCM6328_MUX_FUN(pcie_clkreq, 2), -+ BCM6328_MUX_FUN(ephy0_act_led, 1), -+ BCM6328_MUX_FUN(ephy1_act_led, 1), -+ BCM6328_MUX_FUN(ephy2_act_led, 1), -+ BCM6328_MUX_FUN(ephy3_act_led, 1), -+ BCM6328_MUX_FUN(hsspi_cs1, 2), -+ BCM6328_MUX_FUN(usb_host_port, 1), -+ BCM6328_MUX_FUN(usb_device_port, 2), -+}; -+ -+static int bcm6328_pinctrl_get_group_count(struct pinctrl_dev *pctldev) -+{ -+ return ARRAY_SIZE(bcm6328_groups); -+} -+ -+static const char *bcm6328_pinctrl_get_group_name(struct pinctrl_dev *pctldev, -+ unsigned group) -+{ -+ return bcm6328_groups[group].name; -+} -+ -+static int bcm6328_pinctrl_get_group_pins(struct pinctrl_dev *pctldev, -+ unsigned group, const unsigned **pins, -+ unsigned *num_pins) -+{ -+ *pins = bcm6328_groups[group].pins; -+ *num_pins = bcm6328_groups[group].num_pins; -+ -+ return 0; -+} -+ -+static int bcm6328_pinctrl_get_func_count(struct pinctrl_dev *pctldev) -+{ -+ return ARRAY_SIZE(bcm6328_funcs); -+} -+ -+static const char *bcm6328_pinctrl_get_func_name(struct pinctrl_dev *pctldev, -+ unsigned selector) -+{ -+ return bcm6328_funcs[selector].name; -+} -+ -+static int bcm6328_pinctrl_get_groups(struct pinctrl_dev *pctldev, -+ unsigned selector, -+ const char * const **groups, -+ unsigned * const num_groups) -+{ -+ *groups = bcm6328_funcs[selector].groups; -+ *num_groups = bcm6328_funcs[selector].num_groups; -+ -+ return 0; -+} -+ -+static void bcm6328_rmw_mux(struct bcm6328_pinctrl *pctl, unsigned pin, -+ u32 mode, u32 mux) -+{ -+ unsigned long flags; -+ u32 reg; -+ -+ spin_lock_irqsave(&pctl->lock, flags); -+ if (pin < 32) { -+ reg = __raw_readl(pctl->mode); -+ reg &= ~BIT(pin); -+ if (mode) -+ reg |= BIT(pin); -+ __raw_writel(reg, pctl->mode); -+ } -+ -+ reg = __raw_readl(pctl->mux[pin / 16]); -+ reg &= ~(3UL << ((pin % 16) * 2)); -+ reg |= mux << ((pin % 16) * 2); -+ __raw_writel(reg, pctl->mux[pin / 16]); -+ -+ spin_unlock_irqrestore(&pctl->lock, flags); -+} -+ -+static int bcm6328_pinctrl_set_mux(struct pinctrl_dev *pctldev, -+ unsigned selector, unsigned group) -+{ -+ struct bcm6328_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); -+ const struct bcm6328_pingroup *grp = &bcm6328_groups[group]; -+ const struct bcm6328_function *f = &bcm6328_funcs[selector]; -+ -+ bcm6328_rmw_mux(pctl, grp->pins[0], f->mode_val, f->mux_val); -+ -+ return 0; -+} -+ -+static int bcm6328_gpio_request_enable(struct pinctrl_dev *pctldev, -+ struct pinctrl_gpio_range *range, -+ unsigned offset) -+{ -+ struct bcm6328_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); -+ -+ /* disable all functions using this pin */ -+ bcm6328_rmw_mux(pctl, offset, 0, 0); -+ -+ return 0; -+} -+ -+static struct pinctrl_ops bcm6328_pctl_ops = { -+ .get_groups_count = bcm6328_pinctrl_get_group_count, -+ .get_group_name = bcm6328_pinctrl_get_group_name, -+ .get_group_pins = bcm6328_pinctrl_get_group_pins, -+#ifdef CONFIG_OF -+ .dt_node_to_map = pinconf_generic_dt_node_to_map_pin, -+ .dt_free_map = pinctrl_utils_free_map, -+#endif -+}; -+ -+static struct pinmux_ops bcm6328_pmx_ops = { -+ .get_functions_count = bcm6328_pinctrl_get_func_count, -+ .get_function_name = bcm6328_pinctrl_get_func_name, -+ .get_function_groups = bcm6328_pinctrl_get_groups, -+ .set_mux = bcm6328_pinctrl_set_mux, -+ .gpio_request_enable = bcm6328_gpio_request_enable, -+ .strict = true, -+}; -+ -+static int bcm6328_pinctrl_probe(struct platform_device *pdev) -+{ -+ struct bcm6328_pinctrl *pctl; -+ struct resource *res; -+ void __iomem *mode, *mux; -+ -+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mode"); -+ mode = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(mode)) -+ return PTR_ERR(mode); -+ -+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mux"); -+ mux = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(mux)) -+ return PTR_ERR(mux); -+ -+ pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL); -+ if (!pctl) -+ return -ENOMEM; -+ -+ spin_lock_init(&pctl->lock); -+ -+ pctl->mode = mode; -+ pctl->mux[0] = mux + BCM6328_MUX_LO_REG; -+ pctl->mux[1] = mux + BCM6328_MUX_HI_REG; -+ pctl->mux[2] = mux + BCM6328_MUX_OTHER_REG; -+ -+ pctl->desc.name = dev_name(&pdev->dev); -+ pctl->desc.owner = THIS_MODULE; -+ pctl->desc.pctlops = &bcm6328_pctl_ops; -+ pctl->desc.pmxops = &bcm6328_pmx_ops; -+ -+ pctl->desc.npins = ARRAY_SIZE(bcm6328_pins); -+ pctl->desc.pins = bcm6328_pins; -+ -+ platform_set_drvdata(pdev, pctl); -+ -+ pctl->pctldev = bcm63xx_pinctrl_register(pdev, &pctl->desc, pctl, -+ &pctl->gpio, BCM6328_NGPIO); -+ if (IS_ERR(pctl->pctldev)) -+ return PTR_ERR(pctl->pctldev); -+ -+ return 0; -+} -+ -+static const struct of_device_id bcm6328_pinctrl_match[] = { -+ { .compatible = "brcm,bcm6328-pinctrl", }, -+ { }, -+}; -+ -+static struct platform_driver bcm6328_pinctrl_driver = { -+ .probe = bcm6328_pinctrl_probe, -+ .driver = { -+ .name = "bcm6328-pinctrl", -+ .of_match_table = bcm6328_pinctrl_match, -+ }, -+}; -+ -+builtin_platform_driver(bcm6328_pinctrl_driver); diff --git a/target/linux/bcm63xx/patches-5.15/133-Documentation-add-BCM6348-pincontroller-binding-docu.patch b/target/linux/bcm63xx/patches-5.15/133-Documentation-add-BCM6348-pincontroller-binding-docu.patch deleted file mode 100644 index 800f0540cc9855..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/133-Documentation-add-BCM6348-pincontroller-binding-docu.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 962c46bf7f43df730e2d3698930e77958cc6b191 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Wed, 27 Jul 2016 11:35:45 +0200 -Subject: [PATCH 04/16] Documentation: add BCM6348 pincontroller binding - documentation - -Add binding documentation for the pincontrol core found in BCM6348 SoCs. - -Signed-off-by: Jonas Gorski ---- - .../bindings/pinctrl/brcm,bcm6348-pinctrl.txt | 32 ++++++++++++++++++++++ - 1 file changed, 32 insertions(+) - create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6348-pinctrl.txt - ---- /dev/null -+++ b/Documentation/devicetree/bindings/pinctrl/brcm,bcm6348-pinctrl.txt -@@ -0,0 +1,32 @@ -+* Broadcom BCM6348 pin controller -+ -+Required properties: -+- compatible: Must be "brcm,bcm6348-pinctrl". -+- reg: register Specifiers of dirout, dat, mode registers. -+- reg-names: Must be "dirout", "dat", "mode". -+- gpio-controller: Identifies this node as a GPIO controller. -+- #gpio-cells: Must be <2>. -+ -+Example: -+ -+pinctrl: pin-controller@fffe0080 { -+ compatible = "brcm,bcm6348-pinctrl"; -+ reg = <0xfffe0080 0x8>, -+ <0xfffe0088 0x8>, -+ <0xfffe0098 0x4>; -+ reg-names = "dirout", "dat", "mode"; -+ -+ gpio-controller; -+ #gpio-cells = <2>; -+}; -+ -+Available pins/groups and functions: -+ -+name pins functions -+----------------------------------------------------------- -+group0 32-36 ext_mii, diag -+group1 22-31 ext_ephy, mii_snoop, mii_pccard, -+ spi_master_uart, utopia, diag -+group2 16-21 pci, diag -+group3 8-15 ext_mii, utopia, diag -+group4 0-7 ext_ephy, mii_snoop, legacy_led, utopia, diag diff --git a/target/linux/bcm63xx/patches-5.15/134-pinctrl-add-a-pincontrol-driver-for-BCM6348.patch b/target/linux/bcm63xx/patches-5.15/134-pinctrl-add-a-pincontrol-driver-for-BCM6348.patch deleted file mode 100644 index de8c2368dbb457..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/134-pinctrl-add-a-pincontrol-driver-for-BCM6348.patch +++ /dev/null @@ -1,410 +0,0 @@ -From 45444cb631555e2dc16b95d779b10aa075c7482e Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Fri, 24 Jun 2016 22:14:13 +0200 -Subject: [PATCH 05/16] pinctrl: add a pincontrol driver for BCM6348 - -Add a pincotrol driver for BCM6348. BCM6348 allow muxing five groups of -up to ten gpios into fourteen potential functions. It does not allow -muxing individual pins. Some functions require more than one group to be -muxed to the same function. - -Signed-off-by: Jonas Gorski ---- - drivers/pinctrl/bcm63xx/Kconfig | 7 + - drivers/pinctrl/bcm63xx/Makefile | 1 + - drivers/pinctrl/bcm63xx/pinctrl-bcm6348.c | 391 ++++++++++++++++++++++++++++++ - 3 files changed, 399 insertions(+) - create mode 100644 drivers/pinctrl/bcm63xx/pinctrl-bcm6348.c - ---- a/drivers/pinctrl/bcm63xx/Kconfig -+++ b/drivers/pinctrl/bcm63xx/Kconfig -@@ -8,3 +8,10 @@ config PINCTRL_BRCM6328 - select PINCONF - select PINCTRL_BRCM63XX - select GENERIC_PINCONF -+ -+config PINCTRL_BRCM6348 -+ bool "BCM6348 pincontrol driver" if COMPILE_TEST -+ select PINMUX -+ select PINCONF -+ select PINCTRL_BRCM63XX -+ select GENERIC_PINCONF ---- a/drivers/pinctrl/bcm63xx/Makefile -+++ b/drivers/pinctrl/bcm63xx/Makefile -@@ -1,2 +1,3 @@ - obj-$(CONFIG_PINCTRL_BRCM63XX) += pinctrl-bcm63xx.o - obj-$(CONFIG_PINCTRL_BRCM6328) += pinctrl-bcm6328.o -+obj-$(CONFIG_PINCTRL_BRCM6348) += pinctrl-bcm6348.o ---- /dev/null -+++ b/drivers/pinctrl/bcm63xx/pinctrl-bcm6348.c -@@ -0,0 +1,370 @@ -+/* -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file "COPYING" in the main directory of this archive -+ * for more details. -+ * -+ * Copyright (C) 2016 Jonas Gorski -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include "../core.h" -+#include "../pinctrl-utils.h" -+ -+#include "pinctrl-bcm63xx.h" -+ -+#define BCM6348_NGPIO 37 -+ -+#define MAX_GROUP 4 -+#define PINS_PER_GROUP 8 -+#define PIN_TO_GROUP(pin) (MAX_GROUP - ((pin) / PINS_PER_GROUP)) -+#define GROUP_SHIFT(pin) (PIN_TO_GROUP(pin) * 4) -+#define GROUP_MASK(pin) (0xf << GROUP_SHIFT(pin)) -+ -+struct bcm6348_pingroup { -+ const char *name; -+ const unsigned * const pins; -+ const unsigned num_pins; -+}; -+ -+struct bcm6348_function { -+ const char *name; -+ const char * const *groups; -+ const unsigned num_groups; -+ unsigned int value; -+}; -+ -+struct bcm6348_pinctrl { -+ struct pinctrl_dev *pctldev; -+ struct pinctrl_desc desc; -+ -+ void __iomem *mode; -+ -+ /* register access lock */ -+ spinlock_t lock; -+ -+ struct gpio_chip gpio[2]; -+}; -+ -+#define BCM6348_PIN(a, b, group) \ -+ { \ -+ .number = a, \ -+ .name = b, \ -+ .drv_data = (void *)(group), \ -+ } -+ -+static const struct pinctrl_pin_desc bcm6348_pins[] = { -+ BCM6348_PIN(0, "gpio0", 4), -+ BCM6348_PIN(1, "gpio1", 4), -+ BCM6348_PIN(2, "gpio2", 4), -+ BCM6348_PIN(3, "gpio3", 4), -+ BCM6348_PIN(4, "gpio4", 4), -+ BCM6348_PIN(5, "gpio5", 4), -+ BCM6348_PIN(6, "gpio6", 4), -+ BCM6348_PIN(7, "gpio7", 4), -+ BCM6348_PIN(8, "gpio8", 3), -+ BCM6348_PIN(9, "gpio9", 3), -+ BCM6348_PIN(10, "gpio10", 3), -+ BCM6348_PIN(11, "gpio11", 3), -+ BCM6348_PIN(12, "gpio12", 3), -+ BCM6348_PIN(13, "gpio13", 3), -+ BCM6348_PIN(14, "gpio14", 3), -+ BCM6348_PIN(15, "gpio15", 3), -+ BCM6348_PIN(16, "gpio16", 2), -+ BCM6348_PIN(17, "gpio17", 2), -+ BCM6348_PIN(18, "gpio18", 2), -+ BCM6348_PIN(19, "gpio19", 2), -+ BCM6348_PIN(20, "gpio20", 2), -+ BCM6348_PIN(21, "gpio21", 2), -+ BCM6348_PIN(22, "gpio22", 1), -+ BCM6348_PIN(23, "gpio23", 1), -+ BCM6348_PIN(24, "gpio24", 1), -+ BCM6348_PIN(25, "gpio25", 1), -+ BCM6348_PIN(26, "gpio26", 1), -+ BCM6348_PIN(27, "gpio27", 1), -+ BCM6348_PIN(28, "gpio28", 1), -+ BCM6348_PIN(29, "gpio29", 1), -+ BCM6348_PIN(30, "gpio30", 1), -+ BCM6348_PIN(31, "gpio31", 1), -+ BCM6348_PIN(32, "gpio32", 0), -+ BCM6348_PIN(33, "gpio33", 0), -+ BCM6348_PIN(34, "gpio34", 0), -+ BCM6348_PIN(35, "gpio35", 0), -+ BCM6348_PIN(36, "gpio36", 0), -+}; -+ -+enum bcm6348_muxes { -+ BCM6348_MUX_GPIO = 0, -+ BCM6348_MUX_EXT_EPHY, -+ BCM6348_MUX_MII_SNOOP, -+ BCM6348_MUX_LEGACY_LED, -+ BCM6348_MUX_MII_PCCARD, -+ BCM6348_MUX_PCI, -+ BCM6348_MUX_SPI_MASTER_UART, -+ BCM6348_MUX_EXT_MII, -+ BCM6348_MUX_UTOPIA, -+ BCM6348_MUX_DIAG, -+}; -+ -+static unsigned group0_pins[] = { -+ 32, 33, 34, 35, 36, -+}; -+ -+static unsigned group1_pins[] = { -+ 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, -+}; -+ -+static unsigned group2_pins[] = { -+ 16, 17, 18, 19, 20, 21, -+}; -+ -+static unsigned group3_pins[] = { -+ 8, 9, 10, 11, 12, 13, 14, 15, -+}; -+ -+static unsigned group4_pins[] = { -+ 0, 1, 2, 3, 4, 5, 6, 7, -+}; -+ -+#define BCM6348_GROUP(n) \ -+ { \ -+ .name = #n, \ -+ .pins = n##_pins, \ -+ .num_pins = ARRAY_SIZE(n##_pins), \ -+ } \ -+ -+static struct bcm6348_pingroup bcm6348_groups[] = { -+ BCM6348_GROUP(group0), -+ BCM6348_GROUP(group1), -+ BCM6348_GROUP(group2), -+ BCM6348_GROUP(group3), -+ BCM6348_GROUP(group4), -+}; -+ -+static const char * const ext_mii_groups[] = { -+ "group0", -+ "group3", -+}; -+ -+static const char * const ext_ephy_groups[] = { -+ "group1", -+ "group4" -+}; -+ -+static const char * const mii_snoop_groups[] = { -+ "group1", -+ "group4", -+}; -+ -+static const char * const legacy_led_groups[] = { -+ "group4", -+}; -+ -+static const char * const mii_pccard_groups[] = { -+ "group1", -+}; -+ -+static const char * const pci_groups[] = { -+ "group2", -+}; -+ -+static const char * const spi_master_uart_groups[] = { -+ "group1", -+}; -+ -+static const char * const utopia_groups[] = { -+ "group1", -+ "group3", -+ "group4", -+}; -+ -+static const char * const diag_groups[] = { -+ "group0", -+ "group1", -+ "group2", -+ "group3", -+ "group4", -+}; -+ -+#define BCM6348_FUN(n, f) \ -+ { \ -+ .name = #n, \ -+ .groups = n##_groups, \ -+ .num_groups = ARRAY_SIZE(n##_groups), \ -+ .value = BCM6348_MUX_##f, \ -+ } -+ -+static const struct bcm6348_function bcm6348_funcs[] = { -+ BCM6348_FUN(ext_mii, EXT_MII), -+ BCM6348_FUN(ext_ephy, EXT_EPHY), -+ BCM6348_FUN(mii_snoop, MII_SNOOP), -+ BCM6348_FUN(legacy_led, LEGACY_LED), -+ BCM6348_FUN(mii_pccard, MII_PCCARD), -+ BCM6348_FUN(pci, PCI), -+ BCM6348_FUN(spi_master_uart, SPI_MASTER_UART), -+ BCM6348_FUN(utopia, UTOPIA), -+ BCM6348_FUN(diag, DIAG), -+}; -+ -+static int bcm6348_pinctrl_get_group_count(struct pinctrl_dev *pctldev) -+{ -+ return ARRAY_SIZE(bcm6348_groups); -+} -+ -+static const char *bcm6348_pinctrl_get_group_name(struct pinctrl_dev *pctldev, -+ unsigned group) -+{ -+ return bcm6348_groups[group].name; -+} -+ -+static int bcm6348_pinctrl_get_group_pins(struct pinctrl_dev *pctldev, -+ unsigned group, const unsigned **pins, -+ unsigned *num_pins) -+{ -+ *pins = bcm6348_groups[group].pins; -+ *num_pins = bcm6348_groups[group].num_pins; -+ -+ return 0; -+} -+ -+static int bcm6348_pinctrl_get_func_count(struct pinctrl_dev *pctldev) -+{ -+ return ARRAY_SIZE(bcm6348_funcs); -+} -+ -+static const char *bcm6348_pinctrl_get_func_name(struct pinctrl_dev *pctldev, -+ unsigned selector) -+{ -+ return bcm6348_funcs[selector].name; -+} -+ -+static int bcm6348_pinctrl_get_groups(struct pinctrl_dev *pctldev, -+ unsigned selector, -+ const char * const **groups, -+ unsigned * const num_groups) -+{ -+ *groups = bcm6348_funcs[selector].groups; -+ *num_groups = bcm6348_funcs[selector].num_groups; -+ -+ return 0; -+} -+ -+static void bcm6348_rmw_mux(struct bcm6348_pinctrl *pctl, u32 mask, u32 val) -+{ -+ unsigned long flags; -+ u32 reg; -+ -+ spin_lock_irqsave(&pctl->lock, flags); -+ -+ reg = __raw_readl(pctl->mode); -+ reg &= ~mask; -+ reg |= val & mask; -+ __raw_writel(reg, pctl->mode); -+ -+ spin_unlock_irqrestore(&pctl->lock, flags); -+} -+ -+static int bcm6348_pinctrl_set_mux(struct pinctrl_dev *pctldev, -+ unsigned selector, unsigned group) -+{ -+ struct bcm6348_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); -+ const struct bcm6348_pingroup *grp = &bcm6348_groups[group]; -+ const struct bcm6348_function *f = &bcm6348_funcs[selector]; -+ u32 mask, val; -+ -+ /* -+ * pins n..(n+7) share the same group, so we only need to look at -+ * the first pin. -+ */ -+ mask = GROUP_MASK(grp->pins[0]); -+ val = f->value << GROUP_SHIFT(grp->pins[0]); -+ -+ bcm6348_rmw_mux(pctl, mask, val); -+ -+ return 0; -+} -+ -+static struct pinctrl_ops bcm6348_pctl_ops = { -+ .get_groups_count = bcm6348_pinctrl_get_group_count, -+ .get_group_name = bcm6348_pinctrl_get_group_name, -+ .get_group_pins = bcm6348_pinctrl_get_group_pins, -+#ifdef CONFIG_OF -+ .dt_node_to_map = pinconf_generic_dt_node_to_map_pin, -+ .dt_free_map = pinctrl_utils_free_map, -+#endif -+}; -+ -+static struct pinmux_ops bcm6348_pmx_ops = { -+ .get_functions_count = bcm6348_pinctrl_get_func_count, -+ .get_function_name = bcm6348_pinctrl_get_func_name, -+ .get_function_groups = bcm6348_pinctrl_get_groups, -+ .set_mux = bcm6348_pinctrl_set_mux, -+ .strict = false, -+}; -+ -+static int bcm6348_pinctrl_probe(struct platform_device *pdev) -+{ -+ struct bcm6348_pinctrl *pctl; -+ struct resource *res; -+ void __iomem *mode; -+ -+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mode"); -+ mode = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(mode)) -+ return PTR_ERR(mode); -+ -+ pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL); -+ if (!pctl) -+ return -ENOMEM; -+ -+ spin_lock_init(&pctl->lock); -+ -+ pctl->mode = mode; -+ -+ /* disable all muxes by default */ -+ __raw_writel(0, pctl->mode); -+ -+ pctl->desc.name = dev_name(&pdev->dev); -+ pctl->desc.owner = THIS_MODULE; -+ pctl->desc.pctlops = &bcm6348_pctl_ops; -+ pctl->desc.pmxops = &bcm6348_pmx_ops; -+ -+ pctl->desc.npins = ARRAY_SIZE(bcm6348_pins); -+ pctl->desc.pins = bcm6348_pins; -+ -+ platform_set_drvdata(pdev, pctl); -+ -+ pctl->pctldev = bcm63xx_pinctrl_register(pdev, &pctl->desc, pctl, -+ pctl->gpio, BCM6348_NGPIO); -+ if (IS_ERR(pctl->pctldev)) -+ return PTR_ERR(pctl->pctldev); -+ -+ return 0; -+} -+ -+static const struct of_device_id bcm6348_pinctrl_match[] = { -+ { .compatible = "brcm,bcm6348-pinctrl", }, -+ { }, -+}; -+ -+static struct platform_driver bcm6348_pinctrl_driver = { -+ .probe = bcm6348_pinctrl_probe, -+ .driver = { -+ .name = "bcm6348-pinctrl", -+ .of_match_table = bcm6348_pinctrl_match, -+ }, -+}; -+ -+builtin_platform_driver(bcm6348_pinctrl_driver); diff --git a/target/linux/bcm63xx/patches-5.15/135-Documentation-add-BCM6358-pincontroller-binding-docu.patch b/target/linux/bcm63xx/patches-5.15/135-Documentation-add-BCM6358-pincontroller-binding-docu.patch deleted file mode 100644 index e8a7479915a088..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/135-Documentation-add-BCM6358-pincontroller-binding-docu.patch +++ /dev/null @@ -1,61 +0,0 @@ -From c7c8fa7f5b5ee9bea751fa7bdae8ff4acde8f26e Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Wed, 27 Jul 2016 11:36:00 +0200 -Subject: [PATCH 06/16] Documentation: add BCM6358 pincontroller binding - documentation - -Add binding documentation for the pincontrol core found in BCM6358 SoCs. - -Signed-off-by: Jonas Gorski ---- - .../bindings/pinctrl/brcm,bcm6358-pinctrl.txt | 44 ++++++++++++++++++++++ - 1 file changed, 44 insertions(+) - create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6358-pinctrl.txt - ---- /dev/null -+++ b/Documentation/devicetree/bindings/pinctrl/brcm,bcm6358-pinctrl.txt -@@ -0,0 +1,44 @@ -+* Broadcom BCM6358 pin controller -+ -+Required properties: -+- compatible: Must be "brcm,bcm6358-pinctrl". -+- reg: Register specifiers of dirout, dat registers. -+- reg-names: Must be "dirout", "dat". -+- brcm,gpiomode: Phandle to the shared gpiomode register. -+- gpio-controller: Identifies this node as a gpio-controller. -+- #gpio-cells: Must be <2>. -+ -+Example: -+ -+pinctrl: pin-controller@fffe0080 { -+ compatible = "brcm,bcm6358-pinctrl"; -+ reg = <0xfffe0080 0x8>, -+ <0xfffe0088 0x8>, -+ <0xfffe0098 0x4>; -+ reg-names = "dirout", "dat"; -+ brcm,gpiomode = <&gpiomode>; -+ -+ gpio-controller; -+ #gpio-cells = <2>; -+}; -+ -+gpiomode: syscon@fffe0098 { -+ compatible = "brcm,bcm6358-gpiomode", "syscon"; -+ reg = <0xfffe0098 0x4>; -+ native-endian; -+}; -+ -+Available pins/groups and functions: -+ -+name pins functions -+----------------------------------------------------------- -+ebi_cs_grp 30-31 ebi_cs -+uart1_grp 28-31 uart1 -+spi_cs_grp 32-33 spi_cs -+async_modem_grp 12-15 async_modem -+legacy_led_grp 9-15 legacy_led -+serial_led_grp 6-7 serial_led -+led_grp 0-3 led -+utopia_grp 12-15, 22-31 utopia -+pwm_syn_clk_grp 8 pwm_syn_clk -+sys_irq_grp 5 sys_irq diff --git a/target/linux/bcm63xx/patches-5.15/136-pinctrl-add-a-pincontrol-driver-for-BCM6358.patch b/target/linux/bcm63xx/patches-5.15/136-pinctrl-add-a-pincontrol-driver-for-BCM6358.patch deleted file mode 100644 index 17ce13cc9f3cff..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/136-pinctrl-add-a-pincontrol-driver-for-BCM6358.patch +++ /dev/null @@ -1,436 +0,0 @@ -From fb00ef462f3f8b70ea8902151cc72810fe90b999 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Fri, 24 Jun 2016 22:16:01 +0200 -Subject: [PATCH 07/16] pinctrl: add a pincontrol driver for BCM6358 - -Add a pincotrol driver for BCM6358. BCM6358 allow overlaying different -functions onto the GPIO pins. It does not support configuring individual -pins but only whole groups. These groups may overlap, and still require -the directions to be set correctly in the GPIO register. In addition the -functions register controls other, not directly mux related functions. - -Signed-off-by: Jonas Gorski ---- - drivers/pinctrl/bcm63xx/Kconfig | 8 + - drivers/pinctrl/bcm63xx/Makefile | 1 + - drivers/pinctrl/bcm63xx/pinctrl-bcm6358.c | 393 ++++++++++++++++++++++++++++++ - 3 files changed, 402 insertions(+) - create mode 100644 drivers/pinctrl/bcm63xx/pinctrl-bcm6358.c - ---- a/drivers/pinctrl/bcm63xx/Kconfig -+++ b/drivers/pinctrl/bcm63xx/Kconfig -@@ -15,3 +15,11 @@ config PINCTRL_BRCM6348 - select PINCONF - select PINCTRL_BRCM63XX - select GENERIC_PINCONF -+ -+config PINCTRL_BRCM6358 -+ bool "BCM6358 pincontrol driver" if COMPILE_TEST -+ select PINMUX -+ select PINCONF -+ select PINCTRL_BRCM63XX -+ select GENERIC_PINCONF -+ select MFD_SYSCON ---- a/drivers/pinctrl/bcm63xx/Makefile -+++ b/drivers/pinctrl/bcm63xx/Makefile -@@ -1,3 +1,4 @@ - obj-$(CONFIG_PINCTRL_BRCM63XX) += pinctrl-bcm63xx.o - obj-$(CONFIG_PINCTRL_BRCM6328) += pinctrl-bcm6328.o - obj-$(CONFIG_PINCTRL_BRCM6348) += pinctrl-bcm6348.o -+obj-$(CONFIG_PINCTRL_BRCM6358) += pinctrl-bcm6358.o ---- /dev/null -+++ b/drivers/pinctrl/bcm63xx/pinctrl-bcm6358.c -@@ -0,0 +1,393 @@ -+/* -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file "COPYING" in the main directory of this archive -+ * for more details. -+ * -+ * Copyright (C) 2016 Jonas Gorski -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include "../core.h" -+#include "../pinctrl-utils.h" -+ -+#include "pinctrl-bcm63xx.h" -+ -+/* GPIO_MODE register */ -+#define BCM6358_MODE_MUX_NONE 0 -+ -+/* overlays on gpio pins */ -+#define BCM6358_MODE_MUX_EBI_CS BIT(5) -+#define BCM6358_MODE_MUX_UART1 BIT(6) -+#define BCM6358_MODE_MUX_SPI_CS BIT(7) -+#define BCM6358_MODE_MUX_ASYNC_MODEM BIT(8) -+#define BCM6358_MODE_MUX_LEGACY_LED BIT(9) -+#define BCM6358_MODE_MUX_SERIAL_LED BIT(10) -+#define BCM6358_MODE_MUX_LED BIT(11) -+#define BCM6358_MODE_MUX_UTOPIA BIT(12) -+#define BCM6358_MODE_MUX_CLKRST BIT(13) -+#define BCM6358_MODE_MUX_PWM_SYN_CLK BIT(14) -+#define BCM6358_MODE_MUX_SYS_IRQ BIT(15) -+ -+#define BCM6358_NGPIO 40 -+ -+struct bcm6358_pingroup { -+ const char *name; -+ const unsigned * const pins; -+ const unsigned num_pins; -+ -+ const u16 mode_val; -+ -+ /* non-GPIO function muxes require the gpio direction to be set */ -+ const u16 direction; -+}; -+ -+struct bcm6358_function { -+ const char *name; -+ const char * const *groups; -+ const unsigned num_groups; -+}; -+ -+struct bcm6358_pinctrl { -+ struct device *dev; -+ struct pinctrl_dev *pctldev; -+ struct pinctrl_desc desc; -+ -+ struct regmap_field *overlays; -+ -+ struct gpio_chip gpio[2]; -+}; -+ -+#define BCM6358_GPIO_PIN(a, b, bit1, bit2, bit3) \ -+ { \ -+ .number = a, \ -+ .name = b, \ -+ .drv_data = (void *)(BCM6358_MODE_MUX_##bit1 | \ -+ BCM6358_MODE_MUX_##bit2 | \ -+ BCM6358_MODE_MUX_##bit3), \ -+ } -+ -+static const struct pinctrl_pin_desc bcm6358_pins[] = { -+ BCM6358_GPIO_PIN(0, "gpio0", LED, NONE, NONE), -+ BCM6358_GPIO_PIN(1, "gpio1", LED, NONE, NONE), -+ BCM6358_GPIO_PIN(2, "gpio2", LED, NONE, NONE), -+ BCM6358_GPIO_PIN(3, "gpio3", LED, NONE, NONE), -+ PINCTRL_PIN(4, "gpio4"), -+ BCM6358_GPIO_PIN(5, "gpio5", SYS_IRQ, NONE, NONE), -+ BCM6358_GPIO_PIN(6, "gpio6", SERIAL_LED, NONE, NONE), -+ BCM6358_GPIO_PIN(7, "gpio7", SERIAL_LED, NONE, NONE), -+ BCM6358_GPIO_PIN(8, "gpio8", PWM_SYN_CLK, NONE, NONE), -+ BCM6358_GPIO_PIN(9, "gpio09", LEGACY_LED, NONE, NONE), -+ BCM6358_GPIO_PIN(10, "gpio10", LEGACY_LED, NONE, NONE), -+ BCM6358_GPIO_PIN(11, "gpio11", LEGACY_LED, NONE, NONE), -+ BCM6358_GPIO_PIN(12, "gpio12", LEGACY_LED, ASYNC_MODEM, UTOPIA), -+ BCM6358_GPIO_PIN(13, "gpio13", LEGACY_LED, ASYNC_MODEM, UTOPIA), -+ BCM6358_GPIO_PIN(14, "gpio14", LEGACY_LED, ASYNC_MODEM, UTOPIA), -+ BCM6358_GPIO_PIN(15, "gpio15", LEGACY_LED, ASYNC_MODEM, UTOPIA), -+ PINCTRL_PIN(16, "gpio16"), -+ PINCTRL_PIN(17, "gpio17"), -+ PINCTRL_PIN(18, "gpio18"), -+ PINCTRL_PIN(19, "gpio19"), -+ PINCTRL_PIN(20, "gpio20"), -+ PINCTRL_PIN(21, "gpio21"), -+ BCM6358_GPIO_PIN(22, "gpio22", UTOPIA, NONE, NONE), -+ BCM6358_GPIO_PIN(23, "gpio23", UTOPIA, NONE, NONE), -+ BCM6358_GPIO_PIN(24, "gpio24", UTOPIA, NONE, NONE), -+ BCM6358_GPIO_PIN(25, "gpio25", UTOPIA, NONE, NONE), -+ BCM6358_GPIO_PIN(26, "gpio26", UTOPIA, NONE, NONE), -+ BCM6358_GPIO_PIN(27, "gpio27", UTOPIA, NONE, NONE), -+ BCM6358_GPIO_PIN(28, "gpio28", UTOPIA, UART1, NONE), -+ BCM6358_GPIO_PIN(29, "gpio29", UTOPIA, UART1, NONE), -+ BCM6358_GPIO_PIN(30, "gpio30", UTOPIA, UART1, EBI_CS), -+ BCM6358_GPIO_PIN(31, "gpio31", UTOPIA, UART1, EBI_CS), -+ BCM6358_GPIO_PIN(32, "gpio32", SPI_CS, NONE, NONE), -+ BCM6358_GPIO_PIN(33, "gpio33", SPI_CS, NONE, NONE), -+ PINCTRL_PIN(34, "gpio34"), -+ PINCTRL_PIN(35, "gpio35"), -+ PINCTRL_PIN(36, "gpio36"), -+ PINCTRL_PIN(37, "gpio37"), -+ PINCTRL_PIN(38, "gpio38"), -+ PINCTRL_PIN(39, "gpio39"), -+}; -+ -+static unsigned ebi_cs_grp_pins[] = { 30, 31 }; -+ -+static unsigned uart1_grp_pins[] = { 28, 29, 30, 31 }; -+ -+static unsigned spi_cs_grp_pins[] = { 32, 33 }; -+ -+static unsigned async_modem_grp_pins[] = { 12, 13, 14, 15 }; -+ -+static unsigned serial_led_grp_pins[] = { 6, 7 }; -+ -+static unsigned legacy_led_grp_pins[] = { 9, 10, 11, 12, 13, 14, 15 }; -+ -+static unsigned led_grp_pins[] = { 0, 1, 2, 3 }; -+ -+static unsigned utopia_grp_pins[] = { -+ 12, 13, 14, 15, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, -+}; -+ -+static unsigned pwm_syn_clk_grp_pins[] = { 8 }; -+ -+static unsigned sys_irq_grp_pins[] = { 5 }; -+ -+#define BCM6358_GPIO_MUX_GROUP(n, bit, dir) \ -+ { \ -+ .name = #n, \ -+ .pins = n##_pins, \ -+ .num_pins = ARRAY_SIZE(n##_pins), \ -+ .mode_val = BCM6358_MODE_MUX_##bit, \ -+ .direction = dir, \ -+ } -+ -+static const struct bcm6358_pingroup bcm6358_groups[] = { -+ BCM6358_GPIO_MUX_GROUP(ebi_cs_grp, EBI_CS, 0x3), -+ BCM6358_GPIO_MUX_GROUP(uart1_grp, UART1, 0x2), -+ BCM6358_GPIO_MUX_GROUP(spi_cs_grp, SPI_CS, 0x6), -+ BCM6358_GPIO_MUX_GROUP(async_modem_grp, ASYNC_MODEM, 0x6), -+ BCM6358_GPIO_MUX_GROUP(legacy_led_grp, LEGACY_LED, 0x7f), -+ BCM6358_GPIO_MUX_GROUP(serial_led_grp, SERIAL_LED, 0x3), -+ BCM6358_GPIO_MUX_GROUP(led_grp, LED, 0xf), -+ BCM6358_GPIO_MUX_GROUP(utopia_grp, UTOPIA, 0x000f), -+ BCM6358_GPIO_MUX_GROUP(pwm_syn_clk_grp, PWM_SYN_CLK, 0x1), -+ BCM6358_GPIO_MUX_GROUP(sys_irq_grp, SYS_IRQ, 0x1), -+}; -+ -+static const char * const ebi_cs_groups[] = { -+ "ebi_cs_grp" -+}; -+ -+static const char * const uart1_groups[] = { -+ "uart1_grp" -+}; -+ -+static const char * const spi_cs_2_3_groups[] = { -+ "spi_cs_2_3_grp" -+}; -+ -+static const char * const async_modem_groups[] = { -+ "async_modem_grp" -+}; -+ -+static const char * const legacy_led_groups[] = { -+ "legacy_led_grp", -+}; -+ -+static const char * const serial_led_groups[] = { -+ "serial_led_grp", -+}; -+ -+static const char * const led_groups[] = { -+ "led_grp", -+}; -+ -+static const char * const clkrst_groups[] = { -+ "clkrst_grp", -+}; -+ -+static const char * const pwm_syn_clk_groups[] = { -+ "pwm_syn_clk_grp", -+}; -+ -+static const char * const sys_irq_groups[] = { -+ "sys_irq_grp", -+}; -+ -+#define BCM6358_FUN(n) \ -+ { \ -+ .name = #n, \ -+ .groups = n##_groups, \ -+ .num_groups = ARRAY_SIZE(n##_groups), \ -+ } -+ -+static const struct bcm6358_function bcm6358_funcs[] = { -+ BCM6358_FUN(ebi_cs), -+ BCM6358_FUN(uart1), -+ BCM6358_FUN(spi_cs_2_3), -+ BCM6358_FUN(async_modem), -+ BCM6358_FUN(legacy_led), -+ BCM6358_FUN(serial_led), -+ BCM6358_FUN(led), -+ BCM6358_FUN(clkrst), -+ BCM6358_FUN(pwm_syn_clk), -+ BCM6358_FUN(sys_irq), -+}; -+ -+static int bcm6358_pinctrl_get_group_count(struct pinctrl_dev *pctldev) -+{ -+ return ARRAY_SIZE(bcm6358_groups); -+} -+ -+static const char *bcm6358_pinctrl_get_group_name(struct pinctrl_dev *pctldev, -+ unsigned group) -+{ -+ return bcm6358_groups[group].name; -+} -+ -+static int bcm6358_pinctrl_get_group_pins(struct pinctrl_dev *pctldev, -+ unsigned group, const unsigned **pins, -+ unsigned *num_pins) -+{ -+ *pins = bcm6358_groups[group].pins; -+ *num_pins = bcm6358_groups[group].num_pins; -+ -+ return 0; -+} -+ -+static int bcm6358_pinctrl_get_func_count(struct pinctrl_dev *pctldev) -+{ -+ return ARRAY_SIZE(bcm6358_funcs); -+} -+ -+static const char *bcm6358_pinctrl_get_func_name(struct pinctrl_dev *pctldev, -+ unsigned selector) -+{ -+ return bcm6358_funcs[selector].name; -+} -+ -+static int bcm6358_pinctrl_get_groups(struct pinctrl_dev *pctldev, -+ unsigned selector, -+ const char * const **groups, -+ unsigned * const num_groups) -+{ -+ *groups = bcm6358_funcs[selector].groups; -+ *num_groups = bcm6358_funcs[selector].num_groups; -+ -+ return 0; -+} -+ -+static int bcm6358_pinctrl_set_mux(struct pinctrl_dev *pctldev, -+ unsigned selector, unsigned group) -+{ -+ struct bcm6358_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); -+ const struct bcm6358_pingroup *grp = &bcm6358_groups[group]; -+ u32 val = grp->mode_val; -+ u32 mask = val; -+ unsigned pin; -+ -+ for (pin = 0; pin < grp->num_pins; pin++) -+ mask |= (unsigned long)bcm6358_pins[pin].drv_data; -+ -+ regmap_field_update_bits(pctl->overlays, mask, val); -+ -+ for (pin = 0; pin < grp->num_pins; pin++) { -+ int hw_gpio = bcm6358_pins[pin].number; -+ struct gpio_chip *gc = &pctl->gpio[hw_gpio / 32]; -+ -+ if (grp->direction & BIT(pin)) -+ gc->direction_output(gc, hw_gpio % 32, 0); -+ else -+ gc->direction_input(gc, hw_gpio % 32); -+ } -+ -+ return 0; -+} -+ -+static int bcm6358_gpio_request_enable(struct pinctrl_dev *pctldev, -+ struct pinctrl_gpio_range *range, -+ unsigned offset) -+{ -+ struct bcm6358_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); -+ u32 mask; -+ -+ mask = (unsigned long)bcm6358_pins[offset].drv_data; -+ if (!mask) -+ return 0; -+ -+ /* disable all functions using this pin */ -+ return regmap_field_update_bits(pctl->overlays, mask, 0); -+} -+ -+static struct pinctrl_ops bcm6358_pctl_ops = { -+ .get_groups_count = bcm6358_pinctrl_get_group_count, -+ .get_group_name = bcm6358_pinctrl_get_group_name, -+ .get_group_pins = bcm6358_pinctrl_get_group_pins, -+#ifdef CONFIG_OF -+ .dt_node_to_map = pinconf_generic_dt_node_to_map_pin, -+ .dt_free_map = pinctrl_utils_free_map, -+#endif -+}; -+ -+static struct pinmux_ops bcm6358_pmx_ops = { -+ .get_functions_count = bcm6358_pinctrl_get_func_count, -+ .get_function_name = bcm6358_pinctrl_get_func_name, -+ .get_function_groups = bcm6358_pinctrl_get_groups, -+ .set_mux = bcm6358_pinctrl_set_mux, -+ .gpio_request_enable = bcm6358_gpio_request_enable, -+ .strict = true, -+}; -+ -+static int bcm6358_pinctrl_probe(struct platform_device *pdev) -+{ -+ struct bcm6358_pinctrl *pctl; -+ struct regmap *mode; -+ struct reg_field overlays = REG_FIELD(0, 0, 15); -+ -+ if (pdev->dev.of_node) -+ mode = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, -+ "brcm,gpiomode"); -+ else -+ mode = syscon_regmap_lookup_by_pdevname("syscon.fffe0098"); -+ -+ if (IS_ERR(mode)) -+ return PTR_ERR(mode); -+ -+ pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL); -+ if (!pctl) -+ return -ENOMEM; -+ -+ pctl->overlays = devm_regmap_field_alloc(&pdev->dev, mode, overlays); -+ if (IS_ERR(pctl->overlays)) -+ return PTR_ERR(pctl->overlays); -+ -+ /* disable all muxes by default */ -+ regmap_field_write(pctl->overlays, 0); -+ -+ pctl->desc.name = dev_name(&pdev->dev); -+ pctl->desc.owner = THIS_MODULE; -+ pctl->desc.pctlops = &bcm6358_pctl_ops; -+ pctl->desc.pmxops = &bcm6358_pmx_ops; -+ -+ pctl->desc.npins = ARRAY_SIZE(bcm6358_pins); -+ pctl->desc.pins = bcm6358_pins; -+ -+ platform_set_drvdata(pdev, pctl); -+ -+ pctl->pctldev = bcm63xx_pinctrl_register(pdev, &pctl->desc, pctl, -+ pctl->gpio, BCM6358_NGPIO); -+ if (IS_ERR(pctl->pctldev)) -+ return PTR_ERR(pctl->pctldev); -+ -+ return 0; -+} -+ -+static const struct of_device_id bcm6358_pinctrl_match[] = { -+ { .compatible = "brcm,bcm6358-pinctrl", }, -+ { }, -+}; -+ -+static struct platform_driver bcm6358_pinctrl_driver = { -+ .probe = bcm6358_pinctrl_probe, -+ .driver = { -+ .name = "bcm6358-pinctrl", -+ .of_match_table = bcm6358_pinctrl_match, -+ }, -+}; -+ -+builtin_platform_driver(bcm6358_pinctrl_driver); diff --git a/target/linux/bcm63xx/patches-5.15/137-Documentation-add-BCM6362-pincontroller-binding-docu.patch b/target/linux/bcm63xx/patches-5.15/137-Documentation-add-BCM6362-pincontroller-binding-docu.patch deleted file mode 100644 index 9fc424cb4c9d73..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/137-Documentation-add-BCM6362-pincontroller-binding-docu.patch +++ /dev/null @@ -1,96 +0,0 @@ -From ba03ea8ada2ca71c9095d96a1e4085c2c5cf0e69 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Wed, 27 Jul 2016 11:36:18 +0200 -Subject: [PATCH 08/16] Documentation: add BCM6362 pincontroller binding - documentation - -Add binding documentation for the pincontrol core found in BCM6362 SoCs. - -Signed-off-by: Jonas Gorski ---- - .../bindings/pinctrl/brcm,bcm6362-pinctrl.txt | 79 ++++++++++++++++++++++ - 1 file changed, 79 insertions(+) - create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6362-pinctrl.txt - ---- /dev/null -+++ b/Documentation/devicetree/bindings/pinctrl/brcm,bcm6362-pinctrl.txt -@@ -0,0 +1,79 @@ -+* Broadcom BCM6362 pin controller -+ -+Required properties: -+- compatible: Must be "brcm,bcm6362-pinctrl" -+- reg: Register specifiers of dirout, dat, led, mode, ctrl, basemode registers. -+- reg-names: Must be "dirout", "dat", "led", "mode", "ctrl", "basemode". -+- gpio-controller: Identifies this node as a GPIO controller. -+- #gpio-cells: Must be <2>. -+ -+Example: -+ -+pinctrl: pin-controller@10000080 { -+ compatible = "brcm,bcm6362-pinctrl"; -+ reg = <0x10000080 0x8>, -+ <0x10000088 0x8>, -+ <0x10000090 0x4>, -+ <0x10000098 0x4>, -+ <0x1000009c 0x4>, -+ <0x100000b8 0x4>; -+ reg-names = "dirout", "dat", "led", -+ "mode", "ctrl", "basemode"; -+ -+ gpio-controller; -+ #gpio-cells = <2>; -+}; -+ -+Available pins/groups and functions: -+ -+name pins functions -+----------------------------------------------------------- -+gpio0 0 led, usb_device_led -+gpio1 1 led, sys_irq -+gpio2 2 led, serial_led_clk -+gpio3 3 led, serial_led_data -+gpio4 4 led, robosw_led_data -+gpio5 5 led, robosw_led_clk -+gpio6 6 led, robosw_led0 -+gpio7 7 led, robosw_led1 -+gpio8 8 led, inet_led -+gpio9 9 led, spi_cs2 -+gpio10 10 led, spi_cs3 -+gpio11 11 led, ntr_pulse -+gpio12 12 led, uart1_scts -+gpio13 13 led, uart1_srts -+gpio14 14 led, uart1_sdin -+gpio15 15 led, uart1_sdout -+gpio16 16 led, adsl_spi_miso -+gpio17 17 led, adsl_spi_mosi -+gpio18 18 led, adsl_spi_clk -+gpio19 19 led, adsl_spi_cs -+gpio20 20 led, ephy0_led -+gpio21 21 led, ephy1_led -+gpio22 22 led, ephy2_led -+gpio23 23 led, ephy3_led -+gpio24 24 ext_irq0 -+gpio25 25 ext_irq1 -+gpio26 26 ext_irq2 -+gpio27 27 ext_irq3 -+gpio28 28 - -+gpio29 29 - -+gpio30 30 - -+gpio31 31 - -+gpio32 32 wifi -+gpio33 33 wifi -+gpio34 34 wifi -+gpio35 35 wifi -+gpio36 36 wifi -+gpio37 37 wifi -+gpio38 38 wifi -+gpio39 39 wifi -+gpio40 40 wifi -+gpio41 41 wifi -+gpio42 42 wifi -+gpio43 43 wifi -+gpio44 44 wifi -+gpio45 45 wifi -+gpio46 46 wifi -+gpio47 47 wifi -+nand_grp 8, 12-23, 27 nand diff --git a/target/linux/bcm63xx/patches-5.15/138-pinctrl-add-a-pincontrol-driver-for-BCM6362.patch b/target/linux/bcm63xx/patches-5.15/138-pinctrl-add-a-pincontrol-driver-for-BCM6362.patch deleted file mode 100644 index 287119c7e0954a..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/138-pinctrl-add-a-pincontrol-driver-for-BCM6362.patch +++ /dev/null @@ -1,733 +0,0 @@ -From eea6b96701d734095e2f823f3a82d9b063f553ae Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Fri, 24 Jun 2016 22:17:20 +0200 -Subject: [PATCH 09/16] pinctrl: add a pincontrol driver for BCM6362 - -Add a pincotrol driver for BCM6362. BCM6362 allows muxing individual -GPIO pins to the LED controller, to be available by the integrated -wifi, or other functions. It also supports overlay groups, of which -only NAND is documented. - -Signed-off-by: Jonas Gorski ---- - drivers/pinctrl/bcm63xx/Kconfig | 7 + - drivers/pinctrl/bcm63xx/Makefile | 1 + - drivers/pinctrl/bcm63xx/pinctrl-bcm6362.c | 692 ++++++++++++++++++++++++++++++ - 3 files changed, 700 insertions(+) - create mode 100644 drivers/pinctrl/bcm63xx/pinctrl-bcm6362.c - ---- a/drivers/pinctrl/bcm63xx/Kconfig -+++ b/drivers/pinctrl/bcm63xx/Kconfig -@@ -23,3 +23,10 @@ config PINCTRL_BRCM6358 - select PINCTRL_BRCM63XX - select GENERIC_PINCONF - select MFD_SYSCON -+ -+config PINCTRL_BRCM6362 -+ bool "BCM6362 pincontrol driver" if COMPILE_TEST -+ select PINMUX -+ select PINCONF -+ select PINCTRL_BRCM63XX -+ select GENERIC_PINCONF ---- a/drivers/pinctrl/bcm63xx/Makefile -+++ b/drivers/pinctrl/bcm63xx/Makefile -@@ -2,3 +2,4 @@ obj-$(CONFIG_PINCTRL_BRCM63XX) += pinctr - obj-$(CONFIG_PINCTRL_BRCM6328) += pinctrl-bcm6328.o - obj-$(CONFIG_PINCTRL_BRCM6348) += pinctrl-bcm6348.o - obj-$(CONFIG_PINCTRL_BRCM6358) += pinctrl-bcm6358.o -+obj-$(CONFIG_PINCTRL_BRCM6362) += pinctrl-bcm6362.o ---- /dev/null -+++ b/drivers/pinctrl/bcm63xx/pinctrl-bcm6362.c -@@ -0,0 +1,692 @@ -+/* -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file "COPYING" in the main directory of this archive -+ * for more details. -+ * -+ * Copyright (C) 2016 Jonas Gorski -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include "../core.h" -+#include "../pinctrl-utils.h" -+ -+#include "pinctrl-bcm63xx.h" -+ -+#define BCM6362_NGPIO 48 -+ -+/* GPIO_BASEMODE register */ -+#define BASEMODE_NAND BIT(2) -+ -+enum bcm6362_pinctrl_reg { -+ BCM6362_LEDCTRL, -+ BCM6362_MODE, -+ BCM6362_CTRL, -+ BCM6362_BASEMODE, -+}; -+ -+struct bcm6362_pingroup { -+ const char *name; -+ const unsigned * const pins; -+ const unsigned num_pins; -+}; -+ -+struct bcm6362_function { -+ const char *name; -+ const char * const *groups; -+ const unsigned num_groups; -+ -+ enum bcm6362_pinctrl_reg reg; -+ u32 basemode_mask; -+}; -+ -+struct bcm6362_pinctrl { -+ struct pinctrl_dev *pctldev; -+ struct pinctrl_desc desc; -+ -+ void __iomem *led; -+ void __iomem *mode; -+ void __iomem *ctrl; -+ void __iomem *basemode; -+ -+ /* register access lock */ -+ spinlock_t lock; -+ -+ struct gpio_chip gpio[2]; -+}; -+ -+#define BCM6362_PIN(a, b, mask) \ -+ { \ -+ .number = a, \ -+ .name = b, \ -+ .drv_data = (void *)(mask), \ -+ } -+ -+static const struct pinctrl_pin_desc bcm6362_pins[] = { -+ PINCTRL_PIN(0, "gpio0"), -+ PINCTRL_PIN(1, "gpio1"), -+ PINCTRL_PIN(2, "gpio2"), -+ PINCTRL_PIN(3, "gpio3"), -+ PINCTRL_PIN(4, "gpio4"), -+ PINCTRL_PIN(5, "gpio5"), -+ PINCTRL_PIN(6, "gpio6"), -+ PINCTRL_PIN(7, "gpio7"), -+ BCM6362_PIN(8, "gpio8", BASEMODE_NAND), -+ PINCTRL_PIN(9, "gpio9"), -+ PINCTRL_PIN(10, "gpio10"), -+ PINCTRL_PIN(11, "gpio11"), -+ BCM6362_PIN(12, "gpio12", BASEMODE_NAND), -+ BCM6362_PIN(13, "gpio13", BASEMODE_NAND), -+ BCM6362_PIN(14, "gpio14", BASEMODE_NAND), -+ BCM6362_PIN(15, "gpio15", BASEMODE_NAND), -+ BCM6362_PIN(16, "gpio16", BASEMODE_NAND), -+ BCM6362_PIN(17, "gpio17", BASEMODE_NAND), -+ BCM6362_PIN(18, "gpio18", BASEMODE_NAND), -+ BCM6362_PIN(19, "gpio19", BASEMODE_NAND), -+ BCM6362_PIN(20, "gpio20", BASEMODE_NAND), -+ BCM6362_PIN(21, "gpio21", BASEMODE_NAND), -+ BCM6362_PIN(22, "gpio22", BASEMODE_NAND), -+ BCM6362_PIN(23, "gpio23", BASEMODE_NAND), -+ PINCTRL_PIN(24, "gpio24"), -+ PINCTRL_PIN(25, "gpio25"), -+ PINCTRL_PIN(26, "gpio26"), -+ BCM6362_PIN(27, "gpio27", BASEMODE_NAND), -+ PINCTRL_PIN(28, "gpio28"), -+ PINCTRL_PIN(29, "gpio29"), -+ PINCTRL_PIN(30, "gpio30"), -+ PINCTRL_PIN(31, "gpio31"), -+ PINCTRL_PIN(32, "gpio32"), -+ PINCTRL_PIN(33, "gpio33"), -+ PINCTRL_PIN(34, "gpio34"), -+ PINCTRL_PIN(35, "gpio35"), -+ PINCTRL_PIN(36, "gpio36"), -+ PINCTRL_PIN(37, "gpio37"), -+ PINCTRL_PIN(38, "gpio38"), -+ PINCTRL_PIN(39, "gpio39"), -+ PINCTRL_PIN(40, "gpio40"), -+ PINCTRL_PIN(41, "gpio41"), -+ PINCTRL_PIN(42, "gpio42"), -+ PINCTRL_PIN(43, "gpio43"), -+ PINCTRL_PIN(44, "gpio44"), -+ PINCTRL_PIN(45, "gpio45"), -+ PINCTRL_PIN(46, "gpio46"), -+ PINCTRL_PIN(47, "gpio47"), -+}; -+ -+static unsigned gpio0_pins[] = { 0 }; -+static unsigned gpio1_pins[] = { 1 }; -+static unsigned gpio2_pins[] = { 2 }; -+static unsigned gpio3_pins[] = { 3 }; -+static unsigned gpio4_pins[] = { 4 }; -+static unsigned gpio5_pins[] = { 5 }; -+static unsigned gpio6_pins[] = { 6 }; -+static unsigned gpio7_pins[] = { 7 }; -+static unsigned gpio8_pins[] = { 8 }; -+static unsigned gpio9_pins[] = { 9 }; -+static unsigned gpio10_pins[] = { 10 }; -+static unsigned gpio11_pins[] = { 11 }; -+static unsigned gpio12_pins[] = { 12 }; -+static unsigned gpio13_pins[] = { 13 }; -+static unsigned gpio14_pins[] = { 14 }; -+static unsigned gpio15_pins[] = { 15 }; -+static unsigned gpio16_pins[] = { 16 }; -+static unsigned gpio17_pins[] = { 17 }; -+static unsigned gpio18_pins[] = { 18 }; -+static unsigned gpio19_pins[] = { 19 }; -+static unsigned gpio20_pins[] = { 20 }; -+static unsigned gpio21_pins[] = { 21 }; -+static unsigned gpio22_pins[] = { 22 }; -+static unsigned gpio23_pins[] = { 23 }; -+static unsigned gpio24_pins[] = { 24 }; -+static unsigned gpio25_pins[] = { 25 }; -+static unsigned gpio26_pins[] = { 26 }; -+static unsigned gpio27_pins[] = { 27 }; -+static unsigned gpio28_pins[] = { 28 }; -+static unsigned gpio29_pins[] = { 29 }; -+static unsigned gpio30_pins[] = { 30 }; -+static unsigned gpio31_pins[] = { 31 }; -+static unsigned gpio32_pins[] = { 32 }; -+static unsigned gpio33_pins[] = { 33 }; -+static unsigned gpio34_pins[] = { 34 }; -+static unsigned gpio35_pins[] = { 35 }; -+static unsigned gpio36_pins[] = { 36 }; -+static unsigned gpio37_pins[] = { 37 }; -+static unsigned gpio38_pins[] = { 38 }; -+static unsigned gpio39_pins[] = { 39 }; -+static unsigned gpio40_pins[] = { 40 }; -+static unsigned gpio41_pins[] = { 41 }; -+static unsigned gpio42_pins[] = { 42 }; -+static unsigned gpio43_pins[] = { 43 }; -+static unsigned gpio44_pins[] = { 44 }; -+static unsigned gpio45_pins[] = { 45 }; -+static unsigned gpio46_pins[] = { 46 }; -+static unsigned gpio47_pins[] = { 47 }; -+ -+static unsigned nand_grp_pins[] = { -+ 8, 12, 13, 14, 15, 16, 17, -+ 18, 19, 20, 21, 22, 23, 27, -+}; -+ -+#define BCM6362_GROUP(n) \ -+ { \ -+ .name = #n, \ -+ .pins = n##_pins, \ -+ .num_pins = ARRAY_SIZE(n##_pins), \ -+ } -+ -+static struct bcm6362_pingroup bcm6362_groups[] = { -+ BCM6362_GROUP(gpio0), -+ BCM6362_GROUP(gpio1), -+ BCM6362_GROUP(gpio2), -+ BCM6362_GROUP(gpio3), -+ BCM6362_GROUP(gpio4), -+ BCM6362_GROUP(gpio5), -+ BCM6362_GROUP(gpio6), -+ BCM6362_GROUP(gpio7), -+ BCM6362_GROUP(gpio8), -+ BCM6362_GROUP(gpio9), -+ BCM6362_GROUP(gpio10), -+ BCM6362_GROUP(gpio11), -+ BCM6362_GROUP(gpio12), -+ BCM6362_GROUP(gpio13), -+ BCM6362_GROUP(gpio14), -+ BCM6362_GROUP(gpio15), -+ BCM6362_GROUP(gpio16), -+ BCM6362_GROUP(gpio17), -+ BCM6362_GROUP(gpio18), -+ BCM6362_GROUP(gpio19), -+ BCM6362_GROUP(gpio20), -+ BCM6362_GROUP(gpio21), -+ BCM6362_GROUP(gpio22), -+ BCM6362_GROUP(gpio23), -+ BCM6362_GROUP(gpio24), -+ BCM6362_GROUP(gpio25), -+ BCM6362_GROUP(gpio26), -+ BCM6362_GROUP(gpio27), -+ BCM6362_GROUP(gpio28), -+ BCM6362_GROUP(gpio29), -+ BCM6362_GROUP(gpio30), -+ BCM6362_GROUP(gpio31), -+ BCM6362_GROUP(gpio32), -+ BCM6362_GROUP(gpio33), -+ BCM6362_GROUP(gpio34), -+ BCM6362_GROUP(gpio35), -+ BCM6362_GROUP(gpio36), -+ BCM6362_GROUP(gpio37), -+ BCM6362_GROUP(gpio38), -+ BCM6362_GROUP(gpio39), -+ BCM6362_GROUP(gpio40), -+ BCM6362_GROUP(gpio41), -+ BCM6362_GROUP(gpio42), -+ BCM6362_GROUP(gpio43), -+ BCM6362_GROUP(gpio44), -+ BCM6362_GROUP(gpio45), -+ BCM6362_GROUP(gpio46), -+ BCM6362_GROUP(gpio47), -+ BCM6362_GROUP(nand_grp), -+}; -+ -+static const char * const led_groups[] = { -+ "gpio0", -+ "gpio1", -+ "gpio2", -+ "gpio3", -+ "gpio4", -+ "gpio5", -+ "gpio6", -+ "gpio7", -+ "gpio8", -+ "gpio9", -+ "gpio10", -+ "gpio11", -+ "gpio12", -+ "gpio13", -+ "gpio14", -+ "gpio15", -+ "gpio16", -+ "gpio17", -+ "gpio18", -+ "gpio19", -+ "gpio20", -+ "gpio21", -+ "gpio22", -+ "gpio23", -+}; -+ -+static const char * const usb_device_led_groups[] = { -+ "gpio0", -+}; -+ -+static const char * const sys_irq_groups[] = { -+ "gpio1", -+}; -+ -+static const char * const serial_led_clk_groups[] = { -+ "gpio2", -+}; -+ -+static const char * const serial_led_data_groups[] = { -+ "gpio3", -+}; -+ -+static const char * const robosw_led_data_groups[] = { -+ "gpio4", -+}; -+ -+static const char * const robosw_led_clk_groups[] = { -+ "gpio5", -+}; -+ -+static const char * const robosw_led0_groups[] = { -+ "gpio6", -+}; -+ -+static const char * const robosw_led1_groups[] = { -+ "gpio7", -+}; -+ -+static const char * const inet_led_groups[] = { -+ "gpio8", -+}; -+ -+static const char * const spi_cs2_groups[] = { -+ "gpio9", -+}; -+ -+static const char * const spi_cs3_groups[] = { -+ "gpio10", -+}; -+ -+static const char * const ntr_pulse_groups[] = { -+ "gpio11", -+}; -+ -+static const char * const uart1_scts_groups[] = { -+ "gpio12", -+}; -+ -+static const char * const uart1_srts_groups[] = { -+ "gpio13", -+}; -+ -+static const char * const uart1_sdin_groups[] = { -+ "gpio14", -+}; -+ -+static const char * const uart1_sdout_groups[] = { -+ "gpio15", -+}; -+ -+static const char * const adsl_spi_miso_groups[] = { -+ "gpio16", -+}; -+ -+static const char * const adsl_spi_mosi_groups[] = { -+ "gpio17", -+}; -+ -+static const char * const adsl_spi_clk_groups[] = { -+ "gpio18", -+}; -+ -+static const char * const adsl_spi_cs_groups[] = { -+ "gpio19", -+}; -+ -+static const char * const ephy0_led_groups[] = { -+ "gpio20", -+}; -+ -+static const char * const ephy1_led_groups[] = { -+ "gpio21", -+}; -+ -+static const char * const ephy2_led_groups[] = { -+ "gpio22", -+}; -+ -+static const char * const ephy3_led_groups[] = { -+ "gpio23", -+}; -+ -+static const char * const ext_irq0_groups[] = { -+ "gpio24", -+}; -+ -+static const char * const ext_irq1_groups[] = { -+ "gpio25", -+}; -+ -+static const char * const ext_irq2_groups[] = { -+ "gpio26", -+}; -+ -+static const char * const ext_irq3_groups[] = { -+ "gpio27", -+}; -+ -+static const char * const wifi_groups[] = { -+ "gpio32", -+ "gpio33", -+ "gpio34", -+ "gpio35", -+ "gpio36", -+ "gpio37", -+ "gpio38", -+ "gpio39", -+ "gpio40", -+ "gpio41", -+ "gpio42", -+ "gpio43", -+ "gpio44", -+ "gpio45", -+ "gpio46", -+ "gpio47", -+}; -+ -+static const char * const nand_groups[] = { -+ "nand_grp", -+}; -+ -+#define BCM6362_LED_FUN(n) \ -+ { \ -+ .name = #n, \ -+ .groups = n##_groups, \ -+ .num_groups = ARRAY_SIZE(n##_groups), \ -+ .reg = BCM6362_LEDCTRL, \ -+ } -+ -+#define BCM6362_MODE_FUN(n) \ -+ { \ -+ .name = #n, \ -+ .groups = n##_groups, \ -+ .num_groups = ARRAY_SIZE(n##_groups), \ -+ .reg = BCM6362_MODE, \ -+ } -+ -+#define BCM6362_CTRL_FUN(n) \ -+ { \ -+ .name = #n, \ -+ .groups = n##_groups, \ -+ .num_groups = ARRAY_SIZE(n##_groups), \ -+ .reg = BCM6362_CTRL, \ -+ } -+ -+#define BCM6362_BASEMODE_FUN(n, mask) \ -+ { \ -+ .name = #n, \ -+ .groups = n##_groups, \ -+ .num_groups = ARRAY_SIZE(n##_groups), \ -+ .reg = BCM6362_BASEMODE, \ -+ .basemode_mask = (mask), \ -+ } -+ -+static const struct bcm6362_function bcm6362_funcs[] = { -+ BCM6362_LED_FUN(led), -+ BCM6362_MODE_FUN(usb_device_led), -+ BCM6362_MODE_FUN(sys_irq), -+ BCM6362_MODE_FUN(serial_led_clk), -+ BCM6362_MODE_FUN(serial_led_data), -+ BCM6362_MODE_FUN(robosw_led_data), -+ BCM6362_MODE_FUN(robosw_led_clk), -+ BCM6362_MODE_FUN(robosw_led0), -+ BCM6362_MODE_FUN(robosw_led1), -+ BCM6362_MODE_FUN(inet_led), -+ BCM6362_MODE_FUN(spi_cs2), -+ BCM6362_MODE_FUN(spi_cs3), -+ BCM6362_MODE_FUN(ntr_pulse), -+ BCM6362_MODE_FUN(uart1_scts), -+ BCM6362_MODE_FUN(uart1_srts), -+ BCM6362_MODE_FUN(uart1_sdin), -+ BCM6362_MODE_FUN(uart1_sdout), -+ BCM6362_MODE_FUN(adsl_spi_miso), -+ BCM6362_MODE_FUN(adsl_spi_mosi), -+ BCM6362_MODE_FUN(adsl_spi_clk), -+ BCM6362_MODE_FUN(adsl_spi_cs), -+ BCM6362_MODE_FUN(ephy0_led), -+ BCM6362_MODE_FUN(ephy1_led), -+ BCM6362_MODE_FUN(ephy2_led), -+ BCM6362_MODE_FUN(ephy3_led), -+ BCM6362_MODE_FUN(ext_irq0), -+ BCM6362_MODE_FUN(ext_irq1), -+ BCM6362_MODE_FUN(ext_irq2), -+ BCM6362_MODE_FUN(ext_irq3), -+ BCM6362_CTRL_FUN(wifi), -+ BCM6362_BASEMODE_FUN(nand, BASEMODE_NAND), -+}; -+ -+static int bcm6362_pinctrl_get_group_count(struct pinctrl_dev *pctldev) -+{ -+ return ARRAY_SIZE(bcm6362_groups); -+} -+ -+static const char *bcm6362_pinctrl_get_group_name(struct pinctrl_dev *pctldev, -+ unsigned group) -+{ -+ return bcm6362_groups[group].name; -+} -+ -+static int bcm6362_pinctrl_get_group_pins(struct pinctrl_dev *pctldev, -+ unsigned group, const unsigned **pins, -+ unsigned *num_pins) -+{ -+ *pins = bcm6362_groups[group].pins; -+ *num_pins = bcm6362_groups[group].num_pins; -+ -+ return 0; -+} -+ -+static int bcm6362_pinctrl_get_func_count(struct pinctrl_dev *pctldev) -+{ -+ return ARRAY_SIZE(bcm6362_funcs); -+} -+ -+static const char *bcm6362_pinctrl_get_func_name(struct pinctrl_dev *pctldev, -+ unsigned selector) -+{ -+ return bcm6362_funcs[selector].name; -+} -+ -+static int bcm6362_pinctrl_get_groups(struct pinctrl_dev *pctldev, -+ unsigned selector, -+ const char * const **groups, -+ unsigned * const num_groups) -+{ -+ *groups = bcm6362_funcs[selector].groups; -+ *num_groups = bcm6362_funcs[selector].num_groups; -+ -+ return 0; -+} -+ -+static void bcm6362_rmw_mux(struct bcm6362_pinctrl *pctl, void __iomem *reg, -+ u32 mask, u32 val) -+{ -+ unsigned long flags; -+ u32 tmp; -+ -+ spin_lock_irqsave(&pctl->lock, flags); -+ tmp = __raw_readl(reg); -+ tmp &= ~mask; -+ tmp |= val & mask; -+ __raw_writel(tmp, reg); -+ -+ spin_unlock_irqrestore(&pctl->lock, flags); -+} -+ -+static void bcm6362_set_gpio(struct bcm6362_pinctrl *pctl, unsigned pin) -+{ -+ const struct pinctrl_pin_desc *desc = &bcm6362_pins[pin]; -+ u32 mask = BIT(pin % 32); -+ -+ if (desc->drv_data) -+ bcm6362_rmw_mux(pctl, pctl->basemode, (u32)desc->drv_data, 0); -+ -+ if (pin < 32) { -+ /* base mode 0 => gpio 1 => mux function */ -+ bcm6362_rmw_mux(pctl, pctl->mode, mask, 0); -+ -+ /* pins 0-23 might be muxed to led */ -+ if (pin < 24) -+ bcm6362_rmw_mux(pctl, pctl->led, mask, 0); -+ } else { -+ /* ctrl reg 0 => wifi function 1 => gpio */ -+ bcm6362_rmw_mux(pctl, pctl->ctrl, mask, mask); -+ } -+} -+ -+static int bcm6362_pinctrl_set_mux(struct pinctrl_dev *pctldev, -+ unsigned selector, unsigned group) -+{ -+ struct bcm6362_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); -+ const struct bcm6362_pingroup *grp = &bcm6362_groups[group]; -+ const struct bcm6362_function *f = &bcm6362_funcs[selector]; -+ unsigned i; -+ void __iomem *reg; -+ u32 val, mask; -+ -+ for (i = 0; i < grp->num_pins; i++) -+ bcm6362_set_gpio(pctl, grp->pins[i]); -+ -+ switch (f->reg) { -+ case BCM6362_LEDCTRL: -+ reg = pctl->led; -+ mask = BIT(grp->pins[0]); -+ val = BIT(grp->pins[0]); -+ break; -+ case BCM6362_MODE: -+ reg = pctl->ctrl; -+ mask = BIT(grp->pins[0]); -+ val = BIT(grp->pins[0]); -+ break; -+ case BCM6362_CTRL: -+ reg = pctl->ctrl; -+ mask = BIT(grp->pins[0]); -+ val = 0; -+ break; -+ case BCM6362_BASEMODE: -+ reg = pctl->basemode; -+ mask = f->basemode_mask; -+ val = f->basemode_mask; -+ break; -+ default: -+ WARN_ON(1); -+ return -EINVAL; -+ } -+ -+ bcm6362_rmw_mux(pctl, reg, mask, val); -+ -+ return 0; -+} -+ -+static int bcm6362_gpio_request_enable(struct pinctrl_dev *pctldev, -+ struct pinctrl_gpio_range *range, -+ unsigned offset) -+{ -+ struct bcm6362_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); -+ -+ /* disable all functions using this pin */ -+ bcm6362_set_gpio(pctl, offset); -+ -+ return 0; -+} -+ -+static struct pinctrl_ops bcm6362_pctl_ops = { -+ .get_groups_count = bcm6362_pinctrl_get_group_count, -+ .get_group_name = bcm6362_pinctrl_get_group_name, -+ .get_group_pins = bcm6362_pinctrl_get_group_pins, -+#ifdef CONFIG_OF -+ .dt_node_to_map = pinconf_generic_dt_node_to_map_pin, -+ .dt_free_map = pinctrl_utils_free_map, -+#endif -+}; -+ -+static struct pinmux_ops bcm6362_pmx_ops = { -+ .get_functions_count = bcm6362_pinctrl_get_func_count, -+ .get_function_name = bcm6362_pinctrl_get_func_name, -+ .get_function_groups = bcm6362_pinctrl_get_groups, -+ .set_mux = bcm6362_pinctrl_set_mux, -+ .gpio_request_enable = bcm6362_gpio_request_enable, -+ .strict = true, -+}; -+ -+static int bcm6362_pinctrl_probe(struct platform_device *pdev) -+{ -+ struct bcm6362_pinctrl *pctl; -+ struct resource *res; -+ void __iomem *led, *mode, *ctrl, *basemode; -+ -+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "led"); -+ led = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(led)) -+ return PTR_ERR(led); -+ -+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mode"); -+ mode = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(mode)) -+ return PTR_ERR(mode); -+ -+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ctrl"); -+ ctrl = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(ctrl)) -+ return PTR_ERR(ctrl); -+ -+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "basemode"); -+ basemode = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(basemode)) -+ return PTR_ERR(basemode); -+ -+ pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL); -+ if (!pctl) -+ return -ENOMEM; -+ -+ spin_lock_init(&pctl->lock); -+ -+ pctl->led = led; -+ pctl->mode = mode; -+ pctl->ctrl = ctrl; -+ pctl->basemode = basemode; -+ -+ pctl->desc.name = dev_name(&pdev->dev); -+ pctl->desc.owner = THIS_MODULE; -+ pctl->desc.pctlops = &bcm6362_pctl_ops; -+ pctl->desc.pmxops = &bcm6362_pmx_ops; -+ -+ pctl->desc.npins = ARRAY_SIZE(bcm6362_pins); -+ pctl->desc.pins = bcm6362_pins; -+ -+ platform_set_drvdata(pdev, pctl); -+ -+ pctl->pctldev = bcm63xx_pinctrl_register(pdev, &pctl->desc, pctl, -+ pctl->gpio, BCM6362_NGPIO); -+ if (IS_ERR(pctl->pctldev)) -+ return PTR_ERR(pctl->pctldev); -+ -+ return 0; -+} -+ -+static const struct of_device_id bcm6362_pinctrl_match[] = { -+ { .compatible = "brcm,bcm6362-pinctrl", }, -+ { }, -+}; -+ -+static struct platform_driver bcm6362_pinctrl_driver = { -+ .probe = bcm6362_pinctrl_probe, -+ .driver = { -+ .name = "bcm6362-pinctrl", -+ .of_match_table = bcm6362_pinctrl_match, -+ }, -+}; -+ -+builtin_platform_driver(bcm6362_pinctrl_driver); diff --git a/target/linux/bcm63xx/patches-5.15/139-Documentation-add-BCM6368-pincontroller-binding-docu.patch b/target/linux/bcm63xx/patches-5.15/139-Documentation-add-BCM6368-pincontroller-binding-docu.patch deleted file mode 100644 index e0a698fc123f44..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/139-Documentation-add-BCM6368-pincontroller-binding-docu.patch +++ /dev/null @@ -1,84 +0,0 @@ -From 30594cf9bfff176a9e4b14c50dcd8b9d0cc3edec Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Wed, 27 Jul 2016 11:36:51 +0200 -Subject: [PATCH 10/16] Documentation: add BCM6368 pincontroller binding - documentation - -Add binding documentation for the pincontrol core found in BCM6368 SoCs. - -Signed-off-by: Jonas Gorski ---- - .../bindings/pinctrl/brcm,bcm6368-pinctrl.txt | 67 ++++++++++++++++++++++ - 1 file changed, 67 insertions(+) - create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6368-pinctrl.txt - ---- /dev/null -+++ b/Documentation/devicetree/bindings/pinctrl/brcm,bcm6368-pinctrl.txt -@@ -0,0 +1,67 @@ -+* Broadcom BCM6368 pin controller -+ -+Required properties: -+- compatible: Must be "brcm,bcm6368-pinctrl". -+- reg: Register specifiers of dirout, dat, mode registers. -+- reg-names: Must be "dirout", "dat", "mode". -+- brcm,gpiobasemode: Phandle to the gpio basemode register. -+- gpio-controller: Identifies this node as a GPIO controller. -+- #gpio-cells: Must be <2>. -+ -+Example: -+ -+pinctrl: pin-controller@10000080 { -+ compatible = "brcm,bcm6368-pinctrl"; -+ reg = <0x10000080 0x08>, -+ <0x10000088 0x08>, -+ <0x10000098 0x04>; -+ reg-names = "dirout", "dat", "mode"; -+ brcm,gpiobasemode = <&gpiobasemode>; -+ -+ gpio-controller; -+ #gpio-cells = <2>; -+}; -+ -+gpiobasemode: syscon@100000b8 { -+ compatible = "brcm,bcm6368-gpiobasemode", "syscon"; -+ reg = <0x100000b8 4>; -+ native-endian; -+}; -+ -+Available pins/groups and functions: -+ -+name pins functions -+----------------------------------------------------------- -+gpio0 0 analog_afe0 -+gpio1 1 analog_afe1 -+gpio2 2 sys_irq -+gpio3 3 serial_led_data -+gpio4 4 serial_led_clk -+gpio5 5 inet_led -+gpio6 6 ephy0_led -+gpio7 7 ephy1_led -+gpio8 8 ephy2_led -+gpio9 9 ephy3_led -+gpio10 10 robosw_led_data -+gpio11 11 robosw_led_clk -+gpio12 12 robosw_led0 -+gpio13 13 robosw_led1 -+gpio14 14 usb_device_led -+gpio15 15 - -+gpio16 16 pci_req1 -+gpio17 17 pci_gnt1 -+gpio18 18 pci_intb -+gpio19 19 pci_req0 -+gpio20 20 pci_gnt0 -+gpio21 21 - -+gpio22 22 pcmcia_cd1 -+gpio23 23 pcmcia_cd2 -+gpio24 24 pcmcia_vs1 -+gpio25 25 pcmcia_vs2 -+gpio26 26 ebi_cs2 -+gpio27 27 ebi_cs3 -+gpio28 28 spi_cs2 -+gpio29 29 spi_cs3 -+gpio30 30 spi_cs4 -+gpio31 31 spi_cs5 -+uart1_grp 30-33 uart1 diff --git a/target/linux/bcm63xx/patches-5.15/140-pinctrl-add-a-pincontrol-driver-for-BCM6368.patch b/target/linux/bcm63xx/patches-5.15/140-pinctrl-add-a-pincontrol-driver-for-BCM6368.patch deleted file mode 100644 index 04e09352e3a7d5..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/140-pinctrl-add-a-pincontrol-driver-for-BCM6368.patch +++ /dev/null @@ -1,620 +0,0 @@ -From 90be3cb4f1a45b8be4a4ec264cd66c2f8e893fcb Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Fri, 24 Jun 2016 22:18:25 +0200 -Subject: [PATCH 11/16] pinctrl: add a pincontrol driver for BCM6368 - -Add a pincontrol driver for BCM6368. BCM6368 allows muxing the first 32 -GPIOs onto alternative functions. Not all are documented. - -Signed-off-by: Jonas Gorski ---- - drivers/pinctrl/bcm63xx/Kconfig | 15 + - drivers/pinctrl/bcm63xx/Makefile | 1 + - drivers/pinctrl/bcm63xx/pinctrl-bcm6368.c | 573 ++++++++++++++++++++++++++++++ - 3 files changed, 589 insertions(+) - create mode 100644 drivers/pinctrl/bcm63xx/pinctrl-bcm6368.c - ---- a/drivers/pinctrl/bcm63xx/Kconfig -+++ b/drivers/pinctrl/bcm63xx/Kconfig -@@ -30,3 +30,18 @@ config PINCTRL_BRCM6362 - select PINCONF - select PINCTRL_BRCM63XX - select GENERIC_PINCONF -+ -+config PINCTRL_BRCM6368 -+ bool "BCM6368 pincontrol driver" if COMPILE_TEST -+ select PINMUX -+ select PINCONF -+ select PINCTRL_BRCM63XX -+ select GENERIC_PINCONF -+ select MFD_SYSCON -+ -+config PINCTRL_BRCM63268 -+ bool "BCM63268 pincontrol driver" if COMPILE_TEST -+ select PINMUX -+ select PINCONF -+ select PINCTRL_BRCM63XX -+ select GENERIC_PINCONF ---- a/drivers/pinctrl/bcm63xx/Makefile -+++ b/drivers/pinctrl/bcm63xx/Makefile -@@ -3,3 +3,4 @@ obj-$(CONFIG_PINCTRL_BRCM6328) += pinctr - obj-$(CONFIG_PINCTRL_BRCM6348) += pinctrl-bcm6348.o - obj-$(CONFIG_PINCTRL_BRCM6358) += pinctrl-bcm6358.o - obj-$(CONFIG_PINCTRL_BRCM6362) += pinctrl-bcm6362.o -+obj-$(CONFIG_PINCTRL_BRCM6368) += pinctrl-bcm6368.o ---- /dev/null -+++ b/drivers/pinctrl/bcm63xx/pinctrl-bcm6368.c -@@ -0,0 +1,573 @@ -+/* -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file "COPYING" in the main directory of this archive -+ * for more details. -+ * -+ * Copyright (C) 2016 Jonas Gorski -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "../core.h" -+#include "../pinctrl-utils.h" -+ -+#include "pinctrl-bcm63xx.h" -+ -+#define BCM6368_NGPIO 38 -+ -+#define BCM6368_BASEMODE_MASK 0x7 -+#define BCM6368_BASEMODE_GPIO 0x0 -+#define BCM6368_BASEMODE_UART1 0x1 -+ -+struct bcm6368_pingroup { -+ const char *name; -+ const unsigned * const pins; -+ const unsigned num_pins; -+}; -+ -+struct bcm6368_function { -+ const char *name; -+ const char * const *groups; -+ const unsigned num_groups; -+ -+ unsigned dir_out:16; -+ unsigned basemode:3; -+}; -+ -+struct bcm6368_pinctrl { -+ struct pinctrl_dev *pctldev; -+ struct pinctrl_desc desc; -+ -+ void __iomem *mode; -+ struct regmap_field *overlay; -+ -+ /* register access lock */ -+ spinlock_t lock; -+ -+ struct gpio_chip gpio[2]; -+}; -+ -+#define BCM6368_BASEMODE_PIN(a, b) \ -+ { \ -+ .number = a, \ -+ .name = b, \ -+ .drv_data = (void *)true \ -+ } -+ -+static const struct pinctrl_pin_desc bcm6368_pins[] = { -+ PINCTRL_PIN(0, "gpio0"), -+ PINCTRL_PIN(1, "gpio1"), -+ PINCTRL_PIN(2, "gpio2"), -+ PINCTRL_PIN(3, "gpio3"), -+ PINCTRL_PIN(4, "gpio4"), -+ PINCTRL_PIN(5, "gpio5"), -+ PINCTRL_PIN(6, "gpio6"), -+ PINCTRL_PIN(7, "gpio7"), -+ PINCTRL_PIN(8, "gpio8"), -+ PINCTRL_PIN(9, "gpio9"), -+ PINCTRL_PIN(10, "gpio10"), -+ PINCTRL_PIN(11, "gpio11"), -+ PINCTRL_PIN(12, "gpio12"), -+ PINCTRL_PIN(13, "gpio13"), -+ PINCTRL_PIN(14, "gpio14"), -+ PINCTRL_PIN(15, "gpio15"), -+ PINCTRL_PIN(16, "gpio16"), -+ PINCTRL_PIN(17, "gpio17"), -+ PINCTRL_PIN(18, "gpio18"), -+ PINCTRL_PIN(19, "gpio19"), -+ PINCTRL_PIN(20, "gpio20"), -+ PINCTRL_PIN(21, "gpio21"), -+ PINCTRL_PIN(22, "gpio22"), -+ PINCTRL_PIN(23, "gpio23"), -+ PINCTRL_PIN(24, "gpio24"), -+ PINCTRL_PIN(25, "gpio25"), -+ PINCTRL_PIN(26, "gpio26"), -+ PINCTRL_PIN(27, "gpio27"), -+ PINCTRL_PIN(28, "gpio28"), -+ PINCTRL_PIN(29, "gpio29"), -+ BCM6368_BASEMODE_PIN(30, "gpio30"), -+ BCM6368_BASEMODE_PIN(31, "gpio31"), -+ BCM6368_BASEMODE_PIN(32, "gpio32"), -+ BCM6368_BASEMODE_PIN(33, "gpio33"), -+ PINCTRL_PIN(34, "gpio34"), -+ PINCTRL_PIN(35, "gpio35"), -+ PINCTRL_PIN(36, "gpio36"), -+ PINCTRL_PIN(37, "gpio37"), -+}; -+ -+static unsigned gpio0_pins[] = { 0 }; -+static unsigned gpio1_pins[] = { 1 }; -+static unsigned gpio2_pins[] = { 2 }; -+static unsigned gpio3_pins[] = { 3 }; -+static unsigned gpio4_pins[] = { 4 }; -+static unsigned gpio5_pins[] = { 5 }; -+static unsigned gpio6_pins[] = { 6 }; -+static unsigned gpio7_pins[] = { 7 }; -+static unsigned gpio8_pins[] = { 8 }; -+static unsigned gpio9_pins[] = { 9 }; -+static unsigned gpio10_pins[] = { 10 }; -+static unsigned gpio11_pins[] = { 11 }; -+static unsigned gpio12_pins[] = { 12 }; -+static unsigned gpio13_pins[] = { 13 }; -+static unsigned gpio14_pins[] = { 14 }; -+static unsigned gpio15_pins[] = { 15 }; -+static unsigned gpio16_pins[] = { 16 }; -+static unsigned gpio17_pins[] = { 17 }; -+static unsigned gpio18_pins[] = { 18 }; -+static unsigned gpio19_pins[] = { 19 }; -+static unsigned gpio20_pins[] = { 20 }; -+static unsigned gpio21_pins[] = { 21 }; -+static unsigned gpio22_pins[] = { 22 }; -+static unsigned gpio23_pins[] = { 23 }; -+static unsigned gpio24_pins[] = { 24 }; -+static unsigned gpio25_pins[] = { 25 }; -+static unsigned gpio26_pins[] = { 26 }; -+static unsigned gpio27_pins[] = { 27 }; -+static unsigned gpio28_pins[] = { 28 }; -+static unsigned gpio29_pins[] = { 29 }; -+static unsigned gpio30_pins[] = { 30 }; -+static unsigned gpio31_pins[] = { 31 }; -+static unsigned uart1_grp_pins[] = { 30, 31, 32, 33 }; -+ -+#define BCM6368_GROUP(n) \ -+ { \ -+ .name = #n, \ -+ .pins = n##_pins, \ -+ .num_pins = ARRAY_SIZE(n##_pins), \ -+ } -+ -+static struct bcm6368_pingroup bcm6368_groups[] = { -+ BCM6368_GROUP(gpio0), -+ BCM6368_GROUP(gpio1), -+ BCM6368_GROUP(gpio2), -+ BCM6368_GROUP(gpio3), -+ BCM6368_GROUP(gpio4), -+ BCM6368_GROUP(gpio5), -+ BCM6368_GROUP(gpio6), -+ BCM6368_GROUP(gpio7), -+ BCM6368_GROUP(gpio8), -+ BCM6368_GROUP(gpio9), -+ BCM6368_GROUP(gpio10), -+ BCM6368_GROUP(gpio11), -+ BCM6368_GROUP(gpio12), -+ BCM6368_GROUP(gpio13), -+ BCM6368_GROUP(gpio14), -+ BCM6368_GROUP(gpio15), -+ BCM6368_GROUP(gpio16), -+ BCM6368_GROUP(gpio17), -+ BCM6368_GROUP(gpio18), -+ BCM6368_GROUP(gpio19), -+ BCM6368_GROUP(gpio20), -+ BCM6368_GROUP(gpio21), -+ BCM6368_GROUP(gpio22), -+ BCM6368_GROUP(gpio23), -+ BCM6368_GROUP(gpio24), -+ BCM6368_GROUP(gpio25), -+ BCM6368_GROUP(gpio26), -+ BCM6368_GROUP(gpio27), -+ BCM6368_GROUP(gpio28), -+ BCM6368_GROUP(gpio29), -+ BCM6368_GROUP(gpio30), -+ BCM6368_GROUP(gpio31), -+ BCM6368_GROUP(uart1_grp), -+}; -+ -+static const char * const analog_afe_0_groups[] = { -+ "gpio0", -+}; -+ -+static const char * const analog_afe_1_groups[] = { -+ "gpio1", -+}; -+ -+static const char * const sys_irq_groups[] = { -+ "gpio2", -+}; -+ -+static const char * const serial_led_data_groups[] = { -+ "gpio3", -+}; -+ -+static const char * const serial_led_clk_groups[] = { -+ "gpio4", -+}; -+ -+static const char * const inet_led_groups[] = { -+ "gpio5", -+}; -+ -+static const char * const ephy0_led_groups[] = { -+ "gpio6", -+}; -+ -+static const char * const ephy1_led_groups[] = { -+ "gpio7", -+}; -+ -+static const char * const ephy2_led_groups[] = { -+ "gpio8", -+}; -+ -+static const char * const ephy3_led_groups[] = { -+ "gpio9", -+}; -+ -+static const char * const robosw_led_data_groups[] = { -+ "gpio10", -+}; -+ -+static const char * const robosw_led_clk_groups[] = { -+ "gpio11", -+}; -+ -+static const char * const robosw_led0_groups[] = { -+ "gpio12", -+}; -+ -+static const char * const robosw_led1_groups[] = { -+ "gpio13", -+}; -+ -+static const char * const usb_device_led_groups[] = { -+ "gpio14", -+}; -+ -+static const char * const pci_req1_groups[] = { -+ "gpio16", -+}; -+ -+static const char * const pci_gnt1_groups[] = { -+ "gpio17", -+}; -+ -+static const char * const pci_intb_groups[] = { -+ "gpio18", -+}; -+ -+static const char * const pci_req0_groups[] = { -+ "gpio19", -+}; -+ -+static const char * const pci_gnt0_groups[] = { -+ "gpio20", -+}; -+ -+static const char * const pcmcia_cd1_groups[] = { -+ "gpio22", -+}; -+ -+static const char * const pcmcia_cd2_groups[] = { -+ "gpio23", -+}; -+ -+static const char * const pcmcia_vs1_groups[] = { -+ "gpio24", -+}; -+ -+static const char * const pcmcia_vs2_groups[] = { -+ "gpio25", -+}; -+ -+static const char * const ebi_cs2_groups[] = { -+ "gpio26", -+}; -+ -+static const char * const ebi_cs3_groups[] = { -+ "gpio27", -+}; -+ -+static const char * const spi_cs2_groups[] = { -+ "gpio28", -+}; -+ -+static const char * const spi_cs3_groups[] = { -+ "gpio29", -+}; -+ -+static const char * const spi_cs4_groups[] = { -+ "gpio30", -+}; -+ -+static const char * const spi_cs5_groups[] = { -+ "gpio31", -+}; -+ -+static const char * const uart1_groups[] = { -+ "uart1_grp", -+}; -+ -+#define BCM6368_FUN(n, out) \ -+ { \ -+ .name = #n, \ -+ .groups = n##_groups, \ -+ .num_groups = ARRAY_SIZE(n##_groups), \ -+ .dir_out = out, \ -+ } -+ -+#define BCM6368_BASEMODE_FUN(n, val, out) \ -+ { \ -+ .name = #n, \ -+ .groups = n##_groups, \ -+ .num_groups = ARRAY_SIZE(n##_groups), \ -+ .basemode = BCM6368_BASEMODE_##val, \ -+ .dir_out = out, \ -+ } -+ -+static const struct bcm6368_function bcm6368_funcs[] = { -+ BCM6368_FUN(analog_afe_0, 1), -+ BCM6368_FUN(analog_afe_1, 1), -+ BCM6368_FUN(sys_irq, 1), -+ BCM6368_FUN(serial_led_data, 1), -+ BCM6368_FUN(serial_led_clk, 1), -+ BCM6368_FUN(inet_led, 1), -+ BCM6368_FUN(ephy0_led, 1), -+ BCM6368_FUN(ephy1_led, 1), -+ BCM6368_FUN(ephy2_led, 1), -+ BCM6368_FUN(ephy3_led, 1), -+ BCM6368_FUN(robosw_led_data, 1), -+ BCM6368_FUN(robosw_led_clk, 1), -+ BCM6368_FUN(robosw_led0, 1), -+ BCM6368_FUN(robosw_led1, 1), -+ BCM6368_FUN(usb_device_led, 1), -+ BCM6368_FUN(pci_req1, 0), -+ BCM6368_FUN(pci_gnt1, 0), -+ BCM6368_FUN(pci_intb, 0), -+ BCM6368_FUN(pci_req0, 0), -+ BCM6368_FUN(pci_gnt0, 0), -+ BCM6368_FUN(pcmcia_cd1, 0), -+ BCM6368_FUN(pcmcia_cd2, 0), -+ BCM6368_FUN(pcmcia_vs1, 0), -+ BCM6368_FUN(pcmcia_vs2, 0), -+ BCM6368_FUN(ebi_cs2, 1), -+ BCM6368_FUN(ebi_cs3, 1), -+ BCM6368_FUN(spi_cs2, 1), -+ BCM6368_FUN(spi_cs3, 1), -+ BCM6368_FUN(spi_cs4, 1), -+ BCM6368_FUN(spi_cs5, 1), -+ BCM6368_BASEMODE_FUN(uart1, UART1, 0x6), -+}; -+ -+static int bcm6368_pinctrl_get_group_count(struct pinctrl_dev *pctldev) -+{ -+ return ARRAY_SIZE(bcm6368_groups); -+} -+ -+static const char *bcm6368_pinctrl_get_group_name(struct pinctrl_dev *pctldev, -+ unsigned group) -+{ -+ return bcm6368_groups[group].name; -+} -+ -+static int bcm6368_pinctrl_get_group_pins(struct pinctrl_dev *pctldev, -+ unsigned group, const unsigned **pins, -+ unsigned *num_pins) -+{ -+ *pins = bcm6368_groups[group].pins; -+ *num_pins = bcm6368_groups[group].num_pins; -+ -+ return 0; -+} -+ -+static int bcm6368_pinctrl_get_func_count(struct pinctrl_dev *pctldev) -+{ -+ return ARRAY_SIZE(bcm6368_funcs); -+} -+ -+static const char *bcm6368_pinctrl_get_func_name(struct pinctrl_dev *pctldev, -+ unsigned selector) -+{ -+ return bcm6368_funcs[selector].name; -+} -+ -+static int bcm6368_pinctrl_get_groups(struct pinctrl_dev *pctldev, -+ unsigned selector, -+ const char * const **groups, -+ unsigned * const num_groups) -+{ -+ *groups = bcm6368_funcs[selector].groups; -+ *num_groups = bcm6368_funcs[selector].num_groups; -+ -+ return 0; -+} -+ -+static void bcm6368_rmw_mux(struct bcm6368_pinctrl *pctl, void __iomem *reg, -+ u32 mask, u32 val) -+{ -+ u32 tmp; -+ -+ tmp = __raw_readl(reg); -+ tmp &= ~mask; -+ tmp |= (val & mask); -+ __raw_writel(tmp, reg); -+} -+ -+static int bcm6368_pinctrl_set_mux(struct pinctrl_dev *pctldev, -+ unsigned selector, unsigned group) -+{ -+ struct bcm6368_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); -+ const struct bcm6368_pingroup *grp = &bcm6368_groups[group]; -+ const struct bcm6368_function *fun = &bcm6368_funcs[selector]; -+ unsigned long flags; -+ int i, pin; -+ -+ spin_lock_irqsave(&pctl->lock, flags); -+ if (fun->basemode) { -+ u32 mask = 0; -+ -+ for (i = 0; i < grp->num_pins; i++) { -+ pin = grp->pins[i]; -+ if (pin < 32) -+ mask |= BIT(pin); -+ } -+ -+ bcm6368_rmw_mux(pctl, pctl->mode, mask, 0); -+ regmap_field_write(pctl->overlay, fun->basemode); -+ } else { -+ pin = grp->pins[0]; -+ -+ if (bcm6368_pins[pin].drv_data) -+ regmap_field_write(pctl->overlay, -+ BCM6368_BASEMODE_GPIO); -+ -+ bcm6368_rmw_mux(pctl, pctl->mode, BIT(pin), BIT(pin)); -+ } -+ spin_unlock_irqrestore(&pctl->lock, flags); -+ -+ for (pin = 0; pin < grp->num_pins; pin++) { -+ int hw_gpio = bcm6368_pins[pin].number; -+ struct gpio_chip *gc = &pctl->gpio[hw_gpio / 32]; -+ -+ if (fun->dir_out & BIT(pin)) -+ gc->direction_output(gc, hw_gpio % 32, 0); -+ else -+ gc->direction_input(gc, hw_gpio % 32); -+ } -+ -+ return 0; -+} -+ -+static int bcm6368_gpio_request_enable(struct pinctrl_dev *pctldev, -+ struct pinctrl_gpio_range *range, -+ unsigned offset) -+{ -+ struct bcm6368_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); -+ unsigned long flags; -+ -+ if (offset >= 32 && !bcm6368_pins[offset].drv_data) -+ return 0; -+ -+ spin_lock_irqsave(&pctl->lock, flags); -+ /* disable all functions using this pin */ -+ if (offset < 32) -+ bcm6368_rmw_mux(pctl, pctl->mode, BIT(offset), 0); -+ -+ if (bcm6368_pins[offset].drv_data) -+ regmap_field_write(pctl->overlay, BCM6368_BASEMODE_GPIO); -+ -+ spin_unlock_irqrestore(&pctl->lock, flags); -+ -+ return 0; -+} -+ -+static struct pinctrl_ops bcm6368_pctl_ops = { -+ .get_groups_count = bcm6368_pinctrl_get_group_count, -+ .get_group_name = bcm6368_pinctrl_get_group_name, -+ .get_group_pins = bcm6368_pinctrl_get_group_pins, -+#ifdef CONFIG_OF -+ .dt_node_to_map = pinconf_generic_dt_node_to_map_pin, -+ .dt_free_map = pinctrl_utils_free_map, -+#endif -+}; -+ -+static struct pinmux_ops bcm6368_pmx_ops = { -+ .get_functions_count = bcm6368_pinctrl_get_func_count, -+ .get_function_name = bcm6368_pinctrl_get_func_name, -+ .get_function_groups = bcm6368_pinctrl_get_groups, -+ .set_mux = bcm6368_pinctrl_set_mux, -+ .gpio_request_enable = bcm6368_gpio_request_enable, -+ .strict = true, -+}; -+ -+static int bcm6368_pinctrl_probe(struct platform_device *pdev) -+{ -+ struct bcm6368_pinctrl *pctl; -+ struct resource *res; -+ void __iomem *mode; -+ struct regmap *basemode; -+ struct reg_field overlay = REG_FIELD(0, 0, 3); -+ -+ if (pdev->dev.of_node) -+ basemode = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, -+ "brcm,gpiobasemode"); -+ else -+ basemode = syscon_regmap_lookup_by_pdevname("syscon.b00000b8"); -+ -+ if (IS_ERR(basemode)) -+ return PTR_ERR(basemode); -+ -+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mode"); -+ mode = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(mode)) -+ return PTR_ERR(mode); -+ -+ pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL); -+ if (!pctl) -+ return -ENOMEM; -+ -+ pctl->overlay = devm_regmap_field_alloc(&pdev->dev, basemode, overlay); -+ if (IS_ERR(pctl->overlay)) -+ return PTR_ERR(pctl->overlay); -+ -+ spin_lock_init(&pctl->lock); -+ -+ pctl->mode = mode; -+ -+ /* disable all muxes by default */ -+ __raw_writel(0, pctl->mode); -+ -+ pctl->desc.name = dev_name(&pdev->dev); -+ pctl->desc.owner = THIS_MODULE; -+ pctl->desc.pctlops = &bcm6368_pctl_ops; -+ pctl->desc.pmxops = &bcm6368_pmx_ops; -+ -+ pctl->desc.npins = ARRAY_SIZE(bcm6368_pins); -+ pctl->desc.pins = bcm6368_pins; -+ -+ platform_set_drvdata(pdev, pctl); -+ -+ pctl->pctldev = bcm63xx_pinctrl_register(pdev, &pctl->desc, pctl, -+ pctl->gpio, BCM6368_NGPIO); -+ if (IS_ERR(pctl->pctldev)) -+ return PTR_ERR(pctl->pctldev); -+ -+ return 0; -+} -+ -+static const struct of_device_id bcm6368_pinctrl_match[] = { -+ { .compatible = "brcm,bcm6368-pinctrl", }, -+ { }, -+}; -+ -+static struct platform_driver bcm6368_pinctrl_driver = { -+ .probe = bcm6368_pinctrl_probe, -+ .driver = { -+ .name = "bcm6368-pinctrl", -+ .of_match_table = bcm6368_pinctrl_match, -+ }, -+}; -+ -+builtin_platform_driver(bcm6368_pinctrl_driver); diff --git a/target/linux/bcm63xx/patches-5.15/141-Documentation-add-BCM63268-pincontroller-binding-doc.patch b/target/linux/bcm63xx/patches-5.15/141-Documentation-add-BCM63268-pincontroller-binding-doc.patch deleted file mode 100644 index ffe842fd73d893..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/141-Documentation-add-BCM63268-pincontroller-binding-doc.patch +++ /dev/null @@ -1,106 +0,0 @@ -From 28cc80e4ada5d73d5305fd268297825cd8d01936 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Wed, 27 Jul 2016 11:37:08 +0200 -Subject: [PATCH 12/16] Documentation: add BCM63268 pincontroller binding - documentation - -Add binding documentation for the pincontrol core found in the BCM63268 -family SoCs. - -Signed-off-by: Jonas Gorski ---- - .../bindings/pinctrl/brcm,bcm63268-pinctrl.txt | 88 ++++++++++++++++++++++ - 1 file changed, 88 insertions(+) - create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm63268-pinctrl.txt - ---- /dev/null -+++ b/Documentation/devicetree/bindings/pinctrl/brcm,bcm63268-pinctrl.txt -@@ -0,0 +1,88 @@ -+* Broadcom BCM63268 pin controller -+ -+Required properties: -+- compatible: Must be "brcm,bcm6362-pinctrl". -+- reg: Register specifiers of dirout, dat, led, mode, ctrl, basemode registers. -+- reg-names: Must be "dirout", "dat", "led", "mode", "ctrl", "basemode". -+- gpio-controller: Identifies this node as a GPIO controller. -+- #gpio-cells: Must be <2>. -+ -+Example: -+ -+pinctrl: pin-controller@100000c0 { -+ compatible = "brcm,bcm63268-pinctrl"; -+ reg = <0x100000c0 0x8>, -+ <0x100000c8 0x8>, -+ <0x100000d0 0x4>, -+ <0x100000d8 0x4>, -+ <0x100000dc 0x4>, -+ <0x100000f8 0x4>; -+ reg-names = "dirout", "dat", "led", "mode", -+ "ctrl", "basemode"; -+ -+ gpio-controller; -+ #gpio-cells = <2>; -+}; -+ -+Available pins/groups and functions: -+ -+name pins functions -+----------------------------------------------------------- -+gpio0 0 led, serial_led_clk -+gpio1 1 led, serial_led_data -+gpio2 2 led, -+gpio3 3 led, -+gpio4 4 led, -+gpio5 5 led, -+gpio6 6 led, -+gpio7 7 led, -+gpio8 8 led, hsspi_cs6 -+gpio9 9 led, hsspi_cs7 -+gpio10 10 led, uart1_scts -+gpio11 11 led, uart1_srts -+gpio12 12 led, uart1_sdin -+gpio13 13 led, uart1_sdout -+gpio14 14 led, ntr_pulse_in -+gpio15 15 led, dsl_ntr_pulse_out -+gpio16 16 led, hsspi_cs4 -+gpio17 17 led, hsspi_cs5 -+gpio18 18 led, adsl_spi_miso -+gpio19 19 led, adsl_spi_mosi -+gpio20 20 led, -+gpio21 21 led, -+gpio22 22 led, vreg_clk -+gpio23 23 led, pcie_clkreq_b -+gpio24 24 uart1_scts -+gpio25 25 uart1_srts -+gpio26 26 uart1_sdin -+gpio27 27 uart1_sdout -+gpio28 28 ntr_pulse_in -+gpio29 29 dsl_ntr_pulse_out -+gpio30 30 switch_led_clk -+gpio31 31 switch_led_data -+gpio32 32 wifi -+gpio33 33 wifi -+gpio34 34 wifi -+gpio35 35 wifi -+gpio36 36 wifi -+gpio37 37 wifi -+gpio38 38 wifi -+gpio39 39 wifi -+gpio40 40 wifi -+gpio41 41 wifi -+gpio42 42 wifi -+gpio43 43 wifi -+gpio44 44 wifi -+gpio45 45 wifi -+gpio46 46 wifi -+gpio47 47 wifi -+gpio48 48 wifi -+gpio49 49 wifi -+gpio50 50 wifi -+gpio51 51 wifi -+nand_grp 2-7,24-31 nand -+dect_pd_grp 8-9 dect_pd -+vdsl_phy0_grp 10-11 vdsl_phy0 -+vdsl_phy1_grp 12-13 vdsl_phy1 -+vdsl_phy2_grp 24-25 vdsl_phy2 -+vdsl_phy3_grp 26-27 vdsl_phy3 diff --git a/target/linux/bcm63xx/patches-5.15/142-pinctrl-add-a-pincontrol-driver-for-BCM63268.patch b/target/linux/bcm63xx/patches-5.15/142-pinctrl-add-a-pincontrol-driver-for-BCM63268.patch deleted file mode 100644 index 0eece19500c55f..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/142-pinctrl-add-a-pincontrol-driver-for-BCM63268.patch +++ /dev/null @@ -1,736 +0,0 @@ -From 8665d3ea63649cc155286c75f83f694a930580e5 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Fri, 24 Jun 2016 22:19:12 +0200 -Subject: [PATCH 13/16] pinctrl: add a pincontrol driver for BCM63268 - -Add a pincontrol driver for BCM63268. BCM63268 allows muxing GPIOs -to different functions. Depending on the mux, these are either single -pin configurations or whole pin groups. - -Signed-off-by: Jonas Gorski ---- - drivers/pinctrl/bcm63xx/Makefile | 1 + - drivers/pinctrl/bcm63xx/pinctrl-bcm63268.c | 710 +++++++++++++++++++++++++++++ - 2 files changed, 711 insertions(+) - create mode 100644 drivers/pinctrl/bcm63xx/pinctrl-bcm63268.c - ---- a/drivers/pinctrl/bcm63xx/Makefile -+++ b/drivers/pinctrl/bcm63xx/Makefile -@@ -4,3 +4,4 @@ obj-$(CONFIG_PINCTRL_BRCM6348) += pinctr - obj-$(CONFIG_PINCTRL_BRCM6358) += pinctrl-bcm6358.o - obj-$(CONFIG_PINCTRL_BRCM6362) += pinctrl-bcm6362.o - obj-$(CONFIG_PINCTRL_BRCM6368) += pinctrl-bcm6368.o -+obj-$(CONFIG_PINCTRL_BRCM63268) += pinctrl-bcm63268.o ---- /dev/null -+++ b/drivers/pinctrl/bcm63xx/pinctrl-bcm63268.c -@@ -0,0 +1,710 @@ -+/* -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file "COPYING" in the main directory of this archive -+ * for more details. -+ * -+ * Copyright (C) 2016 Jonas Gorski -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include "../core.h" -+#include "../pinctrl-utils.h" -+ -+#include "pinctrl-bcm63xx.h" -+ -+#define BCM63268_NGPIO 52 -+ -+/* GPIO_BASEMODE register */ -+#define BASEMODE_NAND BIT(2) /* GPIOs 2-7, 24-31 */ -+#define BASEMODE_GPIO35 BIT(4) /* GPIO 35 */ -+#define BASEMODE_DECTPD BIT(5) /* GPIOs 8/9 */ -+#define BASEMODE_VDSL_PHY_0 BIT(6) /* GPIOs 10/11 */ -+#define BASEMODE_VDSL_PHY_1 BIT(7) /* GPIOs 12/13 */ -+#define BASEMODE_VDSL_PHY_2 BIT(8) /* GPIOs 24/25 */ -+#define BASEMODE_VDSL_PHY_3 BIT(9) /* GPIOs 26/27 */ -+ -+enum bcm63268_pinctrl_reg { -+ BCM63268_LEDCTRL, -+ BCM63268_MODE, -+ BCM63268_CTRL, -+ BCM63268_BASEMODE, -+}; -+ -+struct bcm63268_pingroup { -+ const char *name; -+ const unsigned * const pins; -+ const unsigned num_pins; -+}; -+ -+struct bcm63268_function { -+ const char *name; -+ const char * const *groups; -+ const unsigned num_groups; -+ -+ enum bcm63268_pinctrl_reg reg; -+ u32 mask; -+}; -+ -+struct bcm63268_pinctrl { -+ struct pinctrl_dev *pctldev; -+ struct pinctrl_desc desc; -+ -+ void __iomem *led; -+ void __iomem *mode; -+ void __iomem *ctrl; -+ void __iomem *basemode; -+ -+ /* register access lock */ -+ spinlock_t lock; -+ -+ struct gpio_chip gpio[2]; -+}; -+ -+#define BCM63268_PIN(a, b, basemode) \ -+ { \ -+ .number = a, \ -+ .name = b, \ -+ .drv_data = (void *)(basemode) \ -+ } -+ -+static const struct pinctrl_pin_desc bcm63268_pins[] = { -+ PINCTRL_PIN(0, "gpio0"), -+ PINCTRL_PIN(1, "gpio1"), -+ BCM63268_PIN(2, "gpio2", BASEMODE_NAND), -+ BCM63268_PIN(3, "gpio3", BASEMODE_NAND), -+ BCM63268_PIN(4, "gpio4", BASEMODE_NAND), -+ BCM63268_PIN(5, "gpio5", BASEMODE_NAND), -+ BCM63268_PIN(6, "gpio6", BASEMODE_NAND), -+ BCM63268_PIN(7, "gpio7", BASEMODE_NAND), -+ BCM63268_PIN(8, "gpio8", BASEMODE_DECTPD), -+ BCM63268_PIN(9, "gpio9", BASEMODE_DECTPD), -+ BCM63268_PIN(10, "gpio10", BASEMODE_VDSL_PHY_0), -+ BCM63268_PIN(11, "gpio11", BASEMODE_VDSL_PHY_0), -+ BCM63268_PIN(12, "gpio12", BASEMODE_VDSL_PHY_1), -+ BCM63268_PIN(13, "gpio13", BASEMODE_VDSL_PHY_1), -+ PINCTRL_PIN(14, "gpio14"), -+ PINCTRL_PIN(15, "gpio15"), -+ PINCTRL_PIN(16, "gpio16"), -+ PINCTRL_PIN(17, "gpio17"), -+ PINCTRL_PIN(18, "gpio18"), -+ PINCTRL_PIN(19, "gpio19"), -+ PINCTRL_PIN(20, "gpio20"), -+ PINCTRL_PIN(21, "gpio21"), -+ PINCTRL_PIN(22, "gpio22"), -+ PINCTRL_PIN(23, "gpio23"), -+ BCM63268_PIN(24, "gpio24", BASEMODE_NAND | BASEMODE_VDSL_PHY_2), -+ BCM63268_PIN(25, "gpio25", BASEMODE_NAND | BASEMODE_VDSL_PHY_2), -+ BCM63268_PIN(26, "gpio26", BASEMODE_NAND | BASEMODE_VDSL_PHY_3), -+ BCM63268_PIN(27, "gpio27", BASEMODE_NAND | BASEMODE_VDSL_PHY_3), -+ BCM63268_PIN(28, "gpio28", BASEMODE_NAND), -+ BCM63268_PIN(29, "gpio29", BASEMODE_NAND), -+ BCM63268_PIN(30, "gpio30", BASEMODE_NAND), -+ BCM63268_PIN(31, "gpio31", BASEMODE_NAND), -+ PINCTRL_PIN(32, "gpio32"), -+ PINCTRL_PIN(33, "gpio33"), -+ PINCTRL_PIN(34, "gpio34"), -+ PINCTRL_PIN(35, "gpio35"), -+ PINCTRL_PIN(36, "gpio36"), -+ PINCTRL_PIN(37, "gpio37"), -+ PINCTRL_PIN(38, "gpio38"), -+ PINCTRL_PIN(39, "gpio39"), -+ PINCTRL_PIN(40, "gpio40"), -+ PINCTRL_PIN(41, "gpio41"), -+ PINCTRL_PIN(42, "gpio42"), -+ PINCTRL_PIN(43, "gpio43"), -+ PINCTRL_PIN(44, "gpio44"), -+ PINCTRL_PIN(45, "gpio45"), -+ PINCTRL_PIN(46, "gpio46"), -+ PINCTRL_PIN(47, "gpio47"), -+ PINCTRL_PIN(48, "gpio48"), -+ PINCTRL_PIN(49, "gpio49"), -+ PINCTRL_PIN(50, "gpio50"), -+ PINCTRL_PIN(51, "gpio51"), -+}; -+ -+static unsigned gpio0_pins[] = { 0 }; -+static unsigned gpio1_pins[] = { 1 }; -+static unsigned gpio2_pins[] = { 2 }; -+static unsigned gpio3_pins[] = { 3 }; -+static unsigned gpio4_pins[] = { 4 }; -+static unsigned gpio5_pins[] = { 5 }; -+static unsigned gpio6_pins[] = { 6 }; -+static unsigned gpio7_pins[] = { 7 }; -+static unsigned gpio8_pins[] = { 8 }; -+static unsigned gpio9_pins[] = { 9 }; -+static unsigned gpio10_pins[] = { 10 }; -+static unsigned gpio11_pins[] = { 11 }; -+static unsigned gpio12_pins[] = { 12 }; -+static unsigned gpio13_pins[] = { 13 }; -+static unsigned gpio14_pins[] = { 14 }; -+static unsigned gpio15_pins[] = { 15 }; -+static unsigned gpio16_pins[] = { 16 }; -+static unsigned gpio17_pins[] = { 17 }; -+static unsigned gpio18_pins[] = { 18 }; -+static unsigned gpio19_pins[] = { 19 }; -+static unsigned gpio20_pins[] = { 20 }; -+static unsigned gpio21_pins[] = { 21 }; -+static unsigned gpio22_pins[] = { 22 }; -+static unsigned gpio23_pins[] = { 23 }; -+static unsigned gpio24_pins[] = { 24 }; -+static unsigned gpio25_pins[] = { 25 }; -+static unsigned gpio26_pins[] = { 26 }; -+static unsigned gpio27_pins[] = { 27 }; -+static unsigned gpio28_pins[] = { 28 }; -+static unsigned gpio29_pins[] = { 29 }; -+static unsigned gpio30_pins[] = { 30 }; -+static unsigned gpio31_pins[] = { 31 }; -+static unsigned gpio32_pins[] = { 32 }; -+static unsigned gpio33_pins[] = { 33 }; -+static unsigned gpio34_pins[] = { 34 }; -+static unsigned gpio35_pins[] = { 35 }; -+static unsigned gpio36_pins[] = { 36 }; -+static unsigned gpio37_pins[] = { 37 }; -+static unsigned gpio38_pins[] = { 38 }; -+static unsigned gpio39_pins[] = { 39 }; -+static unsigned gpio40_pins[] = { 40 }; -+static unsigned gpio41_pins[] = { 41 }; -+static unsigned gpio42_pins[] = { 42 }; -+static unsigned gpio43_pins[] = { 43 }; -+static unsigned gpio44_pins[] = { 44 }; -+static unsigned gpio45_pins[] = { 45 }; -+static unsigned gpio46_pins[] = { 46 }; -+static unsigned gpio47_pins[] = { 47 }; -+static unsigned gpio48_pins[] = { 48 }; -+static unsigned gpio49_pins[] = { 49 }; -+static unsigned gpio50_pins[] = { 50 }; -+static unsigned gpio51_pins[] = { 51 }; -+ -+static unsigned nand_grp_pins[] = { -+ 2, 3, 4, 5, 6, 7, 24, -+ 25, 26, 27, 28, 29, 30, 31, -+}; -+ -+static unsigned dectpd_grp_pins[] = { 8, 9 }; -+static unsigned vdsl_phy0_grp_pins[] = { 10, 11 }; -+static unsigned vdsl_phy1_grp_pins[] = { 12, 13 }; -+static unsigned vdsl_phy2_grp_pins[] = { 24, 25 }; -+static unsigned vdsl_phy3_grp_pins[] = { 26, 27 }; -+ -+#define BCM63268_GROUP(n) \ -+ { \ -+ .name = #n, \ -+ .pins = n##_pins, \ -+ .num_pins = ARRAY_SIZE(n##_pins), \ -+ } -+ -+static struct bcm63268_pingroup bcm63268_groups[] = { -+ BCM63268_GROUP(gpio0), -+ BCM63268_GROUP(gpio1), -+ BCM63268_GROUP(gpio2), -+ BCM63268_GROUP(gpio3), -+ BCM63268_GROUP(gpio4), -+ BCM63268_GROUP(gpio5), -+ BCM63268_GROUP(gpio6), -+ BCM63268_GROUP(gpio7), -+ BCM63268_GROUP(gpio8), -+ BCM63268_GROUP(gpio9), -+ BCM63268_GROUP(gpio10), -+ BCM63268_GROUP(gpio11), -+ BCM63268_GROUP(gpio12), -+ BCM63268_GROUP(gpio13), -+ BCM63268_GROUP(gpio14), -+ BCM63268_GROUP(gpio15), -+ BCM63268_GROUP(gpio16), -+ BCM63268_GROUP(gpio17), -+ BCM63268_GROUP(gpio18), -+ BCM63268_GROUP(gpio19), -+ BCM63268_GROUP(gpio20), -+ BCM63268_GROUP(gpio21), -+ BCM63268_GROUP(gpio22), -+ BCM63268_GROUP(gpio23), -+ BCM63268_GROUP(gpio24), -+ BCM63268_GROUP(gpio25), -+ BCM63268_GROUP(gpio26), -+ BCM63268_GROUP(gpio27), -+ BCM63268_GROUP(gpio28), -+ BCM63268_GROUP(gpio29), -+ BCM63268_GROUP(gpio30), -+ BCM63268_GROUP(gpio31), -+ BCM63268_GROUP(gpio32), -+ BCM63268_GROUP(gpio33), -+ BCM63268_GROUP(gpio34), -+ BCM63268_GROUP(gpio35), -+ BCM63268_GROUP(gpio36), -+ BCM63268_GROUP(gpio37), -+ BCM63268_GROUP(gpio38), -+ BCM63268_GROUP(gpio39), -+ BCM63268_GROUP(gpio40), -+ BCM63268_GROUP(gpio41), -+ BCM63268_GROUP(gpio42), -+ BCM63268_GROUP(gpio43), -+ BCM63268_GROUP(gpio44), -+ BCM63268_GROUP(gpio45), -+ BCM63268_GROUP(gpio46), -+ BCM63268_GROUP(gpio47), -+ BCM63268_GROUP(gpio48), -+ BCM63268_GROUP(gpio49), -+ BCM63268_GROUP(gpio50), -+ BCM63268_GROUP(gpio51), -+ -+ /* multi pin groups */ -+ BCM63268_GROUP(nand_grp), -+ BCM63268_GROUP(dectpd_grp), -+ BCM63268_GROUP(vdsl_phy0_grp), -+ BCM63268_GROUP(vdsl_phy1_grp), -+ BCM63268_GROUP(vdsl_phy2_grp), -+ BCM63268_GROUP(vdsl_phy3_grp), -+}; -+ -+static const char * const led_groups[] = { -+ "gpio0", -+ "gpio1", -+ "gpio2", -+ "gpio3", -+ "gpio4", -+ "gpio5", -+ "gpio6", -+ "gpio7", -+ "gpio8", -+ "gpio9", -+ "gpio10", -+ "gpio11", -+ "gpio12", -+ "gpio13", -+ "gpio14", -+ "gpio15", -+ "gpio16", -+ "gpio17", -+ "gpio18", -+ "gpio19", -+ "gpio20", -+ "gpio21", -+ "gpio22", -+ "gpio23", -+}; -+ -+static const char * const serial_led_clk_groups[] = { -+ "gpio0", -+}; -+ -+static const char * const serial_led_data_groups[] = { -+ "gpio1", -+}; -+ -+static const char * const hsspi_cs4_groups[] = { -+ "gpio16", -+}; -+ -+static const char * const hsspi_cs5_groups[] = { -+ "gpio17", -+}; -+ -+static const char * const hsspi_cs6_groups[] = { -+ "gpio8", -+}; -+ -+static const char * const hsspi_cs7_groups[] = { -+ "gpio9", -+}; -+ -+static const char * const uart1_scts_groups[] = { -+ "gpio10", -+ "gpio24", -+}; -+ -+static const char * const uart1_srts_groups[] = { -+ "gpio11", -+ "gpio25", -+}; -+ -+static const char * const uart1_sdin_groups[] = { -+ "gpio12", -+ "gpio26", -+}; -+ -+static const char * const uart1_sdout_groups[] = { -+ "gpio13", -+ "gpio27", -+}; -+ -+static const char * const ntr_pulse_in_groups[] = { -+ "gpio14", -+ "gpio28", -+}; -+ -+static const char * const dsl_ntr_pulse_out_groups[] = { -+ "gpio15", -+ "gpio29", -+}; -+ -+static const char * const adsl_spi_miso_groups[] = { -+ "gpio18", -+}; -+ -+static const char * const adsl_spi_mosi_groups[] = { -+ "gpio19", -+}; -+ -+static const char * const vreg_clk_groups[] = { -+ "gpio22", -+}; -+ -+static const char * const pcie_clkreq_b_groups[] = { -+ "gpio23", -+}; -+ -+static const char * const switch_led_clk_groups[] = { -+ "gpio30", -+}; -+ -+static const char * const switch_led_data_groups[] = { -+ "gpio31", -+}; -+ -+static const char * const wifi_groups[] = { -+ "gpio32", -+ "gpio33", -+ "gpio34", -+ "gpio35", -+ "gpio36", -+ "gpio37", -+ "gpio38", -+ "gpio39", -+ "gpio40", -+ "gpio41", -+ "gpio42", -+ "gpio43", -+ "gpio44", -+ "gpio45", -+ "gpio46", -+ "gpio47", -+ "gpio48", -+ "gpio49", -+ "gpio50", -+ "gpio51", -+}; -+ -+static const char * const nand_groups[] = { -+ "nand_grp", -+}; -+ -+static const char * const dectpd_groups[] = { -+ "dectpd_grp", -+}; -+ -+static const char * const vdsl_phy_override_0_groups[] = { -+ "vdsl_phy_override_0_grp", -+}; -+ -+static const char * const vdsl_phy_override_1_groups[] = { -+ "vdsl_phy_override_1_grp", -+}; -+ -+static const char * const vdsl_phy_override_2_groups[] = { -+ "vdsl_phy_override_2_grp", -+}; -+ -+static const char * const vdsl_phy_override_3_groups[] = { -+ "vdsl_phy_override_3_grp", -+}; -+ -+#define BCM63268_LED_FUN(n) \ -+ { \ -+ .name = #n, \ -+ .groups = n##_groups, \ -+ .num_groups = ARRAY_SIZE(n##_groups), \ -+ .reg = BCM63268_LEDCTRL, \ -+ } -+ -+#define BCM63268_MODE_FUN(n) \ -+ { \ -+ .name = #n, \ -+ .groups = n##_groups, \ -+ .num_groups = ARRAY_SIZE(n##_groups), \ -+ .reg = BCM63268_MODE, \ -+ } -+ -+#define BCM63268_CTRL_FUN(n) \ -+ { \ -+ .name = #n, \ -+ .groups = n##_groups, \ -+ .num_groups = ARRAY_SIZE(n##_groups), \ -+ .reg = BCM63268_CTRL, \ -+ } -+ -+#define BCM63268_BASEMODE_FUN(n, val) \ -+ { \ -+ .name = #n, \ -+ .groups = n##_groups, \ -+ .num_groups = ARRAY_SIZE(n##_groups), \ -+ .reg = BCM63268_BASEMODE, \ -+ .mask = val, \ -+ } -+ -+static const struct bcm63268_function bcm63268_funcs[] = { -+ BCM63268_LED_FUN(led), -+ BCM63268_MODE_FUN(serial_led_clk), -+ BCM63268_MODE_FUN(serial_led_data), -+ BCM63268_MODE_FUN(hsspi_cs6), -+ BCM63268_MODE_FUN(hsspi_cs7), -+ BCM63268_MODE_FUN(uart1_scts), -+ BCM63268_MODE_FUN(uart1_srts), -+ BCM63268_MODE_FUN(uart1_sdin), -+ BCM63268_MODE_FUN(uart1_sdout), -+ BCM63268_MODE_FUN(ntr_pulse_in), -+ BCM63268_MODE_FUN(dsl_ntr_pulse_out), -+ BCM63268_MODE_FUN(hsspi_cs4), -+ BCM63268_MODE_FUN(hsspi_cs5), -+ BCM63268_MODE_FUN(adsl_spi_miso), -+ BCM63268_MODE_FUN(adsl_spi_mosi), -+ BCM63268_MODE_FUN(vreg_clk), -+ BCM63268_MODE_FUN(pcie_clkreq_b), -+ BCM63268_MODE_FUN(switch_led_clk), -+ BCM63268_MODE_FUN(switch_led_data), -+ BCM63268_CTRL_FUN(wifi), -+ BCM63268_BASEMODE_FUN(nand, BASEMODE_NAND), -+ BCM63268_BASEMODE_FUN(dectpd, BASEMODE_DECTPD), -+ BCM63268_BASEMODE_FUN(vdsl_phy_override_0, BASEMODE_VDSL_PHY_0), -+ BCM63268_BASEMODE_FUN(vdsl_phy_override_1, BASEMODE_VDSL_PHY_1), -+ BCM63268_BASEMODE_FUN(vdsl_phy_override_2, BASEMODE_VDSL_PHY_2), -+ BCM63268_BASEMODE_FUN(vdsl_phy_override_3, BASEMODE_VDSL_PHY_3), -+}; -+ -+static int bcm63268_pinctrl_get_group_count(struct pinctrl_dev *pctldev) -+{ -+ return ARRAY_SIZE(bcm63268_groups); -+} -+ -+static const char *bcm63268_pinctrl_get_group_name(struct pinctrl_dev *pctldev, -+ unsigned group) -+{ -+ return bcm63268_groups[group].name; -+} -+ -+static int bcm63268_pinctrl_get_group_pins(struct pinctrl_dev *pctldev, -+ unsigned group, -+ const unsigned **pins, -+ unsigned *num_pins) -+{ -+ *pins = bcm63268_groups[group].pins; -+ *num_pins = bcm63268_groups[group].num_pins; -+ -+ return 0; -+} -+ -+static int bcm63268_pinctrl_get_func_count(struct pinctrl_dev *pctldev) -+{ -+ return ARRAY_SIZE(bcm63268_funcs); -+} -+ -+static const char *bcm63268_pinctrl_get_func_name(struct pinctrl_dev *pctldev, -+ unsigned selector) -+{ -+ return bcm63268_funcs[selector].name; -+} -+ -+static int bcm63268_pinctrl_get_groups(struct pinctrl_dev *pctldev, -+ unsigned selector, -+ const char * const **groups, -+ unsigned * const num_groups) -+{ -+ *groups = bcm63268_funcs[selector].groups; -+ *num_groups = bcm63268_funcs[selector].num_groups; -+ -+ return 0; -+} -+ -+static void bcm63268_rmw_mux(struct bcm63268_pinctrl *pctl, void __iomem *reg, -+ u32 mask, u32 val) -+{ -+ unsigned long flags; -+ u32 tmp; -+ -+ spin_lock_irqsave(&pctl->lock, flags); -+ tmp = __raw_readl(reg); -+ tmp &= ~mask; -+ tmp |= val; -+ __raw_writel(tmp, reg); -+ -+ spin_unlock_irqrestore(&pctl->lock, flags); -+} -+ -+static void bcm63268_set_gpio(struct bcm63268_pinctrl *pctl, unsigned pin) -+{ -+ const struct pinctrl_pin_desc *desc = &bcm63268_pins[pin]; -+ u32 basemode = (unsigned long)desc->drv_data; -+ u32 mask = BIT(pin % 32); -+ -+ if (basemode) -+ bcm63268_rmw_mux(pctl, pctl->basemode, basemode, 0); -+ -+ if (pin < 32) { -+ /* base mode: 0 => gpio, 1 => mux function */ -+ bcm63268_rmw_mux(pctl, pctl->mode, mask, 0); -+ -+ /* pins 0-23 might be muxed to led */ -+ if (pin < 24) -+ bcm63268_rmw_mux(pctl, pctl->led, mask, 0); -+ } else if (pin < 52) { -+ /* ctrl reg: 0 => wifi function, 1 => gpio */ -+ bcm63268_rmw_mux(pctl, pctl->ctrl, mask, mask); -+ } -+} -+ -+static int bcm63268_pinctrl_set_mux(struct pinctrl_dev *pctldev, -+ unsigned selector, unsigned group) -+{ -+ struct bcm63268_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); -+ const struct bcm63268_pingroup *grp = &bcm63268_groups[group]; -+ const struct bcm63268_function *f = &bcm63268_funcs[selector]; -+ unsigned i; -+ void __iomem *reg; -+ u32 val, mask; -+ -+ for (i = 0; i < grp->num_pins; i++) -+ bcm63268_set_gpio(pctl, grp->pins[i]); -+ -+ switch (f->reg) { -+ case BCM63268_LEDCTRL: -+ reg = pctl->led; -+ mask = BIT(grp->pins[0]); -+ val = BIT(grp->pins[0]); -+ break; -+ case BCM63268_MODE: -+ reg = pctl->mode; -+ mask = BIT(grp->pins[0]); -+ val = BIT(grp->pins[0]); -+ break; -+ case BCM63268_CTRL: -+ reg = pctl->ctrl; -+ mask = BIT(grp->pins[0]); -+ val = 0; -+ break; -+ case BCM63268_BASEMODE: -+ reg = pctl->basemode; -+ mask = f->mask; -+ val = f->mask; -+ break; -+ default: -+ WARN_ON(1); -+ return -EINVAL; -+ } -+ -+ bcm63268_rmw_mux(pctl, reg, mask, val); -+ -+ return 0; -+} -+ -+static int bcm63268_gpio_request_enable(struct pinctrl_dev *pctldev, -+ struct pinctrl_gpio_range *range, -+ unsigned offset) -+{ -+ struct bcm63268_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); -+ -+ /* disable all functions using this pin */ -+ bcm63268_set_gpio(pctl, offset); -+ -+ return 0; -+} -+ -+static struct pinctrl_ops bcm63268_pctl_ops = { -+ .get_groups_count = bcm63268_pinctrl_get_group_count, -+ .get_group_name = bcm63268_pinctrl_get_group_name, -+ .get_group_pins = bcm63268_pinctrl_get_group_pins, -+#ifdef CONFIG_OF -+ .dt_node_to_map = pinconf_generic_dt_node_to_map_pin, -+ .dt_free_map = pinctrl_utils_free_map, -+#endif -+}; -+ -+static struct pinmux_ops bcm63268_pmx_ops = { -+ .get_functions_count = bcm63268_pinctrl_get_func_count, -+ .get_function_name = bcm63268_pinctrl_get_func_name, -+ .get_function_groups = bcm63268_pinctrl_get_groups, -+ .set_mux = bcm63268_pinctrl_set_mux, -+ .gpio_request_enable = bcm63268_gpio_request_enable, -+ .strict = true, -+}; -+ -+static int bcm63268_pinctrl_probe(struct platform_device *pdev) -+{ -+ struct bcm63268_pinctrl *pctl; -+ struct resource *res; -+ void __iomem *led, *mode, *ctrl, *basemode; -+ -+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "led"); -+ led = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(led)) -+ return PTR_ERR(led); -+ -+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mode"); -+ mode = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(mode)) -+ return PTR_ERR(mode); -+ -+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ctrl"); -+ ctrl = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(ctrl)) -+ return PTR_ERR(ctrl); -+ -+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "basemode"); -+ basemode = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(basemode)) -+ return PTR_ERR(basemode); -+ -+ pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL); -+ if (!pctl) -+ return -ENOMEM; -+ -+ spin_lock_init(&pctl->lock); -+ -+ pctl->led = led; -+ pctl->mode = mode; -+ pctl->ctrl = ctrl; -+ pctl->basemode = basemode; -+ -+ pctl->desc.name = dev_name(&pdev->dev); -+ pctl->desc.owner = THIS_MODULE; -+ pctl->desc.pctlops = &bcm63268_pctl_ops; -+ pctl->desc.pmxops = &bcm63268_pmx_ops; -+ -+ pctl->desc.npins = ARRAY_SIZE(bcm63268_pins); -+ pctl->desc.pins = bcm63268_pins; -+ -+ platform_set_drvdata(pdev, pctl); -+ -+ pctl->pctldev = bcm63xx_pinctrl_register(pdev, &pctl->desc, pctl, -+ pctl->gpio, BCM63268_NGPIO); -+ if (IS_ERR(pctl->pctldev)) -+ return PTR_ERR(pctl->pctldev); -+ -+ return 0; -+} -+ -+static const struct of_device_id bcm63268_pinctrl_match[] = { -+ { .compatible = "brcm,bcm63268-pinctrl", }, -+ { }, -+}; -+ -+static struct platform_driver bcm63268_pinctrl_driver = { -+ .probe = bcm63268_pinctrl_probe, -+ .driver = { -+ .name = "bcm63268-pinctrl", -+ .of_match_table = bcm63268_pinctrl_match, -+ }, -+}; -+ -+builtin_platform_driver(bcm63268_pinctrl_driver); diff --git a/target/linux/bcm63xx/patches-5.15/143-gpio-fix-device-tree-gpio-hogs-on-dual-role-gpio-pin.patch b/target/linux/bcm63xx/patches-5.15/143-gpio-fix-device-tree-gpio-hogs-on-dual-role-gpio-pin.patch deleted file mode 100644 index 4b3e87cbbfd3b2..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/143-gpio-fix-device-tree-gpio-hogs-on-dual-role-gpio-pin.patch +++ /dev/null @@ -1,161 +0,0 @@ -From e058fa1969019c2f6705c53c4130e364a877d4e6 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 26 Nov 2017 12:07:31 +0100 -Subject: [PATCH] gpio: fix device tree gpio hogs on dual role gpio/pincontrol - controllers - -For dual role gpio and pincontrol controller, the device registration -path is often: - - pinctrl_register(...); - gpiochip_add_data(...); - gpiochip_add_pin_range(...); - -If the device tree node has any gpio-hogs, the code will try to apply them -in the gpiochip_add_data step, but fail as they cannot be requested, as the -ranges are missing. But we also cannot first add the pinranges, as the -appropriate data structures are only initialized in gpiochip_add_data. - -To fix this, defer gpio-hogs to the time pin ranges get added instead of -directly at chip request time, if the gpio-chip has a request method. - -Signed-off-by: Jonas Gorski ---- - - drivers/gpio/gpiolib-of.c | 20 +++++++++++++++----- - drivers/gpio/gpiolib.c | 5 +++-- - drivers/gpio/gpiolib.h | 8 ++++++++ - 3 files changed, 26 insertions(+), 7 deletions(-) - ---- a/drivers/gpio/gpiolib-of.c -+++ b/drivers/gpio/gpiolib-of.c -@@ -646,23 +646,30 @@ static struct gpio_desc *of_parse_own_gp - * of_gpiochip_add_hog - Add all hogs in a hog device node - * @chip: gpio chip to act on - * @hog: device node describing the hogs -+ * @start: first gpio to check -+ * @num: number of gpios to check - * - * Returns error if it fails otherwise 0 on success. - */ --static int of_gpiochip_add_hog(struct gpio_chip *chip, struct device_node *hog) -+static int of_gpiochip_add_hog(struct gpio_chip *chip, struct device_node *hog, -+ unsigned int start, unsigned int num) - { - enum gpiod_flags dflags; - struct gpio_desc *desc; - unsigned long lflags; - const char *name; - unsigned int i; -- int ret; -+ int ret, hwgpio; - - for (i = 0;; i++) { - desc = of_parse_own_gpio(hog, chip, i, &name, &lflags, &dflags); - if (IS_ERR(desc)) - break; - -+ hwgpio = gpio_chip_hwgpio(desc); -+ if (hwgpio < start || hwgpio >= (start + num)) -+ continue; -+ - ret = gpiod_hog(desc, name, lflags, dflags); - if (ret < 0) - return ret; -@@ -678,12 +685,15 @@ static int of_gpiochip_add_hog(struct gp - /** - * of_gpiochip_scan_gpios - Scan gpio-controller for gpio definitions - * @chip: gpio chip to act on -+ * @start: first gpio to check -+ * @num: number of gpios to check - * -- * This is only used by of_gpiochip_add to request/set GPIO initial -- * configuration. -+ * This is used by of_gpiochip_add, gpiochip_add_pingroup_range and -+ * gpiochip_add_pin_range to request/set GPIO initial configuration. - * It returns error if it fails otherwise 0 on success. - */ --static int of_gpiochip_scan_gpios(struct gpio_chip *chip) -+int of_gpiochip_scan_gpios(struct gpio_chip *chip, unsigned int start, -+ unsigned int num) - { - struct device_node *np; - int ret; -@@ -692,7 +702,7 @@ static int of_gpiochip_scan_gpios(struct - if (!of_property_read_bool(np, "gpio-hog")) - continue; - -- ret = of_gpiochip_add_hog(chip, np); -+ ret = of_gpiochip_add_hog(chip, np, start, num); - if (ret < 0) { - of_node_put(np); - return ret; -@@ -758,7 +768,7 @@ static int of_gpio_notify(struct notifie - if (chip == NULL) - return NOTIFY_OK; /* not for us */ - -- ret = of_gpiochip_add_hog(chip, rd->dn); -+ ret = of_gpiochip_add_hog(chip, rd->dn, 0, chip->ngpio); - if (ret < 0) { - pr_err("%s: failed to add hogs for %pOF\n", __func__, - rd->dn); -@@ -1037,9 +1047,11 @@ int of_gpiochip_add(struct gpio_chip *ch - - of_node_get(chip->of_node); - -- ret = of_gpiochip_scan_gpios(chip); -- if (ret) -- of_node_put(chip->of_node); -+ if (!chip->request) { -+ ret = of_gpiochip_scan_gpios(chip, 0, chip->ngpio); -+ if (ret) -+ of_node_put(chip->of_node); -+ } - - return ret; - } ---- a/drivers/gpio/gpiolib.c -+++ b/drivers/gpio/gpiolib.c -@@ -1815,7 +1815,8 @@ int gpiochip_add_pingroup_range(struct g - - list_add_tail(&pin_range->node, &gdev->pin_ranges); - -- return 0; -+ return of_gpiochip_scan_gpios(gc, gpio_offset, -+ pin_range->range.npins); - } - EXPORT_SYMBOL_GPL(gpiochip_add_pingroup_range); - -@@ -1872,7 +1873,7 @@ int gpiochip_add_pin_range(struct gpio_c - - list_add_tail(&pin_range->node, &gdev->pin_ranges); - -- return 0; -+ return of_gpiochip_scan_gpios(gc, gpio_offset, npins); - } - EXPORT_SYMBOL_GPL(gpiochip_add_pin_range); - ---- a/drivers/gpio/gpiolib-of.h -+++ b/drivers/gpio/gpiolib-of.h -@@ -13,6 +13,8 @@ struct gpio_desc *of_find_gpio(struct de - unsigned long *lookupflags); - int of_gpiochip_add(struct gpio_chip *gc); - void of_gpiochip_remove(struct gpio_chip *gc); -+int of_gpiochip_scan_gpios(struct gpio_chip *chip, unsigned int start, -+ unsigned int num); - int of_gpio_get_count(struct device *dev, const char *con_id); - bool of_gpio_need_valid_mask(const struct gpio_chip *gc); - void of_gpio_dev_init(struct gpio_chip *gc, struct gpio_device *gdev); -@@ -26,6 +28,12 @@ static inline struct gpio_desc *of_find_ - } - static inline int of_gpiochip_add(struct gpio_chip *gc) { return 0; } - static inline void of_gpiochip_remove(struct gpio_chip *gc) { } -+static inline int of_gpiochip_scan_gpios(struct gpio_chip *chip, -+ unsigned int start, -+ unsigned int num) -+{ -+ return 0; -+} - static inline int of_gpio_get_count(struct device *dev, const char *con_id) - { - return 0; diff --git a/target/linux/bcm63xx/patches-5.15/144-add-removed-syscon_regmap_lookup_by_pdevname.patch b/target/linux/bcm63xx/patches-5.15/144-add-removed-syscon_regmap_lookup_by_pdevname.patch deleted file mode 100644 index 71991663770ae8..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/144-add-removed-syscon_regmap_lookup_by_pdevname.patch +++ /dev/null @@ -1,68 +0,0 @@ -From: Adrian Schmutzler -Date: Fri, 03 Apr 2020 19:50:03 +0200 -Subject: add removed helper syscon_regmap_lookup_by_pdevname - -The helper syscon_regmap_lookup_by_pdevname has been removed in 29d14b668d2f -("mfd: Remove unused helper syscon_regmap_lookup_by_pdevname") due to lack -of users. - -Thus, we have to maintain it locally. - -This patch includes a fix due to changes in driver_find_device; -kernel commit: 92ce7e83b4e5 ("driver_find_device: Unify the match function -with class_find_device()") - -Signed-off-by: Adrian Schmutzler - ---- a/drivers/mfd/syscon.c -+++ b/drivers/mfd/syscon.c -@@ -209,6 +209,27 @@ struct regmap *syscon_regmap_lookup_by_c - } - EXPORT_SYMBOL_GPL(syscon_regmap_lookup_by_compatible); - -+static int syscon_match_pdevname(struct device *dev, const void *data) -+{ -+ return !strcmp(dev_name(dev), (const char *)data); -+} -+ -+struct regmap *syscon_regmap_lookup_by_pdevname(const char *s) -+{ -+ struct device *dev; -+ struct syscon *syscon; -+ -+ dev = driver_find_device(&syscon_driver.driver, NULL, (void *)s, -+ syscon_match_pdevname); -+ if (!dev) -+ return ERR_PTR(-EPROBE_DEFER); -+ -+ syscon = dev_get_drvdata(dev); -+ -+ return syscon->regmap; -+} -+EXPORT_SYMBOL_GPL(syscon_regmap_lookup_by_pdevname); -+ - struct regmap *syscon_regmap_lookup_by_phandle(struct device_node *np, - const char *property) - { ---- a/include/linux/mfd/syscon.h -+++ b/include/linux/mfd/syscon.h -@@ -20,6 +20,7 @@ struct device_node; - extern struct regmap *device_node_to_regmap(struct device_node *np); - extern struct regmap *syscon_node_to_regmap(struct device_node *np); - extern struct regmap *syscon_regmap_lookup_by_compatible(const char *s); -+extern struct regmap *syscon_regmap_lookup_by_pdevname(const char *s); - extern struct regmap *syscon_regmap_lookup_by_phandle( - struct device_node *np, - const char *property); -@@ -46,6 +47,11 @@ static inline struct regmap *syscon_regm - { - return ERR_PTR(-ENOTSUPP); - } -+ -+static inline struct regmap *syscon_regmap_lookup_by_pdevname(const char *s) -+{ -+ return ERR_PTR(-ENOTSUPP); -+} - - static inline struct regmap *syscon_regmap_lookup_by_phandle( - struct device_node *np, diff --git a/target/linux/bcm63xx/patches-5.15/145-pinctrl-BCM6362-fix-gpio-mode.patch b/target/linux/bcm63xx/patches-5.15/145-pinctrl-BCM6362-fix-gpio-mode.patch deleted file mode 100644 index 0189b0b9a3b548..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/145-pinctrl-BCM6362-fix-gpio-mode.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/drivers/pinctrl/bcm63xx/pinctrl-bcm6362.c -+++ b/drivers/pinctrl/bcm63xx/pinctrl-bcm6362.c -@@ -566,7 +566,7 @@ static int bcm6362_pinctrl_set_mux(struc - val = BIT(grp->pins[0]); - break; - case BCM6362_MODE: -- reg = pctl->ctrl; -+ reg = pctl->mode; - mask = BIT(grp->pins[0]); - val = BIT(grp->pins[0]); - break; diff --git a/target/linux/bcm63xx/patches-5.15/206-USB-EHCI-allow-limiting-ports-for-ehci-platform.patch b/target/linux/bcm63xx/patches-5.15/206-USB-EHCI-allow-limiting-ports-for-ehci-platform.patch deleted file mode 100644 index 21401c9c9f0f4b..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/206-USB-EHCI-allow-limiting-ports-for-ehci-platform.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 6ac09efa8f0e189ffe7dd7b0889289de56ee44cc Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 19 Jan 2014 12:18:03 +0100 -Subject: [PATCH] USB: EHCI: allow limiting ports for ehci-platform - -In the same way as the ohci platform driver allows limiting ports, -enable the same for ehci. This prevents a mismatch in the available -ports between ehci/ohci on USB 2.0 controllers. - -This is needed if the USB host controller always reports the maximum -number of ports regardless of the number of available ports (because -one might be set to be usb device). - -Signed-off-by: Jonas Gorski ---- - drivers/usb/host/ehci-hcd.c | 4 ++++ - drivers/usb/host/ehci-platform.c | 2 ++ - drivers/usb/host/ehci.h | 1 + - include/linux/usb/ehci_pdriver.h | 1 + - 4 files changed, 8 insertions(+) - ---- a/drivers/usb/host/ehci-hcd.c -+++ b/drivers/usb/host/ehci-hcd.c -@@ -688,6 +688,10 @@ int ehci_setup(struct usb_hcd *hcd) - - /* cache this readonly data; minimize chip reads */ - ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params); -+ if (ehci->num_ports) { -+ ehci->hcs_params &= ~0xf; /* bits 3:0, ports on HC */ -+ ehci->hcs_params |= ehci->num_ports; -+ } - - ehci->sbrn = HCD_USB2; - ---- a/drivers/usb/host/ehci-platform.c -+++ b/drivers/usb/host/ehci-platform.c -@@ -65,6 +65,9 @@ static int ehci_platform_reset(struct us - - ehci->has_synopsys_hc_bug = pdata->has_synopsys_hc_bug; - -+ if (pdata->num_ports && pdata->num_ports <= 15) -+ ehci->num_ports = pdata->num_ports; -+ - if (pdata->pre_setup) { - retval = pdata->pre_setup(hcd); - if (retval < 0) ---- a/drivers/usb/host/ehci.h -+++ b/drivers/usb/host/ehci.h -@@ -203,6 +203,7 @@ struct ehci_hcd { /* one per controlle - u32 command; - - /* SILICON QUIRKS */ -+ unsigned int num_ports; - unsigned no_selective_suspend:1; - unsigned has_fsl_port_bug:1; /* FreeScale */ - unsigned has_fsl_hs_errata:1; /* Freescale HS quirk */ ---- a/include/linux/usb/ehci_pdriver.h -+++ b/include/linux/usb/ehci_pdriver.h -@@ -43,6 +43,7 @@ struct usb_hcd; - */ - struct usb_ehci_pdata { - int caps_offset; -+ unsigned int num_ports; - unsigned has_tt:1; - unsigned has_synopsys_hc_bug:1; - unsigned big_endian_desc:1; diff --git a/target/linux/bcm63xx/patches-5.15/207-MIPS-BCM63XX-move-device-registration-code-into-its-.patch b/target/linux/bcm63xx/patches-5.15/207-MIPS-BCM63XX-move-device-registration-code-into-its-.patch deleted file mode 100644 index 1d27ec972e0206..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/207-MIPS-BCM63XX-move-device-registration-code-into-its-.patch +++ /dev/null @@ -1,484 +0,0 @@ -From 5a50cb0d53344a2429831b00925d6183d4d332e1 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 9 Mar 2014 03:54:05 +0100 -Subject: [PATCH 40/44] MIPS: BCM63XX: move device registration code into its - own file - -Move device registration code into its own file to allow sharing it -between board implementations. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/boards/Makefile | 1 + - arch/mips/bcm63xx/boards/board_bcm963xx.c | 188 +------------------------- - arch/mips/bcm63xx/boards/board_common.c | 215 ++++++++++++++++++++++++++++++ - arch/mips/bcm63xx/boards/board_common.h | 8 ++ - 4 files changed, 223 insertions(+), 183 deletions(-) - create mode 100644 arch/mips/bcm63xx/boards/board_common.c - create mode 100644 arch/mips/bcm63xx/boards/board_common.h - ---- a/arch/mips/bcm63xx/boards/Makefile -+++ b/arch/mips/bcm63xx/boards/Makefile -@@ -1,2 +1,3 @@ - # SPDX-License-Identifier: GPL-2.0-only -+obj-y += board_common.o - obj-$(CONFIG_BOARD_BCM963XX) += board_bcm963xx.o ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -9,32 +9,20 @@ - #include - #include - #include --#include --#include - #include - #include - #include --#include - #include - #include - #include --#include --#include --#include --#include --#include --#include --#include --#include --#include - #include - -+#include "board_common.h" -+ - #include - - #define HCS_OFFSET_128K 0x20000 - --static struct board_info board; -- - /* - * known 3368 boards - */ -@@ -679,52 +667,6 @@ static const struct board_info __initcon - }; - - /* -- * Register a sane SPROMv2 to make the on-board -- * bcm4318 WLAN work -- */ --#ifdef CONFIG_SSB_PCIHOST --static struct ssb_sprom bcm63xx_sprom = { -- .revision = 0x02, -- .board_rev = 0x17, -- .country_code = 0x0, -- .ant_available_bg = 0x3, -- .pa0b0 = 0x15ae, -- .pa0b1 = 0xfa85, -- .pa0b2 = 0xfe8d, -- .pa1b0 = 0xffff, -- .pa1b1 = 0xffff, -- .pa1b2 = 0xffff, -- .gpio0 = 0xff, -- .gpio1 = 0xff, -- .gpio2 = 0xff, -- .gpio3 = 0xff, -- .maxpwr_bg = 0x004c, -- .itssi_bg = 0x00, -- .boardflags_lo = 0x2848, -- .boardflags_hi = 0x0000, --}; -- --int bcm63xx_get_fallback_sprom(struct ssb_bus *bus, struct ssb_sprom *out) --{ -- if (bus->bustype == SSB_BUSTYPE_PCI) { -- memcpy(out, &bcm63xx_sprom, sizeof(struct ssb_sprom)); -- return 0; -- } else { -- pr_err("unable to fill SPROM for given bustype\n"); -- return -EINVAL; -- } --} --#endif /* CONFIG_SSB_PCIHOST */ -- --/* -- * return board name for /proc/cpuinfo -- */ --const char *board_get_name(void) --{ -- return board.name; --} -- --/* - * early init callback, read nvram data from flash and checksum it - */ - void __init board_prom_init(void) -@@ -783,137 +725,15 @@ void __init board_prom_init(void) - if (strncmp(board_name, bcm963xx_boards[i]->name, 16)) - continue; - /* copy, board desc array is marked initdata */ -- memcpy(&board, bcm963xx_boards[i], sizeof(board)); -+ board_early_setup(bcm963xx_boards[i]); - break; - } - -- /* bail out if board is not found, will complain later */ -- if (!board.name[0]) { -+ /* warn if board is not found, will complain later */ -+ if (i == ARRAY_SIZE(bcm963xx_boards)) { - char name[17]; - memcpy(name, board_name, 16); - name[16] = 0; - pr_err("unknown bcm963xx board: %s\n", name); -- return; -- } -- -- /* setup pin multiplexing depending on board enabled device, -- * this has to be done this early since PCI init is done -- * inside arch_initcall */ -- val = 0; -- --#ifdef CONFIG_PCI -- if (board.has_pci) { -- bcm63xx_pci_enabled = 1; -- if (BCMCPU_IS_6348()) -- val |= GPIO_MODE_6348_G2_PCI; -- } --#endif /* CONFIG_PCI */ -- -- if (board.has_pccard) { -- if (BCMCPU_IS_6348()) -- val |= GPIO_MODE_6348_G1_MII_PCCARD; -- } -- -- if (board.has_enet0 && !board.enet0.use_internal_phy) { -- if (BCMCPU_IS_6348()) -- val |= GPIO_MODE_6348_G3_EXT_MII | -- GPIO_MODE_6348_G0_EXT_MII; -- } -- -- if (board.has_enet1 && !board.enet1.use_internal_phy) { -- if (BCMCPU_IS_6348()) -- val |= GPIO_MODE_6348_G3_EXT_MII | -- GPIO_MODE_6348_G0_EXT_MII; -- } -- -- bcm_gpio_writel(val, GPIO_MODE_REG); --} -- --/* -- * second stage init callback, good time to panic if we couldn't -- * identify on which board we're running since early printk is working -- */ --void __init board_setup(void) --{ -- if (!board.name[0]) -- panic("unable to detect bcm963xx board"); -- pr_info("board name: %s\n", board.name); -- -- /* make sure we're running on expected cpu */ -- if (bcm63xx_get_cpu_id() != board.expected_cpu_id) -- panic("unexpected CPU for bcm963xx board"); --} -- --static struct gpio_led_platform_data bcm63xx_led_data; -- --static struct platform_device bcm63xx_gpio_leds = { -- .name = "leds-gpio", -- .id = 0, -- .dev.platform_data = &bcm63xx_led_data, --}; -- --/* -- * third stage init callback, register all board devices. -- */ --int __init board_register_devices(void) --{ -- if (board.has_uart0) -- bcm63xx_uart_register(0); -- -- if (board.has_uart1) -- bcm63xx_uart_register(1); -- -- if (board.has_pccard) -- bcm63xx_pcmcia_register(); -- -- if (board.has_enet0 && -- !bcm63xx_nvram_get_mac_address(board.enet0.mac_addr)) -- bcm63xx_enet_register(0, &board.enet0); -- -- if (board.has_enet1 && -- !bcm63xx_nvram_get_mac_address(board.enet1.mac_addr)) -- bcm63xx_enet_register(1, &board.enet1); -- -- if (board.has_enetsw && -- !bcm63xx_nvram_get_mac_address(board.enetsw.mac_addr)) -- bcm63xx_enetsw_register(&board.enetsw); -- -- if (board.has_usbd) -- bcm63xx_usbd_register(&board.usbd); -- -- if (board.has_ehci0) -- bcm63xx_ehci_register(); -- -- if (board.has_ohci0) -- bcm63xx_ohci_register(); -- -- /* Generate MAC address for WLAN and register our SPROM, -- * do this after registering enet devices -- */ --#ifdef CONFIG_SSB_PCIHOST -- if (!bcm63xx_nvram_get_mac_address(bcm63xx_sprom.il0mac)) { -- memcpy(bcm63xx_sprom.et0mac, bcm63xx_sprom.il0mac, ETH_ALEN); -- memcpy(bcm63xx_sprom.et1mac, bcm63xx_sprom.il0mac, ETH_ALEN); -- if (ssb_arch_register_fallback_sprom( -- &bcm63xx_get_fallback_sprom) < 0) -- pr_err("failed to register fallback SPROM\n"); - } --#endif /* CONFIG_SSB_PCIHOST */ -- -- bcm63xx_spi_register(); -- -- bcm63xx_hsspi_register(); -- -- bcm63xx_flash_register(); -- -- bcm63xx_led_data.num_leds = ARRAY_SIZE(board.leds); -- bcm63xx_led_data.leds = board.leds; -- -- platform_device_register(&bcm63xx_gpio_leds); -- -- if (board.ephy_reset_gpio && board.ephy_reset_gpio_flags) -- gpio_request_one(board.ephy_reset_gpio, -- board.ephy_reset_gpio_flags, "ephy-reset"); -- -- return 0; - } ---- /dev/null -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -0,0 +1,214 @@ -+/* -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file "COPYING" in the main directory of this archive -+ * for more details. -+ * -+ * Copyright (C) 2008 Maxime Bizon -+ * Copyright (C) 2008 Florian Fainelli -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define PFX "board: " -+ -+static struct board_info board; -+ -+/* -+ * Register a sane SPROMv2 to make the on-board -+ * bcm4318 WLAN work -+ */ -+#ifdef CONFIG_SSB_PCIHOST -+static struct ssb_sprom bcm63xx_sprom = { -+ .revision = 0x02, -+ .board_rev = 0x17, -+ .country_code = 0x0, -+ .ant_available_bg = 0x3, -+ .pa0b0 = 0x15ae, -+ .pa0b1 = 0xfa85, -+ .pa0b2 = 0xfe8d, -+ .pa1b0 = 0xffff, -+ .pa1b1 = 0xffff, -+ .pa1b2 = 0xffff, -+ .gpio0 = 0xff, -+ .gpio1 = 0xff, -+ .gpio2 = 0xff, -+ .gpio3 = 0xff, -+ .maxpwr_bg = 0x004c, -+ .itssi_bg = 0x00, -+ .boardflags_lo = 0x2848, -+ .boardflags_hi = 0x0000, -+}; -+ -+int bcm63xx_get_fallback_sprom(struct ssb_bus *bus, struct ssb_sprom *out) -+{ -+ if (bus->bustype == SSB_BUSTYPE_PCI) { -+ memcpy(out, &bcm63xx_sprom, sizeof(struct ssb_sprom)); -+ return 0; -+ } else { -+ printk(KERN_ERR PFX "unable to fill SPROM for given bustype.\n"); -+ return -EINVAL; -+ } -+} -+#endif -+ -+/* -+ * return board name for /proc/cpuinfo -+ */ -+const char *board_get_name(void) -+{ -+ return board.name; -+} -+ -+/* -+ * setup board for device registration -+ */ -+void __init board_early_setup(const struct board_info *target) -+{ -+ u32 val; -+ -+ memcpy(&board, target, sizeof(board)); -+ -+ /* setup pin multiplexing depending on board enabled device, -+ * this has to be done this early since PCI init is done -+ * inside arch_initcall */ -+ val = 0; -+ -+#ifdef CONFIG_PCI -+ if (board.has_pci) { -+ bcm63xx_pci_enabled = 1; -+ if (BCMCPU_IS_6348()) -+ val |= GPIO_MODE_6348_G2_PCI; -+ } -+#endif -+ -+ if (board.has_pccard) { -+ if (BCMCPU_IS_6348()) -+ val |= GPIO_MODE_6348_G1_MII_PCCARD; -+ } -+ -+ if (board.has_enet0 && !board.enet0.use_internal_phy) { -+ if (BCMCPU_IS_6348()) -+ val |= GPIO_MODE_6348_G3_EXT_MII | -+ GPIO_MODE_6348_G0_EXT_MII; -+ } -+ -+ if (board.has_enet1 && !board.enet1.use_internal_phy) { -+ if (BCMCPU_IS_6348()) -+ val |= GPIO_MODE_6348_G3_EXT_MII | -+ GPIO_MODE_6348_G0_EXT_MII; -+ } -+ -+ bcm_gpio_writel(val, GPIO_MODE_REG); -+} -+ -+ -+/* -+ * second stage init callback, good time to panic if we couldn't -+ * identify on which board we're running since early printk is working -+ */ -+void __init board_setup(void) -+{ -+ if (!board.name[0]) -+ panic("unable to detect bcm963xx board"); -+ printk(KERN_INFO PFX "board name: %s\n", board.name); -+ -+ /* make sure we're running on expected cpu */ -+ if (bcm63xx_get_cpu_id() != board.expected_cpu_id) -+ panic("unexpected CPU for bcm963xx board"); -+} -+ -+static struct gpio_led_platform_data bcm63xx_led_data; -+ -+static struct platform_device bcm63xx_gpio_leds = { -+ .name = "leds-gpio", -+ .id = 0, -+ .dev.platform_data = &bcm63xx_led_data, -+}; -+ -+/* -+ * third stage init callback, register all board devices. -+ */ -+int __init board_register_devices(void) -+{ -+ if (board.has_uart0) -+ bcm63xx_uart_register(0); -+ -+ if (board.has_uart1) -+ bcm63xx_uart_register(1); -+ -+ if (board.has_pccard) -+ bcm63xx_pcmcia_register(); -+ -+ if (board.has_enet0 && -+ !bcm63xx_nvram_get_mac_address(board.enet0.mac_addr)) -+ bcm63xx_enet_register(0, &board.enet0); -+ -+ if (board.has_enet1 && -+ !bcm63xx_nvram_get_mac_address(board.enet1.mac_addr)) -+ bcm63xx_enet_register(1, &board.enet1); -+ -+ if (board.has_enetsw && -+ !bcm63xx_nvram_get_mac_address(board.enetsw.mac_addr)) -+ bcm63xx_enetsw_register(&board.enetsw); -+ -+ if (board.has_usbd) -+ bcm63xx_usbd_register(&board.usbd); -+ -+ if (board.has_ehci0) -+ bcm63xx_ehci_register(); -+ -+ if (board.has_ohci0) -+ bcm63xx_ohci_register(); -+ -+ /* Generate MAC address for WLAN and register our SPROM, -+ * do this after registering enet devices -+ */ -+#ifdef CONFIG_SSB_PCIHOST -+ if (!bcm63xx_nvram_get_mac_address(bcm63xx_sprom.il0mac)) { -+ memcpy(bcm63xx_sprom.et0mac, bcm63xx_sprom.il0mac, ETH_ALEN); -+ memcpy(bcm63xx_sprom.et1mac, bcm63xx_sprom.il0mac, ETH_ALEN); -+ if (ssb_arch_register_fallback_sprom( -+ &bcm63xx_get_fallback_sprom) < 0) -+ pr_err(PFX "failed to register fallback SPROM\n"); -+ } -+#endif -+ -+ bcm63xx_spi_register(); -+ -+ bcm63xx_hsspi_register(); -+ -+ bcm63xx_flash_register(); -+ -+ bcm63xx_led_data.num_leds = ARRAY_SIZE(board.leds); -+ bcm63xx_led_data.leds = board.leds; -+ -+ platform_device_register(&bcm63xx_gpio_leds); -+ -+ if (board.ephy_reset_gpio && board.ephy_reset_gpio_flags) -+ gpio_request_one(board.ephy_reset_gpio, -+ board.ephy_reset_gpio_flags, "ephy-reset"); -+ -+ return 0; -+} ---- /dev/null -+++ b/arch/mips/bcm63xx/boards/board_common.h -@@ -0,0 +1,8 @@ -+#ifndef __BOARD_COMMON_H -+#define __BOARD_COMMON_H -+ -+#include -+ -+void board_early_setup(const struct board_info *board); -+ -+#endif /* __BOARD_COMMON_H */ diff --git a/target/linux/bcm63xx/patches-5.15/208-MIPS-BCM63XX-pass-a-mac-addresss-allocator-to-board-.patch b/target/linux/bcm63xx/patches-5.15/208-MIPS-BCM63XX-pass-a-mac-addresss-allocator-to-board-.patch deleted file mode 100644 index 804cbc92aba30f..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/208-MIPS-BCM63XX-pass-a-mac-addresss-allocator-to-board-.patch +++ /dev/null @@ -1,100 +0,0 @@ -From 4e9c34a37bd3442b286ba55441bfe22c1ac5b65f Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 9 Mar 2014 04:08:06 +0100 -Subject: [PATCH 41/44] MIPS: BCM63XX: pass a mac addresss allocator to board - setup - -Pass a mac address allocator to board setup code to allow board -implementations to work with third party bootloaders not using nvram -for configuration storage. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/boards/board_bcm963xx.c | 3 ++- - arch/mips/bcm63xx/boards/board_common.c | 16 ++++++++++------ - arch/mips/bcm63xx/boards/board_common.h | 3 ++- - 3 files changed, 14 insertions(+), 8 deletions(-) - ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -725,7 +725,8 @@ void __init board_prom_init(void) - if (strncmp(board_name, bcm963xx_boards[i]->name, 16)) - continue; - /* copy, board desc array is marked initdata */ -- board_early_setup(bcm963xx_boards[i]); -+ board_early_setup(bcm963xx_boards[i], -+ bcm63xx_nvram_get_mac_address); - break; - } - ---- a/arch/mips/bcm63xx/boards/board_common.c -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -18,7 +18,6 @@ - #include - #include - #include --#include - #include - #include - #include -@@ -81,15 +80,20 @@ const char *board_get_name(void) - return board.name; - } - -+static int (*board_get_mac_address)(u8 mac[ETH_ALEN]); -+ - /* - * setup board for device registration - */ --void __init board_early_setup(const struct board_info *target) -+void __init board_early_setup(const struct board_info *target, -+ int (*get_mac_address)(u8 mac[ETH_ALEN])) - { - u32 val; - - memcpy(&board, target, sizeof(board)); - -+ board_get_mac_address = get_mac_address; -+ - /* setup pin multiplexing depending on board enabled device, - * this has to be done this early since PCI init is done - * inside arch_initcall */ -@@ -162,15 +166,15 @@ int __init board_register_devices(void) - bcm63xx_pcmcia_register(); - - if (board.has_enet0 && -- !bcm63xx_nvram_get_mac_address(board.enet0.mac_addr)) -+ !board_get_mac_address(board.enet0.mac_addr)) - bcm63xx_enet_register(0, &board.enet0); - - if (board.has_enet1 && -- !bcm63xx_nvram_get_mac_address(board.enet1.mac_addr)) -+ !board_get_mac_address(board.enet1.mac_addr)) - bcm63xx_enet_register(1, &board.enet1); - - if (board.has_enetsw && -- !bcm63xx_nvram_get_mac_address(board.enetsw.mac_addr)) -+ !board_get_mac_address(board.enetsw.mac_addr)) - bcm63xx_enetsw_register(&board.enetsw); - - if (board.has_usbd) -@@ -186,7 +190,7 @@ int __init board_register_devices(void) - * do this after registering enet devices - */ - #ifdef CONFIG_SSB_PCIHOST -- if (!bcm63xx_nvram_get_mac_address(bcm63xx_sprom.il0mac)) { -+ if (!board_get_mac_address(bcm63xx_sprom.il0mac)) { - memcpy(bcm63xx_sprom.et0mac, bcm63xx_sprom.il0mac, ETH_ALEN); - memcpy(bcm63xx_sprom.et1mac, bcm63xx_sprom.il0mac, ETH_ALEN); - if (ssb_arch_register_fallback_sprom( ---- a/arch/mips/bcm63xx/boards/board_common.h -+++ b/arch/mips/bcm63xx/boards/board_common.h -@@ -3,6 +3,7 @@ - - #include - --void board_early_setup(const struct board_info *board); -+void board_early_setup(const struct board_info *board, -+ int (*get_mac_address)(u8 mac[ETH_ALEN])); - - #endif /* __BOARD_COMMON_H */ diff --git a/target/linux/bcm63xx/patches-5.15/320-irqchip-add-support-for-bcm6345-style-periphery-irq-.patch b/target/linux/bcm63xx/patches-5.15/320-irqchip-add-support-for-bcm6345-style-periphery-irq-.patch deleted file mode 100644 index fd52b7aec77350..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/320-irqchip-add-support-for-bcm6345-style-periphery-irq-.patch +++ /dev/null @@ -1,455 +0,0 @@ -From 301744ecbeece89ab3a9d6beef7802fa22598f00 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 30 Nov 2014 14:53:12 +0100 -Subject: [PATCH 1/5] irqchip: add support for bcm6345-style periphery irq - controller - -Signed-off-by: Jonas Gorski ---- - .../brcm,bcm6345-periph-intc.txt | 50 +++ - drivers/irqchip/Kconfig | 4 + - drivers/irqchip/Makefile | 1 + - drivers/irqchip/irq-bcm6345-periph.c | 339 ++++++++++++++++++++ - include/linux/irqchip/irq-bcm6345-periph.h | 16 + - 5 files changed, 410 insertions(+) - create mode 100644 Documentation/devicetree/bindings/interrupt-controller/brcm,bcm6345-periph-intc.txt - create mode 100644 drivers/irqchip/irq-bcm6345-periph.c - create mode 100644 include/linux/irqchip/irq-bcm6345-periph.h - ---- /dev/null -+++ b/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm6345-periph-intc.txt -@@ -0,0 +1,50 @@ -+Broadcom BCM6345 Level 1 periphery interrupt controller -+ -+This block is a interrupt controller that is typically connected directly -+to one of the HW INT lines on each CPU. Every BCM63XX xDSL chip since -+BCM6345 has contained this hardware. -+ -+Key elements of the hardware design include: -+ -+- 32, 64, or 128 incoming level IRQ lines -+ -+- All onchip peripherals are wired directly to an L2 input -+ -+- A separate instance of the register set for each CPU, allowing individual -+ peripheral IRQs to be routed to any CPU -+ -+- No atomic mask/unmask operations -+ -+- No polarity/level/edge settings -+ -+- No FIFO or priority encoder logic; software is expected to read all -+ 1-4 status words to determine which IRQs are pending -+ -+Required properties: -+ -+- compatible: Should be "brcm,bcm6345-periph-intc". -+- reg: Specifies the base physical address and size of the registers. -+ Multiple register addresses may be specified, and must match the amount of -+ parent interrupts. -+- interrupt-controller: Identifies the node as an interrupt controller. -+- #interrupt-cells: Specifies the number of cells needed to encode an interrupt -+ source, should be 1. -+- interrupt-parent: Specifies the phandle to the parent interrupt controller -+ this one is cascaded from. -+- interrupts: Specifies the interrupt line(s) in the interrupt-parent controller -+ node, valid values depend on the type of parent interrupt controller. -+ Multiple lines are used to route interrupts to different cpus, with the first -+ assumed to be for the boot CPU. -+ -+Example: -+ -+periph_intc: interrupt-controller@f0406800 { -+ compatible = "brcm,bcm6345-periph-intc"; -+ reg = <0x10000020 0x10>, <0x10000030 0x10>; -+ -+ interrupt-controller; -+ #interrupt-cells = <1>; -+ -+ interrupt-parent = <&cpu_intc>; -+ interrupts = <2>, <3>; -+}; ---- a/drivers/irqchip/Kconfig -+++ b/drivers/irqchip/Kconfig -@@ -140,6 +140,10 @@ config DAVINCI_CP_INTC - select GENERIC_IRQ_CHIP - select IRQ_DOMAIN - -+config BCM6345_PERIPH_IRQ -+ bool -+ select IRQ_DOMAIN -+ - config DW_APB_ICTL - bool - select GENERIC_IRQ_CHIP ---- a/drivers/irqchip/Makefile -+++ b/drivers/irqchip/Makefile -@@ -17,6 +17,7 @@ obj-$(CONFIG_ARCH_LPC32XX) += irq-lpc32 - obj-$(CONFIG_ARCH_MMP) += irq-mmp.o - obj-$(CONFIG_IRQ_MXS) += irq-mxs.o - obj-$(CONFIG_ARCH_TEGRA) += irq-tegra.o -+obj-$(CONFIG_BCM6345_PERIPH_IRQ) += irq-bcm6345-periph.o - obj-$(CONFIG_DW_APB_ICTL) += irq-dw-apb-ictl.o - obj-$(CONFIG_CLPS711X_IRQCHIP) += irq-clps711x.o - obj-$(CONFIG_OMPIC) += irq-ompic.o ---- /dev/null -+++ b/drivers/irqchip/irq-bcm6345-periph.c -@@ -0,0 +1,339 @@ -+/* -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file "COPYING" in the main directory of this archive -+ * for more details. -+ * -+ * Copyright (C) 2014 Jonas Gorski -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#ifdef CONFIG_BCM63XX -+#include -+ -+#define VIRQ_BASE IRQ_INTERNAL_BASE -+#else -+#define VIRQ_BASE 0 -+#endif -+ -+#define MAX_WORDS 4 -+#define MAX_PARENT_IRQS 2 -+#define IRQS_PER_WORD 32 -+ -+struct intc_block { -+ int parent_irq; -+ void __iomem *base; -+ void __iomem *en_reg[MAX_WORDS]; -+ void __iomem *status_reg[MAX_WORDS]; -+ u32 mask_cache[MAX_WORDS]; -+}; -+ -+struct intc_data { -+ struct irq_chip chip; -+ struct intc_block block[MAX_PARENT_IRQS]; -+ -+ int num_words; -+ -+ struct irq_domain *domain; -+ raw_spinlock_t lock; -+}; -+ -+static void bcm6345_periph_irq_handle(struct irq_desc *desc) -+{ -+ struct intc_data *data = irq_desc_get_handler_data(desc); -+ struct irq_chip *chip = irq_desc_get_chip(desc); -+ struct intc_block *block; -+ unsigned int irq = irq_desc_get_irq(desc); -+ unsigned int idx; -+ -+ chained_irq_enter(chip, desc); -+ -+ for (idx = 0; idx < MAX_PARENT_IRQS; idx++) -+ if (irq == data->block[idx].parent_irq) -+ block = &data->block[idx]; -+ -+ for (idx = 0; idx < data->num_words; idx++) { -+ int base = idx * IRQS_PER_WORD; -+ unsigned long pending; -+ int hw_irq; -+ -+ raw_spin_lock(&data->lock); -+ pending = __raw_readl(block->en_reg[idx]) & -+ __raw_readl(block->status_reg[idx]); -+ raw_spin_unlock(&data->lock); -+ -+ for_each_set_bit(hw_irq, &pending, IRQS_PER_WORD) { -+ int virq; -+ -+ virq = irq_find_mapping(data->domain, base + hw_irq); -+ generic_handle_irq(virq); -+ } -+ } -+ -+ chained_irq_exit(chip, desc); -+} -+ -+static void __bcm6345_periph_enable(struct intc_block *block, int reg, int bit, -+ bool enable) -+{ -+ u32 val; -+ -+ val = __raw_readl(block->en_reg[reg]); -+ if (enable) -+ val |= BIT(bit); -+ else -+ val &= ~BIT(bit); -+ __raw_writel(val, block->en_reg[reg]); -+} -+ -+static void bcm6345_periph_irq_mask(struct irq_data *data) -+{ -+ unsigned int i, reg, bit; -+ struct intc_data *priv = data->domain->host_data; -+ irq_hw_number_t hwirq = irqd_to_hwirq(data); -+ -+ reg = hwirq / IRQS_PER_WORD; -+ bit = hwirq % IRQS_PER_WORD; -+ -+ raw_spin_lock(&priv->lock); -+ for (i = 0; i < MAX_PARENT_IRQS; i++) { -+ struct intc_block *block = &priv->block[i]; -+ -+ if (!block->parent_irq) -+ break; -+ -+ __bcm6345_periph_enable(block, reg, bit, false); -+ } -+ raw_spin_unlock(&priv->lock); -+} -+ -+static void bcm6345_periph_irq_unmask(struct irq_data *data) -+{ -+ struct intc_data *priv = data->domain->host_data; -+ irq_hw_number_t hwirq = irqd_to_hwirq(data); -+ unsigned int i, reg, bit; -+ -+ reg = hwirq / IRQS_PER_WORD; -+ bit = hwirq % IRQS_PER_WORD; -+ -+ raw_spin_lock(&priv->lock); -+ for (i = 0; i < MAX_PARENT_IRQS; i++) { -+ struct intc_block *block = &priv->block[i]; -+ -+ if (!block->parent_irq) -+ break; -+ -+ if (block->mask_cache[reg] & BIT(bit)) -+ __bcm6345_periph_enable(block, reg, bit, true); -+ else -+ __bcm6345_periph_enable(block, reg, bit, false); -+ } -+ raw_spin_unlock(&priv->lock); -+} -+ -+#ifdef CONFIG_SMP -+static int bcm6345_periph_set_affinity(struct irq_data *data, -+ const struct cpumask *mask, bool force) -+{ -+ irq_hw_number_t hwirq = irqd_to_hwirq(data); -+ struct intc_data *priv = data->domain->host_data; -+ unsigned int i, reg, bit; -+ unsigned long flags; -+ bool enabled; -+ int cpu; -+ -+ reg = hwirq / IRQS_PER_WORD; -+ bit = hwirq % IRQS_PER_WORD; -+ -+ /* we could route to more than one cpu, but performance -+ suffers, so fix it to one. -+ */ -+ cpu = cpumask_any_and(mask, cpu_online_mask); -+ if (cpu >= nr_cpu_ids) -+ return -EINVAL; -+ -+ if (cpu >= MAX_PARENT_IRQS) -+ return -EINVAL; -+ -+ if (!priv->block[cpu].parent_irq) -+ return -EINVAL; -+ -+ raw_spin_lock_irqsave(&priv->lock, flags); -+ enabled = !irqd_irq_masked(data); -+ for (i = 0; i < MAX_PARENT_IRQS; i++) { -+ struct intc_block *block = &priv->block[i]; -+ -+ if (!block->parent_irq) -+ break; -+ -+ if (i == cpu) { -+ block->mask_cache[reg] |= BIT(bit); -+ __bcm6345_periph_enable(block, reg, bit, enabled); -+ } else { -+ block->mask_cache[reg] &= ~BIT(bit); -+ __bcm6345_periph_enable(block, reg, bit, false); -+ } -+ } -+ raw_spin_unlock_irqrestore(&priv->lock, flags); -+ -+ return 0; -+} -+#endif -+ -+static int bcm6345_periph_map(struct irq_domain *d, unsigned int irq, -+ irq_hw_number_t hw) -+{ -+ struct intc_data *priv = d->host_data; -+ -+ irq_set_chip_and_handler(irq, &priv->chip, handle_level_irq); -+ -+ return 0; -+} -+ -+static const struct irq_domain_ops bcm6345_periph_domain_ops = { -+ .xlate = irq_domain_xlate_onecell, -+ .map = bcm6345_periph_map, -+}; -+ -+static int __init __bcm6345_periph_intc_init(struct device_node *node, -+ int num_blocks, int *irq, -+ void __iomem **base, int num_words) -+{ -+ struct intc_data *data; -+ unsigned int i, w, status_offset; -+ -+ data = kzalloc(sizeof(*data), GFP_KERNEL); -+ if (!data) -+ return -ENOMEM; -+ -+ raw_spin_lock_init(&data->lock); -+ -+ status_offset = num_words * sizeof(u32); -+ -+ for (i = 0; i < num_blocks; i++) { -+ struct intc_block *block = &data->block[i]; -+ -+ block->parent_irq = irq[i]; -+ block->base = base[i]; -+ -+ for (w = 0; w < num_words; w++) { -+ int word_offset = sizeof(u32) * ((num_words - w) - 1); -+ -+ block->en_reg[w] = base[i] + word_offset; -+ block->status_reg[w] = base[i] + status_offset; -+ block->status_reg[w] += word_offset; -+ -+ /* route all interrupts to line 0 by default */ -+ if (i == 0) -+ block->mask_cache[w] = 0xffffffff; -+ } -+ -+ irq_set_handler_data(block->parent_irq, data); -+ irq_set_chained_handler(block->parent_irq, -+ bcm6345_periph_irq_handle); -+ } -+ -+ data->num_words = num_words; -+ -+ data->chip.name = "bcm6345-periph-intc"; -+ data->chip.irq_mask = bcm6345_periph_irq_mask; -+ data->chip.irq_unmask = bcm6345_periph_irq_unmask; -+ -+#ifdef CONFIG_SMP -+ if (num_blocks > 1) -+ data->chip.irq_set_affinity = bcm6345_periph_set_affinity; -+#endif -+ -+ data->domain = irq_domain_add_simple(node, IRQS_PER_WORD * num_words, -+ VIRQ_BASE, -+ &bcm6345_periph_domain_ops, data); -+ if (!data->domain) { -+ kfree(data); -+ return -EINVAL; -+ } -+ -+ return 0; -+} -+ -+void __init bcm6345_periph_intc_init(int num_blocks, int *irq, -+ void __iomem **base, int num_words) -+{ -+ __bcm6345_periph_intc_init(NULL, num_blocks, irq, base, num_words); -+} -+ -+#ifdef CONFIG_OF -+static int __init bcm6345_periph_of_init(struct device_node *node, -+ struct device_node *parent) -+{ -+ struct resource res; -+ int num_irqs, ret = -EINVAL; -+ int irqs[MAX_PARENT_IRQS] = { 0 }; -+ void __iomem *bases[MAX_PARENT_IRQS] = { NULL }; -+ int words = 0; -+ int i; -+ -+ num_irqs = of_irq_count(node); -+ -+ if (num_irqs < 1 || num_irqs > MAX_PARENT_IRQS) -+ return -EINVAL; -+ -+ for (i = 0; i < num_irqs; i++) { -+ resource_size_t size; -+ -+ irqs[i] = irq_of_parse_and_map(node, i); -+ if (!irqs[i]) -+ goto out_unmap; -+ -+ if (of_address_to_resource(node, i, &res)) -+ goto out_unmap; -+ -+ size = resource_size(&res); -+ switch (size) { -+ case 8: -+ case 16: -+ case 32: -+ size = size / 8; -+ break; -+ default: -+ goto out_unmap; -+ } -+ -+ if (words && words != size) { -+ ret = -EINVAL; -+ goto out_unmap; -+ } -+ words = size; -+ -+ bases[i] = of_iomap(node, i); -+ if (!bases[i]) { -+ ret = -ENOMEM; -+ goto out_unmap; -+ } -+ } -+ -+ ret = __bcm6345_periph_intc_init(node, num_irqs, irqs, bases, words); -+ if (!ret) -+ return 0; -+ -+out_unmap: -+ for (i = 0; i < num_irqs; i++) { -+ iounmap(bases[i]); -+ irq_dispose_mapping(irqs[i]); -+ } -+ -+ return ret; -+} -+ -+IRQCHIP_DECLARE(bcm6345_periph_intc, "brcm,bcm6345-l1-intc", -+ bcm6345_periph_of_init); -+#endif ---- /dev/null -+++ b/include/linux/irqchip/irq-bcm6345-periph.h -@@ -0,0 +1,16 @@ -+/* -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file "COPYING" in the main directory of this archive -+ * for more details. -+ * -+ * Copyright (C) 2008 Maxime Bizon -+ * Copyright (C) 2008 Nicolas Schichan -+ */ -+ -+#ifndef __INCLUDE_LINUX_IRQCHIP_IRQ_BCM6345_PERIPH_H -+#define __INCLUDE_LINUX_IRQCHIP_IRQ_BCM6345_PERIPH_H -+ -+void bcm6345_periph_intc_init(int num_blocks, int *irq, void __iomem **base, -+ int num_words); -+ -+#endif /* __INCLUDE_LINUX_IRQCHIP_IRQ_BCM6345_PERIPH_H */ diff --git a/target/linux/bcm63xx/patches-5.15/321-irqchip-add-support-for-bcm6345-style-external-inter.patch b/target/linux/bcm63xx/patches-5.15/321-irqchip-add-support-for-bcm6345-style-external-inter.patch deleted file mode 100644 index b68f988ee9753b..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/321-irqchip-add-support-for-bcm6345-style-external-inter.patch +++ /dev/null @@ -1,394 +0,0 @@ -From cf908990d4a8ccdb73ee4484aa8cadad379ca314 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 30 Nov 2014 14:54:27 +0100 -Subject: [PATCH 2/5] irqchip: add support for bcm6345-style external - interrupt controller - -Signed-off-by: Jonas Gorski ---- - .../interrupt-controller/brcm,bcm6345-ext-intc.txt | 29 ++ - drivers/irqchip/Kconfig | 4 + - drivers/irqchip/Makefile | 1 + - drivers/irqchip/irq-bcm6345-ext.c | 287 ++++++++++++++++++++ - include/linux/irqchip/irq-bcm6345-ext.h | 14 + - 5 files changed, 335 insertions(+) - create mode 100644 Documentation/devicetree/bindings/interrupt-controller/brcm,bcm6345-ext-intc.txt - create mode 100644 drivers/irqchip/irq-bcm6345-ext.c - create mode 100644 include/linux/irqchip/irq-bcm6345-ext.h - ---- /dev/null -+++ b/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm6345-ext-intc.txt -@@ -0,0 +1,29 @@ -+Broadcom BCM6345-style external interrupt controller -+ -+Required properties: -+ -+- compatible: Should be "brcm,bcm6345-ext-intc" or "brcm,bcm6318-ext-intc". -+- reg: Specifies the base physical addresses and size of the registers. -+- interrupt-controller: identifies the node as an interrupt controller. -+- #interrupt-cells: Specifies the number of cells needed to encode an interrupt -+ source, Should be 2. -+- interrupt-parent: Specifies the phandle to the parent interrupt controller -+ this one is cascaded from. -+- interrupts: Specifies the interrupt line(s) in the interrupt-parent controller -+ node, valid values depend on the type of parent interrupt controller. -+ -+Optional properties: -+ -+- brcm,field-width: Size of each field (mask, clear, sense, ...) in bits in the -+ register. Defaults to 4. -+ -+Example: -+ -+ext_intc: interrupt-controller@10000018 { -+ compatible = "brcm,bcm6345-ext-intc"; -+ interrupt-parent = <&periph_intc>; -+ #interrupt-cells = <2>; -+ reg = <0x10000018 0x4>; -+ interrupt-controller; -+ interrupts = <24>, <25>, <26>, <27>; -+}; ---- a/drivers/irqchip/Kconfig -+++ b/drivers/irqchip/Kconfig -@@ -140,6 +140,10 @@ config DAVINCI_CP_INTC - select GENERIC_IRQ_CHIP - select IRQ_DOMAIN - -+config BCM6345_EXT_IRQ -+ bool -+ select IRQ_DOMAIN -+ - config BCM6345_PERIPH_IRQ - bool - select IRQ_DOMAIN ---- a/drivers/irqchip/Makefile -+++ b/drivers/irqchip/Makefile -@@ -17,6 +17,7 @@ obj-$(CONFIG_ARCH_LPC32XX) += irq-lpc32 - obj-$(CONFIG_ARCH_MMP) += irq-mmp.o - obj-$(CONFIG_IRQ_MXS) += irq-mxs.o - obj-$(CONFIG_ARCH_TEGRA) += irq-tegra.o -+obj-$(CONFIG_BCM6345_EXT_IRQ) += irq-bcm6345-ext.o - obj-$(CONFIG_BCM6345_PERIPH_IRQ) += irq-bcm6345-periph.o - obj-$(CONFIG_DW_APB_ICTL) += irq-dw-apb-ictl.o - obj-$(CONFIG_CLPS711X_IRQCHIP) += irq-clps711x.o ---- /dev/null -+++ b/drivers/irqchip/irq-bcm6345-ext.c -@@ -0,0 +1,301 @@ -+/* -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file "COPYING" in the main directory of this archive -+ * for more details. -+ * -+ * Copyright (C) 2014 Jonas Gorski -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#ifdef CONFIG_BCM63XX -+#include -+ -+#define VIRQ_BASE IRQ_EXTERNAL_BASE -+#else -+#define VIRQ_BASE 0 -+#endif -+ -+#define MAX_IRQS 4 -+ -+#define EXTIRQ_CFG_SENSE 0 -+#define EXTIRQ_CFG_STAT 1 -+#define EXTIRQ_CFG_CLEAR 2 -+#define EXTIRQ_CFG_MASK 3 -+#define EXTIRQ_CFG_BOTHEDGE 4 -+#define EXTIRQ_CFG_LEVELSENSE 5 -+ -+struct intc_data { -+ struct irq_chip chip; -+ struct irq_domain *domain; -+ raw_spinlock_t lock; -+ -+ int parent_irq[MAX_IRQS]; -+ void __iomem *reg; -+ int shift; -+ unsigned int toggle_clear_on_ack:1; -+}; -+ -+static void bcm6345_ext_intc_irq_handle(struct irq_desc *desc) -+{ -+ struct intc_data *data = irq_desc_get_handler_data(desc); -+ struct irq_chip *chip = irq_desc_get_chip(desc); -+ unsigned int irq = irq_desc_get_irq(desc); -+ unsigned int idx; -+ -+ chained_irq_enter(chip, desc); -+ -+ for (idx = 0; idx < MAX_IRQS; idx++) { -+ if (data->parent_irq[idx] != irq) -+ continue; -+ -+ generic_handle_irq(irq_find_mapping(data->domain, idx)); -+ } -+ -+ chained_irq_exit(chip, desc); -+} -+ -+static void bcm6345_ext_intc_irq_ack(struct irq_data *data) -+{ -+ struct intc_data *priv = data->domain->host_data; -+ irq_hw_number_t hwirq = irqd_to_hwirq(data); -+ u32 reg; -+ -+ raw_spin_lock(&priv->lock); -+ reg = __raw_readl(priv->reg); -+ __raw_writel(reg | (1 << (hwirq + EXTIRQ_CFG_CLEAR * priv->shift)), -+ priv->reg); -+ if (priv->toggle_clear_on_ack) -+ __raw_writel(reg, priv->reg); -+ raw_spin_unlock(&priv->lock); -+} -+ -+static void bcm6345_ext_intc_irq_mask(struct irq_data *data) -+{ -+ struct intc_data *priv = data->domain->host_data; -+ irq_hw_number_t hwirq = irqd_to_hwirq(data); -+ u32 reg; -+ -+ raw_spin_lock(&priv->lock); -+ reg = __raw_readl(priv->reg); -+ reg &= ~(1 << (hwirq + EXTIRQ_CFG_MASK * priv->shift)); -+ __raw_writel(reg, priv->reg); -+ raw_spin_unlock(&priv->lock); -+} -+ -+static void bcm6345_ext_intc_irq_unmask(struct irq_data *data) -+{ -+ struct intc_data *priv = data->domain->host_data; -+ irq_hw_number_t hwirq = irqd_to_hwirq(data); -+ u32 reg; -+ -+ raw_spin_lock(&priv->lock); -+ reg = __raw_readl(priv->reg); -+ reg |= 1 << (hwirq + EXTIRQ_CFG_MASK * priv->shift); -+ __raw_writel(reg, priv->reg); -+ raw_spin_unlock(&priv->lock); -+} -+ -+static int bcm6345_ext_intc_set_type(struct irq_data *data, -+ unsigned int flow_type) -+{ -+ struct intc_data *priv = data->domain->host_data; -+ irq_hw_number_t hwirq = irqd_to_hwirq(data); -+ bool levelsense = 0, sense = 0, bothedge = 0; -+ u32 reg; -+ -+ flow_type &= IRQ_TYPE_SENSE_MASK; -+ -+ if (flow_type == IRQ_TYPE_NONE) -+ flow_type = IRQ_TYPE_LEVEL_LOW; -+ -+ switch (flow_type) { -+ case IRQ_TYPE_EDGE_BOTH: -+ bothedge = 1; -+ break; -+ -+ case IRQ_TYPE_EDGE_RISING: -+ sense = 1; -+ break; -+ -+ case IRQ_TYPE_EDGE_FALLING: -+ break; -+ -+ case IRQ_TYPE_LEVEL_HIGH: -+ levelsense = 1; -+ sense = 1; -+ break; -+ -+ case IRQ_TYPE_LEVEL_LOW: -+ levelsense = 1; -+ break; -+ -+ default: -+ pr_err("bogus flow type combination given!\n"); -+ return -EINVAL; -+ } -+ -+ raw_spin_lock(&priv->lock); -+ reg = __raw_readl(priv->reg); -+ -+ if (levelsense) -+ reg |= 1 << (hwirq + EXTIRQ_CFG_LEVELSENSE * priv->shift); -+ else -+ reg &= ~(1 << (hwirq + EXTIRQ_CFG_LEVELSENSE * priv->shift)); -+ if (sense) -+ reg |= 1 << (hwirq + EXTIRQ_CFG_SENSE * priv->shift); -+ else -+ reg &= ~(1 << (hwirq + EXTIRQ_CFG_SENSE * priv->shift)); -+ if (bothedge) -+ reg |= 1 << (hwirq + EXTIRQ_CFG_BOTHEDGE * priv->shift); -+ else -+ reg &= ~(1 << (hwirq + EXTIRQ_CFG_BOTHEDGE * priv->shift)); -+ -+ __raw_writel(reg, priv->reg); -+ raw_spin_unlock(&priv->lock); -+ -+ irqd_set_trigger_type(data, flow_type); -+ if (flow_type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH)) -+ irq_set_handler_locked(data, handle_level_irq); -+ else -+ irq_set_handler_locked(data, handle_edge_irq); -+ -+ return 0; -+} -+ -+static int bcm6345_ext_intc_map(struct irq_domain *d, unsigned int irq, -+ irq_hw_number_t hw) -+{ -+ struct intc_data *priv = d->host_data; -+ -+ irq_set_chip_and_handler(irq, &priv->chip, handle_level_irq); -+ -+ return 0; -+} -+ -+static const struct irq_domain_ops bcm6345_ext_domain_ops = { -+ .xlate = irq_domain_xlate_twocell, -+ .map = bcm6345_ext_intc_map, -+}; -+ -+static int __init __bcm6345_ext_intc_init(struct device_node *node, -+ int num_irqs, int *irqs, -+ void __iomem *reg, int shift, -+ bool toggle_clear_on_ack) -+{ -+ struct intc_data *data; -+ unsigned int i; -+ int start = VIRQ_BASE; -+ -+ data = kzalloc(sizeof(*data), GFP_KERNEL); -+ if (!data) -+ return -ENOMEM; -+ -+ raw_spin_lock_init(&data->lock); -+ -+ for (i = 0; i < num_irqs; i++) { -+ data->parent_irq[i] = irqs[i]; -+ -+ irq_set_handler_data(irqs[i], data); -+ irq_set_chained_handler(irqs[i], bcm6345_ext_intc_irq_handle); -+ } -+ -+ data->reg = reg; -+ data->shift = shift; -+ data->toggle_clear_on_ack = toggle_clear_on_ack; -+ -+ data->chip.name = "bcm6345-ext-intc"; -+ data->chip.irq_ack = bcm6345_ext_intc_irq_ack; -+ data->chip.irq_mask = bcm6345_ext_intc_irq_mask; -+ data->chip.irq_unmask = bcm6345_ext_intc_irq_unmask; -+ data->chip.irq_set_type = bcm6345_ext_intc_set_type; -+ -+ /* -+ * If we have less than 4 irqs, this is the second controller on -+ * bcm63xx. So increase the VIRQ start to not overlap with the first -+ * one, but only do so if we actually use a non-zero start. -+ * -+ * This can be removed when bcm63xx has no legacy users anymore. -+ */ -+ if (start && num_irqs < 4) -+ start += 4; -+ -+ data->domain = irq_domain_add_simple(node, num_irqs, start, -+ &bcm6345_ext_domain_ops, data); -+ if (!data->domain) { -+ kfree(data); -+ return -ENOMEM; -+ } -+ -+ return 0; -+} -+ -+void __init bcm6345_ext_intc_init(int num_irqs, int *irqs, void __iomem *reg, -+ int shift) -+{ -+ __bcm6345_ext_intc_init(NULL, num_irqs, irqs, reg, shift, false); -+} -+ -+#ifdef CONFIG_OF -+static int __init bcm6345_ext_intc_of_init(struct device_node *node, -+ struct device_node *parent) -+{ -+ int num_irqs, ret = -EINVAL; -+ unsigned i; -+ void __iomem *base; -+ int irqs[MAX_IRQS] = { 0 }; -+ u32 shift; -+ bool toggle_clear_on_ack = false; -+ -+ num_irqs = of_irq_count(node); -+ -+ if (!num_irqs || num_irqs > MAX_IRQS) -+ return -EINVAL; -+ -+ if (of_property_read_u32(node, "brcm,field-width", &shift)) -+ shift = 4; -+ -+ /* on BCM6318 setting CLEAR seems to continuously mask interrupts */ -+ if (of_device_is_compatible(node, "brcm,bcm6318-ext-intc")) -+ toggle_clear_on_ack = true; -+ -+ for (i = 0; i < num_irqs; i++) { -+ irqs[i] = irq_of_parse_and_map(node, i); -+ if (!irqs[i]) { -+ ret = -ENOMEM; -+ goto out_unmap; -+ } -+ } -+ -+ base = of_iomap(node, 0); -+ if (!base) -+ goto out_unmap; -+ -+ ret = __bcm6345_ext_intc_init(node, num_irqs, irqs, base, shift, -+ toggle_clear_on_ack); -+ if (!ret) -+ return 0; -+out_unmap: -+ iounmap(base); -+ -+ for (i = 0; i < num_irqs; i++) -+ irq_dispose_mapping(irqs[i]); -+ -+ return ret; -+} -+ -+IRQCHIP_DECLARE(bcm6318_ext_intc, "brcm,bcm6318-ext-intc", -+ bcm6345_ext_intc_of_init); -+IRQCHIP_DECLARE(bcm6345_ext_intc, "brcm,bcm6345-ext-intc", -+ bcm6345_ext_intc_of_init); -+#endif ---- /dev/null -+++ b/include/linux/irqchip/irq-bcm6345-ext.h -@@ -0,0 +1,14 @@ -+/* -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file "COPYING" in the main directory of this archive -+ * for more details. -+ * -+ * Copyright (C) 2014 Jonas Gorski -+ */ -+ -+#ifndef __INCLUDE_LINUX_IRQCHIP_IRQ_BCM6345_EXT_H -+#define __INCLUDE_LINUX_IRQCHIP_IRQ_BCM6345_EXT_H -+ -+void bcm6345_ext_intc_init(int n_irqs, int *irqs, void __iomem *reg, int shift); -+ -+#endif /* __INCLUDE_LINUX_IRQCHIP_IRQ_BCM6345_EXT_H */ diff --git a/target/linux/bcm63xx/patches-5.15/322-MIPS-BCM63XX-switch-to-IRQ_DOMAIN.patch b/target/linux/bcm63xx/patches-5.15/322-MIPS-BCM63XX-switch-to-IRQ_DOMAIN.patch deleted file mode 100644 index c6a8cf1e36661a..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/322-MIPS-BCM63XX-switch-to-IRQ_DOMAIN.patch +++ /dev/null @@ -1,687 +0,0 @@ -From d2d2489e0a4b740abd980e9d1cad952d15bc2d9e Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 30 Nov 2014 14:55:02 +0100 -Subject: [PATCH] MIPS: BCM63XX: switch to IRQ_DOMAIN - -Now that we have working IRQ_DOMAIN drivers for both interrupt controllers, -switch to using them. - -Signed-off-by: Jonas Gorski ---- - arch/mips/Kconfig | 3 + - arch/mips/bcm63xx/irq.c | 612 +++++++++--------------------------------------- - 2 files changed, 108 insertions(+), 507 deletions(-) - ---- a/arch/mips/Kconfig -+++ b/arch/mips/Kconfig -@@ -333,6 +333,9 @@ config BCM63XX - select SYNC_R4K - select DMA_NONCOHERENT - select IRQ_MIPS_CPU -+ select BCM6345_EXT_IRQ -+ select BCM6345_PERIPH_IRQ -+ select IRQ_DOMAIN - select SYS_SUPPORTS_32BIT_KERNEL - select SYS_SUPPORTS_BIG_ENDIAN - select SYS_HAS_EARLY_PRINTK ---- a/arch/mips/bcm63xx/irq.c -+++ b/arch/mips/bcm63xx/irq.c -@@ -11,7 +11,9 @@ - #include - #include - #include --#include -+#include -+#include -+#include - #include - #include - #include -@@ -19,535 +21,140 @@ - #include - #include - -- --static DEFINE_SPINLOCK(ipic_lock); --static DEFINE_SPINLOCK(epic_lock); -- --static u32 irq_stat_addr[2]; --static u32 irq_mask_addr[2]; --static void (*dispatch_internal)(int cpu); --static int is_ext_irq_cascaded; --static unsigned int ext_irq_count; --static unsigned int ext_irq_start, ext_irq_end; --static unsigned int ext_irq_cfg_reg1, ext_irq_cfg_reg2; --static void (*internal_irq_mask)(struct irq_data *d); --static void (*internal_irq_unmask)(struct irq_data *d, const struct cpumask *m); -- -- --static inline u32 get_ext_irq_perf_reg(int irq) --{ -- if (irq < 4) -- return ext_irq_cfg_reg1; -- return ext_irq_cfg_reg2; --} -- --static inline void handle_internal(int intbit) --{ -- if (is_ext_irq_cascaded && -- intbit >= ext_irq_start && intbit <= ext_irq_end) -- do_IRQ(intbit - ext_irq_start + IRQ_EXTERNAL_BASE); -- else -- do_IRQ(intbit + IRQ_INTERNAL_BASE); --} -- --static inline int enable_irq_for_cpu(int cpu, struct irq_data *d, -- const struct cpumask *m) --{ -- bool enable = cpu_online(cpu); -- --#ifdef CONFIG_SMP -- if (m) -- enable &= cpumask_test_cpu(cpu, m); -- else if (irqd_affinity_was_set(d)) -- enable &= cpumask_test_cpu(cpu, irq_data_get_affinity_mask(d)); --#endif -- return enable; --} -- --/* -- * dispatch internal devices IRQ (uart, enet, watchdog, ...). do not -- * prioritize any interrupt relatively to another. the static counter -- * will resume the loop where it ended the last time we left this -- * function. -- */ -- --#define BUILD_IPIC_INTERNAL(width) \ --void __dispatch_internal_##width(int cpu) \ --{ \ -- u32 pending[width / 32]; \ -- unsigned int src, tgt; \ -- bool irqs_pending = false; \ -- static unsigned int i[2]; \ -- unsigned int *next = &i[cpu]; \ -- unsigned long flags; \ -- \ -- /* read registers in reverse order */ \ -- spin_lock_irqsave(&ipic_lock, flags); \ -- for (src = 0, tgt = (width / 32); src < (width / 32); src++) { \ -- u32 val; \ -- \ -- val = bcm_readl(irq_stat_addr[cpu] + src * sizeof(u32)); \ -- val &= bcm_readl(irq_mask_addr[cpu] + src * sizeof(u32)); \ -- pending[--tgt] = val; \ -- \ -- if (val) \ -- irqs_pending = true; \ -- } \ -- spin_unlock_irqrestore(&ipic_lock, flags); \ -- \ -- if (!irqs_pending) \ -- return; \ -- \ -- while (1) { \ -- unsigned int to_call = *next; \ -- \ -- *next = (*next + 1) & (width - 1); \ -- if (pending[to_call / 32] & (1 << (to_call & 0x1f))) { \ -- handle_internal(to_call); \ -- break; \ -- } \ -- } \ --} \ -- \ --static void __internal_irq_mask_##width(struct irq_data *d) \ --{ \ -- u32 val; \ -- unsigned irq = d->irq - IRQ_INTERNAL_BASE; \ -- unsigned reg = (irq / 32) ^ (width/32 - 1); \ -- unsigned bit = irq & 0x1f; \ -- unsigned long flags; \ -- int cpu; \ -- \ -- spin_lock_irqsave(&ipic_lock, flags); \ -- for_each_present_cpu(cpu) { \ -- if (!irq_mask_addr[cpu]) \ -- break; \ -- \ -- val = bcm_readl(irq_mask_addr[cpu] + reg * sizeof(u32));\ -- val &= ~(1 << bit); \ -- bcm_writel(val, irq_mask_addr[cpu] + reg * sizeof(u32));\ -- } \ -- spin_unlock_irqrestore(&ipic_lock, flags); \ --} \ -- \ --static void __internal_irq_unmask_##width(struct irq_data *d, \ -- const struct cpumask *m) \ --{ \ -- u32 val; \ -- unsigned irq = d->irq - IRQ_INTERNAL_BASE; \ -- unsigned reg = (irq / 32) ^ (width/32 - 1); \ -- unsigned bit = irq & 0x1f; \ -- unsigned long flags; \ -- int cpu; \ -- \ -- spin_lock_irqsave(&ipic_lock, flags); \ -- for_each_present_cpu(cpu) { \ -- if (!irq_mask_addr[cpu]) \ -- break; \ -- \ -- val = bcm_readl(irq_mask_addr[cpu] + reg * sizeof(u32));\ -- if (enable_irq_for_cpu(cpu, d, m)) \ -- val |= (1 << bit); \ -- else \ -- val &= ~(1 << bit); \ -- bcm_writel(val, irq_mask_addr[cpu] + reg * sizeof(u32));\ -- } \ -- spin_unlock_irqrestore(&ipic_lock, flags); \ --} -- --BUILD_IPIC_INTERNAL(32); --BUILD_IPIC_INTERNAL(64); -- --asmlinkage void plat_irq_dispatch(void) --{ -- u32 cause; -- -- do { -- cause = read_c0_cause() & read_c0_status() & ST0_IM; -- -- if (!cause) -- break; -- -- if (cause & CAUSEF_IP7) -- do_IRQ(7); -- if (cause & CAUSEF_IP0) -- do_IRQ(0); -- if (cause & CAUSEF_IP1) -- do_IRQ(1); -- if (cause & CAUSEF_IP2) -- dispatch_internal(0); -- if (is_ext_irq_cascaded) { -- if (cause & CAUSEF_IP3) -- dispatch_internal(1); -- } else { -- if (cause & CAUSEF_IP3) -- do_IRQ(IRQ_EXT_0); -- if (cause & CAUSEF_IP4) -- do_IRQ(IRQ_EXT_1); -- if (cause & CAUSEF_IP5) -- do_IRQ(IRQ_EXT_2); -- if (cause & CAUSEF_IP6) -- do_IRQ(IRQ_EXT_3); -- } -- } while (1); --} -- --/* -- * internal IRQs operations: only mask/unmask on PERF irq mask -- * register. -- */ --static void bcm63xx_internal_irq_mask(struct irq_data *d) --{ -- internal_irq_mask(d); --} -- --static void bcm63xx_internal_irq_unmask(struct irq_data *d) --{ -- internal_irq_unmask(d, NULL); --} -- --/* -- * external IRQs operations: mask/unmask and clear on PERF external -- * irq control register. -- */ --static void bcm63xx_external_irq_mask(struct irq_data *d) --{ -- unsigned int irq = d->irq - IRQ_EXTERNAL_BASE; -- u32 reg, regaddr; -- unsigned long flags; -- -- regaddr = get_ext_irq_perf_reg(irq); -- spin_lock_irqsave(&epic_lock, flags); -- reg = bcm_perf_readl(regaddr); -- -- if (BCMCPU_IS_6348()) -- reg &= ~EXTIRQ_CFG_MASK_6348(irq % 4); -- else -- reg &= ~EXTIRQ_CFG_MASK(irq % 4); -- -- bcm_perf_writel(reg, regaddr); -- spin_unlock_irqrestore(&epic_lock, flags); -- -- if (is_ext_irq_cascaded) -- internal_irq_mask(irq_get_irq_data(irq + ext_irq_start)); --} -- --static void bcm63xx_external_irq_unmask(struct irq_data *d) --{ -- unsigned int irq = d->irq - IRQ_EXTERNAL_BASE; -- u32 reg, regaddr; -- unsigned long flags; -- -- regaddr = get_ext_irq_perf_reg(irq); -- spin_lock_irqsave(&epic_lock, flags); -- reg = bcm_perf_readl(regaddr); -- -- if (BCMCPU_IS_6348()) -- reg |= EXTIRQ_CFG_MASK_6348(irq % 4); -- else -- reg |= EXTIRQ_CFG_MASK(irq % 4); -- -- bcm_perf_writel(reg, regaddr); -- spin_unlock_irqrestore(&epic_lock, flags); -- -- if (is_ext_irq_cascaded) -- internal_irq_unmask(irq_get_irq_data(irq + ext_irq_start), -- NULL); --} -- --static void bcm63xx_external_irq_clear(struct irq_data *d) --{ -- unsigned int irq = d->irq - IRQ_EXTERNAL_BASE; -- u32 reg, regaddr; -- unsigned long flags; -- -- regaddr = get_ext_irq_perf_reg(irq); -- spin_lock_irqsave(&epic_lock, flags); -- reg = bcm_perf_readl(regaddr); -- -- if (BCMCPU_IS_6348()) -- reg |= EXTIRQ_CFG_CLEAR_6348(irq % 4); -- else -- reg |= EXTIRQ_CFG_CLEAR(irq % 4); -- -- bcm_perf_writel(reg, regaddr); -- spin_unlock_irqrestore(&epic_lock, flags); --} -- --static int bcm63xx_external_irq_set_type(struct irq_data *d, -- unsigned int flow_type) --{ -- unsigned int irq = d->irq - IRQ_EXTERNAL_BASE; -- u32 reg, regaddr; -- int levelsense, sense, bothedge; -- unsigned long flags; -- -- flow_type &= IRQ_TYPE_SENSE_MASK; -- -- if (flow_type == IRQ_TYPE_NONE) -- flow_type = IRQ_TYPE_LEVEL_LOW; -- -- levelsense = sense = bothedge = 0; -- switch (flow_type) { -- case IRQ_TYPE_EDGE_BOTH: -- bothedge = 1; -- break; -- -- case IRQ_TYPE_EDGE_RISING: -- sense = 1; -- break; -- -- case IRQ_TYPE_EDGE_FALLING: -- break; -- -- case IRQ_TYPE_LEVEL_HIGH: -- levelsense = 1; -- sense = 1; -- break; -- -- case IRQ_TYPE_LEVEL_LOW: -- levelsense = 1; -- break; -- -- default: -- pr_err("bogus flow type combination given !\n"); -- return -EINVAL; -- } -- -- regaddr = get_ext_irq_perf_reg(irq); -- spin_lock_irqsave(&epic_lock, flags); -- reg = bcm_perf_readl(regaddr); -- irq %= 4; -- -- switch (bcm63xx_get_cpu_id()) { -- case BCM6348_CPU_ID: -- if (levelsense) -- reg |= EXTIRQ_CFG_LEVELSENSE_6348(irq); -- else -- reg &= ~EXTIRQ_CFG_LEVELSENSE_6348(irq); -- if (sense) -- reg |= EXTIRQ_CFG_SENSE_6348(irq); -- else -- reg &= ~EXTIRQ_CFG_SENSE_6348(irq); -- if (bothedge) -- reg |= EXTIRQ_CFG_BOTHEDGE_6348(irq); -- else -- reg &= ~EXTIRQ_CFG_BOTHEDGE_6348(irq); -- break; -- -- case BCM3368_CPU_ID: -- case BCM6328_CPU_ID: -- case BCM6338_CPU_ID: -- case BCM6345_CPU_ID: -- case BCM6358_CPU_ID: -- case BCM6362_CPU_ID: -- case BCM6368_CPU_ID: -- if (levelsense) -- reg |= EXTIRQ_CFG_LEVELSENSE(irq); -- else -- reg &= ~EXTIRQ_CFG_LEVELSENSE(irq); -- if (sense) -- reg |= EXTIRQ_CFG_SENSE(irq); -- else -- reg &= ~EXTIRQ_CFG_SENSE(irq); -- if (bothedge) -- reg |= EXTIRQ_CFG_BOTHEDGE(irq); -- else -- reg &= ~EXTIRQ_CFG_BOTHEDGE(irq); -- break; -- default: -- BUG(); -- } -- -- bcm_perf_writel(reg, regaddr); -- spin_unlock_irqrestore(&epic_lock, flags); -- -- irqd_set_trigger_type(d, flow_type); -- if (flow_type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH)) -- irq_set_handler_locked(d, handle_level_irq); -- else -- irq_set_handler_locked(d, handle_edge_irq); -- -- return IRQ_SET_MASK_OK_NOCOPY; --} -- --#ifdef CONFIG_SMP --static int bcm63xx_internal_set_affinity(struct irq_data *data, -- const struct cpumask *dest, -- bool force) --{ -- if (!irqd_irq_disabled(data)) -- internal_irq_unmask(data, dest); -- -- return 0; --} --#endif -- --static struct irq_chip bcm63xx_internal_irq_chip = { -- .name = "bcm63xx_ipic", -- .irq_mask = bcm63xx_internal_irq_mask, -- .irq_unmask = bcm63xx_internal_irq_unmask, --}; -- --static struct irq_chip bcm63xx_external_irq_chip = { -- .name = "bcm63xx_epic", -- .irq_ack = bcm63xx_external_irq_clear, -- -- .irq_mask = bcm63xx_external_irq_mask, -- .irq_unmask = bcm63xx_external_irq_unmask, -- -- .irq_set_type = bcm63xx_external_irq_set_type, --}; -- --static void bcm63xx_init_irq(void) -+void __init arch_init_irq(void) - { -- int irq_bits; -- -- irq_stat_addr[0] = bcm63xx_regset_address(RSET_PERF); -- irq_mask_addr[0] = bcm63xx_regset_address(RSET_PERF); -- irq_stat_addr[1] = bcm63xx_regset_address(RSET_PERF); -- irq_mask_addr[1] = bcm63xx_regset_address(RSET_PERF); -+ void __iomem *periph_bases[2]; -+ void __iomem *ext_intc_bases[2]; -+ int periph_irq_count, periph_width, ext_irq_count, ext_shift; -+ int periph_irqs[2] = { 2, 3 }; -+ int ext_irqs[6]; -+ -+ periph_bases[0] = (void __iomem *)bcm63xx_regset_address(RSET_PERF); -+ periph_bases[1] = (void __iomem *)bcm63xx_regset_address(RSET_PERF); -+ ext_intc_bases[0] = (void __iomem *)bcm63xx_regset_address(RSET_PERF); -+ ext_intc_bases[1] = (void __iomem *)bcm63xx_regset_address(RSET_PERF); - - switch (bcm63xx_get_cpu_id()) { - case BCM3368_CPU_ID: -- irq_stat_addr[0] += PERF_IRQSTAT_3368_REG; -- irq_mask_addr[0] += PERF_IRQMASK_3368_REG; -- irq_stat_addr[1] = 0; -- irq_mask_addr[1] = 0; -- irq_bits = 32; -- ext_irq_count = 4; -- ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_3368; -+ periph_bases[0] += PERF_IRQMASK_3368_REG; -+ periph_irq_count = 1; -+ periph_width = 1; -+ -+ ext_intc_bases[0] += PERF_EXTIRQ_CFG_REG_3368; -+ ext_irq_count = 4; -+ ext_irqs[0] = BCM_3368_EXT_IRQ0; -+ ext_irqs[1] = BCM_3368_EXT_IRQ1; -+ ext_irqs[2] = BCM_3368_EXT_IRQ2; -+ ext_irqs[3] = BCM_3368_EXT_IRQ3; -+ ext_shift = 4; - break; - case BCM6328_CPU_ID: -- irq_stat_addr[0] += PERF_IRQSTAT_6328_REG(0); -- irq_mask_addr[0] += PERF_IRQMASK_6328_REG(0); -- irq_stat_addr[1] += PERF_IRQSTAT_6328_REG(1); -- irq_mask_addr[1] += PERF_IRQMASK_6328_REG(1); -- irq_bits = 64; -- ext_irq_count = 4; -- is_ext_irq_cascaded = 1; -- ext_irq_start = BCM_6328_EXT_IRQ0 - IRQ_INTERNAL_BASE; -- ext_irq_end = BCM_6328_EXT_IRQ3 - IRQ_INTERNAL_BASE; -- ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6328; -+ periph_bases[0] += PERF_IRQMASK_6328_REG(0); -+ periph_bases[1] += PERF_IRQMASK_6328_REG(1); -+ periph_irq_count = 2; -+ periph_width = 2; -+ -+ ext_intc_bases[0] += PERF_EXTIRQ_CFG_REG_6328; -+ ext_irq_count = 4; -+ ext_irqs[0] = BCM_6328_EXT_IRQ0; -+ ext_irqs[1] = BCM_6328_EXT_IRQ1; -+ ext_irqs[2] = BCM_6328_EXT_IRQ2; -+ ext_irqs[3] = BCM_6328_EXT_IRQ3; -+ ext_shift = 4; - break; - case BCM6338_CPU_ID: -- irq_stat_addr[0] += PERF_IRQSTAT_6338_REG; -- irq_mask_addr[0] += PERF_IRQMASK_6338_REG; -- irq_stat_addr[1] = 0; -- irq_mask_addr[1] = 0; -- irq_bits = 32; -- ext_irq_count = 4; -- ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6338; -+ periph_bases[0] += PERF_IRQMASK_6338_REG; -+ periph_irq_count = 1; -+ periph_width = 1; -+ -+ ext_intc_bases[0] += PERF_EXTIRQ_CFG_REG_6338; -+ ext_irq_count = 4; -+ ext_irqs[0] = 3; -+ ext_irqs[1] = 4; -+ ext_irqs[2] = 5; -+ ext_irqs[3] = 6; -+ ext_shift = 4; - break; - case BCM6345_CPU_ID: -- irq_stat_addr[0] += PERF_IRQSTAT_6345_REG; -- irq_mask_addr[0] += PERF_IRQMASK_6345_REG; -- irq_stat_addr[1] = 0; -- irq_mask_addr[1] = 0; -- irq_bits = 32; -- ext_irq_count = 4; -- ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6345; -+ periph_bases[0] += PERF_IRQMASK_6345_REG; -+ periph_irq_count = 1; -+ periph_width = 1; -+ -+ ext_intc_bases[0] += PERF_EXTIRQ_CFG_REG_6345; -+ ext_irq_count = 4; -+ ext_irqs[0] = 3; -+ ext_irqs[1] = 4; -+ ext_irqs[2] = 5; -+ ext_irqs[3] = 6; -+ ext_shift = 4; - break; - case BCM6348_CPU_ID: -- irq_stat_addr[0] += PERF_IRQSTAT_6348_REG; -- irq_mask_addr[0] += PERF_IRQMASK_6348_REG; -- irq_stat_addr[1] = 0; -- irq_mask_addr[1] = 0; -- irq_bits = 32; -- ext_irq_count = 4; -- ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6348; -+ periph_bases[0] += PERF_IRQMASK_6348_REG; -+ periph_irq_count = 1; -+ periph_width = 1; -+ -+ ext_intc_bases[0] += PERF_EXTIRQ_CFG_REG_6348; -+ ext_irq_count = 4; -+ ext_irqs[0] = 3; -+ ext_irqs[1] = 4; -+ ext_irqs[2] = 5; -+ ext_irqs[3] = 6; -+ ext_shift = 5; - break; - case BCM6358_CPU_ID: -- irq_stat_addr[0] += PERF_IRQSTAT_6358_REG(0); -- irq_mask_addr[0] += PERF_IRQMASK_6358_REG(0); -- irq_stat_addr[1] += PERF_IRQSTAT_6358_REG(1); -- irq_mask_addr[1] += PERF_IRQMASK_6358_REG(1); -- irq_bits = 32; -- ext_irq_count = 4; -- is_ext_irq_cascaded = 1; -- ext_irq_start = BCM_6358_EXT_IRQ0 - IRQ_INTERNAL_BASE; -- ext_irq_end = BCM_6358_EXT_IRQ3 - IRQ_INTERNAL_BASE; -- ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6358; -+ periph_bases[0] += PERF_IRQMASK_6358_REG(0); -+ periph_bases[1] += PERF_IRQMASK_6358_REG(1); -+ periph_irq_count = 2; -+ periph_width = 1; -+ -+ ext_intc_bases[0] += PERF_EXTIRQ_CFG_REG_6358; -+ ext_irq_count = 4; -+ ext_irqs[0] = BCM_6358_EXT_IRQ0; -+ ext_irqs[1] = BCM_6358_EXT_IRQ1; -+ ext_irqs[2] = BCM_6358_EXT_IRQ2; -+ ext_irqs[3] = BCM_6358_EXT_IRQ3; -+ ext_shift = 4; - break; - case BCM6362_CPU_ID: -- irq_stat_addr[0] += PERF_IRQSTAT_6362_REG(0); -- irq_mask_addr[0] += PERF_IRQMASK_6362_REG(0); -- irq_stat_addr[1] += PERF_IRQSTAT_6362_REG(1); -- irq_mask_addr[1] += PERF_IRQMASK_6362_REG(1); -- irq_bits = 64; -- ext_irq_count = 4; -- is_ext_irq_cascaded = 1; -- ext_irq_start = BCM_6362_EXT_IRQ0 - IRQ_INTERNAL_BASE; -- ext_irq_end = BCM_6362_EXT_IRQ3 - IRQ_INTERNAL_BASE; -- ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6362; -+ periph_bases[0] += PERF_IRQMASK_6362_REG(0); -+ periph_bases[1] += PERF_IRQMASK_6362_REG(1); -+ periph_irq_count = 2; -+ periph_width = 2; -+ -+ ext_intc_bases[0] += PERF_EXTIRQ_CFG_REG_6362; -+ ext_irq_count = 4; -+ ext_irqs[0] = BCM_6362_EXT_IRQ0; -+ ext_irqs[1] = BCM_6362_EXT_IRQ1; -+ ext_irqs[2] = BCM_6362_EXT_IRQ2; -+ ext_irqs[3] = BCM_6362_EXT_IRQ3; -+ ext_shift = 4; - break; - case BCM6368_CPU_ID: -- irq_stat_addr[0] += PERF_IRQSTAT_6368_REG(0); -- irq_mask_addr[0] += PERF_IRQMASK_6368_REG(0); -- irq_stat_addr[1] += PERF_IRQSTAT_6368_REG(1); -- irq_mask_addr[1] += PERF_IRQMASK_6368_REG(1); -- irq_bits = 64; -- ext_irq_count = 6; -- is_ext_irq_cascaded = 1; -- ext_irq_start = BCM_6368_EXT_IRQ0 - IRQ_INTERNAL_BASE; -- ext_irq_end = BCM_6368_EXT_IRQ5 - IRQ_INTERNAL_BASE; -- ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6368; -- ext_irq_cfg_reg2 = PERF_EXTIRQ_CFG_REG2_6368; -+ periph_bases[0] += PERF_IRQMASK_6368_REG(0); -+ periph_bases[1] += PERF_IRQMASK_6368_REG(1); -+ periph_irq_count = 2; -+ periph_width = 2; -+ -+ ext_intc_bases[0] += PERF_EXTIRQ_CFG_REG_6368; -+ ext_intc_bases[1] += PERF_EXTIRQ_CFG_REG2_6368; -+ ext_irq_count = 6; -+ ext_irqs[0] = BCM_6368_EXT_IRQ0; -+ ext_irqs[1] = BCM_6368_EXT_IRQ1; -+ ext_irqs[2] = BCM_6368_EXT_IRQ2; -+ ext_irqs[3] = BCM_6368_EXT_IRQ3; -+ ext_irqs[4] = BCM_6368_EXT_IRQ4; -+ ext_irqs[5] = BCM_6368_EXT_IRQ5; -+ ext_shift = 4; - break; - default: - BUG(); - } - -- if (irq_bits == 32) { -- dispatch_internal = __dispatch_internal_32; -- internal_irq_mask = __internal_irq_mask_32; -- internal_irq_unmask = __internal_irq_unmask_32; -- } else { -- dispatch_internal = __dispatch_internal_64; -- internal_irq_mask = __internal_irq_mask_64; -- internal_irq_unmask = __internal_irq_unmask_64; -- } --} -- --void __init arch_init_irq(void) --{ -- int i, irq; -- -- bcm63xx_init_irq(); - mips_cpu_irq_init(); -- for (i = IRQ_INTERNAL_BASE; i < NR_IRQS; ++i) -- irq_set_chip_and_handler(i, &bcm63xx_internal_irq_chip, -- handle_level_irq); -- -- for (i = IRQ_EXTERNAL_BASE; i < IRQ_EXTERNAL_BASE + ext_irq_count; ++i) -- irq_set_chip_and_handler(i, &bcm63xx_external_irq_chip, -- handle_edge_irq); -- -- if (!is_ext_irq_cascaded) { -- for (i = 3; i < 3 + ext_irq_count; ++i) { -- irq = MIPS_CPU_IRQ_BASE + i; -- if (request_irq(irq, no_action, IRQF_NO_THREAD, -- "cascade_extirq", NULL)) { -- pr_err("Failed to request irq %d (cascade_extirq)\n", -- irq); -- } -- } -- } -- -- irq = MIPS_CPU_IRQ_BASE + 2; -- if (request_irq(irq, no_action, IRQF_NO_THREAD, "cascade_ip2", NULL)) -- pr_err("Failed to request irq %d (cascade_ip2)\n", irq); --#ifdef CONFIG_SMP -- if (is_ext_irq_cascaded) { -- irq = MIPS_CPU_IRQ_BASE + 3; -- if (request_irq(irq, no_action, IRQF_NO_THREAD, "cascade_ip3", -- NULL)) -- pr_err("Failed to request irq %d (cascade_ip3)\n", irq); -- bcm63xx_internal_irq_chip.irq_set_affinity = -- bcm63xx_internal_set_affinity; -- -- cpumask_clear(irq_default_affinity); -- cpumask_set_cpu(smp_processor_id(), irq_default_affinity); -- } --#endif -+ bcm6345_periph_intc_init(periph_irq_count, periph_irqs, periph_bases, -+ periph_width); -+ bcm6345_ext_intc_init(4, ext_irqs, ext_intc_bases[0], ext_shift); -+ if (ext_irq_count > 4) -+ bcm6345_ext_intc_init(2, &ext_irqs[4], ext_intc_bases[1], -+ ext_shift); - } diff --git a/target/linux/bcm63xx/patches-5.15/323-MIPS-BCM63XX-wire-up-BCM6358-s-external-interrupts-4.patch b/target/linux/bcm63xx/patches-5.15/323-MIPS-BCM63XX-wire-up-BCM6358-s-external-interrupts-4.patch deleted file mode 100644 index e911f0ead5ef5e..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/323-MIPS-BCM63XX-wire-up-BCM6358-s-external-interrupts-4.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 4fd286c3e5a5bebab0391cf1937695b3ed6721a3 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 30 Nov 2014 20:20:30 +0100 -Subject: [PATCH 4/5] MIPS: BCM63XX: wire up BCM6358's external interrupts 4 - and 5 - -Due to the external interrupts being non consecutive, the previous -implementation did not support them. Now that we treat both registers -as separate irq controllers, there is no such limitation anymore and -we can expose them for drivers to use. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/irq.c | 5 ++++- - arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h | 2 ++ - arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h | 1 + - 3 files changed, 7 insertions(+), 1 deletion(-) - ---- a/arch/mips/bcm63xx/irq.c -+++ b/arch/mips/bcm63xx/irq.c -@@ -108,11 +108,14 @@ void __init arch_init_irq(void) - periph_width = 1; - - ext_intc_bases[0] += PERF_EXTIRQ_CFG_REG_6358; -- ext_irq_count = 4; -+ ext_intc_bases[1] += PERF_EXTIRQ_CFG_REG2_6358; -+ ext_irq_count = 6; - ext_irqs[0] = BCM_6358_EXT_IRQ0; - ext_irqs[1] = BCM_6358_EXT_IRQ1; - ext_irqs[2] = BCM_6358_EXT_IRQ2; - ext_irqs[3] = BCM_6358_EXT_IRQ3; -+ ext_irqs[4] = BCM_6358_EXT_IRQ4; -+ ext_irqs[5] = BCM_6358_EXT_IRQ5; - ext_shift = 4; - break; - case BCM6362_CPU_ID: ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h -@@ -896,6 +896,8 @@ enum bcm63xx_irq { - #define BCM_6358_EXT_IRQ1 (IRQ_INTERNAL_BASE + 26) - #define BCM_6358_EXT_IRQ2 (IRQ_INTERNAL_BASE + 27) - #define BCM_6358_EXT_IRQ3 (IRQ_INTERNAL_BASE + 28) -+#define BCM_6358_EXT_IRQ4 (IRQ_INTERNAL_BASE + 20) -+#define BCM_6358_EXT_IRQ5 (IRQ_INTERNAL_BASE + 21) - - /* - * 6362 irqs ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -@@ -244,6 +244,7 @@ - #define PERF_EXTIRQ_CFG_REG_6362 0x18 - #define PERF_EXTIRQ_CFG_REG_6368 0x18 - -+#define PERF_EXTIRQ_CFG_REG2_6358 0x1c - #define PERF_EXTIRQ_CFG_REG2_6368 0x1c - - /* for 6348 only */ diff --git a/target/linux/bcm63xx/patches-5.15/324-irqchip-bcm6345-periph-fix-block-uninitialized.patch b/target/linux/bcm63xx/patches-5.15/324-irqchip-bcm6345-periph-fix-block-uninitialized.patch deleted file mode 100644 index 60a645e1bff05f..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/324-irqchip-bcm6345-periph-fix-block-uninitialized.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/drivers/irqchip/irq-bcm6345-periph.c -+++ b/drivers/irqchip/irq-bcm6345-periph.c -@@ -52,7 +52,7 @@ static void bcm6345_periph_irq_handle(st - { - struct intc_data *data = irq_desc_get_handler_data(desc); - struct irq_chip *chip = irq_desc_get_chip(desc); -- struct intc_block *block; -+ struct intc_block *block = NULL; - unsigned int irq = irq_desc_get_irq(desc); - unsigned int idx; - -@@ -62,7 +62,7 @@ static void bcm6345_periph_irq_handle(st - if (irq == data->block[idx].parent_irq) - block = &data->block[idx]; - -- for (idx = 0; idx < data->num_words; idx++) { -+ for (idx = 0; block && idx < data->num_words; idx++) { - int base = idx * IRQS_PER_WORD; - unsigned long pending; - int hw_irq; diff --git a/target/linux/bcm63xx/patches-5.15/325-irqchip-bcm6345-external-fix-base-uninitialized.patch b/target/linux/bcm63xx/patches-5.15/325-irqchip-bcm6345-external-fix-base-uninitialized.patch deleted file mode 100644 index 45b5118a4a6169..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/325-irqchip-bcm6345-external-fix-base-uninitialized.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- a/drivers/irqchip/irq-bcm6345-ext.c -+++ b/drivers/irqchip/irq-bcm6345-ext.c -@@ -271,21 +271,19 @@ static int __init bcm6345_ext_intc_of_in - - for (i = 0; i < num_irqs; i++) { - irqs[i] = irq_of_parse_and_map(node, i); -- if (!irqs[i]) { -- ret = -ENOMEM; -- goto out_unmap; -- } -+ if (!irqs[i]) -+ return -ENOMEM; - } - - base = of_iomap(node, 0); - if (!base) -- goto out_unmap; -+ return -ENXIO; - - ret = __bcm6345_ext_intc_init(node, num_irqs, irqs, base, shift, - toggle_clear_on_ack); - if (!ret) - return 0; --out_unmap: -+ - iounmap(base); - - for (i = 0; i < num_irqs; i++) diff --git a/target/linux/bcm63xx/patches-5.15/326-irqchip-bcm6345-report-eff-affinity.patch b/target/linux/bcm63xx/patches-5.15/326-irqchip-bcm6345-report-eff-affinity.patch deleted file mode 100644 index f25488575c3ebb..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/326-irqchip-bcm6345-report-eff-affinity.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/drivers/irqchip/irq-bcm6345-periph.c -+++ b/drivers/irqchip/irq-bcm6345-periph.c -@@ -186,6 +186,8 @@ static int bcm6345_periph_set_affinity(s - } - raw_spin_unlock_irqrestore(&priv->lock, flags); - -+ irq_data_update_effective_affinity(data, cpumask_of(cpu)); -+ - return 0; - } - #endif -@@ -197,6 +199,8 @@ static int bcm6345_periph_map(struct irq - - irq_set_chip_and_handler(irq, &priv->chip, handle_level_irq); - -+ irqd_set_single_target(irq_desc_get_irq_data(irq_to_desc(irq))); -+ - return 0; - } - diff --git a/target/linux/bcm63xx/patches-5.15/327-irqchip-bcm6345-periph-clear-on-init.patch b/target/linux/bcm63xx/patches-5.15/327-irqchip-bcm6345-periph-clear-on-init.patch deleted file mode 100644 index a878b34b2175e6..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/327-irqchip-bcm6345-periph-clear-on-init.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/drivers/irqchip/irq-bcm6345-periph.c -+++ b/drivers/irqchip/irq-bcm6345-periph.c -@@ -240,6 +240,9 @@ static int __init __bcm6345_periph_intc_ - /* route all interrupts to line 0 by default */ - if (i == 0) - block->mask_cache[w] = 0xffffffff; -+ -+ /* mask all interrupts */ -+ __raw_writel(0, block->en_reg[w]); - } - - irq_set_handler_data(block->parent_irq, data); diff --git a/target/linux/bcm63xx/patches-5.15/330-MIPS-BCM63XX-add-a-new-cpu-variant-helper.patch b/target/linux/bcm63xx/patches-5.15/330-MIPS-BCM63XX-add-a-new-cpu-variant-helper.patch deleted file mode 100644 index 07d3f9dbc8eeb2..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/330-MIPS-BCM63XX-add-a-new-cpu-variant-helper.patch +++ /dev/null @@ -1,77 +0,0 @@ -From c50acd37b425a8a907a6f7f93aa2e658256e79ce Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sat, 7 Dec 2013 14:08:36 +0100 -Subject: [PATCH 40/53] MIPS: BCM63XX: add a new cpu variant helper - ---- - arch/mips/bcm63xx/cpu.c | 10 ++++++++++ - arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h | 18 ++++++++++++++++++ - 2 files changed, 28 insertions(+) - ---- a/arch/mips/bcm63xx/cpu.c -+++ b/arch/mips/bcm63xx/cpu.c -@@ -27,6 +27,8 @@ EXPORT_SYMBOL(bcm63xx_irqs); - u16 bcm63xx_cpu_id __read_mostly; - EXPORT_SYMBOL(bcm63xx_cpu_id); - -+static u32 bcm63xx_cpu_variant __read_mostly; -+ - static u8 bcm63xx_cpu_rev; - static unsigned int bcm63xx_cpu_freq; - static unsigned int bcm63xx_memory_size; -@@ -99,6 +101,13 @@ static const int bcm6368_irqs[] = { - - }; - -+u32 bcm63xx_get_cpu_variant(void) -+{ -+ return bcm63xx_cpu_variant; -+} -+ -+EXPORT_SYMBOL(bcm63xx_get_cpu_variant); -+ - u8 bcm63xx_get_cpu_rev(void) - { - return bcm63xx_cpu_rev; -@@ -333,6 +342,7 @@ void __init bcm63xx_cpu_init(void) - /* read out CPU type */ - tmp = bcm_readl(chipid_reg); - bcm63xx_cpu_id = (tmp & REV_CHIPID_MASK) >> REV_CHIPID_SHIFT; -+ bcm63xx_cpu_variant = bcm63xx_cpu_id; - bcm63xx_cpu_rev = (tmp & REV_REVID_MASK) >> REV_REVID_SHIFT; - - switch (bcm63xx_cpu_id) { ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h -@@ -20,6 +20,7 @@ - #define BCM6368_CPU_ID 0x6368 - - void __init bcm63xx_cpu_init(void); -+u32 bcm63xx_get_cpu_variant(void); - u8 bcm63xx_get_cpu_rev(void); - unsigned int bcm63xx_get_cpu_freq(void); - -@@ -83,6 +84,23 @@ static inline u16 __pure bcm63xx_get_cpu - #define BCMCPU_IS_6362() (bcm63xx_get_cpu_id() == BCM6362_CPU_ID) - #define BCMCPU_IS_6368() (bcm63xx_get_cpu_id() == BCM6368_CPU_ID) - -+#define BCMCPU_VARIANT_IS_3368() \ -+ (bcm63xx_get_cpu_variant() == BCM3368_CPU_ID) -+#define BCMCPU_VARIANT_IS_6328() \ -+ (bcm63xx_get_cpu_variant() == BCM6328_CPU_ID) -+#define BCMCPU_VARIANT_IS_6338() \ -+ (bcm63xx_get_cpu_variant() == BCM6338_CPU_ID) -+#define BCMCPU_VARIANT_IS_6345() \ -+ (bcm63xx_get_cpu_variant() == BCM6345_CPU_ID) -+#define BCMCPU_VARIANT_IS_6348() \ -+ (bcm63xx_get_cpu_variant() == BCM6348_CPU_ID) -+#define BCMCPU_VARIANT_IS_6358() \ -+ (bcm63xx_get_cpu_cariant() == BCM6358_CPU_ID) -+#define BCMCPU_VARIANT_IS_6362() \ -+ (bcm63xx_get_cpu_variant() == BCM6362_CPU_ID) -+#define BCMCPU_VARIANT_IS_6368() \ -+ (bcm63xx_get_cpu_variant() == BCM6368_CPU_ID) -+ - /* - * While registers sets are (mostly) the same across 63xx CPU, base - * address of these sets do change. diff --git a/target/linux/bcm63xx/patches-5.15/331-MIPS-BCM63XX-define-variant-id-field.patch b/target/linux/bcm63xx/patches-5.15/331-MIPS-BCM63XX-define-variant-id-field.patch deleted file mode 100644 index 57af8368587d22..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/331-MIPS-BCM63XX-define-variant-id-field.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 3bd8e2535265f06f79ed9c0ad788405441e091dc Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sat, 7 Dec 2013 14:22:41 +0100 -Subject: [PATCH 21/45] MIPS: BCM63XX: define variant id field - -Some SoC have a variant id field in the chip id register. - -Signed-off-by: Jonas Gorski ---- - arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -@@ -10,6 +10,8 @@ - #define PERF_REV_REG 0x0 - #define REV_CHIPID_SHIFT 16 - #define REV_CHIPID_MASK (0xffff << REV_CHIPID_SHIFT) -+#define REV_VARID_SHIFT 12 -+#define REV_VARID_MASK (0xf << REV_VARID_SHIFT) - #define REV_REVID_SHIFT 0 - #define REV_REVID_MASK (0xff << REV_REVID_SHIFT) - diff --git a/target/linux/bcm63xx/patches-5.15/332-MIPS-BCM63XX-detect-BCM6328-variants.patch b/target/linux/bcm63xx/patches-5.15/332-MIPS-BCM63XX-detect-BCM6328-variants.patch deleted file mode 100644 index a05a4b3e246492..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/332-MIPS-BCM63XX-detect-BCM6328-variants.patch +++ /dev/null @@ -1,68 +0,0 @@ -From d59120f23279ef62a48d9f94847254b061d0a8b6 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sat, 7 Dec 2013 14:30:59 +0100 -Subject: [PATCH 22/45] MIPS: BCM63XX: detect BCM6328 variants - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/cpu.c | 10 ++++++++++ - arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h | 8 ++++++-- - 2 files changed, 16 insertions(+), 2 deletions(-) - ---- a/arch/mips/bcm63xx/cpu.c -+++ b/arch/mips/bcm63xx/cpu.c -@@ -305,6 +305,7 @@ void __init bcm63xx_cpu_init(void) - unsigned int tmp; - unsigned int cpu = smp_processor_id(); - u32 chipid_reg; -+ u8 __maybe_unused varid = 0; - - /* soc registers location depends on cpu type */ - chipid_reg = 0; -@@ -344,6 +345,7 @@ void __init bcm63xx_cpu_init(void) - bcm63xx_cpu_id = (tmp & REV_CHIPID_MASK) >> REV_CHIPID_SHIFT; - bcm63xx_cpu_variant = bcm63xx_cpu_id; - bcm63xx_cpu_rev = (tmp & REV_REVID_MASK) >> REV_REVID_SHIFT; -+ varid = (tmp & REV_VARID_MASK) >> REV_VARID_SHIFT; - - switch (bcm63xx_cpu_id) { - case BCM3368_CPU_ID: -@@ -353,6 +355,14 @@ void __init bcm63xx_cpu_init(void) - case BCM6328_CPU_ID: - bcm63xx_regs_base = bcm6328_regs_base; - bcm63xx_irqs = bcm6328_irqs; -+ -+ if (varid == 1) -+ bcm63xx_cpu_variant = BCM63281_CPU_ID; -+ else if (varid == 3) -+ bcm63xx_cpu_variant = BCM63283_CPU_ID; -+ else -+ pr_warn("unknown BCM6328 variant: %x\n", varid); -+ - break; - case BCM6338_CPU_ID: - bcm63xx_regs_base = bcm6338_regs_base; ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h -@@ -12,6 +12,8 @@ - */ - #define BCM3368_CPU_ID 0x3368 - #define BCM6328_CPU_ID 0x6328 -+#define BCM63281_CPU_ID 0x63281 -+#define BCM63283_CPU_ID 0x63283 - #define BCM6338_CPU_ID 0x6338 - #define BCM6345_CPU_ID 0x6345 - #define BCM6348_CPU_ID 0x6348 -@@ -86,8 +88,10 @@ static inline u16 __pure bcm63xx_get_cpu - - #define BCMCPU_VARIANT_IS_3368() \ - (bcm63xx_get_cpu_variant() == BCM3368_CPU_ID) --#define BCMCPU_VARIANT_IS_6328() \ -- (bcm63xx_get_cpu_variant() == BCM6328_CPU_ID) -+#define BCMCPU_VARIANT_IS_63281() \ -+ (bcm63xx_get_cpu_variant() == BCM63281_CPU_ID) -+#define BCMCPU_VARIANT_IS_63283() \ -+ (bcm63xx_get_cpu_variant() == BCM63283_CPU_ID) - #define BCMCPU_VARIANT_IS_6338() \ - (bcm63xx_get_cpu_variant() == BCM6338_CPU_ID) - #define BCMCPU_VARIANT_IS_6345() \ diff --git a/target/linux/bcm63xx/patches-5.15/333-MIPS-BCM63XX-detect-BCM6362-variants.patch b/target/linux/bcm63xx/patches-5.15/333-MIPS-BCM63XX-detect-BCM6362-variants.patch deleted file mode 100644 index 2efbf36d3241c1..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/333-MIPS-BCM63XX-detect-BCM6362-variants.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 04458c3db8eb79da21ecde40ab36a1dde52bef06 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sat, 7 Dec 2013 14:33:28 +0100 -Subject: [PATCH 23/45] MIPS: BCM63XX: detect BCM6362 variants - ---- - arch/mips/bcm63xx/cpu.c | 8 ++++++++ - arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h | 3 +++ - 2 files changed, 11 insertions(+) - ---- a/arch/mips/bcm63xx/cpu.c -+++ b/arch/mips/bcm63xx/cpu.c -@@ -383,6 +383,14 @@ void __init bcm63xx_cpu_init(void) - case BCM6362_CPU_ID: - bcm63xx_regs_base = bcm6362_regs_base; - bcm63xx_irqs = bcm6362_irqs; -+ -+ if (varid == 1) -+ bcm63xx_cpu_variant = BCM6362_CPU_ID; -+ else if (varid == 2) -+ bcm63xx_cpu_variant = BCM6361_CPU_ID; -+ else -+ pr_warn("unknown BCM6362 variant: %x\n", varid); -+ - break; - case BCM6368_CPU_ID: - bcm63xx_regs_base = bcm6368_regs_base; ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h -@@ -18,6 +18,7 @@ - #define BCM6345_CPU_ID 0x6345 - #define BCM6348_CPU_ID 0x6348 - #define BCM6358_CPU_ID 0x6358 -+#define BCM6361_CPU_ID 0x6361 - #define BCM6362_CPU_ID 0x6362 - #define BCM6368_CPU_ID 0x6368 - -@@ -100,6 +101,8 @@ static inline u16 __pure bcm63xx_get_cpu - (bcm63xx_get_cpu_variant() == BCM6348_CPU_ID) - #define BCMCPU_VARIANT_IS_6358() \ - (bcm63xx_get_cpu_cariant() == BCM6358_CPU_ID) -+#define BCMCPU_VARIANT_IS_6361() \ -+ (bcm63xx_get_cpu_variant() == BCM6361_CPU_ID) - #define BCMCPU_VARIANT_IS_6362() \ - (bcm63xx_get_cpu_variant() == BCM6362_CPU_ID) - #define BCMCPU_VARIANT_IS_6368() \ diff --git a/target/linux/bcm63xx/patches-5.15/334-MIPS-BCM63XX-detect-BCM6368-variants.patch b/target/linux/bcm63xx/patches-5.15/334-MIPS-BCM63XX-detect-BCM6368-variants.patch deleted file mode 100644 index 64bcd8f19b00df..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/334-MIPS-BCM63XX-detect-BCM6368-variants.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 825cc67e56b5e624a05f6850a86d91508b786848 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sat, 7 Dec 2013 14:36:56 +0100 -Subject: [PATCH 24/44] MIPS: BCM63XX: detect BCM6368 variants - -The DSL-less BCM6368 variant BCM6367 uses a different chip id. Apart -from missing DSL, there is no difference to BCM6368, so treat it such. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/cpu.c | 4 ++++ - arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h | 3 +++ - 2 files changed, 7 insertions(+) - ---- a/arch/mips/bcm63xx/cpu.c -+++ b/arch/mips/bcm63xx/cpu.c -@@ -393,8 +393,12 @@ void __init bcm63xx_cpu_init(void) - - break; - case BCM6368_CPU_ID: -+ case BCM6369_CPU_ID: - bcm63xx_regs_base = bcm6368_regs_base; - bcm63xx_irqs = bcm6368_irqs; -+ -+ /* BCM6369 is a BCM6368 without xDSL, so treat it the same */ -+ bcm63xx_cpu_id = BCM6368_CPU_ID; - break; - default: - panic("unsupported broadcom CPU %x", bcm63xx_cpu_id); ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h -@@ -21,6 +21,7 @@ - #define BCM6361_CPU_ID 0x6361 - #define BCM6362_CPU_ID 0x6362 - #define BCM6368_CPU_ID 0x6368 -+#define BCM6369_CPU_ID 0x6369 - - void __init bcm63xx_cpu_init(void); - u32 bcm63xx_get_cpu_variant(void); -@@ -107,6 +108,8 @@ static inline u16 __pure bcm63xx_get_cpu - (bcm63xx_get_cpu_variant() == BCM6362_CPU_ID) - #define BCMCPU_VARIANT_IS_6368() \ - (bcm63xx_get_cpu_variant() == BCM6368_CPU_ID) -+#define BCMCPU_VARIANT_IS_6369() \ -+ (bcm63xx_get_cpu_variant() == BCM6369_CPU_ID) - - /* - * While registers sets are (mostly) the same across 63xx CPU, base diff --git a/target/linux/bcm63xx/patches-5.15/335-MIPS-BCM63XX-fix-PCIe-memory-window-size.patch b/target/linux/bcm63xx/patches-5.15/335-MIPS-BCM63XX-fix-PCIe-memory-window-size.patch deleted file mode 100644 index 54900d72ab49dc..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/335-MIPS-BCM63XX-fix-PCIe-memory-window-size.patch +++ /dev/null @@ -1,20 +0,0 @@ -From f67f8134b4537c8bbafe7e1975edfe808b813997 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 8 Dec 2013 03:05:54 +0100 -Subject: [PATCH 45/53] MIPS: BCM63XX: fix PCIe memory window size - ---- - arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h -@@ -42,7 +42,7 @@ - BCM_CB_MEM_SIZE - 1) - - #define BCM_PCIE_MEM_BASE_PA 0x10f00000 --#define BCM_PCIE_MEM_SIZE (16 * 1024 * 1024) -+#define BCM_PCIE_MEM_SIZE (1 * 1024 * 1024) - #define BCM_PCIE_MEM_END_PA (BCM_PCIE_MEM_BASE_PA + \ - BCM_PCIE_MEM_SIZE - 1) - diff --git a/target/linux/bcm63xx/patches-5.15/336-MIPS-BCM63XX-dynamically-set-the-pcie-memory-windows.patch b/target/linux/bcm63xx/patches-5.15/336-MIPS-BCM63XX-dynamically-set-the-pcie-memory-windows.patch deleted file mode 100644 index 05142a8e46462d..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/336-MIPS-BCM63XX-dynamically-set-the-pcie-memory-windows.patch +++ /dev/null @@ -1,70 +0,0 @@ -From aa05464973bc176478af462ca7c53a9239c651d4 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 8 Dec 2013 03:13:06 +0100 -Subject: [PATCH 46/53] MIPS: BCM63XX: dynamically set the pcie memory windows - -Different SoCs use different memory windows (and sizes), so don't -hardcode it. ---- - arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h | 8 ++++---- - arch/mips/pci/pci-bcm63xx.c | 15 ++++++++++----- - 2 files changed, 14 insertions(+), 9 deletions(-) - ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h -@@ -41,10 +41,10 @@ - #define BCM_CB_MEM_END_PA (BCM_CB_MEM_BASE_PA + \ - BCM_CB_MEM_SIZE - 1) - --#define BCM_PCIE_MEM_BASE_PA 0x10f00000 --#define BCM_PCIE_MEM_SIZE (1 * 1024 * 1024) --#define BCM_PCIE_MEM_END_PA (BCM_PCIE_MEM_BASE_PA + \ -- BCM_PCIE_MEM_SIZE - 1) -+#define BCM_PCIE_MEM_BASE_PA_6328 0x10f00000 -+#define BCM_PCIE_MEM_SIZE_6328 (1 * 1024 * 1024) -+#define BCM_PCIE_MEM_END_PA_6328 (BCM_PCIE_MEM_BASE_PA_6328 + \ -+ BCM_PCIE_MEM_SIZE_6328 - 1) - - /* - * Internal registers are accessed through KSEG3 ---- a/arch/mips/pci/pci-bcm63xx.c -+++ b/arch/mips/pci/pci-bcm63xx.c -@@ -77,8 +77,8 @@ struct pci_controller bcm63xx_cb_control - - static struct resource bcm_pcie_mem_resource = { - .name = "bcm63xx PCIe memory space", -- .start = BCM_PCIE_MEM_BASE_PA, -- .end = BCM_PCIE_MEM_END_PA, -+ .start = 0, -+ .end = 0, - .flags = IORESOURCE_MEM, - }; - -@@ -195,12 +195,12 @@ static int __init bcm63xx_register_pcie( - bcm_pcie_writel(val, PCIE_CONFIG2_REG); - - /* set bar0 to little endian */ -- val = (BCM_PCIE_MEM_BASE_PA >> 20) << BASEMASK_BASE_SHIFT; -- val |= (BCM_PCIE_MEM_BASE_PA >> 20) << BASEMASK_MASK_SHIFT; -+ val = (bcm_pcie_mem_resource.start >> 20) << BASEMASK_BASE_SHIFT; -+ val |= (bcm_pcie_mem_resource.end >> 20) << BASEMASK_MASK_SHIFT; - val |= BASEMASK_REMAP_EN; - bcm_pcie_writel(val, PCIE_BRIDGE_BAR0_BASEMASK_REG); - -- val = (BCM_PCIE_MEM_BASE_PA >> 20) << REBASE_ADDR_BASE_SHIFT; -+ val = (bcm_pcie_mem_resource.start >> 20) << REBASE_ADDR_BASE_SHIFT; - bcm_pcie_writel(val, PCIE_BRIDGE_BAR0_REBASE_ADDR_REG); - - register_pci_controller(&bcm63xx_pcie_controller); -@@ -334,6 +334,11 @@ static int __init bcm63xx_pci_init(void) - if (!bcm63xx_pci_enabled) - return -ENODEV; - -+ if (BCMCPU_IS_6328() || BCMCPU_IS_6362()) { -+ bcm_pcie_mem_resource.start = BCM_PCIE_MEM_BASE_PA_6328; -+ bcm_pcie_mem_resource.end = BCM_PCIE_MEM_END_PA_6328; -+ } -+ - switch (bcm63xx_get_cpu_id()) { - case BCM6328_CPU_ID: - case BCM6362_CPU_ID: diff --git a/target/linux/bcm63xx/patches-5.15/337-MIPS-BCM63XX-widen-cpuid-field.patch b/target/linux/bcm63xx/patches-5.15/337-MIPS-BCM63XX-widen-cpuid-field.patch deleted file mode 100644 index c38b4311259e21..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/337-MIPS-BCM63XX-widen-cpuid-field.patch +++ /dev/null @@ -1,56 +0,0 @@ -From f1477f6e3551fd6beecfee5368fed1325dcd421f Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sat, 7 Dec 2013 14:54:51 +0100 -Subject: [PATCH 47/53] MIPS: BCM63XX: widen cpuid field - ---- - arch/mips/bcm63xx/cpu.c | 2 +- - arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h | 8 ++++---- - 2 files changed, 5 insertions(+), 5 deletions(-) - ---- a/arch/mips/bcm63xx/cpu.c -+++ b/arch/mips/bcm63xx/cpu.c -@@ -24,7 +24,7 @@ EXPORT_SYMBOL(bcm63xx_regs_base); - const int *bcm63xx_irqs; - EXPORT_SYMBOL(bcm63xx_irqs); - --u16 bcm63xx_cpu_id __read_mostly; -+u32 bcm63xx_cpu_id __read_mostly; - EXPORT_SYMBOL(bcm63xx_cpu_id); - - static u32 bcm63xx_cpu_variant __read_mostly; -@@ -127,7 +127,7 @@ unsigned int bcm63xx_get_memory_size(voi - - static unsigned int detect_cpu_clock(void) - { -- u16 cpu_id = bcm63xx_get_cpu_id(); -+ u32 cpu_id = bcm63xx_get_cpu_id(); - - switch (cpu_id) { - case BCM3368_CPU_ID: ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h -@@ -28,7 +28,7 @@ u32 bcm63xx_get_cpu_variant(void); - u8 bcm63xx_get_cpu_rev(void); - unsigned int bcm63xx_get_cpu_freq(void); - --static inline u16 __pure __bcm63xx_get_cpu_id(const u16 cpu_id) -+static inline u32 __pure __bcm63xx_get_cpu_id(const u32 cpu_id) - { - switch (cpu_id) { - #ifdef CONFIG_BCM63XX_CPU_3368 -@@ -70,11 +70,11 @@ static inline u16 __pure __bcm63xx_get_c - return cpu_id; - } - --extern u16 bcm63xx_cpu_id; -+extern u32 bcm63xx_cpu_id; - --static inline u16 __pure bcm63xx_get_cpu_id(void) -+static inline u32 __pure bcm63xx_get_cpu_id(void) - { -- const u16 cpu_id = bcm63xx_cpu_id; -+ const u32 cpu_id = bcm63xx_cpu_id; - - return __bcm63xx_get_cpu_id(cpu_id); - } diff --git a/target/linux/bcm63xx/patches-5.15/338-MIPS-BCM63XX-increase-number-of-IRQs.patch b/target/linux/bcm63xx/patches-5.15/338-MIPS-BCM63XX-increase-number-of-IRQs.patch deleted file mode 100644 index 1809a3cac48202..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/338-MIPS-BCM63XX-increase-number-of-IRQs.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 6f5658c845cf1f79213b1d20423a04967259fdaa Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 15 Dec 2013 20:46:26 +0100 -Subject: [PATCH 48/53] MIPS: BCM63XX: increase number of IRQs - -Newer SoCs have 128 bit wide irq registers, thus 128 available internal -interupts. ---- - arch/mips/include/asm/mach-bcm63xx/bcm63xx_irq.h | 4 +++- - arch/mips/include/asm/mach-bcm63xx/irq.h | 2 +- - 2 files changed, 4 insertions(+), 2 deletions(-) - ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_irq.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_irq.h -@@ -2,10 +2,12 @@ - #ifndef BCM63XX_IRQ_H_ - #define BCM63XX_IRQ_H_ - -+#include - #include - - #define IRQ_INTERNAL_BASE 8 --#define IRQ_EXTERNAL_BASE 100 -+#define NR_INTERNAL_IRQS 128 -+#define IRQ_EXTERNAL_BASE (IRQ_INTERNAL_BASE + NR_INTERNAL_IRQS) - #define IRQ_EXT_0 (IRQ_EXTERNAL_BASE + 0) - #define IRQ_EXT_1 (IRQ_EXTERNAL_BASE + 1) - #define IRQ_EXT_2 (IRQ_EXTERNAL_BASE + 2) ---- a/arch/mips/include/asm/mach-bcm63xx/irq.h -+++ b/arch/mips/include/asm/mach-bcm63xx/irq.h -@@ -2,7 +2,7 @@ - #ifndef __ASM_MACH_BCM63XX_IRQ_H - #define __ASM_MACH_BCM63XX_IRQ_H - --#define NR_IRQS 128 -+#define NR_IRQS 256 - #define MIPS_CPU_IRQ_BASE 0 - - #endif diff --git a/target/linux/bcm63xx/patches-5.15/339-MIPS-BCM63XX-add-support-for-BCM63268.patch b/target/linux/bcm63xx/patches-5.15/339-MIPS-BCM63XX-add-support-for-BCM63268.patch deleted file mode 100644 index 50732865a4f484..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/339-MIPS-BCM63XX-add-support-for-BCM63268.patch +++ /dev/null @@ -1,774 +0,0 @@ -From 98f63141190ac02c58b78d58f771bd263c61d756 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sat, 7 Dec 2013 17:14:17 +0100 -Subject: [PATCH 48/56] MIPS: BCM63XX: add support for BCM63268 - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/Kconfig | 5 + - arch/mips/bcm63xx/boards/board_bcm963xx.c | 2 +- - arch/mips/bcm63xx/clk.c | 25 ++++- - arch/mips/bcm63xx/cpu.c | 59 +++++++++- - arch/mips/bcm63xx/dev-flash.c | 6 + - arch/mips/bcm63xx/dev-spi.c | 4 +- - arch/mips/bcm63xx/irq.c | 20 +++- - arch/mips/bcm63xx/reset.c | 21 ++++ - arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h | 130 ++++++++++++++++++++++ - arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h | 2 + - arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h | 79 +++++++++++++ - arch/mips/include/asm/mach-bcm63xx/ioremap.h | 1 + - 12 files changed, 342 insertions(+), 12 deletions(-) - ---- a/arch/mips/bcm63xx/Kconfig -+++ b/arch/mips/bcm63xx/Kconfig -@@ -61,6 +61,11 @@ config BCM63XX_CPU_6368 - select HAVE_PCI - select BCM63XX_OHCI - select BCM63XX_EHCI -+ -+config BCM63XX_CPU_63268 -+ bool "support 63268 CPU" -+ select SYS_HAS_CPU_BMIPS4350 -+ select HAVE_PCI - endmenu - - source "arch/mips/bcm63xx/boards/Kconfig" ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -681,7 +681,7 @@ void __init board_prom_init(void) - /* read base address of boot chip select (0) - * 6328/6362 do not have MPI but boot from a fixed address - */ -- if (BCMCPU_IS_6328() || BCMCPU_IS_6362()) { -+ if (BCMCPU_IS_6328() || BCMCPU_IS_6362() || BCMCPU_IS_63268()) { - val = 0x18000000; - } else { - val = bcm_mpi_readl(MPI_CSBASE_REG(0)); ---- a/arch/mips/bcm63xx/clk.c -+++ b/arch/mips/bcm63xx/clk.c -@@ -52,6 +52,18 @@ static void bcm_hwclock_set(u32 mask, in - bcm_perf_writel(reg, PERF_CKCTL_REG); - } - -+static void bcm_gpiorobosw_set(u32 mask, int enable) -+{ -+ u32 reg; -+ -+ reg = bcm_gpio_readl(GPIO_ROBOSW_SW_CTRL_REG); -+ if (enable) -+ reg |= mask; -+ else -+ reg &= ~mask; -+ bcm_gpio_writel(reg, GPIO_ROBOSW_SW_CTRL_REG); -+} -+ - /* - * Ethernet MAC "misc" clock: dma clocks and main clock on 6348 - */ -@@ -169,6 +181,10 @@ static void enetsw_set(struct clk *clk, - clk_disable_unlocked(&clk_swpkt_sar); - } - bcm_hwclock_set(CKCTL_6368_ROBOSW_EN, enable); -+ } else if (BCMCPU_IS_63268()) { -+ bcm_gpiorobosw_set(GPIO_ROBOSW_MII_DUMB_FWDG_EN | -+ GPIO_ROBOSW_HW_FWDG_EN, enable); -+ bcm_hwclock_set(CKCTL_63268_ROBOSW_EN, enable); - } else { - return; - } -@@ -214,6 +230,8 @@ static void usbh_set(struct clk *clk, in - bcm_hwclock_set(CKCTL_6362_USBH_EN, enable); - else if (BCMCPU_IS_6368()) - bcm_hwclock_set(CKCTL_6368_USBH_EN, enable); -+ else if (BCMCPU_IS_63268()) -+ bcm_hwclock_set(CKCTL_63268_USBH_EN, enable); - else - return; - -@@ -236,6 +254,8 @@ static void usbd_set(struct clk *clk, in - bcm_hwclock_set(CKCTL_6362_USBD_EN, enable); - else if (BCMCPU_IS_6368()) - bcm_hwclock_set(CKCTL_6368_USBD_EN, enable); -+ else if (BCMCPU_IS_63268()) -+ bcm_hwclock_set(CKCTL_63268_USBD_EN, enable); - else - return; - -@@ -262,9 +282,13 @@ static void spi_set(struct clk *clk, int - mask = CKCTL_6358_SPI_EN; - else if (BCMCPU_IS_6362()) - mask = CKCTL_6362_SPI_EN; -- else -- /* BCMCPU_IS_6368 */ -+ else if (BCMCPU_IS_6368()) - mask = CKCTL_6368_SPI_EN; -+ else if (BCMCPU_IS_63268()) -+ mask = CKCTL_63268_SPI_EN; -+ else -+ return; -+ - bcm_hwclock_set(mask, enable); - } - -@@ -283,6 +307,8 @@ static void hsspi_set(struct clk *clk, i - mask = CKCTL_6328_HSSPI_EN; - else if (BCMCPU_IS_6362()) - mask = CKCTL_6362_HSSPI_EN; -+ else if (BCMCPU_IS_63268()) -+ mask = CKCTL_63268_HSSPI_EN; - else - return; - -@@ -352,6 +378,8 @@ static void pcie_set(struct clk *clk, in - bcm_hwclock_set(CKCTL_6328_PCIE_EN, enable); - else if (BCMCPU_IS_6362()) - bcm_hwclock_set(CKCTL_6362_PCIE_EN, enable); -+ else if (BCMCPU_IS_63268()) -+ bcm_hwclock_set(CKCTL_63268_PCIE_EN, enable); - } - - static struct clk clk_pcie = { -@@ -550,6 +578,21 @@ static struct clk_lookup bcm6368_clks[] - CLKDEV_INIT(NULL, "ipsec", &clk_ipsec), - }; - -+static struct clk_lookup bcm63268_clks[] = { -+ /* fixed rate clocks */ -+ CLKDEV_INIT(NULL, "periph", &clk_periph), -+ CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), -+ CLKDEV_INIT("bcm63xx_uart.1", "refclk", &clk_periph), -+ CLKDEV_INIT("bcm63xx-hsspi.0", "pll", &clk_hsspi_pll), -+ /* gated clocks */ -+ CLKDEV_INIT(NULL, "enetsw", &clk_enetsw), -+ CLKDEV_INIT(NULL, "usbh", &clk_usbh), -+ CLKDEV_INIT(NULL, "usbd", &clk_usbd), -+ CLKDEV_INIT(NULL, "spi", &clk_spi), -+ CLKDEV_INIT(NULL, "hsspi", &clk_hsspi), -+ CLKDEV_INIT(NULL, "pcie", &clk_pcie), -+}; -+ - #define HSSPI_PLL_HZ_6328 133333333 - #define HSSPI_PLL_HZ_6362 400000000 - -@@ -582,6 +625,10 @@ static int __init bcm63xx_clk_init(void) - case BCM6368_CPU_ID: - clkdev_add_table(bcm6368_clks, ARRAY_SIZE(bcm6368_clks)); - break; -+ case BCM63268_CPU_ID: -+ clk_hsspi_pll.rate = HSSPI_PLL_HZ_6362; -+ clkdev_add_table(bcm63268_clks, ARRAY_SIZE(bcm63268_clks)); -+ break; - } - - return 0; ---- a/arch/mips/bcm63xx/cpu.c -+++ b/arch/mips/bcm63xx/cpu.c -@@ -101,6 +101,15 @@ static const int bcm6368_irqs[] = { - - }; - -+static const unsigned long bcm63268_regs_base[] = { -+ __GEN_CPU_REGS_TABLE(63268) -+}; -+ -+static const int bcm63268_irqs[] = { -+ __GEN_CPU_IRQ_TABLE(63268) -+ -+}; -+ - u32 bcm63xx_get_cpu_variant(void) - { - return bcm63xx_cpu_variant; -@@ -253,6 +262,27 @@ static unsigned int detect_cpu_clock(voi - - return (((64 * 1000000) / p1) * p2 * ndiv) / m1; - } -+ case BCM63268_CPU_ID: -+ { -+ unsigned int tmp, mips_pll_fcvo; -+ -+ tmp = bcm_misc_readl(MISC_STRAPBUS_63268_REG); -+ mips_pll_fcvo = (tmp & STRAPBUS_63268_FCVO_MASK) >> -+ STRAPBUS_63268_FCVO_SHIFT; -+ switch (mips_pll_fcvo) { -+ case 0x3: -+ case 0xe: -+ return 320000000; -+ case 0xa: -+ return 333000000; -+ case 0x2: -+ case 0xb: -+ case 0xf: -+ return 400000000; -+ default: -+ return 0; -+ } -+ } - - default: - panic("Failed to detect clock for CPU with id=%04X\n", cpu_id); -@@ -267,7 +297,7 @@ static unsigned int detect_memory_size(v - unsigned int cols = 0, rows = 0, is_32bits = 0, banks = 0; - u32 val; - -- if (BCMCPU_IS_6328() || BCMCPU_IS_6362()) -+ if (BCMCPU_IS_6328() || BCMCPU_IS_6362() || BCMCPU_IS_63268()) - return bcm_ddr_readl(DDR_CSEND_REG) << 24; - - if (BCMCPU_IS_6345()) { -@@ -305,6 +335,7 @@ void __init bcm63xx_cpu_init(void) - unsigned int tmp; - unsigned int cpu = smp_processor_id(); - u32 chipid_reg; -+ bool long_chipid = false; - u8 __maybe_unused varid = 0; - - /* soc registers location depends on cpu type */ -@@ -326,6 +357,9 @@ void __init bcm63xx_cpu_init(void) - case 0x10: - chipid_reg = BCM_6345_PERF_BASE; - break; -+ case 0x80: -+ long_chipid = true; -+ fallthrough; - default: - chipid_reg = BCM_6368_PERF_BASE; - break; -@@ -333,6 +367,7 @@ void __init bcm63xx_cpu_init(void) - break; - } - -+ - /* - * really early to panic, but delaying panic would not help since we - * will never get any working console -@@ -342,10 +377,17 @@ void __init bcm63xx_cpu_init(void) - - /* read out CPU type */ - tmp = bcm_readl(chipid_reg); -- bcm63xx_cpu_id = (tmp & REV_CHIPID_MASK) >> REV_CHIPID_SHIFT; -- bcm63xx_cpu_variant = bcm63xx_cpu_id; -+ -+ if (long_chipid) { -+ bcm63xx_cpu_id = tmp & REV_LONG_CHIPID_MASK; -+ bcm63xx_cpu_id >>= REV_LONG_CHIPID_SHIFT; -+ } else { -+ bcm63xx_cpu_id = (tmp & REV_CHIPID_MASK) >> REV_CHIPID_SHIFT; -+ varid = (tmp & REV_VARID_MASK) >> REV_VARID_SHIFT; -+ } -+ - bcm63xx_cpu_rev = (tmp & REV_REVID_MASK) >> REV_REVID_SHIFT; -- varid = (tmp & REV_VARID_MASK) >> REV_VARID_SHIFT; -+ bcm63xx_cpu_variant = bcm63xx_cpu_id; - - switch (bcm63xx_cpu_id) { - case BCM3368_CPU_ID: -@@ -400,6 +442,16 @@ void __init bcm63xx_cpu_init(void) - /* BCM6369 is a BCM6368 without xDSL, so treat it the same */ - bcm63xx_cpu_id = BCM6368_CPU_ID; - break; -+ case BCM63167_CPU_ID: -+ case BCM63168_CPU_ID: -+ case BCM63169_CPU_ID: -+ case BCM63268_CPU_ID: -+ case BCM63269_CPU_ID: -+ bcm63xx_regs_base = bcm63268_regs_base; -+ bcm63xx_irqs = bcm63268_irqs; -+ -+ bcm63xx_cpu_id = BCM63268_CPU_ID; -+ break; - default: - panic("unsupported broadcom CPU %x", bcm63xx_cpu_id); - break; ---- a/arch/mips/bcm63xx/dev-flash.c -+++ b/arch/mips/bcm63xx/dev-flash.c -@@ -84,6 +84,12 @@ static int __init bcm63xx_detect_flash_t - return BCM63XX_FLASH_TYPE_SERIAL; - else - return BCM63XX_FLASH_TYPE_NAND; -+ case BCM63268_CPU_ID: -+ val = bcm_misc_readl(MISC_STRAPBUS_63268_REG); -+ if (val & STRAPBUS_63268_BOOT_SEL_SERIAL) -+ return BCM63XX_FLASH_TYPE_SERIAL; -+ else -+ return BCM63XX_FLASH_TYPE_NAND; - case BCM6368_CPU_ID: - val = bcm_gpio_readl(GPIO_STRAPBUS_REG); - switch (val & STRAPBUS_6368_BOOT_SEL_MASK) { ---- a/arch/mips/bcm63xx/dev-spi.c -+++ b/arch/mips/bcm63xx/dev-spi.c -@@ -51,7 +51,7 @@ int __init bcm63xx_spi_register(void) - } - - if (BCMCPU_IS_3368() || BCMCPU_IS_6358() || BCMCPU_IS_6362() || -- BCMCPU_IS_6368()) { -+ BCMCPU_IS_6368() || BCMCPU_IS_63268()) { - bcm63xx_spi_device.name = "bcm6358-spi", - spi_resources[0].end += BCM_6358_RSET_SPI_SIZE - 1; - } ---- a/arch/mips/bcm63xx/irq.c -+++ b/arch/mips/bcm63xx/irq.c -@@ -149,6 +149,20 @@ void __init arch_init_irq(void) - ext_irqs[5] = BCM_6368_EXT_IRQ5; - ext_shift = 4; - break; -+ case BCM63268_CPU_ID: -+ periph_bases[0] += PERF_IRQMASK_63268_REG(0); -+ periph_bases[1] += PERF_IRQMASK_63268_REG(1); -+ periph_irq_count = 2; -+ periph_width = 4; -+ -+ ext_intc_bases[0] += PERF_EXTIRQ_CFG_REG_63268; -+ ext_irq_count = 4; -+ ext_irqs[0] = BCM_63268_EXT_IRQ0; -+ ext_irqs[1] = BCM_63268_EXT_IRQ1; -+ ext_irqs[2] = BCM_63268_EXT_IRQ2; -+ ext_irqs[3] = BCM_63268_EXT_IRQ3; -+ ext_shift = 4; -+ break; - default: - BUG(); - } ---- a/arch/mips/bcm63xx/reset.c -+++ b/arch/mips/bcm63xx/reset.c -@@ -126,6 +126,20 @@ - #define BCM6368_RESET_PCIE 0 - #define BCM6368_RESET_PCIE_EXT 0 - -+#define BCM63268_RESET_SPI SOFTRESET_63268_SPI_MASK -+#define BCM63268_RESET_ENET 0 -+#define BCM63268_RESET_USBH SOFTRESET_63268_USBH_MASK -+#define BCM63268_RESET_USBD SOFTRESET_63268_USBS_MASK -+#define BCM63268_RESET_DSL 0 -+#define BCM63268_RESET_SAR SOFTRESET_63268_SAR_MASK -+#define BCM63268_RESET_EPHY 0 -+#define BCM63268_RESET_ENETSW SOFTRESET_63268_ENETSW_MASK -+#define BCM63268_RESET_PCM SOFTRESET_63268_PCM_MASK -+#define BCM63268_RESET_MPI 0 -+#define BCM63268_RESET_PCIE (SOFTRESET_63268_PCIE_MASK | \ -+ SOFTRESET_63268_PCIE_CORE_MASK) -+#define BCM63268_RESET_PCIE_EXT SOFTRESET_63268_PCIE_EXT_MASK -+ - /* - * core reset bits - */ -@@ -157,6 +171,10 @@ static const u32 bcm6368_reset_bits[] = - __GEN_RESET_BITS_TABLE(6368) - }; - -+static const u32 bcm63268_reset_bits[] = { -+ __GEN_RESET_BITS_TABLE(63268) -+}; -+ - const u32 *bcm63xx_reset_bits; - static int reset_reg; - -@@ -183,6 +201,9 @@ static int __init bcm63xx_reset_bits_ini - } else if (BCMCPU_IS_6368()) { - reset_reg = PERF_SOFTRESET_6368_REG; - bcm63xx_reset_bits = bcm6368_reset_bits; -+ } else if (BCMCPU_IS_63268()) { -+ reset_reg = PERF_SOFTRESET_63268_REG; -+ bcm63xx_reset_bits = bcm63268_reset_bits; - } - - return 0; ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h -@@ -22,6 +22,11 @@ - #define BCM6362_CPU_ID 0x6362 - #define BCM6368_CPU_ID 0x6368 - #define BCM6369_CPU_ID 0x6369 -+#define BCM63167_CPU_ID 0x63167 -+#define BCM63168_CPU_ID 0x63168 -+#define BCM63169_CPU_ID 0x63169 -+#define BCM63268_CPU_ID 0x63268 -+#define BCM63269_CPU_ID 0x63269 - - void __init bcm63xx_cpu_init(void); - u32 bcm63xx_get_cpu_variant(void); -@@ -62,6 +67,10 @@ static inline u32 __pure __bcm63xx_get_c - #ifdef CONFIG_BCM63XX_CPU_6368 - case BCM6368_CPU_ID: - #endif -+ -+#ifdef CONFIG_BCM63XX_CPU_63268 -+ case BCM63268_CPU_ID: -+#endif - break; - default: - unreachable(); -@@ -87,6 +96,7 @@ static inline u32 __pure bcm63xx_get_cpu - #define BCMCPU_IS_6358() (bcm63xx_get_cpu_id() == BCM6358_CPU_ID) - #define BCMCPU_IS_6362() (bcm63xx_get_cpu_id() == BCM6362_CPU_ID) - #define BCMCPU_IS_6368() (bcm63xx_get_cpu_id() == BCM6368_CPU_ID) -+#define BCMCPU_IS_63268() (bcm63xx_get_cpu_id() == BCM63268_CPU_ID) - - #define BCMCPU_VARIANT_IS_3368() \ - (bcm63xx_get_cpu_variant() == BCM3368_CPU_ID) -@@ -110,6 +120,16 @@ static inline u32 __pure bcm63xx_get_cpu - (bcm63xx_get_cpu_variant() == BCM6368_CPU_ID) - #define BCMCPU_VARIANT_IS_6369() \ - (bcm63xx_get_cpu_variant() == BCM6369_CPU_ID) -+#define BCMCPU_VARIANT_IS_63167() \ -+ (bcm63xx_get_cpu_variant() == BCM63167_CPU_ID) -+#define BCMCPU_VARIANT_IS_63168() \ -+ (bcm63xx_get_cpu_variant() == BCM63168_CPU_ID) -+#define BCMCPU_VARIANT_IS_63169() \ -+ (bcm63xx_get_cpu_variant() == BCM63169_CPU_ID) -+#define BCMCPU_VARIANT_IS_63268() \ -+ (bcm63xx_get_cpu_variant() == BCM63268_CPU_ID) -+#define BCMCPU_VARIANT_IS_63269() \ -+ (bcm63xx_get_cpu_variant() == BCM63269_CPU_ID) - - /* - * While registers sets are (mostly) the same across 63xx CPU, base -@@ -574,6 +594,52 @@ enum bcm63xx_regs_set { - #define BCM_6368_RNG_BASE (0xb0004180) - #define BCM_6368_MISC_BASE (0xdeadbeef) - -+/* -+ * 63268 register sets base address -+ */ -+#define BCM_63268_DSL_LMEM_BASE (0xdeadbeef) -+#define BCM_63268_PERF_BASE (0xb0000000) -+#define BCM_63268_TIMER_BASE (0xb0000080) -+#define BCM_63268_WDT_BASE (0xb000009c) -+#define BCM_63268_UART0_BASE (0xb0000180) -+#define BCM_63268_UART1_BASE (0xb00001a0) -+#define BCM_63268_GPIO_BASE (0xb00000c0) -+#define BCM_63268_SPI_BASE (0xb0000800) -+#define BCM_63268_HSSPI_BASE (0xb0001000) -+#define BCM_63268_UDC0_BASE (0xdeadbeef) -+#define BCM_63268_USBDMA_BASE (0xb000c800) -+#define BCM_63268_OHCI0_BASE (0xb0002600) -+#define BCM_63268_OHCI_PRIV_BASE (0xdeadbeef) -+#define BCM_63268_USBH_PRIV_BASE (0xb0002700) -+#define BCM_63268_USBD_BASE (0xb0002400) -+#define BCM_63268_MPI_BASE (0xdeadbeef) -+#define BCM_63268_PCMCIA_BASE (0xdeadbeef) -+#define BCM_63268_PCIE_BASE (0xb06e0000) -+#define BCM_63268_SDRAM_REGS_BASE (0xdeadbeef) -+#define BCM_63268_DSL_BASE (0xdeadbeef) -+#define BCM_63268_UBUS_BASE (0xdeadbeef) -+#define BCM_63268_ENET0_BASE (0xdeadbeef) -+#define BCM_63268_ENET1_BASE (0xdeadbeef) -+#define BCM_63268_ENETDMA_BASE (0xb000d800) -+#define BCM_63268_ENETDMAC_BASE (0xb000da00) -+#define BCM_63268_ENETDMAS_BASE (0xb000dc00) -+#define BCM_63268_ENETSW_BASE (0xb0700000) -+#define BCM_63268_EHCI0_BASE (0xb0002500) -+#define BCM_63268_SDRAM_BASE (0xdeadbeef) -+#define BCM_63268_MEMC_BASE (0xdeadbeef) -+#define BCM_63268_DDR_BASE (0xb0003000) -+#define BCM_63268_M2M_BASE (0xdeadbeef) -+#define BCM_63268_ATM_BASE (0xdeadbeef) -+#define BCM_63268_XTM_BASE (0xb0007000) -+#define BCM_63268_XTMDMA_BASE (0xb000b800) -+#define BCM_63268_XTMDMAC_BASE (0xdeadbeef) -+#define BCM_63268_XTMDMAS_BASE (0xdeadbeef) -+#define BCM_63268_PCM_BASE (0xb000b000) -+#define BCM_63268_PCMDMA_BASE (0xb000b800) -+#define BCM_63268_PCMDMAC_BASE (0xdeadbeef) -+#define BCM_63268_PCMDMAS_BASE (0xdeadbeef) -+#define BCM_63268_RNG_BASE (0xdeadbeef) -+#define BCM_63268_MISC_BASE (0xb0001800) - - extern const unsigned long *bcm63xx_regs_base; - -@@ -1042,6 +1108,73 @@ enum bcm63xx_irq { - #define BCM_6368_EXT_IRQ4 (IRQ_INTERNAL_BASE + 24) - #define BCM_6368_EXT_IRQ5 (IRQ_INTERNAL_BASE + 25) - -+/* -+ * 63268 irqs -+ */ -+#define BCM_63268_HIGH_IRQ_BASE (IRQ_INTERNAL_BASE + 32) -+#define BCM_63268_VERY_HIGH_IRQ_BASE (BCM_63268_HIGH_IRQ_BASE + 32) -+ -+#define BCM_63268_TIMER_IRQ (IRQ_INTERNAL_BASE + 0) -+#define BCM_63268_SPI_IRQ (BCM_63268_VERY_HIGH_IRQ_BASE + 16) -+#define BCM_63268_UART0_IRQ (IRQ_INTERNAL_BASE + 5) -+#define BCM_63268_UART1_IRQ (BCM_63268_HIGH_IRQ_BASE + 2) -+#define BCM_63268_DSL_IRQ (IRQ_INTERNAL_BASE + 23) -+#define BCM_63268_UDC0_IRQ 0 -+#define BCM_63268_ENET0_IRQ 0 -+#define BCM_63268_ENET1_IRQ 0 -+#define BCM_63268_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 13) -+#define BCM_63268_HSSPI_IRQ (IRQ_INTERNAL_BASE + 6) -+#define BCM_63268_OHCI0_IRQ (IRQ_INTERNAL_BASE + 9) -+#define BCM_63268_EHCI0_IRQ (IRQ_INTERNAL_BASE + 10) -+#define BCM_63268_USBD_IRQ (IRQ_INTERNAL_BASE + 11) -+#define BCM_63268_USBD_RXDMA0_IRQ (IRQ_INTERNAL_BASE + 19) -+#define BCM_63268_USBD_TXDMA0_IRQ (BCM_63268_HIGH_IRQ_BASE + 4) -+#define BCM_63268_USBD_RXDMA1_IRQ (IRQ_INTERNAL_BASE + 20) -+#define BCM_63268_USBD_TXDMA1_IRQ (BCM_63268_HIGH_IRQ_BASE + 5) -+#define BCM_63268_USBD_RXDMA2_IRQ (IRQ_INTERNAL_BASE + 21) -+#define BCM_63268_USBD_TXDMA2_IRQ (BCM_63268_HIGH_IRQ_BASE + 6) -+#define BCM_63268_PCMCIA_IRQ 0 -+#define BCM_63268_ENET0_RXDMA_IRQ 0 -+#define BCM_63268_ENET0_TXDMA_IRQ 0 -+#define BCM_63268_ENET1_RXDMA_IRQ 0 -+#define BCM_63268_ENET1_TXDMA_IRQ 0 -+#define BCM_63268_PCI_IRQ (BCM_63268_HIGH_IRQ_BASE + 8) -+#define BCM_63268_ATM_IRQ 0 -+#define BCM_63268_ENETSW_RXDMA0_IRQ (IRQ_INTERNAL_BASE + 1) -+#define BCM_63268_ENETSW_RXDMA1_IRQ (IRQ_INTERNAL_BASE + 2) -+#define BCM_63268_ENETSW_RXDMA2_IRQ (IRQ_INTERNAL_BASE + 3) -+#define BCM_63268_ENETSW_RXDMA3_IRQ (IRQ_INTERNAL_BASE + 4) -+#define BCM_63268_ENETSW_TXDMA0_IRQ (BCM_63268_VERY_HIGH_IRQ_BASE + 0) -+#define BCM_63268_ENETSW_TXDMA1_IRQ (BCM_63268_VERY_HIGH_IRQ_BASE + 1) -+#define BCM_63268_ENETSW_TXDMA2_IRQ (BCM_63268_VERY_HIGH_IRQ_BASE + 2) -+#define BCM_63268_ENETSW_TXDMA3_IRQ (BCM_63268_VERY_HIGH_IRQ_BASE + 3) -+#define BCM_63268_XTM_IRQ (BCM_63268_HIGH_IRQ_BASE + 17) -+#define BCM_63268_XTM_DMA0_IRQ (IRQ_INTERNAL_BASE + 26) -+ -+#define BCM_63268_RING_OSC_IRQ (BCM_63268_HIGH_IRQ_BASE + 20) -+#define BCM_63268_WLAN_GPIO_IRQ (BCM_63268_HIGH_IRQ_BASE + 3) -+#define BCM_63268_WLAN_IRQ (IRQ_INTERNAL_BASE + 7) -+#define BCM_63268_IPSEC_IRQ (IRQ_INTERNAL_BASE + 8) -+#define BCM_63268_NAND_IRQ (BCM_63268_HIGH_IRQ_BASE + 18) -+#define BCM_63268_PCM_IRQ (IRQ_INTERNAL_BASE + 13) -+#define BCM_63268_DG_IRQ (IRQ_INTERNAL_BASE + 15) -+#define BCM_63268_EPHY_ENERGY0_IRQ (IRQ_INTERNAL_BASE + 16) -+#define BCM_63268_EPHY_ENERGY1_IRQ (IRQ_INTERNAL_BASE + 17) -+#define BCM_63268_EPHY_ENERGY2_IRQ (IRQ_INTERNAL_BASE + 18) -+#define BCM_63268_EPHY_ENERGY3_IRQ (IRQ_INTERNAL_BASE + 19) -+#define BCM_63268_IPSEC_DMA0_IRQ (IRQ_INTERNAL_BASE + 22) -+#define BCM_63268_IPSEC_DMA1_IRQ (BCM_63268_HIGH_IRQ_BASE + 7) -+#define BCM_63268_FAP0_IRQ (IRQ_INTERNAL_BASE + 24) -+#define BCM_63268_FAP1_IRQ (IRQ_INTERNAL_BASE + 25) -+#define BCM_63268_PCM_DMA0_IRQ (BCM_63268_HIGH_IRQ_BASE + 10) -+#define BCM_63268_PCM_DMA1_IRQ (BCM_63268_HIGH_IRQ_BASE + 11) -+#define BCM_63268_DECT0_IRQ (BCM_63268_HIGH_IRQ_BASE + 0) -+#define BCM_63268_DECT1_IRQ (BCM_63268_HIGH_IRQ_BASE + 1) -+#define BCM_63268_EXT_IRQ0 (BCM_63268_HIGH_IRQ_BASE + 12) -+#define BCM_63268_EXT_IRQ1 (BCM_63268_HIGH_IRQ_BASE + 13) -+#define BCM_63268_EXT_IRQ2 (BCM_63268_HIGH_IRQ_BASE + 14) -+#define BCM_63268_EXT_IRQ3 (BCM_63268_HIGH_IRQ_BASE + 15) -+ - extern const int *bcm63xx_irqs; - - #define __GEN_CPU_IRQ_TABLE(__cpu) \ ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h -@@ -23,6 +23,8 @@ static inline unsigned long bcm63xx_gpio - return 38; - case BCM6362_CPU_ID: - return 48; -+ case BCM63268_CPU_ID: -+ return 52; - case BCM6348_CPU_ID: - default: - return 37; ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -@@ -10,6 +10,8 @@ - #define PERF_REV_REG 0x0 - #define REV_CHIPID_SHIFT 16 - #define REV_CHIPID_MASK (0xffff << REV_CHIPID_SHIFT) -+#define REV_LONG_CHIPID_SHIFT 12 -+#define REV_LONG_CHIPID_MASK (0xfffff << REV_LONG_CHIPID_SHIFT) - #define REV_VARID_SHIFT 12 - #define REV_VARID_MASK (0xf << REV_VARID_SHIFT) - #define REV_REVID_SHIFT 0 -@@ -212,6 +214,52 @@ - CKCTL_6368_NAND_EN | \ - CKCTL_6368_IPSEC_EN) - -+#define CKCTL_63268_DISABLE_GLESS (1 << 0) -+#define CKCTL_63268_VDSL_QPROC_EN (1 << 1) -+#define CKCTL_63268_VDSL_AFE_EN (1 << 2) -+#define CKCTL_63268_VDSL_EN (1 << 3) -+#define CKCTL_63268_MIPS_EN (1 << 4) -+#define CKCTL_63268_WLAN_OCP_EN (1 << 5) -+#define CKCTL_63268_DECT_EN (1 << 6) -+#define CKCTL_63268_FAP0_EN (1 << 7) -+#define CKCTL_63268_FAP1_EN (1 << 8) -+#define CKCTL_63268_SAR_EN (1 << 9) -+#define CKCTL_63268_ROBOSW_EN (1 << 10) -+#define CKCTL_63268_PCM_EN (1 << 11) -+#define CKCTL_63268_USBD_EN (1 << 12) -+#define CKCTL_63268_USBH_EN (1 << 13) -+#define CKCTL_63268_IPSEC_EN (1 << 14) -+#define CKCTL_63268_SPI_EN (1 << 15) -+#define CKCTL_63268_HSSPI_EN (1 << 16) -+#define CKCTL_63268_PCIE_EN (1 << 17) -+#define CKCTL_63268_PHYMIPS_EN (1 << 18) -+#define CKCTL_63268_GMAC_EN (1 << 19) -+#define CKCTL_63268_NAND_EN (1 << 20) -+#define CKCTL_63268_TBUS_EN (1 << 27) -+#define CKCTL_63268_ROBOSW250_EN (1 << 31) -+ -+#define CKCTL_63268_ALL_SAFE_EN (CKCTL_63268_VDSL_QPROC_EN | \ -+ CKCTL_63268_VDSL_AFE_EN | \ -+ CKCTL_63268_VDSL_EN | \ -+ CKCTL_63268_WLAN_OCP_EN | \ -+ CKCTL_63268_DECT_EN | \ -+ CKCTL_63268_FAP0_EN | \ -+ CKCTL_63268_FAP1_EN | \ -+ CKCTL_63268_SAR_EN | \ -+ CKCTL_63268_ROBOSW_EN | \ -+ CKCTL_63268_PCM_EN | \ -+ CKCTL_63268_USBD_EN | \ -+ CKCTL_63268_USBH_EN | \ -+ CKCTL_63268_IPSEC_EN | \ -+ CKCTL_63268_SPI_EN | \ -+ CKCTL_63268_HSSPI_EN | \ -+ CKCTL_63268_PCIE_EN | \ -+ CKCTL_63268_PHYMIPS_EN | \ -+ CKCTL_63268_GMAC_EN | \ -+ CKCTL_63268_NAND_EN | \ -+ CKCTL_63268_TBUS_EN | \ -+ CKCTL_63268_ROBOSW250_EN) -+ - /* System PLL Control register */ - #define PERF_SYS_PLL_CTL_REG 0x8 - #define SYS_PLL_SOFT_RESET 0x1 -@@ -225,6 +273,7 @@ - #define PERF_IRQMASK_6358_REG(x) (0xc + (x) * 0x2c) - #define PERF_IRQMASK_6362_REG(x) (0x20 + (x) * 0x10) - #define PERF_IRQMASK_6368_REG(x) (0x20 + (x) * 0x10) -+#define PERF_IRQMASK_63268_REG(x) (0x20 + (x) * 0x20) - - /* Interrupt Status register */ - #define PERF_IRQSTAT_3368_REG 0x10 -@@ -235,6 +284,7 @@ - #define PERF_IRQSTAT_6358_REG(x) (0x10 + (x) * 0x2c) - #define PERF_IRQSTAT_6362_REG(x) (0x28 + (x) * 0x10) - #define PERF_IRQSTAT_6368_REG(x) (0x28 + (x) * 0x10) -+#define PERF_IRQSTAT_63268_REG(x) (0x30 + (x) * 0x20) - - /* External Interrupt Configuration register */ - #define PERF_EXTIRQ_CFG_REG_3368 0x14 -@@ -245,6 +295,7 @@ - #define PERF_EXTIRQ_CFG_REG_6358 0x14 - #define PERF_EXTIRQ_CFG_REG_6362 0x18 - #define PERF_EXTIRQ_CFG_REG_6368 0x18 -+#define PERF_EXTIRQ_CFG_REG_63268 0x18 - - #define PERF_EXTIRQ_CFG_REG2_6358 0x1c - #define PERF_EXTIRQ_CFG_REG2_6368 0x1c -@@ -275,6 +326,7 @@ - #define PERF_SOFTRESET_6358_REG 0x34 - #define PERF_SOFTRESET_6362_REG 0x10 - #define PERF_SOFTRESET_6368_REG 0x10 -+#define PERF_SOFTRESET_63268_REG 0x10 - - #define SOFTRESET_3368_SPI_MASK (1 << 0) - #define SOFTRESET_3368_ENET_MASK (1 << 2) -@@ -368,6 +420,26 @@ - #define SOFTRESET_6368_USBH_MASK (1 << 12) - #define SOFTRESET_6368_PCM_MASK (1 << 13) - -+#define SOFTRESET_63268_SPI_MASK (1 << 0) -+#define SOFTRESET_63268_IPSEC_MASK (1 << 1) -+#define SOFTRESET_63268_EPHY_MASK (1 << 2) -+#define SOFTRESET_63268_SAR_MASK (1 << 3) -+#define SOFTRESET_63268_ENETSW_MASK (1 << 4) -+#define SOFTRESET_63268_USBS_MASK (1 << 5) -+#define SOFTRESET_63268_USBH_MASK (1 << 6) -+#define SOFTRESET_63268_PCM_MASK (1 << 7) -+#define SOFTRESET_63268_PCIE_CORE_MASK (1 << 8) -+#define SOFTRESET_63268_PCIE_MASK (1 << 9) -+#define SOFTRESET_63268_PCIE_EXT_MASK (1 << 10) -+#define SOFTRESET_63268_WLAN_SHIM_MASK (1 << 11) -+#define SOFTRESET_63268_DDR_PHY_MASK (1 << 12) -+#define SOFTRESET_63268_FAP0_MASK (1 << 13) -+#define SOFTRESET_63268_WLAN_UBUS_MASK (1 << 14) -+#define SOFTRESET_63268_DECT_MASK (1 << 15) -+#define SOFTRESET_63268_FAP1_MASK (1 << 16) -+#define SOFTRESET_63268_PCIE_HARD_MASK (1 << 17) -+#define SOFTRESET_63268_GPHY_MASK (1 << 18) -+ - /* MIPS PLL control register */ - #define PERF_MIPSPLLCTL_REG 0x34 - #define MIPSPLLCTL_N1_SHIFT 20 -@@ -559,6 +631,11 @@ - #define STRAPBUS_6368_BOOT_SEL_SERIAL 1 - #define STRAPBUS_6368_BOOT_SEL_PARALLEL 3 - -+/* BCM6318 BCM6328 BCM6362 BCM63268 */ -+#define GPIO_ROBOSW_SW_CTRL_REG 0x40 -+#define GPIO_ROBOSW_MII_DUMB_FWDG_EN (1 << 0) -+#define GPIO_ROBOSW_HW_FWDG_EN (1 << 3) -+ - - /************************************************************************* - * _REG relative to RSET_ENET -@@ -1367,6 +1444,13 @@ - #define STRAPBUS_6362_BOOT_SEL_SERIAL (1 << 15) - #define STRAPBUS_6362_BOOT_SEL_NAND (0 << 15) - -+#define MISC_STRAPBUS_63268_REG 0x14 -+#define STRAPBUS_63268_HSSPI_CLK_FAST (1 << 9) -+#define STRAPBUS_63268_BOOT_SEL_SERIAL (1 << 11) -+#define STRAPBUS_63268_BOOT_SEL_NAND (0 << 11) -+#define STRAPBUS_63268_FCVO_SHIFT 21 -+#define STRAPBUS_63268_FCVO_MASK (0xf << STRAPBUS_63268_FCVO_SHIFT) -+ - #define MISC_STRAPBUS_6328_REG 0x240 - #define STRAPBUS_6328_FCVO_SHIFT 7 - #define STRAPBUS_6328_FCVO_MASK (0x1f << STRAPBUS_6328_FCVO_SHIFT) ---- a/arch/mips/include/asm/mach-bcm63xx/ioremap.h -+++ b/arch/mips/include/asm/mach-bcm63xx/ioremap.h -@@ -21,6 +21,7 @@ static inline int is_bcm63xx_internal_re - case BCM6328_CPU_ID: - case BCM6362_CPU_ID: - case BCM6368_CPU_ID: -+ case BCM63268_CPU_ID: - if (offset >= 0xb0000000 && offset < 0xb1000000) - return 1; - break; ---- a/arch/mips/bcm63xx/dev-hsspi.c -+++ b/arch/mips/bcm63xx/dev-hsspi.c -@@ -35,7 +35,7 @@ static struct platform_device bcm63xx_hs - - int __init bcm63xx_hsspi_register(void) - { -- if (!BCMCPU_IS_6328() && !BCMCPU_IS_6362()) -+ if (!BCMCPU_IS_6328() && !BCMCPU_IS_6362() && !BCMCPU_IS_63268()) - return -ENODEV; - - spi_resources[0].start = bcm63xx_regset_address(RSET_HSSPI); ---- a/arch/mips/bcm63xx/dev-enet.c -+++ b/arch/mips/bcm63xx/dev-enet.c -@@ -184,7 +184,8 @@ static int __init register_shared(void) - else - shared_res[0].end += (RSET_ENETDMA_SIZE) - 1; - -- if (BCMCPU_IS_6328() || BCMCPU_IS_6362() || BCMCPU_IS_6368()) -+ if (BCMCPU_IS_6328() || BCMCPU_IS_6362() || BCMCPU_IS_6368() || -+ BCMCPU_IS_63268()) - chan_count = 32; - else if (BCMCPU_IS_6345()) - chan_count = 8; -@@ -292,7 +293,8 @@ bcm63xx_enetsw_register(const struct bcm - { - int ret; - -- if (!BCMCPU_IS_6328() && !BCMCPU_IS_6362() && !BCMCPU_IS_6368()) -+ if (!BCMCPU_IS_6328() && !BCMCPU_IS_6362() && !BCMCPU_IS_6368() && -+ !BCMCPU_IS_63268()) - return -ENODEV; - - ret = register_shared(); -@@ -313,6 +315,8 @@ bcm63xx_enetsw_register(const struct bcm - enetsw_pd.num_ports = ENETSW_PORTS_6328; - else if (BCMCPU_IS_6362() || BCMCPU_IS_6368()) - enetsw_pd.num_ports = ENETSW_PORTS_6368; -+ else if (BCMCPU_IS_63268()) -+ enetsw_pd.num_ports = ENETSW_PORTS_63268; - - enetsw_pd.dma_has_sram = true; - enetsw_pd.dma_chan_width = ENETDMA_CHAN_WIDTH; ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h -@@ -67,6 +67,7 @@ struct bcm63xx_enet_platform_data { - #define ENETSW_MAX_PORT 8 - #define ENETSW_PORTS_6328 5 /* 4 FE PHY + 1 RGMII */ - #define ENETSW_PORTS_6368 6 /* 4 FE PHY + 2 RGMII */ -+#define ENETSW_PORTS_63268 8 /* 3 FE PHY + 1 GE PHY + 4 RGMII */ - - #define ENETSW_RGMII_PORT0 4 - diff --git a/target/linux/bcm63xx/patches-5.15/340-MIPS-BCM63XX-add-pcie-support-for-BCM63268.patch b/target/linux/bcm63xx/patches-5.15/340-MIPS-BCM63XX-add-pcie-support-for-BCM63268.patch deleted file mode 100644 index e9f9e2b01d74fc..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/340-MIPS-BCM63XX-add-pcie-support-for-BCM63268.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 5c290c81dbdb4433600593fe80c88eb4af86e791 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 8 Dec 2013 03:22:40 +0100 -Subject: [PATCH 50/53] MIPS: BCM63XX: add pcie support for BCM63268 - ---- - arch/mips/bcm63xx/reset.c | 3 ++- - arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h | 5 +++++ - arch/mips/pci/pci-bcm63xx.c | 4 ++++ - 3 files changed, 11 insertions(+), 1 deletion(-) - ---- a/arch/mips/bcm63xx/reset.c -+++ b/arch/mips/bcm63xx/reset.c -@@ -137,7 +137,8 @@ - #define BCM63268_RESET_PCM SOFTRESET_63268_PCM_MASK - #define BCM63268_RESET_MPI 0 - #define BCM63268_RESET_PCIE (SOFTRESET_63268_PCIE_MASK | \ -- SOFTRESET_63268_PCIE_CORE_MASK) -+ SOFTRESET_63268_PCIE_CORE_MASK | \ -+ SOFTRESET_63268_PCIE_HARD_MASK) - #define BCM63268_RESET_PCIE_EXT SOFTRESET_63268_PCIE_EXT_MASK - - /* ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h -@@ -46,6 +46,11 @@ - #define BCM_PCIE_MEM_END_PA_6328 (BCM_PCIE_MEM_BASE_PA_6328 + \ - BCM_PCIE_MEM_SIZE_6328 - 1) - -+#define BCM_PCIE_MEM_BASE_PA_63268 0x11000000 -+#define BCM_PCIE_MEM_SIZE_63268 (15 * 1024 * 1024) -+#define BCM_PCIE_MEM_END_PA_63268 (BCM_PCIE_MEM_BASE_PA_63268 + \ -+ BCM_PCIE_MEM_SIZE_63268 - 1) -+ - /* - * Internal registers are accessed through KSEG3 - */ ---- a/arch/mips/pci/pci-bcm63xx.c -+++ b/arch/mips/pci/pci-bcm63xx.c -@@ -337,11 +337,15 @@ static int __init bcm63xx_pci_init(void) - if (BCMCPU_IS_6328() || BCMCPU_IS_6362()) { - bcm_pcie_mem_resource.start = BCM_PCIE_MEM_BASE_PA_6328; - bcm_pcie_mem_resource.end = BCM_PCIE_MEM_END_PA_6328; -+ } else if (BCMCPU_IS_63268()) { -+ bcm_pcie_mem_resource.start = BCM_PCIE_MEM_BASE_PA_63268; -+ bcm_pcie_mem_resource.end = BCM_PCIE_MEM_END_PA_63268; - } - - switch (bcm63xx_get_cpu_id()) { - case BCM6328_CPU_ID: - case BCM6362_CPU_ID: -+ case BCM63268_CPU_ID: - return bcm63xx_register_pcie(); - case BCM3368_CPU_ID: - case BCM6348_CPU_ID: diff --git a/target/linux/bcm63xx/patches-5.15/341-MIPS-BCM63XX-add-support-for-BCM6318.patch b/target/linux/bcm63xx/patches-5.15/341-MIPS-BCM63XX-add-support-for-BCM6318.patch deleted file mode 100644 index 121d02a81a4c0a..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/341-MIPS-BCM63XX-add-support-for-BCM6318.patch +++ /dev/null @@ -1,699 +0,0 @@ -From 60c29522a8c77d96145d965589c56befda7d4c3d Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 8 Dec 2013 01:24:09 +0100 -Subject: [PATCH 51/53] MIPS: BCM63XX: add support for BCM6318 - ---- - arch/mips/bcm63xx/Kconfig | 5 + - arch/mips/bcm63xx/boards/board_bcm963xx.c | 2 +- - arch/mips/bcm63xx/clk.c | 8 +- - arch/mips/bcm63xx/cpu.c | 53 +++++++++++ - arch/mips/bcm63xx/dev-flash.c | 3 + - arch/mips/bcm63xx/dev-spi.c | 2 +- - arch/mips/bcm63xx/irq.c | 10 ++ - arch/mips/bcm63xx/prom.c | 2 +- - arch/mips/bcm63xx/reset.c | 24 +++++ - arch/mips/bcm63xx/setup.c | 5 +- - arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h | 107 ++++++++++++++++++++++ - arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h | 75 ++++++++++++++- - arch/mips/include/asm/mach-bcm63xx/ioremap.h | 1 + - 13 files changed, 291 insertions(+), 6 deletions(-) - ---- a/arch/mips/bcm63xx/Kconfig -+++ b/arch/mips/bcm63xx/Kconfig -@@ -19,6 +19,11 @@ config BCM63XX_EHCI - select USB_EHCI_BIG_ENDIAN_DESC if USB_EHCI_HCD - select USB_EHCI_BIG_ENDIAN_MMIO if USB_EHCI_HCD - -+config BCM63XX_CPU_6318 -+ bool "support 6318 CPU" -+ select SYS_HAS_CPU_BMIPS32_3300 -+ select HAVE_PCI -+ - config BCM63XX_CPU_6328 - bool "support 6328 CPU" - select SYS_HAS_CPU_BMIPS4350 ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -681,7 +681,7 @@ void __init board_prom_init(void) - /* read base address of boot chip select (0) - * 6328/6362 do not have MPI but boot from a fixed address - */ -- if (BCMCPU_IS_6328() || BCMCPU_IS_6362() || BCMCPU_IS_63268()) { -+ if (BCMCPU_IS_6318() || BCMCPU_IS_6328() || BCMCPU_IS_6362() || BCMCPU_IS_63268()) { - val = 0x18000000; - } else { - val = bcm_mpi_readl(MPI_CSBASE_REG(0)); ---- a/arch/mips/bcm63xx/clk.c -+++ b/arch/mips/bcm63xx/clk.c -@@ -303,7 +303,9 @@ static void hsspi_set(struct clk *clk, i - { - u32 mask; - -- if (BCMCPU_IS_6328()) -+ if (BCMCPU_IS_6318()) -+ mask = CKCTL_6318_HSSPI_EN; -+ else if (BCMCPU_IS_6328()) - mask = CKCTL_6328_HSSPI_EN; - else if (BCMCPU_IS_6362()) - mask = CKCTL_6362_HSSPI_EN; -@@ -472,6 +474,19 @@ static struct clk_lookup bcm3368_clks[] - CLKDEV_INIT("bcm63xx_enet.1", "enet", &clk_enet1), - }; - -+static struct clk_lookup bcm6318_clks[] = { -+ /* fixed rate clocks */ -+ CLKDEV_INIT(NULL, "periph", &clk_periph), -+ CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), -+ CLKDEV_INIT("bcm63xx-hsspi.0", "pll", &clk_hsspi_pll), -+ /* gated clocks */ -+ CLKDEV_INIT(NULL, "enetsw", &clk_enetsw), -+ CLKDEV_INIT(NULL, "usbh", &clk_usbh), -+ CLKDEV_INIT(NULL, "usbd", &clk_usbh), -+ CLKDEV_INIT(NULL, "hsspi", &clk_hsspi), -+ CLKDEV_INIT(NULL, "pcie", &clk_pcie), -+}; -+ - static struct clk_lookup bcm6328_clks[] = { - /* fixed rate clocks */ - CLKDEV_INIT(NULL, "periph", &clk_periph), -@@ -593,6 +608,7 @@ static struct clk_lookup bcm63268_clks[] - CLKDEV_INIT(NULL, "pcie", &clk_pcie), - }; - -+#define HSSPI_PLL_HZ_6318 250000000 - #define HSSPI_PLL_HZ_6328 133333333 - #define HSSPI_PLL_HZ_6362 400000000 - -@@ -602,6 +618,10 @@ static int __init bcm63xx_clk_init(void) - case BCM3368_CPU_ID: - clkdev_add_table(bcm3368_clks, ARRAY_SIZE(bcm3368_clks)); - break; -+ case BCM6318_CPU_ID: -+ clk_hsspi_pll.rate = HSSPI_PLL_HZ_6318; -+ clkdev_add_table(bcm6318_clks, ARRAY_SIZE(bcm6318_clks)); -+ break; - case BCM6328_CPU_ID: - clk_hsspi_pll.rate = HSSPI_PLL_HZ_6328; - clkdev_add_table(bcm6328_clks, ARRAY_SIZE(bcm6328_clks)); ---- a/arch/mips/bcm63xx/cpu.c -+++ b/arch/mips/bcm63xx/cpu.c -@@ -41,6 +41,14 @@ static const int bcm3368_irqs[] = { - __GEN_CPU_IRQ_TABLE(3368) - }; - -+static const unsigned long bcm6318_regs_base[] = { -+ __GEN_CPU_REGS_TABLE(6318) -+}; -+ -+static const int bcm6318_irqs[] = { -+ __GEN_CPU_IRQ_TABLE(6318) -+}; -+ - static const unsigned long bcm6328_regs_base[] = { - __GEN_CPU_REGS_TABLE(6328) - }; -@@ -134,6 +142,10 @@ unsigned int bcm63xx_get_memory_size(voi - return bcm63xx_memory_size; - } - -+#define STRAP_OVERRIDE_BUS_REG 0x0 -+#define OVERRIDE_BUS_MIPS_FREQ_SHIFT 23 -+#define OVERRIDE_BUS_MIPS_FREQ_MASK (0x3 << OVERRIDE_BUS_MIPS_FREQ_SHIFT) -+ - static unsigned int detect_cpu_clock(void) - { - u32 cpu_id = bcm63xx_get_cpu_id(); -@@ -142,6 +154,30 @@ static unsigned int detect_cpu_clock(voi - case BCM3368_CPU_ID: - return 300000000; - -+ case BCM6318_CPU_ID: -+ { -+ unsigned int tmp, mips_pll_fcvo; -+ -+ tmp = bcm_readl(BCM_6318_STRAP_BASE + STRAP_OVERRIDE_BUS_REG); -+ -+ pr_info("strap_override_bus = %08x\n", tmp); -+ -+ mips_pll_fcvo = (tmp & OVERRIDE_BUS_MIPS_FREQ_MASK) -+ >> OVERRIDE_BUS_MIPS_FREQ_SHIFT; -+ -+ switch (mips_pll_fcvo) { -+ case 0: -+ return 166000000; -+ case 1: -+ return 400000000; -+ case 2: -+ return 250000000; -+ case 3: -+ return 333000000; -+ default: -+ return 320000000; -+ } -+ } - case BCM6328_CPU_ID: - { - unsigned int tmp, mips_pll_fcvo; -@@ -297,6 +333,13 @@ static unsigned int detect_memory_size(v - unsigned int cols = 0, rows = 0, is_32bits = 0, banks = 0; - u32 val; - -+ if (BCMCPU_IS_6318()) { -+ val = bcm_sdram_readl(SDRAM_CFG_REG); -+ val = val & SDRAM_CFG_6318_SPACE_MASK; -+ val >>= SDRAM_CFG_6318_SPACE_SHIFT; -+ return 1 << (val + 20); -+ } -+ - if (BCMCPU_IS_6328() || BCMCPU_IS_6362() || BCMCPU_IS_63268()) - return bcm_ddr_readl(DDR_CSEND_REG) << 24; - -@@ -343,6 +386,12 @@ void __init bcm63xx_cpu_init(void) - - switch (current_cpu_type()) { - case CPU_BMIPS3300: -+ if ((read_c0_prid() & 0xff) >= 0x33) { -+ /* BCM6318 */ -+ chipid_reg = BCM_6368_PERF_BASE; -+ break; -+ } -+ - if ((read_c0_prid() & PRID_IMP_MASK) != PRID_IMP_BMIPS3300_ALT) - __cpu_name[cpu] = "Broadcom BCM6338"; - fallthrough; -@@ -390,6 +439,10 @@ void __init bcm63xx_cpu_init(void) - bcm63xx_cpu_variant = bcm63xx_cpu_id; - - switch (bcm63xx_cpu_id) { -+ case BCM6318_CPU_ID: -+ bcm63xx_regs_base = bcm6318_regs_base; -+ bcm63xx_irqs = bcm6318_irqs; -+ break; - case BCM3368_CPU_ID: - bcm63xx_regs_base = bcm3368_regs_base; - bcm63xx_irqs = bcm3368_irqs; ---- a/arch/mips/bcm63xx/dev-flash.c -+++ b/arch/mips/bcm63xx/dev-flash.c -@@ -60,6 +60,9 @@ static int __init bcm63xx_detect_flash_t - u32 val; - - switch (bcm63xx_get_cpu_id()) { -+ case BCM6318_CPU_ID: -+ /* only support serial flash */ -+ return BCM63XX_FLASH_TYPE_SERIAL; - case BCM6328_CPU_ID: - val = bcm_misc_readl(MISC_STRAPBUS_6328_REG); - if (val & STRAPBUS_6328_BOOT_SEL_SERIAL) ---- a/arch/mips/bcm63xx/dev-spi.c -+++ b/arch/mips/bcm63xx/dev-spi.c -@@ -38,7 +38,7 @@ static struct platform_device bcm63xx_sp - - int __init bcm63xx_spi_register(void) - { -- if (BCMCPU_IS_6328() || BCMCPU_IS_6345()) -+ if (BCMCPU_IS_6318() || BCMCPU_IS_6328() || BCMCPU_IS_6345()) - return -ENODEV; - - spi_resources[0].start = bcm63xx_regset_address(RSET_SPI); ---- a/arch/mips/bcm63xx/irq.c -+++ b/arch/mips/bcm63xx/irq.c -@@ -48,6 +48,19 @@ void __init arch_init_irq(void) - ext_irqs[3] = BCM_3368_EXT_IRQ3; - ext_shift = 4; - break; -+ case BCM6318_CPU_ID: -+ periph_bases[0] += PERF_IRQMASK_6318_REG; -+ periph_irq_count = 1; -+ periph_width = 4; -+ -+ ext_intc_bases[0] += PERF_EXTIRQ_CFG_REG_6318; -+ ext_irq_count = 4; -+ ext_irqs[0] = BCM_6318_EXT_IRQ0; -+ ext_irqs[1] = BCM_6318_EXT_IRQ0; -+ ext_irqs[2] = BCM_6318_EXT_IRQ0; -+ ext_irqs[3] = BCM_6318_EXT_IRQ0; -+ ext_shift = 4; -+ break; - case BCM6328_CPU_ID: - periph_bases[0] += PERF_IRQMASK_6328_REG(0); - periph_bases[1] += PERF_IRQMASK_6328_REG(1); ---- a/arch/mips/bcm63xx/prom.c -+++ b/arch/mips/bcm63xx/prom.c -@@ -68,7 +68,7 @@ void __init prom_init(void) - - if (reg & OTP_6328_REG3_TP1_DISABLED) - bmips_smp_enabled = 0; -- } else if (BCMCPU_IS_3368() || BCMCPU_IS_6358()) { -+ } else if (BCMCPU_IS_6318() || BCMCPU_IS_3368() || BCMCPU_IS_6358()) { - bmips_smp_enabled = 0; - } - ---- a/arch/mips/bcm63xx/reset.c -+++ b/arch/mips/bcm63xx/reset.c -@@ -44,6 +44,23 @@ - #define BCM3368_RESET_PCIE 0 - #define BCM3368_RESET_PCIE_EXT 0 - -+ -+#define BCM6318_RESET_SPI SOFTRESET_6318_SPI_MASK -+#define BCM6318_RESET_ENET 0 -+#define BCM6318_RESET_USBH SOFTRESET_6318_USBH_MASK -+#define BCM6318_RESET_USBD SOFTRESET_6318_USBS_MASK -+#define BCM6318_RESET_DSL 0 -+#define BCM6318_RESET_SAR SOFTRESET_6318_SAR_MASK -+#define BCM6318_RESET_EPHY SOFTRESET_6318_EPHY_MASK -+#define BCM6318_RESET_ENETSW SOFTRESET_6318_ENETSW_MASK -+#define BCM6318_RESET_PCM 0 -+#define BCM6318_RESET_MPI 0 -+#define BCM6318_RESET_PCIE \ -+ (SOFTRESET_6318_PCIE_MASK | \ -+ SOFTRESET_6318_PCIE_CORE_MASK | \ -+ SOFTRESET_6318_PCIE_HARD_MASK) -+#define BCM6318_RESET_PCIE_EXT SOFTRESET_6318_PCIE_EXT_MASK -+ - #define BCM6328_RESET_SPI SOFTRESET_6328_SPI_MASK - #define BCM6328_RESET_ENET 0 - #define BCM6328_RESET_USBH SOFTRESET_6328_USBH_MASK -@@ -148,6 +165,10 @@ static const u32 bcm3368_reset_bits[] = - __GEN_RESET_BITS_TABLE(3368) - }; - -+static const u32 bcm6318_reset_bits[] = { -+ __GEN_RESET_BITS_TABLE(6318) -+}; -+ - static const u32 bcm6328_reset_bits[] = { - __GEN_RESET_BITS_TABLE(6328) - }; -@@ -184,6 +205,9 @@ static int __init bcm63xx_reset_bits_ini - if (BCMCPU_IS_3368()) { - reset_reg = PERF_SOFTRESET_6358_REG; - bcm63xx_reset_bits = bcm3368_reset_bits; -+ } else if (BCMCPU_IS_6318()) { -+ reset_reg = PERF_SOFTRESET_6318_REG; -+ bcm63xx_reset_bits = bcm6318_reset_bits; - } else if (BCMCPU_IS_6328()) { - reset_reg = PERF_SOFTRESET_6328_REG; - bcm63xx_reset_bits = bcm6328_reset_bits; ---- a/arch/mips/bcm63xx/setup.c -+++ b/arch/mips/bcm63xx/setup.c -@@ -72,6 +72,9 @@ void bcm63xx_machine_reboot(void) - case BCM3368_CPU_ID: - perf_regs[0] = PERF_EXTIRQ_CFG_REG_3368; - break; -+ case BCM6318_CPU_ID: -+ perf_regs[0] = PERF_EXTIRQ_CFG_REG_6318; -+ break; - case BCM6328_CPU_ID: - perf_regs[0] = PERF_EXTIRQ_CFG_REG_6328; - break; -@@ -111,7 +114,7 @@ void bcm63xx_machine_reboot(void) - bcm6348_a1_reboot(); - - pr_info("triggering watchdog soft-reset...\n"); -- if (BCMCPU_IS_6328()) { -+ if (BCMCPU_IS_6318() || BCMCPU_IS_6328()) { - bcm_wdt_writel(1, WDT_SOFTRESET_REG); - } else { - reg = bcm_perf_readl(PERF_SYS_PLL_CTL_REG); ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h -@@ -11,6 +11,7 @@ - * arm mach-types) - */ - #define BCM3368_CPU_ID 0x3368 -+#define BCM6318_CPU_ID 0x6318 - #define BCM6328_CPU_ID 0x6328 - #define BCM63281_CPU_ID 0x63281 - #define BCM63283_CPU_ID 0x63283 -@@ -40,6 +41,10 @@ static inline u32 __pure __bcm63xx_get_c - case BCM3368_CPU_ID: - #endif - -+#ifdef CONFIG_BCM63XX_CPU_6318 -+ case BCM6318_CPU_ID: -+#endif -+ - #ifdef CONFIG_BCM63XX_CPU_6328 - case BCM6328_CPU_ID: - #endif -@@ -89,6 +94,7 @@ static inline u32 __pure bcm63xx_get_cpu - } - - #define BCMCPU_IS_3368() (bcm63xx_get_cpu_id() == BCM3368_CPU_ID) -+#define BCMCPU_IS_6318() (bcm63xx_get_cpu_id() == BCM6318_CPU_ID) - #define BCMCPU_IS_6328() (bcm63xx_get_cpu_id() == BCM6328_CPU_ID) - #define BCMCPU_IS_6338() (bcm63xx_get_cpu_id() == BCM6338_CPU_ID) - #define BCMCPU_IS_6345() (bcm63xx_get_cpu_id() == BCM6345_CPU_ID) -@@ -100,6 +106,8 @@ static inline u32 __pure bcm63xx_get_cpu - - #define BCMCPU_VARIANT_IS_3368() \ - (bcm63xx_get_cpu_variant() == BCM3368_CPU_ID) -+#define BCMCPU_VARIANT_IS_6318() \ -+ (bcm63xx_get_cpu_variant() == BCM6318_CPU_ID) - #define BCMCPU_VARIANT_IS_63281() \ - (bcm63xx_get_cpu_variant() == BCM63281_CPU_ID) - #define BCMCPU_VARIANT_IS_63283() \ -@@ -256,6 +264,56 @@ enum bcm63xx_regs_set { - #define BCM_3368_MISC_BASE (0xdeadbeef) - - /* -+ * 6318 register sets base address -+ */ -+#define BCM_6318_DSL_LMEM_BASE (0xdeadbeef) -+#define BCM_6318_PERF_BASE (0xb0000000) -+#define BCM_6318_TIMER_BASE (0xb0000040) -+#define BCM_6318_WDT_BASE (0xb0000068) -+#define BCM_6318_UART0_BASE (0xb0000100) -+#define BCM_6318_UART1_BASE (0xdeadbeef) -+#define BCM_6318_GPIO_BASE (0xb0000080) -+#define BCM_6318_SPI_BASE (0xdeadbeef) -+#define BCM_6318_HSSPI_BASE (0xb0003000) -+#define BCM_6318_UDC0_BASE (0xdeadbeef) -+#define BCM_6318_USBDMA_BASE (0xb0006800) -+#define BCM_6318_OHCI0_BASE (0xb0005100) -+#define BCM_6318_OHCI_PRIV_BASE (0xdeadbeef) -+#define BCM_6318_USBH_PRIV_BASE (0xb0005200) -+#define BCM_6318_USBD_BASE (0xb0006000) -+#define BCM_6318_MPI_BASE (0xdeadbeef) -+#define BCM_6318_PCMCIA_BASE (0xdeadbeef) -+#define BCM_6318_PCIE_BASE (0xb0010000) -+#define BCM_6318_SDRAM_REGS_BASE (0xdeadbeef) -+#define BCM_6318_DSL_BASE (0xdeadbeef) -+#define BCM_6318_UBUS_BASE (0xdeadbeef) -+#define BCM_6318_ENET0_BASE (0xdeadbeef) -+#define BCM_6318_ENET1_BASE (0xdeadbeef) -+#define BCM_6318_ENETDMA_BASE (0xb0088000) -+#define BCM_6318_ENETDMAC_BASE (0xb0088200) -+#define BCM_6318_ENETDMAS_BASE (0xb0088400) -+#define BCM_6318_ENETSW_BASE (0xb0080000) -+#define BCM_6318_EHCI0_BASE (0xb0005000) -+#define BCM_6318_SDRAM_BASE (0xb0004000) -+#define BCM_6318_MEMC_BASE (0xdeadbeef) -+#define BCM_6318_DDR_BASE (0xdeadbeef) -+#define BCM_6318_M2M_BASE (0xdeadbeef) -+#define BCM_6318_ATM_BASE (0xdeadbeef) -+#define BCM_6318_XTM_BASE (0xdeadbeef) -+#define BCM_6318_XTMDMA_BASE (0xb000c000) -+#define BCM_6318_XTMDMAC_BASE (0xdeadbeef) -+#define BCM_6318_XTMDMAS_BASE (0xdeadbeef) -+#define BCM_6318_PCM_BASE (0xdeadbeef) -+#define BCM_6318_PCMDMA_BASE (0xdeadbeef) -+#define BCM_6318_PCMDMAC_BASE (0xdeadbeef) -+#define BCM_6318_PCMDMAS_BASE (0xdeadbeef) -+#define BCM_6318_RNG_BASE (0xdeadbeef) -+#define BCM_6318_MISC_BASE (0xb0000280) -+#define BCM_6318_OTP_BASE (0xdeadbeef) -+ -+#define BCM_6318_STRAP_BASE (0xb0000900) -+ -+/* - * 6328 register sets base address - */ - #define BCM_6328_DSL_LMEM_BASE (0xdeadbeef) -@@ -778,6 +836,55 @@ enum bcm63xx_irq { - #define BCM_3368_EXT_IRQ2 (IRQ_INTERNAL_BASE + 27) - #define BCM_3368_EXT_IRQ3 (IRQ_INTERNAL_BASE + 28) - -+/* -+ * 6318 irqs -+ */ -+#define BCM_6318_HIGH_IRQ_BASE (IRQ_INTERNAL_BASE + 32) -+#define BCM_6318_VERY_HIGH_IRQ_BASE (BCM_6318_HIGH_IRQ_BASE + 32) -+ -+#define BCM_6318_TIMER_IRQ (IRQ_INTERNAL_BASE + 31) -+#define BCM_6318_SPI_IRQ 0 -+#define BCM_6318_UART0_IRQ (IRQ_INTERNAL_BASE + 28) -+#define BCM_6318_UART1_IRQ 0 -+#define BCM_6318_DSL_IRQ (IRQ_INTERNAL_BASE + 21) -+#define BCM_6318_UDC0_IRQ 0 -+#define BCM_6318_ENET0_IRQ 0 -+#define BCM_6318_ENET1_IRQ 0 -+#define BCM_6318_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 12) -+#define BCM_6318_HSSPI_IRQ (IRQ_INTERNAL_BASE + 29) -+#define BCM_6318_OHCI0_IRQ (BCM_6318_HIGH_IRQ_BASE + 9) -+#define BCM_6318_EHCI0_IRQ (BCM_6318_HIGH_IRQ_BASE + 10) -+#define BCM_6318_USBD_IRQ (IRQ_INTERNAL_BASE + 4) -+#define BCM_6318_USBD_RXDMA0_IRQ (IRQ_INTERNAL_BASE + 5) -+#define BCM_6318_USBD_TXDMA0_IRQ (IRQ_INTERNAL_BASE + 6) -+#define BCM_6318_USBD_RXDMA1_IRQ (IRQ_INTERNAL_BASE + 7) -+#define BCM_6318_USBD_TXDMA1_IRQ (IRQ_INTERNAL_BASE + 8) -+#define BCM_6318_USBD_RXDMA2_IRQ (IRQ_INTERNAL_BASE + 9) -+#define BCM_6318_USBD_TXDMA2_IRQ (IRQ_INTERNAL_BASE + 10) -+#define BCM_6318_PCMCIA_IRQ 0 -+#define BCM_6318_ENET0_RXDMA_IRQ 0 -+#define BCM_6318_ENET0_TXDMA_IRQ 0 -+#define BCM_6318_ENET1_RXDMA_IRQ 0 -+#define BCM_6318_ENET1_TXDMA_IRQ 0 -+#define BCM_6318_PCI_IRQ (IRQ_INTERNAL_BASE + 23) -+#define BCM_6318_ATM_IRQ 0 -+#define BCM_6318_ENETSW_RXDMA0_IRQ (BCM_6318_HIGH_IRQ_BASE + 0) -+#define BCM_6318_ENETSW_RXDMA1_IRQ (BCM_6318_HIGH_IRQ_BASE + 1) -+#define BCM_6318_ENETSW_RXDMA2_IRQ (BCM_6318_HIGH_IRQ_BASE + 2) -+#define BCM_6318_ENETSW_RXDMA3_IRQ (BCM_6318_HIGH_IRQ_BASE + 3) -+#define BCM_6318_ENETSW_TXDMA0_IRQ (BCM_6318_VERY_HIGH_IRQ_BASE + 10) -+#define BCM_6318_ENETSW_TXDMA1_IRQ (BCM_6318_VERY_HIGH_IRQ_BASE + 11) -+#define BCM_6318_ENETSW_TXDMA2_IRQ (BCM_6318_VERY_HIGH_IRQ_BASE + 12) -+#define BCM_6318_ENETSW_TXDMA3_IRQ (BCM_6318_VERY_HIGH_IRQ_BASE + 13) -+#define BCM_6318_XTM_IRQ (BCM_6318_HIGH_IRQ_BASE + 31) -+#define BCM_6318_XTM_DMA0_IRQ (BCM_6318_HIGH_IRQ_BASE + 11) -+ -+#define BCM_6318_PCM_DMA0_IRQ (IRQ_INTERNAL_BASE + 2) -+#define BCM_6318_PCM_DMA1_IRQ (IRQ_INTERNAL_BASE + 3) -+#define BCM_6318_EXT_IRQ0 (IRQ_INTERNAL_BASE + 24) -+#define BCM_6318_EXT_IRQ1 (IRQ_INTERNAL_BASE + 25) -+#define BCM_6318_EXT_IRQ2 (IRQ_INTERNAL_BASE + 26) -+#define BCM_6318_EXT_IRQ3 (IRQ_INTERNAL_BASE + 27) - - /* - * 6328 irqs ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -@@ -53,6 +53,39 @@ - CKCTL_3368_EMUSB_EN | \ - CKCTL_3368_USBU_EN) - -+#define CKCTL_6318_ADSL_ASB_EN (1 << 0) -+#define CKCTL_6318_USB_ASB_EN (1 << 1) -+#define CKCTL_6318_MIPS_ASB_EN (1 << 2) -+#define CKCTL_6318_PCIE_ASB_EN (1 << 3) -+#define CKCTL_6318_PHYMIPS_ASB_EN (1 << 4) -+#define CKCTL_6318_ROBOSW_ASB_EN (1 << 5) -+#define CKCTL_6318_SAR_ASB_EN (1 << 6) -+#define CKCTL_6318_SDR_ASB_EN (1 << 7) -+#define CKCTL_6318_SWREG_ASB_EN (1 << 8) -+#define CKCTL_6318_PERIPH_ASB_EN (1 << 9) -+#define CKCTL_6318_CPUBUS160_EN (1 << 10) -+#define CKCTL_6318_ADSL_EN (1 << 11) -+#define CKCTL_6318_SAR125_EN (1 << 12) -+#define CKCTL_6318_MIPS_EN (1 << 13) -+#define CKCTL_6318_PCIE_EN (1 << 14) -+#define CKCTL_6318_ROBOSW250_EN (1 << 16) -+#define CKCTL_6318_ROBOSW025_EN (1 << 17) -+#define CKCTL_6318_SDR_EN (1 << 19) -+#define CKCTL_6318_USB_EN (1 << 20) /* both device and host */ -+#define CKCTL_6318_HSSPI_EN (1 << 25) -+#define CKCTL_6318_PCIE25_EN (1 << 27) -+#define CKCTL_6318_PHYMIPS_EN (1 << 28) -+#define CKCTL_6318_ADSL_AFE_EN (1 << 29) -+#define CKCTL_6318_ADSL_QPROC_EN (1 << 30) -+ -+#define CKCTL_6318_ALL_SAFE_EN (CKCTL_6318_PHYMIPS_EN | \ -+ CKCTL_6318_ADSL_QPROC_EN | \ -+ CKCTL_6318_ADSL_AFE_EN | \ -+ CKCTL_6318_ADSL_EN | \ -+ CKCTL_6318_SAR_EN | \ -+ CKCTL_6318_USB_EN | \ -+ CKCTL_6318_PCIE_EN) -+ - #define CKCTL_6328_PHYMIPS_EN (1 << 0) - #define CKCTL_6328_ADSL_QPROC_EN (1 << 1) - #define CKCTL_6328_ADSL_AFE_EN (1 << 2) -@@ -260,12 +293,27 @@ - CKCTL_63268_TBUS_EN | \ - CKCTL_63268_ROBOSW250_EN) - -+/* UBUS Clock Control register */ -+#define PERF_UB_CKCTL_REG 0x10 -+ -+#define UB_CKCTL_6318_ADSL_EN (1 << 0) -+#define UB_CKCTL_6318_ARB_EN (1 << 1) -+#define UB_CKCTL_6318_MIPS_EN (1 << 2) -+#define UB_CKCTL_6318_PCIE_EN (1 << 3) -+#define UB_CKCTL_6318_PERIPH_EN (1 << 4) -+#define UB_CKCTL_6318_PHYMIPS_EN (1 << 5) -+#define UB_CKCTL_6318_ROBOSW_EN (1 << 6) -+#define UB_CKCTL_6318_SAR_EN (1 << 7) -+#define UB_CKCTL_6318_SDR_EN (1 << 8) -+#define UB_CKCTL_6318_USB_EN (1 << 9) -+ - /* System PLL Control register */ - #define PERF_SYS_PLL_CTL_REG 0x8 - #define SYS_PLL_SOFT_RESET 0x1 - - /* Interrupt Mask register */ - #define PERF_IRQMASK_3368_REG 0xc -+#define PERF_IRQMASK_6318_REG 0x20 - #define PERF_IRQMASK_6328_REG(x) (0x20 + (x) * 0x10) - #define PERF_IRQMASK_6338_REG 0xc - #define PERF_IRQMASK_6345_REG 0xc -@@ -277,6 +325,7 @@ - - /* Interrupt Status register */ - #define PERF_IRQSTAT_3368_REG 0x10 -+#define PERF_IRQSTAT_6318_REG 0x30 - #define PERF_IRQSTAT_6328_REG(x) (0x28 + (x) * 0x10) - #define PERF_IRQSTAT_6338_REG 0x10 - #define PERF_IRQSTAT_6345_REG 0x10 -@@ -288,6 +337,7 @@ - - /* External Interrupt Configuration register */ - #define PERF_EXTIRQ_CFG_REG_3368 0x14 -+#define PERF_EXTIRQ_CFG_REG_6318 0x18 - #define PERF_EXTIRQ_CFG_REG_6328 0x18 - #define PERF_EXTIRQ_CFG_REG_6338 0x14 - #define PERF_EXTIRQ_CFG_REG_6345 0x14 -@@ -322,6 +372,7 @@ - - /* Soft Reset register */ - #define PERF_SOFTRESET_REG 0x28 -+#define PERF_SOFTRESET_6318_REG 0x10 - #define PERF_SOFTRESET_6328_REG 0x10 - #define PERF_SOFTRESET_6358_REG 0x34 - #define PERF_SOFTRESET_6362_REG 0x10 -@@ -335,6 +386,18 @@ - #define SOFTRESET_3368_USBS_MASK (1 << 11) - #define SOFTRESET_3368_PCM_MASK (1 << 13) - -+#define SOFTRESET_6318_SPI_MASK (1 << 0) -+#define SOFTRESET_6318_EPHY_MASK (1 << 1) -+#define SOFTRESET_6318_SAR_MASK (1 << 2) -+#define SOFTRESET_6318_ENETSW_MASK (1 << 3) -+#define SOFTRESET_6318_USBS_MASK (1 << 4) -+#define SOFTRESET_6318_USBH_MASK (1 << 5) -+#define SOFTRESET_6318_PCIE_CORE_MASK (1 << 6) -+#define SOFTRESET_6318_PCIE_MASK (1 << 7) -+#define SOFTRESET_6318_PCIE_EXT_MASK (1 << 8) -+#define SOFTRESET_6318_PCIE_HARD_MASK (1 << 9) -+#define SOFTRESET_6318_ADSL_MASK (1 << 10) -+ - #define SOFTRESET_6328_SPI_MASK (1 << 0) - #define SOFTRESET_6328_EPHY_MASK (1 << 1) - #define SOFTRESET_6328_SAR_MASK (1 << 2) -@@ -506,8 +569,17 @@ - #define TIMER_IRQSTAT_TIMER1_IR_EN (1 << 9) - #define TIMER_IRQSTAT_TIMER2_IR_EN (1 << 10) - -+#define TIMER_IRQMASK_6318_REG 0x0 -+#define TIMER_IRQSTAT_6318_REG 0x4 -+#define IRQSTATMASK_TIMER0 (1 << 0) -+#define IRQSTATMASK_TIMER1 (1 << 1) -+#define IRQSTATMASK_TIMER2 (1 << 2) -+#define IRQSTATMASK_TIMER3 (1 << 3) -+#define IRQSTATMASK_WDT (1 << 4) -+ - /* Timer control register */ - #define TIMER_CTLx_REG(x) (0x4 + (x * 4)) -+#define TIMER_CTRx_6318_REG(x) (0x8 + (x * 4)) - #define TIMER_CTL0_REG 0x4 - #define TIMER_CTL1_REG 0x8 - #define TIMER_CTL2_REG 0xC -@@ -1259,6 +1331,8 @@ - #define SDRAM_CFG_32B_MASK (1 << SDRAM_CFG_32B_SHIFT) - #define SDRAM_CFG_BANK_SHIFT 13 - #define SDRAM_CFG_BANK_MASK (1 << SDRAM_CFG_BANK_SHIFT) -+#define SDRAM_CFG_6318_SPACE_SHIFT 4 -+#define SDRAM_CFG_6318_SPACE_MASK (0xf << SDRAM_CFG_6318_SPACE_SHIFT) - - #define SDRAM_MBASE_REG 0xc - ---- a/arch/mips/include/asm/mach-bcm63xx/ioremap.h -+++ b/arch/mips/include/asm/mach-bcm63xx/ioremap.h -@@ -18,6 +18,7 @@ static inline int is_bcm63xx_internal_re - if (offset >= 0xfff00000) - return 1; - break; -+ case BCM6318_CPU_ID: - case BCM6328_CPU_ID: - case BCM6362_CPU_ID: - case BCM6368_CPU_ID: ---- a/arch/mips/bcm63xx/dev-hsspi.c -+++ b/arch/mips/bcm63xx/dev-hsspi.c -@@ -35,7 +35,8 @@ static struct platform_device bcm63xx_hs - - int __init bcm63xx_hsspi_register(void) - { -- if (!BCMCPU_IS_6328() && !BCMCPU_IS_6362() && !BCMCPU_IS_63268()) -+ if (!BCMCPU_IS_6318() && !BCMCPU_IS_6328() && !BCMCPU_IS_6362() && -+ !BCMCPU_IS_63268()) - return -ENODEV; - - spi_resources[0].start = bcm63xx_regset_address(RSET_HSSPI); ---- a/arch/mips/bcm63xx/dev-usb-usbd.c -+++ b/arch/mips/bcm63xx/dev-usb-usbd.c -@@ -41,7 +41,7 @@ int __init bcm63xx_usbd_register(const s - IRQ_USBD_RXDMA2, IRQ_USBD_TXDMA2 }; - int i; - -- if (!BCMCPU_IS_6328() && !BCMCPU_IS_6368()) -+ if (!BCMCPU_IS_6318() && !BCMCPU_IS_6328() && !BCMCPU_IS_6368()) - return 0; - - usbd_resources[0].start = bcm63xx_regset_address(RSET_USBD); ---- a/arch/mips/bcm63xx/dev-enet.c -+++ b/arch/mips/bcm63xx/dev-enet.c -@@ -184,8 +184,8 @@ static int __init register_shared(void) - else - shared_res[0].end += (RSET_ENETDMA_SIZE) - 1; - -- if (BCMCPU_IS_6328() || BCMCPU_IS_6362() || BCMCPU_IS_6368() || -- BCMCPU_IS_63268()) -+ if (BCMCPU_IS_6318() || BCMCPU_IS_6328() || BCMCPU_IS_6362() || -+ BCMCPU_IS_6368() || BCMCPU_IS_63268()) - chan_count = 32; - else if (BCMCPU_IS_6345()) - chan_count = 8; -@@ -293,8 +293,8 @@ bcm63xx_enetsw_register(const struct bcm - { - int ret; - -- if (!BCMCPU_IS_6328() && !BCMCPU_IS_6362() && !BCMCPU_IS_6368() && -- !BCMCPU_IS_63268()) -+ if (!BCMCPU_IS_6318() && !BCMCPU_IS_6328() && !BCMCPU_IS_6362() && -+ !BCMCPU_IS_6368() && !BCMCPU_IS_63268()) - return -ENODEV; - - ret = register_shared(); -@@ -311,7 +311,7 @@ bcm63xx_enetsw_register(const struct bcm - - memcpy(bcm63xx_enetsw_device.dev.platform_data, pd, sizeof(*pd)); - -- if (BCMCPU_IS_6328()) -+ if (BCMCPU_IS_6318() || BCMCPU_IS_6328()) - enetsw_pd.num_ports = ENETSW_PORTS_6328; - else if (BCMCPU_IS_6362() || BCMCPU_IS_6368()) - enetsw_pd.num_ports = ENETSW_PORTS_6368; ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h -@@ -10,6 +10,8 @@ int __init bcm63xx_gpio_init(void); - static inline unsigned long bcm63xx_gpio_count(void) - { - switch (bcm63xx_get_cpu_id()) { -+ case BCM6318_CPU_ID: -+ return 50; - case BCM6328_CPU_ID: - return 32; - case BCM3368_CPU_ID: ---- a/arch/mips/bcm63xx/dev-usb-ehci.c -+++ b/arch/mips/bcm63xx/dev-usb-ehci.c -@@ -81,7 +81,8 @@ static struct platform_device bcm63xx_eh - - int __init bcm63xx_ehci_register(void) - { -- if (!BCMCPU_IS_6328() && !BCMCPU_IS_6358() && !BCMCPU_IS_6362() && !BCMCPU_IS_6368()) -+ if (!BCMCPU_IS_6318() && !BCMCPU_IS_6328() && !BCMCPU_IS_6358() && -+ !BCMCPU_IS_6362() && !BCMCPU_IS_6368()) - return 0; - - ehci_resources[0].start = bcm63xx_regset_address(RSET_EHCI0); diff --git a/target/linux/bcm63xx/patches-5.15/342-MIPS-BCM63XX-split-PCIe-reset-signals.patch b/target/linux/bcm63xx/patches-5.15/342-MIPS-BCM63XX-split-PCIe-reset-signals.patch deleted file mode 100644 index e359311750e089..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/342-MIPS-BCM63XX-split-PCIe-reset-signals.patch +++ /dev/null @@ -1,156 +0,0 @@ -From 4bdfacdeaf3c988c4f3256c88118893eac640b03 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 8 Dec 2013 14:17:50 +0100 -Subject: [PATCH 52/53] MIPS: BCM63XX: split PCIE reset signals - ---- - arch/mips/bcm63xx/reset.c | 39 ++++++++++++++-------- - arch/mips/include/asm/mach-bcm63xx/bcm63xx_reset.h | 2 ++ - arch/mips/pci/pci-bcm63xx.c | 7 ++++ - 3 files changed, 34 insertions(+), 14 deletions(-) - ---- a/arch/mips/bcm63xx/reset.c -+++ b/arch/mips/bcm63xx/reset.c -@@ -29,7 +29,9 @@ - [BCM63XX_RESET_PCM] = BCM## __cpu ##_RESET_PCM, \ - [BCM63XX_RESET_MPI] = BCM## __cpu ##_RESET_MPI, \ - [BCM63XX_RESET_PCIE] = BCM## __cpu ##_RESET_PCIE, \ -- [BCM63XX_RESET_PCIE_EXT] = BCM## __cpu ##_RESET_PCIE_EXT, -+ [BCM63XX_RESET_PCIE_EXT] = BCM## __cpu ##_RESET_PCIE_EXT, \ -+ [BCM63XX_RESET_PCIE_CORE] = BCM## __cpu ##_RESET_PCIE_CORE, \ -+ [BCM63XX_RESET_PCIE_HARD] = BCM## __cpu ##_RESET_PCIE_HARD, - - #define BCM3368_RESET_SPI SOFTRESET_3368_SPI_MASK - #define BCM3368_RESET_ENET SOFTRESET_3368_ENET_MASK -@@ -43,6 +45,8 @@ - #define BCM3368_RESET_MPI SOFTRESET_3368_MPI_MASK - #define BCM3368_RESET_PCIE 0 - #define BCM3368_RESET_PCIE_EXT 0 -+#define BCM3368_RESET_PCIE_CORE 0 -+#define BCM3368_RESET_PCIE_HARD 0 - - - #define BCM6318_RESET_SPI SOFTRESET_6318_SPI_MASK -@@ -55,11 +59,10 @@ - #define BCM6318_RESET_ENETSW SOFTRESET_6318_ENETSW_MASK - #define BCM6318_RESET_PCM 0 - #define BCM6318_RESET_MPI 0 --#define BCM6318_RESET_PCIE \ -- (SOFTRESET_6318_PCIE_MASK | \ -- SOFTRESET_6318_PCIE_CORE_MASK | \ -- SOFTRESET_6318_PCIE_HARD_MASK) -+#define BCM6318_RESET_PCIE SOFTRESET_6318_PCIE_MASK - #define BCM6318_RESET_PCIE_EXT SOFTRESET_6318_PCIE_EXT_MASK -+#define BCM6318_RESET_PCIE_CORE SOFTRESET_6318_PCIE_CORE_MASK -+#define BCM6318_RESET_PCIE_HARD SOFTRESET_6318_PCIE_HARD_MASK - - #define BCM6328_RESET_SPI SOFTRESET_6328_SPI_MASK - #define BCM6328_RESET_ENET 0 -@@ -71,11 +74,10 @@ - #define BCM6328_RESET_ENETSW SOFTRESET_6328_ENETSW_MASK - #define BCM6328_RESET_PCM SOFTRESET_6328_PCM_MASK - #define BCM6328_RESET_MPI 0 --#define BCM6328_RESET_PCIE \ -- (SOFTRESET_6328_PCIE_MASK | \ -- SOFTRESET_6328_PCIE_CORE_MASK | \ -- SOFTRESET_6328_PCIE_HARD_MASK) -+#define BCM6328_RESET_PCIE SOFTRESET_6328_PCIE_MASK - #define BCM6328_RESET_PCIE_EXT SOFTRESET_6328_PCIE_EXT_MASK -+#define BCM6328_RESET_PCIE_CORE SOFTRESET_6328_PCIE_CORE_MASK -+#define BCM6328_RESET_PCIE_HARD SOFTRESET_6328_PCIE_HARD_MASK - - #define BCM6338_RESET_SPI SOFTRESET_6338_SPI_MASK - #define BCM6338_RESET_ENET SOFTRESET_6338_ENET_MASK -@@ -89,6 +91,8 @@ - #define BCM6338_RESET_MPI 0 - #define BCM6338_RESET_PCIE 0 - #define BCM6338_RESET_PCIE_EXT 0 -+#define BCM6338_RESET_PCIE_CORE 0 -+#define BCM6338_RESET_PCIE_HARD 0 - - #define BCM6348_RESET_SPI SOFTRESET_6348_SPI_MASK - #define BCM6348_RESET_ENET SOFTRESET_6348_ENET_MASK -@@ -102,6 +106,8 @@ - #define BCM6348_RESET_MPI 0 - #define BCM6348_RESET_PCIE 0 - #define BCM6348_RESET_PCIE_EXT 0 -+#define BCM6348_RESET_PCIE_CORE 0 -+#define BCM6348_RESET_PCIE_HARD 0 - - #define BCM6358_RESET_SPI SOFTRESET_6358_SPI_MASK - #define BCM6358_RESET_ENET SOFTRESET_6358_ENET_MASK -@@ -115,6 +121,8 @@ - #define BCM6358_RESET_MPI SOFTRESET_6358_MPI_MASK - #define BCM6358_RESET_PCIE 0 - #define BCM6358_RESET_PCIE_EXT 0 -+#define BCM6358_RESET_PCIE_CORE 0 -+#define BCM6358_RESET_PCIE_HARD 0 - - #define BCM6362_RESET_SPI SOFTRESET_6362_SPI_MASK - #define BCM6362_RESET_ENET 0 -@@ -126,9 +134,10 @@ - #define BCM6362_RESET_ENETSW SOFTRESET_6362_ENETSW_MASK - #define BCM6362_RESET_PCM SOFTRESET_6362_PCM_MASK - #define BCM6362_RESET_MPI 0 --#define BCM6362_RESET_PCIE (SOFTRESET_6362_PCIE_MASK | \ -- SOFTRESET_6362_PCIE_CORE_MASK) -+#define BCM6362_RESET_PCIE SOFTRESET_6362_PCIE_MASK - #define BCM6362_RESET_PCIE_EXT SOFTRESET_6362_PCIE_EXT_MASK -+#define BCM6362_RESET_PCIE_CORE SOFTRESET_6362_PCIE_CORE_MASK -+#define BCM6362_RESET_PCIE_HARD 0 - - #define BCM6368_RESET_SPI SOFTRESET_6368_SPI_MASK - #define BCM6368_RESET_ENET 0 -@@ -142,6 +151,8 @@ - #define BCM6368_RESET_MPI SOFTRESET_6368_MPI_MASK - #define BCM6368_RESET_PCIE 0 - #define BCM6368_RESET_PCIE_EXT 0 -+#define BCM6368_RESET_PCIE_CORE 0 -+#define BCM6368_RESET_PCIE_HARD 0 - - #define BCM63268_RESET_SPI SOFTRESET_63268_SPI_MASK - #define BCM63268_RESET_ENET 0 -@@ -153,10 +164,10 @@ - #define BCM63268_RESET_ENETSW SOFTRESET_63268_ENETSW_MASK - #define BCM63268_RESET_PCM SOFTRESET_63268_PCM_MASK - #define BCM63268_RESET_MPI 0 --#define BCM63268_RESET_PCIE (SOFTRESET_63268_PCIE_MASK | \ -- SOFTRESET_63268_PCIE_CORE_MASK | \ -- SOFTRESET_63268_PCIE_HARD_MASK) -+#define BCM63268_RESET_PCIE SOFTRESET_63268_PCIE_MASK - #define BCM63268_RESET_PCIE_EXT SOFTRESET_63268_PCIE_EXT_MASK -+#define BCM63268_RESET_PCIE_CORE SOFTRESET_63268_PCIE_CORE_MASK -+#define BCM63268_RESET_PCIE_HARD SOFTRESET_63268_PCIE_HARD_MASK - - /* - * core reset bits ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_reset.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_reset.h -@@ -15,6 +15,8 @@ enum bcm63xx_core_reset { - BCM63XX_RESET_MPI, - BCM63XX_RESET_PCIE, - BCM63XX_RESET_PCIE_EXT, -+ BCM63XX_RESET_PCIE_CORE, -+ BCM63XX_RESET_PCIE_HARD, - }; - - void bcm63xx_core_set_reset(enum bcm63xx_core_reset, int reset); ---- a/arch/mips/pci/pci-bcm63xx.c -+++ b/arch/mips/pci/pci-bcm63xx.c -@@ -135,9 +135,16 @@ static void __init bcm63xx_reset_pcie(vo - - /* reset the PCIe core */ - bcm63xx_core_set_reset(BCM63XX_RESET_PCIE, 1); -+ bcm63xx_core_set_reset(BCM63XX_RESET_PCIE_CORE, 1); - bcm63xx_core_set_reset(BCM63XX_RESET_PCIE_EXT, 1); -+ if (BCMCPU_IS_6328() || BCMCPU_IS_63268()) { -+ bcm63xx_core_set_reset(BCM63XX_RESET_PCIE_HARD, 1); -+ mdelay(10); -+ bcm63xx_core_set_reset(BCM63XX_RESET_PCIE_HARD, 0); -+ } - mdelay(10); - -+ bcm63xx_core_set_reset(BCM63XX_RESET_PCIE_CORE, 0); - bcm63xx_core_set_reset(BCM63XX_RESET_PCIE, 0); - mdelay(10); - diff --git a/target/linux/bcm63xx/patches-5.15/343-MIPS-BCM63XX-add-PCIe-support-for-BCM6318.patch b/target/linux/bcm63xx/patches-5.15/343-MIPS-BCM63XX-add-PCIe-support-for-BCM6318.patch deleted file mode 100644 index feba1a6ef71eb0..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/343-MIPS-BCM63XX-add-PCIe-support-for-BCM6318.patch +++ /dev/null @@ -1,333 +0,0 @@ -From 11a8ab8dac4ef5d0d70199843043927edce1d4db Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 15 Dec 2013 20:47:34 +0100 -Subject: [PATCH 53/53] MIPS: BCM63XX: add PCIe support for BCM6318 - ---- - arch/mips/bcm63xx/clk.c | 25 ++++- - arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h | 6 ++ - arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h | 60 +++++++++++- - arch/mips/pci/ops-bcm63xx.c | 16 +++- - arch/mips/pci/pci-bcm63xx.c | 106 ++++++++++++++++++---- - 5 files changed, 184 insertions(+), 29 deletions(-) - ---- a/arch/mips/bcm63xx/clk.c -+++ b/arch/mips/bcm63xx/clk.c -@@ -64,6 +64,18 @@ static void bcm_gpiorobosw_set(u32 mask, - bcm_gpio_writel(reg, GPIO_ROBOSW_SW_CTRL_REG); - } - -+static void bcm_ub_hwclock_set(u32 mask, int enable) -+{ -+ u32 reg; -+ -+ reg = bcm_perf_readl(PERF_UB_CKCTL_REG); -+ if (enable) -+ reg |= mask; -+ else -+ reg &= ~mask; -+ bcm_perf_writel(reg, PERF_UB_CKCTL_REG); -+} -+ - /* - * Ethernet MAC "misc" clock: dma clocks and main clock on 6348 - */ -@@ -376,12 +388,17 @@ static struct clk clk_ipsec = { - - static void pcie_set(struct clk *clk, int enable) - { -- if (BCMCPU_IS_6328()) -+ if (BCMCPU_IS_6318()) { -+ bcm_hwclock_set(CKCTL_6318_PCIE_EN, enable); -+ bcm_hwclock_set(CKCTL_6318_PCIE25_EN, enable); -+ bcm_ub_hwclock_set(UB_CKCTL_6318_PCIE_EN, enable); -+ } else if (BCMCPU_IS_6328()) { - bcm_hwclock_set(CKCTL_6328_PCIE_EN, enable); -- else if (BCMCPU_IS_6362()) -+ } else if (BCMCPU_IS_6362()) { - bcm_hwclock_set(CKCTL_6362_PCIE_EN, enable); -- else if (BCMCPU_IS_63268()) -+ } else if (BCMCPU_IS_63268()) { - bcm_hwclock_set(CKCTL_63268_PCIE_EN, enable); -+ } - } - - static struct clk clk_pcie = { ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h -@@ -41,6 +41,12 @@ - #define BCM_CB_MEM_END_PA (BCM_CB_MEM_BASE_PA + \ - BCM_CB_MEM_SIZE - 1) - -+#define BCM_PCIE_MEM_BASE_PA_6318 0x10200000 -+#define BCM_PCIE_MEM_SIZE_6318 (1 * 1024 * 1024) -+#define BCM_PCIE_MEM_END_PA_6318 (BCM_PCIE_MEM_BASE_PA_6318 + \ -+ BCM_PCIE_MEM_SIZE_6318 - 1) -+ -+ - #define BCM_PCIE_MEM_BASE_PA_6328 0x10f00000 - #define BCM_PCIE_MEM_SIZE_6328 (1 * 1024 * 1024) - #define BCM_PCIE_MEM_END_PA_6328 (BCM_PCIE_MEM_BASE_PA_6328 + \ ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -@@ -1535,6 +1535,17 @@ - * _REG relative to RSET_PCIE - *************************************************************************/ - -+#define PCIE_SPECIFIC_REG 0x188 -+#define SPECIFIC_ENDIAN_MODE_BAR1_SHIFT 0 -+#define SPECIFIC_ENDIAN_MODE_BAR1_MASK (0x3 << SPECIFIC_ENDIAN_MODE_BAR1_SHIFT) -+#define SPECIFIC_ENDIAN_MODE_BAR2_SHIFT 2 -+#define SPECIFIC_ENDIAN_MODE_BAR2_MASK (0x3 << SPECIFIC_ENDIAN_MODE_BAR1_SHIFT) -+#define SPECIFIC_ENDIAN_MODE_BAR3_SHIFT 4 -+#define SPECIFIC_ENDIAN_MODE_BAR3_MASK (0x3 << SPECIFIC_ENDIAN_MODE_BAR1_SHIFT) -+#define SPECIFIC_ENDIAN_MODE_WORD_ALIGN 0 -+#define SPECIFIC_ENDIAN_MODE_HALFWORD_ALIGN 1 -+#define SPECIFIC_ENDIAN_MODE_BYTE_ALIGN 2 -+ - #define PCIE_CONFIG2_REG 0x408 - #define CONFIG2_BAR1_SIZE_EN 1 - #define CONFIG2_BAR1_SIZE_MASK 0xf -@@ -1580,7 +1591,54 @@ - #define PCIE_RC_INT_C (1 << 2) - #define PCIE_RC_INT_D (1 << 3) - --#define PCIE_DEVICE_OFFSET 0x8000 -+#define PCIE_CPU_2_PCIE_MEM_WIN0_LO_REG 0x400c -+#define C2P_MEM_WIN_ENDIAN_MODE_MASK 0x3 -+#define C2P_MEM_WIN_ENDIAN_NO_SWAP 0 -+#define C2P_MEM_WIN_ENDIAN_HALF_WORD_SWAP 1 -+#define C2P_MEM_WIN_ENDIAN_HALF_BYTE_SWAP 2 -+#define C2P_MEM_WIN_BASE_ADDR_SHIFT 20 -+#define C2P_MEM_WIN_BASE_ADDR_MASK (0xfff << C2P_MEM_WIN_BASE_ADDR_SHIFT) -+ -+#define PCIE_RC_BAR1_CONFIG_LO_REG 0x402c -+#define RC_BAR_CFG_LO_SIZE_256MB 0xd -+#define RC_BAR_CFG_LO_MATCH_ADDR_SHIFT 20 -+#define RC_BAR_CFG_LO_MATCH_ADDR_MASK (0xfff << RC_BAR_CFG_LO_MATCH_ADDR_SHIFT) -+ -+#define PCIE_CPU_2_PCIE_MEM_WIN0_BASELIMIT_REG 0x4070 -+#define C2P_BASELIMIT_LIMIT_SHIFT 20 -+#define C2P_BASELIMIT_LIMIT_MASK (0xfff << C2P_BASELIMIT_LIMIT_SHIFT) -+#define C2P_BASELIMIT_BASE_SHIFT 4 -+#define C2P_BASELIMIT_BASE_MASK (0xfff << C2P_BASELIMIT_BASE_SHIFT) -+ -+#define PCIE_UBUS_BAR1_CFG_REMAP_REG 0x4088 -+#define BAR1_CFG_REMAP_OFFSET_SHIFT 20 -+#define BAR1_CFG_REMAP_OFFSET_MASK (0xfff << BAR1_CFG_REMAP_OFFSET_SHIFT) -+#define BAR1_CFG_REMAP_ACCESS_EN 1 -+ -+#define PCIE_HARD_DEBUG_REG 0x4204 -+#define HARD_DEBUG_SERDES_IDDQ (1 << 23) -+ -+#define PCIE_CPU_INT1_MASK_CLEAR_REG 0x830c -+#define CPU_INT_PCIE_ERR_ATTN_CPU (1 << 0) -+#define CPU_INT_PCIE_INTA (1 << 1) -+#define CPU_INT_PCIE_INTB (1 << 2) -+#define CPU_INT_PCIE_INTC (1 << 3) -+#define CPU_INT_PCIE_INTD (1 << 4) -+#define CPU_INT_PCIE_INTR (1 << 5) -+#define CPU_INT_PCIE_NMI (1 << 6) -+#define CPU_INT_PCIE_UBUS (1 << 7) -+#define CPU_INT_IPI (1 << 8) -+ -+#define PCIE_EXT_CFG_INDEX_REG 0x8400 -+#define EXT_CFG_FUNC_NUM_SHIFT 12 -+#define EXT_CFG_FUNC_NUM_MASK (0x7 << EXT_CFG_FUNC_NUM_SHIFT) -+#define EXT_CFG_DEV_NUM_SHIFT 15 -+#define EXT_CFG_DEV_NUM_MASK (0xf << EXT_CFG_DEV_NUM_SHIFT) -+#define EXT_CFG_BUS_NUM_SHIFT 20 -+#define EXT_CFG_BUS_NUM_MASK (0xff << EXT_CFG_BUS_NUM_SHIFT) -+ -+#define PCIE_DEVICE_OFFSET_6318 0x9000 -+#define PCIE_DEVICE_OFFSET_6328 0x8000 - - /************************************************************************* - * _REG relative to RSET_OTP ---- a/arch/mips/pci/ops-bcm63xx.c -+++ b/arch/mips/pci/ops-bcm63xx.c -@@ -489,8 +489,12 @@ static int bcm63xx_pcie_read(struct pci_ - if (!bcm63xx_pcie_can_access(bus, devfn)) - return PCIBIOS_DEVICE_NOT_FOUND; - -- if (bus->number == PCIE_BUS_DEVICE) -- reg += PCIE_DEVICE_OFFSET; -+ if (bus->number == PCIE_BUS_DEVICE) { -+ if (BCMCPU_IS_6318()) -+ reg += PCIE_DEVICE_OFFSET_6318; -+ else -+ reg += PCIE_DEVICE_OFFSET_6328; -+ } - - data = bcm_pcie_readl(reg); - -@@ -509,8 +513,12 @@ static int bcm63xx_pcie_write(struct pci - if (!bcm63xx_pcie_can_access(bus, devfn)) - return PCIBIOS_DEVICE_NOT_FOUND; - -- if (bus->number == PCIE_BUS_DEVICE) -- reg += PCIE_DEVICE_OFFSET; -+ if (bus->number == PCIE_BUS_DEVICE) { -+ if (BCMCPU_IS_6318()) -+ reg += PCIE_DEVICE_OFFSET_6318; -+ else -+ reg += PCIE_DEVICE_OFFSET_6328; -+ } - - - data = bcm_pcie_readl(reg); ---- a/arch/mips/pci/pci-bcm63xx.c -+++ b/arch/mips/pci/pci-bcm63xx.c -@@ -118,7 +118,7 @@ static void bcm63xx_int_cfg_writel(u32 v - - void __iomem *pci_iospace_start; - --static void __init bcm63xx_reset_pcie(void) -+static void __init bcm63xx_reset_pcie_gen1(void) - { - u32 val; - u32 reg; -@@ -152,20 +152,32 @@ static void __init bcm63xx_reset_pcie(vo - mdelay(200); - } - --static struct clk *pcie_clk; -- --static int __init bcm63xx_register_pcie(void) -+static void __init bcm63xx_reset_pcie_gen2(void) - { - u32 val; - -- /* enable clock */ -- pcie_clk = clk_get(NULL, "pcie"); -- if (IS_ERR_OR_NULL(pcie_clk)) -- return -ENODEV; -+ bcm63xx_core_set_reset(BCM63XX_RESET_PCIE_HARD, 0); - -- clk_prepare_enable(pcie_clk); -+ /* reset the PCIe core */ -+ bcm63xx_core_set_reset(BCM63XX_RESET_PCIE, 1); -+ bcm63xx_core_set_reset(BCM63XX_RESET_PCIE_EXT, 1); -+ bcm63xx_core_set_reset(BCM63XX_RESET_PCIE_CORE, 1); -+ mdelay(10); -+ bcm63xx_core_set_reset(BCM63XX_RESET_PCIE_EXT, 0); -+ mdelay(10); -+ bcm63xx_core_set_reset(BCM63XX_RESET_PCIE, 0); -+ mdelay(10); -+ val = bcm_pcie_readl(PCIE_HARD_DEBUG_REG); -+ val &= ~HARD_DEBUG_SERDES_IDDQ; -+ bcm_pcie_writel(val, PCIE_HARD_DEBUG_REG); -+ mdelay(10); -+ bcm63xx_core_set_reset(BCM63XX_RESET_PCIE_CORE, 0); -+ mdelay(200); -+} - -- bcm63xx_reset_pcie(); -+static void __init bcm63xx_init_pcie_gen1(void) -+{ -+ u32 val; - - /* configure the PCIe bridge */ - val = bcm_pcie_readl(PCIE_BRIDGE_OPT1_REG); -@@ -190,6 +202,65 @@ static int __init bcm63xx_register_pcie( - val |= OPT2_CFG_TYPE1_BD_SEL; - bcm_pcie_writel(val, PCIE_BRIDGE_OPT2_REG); - -+ /* set bar0 to little endian */ -+ val = (bcm_pcie_mem_resource.start >> 20) << BASEMASK_BASE_SHIFT; -+ val |= (bcm_pcie_mem_resource.end >> 20) << BASEMASK_MASK_SHIFT; -+ val |= BASEMASK_REMAP_EN; -+ bcm_pcie_writel(val, PCIE_BRIDGE_BAR0_BASEMASK_REG); -+ -+ val = (bcm_pcie_mem_resource.start >> 20) << REBASE_ADDR_BASE_SHIFT; -+ bcm_pcie_writel(val, PCIE_BRIDGE_BAR0_REBASE_ADDR_REG); -+} -+ -+static void __init bcm63xx_init_pcie_gen2(void) -+{ -+ u32 val; -+ -+ bcm_pcie_writel(CPU_INT_PCIE_INTA | CPU_INT_PCIE_INTB | -+ CPU_INT_PCIE_INTC | CPU_INT_PCIE_INTD, -+ PCIE_CPU_INT1_MASK_CLEAR_REG); -+ -+ val = bcm_pcie_mem_resource.end & C2P_BASELIMIT_LIMIT_MASK; -+ val |= (bcm_pcie_mem_resource.start >> C2P_BASELIMIT_LIMIT_SHIFT) << -+ C2P_BASELIMIT_BASE_SHIFT; -+ -+ bcm_pcie_writel(val, PCIE_CPU_2_PCIE_MEM_WIN0_BASELIMIT_REG); -+ -+ /* set bar0 to little endian */ -+ val = bcm_pcie_readl(PCIE_CPU_2_PCIE_MEM_WIN0_LO_REG); -+ val |= bcm_pcie_mem_resource.start & C2P_MEM_WIN_BASE_ADDR_MASK; -+ val |= C2P_MEM_WIN_ENDIAN_HALF_BYTE_SWAP; -+ bcm_pcie_writel(val, PCIE_CPU_2_PCIE_MEM_WIN0_LO_REG); -+ -+ bcm_pcie_writel(SPECIFIC_ENDIAN_MODE_BYTE_ALIGN, PCIE_SPECIFIC_REG); -+ bcm_pcie_writel(RC_BAR_CFG_LO_SIZE_256MB, PCIE_RC_BAR1_CONFIG_LO_REG); -+ bcm_pcie_writel(BAR1_CFG_REMAP_ACCESS_EN, PCIE_UBUS_BAR1_CFG_REMAP_REG); -+ -+ bcm_pcie_writel(PCIE_BUS_DEVICE << EXT_CFG_BUS_NUM_SHIFT, -+ PCIE_EXT_CFG_INDEX_REG); -+} -+ -+static struct clk *pcie_clk; -+ -+static int __init bcm63xx_register_pcie(void) -+{ -+ u32 val; -+ -+ /* enable clock */ -+ pcie_clk = clk_get(NULL, "pcie"); -+ if (IS_ERR_OR_NULL(pcie_clk)) -+ return -ENODEV; -+ -+ clk_prepare_enable(pcie_clk); -+ -+ if (BCMCPU_IS_6328() || BCMCPU_IS_6362() || BCMCPU_IS_63268()) { -+ bcm63xx_reset_pcie_gen1(); -+ bcm63xx_init_pcie_gen1(); -+ } else { -+ bcm63xx_reset_pcie_gen2(); -+ bcm63xx_init_pcie_gen2(); -+ } -+ - /* setup class code as bridge */ - val = bcm_pcie_readl(PCIE_IDVAL3_REG); - val &= ~IDVAL3_CLASS_CODE_MASK; -@@ -201,15 +272,6 @@ static int __init bcm63xx_register_pcie( - val &= ~CONFIG2_BAR1_SIZE_MASK; - bcm_pcie_writel(val, PCIE_CONFIG2_REG); - -- /* set bar0 to little endian */ -- val = (bcm_pcie_mem_resource.start >> 20) << BASEMASK_BASE_SHIFT; -- val |= (bcm_pcie_mem_resource.end >> 20) << BASEMASK_MASK_SHIFT; -- val |= BASEMASK_REMAP_EN; -- bcm_pcie_writel(val, PCIE_BRIDGE_BAR0_BASEMASK_REG); -- -- val = (bcm_pcie_mem_resource.start >> 20) << REBASE_ADDR_BASE_SHIFT; -- bcm_pcie_writel(val, PCIE_BRIDGE_BAR0_REBASE_ADDR_REG); -- - register_pci_controller(&bcm63xx_pcie_controller); - - return 0; -@@ -341,7 +403,10 @@ static int __init bcm63xx_pci_init(void) - if (!bcm63xx_pci_enabled) - return -ENODEV; - -- if (BCMCPU_IS_6328() || BCMCPU_IS_6362()) { -+ if (BCMCPU_IS_6318()) { -+ bcm_pcie_mem_resource.start = BCM_PCIE_MEM_BASE_PA_6318; -+ bcm_pcie_mem_resource.end = BCM_PCIE_MEM_END_PA_6318; -+ } if (BCMCPU_IS_6328() || BCMCPU_IS_6362()) { - bcm_pcie_mem_resource.start = BCM_PCIE_MEM_BASE_PA_6328; - bcm_pcie_mem_resource.end = BCM_PCIE_MEM_END_PA_6328; - } else if (BCMCPU_IS_63268()) { -@@ -350,6 +415,7 @@ static int __init bcm63xx_pci_init(void) - } - - switch (bcm63xx_get_cpu_id()) { -+ case BCM6318_CPU_ID: - case BCM6328_CPU_ID: - case BCM6362_CPU_ID: - case BCM63268_CPU_ID: diff --git a/target/linux/bcm63xx/patches-5.15/344-MIPS-BCM63XX-detect-flash-type-early-and-store-the-r.patch b/target/linux/bcm63xx/patches-5.15/344-MIPS-BCM63XX-detect-flash-type-early-and-store-the-r.patch deleted file mode 100644 index cbe095c038dc45..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/344-MIPS-BCM63XX-detect-flash-type-early-and-store-the-r.patch +++ /dev/null @@ -1,74 +0,0 @@ -From 9a97177b907330971aa7bf41855fafc2602e1c18 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 22 Dec 2013 12:26:57 +0100 -Subject: [PATCH 51/56] MIPS: BCM63XX: detect flash type early and store the - result - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/dev-flash.c | 10 +++++++--- - arch/mips/bcm63xx/prom.c | 4 ++++ - arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h | 2 ++ - 3 files changed, 13 insertions(+), 3 deletions(-) - ---- a/arch/mips/bcm63xx/dev-flash.c -+++ b/arch/mips/bcm63xx/dev-flash.c -@@ -22,6 +22,8 @@ - #include - #include - -+static int flash_type; -+ - static struct mtd_partition mtd_partitions[] = { - { - .name = "cfe", -@@ -109,13 +111,15 @@ static int __init bcm63xx_detect_flash_t - } - } - -+void __init bcm63xx_flash_detect(void) -+{ -+ flash_type = bcm63xx_detect_flash_type(); -+} -+ - int __init bcm63xx_flash_register(void) - { -- int flash_type; - u32 val; - -- flash_type = bcm63xx_detect_flash_type(); -- - switch (flash_type) { - case BCM63XX_FLASH_TYPE_PARALLEL: - /* read base address of boot chip select (0) */ ---- a/arch/mips/bcm63xx/prom.c -+++ b/arch/mips/bcm63xx/prom.c -@@ -17,6 +17,7 @@ - #include - #include - #include -+#include - - void __init prom_init(void) - { -@@ -52,6 +53,9 @@ void __init prom_init(void) - reg &= ~mask; - bcm_perf_writel(reg, PERF_CKCTL_REG); - -+ /* detect and setup flash access */ -+ bcm63xx_flash_detect(); -+ - /* do low level board init */ - board_prom_init(); - ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h -@@ -8,6 +8,8 @@ enum { - BCM63XX_FLASH_TYPE_NAND, - }; - -+void bcm63xx_flash_detect(void); -+ - int __init bcm63xx_flash_register(void); - - #endif /* __BCM63XX_FLASH_H */ diff --git a/target/linux/bcm63xx/patches-5.15/345-MIPS-BCM63XX-fixup-mapped-SPI-flash-access-on-boot.patch b/target/linux/bcm63xx/patches-5.15/345-MIPS-BCM63XX-fixup-mapped-SPI-flash-access-on-boot.patch deleted file mode 100644 index 91dae6e3d8eab9..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/345-MIPS-BCM63XX-fixup-mapped-SPI-flash-access-on-boot.patch +++ /dev/null @@ -1,84 +0,0 @@ -From 1cacd0f7b0d35f8e3d3f8a69ecb3b5e436d6b9e8 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 22 Dec 2013 13:25:25 +0100 -Subject: [PATCH 52/56] MIPS: BCM63XX: fixup mapped SPI flash access on boot - -Some bootloaders leave the flash access in an invalid state with dual -read enabled; fix it by disabling it and falling back to simple fast -reads. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/dev-flash.c | 51 ++++++++++++++++++++++++++++++++++++ - 1 file changed, 51 insertions(+) - ---- a/arch/mips/bcm63xx/dev-flash.c -+++ b/arch/mips/bcm63xx/dev-flash.c -@@ -16,6 +16,7 @@ - #include - #include - #include -+#include - - #include - #include -@@ -111,9 +112,59 @@ static int __init bcm63xx_detect_flash_t - } - } - -+#define HSSPI_FLASH_CTRL_REG 0x14 -+#define FLASH_CTRL_READ_OPCODE_MASK 0xff -+#define FLASH_CTRL_ADDR_BYTES_MASK (0x3 << 8) -+#define FLASH_CTRL_ADDR_BYTES_2 (0 << 8) -+#define FLASH_CTRL_ADDR_BYTES_3 (1 << 8) -+#define FLASH_CTRL_ADDR_BYTES_4 (2 << 8) -+#define FLASH_CTRL_DUMMY_BYTES_SHIFT 10 -+#define FLASH_CTRL_DUMMY_BYTES_MASK (0x3 << FLASH_CTRL_DUMMY_BYTES_SHIFT) -+#define FLASH_CTRL_MB_EN (1 << 23) -+ - void __init bcm63xx_flash_detect(void) - { - flash_type = bcm63xx_detect_flash_type(); -+ -+ /* ensure flash mapping has sane values */ -+ if (flash_type == BCM63XX_FLASH_TYPE_SERIAL && -+ (BCMCPU_IS_6318() || BCMCPU_IS_6328() || BCMCPU_IS_6362() || -+ BCMCPU_IS_63268())) { -+ u32 val = bcm_rset_readl(RSET_HSSPI, HSSPI_FLASH_CTRL_REG); -+ -+ if (val & FLASH_CTRL_MB_EN) { -+ /* cfe might configure non working dual-io mode */ -+ val &= ~FLASH_CTRL_MB_EN; -+ val &= ~FLASH_CTRL_READ_OPCODE_MASK; -+ val &= ~FLASH_CTRL_DUMMY_BYTES_MASK; -+ val |= 1 << FLASH_CTRL_DUMMY_BYTES_SHIFT; -+ -+ switch (val & FLASH_CTRL_ADDR_BYTES_MASK) { -+ case FLASH_CTRL_ADDR_BYTES_3: -+ val |= SPINOR_OP_READ_FAST; -+ break; -+ case FLASH_CTRL_ADDR_BYTES_4: -+ val |= SPINOR_OP_READ_FAST_4B; -+ break; -+ case FLASH_CTRL_ADDR_BYTES_2: -+ default: -+ pr_warn("unsupported address byte mode (%x), not fixing up\n", -+ val & FLASH_CTRL_ADDR_BYTES_MASK); -+ return; -+ } -+ } else { -+ /* ensure dummy bytes is set to 1 for _FAST reads */ -+ u8 cmd = val & FLASH_CTRL_READ_OPCODE_MASK; -+ -+ if (cmd != SPINOR_OP_READ_FAST && cmd != SPINOR_OP_READ_FAST_4B) -+ return; -+ -+ val &= ~FLASH_CTRL_DUMMY_BYTES_MASK; -+ val |= 1 << FLASH_CTRL_DUMMY_BYTES_SHIFT; -+ } -+ -+ bcm_rset_writel(RSET_HSSPI, val, HSSPI_FLASH_CTRL_REG); -+ } - } - - int __init bcm63xx_flash_register(void) diff --git a/target/linux/bcm63xx/patches-5.15/346-MIPS-BCM63XX-USB-ENETSW-6318-clocks.patch b/target/linux/bcm63xx/patches-5.15/346-MIPS-BCM63XX-USB-ENETSW-6318-clocks.patch deleted file mode 100644 index f6fb193d6ad849..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/346-MIPS-BCM63XX-USB-ENETSW-6318-clocks.patch +++ /dev/null @@ -1,44 +0,0 @@ ---- a/arch/mips/bcm63xx/clk.c -+++ b/arch/mips/bcm63xx/clk.c -@@ -180,7 +180,11 @@ static struct clk clk_swpkt_usb = { - */ - static void enetsw_set(struct clk *clk, int enable) - { -- if (BCMCPU_IS_6328()) { -+ if (BCMCPU_IS_6318()) { -+ bcm_hwclock_set(CKCTL_6318_ROBOSW250_EN | -+ CKCTL_6318_ROBOSW025_EN, enable); -+ bcm_ub_hwclock_set(UB_CKCTL_6318_ROBOSW_EN, enable); -+ } else if (BCMCPU_IS_6328()) { - bcm_hwclock_set(CKCTL_6328_ROBOSW_EN, enable); - } else if (BCMCPU_IS_6362()) { - bcm_hwclock_set(CKCTL_6362_ROBOSW_EN, enable); -@@ -234,18 +238,22 @@ static struct clk clk_pcm = { - */ - static void usbh_set(struct clk *clk, int enable) - { -- if (BCMCPU_IS_6328()) -+ if (BCMCPU_IS_6318()) { -+ bcm_hwclock_set(CKCTL_6318_USB_EN, enable); -+ bcm_ub_hwclock_set(UB_CKCTL_6318_USB_EN, enable); -+ } else if (BCMCPU_IS_6328()) { - bcm_hwclock_set(CKCTL_6328_USBH_EN, enable); -- else if (BCMCPU_IS_6348()) -+ } else if (BCMCPU_IS_6348()) { - bcm_hwclock_set(CKCTL_6348_USBH_EN, enable); -- else if (BCMCPU_IS_6362()) -+ } else if (BCMCPU_IS_6362()) { - bcm_hwclock_set(CKCTL_6362_USBH_EN, enable); -- else if (BCMCPU_IS_6368()) -+ } else if (BCMCPU_IS_6368()) { - bcm_hwclock_set(CKCTL_6368_USBH_EN, enable); -- else if (BCMCPU_IS_63268()) -+ } else if (BCMCPU_IS_63268()) { - bcm_hwclock_set(CKCTL_63268_USBH_EN, enable); -- else -+ } else { - return; -+ } - - if (enable) - msleep(100); diff --git a/target/linux/bcm63xx/patches-5.15/347-MIPS-BCM6318-USB-support.patch b/target/linux/bcm63xx/patches-5.15/347-MIPS-BCM6318-USB-support.patch deleted file mode 100644 index ddbb30d04f0600..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/347-MIPS-BCM6318-USB-support.patch +++ /dev/null @@ -1,124 +0,0 @@ ---- a/arch/mips/bcm63xx/usb-common.c -+++ b/arch/mips/bcm63xx/usb-common.c -@@ -109,6 +109,27 @@ void bcm63xx_usb_priv_ohci_cfg_set(void) - reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SETUP_6368_REG); - reg |= USBH_PRIV_SETUP_IOC_MASK; - bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SETUP_6368_REG); -+ } else if (BCMCPU_IS_6318()) { -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_PLL_CTRL1_6318_REG); -+ reg |= USBH_PRIV_PLL_CTRL1_SUSP_EN; -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_PLL_CTRL1_6318_REG); -+ -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6318_REG); -+ reg &= ~USBH_PRIV_SWAP_OHCI_ENDN_MASK; -+ reg |= USBH_PRIV_SWAP_OHCI_DATA_MASK; -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SWAP_6318_REG); -+ -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SETUP_6318_REG); -+ reg |= USBH_PRIV_SETUP_IOC_MASK; -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SETUP_6318_REG); -+ -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_PLL_CTRL1_6318_REG); -+ reg &= ~USBH_PRIV_PLL_CTRL1_IDDQ_PWRDN; -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_PLL_CTRL1_6318_REG); -+ -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SIM_CTRL_6318_REG); -+ reg |= USBH_PRIV_SIM_CTRL_LADDR_SEL; -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SIM_CTRL_6318_REG); - } - - spin_unlock_irqrestore(&usb_priv_reg_lock, flags); -@@ -144,6 +165,27 @@ void bcm63xx_usb_priv_ehci_cfg_set(void) - reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SETUP_6368_REG); - reg |= USBH_PRIV_SETUP_IOC_MASK; - bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SETUP_6368_REG); -+ } else if (BCMCPU_IS_6318()) { -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_PLL_CTRL1_6318_REG); -+ reg |= USBH_PRIV_PLL_CTRL1_SUSP_EN; -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_PLL_CTRL1_6318_REG); -+ -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6318_REG); -+ reg &= ~USBH_PRIV_SWAP_EHCI_ENDN_MASK; -+ reg |= USBH_PRIV_SWAP_EHCI_DATA_MASK; -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SWAP_6318_REG); -+ -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SETUP_6318_REG); -+ reg |= USBH_PRIV_SETUP_IOC_MASK; -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SETUP_6318_REG); -+ -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_PLL_CTRL1_6318_REG); -+ reg &= ~USBH_PRIV_PLL_CTRL1_IDDQ_PWRDN; -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_PLL_CTRL1_6318_REG); -+ -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SIM_CTRL_6318_REG); -+ reg |= USBH_PRIV_SIM_CTRL_LADDR_SEL; -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SIM_CTRL_6318_REG); - } - - spin_unlock_irqrestore(&usb_priv_reg_lock, flags); ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -@@ -682,6 +682,12 @@ - #define GPIO_MODE_6368_SPI_SSN4 (1 << 30) - #define GPIO_MODE_6368_SPI_SSN5 (1 << 31) - -+#define GPIO_PINMUX_SEL0_6318 0x1c -+#define GPIO_PINMUX_SEL0_GPIO13_SHIFT 26 -+#define GPIO_PINMUX_SEL0_GPIO13_MASK (0x3 << GPIO_PINMUX_SEL0_GPIO13_SHIFT) -+#define GPIO_PINMUX_SEL0_GPIO13_PWRON (1 << GPIO_PINMUX_SEL0_GPIO13_SHIFT) -+#define GPIO_PINMUX_SEL0_GPIO13_LED (2 << GPIO_PINMUX_SEL0_GPIO13_SHIFT) -+#define GPIO_PINMUX_SEL0_GPIO13_GPIO (3 << GPIO_PINMUX_SEL0_GPIO13_SHIFT) - - #define GPIO_PINMUX_OTHR_REG 0x24 - #define GPIO_PINMUX_OTHR_6328_USB_SHIFT 12 -@@ -1005,6 +1011,7 @@ - - #define USBH_PRIV_SWAP_6358_REG 0x0 - #define USBH_PRIV_SWAP_6368_REG 0x1c -+#define USBH_PRIV_SWAP_6318_REG 0x0c - - #define USBH_PRIV_SWAP_USBD_SHIFT 6 - #define USBH_PRIV_SWAP_USBD_MASK (1 << USBH_PRIV_SWAP_USBD_SHIFT) -@@ -1030,6 +1037,13 @@ - #define USBH_PRIV_SETUP_IOC_SHIFT 4 - #define USBH_PRIV_SETUP_IOC_MASK (1 << USBH_PRIV_SETUP_IOC_SHIFT) - -+#define USBH_PRIV_SETUP_6318_REG 0x00 -+#define USBH_PRIV_PLL_CTRL1_6318_REG 0x04 -+#define USBH_PRIV_PLL_CTRL1_SUSP_EN (1 << 27) -+#define USBH_PRIV_PLL_CTRL1_IDDQ_PWRDN (1 << 31) -+#define USBH_PRIV_SIM_CTRL_6318_REG 0x20 -+#define USBH_PRIV_SIM_CTRL_LADDR_SEL (1 << 5) -+ - - /************************************************************************* - * _REG relative to RSET_USBD ---- a/arch/mips/bcm63xx/boards/board_common.c -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -125,6 +125,15 @@ void __init board_early_setup(const stru - } - - bcm_gpio_writel(val, GPIO_MODE_REG); -+ -+#if IS_ENABLED(CONFIG_USB) -+ if (BCMCPU_IS_6318() && (board.has_ehci0 || board.has_ohci0)) { -+ val = bcm_gpio_readl(GPIO_PINMUX_SEL0_6318); -+ val &= ~GPIO_PINMUX_SEL0_GPIO13_MASK; -+ val |= GPIO_PINMUX_SEL0_GPIO13_PWRON; -+ bcm_gpio_writel(val, GPIO_PINMUX_SEL0_6318); -+ } -+#endif - } - - ---- a/arch/mips/bcm63xx/Kconfig -+++ b/arch/mips/bcm63xx/Kconfig -@@ -23,6 +23,8 @@ config BCM63XX_CPU_6318 - bool "support 6318 CPU" - select SYS_HAS_CPU_BMIPS32_3300 - select HAVE_PCI -+ select BCM63XX_OHCI -+ select BCM63XX_EHCI - - config BCM63XX_CPU_6328 - bool "support 6328 CPU" diff --git a/target/linux/bcm63xx/patches-5.15/348-MIPS-BCM63XX-fix-BCM63268-USB-clock.patch b/target/linux/bcm63xx/patches-5.15/348-MIPS-BCM63XX-fix-BCM63268-USB-clock.patch deleted file mode 100644 index e4496227c19503..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/348-MIPS-BCM63XX-fix-BCM63268-USB-clock.patch +++ /dev/null @@ -1,71 +0,0 @@ ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -@@ -587,6 +587,9 @@ - #define TIMER_CTL_MONOTONIC_MASK (1 << 30) - #define TIMER_CTL_ENABLE_MASK (1 << 31) - -+/* Clock reset control (63268 only) */ -+#define TIMER_CLK_RST_CTL_REG 0x2c -+#define CLK_RST_CTL_USB_REF_CLK_EN (1 << 18) - - /************************************************************************* - * _REG relative to RSET_WDT -@@ -1539,6 +1542,11 @@ - #define STRAPBUS_63268_FCVO_SHIFT 21 - #define STRAPBUS_63268_FCVO_MASK (0xf << STRAPBUS_63268_FCVO_SHIFT) - -+#define MISC_IDDQ_CTRL_6328_REG 0x48 -+#define MISC_IDDQ_CTRL_63268_REG 0x4c -+ -+#define IDDQ_CTRL_63268_USBH (1 << 4) -+ - #define MISC_STRAPBUS_6328_REG 0x240 - #define STRAPBUS_6328_FCVO_SHIFT 7 - #define STRAPBUS_6328_FCVO_MASK (0x1f << STRAPBUS_6328_FCVO_SHIFT) ---- a/arch/mips/bcm63xx/clk.c -+++ b/arch/mips/bcm63xx/clk.c -@@ -76,6 +76,26 @@ static void bcm_ub_hwclock_set(u32 mask, - bcm_perf_writel(reg, PERF_UB_CKCTL_REG); - } - -+static void bcm_misc_iddq_set(u32 mask, int enable) -+{ -+ u32 offset; -+ u32 reg; -+ -+ if (BCMCPU_IS_6328() || BCMCPU_IS_6362()) -+ offset = MISC_IDDQ_CTRL_6328_REG; -+ else if (BCMCPU_IS_63268()) -+ offset = MISC_IDDQ_CTRL_63268_REG; -+ else -+ return; -+ -+ reg = bcm_misc_readl(offset); -+ if (enable) -+ reg &= ~mask; -+ else -+ reg |= mask; -+ bcm_misc_writel(reg, offset); -+} -+ - /* - * Ethernet MAC "misc" clock: dma clocks and main clock on 6348 - */ -@@ -250,7 +270,17 @@ static void usbh_set(struct clk *clk, in - } else if (BCMCPU_IS_6368()) { - bcm_hwclock_set(CKCTL_6368_USBH_EN, enable); - } else if (BCMCPU_IS_63268()) { -+ u32 reg; -+ - bcm_hwclock_set(CKCTL_63268_USBH_EN, enable); -+ bcm_misc_iddq_set(IDDQ_CTRL_63268_USBH, enable); -+ bcm63xx_core_set_reset(BCM63XX_RESET_USBH, !enable); -+ reg = bcm_timer_readl(TIMER_CLK_RST_CTL_REG); -+ if (enable) -+ reg |= CLK_RST_CTL_USB_REF_CLK_EN; -+ else -+ reg &= ~CLK_RST_CTL_USB_REF_CLK_EN; -+ bcm_timer_writel(reg, TIMER_CLK_RST_CTL_REG); - } else { - return; - } diff --git a/target/linux/bcm63xx/patches-5.15/349-MIPS-BCM63XX-add-BCM63268-USB-support.patch b/target/linux/bcm63xx/patches-5.15/349-MIPS-BCM63XX-add-BCM63268-USB-support.patch deleted file mode 100644 index 05f58c6f9f3856..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/349-MIPS-BCM63XX-add-BCM63268-USB-support.patch +++ /dev/null @@ -1,117 +0,0 @@ ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -@@ -1039,11 +1039,18 @@ - #define USBH_PRIV_SETUP_6368_REG 0x28 - #define USBH_PRIV_SETUP_IOC_SHIFT 4 - #define USBH_PRIV_SETUP_IOC_MASK (1 << USBH_PRIV_SETUP_IOC_SHIFT) -+#define USBH_PRIV_SETUP_IPP_SHIFT 5 -+#define USBH_PRIV_SETUP_IPP_MASK (1 << USBH_PRIV_SETUP_IPP_SHIFT) - - #define USBH_PRIV_SETUP_6318_REG 0x00 -+#define USBH_PRIV_PLL_CTRL1_6368_REG 0x18 - #define USBH_PRIV_PLL_CTRL1_6318_REG 0x04 --#define USBH_PRIV_PLL_CTRL1_SUSP_EN (1 << 27) --#define USBH_PRIV_PLL_CTRL1_IDDQ_PWRDN (1 << 31) -+ -+#define USBH_PRIV_PLL_CTRL1_6318_SUSP_EN (1 << 27) -+#define USBH_PRIV_PLL_CTRL1_6318_IDDQ_PWRDN (1 << 31) -+#define USBH_PRIV_PLL_CTRL1_63268_IDDQ_PWRDN (1 << 9) -+#define USBH_PRIV_PLL_CTRL1_63268_PWRDN_DELAY (1 << 10) -+ - #define USBH_PRIV_SIM_CTRL_6318_REG 0x20 - #define USBH_PRIV_SIM_CTRL_LADDR_SEL (1 << 5) - ---- a/arch/mips/bcm63xx/Kconfig -+++ b/arch/mips/bcm63xx/Kconfig -@@ -73,6 +73,8 @@ config BCM63XX_CPU_63268 - bool "support 63268 CPU" - select SYS_HAS_CPU_BMIPS4350 - select HAVE_PCI -+ select BCM63XX_OHCI -+ select BCM63XX_EHCI - endmenu - - source "arch/mips/bcm63xx/boards/Kconfig" ---- a/arch/mips/bcm63xx/dev-usb-ehci.c -+++ b/arch/mips/bcm63xx/dev-usb-ehci.c -@@ -82,7 +82,7 @@ static struct platform_device bcm63xx_eh - int __init bcm63xx_ehci_register(void) - { - if (!BCMCPU_IS_6318() && !BCMCPU_IS_6328() && !BCMCPU_IS_6358() && -- !BCMCPU_IS_6362() && !BCMCPU_IS_6368()) -+ !BCMCPU_IS_6362() && !BCMCPU_IS_6368() && !BCMCPU_IS_63268()) - return 0; - - ehci_resources[0].start = bcm63xx_regset_address(RSET_EHCI0); ---- a/arch/mips/bcm63xx/usb-common.c -+++ b/arch/mips/bcm63xx/usb-common.c -@@ -109,9 +109,24 @@ void bcm63xx_usb_priv_ohci_cfg_set(void) - reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SETUP_6368_REG); - reg |= USBH_PRIV_SETUP_IOC_MASK; - bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SETUP_6368_REG); -+ } else if (BCMCPU_IS_63268()) { -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6368_REG); -+ reg &= ~USBH_PRIV_SWAP_OHCI_ENDN_MASK; -+ reg |= USBH_PRIV_SWAP_OHCI_DATA_MASK; -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SWAP_6368_REG); -+ -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SETUP_6368_REG); -+ reg |= USBH_PRIV_SETUP_IOC_MASK; -+ reg &= ~USBH_PRIV_SETUP_IPP_MASK; -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SETUP_6368_REG); -+ -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_PLL_CTRL1_6368_REG); -+ reg &= ~(USBH_PRIV_PLL_CTRL1_63268_IDDQ_PWRDN | -+ USBH_PRIV_PLL_CTRL1_63268_PWRDN_DELAY); -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_PLL_CTRL1_6368_REG); - } else if (BCMCPU_IS_6318()) { - reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_PLL_CTRL1_6318_REG); -- reg |= USBH_PRIV_PLL_CTRL1_SUSP_EN; -+ reg |= USBH_PRIV_PLL_CTRL1_6318_SUSP_EN; - bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_PLL_CTRL1_6318_REG); - - reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6318_REG); -@@ -124,7 +139,7 @@ void bcm63xx_usb_priv_ohci_cfg_set(void) - bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SETUP_6318_REG); - - reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_PLL_CTRL1_6318_REG); -- reg &= ~USBH_PRIV_PLL_CTRL1_IDDQ_PWRDN; -+ reg &= ~USBH_PRIV_PLL_CTRL1_6318_IDDQ_PWRDN; - bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_PLL_CTRL1_6318_REG); - - reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SIM_CTRL_6318_REG); -@@ -165,9 +180,24 @@ void bcm63xx_usb_priv_ehci_cfg_set(void) - reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SETUP_6368_REG); - reg |= USBH_PRIV_SETUP_IOC_MASK; - bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SETUP_6368_REG); -+ } else if (BCMCPU_IS_63268()) { -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6368_REG); -+ reg &= ~USBH_PRIV_SWAP_EHCI_ENDN_MASK; -+ reg |= USBH_PRIV_SWAP_EHCI_DATA_MASK; -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SWAP_6368_REG); -+ -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SETUP_6368_REG); -+ reg |= USBH_PRIV_SETUP_IOC_MASK; -+ reg &= ~USBH_PRIV_SETUP_IPP_MASK; -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SETUP_6368_REG); -+ -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_PLL_CTRL1_6368_REG); -+ reg &= ~(USBH_PRIV_PLL_CTRL1_63268_IDDQ_PWRDN | -+ USBH_PRIV_PLL_CTRL1_63268_PWRDN_DELAY); -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_PLL_CTRL1_6368_REG); - } else if (BCMCPU_IS_6318()) { - reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_PLL_CTRL1_6318_REG); -- reg |= USBH_PRIV_PLL_CTRL1_SUSP_EN; -+ reg |= USBH_PRIV_PLL_CTRL1_6318_SUSP_EN; - bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_PLL_CTRL1_6318_REG); - - reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6318_REG); -@@ -180,7 +210,7 @@ void bcm63xx_usb_priv_ehci_cfg_set(void) - bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SETUP_6318_REG); - - reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_PLL_CTRL1_6318_REG); -- reg &= ~USBH_PRIV_PLL_CTRL1_IDDQ_PWRDN; -+ reg &= ~USBH_PRIV_PLL_CTRL1_6318_IDDQ_PWRDN; - bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_PLL_CTRL1_6318_REG); - - reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SIM_CTRL_6318_REG); diff --git a/target/linux/bcm63xx/patches-5.15/350-MIPS-BCM63XX-support-settings-num-usbh-ports.patch b/target/linux/bcm63xx/patches-5.15/350-MIPS-BCM63XX-support-settings-num-usbh-ports.patch deleted file mode 100644 index 35c2ef63ee291f..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/350-MIPS-BCM63XX-support-settings-num-usbh-ports.patch +++ /dev/null @@ -1,108 +0,0 @@ ---- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h -+++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h -@@ -40,6 +40,7 @@ struct board_info { - - /* USB config */ - struct bcm63xx_usbd_platform_data usbd; -+ unsigned int num_usbh_ports:2; - - /* GPIO LEDs */ - struct gpio_led leds[5]; ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ehci.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ehci.h -@@ -1,6 +1,6 @@ - #ifndef BCM63XX_DEV_USB_EHCI_H_ - #define BCM63XX_DEV_USB_EHCI_H_ - --int bcm63xx_ehci_register(void); -+int bcm63xx_ehci_register(unsigned int num_ports); - - #endif /* BCM63XX_DEV_USB_EHCI_H_ */ ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ohci.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_usb_ohci.h -@@ -1,6 +1,6 @@ - #ifndef BCM63XX_DEV_USB_OHCI_H_ - #define BCM63XX_DEV_USB_OHCI_H_ - --int bcm63xx_ohci_register(void); -+int bcm63xx_ohci_register(unsigned int num_ports); - - #endif /* BCM63XX_DEV_USB_OHCI_H_ */ ---- a/arch/mips/bcm63xx/boards/board_common.c -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -165,6 +165,8 @@ static struct platform_device bcm63xx_gp - */ - int __init board_register_devices(void) - { -+ int usbh_ports = 0; -+ - if (board.has_uart0) - bcm63xx_uart_register(0); - -@@ -186,14 +188,21 @@ int __init board_register_devices(void) - !board_get_mac_address(board.enetsw.mac_addr)) - bcm63xx_enetsw_register(&board.enetsw); - -+ if ((board.has_ohci0 || board.has_ehci0)) { -+ usbh_ports = board.num_usbh_ports; -+ -+ if (!usbh_ports || WARN_ON(usbh_ports > 1 && board.has_usbd)) -+ usbh_ports = 1; -+ } -+ - if (board.has_usbd) - bcm63xx_usbd_register(&board.usbd); - - if (board.has_ehci0) -- bcm63xx_ehci_register(); -+ bcm63xx_ehci_register(usbh_ports); - - if (board.has_ohci0) -- bcm63xx_ohci_register(); -+ bcm63xx_ohci_register(usbh_ports); - - /* Generate MAC address for WLAN and register our SPROM, - * do this after registering enet devices ---- a/arch/mips/bcm63xx/dev-usb-ehci.c -+++ b/arch/mips/bcm63xx/dev-usb-ehci.c -@@ -79,12 +79,14 @@ static struct platform_device bcm63xx_eh - }, - }; - --int __init bcm63xx_ehci_register(void) -+int __init bcm63xx_ehci_register(unsigned int num_ports) - { - if (!BCMCPU_IS_6318() && !BCMCPU_IS_6328() && !BCMCPU_IS_6358() && - !BCMCPU_IS_6362() && !BCMCPU_IS_6368() && !BCMCPU_IS_63268()) - return 0; - -+ bcm63xx_ehci_pdata.num_ports = num_ports; -+ - ehci_resources[0].start = bcm63xx_regset_address(RSET_EHCI0); - ehci_resources[0].end = ehci_resources[0].start; - ehci_resources[0].end += RSET_EHCI_SIZE - 1; ---- a/arch/mips/bcm63xx/dev-usb-ohci.c -+++ b/arch/mips/bcm63xx/dev-usb-ohci.c -@@ -62,7 +62,6 @@ static struct usb_ohci_pdata bcm63xx_ohc - .big_endian_desc = 1, - .big_endian_mmio = 1, - .no_big_frame_no = 1, -- .num_ports = 1, - .power_on = bcm63xx_ohci_power_on, - .power_off = bcm63xx_ohci_power_off, - .power_suspend = bcm63xx_ohci_power_off, -@@ -80,11 +79,13 @@ static struct platform_device bcm63xx_oh - }, - }; - --int __init bcm63xx_ohci_register(void) -+int __init bcm63xx_ohci_register(unsigned int num_ports) - { - if (BCMCPU_IS_6345() || BCMCPU_IS_6338()) - return -ENODEV; - -+ bcm63xx_ohci_pdata.num_ports = num_ports; -+ - ohci_resources[0].start = bcm63xx_regset_address(RSET_OHCI0); - ohci_resources[0].end = ohci_resources[0].start; - ohci_resources[0].end += RSET_OHCI_SIZE - 1; diff --git a/target/linux/bcm63xx/patches-5.15/351-set-board-usbh-ports.patch b/target/linux/bcm63xx/patches-5.15/351-set-board-usbh-ports.patch deleted file mode 100644 index 999f77e508095d..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/351-set-board-usbh-ports.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -547,6 +547,7 @@ static struct board_info __initdata boar - - .has_ehci0 = 1, - .has_ohci0 = 1, -+ .num_usbh_ports = 2, - .has_pccard = 1, - .has_pci = 1, - .has_uart0 = 1, diff --git a/target/linux/bcm63xx/patches-5.15/354-MIPS-BCM63XX-allow-building-support-for-more-than-on.patch b/target/linux/bcm63xx/patches-5.15/354-MIPS-BCM63XX-allow-building-support-for-more-than-on.patch deleted file mode 100644 index 9b4a358ac5c659..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/354-MIPS-BCM63XX-allow-building-support-for-more-than-on.patch +++ /dev/null @@ -1,95 +0,0 @@ -From 0daf361ea799fba0af5a232036d0f06cea85ad24 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sat, 21 Jun 2014 12:47:49 +0200 -Subject: [PATCH 42/44] MIPS: BCM63XX: allow building support for more than one - board type - -Use the arguments passed to the kernel to detect being booted with -CFE as the indicator for bcm963xx board support, allowing the -non presence of CFE_EPTSEAL to assume a different board type. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/boards/Kconfig | 7 +++---- - arch/mips/bcm63xx/boards/board_bcm963xx.c | 2 +- - arch/mips/bcm63xx/boards/board_common.c | 13 +++++++++++++ - arch/mips/bcm63xx/boards/board_common.h | 6 ++++++ - 4 files changed, 23 insertions(+), 5 deletions(-) - ---- a/arch/mips/bcm63xx/boards/Kconfig -+++ b/arch/mips/bcm63xx/boards/Kconfig -@@ -1,11 +1,10 @@ - # SPDX-License-Identifier: GPL-2.0 --choice -- prompt "Board support" -+menu "Board support" - depends on BCM63XX -- default BOARD_BCM963XX - - config BOARD_BCM963XX - bool "Generic Broadcom 963xx boards" - select SSB -+ default y - --endchoice -+endmenu ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -670,7 +670,7 @@ static const struct board_info __initcon - /* - * early init callback, read nvram data from flash and checksum it - */ --void __init board_prom_init(void) -+void __init board_bcm963xx_init(void) - { - unsigned int i; - u8 *boot_addr, *cfe; ---- a/arch/mips/bcm63xx/boards/board_common.c -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -13,6 +13,8 @@ - #include - #include - #include -+#include -+#include - #include - #include - #include -@@ -30,6 +32,8 @@ - #include - #include - -+#include "board_common.h" -+ - #define PFX "board: " - - static struct board_info board; -@@ -80,6 +84,15 @@ const char *board_get_name(void) - return board.name; - } - -+void __init board_prom_init(void) -+{ -+ /* detect bootloader */ -+ if (fw_arg3 == CFE_EPTSEAL) -+ board_bcm963xx_init(); -+ else -+ panic("unsupported bootloader detected"); -+} -+ - static int (*board_get_mac_address)(u8 mac[ETH_ALEN]); - - /* ---- a/arch/mips/bcm63xx/boards/board_common.h -+++ b/arch/mips/bcm63xx/boards/board_common.h -@@ -6,4 +6,10 @@ - void board_early_setup(const struct board_info *board, - int (*get_mac_address)(u8 mac[ETH_ALEN])); - -+#if defined(CONFIG_BOARD_BCM963XX) -+void board_bcm963xx_init(void); -+#else -+static inline void board_bcm963xx_init(void) { } -+#endif -+ - #endif /* __BOARD_COMMON_H */ diff --git a/target/linux/bcm63xx/patches-5.15/355-MIPS-BCM63XX-allow-board-implementations-to-force-fl.patch b/target/linux/bcm63xx/patches-5.15/355-MIPS-BCM63XX-allow-board-implementations-to-force-fl.patch deleted file mode 100644 index bf1c4a2842d4df..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/355-MIPS-BCM63XX-allow-board-implementations-to-force-fl.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 8a30097a899b975709f728666d5ad20c8b832d21 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 9 Mar 2014 04:28:14 +0100 -Subject: [PATCH 43/44] MIPS: BCM63XX: allow board implementations to force - flash address - -Allow board implementations to force the physmap address. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/dev-flash.c | 19 ++++++++++++++----- - .../mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h | 2 ++ - 2 files changed, 16 insertions(+), 5 deletions(-) - ---- a/arch/mips/bcm63xx/dev-flash.c -+++ b/arch/mips/bcm63xx/dev-flash.c -@@ -58,6 +58,12 @@ static struct platform_device mtd_dev = - }, - }; - -+void __init bcm63xx_flash_force_phys_base_address(u32 start, u32 end) -+{ -+ mtd_resources[0].start = start; -+ mtd_resources[0].end = end; -+} -+ - static int __init bcm63xx_detect_flash_type(void) - { - u32 val; -@@ -173,12 +179,15 @@ int __init bcm63xx_flash_register(void) - - switch (flash_type) { - case BCM63XX_FLASH_TYPE_PARALLEL: -- /* read base address of boot chip select (0) */ -- val = bcm_mpi_readl(MPI_CSBASE_REG(0)); -- val &= MPI_CSBASE_BASE_MASK; - -- mtd_resources[0].start = val; -- mtd_resources[0].end = 0x1FFFFFFF; -+ if (!mtd_resources[0].start) { -+ /* read base address of boot chip select (0) */ -+ val = bcm_mpi_readl(MPI_CSBASE_REG(0)); -+ val &= MPI_CSBASE_BASE_MASK; -+ -+ mtd_resources[0].start = val; -+ mtd_resources[0].end = 0x1FFFFFFF; -+ } - - return platform_device_register(&mtd_dev); - case BCM63XX_FLASH_TYPE_SERIAL: ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h -@@ -10,6 +10,8 @@ enum { - - void bcm63xx_flash_detect(void); - -+void bcm63xx_flash_force_phys_base_address(u32 start, u32 end); -+ - int __init bcm63xx_flash_register(void); - - #endif /* __BCM63XX_FLASH_H */ diff --git a/target/linux/bcm63xx/patches-5.15/356-MIPS-BCM63XX-move-fallback-sprom-support-into-its-ow.patch b/target/linux/bcm63xx/patches-5.15/356-MIPS-BCM63XX-move-fallback-sprom-support-into-its-ow.patch deleted file mode 100644 index 886fb2d6f37141..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/356-MIPS-BCM63XX-move-fallback-sprom-support-into-its-ow.patch +++ /dev/null @@ -1,189 +0,0 @@ -From cc025e749a1fece61a6cc0d64bbe7b12472259cc Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Tue, 29 Jul 2014 21:31:12 +0200 -Subject: [PATCH 01/10] MIPS: BCM63XX: move fallback sprom support into its own - unit - -In preparation for enhancing it, move it into its own file. Require a -mac address to be passed as the argument to always "reserve" the mac -regardless of the inclusion state of SSB. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/Makefile | 2 +- - arch/mips/bcm63xx/boards/board_common.c | 53 ++-------------- - arch/mips/bcm63xx/sprom.c | 70 ++++++++++++++++++++++ - .../asm/mach-bcm63xx/bcm63xx_fallback_sprom.h | 6 ++ - 4 files changed, 83 insertions(+), 48 deletions(-) - create mode 100644 arch/mips/bcm63xx/sprom.c - create mode 100644 arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h - ---- a/arch/mips/bcm63xx/Makefile -+++ b/arch/mips/bcm63xx/Makefile -@@ -2,7 +2,8 @@ - obj-y += clk.o cpu.o cs.o gpio.o irq.o nvram.o prom.o reset.o \ - setup.o timer.o dev-enet.o dev-flash.o dev-pcmcia.o \ - dev-rng.o dev-spi.o dev-hsspi.o dev-uart.o dev-wdt.o \ -- dev-usb-ehci.o dev-usb-ohci.o dev-usb-usbd.o usb-common.o -+ dev-usb-ehci.o dev-usb-ohci.o dev-usb-usbd.o usb-common.o \ -+ sprom.o - obj-$(CONFIG_EARLY_PRINTK) += early_printk.o - - obj-y += boards/ ---- a/arch/mips/bcm63xx/boards/board_common.c -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -39,44 +39,6 @@ - static struct board_info board; - - /* -- * Register a sane SPROMv2 to make the on-board -- * bcm4318 WLAN work -- */ --#ifdef CONFIG_SSB_PCIHOST --static struct ssb_sprom bcm63xx_sprom = { -- .revision = 0x02, -- .board_rev = 0x17, -- .country_code = 0x0, -- .ant_available_bg = 0x3, -- .pa0b0 = 0x15ae, -- .pa0b1 = 0xfa85, -- .pa0b2 = 0xfe8d, -- .pa1b0 = 0xffff, -- .pa1b1 = 0xffff, -- .pa1b2 = 0xffff, -- .gpio0 = 0xff, -- .gpio1 = 0xff, -- .gpio2 = 0xff, -- .gpio3 = 0xff, -- .maxpwr_bg = 0x004c, -- .itssi_bg = 0x00, -- .boardflags_lo = 0x2848, -- .boardflags_hi = 0x0000, --}; -- --int bcm63xx_get_fallback_sprom(struct ssb_bus *bus, struct ssb_sprom *out) --{ -- if (bus->bustype == SSB_BUSTYPE_PCI) { -- memcpy(out, &bcm63xx_sprom, sizeof(struct ssb_sprom)); -- return 0; -- } else { -- printk(KERN_ERR PFX "unable to fill SPROM for given bustype.\n"); -- return -EINVAL; -- } --} --#endif -- --/* - * return board name for /proc/cpuinfo - */ - const char *board_get_name(void) -@@ -179,6 +141,7 @@ static struct platform_device bcm63xx_gp - int __init board_register_devices(void) - { - int usbh_ports = 0; -+ u8 mac[ETH_ALEN]; - - if (board.has_uart0) - bcm63xx_uart_register(0); -@@ -220,15 +183,10 @@ int __init board_register_devices(void) - /* Generate MAC address for WLAN and register our SPROM, - * do this after registering enet devices - */ --#ifdef CONFIG_SSB_PCIHOST -- if (!board_get_mac_address(bcm63xx_sprom.il0mac)) { -- memcpy(bcm63xx_sprom.et0mac, bcm63xx_sprom.il0mac, ETH_ALEN); -- memcpy(bcm63xx_sprom.et1mac, bcm63xx_sprom.il0mac, ETH_ALEN); -- if (ssb_arch_register_fallback_sprom( -- &bcm63xx_get_fallback_sprom) < 0) -- pr_err(PFX "failed to register fallback SPROM\n"); -- } --#endif -+ -+ if (board_get_mac_address(mac) || -+ bcm63xx_register_fallback_sprom(mac)) -+ pr_err(PFX "failed to register fallback SPROM\n"); - - bcm63xx_spi_register(); - ---- /dev/null -+++ b/arch/mips/bcm63xx/sprom.c -@@ -0,0 +1,70 @@ -+/* -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file "COPYING" in the main directory of this archive -+ * for more details. -+ * -+ * Copyright (C) 2008 Maxime Bizon -+ * Copyright (C) 2008 Florian Fainelli -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define PFX "sprom: " -+ -+/* -+ * Register a sane SPROMv2 to make the on-board -+ * bcm4318 WLAN work -+ */ -+#ifdef CONFIG_SSB_PCIHOST -+static struct ssb_sprom bcm63xx_sprom = { -+ .revision = 0x02, -+ .board_rev = 0x17, -+ .country_code = 0x0, -+ .ant_available_bg = 0x3, -+ .pa0b0 = 0x15ae, -+ .pa0b1 = 0xfa85, -+ .pa0b2 = 0xfe8d, -+ .pa1b0 = 0xffff, -+ .pa1b1 = 0xffff, -+ .pa1b2 = 0xffff, -+ .gpio0 = 0xff, -+ .gpio1 = 0xff, -+ .gpio2 = 0xff, -+ .gpio3 = 0xff, -+ .maxpwr_bg = 0x004c, -+ .itssi_bg = 0x00, -+ .boardflags_lo = 0x2848, -+ .boardflags_hi = 0x0000, -+}; -+ -+int bcm63xx_get_fallback_sprom(struct ssb_bus *bus, struct ssb_sprom *out) -+{ -+ if (bus->bustype == SSB_BUSTYPE_PCI) { -+ memcpy(out, &bcm63xx_sprom, sizeof(struct ssb_sprom)); -+ return 0; -+ } else { -+ printk(KERN_ERR PFX "unable to fill SPROM for given bustype.\n"); -+ return -EINVAL; -+ } -+} -+#endif -+ -+int __init bcm63xx_register_fallback_sprom(u8 *mac) -+{ -+ int ret = 0; -+ -+#ifdef CONFIG_SSB_PCIHOST -+ memcpy(bcm63xx_sprom.il0mac, mac, ETH_ALEN); -+ memcpy(bcm63xx_sprom.et0mac, mac, ETH_ALEN); -+ memcpy(bcm63xx_sprom.et1mac, mac, ETH_ALEN); -+ -+ ret = ssb_arch_register_fallback_sprom(&bcm63xx_get_fallback_sprom); -+#endif -+ return ret; -+} ---- /dev/null -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h -@@ -0,0 +1,6 @@ -+#ifndef __BCM63XX_FALLBACK_SPROM -+#define __BCM63XX_FALLBACK_SPROM -+ -+int bcm63xx_register_fallback_sprom(u8 *mac); -+ -+#endif diff --git a/target/linux/bcm63xx/patches-5.15/357-MIPS-BCM63XX-use-platform-data-for-the-sprom.patch b/target/linux/bcm63xx/patches-5.15/357-MIPS-BCM63XX-use-platform-data-for-the-sprom.patch deleted file mode 100644 index d0e37efd53f587..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/357-MIPS-BCM63XX-use-platform-data-for-the-sprom.patch +++ /dev/null @@ -1,95 +0,0 @@ -From 9912a8b3c240a9b0af01ff496b7e8ed9e4cc5b82 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Tue, 29 Jul 2014 21:43:49 +0200 -Subject: [PATCH 02/10] MIPS: BCM63XX: use platform data for the sprom - -Similar to ethernet setup, use a platform data struct for passing -the mac. This eliminates the requirement to allocate an array on -stack for the mac passed. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/boards/board_common.c | 6 ++---- - arch/mips/bcm63xx/sprom.c | 8 ++++---- - arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h | 8 +++++++- - arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h | 4 ++++ - 4 files changed, 17 insertions(+), 9 deletions(-) - ---- a/arch/mips/bcm63xx/boards/board_common.c -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -141,7 +141,6 @@ static struct platform_device bcm63xx_gp - int __init board_register_devices(void) - { - int usbh_ports = 0; -- u8 mac[ETH_ALEN]; - - if (board.has_uart0) - bcm63xx_uart_register(0); -@@ -184,8 +183,8 @@ int __init board_register_devices(void) - * do this after registering enet devices - */ - -- if (board_get_mac_address(mac) || -- bcm63xx_register_fallback_sprom(mac)) -+ if (board_get_mac_address(board.fallback_sprom.mac_addr) || -+ bcm63xx_register_fallback_sprom(&board.fallback_sprom)) - pr_err(PFX "failed to register fallback SPROM\n"); - - bcm63xx_spi_register(); ---- a/arch/mips/bcm63xx/sprom.c -+++ b/arch/mips/bcm63xx/sprom.c -@@ -55,14 +55,14 @@ int bcm63xx_get_fallback_sprom(struct ss - } - #endif - --int __init bcm63xx_register_fallback_sprom(u8 *mac) -+int __init bcm63xx_register_fallback_sprom(struct fallback_sprom_data *data) - { - int ret = 0; - - #ifdef CONFIG_SSB_PCIHOST -- memcpy(bcm63xx_sprom.il0mac, mac, ETH_ALEN); -- memcpy(bcm63xx_sprom.et0mac, mac, ETH_ALEN); -- memcpy(bcm63xx_sprom.et1mac, mac, ETH_ALEN); -+ memcpy(bcm63xx_sprom.il0mac, data->mac_addr, ETH_ALEN); -+ memcpy(bcm63xx_sprom.et0mac, data->mac_addr, ETH_ALEN); -+ memcpy(bcm63xx_sprom.et1mac, data->mac_addr, ETH_ALEN); - - ret = ssb_arch_register_fallback_sprom(&bcm63xx_get_fallback_sprom); - #endif ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h -@@ -1,6 +1,12 @@ - #ifndef __BCM63XX_FALLBACK_SPROM - #define __BCM63XX_FALLBACK_SPROM - --int bcm63xx_register_fallback_sprom(u8 *mac); -+#include -+ -+struct fallback_sprom_data { -+ u8 mac_addr[ETH_ALEN]; -+}; -+ -+int bcm63xx_register_fallback_sprom(struct fallback_sprom_data *data); - - #endif ---- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h -+++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h -@@ -7,6 +7,7 @@ - #include - #include - #include -+#include - - /* - * flash mapping -@@ -50,6 +51,9 @@ struct board_info { - - /* External PHY reset GPIO flags from gpio.h */ - unsigned long ephy_reset_gpio_flags; -+ -+ /* fallback sprom config */ -+ struct fallback_sprom_data fallback_sprom; - }; - - #endif /* ! BOARD_BCM963XX_H_ */ diff --git a/target/linux/bcm63xx/patches-5.15/358-MIPS-BCM63XX-make-fallback-sprom-optional.patch b/target/linux/bcm63xx/patches-5.15/358-MIPS-BCM63XX-make-fallback-sprom-optional.patch deleted file mode 100644 index 688a74ca043f70..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/358-MIPS-BCM63XX-make-fallback-sprom-optional.patch +++ /dev/null @@ -1,140 +0,0 @@ -From 83131acbfb59760a19f3711c09526e191c8aad54 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Tue, 29 Jul 2014 21:52:56 +0200 -Subject: [PATCH 03/10] MIPS: BCM63XX: make fallback sprom optional - -Some devices do not provide enough mac addresses to populate wifi in -addition to ethernet. - -Use having pci enabled as a rough heuristic which boards should have it -enabled. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/boards/board_bcm963xx.c | 12 ++++++++++++ - arch/mips/bcm63xx/boards/board_common.c | 5 +++-- - arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h | 1 + - 3 files changed, 16 insertions(+), 2 deletions(-) - ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -63,6 +63,7 @@ static struct board_info __initdata boar - - .has_pci = 1, - .has_uart0 = 1, -+ .use_fallback_sprom = 1, - - .has_usbd = 0, - .usbd = { -@@ -213,6 +214,7 @@ static struct board_info __initdata boar - - .has_pci = 1, - .has_uart0 = 1, -+ .use_fallback_sprom = 1, - - .has_enet0 = 1, - .enet0 = { -@@ -259,6 +261,7 @@ static struct board_info __initdata boar - .has_pccard = 1, - .has_pci = 1, - .has_uart0 = 1, -+ .use_fallback_sprom = 1, - - .has_enet0 = 1, - .enet0 = { -@@ -310,6 +313,7 @@ static struct board_info __initdata boar - .has_pccard = 1, - .has_pci = 1, - .has_uart0 = 1, -+ .use_fallback_sprom = 1, - - .has_enet0 = 1, - .enet0 = { -@@ -360,6 +364,7 @@ static struct board_info __initdata boar - .has_ohci0 = 1, - .has_pci = 1, - .has_uart0 = 1, -+ .use_fallback_sprom = 1, - - .has_enet0 = 1, - .enet0 = { -@@ -411,6 +416,7 @@ static struct board_info __initdata boar - .has_pccard = 1, - .has_pci = 1, - .has_uart0 = 1, -+ .use_fallback_sprom = 1, - - .has_enet0 = 1, - .enet0 = { -@@ -430,6 +436,7 @@ static struct board_info __initdata boar - .expected_cpu_id = 0x6348, - - .has_pci = 1, -+ .use_fallback_sprom = 1, - - .has_enet0 = 1, - .enet0 = { -@@ -451,6 +458,7 @@ static struct board_info __initdata boar - .has_ohci0 = 1, - .has_pci = 1, - .has_uart0 = 1, -+ .use_fallback_sprom = 1, - - .has_enet0 = 1, - .enet0 = { -@@ -472,6 +480,7 @@ static struct board_info __initdata boar - .has_ohci0 = 1, - .has_pci = 1, - .has_uart0 = 1, -+ .use_fallback_sprom = 1, - - .has_enet0 = 1, - .enet0 = { -@@ -500,6 +509,7 @@ static struct board_info __initdata boar - .has_pccard = 1, - .has_pci = 1, - .has_uart0 = 1, -+ .use_fallback_sprom = 1, - - .has_enet0 = 1, - .enet0 = { -@@ -551,6 +561,7 @@ static struct board_info __initdata boar - .has_pccard = 1, - .has_pci = 1, - .has_uart0 = 1, -+ .use_fallback_sprom = 1, - - .has_enet0 = 1, - .enet0 = { -@@ -617,6 +628,7 @@ static struct board_info __initdata boar - .has_ehci0 = 1, - .has_ohci0 = 1, - .has_pci = 1, -+ .use_fallback_sprom = 1, - - .has_enet0 = 1, - .enet0 = { ---- a/arch/mips/bcm63xx/boards/board_common.c -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -183,8 +183,9 @@ int __init board_register_devices(void) - * do this after registering enet devices - */ - -- if (board_get_mac_address(board.fallback_sprom.mac_addr) || -- bcm63xx_register_fallback_sprom(&board.fallback_sprom)) -+ if (board.use_fallback_sprom && -+ (board_get_mac_address(board.fallback_sprom.mac_addr) || -+ bcm63xx_register_fallback_sprom(&board.fallback_sprom))) - pr_err(PFX "failed to register fallback SPROM\n"); - - bcm63xx_spi_register(); ---- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h -+++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h -@@ -33,6 +33,7 @@ struct board_info { - unsigned int has_usbd:1; - unsigned int has_uart0:1; - unsigned int has_uart1:1; -+ unsigned int use_fallback_sprom:1; - - /* ethernet config */ - struct bcm63xx_enet_platform_data enet0; diff --git a/target/linux/bcm63xx/patches-5.15/359-MIPS-BCM63XX-allow-different-types-of-sprom.patch b/target/linux/bcm63xx/patches-5.15/359-MIPS-BCM63XX-allow-different-types-of-sprom.patch deleted file mode 100644 index 0c4a9be47d6fb3..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/359-MIPS-BCM63XX-allow-different-types-of-sprom.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 1cece9f7aca1f0c193edce201f77a87008c5a405 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Tue, 29 Jul 2014 21:58:38 +0200 -Subject: [PATCH 04/10] MIPS: BCM63XX: allow different types of sprom - -Different chips require different sprom contents, so prepare for -supplying the appropriate sprom type. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/sprom.c | 13 ++++++++++++- - arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h | 5 +++++ - 2 files changed, 17 insertions(+), 1 deletion(-) - ---- a/arch/mips/bcm63xx/sprom.c -+++ b/arch/mips/bcm63xx/sprom.c -@@ -22,7 +22,7 @@ - * bcm4318 WLAN work - */ - #ifdef CONFIG_SSB_PCIHOST --static struct ssb_sprom bcm63xx_sprom = { -+static __initconst struct ssb_sprom bcm63xx_default_sprom = { - .revision = 0x02, - .board_rev = 0x17, - .country_code = 0x0, -@@ -43,6 +43,8 @@ static struct ssb_sprom bcm63xx_sprom = - .boardflags_hi = 0x0000, - }; - -+static struct ssb_sprom bcm63xx_sprom; -+ - int bcm63xx_get_fallback_sprom(struct ssb_bus *bus, struct ssb_sprom *out) - { - if (bus->bustype == SSB_BUSTYPE_PCI) { -@@ -60,6 +62,15 @@ int __init bcm63xx_register_fallback_spr - int ret = 0; - - #ifdef CONFIG_SSB_PCIHOST -+ switch (data->type) { -+ case SPROM_DEFAULT: -+ memcpy(&bcm63xx_sprom, &bcm63xx_default_sprom, -+ sizeof(bcm63xx_sprom)); -+ break; -+ default: -+ return -EINVAL; -+ } -+ - memcpy(bcm63xx_sprom.il0mac, data->mac_addr, ETH_ALEN); - memcpy(bcm63xx_sprom.et0mac, data->mac_addr, ETH_ALEN); - memcpy(bcm63xx_sprom.et1mac, data->mac_addr, ETH_ALEN); ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h -@@ -3,8 +3,13 @@ - - #include - -+enum sprom_type { -+ SPROM_DEFAULT, /* default fallback sprom */ -+}; -+ - struct fallback_sprom_data { - u8 mac_addr[ETH_ALEN]; -+ enum sprom_type type; - }; - - int bcm63xx_register_fallback_sprom(struct fallback_sprom_data *data); diff --git a/target/linux/bcm63xx/patches-5.15/360-MIPS-BCM63XX-add-support-for-raw-sproms.patch b/target/linux/bcm63xx/patches-5.15/360-MIPS-BCM63XX-add-support-for-raw-sproms.patch deleted file mode 100644 index 2063cda4857a56..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/360-MIPS-BCM63XX-add-support-for-raw-sproms.patch +++ /dev/null @@ -1,581 +0,0 @@ -From cedee63bc73f8b7d45b8c0cba1236986812c1f83 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Tue, 29 Jul 2014 22:16:36 +0200 -Subject: [PATCH 05/10] MIPS: BCM63XX: add support for "raw" sproms - -Allow using raw sprom content as templates. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/sprom.c | 482 ++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 482 insertions(+) - ---- a/arch/mips/bcm63xx/sprom.c -+++ b/arch/mips/bcm63xx/sprom.c -@@ -55,13 +55,556 @@ int bcm63xx_get_fallback_sprom(struct ss - return -EINVAL; - } - } -+ -+/* FIXME: use lib_sprom after submission upstream */ -+ -+/* Get the word-offset for a SSB_SPROM_XXX define. */ -+#define SPOFF(offset) ((offset) / sizeof(u16)) -+/* Helper to extract some _offset, which is one of the SSB_SPROM_XXX defines. */ -+#define SPEX16(_outvar, _offset, _mask, _shift) \ -+ out->_outvar = ((in[SPOFF(_offset)] & (_mask)) >> (_shift)) -+#define SPEX32(_outvar, _offset, _mask, _shift) \ -+ out->_outvar = ((((u32)in[SPOFF((_offset)+2)] << 16 | \ -+ in[SPOFF(_offset)]) & (_mask)) >> (_shift)) -+#define SPEX(_outvar, _offset, _mask, _shift) \ -+ SPEX16(_outvar, _offset, _mask, _shift) -+ -+#define SPEX_ARRAY8(_field, _offset, _mask, _shift) \ -+ do { \ -+ SPEX(_field[0], _offset + 0, _mask, _shift); \ -+ SPEX(_field[1], _offset + 2, _mask, _shift); \ -+ SPEX(_field[2], _offset + 4, _mask, _shift); \ -+ SPEX(_field[3], _offset + 6, _mask, _shift); \ -+ SPEX(_field[4], _offset + 8, _mask, _shift); \ -+ SPEX(_field[5], _offset + 10, _mask, _shift); \ -+ SPEX(_field[6], _offset + 12, _mask, _shift); \ -+ SPEX(_field[7], _offset + 14, _mask, _shift); \ -+ } while (0) -+ -+ -+static s8 sprom_extract_antgain(u8 sprom_revision, const u16 *in, u16 offset, -+ u16 mask, u16 shift) -+{ -+ u16 v; -+ u8 gain; -+ -+ v = in[SPOFF(offset)]; -+ gain = (v & mask) >> shift; -+ if (gain == 0xFF) -+ gain = 2; /* If unset use 2dBm */ -+ if (sprom_revision == 1) { -+ /* Convert to Q5.2 */ -+ gain <<= 2; -+ } else { -+ /* Q5.2 Fractional part is stored in 0xC0 */ -+ gain = ((gain & 0xC0) >> 6) | ((gain & 0x3F) << 2); -+ } -+ -+ return (s8)gain; -+} -+ -+static void sprom_extract_r23(struct ssb_sprom *out, const u16 *in) -+{ -+ SPEX(boardflags_hi, SSB_SPROM2_BFLHI, 0xFFFF, 0); -+ SPEX(opo, SSB_SPROM2_OPO, SSB_SPROM2_OPO_VALUE, 0); -+ SPEX(pa1lob0, SSB_SPROM2_PA1LOB0, 0xFFFF, 0); -+ SPEX(pa1lob1, SSB_SPROM2_PA1LOB1, 0xFFFF, 0); -+ SPEX(pa1lob2, SSB_SPROM2_PA1LOB2, 0xFFFF, 0); -+ SPEX(pa1hib0, SSB_SPROM2_PA1HIB0, 0xFFFF, 0); -+ SPEX(pa1hib1, SSB_SPROM2_PA1HIB1, 0xFFFF, 0); -+ SPEX(pa1hib2, SSB_SPROM2_PA1HIB2, 0xFFFF, 0); -+ SPEX(maxpwr_ah, SSB_SPROM2_MAXP_A, SSB_SPROM2_MAXP_A_HI, 0); -+ SPEX(maxpwr_al, SSB_SPROM2_MAXP_A, SSB_SPROM2_MAXP_A_LO, -+ SSB_SPROM2_MAXP_A_LO_SHIFT); -+} -+ -+static void sprom_extract_r123(struct ssb_sprom *out, const u16 *in) -+{ -+ u16 loc[3]; -+ -+ if (out->revision == 3) /* rev 3 moved MAC */ -+ loc[0] = SSB_SPROM3_IL0MAC; -+ else { -+ loc[0] = SSB_SPROM1_IL0MAC; -+ loc[1] = SSB_SPROM1_ET0MAC; -+ loc[2] = SSB_SPROM1_ET1MAC; -+ } -+ -+ SPEX(et0phyaddr, SSB_SPROM1_ETHPHY, SSB_SPROM1_ETHPHY_ET0A, 0); -+ SPEX(et1phyaddr, SSB_SPROM1_ETHPHY, SSB_SPROM1_ETHPHY_ET1A, -+ SSB_SPROM1_ETHPHY_ET1A_SHIFT); -+ SPEX(et0mdcport, SSB_SPROM1_ETHPHY, SSB_SPROM1_ETHPHY_ET0M, 14); -+ SPEX(et1mdcport, SSB_SPROM1_ETHPHY, SSB_SPROM1_ETHPHY_ET1M, 15); -+ SPEX(board_rev, SSB_SPROM1_BINF, SSB_SPROM1_BINF_BREV, 0); -+ SPEX(board_type, SSB_SPROM1_SPID, 0xFFFF, 0); -+ if (out->revision == 1) -+ SPEX(country_code, SSB_SPROM1_BINF, SSB_SPROM1_BINF_CCODE, -+ SSB_SPROM1_BINF_CCODE_SHIFT); -+ SPEX(ant_available_a, SSB_SPROM1_BINF, SSB_SPROM1_BINF_ANTA, -+ SSB_SPROM1_BINF_ANTA_SHIFT); -+ SPEX(ant_available_bg, SSB_SPROM1_BINF, SSB_SPROM1_BINF_ANTBG, -+ SSB_SPROM1_BINF_ANTBG_SHIFT); -+ SPEX(pa0b0, SSB_SPROM1_PA0B0, 0xFFFF, 0); -+ SPEX(pa0b1, SSB_SPROM1_PA0B1, 0xFFFF, 0); -+ SPEX(pa0b2, SSB_SPROM1_PA0B2, 0xFFFF, 0); -+ SPEX(pa1b0, SSB_SPROM1_PA1B0, 0xFFFF, 0); -+ SPEX(pa1b1, SSB_SPROM1_PA1B1, 0xFFFF, 0); -+ SPEX(pa1b2, SSB_SPROM1_PA1B2, 0xFFFF, 0); -+ SPEX(gpio0, SSB_SPROM1_GPIOA, SSB_SPROM1_GPIOA_P0, 0); -+ SPEX(gpio1, SSB_SPROM1_GPIOA, SSB_SPROM1_GPIOA_P1, -+ SSB_SPROM1_GPIOA_P1_SHIFT); -+ SPEX(gpio2, SSB_SPROM1_GPIOB, SSB_SPROM1_GPIOB_P2, 0); -+ SPEX(gpio3, SSB_SPROM1_GPIOB, SSB_SPROM1_GPIOB_P3, -+ SSB_SPROM1_GPIOB_P3_SHIFT); -+ SPEX(maxpwr_a, SSB_SPROM1_MAXPWR, SSB_SPROM1_MAXPWR_A, -+ SSB_SPROM1_MAXPWR_A_SHIFT); -+ SPEX(maxpwr_bg, SSB_SPROM1_MAXPWR, SSB_SPROM1_MAXPWR_BG, 0); -+ SPEX(itssi_a, SSB_SPROM1_ITSSI, SSB_SPROM1_ITSSI_A, -+ SSB_SPROM1_ITSSI_A_SHIFT); -+ SPEX(itssi_bg, SSB_SPROM1_ITSSI, SSB_SPROM1_ITSSI_BG, 0); -+ SPEX(boardflags_lo, SSB_SPROM1_BFLLO, 0xFFFF, 0); -+ -+ SPEX(alpha2[0], SSB_SPROM1_CCODE, 0xff00, 8); -+ SPEX(alpha2[1], SSB_SPROM1_CCODE, 0x00ff, 0); -+ -+ /* Extract the antenna gain values. */ -+ out->antenna_gain.a0 = sprom_extract_antgain(out->revision, in, -+ SSB_SPROM1_AGAIN, -+ SSB_SPROM1_AGAIN_BG, -+ SSB_SPROM1_AGAIN_BG_SHIFT); -+ out->antenna_gain.a1 = sprom_extract_antgain(out->revision, in, -+ SSB_SPROM1_AGAIN, -+ SSB_SPROM1_AGAIN_A, -+ SSB_SPROM1_AGAIN_A_SHIFT); -+ if (out->revision >= 2) -+ sprom_extract_r23(out, in); -+} -+ -+/* Revs 4 5 and 8 have partially shared layout */ -+static void sprom_extract_r458(struct ssb_sprom *out, const u16 *in) -+{ -+ SPEX(txpid2g[0], SSB_SPROM4_TXPID2G01, -+ SSB_SPROM4_TXPID2G0, SSB_SPROM4_TXPID2G0_SHIFT); -+ SPEX(txpid2g[1], SSB_SPROM4_TXPID2G01, -+ SSB_SPROM4_TXPID2G1, SSB_SPROM4_TXPID2G1_SHIFT); -+ SPEX(txpid2g[2], SSB_SPROM4_TXPID2G23, -+ SSB_SPROM4_TXPID2G2, SSB_SPROM4_TXPID2G2_SHIFT); -+ SPEX(txpid2g[3], SSB_SPROM4_TXPID2G23, -+ SSB_SPROM4_TXPID2G3, SSB_SPROM4_TXPID2G3_SHIFT); -+ -+ SPEX(txpid5gl[0], SSB_SPROM4_TXPID5GL01, -+ SSB_SPROM4_TXPID5GL0, SSB_SPROM4_TXPID5GL0_SHIFT); -+ SPEX(txpid5gl[1], SSB_SPROM4_TXPID5GL01, -+ SSB_SPROM4_TXPID5GL1, SSB_SPROM4_TXPID5GL1_SHIFT); -+ SPEX(txpid5gl[2], SSB_SPROM4_TXPID5GL23, -+ SSB_SPROM4_TXPID5GL2, SSB_SPROM4_TXPID5GL2_SHIFT); -+ SPEX(txpid5gl[3], SSB_SPROM4_TXPID5GL23, -+ SSB_SPROM4_TXPID5GL3, SSB_SPROM4_TXPID5GL3_SHIFT); -+ -+ SPEX(txpid5g[0], SSB_SPROM4_TXPID5G01, -+ SSB_SPROM4_TXPID5G0, SSB_SPROM4_TXPID5G0_SHIFT); -+ SPEX(txpid5g[1], SSB_SPROM4_TXPID5G01, -+ SSB_SPROM4_TXPID5G1, SSB_SPROM4_TXPID5G1_SHIFT); -+ SPEX(txpid5g[2], SSB_SPROM4_TXPID5G23, -+ SSB_SPROM4_TXPID5G2, SSB_SPROM4_TXPID5G2_SHIFT); -+ SPEX(txpid5g[3], SSB_SPROM4_TXPID5G23, -+ SSB_SPROM4_TXPID5G3, SSB_SPROM4_TXPID5G3_SHIFT); -+ -+ SPEX(txpid5gh[0], SSB_SPROM4_TXPID5GH01, -+ SSB_SPROM4_TXPID5GH0, SSB_SPROM4_TXPID5GH0_SHIFT); -+ SPEX(txpid5gh[1], SSB_SPROM4_TXPID5GH01, -+ SSB_SPROM4_TXPID5GH1, SSB_SPROM4_TXPID5GH1_SHIFT); -+ SPEX(txpid5gh[2], SSB_SPROM4_TXPID5GH23, -+ SSB_SPROM4_TXPID5GH2, SSB_SPROM4_TXPID5GH2_SHIFT); -+ SPEX(txpid5gh[3], SSB_SPROM4_TXPID5GH23, -+ SSB_SPROM4_TXPID5GH3, SSB_SPROM4_TXPID5GH3_SHIFT); -+} -+ -+static void sprom_extract_r45(struct ssb_sprom *out, const u16 *in) -+{ -+ static const u16 pwr_info_offset[] = { -+ SSB_SPROM4_PWR_INFO_CORE0, SSB_SPROM4_PWR_INFO_CORE1, -+ SSB_SPROM4_PWR_INFO_CORE2, SSB_SPROM4_PWR_INFO_CORE3 -+ }; -+ u16 il0mac_offset; -+ int i; -+ -+ BUILD_BUG_ON(ARRAY_SIZE(pwr_info_offset) != -+ ARRAY_SIZE(out->core_pwr_info)); -+ -+ if (out->revision == 4) -+ il0mac_offset = SSB_SPROM4_IL0MAC; -+ else -+ il0mac_offset = SSB_SPROM5_IL0MAC; -+ -+ SPEX(et0phyaddr, SSB_SPROM4_ETHPHY, SSB_SPROM4_ETHPHY_ET0A, 0); -+ SPEX(et1phyaddr, SSB_SPROM4_ETHPHY, SSB_SPROM4_ETHPHY_ET1A, -+ SSB_SPROM4_ETHPHY_ET1A_SHIFT); -+ SPEX(board_rev, SSB_SPROM4_BOARDREV, 0xFFFF, 0); -+ SPEX(board_type, SSB_SPROM1_SPID, 0xFFFF, 0); -+ if (out->revision == 4) { -+ SPEX(alpha2[0], SSB_SPROM4_CCODE, 0xff00, 8); -+ SPEX(alpha2[1], SSB_SPROM4_CCODE, 0x00ff, 0); -+ SPEX(boardflags_lo, SSB_SPROM4_BFLLO, 0xFFFF, 0); -+ SPEX(boardflags_hi, SSB_SPROM4_BFLHI, 0xFFFF, 0); -+ SPEX(boardflags2_lo, SSB_SPROM4_BFL2LO, 0xFFFF, 0); -+ SPEX(boardflags2_hi, SSB_SPROM4_BFL2HI, 0xFFFF, 0); -+ } else { -+ SPEX(alpha2[0], SSB_SPROM5_CCODE, 0xff00, 8); -+ SPEX(alpha2[1], SSB_SPROM5_CCODE, 0x00ff, 0); -+ SPEX(boardflags_lo, SSB_SPROM5_BFLLO, 0xFFFF, 0); -+ SPEX(boardflags_hi, SSB_SPROM5_BFLHI, 0xFFFF, 0); -+ SPEX(boardflags2_lo, SSB_SPROM5_BFL2LO, 0xFFFF, 0); -+ SPEX(boardflags2_hi, SSB_SPROM5_BFL2HI, 0xFFFF, 0); -+ } -+ SPEX(ant_available_a, SSB_SPROM4_ANTAVAIL, SSB_SPROM4_ANTAVAIL_A, -+ SSB_SPROM4_ANTAVAIL_A_SHIFT); -+ SPEX(ant_available_bg, SSB_SPROM4_ANTAVAIL, SSB_SPROM4_ANTAVAIL_BG, -+ SSB_SPROM4_ANTAVAIL_BG_SHIFT); -+ SPEX(maxpwr_bg, SSB_SPROM4_MAXP_BG, SSB_SPROM4_MAXP_BG_MASK, 0); -+ SPEX(itssi_bg, SSB_SPROM4_MAXP_BG, SSB_SPROM4_ITSSI_BG, -+ SSB_SPROM4_ITSSI_BG_SHIFT); -+ SPEX(maxpwr_a, SSB_SPROM4_MAXP_A, SSB_SPROM4_MAXP_A_MASK, 0); -+ SPEX(itssi_a, SSB_SPROM4_MAXP_A, SSB_SPROM4_ITSSI_A, -+ SSB_SPROM4_ITSSI_A_SHIFT); -+ if (out->revision == 4) { -+ SPEX(gpio0, SSB_SPROM4_GPIOA, SSB_SPROM4_GPIOA_P0, 0); -+ SPEX(gpio1, SSB_SPROM4_GPIOA, SSB_SPROM4_GPIOA_P1, -+ SSB_SPROM4_GPIOA_P1_SHIFT); -+ SPEX(gpio2, SSB_SPROM4_GPIOB, SSB_SPROM4_GPIOB_P2, 0); -+ SPEX(gpio3, SSB_SPROM4_GPIOB, SSB_SPROM4_GPIOB_P3, -+ SSB_SPROM4_GPIOB_P3_SHIFT); -+ } else { -+ SPEX(gpio0, SSB_SPROM5_GPIOA, SSB_SPROM5_GPIOA_P0, 0); -+ SPEX(gpio1, SSB_SPROM5_GPIOA, SSB_SPROM5_GPIOA_P1, -+ SSB_SPROM5_GPIOA_P1_SHIFT); -+ SPEX(gpio2, SSB_SPROM5_GPIOB, SSB_SPROM5_GPIOB_P2, 0); -+ SPEX(gpio3, SSB_SPROM5_GPIOB, SSB_SPROM5_GPIOB_P3, -+ SSB_SPROM5_GPIOB_P3_SHIFT); -+ } -+ -+ /* Extract the antenna gain values. */ -+ out->antenna_gain.a0 = sprom_extract_antgain(out->revision, in, -+ SSB_SPROM4_AGAIN01, -+ SSB_SPROM4_AGAIN0, -+ SSB_SPROM4_AGAIN0_SHIFT); -+ out->antenna_gain.a1 = sprom_extract_antgain(out->revision, in, -+ SSB_SPROM4_AGAIN01, -+ SSB_SPROM4_AGAIN1, -+ SSB_SPROM4_AGAIN1_SHIFT); -+ out->antenna_gain.a2 = sprom_extract_antgain(out->revision, in, -+ SSB_SPROM4_AGAIN23, -+ SSB_SPROM4_AGAIN2, -+ SSB_SPROM4_AGAIN2_SHIFT); -+ out->antenna_gain.a3 = sprom_extract_antgain(out->revision, in, -+ SSB_SPROM4_AGAIN23, -+ SSB_SPROM4_AGAIN3, -+ SSB_SPROM4_AGAIN3_SHIFT); -+ -+ /* Extract cores power info info */ -+ for (i = 0; i < ARRAY_SIZE(pwr_info_offset); i++) { -+ u16 o = pwr_info_offset[i]; -+ -+ SPEX(core_pwr_info[i].itssi_2g, o + SSB_SPROM4_2G_MAXP_ITSSI, -+ SSB_SPROM4_2G_ITSSI, SSB_SPROM4_2G_ITSSI_SHIFT); -+ SPEX(core_pwr_info[i].maxpwr_2g, o + SSB_SPROM4_2G_MAXP_ITSSI, -+ SSB_SPROM4_2G_MAXP, 0); -+ -+ SPEX(core_pwr_info[i].pa_2g[0], o + SSB_SPROM4_2G_PA_0, ~0, 0); -+ SPEX(core_pwr_info[i].pa_2g[1], o + SSB_SPROM4_2G_PA_1, ~0, 0); -+ SPEX(core_pwr_info[i].pa_2g[2], o + SSB_SPROM4_2G_PA_2, ~0, 0); -+ SPEX(core_pwr_info[i].pa_2g[3], o + SSB_SPROM4_2G_PA_3, ~0, 0); -+ -+ SPEX(core_pwr_info[i].itssi_5g, o + SSB_SPROM4_5G_MAXP_ITSSI, -+ SSB_SPROM4_5G_ITSSI, SSB_SPROM4_5G_ITSSI_SHIFT); -+ SPEX(core_pwr_info[i].maxpwr_5g, o + SSB_SPROM4_5G_MAXP_ITSSI, -+ SSB_SPROM4_5G_MAXP, 0); -+ SPEX(core_pwr_info[i].maxpwr_5gh, o + SSB_SPROM4_5GHL_MAXP, -+ SSB_SPROM4_5GH_MAXP, 0); -+ SPEX(core_pwr_info[i].maxpwr_5gl, o + SSB_SPROM4_5GHL_MAXP, -+ SSB_SPROM4_5GL_MAXP, SSB_SPROM4_5GL_MAXP_SHIFT); -+ -+ SPEX(core_pwr_info[i].pa_5gl[0], o + SSB_SPROM4_5GL_PA_0, ~0, 0); -+ SPEX(core_pwr_info[i].pa_5gl[1], o + SSB_SPROM4_5GL_PA_1, ~0, 0); -+ SPEX(core_pwr_info[i].pa_5gl[2], o + SSB_SPROM4_5GL_PA_2, ~0, 0); -+ SPEX(core_pwr_info[i].pa_5gl[3], o + SSB_SPROM4_5GL_PA_3, ~0, 0); -+ SPEX(core_pwr_info[i].pa_5g[0], o + SSB_SPROM4_5G_PA_0, ~0, 0); -+ SPEX(core_pwr_info[i].pa_5g[1], o + SSB_SPROM4_5G_PA_1, ~0, 0); -+ SPEX(core_pwr_info[i].pa_5g[2], o + SSB_SPROM4_5G_PA_2, ~0, 0); -+ SPEX(core_pwr_info[i].pa_5g[3], o + SSB_SPROM4_5G_PA_3, ~0, 0); -+ SPEX(core_pwr_info[i].pa_5gh[0], o + SSB_SPROM4_5GH_PA_0, ~0, 0); -+ SPEX(core_pwr_info[i].pa_5gh[1], o + SSB_SPROM4_5GH_PA_1, ~0, 0); -+ SPEX(core_pwr_info[i].pa_5gh[2], o + SSB_SPROM4_5GH_PA_2, ~0, 0); -+ SPEX(core_pwr_info[i].pa_5gh[3], o + SSB_SPROM4_5GH_PA_3, ~0, 0); -+ } -+ -+ sprom_extract_r458(out, in); -+ -+ /* TODO - get remaining rev 4 stuff needed */ -+} -+ -+static void sprom_extract_r8(struct ssb_sprom *out, const u16 *in) -+{ -+ int i; -+ u16 o; -+ static const u16 pwr_info_offset[] = { -+ SSB_SROM8_PWR_INFO_CORE0, SSB_SROM8_PWR_INFO_CORE1, -+ SSB_SROM8_PWR_INFO_CORE2, SSB_SROM8_PWR_INFO_CORE3 -+ }; -+ BUILD_BUG_ON(ARRAY_SIZE(pwr_info_offset) != -+ ARRAY_SIZE(out->core_pwr_info)); -+ -+ SPEX(board_rev, SSB_SPROM8_BOARDREV, 0xFFFF, 0); -+ SPEX(board_type, SSB_SPROM1_SPID, 0xFFFF, 0); -+ SPEX(alpha2[0], SSB_SPROM8_CCODE, 0xff00, 8); -+ SPEX(alpha2[1], SSB_SPROM8_CCODE, 0x00ff, 0); -+ SPEX(boardflags_lo, SSB_SPROM8_BFLLO, 0xFFFF, 0); -+ SPEX(boardflags_hi, SSB_SPROM8_BFLHI, 0xFFFF, 0); -+ SPEX(boardflags2_lo, SSB_SPROM8_BFL2LO, 0xFFFF, 0); -+ SPEX(boardflags2_hi, SSB_SPROM8_BFL2HI, 0xFFFF, 0); -+ SPEX(ant_available_a, SSB_SPROM8_ANTAVAIL, SSB_SPROM8_ANTAVAIL_A, -+ SSB_SPROM8_ANTAVAIL_A_SHIFT); -+ SPEX(ant_available_bg, SSB_SPROM8_ANTAVAIL, SSB_SPROM8_ANTAVAIL_BG, -+ SSB_SPROM8_ANTAVAIL_BG_SHIFT); -+ SPEX(maxpwr_bg, SSB_SPROM8_MAXP_BG, SSB_SPROM8_MAXP_BG_MASK, 0); -+ SPEX(itssi_bg, SSB_SPROM8_MAXP_BG, SSB_SPROM8_ITSSI_BG, -+ SSB_SPROM8_ITSSI_BG_SHIFT); -+ SPEX(maxpwr_a, SSB_SPROM8_MAXP_A, SSB_SPROM8_MAXP_A_MASK, 0); -+ SPEX(itssi_a, SSB_SPROM8_MAXP_A, SSB_SPROM8_ITSSI_A, -+ SSB_SPROM8_ITSSI_A_SHIFT); -+ SPEX(maxpwr_ah, SSB_SPROM8_MAXP_AHL, SSB_SPROM8_MAXP_AH_MASK, 0); -+ SPEX(maxpwr_al, SSB_SPROM8_MAXP_AHL, SSB_SPROM8_MAXP_AL_MASK, -+ SSB_SPROM8_MAXP_AL_SHIFT); -+ SPEX(gpio0, SSB_SPROM8_GPIOA, SSB_SPROM8_GPIOA_P0, 0); -+ SPEX(gpio1, SSB_SPROM8_GPIOA, SSB_SPROM8_GPIOA_P1, -+ SSB_SPROM8_GPIOA_P1_SHIFT); -+ SPEX(gpio2, SSB_SPROM8_GPIOB, SSB_SPROM8_GPIOB_P2, 0); -+ SPEX(gpio3, SSB_SPROM8_GPIOB, SSB_SPROM8_GPIOB_P3, -+ SSB_SPROM8_GPIOB_P3_SHIFT); -+ SPEX(tri2g, SSB_SPROM8_TRI25G, SSB_SPROM8_TRI2G, 0); -+ SPEX(tri5g, SSB_SPROM8_TRI25G, SSB_SPROM8_TRI5G, -+ SSB_SPROM8_TRI5G_SHIFT); -+ SPEX(tri5gl, SSB_SPROM8_TRI5GHL, SSB_SPROM8_TRI5GL, 0); -+ SPEX(tri5gh, SSB_SPROM8_TRI5GHL, SSB_SPROM8_TRI5GH, -+ SSB_SPROM8_TRI5GH_SHIFT); -+ SPEX(rxpo2g, SSB_SPROM8_RXPO, SSB_SPROM8_RXPO2G, 0); -+ SPEX(rxpo5g, SSB_SPROM8_RXPO, SSB_SPROM8_RXPO5G, -+ SSB_SPROM8_RXPO5G_SHIFT); -+ SPEX(rssismf2g, SSB_SPROM8_RSSIPARM2G, SSB_SPROM8_RSSISMF2G, 0); -+ SPEX(rssismc2g, SSB_SPROM8_RSSIPARM2G, SSB_SPROM8_RSSISMC2G, -+ SSB_SPROM8_RSSISMC2G_SHIFT); -+ SPEX(rssisav2g, SSB_SPROM8_RSSIPARM2G, SSB_SPROM8_RSSISAV2G, -+ SSB_SPROM8_RSSISAV2G_SHIFT); -+ SPEX(bxa2g, SSB_SPROM8_RSSIPARM2G, SSB_SPROM8_BXA2G, -+ SSB_SPROM8_BXA2G_SHIFT); -+ SPEX(rssismf5g, SSB_SPROM8_RSSIPARM5G, SSB_SPROM8_RSSISMF5G, 0); -+ SPEX(rssismc5g, SSB_SPROM8_RSSIPARM5G, SSB_SPROM8_RSSISMC5G, -+ SSB_SPROM8_RSSISMC5G_SHIFT); -+ SPEX(rssisav5g, SSB_SPROM8_RSSIPARM5G, SSB_SPROM8_RSSISAV5G, -+ SSB_SPROM8_RSSISAV5G_SHIFT); -+ SPEX(bxa5g, SSB_SPROM8_RSSIPARM5G, SSB_SPROM8_BXA5G, -+ SSB_SPROM8_BXA5G_SHIFT); -+ SPEX(pa0b0, SSB_SPROM8_PA0B0, 0xFFFF, 0); -+ SPEX(pa0b1, SSB_SPROM8_PA0B1, 0xFFFF, 0); -+ SPEX(pa0b2, SSB_SPROM8_PA0B2, 0xFFFF, 0); -+ SPEX(pa1b0, SSB_SPROM8_PA1B0, 0xFFFF, 0); -+ SPEX(pa1b1, SSB_SPROM8_PA1B1, 0xFFFF, 0); -+ SPEX(pa1b2, SSB_SPROM8_PA1B2, 0xFFFF, 0); -+ SPEX(pa1lob0, SSB_SPROM8_PA1LOB0, 0xFFFF, 0); -+ SPEX(pa1lob1, SSB_SPROM8_PA1LOB1, 0xFFFF, 0); -+ SPEX(pa1lob2, SSB_SPROM8_PA1LOB2, 0xFFFF, 0); -+ SPEX(pa1hib0, SSB_SPROM8_PA1HIB0, 0xFFFF, 0); -+ SPEX(pa1hib1, SSB_SPROM8_PA1HIB1, 0xFFFF, 0); -+ SPEX(pa1hib2, SSB_SPROM8_PA1HIB2, 0xFFFF, 0); -+ SPEX(cck2gpo, SSB_SPROM8_CCK2GPO, 0xFFFF, 0); -+ SPEX32(ofdm2gpo, SSB_SPROM8_OFDM2GPO, 0xFFFFFFFF, 0); -+ SPEX32(ofdm5glpo, SSB_SPROM8_OFDM5GLPO, 0xFFFFFFFF, 0); -+ SPEX32(ofdm5gpo, SSB_SPROM8_OFDM5GPO, 0xFFFFFFFF, 0); -+ SPEX32(ofdm5ghpo, SSB_SPROM8_OFDM5GHPO, 0xFFFFFFFF, 0); -+ -+ /* Extract the antenna gain values. */ -+ out->antenna_gain.a0 = sprom_extract_antgain(out->revision, in, -+ SSB_SPROM8_AGAIN01, -+ SSB_SPROM8_AGAIN0, -+ SSB_SPROM8_AGAIN0_SHIFT); -+ out->antenna_gain.a1 = sprom_extract_antgain(out->revision, in, -+ SSB_SPROM8_AGAIN01, -+ SSB_SPROM8_AGAIN1, -+ SSB_SPROM8_AGAIN1_SHIFT); -+ out->antenna_gain.a2 = sprom_extract_antgain(out->revision, in, -+ SSB_SPROM8_AGAIN23, -+ SSB_SPROM8_AGAIN2, -+ SSB_SPROM8_AGAIN2_SHIFT); -+ out->antenna_gain.a3 = sprom_extract_antgain(out->revision, in, -+ SSB_SPROM8_AGAIN23, -+ SSB_SPROM8_AGAIN3, -+ SSB_SPROM8_AGAIN3_SHIFT); -+ -+ /* Extract cores power info info */ -+ for (i = 0; i < ARRAY_SIZE(pwr_info_offset); i++) { -+ o = pwr_info_offset[i]; -+ SPEX(core_pwr_info[i].itssi_2g, o + SSB_SROM8_2G_MAXP_ITSSI, -+ SSB_SPROM8_2G_ITSSI, SSB_SPROM8_2G_ITSSI_SHIFT); -+ SPEX(core_pwr_info[i].maxpwr_2g, o + SSB_SROM8_2G_MAXP_ITSSI, -+ SSB_SPROM8_2G_MAXP, 0); -+ -+ SPEX(core_pwr_info[i].pa_2g[0], o + SSB_SROM8_2G_PA_0, ~0, 0); -+ SPEX(core_pwr_info[i].pa_2g[1], o + SSB_SROM8_2G_PA_1, ~0, 0); -+ SPEX(core_pwr_info[i].pa_2g[2], o + SSB_SROM8_2G_PA_2, ~0, 0); -+ -+ SPEX(core_pwr_info[i].itssi_5g, o + SSB_SROM8_5G_MAXP_ITSSI, -+ SSB_SPROM8_5G_ITSSI, SSB_SPROM8_5G_ITSSI_SHIFT); -+ SPEX(core_pwr_info[i].maxpwr_5g, o + SSB_SROM8_5G_MAXP_ITSSI, -+ SSB_SPROM8_5G_MAXP, 0); -+ SPEX(core_pwr_info[i].maxpwr_5gh, o + SSB_SPROM8_5GHL_MAXP, -+ SSB_SPROM8_5GH_MAXP, 0); -+ SPEX(core_pwr_info[i].maxpwr_5gl, o + SSB_SPROM8_5GHL_MAXP, -+ SSB_SPROM8_5GL_MAXP, SSB_SPROM8_5GL_MAXP_SHIFT); -+ -+ SPEX(core_pwr_info[i].pa_5gl[0], o + SSB_SROM8_5GL_PA_0, ~0, 0); -+ SPEX(core_pwr_info[i].pa_5gl[1], o + SSB_SROM8_5GL_PA_1, ~0, 0); -+ SPEX(core_pwr_info[i].pa_5gl[2], o + SSB_SROM8_5GL_PA_2, ~0, 0); -+ SPEX(core_pwr_info[i].pa_5g[0], o + SSB_SROM8_5G_PA_0, ~0, 0); -+ SPEX(core_pwr_info[i].pa_5g[1], o + SSB_SROM8_5G_PA_1, ~0, 0); -+ SPEX(core_pwr_info[i].pa_5g[2], o + SSB_SROM8_5G_PA_2, ~0, 0); -+ SPEX(core_pwr_info[i].pa_5gh[0], o + SSB_SROM8_5GH_PA_0, ~0, 0); -+ SPEX(core_pwr_info[i].pa_5gh[1], o + SSB_SROM8_5GH_PA_1, ~0, 0); -+ SPEX(core_pwr_info[i].pa_5gh[2], o + SSB_SROM8_5GH_PA_2, ~0, 0); -+ } -+ -+ /* Extract FEM info */ -+ SPEX(fem.ghz2.tssipos, SSB_SPROM8_FEM2G, -+ SSB_SROM8_FEM_TSSIPOS, SSB_SROM8_FEM_TSSIPOS_SHIFT); -+ SPEX(fem.ghz2.extpa_gain, SSB_SPROM8_FEM2G, -+ SSB_SROM8_FEM_EXTPA_GAIN, SSB_SROM8_FEM_EXTPA_GAIN_SHIFT); -+ SPEX(fem.ghz2.pdet_range, SSB_SPROM8_FEM2G, -+ SSB_SROM8_FEM_PDET_RANGE, SSB_SROM8_FEM_PDET_RANGE_SHIFT); -+ SPEX(fem.ghz2.tr_iso, SSB_SPROM8_FEM2G, -+ SSB_SROM8_FEM_TR_ISO, SSB_SROM8_FEM_TR_ISO_SHIFT); -+ SPEX(fem.ghz2.antswlut, SSB_SPROM8_FEM2G, -+ SSB_SROM8_FEM_ANTSWLUT, SSB_SROM8_FEM_ANTSWLUT_SHIFT); -+ -+ SPEX(fem.ghz5.tssipos, SSB_SPROM8_FEM5G, -+ SSB_SROM8_FEM_TSSIPOS, SSB_SROM8_FEM_TSSIPOS_SHIFT); -+ SPEX(fem.ghz5.extpa_gain, SSB_SPROM8_FEM5G, -+ SSB_SROM8_FEM_EXTPA_GAIN, SSB_SROM8_FEM_EXTPA_GAIN_SHIFT); -+ SPEX(fem.ghz5.pdet_range, SSB_SPROM8_FEM5G, -+ SSB_SROM8_FEM_PDET_RANGE, SSB_SROM8_FEM_PDET_RANGE_SHIFT); -+ SPEX(fem.ghz5.tr_iso, SSB_SPROM8_FEM5G, -+ SSB_SROM8_FEM_TR_ISO, SSB_SROM8_FEM_TR_ISO_SHIFT); -+ SPEX(fem.ghz5.antswlut, SSB_SPROM8_FEM5G, -+ SSB_SROM8_FEM_ANTSWLUT, SSB_SROM8_FEM_ANTSWLUT_SHIFT); -+ -+ SPEX(leddc_on_time, SSB_SPROM8_LEDDC, SSB_SPROM8_LEDDC_ON, -+ SSB_SPROM8_LEDDC_ON_SHIFT); -+ SPEX(leddc_off_time, SSB_SPROM8_LEDDC, SSB_SPROM8_LEDDC_OFF, -+ SSB_SPROM8_LEDDC_OFF_SHIFT); -+ -+ SPEX(txchain, SSB_SPROM8_TXRXC, SSB_SPROM8_TXRXC_TXCHAIN, -+ SSB_SPROM8_TXRXC_TXCHAIN_SHIFT); -+ SPEX(rxchain, SSB_SPROM8_TXRXC, SSB_SPROM8_TXRXC_RXCHAIN, -+ SSB_SPROM8_TXRXC_RXCHAIN_SHIFT); -+ SPEX(antswitch, SSB_SPROM8_TXRXC, SSB_SPROM8_TXRXC_SWITCH, -+ SSB_SPROM8_TXRXC_SWITCH_SHIFT); -+ -+ SPEX(opo, SSB_SPROM8_OFDM2GPO, 0x00ff, 0); -+ -+ SPEX_ARRAY8(mcs2gpo, SSB_SPROM8_2G_MCSPO, ~0, 0); -+ SPEX_ARRAY8(mcs5gpo, SSB_SPROM8_5G_MCSPO, ~0, 0); -+ SPEX_ARRAY8(mcs5glpo, SSB_SPROM8_5GL_MCSPO, ~0, 0); -+ SPEX_ARRAY8(mcs5ghpo, SSB_SPROM8_5GH_MCSPO, ~0, 0); -+ -+ SPEX(rawtempsense, SSB_SPROM8_RAWTS, SSB_SPROM8_RAWTS_RAWTEMP, -+ SSB_SPROM8_RAWTS_RAWTEMP_SHIFT); -+ SPEX(measpower, SSB_SPROM8_RAWTS, SSB_SPROM8_RAWTS_MEASPOWER, -+ SSB_SPROM8_RAWTS_MEASPOWER_SHIFT); -+ SPEX(tempsense_slope, SSB_SPROM8_OPT_CORRX, -+ SSB_SPROM8_OPT_CORRX_TEMP_SLOPE, -+ SSB_SPROM8_OPT_CORRX_TEMP_SLOPE_SHIFT); -+ SPEX(tempcorrx, SSB_SPROM8_OPT_CORRX, SSB_SPROM8_OPT_CORRX_TEMPCORRX, -+ SSB_SPROM8_OPT_CORRX_TEMPCORRX_SHIFT); -+ SPEX(tempsense_option, SSB_SPROM8_OPT_CORRX, -+ SSB_SPROM8_OPT_CORRX_TEMP_OPTION, -+ SSB_SPROM8_OPT_CORRX_TEMP_OPTION_SHIFT); -+ SPEX(freqoffset_corr, SSB_SPROM8_HWIQ_IQSWP, -+ SSB_SPROM8_HWIQ_IQSWP_FREQ_CORR, -+ SSB_SPROM8_HWIQ_IQSWP_FREQ_CORR_SHIFT); -+ SPEX(iqcal_swp_dis, SSB_SPROM8_HWIQ_IQSWP, -+ SSB_SPROM8_HWIQ_IQSWP_IQCAL_SWP, -+ SSB_SPROM8_HWIQ_IQSWP_IQCAL_SWP_SHIFT); -+ SPEX(hw_iqcal_en, SSB_SPROM8_HWIQ_IQSWP, SSB_SPROM8_HWIQ_IQSWP_HW_IQCAL, -+ SSB_SPROM8_HWIQ_IQSWP_HW_IQCAL_SHIFT); -+ -+ SPEX(bw40po, SSB_SPROM8_BW40PO, ~0, 0); -+ SPEX(cddpo, SSB_SPROM8_CDDPO, ~0, 0); -+ SPEX(stbcpo, SSB_SPROM8_STBCPO, ~0, 0); -+ SPEX(bwduppo, SSB_SPROM8_BWDUPPO, ~0, 0); -+ -+ SPEX(tempthresh, SSB_SPROM8_THERMAL, SSB_SPROM8_THERMAL_TRESH, -+ SSB_SPROM8_THERMAL_TRESH_SHIFT); -+ SPEX(tempoffset, SSB_SPROM8_THERMAL, SSB_SPROM8_THERMAL_OFFSET, -+ SSB_SPROM8_THERMAL_OFFSET_SHIFT); -+ SPEX(phycal_tempdelta, SSB_SPROM8_TEMPDELTA, -+ SSB_SPROM8_TEMPDELTA_PHYCAL, -+ SSB_SPROM8_TEMPDELTA_PHYCAL_SHIFT); -+ SPEX(temps_period, SSB_SPROM8_TEMPDELTA, SSB_SPROM8_TEMPDELTA_PERIOD, -+ SSB_SPROM8_TEMPDELTA_PERIOD_SHIFT); -+ SPEX(temps_hysteresis, SSB_SPROM8_TEMPDELTA, -+ SSB_SPROM8_TEMPDELTA_HYSTERESIS, -+ SSB_SPROM8_TEMPDELTA_HYSTERESIS_SHIFT); -+ sprom_extract_r458(out, in); -+ -+ /* TODO - get remaining rev 8 stuff needed */ -+} -+ -+static int sprom_extract(struct ssb_sprom *out, const u16 *in, u16 size) -+{ -+ memset(out, 0, sizeof(*out)); -+ -+ out->revision = in[size - 1] & 0x00FF; -+ -+ memset(out->et0mac, 0xFF, 6); /* preset et0 and et1 mac */ -+ memset(out->et1mac, 0xFF, 6); -+ -+ switch (out->revision) { -+ case 1: -+ case 2: -+ case 3: -+ sprom_extract_r123(out, in); -+ break; -+ case 4: -+ case 5: -+ sprom_extract_r45(out, in); -+ break; -+ case 8: -+ sprom_extract_r8(out, in); -+ break; -+ default: -+ pr_warn("Unsupported SPROM revision %d detected. Will extract v1\n", -+ out->revision); -+ out->revision = 1; -+ sprom_extract_r123(out, in); -+ } -+ -+ if (out->boardflags_lo == 0xFFFF) -+ out->boardflags_lo = 0; /* per specs */ -+ if (out->boardflags_hi == 0xFFFF) -+ out->boardflags_hi = 0; /* per specs */ -+ -+ return 0; -+} -+ -+static __initdata u16 template_sprom[220]; - #endif - -+ - int __init bcm63xx_register_fallback_sprom(struct fallback_sprom_data *data) - { - int ret = 0; - - #ifdef CONFIG_SSB_PCIHOST -+ u16 size = 0; -+ - switch (data->type) { - case SPROM_DEFAULT: - memcpy(&bcm63xx_sprom, &bcm63xx_default_sprom, -@@ -71,6 +614,9 @@ int __init bcm63xx_register_fallback_spr - return -EINVAL; - } - -+ if (size > 0) -+ sprom_extract(&bcm63xx_sprom, template_sprom, size); -+ - memcpy(bcm63xx_sprom.il0mac, data->mac_addr, ETH_ALEN); - memcpy(bcm63xx_sprom.et0mac, data->mac_addr, ETH_ALEN); - memcpy(bcm63xx_sprom.et1mac, data->mac_addr, ETH_ALEN); diff --git a/target/linux/bcm63xx/patches-5.15/361-MIPS-BCM63XX-add-raw-fallback-sproms-for-most-common.patch b/target/linux/bcm63xx/patches-5.15/361-MIPS-BCM63XX-add-raw-fallback-sproms-for-most-common.patch deleted file mode 100644 index 0017cc2f6a0a76..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/361-MIPS-BCM63XX-add-raw-fallback-sproms-for-most-common.patch +++ /dev/null @@ -1,181 +0,0 @@ -From 7be5bb46003295c9e04fd4e795593b2deaacd783 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Tue, 29 Jul 2014 22:33:38 +0200 -Subject: [PATCH 06/10] MIPS: BCM63XX: add raw fallback sproms for most common - ssb cards - -Add template sproms for BCM4306, BCM4318, BCM4321, BCM4322, and BCM43222. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/sprom.c | 136 +++++++++++++++++++++ - .../asm/mach-bcm63xx/bcm63xx_fallback_sprom.h | 6 + - 2 files changed, 142 insertions(+) - ---- a/arch/mips/bcm63xx/sprom.c -+++ b/arch/mips/bcm63xx/sprom.c -@@ -43,6 +43,122 @@ static __initconst struct ssb_sprom bcm6 - .boardflags_hi = 0x0000, - }; - -+ -+static __initconst u16 bcm4306_sprom[] = { -+ 0x4001, 0x0000, 0x0453, 0x14e4, 0x4320, 0x8000, 0x0002, 0x0002, -+ 0x1000, 0x1800, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x3034, 0x14d4, -+ 0xfa91, 0xfe60, 0xffff, 0xffff, 0x004c, 0xffff, 0xffff, 0xffff, -+ 0x003e, 0x0a49, 0xff02, 0x0000, 0xff10, 0xffff, 0xffff, 0x0002, -+}; -+ -+static __initconst u16 bcm4318_sprom[] = { -+ 0x2001, 0x0000, 0x0449, 0x14e4, 0x4318, 0x8000, 0x0002, 0x0000, -+ 0x1000, 0x1800, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x3046, 0x15a7, -+ 0xfab0, 0xfe97, 0xffff, 0xffff, 0x0048, 0xffff, 0xffff, 0xffff, -+ 0x003e, 0xea49, 0xff02, 0x0000, 0xff08, 0xffff, 0xffff, 0x0002, -+}; -+ -+static __initconst u16 bcm4321_sprom[] = { -+ 0x3001, 0x0000, 0x046c, 0x14e4, 0x4328, 0x8000, 0x0002, 0x0000, -+ 0x1000, 0x1800, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x5372, 0x0032, 0x4a01, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0x0303, 0x0202, -+ 0xffff, 0x2728, 0x5b5b, 0x222b, 0x5b5b, 0x1927, 0x5b5b, 0x1e36, -+ 0x5b5b, 0x303c, 0x3030, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x3e4c, 0x0000, 0x0000, 0x0000, 0x0000, 0x7838, 0x3a34, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x3e4c, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x7838, 0x3a34, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0x0008, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0x0004, -+}; -+ -+static __initconst u16 bcm4322_sprom[] = { -+ 0x3001, 0x0000, 0x04bc, 0x14e4, 0x432c, 0x8000, 0x0002, 0x0000, -+ 0x1730, 0x1800, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x5372, 0x1209, 0x0200, 0x0000, 0x0400, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0x0303, 0x0202, -+ 0xffff, 0x0033, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0301, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x2048, 0xfe9a, 0x1571, 0xfabd, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x2048, 0xfeb9, 0x159f, 0xfadd, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x3333, 0x5555, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0x0008, -+}; -+ -+static __initconst u16 bcm43222_sprom[] = { -+ 0x2001, 0x0000, 0x04d4, 0x14e4, 0x4351, 0x8000, 0x0002, 0x0000, -+ 0x1730, 0x1800, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x5372, 0x2305, 0x0200, 0x0000, 0x2400, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0x0303, 0x0202, -+ 0xffff, 0x0033, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0325, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x204c, 0xfea6, 0x1717, 0xfa6d, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x204c, 0xfeb8, 0x167c, 0xfa9e, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x0000, 0x3333, 0x3333, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x3333, 0x3333, 0x3333, 0x3333, 0x3333, 0x3333, 0x3333, -+ 0x3333, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0004, 0x0000, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0x0008, -+}; -+ - static struct ssb_sprom bcm63xx_sprom; - - int bcm63xx_get_fallback_sprom(struct ssb_bus *bus, struct ssb_sprom *out) -@@ -606,6 +722,26 @@ int __init bcm63xx_register_fallback_spr - u16 size = 0; - - switch (data->type) { -+ case SPROM_BCM4306: -+ memcpy(&template_sprom, &bcm4306_sprom, sizeof(bcm4306_sprom)); -+ size = ARRAY_SIZE(bcm4306_sprom); -+ break; -+ case SPROM_BCM4318: -+ memcpy(&template_sprom, &bcm4318_sprom, sizeof(bcm4318_sprom)); -+ size = ARRAY_SIZE(bcm4318_sprom); -+ break; -+ case SPROM_BCM4321: -+ memcpy(&template_sprom, &bcm4321_sprom, sizeof(bcm4321_sprom)); -+ size = ARRAY_SIZE(bcm4321_sprom); -+ break; -+ case SPROM_BCM4322: -+ memcpy(&template_sprom, &bcm4322_sprom, sizeof(bcm4322_sprom)); -+ size = ARRAY_SIZE(bcm4322_sprom); -+ break; -+ case SPROM_BCM43222: -+ memcpy(&template_sprom, &bcm43222_sprom, sizeof(bcm43222_sprom)); -+ size = ARRAY_SIZE(bcm43222_sprom); -+ break; - case SPROM_DEFAULT: - memcpy(&bcm63xx_sprom, &bcm63xx_default_sprom, - sizeof(bcm63xx_sprom)); ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h -@@ -5,6 +5,12 @@ - - enum sprom_type { - SPROM_DEFAULT, /* default fallback sprom */ -+ /* SSB based */ -+ SPROM_BCM4306, -+ SPROM_BCM4318, -+ SPROM_BCM4321, -+ SPROM_BCM4322, -+ SPROM_BCM43222, - }; - - struct fallback_sprom_data { diff --git a/target/linux/bcm63xx/patches-5.15/362-MIPS-BCM63XX-also-register-a-fallback-sprom-for-bcma.patch b/target/linux/bcm63xx/patches-5.15/362-MIPS-BCM63XX-also-register-a-fallback-sprom-for-bcma.patch deleted file mode 100644 index eaabbeb432e1ea..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/362-MIPS-BCM63XX-also-register-a-fallback-sprom-for-bcma.patch +++ /dev/null @@ -1,128 +0,0 @@ -From 03feb9db77fba3eef3d83e17a87a56979659b248 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Tue, 29 Jul 2014 22:48:26 +0200 -Subject: [PATCH 07/10] MIPS: BCM63XX: also register a fallback sprom for bcma - -Similar to SSB, register a fallback sprom handler for BCMA. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/boards/Kconfig | 1 + - arch/mips/bcm63xx/sprom.c | 40 +++++++++++++++++++++++++++++++++++----- - 2 files changed, 36 insertions(+), 5 deletions(-) - ---- a/arch/mips/bcm63xx/boards/Kconfig -+++ b/arch/mips/bcm63xx/boards/Kconfig -@@ -5,6 +5,7 @@ menu "Board support" - config BOARD_BCM963XX - bool "Generic Broadcom 963xx boards" - select SSB -+ select BCMA - default y - - endmenu ---- a/arch/mips/bcm63xx/sprom.c -+++ b/arch/mips/bcm63xx/sprom.c -@@ -12,6 +12,7 @@ - #include - #include - #include -+#include - #include - #include - -@@ -21,7 +22,7 @@ - * Register a sane SPROMv2 to make the on-board - * bcm4318 WLAN work - */ --#ifdef CONFIG_SSB_PCIHOST -+#if defined(CONFIG_SSB_PCIHOST) || defined(CONFIG_BCMA_HOST_PCI) - static __initconst struct ssb_sprom bcm63xx_default_sprom = { - .revision = 0x02, - .board_rev = 0x17, -@@ -43,7 +44,7 @@ static __initconst struct ssb_sprom bcm6 - .boardflags_hi = 0x0000, - }; - -- -+#if defined (CONFIG_SSB_PCIHOST) - static __initconst u16 bcm4306_sprom[] = { - 0x4001, 0x0000, 0x0453, 0x14e4, 0x4320, 0x8000, 0x0002, 0x0002, - 0x1000, 0x1800, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, -@@ -158,10 +159,12 @@ static __initconst u16 bcm43222_sprom[] - 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0xffff, 0x0008, - }; -+#endif /* CONFIG_SSB_PCIHOST */ - - static struct ssb_sprom bcm63xx_sprom; - --int bcm63xx_get_fallback_sprom(struct ssb_bus *bus, struct ssb_sprom *out) -+#if defined(CONFIG_SSB_PCIHOST) -+int bcm63xx_get_fallback_ssb_sprom(struct ssb_bus *bus, struct ssb_sprom *out) - { - if (bus->bustype == SSB_BUSTYPE_PCI) { - memcpy(out, &bcm63xx_sprom, sizeof(struct ssb_sprom)); -@@ -171,6 +174,20 @@ int bcm63xx_get_fallback_sprom(struct ss - return -EINVAL; - } - } -+#endif -+ -+#if defined(CONFIG_BCMA_HOST_PCI) -+int bcm63xx_get_fallback_bcma_sprom(struct bcma_bus *bus, struct ssb_sprom *out) -+{ -+ if (bus->hosttype == BCMA_HOSTTYPE_PCI) { -+ memcpy(out, &bcm63xx_sprom, sizeof(struct ssb_sprom)); -+ return 0; -+ } else { -+ printk(KERN_ERR PFX "unable to fill SPROM for given bustype.\n"); -+ return -EINVAL; -+ } -+} -+#endif - - /* FIXME: use lib_sprom after submission upstream */ - -@@ -718,10 +735,11 @@ int __init bcm63xx_register_fallback_spr - { - int ret = 0; - --#ifdef CONFIG_SSB_PCIHOST -+#if defined(CONFIG_SSB_PCIHOST) || defined(CONFIG_BCMA_HOST_PCI) - u16 size = 0; - - switch (data->type) { -+#if defined(CONFIG_SSB_PCIHOST) - case SPROM_BCM4306: - memcpy(&template_sprom, &bcm4306_sprom, sizeof(bcm4306_sprom)); - size = ARRAY_SIZE(bcm4306_sprom); -@@ -742,6 +760,7 @@ int __init bcm63xx_register_fallback_spr - memcpy(&template_sprom, &bcm43222_sprom, sizeof(bcm43222_sprom)); - size = ARRAY_SIZE(bcm43222_sprom); - break; -+#endif - case SPROM_DEFAULT: - memcpy(&bcm63xx_sprom, &bcm63xx_default_sprom, - sizeof(bcm63xx_sprom)); -@@ -756,8 +775,19 @@ int __init bcm63xx_register_fallback_spr - memcpy(bcm63xx_sprom.il0mac, data->mac_addr, ETH_ALEN); - memcpy(bcm63xx_sprom.et0mac, data->mac_addr, ETH_ALEN); - memcpy(bcm63xx_sprom.et1mac, data->mac_addr, ETH_ALEN); -+#endif /* defined(CONFIG_SSB_PCIHOST) || defined(CONFIG_BCMA_HOST_PCI) */ -+ -+#if defined(CONFIG_SSB_PCIHOST) -+ ret = ssb_arch_register_fallback_sprom(&bcm63xx_get_fallback_ssb_sprom); -+ if (ret) -+ return ret; -+ -+#endif - -- ret = ssb_arch_register_fallback_sprom(&bcm63xx_get_fallback_sprom); -+#if defined(CONFIG_BCMA_HOST_PCI) -+ ret = bcma_arch_register_fallback_sprom(bcm63xx_get_fallback_bcma_sprom); -+ if (ret) -+ return ret; - #endif - return ret; - } diff --git a/target/linux/bcm63xx/patches-5.15/363-MIPS-BCM63XX-add-BCMA-based-sprom-templates.patch b/target/linux/bcm63xx/patches-5.15/363-MIPS-BCM63XX-add-BCMA-based-sprom-templates.patch deleted file mode 100644 index d3c40fff431edd..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/363-MIPS-BCM63XX-add-BCMA-based-sprom-templates.patch +++ /dev/null @@ -1,303 +0,0 @@ -From 27bf70e3fe797691b17df07ecbfaf9f5a4419f49 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Wed, 30 Jul 2014 23:14:27 +0200 -Subject: [PATCH 08/10] MIPS: BCM63XX: add BCMA based sprom templates - -Add fallback sproms for BCM4313, BCM43131, BCM43217, BCM43225, BCM43227, -BCM43228, and BCM4331. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/sprom.c | 256 +++++++++++++++++++++ - .../asm/mach-bcm63xx/bcm63xx_fallback_sprom.h | 8 + - 2 files changed, 264 insertions(+) - ---- a/arch/mips/bcm63xx/sprom.c -+++ b/arch/mips/bcm63xx/sprom.c -@@ -161,6 +161,226 @@ static __initconst u16 bcm43222_sprom[] - }; - #endif /* CONFIG_SSB_PCIHOST */ - -+#if defined(CONFIG_BCMA_HOST_PCI) -+static __initconst u16 bcm4313_sprom[] = { -+ 0x2801, 0x0000, 0x0510, 0x14e4, 0x0078, 0xedbe, 0x0000, 0x2bc4, -+ 0x2a64, 0x2964, 0x2c64, 0x3ce7, 0x46ff, 0x47ff, 0x0c00, 0x0820, -+ 0x0030, 0x1002, 0x9f28, 0x5d44, 0x8080, 0x1d8f, 0x0032, 0x0100, -+ 0xdf00, 0x71f5, 0x8400, 0x0083, 0x8500, 0x2010, 0x0001, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x1008, 0x0305, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x4727, 0x8000, 0x0002, 0x0000, 0x1f30, 0x1800, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x5372, 0x1215, 0x2a00, 0x0800, 0x0800, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0003, 0xffff, 0x88ff, 0xffff, 0x0003, 0x0202, -+ 0xffff, 0x0011, 0x007a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0201, -+ 0x0000, 0x7800, 0x7c0a, 0x0398, 0x0008, 0x0000, 0x0000, 0x0000, -+ 0x0044, 0x1684, 0xfd0d, 0xff35, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0048, 0xfed2, 0x15d9, 0xfac6, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0008, -+}; -+ -+static __initconst u16 bcm43131_sprom[] = { -+ 0x2801, 0x0000, 0x05f7, 0x14e4, 0x0070, 0xedbe, 0x1c00, 0x2bc4, -+ 0x2a64, 0x2964, 0x2c64, 0x3ce7, 0x46ff, 0x47ff, 0x0c00, 0x0820, -+ 0x0030, 0x1002, 0x9f28, 0x5d44, 0x8080, 0x1d8f, 0x0032, 0x0100, -+ 0xdf00, 0x71f5, 0x8400, 0x0083, 0x8500, 0x2010, 0x0001, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x1008, 0x0305, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x43aa, 0x8000, 0x0002, 0x0000, 0x1f30, 0x1800, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x5372, 0x1280, 0x0200, 0x0000, 0x8800, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0003, 0xffff, 0x88ff, 0xffff, 0x0002, 0x0202, -+ 0xffff, 0x0022, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0415, -+ 0x0000, 0x7800, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x204c, 0xfe96, 0x192c, 0xfa15, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x204c, 0xfe91, 0x1950, 0xfa0a, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x0000, 0x4444, 0x4444, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x4444, 0x4444, 0x4444, 0x4444, 0x6666, 0x6666, 0x6666, -+ 0x6666, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0x0008, -+}; -+ -+static __initconst u16 bcm43217_sprom[] = { -+ 0x2801, 0x0000, 0x05e9, 0x14e4, 0x0070, 0xedbe, 0x0000, 0x2bc4, -+ 0x2a64, 0x2964, 0x2c64, 0x3ce7, 0x46ff, 0x47ff, 0x0c00, 0x0820, -+ 0x0030, 0x1002, 0x9f28, 0x5d44, 0x8080, 0x1d8f, 0x0032, 0x0100, -+ 0xdf00, 0x71f5, 0x8400, 0x0083, 0x8500, 0x2010, 0x0001, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x1008, 0x0305, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x43a9, 0x8000, 0x0002, 0x0000, 0x1f30, 0x1800, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x5372, 0x1252, 0x0200, 0x0000, 0x9800, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0003, 0xffff, 0x88ff, 0xffff, 0x0003, 0x0202, -+ 0xffff, 0x0033, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0415, -+ 0x0000, 0x7800, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x204c, 0xfe96, 0x192c, 0xfa15, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x204c, 0xfe91, 0x1950, 0xfa0a, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x0000, 0x4444, 0x4444, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x4444, 0x4444, 0x4444, 0x4444, 0x6666, 0x6666, 0x6666, -+ 0x6666, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0x7a08, -+}; -+ -+static __initconst u16 bcm43225_sprom[] = { -+ 0x2801, 0x0000, 0x04da, 0x14e4, 0x0078, 0xedbe, 0x0000, 0x2bc4, -+ 0x2a64, 0x2964, 0x2c64, 0x3ce7, 0x46ff, 0x47ff, 0x0c00, 0x0820, -+ 0x0030, 0x1002, 0x9f28, 0x5d44, 0x8080, 0x1d8f, 0x0032, 0x0100, -+ 0xdf00, 0x71f5, 0x8400, 0x0083, 0x8500, 0x2010, 0x0001, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0x1008, 0x0005, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x4357, 0x8000, 0x0002, 0x0000, 0x1f30, 0x1800, 0x0000, 0x0000, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x5372, 0x1200, 0x0200, 0x0000, 0x1000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x88ff, 0xffff, 0xffff, 0x0303, 0x0202, -+ 0xffff, 0x0033, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0325, -+ 0xffff, 0x7800, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x204e, 0xfead, 0x1611, 0xfa9a, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x204e, 0xfec1, 0x1674, 0xfab2, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x0000, 0x5555, 0x5555, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x5555, 0x7555, 0x5555, 0x7555, 0x5555, 0x7555, 0x5555, -+ 0x7555, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0002, 0x0000, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0x0008, -+}; -+ -+static __initconst u16 bcm43227_sprom[] = { -+ 0x2801, 0x0000, 0x0543, 0x14e4, 0x0070, 0xedbe, 0x0000, 0x2bc4, -+ 0x2a64, 0x2964, 0x2c64, 0x3ce7, 0x46ff, 0x47ff, 0x0c00, 0x0820, -+ 0x0030, 0x1002, 0x9f28, 0x5d44, 0x8080, 0x1d8f, 0x0032, 0x0100, -+ 0xdf00, 0x71f5, 0x8400, 0x0083, 0x8500, 0x2010, 0x0001, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x1008, 0x0305, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x4358, 0x8000, 0x0002, 0x0000, 0x1f30, 0x1800, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x5372, 0x1402, 0x0200, 0x0000, 0x0800, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0003, 0xffff, 0x88ff, 0xffff, 0x0003, 0x0202, -+ 0xffff, 0x0033, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0415, -+ 0x0000, 0x7800, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x204c, 0xff36, 0x16d2, 0xfaae, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x204c, 0xfeca, 0x159b, 0xfa80, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x0000, 0x4444, 0x4444, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x4444, 0x4444, 0x4444, 0x4444, 0x6666, 0x6666, 0x6666, -+ 0x6666, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0x0008, -+}; -+ -+static __initconst u16 bcm43228_sprom[] = { -+ 0x2801, 0x0000, 0x0011, 0x1028, 0x0070, 0xedbe, 0x0000, 0x2bc4, -+ 0x2a64, 0x2964, 0x2c64, 0x3ce7, 0x46ff, 0x47ff, 0x0c00, 0x0820, -+ 0x0030, 0x1002, 0x9f28, 0x5d44, 0x8080, 0x1d8f, 0x0032, 0x0100, -+ 0xdf00, 0x71f5, 0x8400, 0x0083, 0x8500, 0x2010, 0x0001, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x1008, 0x0305, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x4359, 0x8000, 0x0002, 0x0000, 0x1f30, 0x1800, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x5372, 0x1203, 0x0200, 0x0000, 0x0800, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0003, 0xffff, 0x88ff, 0xffff, 0x0303, 0x0202, -+ 0xffff, 0x0033, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0215, -+ 0x0215, 0x7800, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x204c, 0xff73, 0x1762, 0xfaa4, 0x3e34, 0x3434, 0xfea1, 0x154c, -+ 0xfad0, 0xfea1, 0x144c, 0xfafb, 0xfe7b, 0x13fe, 0xfafc, 0x0000, -+ 0x204c, 0xff41, 0x16a3, 0xfa8f, 0x3e34, 0x3434, 0xfe97, 0x1446, -+ 0xfb05, 0xfe97, 0x1346, 0xfb32, 0xfeb9, 0x1516, 0xfaee, 0x0000, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x0000, 0x4444, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x4444, 0x4444, 0x4444, 0x4444, 0x8888, 0x8888, 0x8888, -+ 0x8888, 0x0000, 0x0000, 0x0000, 0x0000, 0x3333, 0x3333, 0x3333, -+ 0x3333, 0x0000, 0x0000, 0x0000, 0x0000, 0x3333, 0x3333, 0x3333, -+ 0x3333, 0x0000, 0x0000, 0x0000, 0x0000, 0x3333, 0x3333, 0x3333, -+ 0x3333, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xf008, -+}; -+ -+static __initconst u16 bcm4331_sprom[] = { -+ 0x2801, 0x0000, 0x0525, 0x14e4, 0x0078, 0xedbe, 0x0000, 0x2bc4, -+ 0x2a64, 0x2964, 0x2c64, 0x3ce7, 0x46ff, 0x47ff, 0x0c00, 0x0820, -+ 0x0030, 0x1002, 0x9f28, 0x5d44, 0x8080, 0x1d8f, 0x0032, 0x0100, -+ 0xdf00, 0x71f5, 0x8400, 0x0083, 0x8500, 0x2010, 0x0001, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0x1010, 0x0005, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x4331, 0x8000, 0x0002, 0x0000, 0x1f30, 0x1800, 0x0000, 0x0000, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x5372, 0x1104, 0x0200, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0xffff, 0x88ff, 0xffff, 0x0707, 0x0202, -+ 0xff02, 0x0077, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0325, -+ 0x0325, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x2048, 0xfe56, 0x16f2, 0xfa44, 0x3e3c, 0x3c3c, 0xfe77, 0x1657, -+ 0xfa75, 0xffff, 0xffff, 0xffff, 0xfe76, 0x15da, 0xfa85, 0x0000, -+ 0x2048, 0xfe5c, 0x16b5, 0xfa56, 0x3e3c, 0x3c3c, 0xfe7c, 0x169d, -+ 0xfa6b, 0xffff, 0xffff, 0xffff, 0xfe7a, 0x1597, 0xfa97, 0x0000, -+ 0x2048, 0xfe68, 0x1734, 0xfa46, 0x3e3c, 0x3c3c, 0xfe7f, 0x15e4, -+ 0xfa94, 0xffff, 0xffff, 0xffff, 0xfe7d, 0x1582, 0xfa9f, 0x0000, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, -+ 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, -+ 0xffff, 0xffff, 0xffff, 0x0009, -+}; -+ -+#endif /* CONFIG_BCMA_HOST_PCI */ -+ - static struct ssb_sprom bcm63xx_sprom; - - #if defined(CONFIG_SSB_PCIHOST) -@@ -761,6 +981,42 @@ int __init bcm63xx_register_fallback_spr - size = ARRAY_SIZE(bcm43222_sprom); - break; - #endif -+#if defined(CONFIG_BCMA_HOST_PCI) -+ case SPROM_BCM4313: -+ memcpy(&template_sprom, &bcm4313_sprom, -+ sizeof(bcm4313_sprom)); -+ size = ARRAY_SIZE(bcm4313_sprom); -+ break; -+ case SPROM_BCM43131: -+ memcpy(&template_sprom, &bcm43131_sprom, -+ sizeof(bcm43131_sprom)); -+ size = ARRAY_SIZE(bcm43131_sprom); -+ break; -+ case SPROM_BCM43217: -+ memcpy(&template_sprom, &bcm43217_sprom, -+ sizeof(bcm43217_sprom)); -+ size = ARRAY_SIZE(bcm43217_sprom); -+ break; -+ case SPROM_BCM43225: -+ memcpy(&template_sprom, &bcm43225_sprom, -+ sizeof(bcm43225_sprom)); -+ size = ARRAY_SIZE(bcm43225_sprom); -+ break; -+ case SPROM_BCM43227: -+ memcpy(&template_sprom, &bcm43227_sprom, -+ sizeof(bcm43227_sprom)); -+ size = ARRAY_SIZE(bcm43227_sprom); -+ break; -+ case SPROM_BCM43228: -+ memcpy(&template_sprom, &bcm43228_sprom, -+ sizeof(bcm43228_sprom)); -+ size = ARRAY_SIZE(bcm43228_sprom); -+ break; -+ case SPROM_BCM4331: -+ memcpy(&template_sprom, &bcm4331_sprom, sizeof(&bcm4331_sprom)); -+ size = ARRAY_SIZE(bcm4331_sprom); -+ break; -+#endif - case SPROM_DEFAULT: - memcpy(&bcm63xx_sprom, &bcm63xx_default_sprom, - sizeof(bcm63xx_sprom)); ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h -@@ -11,6 +11,14 @@ enum sprom_type { - SPROM_BCM4321, - SPROM_BCM4322, - SPROM_BCM43222, -+ /* BCMA based */ -+ SPROM_BCM4313, -+ SPROM_BCM43131, -+ SPROM_BCM43217, -+ SPROM_BCM43225, -+ SPROM_BCM43227, -+ SPROM_BCM43228, -+ SPROM_BCM4331, - }; - - struct fallback_sprom_data { diff --git a/target/linux/bcm63xx/patches-5.15/364-MIPS-BCM63XX-allow-board-files-to-provide-sprom-fixu.patch b/target/linux/bcm63xx/patches-5.15/364-MIPS-BCM63XX-allow-board-files-to-provide-sprom-fixu.patch deleted file mode 100644 index ad5ccbab0cbac9..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/364-MIPS-BCM63XX-allow-board-files-to-provide-sprom-fixu.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 8575548b08e33c9ff4fd540abec09dd177e33682 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Thu, 31 Jul 2014 19:12:33 +0200 -Subject: [PATCH 09/10] MIPS: BCM63XX: allow board files to provide sprom - fixups - -Allow board_info files to supply fixups for the base sproms to adapt -them to the actual used sprom contents in case they do not use the -default ones. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/sprom.c | 14 +++++++++++++- - .../mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h | 8 ++++++++ - 2 files changed, 21 insertions(+), 1 deletion(-) - ---- a/arch/mips/bcm63xx/sprom.c -+++ b/arch/mips/bcm63xx/sprom.c -@@ -947,6 +947,14 @@ static int sprom_extract(struct ssb_spro - return 0; - } - -+void sprom_apply_fixups(u16 *sprom, struct sprom_fixup *fixups, int n) -+{ -+ unsigned int i; -+ -+ for (i = 0; i < n; i++) -+ sprom[fixups[i].offset] = fixups[i].value; -+} -+ - static __initdata u16 template_sprom[220]; - #endif - -@@ -1025,8 +1033,12 @@ int __init bcm63xx_register_fallback_spr - return -EINVAL; - } - -- if (size > 0) -+ if (size > 0) { -+ sprom_apply_fixups(template_sprom, data->board_fixups, -+ data->num_board_fixups); -+ - sprom_extract(&bcm63xx_sprom, template_sprom, size); -+ } - - memcpy(bcm63xx_sprom.il0mac, data->mac_addr, ETH_ALEN); - memcpy(bcm63xx_sprom.et0mac, data->mac_addr, ETH_ALEN); ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h -@@ -21,9 +21,17 @@ enum sprom_type { - SPROM_BCM4331, - }; - -+struct sprom_fixup { -+ u16 offset; -+ u16 value; -+}; -+ - struct fallback_sprom_data { - u8 mac_addr[ETH_ALEN]; - enum sprom_type type; -+ -+ struct sprom_fixup *board_fixups; -+ unsigned int num_board_fixups; - }; - - int bcm63xx_register_fallback_sprom(struct fallback_sprom_data *data); diff --git a/target/linux/bcm63xx/patches-5.15/365-MIPS-BCM63XX-allow-setting-a-pci-bus-device-for-fall.patch b/target/linux/bcm63xx/patches-5.15/365-MIPS-BCM63XX-allow-setting-a-pci-bus-device-for-fall.patch deleted file mode 100644 index 4b994a22c61531..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/365-MIPS-BCM63XX-allow-setting-a-pci-bus-device-for-fall.patch +++ /dev/null @@ -1,102 +0,0 @@ -From f393eaacf178e7e8a61eb11a96edd7dfb35cb49d Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Thu, 31 Jul 2014 20:39:44 +0200 -Subject: [PATCH 10/10] MIPS: BCM63XX: allow setting a pci bus/device for - fallback sprom - -Warn if the set pci bus/slot does not match the actual request. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/sprom.c | 31 ++++++++++++++++++---- - .../asm/mach-bcm63xx/bcm63xx_fallback_sprom.h | 3 +++ - 2 files changed, 29 insertions(+), 5 deletions(-) - ---- a/arch/mips/bcm63xx/sprom.c -+++ b/arch/mips/bcm63xx/sprom.c -@@ -381,13 +381,25 @@ static __initconst u16 bcm4331_sprom[] = - - #endif /* CONFIG_BCMA_HOST_PCI */ - --static struct ssb_sprom bcm63xx_sprom; -+struct fallback_sprom_match { -+ u8 pci_bus; -+ u8 pci_dev; -+ struct ssb_sprom sprom; -+}; -+ -+static struct fallback_sprom_match fallback_sprom; - - #if defined(CONFIG_SSB_PCIHOST) - int bcm63xx_get_fallback_ssb_sprom(struct ssb_bus *bus, struct ssb_sprom *out) - { - if (bus->bustype == SSB_BUSTYPE_PCI) { -- memcpy(out, &bcm63xx_sprom, sizeof(struct ssb_sprom)); -+ if (bus->host_pci->bus->number != fallback_sprom.pci_bus || -+ PCI_SLOT(bus->host_pci->devfn) != fallback_sprom.pci_dev) -+ pr_warn("ssb_fallback_sprom: pci bus/device num mismatch: expected %i/%i, but got %i/%i\n", -+ fallback_sprom.pci_bus, fallback_sprom.pci_dev, -+ bus->host_pci->bus->number, -+ PCI_SLOT(bus->host_pci->devfn)); -+ memcpy(out, &fallback_sprom.sprom, sizeof(struct ssb_sprom)); - return 0; - } else { - printk(KERN_ERR PFX "unable to fill SPROM for given bustype.\n"); -@@ -400,7 +412,13 @@ int bcm63xx_get_fallback_ssb_sprom(struc - int bcm63xx_get_fallback_bcma_sprom(struct bcma_bus *bus, struct ssb_sprom *out) - { - if (bus->hosttype == BCMA_HOSTTYPE_PCI) { -- memcpy(out, &bcm63xx_sprom, sizeof(struct ssb_sprom)); -+ if (bus->host_pci->bus->number != fallback_sprom.pci_bus || -+ PCI_SLOT(bus->host_pci->devfn) != fallback_sprom.pci_dev) -+ pr_warn("bcma_fallback_sprom: pci bus/device num mismatch: expected %i/%i, but got %i/%i\n", -+ fallback_sprom.pci_bus, fallback_sprom.pci_dev, -+ bus->host_pci->bus->number, -+ PCI_SLOT(bus->host_pci->devfn)); -+ memcpy(out, &fallback_sprom.sprom, sizeof(struct ssb_sprom)); - return 0; - } else { - printk(KERN_ERR PFX "unable to fill SPROM for given bustype.\n"); -@@ -1026,8 +1044,8 @@ int __init bcm63xx_register_fallback_spr - break; - #endif - case SPROM_DEFAULT: -- memcpy(&bcm63xx_sprom, &bcm63xx_default_sprom, -- sizeof(bcm63xx_sprom)); -+ memcpy(&fallback_sprom.sprom, &bcm63xx_default_sprom, -+ sizeof(bcm63xx_default_sprom)); - break; - default: - return -EINVAL; -@@ -1037,12 +1055,15 @@ int __init bcm63xx_register_fallback_spr - sprom_apply_fixups(template_sprom, data->board_fixups, - data->num_board_fixups); - -- sprom_extract(&bcm63xx_sprom, template_sprom, size); -+ sprom_extract(&fallback_sprom.sprom, template_sprom, size); - } - -- memcpy(bcm63xx_sprom.il0mac, data->mac_addr, ETH_ALEN); -- memcpy(bcm63xx_sprom.et0mac, data->mac_addr, ETH_ALEN); -- memcpy(bcm63xx_sprom.et1mac, data->mac_addr, ETH_ALEN); -+ memcpy(fallback_sprom.sprom.il0mac, data->mac_addr, ETH_ALEN); -+ memcpy(fallback_sprom.sprom.et0mac, data->mac_addr, ETH_ALEN); -+ memcpy(fallback_sprom.sprom.et1mac, data->mac_addr, ETH_ALEN); -+ -+ fallback_sprom.pci_bus = data->pci_bus; -+ fallback_sprom.pci_dev = data->pci_dev; - #endif /* defined(CONFIG_SSB_PCIHOST) || defined(CONFIG_BCMA_HOST_PCI) */ - - #if defined(CONFIG_SSB_PCIHOST) ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_fallback_sprom.h -@@ -30,6 +30,9 @@ struct fallback_sprom_data { - u8 mac_addr[ETH_ALEN]; - enum sprom_type type; - -+ u8 pci_bus; -+ u8 pci_dev; -+ - struct sprom_fixup *board_fixups; - unsigned int num_board_fixups; - }; diff --git a/target/linux/bcm63xx/patches-5.15/366-MIPS-BCM63XX-fallback-sprom-override-devid.patch b/target/linux/bcm63xx/patches-5.15/366-MIPS-BCM63XX-fallback-sprom-override-devid.patch deleted file mode 100644 index 31641aeff2646a..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/366-MIPS-BCM63XX-fallback-sprom-override-devid.patch +++ /dev/null @@ -1,78 +0,0 @@ ---- a/arch/mips/bcm63xx/sprom.c -+++ b/arch/mips/bcm63xx/sprom.c -@@ -384,6 +384,7 @@ static __initconst u16 bcm4331_sprom[] = - struct fallback_sprom_match { - u8 pci_bus; - u8 pci_dev; -+ int override_devid; - struct ssb_sprom sprom; - }; - -@@ -399,6 +400,8 @@ int bcm63xx_get_fallback_ssb_sprom(struc - fallback_sprom.pci_bus, fallback_sprom.pci_dev, - bus->host_pci->bus->number, - PCI_SLOT(bus->host_pci->devfn)); -+ if (fallback_sprom.override_devid) -+ bus->host_pci->device = fallback_sprom.sprom.dev_id; - memcpy(out, &fallback_sprom.sprom, sizeof(struct ssb_sprom)); - return 0; - } else { -@@ -418,6 +421,8 @@ int bcm63xx_get_fallback_bcma_sprom(stru - fallback_sprom.pci_bus, fallback_sprom.pci_dev, - bus->host_pci->bus->number, - PCI_SLOT(bus->host_pci->devfn)); -+ if (fallback_sprom.override_devid) -+ bus->host_pci->device = fallback_sprom.sprom.dev_id; - memcpy(out, &fallback_sprom.sprom, sizeof(struct ssb_sprom)); - return 0; - } else { -@@ -965,6 +970,37 @@ static int sprom_extract(struct ssb_spro - return 0; - } - -+int sprom_override_devid(struct fallback_sprom_data *data, -+ struct ssb_sprom *out, const u16 *in) -+{ -+ switch (data->type) { -+#if defined(CONFIG_SSB_PCIHOST) -+ case SPROM_BCM4306: -+ case SPROM_BCM4318: -+ case SPROM_BCM4321: -+ case SPROM_BCM4322: -+ case SPROM_BCM43222: -+ SPEX(dev_id, SSB_SPROM1_PID, 0xFFFF, 0); -+ return !!out->dev_id; -+#endif /* CONFIG_SSB_PCIHOST */ -+#if defined(CONFIG_BCMA_HOST_PCI) -+ case SPROM_BCM4313: -+ case SPROM_BCM43131: -+ case SPROM_BCM43217: -+ case SPROM_BCM43225: -+ case SPROM_BCM43227: -+ case SPROM_BCM43228: -+ case SPROM_BCM4331: -+ SPEX(dev_id, 0x0060, 0xFFFF, 0); -+ return !!out->dev_id; -+#endif /* CONFIG_BCMA_HOST_PCI */ -+ case SPROM_DEFAULT: -+ return 0; -+ } -+ -+ return 0; -+} -+ - void sprom_apply_fixups(u16 *sprom, struct sprom_fixup *fixups, int n) - { - unsigned int i; -@@ -1056,6 +1092,11 @@ int __init bcm63xx_register_fallback_spr - data->num_board_fixups); - - sprom_extract(&fallback_sprom.sprom, template_sprom, size); -+ -+ fallback_sprom.override_devid = -+ sprom_override_devid(data, &fallback_sprom.sprom, template_sprom); -+ } else { -+ fallback_sprom.override_devid = 0; - } - - memcpy(fallback_sprom.sprom.il0mac, data->mac_addr, ETH_ALEN); diff --git a/target/linux/bcm63xx/patches-5.15/367-MIPS-BCM63XX-add-support-for-loading-DTB.patch b/target/linux/bcm63xx/patches-5.15/367-MIPS-BCM63XX-add-support-for-loading-DTB.patch deleted file mode 100644 index 16015a0041aa95..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/367-MIPS-BCM63XX-add-support-for-loading-DTB.patch +++ /dev/null @@ -1,119 +0,0 @@ -From 26546e5499d98616322fb3472b977e2e86603f3a Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Tue, 24 Jun 2014 10:57:51 +0200 -Subject: [PATCH 45/48] MIPS: BCM63XX: add support for loading DTB - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/boards/Kconfig | 4 ++++ - arch/mips/bcm63xx/boards/board_common.c | 34 +++++++++++++++++++++++++++++++ - arch/mips/bcm63xx/prom.c | 6 ++++++ - 3 files changed, 44 insertions(+) - ---- a/arch/mips/bcm63xx/boards/Kconfig -+++ b/arch/mips/bcm63xx/boards/Kconfig -@@ -2,6 +2,10 @@ - menu "Board support" - depends on BCM63XX - -+config BOARD_BCM63XX_DT -+ bool "Device Tree boards (experimential)" -+ select USE_OF -+ - config BOARD_BCM963XX - bool "Generic Broadcom 963xx boards" - select SSB ---- a/arch/mips/bcm63xx/boards/board_common.c -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -10,11 +10,14 @@ - #include - #include - #include -+#include -+#include - #include - #include - #include - #include - #include -+#include - #include - #include - #include -@@ -125,8 +128,23 @@ void __init board_setup(void) - /* make sure we're running on expected cpu */ - if (bcm63xx_get_cpu_id() != board.expected_cpu_id) - panic("unexpected CPU for bcm963xx board"); -+ -+#if CONFIG_OF -+ if (initial_boot_params) -+ __dt_setup_arch(initial_boot_params); -+#endif - } - -+#if CONFIG_OF -+void __init device_tree_init(void) -+{ -+ if (!initial_boot_params) -+ return; -+ -+ unflatten_and_copy_device_tree(); -+} -+#endif -+ - static struct gpio_led_platform_data bcm63xx_led_data; - - static struct platform_device bcm63xx_gpio_leds = { -@@ -135,6 +153,13 @@ static struct platform_device bcm63xx_gp - .dev.platform_data = &bcm63xx_led_data, - }; - -+#if CONFIG_OF -+static struct of_device_id of_ids[] = { -+ { /* filled at runtime */ }, -+ { .compatible = "simple-bus" }, -+ { }, -+}; -+#endif - /* - * third stage init callback, register all board devices. - */ -@@ -142,6 +167,15 @@ int __init board_register_devices(void) - { - int usbh_ports = 0; - -+#if CONFIG_OF -+ if (of_have_populated_dt()) { -+ snprintf(of_ids[0].compatible, sizeof(of_ids[0].compatible), -+ "brcm,bcm%x", bcm63xx_get_cpu_id()); -+ -+ of_platform_populate(NULL, of_ids, NULL, NULL); -+ } -+#endif -+ - if (board.has_uart0) - bcm63xx_uart_register(0); - ---- a/arch/mips/bcm63xx/prom.c -+++ b/arch/mips/bcm63xx/prom.c -@@ -8,6 +8,7 @@ - - #include - #include -+#include - #include - #include - #include -@@ -22,6 +23,12 @@ - void __init prom_init(void) - { - u32 reg, mask; -+ void *fdt = get_fdt(); -+ -+#if CONFIG_OF -+ if (fdt) -+ early_init_dt_verify(fdt); -+#endif - - bcm63xx_cpu_init(); - diff --git a/target/linux/bcm63xx/patches-5.15/368-MIPS-BCM63XX-add-support-for-matching-the-board_info.patch b/target/linux/bcm63xx/patches-5.15/368-MIPS-BCM63XX-add-support-for-matching-the-board_info.patch deleted file mode 100644 index 947a92d71ba507..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/368-MIPS-BCM63XX-add-support-for-matching-the-board_info.patch +++ /dev/null @@ -1,95 +0,0 @@ -From 25bf2b5836c892f091651d8a3384c9c57ce1b400 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Thu, 26 Jun 2014 12:51:00 +0200 -Subject: [PATCH 46/48] MIPS: BCM63XX: add support for matching the board_info - by dtb - -Allow using the passed dtb's compatible property to match board_info -structs instead of nvram's boardname field, which is not unique anyway. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/boards/board_bcm963xx.c | 15 +++++++++++++++ - arch/mips/bcm63xx/boards/board_common.c | 18 ++++++++++++++++++ - arch/mips/bcm63xx/boards/board_common.h | 3 +++ - 3 files changed, 36 insertions(+) - ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -679,6 +679,10 @@ static const struct board_info __initcon - #endif /* CONFIG_BCM63XX_CPU_6358 */ - }; - -+static struct of_device_id const bcm963xx_boards_dt[] = { -+ { }, -+}; -+ - /* - * early init callback, read nvram data from flash and checksum it - */ -@@ -690,6 +694,7 @@ void __init board_bcm963xx_init(void) - char *board_name = NULL; - u32 val; - struct bcm_hcs *hcs; -+ const struct of_device_id *board_match; - - /* read base address of boot chip select (0) - * 6328/6362 do not have MPI but boot from a fixed address -@@ -733,6 +738,16 @@ void __init board_bcm963xx_init(void) - } else { - board_name = bcm63xx_nvram_get_name(); - } -+ -+ /* find board by compat */ -+ board_match = bcm63xx_match_board(bcm963xx_boards_dt); -+ if (board_match) { -+ board_early_setup(board_match->data, -+ bcm63xx_nvram_get_mac_address); -+ -+ return; -+ } -+ - /* find board by name */ - for (i = 0; i < ARRAY_SIZE(bcm963xx_boards); i++) { - if (strncmp(board_name, bcm963xx_boards[i]->name, 16)) ---- a/arch/mips/bcm63xx/boards/board_common.c -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -239,3 +239,21 @@ int __init board_register_devices(void) - - return 0; - } -+ -+const struct of_device_id * __init bcm63xx_match_board(const struct of_device_id *m) -+{ -+ const struct of_device_id *match; -+ unsigned long dt_root; -+ -+ if (!IS_ENABLED(CONFIG_OF) || !initial_boot_params) -+ return NULL; -+ -+ dt_root = of_get_flat_dt_root(); -+ -+ for (match = m; match->compatible[0]; match++) { -+ if (of_flat_dt_is_compatible(dt_root, match->compatible)) -+ return match; -+ } -+ -+ return NULL; -+} ---- a/arch/mips/bcm63xx/boards/board_common.h -+++ b/arch/mips/bcm63xx/boards/board_common.h -@@ -1,11 +1,14 @@ - #ifndef __BOARD_COMMON_H - #define __BOARD_COMMON_H - -+#include - #include - - void board_early_setup(const struct board_info *board, - int (*get_mac_address)(u8 mac[ETH_ALEN])); - -+const struct of_device_id *bcm63xx_match_board(const struct of_device_id *); -+ - #if defined(CONFIG_BOARD_BCM963XX) - void board_bcm963xx_init(void); - #else diff --git a/target/linux/bcm63xx/patches-5.15/371_add_of_node_available_by_alias.patch b/target/linux/bcm63xx/patches-5.15/371_add_of_node_available_by_alias.patch deleted file mode 100644 index 026eff3135695d..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/371_add_of_node_available_by_alias.patch +++ /dev/null @@ -1,37 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_common.c -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -143,6 +143,18 @@ void __init device_tree_init(void) - - unflatten_and_copy_device_tree(); - } -+ -+int board_of_device_present(const char *alias) -+{ -+ bool present; -+ struct device_node *np; -+ -+ np = of_find_node_by_path(alias); -+ present = of_device_is_available(np); -+ of_node_put(np); -+ -+ return present; -+} - #endif - - static struct gpio_led_platform_data bcm63xx_led_data; ---- a/arch/mips/bcm63xx/boards/board_common.h -+++ b/arch/mips/bcm63xx/boards/board_common.h -@@ -15,4 +15,13 @@ void board_bcm963xx_init(void); - static inline void board_bcm963xx_init(void) { } - #endif - -+#if defined(CONFIG_OF) -+int board_of_device_present(const char *alias); -+#else -+static inline void board_of_device_present(const char *alias) -+{ -+ return 0; -+} -+#endif -+ - #endif /* __BOARD_COMMON_H */ diff --git a/target/linux/bcm63xx/patches-5.15/372_dont_register_pflash_when_available_in_dtb.patch b/target/linux/bcm63xx/patches-5.15/372_dont_register_pflash_when_available_in_dtb.patch deleted file mode 100644 index af0800f5aa1aeb..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/372_dont_register_pflash_when_available_in_dtb.patch +++ /dev/null @@ -1,21 +0,0 @@ ---- a/arch/mips/bcm63xx/dev-flash.c -+++ b/arch/mips/bcm63xx/dev-flash.c -@@ -23,6 +23,8 @@ - #include - #include - -+#include "boards/board_common.h" -+ - static int flash_type; - - static struct mtd_partition mtd_partitions[] = { -@@ -179,6 +181,9 @@ int __init bcm63xx_flash_register(void) - - switch (flash_type) { - case BCM63XX_FLASH_TYPE_PARALLEL: -+ /* don't register when already registered through from dtb */ -+ if (board_of_device_present("pflash")) -+ return 0; - - if (!mtd_resources[0].start) { - /* read base address of boot chip select (0) */ diff --git a/target/linux/bcm63xx/patches-5.15/373-MIPS-BCM63XX-register-interrupt-controllers-through-.patch b/target/linux/bcm63xx/patches-5.15/373-MIPS-BCM63XX-register-interrupt-controllers-through-.patch deleted file mode 100644 index c5041a923e652d..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/373-MIPS-BCM63XX-register-interrupt-controllers-through-.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 8a0803979163c647736cb234ee1620c049c4915c Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Mon, 1 Dec 2014 00:20:07 +0100 -Subject: [PATCH 5/5] MIPS: BCM63XX: register interrupt controllers through DT - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/irq.c | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - ---- a/arch/mips/bcm63xx/irq.c -+++ b/arch/mips/bcm63xx/irq.c -@@ -14,6 +14,8 @@ - #include - #include - #include -+#include -+#include - #include - #include - #include -@@ -21,6 +23,9 @@ - #include - #include - -+IRQCHIP_DECLARE(mips_cpu_intc, "mti,cpu-interrupt-controller", -+ mips_cpu_irq_of_init); -+ - void __init arch_init_irq(void) - { - void __iomem *periph_bases[2]; -@@ -29,6 +34,13 @@ void __init arch_init_irq(void) - int periph_irqs[2] = { 2, 3 }; - int ext_irqs[6]; - -+#ifdef CONFIG_OF -+ if (initial_boot_params) { -+ irqchip_init(); -+ return; -+ } -+#endif -+ - periph_bases[0] = (void __iomem *)bcm63xx_regset_address(RSET_PERF); - periph_bases[1] = (void __iomem *)bcm63xx_regset_address(RSET_PERF); - ext_intc_bases[0] = (void __iomem *)bcm63xx_regset_address(RSET_PERF); diff --git a/target/linux/bcm63xx/patches-5.15/374-gpio-add-a-simple-GPIO-driver-for-bcm63xx.patch b/target/linux/bcm63xx/patches-5.15/374-gpio-add-a-simple-GPIO-driver-for-bcm63xx.patch deleted file mode 100644 index 77ed455b99b1d5..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/374-gpio-add-a-simple-GPIO-driver-for-bcm63xx.patch +++ /dev/null @@ -1,178 +0,0 @@ -From dbe94a8daaa63ef81b7414f2a17bca8e36dd6daa Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Fri, 20 Feb 2015 19:55:32 +0100 -Subject: [PATCH 1/6] gpio: add a simple GPIO driver for bcm63xx - - -Signed-off-by: Jonas Gorski ---- - drivers/gpio/Kconfig | 8 +++ - drivers/gpio/Makefile | 1 + - drivers/gpio/gpio-bcm63xx.c | 135 +++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 131 insertions(+) - create mode 100644 drivers/gpio/gpio-bcm63xx.c - ---- a/drivers/gpio/Kconfig -+++ b/drivers/gpio/Kconfig -@@ -194,6 +194,13 @@ config GPIO_BCM_XGS_IPROC - help - Say yes here to enable GPIO support for Broadcom XGS iProc SoCs. - -+config GPIO_BCM63XX -+ bool "Broadcom BCM63XX GPIO" -+ depends on MIPS || COMPILE_TEST -+ select GPIO_GENERIC -+ help -+ Turn on GPIO support for Broadcom BCM63XX xDSL chips. -+ - config GPIO_BRCMSTB - tristate "BRCMSTB GPIO support" - default y if (ARCH_BRCMSTB || BMIPS_GENERIC) ---- a/drivers/gpio/Makefile -+++ b/drivers/gpio/Makefile -@@ -38,6 +38,7 @@ obj-$(CONFIG_GPIO_ASPEED_SGPIO) += gpio - obj-$(CONFIG_GPIO_ATH79) += gpio-ath79.o - obj-$(CONFIG_GPIO_BCM_KONA) += gpio-bcm-kona.o - obj-$(CONFIG_GPIO_BCM_XGS_IPROC) += gpio-xgs-iproc.o -+obj-$(CONFIG_GPIO_BCM63XX) += gpio-bcm63xx.o - obj-$(CONFIG_GPIO_BD70528) += gpio-bd70528.o - obj-$(CONFIG_GPIO_BD71815) += gpio-bd71815.o - obj-$(CONFIG_GPIO_BD71828) += gpio-bd71828.o ---- /dev/null -+++ b/drivers/gpio/gpio-bcm63xx.c -@@ -0,0 +1,135 @@ -+/* -+ * Driver for BCM63XX memory-mapped GPIO controllers, based on -+ * Generic driver for memory-mapped GPIO controllers. -+ * -+ * Copyright 2008 MontaVista Software, Inc. -+ * Copyright 2008,2010 Anton Vorontsov -+ * Copyright 2015 Jonas Gorski -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License as published by the -+ * Free Software Foundation; either version 2 of the License, or (at your -+ * option) any later version. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+static int bcm63xx_gpio_to_irq(struct gpio_chip *chip, unsigned gpio) -+{ -+ char irq_name[7]; /* "gpioXX" */ -+ -+ sprintf(irq_name, "gpio%d", gpio); -+ return of_irq_get_byname(chip->of_node, irq_name); -+} -+ -+static int bcm63xx_gpio_probe(struct platform_device *pdev) -+{ -+ struct device *dev = &pdev->dev; -+ struct resource *dat_r, *dirout_r; -+ void __iomem *dat; -+ void __iomem *dirout; -+ unsigned long sz; -+ int err; -+ struct gpio_chip *gc; -+ struct bgpio_pdata *pdata = dev_get_platdata(dev); -+ -+ dirout_r = platform_get_resource(pdev, IORESOURCE_MEM, 0); -+ dat_r = platform_get_resource(pdev, IORESOURCE_MEM, 1); -+ if (!dat_r || !dirout_r) -+ return -EINVAL; -+ -+ if (resource_size(dat_r) != resource_size(dirout_r)) -+ return -EINVAL; -+ -+ sz = resource_size(dat_r); -+ -+ dat = devm_ioremap_resource(dev, dat_r); -+ if (IS_ERR(dat)) -+ return PTR_ERR(dat); -+ -+ dirout = devm_ioremap_resource(dev, dirout_r); -+ if (IS_ERR(dirout)) -+ return PTR_ERR(dirout); -+ -+ gc = devm_kzalloc(&pdev->dev, sizeof(*gc), GFP_KERNEL); -+ if (!gc) -+ return -ENOMEM; -+ -+ err = bgpio_init(gc, dev, sz, dat, NULL, NULL, dirout, NULL, -+ BGPIOF_BIG_ENDIAN_BYTE_ORDER); -+ if (err) -+ return err; -+ -+ platform_set_drvdata(pdev, gc); -+ -+ if (dev->of_node) { -+ int id = of_alias_get_id(dev->of_node, "gpio"); -+ u32 ngpios; -+ -+ if (id >= 0) -+ gc->label = devm_kasprintf(dev, GFP_KERNEL, -+ "bcm63xx-gpio.%d", id); -+ -+ if (!of_property_read_u32(dev->of_node, "ngpios", &ngpios)) -+ gc->ngpio = ngpios; -+ -+ if (of_get_property(dev->of_node, "interrupt-names", NULL)) -+ gc->to_irq = bcm63xx_gpio_to_irq; -+ -+ } else if (pdata) { -+ gc->base = pdata->base; -+ if (pdata->ngpio > 0) -+ gc->ngpio = pdata->ngpio; -+ } -+ -+ return gpiochip_add(gc); -+} -+ -+static int bcm63xx_gpio_remove(struct platform_device *pdev) -+{ -+ struct gpio_chip *gc = platform_get_drvdata(pdev); -+ -+ gpiochip_remove(gc); -+ return 0; -+} -+ -+#ifdef CONFIG_OF -+static struct of_device_id bcm63xx_gpio_of_match[] = { -+ { .compatible = "brcm,bcm6345-gpio" }, -+ { }, -+}; -+#endif -+ -+static struct platform_driver bcm63xx_gpio_driver = { -+ .probe = bcm63xx_gpio_probe, -+ .remove = bcm63xx_gpio_remove, -+ .driver = { -+ .name = "bcm63xx-gpio", -+ .of_match_table = of_match_ptr(bcm63xx_gpio_of_match), -+ }, -+}; -+ -+module_platform_driver(bcm63xx_gpio_driver); -+ -+MODULE_DESCRIPTION("Driver for BCM63XX memory-mapped GPIO controllers"); -+MODULE_AUTHOR("Jonas Gorski "); -+MODULE_LICENSE("GPL"); diff --git a/target/linux/bcm63xx/patches-5.15/375-MIPS-BCM63XX-switch-to-new-gpio-driver.patch b/target/linux/bcm63xx/patches-5.15/375-MIPS-BCM63XX-switch-to-new-gpio-driver.patch deleted file mode 100644 index 9c7bf2ed58480a..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/375-MIPS-BCM63XX-switch-to-new-gpio-driver.patch +++ /dev/null @@ -1,212 +0,0 @@ -From 302f69453721e5ee19f583339a3a646821d4a173 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Fri, 20 Feb 2015 23:58:54 +0100 -Subject: [PATCH 2/6] MIPS: BCM63XX: switch to new gpio driver - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/boards/board_common.c | 2 + - arch/mips/bcm63xx/gpio.c | 145 ++++++++++------------------------------------ - arch/mips/bcm63xx/setup.c | 3 - - 3 files changed, 32 insertions(+), 118 deletions(-) - ---- a/arch/mips/bcm63xx/boards/board_common.c -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -188,6 +188,8 @@ int __init board_register_devices(void) - } - #endif - -+ bcm63xx_gpio_init(); -+ - if (board.has_uart0) - bcm63xx_uart_register(0); - ---- a/arch/mips/bcm63xx/gpio.c -+++ b/arch/mips/bcm63xx/gpio.c -@@ -5,144 +5,62 @@ - * - * Copyright (C) 2008 Maxime Bizon - * Copyright (C) 2008-2011 Florian Fainelli -+ * Copyright (C) Jonas Gorski - */ - - #include - #include --#include - #include - #include - - #include - #include --#include - #include - --static u32 gpio_out_low_reg; -- --static void bcm63xx_gpio_out_low_reg_init(void) -+static void __init bcm63xx_gpio_init_one(int id, int dir, int data, int ngpio) - { -- switch (bcm63xx_get_cpu_id()) { -- case BCM6345_CPU_ID: -- gpio_out_low_reg = GPIO_DATA_LO_REG_6345; -- break; -- default: -- gpio_out_low_reg = GPIO_DATA_LO_REG; -- break; -- } --} -- --static DEFINE_SPINLOCK(bcm63xx_gpio_lock); --static u32 gpio_out_low, gpio_out_high; -+ struct resource res[2]; -+ struct bgpio_pdata pdata; - --static void bcm63xx_gpio_set(struct gpio_chip *chip, -- unsigned gpio, int val) --{ -- u32 reg; -- u32 mask; -- u32 *v; -- unsigned long flags; -- -- BUG_ON(gpio >= chip->ngpio); -- -- if (gpio < 32) { -- reg = gpio_out_low_reg; -- mask = 1 << gpio; -- v = &gpio_out_low; -- } else { -- reg = GPIO_DATA_HI_REG; -- mask = 1 << (gpio - 32); -- v = &gpio_out_high; -- } -- -- spin_lock_irqsave(&bcm63xx_gpio_lock, flags); -- if (val) -- *v |= mask; -- else -- *v &= ~mask; -- bcm_gpio_writel(*v, reg); -- spin_unlock_irqrestore(&bcm63xx_gpio_lock, flags); --} -+ memset(res, 0, sizeof(res)); -+ memset(&pdata, 0, sizeof(pdata)); - --static int bcm63xx_gpio_get(struct gpio_chip *chip, unsigned gpio) --{ -- u32 reg; -- u32 mask; -+ res[0].flags = IORESOURCE_MEM; -+ res[0].start = bcm63xx_regset_address(RSET_GPIO); -+ res[0].start += dir; - -- BUG_ON(gpio >= chip->ngpio); -+ res[0].end = res[0].start + 3; - -- if (gpio < 32) { -- reg = gpio_out_low_reg; -- mask = 1 << gpio; -- } else { -- reg = GPIO_DATA_HI_REG; -- mask = 1 << (gpio - 32); -- } -+ res[1].flags = IORESOURCE_MEM; -+ res[1].start = bcm63xx_regset_address(RSET_GPIO); -+ res[1].start += data; - -- return !!(bcm_gpio_readl(reg) & mask); --} -+ res[1].end = res[1].start + 3; - --static int bcm63xx_gpio_set_direction(struct gpio_chip *chip, -- unsigned gpio, int dir) --{ -- u32 reg; -- u32 mask; -- u32 tmp; -- unsigned long flags; -- -- BUG_ON(gpio >= chip->ngpio); -- -- if (gpio < 32) { -- reg = GPIO_CTL_LO_REG; -- mask = 1 << gpio; -- } else { -- reg = GPIO_CTL_HI_REG; -- mask = 1 << (gpio - 32); -- } -- -- spin_lock_irqsave(&bcm63xx_gpio_lock, flags); -- tmp = bcm_gpio_readl(reg); -- if (dir == BCM63XX_GPIO_DIR_IN) -- tmp &= ~mask; -- else -- tmp |= mask; -- bcm_gpio_writel(tmp, reg); -- spin_unlock_irqrestore(&bcm63xx_gpio_lock, flags); -+ pdata.base = id * 32; -+ pdata.ngpio = ngpio; - -- return 0; -+ platform_device_register_resndata(NULL, "bcm63xx-gpio", id, res, 2, -+ &pdata, sizeof(pdata)); - } - --static int bcm63xx_gpio_direction_input(struct gpio_chip *chip, unsigned gpio) -+int __init bcm63xx_gpio_init(void) - { -- return bcm63xx_gpio_set_direction(chip, gpio, BCM63XX_GPIO_DIR_IN); --} -+ int ngpio = bcm63xx_gpio_count(); -+ int data_low_reg; - --static int bcm63xx_gpio_direction_output(struct gpio_chip *chip, -- unsigned gpio, int value) --{ -- bcm63xx_gpio_set(chip, gpio, value); -- return bcm63xx_gpio_set_direction(chip, gpio, BCM63XX_GPIO_DIR_OUT); --} -+ if (BCMCPU_IS_6345()) -+ data_low_reg = GPIO_DATA_LO_REG_6345; -+ else -+ data_low_reg = GPIO_DATA_LO_REG; - -+ bcm63xx_gpio_init_one(0, GPIO_CTL_LO_REG, data_low_reg, min(ngpio, 32)); - --static struct gpio_chip bcm63xx_gpio_chip = { -- .label = "bcm63xx-gpio", -- .direction_input = bcm63xx_gpio_direction_input, -- .direction_output = bcm63xx_gpio_direction_output, -- .get = bcm63xx_gpio_get, -- .set = bcm63xx_gpio_set, -- .base = 0, --}; -+ if (ngpio <= 32) -+ return 0; - --int __init bcm63xx_gpio_init(void) --{ -- bcm63xx_gpio_out_low_reg_init(); -+ bcm63xx_gpio_init_one(1, GPIO_CTL_HI_REG, GPIO_DATA_HI_REG, ngpio - 32); - -- gpio_out_low = bcm_gpio_readl(gpio_out_low_reg); -- if (!BCMCPU_IS_6345()) -- gpio_out_high = bcm_gpio_readl(GPIO_DATA_HI_REG); -- bcm63xx_gpio_chip.ngpio = bcm63xx_gpio_count(); -- pr_info("registering %d GPIOs\n", bcm63xx_gpio_chip.ngpio); -+ return 0; - -- return gpiochip_add_data(&bcm63xx_gpio_chip, NULL); - } ---- a/arch/mips/bcm63xx/setup.c -+++ b/arch/mips/bcm63xx/setup.c -@@ -164,9 +164,6 @@ void __init plat_mem_setup(void) - - int __init bcm63xx_register_devices(void) - { -- /* register gpiochip */ -- bcm63xx_gpio_init(); -- - return board_register_devices(); - } - diff --git a/target/linux/bcm63xx/patches-5.15/377-MIPS-BCM63XX-register-lookup-for-ephy-reset-gpio.patch b/target/linux/bcm63xx/patches-5.15/377-MIPS-BCM63XX-register-lookup-for-ephy-reset-gpio.patch deleted file mode 100644 index c66a3aa09bedb8..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/377-MIPS-BCM63XX-register-lookup-for-ephy-reset-gpio.patch +++ /dev/null @@ -1,129 +0,0 @@ -From d13bdf92ec885105cf107183f8464c40e5f3b93b Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sat, 21 Feb 2015 17:21:59 +0100 -Subject: [PATCH 4/6] MIPS: BCM63XX: register lookup for ephy-reset gpio - - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/boards/board_bcm963xx.c | 2 +- - arch/mips/bcm63xx/boards/board_common.c | 7 +++-- - arch/mips/bcm63xx/gpio.c | 32 ++++++++++++++++++++ - arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h | 2 ++ - .../mips/include/asm/mach-bcm63xx/board_bcm963xx.h | 5 +-- - 5 files changed, 42 insertions(+), 6 deletions(-) - ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -32,7 +32,7 @@ static struct board_info __initdata boar - .expected_cpu_id = 0x3368, - - .ephy_reset_gpio = 36, -- .ephy_reset_gpio_flags = GPIOF_INIT_HIGH, -+ .ephy_reset_gpio_flags = GPIO_ACTIVE_LOW, - .has_pci = 1, - .has_uart0 = 1, - .has_uart1 = 1, ---- a/arch/mips/bcm63xx/boards/board_common.c -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -247,9 +247,10 @@ int __init board_register_devices(void) - - platform_device_register(&bcm63xx_gpio_leds); - -- if (board.ephy_reset_gpio && board.ephy_reset_gpio_flags) -- gpio_request_one(board.ephy_reset_gpio, -- board.ephy_reset_gpio_flags, "ephy-reset"); -+ if (board.ephy_reset_gpio && board.ephy_reset_gpio_flags) { -+ bcm63xx_gpio_ephy_reset(board.ephy_reset_gpio, -+ board.ephy_reset_gpio_flags); -+ } - - return 0; - } ---- a/arch/mips/bcm63xx/gpio.c -+++ b/arch/mips/bcm63xx/gpio.c -@@ -8,15 +8,23 @@ - * Copyright (C) Jonas Gorski - */ - -+#include -+ - #include - #include - #include - #include -+#include - - #include - #include - #include - -+static const char * const gpio_chip_labels[] = { -+ "bcm63xx-gpio.0", -+ "bcm63xx-gpio.1", -+}; -+ - static void __init bcm63xx_gpio_init_one(int id, int dir, int data, int ngpio) - { - struct resource res[2]; -@@ -64,3 +72,25 @@ int __init bcm63xx_gpio_init(void) - return 0; - - } -+ -+static struct gpiod_lookup_table ephy_reset = { -+ .dev_id = "bcm63xx_enet-0", -+ .table = { -+ { /* filled at runtime */ }, -+ { }, -+ }, -+}; -+ -+ -+void bcm63xx_gpio_ephy_reset(int hw_gpio, enum gpio_lookup_flags flags) -+{ -+ if (ephy_reset.table[0].key) -+ return; -+ -+ ephy_reset.table[0].key = gpio_chip_labels[hw_gpio / 32]; -+ ephy_reset.table[0].chip_hwnum = hw_gpio % 32; -+ ephy_reset.table[0].con_id = "reset"; -+ ephy_reset.table[0].flags = flags; -+ -+ gpiod_add_lookup_table(&ephy_reset); -+} ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_gpio.h -@@ -3,9 +3,11 @@ - #define BCM63XX_GPIO_H - - #include -+#include - #include - - int __init bcm63xx_gpio_init(void); -+void bcm63xx_gpio_ephy_reset(int hw_gpio, enum gpio_lookup_flags flags); - - static inline unsigned long bcm63xx_gpio_count(void) - { ---- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h -+++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h -@@ -4,6 +4,7 @@ - - #include - #include -+#include - #include - #include - #include -@@ -50,8 +51,8 @@ struct board_info { - /* External PHY reset GPIO */ - unsigned int ephy_reset_gpio; - -- /* External PHY reset GPIO flags from gpio.h */ -- unsigned long ephy_reset_gpio_flags; -+ /* External PHY reset GPIO flags from gpio/machine.h */ -+ enum gpio_lookup_flags ephy_reset_gpio_flags; - - /* fallback sprom config */ - struct fallback_sprom_data fallback_sprom; diff --git a/target/linux/bcm63xx/patches-5.15/378-MIPS-BCM63XX-do-not-register-gpio-controller-if-pres.patch b/target/linux/bcm63xx/patches-5.15/378-MIPS-BCM63XX-do-not-register-gpio-controller-if-pres.patch deleted file mode 100644 index 6eb1bd02849c35..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/378-MIPS-BCM63XX-do-not-register-gpio-controller-if-pres.patch +++ /dev/null @@ -1,35 +0,0 @@ -From e55892aac9d5508a000647ca66f0e678e02be3bb Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sat, 21 Feb 2015 17:26:50 +0100 -Subject: [PATCH 5/6] MIPS: BCM63XX: do not register gpio-controller if -present in dtb - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/gpio.c | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - ---- a/arch/mips/bcm63xx/gpio.c -+++ b/arch/mips/bcm63xx/gpio.c -@@ -20,6 +20,8 @@ - #include - #include - -+#include "boards/board_common.h" -+ - static const char * const gpio_chip_labels[] = { - "bcm63xx-gpio.0", - "bcm63xx-gpio.1", -@@ -48,8 +50,10 @@ static void __init bcm63xx_gpio_init_one - pdata.base = id * 32; - pdata.ngpio = ngpio; - -- platform_device_register_resndata(NULL, "bcm63xx-gpio", id, res, 2, -- &pdata, sizeof(pdata)); -+ if (!board_of_device_present("gpio0") && -+ !board_of_device_present("pinctrl")) -+ platform_device_register_resndata(NULL, "bcm63xx-gpio", id, res, -+ 2, &pdata, sizeof(pdata)); - } - - int __init bcm63xx_gpio_init(void) diff --git a/target/linux/bcm63xx/patches-5.15/379-MIPS-BCM63XX-provide-a-gpio-lookup-for-the-pcmcia-re.patch b/target/linux/bcm63xx/patches-5.15/379-MIPS-BCM63XX-provide-a-gpio-lookup-for-the-pcmcia-re.patch deleted file mode 100644 index b5719990bda1d5..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/379-MIPS-BCM63XX-provide-a-gpio-lookup-for-the-pcmcia-re.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 1647cccc871bf43876c3df9852869680880d054c Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Wed, 25 Mar 2015 13:52:02 +0100 -Subject: [PATCH 1/2] MIPS: BCM63XX: provide a gpio lookup for the pcmcia - ready gpio - -To prepare for a time when gpiobases don't need to be fixed anymore. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/dev-pcmcia.c | 13 +++++++++++++ - 1 file changed, 13 insertions(+) - ---- a/arch/mips/bcm63xx/dev-pcmcia.c -+++ b/arch/mips/bcm63xx/dev-pcmcia.c -@@ -10,6 +10,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -101,6 +102,14 @@ static const struct { - }, - }; - -+static struct gpiod_lookup_table pcmcia_gpios_table = { -+ .dev_id = "bcm63xx_pcmcia.0", -+ .table = { -+ GPIO_LOOKUP("bcm63xx-gpio.0", 0, "ready", GPIO_ACTIVE_HIGH), -+ { }, -+ }, -+}; -+ - int __init bcm63xx_pcmcia_register(void) - { - int ret, i; -@@ -112,16 +121,20 @@ int __init bcm63xx_pcmcia_register(void) - switch (bcm63xx_get_cpu_id()) { - case BCM6348_CPU_ID: - pd.ready_gpio = 22; -+ pcmcia_gpios_table.table[0].chip_hwnum = 22; - break; - - case BCM6358_CPU_ID: - pd.ready_gpio = 18; -+ pcmcia_gpios_table.table[0].chip_hwnum = 18; - break; - - default: - return -ENODEV; - } - -+ gpiod_add_lookup_table(&pcmcia_gpios_table); -+ - pcmcia_resources[0].start = bcm63xx_regset_address(RSET_PCMCIA); - pcmcia_resources[0].end = pcmcia_resources[0].start + - RSET_PCMCIA_SIZE - 1; diff --git a/target/linux/bcm63xx/patches-5.15/380-pcmcia-bcm63xx_pmcia-use-the-new-named-gpio.patch b/target/linux/bcm63xx/patches-5.15/380-pcmcia-bcm63xx_pmcia-use-the-new-named-gpio.patch deleted file mode 100644 index 253417153c173a..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/380-pcmcia-bcm63xx_pmcia-use-the-new-named-gpio.patch +++ /dev/null @@ -1,59 +0,0 @@ -From c4e04f1c54928a49b227a5420d38b18226838775 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Wed, 25 Mar 2015 13:54:56 +0100 -Subject: [PATCH 2/2] pcmcia: bcm63xx_pmcia: use the new named gpio - -Use the new named gpio instead of relying on the hardware gpio numbers -matching the virtual gpio numbers. - -Signed-off-by: Jonas Gorski ---- - drivers/pcmcia/bcm63xx_pcmcia.c | 9 ++++++++- - drivers/pcmcia/bcm63xx_pcmcia.h | 4 ++++ - 2 files changed, 12 insertions(+), 1 deletion(-) - ---- a/drivers/pcmcia/bcm63xx_pcmcia.c -+++ b/drivers/pcmcia/bcm63xx_pcmcia.c -@@ -237,7 +237,7 @@ static unsigned int __get_socket_status( - stat |= SS_XVCARD; - stat |= SS_POWERON; - -- if (gpio_get_value(skt->pd->ready_gpio)) -+ if (gpiod_get_value(skt->ready_gpio)) - stat |= SS_READY; - - return stat; -@@ -373,6 +373,13 @@ static int bcm63xx_drv_pcmcia_probe(stru - goto err; - } - -+ /* get ready gpio */ -+ skt->ready_gpio = devm_gpiod_get(&pdev->dev, "ready", GPIOD_IN); -+ if (IS_ERR(skt->ready_gpio)) { -+ ret = PTR_ERR(skt->ready_gpio); -+ goto err; -+ } -+ - /* resources are static */ - sock->resource_ops = &pccard_static_ops; - sock->ops = &bcm63xx_pcmcia_operations; ---- a/drivers/pcmcia/bcm63xx_pcmcia.h -+++ b/drivers/pcmcia/bcm63xx_pcmcia.h -@@ -4,6 +4,7 @@ - - #include - #include -+#include - #include - #include - -@@ -56,6 +57,9 @@ struct bcm63xx_pcmcia_socket { - - /* base address of io memory */ - void __iomem *io_base; -+ -+ /* ready gpio */ -+ struct gpio_desc *ready_gpio; - }; - - #endif /* BCM63XX_PCMCIA_H_ */ diff --git a/target/linux/bcm63xx/patches-5.15/381-Documentation-add-BCM6318-pincontroller-binding-docu.patch b/target/linux/bcm63xx/patches-5.15/381-Documentation-add-BCM6318-pincontroller-binding-docu.patch deleted file mode 100644 index 5d4265f7feb515..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/381-Documentation-add-BCM6318-pincontroller-binding-docu.patch +++ /dev/null @@ -1,96 +0,0 @@ -From 8439e5d2e69f54a532bb5f8ec001b4b5a3035574 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Wed, 27 Jul 2016 11:38:05 +0200 -Subject: [PATCH 14/16] Documentation: add BCM6318 pincontroller binding - documentation - -Add binding documentation for the pincontrol core found in BCM6318 SoCs. - -Signed-off-by: Jonas Gorski ---- - .../bindings/pinctrl/brcm,bcm6318-pinctrl.txt | 79 ++++++++++++++++++++++ - 1 file changed, 79 insertions(+) - create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6318-pinctrl.txt - ---- /dev/null -+++ b/Documentation/devicetree/bindings/pinctrl/brcm,bcm6318-pinctrl.txt -@@ -0,0 +1,79 @@ -+* Broadcom BCM6318 pin controller -+ -+Required properties: -+- compatible: Must be "brcm,bcm6318-pinctrl". -+- regs: Register specifiers of dirout, dat, mode, mux, and pad registers. -+- reg-names: Must be "dirout", "dat", "mode", "mux", "pad". -+- gpio-controller: Identifies this node as a gpio controller. -+- #gpio-cells: Must be <2>. -+ -+Example: -+ -+pinctrl: pin-controller@10000080 { -+ compatible = "brcm,bcm6318-pinctrl"; -+ reg = <0x10000080 0x08>, -+ <0x10000088 0x08>, -+ <0x10000098 0x04>, -+ <0x1000009c 0x0c>, -+ <0x100000d4 0x18>; -+ reg-names = "dirout", "dat", "mode", "mux", "pad"; -+ -+ gpio-controller; -+ #gpio-cells = <2>; -+}; -+ -+ -+Available pins/groups and functions: -+ -+name pins functions -+----------------------------------------------------------- -+gpio0 0 led, ephy0_spd_led -+gpio1 1 led, ephy1_spd_led -+gpio2 2 led, ephy2_spd_led -+gpio3 3 led, ephy3_spd_led -+gpio4 4 led, ephy0_act_led -+gpio5 5 led, ephy1_act_led -+gpio6 6 led, ephy2_act_led, serial_led_data -+gpio7 7 led, ephy3_act_led, serial_led_clk -+gpio8 8 led, inet_act_led -+gpio9 9 led, inet_fail_led -+gpio10 10 led, dsl_led -+gpio11 11 led, post_fail_led -+gpio12 12 led, wlan_wps_led -+gpio13 13 led, usb_pwron, usb_device_led -+gpio14 14 led -+gpio15 15 led -+gpio16 16 led -+gpio17 17 led -+gpio18 18 led -+gpio19 19 led -+gpio20 20 led -+gpio21 21 led -+gpio22 22 led -+gpio23 23 led -+gpio24 24 - -+gpio25 25 - -+gpio26 26 - -+gpio27 27 - -+gpio28 28 - -+gpio29 29 - -+gpio30 30 - -+gpio31 31 - -+gpio32 32 - -+gpio33 33 - -+gpio34 34 - -+gpio35 35 - -+gpio36 36 - -+gpio37 37 - -+gpio38 38 - -+gpio39 39 - -+gpio40 40 usb_active -+gpio41 41 - -+gpio42 42 - -+gpio43 43 - -+gpio44 44 - -+gpio45 45 - -+gpio46 46 - -+gpio47 47 - -+gpio48 48 - -+gpio49 49 - diff --git a/target/linux/bcm63xx/patches-5.15/382-pinctrl-add-a-pincontrol-driver-for-BCM6318.patch b/target/linux/bcm63xx/patches-5.15/382-pinctrl-add-a-pincontrol-driver-for-BCM6318.patch deleted file mode 100644 index 4ab7df3c828297..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/382-pinctrl-add-a-pincontrol-driver-for-BCM6318.patch +++ /dev/null @@ -1,609 +0,0 @@ -From bd9c250ef85e6f99aa5d59b21abb87d0a48f2f61 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Fri, 24 Jun 2016 22:20:39 +0200 -Subject: [PATCH 15/16] pinctrl: add a pincontrol driver for BCM6318 - -Add a pincontrol driver for BCM6318. BCM6318 allows muxing most GPIOs -to different functions. BCM6318 is similar to BCM6328 with the addition -of a pad register, and the GPIO meaning of the mux register changes -based on the GPIO number. - -Signed-off-by: Jonas Gorski ---- - drivers/pinctrl/bcm63xx/Kconfig | 7 + - drivers/pinctrl/bcm63xx/Makefile | 1 + - drivers/pinctrl/bcm63xx/pinctrl-bcm6318.c | 564 ++++++++++++++++++++++++++++++ - 3 files changed, 572 insertions(+) - create mode 100644 drivers/pinctrl/bcm63xx/pinctrl-bcm6318.c - ---- a/drivers/pinctrl/bcm63xx/Kconfig -+++ b/drivers/pinctrl/bcm63xx/Kconfig -@@ -2,6 +2,13 @@ config PINCTRL_BRCM63XX - bool - select GPIO_GENERIC - -+config PINCTRL_BRCM6318 -+ bool "BCM6318 pincontrol driver" if COMPILE_TEST -+ select PINMUX -+ select PINCONF -+ select PINCTRL_BRCM63XX -+ select GENERIC_PINCONF -+ - config PINCTRL_BRCM6328 - bool "BCM6328 pincontrol driver" if COMPILE_TEST - select PINMUX ---- a/drivers/pinctrl/bcm63xx/Makefile -+++ b/drivers/pinctrl/bcm63xx/Makefile -@@ -1,4 +1,5 @@ - obj-$(CONFIG_PINCTRL_BRCM63XX) += pinctrl-bcm63xx.o -+obj-$(CONFIG_PINCTRL_BRCM6318) += pinctrl-bcm6318.o - obj-$(CONFIG_PINCTRL_BRCM6328) += pinctrl-bcm6328.o - obj-$(CONFIG_PINCTRL_BRCM6348) += pinctrl-bcm6348.o - obj-$(CONFIG_PINCTRL_BRCM6358) += pinctrl-bcm6358.o ---- /dev/null -+++ b/drivers/pinctrl/bcm63xx/pinctrl-bcm6318.c -@@ -0,0 +1,564 @@ -+/* -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file "COPYING" in the main directory of this archive -+ * for more details. -+ * -+ * Copyright (C) 2016 Jonas Gorski -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+ -+#include "../core.h" -+#include "../pinctrl-utils.h" -+ -+#include "pinctrl-bcm63xx.h" -+ -+#define BCM6318_NGPIO 50 -+ -+struct bcm6318_pingroup { -+ const char *name; -+ const unsigned * const pins; -+ const unsigned num_pins; -+}; -+ -+struct bcm6318_function { -+ const char *name; -+ const char * const *groups; -+ const unsigned num_groups; -+ -+ unsigned mode_val:1; -+ unsigned mux_val:2; -+}; -+ -+struct bcm6318_pinctrl { -+ struct pinctrl_dev *pctldev; -+ struct pinctrl_desc desc; -+ -+ void __iomem *mode; -+ void __iomem *mux[3]; -+ void __iomem *pad[6]; -+ -+ /* register access lock */ -+ spinlock_t lock; -+ -+ struct gpio_chip gpio[2]; -+}; -+ -+static const struct pinctrl_pin_desc bcm6318_pins[] = { -+ PINCTRL_PIN(0, "gpio0"), -+ PINCTRL_PIN(1, "gpio1"), -+ PINCTRL_PIN(2, "gpio2"), -+ PINCTRL_PIN(3, "gpio3"), -+ PINCTRL_PIN(4, "gpio4"), -+ PINCTRL_PIN(5, "gpio5"), -+ PINCTRL_PIN(6, "gpio6"), -+ PINCTRL_PIN(7, "gpio7"), -+ PINCTRL_PIN(8, "gpio8"), -+ PINCTRL_PIN(9, "gpio9"), -+ PINCTRL_PIN(10, "gpio10"), -+ PINCTRL_PIN(11, "gpio11"), -+ PINCTRL_PIN(12, "gpio12"), -+ PINCTRL_PIN(13, "gpio13"), -+ PINCTRL_PIN(14, "gpio14"), -+ PINCTRL_PIN(15, "gpio15"), -+ PINCTRL_PIN(16, "gpio16"), -+ PINCTRL_PIN(17, "gpio17"), -+ PINCTRL_PIN(18, "gpio18"), -+ PINCTRL_PIN(19, "gpio19"), -+ PINCTRL_PIN(20, "gpio20"), -+ PINCTRL_PIN(21, "gpio21"), -+ PINCTRL_PIN(22, "gpio22"), -+ PINCTRL_PIN(23, "gpio23"), -+ PINCTRL_PIN(24, "gpio24"), -+ PINCTRL_PIN(25, "gpio25"), -+ PINCTRL_PIN(26, "gpio26"), -+ PINCTRL_PIN(27, "gpio27"), -+ PINCTRL_PIN(28, "gpio28"), -+ PINCTRL_PIN(29, "gpio29"), -+ PINCTRL_PIN(30, "gpio30"), -+ PINCTRL_PIN(31, "gpio31"), -+ PINCTRL_PIN(32, "gpio32"), -+ PINCTRL_PIN(33, "gpio33"), -+ PINCTRL_PIN(34, "gpio34"), -+ PINCTRL_PIN(35, "gpio35"), -+ PINCTRL_PIN(36, "gpio36"), -+ PINCTRL_PIN(37, "gpio37"), -+ PINCTRL_PIN(38, "gpio38"), -+ PINCTRL_PIN(39, "gpio39"), -+ PINCTRL_PIN(40, "gpio40"), -+ PINCTRL_PIN(41, "gpio41"), -+ PINCTRL_PIN(42, "gpio42"), -+ PINCTRL_PIN(43, "gpio43"), -+ PINCTRL_PIN(44, "gpio44"), -+ PINCTRL_PIN(45, "gpio45"), -+ PINCTRL_PIN(46, "gpio46"), -+ PINCTRL_PIN(47, "gpio47"), -+ PINCTRL_PIN(48, "gpio48"), -+ PINCTRL_PIN(49, "gpio49"), -+}; -+ -+static unsigned gpio0_pins[] = { 0 }; -+static unsigned gpio1_pins[] = { 1 }; -+static unsigned gpio2_pins[] = { 2 }; -+static unsigned gpio3_pins[] = { 3 }; -+static unsigned gpio4_pins[] = { 4 }; -+static unsigned gpio5_pins[] = { 5 }; -+static unsigned gpio6_pins[] = { 6 }; -+static unsigned gpio7_pins[] = { 7 }; -+static unsigned gpio8_pins[] = { 8 }; -+static unsigned gpio9_pins[] = { 9 }; -+static unsigned gpio10_pins[] = { 10 }; -+static unsigned gpio11_pins[] = { 11 }; -+static unsigned gpio12_pins[] = { 12 }; -+static unsigned gpio13_pins[] = { 13 }; -+static unsigned gpio14_pins[] = { 14 }; -+static unsigned gpio15_pins[] = { 15 }; -+static unsigned gpio16_pins[] = { 16 }; -+static unsigned gpio17_pins[] = { 17 }; -+static unsigned gpio18_pins[] = { 18 }; -+static unsigned gpio19_pins[] = { 19 }; -+static unsigned gpio20_pins[] = { 20 }; -+static unsigned gpio21_pins[] = { 21 }; -+static unsigned gpio22_pins[] = { 22 }; -+static unsigned gpio23_pins[] = { 23 }; -+static unsigned gpio24_pins[] = { 24 }; -+static unsigned gpio25_pins[] = { 25 }; -+static unsigned gpio26_pins[] = { 26 }; -+static unsigned gpio27_pins[] = { 27 }; -+static unsigned gpio28_pins[] = { 28 }; -+static unsigned gpio29_pins[] = { 29 }; -+static unsigned gpio30_pins[] = { 30 }; -+static unsigned gpio31_pins[] = { 31 }; -+static unsigned gpio32_pins[] = { 32 }; -+static unsigned gpio33_pins[] = { 33 }; -+static unsigned gpio34_pins[] = { 34 }; -+static unsigned gpio35_pins[] = { 35 }; -+static unsigned gpio36_pins[] = { 36 }; -+static unsigned gpio37_pins[] = { 37 }; -+static unsigned gpio38_pins[] = { 38 }; -+static unsigned gpio39_pins[] = { 39 }; -+static unsigned gpio40_pins[] = { 40 }; -+static unsigned gpio41_pins[] = { 41 }; -+static unsigned gpio42_pins[] = { 42 }; -+static unsigned gpio43_pins[] = { 43 }; -+static unsigned gpio44_pins[] = { 44 }; -+static unsigned gpio45_pins[] = { 45 }; -+static unsigned gpio46_pins[] = { 46 }; -+static unsigned gpio47_pins[] = { 47 }; -+static unsigned gpio48_pins[] = { 48 }; -+static unsigned gpio49_pins[] = { 49 }; -+ -+#define BCM6318_GROUP(n) \ -+ { \ -+ .name = #n, \ -+ .pins = n##_pins, \ -+ .num_pins = ARRAY_SIZE(n##_pins), \ -+ } -+ -+static struct bcm6318_pingroup bcm6318_groups[] = { -+ BCM6318_GROUP(gpio0), -+ BCM6318_GROUP(gpio1), -+ BCM6318_GROUP(gpio2), -+ BCM6318_GROUP(gpio3), -+ BCM6318_GROUP(gpio4), -+ BCM6318_GROUP(gpio5), -+ BCM6318_GROUP(gpio6), -+ BCM6318_GROUP(gpio7), -+ BCM6318_GROUP(gpio8), -+ BCM6318_GROUP(gpio9), -+ BCM6318_GROUP(gpio10), -+ BCM6318_GROUP(gpio11), -+ BCM6318_GROUP(gpio12), -+ BCM6318_GROUP(gpio13), -+ BCM6318_GROUP(gpio14), -+ BCM6318_GROUP(gpio15), -+ BCM6318_GROUP(gpio16), -+ BCM6318_GROUP(gpio17), -+ BCM6318_GROUP(gpio18), -+ BCM6318_GROUP(gpio19), -+ BCM6318_GROUP(gpio20), -+ BCM6318_GROUP(gpio21), -+ BCM6318_GROUP(gpio22), -+ BCM6318_GROUP(gpio23), -+ BCM6318_GROUP(gpio24), -+ BCM6318_GROUP(gpio25), -+ BCM6318_GROUP(gpio26), -+ BCM6318_GROUP(gpio27), -+ BCM6318_GROUP(gpio28), -+ BCM6318_GROUP(gpio29), -+ BCM6318_GROUP(gpio30), -+ BCM6318_GROUP(gpio31), -+ BCM6318_GROUP(gpio32), -+ BCM6318_GROUP(gpio33), -+ BCM6318_GROUP(gpio34), -+ BCM6318_GROUP(gpio35), -+ BCM6318_GROUP(gpio36), -+ BCM6318_GROUP(gpio37), -+ BCM6318_GROUP(gpio38), -+ BCM6318_GROUP(gpio39), -+ BCM6318_GROUP(gpio40), -+ BCM6318_GROUP(gpio41), -+ BCM6318_GROUP(gpio42), -+ BCM6318_GROUP(gpio43), -+ BCM6318_GROUP(gpio44), -+ BCM6318_GROUP(gpio45), -+ BCM6318_GROUP(gpio46), -+ BCM6318_GROUP(gpio47), -+ BCM6318_GROUP(gpio48), -+ BCM6318_GROUP(gpio49), -+}; -+ -+/* GPIO_MODE */ -+static const char * const led_groups[] = { -+ "gpio0", -+ "gpio1", -+ "gpio2", -+ "gpio3", -+ "gpio4", -+ "gpio5", -+ "gpio6", -+ "gpio7", -+ "gpio8", -+ "gpio9", -+ "gpio10", -+ "gpio11", -+ "gpio12", -+ "gpio13", -+ "gpio14", -+ "gpio15", -+ "gpio16", -+ "gpio17", -+ "gpio18", -+ "gpio19", -+ "gpio20", -+ "gpio21", -+ "gpio22", -+ "gpio23", -+}; -+ -+/* PINMUX_SEL */ -+static const char * const ephy0_spd_led_groups[] = { -+ "gpio0", -+}; -+ -+static const char * const ephy1_spd_led_groups[] = { -+ "gpio1", -+}; -+ -+static const char * const ephy2_spd_led_groups[] = { -+ "gpio2", -+}; -+ -+static const char * const ephy3_spd_led_groups[] = { -+ "gpio3", -+}; -+ -+static const char * const ephy0_act_led_groups[] = { -+ "gpio4", -+}; -+ -+static const char * const ephy1_act_led_groups[] = { -+ "gpio5", -+}; -+ -+static const char * const ephy2_act_led_groups[] = { -+ "gpio6", -+}; -+ -+static const char * const ephy3_act_led_groups[] = { -+ "gpio7", -+}; -+ -+static const char * const serial_led_data_groups[] = { -+ "gpio6", -+}; -+ -+static const char * const serial_led_clk_groups[] = { -+ "gpio7", -+}; -+ -+static const char * const inet_act_led_groups[] = { -+ "gpio8", -+}; -+ -+static const char * const inet_fail_led_groups[] = { -+ "gpio9", -+}; -+ -+static const char * const dsl_led_groups[] = { -+ "gpio10", -+}; -+ -+static const char * const post_fail_led_groups[] = { -+ "gpio11", -+}; -+ -+static const char * const wlan_wps_led_groups[] = { -+ "gpio12", -+}; -+ -+static const char * const usb_pwron_groups[] = { -+ "gpio13", -+}; -+ -+static const char * const usb_device_led_groups[] = { -+ "gpio13", -+}; -+ -+static const char * const usb_active_groups[] = { -+ "gpio40", -+}; -+ -+#define BCM6318_MODE_FUN(n) \ -+ { \ -+ .name = #n, \ -+ .groups = n##_groups, \ -+ .num_groups = ARRAY_SIZE(n##_groups), \ -+ .mode_val = 1, \ -+ } -+ -+#define BCM6318_MUX_FUN(n, mux) \ -+ { \ -+ .name = #n, \ -+ .groups = n##_groups, \ -+ .num_groups = ARRAY_SIZE(n##_groups), \ -+ .mux_val = mux, \ -+ } -+ -+static const struct bcm6318_function bcm6318_funcs[] = { -+ BCM6318_MODE_FUN(led), -+ BCM6318_MUX_FUN(ephy0_spd_led, 1), -+ BCM6318_MUX_FUN(ephy1_spd_led, 1), -+ BCM6318_MUX_FUN(ephy2_spd_led, 1), -+ BCM6318_MUX_FUN(ephy3_spd_led, 1), -+ BCM6318_MUX_FUN(ephy0_act_led, 1), -+ BCM6318_MUX_FUN(ephy1_act_led, 1), -+ BCM6318_MUX_FUN(ephy2_act_led, 1), -+ BCM6318_MUX_FUN(ephy3_act_led, 1), -+ BCM6318_MUX_FUN(serial_led_data, 3), -+ BCM6318_MUX_FUN(serial_led_clk, 3), -+ BCM6318_MUX_FUN(inet_act_led, 1), -+ BCM6318_MUX_FUN(inet_fail_led, 1), -+ BCM6318_MUX_FUN(dsl_led, 1), -+ BCM6318_MUX_FUN(post_fail_led, 1), -+ BCM6318_MUX_FUN(wlan_wps_led, 1), -+ BCM6318_MUX_FUN(usb_pwron, 1), -+ BCM6318_MUX_FUN(usb_device_led, 2), -+ BCM6318_MUX_FUN(usb_active, 2), -+}; -+ -+static int bcm6318_pinctrl_get_group_count(struct pinctrl_dev *pctldev) -+{ -+ return ARRAY_SIZE(bcm6318_groups); -+} -+ -+static const char *bcm6318_pinctrl_get_group_name(struct pinctrl_dev *pctldev, -+ unsigned group) -+{ -+ return bcm6318_groups[group].name; -+} -+ -+static int bcm6318_pinctrl_get_group_pins(struct pinctrl_dev *pctldev, -+ unsigned group, const unsigned **pins, -+ unsigned *num_pins) -+{ -+ *pins = bcm6318_groups[group].pins; -+ *num_pins = bcm6318_groups[group].num_pins; -+ -+ return 0; -+} -+ -+static int bcm6318_pinctrl_get_func_count(struct pinctrl_dev *pctldev) -+{ -+ return ARRAY_SIZE(bcm6318_funcs); -+} -+ -+static const char *bcm6318_pinctrl_get_func_name(struct pinctrl_dev *pctldev, -+ unsigned selector) -+{ -+ return bcm6318_funcs[selector].name; -+} -+ -+static int bcm6318_pinctrl_get_groups(struct pinctrl_dev *pctldev, -+ unsigned selector, -+ const char * const **groups, -+ unsigned * const num_groups) -+{ -+ *groups = bcm6318_funcs[selector].groups; -+ *num_groups = bcm6318_funcs[selector].num_groups; -+ -+ return 0; -+} -+ -+static void bcm6318_rmw_mux(struct bcm6318_pinctrl *pctl, unsigned pin, -+ u32 mode, u32 mux) -+{ -+ unsigned long flags; -+ u32 reg; -+ -+ spin_lock_irqsave(&pctl->lock, flags); -+ if (pin < 32) { -+ reg = __raw_readl(pctl->mode); -+ reg &= ~BIT(pin); -+ if (mode) -+ reg |= BIT(pin); -+ __raw_writel(reg, pctl->mode); -+ } -+ -+ if (pin < 48) { -+ reg = __raw_readl(pctl->mux[pin / 16]); -+ reg &= ~(3UL << ((pin % 16) * 2)); -+ reg |= mux << ((pin % 16) * 2); -+ __raw_writel(reg, pctl->mux[pin / 16]); -+ } -+ spin_unlock_irqrestore(&pctl->lock, flags); -+} -+ -+static void bcm6318_set_pad(struct bcm6318_pinctrl *pctl, unsigned pin, u8 val) -+{ -+ unsigned long flags; -+ u32 reg; -+ -+ spin_lock_irqsave(&pctl->lock, flags); -+ reg = __raw_readl(pctl->pad[pin / 8]); -+ reg &= ~(0xfUL << ((pin % 8) * 4)); -+ reg |= val << ((pin % 8) * 4); -+ __raw_writel(reg, pctl->pad[pin / 8]); -+ spin_unlock_irqrestore(&pctl->lock, flags); -+} -+ -+static int bcm6318_pinctrl_set_mux(struct pinctrl_dev *pctldev, -+ unsigned selector, unsigned group) -+{ -+ struct bcm6318_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); -+ const struct bcm6318_pingroup *grp = &bcm6318_groups[group]; -+ const struct bcm6318_function *f = &bcm6318_funcs[selector]; -+ -+ bcm6318_rmw_mux(pctl, grp->pins[0], f->mode_val, f->mux_val); -+ -+ return 0; -+} -+ -+static int bcm6318_gpio_request_enable(struct pinctrl_dev *pctldev, -+ struct pinctrl_gpio_range *range, -+ unsigned offset) -+{ -+ struct bcm6318_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev); -+ -+ /* disable all functions using this pin */ -+ if (offset < 13) { -+ /* GPIOs 0-12 use mux 0 as GPIO function */ -+ bcm6318_rmw_mux(pctl, offset, 0, 0); -+ } else if (offset < 42) { -+ /* GPIOs 13-41 use mux 3 as GPIO function */ -+ bcm6318_rmw_mux(pctl, offset, 0, 3); -+ -+ /* FIXME: revert to old value for non gpio? */ -+ bcm6318_set_pad(pctl, offset, 0); -+ } else { -+ /* no idea, really */ -+ } -+ -+ return 0; -+} -+ -+static struct pinctrl_ops bcm6318_pctl_ops = { -+ .get_groups_count = bcm6318_pinctrl_get_group_count, -+ .get_group_name = bcm6318_pinctrl_get_group_name, -+ .get_group_pins = bcm6318_pinctrl_get_group_pins, -+#ifdef CONFIG_OF -+ .dt_node_to_map = pinconf_generic_dt_node_to_map_pin, -+ .dt_free_map = pinctrl_utils_free_map, -+#endif -+}; -+ -+static struct pinmux_ops bcm6318_pmx_ops = { -+ .get_functions_count = bcm6318_pinctrl_get_func_count, -+ .get_function_name = bcm6318_pinctrl_get_func_name, -+ .get_function_groups = bcm6318_pinctrl_get_groups, -+ .set_mux = bcm6318_pinctrl_set_mux, -+ .gpio_request_enable = bcm6318_gpio_request_enable, -+ .strict = true, -+}; -+ -+static int bcm6318_pinctrl_probe(struct platform_device *pdev) -+{ -+ struct bcm6318_pinctrl *pctl; -+ struct resource *res; -+ void __iomem *mode, *mux, *pad; -+ unsigned i; -+ -+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mode"); -+ mode = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(mode)) -+ return PTR_ERR(mode); -+ -+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mux"); -+ mux = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(mux)) -+ return PTR_ERR(mux); -+ -+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pad"); -+ pad = devm_ioremap_resource(&pdev->dev, res); -+ if (IS_ERR(pad)) -+ return PTR_ERR(pad); -+ -+ pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL); -+ if (!pctl) -+ return -ENOMEM; -+ -+ spin_lock_init(&pctl->lock); -+ -+ pctl->mode = mode; -+ -+ for (i = 0; i < 3; i++) -+ pctl->mux[i] = mux + (i * 4); -+ -+ for (i = 0; i < 6; i++) -+ pctl->pad[i] = pad + (i * 4); -+ -+ pctl->desc.name = dev_name(&pdev->dev); -+ pctl->desc.owner = THIS_MODULE; -+ pctl->desc.pctlops = &bcm6318_pctl_ops; -+ pctl->desc.pmxops = &bcm6318_pmx_ops; -+ -+ pctl->desc.npins = ARRAY_SIZE(bcm6318_pins); -+ pctl->desc.pins = bcm6318_pins; -+ -+ platform_set_drvdata(pdev, pctl); -+ -+ pctl->pctldev = bcm63xx_pinctrl_register(pdev, &pctl->desc, pctl, -+ pctl->gpio, BCM6318_NGPIO); -+ if (IS_ERR(pctl->pctldev)) -+ return PTR_ERR(pctl->pctldev); -+ -+ return 0; -+} -+ -+static const struct of_device_id bcm6318_pinctrl_match[] = { -+ { .compatible = "brcm,bcm6318-pinctrl", }, -+ { }, -+}; -+ -+static struct platform_driver bcm6318_pinctrl_driver = { -+ .probe = bcm6318_pinctrl_probe, -+ .driver = { -+ .name = "bcm6318-pinctrl", -+ .of_match_table = bcm6318_pinctrl_match, -+ }, -+}; -+ -+builtin_platform_driver(bcm6318_pinctrl_driver); diff --git a/target/linux/bcm63xx/patches-5.15/383-bcm63xx_select_pinctrl.patch b/target/linux/bcm63xx/patches-5.15/383-bcm63xx_select_pinctrl.patch deleted file mode 100644 index 126814a51d043b..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/383-bcm63xx_select_pinctrl.patch +++ /dev/null @@ -1,65 +0,0 @@ ---- a/arch/mips/bcm63xx/Kconfig -+++ b/arch/mips/bcm63xx/Kconfig -@@ -25,6 +25,8 @@ config BCM63XX_CPU_6318 - select HAVE_PCI - select BCM63XX_OHCI - select BCM63XX_EHCI -+ select PINCTRL -+ select PINCTRL_BRCM6318 - - config BCM63XX_CPU_6328 - bool "support 6328 CPU" -@@ -32,6 +34,8 @@ config BCM63XX_CPU_6328 - select HAVE_PCI - select BCM63XX_OHCI - select BCM63XX_EHCI -+ select PINCTRL -+ select PINCTRL_BRCM6328 - - config BCM63XX_CPU_6338 - bool "support 6338 CPU" -@@ -47,6 +51,8 @@ config BCM63XX_CPU_6348 - select SYS_HAS_CPU_BMIPS32_3300 - select HAVE_PCI - select BCM63XX_OHCI -+ select PINCTRL -+ select PINCTRL_BRCM6348 - - config BCM63XX_CPU_6358 - bool "support 6358 CPU" -@@ -54,6 +60,8 @@ config BCM63XX_CPU_6358 - select HAVE_PCI - select BCM63XX_OHCI - select BCM63XX_EHCI -+ select PINCTRL -+ select PINCTRL_BRCM6358 - - config BCM63XX_CPU_6362 - bool "support 6362 CPU" -@@ -61,6 +69,8 @@ config BCM63XX_CPU_6362 - select HAVE_PCI - select BCM63XX_OHCI - select BCM63XX_EHCI -+ select PINCTRL -+ select PINCTRL_BRCM6362 - - config BCM63XX_CPU_6368 - bool "support 6368 CPU" -@@ -68,6 +78,8 @@ config BCM63XX_CPU_6368 - select HAVE_PCI - select BCM63XX_OHCI - select BCM63XX_EHCI -+ select PINCTRL -+ select PINCTRL_BRCM6368 - - config BCM63XX_CPU_63268 - bool "support 63268 CPU" -@@ -75,6 +87,8 @@ config BCM63XX_CPU_63268 - select HAVE_PCI - select BCM63XX_OHCI - select BCM63XX_EHCI -+ select PINCTRL -+ select PINCTRL_BRCM63268 - endmenu - - source "arch/mips/bcm63xx/boards/Kconfig" diff --git a/target/linux/bcm63xx/patches-5.15/389-MIPS-BCM63XX-add-clkdev-lookups-for-device-tree.patch b/target/linux/bcm63xx/patches-5.15/389-MIPS-BCM63XX-add-clkdev-lookups-for-device-tree.patch deleted file mode 100644 index 012aab16d99682..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/389-MIPS-BCM63XX-add-clkdev-lookups-for-device-tree.patch +++ /dev/null @@ -1,105 +0,0 @@ -From cad8f63047c0691e8185d3c9c6a2705b83310c9c Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Mon, 31 Jul 2017 20:10:36 +0200 -Subject: [PATCH] MIPS: BCM63XX: add clkdev lookups for device tree - ---- - arch/mips/bcm63xx/clk.c | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - ---- a/arch/mips/bcm63xx/clk.c -+++ b/arch/mips/bcm63xx/clk.c -@@ -517,6 +517,8 @@ static struct clk_lookup bcm3368_clks[] - CLKDEV_INIT(NULL, "periph", &clk_periph), - CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), - CLKDEV_INIT("bcm63xx_uart.1", "refclk", &clk_periph), -+ CLKDEV_INIT("fff8c100.serial", "refclk", &clk_periph), -+ CLKDEV_INIT("fff8c120.serial", "refclk", &clk_periph), - /* gated clocks */ - CLKDEV_INIT(NULL, "enet0", &clk_enet0), - CLKDEV_INIT(NULL, "enet1", &clk_enet1), -@@ -533,7 +535,9 @@ static struct clk_lookup bcm6318_clks[] - /* fixed rate clocks */ - CLKDEV_INIT(NULL, "periph", &clk_periph), - CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), -+ CLKDEV_INIT("10000100.serial", "refclk", &clk_periph), - CLKDEV_INIT("bcm63xx-hsspi.0", "pll", &clk_hsspi_pll), -+ CLKDEV_INIT("10003000.spi", "pll", &clk_hsspi_pll), - /* gated clocks */ - CLKDEV_INIT(NULL, "enetsw", &clk_enetsw), - CLKDEV_INIT(NULL, "usbh", &clk_usbh), -@@ -547,7 +551,10 @@ static struct clk_lookup bcm6328_clks[] - CLKDEV_INIT(NULL, "periph", &clk_periph), - CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), - CLKDEV_INIT("bcm63xx_uart.1", "refclk", &clk_periph), -+ CLKDEV_INIT("10000100.serial", "refclk", &clk_periph), -+ CLKDEV_INIT("10000120.serial", "refclk", &clk_periph), - CLKDEV_INIT("bcm63xx-hsspi.0", "pll", &clk_hsspi_pll), -+ CLKDEV_INIT("10001000.spi", "pll", &clk_hsspi_pll), - /* gated clocks */ - CLKDEV_INIT(NULL, "enetsw", &clk_enetsw), - CLKDEV_INIT(NULL, "usbh", &clk_usbh), -@@ -560,6 +567,7 @@ static struct clk_lookup bcm6338_clks[] - /* fixed rate clocks */ - CLKDEV_INIT(NULL, "periph", &clk_periph), - CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), -+ CLKDEV_INIT("fffe0300.serial", "refclk", &clk_periph), - /* gated clocks */ - CLKDEV_INIT(NULL, "enet0", &clk_enet0), - CLKDEV_INIT(NULL, "enet1", &clk_enet1), -@@ -574,6 +582,7 @@ static struct clk_lookup bcm6345_clks[] - /* fixed rate clocks */ - CLKDEV_INIT(NULL, "periph", &clk_periph), - CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), -+ CLKDEV_INIT("fffe0300.serial", "refclk", &clk_periph), - /* gated clocks */ - CLKDEV_INIT(NULL, "enet0", &clk_enet0), - CLKDEV_INIT(NULL, "enet1", &clk_enet1), -@@ -588,6 +597,7 @@ static struct clk_lookup bcm6348_clks[] - /* fixed rate clocks */ - CLKDEV_INIT(NULL, "periph", &clk_periph), - CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), -+ CLKDEV_INIT("fffe0300.serial", "refclk", &clk_periph), - /* gated clocks */ - CLKDEV_INIT(NULL, "enet0", &clk_enet0), - CLKDEV_INIT(NULL, "enet1", &clk_enet1), -@@ -604,6 +614,8 @@ static struct clk_lookup bcm6358_clks[] - CLKDEV_INIT(NULL, "periph", &clk_periph), - CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), - CLKDEV_INIT("bcm63xx_uart.1", "refclk", &clk_periph), -+ CLKDEV_INIT("fffe0100.serial", "refclk", &clk_periph), -+ CLKDEV_INIT("fffe0120.serial", "refclk", &clk_periph), - /* gated clocks */ - CLKDEV_INIT(NULL, "enet0", &clk_enet0), - CLKDEV_INIT(NULL, "enet1", &clk_enet1), -@@ -623,7 +635,10 @@ static struct clk_lookup bcm6362_clks[] - CLKDEV_INIT(NULL, "periph", &clk_periph), - CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), - CLKDEV_INIT("bcm63xx_uart.1", "refclk", &clk_periph), -+ CLKDEV_INIT("10000100.serial", "refclk", &clk_periph), -+ CLKDEV_INIT("10000120.serial", "refclk", &clk_periph), - CLKDEV_INIT("bcm63xx-hsspi.0", "pll", &clk_hsspi_pll), -+ CLKDEV_INIT("10001000.spi", "pll", &clk_hsspi_pll), - /* gated clocks */ - CLKDEV_INIT(NULL, "enetsw", &clk_enetsw), - CLKDEV_INIT(NULL, "usbh", &clk_usbh), -@@ -639,6 +654,8 @@ static struct clk_lookup bcm6368_clks[] - CLKDEV_INIT(NULL, "periph", &clk_periph), - CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), - CLKDEV_INIT("bcm63xx_uart.1", "refclk", &clk_periph), -+ CLKDEV_INIT("10000100.serial", "refclk", &clk_periph), -+ CLKDEV_INIT("10000120.serial", "refclk", &clk_periph), - /* gated clocks */ - CLKDEV_INIT(NULL, "enetsw", &clk_enetsw), - CLKDEV_INIT(NULL, "usbh", &clk_usbh), -@@ -653,7 +670,10 @@ static struct clk_lookup bcm63268_clks[] - CLKDEV_INIT(NULL, "periph", &clk_periph), - CLKDEV_INIT("bcm63xx_uart.0", "refclk", &clk_periph), - CLKDEV_INIT("bcm63xx_uart.1", "refclk", &clk_periph), -+ CLKDEV_INIT("10000180.serial", "refclk", &clk_periph), -+ CLKDEV_INIT("100001a0.serial", "refclk", &clk_periph), - CLKDEV_INIT("bcm63xx-hsspi.0", "pll", &clk_hsspi_pll), -+ CLKDEV_INIT("10001000.spi", "pll", &clk_hsspi_pll), - /* gated clocks */ - CLKDEV_INIT(NULL, "enetsw", &clk_enetsw), - CLKDEV_INIT(NULL, "usbh", &clk_usbh), diff --git a/target/linux/bcm63xx/patches-5.15/390-MIPS-BCM63XX-do-not-register-SPI-controllers.patch b/target/linux/bcm63xx/patches-5.15/390-MIPS-BCM63XX-do-not-register-SPI-controllers.patch deleted file mode 100644 index 03b8bfc7c61e2a..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/390-MIPS-BCM63XX-do-not-register-SPI-controllers.patch +++ /dev/null @@ -1,172 +0,0 @@ -From 39d2882058345b5994680b8731848a0343878019 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sat, 4 Feb 2017 12:58:50 +0100 -Subject: [PATCH 7/8] MIPS: BCM63XX: do not register SPI controllers - -We now register them through DT, so no need to keep them here. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/boards/board_bcm963xx.c | 7 ------- - 1 file changed, 7 deletions(-) - ---- a/arch/mips/bcm63xx/boards/board_common.c -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -27,9 +27,7 @@ - #include - #include - #include --#include - #include --#include - #include - #include - #include -@@ -236,10 +234,6 @@ int __init board_register_devices(void) - bcm63xx_register_fallback_sprom(&board.fallback_sprom))) - pr_err(PFX "failed to register fallback SPROM\n"); - -- bcm63xx_spi_register(); -- -- bcm63xx_hsspi_register(); -- - bcm63xx_flash_register(); - - bcm63xx_led_data.num_leds = ARRAY_SIZE(board.leds); ---- a/arch/mips/bcm63xx/Makefile -+++ b/arch/mips/bcm63xx/Makefile -@@ -1,7 +1,7 @@ - # SPDX-License-Identifier: GPL-2.0 - obj-y += clk.o cpu.o cs.o gpio.o irq.o nvram.o prom.o reset.o \ - setup.o timer.o dev-enet.o dev-flash.o dev-pcmcia.o \ -- dev-rng.o dev-spi.o dev-hsspi.o dev-uart.o dev-wdt.o \ -+ dev-rng.o dev-uart.o dev-wdt.o \ - dev-usb-ehci.o dev-usb-ohci.o dev-usb-usbd.o usb-common.o \ - sprom.o - obj-$(CONFIG_EARLY_PRINTK) += early_printk.o ---- a/arch/mips/bcm63xx/dev-hsspi.c -+++ /dev/null -@@ -1,48 +0,0 @@ --/* -- * This file is subject to the terms and conditions of the GNU General Public -- * License. See the file "COPYING" in the main directory of this archive -- * for more details. -- * -- * Copyright (C) 2012 Jonas Gorski -- */ -- --#include --#include --#include -- --#include --#include --#include -- --static struct resource spi_resources[] = { -- { -- .start = -1, /* filled at runtime */ -- .end = -1, /* filled at runtime */ -- .flags = IORESOURCE_MEM, -- }, -- { -- .start = -1, /* filled at runtime */ -- .flags = IORESOURCE_IRQ, -- }, --}; -- --static struct platform_device bcm63xx_hsspi_device = { -- .name = "bcm63xx-hsspi", -- .id = 0, -- .num_resources = ARRAY_SIZE(spi_resources), -- .resource = spi_resources, --}; -- --int __init bcm63xx_hsspi_register(void) --{ -- if (!BCMCPU_IS_6318() && !BCMCPU_IS_6328() && !BCMCPU_IS_6362() && -- !BCMCPU_IS_63268()) -- return -ENODEV; -- -- spi_resources[0].start = bcm63xx_regset_address(RSET_HSSPI); -- spi_resources[0].end = spi_resources[0].start; -- spi_resources[0].end += RSET_HSSPI_SIZE - 1; -- spi_resources[1].start = bcm63xx_get_irq_number(IRQ_HSSPI); -- -- return platform_device_register(&bcm63xx_hsspi_device); --} ---- a/arch/mips/bcm63xx/dev-spi.c -+++ /dev/null -@@ -1,60 +0,0 @@ --/* -- * This file is subject to the terms and conditions of the GNU General Public -- * License. See the file "COPYING" in the main directory of this archive -- * for more details. -- * -- * Copyright (C) 2009-2011 Florian Fainelli -- * Copyright (C) 2010 Tanguy Bouzeloc -- */ -- --#include --#include --#include --#include --#include --#include -- --#include --#include --#include -- --static struct resource spi_resources[] = { -- { -- .start = -1, /* filled at runtime */ -- .end = -1, /* filled at runtime */ -- .flags = IORESOURCE_MEM, -- }, -- { -- .start = -1, /* filled at runtime */ -- .flags = IORESOURCE_IRQ, -- }, --}; -- --static struct platform_device bcm63xx_spi_device = { -- .id = -1, -- .num_resources = ARRAY_SIZE(spi_resources), -- .resource = spi_resources, --}; -- --int __init bcm63xx_spi_register(void) --{ -- if (BCMCPU_IS_6318() || BCMCPU_IS_6328() || BCMCPU_IS_6345()) -- return -ENODEV; -- -- spi_resources[0].start = bcm63xx_regset_address(RSET_SPI); -- spi_resources[0].end = spi_resources[0].start; -- spi_resources[1].start = bcm63xx_get_irq_number(IRQ_SPI); -- -- if (BCMCPU_IS_6338() || BCMCPU_IS_6348()) { -- bcm63xx_spi_device.name = "bcm6348-spi", -- spi_resources[0].end += BCM_6348_RSET_SPI_SIZE - 1; -- } -- -- if (BCMCPU_IS_3368() || BCMCPU_IS_6358() || BCMCPU_IS_6362() || -- BCMCPU_IS_6368() || BCMCPU_IS_63268()) { -- bcm63xx_spi_device.name = "bcm6358-spi", -- spi_resources[0].end += BCM_6358_RSET_SPI_SIZE - 1; -- } -- -- return platform_device_register(&bcm63xx_spi_device); --} ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_hsspi.h -+++ /dev/null -@@ -1,9 +0,0 @@ --/* SPDX-License-Identifier: GPL-2.0 */ --#ifndef BCM63XX_DEV_HSSPI_H --#define BCM63XX_DEV_HSSPI_H -- --#include -- --int bcm63xx_hsspi_register(void); -- --#endif /* BCM63XX_DEV_HSSPI_H */ diff --git a/target/linux/bcm63xx/patches-5.15/391-MIPS-BCM63XX-do-not-register-uart.patch b/target/linux/bcm63xx/patches-5.15/391-MIPS-BCM63XX-do-not-register-uart.patch deleted file mode 100644 index 807c81aaee812f..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/391-MIPS-BCM63XX-do-not-register-uart.patch +++ /dev/null @@ -1,259 +0,0 @@ ---- a/arch/mips/bcm63xx/Makefile -+++ b/arch/mips/bcm63xx/Makefile -@@ -1,7 +1,7 @@ - # SPDX-License-Identifier: GPL-2.0 - obj-y += clk.o cpu.o cs.o gpio.o irq.o nvram.o prom.o reset.o \ - setup.o timer.o dev-enet.o dev-flash.o dev-pcmcia.o \ -- dev-rng.o dev-uart.o dev-wdt.o \ -+ dev-rng.o dev-wdt.o \ - dev-usb-ehci.o dev-usb-ohci.o dev-usb-usbd.o usb-common.o \ - sprom.o - obj-$(CONFIG_EARLY_PRINTK) += early_printk.o ---- a/arch/mips/bcm63xx/dev-uart.c -+++ /dev/null -@@ -1,76 +0,0 @@ --/* -- * This file is subject to the terms and conditions of the GNU General Public -- * License. See the file "COPYING" in the main directory of this archive -- * for more details. -- * -- * Copyright (C) 2008 Maxime Bizon -- */ -- --#include --#include --#include --#include -- --static struct resource uart0_resources[] = { -- { -- /* start & end filled at runtime */ -- .flags = IORESOURCE_MEM, -- }, -- { -- /* start filled at runtime */ -- .flags = IORESOURCE_IRQ, -- }, --}; -- --static struct resource uart1_resources[] = { -- { -- /* start & end filled at runtime */ -- .flags = IORESOURCE_MEM, -- }, -- { -- /* start filled at runtime */ -- .flags = IORESOURCE_IRQ, -- }, --}; -- --static struct platform_device bcm63xx_uart_devices[] = { -- { -- .name = "bcm63xx_uart", -- .id = 0, -- .num_resources = ARRAY_SIZE(uart0_resources), -- .resource = uart0_resources, -- }, -- -- { -- .name = "bcm63xx_uart", -- .id = 1, -- .num_resources = ARRAY_SIZE(uart1_resources), -- .resource = uart1_resources, -- } --}; -- --int __init bcm63xx_uart_register(unsigned int id) --{ -- if (id >= ARRAY_SIZE(bcm63xx_uart_devices)) -- return -ENODEV; -- -- if (id == 1 && (!BCMCPU_IS_3368() && !BCMCPU_IS_6358() && -- !BCMCPU_IS_6368())) -- return -ENODEV; -- -- if (id == 0) { -- uart0_resources[0].start = bcm63xx_regset_address(RSET_UART0); -- uart0_resources[0].end = uart0_resources[0].start + -- RSET_UART_SIZE - 1; -- uart0_resources[1].start = bcm63xx_get_irq_number(IRQ_UART0); -- } -- -- if (id == 1) { -- uart1_resources[0].start = bcm63xx_regset_address(RSET_UART1); -- uart1_resources[0].end = uart1_resources[0].start + -- RSET_UART_SIZE - 1; -- uart1_resources[1].start = bcm63xx_get_irq_number(IRQ_UART1); -- } -- -- return platform_device_register(&bcm63xx_uart_devices[id]); --} ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_uart.h -+++ /dev/null -@@ -1,7 +0,0 @@ --/* SPDX-License-Identifier: GPL-2.0 */ --#ifndef BCM63XX_DEV_UART_H_ --#define BCM63XX_DEV_UART_H_ -- --int bcm63xx_uart_register(unsigned int id); -- --#endif /* BCM63XX_DEV_UART_H_ */ ---- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h -+++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h -@@ -32,8 +32,6 @@ struct board_info { - unsigned int has_ohci0:1; - unsigned int has_ehci0:1; - unsigned int has_usbd:1; -- unsigned int has_uart0:1; -- unsigned int has_uart1:1; - unsigned int use_fallback_sprom:1; - - /* ethernet config */ ---- a/arch/mips/bcm63xx/boards/board_common.c -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -20,7 +20,6 @@ - #include - #include - #include --#include - #include - #include - #include -@@ -188,12 +187,6 @@ int __init board_register_devices(void) - - bcm63xx_gpio_init(); - -- if (board.has_uart0) -- bcm63xx_uart_register(0); -- -- if (board.has_uart1) -- bcm63xx_uart_register(1); -- - if (board.has_pccard) - bcm63xx_pcmcia_register(); - ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -34,8 +34,6 @@ static struct board_info __initdata boar - .ephy_reset_gpio = 36, - .ephy_reset_gpio_flags = GPIO_ACTIVE_LOW, - .has_pci = 1, -- .has_uart0 = 1, -- .has_uart1 = 1, - - .has_enet0 = 1, - .enet0 = { -@@ -62,7 +60,6 @@ static struct board_info __initdata boar - .expected_cpu_id = 0x6328, - - .has_pci = 1, -- .has_uart0 = 1, - .use_fallback_sprom = 1, - - .has_usbd = 0, -@@ -111,7 +108,6 @@ static struct board_info __initdata boar - .expected_cpu_id = 0x6338, - - .has_ohci0 = 1, -- .has_uart0 = 1, - - .has_enet0 = 1, - .enet0 = { -@@ -153,8 +149,6 @@ static struct board_info __initdata boar - .name = "96338W", - .expected_cpu_id = 0x6338, - -- .has_uart0 = 1, -- - .has_enet0 = 1, - .enet0 = { - .force_speed_100 = 1, -@@ -199,8 +193,6 @@ static struct board_info __initdata boar - static struct board_info __initdata board_96345gw2 = { - .name = "96345GW2", - .expected_cpu_id = 0x6345, -- -- .has_uart0 = 1, - }; - #endif /* CONFIG_BCM63XX_CPU_6345 */ - -@@ -213,7 +205,6 @@ static struct board_info __initdata boar - .expected_cpu_id = 0x6348, - - .has_pci = 1, -- .has_uart0 = 1, - .use_fallback_sprom = 1, - - .has_enet0 = 1, -@@ -260,7 +251,6 @@ static struct board_info __initdata boar - .has_ohci0 = 1, - .has_pccard = 1, - .has_pci = 1, -- .has_uart0 = 1, - .use_fallback_sprom = 1, - - .has_enet0 = 1, -@@ -312,7 +302,6 @@ static struct board_info __initdata boar - .has_ohci0 = 1, - .has_pccard = 1, - .has_pci = 1, -- .has_uart0 = 1, - .use_fallback_sprom = 1, - - .has_enet0 = 1, -@@ -363,7 +352,6 @@ static struct board_info __initdata boar - - .has_ohci0 = 1, - .has_pci = 1, -- .has_uart0 = 1, - .use_fallback_sprom = 1, - - .has_enet0 = 1, -@@ -415,7 +403,6 @@ static struct board_info __initdata boar - .has_ohci0 = 1, - .has_pccard = 1, - .has_pci = 1, -- .has_uart0 = 1, - .use_fallback_sprom = 1, - - .has_enet0 = 1, -@@ -457,7 +444,6 @@ static struct board_info __initdata boar - - .has_ohci0 = 1, - .has_pci = 1, -- .has_uart0 = 1, - .use_fallback_sprom = 1, - - .has_enet0 = 1, -@@ -479,7 +465,6 @@ static struct board_info __initdata boar - - .has_ohci0 = 1, - .has_pci = 1, -- .has_uart0 = 1, - .use_fallback_sprom = 1, - - .has_enet0 = 1, -@@ -508,7 +493,6 @@ static struct board_info __initdata boar - .has_ohci0 = 1, - .has_pccard = 1, - .has_pci = 1, -- .has_uart0 = 1, - .use_fallback_sprom = 1, - - .has_enet0 = 1, -@@ -560,7 +544,6 @@ static struct board_info __initdata boar - .num_usbh_ports = 2, - .has_pccard = 1, - .has_pci = 1, -- .has_uart0 = 1, - .use_fallback_sprom = 1, - - .has_enet0 = 1, -@@ -606,7 +589,6 @@ static struct board_info __initdata boar - .has_ehci0 = 1, - .has_ohci0 = 1, - .has_pci = 1, -- .has_uart0 = 1, - - .has_enet0 = 1, - .enet0 = { diff --git a/target/linux/bcm63xx/patches-5.15/392-MIPS-BCM63XX-remove-leds-and-buttons.patch b/target/linux/bcm63xx/patches-5.15/392-MIPS-BCM63XX-remove-leds-and-buttons.patch deleted file mode 100644 index 184cdb6c487f06..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/392-MIPS-BCM63XX-remove-leds-and-buttons.patch +++ /dev/null @@ -1,343 +0,0 @@ -From 997f53b174c63153335508c22dc4493e8e5808d6 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 22 Feb 2015 17:52:32 +0100 -Subject: [PATCH] MIPS: BCM63XX: remove leds and buttons - ---- - arch/mips/bcm63xx/boards/board_bcm963xx.c | 262 ----------------------------- - 1 file changed, 262 deletions(-) - ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -40,14 +40,6 @@ static struct board_info __initdata boar - .has_phy = 1, - .use_internal_phy = 1, - }, -- -- .leds = { -- { -- .name = "CVG834G:green:power", -- .gpio = 37, -- .default_trigger= "default-on", -- }, -- }, - }; - #endif /* CONFIG_BCM63XX_CPU_3368 */ - -@@ -67,35 +59,6 @@ static struct board_info __initdata boar - .use_fullspeed = 0, - .port_no = 0, - }, -- -- .leds = { -- { -- .name = "96328avng::ppp-fail", -- .gpio = 2, -- .active_low = 1, -- }, -- { -- .name = "96328avng::power", -- .gpio = 4, -- .active_low = 1, -- .default_trigger = "default-on", -- }, -- { -- .name = "96328avng::power-fail", -- .gpio = 8, -- .active_low = 1, -- }, -- { -- .name = "96328avng::wps", -- .gpio = 9, -- .active_low = 1, -- }, -- { -- .name = "96328avng::ppp", -- .gpio = 11, -- .active_low = 1, -- }, -- }, - }; - #endif /* CONFIG_BCM63XX_CPU_6328 */ - -@@ -114,35 +77,6 @@ static struct board_info __initdata boar - .force_speed_100 = 1, - .force_duplex_full = 1, - }, -- -- .leds = { -- { -- .name = "adsl", -- .gpio = 3, -- .active_low = 1, -- }, -- { -- .name = "ses", -- .gpio = 5, -- .active_low = 1, -- }, -- { -- .name = "ppp-fail", -- .gpio = 4, -- .active_low = 1, -- }, -- { -- .name = "power", -- .gpio = 0, -- .active_low = 1, -- .default_trigger = "default-on", -- }, -- { -- .name = "stop", -- .gpio = 1, -- .active_low = 1, -- } -- }, - }; - - static struct board_info __initdata board_96338w = { -@@ -154,35 +88,6 @@ static struct board_info __initdata boar - .force_speed_100 = 1, - .force_duplex_full = 1, - }, -- -- .leds = { -- { -- .name = "adsl", -- .gpio = 3, -- .active_low = 1, -- }, -- { -- .name = "ses", -- .gpio = 5, -- .active_low = 1, -- }, -- { -- .name = "ppp-fail", -- .gpio = 4, -- .active_low = 1, -- }, -- { -- .name = "power", -- .gpio = 0, -- .active_low = 1, -- .default_trigger = "default-on", -- }, -- { -- .name = "stop", -- .gpio = 1, -- .active_low = 1, -- }, -- }, - }; - #endif /* CONFIG_BCM63XX_CPU_6338 */ - -@@ -212,36 +117,6 @@ static struct board_info __initdata boar - .has_phy = 1, - .use_internal_phy = 1, - }, -- -- .leds = { -- { -- .name = "adsl-fail", -- .gpio = 2, -- .active_low = 1, -- }, -- { -- .name = "ppp", -- .gpio = 3, -- .active_low = 1, -- }, -- { -- .name = "ppp-fail", -- .gpio = 4, -- .active_low = 1, -- }, -- { -- .name = "power", -- .gpio = 0, -- .active_low = 1, -- .default_trigger = "default-on", -- -- }, -- { -- .name = "stop", -- .gpio = 1, -- .active_low = 1, -- }, -- }, - }; - - static struct board_info __initdata board_96348gw_10 = { -@@ -264,35 +139,6 @@ static struct board_info __initdata boar - .force_speed_100 = 1, - .force_duplex_full = 1, - }, -- -- .leds = { -- { -- .name = "adsl-fail", -- .gpio = 2, -- .active_low = 1, -- }, -- { -- .name = "ppp", -- .gpio = 3, -- .active_low = 1, -- }, -- { -- .name = "ppp-fail", -- .gpio = 4, -- .active_low = 1, -- }, -- { -- .name = "power", -- .gpio = 0, -- .active_low = 1, -- .default_trigger = "default-on", -- }, -- { -- .name = "stop", -- .gpio = 1, -- .active_low = 1, -- }, -- }, - }; - - static struct board_info __initdata board_96348gw_11 = { -@@ -315,35 +161,6 @@ static struct board_info __initdata boar - .force_speed_100 = 1, - .force_duplex_full = 1, - }, -- -- .leds = { -- { -- .name = "adsl-fail", -- .gpio = 2, -- .active_low = 1, -- }, -- { -- .name = "ppp", -- .gpio = 3, -- .active_low = 1, -- }, -- { -- .name = "ppp-fail", -- .gpio = 4, -- .active_low = 1, -- }, -- { -- .name = "power", -- .gpio = 0, -- .active_low = 1, -- .default_trigger = "default-on", -- }, -- { -- .name = "stop", -- .gpio = 1, -- .active_low = 1, -- }, -- }, - }; - - static struct board_info __initdata board_96348gw = { -@@ -365,35 +182,6 @@ static struct board_info __initdata boar - .force_speed_100 = 1, - .force_duplex_full = 1, - }, -- -- .leds = { -- { -- .name = "adsl-fail", -- .gpio = 2, -- .active_low = 1, -- }, -- { -- .name = "ppp", -- .gpio = 3, -- .active_low = 1, -- }, -- { -- .name = "ppp-fail", -- .gpio = 4, -- .active_low = 1, -- }, -- { -- .name = "power", -- .gpio = 0, -- .active_low = 1, -- .default_trigger = "default-on", -- }, -- { -- .name = "stop", -- .gpio = 1, -- .active_low = 1, -- }, -- }, - }; - - static struct board_info __initdata board_FAST2404 = { -@@ -506,33 +294,6 @@ static struct board_info __initdata boar - .force_speed_100 = 1, - .force_duplex_full = 1, - }, -- -- .leds = { -- { -- .name = "adsl-fail", -- .gpio = 15, -- .active_low = 1, -- }, -- { -- .name = "ppp", -- .gpio = 22, -- .active_low = 1, -- }, -- { -- .name = "ppp-fail", -- .gpio = 23, -- .active_low = 1, -- }, -- { -- .name = "power", -- .gpio = 4, -- .default_trigger = "default-on", -- }, -- { -- .name = "stop", -- .gpio = 5, -- }, -- }, - }; - - static struct board_info __initdata board_96358vw2 = { -@@ -557,29 +318,6 @@ static struct board_info __initdata boar - .force_speed_100 = 1, - .force_duplex_full = 1, - }, -- -- .leds = { -- { -- .name = "adsl", -- .gpio = 22, -- .active_low = 1, -- }, -- { -- .name = "ppp-fail", -- .gpio = 23, -- }, -- { -- .name = "power", -- .gpio = 5, -- .active_low = 1, -- .default_trigger = "default-on", -- }, -- { -- .name = "stop", -- .gpio = 4, -- .active_low = 1, -- }, -- }, - }; - - static struct board_info __initdata board_AGPFS0 = { diff --git a/target/linux/bcm63xx/patches-5.15/393-bcm6358-power-cycle-usb-pll.patch b/target/linux/bcm63xx/patches-5.15/393-bcm6358-power-cycle-usb-pll.patch deleted file mode 100644 index 43b82bca32e340..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/393-bcm6358-power-cycle-usb-pll.patch +++ /dev/null @@ -1,47 +0,0 @@ ---- a/arch/mips/bcm63xx/clk.c -+++ b/arch/mips/bcm63xx/clk.c -@@ -258,6 +258,8 @@ static struct clk clk_pcm = { - */ - static void usbh_set(struct clk *clk, int enable) - { -+ u32 reg; -+ - if (BCMCPU_IS_6318()) { - bcm_hwclock_set(CKCTL_6318_USB_EN, enable); - bcm_ub_hwclock_set(UB_CKCTL_6318_USB_EN, enable); -@@ -265,13 +267,19 @@ static void usbh_set(struct clk *clk, in - bcm_hwclock_set(CKCTL_6328_USBH_EN, enable); - } else if (BCMCPU_IS_6348()) { - bcm_hwclock_set(CKCTL_6348_USBH_EN, enable); -+ } else if (BCMCPU_IS_6358()) { -+ /* power cycle the USB PLL */ -+ reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_PLL_CTRL_6358_REG); -+ reg &= ~USBH_PRIV_PLL_CTRL_6358_EN; -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_PLL_CTRL_6358_REG); -+ mdelay(1); -+ reg |= USBH_PRIV_PLL_CTRL_6358_EN; -+ bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_PLL_CTRL_6358_REG); - } else if (BCMCPU_IS_6362()) { - bcm_hwclock_set(CKCTL_6362_USBH_EN, enable); - } else if (BCMCPU_IS_6368()) { - bcm_hwclock_set(CKCTL_6368_USBH_EN, enable); - } else if (BCMCPU_IS_63268()) { -- u32 reg; -- - bcm_hwclock_set(CKCTL_63268_USBH_EN, enable); - bcm_misc_iddq_set(IDDQ_CTRL_63268_USBH, enable); - bcm63xx_core_set_reset(BCM63XX_RESET_USBH, !enable); ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -@@ -1043,9 +1043,11 @@ - #define USBH_PRIV_SETUP_IPP_MASK (1 << USBH_PRIV_SETUP_IPP_SHIFT) - - #define USBH_PRIV_SETUP_6318_REG 0x00 -+#define USBH_PRIV_PLL_CTRL_6358_REG 0x0c - #define USBH_PRIV_PLL_CTRL1_6368_REG 0x18 - #define USBH_PRIV_PLL_CTRL1_6318_REG 0x04 - -+#define USBH_PRIV_PLL_CTRL_6358_EN (1 << 25) - #define USBH_PRIV_PLL_CTRL1_6318_SUSP_EN (1 << 27) - #define USBH_PRIV_PLL_CTRL1_6318_IDDQ_PWRDN (1 << 31) - #define USBH_PRIV_PLL_CTRL1_63268_IDDQ_PWRDN (1 << 9) diff --git a/target/linux/bcm63xx/patches-5.15/400-bcm963xx_flashmap.patch b/target/linux/bcm63xx/patches-5.15/400-bcm963xx_flashmap.patch deleted file mode 100644 index e01e38765f0725..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/400-bcm963xx_flashmap.patch +++ /dev/null @@ -1,65 +0,0 @@ -From a4d005c91d403d9f3d0272db6cc46202c06ec774 Mon Sep 17 00:00:00 2001 -From: Axel Gembe -Date: Mon, 12 May 2008 18:54:09 +0200 -Subject: [PATCH] bcm963xx: flashmap support - -Signed-off-by: Axel Gembe ---- - arch/mips/bcm63xx/boards/board_bcm963xx.c | 19 +---------------- - drivers/mtd/maps/bcm963xx-flash.c | 32 ++++++++++++++++++++++++---- - drivers/mtd/redboot.c | 13 +++++++++-- - 3 files changed, 38 insertions(+), 26 deletions(-) - ---- a/arch/mips/bcm63xx/dev-flash.c -+++ b/arch/mips/bcm63xx/dev-flash.c -@@ -35,7 +35,7 @@ static struct mtd_partition mtd_partitio - } - }; - --static const char *bcm63xx_part_types[] = { "bcm63xxpart", NULL }; -+static const char *bcm63xx_part_types[] = { "bcm63xxpart", "RedBoot", NULL }; - - static struct physmap_flash_data flash_data = { - .width = 2, ---- a/drivers/mtd/parsers/redboot.c -+++ b/drivers/mtd/parsers/redboot.c -@@ -85,6 +85,7 @@ static int parse_redboot_partitions(stru - int nulllen = 0; - int numslots; - unsigned long offset; -+ unsigned long fis_origin = 0; - #ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED - static char nullstring[] = "unallocated"; - #endif -@@ -190,6 +191,16 @@ nogood: - goto out; - } - -+ if (data && data->origin) { -+ fis_origin = data->origin; -+ } else { -+ for (i = 0; i < numslots; i++) { -+ if (!strncmp(buf[i].name, "RedBoot", 8)) { -+ fis_origin = (buf[i].flash_base & ((master->size << 1) - 1)); -+ } -+ } -+ } -+ - for (i = 0; i < numslots; i++) { - struct fis_list *new_fl, **prev; - -@@ -210,10 +221,10 @@ nogood: - goto out; - } - new_fl->img = &buf[i]; -- if (data && data->origin) -- buf[i].flash_base -= data->origin; -- else -- buf[i].flash_base &= master->size - 1; -+ if (fis_origin) -+ buf[i].flash_base -= fis_origin; -+ -+ buf[i].flash_base &= (master->size << 1) - 1; - - /* I'm sure the JFFS2 code has done me permanent damage. - * I now think the following is _normal_ diff --git a/target/linux/bcm63xx/patches-5.15/401-bcm963xx_real_rootfs_length.patch b/target/linux/bcm63xx/patches-5.15/401-bcm963xx_real_rootfs_length.patch deleted file mode 100644 index eccdf0d7c5d57c..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/401-bcm963xx_real_rootfs_length.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- a/include/linux/bcm963xx_tag.h -+++ b/include/linux/bcm963xx_tag.h -@@ -92,8 +92,10 @@ struct bcm_tag { - __u32 rootfs_crc; - /* 224-227: CRC32 of kernel partition */ - __u32 kernel_crc; -- /* 228-235: Unused at present */ -- char reserved1[8]; -+ /* 228-231: Unused at present */ -+ char reserved1[4]; -+ /* 222-235: Openwrt: real rootfs length */ -+ __u32 real_rootfs_length; - /* 236-239: CRC32 of header excluding last 20 bytes */ - __u32 header_crc; - /* 240-255: Unused at present */ ---- a/drivers/mtd/parsers/parser_imagetag.c -+++ b/drivers/mtd/parsers/parser_imagetag.c -@@ -136,7 +136,8 @@ static int bcm963xx_parse_imagetag_parti - } else { - /* OpenWrt layout */ - rootfsaddr = kerneladdr + kernellen; -- rootfslen = spareaddr - rootfsaddr; -+ rootfslen = buf->real_rootfs_length; -+ spareaddr = rootfsaddr + rootfslen; - } - } else { - goto out; diff --git a/target/linux/bcm63xx/patches-5.15/402_bcm63xx_enet_vlan_incoming_fixed.patch b/target/linux/bcm63xx/patches-5.15/402_bcm63xx_enet_vlan_incoming_fixed.patch deleted file mode 100644 index a034c97a96bd14..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/402_bcm63xx_enet_vlan_incoming_fixed.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c -+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c -@@ -1627,7 +1627,7 @@ static int bcm_enet_change_mtu(struct ne - return -EBUSY; - - /* add ethernet header + vlan tag size */ -- actual_mtu += VLAN_ETH_HLEN; -+ actual_mtu += VLAN_ETH_HLEN + VLAN_HLEN; - - /* - * setup maximum size before we get overflow mark in diff --git a/target/linux/bcm63xx/patches-5.15/403-6358-enet1-external-mii-clk.patch b/target/linux/bcm63xx/patches-5.15/403-6358-enet1-external-mii-clk.patch deleted file mode 100644 index efd9763a485ef9..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/403-6358-enet1-external-mii-clk.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_common.c -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -97,6 +97,8 @@ void __init board_early_setup(const stru - if (BCMCPU_IS_6348()) - val |= GPIO_MODE_6348_G3_EXT_MII | - GPIO_MODE_6348_G0_EXT_MII; -+ else if (BCMCPU_IS_6358()) -+ val |= GPIO_MODE_6358_ENET1_MII_CLK_INV; - } - - bcm_gpio_writel(val, GPIO_MODE_REG); ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -@@ -652,6 +652,8 @@ - #define GPIO_MODE_6358_EXTRA_SPI_SS (1 << 7) - #define GPIO_MODE_6358_SERIAL_LED (1 << 10) - #define GPIO_MODE_6358_UTOPIA (1 << 12) -+#define GPIO_MODE_6358_ENET1_MII_CLK_INV (1 << 30) -+#define GPIO_MODE_6358_ENET0_MII_CLK_INV (1 << 31) - - #define GPIO_MODE_6368_ANALOG_AFE_0 (1 << 0) - #define GPIO_MODE_6368_ANALOG_AFE_1 (1 << 1) diff --git a/target/linux/bcm63xx/patches-5.15/404-NET-bcm63xx_enet-move-phy_-dis-connect-into-probe-re.patch b/target/linux/bcm63xx/patches-5.15/404-NET-bcm63xx_enet-move-phy_-dis-connect-into-probe-re.patch deleted file mode 100644 index 9b66a442d7d3bd..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/404-NET-bcm63xx_enet-move-phy_-dis-connect-into-probe-re.patch +++ /dev/null @@ -1,247 +0,0 @@ -From 7fa63fdde703aaabaa7199ae879219737a98a3f3 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Fri, 6 Jan 2012 12:24:18 +0100 -Subject: [PATCH] NET: bcm63xx_enet: move phy_(dis)connect into probe/remove - -Only connect/disconnect the phy during probe and remove, not during any -open/close. The phy seldom changes during the runtime, and disconnecting -the phy during close will prevent it from keeping any configuration over -a down/up cycle. - -Signed-off-by: Jonas Gorski ---- - drivers/net/ethernet/broadcom/bcm63xx_enet.c | 158 +++++++++++++-------------- - 1 file changed, 78 insertions(+), 80 deletions(-) - ---- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c -+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c -@@ -892,10 +892,8 @@ static int bcm_enet_open(struct net_devi - struct bcm_enet_priv *priv; - struct sockaddr addr; - struct device *kdev; -- struct phy_device *phydev; - int i, ret; - unsigned int size; -- char phy_id[MII_BUS_ID_SIZE + 3]; - void *p; - u32 val; - -@@ -903,31 +901,10 @@ static int bcm_enet_open(struct net_devi - kdev = &priv->pdev->dev; - - if (priv->has_phy) { -- /* connect to PHY */ -- snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, -- priv->mii_bus->id, priv->phy_id); -- -- phydev = phy_connect(dev, phy_id, bcm_enet_adjust_phy_link, -- PHY_INTERFACE_MODE_MII); -- -- if (IS_ERR(phydev)) { -- dev_err(kdev, "could not attach to PHY\n"); -- return PTR_ERR(phydev); -- } -- -- /* mask with MAC supported features */ -- phy_support_sym_pause(phydev); -- phy_set_max_speed(phydev, SPEED_100); -- phy_set_sym_pause(phydev, priv->pause_rx, priv->pause_rx, -- priv->pause_auto); -- -- phy_attached_info(phydev); -- -+ /* Reset state */ - priv->old_link = 0; - priv->old_duplex = -1; - priv->old_pause = -1; -- } else { -- phydev = NULL; - } - - /* mask all interrupts and request them */ -@@ -937,7 +914,7 @@ static int bcm_enet_open(struct net_devi - - ret = request_irq(dev->irq, bcm_enet_isr_mac, 0, dev->name, dev); - if (ret) -- goto out_phy_disconnect; -+ return ret; - - ret = request_irq(priv->irq_rx, bcm_enet_isr_dma, 0, - dev->name, dev); -@@ -1099,8 +1076,8 @@ static int bcm_enet_open(struct net_devi - enet_dmac_writel(priv, priv->dma_chan_int_mask, - ENETDMAC_IRMASK, priv->tx_chan); - -- if (phydev) -- phy_start(phydev); -+ if (priv->has_phy) -+ phy_start(dev->phydev); - else - bcm_enet_adjust_link(dev); - -@@ -1130,10 +1107,6 @@ out_freeirq_rx: - out_freeirq: - free_irq(dev->irq, dev); - --out_phy_disconnect: -- if (phydev) -- phy_disconnect(phydev); -- - return ret; - } - -@@ -1226,10 +1199,6 @@ static int bcm_enet_stop(struct net_devi - free_irq(priv->irq_rx, dev); - free_irq(dev->irq, dev); - -- /* release phy */ -- if (priv->has_phy) -- phy_disconnect(dev->phydev); -- - /* reset BQL after forced tx reclaim to prevent kernel panic */ - netdev_reset_queue(dev); - -@@ -1797,14 +1766,47 @@ static int bcm_enet_probe(struct platfor - - /* do minimal hardware init to be able to probe mii bus */ - bcm_enet_hw_preinit(priv); -+ spin_lock_init(&priv->rx_lock); -+ -+ /* init rx timeout (used for oom) */ -+ timer_setup(&priv->rx_timeout, bcm_enet_refill_rx_timer, 0); -+ -+ /* init the mib update lock&work */ -+ mutex_init(&priv->mib_update_lock); -+ INIT_WORK(&priv->mib_update_task, bcm_enet_update_mib_counters_defer); -+ -+ /* zero mib counters */ -+ for (i = 0; i < ENET_MIB_REG_COUNT; i++) -+ enet_writel(priv, 0, ENET_MIB_REG(i)); -+ -+ /* register netdevice */ -+ dev->netdev_ops = &bcm_enet_ops; -+ netif_napi_add(dev, &priv->napi, bcm_enet_poll, 16); -+ -+ dev->ethtool_ops = &bcm_enet_ethtool_ops; -+ /* MTU range: 46 - 2028 */ -+ dev->min_mtu = ETH_ZLEN - ETH_HLEN; -+ dev->max_mtu = BCMENET_MAX_MTU - VLAN_ETH_HLEN; -+ SET_NETDEV_DEV(dev, &pdev->dev); -+ -+ ret = register_netdev(dev); -+ if (ret) -+ goto out_uninit_hw; -+ -+ netif_carrier_off(dev); -+ platform_set_drvdata(pdev, dev); -+ priv->pdev = pdev; -+ priv->net_dev = dev; - - /* MII bus registration */ - if (priv->has_phy) { -+ struct phy_device *phydev; -+ char phy_id[MII_BUS_ID_SIZE + 3]; - - priv->mii_bus = mdiobus_alloc(); - if (!priv->mii_bus) { - ret = -ENOMEM; -- goto out_uninit_hw; -+ goto out_unregister_netdev; - } - - bus = priv->mii_bus; -@@ -1828,6 +1830,26 @@ static int bcm_enet_probe(struct platfor - dev_err(&pdev->dev, "unable to register mdio bus\n"); - goto out_free_mdio; - } -+ -+ /* connect to PHY */ -+ snprintf(phy_id, sizeof(phy_id), PHY_ID_FMT, -+ priv->mii_bus->id, priv->phy_id); -+ -+ phydev = phy_connect(dev, phy_id, bcm_enet_adjust_phy_link, -+ PHY_INTERFACE_MODE_MII); -+ -+ if (IS_ERR(phydev)) { -+ dev_err(&pdev->dev, "could not attach to PHY\n"); -+ goto out_unregister_mdio; -+ } -+ -+ /* mask with MAC supported features */ -+ phy_support_sym_pause(phydev); -+ phy_set_max_speed(phydev, SPEED_100); -+ phy_set_sym_pause(phydev, priv->pause_rx, priv->pause_rx, -+ priv->pause_auto); -+ -+ phy_attached_info(phydev); - } else { - - /* run platform code to initialize PHY device */ -@@ -1835,45 +1857,16 @@ static int bcm_enet_probe(struct platfor - pd->mii_config(dev, 1, bcm_enet_mdio_read_mii, - bcm_enet_mdio_write_mii)) { - dev_err(&pdev->dev, "unable to configure mdio bus\n"); -- goto out_uninit_hw; -+ goto out_unregister_netdev; - } - } - -- spin_lock_init(&priv->rx_lock); -- -- /* init rx timeout (used for oom) */ -- timer_setup(&priv->rx_timeout, bcm_enet_refill_rx_timer, 0); -- -- /* init the mib update lock&work */ -- mutex_init(&priv->mib_update_lock); -- INIT_WORK(&priv->mib_update_task, bcm_enet_update_mib_counters_defer); -- -- /* zero mib counters */ -- for (i = 0; i < ENET_MIB_REG_COUNT; i++) -- enet_writel(priv, 0, ENET_MIB_REG(i)); -- -- /* register netdevice */ -- dev->netdev_ops = &bcm_enet_ops; -- netif_napi_add(dev, &priv->napi, bcm_enet_poll, 16); -- -- dev->ethtool_ops = &bcm_enet_ethtool_ops; -- /* MTU range: 46 - 2028 */ -- dev->min_mtu = ETH_ZLEN - ETH_HLEN; -- dev->max_mtu = BCMENET_MAX_MTU - VLAN_ETH_HLEN; -- SET_NETDEV_DEV(dev, &pdev->dev); -- -- ret = register_netdev(dev); -- if (ret) -- goto out_unregister_mdio; -- -- netif_carrier_off(dev); -- platform_set_drvdata(pdev, dev); -- priv->pdev = pdev; -- priv->net_dev = dev; -- - return 0; - - out_unregister_mdio: -+ if (dev->phydev) -+ phy_disconnect(dev->phydev); -+ - if (priv->mii_bus) - mdiobus_unregister(priv->mii_bus); - -@@ -1881,6 +1874,9 @@ out_free_mdio: - if (priv->mii_bus) - mdiobus_free(priv->mii_bus); - -+out_unregister_netdev: -+ unregister_netdev(dev); -+ - out_uninit_hw: - /* turn off mdc clock */ - enet_writel(priv, 0, ENET_MIISC_REG); -@@ -1911,6 +1907,7 @@ static int bcm_enet_remove(struct platfo - enet_writel(priv, 0, ENET_MIISC_REG); - - if (priv->has_phy) { -+ phy_disconnect(dev->phydev); - mdiobus_unregister(priv->mii_bus); - mdiobus_free(priv->mii_bus); - } else { diff --git a/target/linux/bcm63xx/patches-5.15/408-bcm63xx_enet-enable-rgmii-clock-on-external-ports.patch b/target/linux/bcm63xx/patches-5.15/408-bcm63xx_enet-enable-rgmii-clock-on-external-ports.patch deleted file mode 100644 index f2b0d70d4a64a5..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/408-bcm63xx_enet-enable-rgmii-clock-on-external-ports.patch +++ /dev/null @@ -1,53 +0,0 @@ -From d8237d704fc25eb2fc25ef4403608b78c6a6d4be Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 15 Jul 2012 20:08:57 +0200 -Subject: [PATCH 54/81] bcm63xx_enet: enable rgmii clock on external ports - ---- - arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h | 13 +++++++++++++ - drivers/net/ethernet/broadcom/bcm63xx_enet.c | 12 ++++++++++++ - 2 files changed, 25 insertions(+), 0 deletions(-) - ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -@@ -973,6 +973,19 @@ - #define ENETSW_PORTOV_FDX_MASK (1 << 1) - #define ENETSW_PORTOV_LINKUP_MASK (1 << 0) - -+/* Port RGMII control register */ -+#define ENETSW_RGMII_CTRL_REG(x) (0x60 + (x)) -+#define ENETSW_RGMII_CTRL_GMII_CLK_EN (1 << 7) -+#define ENETSW_RGMII_CTRL_MII_OVERRIDE_EN (1 << 6) -+#define ENETSW_RGMII_CTRL_MII_MODE_MASK (3 << 4) -+#define ENETSW_RGMII_CTRL_RGMII_MODE (0 << 4) -+#define ENETSW_RGMII_CTRL_MII_MODE (1 << 4) -+#define ENETSW_RGMII_CTRL_RVMII_MODE (2 << 4) -+#define ENETSW_RGMII_CTRL_TIMING_SEL_EN (1 << 0) -+ -+/* Port RGMII timing register */ -+#define ENETSW_RGMII_TIMING_REG(x) (0x68 + (x)) -+ - /* MDIO control register */ - #define ENETSW_MDIOC_REG (0xb0) - #define ENETSW_MDIOC_EXT_MASK (1 << 16) ---- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c -+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c -@@ -2180,6 +2180,18 @@ static int bcm_enetsw_open(struct net_de - priv->sw_port_link[i] = 0; - } - -+ /* enable external ports */ -+ for (i = ENETSW_RGMII_PORT0; i < priv->num_ports; i++) { -+ u8 rgmii_ctrl; -+ -+ if (!priv->used_ports[i].used) -+ continue; -+ -+ rgmii_ctrl = enetsw_readb(priv, ENETSW_RGMII_CTRL_REG(i)); -+ rgmii_ctrl |= ENETSW_RGMII_CTRL_GMII_CLK_EN; -+ enetsw_writeb(priv, rgmii_ctrl, ENETSW_RGMII_CTRL_REG(i)); -+ } -+ - /* reset mib */ - val = enetsw_readb(priv, ENETSW_GMCR_REG); - val |= ENETSW_GMCR_RST_MIB_MASK; diff --git a/target/linux/bcm63xx/patches-5.15/411-MIPS-BCM63XX-Register-SPI-flash-if-present.patch b/target/linux/bcm63xx/patches-5.15/411-MIPS-BCM63XX-Register-SPI-flash-if-present.patch deleted file mode 100644 index 364e7005338d2a..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/411-MIPS-BCM63XX-Register-SPI-flash-if-present.patch +++ /dev/null @@ -1,156 +0,0 @@ -From d135d94b3d1fe599d13e7198d5f502912d694c13 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 3 Jul 2011 15:00:38 +0200 -Subject: [PATCH 29/60] MIPS: BCM63XX: Register SPI flash if present - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/dev-flash.c | 35 +++++++++++++++++++- - arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h | 2 + - 2 files changed, 33 insertions(+), 2 deletions(-) - ---- a/arch/mips/bcm63xx/dev-flash.c -+++ b/arch/mips/bcm63xx/dev-flash.c -@@ -17,6 +17,9 @@ - #include - #include - #include -+#include -+#include -+#include - - #include - #include -@@ -66,6 +69,41 @@ void __init bcm63xx_flash_force_phys_bas - mtd_resources[0].end = end; - } - -+static struct spi_board_info bcm63xx_spi_flash_info[] = { -+ { -+ .bus_num = 0, -+ .chip_select = 0, -+ .mode = 0, -+ .max_speed_hz = 781000, -+ .modalias = "m25p80", -+ }, -+}; -+ -+static void bcm63xx_of_update_spi_flash_speed(struct device_node *np, -+ unsigned int new_hz) -+{ -+ struct property *max_hz; -+ __be32 *hz; -+ -+ max_hz = kzalloc(sizeof(*max_hz) + sizeof(*hz), GFP_KERNEL); -+ if (!max_hz) -+ return; -+ -+ max_hz->name = kstrdup("spi-max-frequency", GFP_KERNEL); -+ if (!max_hz->name) { -+ kfree(max_hz); -+ return; -+ } -+ -+ max_hz->value = max_hz + 1; -+ max_hz->length = sizeof(*hz); -+ -+ hz = max_hz->value; -+ *hz = cpu_to_be32(new_hz); -+ -+ of_update_property(np, max_hz); -+} -+ - static int __init bcm63xx_detect_flash_type(void) - { - u32 val; -@@ -73,9 +111,15 @@ static int __init bcm63xx_detect_flash_t - switch (bcm63xx_get_cpu_id()) { - case BCM6318_CPU_ID: - /* only support serial flash */ -+ bcm63xx_spi_flash_info[0].max_speed_hz = 62500000; - return BCM63XX_FLASH_TYPE_SERIAL; - case BCM6328_CPU_ID: - val = bcm_misc_readl(MISC_STRAPBUS_6328_REG); -+ if (val & STRAPBUS_6328_HSSPI_CLK_FAST) -+ bcm63xx_spi_flash_info[0].max_speed_hz = 33333334; -+ else -+ bcm63xx_spi_flash_info[0].max_speed_hz = 16666667; -+ - if (val & STRAPBUS_6328_BOOT_SEL_SERIAL) - return BCM63XX_FLASH_TYPE_SERIAL; - else -@@ -94,18 +138,31 @@ static int __init bcm63xx_detect_flash_t - return BCM63XX_FLASH_TYPE_SERIAL; - case BCM6362_CPU_ID: - val = bcm_misc_readl(MISC_STRAPBUS_6362_REG); -+ if (val & STRAPBUS_6362_HSSPI_CLK_FAST) -+ bcm63xx_spi_flash_info[0].max_speed_hz = 50000000; -+ else -+ bcm63xx_spi_flash_info[0].max_speed_hz = 20000000; -+ - if (val & STRAPBUS_6362_BOOT_SEL_SERIAL) - return BCM63XX_FLASH_TYPE_SERIAL; - else - return BCM63XX_FLASH_TYPE_NAND; - case BCM63268_CPU_ID: - val = bcm_misc_readl(MISC_STRAPBUS_63268_REG); -+ if (val & STRAPBUS_63268_HSSPI_CLK_FAST) -+ bcm63xx_spi_flash_info[0].max_speed_hz = 50000000; -+ else -+ bcm63xx_spi_flash_info[0].max_speed_hz = 20000000; -+ - if (val & STRAPBUS_63268_BOOT_SEL_SERIAL) - return BCM63XX_FLASH_TYPE_SERIAL; - else - return BCM63XX_FLASH_TYPE_NAND; - case BCM6368_CPU_ID: - val = bcm_gpio_readl(GPIO_STRAPBUS_REG); -+ if (val & STRAPBUS_6368_SPI_CLK_FAST) -+ bcm63xx_spi_flash_info[0].max_speed_hz = 20000000; -+ - switch (val & STRAPBUS_6368_BOOT_SEL_MASK) { - case STRAPBUS_6368_BOOT_SEL_NAND: - return BCM63XX_FLASH_TYPE_NAND; -@@ -177,6 +234,7 @@ void __init bcm63xx_flash_detect(void) - - int __init bcm63xx_flash_register(void) - { -+ struct device_node *np; - u32 val; - - switch (flash_type) { -@@ -196,8 +254,14 @@ int __init bcm63xx_flash_register(void) - - return platform_device_register(&mtd_dev); - case BCM63XX_FLASH_TYPE_SERIAL: -- pr_warn("unsupported serial flash detected\n"); -- return -ENODEV; -+ np = of_find_compatible_node(NULL, NULL, "jedec,spi-nor"); -+ if (np) { -+ bcm63xx_of_update_spi_flash_speed(np, bcm63xx_spi_flash_info[0].max_speed_hz); -+ of_node_put(np); -+ return 0; -+ } else { -+ return -ENODEV; -+ } - case BCM63XX_FLASH_TYPE_NAND: - pr_warn("unsupported NAND flash detected\n"); - return -ENODEV; ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -@@ -709,6 +709,7 @@ - #define GPIO_STRAPBUS_REG 0x40 - #define STRAPBUS_6358_BOOT_SEL_PARALLEL (1 << 1) - #define STRAPBUS_6358_BOOT_SEL_SERIAL (0 << 1) -+#define STRAPBUS_6368_SPI_CLK_FAST (1 << 6) - #define STRAPBUS_6368_BOOT_SEL_MASK 0x3 - #define STRAPBUS_6368_BOOT_SEL_NAND 0 - #define STRAPBUS_6368_BOOT_SEL_SERIAL 1 -@@ -1572,6 +1573,7 @@ - #define IDDQ_CTRL_63268_USBH (1 << 4) - - #define MISC_STRAPBUS_6328_REG 0x240 -+#define STRAPBUS_6328_HSSPI_CLK_FAST (1 << 4) - #define STRAPBUS_6328_FCVO_SHIFT 7 - #define STRAPBUS_6328_FCVO_MASK (0x1f << STRAPBUS_6328_FCVO_SHIFT) - #define STRAPBUS_6328_BOOT_SEL_SERIAL (1 << 18) diff --git a/target/linux/bcm63xx/patches-5.15/413-BCM63XX-allow-providing-fixup-data-in-board-data.patch b/target/linux/bcm63xx/patches-5.15/413-BCM63XX-allow-providing-fixup-data-in-board-data.patch deleted file mode 100644 index 16d47b4c58eedc..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/413-BCM63XX-allow-providing-fixup-data-in-board-data.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 8879e209111192c5e9752d7bd203cf7582693328 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Thu, 3 May 2012 14:40:03 +0200 -Subject: [PATCH 58/72] BCM63XX: allow providing fixup data in board data - ---- - arch/mips/bcm63xx/boards/board_bcm963xx.c | 9 ++++++++- - arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h | 10 ++++++++++ - 2 files changed, 18 insertions(+), 1 deletion(-) - ---- a/arch/mips/bcm63xx/boards/board_common.c -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -31,6 +31,7 @@ - #include - #include - #include -+#include - - #include "board_common.h" - -@@ -177,6 +178,7 @@ static struct of_device_id of_ids[] = { - int __init board_register_devices(void) - { - int usbh_ports = 0; -+ int i; - - #if CONFIG_OF - if (of_have_populated_dt()) { -@@ -241,6 +243,10 @@ int __init board_register_devices(void) - board.ephy_reset_gpio_flags); - } - -+ /* register any fixups */ -+ for (i = 0; i < board.has_caldata; i++) -+ pci_enable_ath9k_fixup(board.caldata[i].slot, board.caldata[i].caldata_offset); -+ - return 0; - } - ---- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h -+++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h -@@ -9,6 +9,7 @@ - #include - #include - #include -+#include - - /* - * flash mapping -@@ -16,6 +17,11 @@ - #define BCM963XX_CFE_VERSION_OFFSET 0x570 - #define BCM963XX_NVRAM_OFFSET 0x580 - -+struct ath9k_caldata { -+ unsigned int slot; -+ u32 caldata_offset; -+}; -+ - /* - * board definition - */ -@@ -33,6 +39,10 @@ struct board_info { - unsigned int has_ehci0:1; - unsigned int has_usbd:1; - unsigned int use_fallback_sprom:1; -+ unsigned int has_caldata:2; -+ -+ /* wifi calibration data config */ -+ struct ath9k_caldata caldata[2]; - - /* ethernet config */ - struct bcm63xx_enet_platform_data enet0; diff --git a/target/linux/bcm63xx/patches-5.15/415-MIPS-BCM63XX-export-the-attached-flash-type.patch b/target/linux/bcm63xx/patches-5.15/415-MIPS-BCM63XX-export-the-attached-flash-type.patch deleted file mode 100644 index 729430325aa66c..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/415-MIPS-BCM63XX-export-the-attached-flash-type.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 066f1e37742ee434496d32a41a9284458de96742 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Mon, 13 Jan 2014 12:12:30 +0100 -Subject: [PATCH] MIPS: BCM63XX: export the attached flash type - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/dev-flash.c | 5 +++++ - arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h | 2 ++ - 2 files changed, 7 insertions(+) - ---- a/arch/mips/bcm63xx/dev-flash.c -+++ b/arch/mips/bcm63xx/dev-flash.c -@@ -271,3 +271,8 @@ int __init bcm63xx_flash_register(void) - return -ENODEV; - } - } -+ -+int bcm63xx_flash_get_type(void) -+{ -+ return flash_type; -+} ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h -@@ -14,4 +14,6 @@ void bcm63xx_flash_force_phys_base_addre - - int __init bcm63xx_flash_register(void); - -+int bcm63xx_flash_get_type(void); -+ - #endif /* __BCM63XX_FLASH_H */ diff --git a/target/linux/bcm63xx/patches-5.15/416-BCM63XX-add-a-fixup-for-ath9k-devices.patch b/target/linux/bcm63xx/patches-5.15/416-BCM63XX-add-a-fixup-for-ath9k-devices.patch deleted file mode 100644 index b8d302f5ed4970..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/416-BCM63XX-add-a-fixup-for-ath9k-devices.patch +++ /dev/null @@ -1,242 +0,0 @@ -From bbebbf735a02b6d044ed928978ab4bd5f1833364 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Thu, 3 May 2012 14:36:11 +0200 -Subject: [PATCH 61/72] BCM63XX: add a fixup for ath9k devices - ---- - arch/mips/bcm63xx/Makefile | 3 +- - arch/mips/bcm63xx/pci-ath9k-fixup.c | 190 ++++++++++++++++++++ - .../include/asm/mach-bcm63xx/pci_ath9k_fixup.h | 7 + - 3 files changed, 199 insertions(+), 1 deletion(-) - create mode 100644 arch/mips/bcm63xx/pci-ath9k-fixup.c - create mode 100644 arch/mips/include/asm/mach-bcm63xx/pci_ath9k_fixup.h - ---- a/arch/mips/bcm63xx/Makefile -+++ b/arch/mips/bcm63xx/Makefile -@@ -3,7 +3,7 @@ obj-y += clk.o cpu.o cs.o gpio.o irq.o - setup.o timer.o dev-enet.o dev-flash.o dev-pcmcia.o \ - dev-rng.o dev-wdt.o \ - dev-usb-ehci.o dev-usb-ohci.o dev-usb-usbd.o usb-common.o \ -- sprom.o -+ pci-ath9k-fixup.o sprom.o - obj-$(CONFIG_EARLY_PRINTK) += early_printk.o - - obj-y += boards/ ---- /dev/null -+++ b/arch/mips/bcm63xx/pci-ath9k-fixup.c -@@ -0,0 +1,205 @@ -+/* -+ * Broadcom BCM63XX Ath9k EEPROM fixup helper. -+ * -+ * Copytight (C) 2012 Jonas Gorski -+ * -+ * Based on -+ * -+ * Atheros AP94 reference board PCI initialization -+ * -+ * Copyright (C) 2009-2010 Gabor Juhos -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published -+ * by the Free Software Foundation. -+ */ -+ -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define bcm_hsspi_writel(v, o) bcm_rset_writel(RSET_HSSPI, (v), (o)) -+ -+struct ath9k_fixup { -+ unsigned slot; -+ u8 mac[ETH_ALEN]; -+ struct ath9k_platform_data pdata; -+}; -+ -+static int ath9k_num_fixups; -+static struct ath9k_fixup ath9k_fixups[2] = { -+ { -+ .slot = 255, -+ .pdata = { -+ .led_pin = -1, -+ }, -+ }, -+ { -+ .slot = 255, -+ .pdata = { -+ .led_pin = -1, -+ }, -+ }, -+}; -+ -+static u16 *bcm63xx_read_eeprom(u16 *eeprom, u32 offset) -+{ -+ u32 addr; -+ -+ if (BCMCPU_IS_6328()) { -+ addr = 0x18000000; -+ } else { -+ addr = bcm_mpi_readl(MPI_CSBASE_REG(0)); -+ addr &= MPI_CSBASE_BASE_MASK; -+ } -+ -+ switch (bcm63xx_flash_get_type()) { -+ case BCM63XX_FLASH_TYPE_PARALLEL: -+ memcpy(eeprom, (void *)KSEG1ADDR(addr + offset), ATH9K_PLAT_EEP_MAX_WORDS * sizeof(u16)); -+ return eeprom; -+ case BCM63XX_FLASH_TYPE_SERIAL: -+ /* the first megabyte is memory mapped */ -+ if (offset < 0x100000) { -+ memcpy(eeprom, (void *)KSEG1ADDR(addr + offset), ATH9K_PLAT_EEP_MAX_WORDS * sizeof(u16)); -+ return eeprom; -+ } -+ -+ if (BCMCPU_IS_6328()) { -+ /* we can change the memory mapped megabyte */ -+ bcm_hsspi_writel(offset & 0xf00000, 0x18); -+ memcpy(eeprom, (void *)KSEG1ADDR(addr + (offset & 0xfffff)), ATH9K_PLAT_EEP_MAX_WORDS * sizeof(u16)); -+ bcm_hsspi_writel(0, 0x18); -+ return eeprom; -+ } -+ /* can't do anything here without talking to the SPI controller. */ -+ fallthrough; -+ case BCM63XX_FLASH_TYPE_NAND: -+ default: -+ return NULL; -+ } -+} -+ -+static void ath9k_pci_fixup(struct pci_dev *dev) -+{ -+ void __iomem *mem; -+ struct ath9k_platform_data *pdata = NULL; -+ struct pci_dev *bridge = pci_upstream_bridge(dev); -+ u16 *cal_data = NULL; -+ u16 cmd; -+ u32 bar0; -+ u32 val; -+ unsigned i; -+ int rc; -+ -+ for (i = 0; i < ath9k_num_fixups; i++) { -+ if (ath9k_fixups[i].slot != PCI_SLOT(dev->devfn)) -+ continue; -+ -+ cal_data = ath9k_fixups[i].pdata.eeprom_data; -+ pdata = &ath9k_fixups[i].pdata; -+ break; -+ } -+ -+ if (cal_data == NULL) -+ return; -+ -+ if (*cal_data != 0xa55a) { -+ pr_err("pci %s: invalid calibration data\n", pci_name(dev)); -+ return; -+ } -+ -+ pr_info("pci %s: fixup device configuration\n", pci_name(dev)); -+ -+ switch (bcm63xx_get_cpu_id()) { -+ case BCM6328_CPU_ID: -+ val = BCM_PCIE_MEM_BASE_PA_6328; -+ break; -+ case BCM6348_CPU_ID: -+ case BCM6358_CPU_ID: -+ case BCM6368_CPU_ID: -+ val = BCM_PCI_MEM_BASE_PA; -+ break; -+ default: -+ BUG(); -+ } -+ -+ mem = ioremap(val, 0x10000); -+ if (!mem) { -+ pr_err("pci %s: ioremap error\n", pci_name(dev)); -+ return; -+ } -+ -+ if (bridge) { -+ rc = pci_enable_device(bridge); -+ if (rc < 0) -+ pr_err("pci %s: bridge enable error\n", pci_name(dev)); -+ } -+ -+ pci_read_config_dword(dev, PCI_BASE_ADDRESS_0, &bar0); -+ pci_read_config_dword(dev, PCI_BASE_ADDRESS_0, &bar0); -+ pci_write_config_dword(dev, PCI_BASE_ADDRESS_0, val); -+ -+ pci_read_config_word(dev, PCI_COMMAND, &cmd); -+ cmd |= PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY; -+ pci_write_config_word(dev, PCI_COMMAND, cmd); -+ -+ /* set offset to first reg address */ -+ cal_data += 3; -+ while(*cal_data != 0xffff) { -+ u32 reg; -+ reg = *cal_data++; -+ val = *cal_data++; -+ val |= (*cal_data++) << 16; -+ -+ writel(val, mem + reg); -+ udelay(100); -+ } -+ -+ pci_read_config_dword(dev, PCI_VENDOR_ID, &val); -+ dev->vendor = val & 0xffff; -+ dev->device = (val >> 16) & 0xffff; -+ -+ pci_read_config_dword(dev, PCI_CLASS_REVISION, &val); -+ dev->revision = val & 0xff; -+ dev->class = val >> 8; /* upper 3 bytes */ -+ -+ pci_read_config_word(dev, PCI_COMMAND, &cmd); -+ cmd &= ~(PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY); -+ pci_write_config_word(dev, PCI_COMMAND, cmd); -+ -+ pci_write_config_dword(dev, PCI_BASE_ADDRESS_0, bar0); -+ -+ if (bridge) -+ pci_disable_device(bridge); -+ -+ iounmap(mem); -+ -+ dev->dev.platform_data = pdata; -+} -+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATHEROS, PCI_ANY_ID, ath9k_pci_fixup); -+ -+void __init pci_enable_ath9k_fixup(unsigned slot, u32 offset) -+{ -+ if (ath9k_num_fixups >= ARRAY_SIZE(ath9k_fixups)) -+ return; -+ -+ ath9k_fixups[ath9k_num_fixups].slot = slot; -+ -+ if (!bcm63xx_read_eeprom(ath9k_fixups[ath9k_num_fixups].pdata.eeprom_data, offset)) -+ return; -+ -+ if (bcm63xx_nvram_get_mac_address(ath9k_fixups[ath9k_num_fixups].mac)) -+ return; -+ -+ ath9k_fixups[ath9k_num_fixups].pdata.macaddr = ath9k_fixups[ath9k_num_fixups].mac; -+ ath9k_num_fixups++; -+} ---- /dev/null -+++ b/arch/mips/include/asm/mach-bcm63xx/pci_ath9k_fixup.h -@@ -0,0 +1,7 @@ -+#ifndef _PCI_ATH9K_FIXUP -+#define _PCI_ATH9K_FIXUP -+ -+ -+void pci_enable_ath9k_fixup(unsigned slot, u32 offset) __init; -+ -+#endif /* _PCI_ATH9K_FIXUP */ diff --git a/target/linux/bcm63xx/patches-5.15/420-BCM63XX-add-endian-check-for-ath9k.patch b/target/linux/bcm63xx/patches-5.15/420-BCM63XX-add-endian-check-for-ath9k.patch deleted file mode 100644 index ec45e32a12ad3b..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/420-BCM63XX-add-endian-check-for-ath9k.patch +++ /dev/null @@ -1,51 +0,0 @@ ---- a/arch/mips/include/asm/mach-bcm63xx/pci_ath9k_fixup.h -+++ b/arch/mips/include/asm/mach-bcm63xx/pci_ath9k_fixup.h -@@ -2,6 +2,7 @@ - #define _PCI_ATH9K_FIXUP - - --void pci_enable_ath9k_fixup(unsigned slot, u32 offset) __init; -+void pci_enable_ath9k_fixup(unsigned slot, u32 offset, -+ unsigned endian_check) __init; - - #endif /* _PCI_ATH9K_FIXUP */ ---- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h -+++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h -@@ -20,6 +20,7 @@ - struct ath9k_caldata { - unsigned int slot; - u32 caldata_offset; -+ unsigned int endian_check:1; - }; - - /* ---- a/arch/mips/bcm63xx/pci-ath9k-fixup.c -+++ b/arch/mips/bcm63xx/pci-ath9k-fixup.c -@@ -187,12 +187,14 @@ static void ath9k_pci_fixup(struct pci_d - } - DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATHEROS, PCI_ANY_ID, ath9k_pci_fixup); - --void __init pci_enable_ath9k_fixup(unsigned slot, u32 offset) -+void __init pci_enable_ath9k_fixup(unsigned slot, u32 offset, -+ unsigned endian_check) - { - if (ath9k_num_fixups >= ARRAY_SIZE(ath9k_fixups)) - return; - - ath9k_fixups[ath9k_num_fixups].slot = slot; -+ ath9k_fixups[ath9k_num_fixups].pdata.endian_check = endian_check; - - if (!bcm63xx_read_eeprom(ath9k_fixups[ath9k_num_fixups].pdata.eeprom_data, offset)) - return; ---- a/arch/mips/bcm63xx/boards/board_common.c -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -245,7 +245,8 @@ int __init board_register_devices(void) - - /* register any fixups */ - for (i = 0; i < board.has_caldata; i++) -- pci_enable_ath9k_fixup(board.caldata[i].slot, board.caldata[i].caldata_offset); -+ pci_enable_ath9k_fixup(board.caldata[i].slot, board.caldata[i].caldata_offset, -+ board.caldata[i].endian_check); - - return 0; - } diff --git a/target/linux/bcm63xx/patches-5.15/421-BCM63XX-add-led-pin-for-ath9k.patch b/target/linux/bcm63xx/patches-5.15/421-BCM63XX-add-led-pin-for-ath9k.patch deleted file mode 100644 index aab4553b8f00f5..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/421-BCM63XX-add-led-pin-for-ath9k.patch +++ /dev/null @@ -1,51 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_common.c -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -246,7 +246,7 @@ int __init board_register_devices(void) - /* register any fixups */ - for (i = 0; i < board.has_caldata; i++) - pci_enable_ath9k_fixup(board.caldata[i].slot, board.caldata[i].caldata_offset, -- board.caldata[i].endian_check); -+ board.caldata[i].endian_check, board.caldata[i].led_pin, board.caldata[i].led_active_high); - - return 0; - } ---- a/arch/mips/bcm63xx/pci-ath9k-fixup.c -+++ b/arch/mips/bcm63xx/pci-ath9k-fixup.c -@@ -188,13 +188,15 @@ static void ath9k_pci_fixup(struct pci_d - DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATHEROS, PCI_ANY_ID, ath9k_pci_fixup); - - void __init pci_enable_ath9k_fixup(unsigned slot, u32 offset, -- unsigned endian_check) -+ unsigned endian_check, int led_pin, bool led_active_high) - { - if (ath9k_num_fixups >= ARRAY_SIZE(ath9k_fixups)) - return; - - ath9k_fixups[ath9k_num_fixups].slot = slot; - ath9k_fixups[ath9k_num_fixups].pdata.endian_check = endian_check; -+ ath9k_fixups[ath9k_num_fixups].pdata.led_pin = led_pin; -+ ath9k_fixups[ath9k_num_fixups].pdata.led_active_high = led_active_high; - - if (!bcm63xx_read_eeprom(ath9k_fixups[ath9k_num_fixups].pdata.eeprom_data, offset)) - return; ---- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h -+++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h -@@ -21,6 +21,8 @@ struct ath9k_caldata { - unsigned int slot; - u32 caldata_offset; - unsigned int endian_check:1; -+ int led_pin; -+ bool led_active_high; - }; - - /* ---- a/arch/mips/include/asm/mach-bcm63xx/pci_ath9k_fixup.h -+++ b/arch/mips/include/asm/mach-bcm63xx/pci_ath9k_fixup.h -@@ -3,6 +3,6 @@ - - - void pci_enable_ath9k_fixup(unsigned slot, u32 offset, -- unsigned endian_check) __init; -+ unsigned endian_check, int led_pin, bool led_active_high) __init; - - #endif /* _PCI_ATH9K_FIXUP */ diff --git a/target/linux/bcm63xx/patches-5.15/422-BCM63XX-add-a-fixup-for-rt2x00-devices.patch b/target/linux/bcm63xx/patches-5.15/422-BCM63XX-add-a-fixup-for-rt2x00-devices.patch deleted file mode 100644 index cc980a14d45b42..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/422-BCM63XX-add-a-fixup-for-rt2x00-devices.patch +++ /dev/null @@ -1,185 +0,0 @@ -From 5ed5b5e9614fa5b02da699ab565af76c7e63d64d Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Mon, 7 Jan 2013 17:45:39 +0100 -Subject: [PATCH 72/72] 446-BCM63XX-add-a-fixup-for-rt2x00-devices - ---- - arch/mips/bcm63xx/Makefile | 2 +- - arch/mips/bcm63xx/boards/board_bcm963xx.c | 17 ++++- - arch/mips/bcm63xx/dev-flash.c | 2 +- - arch/mips/bcm63xx/pci-rt2x00-fixup.c | 71 ++++++++++++++++++++ - .../include/asm/mach-bcm63xx/bcm63xx_dev_flash.h | 2 +- - .../mips/include/asm/mach-bcm63xx/board_bcm963xx.h | 9 ++- - .../include/asm/mach-bcm63xx/pci_rt2x00_fixup.h | 9 +++ - 7 files changed, 104 insertions(+), 8 deletions(-) - create mode 100644 arch/mips/bcm63xx/pci-rt2x00-fixup.c - create mode 100644 arch/mips/include/asm/mach-bcm63xx/pci_rt2x00_fixup.h - ---- a/arch/mips/bcm63xx/Makefile -+++ b/arch/mips/bcm63xx/Makefile -@@ -3,7 +3,7 @@ obj-y += clk.o cpu.o cs.o gpio.o irq.o - setup.o timer.o dev-enet.o dev-flash.o dev-pcmcia.o \ - dev-rng.o dev-wdt.o \ - dev-usb-ehci.o dev-usb-ohci.o dev-usb-usbd.o usb-common.o \ -- pci-ath9k-fixup.o sprom.o -+ pci-ath9k-fixup.o pci-rt2x00-fixup.o sprom.o - obj-$(CONFIG_EARLY_PRINTK) += early_printk.o - - obj-y += boards/ ---- a/arch/mips/bcm63xx/boards/board_common.c -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -32,6 +32,7 @@ - #include - #include - #include -+#include - - #include "board_common.h" - -@@ -244,9 +245,19 @@ int __init board_register_devices(void) - } - - /* register any fixups */ -- for (i = 0; i < board.has_caldata; i++) -- pci_enable_ath9k_fixup(board.caldata[i].slot, board.caldata[i].caldata_offset, -- board.caldata[i].endian_check, board.caldata[i].led_pin, board.caldata[i].led_active_high); -+ for (i = 0; i < board.has_caldata; i++) { -+ switch (board.caldata[i].vendor) { -+ case PCI_VENDOR_ID_ATHEROS: -+ pci_enable_ath9k_fixup(board.caldata[i].slot, -+ board.caldata[i].caldata_offset, board.caldata[i].endian_check, -+ board.caldata[i].led_pin, board.caldata[i].led_active_high); -+ break; -+ case PCI_VENDOR_ID_RALINK: -+ pci_enable_rt2x00_fixup(board.caldata[i].slot, -+ board.caldata[i].eeprom); -+ break; -+ } -+ } - - return 0; - } ---- /dev/null -+++ b/arch/mips/bcm63xx/pci-rt2x00-fixup.c -@@ -0,0 +1,72 @@ -+/* -+ * Broadcom BCM63XX RT2x00 EEPROM fixup helper. -+ * -+ * Copyright (C) 2012 Álvaro Fernández Rojas -+ * -+ * Based on -+ * -+ * Broadcom BCM63XX Ath9k EEPROM fixup helper. -+ * -+ * Copyright (C) 2012 Jonas Gorski -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License version 2 as published -+ * by the Free Software Foundation. -+ */ -+ -+#include -+#include -+#include -+#include -+ -+#include -+#include -+ -+struct rt2x00_fixup { -+ unsigned slot; -+ u8 mac[ETH_ALEN]; -+ struct rt2x00_platform_data pdata; -+}; -+ -+static int rt2x00_num_fixups; -+static struct rt2x00_fixup rt2x00_fixups[2] = { -+ { -+ .slot = 255, -+ }, -+ { -+ .slot = 255, -+ }, -+}; -+ -+static void rt2x00_pci_fixup(struct pci_dev *dev) -+{ -+ unsigned i; -+ struct rt2x00_platform_data *pdata = NULL; -+ -+ for (i = 0; i < rt2x00_num_fixups; i++) { -+ if (rt2x00_fixups[i].slot != PCI_SLOT(dev->devfn)) -+ continue; -+ -+ pdata = &rt2x00_fixups[i].pdata; -+ break; -+ } -+ -+ dev->dev.platform_data = pdata; -+} -+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_RALINK, PCI_ANY_ID, rt2x00_pci_fixup); -+ -+void __init pci_enable_rt2x00_fixup(unsigned slot, char* eeprom) -+{ -+ if (rt2x00_num_fixups >= ARRAY_SIZE(rt2x00_fixups)) -+ return; -+ -+ rt2x00_fixups[rt2x00_num_fixups].slot = slot; -+ rt2x00_fixups[rt2x00_num_fixups].pdata.eeprom_file_name = kstrdup(eeprom, GFP_KERNEL); -+ -+ if (bcm63xx_nvram_get_mac_address(rt2x00_fixups[rt2x00_num_fixups].mac)) -+ return; -+ -+ rt2x00_fixups[rt2x00_num_fixups].pdata.mac_address = rt2x00_fixups[rt2x00_num_fixups].mac; -+ rt2x00_num_fixups++; -+} -+ ---- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h -+++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h -@@ -10,6 +10,7 @@ - #include - #include - #include -+#include - - /* - * flash mapping -@@ -17,12 +18,16 @@ - #define BCM963XX_CFE_VERSION_OFFSET 0x570 - #define BCM963XX_NVRAM_OFFSET 0x580 - --struct ath9k_caldata { -+struct bcm63xx_caldata { -+ unsigned int vendor; - unsigned int slot; - u32 caldata_offset; -+ /* Atheros */ - unsigned int endian_check:1; - int led_pin; - bool led_active_high; -+ /* Ralink */ -+ char* eeprom; - }; - - /* -@@ -45,7 +50,7 @@ struct board_info { - unsigned int has_caldata:2; - - /* wifi calibration data config */ -- struct ath9k_caldata caldata[2]; -+ struct bcm63xx_caldata caldata[2]; - - /* ethernet config */ - struct bcm63xx_enet_platform_data enet0; ---- /dev/null -+++ b/arch/mips/include/asm/mach-bcm63xx/pci_rt2x00_fixup.h -@@ -0,0 +1,9 @@ -+#ifndef _PCI_RT2X00_FIXUP -+#define _PCI_RT2X00_FIXUP -+ -+#define PCI_VENDOR_ID_RALINK 0x1814 -+ -+void pci_enable_rt2x00_fixup(unsigned slot, char* eeprom) __init; -+ -+#endif /* _PCI_RT2X00_FIXUP */ -+ diff --git a/target/linux/bcm63xx/patches-5.15/423-bcm63xx_enet_add_b53_support.patch b/target/linux/bcm63xx/patches-5.15/423-bcm63xx_enet_add_b53_support.patch deleted file mode 100644 index 86c9d3a75d468f..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/423-bcm63xx_enet_add_b53_support.patch +++ /dev/null @@ -1,169 +0,0 @@ ---- a/drivers/net/ethernet/broadcom/bcm63xx_enet.h -+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.h -@@ -338,6 +338,9 @@ struct bcm_enet_priv { - struct bcm63xx_enetsw_port used_ports[ENETSW_MAX_PORT]; - int sw_port_link[ENETSW_MAX_PORT]; - -+ /* platform device for associated switch */ -+ struct platform_device *b53_device; -+ - /* used to poll switch port state */ - struct timer_list swphy_poll; - spinlock_t enetsw_mdio_lock; ---- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c -+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c -@@ -17,6 +17,7 @@ - #include - #include - #include -+#include - - #include - #include "bcm63xx_enet.h" -@@ -1927,7 +1928,8 @@ static int bcm_enet_remove(struct platfo - return 0; - } - --struct platform_driver bcm63xx_enet_driver = { -+ -+static struct platform_driver bcm63xx_enet_driver = { - .probe = bcm_enet_probe, - .remove = bcm_enet_remove, - .driver = { -@@ -1936,6 +1938,42 @@ struct platform_driver bcm63xx_enet_driv - }, - }; - -+struct b53_platform_data bcm63xx_b53_pdata = { -+ .chip_id = 0x6300, -+ .big_endian = 1, -+}; -+ -+struct platform_device bcm63xx_b53_dev = { -+ .name = "b53-switch", -+ .id = -1, -+ .dev = { -+ .platform_data = &bcm63xx_b53_pdata, -+ }, -+}; -+ -+static int bcmenet_switch_register(struct bcm_enet_priv *priv, u16 port_mask) -+{ -+ int ret; -+ -+ bcm63xx_b53_pdata.regs = priv->base; -+ bcm63xx_b53_pdata.enabled_ports = port_mask; -+ bcm63xx_b53_pdata.alias = priv->net_dev->name; -+ -+ ret = platform_device_register(&bcm63xx_b53_dev); -+ if (!ret) -+ priv->b53_device = &bcm63xx_b53_dev; -+ -+ return ret; -+} -+ -+static void bcmenet_switch_unregister(struct bcm_enet_priv *priv) -+{ -+ if (priv->b53_device) -+ platform_device_unregister(&bcm63xx_b53_dev); -+ -+ priv->b53_device = NULL; -+} -+ - /* - * switch mii access callbacks - */ -@@ -2192,29 +2230,6 @@ static int bcm_enetsw_open(struct net_de - enetsw_writeb(priv, rgmii_ctrl, ENETSW_RGMII_CTRL_REG(i)); - } - -- /* reset mib */ -- val = enetsw_readb(priv, ENETSW_GMCR_REG); -- val |= ENETSW_GMCR_RST_MIB_MASK; -- enetsw_writeb(priv, val, ENETSW_GMCR_REG); -- mdelay(1); -- val &= ~ENETSW_GMCR_RST_MIB_MASK; -- enetsw_writeb(priv, val, ENETSW_GMCR_REG); -- mdelay(1); -- -- /* force CPU port state */ -- val = enetsw_readb(priv, ENETSW_IMPOV_REG); -- val |= ENETSW_IMPOV_FORCE_MASK | ENETSW_IMPOV_LINKUP_MASK; -- enetsw_writeb(priv, val, ENETSW_IMPOV_REG); -- -- /* enable switch forward engine */ -- val = enetsw_readb(priv, ENETSW_SWMODE_REG); -- val |= ENETSW_SWMODE_FWD_EN_MASK; -- enetsw_writeb(priv, val, ENETSW_SWMODE_REG); -- -- /* enable jumbo on all ports */ -- enetsw_writel(priv, 0x1ff, ENETSW_JMBCTL_PORT_REG); -- enetsw_writew(priv, 9728, ENETSW_JMBCTL_MAXSIZE_REG); -- - /* initialize flow control buffer allocation */ - enet_dma_writel(priv, ENETDMA_BUFALLOC_FORCE_MASK | 0, - ENETDMA_BUFALLOC_REG(priv->rx_chan)); -@@ -2648,6 +2663,9 @@ static int bcm_enetsw_probe(struct platf - struct bcm63xx_enetsw_platform_data *pd; - struct resource *res_mem; - int ret, irq_rx, irq_tx; -+ unsigned i, num_ports = 0; -+ u16 port_mask = BIT(8); -+ u8 val; - - if (!bcm_enet_shared_base[0]) - return -EPROBE_DEFER; -@@ -2727,6 +2745,43 @@ static int bcm_enetsw_probe(struct platf - priv->pdev = pdev; - priv->net_dev = dev; - -+ /* reset mib */ -+ val = enetsw_readb(priv, ENETSW_GMCR_REG); -+ val |= ENETSW_GMCR_RST_MIB_MASK; -+ enetsw_writeb(priv, val, ENETSW_GMCR_REG); -+ mdelay(1); -+ val &= ~ENETSW_GMCR_RST_MIB_MASK; -+ enetsw_writeb(priv, val, ENETSW_GMCR_REG); -+ mdelay(1); -+ -+ /* force CPU port state */ -+ val = enetsw_readb(priv, ENETSW_IMPOV_REG); -+ val |= ENETSW_IMPOV_FORCE_MASK | ENETSW_IMPOV_LINKUP_MASK; -+ enetsw_writeb(priv, val, ENETSW_IMPOV_REG); -+ -+ /* enable switch forward engine */ -+ val = enetsw_readb(priv, ENETSW_SWMODE_REG); -+ val |= ENETSW_SWMODE_FWD_EN_MASK; -+ enetsw_writeb(priv, val, ENETSW_SWMODE_REG); -+ -+ /* enable jumbo on all ports */ -+ enetsw_writel(priv, 0x1ff, ENETSW_JMBCTL_PORT_REG); -+ enetsw_writew(priv, 9728, ENETSW_JMBCTL_MAXSIZE_REG); -+ -+ for (i = 0; i < priv->num_ports; i++) { -+ struct bcm63xx_enetsw_port *port = &priv->used_ports[i]; -+ -+ if (!port->used) -+ continue; -+ -+ num_ports++; -+ port_mask |= BIT(i); -+ } -+ -+ /* only register if there is more than one external port */ -+ if (num_ports > 1) -+ bcmenet_switch_register(priv, port_mask); -+ - return 0; - - out_disable_clk: -@@ -2748,6 +2803,9 @@ static int bcm_enetsw_remove(struct plat - priv = netdev_priv(dev); - unregister_netdev(dev); - -+ /* remove switch */ -+ bcmenet_switch_unregister(priv); -+ - clk_disable_unprepare(priv->mac_clk); - - free_netdev(dev); diff --git a/target/linux/bcm63xx/patches-5.15/424-bcm63xx_enet_no_request_mem_region.patch b/target/linux/bcm63xx/patches-5.15/424-bcm63xx_enet_no_request_mem_region.patch deleted file mode 100644 index c0dcbc51822fad..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/424-bcm63xx_enet_no_request_mem_region.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c -+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c -@@ -2706,9 +2706,9 @@ static int bcm_enetsw_probe(struct platf - if (ret) - goto out; - -- priv->base = devm_ioremap_resource(&pdev->dev, res_mem); -- if (IS_ERR(priv->base)) { -- ret = PTR_ERR(priv->base); -+ priv->base = devm_ioremap(&pdev->dev, res_mem->start, resource_size(res_mem)); -+ if (priv->base == NULL) { -+ ret = -ENOMEM; - goto out; - } - diff --git a/target/linux/bcm63xx/patches-5.15/427-boards_probe_switch.patch b/target/linux/bcm63xx/patches-5.15/427-boards_probe_switch.patch deleted file mode 100644 index d7231f32b92880..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/427-boards_probe_switch.patch +++ /dev/null @@ -1,119 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -74,6 +74,8 @@ static struct board_info __initdata boar - - .has_enet0 = 1, - .enet0 = { -+ .has_phy = 1, -+ .phy_id = 0, - .force_speed_100 = 1, - .force_duplex_full = 1, - }, -@@ -85,6 +87,8 @@ static struct board_info __initdata boar - - .has_enet0 = 1, - .enet0 = { -+ .has_phy = 1, -+ .phy_id = 0, - .force_speed_100 = 1, - .force_duplex_full = 1, - }, -@@ -136,6 +140,8 @@ static struct board_info __initdata boar - - .has_enet1 = 1, - .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, - .force_speed_100 = 1, - .force_duplex_full = 1, - }, -@@ -158,6 +164,8 @@ static struct board_info __initdata boar - - .has_enet1 = 1, - .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, - .force_speed_100 = 1, - .force_duplex_full = 1, - }, -@@ -179,6 +187,8 @@ static struct board_info __initdata boar - - .has_enet1 = 1, - .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, - .force_speed_100 = 1, - .force_duplex_full = 1, - }, -@@ -201,6 +211,8 @@ static struct board_info __initdata boar - - .has_enet1 = 1, - .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, - .force_speed_100 = 1, - .force_duplex_full = 1, - }, -@@ -221,6 +233,8 @@ static struct board_info __initdata boar - - .has_enet1 = 1, - .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, - .force_speed_100 = 1, - .force_duplex_full = 1, - }, -@@ -242,6 +256,8 @@ static struct board_info __initdata boar - - .has_enet1 = 1, - .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, - .force_speed_100 = 1, - .force_duplex_full = 1, - }, -@@ -263,6 +279,8 @@ static struct board_info __initdata boar - - .has_enet1 = 1, - .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, - .force_speed_100 = 1, - .force_duplex_full = 1, - }, -@@ -291,6 +309,8 @@ static struct board_info __initdata boar - - .has_enet1 = 1, - .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, - .force_speed_100 = 1, - .force_duplex_full = 1, - }, -@@ -315,6 +335,8 @@ static struct board_info __initdata boar - - .has_enet1 = 1, - .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, - .force_speed_100 = 1, - .force_duplex_full = 1, - }, -@@ -336,6 +358,8 @@ static struct board_info __initdata boar - - .has_enet1 = 1, - .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, - .force_speed_100 = 1, - .force_duplex_full = 1, - }, -@@ -358,6 +382,8 @@ static struct board_info __initdata boar - - .has_enet1 = 1, - .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, - .force_speed_100 = 1, - .force_duplex_full = 1, - }, diff --git a/target/linux/bcm63xx/patches-5.15/428-bcm63xx_enet-rgmii-ctrl-fix.patch b/target/linux/bcm63xx/patches-5.15/428-bcm63xx_enet-rgmii-ctrl-fix.patch deleted file mode 100644 index 30fdf6f670c5b9..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/428-bcm63xx_enet-rgmii-ctrl-fix.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h -@@ -79,6 +79,9 @@ struct bcm63xx_enetsw_port { - int force_speed; - int force_duplex_full; - -+ int mii_override; -+ int timing_sel; -+ - const char *name; - }; - ---- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c -+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c -@@ -2227,6 +2227,10 @@ static int bcm_enetsw_open(struct net_de - - rgmii_ctrl = enetsw_readb(priv, ENETSW_RGMII_CTRL_REG(i)); - rgmii_ctrl |= ENETSW_RGMII_CTRL_GMII_CLK_EN; -+ if (priv->used_ports[i].mii_override) -+ rgmii_ctrl |= ENETSW_RGMII_CTRL_MII_OVERRIDE_EN; -+ if (priv->used_ports[i].timing_sel) -+ rgmii_ctrl |= ENETSW_RGMII_CTRL_TIMING_SEL_EN; - enetsw_writeb(priv, rgmii_ctrl, ENETSW_RGMII_CTRL_REG(i)); - } - diff --git a/target/linux/bcm63xx/patches-5.15/430-MIPS-BCM63XX-add-nand-clocks.patch b/target/linux/bcm63xx/patches-5.15/430-MIPS-BCM63XX-add-nand-clocks.patch deleted file mode 100644 index 432c2251761fe1..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/430-MIPS-BCM63XX-add-nand-clocks.patch +++ /dev/null @@ -1,50 +0,0 @@ ---- a/arch/mips/bcm63xx/clk.c -+++ b/arch/mips/bcm63xx/clk.c -@@ -452,6 +452,23 @@ static struct clk clk_pcie = { - }; - - /* -+ * NAND clock -+ */ -+static void nand_set(struct clk *clk, int enable) -+{ -+ if (BCMCPU_IS_6362()) -+ bcm_hwclock_set(CKCTL_6362_NAND_EN, enable); -+ else if (BCMCPU_IS_6368()) -+ bcm_hwclock_set(CKCTL_6368_NAND_EN, enable); -+ else if (BCMCPU_IS_63268()) -+ bcm_hwclock_set(CKCTL_63268_NAND_EN, enable); -+} -+ -+static struct clk clk_nand = { -+ .set = nand_set, -+}; -+ -+/* - * Internal peripheral clock - */ - static struct clk clk_periph = { -@@ -648,6 +665,7 @@ static struct clk_lookup bcm6362_clks[] - CLKDEV_INIT("bcm63xx-hsspi.0", "pll", &clk_hsspi_pll), - CLKDEV_INIT("10001000.spi", "pll", &clk_hsspi_pll), - /* gated clocks */ -+ CLKDEV_INIT(NULL, "nand", &clk_nand), - CLKDEV_INIT(NULL, "enetsw", &clk_enetsw), - CLKDEV_INIT(NULL, "usbh", &clk_usbh), - CLKDEV_INIT(NULL, "usbd", &clk_usbd), -@@ -665,6 +683,7 @@ static struct clk_lookup bcm6368_clks[] - CLKDEV_INIT("10000100.serial", "refclk", &clk_periph), - CLKDEV_INIT("10000120.serial", "refclk", &clk_periph), - /* gated clocks */ -+ CLKDEV_INIT(NULL, "nand", &clk_nand), - CLKDEV_INIT(NULL, "enetsw", &clk_enetsw), - CLKDEV_INIT(NULL, "usbh", &clk_usbh), - CLKDEV_INIT(NULL, "usbd", &clk_usbd), -@@ -683,6 +702,7 @@ static struct clk_lookup bcm63268_clks[] - CLKDEV_INIT("bcm63xx-hsspi.0", "pll", &clk_hsspi_pll), - CLKDEV_INIT("10001000.spi", "pll", &clk_hsspi_pll), - /* gated clocks */ -+ CLKDEV_INIT(NULL, "nand", &clk_nand), - CLKDEV_INIT(NULL, "enetsw", &clk_enetsw), - CLKDEV_INIT(NULL, "usbh", &clk_usbh), - CLKDEV_INIT(NULL, "usbd", &clk_usbd), diff --git a/target/linux/bcm63xx/patches-5.15/431-MIPS-BCM63XX-add-nand-rset.patch b/target/linux/bcm63xx/patches-5.15/431-MIPS-BCM63XX-add-nand-rset.patch deleted file mode 100644 index 75eea3a66c26e1..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/431-MIPS-BCM63XX-add-nand-rset.patch +++ /dev/null @@ -1,145 +0,0 @@ ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h -@@ -184,7 +184,8 @@ enum bcm63xx_regs_set { - RSET_PCMDMAC, - RSET_PCMDMAS, - RSET_RNG, -- RSET_MISC -+ RSET_MISC, -+ RSET_NAND - }; - - #define RSET_DSL_LMEM_SIZE (64 * 1024 * 4) -@@ -262,6 +263,7 @@ enum bcm63xx_regs_set { - #define BCM_3368_PCMDMAS_BASE (0xdeadbeef) - #define BCM_3368_RNG_BASE (0xdeadbeef) - #define BCM_3368_MISC_BASE (0xdeadbeef) -+#define BCM_3368_NAND_BASE (0xdeadbeef) - - /* - * 6318 register sets base address -@@ -309,6 +311,7 @@ enum bcm63xx_regs_set { - #define BCM_6318_PCMDMAS_BASE (0xdeadbeef) - #define BCM_6318_RNG_BASE (0xdeadbeef) - #define BCM_6318_MISC_BASE (0xb0000280) -+#define BCM_6318_NAND_BASE (0xdeadbeef) - #define BCM_6318_OTP_BASE (0xdeadbeef) - - #define BCM_6318_STRAP_BASE (0xb0000900) -@@ -359,6 +362,7 @@ enum bcm63xx_regs_set { - #define BCM_6328_PCMDMAS_BASE (0xdeadbeef) - #define BCM_6328_RNG_BASE (0xdeadbeef) - #define BCM_6328_MISC_BASE (0xb0001800) -+#define BCM_6328_NAND_BASE (0xb0000200) - #define BCM_6328_OTP_BASE (0xb0000600) - - /* -@@ -408,6 +412,7 @@ enum bcm63xx_regs_set { - #define BCM_6338_PCMDMAS_BASE (0xdeadbeef) - #define BCM_6338_RNG_BASE (0xdeadbeef) - #define BCM_6338_MISC_BASE (0xdeadbeef) -+#define BCM_6338_NAND_BASE (0xdeadbeef) - - /* - * 6345 register sets base address -@@ -456,6 +461,7 @@ enum bcm63xx_regs_set { - #define BCM_6345_PCMDMAS_BASE (0xdeadbeef) - #define BCM_6345_RNG_BASE (0xdeadbeef) - #define BCM_6345_MISC_BASE (0xdeadbeef) -+#define BCM_6345_NAND_BASE (0xdeadbeef) - - /* - * 6348 register sets base address -@@ -502,6 +508,7 @@ enum bcm63xx_regs_set { - #define BCM_6348_PCMDMAS_BASE (0xdeadbeef) - #define BCM_6348_RNG_BASE (0xdeadbeef) - #define BCM_6348_MISC_BASE (0xdeadbeef) -+#define BCM_6348_NAND_BASE (0xdeadbeef) - - /* - * 6358 register sets base address -@@ -548,7 +555,7 @@ enum bcm63xx_regs_set { - #define BCM_6358_PCMDMAS_BASE (0xfffe1a00) - #define BCM_6358_RNG_BASE (0xdeadbeef) - #define BCM_6358_MISC_BASE (0xdeadbeef) -- -+#define BCM_6358_NAND_BASE (0xdeadbeef) - - /* - * 6362 register sets base address -@@ -596,6 +603,7 @@ enum bcm63xx_regs_set { - #define BCM_6362_PCMDMAS_BASE (0xdeadbeef) - #define BCM_6362_RNG_BASE (0xdeadbeef) - #define BCM_6362_MISC_BASE (0xb0001800) -+#define BCM_6362_NAND_BASE (0xb0000200) - - #define BCM_6362_NAND_REG_BASE (0xb0000200) - #define BCM_6362_NAND_CACHE_BASE (0xb0000600) -@@ -651,6 +659,7 @@ enum bcm63xx_regs_set { - #define BCM_6368_PCMDMAS_BASE (0xb0005c00) - #define BCM_6368_RNG_BASE (0xb0004180) - #define BCM_6368_MISC_BASE (0xdeadbeef) -+#define BCM_6368_NAND_BASE (0xb0000200) - - /* - * 63268 register sets base address -@@ -698,6 +707,7 @@ enum bcm63xx_regs_set { - #define BCM_63268_PCMDMAS_BASE (0xdeadbeef) - #define BCM_63268_RNG_BASE (0xdeadbeef) - #define BCM_63268_MISC_BASE (0xb0001800) -+#define BCM_63268_NAND_BASE (0xb0000200) - - extern const unsigned long *bcm63xx_regs_base; - -@@ -743,6 +753,7 @@ extern const unsigned long *bcm63xx_regs - [RSET_PCMDMAS] = BCM_## __cpu ##_PCMDMAS_BASE, \ - [RSET_RNG] = BCM_## __cpu ##_RNG_BASE, \ - [RSET_MISC] = BCM_## __cpu ##_MISC_BASE, \ -+ [RSET_NAND] = BCM_## __cpu ##_NAND_BASE, \ - - - static inline unsigned long bcm63xx_regset_address(enum bcm63xx_regs_set set) ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_io.h -@@ -111,5 +111,7 @@ - #define bcm_ddr_writel(v, o) bcm_rset_writel(RSET_DDR, (v), (o)) - #define bcm_misc_readl(o) bcm_rset_readl(RSET_MISC, (o)) - #define bcm_misc_writel(v, o) bcm_rset_writel(RSET_MISC, (v), (o)) -+#define bcm_nand_readl(o) bcm_rset_readl(RSET_NAND, (o)) -+#define bcm_nand_writel(v, o) bcm_rset_writel(RSET_NAND, (v), (o)) - - #endif /* ! BCM63XX_IO_H_ */ ---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h -@@ -1695,4 +1695,31 @@ - #define OTP_USER_BITS_6328_REG(i) (0x20 + (i) * 4) - #define OTP_6328_REG3_TP1_DISABLED BIT(9) - -+/************************************************************************* -+ * _REG relative to RSET_NAND -+ *************************************************************************/ -+ -+#define NAND_CS_SEL_REG 0x14 -+#define NAND_CS_SEL_EBC_CS0_SEL (1 << 0) -+#define NAND_CS_SEL_EBC_CS1_SEL (1 << 1) -+#define NAND_CS_SEL_EBC_CS2_SEL (1 << 2) -+#define NAND_CS_SEL_EBC_CS3_SEL (1 << 3) -+#define NAND_CS_SEL_EBC_CS4_SEL (1 << 4) -+#define NAND_CS_SEL_EBC_CS5_SEL (1 << 5) -+#define NAND_CS_SEL_EBC_CS6_SEL (1 << 6) -+#define NAND_CS_SEL_EBC_CS7_SEL (1 << 7) -+#define NAND_CS_SEL_EBI_CS0_USES_NAND (1 << 8) -+#define NAND_CS_SEL_EBI_CS1_USES_NAND (1 << 9) -+#define NAND_CS_SEL_EBI_CS2_USES_NAND (1 << 10) -+#define NAND_CS_SEL_EBI_CS3_USES_NAND (1 << 11) -+#define NAND_CS_SEL_EBI_CS4_USES_NAND (1 << 12) -+#define NAND_CS_SEL_EBI_CS5_USES_NAND (1 << 13) -+#define NAND_CS_SEL_EBI_CS6_USES_NAND (1 << 14) -+#define NAND_CS_SEL_EBI_CS7_USES_NAND (1 << 15) -+#define NAND_CS_SEL_WR_PROT_BLK0 (1 << 28) -+#define NAND_CS_SEL_AUTO_DEV_ID (1 << 30) -+#define NAND_CS_SEL_CS_LOCK (1 << 31) -+ -+#define NAND_CS_XOR_REG 0x18 -+ - #endif /* BCM63XX_REGS_H_ */ diff --git a/target/linux/bcm63xx/patches-5.15/432-MIPS-BCM63XX-detect-nand-nvram.patch b/target/linux/bcm63xx/patches-5.15/432-MIPS-BCM63XX-detect-nand-nvram.patch deleted file mode 100644 index 5a2a5f2489a740..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/432-MIPS-BCM63XX-detect-nand-nvram.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- a/arch/mips/bcm63xx/dev-flash.c -+++ b/arch/mips/bcm63xx/dev-flash.c -@@ -229,6 +229,14 @@ void __init bcm63xx_flash_detect(void) - } - - bcm_rset_writel(RSET_HSSPI, val, HSSPI_FLASH_CTRL_REG); -+ } else if (flash_type == BCM63XX_FLASH_TYPE_NAND && -+ (BCMCPU_IS_6328() || BCMCPU_IS_6362() || BCMCPU_IS_6368() || -+ BCMCPU_IS_63268())) { -+ bcm_nand_writel(NAND_CS_SEL_AUTO_DEV_ID -+ | NAND_CS_SEL_EBI_CS0_USES_NAND -+ | NAND_CS_SEL_EBC_CS0_SEL, -+ NAND_CS_SEL_REG); -+ bcm_nand_writel(1, NAND_CS_XOR_REG); - } - } - diff --git a/target/linux/bcm63xx/patches-5.15/433-MIPS-BCM63XX-enable-nand-support.patch b/target/linux/bcm63xx/patches-5.15/433-MIPS-BCM63XX-enable-nand-support.patch deleted file mode 100644 index 7d63ee79830ceb..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/433-MIPS-BCM63XX-enable-nand-support.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- a/arch/mips/bcm63xx/dev-flash.c -+++ b/arch/mips/bcm63xx/dev-flash.c -@@ -271,8 +271,12 @@ int __init bcm63xx_flash_register(void) - return -ENODEV; - } - case BCM63XX_FLASH_TYPE_NAND: -- pr_warn("unsupported NAND flash detected\n"); -- return -ENODEV; -+ if (board_of_device_present("nflash")) { -+ return 0; -+ } else { -+ pr_warn("unsupported NAND flash detected\n"); -+ return -ENODEV; -+ } - default: - pr_err("flash detection failed for BCM%x: %d\n", - bcm63xx_get_cpu_id(), flash_type); diff --git a/target/linux/bcm63xx/patches-5.15/500-MIPS-BCM63XX-populate-the-compatible-to-board_info-l.patch b/target/linux/bcm63xx/patches-5.15/500-MIPS-BCM63XX-populate-the-compatible-to-board_info-l.patch deleted file mode 100644 index 7ef1200905306e..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/500-MIPS-BCM63XX-populate-the-compatible-to-board_info-l.patch +++ /dev/null @@ -1,69 +0,0 @@ -From e71eea9953c774dfadb754258824fb1888c279f4 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Fri, 21 Nov 2014 16:54:06 +0100 -Subject: [PATCH 47/48] MIPS: BCM63XX: populate the compatible to board_info - list - -Populate the compatible to board_info list to allow dtbs to be used -for known boards. - -Signed-off-by: Jonas Gorski ---- - arch/mips/bcm63xx/boards/board_bcm963xx.c | 34 +++++++++++++++++++++++++++++ - 1 file changed, 34 insertions(+) - ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -426,6 +426,52 @@ static const struct board_info __initcon - }; - - static struct of_device_id const bcm963xx_boards_dt[] = { -+#ifdef CONFIG_OF -+#ifdef CONFIG_BCM63XX_CPU_3368 -+ { .compatible = "netgear,cvg834g", .data = &board_cvg834g, }, -+#endif /* CONFIG_BCM63XX_CPU_3368 */ -+#ifdef CONFIG_BCM63XX_CPU_6318 -+#endif /* CONFIG_BCM63XX_CPU_6318 */ -+#ifdef CONFIG_BCM63XX_CPU_6328 -+ { .compatible = "brcm,bcm96328avng", .data = &board_96328avng, }, -+#endif /* CONFIG_BCM63XX_CPU_6328 */ -+#ifdef CONFIG_BCM63XX_CPU_6338 -+ { .compatible = "brcm,bcm96338gw", .data = &board_96338gw, }, -+ { .compatible = "brcm,bcm96338w", .data = &board_96338w, }, -+#endif /* CONFIG_BCM63XX_CPU_6338 */ -+#ifdef CONFIG_BCM63XX_CPU_6345 -+ { .compatible = "brcm,bcm96345gw2", .data = &board_96345gw2, }, -+#endif /* CONFIG_BCM63XX_CPU_6345 */ -+#ifdef CONFIG_BCM63XX_CPU_6348 -+ { .compatible = "belkin,f5d7633", .data = &board_96348gw_10, }, -+ { .compatible = "brcm,bcm96348r", .data = &board_96348r, }, -+ { .compatible = "brcm,bcm96348gw-10", .data = &board_96348gw_10, }, -+ { .compatible = "brcm,bcm96348gw-11", .data = &board_96348gw_11, }, -+ { .compatible = "brcm,bcm96348gw-a", .data = &board_96348gw_a, }, -+ { .compatible = "davolink,dv-201amr", .data = &board_DV201AMR, }, -+ { .compatible = "dynalink,rta1025w", .data = &board_rta1025w_16, }, -+ { .compatible = "netgear,dg834gt-pn", .data = &board_96348gw_10, }, -+ { .compatible = "sagem,fast-2404", .data = &board_FAST2404, }, -+ { .compatible = "tp-link,td-w8900gb", .data = &board_96348gw_11, }, -+ { .compatible = "usrobotics,usr9108", .data = &board_96348gw_a, }, -+#endif /* CONFIG_BCM63XX_CPU_6348 */ -+#ifdef CONFIG_BCM63XX_CPU_6358 -+ { .compatible = "alcatel,rg100a", .data = &board_96358vw2, }, -+ { .compatible = "brcm,bcm96358vw", .data = &board_96358vw, }, -+ { .compatible = "brcm,bcm96358vw2", .data = &board_96358vw2, }, -+ { .compatible = "d-link,dsl-2650u", .data = &board_96358vw2, }, -+ { .compatible = "pirelli,a226g", .data = &board_DWVS0, }, -+ { .compatible = "pirelli,a226m", .data = &board_DWVS0, }, -+ { .compatible = "pirelli,a226m-fwb", .data = &board_DWVS0, }, -+ { .compatible = "pirelli,agpf-s0", .data = &board_AGPFS0, }, -+#endif /* CONFIG_BCM63XX_CPU_6358 */ -+#ifdef CONFIG_BCM63XX_CPU_6362 -+#endif /* CONFIG_BCM63XX_CPU_6362 */ -+#ifdef CONFIG_BCM63XX_CPU_6368 -+#endif /* CONFIG_BCM63XX_CPU_6368 */ -+#ifdef CONFIG_BCM63XX_CPU_63268 -+#endif /* CONFIG_BCM63XX_CPU_63268 */ -+#endif /* CONFIG_OF */ - { }, - }; - diff --git a/target/linux/bcm63xx/patches-5.15/501-board_bcm6328-extend-96328avng-reference-board.patch b/target/linux/bcm63xx/patches-5.15/501-board_bcm6328-extend-96328avng-reference-board.patch deleted file mode 100644 index 7ff23276769370..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/501-board_bcm6328-extend-96328avng-reference-board.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -59,6 +59,32 @@ static struct board_info __initdata boar - .use_fullspeed = 0, - .port_no = 0, - }, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "Port 1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "Port 2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "Port 3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "Port 4", -+ }, -+ }, -+ }, - }; - #endif /* CONFIG_BCM63XX_CPU_6328 */ - diff --git a/target/linux/bcm63xx/patches-5.15/511-board_bcm6318.patch b/target/linux/bcm63xx/patches-5.15/511-board_bcm6318.patch deleted file mode 100644 index 5a9ac6f047cef2..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/511-board_bcm6318.patch +++ /dev/null @@ -1,292 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -44,6 +44,263 @@ static struct board_info __initdata boar - #endif /* CONFIG_BCM63XX_CPU_3368 */ - - /* -+ * known 6318 boards -+ */ -+#ifdef CONFIG_BCM63XX_CPU_6318 -+static struct board_info __initdata board_96318ref = { -+ .name = "96318REF", -+ .expected_cpu_id = 0x6318, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 1, -+ -+ .has_usbd = 1, -+ .usbd = { -+ .use_fullspeed = 0, -+ .port_no = 0, -+ }, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "Port 1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "Port 2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "Port 3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "Port 4", -+ }, -+ }, -+ }, -+}; -+ -+static struct board_info __initdata board_96318ref_p300 = { -+ .name = "96318REF_P300", -+ .expected_cpu_id = 0x6318, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 1, -+ -+ .has_usbd = 1, -+ .usbd = { -+ .use_fullspeed = 0, -+ .port_no = 0, -+ }, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "Port 1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "Port 2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "Port 3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "Port 4", -+ }, -+ }, -+ }, -+}; -+ -+static struct sprom_fixup __initdata ar5315u_fixups[] = { -+ { .offset = 6, .value = 0x1c00 }, -+ { .offset = 65, .value = 0x1255 }, -+ { .offset = 97, .value = 0xfe55 }, -+ { .offset = 98, .value = 0x171d }, -+ { .offset = 99, .value = 0xfa42 }, -+ { .offset = 113, .value = 0xfeb7 }, -+ { .offset = 114, .value = 0x18cd }, -+ { .offset = 115, .value = 0xfa4f }, -+ { .offset = 162, .value = 0x6444 }, -+ { .offset = 170, .value = 0x6444 }, -+ { .offset = 172, .value = 0x6444 }, -+}; -+ -+static struct board_info __initdata board_AR5315u = { -+ .name = "96318A-1441N1", -+ .expected_cpu_id = 0x6318, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 1, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "LAN4", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "LAN3", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "LAN2", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "LAN1", -+ }, -+ }, -+ }, -+ -+ .use_fallback_sprom = 1, -+ .fallback_sprom = { -+ .type = SPROM_BCM43217, -+ .pci_bus = 1, -+ .pci_dev = 0, -+ .board_fixups = ar5315u_fixups, -+ .num_board_fixups = ARRAY_SIZE(ar5315u_fixups), -+ }, -+}; -+ -+static struct sprom_fixup __initdata dsl2751b_e1_fixups[] = { -+ { .offset = 96, .value = 0x2046 }, -+ { .offset = 97, .value = 0xfe9d }, -+ { .offset = 98, .value = 0x1854 }, -+ { .offset = 99, .value = 0xfa59 }, -+ { .offset = 112, .value = 0x2046 }, -+ { .offset = 113, .value = 0xfe79 }, -+ { .offset = 114, .value = 0x17f5 }, -+ { .offset = 115, .value = 0xfa47 }, -+ { .offset = 161, .value = 0x2222 }, -+ { .offset = 162, .value = 0x2222 }, -+ { .offset = 169, .value = 0x2222 }, -+ { .offset = 170, .value = 0x2222 }, -+ { .offset = 171, .value = 0x5555 }, -+ { .offset = 172, .value = 0x5555 }, -+ { .offset = 173, .value = 0x4444 }, -+ { .offset = 174, .value = 0x4444 }, -+ { .offset = 175, .value = 0x5555 }, -+ { .offset = 176, .value = 0x5555 }, -+}; -+ -+static struct board_info __initdata board_dsl_2751b_d1 = { -+ .name = "AW5200B", -+ .expected_cpu_id = 0x6318, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 1, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "Port 1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "Port 2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "Port 3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "Port 4", -+ }, -+ }, -+ }, -+ -+ .use_fallback_sprom = 1, -+ .fallback_sprom = { -+ .type = SPROM_BCM43217, -+ .pci_bus = 1, -+ .pci_dev = 0, -+ .board_fixups = dsl2751b_e1_fixups, -+ .num_board_fixups = ARRAY_SIZE(dsl2751b_e1_fixups), -+ }, -+}; -+ -+static struct board_info __initdata board_FAST2704N = { -+ .name = "F@ST2704N", -+ .expected_cpu_id = 0x6318, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 1, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "Port 1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "Port 2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "Port 3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "Port 4", -+ }, -+ }, -+ }, -+ -+ .use_fallback_sprom = 1, -+ .fallback_sprom = { -+ .type = SPROM_BCM43217, -+ .pci_bus = 1, -+ .pci_dev = 0, -+ }, -+}; -+#endif /* CONFIG_BCM63XX_CPU_6318 */ -+ -+/* - * known 6328 boards - */ - #ifdef CONFIG_BCM63XX_CPU_6328 -@@ -423,6 +680,13 @@ static const struct board_info __initcon - #ifdef CONFIG_BCM63XX_CPU_3368 - &board_cvg834g, - #endif /* CONFIG_BCM63XX_CPU_3368 */ -+#ifdef CONFIG_BCM63XX_CPU_6318 -+ &board_96318ref, -+ &board_96318ref_p300, -+ &board_AR5315u, -+ &board_dsl_2751b_d1, -+ &board_FAST2704N, -+#endif /* CONFIG_BCM63XX_CPU_6318 */ - #ifdef CONFIG_BCM63XX_CPU_6328 - &board_96328avng, - #endif /* CONFIG_BCM63XX_CPU_6328 */ -@@ -457,6 +721,11 @@ static struct of_device_id const bcm963x - { .compatible = "netgear,cvg834g", .data = &board_cvg834g, }, - #endif /* CONFIG_BCM63XX_CPU_3368 */ - #ifdef CONFIG_BCM63XX_CPU_6318 -+ { .compatible = "brcm,bcm96318ref", .data = &board_96318ref, }, -+ { .compatible = "brcm,bcm96318ref-p300", .data = &board_96318ref_p300, }, -+ { .compatible = "comtrend,ar-5315u", .data = &board_AR5315u, }, -+ { .compatible = "d-link,dsl-275xb-d1", .data = &board_dsl_2751b_d1, }, -+ { .compatible = "sagem,fast-2704n", .data = &board_FAST2704N, }, - #endif /* CONFIG_BCM63XX_CPU_6318 */ - #ifdef CONFIG_BCM63XX_CPU_6328 - { .compatible = "brcm,bcm96328avng", .data = &board_96328avng, }, diff --git a/target/linux/bcm63xx/patches-5.15/512-board_bcm6328.patch b/target/linux/bcm63xx/patches-5.15/512-board_bcm6328.patch deleted file mode 100644 index 9a68484c5f48ad..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/512-board_bcm6328.patch +++ /dev/null @@ -1,699 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -343,6 +343,651 @@ static struct board_info __initdata boar - }, - }, - }; -+ -+static struct board_info __initdata board_963281TAN = { -+ .name = "963281TAN", -+ .expected_cpu_id = 0x6328, -+ -+ .has_pci = 1, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "Port 1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "Port 2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "Port 3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "Port 4", -+ }, -+ }, -+ }, -+}; -+ -+static struct board_info __initdata board_A4001N = { -+ .name = "96328dg2x2", -+ .expected_cpu_id = 0x6328, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 1, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "Port 1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "Port 2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "Port 3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "Port 4", -+ }, -+ }, -+ }, -+ -+ .use_fallback_sprom = 1, -+ .fallback_sprom = { -+ .type = SPROM_BCM43225, -+ .pci_bus = 1, -+ .pci_dev = 0, -+ }, -+}; -+ -+static struct board_info __initdata board_A4001N1 = { -+ .name = "963281T_TEF", -+ .expected_cpu_id = 0x6328, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 1, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "Port 1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "Port 2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "Port 3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "Port 4", -+ }, -+ }, -+ }, -+ -+ .use_fallback_sprom = 1, -+ .fallback_sprom = { -+ .type = SPROM_BCM43225, -+ .pci_bus = 1, -+ .pci_dev = 0, -+ }, -+}; -+ -+static struct sprom_fixup __initdata ad1018_fixups[] = { -+ { .offset = 6, .value = 0x1c00 }, -+ { .offset = 65, .value = 0x1256 }, -+ { .offset = 96, .value = 0x2046 }, -+ { .offset = 97, .value = 0xfe69 }, -+ { .offset = 98, .value = 0x1726 }, -+ { .offset = 99, .value = 0xfa5c }, -+ { .offset = 112, .value = 0x2046 }, -+ { .offset = 113, .value = 0xfea8 }, -+ { .offset = 114, .value = 0x1978 }, -+ { .offset = 115, .value = 0xfa26 }, -+ { .offset = 161, .value = 0x2222 }, -+ { .offset = 169, .value = 0x2222 }, -+ { .offset = 171, .value = 0x2222 }, -+ { .offset = 173, .value = 0x2222 }, -+ { .offset = 174, .value = 0x4444 }, -+ { .offset = 175, .value = 0x2222 }, -+ { .offset = 176, .value = 0x4444 }, -+}; -+ -+static struct board_info __initdata board_AD1018 = { -+ .name = "96328avngr", -+ .expected_cpu_id = 0x6328, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 1, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "FIBRE", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "LAN3", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "LAN2", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "LAN1", -+ }, -+ }, -+ }, -+ -+ .use_fallback_sprom = 1, -+ .fallback_sprom = { -+ .type = SPROM_BCM43217, -+ .pci_bus = 1, -+ .pci_dev = 0, -+ .board_fixups = ad1018_fixups, -+ .num_board_fixups = ARRAY_SIZE(ad1018_fixups), -+ }, -+}; -+ -+static struct sprom_fixup __initdata ar5381u_fixups[] = { -+ { .offset = 97, .value = 0xfee5 }, -+ { .offset = 98, .value = 0x157c }, -+ { .offset = 99, .value = 0xfae7 }, -+ { .offset = 113, .value = 0xfefa }, -+ { .offset = 114, .value = 0x15d6 }, -+ { .offset = 115, .value = 0xfaf8 }, -+}; -+ -+static struct board_info __initdata board_AR5381u = { -+ .name = "96328A-1241N", -+ .expected_cpu_id = 0x6328, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 1, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "Port 1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "Port 2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "Port 3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "Port 4", -+ }, -+ }, -+ }, -+ -+ .use_fallback_sprom = 1, -+ .fallback_sprom = { -+ .type = SPROM_BCM43225, -+ .pci_bus = 1, -+ .pci_dev = 0, -+ .board_fixups = ar5381u_fixups, -+ .num_board_fixups = ARRAY_SIZE(ar5381u_fixups), -+ }, -+}; -+ -+static struct sprom_fixup __initdata ar5387un_fixups[] = { -+ { .offset = 2, .value = 0x05bb }, -+ { .offset = 65, .value = 0x1204 }, -+ { .offset = 78, .value = 0x0303 }, -+ { .offset = 79, .value = 0x0202 }, -+ { .offset = 80, .value = 0xff02 }, -+ { .offset = 87, .value = 0x0315 }, -+ { .offset = 88, .value = 0x0315 }, -+ { .offset = 96, .value = 0x2048 }, -+ { .offset = 97, .value = 0xff11 }, -+ { .offset = 98, .value = 0x1567 }, -+ { .offset = 99, .value = 0xfb24 }, -+ { .offset = 100, .value = 0x3e3c }, -+ { .offset = 101, .value = 0x4038 }, -+ { .offset = 102, .value = 0xfe7f }, -+ { .offset = 103, .value = 0x1279 }, -+ { .offset = 112, .value = 0x2048 }, -+ { .offset = 113, .value = 0xff03 }, -+ { .offset = 114, .value = 0x154c }, -+ { .offset = 115, .value = 0xfb27 }, -+ { .offset = 116, .value = 0x3e3c }, -+ { .offset = 117, .value = 0x4038 }, -+ { .offset = 118, .value = 0xfe87 }, -+ { .offset = 119, .value = 0x1233 }, -+ { .offset = 203, .value = 0x2226 }, -+}; -+ -+static struct board_info __initdata board_AR5387un = { -+ .name = "96328A-1441N1", -+ .expected_cpu_id = 0x6328, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 1, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "Port 1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "Port 2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "Port 3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "Port 4", -+ }, -+ }, -+ }, -+ -+ .use_fallback_sprom = 1, -+ .fallback_sprom = { -+ .type = SPROM_BCM43225, -+ .pci_bus = 1, -+ .pci_dev = 0, -+ .board_fixups = ar5387un_fixups, -+ .num_board_fixups = ARRAY_SIZE(ar5387un_fixups), -+ }, -+}; -+ -+static struct board_info __initdata board_dsl_274xb_f1 = { -+ .name = "AW4339U", -+ .expected_cpu_id = 0x6328, -+ -+ .has_pci = 1, -+ -+ .has_caldata = 1, -+ .caldata = { -+ { -+ .vendor = PCI_VENDOR_ID_ATHEROS, -+ .caldata_offset = 0x7d1000, -+ .slot = 0, -+ .led_pin = -1, -+ .led_active_high = 1, -+ }, -+ }, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "Port 4", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "Port 3", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "Port 2", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "Port 1", -+ }, -+ }, -+ }, -+}; -+ -+static struct board_info __initdata board_FAST2704V2 = { -+ .name = "F@ST2704V2", -+ .expected_cpu_id = 0x6328, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .has_usbd = 1, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "Port 1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "Port 2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "Port 3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "Port 4", -+ }, -+ }, -+ }, -+}; -+ -+static struct board_info __initdata board_PDG_A4001N_A_000_1A1_AX = { -+ .name = "96328avng", -+ .expected_cpu_id = 0x6328, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 1, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "Port 1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "Port 2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "Port 3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "Port 4", -+ }, -+ }, -+ }, -+ -+ .use_fallback_sprom = 1, -+ .fallback_sprom = { -+ .type = SPROM_BCM43225, -+ .pci_bus = 1, -+ .pci_dev = 0, -+ }, -+}; -+ -+static struct board_info __initdata board_PDG_A4101N_A_000_1A1_AE = { -+ .name = "96328avngv", -+ .expected_cpu_id = 0x6328, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 1, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "Port 1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "Port 2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "Port 3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "Port 4", -+ }, -+ }, -+ }, -+ -+ .use_fallback_sprom = 1, -+ .fallback_sprom = { -+ .type = SPROM_BCM43225, -+ .pci_bus = 1, -+ .pci_dev = 0, -+ }, -+}; -+ -+static struct board_info __initdata board_R5010UNV2 = { -+ .name = "96328ang", -+ .expected_cpu_id = 0x6328, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 1, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "Port 1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "Port 2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "Port 3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "Port 4", -+ }, -+ }, -+ }, -+ -+ .use_fallback_sprom = 1, -+ .fallback_sprom = { -+ .type = SPROM_BCM43217, -+ .pci_bus = 1, -+ .pci_dev = 0, -+ }, -+}; -+ -+static struct board_info __initdata board_TG582N = { -+ .name = "DANT-1", -+ .expected_cpu_id = 0x6328, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 1, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "Port 1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "Port 2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "Port 3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "Port 4", -+ }, -+ }, -+ }, -+ -+ .use_fallback_sprom = 1, -+ .fallback_sprom = { -+ .type = SPROM_BCM43225, -+ .pci_bus = 1, -+ .pci_dev = 0, -+ }, -+}; -+ -+static struct board_info __initdata board_TG582N_TELECOM_ITALIA = { -+ .name = "DANT-V", -+ .expected_cpu_id = 0x6328, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 1, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "Port 1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "Port 2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "Port 3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "Port 4", -+ }, -+ }, -+ }, -+ -+ .use_fallback_sprom = 1, -+ .fallback_sprom = { -+ .type = SPROM_BCM43225, -+ .pci_bus = 1, -+ .pci_dev = 0, -+ }, -+}; -+ -+static struct board_info __initdata board_W3400V6 = { -+ .name = "96328ang", -+ .expected_cpu_id = 0x6328, -+ -+ .has_pci = 1, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "Port 1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "Port 2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "Port 3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "Port 4", -+ }, -+ }, -+ }, -+ -+ .use_fallback_sprom = 1, -+ .fallback_sprom = { -+ .type = SPROM_BCM4318, -+ .pci_bus = 1, -+ .pci_dev = 0, -+ }, -+}; - #endif /* CONFIG_BCM63XX_CPU_6328 */ - - /* -@@ -689,6 +1334,20 @@ static const struct board_info __initcon - #endif /* CONFIG_BCM63XX_CPU_6318 */ - #ifdef CONFIG_BCM63XX_CPU_6328 - &board_96328avng, -+ &board_963281TAN, -+ &board_A4001N, -+ &board_A4001N1, -+ &board_AD1018, -+ &board_AR5381u, -+ &board_AR5387un, -+ &board_dsl_274xb_f1, -+ &board_FAST2704V2, -+ &board_PDG_A4001N_A_000_1A1_AX, -+ &board_PDG_A4101N_A_000_1A1_AE, -+ &board_TG582N, -+ &board_TG582N_TELECOM_ITALIA, -+ &board_R5010UNV2, -+ &board_W3400V6, - #endif /* CONFIG_BCM63XX_CPU_6328 */ - #ifdef CONFIG_BCM63XX_CPU_6338 - &board_96338gw, -@@ -728,7 +1387,23 @@ static struct of_device_id const bcm963x - { .compatible = "sagem,fast-2704n", .data = &board_FAST2704N, }, - #endif /* CONFIG_BCM63XX_CPU_6318 */ - #ifdef CONFIG_BCM63XX_CPU_6328 -+ { .compatible = "adb,a4001n", .data = &board_A4001N, }, -+ { .compatible = "adb,a4001n1", .data = &board_A4001N1, }, -+ { .compatible = "adb,pdg-a4001n-a-000-1a1-ax", .data = &board_PDG_A4001N_A_000_1A1_AX, }, -+ { .compatible = "adb,pdg-a4101n-a-000-1a1-ae", .data = &board_PDG_A4101N_A_000_1A1_AE, }, - { .compatible = "brcm,bcm96328avng", .data = &board_96328avng, }, -+ { .compatible = "brcm,bcm963281tan", .data = &board_963281TAN, }, -+ { .compatible = "comtrend,ar-5381u", .data = &board_AR5381u, }, -+ { .compatible = "comtrend,ar-5387un", .data = &board_AR5387un, }, -+ { .compatible = "d-link,dsl-274xb-f1", .data = &board_dsl_274xb_f1, }, -+ { .compatible = "d-link,dsl-2750u-c1", .data = &board_A4001N, }, -+ { .compatible = "innacomm,w3400v6", .data = &board_W3400V6, }, -+ { .compatible = "nucom,r5010un-v2", .data = &board_R5010UNV2, }, -+ { .compatible = "sagem,fast-2704-v2", .data = &board_FAST2704V2, }, -+ { .compatible = "sercomm,ad1018", .data = &board_AD1018, }, -+ { .compatible = "sercomm,ad1018-nor", .data = &board_AD1018, }, -+ { .compatible = "technicolor,tg582n", .data = &board_TG582N, }, -+ { .compatible = "technicolor,tg582n-telecom-italia", .data = &board_TG582N_TELECOM_ITALIA, }, - #endif /* CONFIG_BCM63XX_CPU_6328 */ - #ifdef CONFIG_BCM63XX_CPU_6338 - { .compatible = "brcm,bcm96338gw", .data = &board_96338gw, }, diff --git a/target/linux/bcm63xx/patches-5.15/513-board-bcm6338.patch b/target/linux/bcm63xx/patches-5.15/513-board-bcm6338.patch deleted file mode 100644 index 407a8b39f2c687..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/513-board-bcm6338.patch +++ /dev/null @@ -1,53 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -1021,6 +1021,32 @@ static struct board_info __initdata boar - .force_duplex_full = 1, - }, - }; -+ -+static struct board_info __initdata board_96338w2_e7t = { -+ .name = "96338W2_E7T", -+ .expected_cpu_id = 0x6338, -+ -+ .has_enet0 = 1, -+ .enet0 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+}; -+ -+static struct board_info __initdata board_rta1320_16m = { -+ .name = "RTA1320_16M", -+ .expected_cpu_id = 0x6338, -+ -+ .has_enet0 = 1, -+ .enet0 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+}; - #endif /* CONFIG_BCM63XX_CPU_6338 */ - - /* -@@ -1352,6 +1378,8 @@ static const struct board_info __initcon - #ifdef CONFIG_BCM63XX_CPU_6338 - &board_96338gw, - &board_96338w, -+ &board_96338w2_e7t, -+ &board_rta1320_16m, - #endif /* CONFIG_BCM63XX_CPU_6338 */ - #ifdef CONFIG_BCM63XX_CPU_6345 - &board_96345gw2, -@@ -1408,6 +1436,8 @@ static struct of_device_id const bcm963x - #ifdef CONFIG_BCM63XX_CPU_6338 - { .compatible = "brcm,bcm96338gw", .data = &board_96338gw, }, - { .compatible = "brcm,bcm96338w", .data = &board_96338w, }, -+ { .compatible = "d-link,dsl-2640u", .data = &board_96338w2_e7t, }, -+ { .compatible = "dynalink,rta1320", .data = &board_rta1320_16m, }, - #endif /* CONFIG_BCM63XX_CPU_6338 */ - #ifdef CONFIG_BCM63XX_CPU_6345 - { .compatible = "brcm,bcm96345gw2", .data = &board_96345gw2, }, diff --git a/target/linux/bcm63xx/patches-5.15/514-board_bcm6345.patch b/target/linux/bcm63xx/patches-5.15/514-board_bcm6345.patch deleted file mode 100644 index df9f01d2362adf..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/514-board_bcm6345.patch +++ /dev/null @@ -1,39 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -1057,6 +1057,19 @@ static struct board_info __initdata boar - .name = "96345GW2", - .expected_cpu_id = 0x6345, - }; -+ -+static struct board_info __initdata board_rta770w = { -+ .name = "RTA770BW", -+ .expected_cpu_id = 0x6345, -+ -+ .has_enet0 = 1, -+ .enet0 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+}; - #endif /* CONFIG_BCM63XX_CPU_6345 */ - - /* -@@ -1383,6 +1396,7 @@ static const struct board_info __initcon - #endif /* CONFIG_BCM63XX_CPU_6338 */ - #ifdef CONFIG_BCM63XX_CPU_6345 - &board_96345gw2, -+ &board_rta770w, - #endif /* CONFIG_BCM63XX_CPU_6345 */ - #ifdef CONFIG_BCM63XX_CPU_6348 - &board_96348r, -@@ -1441,6 +1455,8 @@ static struct of_device_id const bcm963x - #endif /* CONFIG_BCM63XX_CPU_6338 */ - #ifdef CONFIG_BCM63XX_CPU_6345 - { .compatible = "brcm,bcm96345gw2", .data = &board_96345gw2, }, -+ { .compatible = "dynalink,rta770bw", .data = &board_rta770w, }, -+ { .compatible = "dynalink,rta770w", .data = &board_rta770w, }, - #endif /* CONFIG_BCM63XX_CPU_6345 */ - #ifdef CONFIG_BCM63XX_CPU_6348 - { .compatible = "belkin,f5d7633", .data = &board_96348gw_10, }, diff --git a/target/linux/bcm63xx/patches-5.15/515-board-bcm6348.patch b/target/linux/bcm63xx/patches-5.15/515-board-bcm6348.patch deleted file mode 100644 index ebe7e8b81f2dac..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/515-board-bcm6348.patch +++ /dev/null @@ -1,328 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -1252,6 +1252,275 @@ static struct board_info __initdata boar - .force_duplex_full = 1, - }, - }; -+ -+static struct board_info __initdata board_96348A_122 = { -+ .name = "96348A-122", -+ .expected_cpu_id = 0x6348, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ -+ .has_enet1 = 1, -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+ -+ .use_fallback_sprom = 1, -+ .fallback_sprom = { -+ .type = SPROM_BCM4318, -+ .pci_bus = 0, -+ .pci_dev = 1, -+ }, -+}; -+ -+static struct board_info __initdata board_96348_D4PW = { -+ .name = "D-4P-W", -+ .expected_cpu_id = 0x6348, -+ -+ .has_pci = 1, -+ -+ .has_enet1 = 1, -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+}; -+ -+static struct board_info __initdata board_96348gw_10_AR1004G = { -+ .name = "AR1004G", -+ .expected_cpu_id = 0x6348, -+ -+ .has_pci = 1, -+ -+ .has_enet1 = 1, -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+}; -+ -+static struct board_info __initdata board_96348sv = { -+ .name = "MAGIC", -+ .expected_cpu_id = 0x6348, -+ -+ .has_pccard = 1, -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ -+ .has_enet0 = 1, -+ .enet0 = { -+ .has_phy = 1, -+ .use_internal_phy = 1, -+ }, -+ -+ .has_enet1 = 1, -+ .enet1 = { -+ /* it has BP_ENET_EXTERNAL_PHY */ -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+}; -+ -+/* NetGear DG834G v4 */ -+static struct board_info __initdata board_96348W3 = { -+ .name = "96348W3", -+ .expected_cpu_id = 0x6348, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ -+ .has_enet1 = 1, -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+}; -+ -+static struct board_info __initdata board_CPVA502plus = { -+ .name = "CPVA502+", -+ .expected_cpu_id = 0x6348, -+ -+ .has_pci = 1, -+ .ephy_reset_gpio = 4, -+ .ephy_reset_gpio_flags = GPIO_ACTIVE_LOW, -+ -+ .has_enet0 = 1, -+ .enet0 = { -+ .has_phy = 1, -+ .use_internal_phy = 1, -+ }, -+ -+ .has_enet1 = 1, -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ }, -+ -+ .use_fallback_sprom = 1, -+ .fallback_sprom = { -+ .type = SPROM_BCM4318, -+ .pci_bus = 0, -+ .pci_dev = 1, -+ }, -+}; -+ -+static struct board_info __initdata board_ct536_ct5621 = { -+ .name = "CT536_CT5621", -+ .expected_cpu_id = 0x6348, -+ -+ .has_pccard = 1, -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ -+ .has_enet1 = 1, -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+ -+ .use_fallback_sprom = 1, -+ .fallback_sprom = { -+ .type = SPROM_BCM4318, -+ .pci_bus = 0, -+ .pci_dev = 1, -+ }, -+}; -+ -+static struct board_info __initdata board_FAST2604 = { -+ .name = "F@ST2604", -+ .expected_cpu_id = 0x6348, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ -+ .has_enet1 = 1, -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+}; -+ -+static struct board_info __initdata board_gw6000 = { -+ .name = "GW6000", -+ .expected_cpu_id = 0x6348, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ -+ .has_enet0 = 1, -+ .enet0 = { -+ .has_phy = 1, -+ .use_internal_phy = 1, -+ }, -+ -+ .has_enet1 = 1, -+ .enet1 = { -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+}; -+ -+static struct board_info __initdata board_gw6200 = { -+ .name = "GW6200", -+ .expected_cpu_id = 0x6348, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ -+ .has_enet0 = 1, -+ .enet0 = { -+ .has_phy = 1, -+ .use_internal_phy = 1, -+ }, -+ -+ .has_enet1 = 1, -+ .enet1 = { -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+}; -+ -+static struct sprom_fixup __initdata spw500v_fixups[] = { -+ { .offset = 46, .value = 0x3046 }, -+ { .offset = 47, .value = 0x15a7 }, -+ { .offset = 48, .value = 0xfa89 }, -+ { .offset = 49, .value = 0xfe79 }, -+ { .offset = 57, .value = 0x6a49 }, -+}; -+ -+static struct board_info __initdata board_spw500v = { -+ .name = "SPW500V", -+ .expected_cpu_id = 0x6348, -+ -+ .has_pci = 1, -+ -+ .has_enet0 = 1, -+ .enet0 = { -+ .has_phy = 1, -+ .use_internal_phy = 1, -+ }, -+ -+ .use_fallback_sprom = 1, -+ .fallback_sprom = { -+ .type = SPROM_BCM4318, -+ .pci_bus = 0, -+ .pci_dev = 1, -+ .board_fixups = spw500v_fixups, -+ .num_board_fixups = ARRAY_SIZE(spw500v_fixups), -+ }, -+}; -+ -+/* BT Voyager 2110 */ -+static struct board_info __initdata board_V2110 = { -+ .name = "V2110", -+ .expected_cpu_id = 0x6348, -+ -+ .has_pci = 1, -+ -+ .has_enet1 = 1, -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+}; -+ -+static struct board_info __initdata board_V2500V_BB = { -+ .name = "V2500V_BB", -+ .expected_cpu_id = 0x6348, -+ -+ .has_pci = 1, -+ -+ .has_enet0 = 1, -+ .enet0 = { -+ .has_phy = 1, -+ .use_internal_phy = 1, -+ }, -+ -+ .has_enet1 = 1, -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+}; - #endif /* CONFIG_BCM63XX_CPU_6348 */ - - /* -@@ -1407,6 +1676,19 @@ static const struct board_info __initcon - &board_DV201AMR, - &board_96348gw_a, - &board_rta1025w_16, -+ &board_96348A_122, -+ &board_96348_D4PW, -+ &board_96348gw_10_AR1004G, -+ &board_96348sv, -+ &board_96348W3, -+ &board_CPVA502plus, -+ &board_ct536_ct5621, -+ &board_FAST2604, -+ &board_gw6000, -+ &board_gw6200, -+ &board_spw500v, -+ &board_V2110, -+ &board_V2500V_BB, - #endif /* CONFIG_BCM63XX_CPU_6348 */ - #ifdef CONFIG_BCM63XX_CPU_6358 - &board_96358vw, -@@ -1459,15 +1741,29 @@ static struct of_device_id const bcm963x - { .compatible = "dynalink,rta770w", .data = &board_rta770w, }, - #endif /* CONFIG_BCM63XX_CPU_6345 */ - #ifdef CONFIG_BCM63XX_CPU_6348 -+ { .compatible = "asmax,ar-1004g", .data = &board_96348gw_10_AR1004G, }, - { .compatible = "belkin,f5d7633", .data = &board_96348gw_10, }, - { .compatible = "brcm,bcm96348r", .data = &board_96348r, }, - { .compatible = "brcm,bcm96348gw-10", .data = &board_96348gw_10, }, - { .compatible = "brcm,bcm96348gw-11", .data = &board_96348gw_11, }, - { .compatible = "brcm,bcm96348gw-a", .data = &board_96348gw_a, }, -+ { .compatible = "bt,voyager-2110", .data = &board_V2110, }, -+ { .compatible = "bt,voyager-2500v-bb", .data = &board_V2500V_BB, }, -+ { .compatible = "comtrend,ct-5365", .data = &board_96348A_122, }, -+ { .compatible = "comtrend,ct-536plus", .data = &board_ct536_ct5621, }, -+ { .compatible = "comtrend,ct-5621", .data = &board_ct536_ct5621, }, -+ { .compatible = "d-link,dsl-2640b-b", .data = &board_96348_D4PW, }, - { .compatible = "davolink,dv-201amr", .data = &board_DV201AMR, }, - { .compatible = "dynalink,rta1025w", .data = &board_rta1025w_16, }, - { .compatible = "netgear,dg834gt-pn", .data = &board_96348gw_10, }, -+ { .compatible = "netgear,dg834g-v4", .data = &board_96348W3, }, - { .compatible = "sagem,fast-2404", .data = &board_FAST2404, }, -+ { .compatible = "sagem,fast-2604", .data = &board_FAST2604, }, -+ { .compatible = "t-com,speedport-w-500v", .data = &board_spw500v, }, -+ { .compatible = "tecom,gw6000", .data = &board_gw6000, }, -+ { .compatible = "tecom,gw6200", .data = &board_gw6200, }, -+ { .compatible = "telsey,cpva502plus", .data = &board_CPVA502plus, }, -+ { .compatible = "telsey,magic", .data = &board_96348sv, }, - { .compatible = "tp-link,td-w8900gb", .data = &board_96348gw_11, }, - { .compatible = "usrobotics,usr9108", .data = &board_96348gw_a, }, - #endif /* CONFIG_BCM63XX_CPU_6348 */ diff --git a/target/linux/bcm63xx/patches-5.15/516-board-bcm6358.patch b/target/linux/bcm63xx/patches-5.15/516-board-bcm6358.patch deleted file mode 100644 index 50d7284cf719da..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/516-board-bcm6358.patch +++ /dev/null @@ -1,384 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -9,6 +9,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -1601,6 +1602,88 @@ static struct board_info __initdata boar - }, - }; - -+static struct board_info __initdata board_CPVA642 = { -+ .name = "CPVA642", -+ .expected_cpu_id = 0x6358, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ -+ .has_enet1 = 1, -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+}; -+ -+static struct board_info __initdata board_ct6373_1 = { -+ .name = "CT6373-1", -+ .expected_cpu_id = 0x6358, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ -+ .has_enet1 = 1, -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+ -+ .use_fallback_sprom = 1, -+ .fallback_sprom = { -+ .type = SPROM_BCM4318, -+ .pci_bus = 0, -+ .pci_dev = 1, -+ }, -+}; -+ -+/* D-Link DSL-274xB revison C2/C3 */ -+static struct board_info __initdata board_dsl_274xb_rev_c = { -+ .name = "AW4139", -+ .expected_cpu_id = 0x6358, -+ -+ .has_pci = 1, -+ -+ .has_enet1 = 1, -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+}; -+ -+/* D-Link DVA-G3810BN/TL */ -+static struct board_info __initdata board_DVAG3810BN = { -+ .name = "DVAG3810BN", -+ .expected_cpu_id = 0x6358, -+ -+ .has_pccard = 1, -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ -+ .has_enet0 = 1, -+ .enet0 = { -+ .has_phy = 1, -+ .use_internal_phy = 1, -+ }, -+ -+ .has_enet1 = 1, -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+}; -+ - static struct board_info __initdata board_DWVS0 = { - .name = "DWV-S0", - .expected_cpu_id = 0x6358, -@@ -1624,6 +1707,238 @@ static struct board_info __initdata boar - .force_duplex_full = 1, - }, - }; -+ -+static struct board_info __initdata board_homehub2a = { -+ .name = "HOMEHUB2A", -+ .expected_cpu_id = 0x6358, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 2, -+ -+ .has_enet1 = 1, -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+ -+ .use_fallback_sprom = 1, -+ .fallback_sprom = { -+ .type = SPROM_BCM4322, -+ .pci_bus = 0, -+ .pci_dev = 1, -+ }, -+}; -+ -+static struct board_info __initdata board_HW520 = { -+ .name = "HW6358GW_B", -+ .expected_cpu_id = 0x6358, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ -+ .has_enet0 = 1, -+ .enet0 = { -+ .has_phy = 1, -+ .use_internal_phy = 1, -+ }, -+ -+ .has_enet1 = 1, -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+ -+ .use_fallback_sprom = 1, -+ .fallback_sprom = { -+ .type = SPROM_BCM4318, -+ .pci_bus = 0, -+ .pci_dev = 1, -+ }, -+}; -+ -+static struct board_info __initdata board_HW553 = { -+ .name = "HW553", -+ .expected_cpu_id = 0x6358, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 2, -+ -+ .has_enet1 = 1, -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+ -+ .use_fallback_sprom = 1, -+ .fallback_sprom = { -+ .type = SPROM_BCM4318, -+ .pci_bus = 0, -+ .pci_dev = 1, -+ }, -+}; -+ -+static struct board_info __initdata board_HW556_A = { -+ .name = "HW556_A", -+ .expected_cpu_id = 0x6358, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 2, -+ -+ .has_caldata = 1, -+ .caldata = { -+ { -+ .vendor = PCI_VENDOR_ID_ATHEROS, -+ .caldata_offset = 0xf7e000, -+ .slot = 1, -+ .endian_check = 1, -+ .led_pin = 2, -+ .led_active_high = 1, -+ }, -+ }, -+ -+ .has_enet1 = 1, -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+}; -+ -+static struct board_info __initdata board_HW556_B = { -+ .name = "HW556_B", -+ .expected_cpu_id = 0x6358, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 2, -+ -+ .has_caldata = 1, -+ .caldata = { -+ { -+ .vendor = PCI_VENDOR_ID_ATHEROS, -+ .caldata_offset = 0xefe000, -+ .slot = 1, -+ .endian_check = 1, -+ .led_pin = 2, -+ .led_active_high = 1, -+ }, -+ }, -+ -+ .has_enet1 = 1, -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+}; -+ -+static struct board_info __initdata board_HW556_C = { -+ .name = "HW556_C", -+ .expected_cpu_id = 0x6358, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 2, -+ -+ .has_caldata = 1, -+ .caldata = { -+ { -+ .vendor = PCI_VENDOR_ID_RALINK, -+ .caldata_offset = 0xeffe00, -+ .slot = 1, -+ .eeprom = "rt2x00.eeprom", -+ }, -+ }, -+ -+ .has_enet1 = 1, -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+}; -+ -+static struct board_info __initdata board_nb4_ser_r0 = { -+ .name = "NB4-SER-r0", -+ .expected_cpu_id = 0x6358, -+ -+ .has_pccard = 1, -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 2, -+ -+ .has_enet0 = 1, -+ .enet0 = { -+ .has_phy = 1, -+ .use_internal_phy = 1, -+ }, -+ -+ .has_enet1 = 1, -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+}; -+ -+static struct board_info __initdata board_nb4_fxc_r1 = { -+ .name = "NB4-FXC-r1", -+ .expected_cpu_id = 0x6358, -+ -+ .has_pccard = 1, -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 2, -+ -+ .has_enet0 = 1, -+ .enet0 = { -+ .has_phy = 1, -+ .use_internal_phy = 1, -+ }, -+ -+ .has_enet1 = 1, -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 0, -+ .force_speed_100 = 1, -+ .force_duplex_full = 1, -+ }, -+}; -+ -+ /* T-Home Speedport W 303V Typ B */ -+static struct board_info __initdata board_spw303v = { -+ .name = "96358-502V", -+ .expected_cpu_id = 0x6358, -+ -+ .has_pci = 1, -+ -+ .has_enet0 = 1, -+ .enet0 = { -+ .has_phy = 1, -+ .use_internal_phy = 1, -+ }, -+}; - #endif /* CONFIG_BCM63XX_CPU_6358 */ - - /* -@@ -1694,7 +2009,20 @@ static const struct board_info __initcon - &board_96358vw, - &board_96358vw2, - &board_AGPFS0, -+ &board_CPVA642, -+ &board_ct6373_1, -+ &board_dsl_274xb_rev_c, -+ &board_DVAG3810BN, - &board_DWVS0, -+ &board_homehub2a, -+ &board_HW520, -+ &board_HW553, -+ &board_HW556_A, -+ &board_HW556_B, -+ &board_HW556_C, -+ &board_nb4_ser_r0, -+ &board_nb4_fxc_r1, -+ &board_spw303v, - #endif /* CONFIG_BCM63XX_CPU_6358 */ - }; - -@@ -1771,11 +2099,24 @@ static struct of_device_id const bcm963x - { .compatible = "alcatel,rg100a", .data = &board_96358vw2, }, - { .compatible = "brcm,bcm96358vw", .data = &board_96358vw, }, - { .compatible = "brcm,bcm96358vw2", .data = &board_96358vw2, }, -+ { .compatible = "bt,home-hub-2-a", .data = &board_homehub2a, }, -+ { .compatible = "comtrend,ct-6373", .data = &board_ct6373_1, }, - { .compatible = "d-link,dsl-2650u", .data = &board_96358vw2, }, -+ { .compatible = "d-link,dsl-274xb-c2", .data = &board_dsl_274xb_rev_c, }, -+ { .compatible = "d-link,dva-g3810bn-tl", .data = &board_DVAG3810BN, }, -+ { .compatible = "huawei,echolife-hg520v", .data = &board_HW520, }, -+ { .compatible = "huawei,echolife-hg553", .data = &board_HW553, }, -+ { .compatible = "huawei,echolife-hg556a-a", .data = &board_HW556_A, }, -+ { .compatible = "huawei,echolife-hg556a-b", .data = &board_HW556_B, }, -+ { .compatible = "huawei,echolife-hg556a-c", .data = &board_HW556_C, }, - { .compatible = "pirelli,a226g", .data = &board_DWVS0, }, - { .compatible = "pirelli,a226m", .data = &board_DWVS0, }, - { .compatible = "pirelli,a226m-fwb", .data = &board_DWVS0, }, - { .compatible = "pirelli,agpf-s0", .data = &board_AGPFS0, }, -+ { .compatible = "sfr,neufbox-4-sercomm-r0", .data = &board_nb4_ser_r0, }, -+ { .compatible = "sfr,neufbox-4-foxconn-r1", .data = &board_nb4_fxc_r1, }, -+ { .compatible = "t-com,speedport-w-303v", .data = &board_spw303v, }, -+ { .compatible = "telsey,cpva642", .data = &board_CPVA642, }, - #endif /* CONFIG_BCM63XX_CPU_6358 */ - #ifdef CONFIG_BCM63XX_CPU_6362 - #endif /* CONFIG_BCM63XX_CPU_6362 */ diff --git a/target/linux/bcm63xx/patches-5.15/517-board_bcm6362.patch b/target/linux/bcm63xx/patches-5.15/517-board_bcm6362.patch deleted file mode 100644 index 0c1da133e45ea0..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/517-board_bcm6362.patch +++ /dev/null @@ -1,144 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -1941,6 +1941,117 @@ static struct board_info __initdata boar - }; - #endif /* CONFIG_BCM63XX_CPU_6358 */ - -+#ifdef CONFIG_BCM63XX_CPU_6362 -+static struct board_info __initdata board_dgnd3700v2 = { -+ .name = "96362ADVN2xh", -+ .expected_cpu_id = 0x6362, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 2, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [4] = { -+ .used = 1, -+ .phy_id = 0xff, -+ .bypass_link = 1, -+ .force_speed = 1000, -+ .force_duplex_full = 1, -+ .name = "RGMII", -+ }, -+ }, -+ }, -+}; -+ -+static struct board_info __initdata board_fast2504n = { -+ .name = "F@ST2504n", -+ .expected_cpu_id = 0x6362, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "Port 1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "Port 2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "Port 3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "Port 4", -+ }, -+ }, -+ }, -+}; -+ -+static struct board_info __initdata board_hg253s_v2 = { -+ .name = "hg253s", -+ .expected_cpu_id = 0x6362, -+ -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 1, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [4] = { -+ .used = 1, -+ .phy_id = 0xff, -+ .bypass_link = 1, -+ .force_speed = 1000, -+ .force_duplex_full = 1, -+ .timing_sel = 1, -+ .name = "RGMII", -+ }, -+ -+ [5] = { -+ .used = 1, -+ .phy_id = 24, -+ .timing_sel = 1, -+ .name = "WAN", -+ }, -+ }, -+ }, -+}; -+ -+static struct board_info __initdata board_nb6 = { -+ .name = "NB6", -+ .expected_cpu_id = 0x6362, -+ -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 2, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [4] = { -+ .used = 1, -+ .phy_id = 0xff, -+ .bypass_link = 1, -+ .force_speed = 1000, -+ .force_duplex_full = 1, -+ .name = "RGMII", -+ }, -+ }, -+ }, -+}; -+#endif /* CONFIG_BCM63XX_CPU_6362 */ -+ - /* - * all boards - */ -@@ -2024,6 +2135,12 @@ static const struct board_info __initcon - &board_nb4_fxc_r1, - &board_spw303v, - #endif /* CONFIG_BCM63XX_CPU_6358 */ -+#ifdef CONFIG_BCM63XX_CPU_6362 -+ &board_dgnd3700v2, -+ &board_fast2504n, -+ &board_hg253s_v2, -+ &board_nb6, -+#endif /* CONFIG_BCM63XX_CPU_6362 */ - }; - - static struct of_device_id const bcm963xx_boards_dt[] = { -@@ -2119,6 +2236,10 @@ static struct of_device_id const bcm963x - { .compatible = "telsey,cpva642", .data = &board_CPVA642, }, - #endif /* CONFIG_BCM63XX_CPU_6358 */ - #ifdef CONFIG_BCM63XX_CPU_6362 -+ { .compatible = "huawei,hg253s-v2", .data = &board_hg253s_v2, }, -+ { .compatible = "netgear,dgnd3700-v2", .data = &board_dgnd3700v2, }, -+ { .compatible = "sagem,fast-2504n", .data = &board_fast2504n, }, -+ { .compatible = "sfr,neufbox-6-sercomm-r0", .data = &board_nb6, }, - #endif /* CONFIG_BCM63XX_CPU_6362 */ - #ifdef CONFIG_BCM63XX_CPU_6368 - #endif /* CONFIG_BCM63XX_CPU_6368 */ diff --git a/target/linux/bcm63xx/patches-5.15/518-board_bcm6368.patch b/target/linux/bcm63xx/patches-5.15/518-board_bcm6368.patch deleted file mode 100644 index 2088562a47d421..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/518-board_bcm6368.patch +++ /dev/null @@ -1,732 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -10,6 +10,8 @@ - #include - #include - #include -+#include -+#include - #include - #include - #include -@@ -2053,6 +2055,648 @@ static struct board_info __initdata boar - #endif /* CONFIG_BCM63XX_CPU_6362 */ - - /* -+ * known 6368 boards -+ */ -+#ifdef CONFIG_BCM63XX_CPU_6368 -+static struct board_info __initdata board_96368mvngr = { -+ .name = "96368MVNgr", -+ .expected_cpu_id = 0x6368, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "port1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "port2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "port3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "port4", -+ }, -+ }, -+ }, -+}; -+ -+static struct board_info __initdata board_96368mvwg = { -+ .name = "96368MVWG", -+ .expected_cpu_id = 0x6368, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ -+ .has_usbd = 1, -+ .usbd = { -+ .use_fullspeed = 0, -+ .port_no = 0, -+ }, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "port1", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "port2", -+ }, -+ [4] = { -+ .used = 1, -+ .phy_id = 0x12, -+ .name = "port0", -+ }, -+ [5] = { -+ .used = 1, -+ .phy_id = 0x11, -+ .name = "port3", -+ }, -+ }, -+ }, -+}; -+ -+static struct board_info __initdata board_AV4202N = { -+ .name = "96368_Swiss_S1", -+ .expected_cpu_id = 0x6368, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 2, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "port1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "port2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "port3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "port4", -+ }, -+ }, -+ }, -+ -+ .use_fallback_sprom = 1, -+ .fallback_sprom = { -+ .type = SPROM_BCM4322, -+ .pci_bus = 0, -+ .pci_dev = 1, -+ }, -+}; -+ -+static struct board_info __initdata board_DGND3700v1_3800B = { -+ .name = "U12L144T01", -+ .expected_cpu_id = 0x6368, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 2, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [5] = { -+ .used = 1, -+ .phy_id = 0xff, -+ .bypass_link = 1, -+ .force_speed = 1000, -+ .force_duplex_full = 1, -+ .name = "RGMII", -+ }, -+ }, -+ }, -+}; -+ -+static struct sprom_fixup __initdata EVG2000_fixups[] = { -+ { .offset = 219, .value = 0xec08 }, -+}; -+ -+static struct board_info __initdata board_EVG2000 = { -+ .name = "96369PVG", -+ .expected_cpu_id = 0x6368, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 2, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [5] = { -+ .used = 1, -+ .phy_id = 0xff, -+ .bypass_link = 1, -+ .force_speed = 1000, -+ .force_duplex_full = 1, -+ .name = "RGMII", -+ }, -+ }, -+ }, -+ -+ .use_fallback_sprom = 1, -+ .fallback_sprom = { -+ .type = SPROM_BCM4322, -+ .pci_bus = 0, -+ .pci_dev = 1, -+ .board_fixups = EVG2000_fixups, -+ .num_board_fixups = ARRAY_SIZE(EVG2000_fixups), -+ }, -+}; -+ -+static struct board_info __initdata board_HG622 = { -+ .name = "96368MVWG_hg622", -+ .expected_cpu_id = 0x6368, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 2, -+ -+ .has_caldata = 1, -+ .caldata = { -+ { -+ .vendor = PCI_VENDOR_ID_RALINK, -+ .caldata_offset = 0xfa0000, -+ .slot = 1, -+ .eeprom = "rt2x00.eeprom", -+ }, -+ }, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "port1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "port2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "port3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "port4", -+ }, -+ }, -+ }, -+}; -+ -+static struct board_info __initdata board_HG655b = { -+ .name = "HW65x", -+ .expected_cpu_id = 0x6368, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 2, -+ -+ .has_caldata = 1, -+ .caldata = { -+ { -+ .vendor = PCI_VENDOR_ID_RALINK, -+ .caldata_offset = 0x7c0000, -+ .slot = 1, -+ .eeprom = "rt2x00.eeprom", -+ }, -+ }, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "port1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "port2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "port3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "port4", -+ }, -+ }, -+ }, -+}; -+ -+static struct board_info __initdata board_P870HW51A_V2 = { -+ .name = "P870HW-51a_v2", -+ .expected_cpu_id = 0x6368, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "port1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "port2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "port3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "port4", -+ }, -+ }, -+ }, -+ -+ .use_fallback_sprom = 1, -+ .fallback_sprom = { -+ .type = SPROM_BCM4318, -+ .pci_bus = 0, -+ .pci_dev = 1, -+ }, -+}; -+ -+static struct board_info __initdata board_R1000H = { -+ .name = "R1000H", -+ .expected_cpu_id = 0x6368, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [5] = { -+ .used = 1, -+ .phy_id = 0xff, -+ .bypass_link = 1, -+ .force_speed = 1000, -+ .force_duplex_full = 1, -+ .name = "RGMII", -+ }, -+ }, -+ }, -+}; -+ -+static struct sprom_fixup __initdata vh4032n_fixups[] = { -+ { .offset = 2, .value = 0x04d2 }, -+ { .offset = 4, .value = 0x4350 }, -+ { .offset = 65, .value = 0x1300 }, -+ { .offset = 68, .value = 0x0402 }, -+ { .offset = 70, .value = 0x0090 }, -+ { .offset = 71, .value = 0x4c19 }, -+ { .offset = 72, .value = 0x2345 }, -+ { .offset = 87, .value = 0x0315 }, -+ { .offset = 88, .value = 0x0315 }, -+ { .offset = 96, .value = 0x2048 }, -+ { .offset = 97, .value = 0xfed7 }, -+ { .offset = 98, .value = 0x15a6 }, -+ { .offset = 99, .value = 0xfaee }, -+ { .offset = 100, .value = 0x3e3a }, -+ { .offset = 101, .value = 0x3a36 }, -+ { .offset = 102, .value = 0xff7f }, -+ { .offset = 103, .value = 0x11b9 }, -+ { .offset = 104, .value = 0xfc53 }, -+ { .offset = 105, .value = 0xffe6 }, -+ { .offset = 106, .value = 0xfdd2 }, -+ { .offset = 107, .value = 0xfe49 }, -+ { .offset = 108, .value = 0xff6a }, -+ { .offset = 109, .value = 0x136e }, -+ { .offset = 110, .value = 0xfbed }, -+ { .offset = 111, .value = 0x0000 }, -+ { .offset = 112, .value = 0x2048 }, -+ { .offset = 113, .value = 0xfee2 }, -+ { .offset = 114, .value = 0x15e5 }, -+ { .offset = 115, .value = 0xfaed }, -+ { .offset = 116, .value = 0x3e3a }, -+ { .offset = 117, .value = 0x3a36 }, -+ { .offset = 118, .value = 0xffc8 }, -+ { .offset = 119, .value = 0x12b8 }, -+ { .offset = 120, .value = 0xfca1 }, -+ { .offset = 121, .value = 0xff9b }, -+ { .offset = 122, .value = 0x122a }, -+ { .offset = 123, .value = 0xfcc8 }, -+ { .offset = 124, .value = 0xff95 }, -+ { .offset = 125, .value = 0x146b }, -+ { .offset = 126, .value = 0xfbba }, -+ { .offset = 127, .value = 0x0000 }, -+ { .offset = 161, .value = 0x0000 }, -+ { .offset = 162, .value = 0x0000 }, -+ { .offset = 169, .value = 0x0000 }, -+ { .offset = 170, .value = 0x0000 }, -+ { .offset = 171, .value = 0x0000 }, -+ { .offset = 172, .value = 0x0000 }, -+ { .offset = 173, .value = 0x0000 }, -+ { .offset = 174, .value = 0x0000 }, -+ { .offset = 175, .value = 0x0000 }, -+ { .offset = 176, .value = 0x0000 }, -+ { .offset = 219, .value = 0x1108 }, -+}; -+ -+static struct board_info __initdata board_VH4032N = { -+ .name = "VH4032N", -+ .expected_cpu_id = 0x6368, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 2, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "LAN4", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "LAN3", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "LAN2", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "LAN1", -+ }, -+ }, -+ }, -+ -+ .use_fallback_sprom = 1, -+ .fallback_sprom = { -+ .type = SPROM_BCM43222, -+ .pci_bus = 0, -+ .pci_dev = 1, -+ .board_fixups = vh4032n_fixups, -+ .num_board_fixups = ARRAY_SIZE(vh4032n_fixups), -+ }, -+}; -+ -+static struct sprom_fixup __initdata vr3025u_fixups[] = { -+ { .offset = 97, .value = 0xfeb3 }, -+ { .offset = 98, .value = 0x1618 }, -+ { .offset = 99, .value = 0xfab0 }, -+ { .offset = 113, .value = 0xfed1 }, -+ { .offset = 114, .value = 0x1609 }, -+ { .offset = 115, .value = 0xfad9 }, -+}; -+ -+static struct board_info __initdata board_VR3025u = { -+ .name = "96368M-1541N", -+ .expected_cpu_id = 0x6368, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "port1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "port2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "port3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "port4", -+ }, -+ }, -+ }, -+ -+ .use_fallback_sprom = 1, -+ .fallback_sprom = { -+ .type = SPROM_BCM43222, -+ .pci_bus = 0, -+ .pci_dev = 1, -+ .board_fixups = vr3025u_fixups, -+ .num_board_fixups = ARRAY_SIZE(vr3025u_fixups), -+ }, -+}; -+ -+static struct sprom_fixup __initdata vr3025un_fixups[] = { -+ { .offset = 97, .value = 0xfeb3 }, -+ { .offset = 98, .value = 0x1618 }, -+ { .offset = 99, .value = 0xfab0 }, -+ { .offset = 113, .value = 0xfed1 }, -+ { .offset = 114, .value = 0x1609 }, -+ { .offset = 115, .value = 0xfad9 }, -+}; -+ -+static struct board_info __initdata board_VR3025un = { -+ .name = "96368M-1341N", -+ .expected_cpu_id = 0x6368, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "port1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "port2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "port3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "port4", -+ }, -+ }, -+ }, -+ -+ .use_fallback_sprom = 1, -+ .fallback_sprom = { -+ .type = SPROM_BCM43222, -+ .pci_bus = 0, -+ .pci_dev = 1, -+ .board_fixups = vr3025un_fixups, -+ .num_board_fixups = ARRAY_SIZE(vr3025un_fixups), -+ }, -+}; -+ -+static struct sprom_fixup __initdata vr3026e_fixups[] = { -+ { .offset = 97, .value = 0xfeb3 }, -+ { .offset = 98, .value = 0x1618 }, -+ { .offset = 99, .value = 0xfab0 }, -+ { .offset = 113, .value = 0xfed1 }, -+ { .offset = 114, .value = 0x1609 }, -+ { .offset = 115, .value = 0xfad9 }, -+}; -+ -+static struct board_info __initdata board_VR3026e = { -+ .name = "96368MT-1341N1", -+ .expected_cpu_id = 0x6368, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "port1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "port2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "port3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "port4", -+ }, -+ }, -+ }, -+ -+ .use_fallback_sprom = 1, -+ .fallback_sprom = { -+ .type = SPROM_BCM43222, -+ .pci_bus = 0, -+ .pci_dev = 1, -+ .board_fixups = vr3026e_fixups, -+ .num_board_fixups = ARRAY_SIZE(vr3026e_fixups), -+ }, -+}; -+ -+static struct sprom_fixup __initdata wap5813n_fixups[] = { -+ { .offset = 97, .value = 0xfeed }, -+ { .offset = 98, .value = 0x15d1 }, -+ { .offset = 99, .value = 0xfb0d }, -+ { .offset = 113, .value = 0xfef7 }, -+ { .offset = 114, .value = 0x15f7 }, -+ { .offset = 115, .value = 0xfb1a }, -+}; -+ -+static struct board_info __initdata board_WAP5813n = { -+ .name = "96369R-1231N", -+ .expected_cpu_id = 0x6368, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [4] = { -+ .used = 1, -+ .phy_id = 0xff, -+ .bypass_link = 1, -+ .force_speed = 1000, -+ .force_duplex_full = 1, -+ .name = "RGMII", -+ }, -+ }, -+ }, -+ -+ .use_fallback_sprom = 1, -+ .fallback_sprom = { -+ .type = SPROM_BCM43222, -+ .pci_bus = 0, -+ .pci_dev = 1, -+ .board_fixups = wap5813n_fixups, -+ .num_board_fixups = ARRAY_SIZE(wap5813n_fixups), -+ }, -+}; -+#endif /* CONFIG_BCM63XX_CPU_6368 */ -+ -+/* - * all boards - */ - static const struct board_info __initconst *bcm963xx_boards[] = { -@@ -2141,6 +2785,22 @@ static const struct board_info __initcon - &board_hg253s_v2, - &board_nb6, - #endif /* CONFIG_BCM63XX_CPU_6362 */ -+#ifdef CONFIG_BCM63XX_CPU_6368 -+ &board_96368mvngr, -+ &board_96368mvwg, -+ &board_AV4202N, -+ &board_DGND3700v1_3800B, -+ &board_EVG2000, -+ &board_HG622, -+ &board_HG655b, -+ &board_P870HW51A_V2, -+ &board_R1000H, -+ &board_VH4032N, -+ &board_VR3025u, -+ &board_VR3025un, -+ &board_VR3026e, -+ &board_WAP5813n, -+#endif /* CONFIG_BCM63XX_CPU_6368 */ - }; - - static struct of_device_id const bcm963xx_boards_dt[] = { -@@ -2242,6 +2902,20 @@ static struct of_device_id const bcm963x - { .compatible = "sfr,neufbox-6-sercomm-r0", .data = &board_nb6, }, - #endif /* CONFIG_BCM63XX_CPU_6362 */ - #ifdef CONFIG_BCM63XX_CPU_6368 -+ { .compatible = "actiontec,r1000h", .data = &board_R1000H, }, -+ { .compatible = "adb,av4202n", .data = &board_AV4202N, }, -+ { .compatible = "brcm,bcm96368mvngr", .data = &board_96368mvngr, }, -+ { .compatible = "brcm,bcm96368mvwg", .data = &board_96368mvwg, }, -+ { .compatible = "comtrend,vr-3025u", .data = &board_VR3025u, }, -+ { .compatible = "comtrend,vr-3025un", .data = &board_VR3025un, }, -+ { .compatible = "comtrend,vr-3026e", .data = &board_VR3026e, }, -+ { .compatible = "comtrend,wap-5813n", .data = &board_WAP5813n, }, -+ { .compatible = "huawei,echolife-hg622", .data = &board_HG622, }, -+ { .compatible = "huawei,echolife-hg655b", .data = &board_HG655b, }, -+ { .compatible = "netgear,dgnd3700-v1", .data = &board_DGND3700v1_3800B, }, -+ { .compatible = "netgear,evg2000", .data = &board_EVG2000, }, -+ { .compatible = "observa,vh4032n", .data = &board_VH4032N, }, -+ { .compatible = "zyxel,p870hw-51a-v2", .data = &board_P870HW51A_V2, }, - #endif /* CONFIG_BCM63XX_CPU_6368 */ - #ifdef CONFIG_BCM63XX_CPU_63268 - #endif /* CONFIG_BCM63XX_CPU_63268 */ ---- a/arch/mips/bcm63xx/boards/board_common.c -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -81,12 +81,25 @@ void __init board_early_setup(const stru - bcm63xx_pci_enabled = 1; - if (BCMCPU_IS_6348()) - val |= GPIO_MODE_6348_G2_PCI; -+ -+ if (BCMCPU_IS_6368()) -+ val |= GPIO_MODE_6368_PCI_REQ1 | -+ GPIO_MODE_6368_PCI_GNT1 | -+ GPIO_MODE_6368_PCI_INTB | -+ GPIO_MODE_6368_PCI_REQ0 | -+ GPIO_MODE_6368_PCI_GNT0; - } - #endif - - if (board.has_pccard) { - if (BCMCPU_IS_6348()) - val |= GPIO_MODE_6348_G1_MII_PCCARD; -+ -+ if (BCMCPU_IS_6368()) -+ val |= GPIO_MODE_6368_PCMCIA_CD1 | -+ GPIO_MODE_6368_PCMCIA_CD2 | -+ GPIO_MODE_6368_PCMCIA_VS1 | -+ GPIO_MODE_6368_PCMCIA_VS2; - } - - if (board.has_enet0 && !board.enet0.use_internal_phy) { diff --git a/target/linux/bcm63xx/patches-5.15/519-board_bcm63268.patch b/target/linux/bcm63xx/patches-5.15/519-board_bcm63268.patch deleted file mode 100644 index 9693b4d3b066f9..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/519-board_bcm63268.patch +++ /dev/null @@ -1,307 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -2697,6 +2697,273 @@ static struct board_info __initdata boar - #endif /* CONFIG_BCM63XX_CPU_6368 */ - - /* -+ * known 63268/63269 boards -+ */ -+#ifdef CONFIG_BCM63XX_CPU_63268 -+static struct board_info __initdata board_963268bu_p300 = { -+ .name = "963268BU_P300", -+ .expected_cpu_id = 0x63268, -+ -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 1, -+ -+ .has_usbd = 1, -+ .usbd = { -+ .use_fullspeed = 0, -+ .port_no = 0, -+ }, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 17, -+ .name = "FE1", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "GbE2", -+ }, -+ [4] = { -+ .used = 1, -+ .phy_id = 0, -+ .name = "GbE3", -+ .mii_override = 1, -+ .timing_sel = 1, -+ }, -+ [5] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "GbE1", -+ .mii_override = 1, -+ .timing_sel = 1, -+ }, -+ [6] = { -+ .used = 1, -+ .phy_id = 24, -+ .name = "GbE4", -+ .mii_override = 1, -+ .timing_sel = 1, -+ }, -+ [7] = { -+ .used = 1, -+ .phy_id = 25, -+ .name = "GbE5", -+ .mii_override = 1, -+ .timing_sel = 1, -+ }, -+ }, -+ }, -+}; -+ -+static struct board_info __initdata board_963269bhr = { -+ .name = "963269BHR", -+ .expected_cpu_id = 0x63268, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "port1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "port2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "port3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "port4", -+ }, -+ }, -+ }, -+}; -+ -+static struct board_info __initdata board_BSKYB_63168 = { -+ .name = "BSKYB_63168", -+ .expected_cpu_id = 0x63268, -+ -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 2, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "Port 1", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "Port 2", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "Port 3", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "Port 4", -+ }, -+ }, -+ }, -+}; -+ -+static struct board_info __initdata board_H500s = { -+ .name = "BXK00C-1.6", -+ .expected_cpu_id = 0x63268, -+ -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 1, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [3] = { -+ .used = 1, -+ .phy_id = 12, -+ .name = "WAN", -+ }, -+ [4] = { -+ .used = 1, -+ .phy_id = 0, -+ .bypass_link = 1, -+ .force_speed = 1000, -+ .force_duplex_full = 1, -+ .mii_override = 1, -+ .timing_sel = 1, -+ .name = "RGMII", -+ }, -+ }, -+ }, -+}; -+ -+static struct board_info __initdata board_VG8050 = { -+ .name = "963169P-1861N5", -+ .expected_cpu_id = 0x63268, -+ -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 2, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [6] = { -+ .used = 1, -+ .phy_id = 0xff, -+ .bypass_link = 1, -+ .force_speed = 1000, -+ .force_duplex_full = 1, -+ .mii_override = 1, -+ .timing_sel = 1, -+ .name = "RGMII", -+ }, -+ }, -+ }, -+}; -+ -+static struct board_info __initdata board_VR3032u = { -+ .name = "963168M-1841N1", -+ .expected_cpu_id = 0x63268, -+ -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 1, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "LAN2", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "LAN3", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "LAN4", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "LAN1", -+ }, -+ }, -+ }, -+}; -+ -+static struct board_info __initdata board_vw6339gu = { -+ .name = "VW6339GU", -+ .expected_cpu_id = 0x63268, -+ -+ .has_ohci0 = 1, -+ .has_ehci0 = 1, -+ .num_usbh_ports = 1, -+ -+ .has_enetsw = 1, -+ .enetsw = { -+ .used_ports = { -+ [0] = { -+ .used = 1, -+ .phy_id = 1, -+ .name = "LAN2", -+ }, -+ [1] = { -+ .used = 1, -+ .phy_id = 2, -+ .name = "LAN3", -+ }, -+ [2] = { -+ .used = 1, -+ .phy_id = 3, -+ .name = "LAN4", -+ }, -+ [3] = { -+ .used = 1, -+ .phy_id = 4, -+ .name = "LAN1", -+ }, -+ [4] = { -+ .used = 1, -+ .phy_id = 7, -+ .name = "WAN", -+ .mii_override = 1, -+ .timing_sel = 1, -+ }, -+ }, -+ }, -+}; -+#endif /* CONFIG_BCM63XX_CPU_63268 */ -+ -+/* - * all boards - */ - static const struct board_info __initconst *bcm963xx_boards[] = { -@@ -2801,6 +3068,15 @@ static const struct board_info __initcon - &board_VR3026e, - &board_WAP5813n, - #endif /* CONFIG_BCM63XX_CPU_6368 */ -+#ifdef CONFIG_BCM63XX_CPU_63268 -+ &board_963268bu_p300, -+ &board_963269bhr, -+ &board_BSKYB_63168, -+ &board_H500s, -+ &board_VG8050, -+ &board_VR3032u, -+ &board_vw6339gu, -+#endif /* CONFIG_BCM63XX_CPU_63268 */ - }; - - static struct of_device_id const bcm963xx_boards_dt[] = { -@@ -2918,6 +3194,14 @@ static struct of_device_id const bcm963x - { .compatible = "zyxel,p870hw-51a-v2", .data = &board_P870HW51A_V2, }, - #endif /* CONFIG_BCM63XX_CPU_6368 */ - #ifdef CONFIG_BCM63XX_CPU_63268 -+ { .compatible = "brcm,bcm963268bu-p300", .data = &board_963268bu_p300, }, -+ { .compatible = "brcm,bcm963269bhr", .data = &board_963269bhr, }, -+ { .compatible = "comtrend,vg-8050", .data = &board_VG8050, }, -+ { .compatible = "comtrend,vr-3032u", .data = &board_VR3032u, }, -+ { .compatible = "inteno,vg50", .data = &board_vw6339gu, }, -+ { .compatible = "sercomm,h500-s-lowi", .data = &board_H500s, }, -+ { .compatible = "sercomm,h500-s-vfes", .data = &board_H500s, }, -+ { .compatible = "sky,sr102", .data = &board_BSKYB_63168, }, - #endif /* CONFIG_BCM63XX_CPU_63268 */ - #endif /* CONFIG_OF */ - { }, diff --git a/target/linux/bcm63xx/patches-5.15/531-board_bcm6348-bt-voyager-2500v-bb.patch b/target/linux/bcm63xx/patches-5.15/531-board_bcm6348-bt-voyager-2500v-bb.patch deleted file mode 100644 index 39728c45e45b99..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/531-board_bcm6348-bt-voyager-2500v-bb.patch +++ /dev/null @@ -1,49 +0,0 @@ ---- a/arch/mips/bcm63xx/boards/board_bcm963xx.c -+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c -@@ -3230,6 +3230,22 @@ void __init board_bcm963xx_init(void) - val &= MPI_CSBASE_BASE_MASK; - } - boot_addr = (u8 *)KSEG1ADDR(val); -+ pr_info("Boot address 0x%08x\n",(unsigned int)boot_addr); -+ -+ /* BT Voyager 2500V (RTA1046VW PCB) has 8 Meg flash used as two */ -+ /* banks of 4 Meg. The byte at 0xBF800000 identifies the back to use.*/ -+ /* Loading firmware from the CFE Prompt always loads to Bank 0 */ -+ /* Do an early check of CFE and then select bank 0 */ -+ -+ if (boot_addr == (u8 *)0xbf800000) { -+ u8 *tmp_boot_addr = (u8*)0xbfc00000; -+ -+ bcm63xx_nvram_init(tmp_boot_addr + BCM963XX_NVRAM_OFFSET); -+ if (!strcmp(bcm63xx_nvram_get_name(), "V2500V_BB")) { -+ pr_info("V2500V: nvram bank 0\n"); -+ boot_addr = tmp_boot_addr; -+ } -+ } - - /* dump cfe version */ - cfe = boot_addr + BCM963XX_CFE_VERSION_OFFSET; ---- a/arch/mips/bcm63xx/dev-flash.c -+++ b/arch/mips/bcm63xx/dev-flash.c -@@ -21,6 +21,7 @@ - #include - #include - -+#include - #include - #include - #include -@@ -256,6 +257,13 @@ int __init bcm63xx_flash_register(void) - val = bcm_mpi_readl(MPI_CSBASE_REG(0)); - val &= MPI_CSBASE_BASE_MASK; - -+ /* BT Voyager 2500V has 8 Meg flash in two 4 Meg banks */ -+ /* Loading from CFE always uses Bank 0 */ -+ if (!strcmp(board_get_name(), "V2500V_BB")) { -+ pr_info("V2500V: Start in Bank 0\n"); -+ val = val + 0x400000; // Select Bank 0 start address -+ } -+ - mtd_resources[0].start = val; - mtd_resources[0].end = 0x1FFFFFFF; - } diff --git a/target/linux/bcm63xx/patches-5.15/532-MIPS-BCM63XX-add-inventel-Livebox-support.patch b/target/linux/bcm63xx/patches-5.15/532-MIPS-BCM63XX-add-inventel-Livebox-support.patch deleted file mode 100644 index 24b8f68807017c..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/532-MIPS-BCM63XX-add-inventel-Livebox-support.patch +++ /dev/null @@ -1,219 +0,0 @@ -From e796582b499f0ba6acaa1ac3a10c09cceaab7702 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 9 Mar 2014 04:55:52 +0100 -Subject: [PATCH] MIPS: BCM63XX: add inventel Livebox support - ---- - arch/mips/bcm63xx/boards/Kconfig | 6 + - arch/mips/bcm63xx/boards/Makefile | 1 + - arch/mips/bcm63xx/boards/board_common.c | 2 +- - arch/mips/bcm63xx/boards/board_common.h | 6 + - arch/mips/bcm63xx/boards/board_livebox.c | 215 ++++++++++++++++++++++++++++++ - 5 files changed, 229 insertions(+), 1 deletion(-) - create mode 100644 arch/mips/bcm63xx/boards/board_livebox.c - ---- a/arch/mips/bcm63xx/boards/Kconfig -+++ b/arch/mips/bcm63xx/boards/Kconfig -@@ -12,4 +12,10 @@ config BOARD_BCM963XX - select BCMA - default y - -+config BOARD_LIVEBOX -+ bool "Inventel Livebox(es) boards" -+ select SSB -+ help -+ Inventel Livebox boards using the RedBoot bootloader. -+ - endmenu ---- a/arch/mips/bcm63xx/boards/Makefile -+++ b/arch/mips/bcm63xx/boards/Makefile -@@ -1,3 +1,4 @@ - # SPDX-License-Identifier: GPL-2.0-only - obj-y += board_common.o - obj-$(CONFIG_BOARD_BCM963XX) += board_bcm963xx.o -+obj-$(CONFIG_BOARD_LIVEBOX) += board_livebox.o ---- a/arch/mips/bcm63xx/boards/board_common.c -+++ b/arch/mips/bcm63xx/boards/board_common.c -@@ -54,7 +54,7 @@ void __init board_prom_init(void) - if (fw_arg3 == CFE_EPTSEAL) - board_bcm963xx_init(); - else -- panic("unsupported bootloader detected"); -+ board_livebox_init(); - } - - static int (*board_get_mac_address)(u8 mac[ETH_ALEN]); ---- a/arch/mips/bcm63xx/boards/board_common.h -+++ b/arch/mips/bcm63xx/boards/board_common.h -@@ -24,4 +24,10 @@ static inline void board_of_device_prese - } - #endif - -+#if defined(CONFIG_BOARD_LIVEBOX) -+void board_livebox_init(void); -+#else -+static inline void board_livebox_init(void) { } -+#endif -+ - #endif /* __BOARD_COMMON_H */ ---- /dev/null -+++ b/arch/mips/bcm63xx/boards/board_livebox.c -@@ -0,0 +1,158 @@ -+/* -+ * This file is subject to the terms and conditions of the GNU General Public -+ * License. See the file "COPYING" in the main directory of this archive -+ * for more details. -+ * -+ * Copyright (C) 2008 Florian Fainelli -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "board_common.h" -+ -+#define PFX "board_livebox: " -+ -+static unsigned int mac_addr_used = 0; -+ -+/* -+ * known 6348 boards -+ */ -+#ifdef CONFIG_BCM63XX_CPU_6348 -+static struct board_info __initdata board_livebox_blue5g = { -+ .name = "Livebox-blue-5g", -+ .expected_cpu_id = 0x6348, -+ -+ .has_pccard = 1, -+ .has_pci = 1, -+ .has_ohci0 = 1, -+ .ephy_reset_gpio = 6, -+ .ephy_reset_gpio_flags = GPIO_ACTIVE_LOW, -+ -+ .has_enet0 = 1, -+ .enet0 = { -+ .has_phy = 1, -+ .use_internal_phy = 1, -+ }, -+ -+ .has_enet1 = 1, -+ .enet1 = { -+ .has_phy = 1, -+ .phy_id = 31, -+ }, -+}; -+#endif -+ -+/* -+ * all boards -+ */ -+static const struct board_info __initdata *bcm963xx_boards[] = { -+#ifdef CONFIG_BCM63XX_CPU_6348 -+ &board_livebox_blue5g -+#endif /* CONFIG_BCM63XX_CPU_6348 */ -+}; -+ -+static struct of_device_id const livebox_boards_dt[] = { -+ { .compatible = "inventel,livebox-1", .data = &board_livebox_blue5g, }, -+ { } -+}; -+ -+/* -+ * register & return a new board mac address -+ */ -+static int livebox_get_mac_address(u8 mac[ETH_ALEN]) -+{ -+ u8 *p; -+ int count; -+ void __iomem *volatile mmio; -+ -+ mmio = ioremap(0x1ebff377, 0x8); -+ if (!mmio) -+ return -EIO; -+ memcpy_fromio(mac, mmio, ETH_ALEN); -+ iounmap(mmio); -+ -+ p = mac + ETH_ALEN - 1; -+ count = mac_addr_used; -+ -+ while (count--) { -+ do { -+ (*p)++; -+ if (*p != 0) -+ break; -+ p--; -+ } while (p != mac); -+ } -+ -+ if (p == mac) { -+ printk(KERN_ERR PFX "unable to fetch mac address\n"); -+ return -ENODEV; -+ } -+ mac_addr_used++; -+ -+ return 0; -+} -+ -+/* -+ * early init callback -+ */ -+#define LIVEBOX_GPIO_DETECT_MASK 0x000000ff -+#define LIVEBOX_BOOT_ADDR 0x1e400000 -+ -+#define LIVEBOX_HW_BLUE5G_9 0x90 -+ -+void __init board_livebox_init(void) -+{ -+ u32 val; -+ u8 hw_version; -+ const struct board_info *board; -+ const struct of_device_id *board_match; -+ -+ /* find board by compat */ -+ board_match = bcm63xx_match_board(livebox_boards_dt); -+ if (board_match) { -+ board = board_match->data; -+ } else { -+ /* Get hardware version */ -+ val = bcm_gpio_readl(GPIO_CTL_LO_REG); -+ val &= ~LIVEBOX_GPIO_DETECT_MASK; -+ bcm_gpio_writel(val, GPIO_CTL_LO_REG); -+ -+ hw_version = bcm_gpio_readl(GPIO_DATA_LO_REG); -+ hw_version &= LIVEBOX_GPIO_DETECT_MASK; -+ -+ switch (hw_version) { -+ case LIVEBOX_HW_BLUE5G_9: -+ printk(KERN_INFO PFX "Livebox BLUE5G.9\n"); -+ board = bcm963xx_boards[0]; -+ break; -+ default: -+ printk(KERN_INFO PFX "Unknown livebox version: %02x\n", -+ hw_version); -+ /* use default livebox configuration */ -+ board = bcm963xx_boards[0]; -+ break; -+ } -+ } -+ -+ /* use default livebox configuration */ -+ board_early_setup(board, livebox_get_mac_address); -+ -+ /* read base address of boot chip select (0) */ -+ val = bcm_mpi_readl(MPI_CSBASE_REG(0)); -+ val &= MPI_CSBASE_BASE_MASK; -+ if (val != LIVEBOX_BOOT_ADDR) { -+ printk(KERN_NOTICE PFX "flash address is: 0x%08x, forcing to: 0x%08x\n", -+ val, LIVEBOX_BOOT_ADDR); -+ bcm63xx_flash_force_phys_base_address(LIVEBOX_BOOT_ADDR, 0x1ebfffff); -+ } -+} diff --git a/target/linux/bcm63xx/patches-5.15/800-wl_exports.patch b/target/linux/bcm63xx/patches-5.15/800-wl_exports.patch deleted file mode 100644 index a4795de4fbb214..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/800-wl_exports.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- a/arch/mips/bcm63xx/nvram.c -+++ b/arch/mips/bcm63xx/nvram.c -@@ -24,6 +24,12 @@ - static struct bcm963xx_nvram nvram; - static int mac_addr_used; - -+/* -+ * Required export for WL -+ */ -+u32 nvram_buf[5] = { 0, cpu_to_le32(20), 0, 0, 0 }; -+EXPORT_SYMBOL(nvram_buf); -+ - void __init bcm63xx_nvram_init(void *addr) - { - u32 crc, expected_crc; ---- a/arch/mips/mm/cache.c -+++ b/arch/mips/mm/cache.c -@@ -63,6 +63,9 @@ void (*_dma_cache_wback_inv)(unsigned lo - void (*_dma_cache_wback)(unsigned long start, unsigned long size); - void (*_dma_cache_inv)(unsigned long start, unsigned long size); - -+EXPORT_SYMBOL(_dma_cache_wback_inv); -+EXPORT_SYMBOL(_dma_cache_inv); -+ - #endif /* CONFIG_DMA_NONCOHERENT */ - - /* diff --git a/target/linux/bcm63xx/patches-5.15/801-ssb_export_fallback_sprom.patch b/target/linux/bcm63xx/patches-5.15/801-ssb_export_fallback_sprom.patch deleted file mode 100644 index 6e4e05a63b6738..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/801-ssb_export_fallback_sprom.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- a/arch/mips/bcm63xx/sprom.c -+++ b/arch/mips/bcm63xx/sprom.c -@@ -8,6 +8,7 @@ - */ - - #include -+#include - #include - #include - #include -@@ -388,7 +389,19 @@ struct fallback_sprom_match { - struct ssb_sprom sprom; - }; - --static struct fallback_sprom_match fallback_sprom; -+struct fallback_sprom_match fallback_sprom; -+ -+int bcm63xx_get_fallback_sprom(uint pci_bus, uint pci_slot, struct ssb_sprom *out) -+{ -+ if (pci_bus != fallback_sprom.pci_bus || -+ pci_slot != fallback_sprom.pci_dev) -+ pr_warn("fallback_sprom: pci bus/device num mismatch: expected %i/%i, but got %i/%i\n", -+ fallback_sprom.pci_bus, fallback_sprom.pci_dev, -+ pci_bus, pci_slot); -+ memcpy(out, &fallback_sprom.sprom, sizeof(struct ssb_sprom)); -+ return 0; -+} -+EXPORT_SYMBOL(bcm63xx_get_fallback_sprom); - - #if defined(CONFIG_SSB_PCIHOST) - int bcm63xx_get_fallback_ssb_sprom(struct ssb_bus *bus, struct ssb_sprom *out) diff --git a/target/linux/bcm63xx/patches-5.15/802-rtl8367r_fix_RGMII_support.patch b/target/linux/bcm63xx/patches-5.15/802-rtl8367r_fix_RGMII_support.patch deleted file mode 100644 index 2aca2f3f74d8c7..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/802-rtl8367r_fix_RGMII_support.patch +++ /dev/null @@ -1,30 +0,0 @@ -From e3208e6087642b95a5bab3101fc9c6e34892c861 Mon Sep 17 00:00:00 2001 -From: Miguel GAIO -Date: Fri, 6 Jul 2012 14:12:33 +0200 -Subject: [PATCH 6/8] * [rtl8367r] Fix RGMII support - ---- - drivers/net/phy/rtl8367.c | 5 +++++ - 1 files changed, 5 insertions(+), 0 deletions(-) - ---- a/drivers/net/phy/rtl8367.c -+++ b/drivers/net/phy/rtl8367.c -@@ -146,6 +146,10 @@ - #define RTL8367_EXT_RGMXF_TXDELAY_MASK 1 - #define RTL8367_EXT_RGMXF_RXDELAY_MASK 0x7 - -+#define RTL8367_PHY_AD_REG 0x130f -+#define RTL8370_PHY_AD_DUMMY_1_OFFSET 5 -+#define RTL8370_PHY_AD_DUMMY_1_MASK 0xe0 -+ - #define RTL8367_DI_FORCE_REG(_x) (0x1310 + (_x)) - #define RTL8367_DI_FORCE_MODE BIT(12) - #define RTL8367_DI_FORCE_NWAY BIT(7) -@@ -897,6 +901,7 @@ static int rtl8367_extif_set_mode(struct - case RTL8367_EXTIF_MODE_RGMII_33V: - REG_WR(smi, RTL8367_CHIP_DEBUG0_REG, 0x0367); - REG_WR(smi, RTL8367_CHIP_DEBUG1_REG, 0x7777); -+ REG_RMW(smi, RTL8367_PHY_AD_REG, BIT(5), 0); - break; - - case RTL8367_EXTIF_MODE_TMII_MAC: diff --git a/target/linux/bcm63xx/patches-5.15/803-jffs2-work-around-unaligned-accesses-failing-on-bcm6.patch b/target/linux/bcm63xx/patches-5.15/803-jffs2-work-around-unaligned-accesses-failing-on-bcm6.patch deleted file mode 100644 index d98d27c6b43cee..00000000000000 --- a/target/linux/bcm63xx/patches-5.15/803-jffs2-work-around-unaligned-accesses-failing-on-bcm6.patch +++ /dev/null @@ -1,26 +0,0 @@ -From ff3409ab17d56450943364ba49a16960e3cdda9b Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Sun, 6 Apr 2014 22:33:16 +0200 -Subject: [RFC] jffs2: work around unaligned accesses failing on bcm63xx/smp - -Unligned memcpy_fromio randomly fails with an unaligned dst. Work around -it by ensuring we are always doing aligned copies. - -Should fix filename corruption in jffs2 with SMP. - -Signed-off-by: Jonas Gorski ---- - fs/jffs2/nodelist.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/fs/jffs2/nodelist.h -+++ b/fs/jffs2/nodelist.h -@@ -259,7 +259,7 @@ struct jffs2_full_dirent - uint32_t ino; /* == zero for unlink */ - unsigned int nhash; - unsigned char type; -- unsigned char name[]; -+ unsigned char name[] __attribute__((aligned((sizeof(long))))); - }; - - /* diff --git a/target/linux/bcm63xx/profiles/default.mk b/target/linux/bcm63xx/profiles/default.mk deleted file mode 100644 index 65f2111087daa9..00000000000000 --- a/target/linux/bcm63xx/profiles/default.mk +++ /dev/null @@ -1,15 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -# -# Copyright (C) 2016 LEDE project - -define Profile/Default - NAME:=Default Profile - PACKAGES:=kmod-b43 wpad-basic-mbedtls - PRIORITY:=1 -endef - -define Profile/Default/Description - Package set compatible with most boards. -endef - -$(eval $(call Profile,Default)) diff --git a/target/linux/bcm63xx/smp/config-default b/target/linux/bcm63xx/smp/config-default deleted file mode 100644 index a6eae6e41dbfeb..00000000000000 --- a/target/linux/bcm63xx/smp/config-default +++ /dev/null @@ -1,41 +0,0 @@ -CONFIG_CPU_RMAP=y -CONFIG_CRC16=y -CONFIG_CRYPTO_ACOMP2=y -CONFIG_CRYPTO_AEAD=y -CONFIG_CRYPTO_AEAD2=y -CONFIG_CRYPTO_DEFLATE=y -CONFIG_CRYPTO_HASH_INFO=y -CONFIG_CRYPTO_HASH2=y -CONFIG_CRYPTO_LZO=y -CONFIG_CRYPTO_MANAGER=y -CONFIG_CRYPTO_MANAGER2=y -CONFIG_CRYPTO_NULL2=y -CONFIG_CRYPTO_ZSTD=y -CONFIG_JFFS2_FS_NAND=y -CONFIG_LZO_COMPRESS=y -CONFIG_LZO_DECOMPRESS=y -CONFIG_MTD_NAND_BRCMNAND=y -CONFIG_MTD_NAND_CORE=y -CONFIG_MTD_NAND_ECC_SW_HAMMING=y -CONFIG_MTD_RAW_NAND=y -CONFIG_MTD_SPLIT_BCM_WFI_FW=y -CONFIG_MTD_UBI=y -CONFIG_MTD_UBI_BEB_LIMIT=20 -CONFIG_MTD_UBI_BLOCK=y -CONFIG_MTD_UBI_WL_THRESHOLD=4096 -CONFIG_NET_FLOW_LIMIT=y -CONFIG_NR_CPUS=2 -CONFIG_PADATA=y -CONFIG_RFS_ACCEL=y -CONFIG_RPS=y -CONFIG_SGL_ALLOC=y -CONFIG_SMP=y -CONFIG_SMP_UP=y -CONFIG_TREE_RCU=y -CONFIG_UBIFS_FS=y -CONFIG_XPS=y -CONFIG_XXHASH=y -CONFIG_ZLIB_DEFLATE=y -CONFIG_ZLIB_INFLATE=y -CONFIG_ZSTD_COMPRESS=y -CONFIG_ZSTD_DECOMPRESS=y diff --git a/target/linux/bcm63xx/smp/target.mk b/target/linux/bcm63xx/smp/target.mk deleted file mode 100644 index 36bc2becdc0b93..00000000000000 --- a/target/linux/bcm63xx/smp/target.mk +++ /dev/null @@ -1,17 +0,0 @@ -BOARDNAME:=smp -FEATURES+=nand - -define Target/Description - Build firmware images for BCM63XX boards with SMP and NAND support. - SoCs with 2 cores: - - BCM6328 (some boards only have 1 core) - - BCM6358 (SMP unsupported due to shared TLB) - - BCM6362 - - BCM6368 - - BCM63268 - SoCs with NAND controller: - - BCM6328 (v2.2) - - BCM6362 (v2.2) - - BCM6368 (v2.1) - - BCM63268 (v4.0) -endef diff --git a/target/linux/bmips/bcm63268/base-files/etc/board.d/01_leds b/target/linux/bmips/bcm63268/base-files/etc/board.d/01_leds index d5b65a9c0facfc..8af1b775045ab5 100644 --- a/target/linux/bmips/bcm63268/base-files/etc/board.d/01_leds +++ b/target/linux/bmips/bcm63268/base-files/etc/board.d/01_leds @@ -9,6 +9,9 @@ case "$(board_name)" in comtrend,vr-3032u) ucidef_set_led_usbport "usb" "USB" "green:usb" "usb1-port1" "usb2-port1" ;; +smartrg,sr505n) + ucidef_set_led_usbport "usb" "USB" "green:usb" "usb1-port1" + ;; sercomm,h500-s-lowi |\ sercomm,h500-s-vfes) ucidef_set_led_netdev "wan" "WAN" "green:internet" "wan" diff --git a/target/linux/bmips/bcm63268/base-files/etc/board.d/02_network b/target/linux/bmips/bcm63268/base-files/etc/board.d/02_network index 7fb9333cc18aa8..74b74691cbd4b8 100644 --- a/target/linux/bmips/bcm63268/base-files/etc/board.d/02_network +++ b/target/linux/bmips/bcm63268/base-files/etc/board.d/02_network @@ -5,7 +5,8 @@ board_config_update case "$(board_name)" in -comtrend,vr-3032u) +comtrend,vr-3032u |\ +smartrg,sr505n) ucidef_set_bridge_device switch ucidef_set_interface_lan "lan1 lan2 lan3 lan4" ;; diff --git a/target/linux/bmips/dts/bcm63168-smartrg-sr505n.dts b/target/linux/bmips/dts/bcm63168-smartrg-sr505n.dts new file mode 100644 index 00000000000000..571289b4c61d6e --- /dev/null +++ b/target/linux/bmips/dts/bcm63168-smartrg-sr505n.dts @@ -0,0 +1,238 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "bcm63268.dtsi" + +/ { + model = "SmartRG SR505n"; + compatible = "smartrg,sr505n", "brcm,bcm63168", "brcm,bcm63268"; + + aliases { + led-boot = &led_power_green; + led-failsafe = &led_power_red; + led-running = &led_power_green; + led-upgrade = &led_power_green; + }; + + keys { + compatible = "gpio-keys-polled"; + poll-interval = <100>; + + reset { + label = "reset"; + gpios = <&gpio 32 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + + wps { + label = "wps"; + gpios = <&gpio 33 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + + wlan { + label = "wlan"; + gpios = <&gpio 34 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + }; +}; + +&ehci { + status = "okay"; +}; + +ðernet { + status = "okay"; + + nvmem-cells = <&macaddr_cfe_6a0>; + nvmem-cell-names = "mac-address"; +}; + +&hsspi { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + spi-max-frequency = <16666667>; + spi-tx-bus-width = <2>; + spi-rx-bus-width = <2>; + reg = <0>; + + #address-cells = <1>; + #size-cells = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "cfe"; + reg = <0x000000 0x010000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_cfe_6a0: macaddr@6a0 { + reg = <0x6a0 0x6>; + }; + }; + }; + + partition@10000 { + compatible = "brcm,bcm963xx-imagetag"; + label = "firmware"; + reg = <0x010000 0xfd0000>; + }; + + partition@fe0000 { + label = "nvram"; + reg = <0xfe0000 0x020000>; + }; + }; + }; +}; + +&leds { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_leds>; + + wps_green@1 { + reg = <1>; + active-low; + function = LED_FUNCTION_WPS; + color = ; + }; + + inet_green@8 { + reg = <8>; + active-low; + label = "green:inet"; + }; + + lan2_green@9 { + /* EPHY1 Act */ + reg = <9>; + brcm,hardware-controlled; + }; + + lan3_green@10 { + /* EPHY2 Act */ + reg = <10>; + brcm,hardware-controlled; + }; + + lan4_green@11 { + /* EPHY3 Act */ + reg = <11>; + brcm,hardware-controlled; + }; + + lan1_green@12 { + /* GPHY0 Act */ + reg = <12>; + brcm,hardware-controlled; + }; + + dsl_green@14 { + reg = <14>; + active-low; + label = "green:dsl"; + }; + + inet_red@15 { + reg = <15>; + active-low; + label = "red:inet"; + }; + + usb_green@16 { + reg = <16>; + active-low; + function = LED_FUNCTION_USB; + color = ; + }; + + led_power_green: power_green@20 { + reg = <20>; + active-low; + function = LED_FUNCTION_POWER; + color = ; + }; + + led_power_red: power_red@21 { + reg = <21>; + active-low; + function = LED_FUNCTION_POWER; + color = ; + panic-indicator; + }; +}; + +&pinctrl { + pinctrl_leds: leds { + function = "led"; + pins = "gpio1", "gpio8", + "gpio9", "gpio10", + "gpio11", "gpio12", + "gpio14", "gpio15", + "gpio16", "gpio20", + "gpio21"; + }; +}; + +&ohci { + status = "okay"; +}; + +&switch0 { + ports { + port@0 { + reg = <0>; + label = "lan2"; + + phy-handle = <&phy1>; + phy-mode = "mii"; + }; + + port@1 { + reg = <1>; + label = "lan3"; + + phy-handle = <&phy2>; + phy-mode = "mii"; + }; + + port@2 { + reg = <2>; + label = "lan4"; + + phy-handle = <&phy3>; + phy-mode = "mii"; + }; + + port@3 { + reg = <3>; + label = "lan1"; + + phy-handle = <&phy4>; + phy-mode = "gmii"; + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&usbh { + status = "okay"; +}; diff --git a/target/linux/bmips/image/bcm63268.mk b/target/linux/bmips/image/bcm63268.mk index 941e83f71bf6bd..be3403174efc01 100644 --- a/target/linux/bmips/image/bcm63268.mk +++ b/target/linux/bmips/image/bcm63268.mk @@ -100,3 +100,17 @@ define Device/sercomm_shg2500 SERCOMM_SWVER := 3207 endef TARGET_DEVICES += sercomm_shg2500 + +define Device/smartrg_sr505n + $(Device/bcm63xx-cfe) + DEVICE_VENDOR := SmartRG + DEVICE_MODEL := SR505n + DEVICE_LOADADDR := $(KERNEL_LOADADDR) + CHIP_ID := 63268 + SOC := bcm63168 + CFE_BOARD_ID := 963168MBV_17AZZ + FLASH_MB := 16 + DEVICE_PACKAGES += $(USB2_PACKAGES) \ + kmod-leds-bcm6328 +endef +TARGET_DEVICES += smartrg_sr505n diff --git a/target/linux/d1/Makefile b/target/linux/d1/Makefile new file mode 100644 index 00000000000000..436ab948623310 --- /dev/null +++ b/target/linux/d1/Makefile @@ -0,0 +1,21 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Copyright (C) 2024 Toco Technologies +# +include $(TOPDIR)/rules.mk + +ARCH:=riscv64 +BOARD:=d1 +BOARDNAME:=AllWinner D1 RISC-V SoC +FEATURES:=ext4 squashfs +KERNELNAME:=Image dtbs + +KERNEL_PATCHVER:=6.1 + +include $(INCLUDE_DIR)/target.mk + +define Target/Description + Build firmware images for Allwinner D1 RISC-V boards +endef + +$(eval $(call BuildTarget)) diff --git a/target/linux/d1/base-files/etc/board.d/02_network b/target/linux/d1/base-files/etc/board.d/02_network new file mode 100644 index 00000000000000..df48b431af5e2c --- /dev/null +++ b/target/linux/d1/base-files/etc/board.d/02_network @@ -0,0 +1,18 @@ +#!/bin/sh +# +# Copyright (C) 2013-2015 OpenWrt.org +# + +. /lib/functions/uci-defaults.sh + +board_config_update + +case "$(board_name)" in +*) + ucidef_set_interface_lan 'eth0' + ;; +esac + +board_config_flush + +exit 0 diff --git a/target/linux/d1/base-files/etc/inittab b/target/linux/d1/base-files/etc/inittab new file mode 100644 index 00000000000000..be81ab3e23879f --- /dev/null +++ b/target/linux/d1/base-files/etc/inittab @@ -0,0 +1,5 @@ +::sysinit:/etc/init.d/rcS S boot +::shutdown:/etc/init.d/rcS K shutdown +tts/0::askfirst:/usr/libexec/login.sh +ttyS0::askfirst:/usr/libexec/login.sh +tty1::askfirst:/usr/libexec/login.sh diff --git a/target/linux/d1/config-6.1 b/target/linux/d1/config-6.1 new file mode 100644 index 00000000000000..ef2112f706d0cd --- /dev/null +++ b/target/linux/d1/config-6.1 @@ -0,0 +1,396 @@ +CONFIG_64BIT=y +# CONFIG_AHCI_SUNXI is not set +CONFIG_ARCH_CLOCKSOURCE_INIT=y +CONFIG_ARCH_DMA_ADDR_T_64BIT=y +CONFIG_ARCH_MMAP_RND_BITS=18 +CONFIG_ARCH_MMAP_RND_BITS_MAX=24 +CONFIG_ARCH_MMAP_RND_BITS_MIN=18 +CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=17 +CONFIG_ARCH_OPTIONAL_KERNEL_RWX=y +CONFIG_ARCH_OPTIONAL_KERNEL_RWX_DEFAULT=y +CONFIG_ARCH_RV64I=y +CONFIG_ARCH_SELECT_MEMORY_MODEL=y +CONFIG_ARCH_SPARSEMEM_ENABLE=y +CONFIG_ARCH_STACKWALK=y +CONFIG_ARCH_SUNXI=y +CONFIG_ARCH_WANTS_THP_SWAP=y +CONFIG_ASN1=y +CONFIG_ASSOCIATIVE_ARRAY=y +CONFIG_BLK_DEV_SD=y +CONFIG_BLK_MQ_PCI=y +CONFIG_CC_HAVE_STACKPROTECTOR_TLS=y +CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" +CONFIG_CC_NO_ARRAY_BOUNDS=y +CONFIG_CLKSRC_MMIO=y +CONFIG_CLONE_BACKWARDS=y +CONFIG_CLZ_TAB=y +CONFIG_CMODEL_MEDANY=y +# CONFIG_CMODEL_MEDLOW is not set +CONFIG_COMMON_CLK=y +CONFIG_COMPACT_UNEVICTABLE_DEFAULT=1 +# CONFIG_COMPAT_32BIT_TIME is not set +CONFIG_COMPAT_BRK=y +CONFIG_CONTEXT_TRACKING=y +CONFIG_CONTEXT_TRACKING_IDLE=y +CONFIG_COREDUMP=y +CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y +CONFIG_CPU_ISOLATION=y +CONFIG_CPU_RMAP=y +CONFIG_CRC16=y +# CONFIG_CRC32_SARWATE is not set +CONFIG_CRC32_SLICEBY8=y +CONFIG_CRC7=y +CONFIG_CRC_ITU_T=y +CONFIG_CRYPTO_DEV_ALLWINNER=y +CONFIG_DECOMPRESS_GZIP=y +CONFIG_DMADEVICES=y +CONFIG_DMA_DIRECT_REMAP=y +CONFIG_DMA_ENGINE=y +CONFIG_DMA_OF=y +CONFIG_DMA_SUN6I=y +CONFIG_DMA_VIRTUAL_CHANNELS=y +CONFIG_DTC=y +CONFIG_DWMAC_GENERIC=y +CONFIG_DWMAC_SUN8I=y +CONFIG_DWMAC_SUNXI=y +CONFIG_EDAC_SUPPORT=y +CONFIG_EFI=y +CONFIG_EFIVAR_FS=m +# CONFIG_EFI_BOOTLOADER_CONTROL is not set +# CONFIG_EFI_CAPSULE_LOADER is not set +# CONFIG_EFI_COCO_SECRET is not set +# CONFIG_EFI_DISABLE_PCI_DMA is not set +# CONFIG_EFI_DISABLE_RUNTIME is not set +CONFIG_EFI_EARLYCON=y +CONFIG_EFI_ESRT=y +CONFIG_EFI_GENERIC_STUB=y +CONFIG_EFI_PARAMS_FROM_FDT=y +CONFIG_EFI_RUNTIME_WRAPPERS=y +CONFIG_EFI_STUB=y +# CONFIG_EFI_TEST is not set +# CONFIG_EFI_ZBOOT is not set +CONFIG_ELF_CORE=y +# CONFIG_ERRATA_SIFIVE is not set +CONFIG_ERRATA_THEAD=y +CONFIG_ERRATA_THEAD_CMO=y +CONFIG_ERRATA_THEAD_PBMT=y +CONFIG_EXT4_FS=y +CONFIG_EXTCON=y +CONFIG_FAILOVER=y +CONFIG_FHANDLE=y +CONFIG_FIXED_PHY=y +CONFIG_FIX_EARLYCON_MEM=y +CONFIG_FONT_8x16=y +CONFIG_FONT_AUTOSELECT=y +CONFIG_FONT_SUPPORT=y +CONFIG_FPU=y +CONFIG_FRAME_POINTER=y +CONFIG_FRAME_WARN=2048 +CONFIG_FS_IOMAP=y +CONFIG_FS_MBCACHE=y +CONFIG_FWNODE_MDIO=y +CONFIG_FW_LOADER_PAGED_BUF=y +CONFIG_FW_LOADER_SYSFS=y +CONFIG_GENERIC_ALLOCATOR=y +CONFIG_GENERIC_ARCH_TOPOLOGY=y +CONFIG_GENERIC_BUG=y +CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y +CONFIG_GENERIC_CSUM=y +CONFIG_GENERIC_EARLY_IOREMAP=y +CONFIG_GENERIC_GETTIMEOFDAY=y +CONFIG_GENERIC_IDLE_POLL_SETUP=y +CONFIG_GENERIC_IOREMAP=y +CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y +CONFIG_GENERIC_IRQ_MULTI_HANDLER=y +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_GENERIC_IRQ_SHOW_LEVEL=y +CONFIG_GENERIC_LIB_DEVMEM_IS_ALLOWED=y +CONFIG_GENERIC_MSI_IRQ=y +CONFIG_GENERIC_MSI_IRQ_DOMAIN=y +CONFIG_GENERIC_PCI_IOMAP=y +CONFIG_GENERIC_PHY=y +CONFIG_GENERIC_PINCONF=y +CONFIG_GENERIC_PINCTRL_GROUPS=y +CONFIG_GENERIC_PINMUX_FUNCTIONS=y +CONFIG_GENERIC_SCHED_CLOCK=y +CONFIG_GENERIC_SMP_IDLE_THREAD=y +CONFIG_GENERIC_STRNCPY_FROM_USER=y +CONFIG_GENERIC_STRNLEN_USER=y +CONFIG_GENERIC_TIME_VSYSCALL=y +CONFIG_GLOB=y +CONFIG_GPIOLIB_IRQCHIP=y +CONFIG_GPIO_CDEV=y +CONFIG_GPIO_PCF857X=y +CONFIG_HARDIRQS_SW_RESEND=y +CONFIG_HAS_DMA=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT_MAP=y +CONFIG_HID=y +CONFIG_HID_GENERIC=y +CONFIG_HVC_DRIVER=y +CONFIG_HVC_RISCV_SBI=y +CONFIG_I2C=y +CONFIG_I2C_BOARDINFO=y +CONFIG_I2C_COMPAT=y +CONFIG_I2C_HELPER_AUTO=y +CONFIG_I2C_MV64XXX=y +CONFIG_I2C_OCORES=y +CONFIG_INITRAMFS_SOURCE="" +CONFIG_INPUT=y +CONFIG_IOMMU_API=y +# CONFIG_IOMMU_DEBUGFS is not set +# CONFIG_IOMMU_DEFAULT_DMA_LAZY is not set +CONFIG_IOMMU_DEFAULT_DMA_STRICT=y +# CONFIG_IOMMU_DEFAULT_PASSTHROUGH is not set +CONFIG_IOMMU_SUPPORT=y +CONFIG_IO_URING=y +CONFIG_IRQCHIP=y +CONFIG_IRQ_DOMAIN=y +CONFIG_IRQ_DOMAIN_HIERARCHY=y +CONFIG_IRQ_FORCED_THREADING=y +CONFIG_IRQ_WORK=y +CONFIG_JBD2=y +CONFIG_KALLSYMS=y +# CONFIG_KEYBOARD_SUN4I_LRADC is not set +# CONFIG_LEDS_PWM_MULTICOLOR is not set +# CONFIG_LEDS_SUN50I_A100 is not set +CONFIG_LEGACY_PTYS=y +CONFIG_LEGACY_PTY_COUNT=256 +CONFIG_LIBFDT=y +CONFIG_LOCALVERSION_AUTO=y +CONFIG_LOCK_DEBUGGING_SUPPORT=y +CONFIG_LOCK_SPIN_ON_OWNER=y +CONFIG_MAILBOX=y +# CONFIG_MAILBOX_TEST is not set +CONFIG_MDIO_BUS=y +CONFIG_MDIO_BUS_MUX=y +CONFIG_MDIO_DEVICE=y +CONFIG_MDIO_DEVRES=y +# CONFIG_MDIO_SUN4I is not set +CONFIG_MEMFD_CREATE=y +CONFIG_MFD_AXP20X=y +CONFIG_MFD_AXP20X_I2C=y +CONFIG_MFD_CORE=y +# CONFIG_MFD_SUN4I_GPADC is not set +CONFIG_MFD_SUN6I_PRCM=y +CONFIG_MFD_SYSCON=y +CONFIG_MIGRATION=y +CONFIG_MMC=y +CONFIG_MMC_BLOCK=y +CONFIG_MMC_SUNXI=y +CONFIG_MMIOWB=y +CONFIG_MTD_SPI_NOR=y +CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y +# CONFIG_MUSB_PIO_ONLY is not set +CONFIG_MUTEX_SPIN_ON_OWNER=y +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_NET_PTP_CLASSIFY=y +CONFIG_NET_VENDOR_ALLWINNER=y +CONFIG_NLS=y +# CONFIG_NONPORTABLE is not set +CONFIG_NOP_USB_XCEIV=y +CONFIG_NR_CPUS=8 +CONFIG_NVMEM=y +CONFIG_NVMEM_SUNXI_SID=y +CONFIG_NVMEM_SYSFS=y +CONFIG_OF=y +CONFIG_OF_ADDRESS=y +CONFIG_OF_DMA_DEFAULT_COHERENT=y +CONFIG_OF_EARLY_FLATTREE=y +CONFIG_OF_FLATTREE=y +CONFIG_OF_GPIO=y +CONFIG_OF_IOMMU=y +CONFIG_OF_IRQ=y +CONFIG_OF_KOBJ=y +CONFIG_OF_MDIO=y +CONFIG_OID_REGISTRY=y +CONFIG_PADATA=y +CONFIG_PAGE_OFFSET=0xff60000000000000 +CONFIG_PAGE_POOL=y +CONFIG_PAGE_SIZE_LESS_THAN_256KB=y +CONFIG_PAGE_SIZE_LESS_THAN_64KB=y +# CONFIG_PAGE_TABLE_CHECK is not set +CONFIG_PANIC_TIMEOUT=0 +CONFIG_PCPU_DEV_REFCNT=y +CONFIG_PGTABLE_LEVELS=5 +CONFIG_PHYLIB=y +CONFIG_PHYLINK=y +CONFIG_PHYS_ADDR_T_64BIT=y +CONFIG_PHY_SUN4I_USB=y +CONFIG_PHY_SUN50I_USB3=y +# CONFIG_PHY_SUN6I_MIPI_DPHY is not set +# CONFIG_PHY_SUN9I_USB is not set +CONFIG_PINCTRL=y +CONFIG_PINCTRL_SUN20I_D1=y +# CONFIG_PINCTRL_SUN4I_A10 is not set +# CONFIG_PINCTRL_SUN50I_A100 is not set +# CONFIG_PINCTRL_SUN50I_A100_R is not set +# CONFIG_PINCTRL_SUN50I_A64 is not set +# CONFIG_PINCTRL_SUN50I_A64_R is not set +# CONFIG_PINCTRL_SUN50I_H5 is not set +# CONFIG_PINCTRL_SUN50I_H6 is not set +# CONFIG_PINCTRL_SUN50I_H616 is not set +# CONFIG_PINCTRL_SUN50I_H616_R is not set +# CONFIG_PINCTRL_SUN50I_H6_R is not set +# CONFIG_PINCTRL_SUN5I is not set +# CONFIG_PINCTRL_SUN6I_A31 is not set +# CONFIG_PINCTRL_SUN6I_A31_R is not set +# CONFIG_PINCTRL_SUN8I_A23 is not set +# CONFIG_PINCTRL_SUN8I_A23_R is not set +# CONFIG_PINCTRL_SUN8I_A33 is not set +# CONFIG_PINCTRL_SUN8I_A83T is not set +# CONFIG_PINCTRL_SUN8I_A83T_R is not set +# CONFIG_PINCTRL_SUN8I_H3 is not set +# CONFIG_PINCTRL_SUN8I_H3_R is not set +# CONFIG_PINCTRL_SUN8I_V3S is not set +# CONFIG_PINCTRL_SUN9I_A80 is not set +# CONFIG_PINCTRL_SUN9I_A80_R is not set +CONFIG_PINCTRL_SUNXI=y +CONFIG_PORTABLE=y +CONFIG_POSIX_CPU_TIMERS_TASK_WORK=y +CONFIG_POWER_RESET=y +CONFIG_POWER_RESET_SYSCON=y +CONFIG_POWER_RESET_SYSCON_POWEROFF=y +CONFIG_POWER_SUPPLY=y +CONFIG_PPS=y +CONFIG_PREEMPT_NONE_BUILD=y +CONFIG_PRINTK_TIME=y +CONFIG_PTP_1588_CLOCK=y +CONFIG_PTP_1588_CLOCK_OPTIONAL=y +CONFIG_PWM=y +# CONFIG_PWM_CLK is not set +# CONFIG_PWM_SIFIVE is not set +# CONFIG_PWM_SUN4I is not set +# CONFIG_PWM_SUN8I_V536 is not set +CONFIG_PWM_SYSFS=y +# CONFIG_PWM_XILINX is not set +CONFIG_RATIONAL=y +CONFIG_RCU_TRACE=y +CONFIG_REALTEK_PHY=y +CONFIG_REGMAP=y +CONFIG_REGMAP_I2C=y +CONFIG_REGMAP_IRQ=y +CONFIG_REGMAP_MMIO=y +CONFIG_REGULATOR=y +# CONFIG_REGULATOR_AXP20X is not set +CONFIG_REGULATOR_FIXED_VOLTAGE=y +CONFIG_REGULATOR_SUN20I=y +# CONFIG_RESET_ATTACK_MITIGATION is not set +CONFIG_RESET_CONTROLLER=y +CONFIG_RESET_SIMPLE=y +CONFIG_RESET_SUNXI=y +CONFIG_RISCV=y +CONFIG_RISCV_ALTERNATIVE=y +CONFIG_RISCV_ALTERNATIVE_EARLY=y +CONFIG_RISCV_BOOT_SPINWAIT=y +CONFIG_RISCV_DMA_NONCOHERENT=y +CONFIG_RISCV_INTC=y +CONFIG_RISCV_ISA_C=y +CONFIG_RISCV_ISA_SVPBMT=y +CONFIG_RISCV_ISA_ZICBOM=y +CONFIG_RISCV_SBI=y +CONFIG_RISCV_SBI_V01=y +CONFIG_RISCV_TIMER=y +CONFIG_RTC_CLASS=y +# CONFIG_RTC_DRV_EFI is not set +CONFIG_RTC_DRV_GOLDFISH=y +CONFIG_RTC_DRV_SUN6I=y +CONFIG_RTC_I2C_AND_SPI=y +CONFIG_RWSEM_SPIN_ON_OWNER=y +CONFIG_SCHED_DEBUG=y +CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y +CONFIG_SERIAL_8250_DW=y +CONFIG_SERIAL_8250_DWLIB=y +CONFIG_SERIAL_8250_NR_UARTS=4 +CONFIG_SERIAL_8250_RUNTIME_UARTS=4 +CONFIG_SERIAL_EARLYCON_RISCV_SBI=y +CONFIG_SERIAL_MCTRL_GPIO=y +CONFIG_SERIAL_OF_PLATFORM=y +CONFIG_SERIO=y +CONFIG_SERIO_SERPORT=y +CONFIG_SG_POOL=y +CONFIG_SIFIVE_PLIC=y +CONFIG_SLUB_DEBUG=y +CONFIG_SMP=y +# CONFIG_SND_SUN20I_CODEC is not set +# CONFIG_SND_SUN4I_I2S is not set +# CONFIG_SND_SUN50I_DMIC is not set +CONFIG_SOCK_RX_QUEUE_MAPPING=y +# CONFIG_SOC_MICROCHIP_POLARFIRE is not set +# CONFIG_SOC_SIFIVE is not set +# CONFIG_SOC_STARFIVE is not set +# CONFIG_SOC_VIRT is not set +CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y +CONFIG_SPARSE_IRQ=y +CONFIG_SPI=y +CONFIG_SPI_BITBANG=y +CONFIG_SPI_MASTER=y +CONFIG_SPI_MEM=y +# CONFIG_SPI_SUN4I is not set +CONFIG_SPI_SUN6I=y +CONFIG_SRCU=y +CONFIG_STACKDEPOT=y +CONFIG_STACKTRACE=y +CONFIG_STMMAC_ETH=y +CONFIG_STMMAC_PLATFORM=y +CONFIG_SUN20I_D1_CCU=y +CONFIG_SUN20I_D1_R_CCU=y +# CONFIG_SUN4I_EMAC is not set +CONFIG_SUN4I_TIMER=y +CONFIG_SUN50I_IOMMU=y +CONFIG_SUN6I_MSGBOX=y +CONFIG_SUN6I_RTC_CCU=y +CONFIG_SUN8I_DE2_CCU=y +# CONFIG_SUN8I_R_CCU is not set +# CONFIG_SUN8I_THERMAL is not set +CONFIG_SUNXI_CCU=y +# CONFIG_SUNXI_RSB is not set +CONFIG_SUNXI_SRAM=y +CONFIG_SUNXI_WATCHDOG=y +CONFIG_SWIOTLB=y +CONFIG_SWPHY=y +CONFIG_SYSCTL_EXCEPTION_TRACE=y +# CONFIG_SYSFB_SIMPLEFB is not set +CONFIG_SYSFS_SYSCALL=y +CONFIG_THREAD_INFO_IN_TASK=y +CONFIG_TICK_CPU_ACCOUNTING=y +CONFIG_TIMER_OF=y +CONFIG_TIMER_PROBE=y +CONFIG_TOOLCHAIN_HAS_ZICBOM=y +CONFIG_TOOLCHAIN_HAS_ZIHINTPAUSE=y +CONFIG_TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI=y +CONFIG_TRACE_CLOCK=y +CONFIG_TREE_RCU=y +CONFIG_TREE_SRCU=y +CONFIG_TUNE_GENERIC=y +# CONFIG_UACCE is not set +CONFIG_UCS2_STRING=y +CONFIG_UEVENT_HELPER_PATH="" +CONFIG_USB=y +CONFIG_USB_COMMON=y +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_EHCI_HCD_PLATFORM=y +CONFIG_USB_HID=y +CONFIG_USB_MUSB_HDRC=y +CONFIG_USB_MUSB_HOST=y +CONFIG_USB_MUSB_SUNXI=y +CONFIG_USB_NET_DRIVERS=y +CONFIG_USB_OHCI_HCD=y +CONFIG_USB_OHCI_HCD_PLATFORM=y +CONFIG_USB_PHY=y +CONFIG_USB_SUPPORT=y +# CONFIG_USB_UHCI_HCD is not set +CONFIG_USB_XHCI_HCD=y +# CONFIG_USB_XHCI_PLATFORM is not set +CONFIG_VGA_ARB=y +CONFIG_VGA_ARB_MAX_GPUS=16 +# CONFIG_VHOST_MENU is not set +# CONFIG_VIRTIO_MENU is not set +CONFIG_VMAP_STACK=y +CONFIG_VM_EVENT_COUNTERS=y +CONFIG_WATCHDOG_CORE=y +CONFIG_XPS=y +CONFIG_ZLIB_INFLATE=y +CONFIG_ZONE_DMA32=y diff --git a/target/linux/d1/image/Config.in b/target/linux/d1/image/Config.in new file mode 100644 index 00000000000000..92169c8eb2b9f7 --- /dev/null +++ b/target/linux/d1/image/Config.in @@ -0,0 +1,5 @@ +config D1_SD_BOOT_PARTSIZE + int "Boot (SD Card) filesystem partition size (in MB)" + depends on TARGET_d1 + default 32 + diff --git a/target/linux/d1/image/Makefile b/target/linux/d1/image/Makefile new file mode 100644 index 00000000000000..aadf1807e751af --- /dev/null +++ b/target/linux/d1/image/Makefile @@ -0,0 +1,94 @@ +# +# Copyright (C) 2023 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/image.mk + +FAT32_BLOCK_SIZE=1024 +FAT32_BLOCKS=$(shell echo $$(($(CONFIG_D1_SD_BOOT_PARTSIZE)*1024*1024/$(FAT32_BLOCK_SIZE)))) + +KERNEL_LOADADDR:=0x40200000 + +define Build/riscv-sdcard + rm -f $@.boot #$(KDIR_TMP)/$(IMG_PREFIX)-$(PROFILE)-boot.img + mkfs.fat $@.boot -C $(FAT32_BLOCKS) + + mcopy -i $@.boot $(STAGING_DIR_IMAGE)/$(DEVICE_NAME)-boot.scr ::boot.scr + mcopy -i $@.boot $(DTS_DIR)/$(DEVICE_DTS).dtb ::dtb + mcopy -i $@.boot $(IMAGE_KERNEL) ::Image + + ./gen_d1_sdcard_img.sh \ + $@ \ + $@.boot \ + $(IMAGE_ROOTFS) \ + $(CONFIG_D1_SD_BOOT_PARTSIZE) \ + $(CONFIG_TARGET_ROOTFS_PARTSIZE) \ + $(STAGING_DIR_IMAGE)/$(DEVICE_NAME)-u-boot-sunxi-with-spl.bin +endef + +define Device/Default + PROFILES := Default + KERNEL_NAME := Image + KERNEL := kernel-bin + IMAGES := sdcard.img.gz + IMAGE/sdcard.img.gz := riscv-sdcard | append-metadata | gzip +endef + +define Device/FitImageGzip + KERNEL_SUFFIX := -fit-uImage.itb + KERNEL = kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb + KERNEL_NAME := Image +endef + +define Device/FitImage + KERNEL_SUFFIX := -fit-uImage.itb + KERNEL = kernel-bin | fit none $$(DTS_DIR)/$$(DEVICE_DTS).dtb + KERNEL_NAME := Image +endef + +define Device/dongshan_nezha_stu + $(call Device/Default) + DEVICE_VENDOR := Dongshan + DEVICE_MODEL := Nezha STU devkit + DEVICE_DTS := allwinner/sun20i-d1-dongshan-nezha-stu + UBOOT := dongshan_nezha_stu +endef +TARGET_DEVICES += dongshan_nezha_stu + +define Device/lichee_rv_dock + $(call Device/Default) + DEVICE_VENDOR := Sipeed + DEVICE_MODEL := LicheePi RV (dock) + DEVICE_DTS := allwinner/sun20i-d1-lichee-rv-dock + DEVICE_PACKAGES += kmod-rtl8723bs + UBOOT := lichee_rv_dock +endef +TARGET_DEVICES += lichee_rv_dock + +define Device/mangopi_mq_pro + $(call Device/Default) + DEVICE_VENDOR := MangoPi + DEVICE_MODEL := MQ Pro + DEVICE_DTS := allwinner/sun20i-d1-mangopi-mq-pro + DEVICE_PACKAGES += kmod-rtl8723bs + UBOOT := mangopi_mq_pro +endef +TARGET_DEVICES += mangopi_mq_pro + +define Device/nezha + $(call Device/Default) + DEVICE_VENDOR := Nezha + DEVICE_MODEL := D1 + DEVICE_DTS := allwinner/sun20i-d1-nezha + UBOOT := nezha +endef +TARGET_DEVICES += nezha + +define Image/Build + $(call Image/Build/$(1),$(1)) +endef + +$(eval $(call BuildImage)) diff --git a/target/linux/d1/image/gen_d1_sdcard_img.sh b/target/linux/d1/image/gen_d1_sdcard_img.sh new file mode 100755 index 00000000000000..197eea7a20d147 --- /dev/null +++ b/target/linux/d1/image/gen_d1_sdcard_img.sh @@ -0,0 +1,33 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-only +# +# Copyright (C) 2013 OpenWrt.org + +set -ex +[ $# -eq 6 ] || { + echo "SYNTAX: $0 " + exit 1 +} + +OUTPUT="$1" +BOOTFS="$2" +ROOTFS="$3" +BOOTFSSIZE="$4" +ROOTFSSIZE="$5" +UBOOT="$6" + +ROOTFSPTOFFSET=$(($BOOTFSSIZE + 20 + 1)) + +head=4 +sect=63 + +set $(ptgen -o $OUTPUT -h $head -s $sect -l 1024 -t c -p ${BOOTFSSIZE}M@20M -t 83 -p ${ROOTFSSIZE}M@${ROOTFSPTOFFSET}M) + +BOOTOFFSET="$(($1 / 512))" +BOOTSIZE="$(($2 / 512))" +ROOTFSOFFSET="$(($3 / 512))" +ROOTFSSIZE="$(($4 / 512))" + +dd bs=512 if="$UBOOT" of="$OUTPUT" seek=256 conv=notrunc +dd bs=512 if="$BOOTFS" of="$OUTPUT" seek="$BOOTOFFSET" conv=notrunc +dd bs=512 if="$ROOTFS" of="$OUTPUT" seek="$ROOTFSOFFSET" conv=notrunc diff --git a/target/linux/d1/patches-6.1/0001-dt-bindings-net-bluetooth-realtek-Add-RTL8723DS.patch b/target/linux/d1/patches-6.1/0001-dt-bindings-net-bluetooth-realtek-Add-RTL8723DS.patch new file mode 100644 index 00000000000000..6636cddde6beb1 --- /dev/null +++ b/target/linux/d1/patches-6.1/0001-dt-bindings-net-bluetooth-realtek-Add-RTL8723DS.patch @@ -0,0 +1,32 @@ +From e663d510ae6a81694a8e9e1ce07bb80dd6b77558 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sun, 24 Jul 2022 17:12:07 -0500 +Subject: [PATCH 001/117] dt-bindings: net: bluetooth: realtek: Add RTL8723DS + +RTL8723DS is another version of the RTL8723 WiFi + Bluetooth chip. It is +already supported by the hci_uart/btrtl driver. Document the compatible. + +Series-to: Marcel Holtmann +Series-to: Johan Hedberg +Series-to: Luiz Augusto von Dentz +Series-to: David S. Miller +Series-to: Eric Dumazet +Series-to: Jakub Kicinski +Series-to: Paolo Abeni +Series-cc: linux-bluetooth@vger.kernel.org + +Signed-off-by: Samuel Holland +--- + Documentation/devicetree/bindings/net/realtek-bluetooth.yaml | 1 + + 1 file changed, 1 insertion(+) + +--- a/Documentation/devicetree/bindings/net/realtek-bluetooth.yaml ++++ b/Documentation/devicetree/bindings/net/realtek-bluetooth.yaml +@@ -20,6 +20,7 @@ properties: + enum: + - realtek,rtl8723bs-bt + - realtek,rtl8723cs-bt ++ - realtek,rtl8723ds-bt + - realtek,rtl8822cs-bt + + device-wake-gpios: diff --git a/target/linux/d1/patches-6.1/0002-clk-sunxi-ng-mp-Avoid-computing-the-rate-twice.patch b/target/linux/d1/patches-6.1/0002-clk-sunxi-ng-mp-Avoid-computing-the-rate-twice.patch new file mode 100644 index 00000000000000..22d4885e291f1a --- /dev/null +++ b/target/linux/d1/patches-6.1/0002-clk-sunxi-ng-mp-Avoid-computing-the-rate-twice.patch @@ -0,0 +1,51 @@ +From 74492b9ecd874496578693d9985649665b560308 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sun, 7 Aug 2022 20:08:49 -0500 +Subject: [PATCH 002/117] clk: sunxi-ng: mp: Avoid computing the rate twice + +ccu_mp_find_best() already computes a best_rate at the same time as the +best m and p factors. Return it so the caller does not need to duplicate +the division. + +Series-to: Chen-Yu Tsai +Series-to: Jernej Skrabec + +Signed-off-by: Samuel Holland +--- + drivers/clk/sunxi-ng/ccu_mp.c | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +--- a/drivers/clk/sunxi-ng/ccu_mp.c ++++ b/drivers/clk/sunxi-ng/ccu_mp.c +@@ -10,9 +10,9 @@ + #include "ccu_gate.h" + #include "ccu_mp.h" + +-static void ccu_mp_find_best(unsigned long parent, unsigned long rate, +- unsigned int max_m, unsigned int max_p, +- unsigned int *m, unsigned int *p) ++static unsigned long ccu_mp_find_best(unsigned long parent, unsigned long rate, ++ unsigned int max_m, unsigned int max_p, ++ unsigned int *m, unsigned int *p) + { + unsigned long best_rate = 0; + unsigned int best_m = 0, best_p = 0; +@@ -35,6 +35,8 @@ static void ccu_mp_find_best(unsigned lo + + *m = best_m; + *p = best_p; ++ ++ return best_rate; + } + + static unsigned long ccu_mp_find_best_with_parent_adj(struct clk_hw *hw, +@@ -109,8 +111,7 @@ static unsigned long ccu_mp_round_rate(s + max_p = cmp->p.max ?: 1 << ((1 << cmp->p.width) - 1); + + if (!clk_hw_can_set_rate_parent(&cmp->common.hw)) { +- ccu_mp_find_best(*parent_rate, rate, max_m, max_p, &m, &p); +- rate = *parent_rate / p / m; ++ rate = ccu_mp_find_best(*parent_rate, rate, max_m, max_p, &m, &p); + } else { + rate = ccu_mp_find_best_with_parent_adj(hw, parent_rate, rate, + max_m, max_p); diff --git a/target/linux/d1/patches-6.1/0003-dt-bindings-net-sun8i-emac-Add-phy-supply-property.patch b/target/linux/d1/patches-6.1/0003-dt-bindings-net-sun8i-emac-Add-phy-supply-property.patch new file mode 100644 index 00000000000000..ec3f553b51b579 --- /dev/null +++ b/target/linux/d1/patches-6.1/0003-dt-bindings-net-sun8i-emac-Add-phy-supply-property.patch @@ -0,0 +1,22 @@ +From 7185f7b424dfd9082bf0859a60b98a2dbd784ed6 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Mon, 5 Sep 2022 16:45:44 -0500 +Subject: [PATCH 003/117] dt-bindings: net: sun8i-emac: Add phy-supply property + +Signed-off-by: Samuel Holland +--- + .../devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/Documentation/devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml ++++ b/Documentation/devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml +@@ -40,6 +40,9 @@ properties: + clock-names: + const: stmmaceth + ++ phy-supply: ++ description: PHY regulator ++ + syscon: + $ref: /schemas/types.yaml#/definitions/phandle + description: diff --git a/target/linux/d1/patches-6.1/0004-dt-bindings-net-sun8i-emac-Add-properties-from-dwmac.patch b/target/linux/d1/patches-6.1/0004-dt-bindings-net-sun8i-emac-Add-properties-from-dwmac.patch new file mode 100644 index 00000000000000..9ac335ae3e0488 --- /dev/null +++ b/target/linux/d1/patches-6.1/0004-dt-bindings-net-sun8i-emac-Add-properties-from-dwmac.patch @@ -0,0 +1,32 @@ +From d20bb97fac77e4d88424043627c769427fc0d35e Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Mon, 5 Sep 2022 16:46:34 -0500 +Subject: [PATCH 004/117] dt-bindings: net: sun8i-emac: Add properties from + dwmac binding + +Signed-off-by: Samuel Holland +--- + .../devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/Documentation/devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml ++++ b/Documentation/devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml +@@ -40,6 +40,9 @@ properties: + clock-names: + const: stmmaceth + ++ resets: true ++ reset-names: true ++ + phy-supply: + description: PHY regulator + +@@ -49,6 +52,8 @@ properties: + Phandle to the device containing the EMAC or GMAC clock + register + ++ mdio: true ++ + required: + - compatible + - reg diff --git a/target/linux/d1/patches-6.1/0005-dt-bindings-display-sun8i-a83t-dw-hdmi-Remove-phy-ce.patch b/target/linux/d1/patches-6.1/0005-dt-bindings-display-sun8i-a83t-dw-hdmi-Remove-phy-ce.patch new file mode 100644 index 00000000000000..402f291674bfff --- /dev/null +++ b/target/linux/d1/patches-6.1/0005-dt-bindings-display-sun8i-a83t-dw-hdmi-Remove-phy-ce.patch @@ -0,0 +1,28 @@ +From c99d1e681dc460892004054a314fa7f929f43490 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sat, 13 Aug 2022 10:45:59 -0500 +Subject: [PATCH 005/117] dt-bindings: display: sun8i-a83t-dw-hdmi: Remove + #phy-cells + +This device is not a PHY, and none of the nodes using this schema +contain a #phy-cells property. Likely this was a copy/paste error +introduced during the YAML conversion. + +Fixes: f5a98bfe7b37 ("dt-bindings: display: Convert Allwinner display pipeline to schemas") +Signed-off-by: Samuel Holland +--- + .../bindings/display/allwinner,sun8i-a83t-dw-hdmi.yaml | 3 --- + 1 file changed, 3 deletions(-) + +--- a/Documentation/devicetree/bindings/display/allwinner,sun8i-a83t-dw-hdmi.yaml ++++ b/Documentation/devicetree/bindings/display/allwinner,sun8i-a83t-dw-hdmi.yaml +@@ -20,9 +20,6 @@ maintainers: + - Maxime Ripard + + properties: +- "#phy-cells": +- const: 0 +- + compatible: + oneOf: + - const: allwinner,sun8i-a83t-dw-hdmi diff --git a/target/linux/d1/patches-6.1/0006-dt-bindings-display-Add-D1-HDMI-compatibles.patch b/target/linux/d1/patches-6.1/0006-dt-bindings-display-Add-D1-HDMI-compatibles.patch new file mode 100644 index 00000000000000..b62e45c09f8ae1 --- /dev/null +++ b/target/linux/d1/patches-6.1/0006-dt-bindings-display-Add-D1-HDMI-compatibles.patch @@ -0,0 +1,34 @@ +From e214b79d45cccdd0cfe839e54da2b3c82b6c6be4 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Thu, 31 Mar 2022 23:43:15 -0500 +Subject: [PATCH 006/117] dt-bindings: display: Add D1 HDMI compatibles + +Allwinner D1 contains a DesignWare HDMI controller with some changes in +platform integration, and a new HDMI PHY. Add their compatibles. + +Signed-off-by: Samuel Holland +--- + .../bindings/display/allwinner,sun8i-a83t-dw-hdmi.yaml | 1 + + .../bindings/display/allwinner,sun8i-a83t-hdmi-phy.yaml | 1 + + 2 files changed, 2 insertions(+) + +--- a/Documentation/devicetree/bindings/display/allwinner,sun8i-a83t-dw-hdmi.yaml ++++ b/Documentation/devicetree/bindings/display/allwinner,sun8i-a83t-dw-hdmi.yaml +@@ -29,6 +29,7 @@ properties: + - enum: + - allwinner,sun8i-h3-dw-hdmi + - allwinner,sun8i-r40-dw-hdmi ++ - allwinner,sun20i-d1-dw-hdmi + - allwinner,sun50i-a64-dw-hdmi + - const: allwinner,sun8i-a83t-dw-hdmi + +--- a/Documentation/devicetree/bindings/display/allwinner,sun8i-a83t-hdmi-phy.yaml ++++ b/Documentation/devicetree/bindings/display/allwinner,sun8i-a83t-hdmi-phy.yaml +@@ -19,6 +19,7 @@ properties: + - allwinner,sun8i-a83t-hdmi-phy + - allwinner,sun8i-h3-hdmi-phy + - allwinner,sun8i-r40-hdmi-phy ++ - allwinner,sun20i-d1-hdmi-phy + - allwinner,sun50i-a64-hdmi-phy + - allwinner,sun50i-h6-hdmi-phy + diff --git a/target/linux/d1/patches-6.1/0007-drm-sun4i-Add-support-for-D1-HDMI.patch b/target/linux/d1/patches-6.1/0007-drm-sun4i-Add-support-for-D1-HDMI.patch new file mode 100644 index 00000000000000..b55c3a3f20d941 --- /dev/null +++ b/target/linux/d1/patches-6.1/0007-drm-sun4i-Add-support-for-D1-HDMI.patch @@ -0,0 +1,52 @@ +From 75dc74ecc1bf5e270659c6c78877053b50e6ae19 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Wed, 30 Mar 2022 21:24:21 -0500 +Subject: [PATCH 007/117] drm/sun4i: Add support for D1 HDMI + +D1's HDMI controller contains some platform integration changes. +It now has no external TMDS clock. The controller also supports HDCP +without an external clock or reset. + +While the maximum HDMI frequency is not explicity stated, the BSP PHY +driver provides PLL configurations only up to 297 MHz, so use that as +the max frequency. + +Signed-off-by: Samuel Holland +--- + drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +--- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c ++++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c +@@ -133,7 +133,7 @@ static int sun8i_dw_hdmi_bind(struct dev + return dev_err_probe(dev, PTR_ERR(hdmi->rst_ctrl), + "Could not get ctrl reset control\n"); + +- hdmi->clk_tmds = devm_clk_get(dev, "tmds"); ++ hdmi->clk_tmds = devm_clk_get_optional(dev, "tmds"); + if (IS_ERR(hdmi->clk_tmds)) + return dev_err_probe(dev, PTR_ERR(hdmi->clk_tmds), + "Couldn't get the tmds clock\n"); +@@ -246,6 +246,11 @@ static const struct sun8i_dw_hdmi_quirks + .mode_valid = sun8i_dw_hdmi_mode_valid_a83t, + }; + ++static const struct sun8i_dw_hdmi_quirks sun20i_d1_quirks = { ++ .mode_valid = sun8i_dw_hdmi_mode_valid_a83t, ++ .use_drm_infoframe = true, ++}; ++ + static const struct sun8i_dw_hdmi_quirks sun50i_h6_quirks = { + .mode_valid = sun8i_dw_hdmi_mode_valid_h6, + .use_drm_infoframe = true, +@@ -257,6 +262,10 @@ static const struct of_device_id sun8i_d + .data = &sun8i_a83t_quirks, + }, + { ++ .compatible = "allwinner,sun20i-d1-dw-hdmi", ++ .data = &sun20i_d1_quirks, ++ }, ++ { + .compatible = "allwinner,sun50i-h6-dw-hdmi", + .data = &sun50i_h6_quirks, + }, diff --git a/target/linux/d1/patches-6.1/0008-drm-sun4i-sun8i-hdmi-phy-Add-support-for-D1-PHY.patch b/target/linux/d1/patches-6.1/0008-drm-sun4i-sun8i-hdmi-phy-Add-support-for-D1-PHY.patch new file mode 100644 index 00000000000000..e8007cc5c41e61 --- /dev/null +++ b/target/linux/d1/patches-6.1/0008-drm-sun4i-sun8i-hdmi-phy-Add-support-for-D1-PHY.patch @@ -0,0 +1,251 @@ +From 11f9765a8e6723bcb7243f6dbc48e6deaf17b097 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sun, 3 Apr 2022 15:15:41 -0500 +Subject: [PATCH 008/117] drm/sun4i: sun8i-hdmi-phy: Add support for D1 PHY + +Signed-off-by: Samuel Holland +--- + drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h | 169 +++++++++++++++++++++++++ + drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c | 32 +++++ + 2 files changed, 201 insertions(+) + +--- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h ++++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h +@@ -145,6 +145,175 @@ + + #define SUN8I_HDMI_PHY_CEC_REG 0x003c + ++#define SUN20I_HDMI_PHY_CTL0_REG 0x0040 ++#define SUN20I_HDMI_PHY_CTL0_PLL_LOCK_MODE_MAN BIT(31) ++#define SUN20I_HDMI_PHY_CTL0_PLL_LOCK_MODE BIT(30) ++#define SUN20I_HDMI_PHY_CTL0_FIFO_WORKC_EN BIT(29) ++#define SUN20I_HDMI_PHY_CTL0_FIFO_AUTOSYNC_DIS BIT(28) ++#define SUN20I_HDMI_PHY_CTL0_ENTX GENMASK(27, 24) ++#define SUN20I_HDMI_PHY_CTL0_ENBI GENMASK(23, 20) ++#define SUN20I_HDMI_PHY_CTL0_ENLDO BIT(18) ++#define SUN20I_HDMI_PHY_CTL0_ENLDO_FS BIT(17) ++#define SUN20I_HDMI_PHY_CTL0_ENCK BIT(16) ++#define SUN20I_HDMI_PHY_CTL0_REG_PLR GENMASK(15, 12) ++#define SUN20I_HDMI_PHY_CTL0_REG_DEN GENMASK(11, 8) ++#define SUN20I_HDMI_PHY_CTL0_REG_CSMPS GENMASK(7, 6) ++#define SUN20I_HDMI_PHY_CTL0_REG_CK_TEST_SEL BIT(5) ++#define SUN20I_HDMI_PHY_CTL0_REG_CK_SEL BIT(4) ++#define SUN20I_HDMI_PHY_CTL0_HPD_EN BIT(2) ++#define SUN20I_HDMI_PHY_CTL0_SCL_EN BIT(1) ++#define SUN20I_HDMI_PHY_CTL0_SDA_EN BIT(0) ++ ++#define SUN20I_HDMI_PHY_CTL1_REG 0x0044 ++#define SUN20I_HDMI_PHY_CTL1_RXSENSE_MODE_MAN BIT(31) ++#define SUN20I_HDMI_PHY_CTL1_RXSENSE_MODE BIT(30) ++#define SUN20I_HDMI_PHY_CTL1_RES_S GENMASK(29, 28) ++#define SUN20I_HDMI_PHY_CTL1_RES_SCKTMDS BIT(27) ++#define SUN20I_HDMI_PHY_CTL1_REG_SWI BIT(26) ++#define SUN20I_HDMI_PHY_CTL1_REG_SVR GENMASK(25, 24) ++#define SUN20I_HDMI_PHY_CTL1_REG_BST2 GENMASK(21, 20) ++#define SUN20I_HDMI_PHY_CTL1_REG_BST1 GENMASK(19, 18) ++#define SUN20I_HDMI_PHY_CTL1_REG_BST0 GENMASK(17, 16) ++#define SUN20I_HDMI_PHY_CTL1_REG_SP2_3 GENMASK(15, 12) ++#define SUN20I_HDMI_PHY_CTL1_REG_SP2_2 GENMASK(11, 8) ++#define SUN20I_HDMI_PHY_CTL1_REG_SP2_1 GENMASK(7, 4) ++#define SUN20I_HDMI_PHY_CTL1_REG_SP2_0 GENMASK(3, 0) ++ ++#define SUN20I_HDMI_PHY_CTL2_REG 0x0048 ++#define SUN20I_HDMI_PHY_CTL2_HPDO_MODE_MAN BIT(31) ++#define SUN20I_HDMI_PHY_CTL2_HPDO_MODE BIT(30) ++#define SUN20I_HDMI_PHY_CTL2_REG_RESDI GENMASK(29, 24) ++#define SUN20I_HDMI_PHY_CTL2_REG_SP1_3 GENMASK(23, 19) ++#define SUN20I_HDMI_PHY_CTL2_REG_SP1_2 GENMASK(18, 14) ++#define SUN20I_HDMI_PHY_CTL2_REG_SP1_1 GENMASK(13, 9) ++#define SUN20I_HDMI_PHY_CTL2_REG_SP1_0 GENMASK(8, 4) ++#define SUN20I_HDMI_PHY_CTL2_REG_P2OPT GENMASK(3, 0) ++ ++#define SUN20I_HDMI_PHY_CTL3_REG 0x004c ++#define SUN20I_HDMI_PHY_CTL3_REG_P2_3 GENMASK(31, 28) ++#define SUN20I_HDMI_PHY_CTL3_REG_P2_2 GENMASK(27, 24) ++#define SUN20I_HDMI_PHY_CTL3_REG_P2_1 GENMASK(23, 20) ++#define SUN20I_HDMI_PHY_CTL3_REG_P2_0 GENMASK(19, 16) ++#define SUN20I_HDMI_PHY_CTL3_REG_MC3 GENMASK(15, 12) ++#define SUN20I_HDMI_PHY_CTL3_REG_MC2 GENMASK(11, 8) ++#define SUN20I_HDMI_PHY_CTL3_REG_MC1 GENMASK(7, 4) ++#define SUN20I_HDMI_PHY_CTL3_REG_MC0 GENMASK(3, 0) ++ ++#define SUN20I_HDMI_PHY_CTL4_REG 0x0050 ++#define SUN20I_HDMI_PHY_CTL4_REG_SLV GENMASK(31, 29) ++#define SUN20I_HDMI_PHY_CTL4_REG_P1_3 GENMASK(28, 24) ++#define SUN20I_HDMI_PHY_CTL4_REG_P1_2 GENMASK(20, 16) ++#define SUN20I_HDMI_PHY_CTL4_REG_P1_1 GENMASK(12, 8) ++#define SUN20I_HDMI_PHY_CTL4_REG_P1_0 GENMASK(4, 0) ++ ++#define SUN20I_HDMI_PHY_CTL5_REG 0x0054 ++#define SUN20I_HDMI_PHY_CTL5_REG_P1OPT GENMASK(19, 16) ++#define SUN20I_HDMI_PHY_CTL5_REG_CKPDLYOPT BIT(12) ++#define SUN20I_HDMI_PHY_CTL5_REG_CALSW BIT(11) ++#define SUN20I_HDMI_PHY_CTL5_ENRESCK BIT(10) ++#define SUN20I_HDMI_PHY_CTL5_ENRES BIT(9) ++#define SUN20I_HDMI_PHY_CTL5_ENRCAL BIT(8) ++#define SUN20I_HDMI_PHY_CTL5_ENP2S GENMASK(7, 4) ++#define SUN20I_HDMI_PHY_CTL5_ENIB BIT(1) ++#define SUN20I_HDMI_PHY_CTL5_ENCALOG BIT(0) ++ ++#define SUN20I_HDMI_PLL_CTL0_REG 0x0058 ++#define SUN20I_HDMI_PLL_CTL0_CKO_SEL GENMASK(31, 30) ++#define SUN20I_HDMI_PLL_CTL0_BYPASS_PPLL BIT(29) ++#define SUN20I_HDMI_PLL_CTL0_ENVBS BIT(28) ++#define SUN20I_HDMI_PLL_CTL0_SLV GENMASK(26, 24) ++#define SUN20I_HDMI_PLL_CTL0_BCR BIT(23) ++#define SUN20I_HDMI_PLL_CTL0_BYPASS_CLRDPTH BIT(22) ++#define SUN20I_HDMI_PLL_CTL0_CLR_DPTH GENMASK(21, 20) ++#define SUN20I_HDMI_PLL_CTL0_CUTFB BIT(18) ++#define SUN20I_HDMI_PLL_CTL0_DIV2_CKBIT BIT(17) ++#define SUN20I_HDMI_PLL_CTL0_DIV2_CKTMDS BIT(16) ++#define SUN20I_HDMI_PLL_CTL0_DIV_PRE GENMASK(15, 12) ++#define SUN20I_HDMI_PLL_CTL0_DIVX1 BIT(10) ++#define SUN20I_HDMI_PLL_CTL0_SDRVEN BIT(9) ++#define SUN20I_HDMI_PLL_CTL0_VCORANGE BIT(8) ++#define SUN20I_HDMI_PLL_CTL0_N_CNTRL GENMASK(7, 6) ++#define SUN20I_HDMI_PLL_CTL0_GMP_CNTRL GENMASK(5, 4) ++#define SUN20I_HDMI_PLL_CTL0_PROP_CNTRL GENMASK(2, 0) ++ ++#define SUN20I_HDMI_PLL_CTL1_REG 0x005c ++#define SUN20I_HDMI_PLL_CTL1_CTRL_MODLE_CLKSRC BIT(31) ++#define SUN20I_HDMI_PLL_CTL1_PCNT_N GENMASK(27, 20) ++#define SUN20I_HDMI_PLL_CTL1_PCNT_EN BIT(19) ++#define SUN20I_HDMI_PLL_CTL1_SDM_EN BIT(18) ++#define SUN20I_HDMI_PLL_CTL1_PIXEL_REP GENMASK(17, 16) ++#define SUN20I_HDMI_PLL_CTL1_PWRON BIT(12) ++#define SUN20I_HDMI_PLL_CTL1_RESET BIT(11) ++#define SUN20I_HDMI_PLL_CTL1_SCKREF BIT(10) ++#define SUN20I_HDMI_PLL_CTL1_SCKFB BIT(9) ++#define SUN20I_HDMI_PLL_CTL1_DRV_ANA BIT(8) ++#define SUN20I_HDMI_PLL_CTL1_FAST_TECH BIT(7) ++#define SUN20I_HDMI_PLL_CTL1_GEAR_SHIFT BIT(6) ++#define SUN20I_HDMI_PLL_CTL1_REF_CNTRL GENMASK(5, 4) ++#define SUN20I_HDMI_PLL_CTL1_INT_CNTRL GENMASK(2, 0) ++ ++#define SUN20I_HDMI_AFIFO_CFG_REG 0x0060 ++#define SUN20I_HDMI_AFIFO_CFG_AFIFO_ERROR BIT(0) ++#define SUN20I_HDMI_AFIFO_CFG_AFIFO_ERROR_DET BIT(1) ++ ++#define SUN20I_HDMI_MODULATOR_CFG0_REG 0x0064 ++#define SUN20I_HDMI_MODULATOR_CFG1_REG 0x0068 ++ ++#define SUN20I_HDMI_INDEB_CTRL_REG 0x006c ++#define SUN20I_HDMI_INDEB_CTRL_HPDI_DEBUGMODE BIT(29) ++#define SUN20I_HDMI_INDEB_CTRL_HPDI_DEBUG BIT(28) ++#define SUN20I_HDMI_INDEB_CTRL_SDAI_DEBUGMODE BIT(25) ++#define SUN20I_HDMI_INDEB_CTRL_SDAI_DEBUG BIT(24) ++#define SUN20I_HDMI_INDEB_CTRL_SCLI_DEBUGMODE BIT(21) ++#define SUN20I_HDMI_INDEB_CTRL_SCLI_DEBUG BIT(20) ++#define SUN20I_HDMI_INDEB_CTRL_CECI_DEBUGMODE BIT(17) ++#define SUN20I_HDMI_INDEB_CTRL_CECI_DEBUG BIT(16) ++#define SUN20I_HDMI_INDEB_CTRL_TXDATA_DEBUGMODE GENMASK(1, 0) ++ ++#define SUN20I_HDMI_INDBG_TXD0_REG 0x0070 ++#define SUN20I_HDMI_INDBG_TXD1_REG 0x0074 ++#define SUN20I_HDMI_INDBG_TXD2_REG 0x0078 ++#define SUN20I_HDMI_INDBG_TXD3_REG 0x007c ++ ++#define SUN20I_HDMI_PLL_STS_REG 0x0080 ++#define SUN20I_HDMI_PLL_STS_PHY_CDETPCK_STATUS BIT(31) ++#define SUN20I_HDMI_PLL_STS_PHY_CDETP_STATUS GENMASK(30, 28) ++#define SUN20I_HDMI_PLL_STS_PHY_CDETNCK_STATUS BIT(27) ++#define SUN20I_HDMI_PLL_STS_PHY_CDETN_STATUS GENMASK(26, 24) ++#define SUN20I_HDMI_PLL_STS_PHY_HPDO_STATUS BIT(23) ++#define SUN20I_HDMI_PLL_STS_PHY_SCLO_STATUS BIT(22) ++#define SUN20I_HDMI_PLL_STS_PHY_SDAO_STATUS BIT(21) ++#define SUN20I_HDMI_PLL_STS_PHY_CECO_STATUS BIT(20) ++#define SUN20I_HDMI_PLL_STS_PHY_COUT2D_STATUS BIT(17) ++#define SUN20I_HDMI_PLL_STS_PHY_RCALEND2D_STS BIT(16) ++#define SUN20I_HDMI_PLL_STS_PHY_RESDO2D_STATUS GENMASK(13, 8) ++#define SUN20I_HDMI_PLL_STS_PLL_LOCK_STATUS BIT(4) ++#define SUN20I_HDMI_PLL_STS_RXSENSE_DLY_STATUS BIT(1) ++#define SUN20I_HDMI_PLL_STS_TX_READY_DLY_STATUS BIT(0) ++ ++#define SUN20I_HDMI_PRBS_CTL_REG 0x0084 ++#define SUN20I_HDMI_PRBS_SEED_GEN_REG 0x0088 ++#define SUN20I_HDMI_PRBS_SEED_CHK_REG 0x008c ++#define SUN20I_HDMI_PRBS_SEED_NUM_REG 0x0090 ++#define SUN20I_HDMI_PRBS_CYCLE_NUM_REG 0x0094 ++ ++#define SUN20I_HDMI_PLL_ODLY_REG 0x0098 ++#define SUN20I_HDMI_PLL_ODLY_RXSENSE_DLY_RESET BIT(31) ++#define SUN20I_HDMI_PLL_ODLY_RXSENSE_DLY_COUNT GENMASK(30, 16) ++#define SUN20I_HDMI_PLL_ODLY_TX_READY_DLY_RESET BIT(15) ++#define SUN20I_HDMI_PLL_ODLY_TX_READY_DLY_COUNT GENMASK(14, 0) ++ ++#define SUN20I_HDMI_PHY_CTL6_REG 0x009c ++#define SUN20I_HDMI_PHY_CTL6_SWITCH_CLKCH_DATA BIT(31) ++#define SUN20I_HDMI_PHY_CTL6_EN_CKDAT BIT(30) ++#define SUN20I_HDMI_PHY_CTL6_CLK_GREATE2_340M GENMASK(29, 20) ++#define SUN20I_HDMI_PHY_CTL6_CLK_GREATE1_340M GENMASK(19, 10) ++#define SUN20I_HDMI_PHY_CTL6_CLK_GREATE0_340M GENMASK(9, 0) ++ ++#define SUN20I_HDMI_PHY_CTL7_REG 0x00a0 ++#define SUN20I_HDMI_PHY_CTL7_CLK_LOW_340M GENMASK(21, 12) ++#define SUN20I_HDMI_PHY_CTL7_CLK_GREATE3_340M GENMASK(9, 0) ++ + struct sun8i_hdmi_phy; + + struct sun8i_hdmi_phy_variant { +--- a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c ++++ b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c +@@ -398,6 +398,28 @@ static const struct dw_hdmi_phy_ops sun8 + .setup_hpd = dw_hdmi_phy_setup_hpd, + }; + ++static int sun20i_d1_hdmi_phy_config(struct dw_hdmi *hdmi, void *data, ++ const struct drm_display_info *display, ++ const struct drm_display_mode *mode) ++{ ++ struct sun8i_hdmi_phy *phy = data; ++ ++ return 0; ++} ++ ++static void sun20i_d1_hdmi_phy_disable(struct dw_hdmi *hdmi, void *data) ++{ ++ struct sun8i_hdmi_phy *phy = data; ++} ++ ++static const struct dw_hdmi_phy_ops sun20i_d1_hdmi_phy_ops = { ++ .init = sun20i_d1_hdmi_phy_config, ++ .disable = sun20i_d1_hdmi_phy_disable, ++ .read_hpd = dw_hdmi_phy_read_hpd, ++ .update_hpd = dw_hdmi_phy_update_hpd, ++ .setup_hpd = dw_hdmi_phy_setup_hpd, ++}; ++ + static void sun8i_hdmi_phy_unlock(struct sun8i_hdmi_phy *phy) + { + /* enable read access to HDMI controller */ +@@ -576,6 +598,7 @@ void sun8i_hdmi_phy_set_ops(struct sun8i + const struct sun8i_hdmi_phy_variant *variant = phy->variant; + + if (variant->phy_ops) { ++ plat_data->phy_force_vendor = true; + plat_data->phy_ops = variant->phy_ops; + plat_data->phy_name = "sun8i_dw_hdmi_phy"; + plat_data->phy_data = phy; +@@ -612,6 +635,11 @@ static const struct sun8i_hdmi_phy_varia + .phy_init = &sun8i_hdmi_phy_init_h3, + }; + ++static const struct sun8i_hdmi_phy_variant sun20i_d1_hdmi_phy = { ++ .phy_ops = &sun20i_d1_hdmi_phy_ops, ++ .phy_init = &sun50i_hdmi_phy_init_h6, ++}; ++ + static const struct sun8i_hdmi_phy_variant sun50i_a64_hdmi_phy = { + .has_phy_clk = true, + .phy_ops = &sun8i_h3_hdmi_phy_ops, +@@ -639,6 +667,10 @@ static const struct of_device_id sun8i_h + .data = &sun8i_r40_hdmi_phy, + }, + { ++ .compatible = "allwinner,sun20i-d1-hdmi-phy", ++ .data = &sun20i_d1_hdmi_phy, ++ }, ++ { + .compatible = "allwinner,sun50i-a64-hdmi-phy", + .data = &sun50i_a64_hdmi_phy, + }, diff --git a/target/linux/d1/patches-6.1/0009-drm-sun4i-Copy-in-BSP-code-for-D1-HDMI-PHY.patch b/target/linux/d1/patches-6.1/0009-drm-sun4i-Copy-in-BSP-code-for-D1-HDMI-PHY.patch new file mode 100644 index 00000000000000..85c81d5057140e --- /dev/null +++ b/target/linux/d1/patches-6.1/0009-drm-sun4i-Copy-in-BSP-code-for-D1-HDMI-PHY.patch @@ -0,0 +1,621 @@ +From 7ea7d4abfd537230da58533803a2d0257addace8 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Wed, 30 Mar 2022 00:46:07 -0500 +Subject: [PATCH 009/117] drm/sun4i: Copy in BSP code for D1 HDMI PHY + +Signed-off-by: Samuel Holland +--- + drivers/gpu/drm/sun4i/aw_phy.h | 411 +++++++++++++++++++++++++ + drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h | 1 + + drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c | 156 ++++++++++ + 3 files changed, 568 insertions(+) + create mode 100644 drivers/gpu/drm/sun4i/aw_phy.h + +--- /dev/null ++++ b/drivers/gpu/drm/sun4i/aw_phy.h +@@ -0,0 +1,411 @@ ++/* ++ * Allwinner SoCs hdmi2.0 driver. ++ * ++ * Copyright (C) 2016 Allwinner. ++ * ++ * This file is licensed under the terms of the GNU General Public ++ * License version 2. This program is licensed "as is" without any ++ * warranty of any kind, whether express or implied. ++ */ ++ ++#ifndef AW_PHY_H_ ++#define AW_PHY_H_ ++ ++#define AW_PHY_TIMEOUT 1000 ++#define LOCK_TIMEOUT 100 ++ ++/* allwinner phy register offset */ ++#define HDMI_PHY_CTL0 0x40 ++#define HDMI_PHY_CTL1 0x44 ++#define HDMI_PHY_CTL2 0x48 ++#define HDMI_PHY_CTL3 0x4C ++#define HDMI_PHY_CTL4 0x50 ++#define HDMI_PHY_CTL5 0x54 ++#define HDMI_PLL_CTL0 0x58 ++#define HDMI_PLL_CTL1 0x5C ++#define HDMI_AFIFO_CFG 0x60 ++#define HDMI_MODULATOR_CFG0 0x64 ++#define HDMI_MODULATOR_CFG1 0x68 ++#define HDMI_PHY_INDEB_CTRL 0x6C ++#define HDMI_PHY_INDBG_TXD0 0x70 ++#define HDMI_PHY_INDBG_TXD1 0x74 ++#define HDMI_PHY_INDBG_TXD2 0x78 ++#define HDMI_PHY_INDBG_TXD3 0x7C ++#define HDMI_PHY_PLL_STS 0x80 ++#define HDMI_PRBS_CTL 0x84 ++#define HDMI_PRBS_SEED_GEN 0x88 ++#define HDMI_PRBS_SEED_CHK 0x8C ++#define HDMI_PRBS_SEED_NUM 0x90 ++#define HDMI_PRBS_CYCLE_NUM 0x94 ++#define HDMI_PHY_PLL_ODLY_CFG 0x98 ++#define HDMI_PHY_CTL6 0x9C ++#define HDMI_PHY_CTL7 0xA0 ++ ++typedef union { ++ u32 dwval; ++ struct { ++ u32 sda_en :1; // Default: 0; ++ u32 scl_en :1; // Default: 0; ++ u32 hpd_en :1; // Default: 0; ++ u32 res0 :1; // Default: 0; ++ u32 reg_ck_sel :1; // Default: 1; ++ u32 reg_ck_test_sel :1; // Default: 1; ++ u32 reg_csmps :2; // Default: 0; ++ u32 reg_den :4; // Default: F; ++ u32 reg_plr :4; // Default: 0; ++ u32 enck :1; // Default: 1; ++ u32 enldo_fs :1; // Default: 1; ++ u32 enldo :1; // Default: 1; ++ u32 res1 :1; // Default: 1; ++ u32 enbi :4; // Default: F; ++ u32 entx :4; // Default: F; ++ u32 async_fifo_autosync_disable :1; // Default: 0; ++ u32 async_fifo_workc_enable :1; // Default: 1; ++ u32 phy_pll_lock_mode :1; // Default: 1; ++ u32 phy_pll_lock_mode_man :1; // Default: 1; ++ } bits; ++} HDMI_PHY_CTL0_t; //=========================== 0x0040 ++ ++typedef union { ++ u32 dwval; ++ struct { ++ u32 reg_sp2_0 : 4 ; // Default: 0; ++ u32 reg_sp2_1 : 4 ; // Default: 0; ++ u32 reg_sp2_2 : 4 ; // Default: 0; ++ u32 reg_sp2_3 : 4 ; // Default: 0; ++ u32 reg_bst0 : 2 ; // Default: 3; ++ u32 reg_bst1 : 2 ; // Default: 3; ++ u32 reg_bst2 : 2 ; // Default: 3; ++ u32 res0 : 2 ; // Default: 0; ++ u32 reg_svr : 2 ; // Default: 2; ++ u32 reg_swi : 1 ; // Default: 0; ++ u32 res_scktmds : 1 ; // Default: 0; ++ u32 res_res_s : 2 ; // Default: 3; ++ u32 phy_rxsense_mode : 1 ; // Default: 0; ++ u32 res_rxsense_mode_man : 1 ; // Default: 0; ++ } bits; ++} HDMI_PHY_CTL1_t; //===================================================== 0x0044 ++ ++typedef union { ++ u32 dwval; ++ struct { ++ u32 reg_p2opt : 4 ; // Default: 0; ++ u32 reg_sp1_0 : 5 ; // Default: 0; ++ u32 reg_sp1_1 : 5 ; // Default: 0; ++ u32 reg_sp1_2 : 5 ; // Default: 0; ++ u32 reg_sp1_3 : 5 ; // Default: 0; ++ u32 reg_resdi : 6 ; // Default: 18; ++ u32 phy_hpdo_mode : 1 ; // Default: 0; ++ u32 phy_hpdo_mode_man : 1 ; // Default: 0; ++ } bits; ++} HDMI_PHY_CTL2_t; //===================================================== 0x0048 ++ ++ ++ ++typedef union { ++ u32 dwval; ++ struct { ++ u32 reg_mc0 : 4 ; // Default: F; ++ u32 reg_mc1 : 4 ; // Default: F; ++ u32 reg_mc2 : 4 ; // Default: F; ++ u32 reg_mc3 : 4 ; // Default: F; ++ u32 reg_p2_0 : 4 ; // Default: F; ++ u32 reg_p2_1 : 4 ; // Default: F; ++ u32 reg_p2_2 : 4 ; // Default: F; ++ u32 reg_p2_3 : 4 ; // Default: F; ++ } bits; ++} HDMI_PHY_CTL3_t; //===================================================== 0x004C ++ ++ ++ ++typedef union { ++ u32 dwval; ++ struct { ++ u32 reg_p1_0 : 5 ; // Default: 0x10; ++ u32 res0 : 3 ; // Default: 0; ++ u32 reg_p1_1 : 5 ; // Default: 0x10; ++ u32 res1 : 3 ; // Default: 0; ++ u32 reg_p1_2 : 5 ; // Default: 0x10; ++ u32 res2 : 3 ; // Default: 0; ++ u32 reg_p1_3 : 5 ; // Default: 0x10; ++ u32 reg_slv : 3 ; // Default: 0; ++ } bits; ++} HDMI_PHY_CTL4_t; //===================================================== 0x0050 ++ ++typedef union { ++ u32 dwval; ++ struct { ++ u32 encalog : 1 ; // Default: 0x1; ++ u32 enib : 1 ; // Default: 0x1; ++ u32 res0 : 2 ; // Default: 0; ++ u32 enp2s : 4 ; // Default: 0xF; ++ u32 enrcal : 1 ; // Default: 0x1; ++ u32 enres : 1 ; // Default: 1; ++ u32 enresck : 1 ; // Default: 1; ++ u32 reg_calsw : 1 ; // Default: 0; ++ u32 reg_ckpdlyopt : 1 ; // Default: 0; ++ u32 res1 : 3 ; // Default: 0; ++ u32 reg_p1opt : 4 ; // Default: 0; ++ u32 res2 : 12 ; // Default: 0; ++ } bits; ++} HDMI_PHY_CTL5_t; //===================================================== 0x0054 ++ ++typedef union { ++ u32 dwval; ++ struct { ++ u32 prop_cntrl : 3 ; // Default: 0x7; ++ u32 res0 : 1 ; // Default: 0; ++ u32 gmp_cntrl : 2 ; // Default: 1; ++ u32 n_cntrl : 2 ; // Default: 0; ++ u32 vcorange : 1 ; // Default: 0; ++ u32 sdrven : 1 ; // Default: 0; ++ u32 divx1 : 1 ; // Default: 0; ++ u32 res1 : 1 ; // Default: 0; ++ u32 div_pre : 4 ; // Default: 0; ++ u32 div2_cktmds : 1 ; // Default: 1; ++ u32 div2_ckbit : 1 ; // Default: 1; ++ u32 cutfb : 1 ; // Default: 0; ++ u32 res2 : 1 ; // Default: 0; ++ u32 clr_dpth : 2 ; // Default: 0; ++ u32 bypass_clrdpth : 1 ; // Default: 0; ++ u32 bcr : 1 ; // Default: 0; ++ u32 slv : 3 ; // Default: 4; ++ u32 res3 : 1 ; // Default: 0; ++ u32 envbs : 1 ; // Default: 0; ++ u32 bypass_ppll : 1 ; // Default: 0; ++ u32 cko_sel : 2 ; // Default: 0; ++ } bits; ++} HDMI_PLL_CTL0_t; //===================================================== 0x0058 ++ ++ ++ ++typedef union { ++ u32 dwval; ++ struct { ++ u32 int_cntrl : 3 ; // Default: 0x0; ++ u32 res0 : 1 ; // Default: 0; ++ u32 ref_cntrl : 2 ; // Default: 3; ++ u32 gear_shift : 1 ; // Default: 0; ++ u32 fast_tech : 1 ; // Default: 0; ++ u32 drv_ana : 1 ; // Default: 1; ++ u32 sckfb : 1 ; // Default: 0; ++ u32 sckref : 1 ; // Default: 0; ++ u32 reset : 1 ; // Default: 0; ++ u32 pwron : 1 ; // Default: 0; ++ u32 res1 : 3 ; // Default: 0; ++ u32 pixel_rep : 2 ; // Default: 0; ++ u32 sdm_en : 1 ; // Default: 0; ++ u32 pcnt_en : 1 ; // Default: 0; ++ u32 pcnt_n : 8 ; // Default: 0xE; ++ u32 res2 : 3 ; // Default: 0; ++ u32 ctrl_modle_clksrc : 1 ; // Default: 0; ++ } bits; ++} HDMI_PLL_CTL1_t; //===================================================== 0x005C ++ ++typedef union { ++ u32 dwval; ++ struct { ++ u32 hdmi_afifo_error : 1 ; // Default: 0x0; ++ u32 hdmi_afifo_error_det : 1 ; // Default: 0x0; ++ u32 res0 : 30 ; // Default: 0; ++ } bits; ++} HDMI_AFIFO_CFG_t; //===================================================== 0x0060 ++ ++typedef union { ++ u32 dwval; ++ struct { ++ u32 fnpll_mash_en : 1 ; // Default: 0x0; ++ u32 fnpll_mash_mod : 2 ; // Default: 0x0; ++ u32 fnpll_mash_stp : 9 ; // Default: 0x0; ++ u32 fnpll_mash_m12 : 1 ; // Default: 0x0; ++ u32 fnpll_mash_frq : 2 ; // Default: 0x0; ++ u32 fnpll_mash_bot : 17 ; // Default: 0x0; ++ } bits; ++} HDMI_MODULATOR_CFG0_t; //===================================================== 0x0064 ++ ++typedef union { ++ u32 dwval; ++ struct { ++ u32 fnpll_mash_dth : 1 ; // Default: 0x0; ++ u32 fnpll_mash_fen : 1 ; // Default: 0x0; ++ u32 fnpll_mash_frc : 17 ; // Default: 0x0; ++ u32 fnpll_mash_fnv : 8 ; // Default: 0x0; ++ u32 res0 : 5 ; // Default: 0x0; ++ } bits; ++} HDMI_MODULATOR_CFG1_t; //===================================================== 0x0068 ++ ++typedef union { ++ u32 dwval; ++ struct { ++ u32 txdata_debugmode : 2 ; // Default: 0x0; ++ u32 res0 : 14 ; // Default: 0x0; ++ u32 ceci_debug : 1 ; // Default: 0x0; ++ u32 ceci_debugmode : 1 ; // Default: 0x0; ++ u32 res1 : 2 ; // Default: 0x0; ++ u32 sdai_debug : 1 ; // Default: 0x0; ++ u32 sdai_debugmode : 1 ; // Default: 0x0; ++ u32 res2 : 2 ; // Default: 0x0; ++ u32 scli_debug : 1 ; // Default: 0x0; ++ u32 scli_debugmode : 1 ; // Default: 0x0; ++ u32 res3 : 2 ; // Default: 0x0; ++ u32 hpdi_debug : 1 ; // Default: 0x0; ++ u32 hpdi_debugmode : 1 ; // Default: 0x0; ++ u32 res4 : 2 ; // Default: 0x0; ++ } bits; ++} HDMI_PHY_INDBG_CTRL_t; //================================================== 0x006C ++ ++typedef union { ++ u32 dwval; ++ struct { ++ u32 txdata0_debug_data : 32 ; // Default: 0x0; ++ } bits; ++} HDMI_PHY_INDBG_TXD0_t; //================================================== 0x0070 ++ ++typedef union { ++ u32 dwval; ++ struct { ++ u32 txdata1_debug_data : 32 ; // Default: 0x0; ++ } bits; ++} HDMI_PHY_INDBG_TXD1_t; //================================================== 0x0074 ++ ++typedef union { ++ u32 dwval; ++ struct { ++ u32 txdata2_debug_data : 32 ; // Default: 0x0; ++ } bits; ++} HDMI_PHY_INDBG_TXD2_t; //================================================== 0x0078 ++ ++typedef union { ++ u32 dwval; ++ struct { ++ u32 txdata3_debug_data : 32 ; // Default: 0x0; ++ } bits; ++} HDMI_PHY_INDBG_TXD3_t; //================================================== 0x007C ++ ++typedef union { ++ u32 dwval; ++ struct { ++ u32 tx_ready_dly_status : 1 ; // Default: 0x0; ++ u32 rxsense_dly_status : 1 ; // Default: 0x0; ++ u32 res0 : 2 ; // Default: 0x0; ++ u32 pll_lock_status : 1 ; // Default: 0x0; ++ u32 res1 : 3 ; // Default: 0x0; ++ u32 phy_resdo2d_status : 6 ; // Default: 0x0; ++ u32 res2 : 2 ; // Default: 0x0; ++ u32 phy_rcalend2d_status : 1 ; // Default: 0x0; ++ u32 phy_cout2d_status : 1 ; // Default: 0x0; ++ u32 res3 : 2 ; // Default: 0x0; ++ u32 phy_ceco_status : 1 ; // Default: 0x0; ++ u32 phy_sdao_status : 1 ; // Default: 0x0; ++ u32 phy_sclo_status : 1 ; // Default: 0x0; ++ u32 phy_hpdo_status : 1 ; // Default: 0x0; ++ u32 phy_cdetn_status : 3 ; // Default: 0x0; ++ u32 phy_cdetnck_status : 1 ; // Default: 0x0; ++ u32 phy_cdetp_status : 3 ; // Default: 0x0; ++ u32 phy_cdetpck_status : 1 ; // Default: 0x0; ++ } bits; ++} HDMI_PHY_PLL_STS_t; //===================================================== 0x0080 ++ ++typedef union { ++ u32 dwval; ++ struct { ++ u32 prbs_en : 1 ; // Default: 0x0; ++ u32 prbs_start : 1 ; // Default: 0x0; ++ u32 prbs_seq_gen : 1 ; // Default: 0x0; ++ u32 prbs_seq_chk : 1 ; // Default: 0x0; ++ u32 prbs_mode : 4 ; // Default: 0x0; ++ u32 prbs_type : 2 ; // Default: 0x0; ++ u32 prbs_clk_pol : 1 ; // Default: 0x0; ++ u32 res0 : 21 ; // Default: 0x0; ++ } bits; ++} HDMI_PRBS_CTL_t; //===================================================== 0x0084 ++ ++typedef union { ++ u32 dwval; ++ struct { ++ u32 prbs_seed_gen : 32 ; // Default: 0x0; ++ } bits; ++} HDMI_PRBS_SEED_GEN_t; //================================================= 0x0088 ++ ++typedef union { ++ u32 dwval; ++ struct { ++ u32 prbs_seed_chk : 32 ; // Default: 0x0; ++ } bits; ++} HDMI_PRBS_SEED_CHK_t; //================================================= 0x008C ++ ++typedef union { ++ u32 dwval; ++ struct { ++ u32 prbs_seed_num : 32 ; // Default: 0x0; ++ } bits; ++} HDMI_PRBS_SEED_NUM_t; //================================================= 0x0090 ++ ++typedef union { ++ u32 dwval; ++ struct { ++ u32 prbs_cycle_num : 32 ; // Default: 0x0; ++ } bits; ++} HDMI_PRBS_CYCLE_NUM_t; //================================================= 0x0094 ++ ++typedef union { ++ u32 dwval; ++ struct { ++ u32 tx_ready_dly_count : 15 ; // Default: 0x0; ++ u32 tx_ready_dly_reset : 1 ; // Default: 0x0; ++ u32 rxsense_dly_count : 15 ; // Default: 0x0; ++ u32 rxsense_dly_reset : 1 ; // Default: 0x0; ++ } bits; ++} HDMI_PHY_PLL_ODLY_CFG_t; //================================================= 0x0098 ++ ++typedef union { ++ u32 dwval; ++ struct { ++ u32 clk_greate0_340m : 10 ; // Default: 0x3FF; ++ u32 clk_greate1_340m : 10 ; // Default: 0x3FF; ++ u32 clk_greate2_340m : 10 ; // Default: 0x3FF; ++ u32 en_ckdat : 1 ; // Default: 0x3FF; ++ u32 switch_clkch_data_corresponding : 1 ; // Default: 0x3FF; ++ } bits; ++} HDMI_PHY_CTL6_t; //========================================================= 0x009C ++ ++typedef union { ++ u32 dwval; ++ struct { ++ u32 clk_greate3_340m : 10 ; // Default: 0x0; ++ u32 res0 : 2 ; // Default: 0x3FF; ++ u32 clk_low_340m : 10 ; // Default: 0x3FF; ++ u32 res1 : 10 ; // Default: 0x3FF; ++ } bits; ++} HDMI_PHY_CTL7_t; //========================================================= 0x00A0 ++ ++struct __aw_phy_reg_t { ++ u32 res[16]; /* 0x0 ~ 0x3c */ ++ HDMI_PHY_CTL0_t phy_ctl0; /* 0x0040 */ ++ HDMI_PHY_CTL1_t phy_ctl1; /* 0x0044 */ ++ HDMI_PHY_CTL2_t phy_ctl2; /* 0x0048 */ ++ HDMI_PHY_CTL3_t phy_ctl3; /* 0x004c */ ++ HDMI_PHY_CTL4_t phy_ctl4; /* 0x0050 */ ++ HDMI_PHY_CTL5_t phy_ctl5; /* 0x0054 */ ++ HDMI_PLL_CTL0_t pll_ctl0; /* 0x0058 */ ++ HDMI_PLL_CTL1_t pll_ctl1; /* 0x005c */ ++ HDMI_AFIFO_CFG_t afifo_cfg; /* 0x0060 */ ++ HDMI_MODULATOR_CFG0_t modulator_cfg0; /* 0x0064 */ ++ HDMI_MODULATOR_CFG1_t modulator_cfg1; /* 0x0068 */ ++ HDMI_PHY_INDBG_CTRL_t phy_indbg_ctrl; /* 0x006c */ ++ HDMI_PHY_INDBG_TXD0_t phy_indbg_txd0; /* 0x0070 */ ++ HDMI_PHY_INDBG_TXD1_t phy_indbg_txd1; /* 0x0074 */ ++ HDMI_PHY_INDBG_TXD2_t phy_indbg_txd2; /* 0x0078 */ ++ HDMI_PHY_INDBG_TXD3_t phy_indbg_txd3; /* 0x007c */ ++ HDMI_PHY_PLL_STS_t phy_pll_sts; /* 0x0080 */ ++ HDMI_PRBS_CTL_t prbs_ctl; /* 0x0084 */ ++ HDMI_PRBS_SEED_GEN_t prbs_seed_gen; /* 0x0088 */ ++ HDMI_PRBS_SEED_CHK_t prbs_seed_chk; /* 0x008c */ ++ HDMI_PRBS_SEED_NUM_t prbs_seed_num; /* 0x0090 */ ++ HDMI_PRBS_CYCLE_NUM_t prbs_cycle_num; /* 0x0094 */ ++ HDMI_PHY_PLL_ODLY_CFG_t phy_pll_odly_cfg; /* 0x0098 */ ++ HDMI_PHY_CTL6_t phy_ctl6; /* 0x009c */ ++ HDMI_PHY_CTL7_t phy_ctl7; /* 0x00A0 */ ++}; ++ ++#endif /* AW_PHY_H_ */ +--- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h ++++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h +@@ -334,6 +334,7 @@ struct sun8i_hdmi_phy { + struct clk *clk_pll1; + struct device *dev; + unsigned int rcal; ++ void __iomem *base; + struct regmap *regs; + struct reset_control *rst_phy; + const struct sun8i_hdmi_phy_variant *variant; +--- a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c ++++ b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c +@@ -9,6 +9,8 @@ + + #include "sun8i_dw_hdmi.h" + ++#include "aw_phy.h" ++ + /* + * Address can be actually any value. Here is set to same value as + * it is set in BSP driver. +@@ -398,11 +400,164 @@ static const struct dw_hdmi_phy_ops sun8 + .setup_hpd = dw_hdmi_phy_setup_hpd, + }; + ++static int sun20i_d1_hdmi_phy_enable(volatile struct __aw_phy_reg_t __iomem *phy_base) ++{ ++ int i = 0, status = 0; ++ ++ pr_info("enter %s\n", __func__); ++ ++ //enib -> enldo -> enrcal -> encalog -> enbi[3:0] -> enck -> enp2s[3:0] -> enres -> enresck -> entx[3:0] ++ phy_base->phy_ctl4.bits.reg_slv = 4; //low power voltage 1.08V, default is 3, set 4 as well as pll_ctl0 bit [24:26] ++ phy_base->phy_ctl5.bits.enib = 1; ++ phy_base->phy_ctl0.bits.enldo = 1; ++ phy_base->phy_ctl0.bits.enldo_fs = 1; ++ phy_base->phy_ctl5.bits.enrcal = 1; ++ ++ phy_base->phy_ctl5.bits.encalog = 1; ++ ++ for (i = 0; i < AW_PHY_TIMEOUT; i++) { ++ udelay(5); ++ status = phy_base->phy_pll_sts.bits.phy_rcalend2d_status; ++ if (status & 0x1) { ++ pr_info("[%s]:phy_rcalend2d_status\n", __func__); ++ break; ++ } ++ } ++ if ((i == AW_PHY_TIMEOUT) && !status) { ++ pr_err("phy_rcalend2d_status Timeout !\n"); ++ return -1; ++ } ++ ++ phy_base->phy_ctl0.bits.enbi = 0xF; ++ for (i = 0; i < AW_PHY_TIMEOUT; i++) { ++ udelay(5); ++ status = phy_base->phy_pll_sts.bits.pll_lock_status; ++ if (status & 0x1) { ++ pr_info("[%s]:pll_lock_status\n", __func__); ++ break; ++ } ++ } ++ if ((i == AW_PHY_TIMEOUT) && !status) { ++ pr_err("pll_lock_status Timeout! status = 0x%x\n", status); ++ return -1; ++ } ++ ++ phy_base->phy_ctl0.bits.enck = 1; ++ phy_base->phy_ctl5.bits.enp2s = 0xF; ++ phy_base->phy_ctl5.bits.enres = 1; ++ phy_base->phy_ctl5.bits.enresck = 1; ++ phy_base->phy_ctl0.bits.entx = 0xF; ++ ++ for (i = 0; i < AW_PHY_TIMEOUT; i++) { ++ udelay(5); ++ status = phy_base->phy_pll_sts.bits.tx_ready_dly_status; ++ if (status & 0x1) { ++ pr_info("[%s]:tx_ready_status\n", __func__); ++ break; ++ } ++ } ++ if ((i == AW_PHY_TIMEOUT) && !status) { ++ pr_err("tx_ready_status Timeout ! status = 0x%x\n", status); ++ return -1; ++ } ++ ++ return 0; ++} ++ + static int sun20i_d1_hdmi_phy_config(struct dw_hdmi *hdmi, void *data, + const struct drm_display_info *display, + const struct drm_display_mode *mode) + { + struct sun8i_hdmi_phy *phy = data; ++ volatile struct __aw_phy_reg_t __iomem *phy_base = phy->base; ++ int ret; ++ ++ pr_info("enter %s\n", __func__); ++ ++ /* enable all channel */ ++ phy_base->phy_ctl5.bits.reg_p1opt = 0xF; ++ ++ // phy_reset ++ phy_base->phy_ctl0.bits.entx = 0; ++ phy_base->phy_ctl5.bits.enresck = 0; ++ phy_base->phy_ctl5.bits.enres = 0; ++ phy_base->phy_ctl5.bits.enp2s = 0; ++ phy_base->phy_ctl0.bits.enck = 0; ++ phy_base->phy_ctl0.bits.enbi = 0; ++ phy_base->phy_ctl5.bits.encalog = 0; ++ phy_base->phy_ctl5.bits.enrcal = 0; ++ phy_base->phy_ctl0.bits.enldo_fs = 0; ++ phy_base->phy_ctl0.bits.enldo = 0; ++ phy_base->phy_ctl5.bits.enib = 0; ++ phy_base->pll_ctl1.bits.reset = 1; ++ phy_base->pll_ctl1.bits.pwron = 0; ++ phy_base->pll_ctl0.bits.envbs = 0; ++ ++ // phy_set_mpll ++ phy_base->pll_ctl0.bits.cko_sel = 0x3; ++ phy_base->pll_ctl0.bits.bypass_ppll = 0x1; ++ phy_base->pll_ctl1.bits.drv_ana = 1; ++ phy_base->pll_ctl1.bits.ctrl_modle_clksrc = 0x0; //0: PLL_video 1: MPLL ++ phy_base->pll_ctl1.bits.sdm_en = 0x0; //mpll sdm jitter is very large, not used for the time being ++ phy_base->pll_ctl1.bits.sckref = 0; //default value is 1 ++ phy_base->pll_ctl0.bits.slv = 4; ++ phy_base->pll_ctl0.bits.prop_cntrl = 7; //default value 7 ++ phy_base->pll_ctl0.bits.gmp_cntrl = 3; //default value 1 ++ phy_base->pll_ctl1.bits.ref_cntrl = 0; ++ phy_base->pll_ctl0.bits.vcorange = 1; ++ ++ // phy_set_div ++ phy_base->pll_ctl0.bits.div_pre = 0; //div7 = n+1 ++ phy_base->pll_ctl1.bits.pcnt_en = 0; ++ phy_base->pll_ctl1.bits.pcnt_n = 1; //div6 = 1 (pcnt_en=0) [div6 = n (pcnt_en = 1) note that some multiples are problematic] 4-256 ++ phy_base->pll_ctl1.bits.pixel_rep = 0; //div5 = n+1 ++ phy_base->pll_ctl0.bits.bypass_clrdpth = 0; ++ phy_base->pll_ctl0.bits.clr_dpth = 0; //div4 = 1 (bypass_clrdpth = 0) ++ //00: 2 01: 2.5 10: 3 11: 4 ++ phy_base->pll_ctl0.bits.n_cntrl = 1; //div ++ phy_base->pll_ctl0.bits.div2_ckbit = 0; //div1 = n+1 ++ phy_base->pll_ctl0.bits.div2_cktmds = 0; //div2 = n+1 ++ phy_base->pll_ctl0.bits.bcr = 0; //div3 0: [1:10] 1: [1:40] ++ phy_base->pll_ctl1.bits.pwron = 1; ++ phy_base->pll_ctl1.bits.reset = 0; ++ ++ // configure phy ++ /* config values taken from table */ ++ phy_base->phy_ctl1.dwval = ((phy_base->phy_ctl1.dwval & 0xFFC0FFFF) | /* config->phy_ctl1 */ 0x0); ++ phy_base->phy_ctl2.dwval = ((phy_base->phy_ctl2.dwval & 0xFF000000) | /* config->phy_ctl2 */ 0x0); ++ phy_base->phy_ctl3.dwval = ((phy_base->phy_ctl3.dwval & 0xFFFF0000) | /* config->phy_ctl3 */ 0xFFFF); ++ phy_base->phy_ctl4.dwval = ((phy_base->phy_ctl4.dwval & 0xE0000000) | /* config->phy_ctl4 */ 0xC0D0D0D); ++ //phy_base->pll_ctl0.dwval |= config->pll_ctl0; ++ //phy_base->pll_ctl1.dwval |= config->pll_ctl1; ++ ++ // phy_set_clk ++ phy_base->phy_ctl6.bits.switch_clkch_data_corresponding = 0; ++ phy_base->phy_ctl6.bits.clk_greate0_340m = 0x3FF; ++ phy_base->phy_ctl6.bits.clk_greate1_340m = 0x3FF; ++ phy_base->phy_ctl6.bits.clk_greate2_340m = 0x0; ++ phy_base->phy_ctl7.bits.clk_greate3_340m = 0x0; ++ phy_base->phy_ctl7.bits.clk_low_340m = 0x3E0; ++ phy_base->phy_ctl6.bits.en_ckdat = 1; //default value is 0 ++ ++ // phy_base->phy_ctl2.bits.reg_resdi = 0x18; ++ // phy_base->phy_ctl4.bits.reg_slv = 3; //low power voltage 1.08V, default value is 3 ++ ++ phy_base->phy_ctl1.bits.res_scktmds = 0; // ++ phy_base->phy_ctl0.bits.reg_csmps = 2; ++ phy_base->phy_ctl0.bits.reg_ck_test_sel = 0; //? ++ phy_base->phy_ctl0.bits.reg_ck_sel = 1; ++ phy_base->phy_indbg_ctrl.bits.txdata_debugmode = 0; ++ ++ // phy_enable ++ ret = sun20i_d1_hdmi_phy_enable(phy_base); ++ if (ret) ++ return ret; ++ ++ phy_base->phy_ctl0.bits.sda_en = 1; ++ phy_base->phy_ctl0.bits.scl_en = 1; ++ phy_base->phy_ctl0.bits.hpd_en = 1; ++ phy_base->phy_ctl0.bits.reg_den = 0xF; ++ phy_base->pll_ctl0.bits.envbs = 1; + + return 0; + } +@@ -720,6 +875,7 @@ static int sun8i_hdmi_phy_probe(struct p + return dev_err_probe(dev, PTR_ERR(regs), + "Couldn't map the HDMI PHY registers\n"); + ++ phy->base = regs; + phy->regs = devm_regmap_init_mmio(dev, regs, + &sun8i_hdmi_phy_regmap_config); + if (IS_ERR(phy->regs)) diff --git a/target/linux/d1/patches-6.1/0010-riscv-mm-Use-IOMMU-for-DMA-when-available.patch b/target/linux/d1/patches-6.1/0010-riscv-mm-Use-IOMMU-for-DMA-when-available.patch new file mode 100644 index 00000000000000..18dfa573e3a6aa --- /dev/null +++ b/target/linux/d1/patches-6.1/0010-riscv-mm-Use-IOMMU-for-DMA-when-available.patch @@ -0,0 +1,30 @@ +From 02a412de18479449c87ed7a332e3fe33d2eff3a4 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Wed, 27 Apr 2022 18:47:53 -0500 +Subject: [PATCH 010/117] riscv: mm: Use IOMMU for DMA when available + +Signed-off-by: Samuel Holland +--- + arch/riscv/mm/dma-noncoherent.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/arch/riscv/mm/dma-noncoherent.c ++++ b/arch/riscv/mm/dma-noncoherent.c +@@ -7,6 +7,7 @@ + + #include + #include ++#include + #include + #include + +@@ -70,6 +71,9 @@ void arch_setup_dma_ops(struct device *d + dev_driver_string(dev), dev_name(dev)); + + dev->dma_coherent = coherent; ++ ++ if (iommu) ++ iommu_setup_dma_ops(dev, dma_base, dma_base + size - 1); + } + + void riscv_noncoherent_supported(void) diff --git a/target/linux/d1/patches-6.1/0011-genirq-Add-support-for-oneshot-safe-threaded-EOIs.patch b/target/linux/d1/patches-6.1/0011-genirq-Add-support-for-oneshot-safe-threaded-EOIs.patch new file mode 100644 index 00000000000000..d8dd2878d1e4f9 --- /dev/null +++ b/target/linux/d1/patches-6.1/0011-genirq-Add-support-for-oneshot-safe-threaded-EOIs.patch @@ -0,0 +1,124 @@ +From ee6459d60f24d91052f0288155f44e6a7f991050 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sat, 7 May 2022 18:34:25 -0500 +Subject: [PATCH 011/117] genirq: Add support for oneshot-safe threaded EOIs + +irqchips can use the combination of flags IRQCHIP_ONESHOT_SAFE | +IRQCHIP_EOI_THREADED to elide mask operations. + +Signed-off-by: Samuel Holland +--- + kernel/irq/chip.c | 36 +++++++++++++++++------------------- + kernel/irq/internals.h | 2 +- + kernel/irq/manage.c | 12 ++++++------ + 3 files changed, 24 insertions(+), 26 deletions(-) + +--- a/kernel/irq/chip.c ++++ b/kernel/irq/chip.c +@@ -439,16 +439,6 @@ void unmask_irq(struct irq_desc *desc) + } + } + +-void unmask_threaded_irq(struct irq_desc *desc) +-{ +- struct irq_chip *chip = desc->irq_data.chip; +- +- if (chip->flags & IRQCHIP_EOI_THREADED) +- chip->irq_eoi(&desc->irq_data); +- +- unmask_irq(desc); +-} +- + /* + * handle_nested_irq - Handle a nested irq from a irq thread + * @irq: the interrupt number +@@ -656,25 +646,33 @@ out_unlock: + } + EXPORT_SYMBOL_GPL(handle_level_irq); + +-static void cond_unmask_eoi_irq(struct irq_desc *desc, struct irq_chip *chip) ++void unmask_eoi_threaded_irq(struct irq_desc *desc) + { +- if (!(desc->istate & IRQS_ONESHOT)) { ++ struct irq_chip *chip = desc->irq_data.chip; ++ ++ if (desc->istate & IRQS_ONESHOT) ++ unmask_irq(desc); ++ ++ if (chip->flags & IRQCHIP_EOI_THREADED) + chip->irq_eoi(&desc->irq_data); ++} ++ ++static void cond_unmask_eoi_irq(struct irq_desc *desc, struct irq_chip *chip) ++{ ++ /* Do not send EOI if the thread will do it for us. */ ++ if ((chip->flags & IRQCHIP_EOI_THREADED) && desc->threads_oneshot) + return; +- } ++ + /* + * We need to unmask in the following cases: + * - Oneshot irq which did not wake the thread (caused by a + * spurious interrupt or a primary handler handling it + * completely). + */ +- if (!irqd_irq_disabled(&desc->irq_data) && +- irqd_irq_masked(&desc->irq_data) && !desc->threads_oneshot) { +- chip->irq_eoi(&desc->irq_data); ++ if ((desc->istate & IRQS_ONESHOT) && !desc->threads_oneshot) + unmask_irq(desc); +- } else if (!(chip->flags & IRQCHIP_EOI_THREADED)) { +- chip->irq_eoi(&desc->irq_data); +- } ++ ++ chip->irq_eoi(&desc->irq_data); + } + + /** +--- a/kernel/irq/internals.h ++++ b/kernel/irq/internals.h +@@ -93,7 +93,7 @@ extern void irq_percpu_enable(struct irq + extern void irq_percpu_disable(struct irq_desc *desc, unsigned int cpu); + extern void mask_irq(struct irq_desc *desc); + extern void unmask_irq(struct irq_desc *desc); +-extern void unmask_threaded_irq(struct irq_desc *desc); ++extern void unmask_eoi_threaded_irq(struct irq_desc *desc); + + #ifdef CONFIG_SPARSE_IRQ + static inline void irq_mark_irq(unsigned int irq) { } +--- a/kernel/irq/manage.c ++++ b/kernel/irq/manage.c +@@ -1074,9 +1074,9 @@ static int irq_wait_for_interrupt(struct + static void irq_finalize_oneshot(struct irq_desc *desc, + struct irqaction *action) + { +- if (!(desc->istate & IRQS_ONESHOT) || +- action->handler == irq_forced_secondary_handler) ++ if (action->handler == irq_forced_secondary_handler) + return; ++ + again: + chip_bus_lock(desc); + raw_spin_lock_irq(&desc->lock); +@@ -1112,9 +1112,8 @@ again: + + desc->threads_oneshot &= ~action->thread_mask; + +- if (!desc->threads_oneshot && !irqd_irq_disabled(&desc->irq_data) && +- irqd_irq_masked(&desc->irq_data)) +- unmask_threaded_irq(desc); ++ if (!desc->threads_oneshot) ++ unmask_eoi_threaded_irq(desc); + + out_unlock: + raw_spin_unlock_irq(&desc->lock); +@@ -1662,7 +1661,8 @@ __setup_irq(unsigned int irq, struct irq + * !ONESHOT irqs the thread mask is 0 so we can avoid a + * conditional in irq_wake_thread(). + */ +- if (new->flags & IRQF_ONESHOT) { ++ if ((new->flags & IRQF_ONESHOT) || ++ (desc->irq_data.chip->flags & (IRQCHIP_ONESHOT_SAFE | IRQCHIP_EOI_THREADED)) == (IRQCHIP_ONESHOT_SAFE | IRQCHIP_EOI_THREADED)) { + /* + * Unlikely to have 32 resp 64 irqs sharing one line, + * but who knows. diff --git a/target/linux/d1/patches-6.1/0012-irqchip-sifive-plic-Enable-oneshot-safe-threaded-EOI.patch b/target/linux/d1/patches-6.1/0012-irqchip-sifive-plic-Enable-oneshot-safe-threaded-EOI.patch new file mode 100644 index 00000000000000..8cb949f186a38f --- /dev/null +++ b/target/linux/d1/patches-6.1/0012-irqchip-sifive-plic-Enable-oneshot-safe-threaded-EOI.patch @@ -0,0 +1,24 @@ +From 1fbe96ec05c41b313b4e7cc4b39b191b4a3f7540 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sat, 7 May 2022 18:38:34 -0500 +Subject: [PATCH 012/117] irqchip/sifive-plic: Enable oneshot-safe threaded + EOIs + +Signed-off-by: Samuel Holland +--- + drivers/irqchip/irq-sifive-plic.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/irqchip/irq-sifive-plic.c ++++ b/drivers/irqchip/irq-sifive-plic.c +@@ -207,7 +207,9 @@ static struct irq_chip plic_chip = { + .irq_set_affinity = plic_set_affinity, + #endif + .irq_set_type = plic_irq_set_type, +- .flags = IRQCHIP_AFFINITY_PRE_STARTUP, ++ .flags = IRQCHIP_ONESHOT_SAFE | ++ IRQCHIP_EOI_THREADED | ++ IRQCHIP_AFFINITY_PRE_STARTUP, + }; + + static int plic_irq_set_type(struct irq_data *d, unsigned int type) diff --git a/target/linux/d1/patches-6.1/0013-irqchip-sifive-plic-Support-wake-IRQs.patch b/target/linux/d1/patches-6.1/0013-irqchip-sifive-plic-Support-wake-IRQs.patch new file mode 100644 index 00000000000000..209d97597c642e --- /dev/null +++ b/target/linux/d1/patches-6.1/0013-irqchip-sifive-plic-Support-wake-IRQs.patch @@ -0,0 +1,32 @@ +From d6cf6473b0aaec455e48bccefe318a98a87b789f Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sat, 28 May 2022 19:04:56 -0500 +Subject: [PATCH 013/117] irqchip/sifive-plic: Support wake IRQs + +Signed-off-by: Samuel Holland +--- + drivers/irqchip/irq-sifive-plic.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/drivers/irqchip/irq-sifive-plic.c ++++ b/drivers/irqchip/irq-sifive-plic.c +@@ -193,7 +193,8 @@ static struct irq_chip plic_edge_chip = + .irq_set_affinity = plic_set_affinity, + #endif + .irq_set_type = plic_irq_set_type, +- .flags = IRQCHIP_AFFINITY_PRE_STARTUP, ++ .flags = IRQCHIP_SKIP_SET_WAKE | ++ IRQCHIP_AFFINITY_PRE_STARTUP, + }; + + static struct irq_chip plic_chip = { +@@ -207,7 +208,8 @@ static struct irq_chip plic_chip = { + .irq_set_affinity = plic_set_affinity, + #endif + .irq_set_type = plic_irq_set_type, +- .flags = IRQCHIP_ONESHOT_SAFE | ++ .flags = IRQCHIP_SKIP_SET_WAKE | ++ IRQCHIP_ONESHOT_SAFE | + IRQCHIP_EOI_THREADED | + IRQCHIP_AFFINITY_PRE_STARTUP, + }; diff --git a/target/linux/d1/patches-6.1/0014-mmc-sunxi-mmc-Correct-the-maximum-segment-size.patch b/target/linux/d1/patches-6.1/0014-mmc-sunxi-mmc-Correct-the-maximum-segment-size.patch new file mode 100644 index 00000000000000..7e8098a2cfb03e --- /dev/null +++ b/target/linux/d1/patches-6.1/0014-mmc-sunxi-mmc-Correct-the-maximum-segment-size.patch @@ -0,0 +1,65 @@ +From 0e871e791a2530562851109346affa1c0d9987e0 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sun, 13 Jun 2021 23:15:56 -0500 +Subject: [PATCH 014/117] mmc: sunxi-mmc: Correct the maximum segment size + +According to the DMA descriptor documentation, the lowest two bits of +the size field are ignored, so the size must be rounded up to a multiple +of 4 bytes. Furthermore, 0 is not a valid buffer size; setting the size +to 0 will cause that DMA descriptor to be ignored. + +Together, these restrictions limit the maximum DMA segment size to 4 +less than the power-of-two width of the size field. + +Series-to: Ulf Hansson +Series-to: linux-mmc@vger.kernel.org + +Fixes: 3cbcb16095f9 ("mmc: sunxi: Add driver for SD/MMC hosts found on Allwinner sunxi SoCs") +Signed-off-by: Samuel Holland +--- + drivers/mmc/host/sunxi-mmc.c | 14 ++++++++------ + 1 file changed, 8 insertions(+), 6 deletions(-) + +--- a/drivers/mmc/host/sunxi-mmc.c ++++ b/drivers/mmc/host/sunxi-mmc.c +@@ -214,6 +214,9 @@ + #define SDXC_IDMAC_DES0_CES BIT(30) /* card error summary */ + #define SDXC_IDMAC_DES0_OWN BIT(31) /* 1-idma owns it, 0-host owns it */ + ++/* Buffer size must be a multiple of 4 bytes. */ ++#define SDXC_IDMAC_SIZE_ALIGN 4 ++ + #define SDXC_CLK_400K 0 + #define SDXC_CLK_25M 1 + #define SDXC_CLK_50M 2 +@@ -361,17 +364,15 @@ static void sunxi_mmc_init_idma_des(stru + { + struct sunxi_idma_des *pdes = (struct sunxi_idma_des *)host->sg_cpu; + dma_addr_t next_desc = host->sg_dma; +- int i, max_len = (1 << host->cfg->idma_des_size_bits); ++ int i; + + for (i = 0; i < data->sg_len; i++) { + pdes[i].config = cpu_to_le32(SDXC_IDMAC_DES0_CH | + SDXC_IDMAC_DES0_OWN | + SDXC_IDMAC_DES0_DIC); + +- if (data->sg[i].length == max_len) +- pdes[i].buf_size = 0; /* 0 == max_len */ +- else +- pdes[i].buf_size = cpu_to_le32(data->sg[i].length); ++ pdes[i].buf_size = cpu_to_le32(ALIGN(data->sg[i].length, ++ SDXC_IDMAC_SIZE_ALIGN)); + + next_desc += sizeof(struct sunxi_idma_des); + pdes[i].buf_addr_ptr1 = +@@ -1421,7 +1422,8 @@ static int sunxi_mmc_probe(struct platfo + mmc->max_blk_count = 8192; + mmc->max_blk_size = 4096; + mmc->max_segs = PAGE_SIZE / sizeof(struct sunxi_idma_des); +- mmc->max_seg_size = (1 << host->cfg->idma_des_size_bits); ++ mmc->max_seg_size = (1 << host->cfg->idma_des_size_bits) - ++ SDXC_IDMAC_SIZE_ALIGN; + mmc->max_req_size = mmc->max_seg_size * mmc->max_segs; + /* 400kHz ~ 52MHz */ + mmc->f_min = 400000; diff --git a/target/linux/d1/patches-6.1/0015-dt-bindings-display-Add-bindings-for-ClockworkPi-CWD.patch b/target/linux/d1/patches-6.1/0015-dt-bindings-display-Add-bindings-for-ClockworkPi-CWD.patch new file mode 100644 index 00000000000000..665c55058cfa3f --- /dev/null +++ b/target/linux/d1/patches-6.1/0015-dt-bindings-display-Add-bindings-for-ClockworkPi-CWD.patch @@ -0,0 +1,82 @@ +From a8e905fb3fd0d26f724646275b72a7363b2f03d8 Mon Sep 17 00:00:00 2001 +From: Max Fierke +Date: Wed, 1 Jun 2022 00:17:47 -0500 +Subject: [PATCH 015/117] dt-bindings: display: Add bindings for ClockworkPi + CWD686 + +The CWD686 is a 6.86" IPS LCD panel used as the primary +display in the ClockworkPi DevTerm portable (all cores) + +Signed-off-by: Max Fierke +Reviewed-by: Krzysztof Kozlowski +Signed-off-by: Samuel Holland +--- + .../display/panel/clockwork,cwd686.yaml | 62 +++++++++++++++++++ + 1 file changed, 62 insertions(+) + create mode 100644 Documentation/devicetree/bindings/display/panel/clockwork,cwd686.yaml + +--- /dev/null ++++ b/Documentation/devicetree/bindings/display/panel/clockwork,cwd686.yaml +@@ -0,0 +1,62 @@ ++# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/display/panel/clockwork,cwd686.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Clockwork CWD686 6.86" IPS LCD panel ++ ++maintainers: ++ - Max Fierke ++ ++description: | ++ The Clockwork CWD686 is a 6.86" ICNL9707-based IPS LCD panel used within the ++ Clockwork DevTerm series of portable devices. The panel has a 480x1280 ++ resolution and uses 24 bit RGB per pixel. ++ ++allOf: ++ - $ref: panel-common.yaml# ++ ++properties: ++ compatible: ++ const: clockwork,cwd686 ++ ++ reg: ++ description: DSI virtual channel used by that screen ++ maxItems: 1 ++ ++ reset-gpios: true ++ rotation: true ++ backlight: true ++ iovcc-supply: true ++ vci-supply: true ++ ++required: ++ - compatible ++ - reg ++ - backlight ++ - reset-gpios ++ ++additionalProperties: false ++ ++examples: ++ - | ++ #include ++ ++ backlight: backlight { ++ compatible = "gpio-backlight"; ++ gpios = <&gpio4 30 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ dsi { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ panel@0 { ++ compatible = "clockwork,cwd686"; ++ reg = <0>; ++ backlight = <&backlight>; ++ reset-gpios = <&gpio2 28 GPIO_ACTIVE_HIGH>; ++ rotation = <90>; ++ }; ++ }; diff --git a/target/linux/d1/patches-6.1/0016-dt-bindings-display-Add-Sitronix-ST7701s-panel-bindi.patch b/target/linux/d1/patches-6.1/0016-dt-bindings-display-Add-Sitronix-ST7701s-panel-bindi.patch new file mode 100644 index 00000000000000..85d8421f62eed0 --- /dev/null +++ b/target/linux/d1/patches-6.1/0016-dt-bindings-display-Add-Sitronix-ST7701s-panel-bindi.patch @@ -0,0 +1,47 @@ +From d290546a88694dde6d2f64a973cd62ff2c69e27e Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Fri, 12 Aug 2022 01:59:35 -0500 +Subject: [PATCH 016/117] dt-bindings: display: Add Sitronix ST7701s panel + binding + +Signed-off-by: Samuel Holland +--- + .../display/panel/sitronix,st7701s.yaml | 32 +++++++++++++++++++ + 1 file changed, 32 insertions(+) + create mode 100644 Documentation/devicetree/bindings/display/panel/sitronix,st7701s.yaml + +--- /dev/null ++++ b/Documentation/devicetree/bindings/display/panel/sitronix,st7701s.yaml +@@ -0,0 +1,32 @@ ++# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/display/panel/sitronix,st7701s.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Sitronix ST7701 based LCD panels ++ ++maintainers: ++ - Samuel Holland ++ ++description: | ++ Panel used on Lichee RV 86 Panel ++ ++allOf: ++ - $ref: panel-common.yaml# ++ - $ref: /schemas/spi/spi-peripheral-props.yaml# ++ ++properties: ++ compatible: ++ items: ++ - const: sitronix,st7701s ++ ++ backlight: true ++ ++ reset-gpios: true ++ ++required: ++ - compatible ++ - reset-gpios ++ ++unevaluatedProperties: false diff --git a/target/linux/d1/patches-6.1/0017-drm-panel-Add-driver-for-ST7701s-DPI-LCD-panel.patch b/target/linux/d1/patches-6.1/0017-drm-panel-Add-driver-for-ST7701s-DPI-LCD-panel.patch new file mode 100644 index 00000000000000..535478cf9ef442 --- /dev/null +++ b/target/linux/d1/patches-6.1/0017-drm-panel-Add-driver-for-ST7701s-DPI-LCD-panel.patch @@ -0,0 +1,487 @@ +From 9d9b8bd567c30a821c82c27035243536c5234542 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Tue, 29 Mar 2022 22:47:57 -0500 +Subject: [PATCH 017/117] drm/panel: Add driver for ST7701s DPI LCD panel + +Signed-off-by: Samuel Holland +--- + drivers/gpu/drm/panel/Kconfig | 8 + + drivers/gpu/drm/panel/Makefile | 1 + + .../gpu/drm/panel/panel-sitronix-st7701s.c | 444 ++++++++++++++++++ + 3 files changed, 453 insertions(+) + create mode 100644 drivers/gpu/drm/panel/panel-sitronix-st7701s.c + +--- a/drivers/gpu/drm/panel/Kconfig ++++ b/drivers/gpu/drm/panel/Kconfig +@@ -608,6 +608,14 @@ config DRM_PANEL_SITRONIX_ST7701 + ST7701 controller for 480X864 LCD panels with MIPI/RGB/SPI + system interfaces. + ++config DRM_PANEL_SITRONIX_ST7701S ++ tristate "Sitronix ST7701s panel driver" ++ depends on OF ++ depends on BACKLIGHT_CLASS_DEVICE ++ help ++ Say Y here if you want to enable support for the Sitronix ++ ST7701s controller with a SPI interface. ++ + config DRM_PANEL_SITRONIX_ST7703 + tristate "Sitronix ST7703 based MIPI touchscreen panels" + depends on OF +--- a/drivers/gpu/drm/panel/Makefile ++++ b/drivers/gpu/drm/panel/Makefile +@@ -61,6 +61,7 @@ obj-$(CONFIG_DRM_PANEL_SHARP_LS037V7DW01 + obj-$(CONFIG_DRM_PANEL_SHARP_LS043T1LE01) += panel-sharp-ls043t1le01.o + obj-$(CONFIG_DRM_PANEL_SHARP_LS060T1SX01) += panel-sharp-ls060t1sx01.o + obj-$(CONFIG_DRM_PANEL_SITRONIX_ST7701) += panel-sitronix-st7701.o ++obj-$(CONFIG_DRM_PANEL_SITRONIX_ST7701S) += panel-sitronix-st7701s.o + obj-$(CONFIG_DRM_PANEL_SITRONIX_ST7703) += panel-sitronix-st7703.o + obj-$(CONFIG_DRM_PANEL_SITRONIX_ST7789V) += panel-sitronix-st7789v.o + obj-$(CONFIG_DRM_PANEL_SONY_ACX565AKM) += panel-sony-acx565akm.o +--- /dev/null ++++ b/drivers/gpu/drm/panel/panel-sitronix-st7701s.c +@@ -0,0 +1,444 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* ++ * Copyright (C) 2017 Free Electrons ++ */ ++ ++#include ++#include ++#include ++#include ++ ++#include