Initial commit
Some checks failed
Build Kernel / Build all affected Kernels (push) Has been cancelled
Build all core packages / Build all core packages for selected target (push) Has been cancelled
Build and Push prebuilt tools container / Build and Push all prebuilt containers (push) Has been cancelled
Build Toolchains / Build Toolchains for each target (push) Has been cancelled
Build host tools / Build host tools for linux and macos based systems (push) Has been cancelled
Coverity scan build / Coverity x86/64 build (push) Has been cancelled
Some checks failed
Build Kernel / Build all affected Kernels (push) Has been cancelled
Build all core packages / Build all core packages for selected target (push) Has been cancelled
Build and Push prebuilt tools container / Build and Push all prebuilt containers (push) Has been cancelled
Build Toolchains / Build Toolchains for each target (push) Has been cancelled
Build host tools / Build host tools for linux and macos based systems (push) Has been cancelled
Coverity scan build / Coverity x86/64 build (push) Has been cancelled
This commit is contained in:
28
target/linux/bcm4908/Makefile
Normal file
28
target/linux/bcm4908/Makefile
Normal file
@@ -0,0 +1,28 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
ARCH:=aarch64
|
||||
BOARD:=bcm4908
|
||||
BOARDNAME:=Broadcom BCM4908 (ARMv8A CPUs Brahma-B53)
|
||||
FEATURES:=squashfs nand usb gpio
|
||||
CPU_TYPE:=cortex-a53
|
||||
SUBTARGETS:=generic
|
||||
|
||||
KERNEL_PATCHVER:=6.6
|
||||
|
||||
define Target/Description
|
||||
Build firmware images for Broadcom BCM4908 SoC family routers.
|
||||
endef
|
||||
|
||||
include $(INCLUDE_DIR)/target.mk
|
||||
|
||||
KERNELNAME:=Image dtbs
|
||||
|
||||
DEFAULT_PACKAGES += \
|
||||
bcm4908img fdt-utils uboot-envtools \
|
||||
kmod-gpio-button-hotplug \
|
||||
kmod-usb-ohci kmod-usb2 kmod-usb3 \
|
||||
kmod-usb-ledtrig-usbport
|
||||
|
||||
$(eval $(call BuildTarget))
|
||||
25
target/linux/bcm4908/base-files/etc/board.d/02_network
Normal file
25
target/linux/bcm4908/base-files/etc/board.d/02_network
Normal file
@@ -0,0 +1,25 @@
|
||||
# SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
|
||||
|
||||
. /lib/functions/system.sh
|
||||
. /lib/functions/uci-defaults.sh
|
||||
|
||||
bcm4908_setup_interfaces()
|
||||
{
|
||||
local board="$1"
|
||||
|
||||
case "$board" in
|
||||
asus,gt-ac5300)
|
||||
ucidef_set_interface_lan "lan1 lan2 lan5 lan6 sw"
|
||||
;;
|
||||
*)
|
||||
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
board_config_update
|
||||
board=$(board_name)
|
||||
bcm4908_setup_interfaces "$board"
|
||||
board_config_flush
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,3 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
uci set network.@globals[0].packet_steering="1"
|
||||
73
target/linux/bcm4908/base-files/lib/functions/bcm4908.sh
Normal file
73
target/linux/bcm4908/base-files/lib/functions/bcm4908.sh
Normal file
@@ -0,0 +1,73 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later OR BSD-2-Clause
|
||||
|
||||
FS_STATE_READY=2
|
||||
|
||||
# $(1): file to read from
|
||||
# $(2): offset in bytes
|
||||
get_hex_u32_le() {
|
||||
dd if="$1" skip=$2 bs=1 count=4 2>/dev/null | hexdump -v -e '1/4 "%02x"'
|
||||
}
|
||||
|
||||
# Setup /tmp/env.config to provide "metadata" UBI volume access
|
||||
#
|
||||
# It can be used with "fw_printenv -c /tmp/env.config"
|
||||
bcm4908_pkgtb_setup_env_config() {
|
||||
local size=$((0x$(get_hex_u32_le /dev/ubi0_1 4)))
|
||||
|
||||
dd if=/dev/ubi0_1 of=/tmp/env.head count=8 iflag=count_bytes
|
||||
dd if=/dev/ubi0_1 of=/tmp/env.body skip=8 iflag=skip_bytes
|
||||
printf "%s\t0x%x\t0x%x\t0x%x" "/tmp/env.body" 0x0 $size $size > /tmp/env.config
|
||||
}
|
||||
|
||||
bcm4908_committed_image_seq() {
|
||||
bcm4908_pkgtb_setup_env_config
|
||||
|
||||
commited="$(fw_printenv -n -c /tmp/env.config COMMITTED)"
|
||||
[ -n "$commited" ] && {
|
||||
seq=$(fw_printenv -n -c /tmp/env.config SEQ | cut -d ',' -f $commited)
|
||||
[ -n "$seq" ] && {
|
||||
echo $seq
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
echo "Failed to read COMMITED and SEQ from metadata1" >&2
|
||||
}
|
||||
|
||||
# Make sure "rootfs_data" UBI volume matches currently flashed image
|
||||
#
|
||||
# On mismatch "rootfs_data" will be wiped and assigned
|
||||
#
|
||||
# $1: UBI volume of "rootfs_data" (e.g. ubi0_123)
|
||||
bcm4908_verify_rootfs_data() {
|
||||
local ubivol="$1"
|
||||
local dir=/tmp/rootfs_data
|
||||
local seq="$(bcm4908_committed_image_seq)"
|
||||
|
||||
[ -z "$seq" ] && return
|
||||
|
||||
mkdir $dir
|
||||
if ! mount -t ubifs /dev/$ubivol $dir; then
|
||||
echo "Failed to mount $ubivol UBI volume" >&2
|
||||
rmdir $dir
|
||||
return
|
||||
fi
|
||||
|
||||
# Wipe rootfs_data if it doesn't belong to us
|
||||
[ "$(readlink $dir/.openwrt-image-seq)" != "$seq" ] && {
|
||||
echo "Removing \"rootfs_data\" content"
|
||||
rm -rf $dir/..?* $dir/.[!.]* $dir/*
|
||||
}
|
||||
|
||||
# If rootfs_data is clean (or was just wiped) claim it
|
||||
[ -z "$(ls -A $dir)" ] && {
|
||||
echo "Assigning \"rootfs_data\" to the current firmware"
|
||||
# Claim this "rootfs_data"
|
||||
ln -s $seq $dir/.openwrt-image-seq
|
||||
# Mark it ready to avoid "mount_root" wiping it again
|
||||
ln -s $FS_STATE_READY $dir/.fs_state
|
||||
}
|
||||
|
||||
umount $dir
|
||||
rmdir $dir
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later OR BSD-2-Clause
|
||||
|
||||
. /lib/functions/bcm4908.sh
|
||||
|
||||
rootfs_create() {
|
||||
local blocks
|
||||
|
||||
blocks=$(cat /sys/class/ubi/ubi0/avail_eraseblocks)
|
||||
[ -z "$blocks" ] && {
|
||||
echo "Failed to read amount of available erase blocks" >&2
|
||||
return
|
||||
}
|
||||
|
||||
# Use 80% of remaining flash size for "rootfs_data"
|
||||
ubimkvol /dev/ubi0 -n 20 -N rootfs_data --lebs $((blocks / 100 * 80))
|
||||
mknod -m 0600 /dev/ubi0_20 c 252 21
|
||||
|
||||
bcm4908_verify_rootfs_data ubi0_20
|
||||
}
|
||||
|
||||
rootfs_prepare() {
|
||||
# Do nothing on CFE devices
|
||||
ubinfo /dev/ubi0 -N metadata1 > /dev/null 2>&1 || return
|
||||
|
||||
# Find UBI volume device (e.g. ubi0_123)
|
||||
local ubivol="$(grep rootfs_data /sys/class/ubi/ubi*/name | sed -n 's/.*\(ubi\d*_\d*\).*/\1/p')"
|
||||
if [ -n "$ubivol" ]; then
|
||||
bcm4908_verify_rootfs_data $ubivol
|
||||
else
|
||||
echo "Creating \"rootfs_data\" UBI volume"
|
||||
rootfs_create
|
||||
fi
|
||||
}
|
||||
|
||||
boot_hook_add preinit_main rootfs_prepare
|
||||
439
target/linux/bcm4908/base-files/lib/upgrade/platform.sh
Normal file
439
target/linux/bcm4908/base-files/lib/upgrade/platform.sh
Normal file
@@ -0,0 +1,439 @@
|
||||
# SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
|
||||
|
||||
. /lib/functions/bcm4908.sh
|
||||
|
||||
RAMFS_COPY_BIN="bcm4908img expr grep ln fdtget fw_printenv fw_setenv readlink tr"
|
||||
|
||||
PART_NAME=firmware
|
||||
|
||||
BCM4908_FW_FORMAT=
|
||||
BCM4908_FW_BOARD_ID=
|
||||
BCM4908_FW_INT_IMG_FORMAT=
|
||||
|
||||
# $(1): file to read from
|
||||
# $(2): offset in bytes
|
||||
# $(3): length in bytes
|
||||
get_content() {
|
||||
dd if="$1" skip=$2 bs=1 count=$3 2>/dev/null
|
||||
}
|
||||
|
||||
# $(1): file to read from
|
||||
# $(2): offset in bytes
|
||||
get_hex_u32_le() {
|
||||
dd if="$1" skip=$2 bs=1 count=4 2>/dev/null | hexdump -v -e '1/4 "%02x"'
|
||||
}
|
||||
|
||||
# $(1): file to read from
|
||||
# $(2): offset in bytes
|
||||
get_hex_u32_be() {
|
||||
dd if="$1" skip=$2 bs=1 count=4 2>/dev/null | hexdump -v -e '1/1 "%02x"'
|
||||
}
|
||||
|
||||
platform_expected_image() {
|
||||
local machine=$(board_name)
|
||||
|
||||
case "$machine" in
|
||||
asus,gt-ac5300) echo "asus GT-AC5300";;
|
||||
netgear,r8000p) echo "chk U12H359T00_NETGEAR";;
|
||||
tplink,archer-c2300-v1) echo "";;
|
||||
esac
|
||||
}
|
||||
|
||||
platform_identify() {
|
||||
local magic
|
||||
local size
|
||||
|
||||
magic=$(get_hex_u32_be "$1" 0)
|
||||
case "$magic" in
|
||||
d00dfeed)
|
||||
BCM4908_FW_FORMAT="pkgtb"
|
||||
return
|
||||
;;
|
||||
2a23245e)
|
||||
local header_len=$((0x$(get_hex_u32_be "$1" 4)))
|
||||
local board_id_len=$(($header_len - 40))
|
||||
|
||||
BCM4908_FW_FORMAT="chk"
|
||||
BCM4908_FW_BOARD_ID=$(dd if="$1" skip=40 bs=1 count=$board_id_len 2>/dev/null | hexdump -v -e '1/1 "%c"')
|
||||
magic=$(get_hex_u32_be "$1" "$header_len")
|
||||
[ "$magic" = "d00dfeed" ] && {
|
||||
BCM4908_FW_INT_IMG_FORMAT="pkgtb"
|
||||
} || {
|
||||
BCM4908_FW_INT_IMG_FORMAT="bcm4908img"
|
||||
}
|
||||
BCM4908_FW_INT_IMG_EXTRACT_CMD="dd skip=$header_len iflag=skip_bytes"
|
||||
return
|
||||
;;
|
||||
esac
|
||||
|
||||
size=$(wc -c "$1" | cut -d ' ' -f 1)
|
||||
|
||||
magic=$(get_content "$1" $((size - 20 - 64 + 8)) 12)
|
||||
case "$magic" in
|
||||
GT-AC5300)
|
||||
local size=$(wc -c "$1" | cut -d ' ' -f 1)
|
||||
|
||||
BCM4908_FW_FORMAT="asus"
|
||||
BCM4908_FW_BOARD_ID=$(get_content "$1" $((size - 20 - 64 + 8)) 12)
|
||||
BCM4908_FW_INT_IMG_FORMAT="bcm4908img"
|
||||
return
|
||||
;;
|
||||
esac
|
||||
|
||||
# Detecting native format is a bit complex (it may start with CFE or
|
||||
# JFFS2) so just use bcm4908img instead of bash hacks.
|
||||
# Make it the last attempt as bcm4908img detects also vendor formats.
|
||||
bcm4908img info -i "$1" > /dev/null && {
|
||||
BCM4908_FW_FORMAT="bcm4908img"
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# pkgtb helpers
|
||||
#
|
||||
|
||||
platform_pkgtb_get_image_name() {
|
||||
local configuration=$($2 < $1 | fdtget - /configurations default)
|
||||
[ -z "$configuration" ] && {
|
||||
echo "Failed to read default configuration from pkgtb" >&2
|
||||
return
|
||||
}
|
||||
|
||||
local image_name=$($2 < $1 | fdtget - /configurations/$configuration $3)
|
||||
[ -z "$image_name" ] && {
|
||||
echo "Failed to read $3 from pkgtb configuration \"$configuration\"" >&2
|
||||
return
|
||||
}
|
||||
|
||||
echo "$image_name"
|
||||
}
|
||||
|
||||
platform_pkgtb_get_image() {
|
||||
local cmd="${2:-cat}"
|
||||
|
||||
local image_name=$(platform_pkgtb_get_image_name "$1" "$cmd" "$3")
|
||||
|
||||
$cmd < $1 | fdtget -p - /images/$image_name | grep -Eq "^data$" && {
|
||||
$cmd < $1 | fdtget -t r - /images/$image_name data
|
||||
return
|
||||
}
|
||||
|
||||
$cmd < $1 | fdtget -p - /images/$image_name | grep -Eq "^data-position$" && {
|
||||
local data_position=$($cmd < $1 | fdtget - /images/$image_name data-position)
|
||||
local data_size=$($cmd < $1 | fdtget - /images/$image_name data-size)
|
||||
$cmd < $1 2>/dev/null | dd skip=$data_position count=$data_size iflag=skip_bytes,count_bytes
|
||||
return
|
||||
}
|
||||
|
||||
$cmd < $1 | fdtget -p - /images/$image_name | grep -Eq "^data-offset" && {
|
||||
local data_offset=$($cmd < $1 | fdtget - /images/$image_name data-offset)
|
||||
local totalsize=$(get_hex_u32_be "$1" 4)
|
||||
local data_position=$(((0x$totalsize + data_offset + 3) & ~3))
|
||||
local data_size=$($cmd < $1 | fdtget - /images/$image_name data-size)
|
||||
$cmd < $1 2>/dev/null | dd skip=$data_position count=$data_size iflag=skip_bytes,count_bytes
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
platform_pkgtb_get_upgrade_index() {
|
||||
case "$(fw_printenv -l /tmp -n -c /tmp/env.config COMMITTED)" in
|
||||
1) echo 2;;
|
||||
2) echo 1;;
|
||||
*) echo 1;;
|
||||
esac
|
||||
}
|
||||
|
||||
platform_pkgtb_commit() {
|
||||
local size=$((0x$(get_hex_u32_le /dev/ubi0_1 4)))
|
||||
local valid1=0
|
||||
local valid2=0
|
||||
local seq1
|
||||
local seq2
|
||||
local tmp
|
||||
|
||||
# Read current values
|
||||
for valid in $(fw_printenv -l /tmp -n -c /tmp/env.config VALID | tr ',' ' '); do
|
||||
case "$valid" in
|
||||
1) valid0=1;;
|
||||
2) valid1=2;;
|
||||
esac
|
||||
done
|
||||
seq0=$(fw_printenv -l /tmp -n -c /tmp/env.config SEQ | cut -d ',' -f 1)
|
||||
seq1=$(fw_printenv -l /tmp -n -c /tmp/env.config SEQ | cut -d ',' -f 2)
|
||||
|
||||
# Calculate values
|
||||
case "$1" in
|
||||
1) valid0=1; seq0=$(((seq1 + 1) % 1000));;
|
||||
2) valid1=2; seq1=$(((seq0 + 1) % 1000));;
|
||||
esac
|
||||
|
||||
# Update variables
|
||||
fw_setenv -l /tmp -c /tmp/env.config COMMITTED "$1"
|
||||
fw_setenv -l /tmp -c /tmp/env.config VALID "$valid0,$valid1"
|
||||
fw_setenv -l /tmp -c /tmp/env.config SEQ "$seq0,$seq1"
|
||||
|
||||
# Write
|
||||
tmp=$(cat /tmp/env.head /tmp/env.body | wc -c)
|
||||
cat /tmp/env.head /tmp/env.body | ubiupdatevol /dev/ubi0_1 -s $tmp -
|
||||
}
|
||||
|
||||
#
|
||||
# check
|
||||
#
|
||||
|
||||
platform_check_pkgtb() {
|
||||
local cmd="${2:-cat}"
|
||||
|
||||
[ -n "$(platform_pkgtb_get_image_name "$1" "$cmd" "bootfs")" -a -n "$(platform_pkgtb_get_image_name "$1" "$cmd" "rootfs")" ]
|
||||
}
|
||||
|
||||
platform_check_image() {
|
||||
[ "$#" -gt 1 ] && return 1
|
||||
|
||||
local expected_image=$(platform_expected_image)
|
||||
local error=0
|
||||
|
||||
platform_identify "$1"
|
||||
[ -z "$BCM4908_FW_FORMAT" ] && {
|
||||
echo "Invalid image type. Please use firmware specific for this device."
|
||||
notify_firmware_broken
|
||||
return 1
|
||||
}
|
||||
echo "Found $BCM4908_FW_FORMAT firmware for device ${BCM4908_FW_BOARD_ID:----}"
|
||||
|
||||
local expected_image="$(platform_expected_image)"
|
||||
[ -n "$expected_image" -a -n "$BCM4908_FW_BOARD_ID" -a "$BCM4908_FW_FORMAT $BCM4908_FW_BOARD_ID" != "$expected_image" ] && {
|
||||
echo "Firmware doesn't match device ($expected_image)"
|
||||
error=1
|
||||
}
|
||||
|
||||
case "$BCM4908_FW_FORMAT" in
|
||||
"bcm4908img")
|
||||
bcm4908img info -i "$1" > /dev/null || {
|
||||
echo "Failed to validate BCM4908 image" >&2
|
||||
notify_firmware_broken
|
||||
return 1
|
||||
}
|
||||
|
||||
bcm4908img bootfs -i "$1" ls | grep -q "1-openwrt" || {
|
||||
# OpenWrt images have 1-openwrt dummy file in the bootfs.
|
||||
# Don't allow backup if it's missing
|
||||
notify_firmware_no_backup
|
||||
}
|
||||
;;
|
||||
"pkgtb")
|
||||
platform_check_pkgtb "$1" || {
|
||||
echo "Failed to validate pkgtb firmware" >&2
|
||||
notify_firmware_broken
|
||||
return 1
|
||||
}
|
||||
;;
|
||||
*)
|
||||
case "$BCM4908_FW_INT_IMG_FORMAT" in
|
||||
"bcm4908img")
|
||||
bcm4908img info -i "$1" > /dev/null || {
|
||||
echo "Failed to validate BCM4908 image" >&2
|
||||
notify_firmware_broken
|
||||
return 1
|
||||
}
|
||||
|
||||
bcm4908img bootfs -i "$1" ls | grep -q "1-openwrt" || {
|
||||
# OpenWrt images have 1-openwrt dummy file in the bootfs.
|
||||
# Don't allow backup if it's missing
|
||||
notify_firmware_no_backup
|
||||
}
|
||||
;;
|
||||
"pkgtb")
|
||||
platform_check_pkgtb "$1" "$BCM4908_FW_INT_IMG_EXTRACT_CMD" || {
|
||||
echo "Failed to validate pkgtb firmware" >&2
|
||||
notify_firmware_broken
|
||||
return 1
|
||||
}
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
return $error
|
||||
}
|
||||
|
||||
#
|
||||
# upgrade
|
||||
#
|
||||
|
||||
platform_pkgtb_clean_rootfs_data() {
|
||||
local ubidev=$(nand_find_ubi $CI_UBIPART)
|
||||
local ubivol="$(nand_find_volume $ubidev rootfs_data)"
|
||||
|
||||
bcm4908_verify_rootfs_data "$ubivol"
|
||||
}
|
||||
|
||||
platform_do_upgrade_pkgtb() {
|
||||
local cmd="${2:-cat}"
|
||||
local size
|
||||
local idx bootfs_id rootfs_id
|
||||
|
||||
bcm4908_pkgtb_setup_env_config
|
||||
|
||||
idx=$(platform_pkgtb_get_upgrade_index)
|
||||
case "$idx" in
|
||||
1) bootfs_id=3; rootfs_id=4;;
|
||||
2) bootfs_id=5; rootfs_id=6;;
|
||||
esac
|
||||
|
||||
size=$(platform_pkgtb_get_image "$1" "$cmd" "bootfs" | wc -c)
|
||||
ubirmvol /dev/ubi0 -N bootfs$idx
|
||||
ubimkvol /dev/ubi0 -n $bootfs_id -N bootfs$idx -t static -s $size
|
||||
platform_pkgtb_get_image "$1" "$cmd" "bootfs" | ubiupdatevol /dev/ubi0_$bootfs_id -s $size -
|
||||
|
||||
size=$(platform_pkgtb_get_image "$1" "$cmd" "rootfs" | wc -c)
|
||||
ubirmvol /dev/ubi0 -N rootfs$idx
|
||||
ubimkvol /dev/ubi0 -n $rootfs_id -N rootfs$idx -t dynamic -s $size
|
||||
platform_pkgtb_get_image "$1" "$cmd" "rootfs" | ubiupdatevol /dev/ubi0_$rootfs_id -s $size -
|
||||
|
||||
platform_pkgtb_commit $idx
|
||||
|
||||
CI_UBIPART="image"
|
||||
platform_pkgtb_clean_rootfs_data
|
||||
nand_do_upgrade_success
|
||||
}
|
||||
|
||||
# $1: cferam index increment value
|
||||
platform_calc_new_cferam() {
|
||||
local inc="$1"
|
||||
local dir="/tmp/sysupgrade-bcm4908"
|
||||
|
||||
local mtd=$(find_mtd_part bootfs)
|
||||
[ -z "$mtd" ] && {
|
||||
echo "Failed to find bootfs partition" >&2
|
||||
return
|
||||
}
|
||||
|
||||
rm -fR $dir
|
||||
mkdir -p $dir
|
||||
mount -t jffs2 -o ro $mtd $dir || {
|
||||
echo "Failed to mount bootfs partition $mtd" >&2
|
||||
rm -fr $dir
|
||||
return
|
||||
}
|
||||
|
||||
local idx=$(ls $dir/cferam.??? | sed -n 's/.*cferam\.\(\d\d\d\)/\1/p')
|
||||
[ -z "$idx" ] && {
|
||||
echo "Failed to find cferam current index" >&2
|
||||
rm -fr $dir
|
||||
return
|
||||
}
|
||||
|
||||
umount $dir
|
||||
rm -fr $dir
|
||||
|
||||
idx=$(($(expr $idx + $inc) % 1000))
|
||||
|
||||
echo $(printf "cferam.%03d" $idx)
|
||||
}
|
||||
|
||||
platform_do_upgrade_ubi() {
|
||||
local dir="/tmp/sysupgrade-bcm4908"
|
||||
local inc=1
|
||||
|
||||
# Verify new bootfs size
|
||||
local mtd_bootfs_size=$(grep "\"bootfs\"" /proc/mtd | sed "s/mtd[0-9]*:[ \t]*\([^ \t]*\).*/\1/")
|
||||
[ -z "$mtd_bootfs_size" ] && {
|
||||
echo "Unable to find \"bootfs\" partition size"
|
||||
return
|
||||
}
|
||||
mtd_bootfs_size=$((0x$mtd_bootfs_size))
|
||||
local img_bootfs_size=$(bcm4908img extract -i "$1" -t bootfs | wc -c)
|
||||
[ $img_bootfs_size -gt $mtd_bootfs_size ] && {
|
||||
echo "New bootfs doesn't fit MTD partition."
|
||||
return
|
||||
}
|
||||
|
||||
# Find cferam name for new firmware
|
||||
# For UBI we always flash "firmware" so don't increase cferam index if
|
||||
# there is "fallback". That could result in cferam.999 & cferam.001
|
||||
[ -n "$(find_mtd_index backup)" -o -n "$(find_mtd_index fallback)" ] && inc=0
|
||||
local cferam=$(platform_calc_new_cferam $inc)
|
||||
[ -z "$cferam" ] && exit 1
|
||||
|
||||
# Prepare new firmware
|
||||
bcm4908img bootfs -i "$1" mv cferam.000 $cferam || {
|
||||
echo "Failed to rename cferam.000 to $cferam" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Extract rootfs for further flashing
|
||||
rm -fr $dir
|
||||
mkdir -p $dir
|
||||
bcm4908img extract -i "$1" -t rootfs > $dir/root || {
|
||||
echo "Failed to extract rootfs" >&2
|
||||
rm -fr $dir
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Flash bootfs MTD partition with new one
|
||||
mtd erase bootfs || {
|
||||
echo "Failed to erase bootfs" >&2
|
||||
rm -fr $dir
|
||||
exit 1
|
||||
}
|
||||
bcm4908img extract -i "$1" -t bootfs | mtd write - bootfs || {
|
||||
echo "Failed to flash bootfs" >&2
|
||||
rm -fr $dir
|
||||
exit 1
|
||||
}
|
||||
|
||||
nand_do_upgrade $dir/root
|
||||
}
|
||||
|
||||
platform_do_upgrade() {
|
||||
platform_identify "$1"
|
||||
|
||||
# Try NAND aware UBI upgrade for OpenWrt images
|
||||
case "$BCM4908_FW_FORMAT" in
|
||||
"bcm4908img")
|
||||
bcm4908img bootfs -i "$1" ls | grep -q "1-openwrt" && platform_do_upgrade_ubi "$1"
|
||||
;;
|
||||
"pkgtb")
|
||||
platform_do_upgrade_pkgtb "$1"
|
||||
;;
|
||||
*)
|
||||
case "$BCM4908_FW_INT_IMG_FORMAT" in
|
||||
"bcm4908img")
|
||||
bcm4908img bootfs -i "$1" ls | grep -q "1-openwrt" && platform_do_upgrade_ubi "$1"
|
||||
;;
|
||||
"pkgtb")
|
||||
platform_do_upgrade_pkgtb "$1" "$BCM4908_FW_INT_IMG_EXTRACT_CMD"
|
||||
;;
|
||||
*)
|
||||
echo "NAND aware sysupgrade is unsupported for $BCM4908_FW_FORMAT format"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
# Above calls exit on success.
|
||||
# If we got here it isn't OpenWrt image or something went wrong.
|
||||
[ "$BCM4908_FW_FORMAT" = "pkgtb" -o "$BCM4908_FW_INT_IMG_FORMAT" = "pkgtb" ] && {
|
||||
echo "Failed to upgrade pkgtb. Fallback to raw flashing is impossible for this format." >&2
|
||||
exit 1
|
||||
}
|
||||
echo "Writing whole image to NAND flash. All erase counters will be lost."
|
||||
|
||||
# Find cferam name for new firmware
|
||||
local cferam=$(platform_calc_new_cferam 1)
|
||||
[ -z "$cferam" ] && exit 1
|
||||
|
||||
# Prepare new firmware
|
||||
bcm4908img bootfs -i "$1" mv cferam.000 $cferam || {
|
||||
echo "Failed to rename cferam.000 to $cferam" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Jush flash firmware partition as is
|
||||
[ -n "$(find_mtd_index backup)" ] && PART_NAME=backup
|
||||
[ -n "$(find_mtd_index fallback)" ] && PART_NAME=fallback
|
||||
mtd erase $PART_NAME
|
||||
default_do_upgrade "$1" "bcm4908img extract -t firmware"
|
||||
}
|
||||
29
target/linux/bcm4908/base-files/usr/libexec/platform/packet-steering.sh
Executable file
29
target/linux/bcm4908/base-files/usr/libexec/platform/packet-steering.sh
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/bin/sh
|
||||
|
||||
packet_steering="$(uci -q get network.@globals[0].packet_steering)"
|
||||
num_cpus="$(grep -c "^processor.*:" /proc/cpuinfo)"
|
||||
flow_offloading="$(uci -q get firewall.@defaults[0].flow_offloading)"
|
||||
flow_offloading_hw="$(uci -q get firewall.@defaults[0].flow_offloading_hw)"
|
||||
rps_eth0=0
|
||||
rps_br_lan=0
|
||||
|
||||
[ "$packet_steering" = 1 ] && {
|
||||
if [ ${flow_offloading_hw:-0} -gt 0 ]; then
|
||||
# HW offloading
|
||||
# Not implemented
|
||||
:
|
||||
elif [ ${flow_offloading:-0} -gt 0 ]; then
|
||||
# SW offloading
|
||||
# BCM4908 always reaches ~940 Mb/s
|
||||
:
|
||||
else
|
||||
# Default
|
||||
case "$num_cpus" in
|
||||
2) rps_eth0=2; rps_br_lan=2;;
|
||||
4) rps_eth0=e; rps_br_lan=e;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
echo $rps_eth0 > /sys/class/net/eth0/queues/rx-0/rps_cpus
|
||||
echo $rps_br_lan > /sys/class/net/br-lan/queues/rx-0/rps_cpus
|
||||
278
target/linux/bcm4908/config-6.6
Normal file
278
target/linux/bcm4908/config-6.6
Normal file
@@ -0,0 +1,278 @@
|
||||
CONFIG_64BIT=y
|
||||
CONFIG_ARCH_BCM=y
|
||||
CONFIG_ARCH_BCMBCA=y
|
||||
CONFIG_ARCH_BINFMT_ELF_EXTRA_PHDRS=y
|
||||
CONFIG_ARCH_CORRECT_STACKTRACE_ON_KRETPROBE=y
|
||||
CONFIG_ARCH_DEFAULT_KEXEC_IMAGE_VERIFY_SIG=y
|
||||
CONFIG_ARCH_DMA_ADDR_T_64BIT=y
|
||||
CONFIG_ARCH_FORCE_MAX_ORDER=10
|
||||
CONFIG_ARCH_KEEP_MEMBLOCK=y
|
||||
CONFIG_ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE=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_MIN=11
|
||||
CONFIG_ARCH_PROC_KCORE_TEXT=y
|
||||
CONFIG_ARCH_SPARSEMEM_ENABLE=y
|
||||
CONFIG_ARCH_STACKWALK=y
|
||||
CONFIG_ARCH_SUSPEND_POSSIBLE=y
|
||||
CONFIG_ARCH_WANTS_NO_INSTR=y
|
||||
CONFIG_ARCH_WANTS_THP_SWAP=y
|
||||
CONFIG_ARM64=y
|
||||
CONFIG_ARM64_4K_PAGES=y
|
||||
CONFIG_ARM64_LD_HAS_FIX_ERRATUM_843419=y
|
||||
CONFIG_ARM64_PAGE_SHIFT=12
|
||||
CONFIG_ARM64_PA_BITS=48
|
||||
CONFIG_ARM64_PA_BITS_48=y
|
||||
CONFIG_ARM64_PTR_AUTH=y
|
||||
CONFIG_ARM64_PTR_AUTH_KERNEL=y
|
||||
CONFIG_ARM64_SVE=y
|
||||
CONFIG_ARM64_TAGGED_ADDR_ABI=y
|
||||
CONFIG_ARM64_VA_BITS=39
|
||||
CONFIG_ARM64_VA_BITS_39=y
|
||||
CONFIG_ARM_AMBA=y
|
||||
CONFIG_ARM_ARCH_TIMER=y
|
||||
CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y
|
||||
CONFIG_ARM_GIC=y
|
||||
CONFIG_ARM_GIC_V3=y
|
||||
CONFIG_ARM_GIC_V3_ITS=y
|
||||
CONFIG_ARM_PSCI_FW=y
|
||||
CONFIG_AUDIT_ARCH_COMPAT_GENERIC=y
|
||||
CONFIG_B53=y
|
||||
CONFIG_BCM4908_ENET=y
|
||||
CONFIG_BCM7038_WDT=y
|
||||
CONFIG_BCM7XXX_PHY=y
|
||||
CONFIG_BCM_NET_PHYLIB=y
|
||||
CONFIG_BCM_PMB=y
|
||||
# CONFIG_BLK_DEV_INITRD is not set
|
||||
CONFIG_BLK_PM=y
|
||||
CONFIG_BUILTIN_RETURN_ADDRESS_STRIPS_PAC=y
|
||||
CONFIG_CC_HAVE_SHADOW_CALL_STACK=y
|
||||
CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG=y
|
||||
CONFIG_CLK_BCM_63XX=y
|
||||
CONFIG_CLONE_BACKWARDS=y
|
||||
CONFIG_CMDLINE="earlycon=bcm63xx_uart,0xff800640 console=ttyS0,115200"
|
||||
CONFIG_CMDLINE_FROM_BOOTLOADER=y
|
||||
CONFIG_COMMON_CLK=y
|
||||
CONFIG_COMMON_CLK_IPROC=y
|
||||
CONFIG_COMPACT_UNEVICTABLE_DEFAULT=1
|
||||
# CONFIG_COMPAT_32BIT_TIME is not set
|
||||
CONFIG_CONTEXT_TRACKING=y
|
||||
CONFIG_CONTEXT_TRACKING_IDLE=y
|
||||
CONFIG_CPU_LITTLE_ENDIAN=y
|
||||
CONFIG_CPU_RMAP=y
|
||||
CONFIG_CRC16=y
|
||||
CONFIG_CRYPTO_AES_ARM64=y
|
||||
CONFIG_CRYPTO_AES_ARM64_CE=y
|
||||
CONFIG_CRYPTO_AES_ARM64_CE_BLK=y
|
||||
CONFIG_CRYPTO_AES_ARM64_CE_CCM=y
|
||||
CONFIG_CRYPTO_CRYPTD=y
|
||||
CONFIG_CRYPTO_DEFLATE=y
|
||||
CONFIG_CRYPTO_GHASH_ARM64_CE=y
|
||||
CONFIG_CRYPTO_HASH_INFO=y
|
||||
CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y
|
||||
CONFIG_CRYPTO_LIB_GF128MUL=y
|
||||
CONFIG_CRYPTO_LIB_SHA1=y
|
||||
CONFIG_CRYPTO_LIB_UTILS=y
|
||||
CONFIG_CRYPTO_LZO=y
|
||||
CONFIG_CRYPTO_ZSTD=y
|
||||
CONFIG_DCACHE_WORD_ACCESS=y
|
||||
CONFIG_DEBUG_INFO=y
|
||||
CONFIG_DMA_BOUNCE_UNALIGNED_KMALLOC=y
|
||||
CONFIG_DMA_DIRECT_REMAP=y
|
||||
CONFIG_DTC=y
|
||||
CONFIG_EDAC_SUPPORT=y
|
||||
CONFIG_EXCLUSIVE_SYSTEM_RAM=y
|
||||
CONFIG_FIXED_PHY=y
|
||||
CONFIG_FIX_EARLYCON_MEM=y
|
||||
CONFIG_FRAME_POINTER=y
|
||||
CONFIG_FS_IOMAP=y
|
||||
CONFIG_FUNCTION_ALIGNMENT=4
|
||||
CONFIG_FUNCTION_ALIGNMENT_4B=y
|
||||
CONFIG_FWNODE_MDIO=y
|
||||
CONFIG_FW_LOADER_PAGED_BUF=y
|
||||
CONFIG_FW_LOADER_SYSFS=y
|
||||
CONFIG_GCC_ASM_GOTO_OUTPUT_WORKAROUND=y
|
||||
CONFIG_GCC_SUPPORTS_DYNAMIC_FTRACE_WITH_ARGS=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_CPU_AUTOPROBE=y
|
||||
CONFIG_GENERIC_CPU_VULNERABILITIES=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_SHOW=y
|
||||
CONFIG_GENERIC_IRQ_SHOW_LEVEL=y
|
||||
CONFIG_GENERIC_LIB_DEVMEM_IS_ALLOWED=y
|
||||
CONFIG_GENERIC_MSI_IRQ=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_GPIO_CDEV=y
|
||||
CONFIG_GPIO_GENERIC=y
|
||||
CONFIG_GPIO_GENERIC_PLATFORM=y
|
||||
CONFIG_GRO_CELLS=y
|
||||
CONFIG_HARDIRQS_SW_RESEND=y
|
||||
CONFIG_HAS_DMA=y
|
||||
CONFIG_HAS_IOMEM=y
|
||||
CONFIG_HAS_IOPORT=y
|
||||
CONFIG_HZ_PERIODIC=y
|
||||
CONFIG_I2C=y
|
||||
CONFIG_I2C_BOARDINFO=y
|
||||
CONFIG_I2C_BRCMSTB=y
|
||||
CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000
|
||||
CONFIG_IRQCHIP=y
|
||||
CONFIG_IRQ_DOMAIN=y
|
||||
CONFIG_IRQ_DOMAIN_HIERARCHY=y
|
||||
CONFIG_IRQ_FORCED_THREADING=y
|
||||
CONFIG_IRQ_WORK=y
|
||||
CONFIG_LEDS_BCM63138=y
|
||||
CONFIG_LEDS_GPIO=y
|
||||
CONFIG_LIBFDT=y
|
||||
CONFIG_LOCK_DEBUGGING_SUPPORT=y
|
||||
CONFIG_LOCK_SPIN_ON_OWNER=y
|
||||
CONFIG_LZO_COMPRESS=y
|
||||
CONFIG_LZO_DECOMPRESS=y
|
||||
CONFIG_MDIO_BCM_UNIMAC=y
|
||||
CONFIG_MDIO_BUS=y
|
||||
CONFIG_MDIO_DEVICE=y
|
||||
CONFIG_MDIO_DEVRES=y
|
||||
CONFIG_MFD_SYSCON=y
|
||||
CONFIG_MIGRATION=y
|
||||
# CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY is not set
|
||||
CONFIG_MMU_LAZY_TLB_REFCOUNT=y
|
||||
CONFIG_MODULES_USE_ELF_RELA=y
|
||||
CONFIG_MTD_BRCM_U_BOOT=y
|
||||
CONFIG_MTD_CMDLINE_PARTS=y
|
||||
CONFIG_MTD_NAND_BRCMNAND=y
|
||||
CONFIG_MTD_NAND_BRCMNAND_BCMBCA=y
|
||||
CONFIG_MTD_NAND_CORE=y
|
||||
CONFIG_MTD_NAND_ECC=y
|
||||
CONFIG_MTD_NAND_ECC_SW_HAMMING=y
|
||||
CONFIG_MTD_OF_PARTS_BCM4908=y
|
||||
# CONFIG_MTD_OF_PARTS_LINKSYS_NS is not set
|
||||
CONFIG_MTD_RAW_NAND=y
|
||||
CONFIG_MTD_SPLIT_CFE_BOOTFS=y
|
||||
# CONFIG_MTD_SPLIT_SQUASHFS_ROOT is not set
|
||||
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_NEED_SG_DMA_LENGTH=y
|
||||
CONFIG_NET_DEVLINK=y
|
||||
CONFIG_NET_DSA=y
|
||||
CONFIG_NET_DSA_BCM_SF2=y
|
||||
CONFIG_NET_DSA_TAG_BRCM=y
|
||||
CONFIG_NET_DSA_TAG_BRCM_COMMON=y
|
||||
CONFIG_NET_DSA_TAG_BRCM_LEGACY=y
|
||||
CONFIG_NET_DSA_TAG_BRCM_PREPEND=y
|
||||
CONFIG_NET_DSA_TAG_NONE=y
|
||||
CONFIG_NET_EGRESS=y
|
||||
CONFIG_NET_FLOW_LIMIT=y
|
||||
CONFIG_NET_INGRESS=y
|
||||
CONFIG_NET_SELFTESTS=y
|
||||
CONFIG_NET_SWITCHDEV=y
|
||||
CONFIG_NET_XGRESS=y
|
||||
CONFIG_NO_IOPORT_MAP=y
|
||||
CONFIG_NR_CPUS=4
|
||||
CONFIG_NVMEM=y
|
||||
CONFIG_NVMEM_LAYOUTS=y
|
||||
CONFIG_NVMEM_SYSFS=y
|
||||
CONFIG_NVMEM_U_BOOT_ENV=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_PADATA=y
|
||||
CONFIG_PAGE_POOL=y
|
||||
CONFIG_PAGE_SIZE_LESS_THAN_256KB=y
|
||||
CONFIG_PAGE_SIZE_LESS_THAN_64KB=y
|
||||
CONFIG_PARTITION_PERCPU=y
|
||||
CONFIG_PER_VMA_LOCK=y
|
||||
CONFIG_PGTABLE_LEVELS=3
|
||||
CONFIG_PHYLIB=y
|
||||
CONFIG_PHYLIB_LEDS=y
|
||||
CONFIG_PHYLINK=y
|
||||
CONFIG_PHYS_ADDR_T_64BIT=y
|
||||
# CONFIG_PHY_BRCM_SATA is not set
|
||||
CONFIG_PHY_BRCM_USB=y
|
||||
CONFIG_PINCTRL=y
|
||||
CONFIG_PINCTRL_BCM4908=y
|
||||
# CONFIG_PINCTRL_SINGLE is not set
|
||||
CONFIG_PM=y
|
||||
CONFIG_PM_CLK=y
|
||||
CONFIG_PM_GENERIC_DOMAINS=y
|
||||
CONFIG_PM_GENERIC_DOMAINS_OF=y
|
||||
CONFIG_POSIX_CPU_TIMERS_TASK_WORK=y
|
||||
CONFIG_POWER_RESET=y
|
||||
CONFIG_POWER_RESET_SYSCON=y
|
||||
CONFIG_POWER_SUPPLY=y
|
||||
CONFIG_PREEMPT_NONE_BUILD=y
|
||||
CONFIG_PTP_1588_CLOCK_OPTIONAL=y
|
||||
CONFIG_QUEUED_RWLOCKS=y
|
||||
CONFIG_QUEUED_SPINLOCKS=y
|
||||
CONFIG_RANDSTRUCT_NONE=y
|
||||
CONFIG_RATIONAL=y
|
||||
CONFIG_REGMAP=y
|
||||
CONFIG_REGMAP_MMIO=y
|
||||
CONFIG_RELOCATABLE=y
|
||||
CONFIG_RFS_ACCEL=y
|
||||
CONFIG_RODATA_FULL_DEFAULT_ENABLED=y
|
||||
CONFIG_RPS=y
|
||||
CONFIG_RWSEM_SPIN_ON_OWNER=y
|
||||
# CONFIG_SERIAL_8250 is not set
|
||||
CONFIG_SERIAL_BCM63XX=y
|
||||
CONFIG_SERIAL_BCM63XX_CONSOLE=y
|
||||
CONFIG_SGL_ALLOC=y
|
||||
CONFIG_SMP=y
|
||||
CONFIG_SOCK_RX_QUEUE_MAPPING=y
|
||||
CONFIG_SOFTIRQ_ON_OWN_STACK=y
|
||||
CONFIG_SPARSEMEM=y
|
||||
CONFIG_SPARSEMEM_EXTREME=y
|
||||
CONFIG_SPARSEMEM_VMEMMAP=y
|
||||
CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
|
||||
CONFIG_SPARSE_IRQ=y
|
||||
CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU=y
|
||||
CONFIG_SWIOTLB=y
|
||||
CONFIG_SWPHY=y
|
||||
CONFIG_SYSCTL_EXCEPTION_TRACE=y
|
||||
CONFIG_THREAD_INFO_IN_TASK=y
|
||||
CONFIG_TICK_CPU_ACCOUNTING=y
|
||||
CONFIG_TIMER_OF=y
|
||||
CONFIG_TIMER_PROBE=y
|
||||
CONFIG_TRACE_IRQFLAGS_NMI_SUPPORT=y
|
||||
CONFIG_TREE_RCU=y
|
||||
CONFIG_TREE_SRCU=y
|
||||
CONFIG_UBIFS_FS=y
|
||||
CONFIG_UNMAP_KERNEL_AT_EL0=y
|
||||
CONFIG_USB_SUPPORT=y
|
||||
CONFIG_VMAP_STACK=y
|
||||
CONFIG_WATCHDOG_CORE=y
|
||||
CONFIG_XPS=y
|
||||
CONFIG_XXHASH=y
|
||||
CONFIG_ZLIB_DEFLATE=y
|
||||
CONFIG_ZLIB_INFLATE=y
|
||||
CONFIG_ZONE_DMA32=y
|
||||
CONFIG_ZSTD_COMMON=y
|
||||
CONFIG_ZSTD_COMPRESS=y
|
||||
CONFIG_ZSTD_DECOMPRESS=y
|
||||
1
target/linux/bcm4908/generic/target.mk
Normal file
1
target/linux/bcm4908/generic/target.mk
Normal file
@@ -0,0 +1 @@
|
||||
BOARDNAME:=Generic
|
||||
138
target/linux/bcm4908/image/Makefile
Normal file
138
target/linux/bcm4908/image/Makefile
Normal file
@@ -0,0 +1,138 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/image.mk
|
||||
|
||||
DEVICE_VARS += ASUS_PRODUCTID ASUS_BUILD_NO ASUS_FW_REV ASUS_EXT_NO
|
||||
DEVICE_VARS += NETGEAR_BOARD_ID NETGEAR_REGION
|
||||
DEVICE_VARS += SOC
|
||||
|
||||
define Image/Prepare
|
||||
cp bootfs*.its* $(KDIR)/
|
||||
sed -i "s=\$$$${images_dir}=$(STAGING_DIR_IMAGE)=" $(KDIR)/bootfs*.its*
|
||||
sed -i "s=\$$$${dts_dir}=$(DTS_DIR)=" $(KDIR)/bootfs*.its*
|
||||
endef
|
||||
|
||||
define Build/bootfs
|
||||
cat $@ | $(STAGING_DIR_HOST)/bin/lzma e -eos -si -so > $@.tmp
|
||||
mv $@.tmp $@
|
||||
sed -i "s=\$${kernel}=$@=" $(KDIR)/bootfs*.its*
|
||||
PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $(KDIR)/bootfs-bcm4908.its $(KDIR)/bootfs-bcm4908.itb
|
||||
PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $(KDIR)/bootfs-bcm4912.its $(KDIR)/bootfs-bcm4912.itb
|
||||
endef
|
||||
|
||||
define Build/bcm4908asus
|
||||
$(STAGING_DIR_HOST)/bin/bcm4908asus create -i $@ \
|
||||
-p $(ASUS_PRODUCTID) -b $(ASUS_BUILD_NO) -f $(ASUS_FW_REV) \
|
||||
-e $(ASUS_EXT_NO)
|
||||
endef
|
||||
|
||||
define Build/bcm4908img
|
||||
rm -fr $@-bootfs
|
||||
mkdir -p $@-bootfs
|
||||
cp -r $(DEVICE_NAME)/* $@-bootfs/
|
||||
touch $@-bootfs/1-openwrt
|
||||
cp $(DTS_DIR)/$(firstword $(DEVICE_DTS)).dtb $@-bootfs/94908.dtb
|
||||
cp $(KDIR)/bcm63xx-cfe/$(subst _,$(comma),$(DEVICE_NAME))/cferam.000 $@-bootfs/
|
||||
cp $(IMAGE_KERNEL) $@-bootfs/vmlinux.lz
|
||||
|
||||
$(STAGING_DIR_HOST)/bin/mkfs.jffs2 --pad=0x800000 --little-endian --squash-uids \
|
||||
-v -e 128KiB -o $@-bootfs.jffs2 -d $@-bootfs -m none -n
|
||||
$(STAGING_DIR_HOST)/bin/bcm4908img create $@.new -f $@-bootfs.jffs2 \
|
||||
-a 0x20000 -f $@
|
||||
mv $@.new $@
|
||||
endef
|
||||
|
||||
define Build/bcm4908kernel
|
||||
$(STAGING_DIR_HOST)/bin/bcm4908kernel -i $@ -o $@.new
|
||||
mv $@.new $@
|
||||
endef
|
||||
|
||||
define Build/bcm4908lzma
|
||||
$(STAGING_DIR_HOST)/bin/lzma e -lc1 -lp2 -pb2 -d22 $@ $@.new
|
||||
mv $@.new $@
|
||||
endef
|
||||
|
||||
define Build/pkgtb
|
||||
mv $@ $@.rootfs
|
||||
cp pkgtb-$(SOC).its $@.its
|
||||
sed -i "s=\$${bootfs}=$(KDIR)/bootfs-$(SOC).itb=" $@.its
|
||||
sed -i "s=\$${rootfs}=$@.rootfs=" $@.its
|
||||
PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@
|
||||
endef
|
||||
|
||||
define Device/Default
|
||||
KERNEL := kernel-bin | bcm4908lzma | bcm4908kernel
|
||||
KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts)
|
||||
KERNEL_INITRAMFS_SUFFIX := .bin
|
||||
KERNEL_INITRAMFS := kernel-bin | bcm4908lzma | bcm4908kernel
|
||||
FILESYSTEMS := squashfs
|
||||
KERNEL_NAME := Image
|
||||
DEVICE_IMG_NAME = $$(DEVICE_IMG_PREFIX)-$$(1).$$(2)
|
||||
BLOCKSIZE := 128k
|
||||
PAGESIZE := 2048
|
||||
IMAGE/bin := append-ubi | bcm4908img
|
||||
endef
|
||||
|
||||
define Device/asus_gt-ac5300
|
||||
DEVICE_VENDOR := ASUS
|
||||
DEVICE_MODEL := GT-AC5300
|
||||
DEVICE_DTS := broadcom/bcmbca/bcm4908-asus-gt-ac5300
|
||||
IMAGES := bin
|
||||
IMAGE/bin := append-ubi | bcm4908img | bcm4908asus
|
||||
ASUS_PRODUCTID := GT-AC5300
|
||||
ASUS_BUILD_NO := 384
|
||||
ASUS_FW_REV := 3.0.0.4
|
||||
ASUS_EXT_NO := 21140
|
||||
endef
|
||||
TARGET_DEVICES += asus_gt-ac5300
|
||||
|
||||
define Device/asus_gt-ax6000
|
||||
DEVICE_VENDOR := ASUS
|
||||
DEVICE_MODEL := GT-AX6000
|
||||
DEVICE_DTS := broadcom/bcmbca/bcm4912-asus-gt-ax6000
|
||||
IMAGES := pkgtb
|
||||
IMAGE/pkgtb := append-rootfs | pkgtb
|
||||
SOC := bcm4912
|
||||
endef
|
||||
# TARGET_DEVICES += asus_gt-ax6000
|
||||
|
||||
define Device/netgear_r8000p
|
||||
DEVICE_VENDOR := Netgear
|
||||
DEVICE_MODEL := R8000P
|
||||
DEVICE_DTS := broadcom/bcmbca/bcm4906-netgear-r8000p
|
||||
IMAGES := bin
|
||||
IMAGE/chk := append-ubi | bcm4908img | netgear-chk
|
||||
NETGEAR_BOARD_ID := U12H359T00_NETGEAR
|
||||
NETGEAR_REGION := 1
|
||||
endef
|
||||
TARGET_DEVICES += netgear_r8000p
|
||||
|
||||
define Device/tplink_archer-c2300-v1
|
||||
DEVICE_VENDOR := TP-Link
|
||||
DEVICE_MODEL := Archer C2300
|
||||
DEVICE_VARIANT := v1
|
||||
DEVICE_DTS := broadcom/bcmbca/bcm4906-tplink-archer-c2300-v1
|
||||
IMAGES := bin
|
||||
IMAGE/bin := append-ubi | bcm4908img
|
||||
BROKEN := y
|
||||
endef
|
||||
TARGET_DEVICES += tplink_archer-c2300-v1
|
||||
|
||||
define Device/netgear
|
||||
DEVICE_VENDOR := NETGEAR
|
||||
KERNEL := kernel-bin | bootfs
|
||||
IMAGES := chk
|
||||
IMAGE/chk := append-rootfs | pkgtb | netgear-chk
|
||||
NETGEAR_REGION := 1
|
||||
endef
|
||||
|
||||
define Device/netgear_raxe500
|
||||
DEVICE_MODEL := RAXE500
|
||||
$(Device/netgear)
|
||||
SOC := bcm4908
|
||||
NETGEAR_BOARD_ID := U12H449T00_NETGEAR
|
||||
endef
|
||||
# TARGET_DEVICES += netgear_raxe500
|
||||
|
||||
$(eval $(call BuildImage))
|
||||
@@ -0,0 +1,2 @@
|
||||
@(#) $imageversion: HND1731918 $
|
||||
@(#) $imageversion: HND1731918 $
|
||||
@@ -0,0 +1 @@
|
||||
HND1731918
|
||||
48
target/linux/bcm4908/image/bootfs-bcm4908.its
Normal file
48
target/linux/bcm4908/image/bootfs-bcm4908.its
Normal file
@@ -0,0 +1,48 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
|
||||
|
||||
/include/ "bootfs.itsi"
|
||||
|
||||
/ {
|
||||
images {
|
||||
uboot {
|
||||
data = /incbin/("${images_dir}/u-boot/u-boot-bcm4908.bin");
|
||||
};
|
||||
|
||||
fdt_uboot {
|
||||
data = /incbin/("${images_dir}/u-boot/u-boot-bcm4908.dtb");
|
||||
};
|
||||
|
||||
fdt_uboot_RAX220 {
|
||||
description = "dtb";
|
||||
data = /incbin/("${images_dir}/u-boot/RAX220.dtb");
|
||||
type = "flat_dt";
|
||||
compression = "none";
|
||||
|
||||
hash-1 {
|
||||
algo = "sha256";
|
||||
};
|
||||
};
|
||||
|
||||
fdt_linux_RAX220 {
|
||||
description = "dtb";
|
||||
data = /incbin/("${dts_dir}/broadcom/bcmbca/bcm4908-netgear-raxe500.dtb");
|
||||
arch = "arm64";
|
||||
type = "flat_dt";
|
||||
compression = "none";
|
||||
};
|
||||
};
|
||||
|
||||
configurations {
|
||||
conf_ub_RAX220 {
|
||||
description = "RAX220";
|
||||
fdt = "fdt_uboot_RAX220";
|
||||
loadables = "atf", "uboot";
|
||||
};
|
||||
|
||||
conf_lx_RAX220 {
|
||||
description = "BRCM 63xxx linux";
|
||||
kernel = "kernel";
|
||||
fdt = "fdt_linux_RAX220";
|
||||
};
|
||||
};
|
||||
};
|
||||
65
target/linux/bcm4908/image/bootfs-bcm4912.its
Normal file
65
target/linux/bcm4908/image/bootfs-bcm4912.its
Normal file
@@ -0,0 +1,65 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
|
||||
|
||||
/include/ "bootfs.itsi"
|
||||
|
||||
/ {
|
||||
images {
|
||||
uboot {
|
||||
data = /incbin/("${images_dir}/u-boot/u-boot-bcm4912.bin");
|
||||
};
|
||||
|
||||
fdt_uboot {
|
||||
data = /incbin/("${images_dir}/u-boot/u-boot-bcm4912.dtb");
|
||||
};
|
||||
|
||||
fdt_uboot_GTAX6000 {
|
||||
description = "dtb";
|
||||
data = /incbin/("${images_dir}/u-boot/GTAX6000.dtb");
|
||||
arch = "arm64";
|
||||
type = "flat_dt";
|
||||
compression = "none";
|
||||
|
||||
hash-1 {
|
||||
algo = "sha256";
|
||||
};
|
||||
};
|
||||
|
||||
fdt_linux_GTAX6000 {
|
||||
description = "dtb";
|
||||
data = /incbin/("${dts_dir}/broadcom/bcmbca/bcm4912-asus-gt-ax6000.dtb");
|
||||
arch = "arm64";
|
||||
type = "flat_dt";
|
||||
compression = "none";
|
||||
|
||||
hash-1 {
|
||||
algo = "sha256";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
configurations {
|
||||
conf_ub_GTAX6000 {
|
||||
description = "GTAX6000";
|
||||
fdt = "fdt_uboot_GTAX6000";
|
||||
loadables = "atf", "uboot";
|
||||
};
|
||||
|
||||
conf_lx_GTAX6000 {
|
||||
description = "BRCM 63xxx linux";
|
||||
kernel = "kernel";
|
||||
fdt = "fdt_linux_GTAX6000";
|
||||
};
|
||||
|
||||
conf_ub_GTAX6000_50991 {
|
||||
description = "GTAX6000_50991";
|
||||
fdt = "fdt_uboot_GTAX6000";
|
||||
loadables = "atf", "uboot";
|
||||
};
|
||||
|
||||
conf_lx_GTAX6000_50991 {
|
||||
description = "BRCM 63xxx linux";
|
||||
kernel = "kernel";
|
||||
fdt = "fdt_linux_GTAX6000";
|
||||
};
|
||||
};
|
||||
};
|
||||
73
target/linux/bcm4908/image/bootfs.itsi
Normal file
73
target/linux/bcm4908/image/bootfs.itsi
Normal file
@@ -0,0 +1,73 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
|
||||
|
||||
/dts-v1/;
|
||||
|
||||
/ {
|
||||
description = "OpenWrt bootfs image";
|
||||
#address-cells = <1>;
|
||||
|
||||
images {
|
||||
atf {
|
||||
description = "ATF";
|
||||
data = /incbin/("${images_dir}/bl31.bin");
|
||||
type = "firmware";
|
||||
arch = "arm64";
|
||||
os = "arm-trusted-firmware";
|
||||
compression = "none";
|
||||
load = <0x4000>;
|
||||
entry = <0x4000>;
|
||||
|
||||
hash-1 {
|
||||
algo = "sha256";
|
||||
};
|
||||
};
|
||||
|
||||
uboot {
|
||||
description = "U-Boot";
|
||||
os = "U-Boot";
|
||||
arch = "arm64";
|
||||
compression = "none";
|
||||
load = <0x1000000>;
|
||||
entry = <0x1000000>;
|
||||
|
||||
hash-1 {
|
||||
algo = "sha256";
|
||||
};
|
||||
};
|
||||
|
||||
kernel {
|
||||
description = "Linux kernel";
|
||||
data = /incbin/("${kernel}");
|
||||
type = "kernel";
|
||||
os = "linux";
|
||||
arch = "arm64";
|
||||
compression = "lzma";
|
||||
load = <0x80000>;
|
||||
entry = <0x80000>;
|
||||
|
||||
hash-1 {
|
||||
algo = "sha256";
|
||||
};
|
||||
};
|
||||
|
||||
fdt_uboot {
|
||||
description = "dtb";
|
||||
type = "flat_dt";
|
||||
compression = "none";
|
||||
|
||||
hash-1 {
|
||||
algo = "sha256";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
configurations {
|
||||
default = "conf_uboot";
|
||||
|
||||
conf_uboot {
|
||||
description = "BRCM 63xxx with uboot";
|
||||
fdt = "fdt_uboot";
|
||||
loadables = "atf", "uboot";
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
@(#) $imageversion: 5024HNDrc11R8000P2602103 $
|
||||
@(#) $imageversion: 5024HNDrc11R8000P2602103 $
|
||||
@(#) $changelist: Changelist: REL_502HND04rc11_BISON04T_REL_7_14_170_34Revision: 765096 $
|
||||
@(#) $changelist: Changelist: REL_502HND04rc11_BISON04T_REL_7_14_170_34Revision: 765096 $
|
||||
@@ -0,0 +1 @@
|
||||
5024HNDrc11R8000P2602103
|
||||
43
target/linux/bcm4908/image/pkgtb-bcm4908.its
Normal file
43
target/linux/bcm4908/image/pkgtb-bcm4908.its
Normal file
@@ -0,0 +1,43 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
|
||||
|
||||
/dts-v1/;
|
||||
|
||||
/ {
|
||||
description = "Broadcom image upgrade package tree binary";
|
||||
#address-cells = <1>;
|
||||
|
||||
images {
|
||||
bootfs_4908_a0+ {
|
||||
description = "bootfs";
|
||||
data = /incbin/("${bootfs}");
|
||||
type = "multi";
|
||||
compression = "none";
|
||||
|
||||
hash-1 {
|
||||
algo = "sha256";
|
||||
};
|
||||
};
|
||||
|
||||
nand_squashfs {
|
||||
description = "rootfs";
|
||||
data = /incbin/("${rootfs}");
|
||||
type = "filesystem";
|
||||
compression = "none";
|
||||
|
||||
hash-1 {
|
||||
algo = "sha256";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
configurations {
|
||||
default = "conf_4908_a0+_nand_squashfs";
|
||||
|
||||
conf_4908_a0+_nand_squashfs {
|
||||
description = "Brcm Image Bundle";
|
||||
bootfs = "bootfs_4908_a0+";
|
||||
rootfs = "nand_squashfs";
|
||||
compatible = "flash=nand;chip=4908;rev=a0+;ip=ipv6,ipv4;ddr=ddr3;fstype=squashfs";
|
||||
};
|
||||
};
|
||||
};
|
||||
43
target/linux/bcm4908/image/pkgtb-bcm4912.its
Normal file
43
target/linux/bcm4908/image/pkgtb-bcm4912.its
Normal file
@@ -0,0 +1,43 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
|
||||
|
||||
/dts-v1/;
|
||||
|
||||
/ {
|
||||
description = "Broadcom image upgrade package tree binary";
|
||||
#address-cells = <1>;
|
||||
|
||||
images {
|
||||
bootfs_4912_a0+ {
|
||||
description = "bootfs";
|
||||
data = /incbin/("${bootfs}");
|
||||
type = "multi";
|
||||
compression = "none";
|
||||
|
||||
hash-1 {
|
||||
algo = "sha256";
|
||||
};
|
||||
};
|
||||
|
||||
nand_squashfs {
|
||||
description = "rootfs";
|
||||
data = /incbin/("${rootfs}");
|
||||
type = "filesystem";
|
||||
compression = "none";
|
||||
|
||||
hash-1 {
|
||||
algo = "sha256";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
configurations {
|
||||
default = "conf_4912_a0+_nand_squashfs";
|
||||
|
||||
conf_4912_a0+_nand_squashfs {
|
||||
description = "Brcm Image Bundle";
|
||||
bootfs = "bootfs_4912_a0+";
|
||||
rootfs = "nand_squashfs";
|
||||
compatible = "flash=nand;chip=4912;rev=a0+;ip=ipv6,ipv4;ddr=ddr3,ddr4;fstype=squashfs";
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
5022HNDrc7HND2221446
|
||||
BIN
target/linux/bcm4908/image/tplink_archer-c2300-v1/nvram.nvm
Executable file
BIN
target/linux/bcm4908/image/tplink_archer-c2300-v1/nvram.nvm
Executable file
Binary file not shown.
@@ -0,0 +1,31 @@
|
||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||
Date: Thu, 28 Mar 2024 10:24:34 +0100
|
||||
Subject: [PATCH] arm64: dts: broadcom: bcmbca: bcm4908: set
|
||||
brcm,wp-not-connected
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Every described BCM4908 board has WP pin not connected. This caused
|
||||
problems for drivers since day 0 but there was no property to describe
|
||||
that properly. Projects like OpenWrt were modifying Linux driver to deal
|
||||
with it.
|
||||
|
||||
It's not clear if that is hardware limitation or just reference design
|
||||
being copied over and over but this applies to all known / supported
|
||||
BCM4908 boards. Handle it by marking WP as not connected by default.
|
||||
|
||||
Fixes: 2961f69f151c ("arm64: dts: broadcom: add BCM4908 and Asus GT-AC5300 early DTS files")
|
||||
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
---
|
||||
|
||||
--- a/arch/arm64/boot/dts/broadcom/bcmbca/bcm4908.dtsi
|
||||
+++ b/arch/arm64/boot/dts/broadcom/bcmbca/bcm4908.dtsi
|
||||
@@ -594,6 +594,7 @@
|
||||
reg-names = "nand", "nand-int-base";
|
||||
interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
|
||||
interrupt-names = "nand_ctlrdy";
|
||||
+ brcm,wp-not-connected;
|
||||
status = "okay";
|
||||
|
||||
nandcs: nand@0 {
|
||||
@@ -0,0 +1,23 @@
|
||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||
Date: Mon, 15 Feb 2021 22:01:03 +0100
|
||||
Subject: [PATCH] arm64: dts: broadcom: bcmbca: bcm4908: limit amount of GPIOs
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Linux driver can't handle more than 64 GPIOs
|
||||
|
||||
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
---
|
||||
|
||||
--- a/arch/arm64/boot/dts/broadcom/bcmbca/bcm4908.dtsi
|
||||
+++ b/arch/arm64/boot/dts/broadcom/bcmbca/bcm4908.dtsi
|
||||
@@ -341,7 +341,7 @@
|
||||
gpio0: gpio-controller@500 {
|
||||
compatible = "brcm,bcm6345-gpio";
|
||||
reg-names = "dirout", "dat";
|
||||
- reg = <0x500 0x28>, <0x528 0x28>;
|
||||
+ reg = <0x500 0x8>, <0x528 0x8>;
|
||||
|
||||
#gpio-cells = <2>;
|
||||
gpio-controller;
|
||||
@@ -0,0 +1,30 @@
|
||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||
Date: Thu, 12 Aug 2021 11:52:42 +0200
|
||||
Subject: [PATCH] arm64: don't issue HVC on boot
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Broadcom's CFE loader seems to miss setting SCR_EL3.HCE which results in
|
||||
generating an UNDEF and kernel panic on the first HVC.
|
||||
|
||||
HVC gets issued by kernels 5.12+ while booting, by kexec and KVM. Until
|
||||
someone finds a workaround we have to avoid all above.
|
||||
|
||||
Workarounds: 0c93df9622d4 ("arm64: Initialise as nVHE before switching to VHE")
|
||||
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
---
|
||||
arch/arm64/kernel/hyp-stub.S | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/arch/arm64/kernel/hyp-stub.S
|
||||
+++ b/arch/arm64/kernel/hyp-stub.S
|
||||
@@ -252,7 +252,7 @@ SYM_FUNC_START(finalise_el2)
|
||||
b.ne 1f
|
||||
|
||||
mov x0, #HVC_FINALISE_EL2
|
||||
- hvc #0
|
||||
+// hvc #0
|
||||
1:
|
||||
ret
|
||||
SYM_FUNC_END(finalise_el2)
|
||||
@@ -0,0 +1,46 @@
|
||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||
Date: Mon, 15 Feb 2021 23:59:26 +0100
|
||||
Subject: [PATCH] net: dsa: bcm_sf2: enable GPHY for switch probing
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
GPHY needs to be enabled to succesfully probe & setup switch port
|
||||
connected to it. Otherwise hardcoding PHY OUI would be required.
|
||||
|
||||
Before:
|
||||
brcm-sf2 80080000.switch lan4 (uninitialized): PHY [800c05c0.mdio--1:08] driver [Generic PHY] (irq=POLL)
|
||||
brcm-sf2 80080000.switch lan3 (uninitialized): PHY [800c05c0.mdio--1:09] driver [Generic PHY] (irq=POLL)
|
||||
brcm-sf2 80080000.switch lan2 (uninitialized): PHY [800c05c0.mdio--1:0a] driver [Generic PHY] (irq=POLL)
|
||||
brcm-sf2 80080000.switch lan1 (uninitialized): PHY [800c05c0.mdio--1:0b] driver [Generic PHY] (irq=POLL)
|
||||
brcm-sf2 80080000.switch wan (uninitialized): error -5 setting up PHY for tree 0, switch 0, port 7
|
||||
|
||||
After:
|
||||
brcm-sf2 80080000.switch lan4 (uninitialized): PHY [800c05c0.mdio--1:08] driver [Generic PHY] (irq=POLL)
|
||||
brcm-sf2 80080000.switch lan3 (uninitialized): PHY [800c05c0.mdio--1:09] driver [Generic PHY] (irq=POLL)
|
||||
brcm-sf2 80080000.switch lan2 (uninitialized): PHY [800c05c0.mdio--1:0a] driver [Generic PHY] (irq=POLL)
|
||||
brcm-sf2 80080000.switch lan1 (uninitialized): PHY [800c05c0.mdio--1:0b] driver [Generic PHY] (irq=POLL)
|
||||
brcm-sf2 80080000.switch wan (uninitialized): PHY [800c05c0.mdio--1:0c] driver [Generic PHY] (irq=POLL)
|
||||
|
||||
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
---
|
||||
drivers/net/dsa/bcm_sf2.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
--- a/drivers/net/dsa/bcm_sf2.c
|
||||
+++ b/drivers/net/dsa/bcm_sf2.c
|
||||
@@ -1524,10 +1524,14 @@ static int bcm_sf2_sw_probe(struct platf
|
||||
rev = reg_readl(priv, REG_PHY_REVISION);
|
||||
priv->hw_params.gphy_rev = rev & PHY_REVISION_MASK;
|
||||
|
||||
+ bcm_sf2_gphy_enable_set(priv->dev->ds, true);
|
||||
+
|
||||
ret = b53_switch_register(dev);
|
||||
if (ret)
|
||||
goto out_mdio;
|
||||
|
||||
+ bcm_sf2_gphy_enable_set(priv->dev->ds, false);
|
||||
+
|
||||
dev_info(&pdev->dev,
|
||||
"Starfighter 2 top: %x.%02x, core: %x.%02x, IRQs: %d, %d\n",
|
||||
priv->hw_params.top_rev >> 8, priv->hw_params.top_rev & 0xff,
|
||||
@@ -0,0 +1,30 @@
|
||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||
Date: Tue, 16 Feb 2021 00:06:35 +0100
|
||||
Subject: [PATCH] net: dsa: bcm_sf2: keep GPHY enabled on the BCM4908
|
||||
|
||||
Trying to access disabled PHY results in MDIO_READ_FAIL and:
|
||||
[ 11.962886] brcm-sf2 80080000.switch wan: configuring for phy/internal link mode
|
||||
[ 11.972500] 8021q: adding VLAN 0 to HW filter on device wan
|
||||
[ 11.980205] ------------[ cut here ]------------
|
||||
[ 11.984885] WARNING: CPU: 0 PID: 7 at phy_error+0x10/0x58
|
||||
|
||||
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
---
|
||||
drivers/net/dsa/bcm_sf2.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
--- a/drivers/net/dsa/bcm_sf2.c
|
||||
+++ b/drivers/net/dsa/bcm_sf2.c
|
||||
@@ -1538,6 +1538,12 @@ static int bcm_sf2_sw_probe(struct platf
|
||||
priv->hw_params.core_rev >> 8, priv->hw_params.core_rev & 0xff,
|
||||
priv->irq0, priv->irq1);
|
||||
|
||||
+ /* BCM4908 has 5 GPHYs which means bcm_sf2_port_setup() will not enable
|
||||
+ * GPHY when needed. Leave it enabled here.
|
||||
+ */
|
||||
+ if (priv->type == BCM4908_DEVICE_ID)
|
||||
+ bcm_sf2_gphy_enable_set(priv->dev->ds, true);
|
||||
+
|
||||
return 0;
|
||||
|
||||
out_mdio:
|
||||
Reference in New Issue
Block a user