mirror of
https://github.com/Ysurac/openmptcprouter.git
synced 2025-02-13 03:41:54 +00:00
Fix merge
This commit is contained in:
commit
61b3e06b2b
85 changed files with 35270 additions and 6208 deletions
26
.github/ISSUE_TEMPLATE.md
vendored
26
.github/ISSUE_TEMPLATE.md
vendored
|
@ -1,9 +1,14 @@
|
|||
## Expected Behavior
|
||||
<!--- In English please. -->
|
||||
<!--- Tell us what should happen -->
|
||||
|
||||
In English please.
|
||||
|
||||
## Actual Behavior
|
||||
## Current Behavior
|
||||
<!--- In English please. -->
|
||||
<!--- Tell us what happens instead of the expected behavior -->
|
||||
|
||||
## Possible Solution
|
||||
<!--- In English please. -->
|
||||
<!--- Not obligatory, but suggest a fix/reason for the bug, -->
|
||||
|
||||
## Steps to Reproduce the Problem
|
||||
|
||||
|
@ -11,8 +16,17 @@
|
|||
2.
|
||||
3.
|
||||
|
||||
## Context (Environment)
|
||||
<!--- How has this issue affected you? What are you trying to accomplish? -->
|
||||
<!--- Providing context helps us come up with a solution that is most useful in the real world -->
|
||||
|
||||
<!--- Provide a general summary of the issue in the Title above -->
|
||||
|
||||
|
||||
## Specifications
|
||||
|
||||
- OpenMPTCProuter version: (Last is not a version)
|
||||
- OpenMPTCProuter VPS version: (Last is not a version)
|
||||
- OpenMPTCProuter platform: (RPI2/RPI3/x86/x86_64)
|
||||
- OpenMPTCProuter version: <!--- (Last is not a version) -->
|
||||
- OpenMPTCProuter VPS version: <!--- (Last is not a version) -->
|
||||
- OpenMPTCProuter platform: <!--- (RPI2/RPI3/x86/x86_64) -->
|
||||
|
||||
<!--- (please do not attach text files) -->
|
175
build.sh
175
build.sh
|
@ -22,18 +22,25 @@ _get_repo() (
|
|||
OMR_DIST=${OMR_DIST:-openmptcprouter}
|
||||
OMR_HOST=${OMR_HOST:-$(curl -sS ifconfig.co)}
|
||||
OMR_PORT=${OMR_PORT:-8000}
|
||||
OMR_REPO=${OMR_REPO:-http://$OMR_HOST:$OMR_PORT/release/$OMR_KERNEL}
|
||||
OMR_KEEPBIN=${OMR_KEEPBIN:-no}
|
||||
OMR_IMG=${OMR_IMG:-yes}
|
||||
OMR_UEFI=${OMR_UEFI:-yes}
|
||||
#OMR_UEFI=${OMR_UEFI:-yes}
|
||||
OMR_PACKAGES=${OMR_PACKAGES:-full}
|
||||
OMR_ALL_PACKAGES=${OMR_ALL_PACKAGES:-no}
|
||||
OMR_TARGET=${OMR_TARGET:-x86_64}
|
||||
OMR_TARGET_CONFIG="config-$OMR_TARGET"
|
||||
OMR_KERNEL=${OMR_KERNEL:-4.19}
|
||||
OMR_KERNEL=${OMR_KERNEL:-5.4}
|
||||
#OMR_RELEASE=${OMR_RELEASE:-$(git describe --tags `git rev-list --tags --max-count=1` | sed 's/^\([0-9.]*\).*/\1/')}
|
||||
OMR_RELEASE=${OMR_RELEASE:-$(git tag --sort=committerdate | tail -1)}
|
||||
OMR_REPO=${OMR_REPO:-http://$OMR_HOST:$OMR_PORT/release/$OMR_RELEASE/$OMR_TARGET}
|
||||
|
||||
OMR_FEED_URL="${OMR_FEED_URL:-https://github.com/ysurac/openmptcprouter-feeds}"
|
||||
OMR_FEED_SRC="${OMR_FEED_SRC:-develop}"
|
||||
|
||||
CUSTOM_FEED_URL="${CUSTOM_FEED_URL}"
|
||||
|
||||
OMR_OPENWRT=${OMR_OPENWRT:-default}
|
||||
|
||||
if [ ! -f "$OMR_TARGET_CONFIG" ]; then
|
||||
echo "Target $OMR_TARGET not found !"
|
||||
#exit 1
|
||||
|
@ -51,6 +58,10 @@ elif [ "$OMR_TARGET" = "wrt32x" ]; then
|
|||
OMR_REAL_TARGET="arm_cortex-a9_vfpv3"
|
||||
elif [ "$OMR_TARGET" = "bpi-r2" ]; then
|
||||
OMR_REAL_TARGET="arm_cortex-a7_neon-vfpv4"
|
||||
elif [ "$OMR_TARGET" = "bpi-r64" ]; then
|
||||
OMR_REAL_TARGET="aarch64_cortex-a53"
|
||||
elif [ "$OMR_TARGET" = "espressobin" ]; then
|
||||
OMR_REAL_TARGET="aarch64_cortex-a53"
|
||||
elif [ "$OMR_TARGET" = "x86" ]; then
|
||||
OMR_REAL_TARGET="i386_pentium4"
|
||||
else
|
||||
|
@ -58,15 +69,30 @@ else
|
|||
fi
|
||||
|
||||
#_get_repo source https://github.com/ysurac/openmptcprouter-source "master"
|
||||
_get_repo "$OMR_TARGET/source" https://github.com/openwrt/openwrt "a017773a92d624142a78452bc0c00e6bc6523967"
|
||||
_get_repo feeds/packages https://github.com/openwrt/packages "e0c0c3c3f030c8582c9493ff894ee0528198f2ce"
|
||||
_get_repo feeds/luci https://github.com/openwrt/luci "0c7f3331aff33567e01e0d9c0c63b9a1a16fbe14"
|
||||
if [ "$OMR_OPENWRT" = "default" ]; then
|
||||
_get_repo "$OMR_TARGET/source" https://github.com/openwrt/openwrt "18b7d87a8f76b4cf36e943d9211bd26d79f55ec6"
|
||||
_get_repo feeds/packages https://github.com/openwrt/packages "1c67444c33d85cd74d3a68d1a251626342554f03"
|
||||
_get_repo feeds/luci https://github.com/openwrt/luci "b2e00f23a7862f47b8bd975207ba8242b55e6cf0"
|
||||
elif [ "$OMR_OPENWRT" = "master" ]; then
|
||||
_get_repo "$OMR_TARGET/source" https://github.com/openwrt/openwrt "master"
|
||||
_get_repo feeds/packages https://github.com/openwrt/packages "master"
|
||||
_get_repo feeds/luci https://github.com/openwrt/luci "master"
|
||||
else
|
||||
_get_repo "$OMR_TARGET/source" https://github.com/openwrt/openwrt "${OMR_OPENWRT}"
|
||||
_get_repo feeds/packages https://github.com/openwrt/packages "${OMR_OPENWRT}"
|
||||
_get_repo feeds/luci https://github.com/openwrt/luci "${OMR_OPENWRT}"
|
||||
fi
|
||||
|
||||
if [ -z "$OMR_FEED" ]; then
|
||||
OMR_FEED=feeds/openmptcprouter
|
||||
_get_repo "$OMR_FEED" "$OMR_FEED_URL" "$OMR_FEED_SRC"
|
||||
fi
|
||||
|
||||
if [ -n "$CUSTOM_FEED_URL" ]; then
|
||||
CUSTOM_FEED=feeds/${OMR_DIST}
|
||||
_get_repo "$CUSTOM_FEED" "$CUSTOM_FEED_URL" "master"
|
||||
fi
|
||||
|
||||
if [ -n "$1" ] && [ -f "$OMR_FEED/$1/Makefile" ]; then
|
||||
OMR_DIST=$1
|
||||
shift 1
|
||||
|
@ -95,13 +121,27 @@ src-link luci $(readlink -f feeds/luci)
|
|||
src-link openmptcprouter $(readlink -f "$OMR_FEED")
|
||||
EOF
|
||||
|
||||
cat > "$OMR_TARGET/source/package/system/opkg/files/customfeeds.conf" <<EOF
|
||||
src/gz openwrt_luci http://downloads.openwrt.org/snapshots/packages/${OMR_REAL_TARGET}/luci
|
||||
src/gz openwrt_packages http://downloads.openwrt.org/snapshots/packages/${OMR_REAL_TARGET}/packages
|
||||
src/gz openwrt_base http://downloads.openwrt.org/snapshots/packages/${OMR_REAL_TARGET}/base
|
||||
src/gz openwrt_routing http://downloads.openwrt.org/snapshots/packages/${OMR_REAL_TARGET}/routing
|
||||
src/gz openwrt_telephony http://downloads.openwrt.org/snapshots/packages/${OMR_REAL_TARGET}/telephony
|
||||
EOF
|
||||
if [ -n "$CUSTOM_FEED" ]; then
|
||||
echo "src-link ${OMR_DIST} $(readlink -f ${CUSTOM_FEED})" >> "$OMR_TARGET/source/feeds.conf"
|
||||
fi
|
||||
|
||||
if [ "$OMR_DIST" = "openmptcprouter" ]; then
|
||||
cat > "$OMR_TARGET/source/package/system/opkg/files/customfeeds.conf" <<-EOF
|
||||
src/gz openwrt_luci http://packages.openmptcprouter.com/${OMR_RELEASE}/${OMR_REAL_TARGET}/luci
|
||||
src/gz openwrt_packages http://packages.openmptcprouter.com/${OMR_RELEASE}/${OMR_REAL_TARGET}/packages
|
||||
src/gz openwrt_base http://packages.openmptcprouter.com/${OMR_RELEASE}/${OMR_REAL_TARGET}/base
|
||||
src/gz openwrt_routing http://packages.openmptcprouter.com/${OMR_RELEASE}/${OMR_REAL_TARGET}/routing
|
||||
src/gz openwrt_telephony http://packages.openmptcprouter.com/${OMR_RELEASE}/${OMR_REAL_TARGET}/telephony
|
||||
EOF
|
||||
else
|
||||
cat > "$OMR_TARGET/source/package/system/opkg/files/customfeeds.conf" <<-EOF
|
||||
src/gz openwrt_luci http://downloads.openwrt.org/snapshots/packages/${OMR_REAL_TARGET}/luci
|
||||
src/gz openwrt_packages http://downloads.openwrt.org/snapshots/packages/${OMR_REAL_TARGET}/packages
|
||||
src/gz openwrt_base http://downloads.openwrt.org/snapshots/packages/${OMR_REAL_TARGET}/base
|
||||
src/gz openwrt_routing http://downloads.openwrt.org/snapshots/packages/${OMR_REAL_TARGET}/routing
|
||||
src/gz openwrt_telephony http://downloads.openwrt.org/snapshots/packages/${OMR_REAL_TARGET}/telephony
|
||||
EOF
|
||||
fi
|
||||
#cat > "$OMR_TARGET/source/package/system/opkg/files/customfeeds.conf" <<EOF
|
||||
#src/gz openwrt_luci http://downloads.openwrt.org/releases/18.06.0/packages/${OMR_REAL_TARGET}/luci
|
||||
#src/gz openwrt_packages http://downloads.openwrt.org/releases/18.06.0/packages/${OMR_REAL_TARGET}/packages
|
||||
|
@ -117,7 +157,6 @@ if [ -f "$OMR_TARGET_CONFIG" ]; then
|
|||
CONFIG_VERSION_DIST="$OMR_DIST"
|
||||
CONFIG_VERSION_REPO="$OMR_REPO"
|
||||
CONFIG_VERSION_NUMBER="$(git -C "$OMR_FEED" describe --tag --always)"
|
||||
CONFIG_PACKAGE_${OMR_DIST}-full=y
|
||||
EOF
|
||||
else
|
||||
cat config -> "$OMR_TARGET/source/.config" <<-EOF
|
||||
|
@ -126,11 +165,11 @@ else
|
|||
CONFIG_VERSION_DIST="$OMR_DIST"
|
||||
CONFIG_VERSION_REPO="$OMR_REPO"
|
||||
CONFIG_VERSION_NUMBER="$(git -C "$OMR_FEED" describe --tag --always)"
|
||||
CONFIG_PACKAGE_${OMR_DIST}-full=y
|
||||
EOF
|
||||
fi
|
||||
if [ "$OMR_ALL_PACKAGES" = "yes" ]; then
|
||||
echo 'CONFIG_ALL=y' >> "$OMR_TARGET/source/.config"
|
||||
echo 'CONFIG_ALL_NONSHARED=y' >> "$OMR_TARGET/source/.config"
|
||||
fi
|
||||
if [ "$OMR_IMG" = "yes" ] && [ "$OMR_TARGET" = "x86_64" ]; then
|
||||
echo 'CONFIG_VDI_IMAGES=y' >> "$OMR_TARGET/source/.config"
|
||||
|
@ -138,19 +177,26 @@ if [ "$OMR_IMG" = "yes" ] && [ "$OMR_TARGET" = "x86_64" ]; then
|
|||
echo 'CONFIG_VHDX_IMAGES=y' >> "$OMR_TARGET/source/.config"
|
||||
fi
|
||||
|
||||
if [ "$OMR_PACKAGES" = "full" ]; then
|
||||
echo "CONFIG_PACKAGE_${OMR_DIST}-full=y" >> "$OMR_TARGET/source/.config"
|
||||
fi
|
||||
if [ "$OMR_PACKAGES" = "mini" ]; then
|
||||
echo "CONFIG_PACKAGE_${OMR_DIST}-mini=y" >> "$OMR_TARGET/source/.config"
|
||||
fi
|
||||
|
||||
cd "$OMR_TARGET/source"
|
||||
|
||||
echo "Checking if UEFI patch is set or not"
|
||||
if [ "$OMR_UEFI" = "yes" ] && [ "$OMR_TARGET" = "x86_64" ]; then
|
||||
if [ "$(grep 'EFI_IMAGES' target/linux/x86/image/Makefile)" = "" ]; then
|
||||
patch -N -p1 -s < ../../patches/uefi.patch
|
||||
fi
|
||||
else
|
||||
if [ "$(grep 'EFI_IMAGES' target/linux/x86/image/Makefile)" != "" ]; then
|
||||
patch -N -R -p1 -s < ../../patches/uefi.patch
|
||||
fi
|
||||
fi
|
||||
echo "Done"
|
||||
#if [ "$OMR_UEFI" = "yes" ] && [ "$OMR_TARGET" = "x86_64" ]; then
|
||||
# echo "Checking if UEFI patch is set or not"
|
||||
# if [ "$(grep 'EFI_IMAGES' target/linux/x86/image/Makefile)" = "" ]; then
|
||||
# patch -N -p1 -s < ../../patches/uefi.patch
|
||||
# fi
|
||||
# echo "Done"
|
||||
#else
|
||||
# if [ "$(grep 'EFI_IMAGES' target/linux/x86/image/Makefile)" != "" ]; then
|
||||
# patch -N -R -p1 -s < ../../patches/uefi.patch
|
||||
# fi
|
||||
#fi
|
||||
|
||||
#if [ "$OMR_TARGET" = "x86_64" ]; then
|
||||
# echo "Checking if Hyper-V patch is set or not"
|
||||
|
@ -162,22 +208,55 @@ echo "Done"
|
|||
|
||||
echo "Checking if No check patch is set or not"
|
||||
if ! patch -Rf -N -p1 -s --dry-run < ../../patches/nocheck.patch; then
|
||||
echo "apply..."
|
||||
patch -N -p1 -s < ../../patches/nocheck.patch
|
||||
fi
|
||||
echo "Done"
|
||||
|
||||
echo "Checking if Nanqinlang patch is set or not"
|
||||
if ! patch -Rf -N -p1 -s --dry-run < ../../patches/nanqinlang.patch; then
|
||||
echo "apply..."
|
||||
patch -N -p1 -s < ../../patches/nanqinlang.patch
|
||||
fi
|
||||
echo "Done"
|
||||
|
||||
echo "Checking if smsc75xx patch is set or not"
|
||||
if ! patch -Rf -N -p1 -s --dry-run < ../../patches/smsc75xx.patch; then
|
||||
echo "apply..."
|
||||
patch -N -p1 -s < ../../patches/smsc75xx.patch
|
||||
fi
|
||||
echo "Done"
|
||||
|
||||
#echo "Checking if ipt-nat patch is set or not"
|
||||
#if ! patch -Rf -N -p1 -s --dry-run < ../../patches/ipt-nat6.patch; then
|
||||
# echo "apply..."
|
||||
# patch -N -p1 -s < ../../patches/ipt-nat6.patch
|
||||
#fi
|
||||
#echo "Done"
|
||||
|
||||
#echo "Checking if mvebu patch is set or not"
|
||||
#if [ ! -d target/linux/mvebu/patches-5.4 ]; then
|
||||
# echo "apply..."
|
||||
# patch -N -p1 -s < ../../patches/mvebu-5.14.patch
|
||||
#fi
|
||||
#echo "Done"
|
||||
|
||||
echo "Checking if opkg install arguement too long patch is set or not"
|
||||
if ! patch -Rf -N -p1 -s --dry-run < ../../patches/package-too-long.patch; then
|
||||
echo "apply..."
|
||||
patch -N -p1 -s < ../../patches/package-too-long.patch
|
||||
fi
|
||||
echo "Done"
|
||||
|
||||
echo "Download via IPv4"
|
||||
if ! patch -Rf -N -p1 -s --dry-run < ../../patches/download-ipv4.patch; then
|
||||
patch -N -p1 -s < ../../patches/download-ipv4.patch
|
||||
fi
|
||||
echo "Done"
|
||||
|
||||
if [ -f target/linux/mediatek/patches-5.4/0999-hnat.patch ]; then
|
||||
rm -f target/linux/mediatek/patches-5.4/0999-hnat.patch
|
||||
fi
|
||||
|
||||
#echo "Patch protobuf wrong hash"
|
||||
#patch -N -R -p1 -s < ../../patches/protobuf_hash.patch
|
||||
|
@ -189,33 +268,49 @@ echo "Done"
|
|||
#fi
|
||||
#echo "Done"
|
||||
|
||||
if [ "$OMR_KERNEL" = "4.19" ]; then
|
||||
echo "Set to kernel 4.19 for rpi arch"
|
||||
find target/linux/bcm27xx -type f -name Makefile -exec sed -i 's%KERNEL_PATCHVER:=4.14%KERNEL_PATCHVER:=4.19%g' {} \;
|
||||
if [ "$OMR_KERNEL" = "5.4" ]; then
|
||||
echo "Set to kernel 5.4 for rpi arch"
|
||||
find target/linux/bcm27xx -type f -name Makefile -exec sed -i 's%KERNEL_PATCHVER:=4.19%KERNEL_PATCHVER:=5.4%g' {} \;
|
||||
echo "Done"
|
||||
echo "Set to kernel 4.19 for x86 arch"
|
||||
find target/linux/x86 -type f -name Makefile -exec sed -i 's%KERNEL_PATCHVER:=4.14%KERNEL_PATCHVER:=4.19%g' {} \;
|
||||
echo "Set to kernel 5.4 for x86 arch"
|
||||
find target/linux/x86 -type f -name Makefile -exec sed -i 's%KERNEL_PATCHVER:=4.19%KERNEL_PATCHVER:=5.4%g' {} \;
|
||||
echo "Done"
|
||||
echo "Set to kernel 4.19 for mvebu arch (WRT)"
|
||||
find target/linux/mvebu -type f -name Makefile -exec sed -i 's%KERNEL_PATCHVER:=4.14%KERNEL_PATCHVER:=4.19%g' {} \;
|
||||
echo "Set to kernel 5.4 for mvebu arch (WRT)"
|
||||
find target/linux/mvebu -type f -name Makefile -exec sed -i 's%KERNEL_PATCHVER:=4.19%KERNEL_PATCHVER:=5.4%g' {} \;
|
||||
echo "Done"
|
||||
echo "Set to kernel 4.19 for mediatek arch (BPI-R2)"
|
||||
find target/linux/mediatek -type f -name Makefile -exec sed -i 's%KERNEL_PATCHVER:=4.14%KERNEL_PATCHVER:=4.19%g' {} \;
|
||||
echo "Set to kernel 5.4 for mediatek arch (BPI-R2)"
|
||||
find target/linux/mediatek -type f -name Makefile -exec sed -i 's%KERNEL_PATCHVER:=4.19%KERNEL_PATCHVER:=5.4%g' {} \;
|
||||
echo "Done"
|
||||
fi
|
||||
|
||||
# Remove patch that can make BPI-R2 slow
|
||||
rm -rf target/linux/mediatek/patches-4.14/0027-*.patch
|
||||
#rm -rf feeds/packages/libs/libwebp
|
||||
|
||||
echo "Update feeds index"
|
||||
rm -rf feeds/luci/modules/luci-mod-network
|
||||
|
||||
cp .config .config.keep
|
||||
scripts/feeds clean
|
||||
scripts/feeds update -a
|
||||
|
||||
#cd -
|
||||
#echo "Checking if fullconenat-luci patch is set or not"
|
||||
##if ! patch -Rf -N -p1 -s --dry-run < patches/fullconenat-luci.patch; then
|
||||
# echo "apply..."
|
||||
# patch -N -p1 -s < patches/fullconenat-luci.patch
|
||||
#fi
|
||||
#echo "Done"
|
||||
#cd "$OMR_TARGET/source"
|
||||
|
||||
if [ "$OMR_ALL_PACKAGES" = "yes" ]; then
|
||||
scripts/feeds install -a -p packages
|
||||
scripts/feeds install -a -p luci
|
||||
scripts/feeds install -a -d m -p packages
|
||||
scripts/feeds install -a -d m -p luci
|
||||
fi
|
||||
if [ -n "$CUSTOM_FEED" ]; then
|
||||
scripts/feeds install -a -d m -p openmptcprouter
|
||||
scripts/feeds install -a -d y -f -p ${OMR_DIST}
|
||||
else
|
||||
scripts/feeds install -a -d y -f -p openmptcprouter
|
||||
fi
|
||||
scripts/feeds install -a -d y -f -p openmptcprouter
|
||||
cp .config.keep .config
|
||||
echo "Done"
|
||||
|
||||
|
|
30
config
30
config
|
@ -17,9 +17,9 @@ CONFIG_BUSYBOX_CONFIG_FEATURE_SEAMLESS_BZ2=y
|
|||
CONFIG_BUSYBOX_CONFIG_FEATURE_SHOW_THREADS=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_STAT_FILESYSTEM=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_STAT_FORMAT=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_TOP_DECIMALS=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_TOP_SMP_CPU=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_TOP_SMP_PROCESS=y
|
||||
# CONFIG_BUSYBOX_CONFIG_FEATURE_TOP_DECIMALS is not set
|
||||
# CONFIG_BUSYBOX_CONFIG_FEATURE_TOP_SMP_CPU is not set
|
||||
# CONFIG_BUSYBOX_CONFIG_FEATURE_TOP_SMP_PROCESS is not set
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_USE_TERMIOS=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_VI_UNDO=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_VI_UNDO_QUEUE=y
|
||||
|
@ -194,17 +194,18 @@ CONFIG_KERNEL_TCP_CONG_BALIA=y
|
|||
CONFIG_KERNEL_MPTCP_FULLMESH=y
|
||||
CONFIG_KERNEL_DEFAULT_FULLMESH=y
|
||||
CONFIG_KERNEL_MPTCP_NDIFFPORTS=y
|
||||
CONFIG_KERNEL_DEFAULT_NDIFFPORTS=n
|
||||
# CONFIG_KERNEL_DEFAULT_NDIFFPORTS is not set
|
||||
CONFIG_KERNEL_MPTCP_BINDER=y
|
||||
CONFIG_KERNEL_MPTCP_ECF=y
|
||||
CONFIG_KERNEL_DEFAULT_BINDER=n
|
||||
CONFIG_KERNEL_DEFAULT_DUMMY=n
|
||||
# CONFIG_KERNEL_DEFAULT_BINDER is not set
|
||||
# CONFIG_KERNEL_DEFAULT_DUMMY is not set
|
||||
CONFIG_KERNEL_MPTCP_ROUNDROBIN=y
|
||||
CONFIG_KERNEL_DEFAULT_ROUNDROBIN=n
|
||||
# CONFIG_KERNEL_DEFAULT_ROUNDROBIN is not set
|
||||
CONFIG_KERNEL_MPTCP_REDUNDANT=y
|
||||
CONFIG_KERNEL_DEFAULT_REDUNDANT=n
|
||||
# CONFIG_KERNEL_DEFAULT_REDUNDANT is not set
|
||||
CONFIG_KERNEL_DEFAULT_SCHEDULER=y
|
||||
CONFIG_KERNEL_MPTCP=y
|
||||
CONFIG_KERNEL_CRYPTO_SHA256=y
|
||||
CONFIG_LUCI_LANG_hu=y
|
||||
CONFIG_LUCI_LANG_pt=y
|
||||
CONFIG_LUCI_LANG_sk=y
|
||||
|
@ -217,7 +218,8 @@ CONFIG_LUCI_LANG_vi=y
|
|||
CONFIG_LUCI_LANG_de=y
|
||||
CONFIG_LUCI_LANG_no=y
|
||||
CONFIG_LUCI_LANG_ms=y
|
||||
CONFIG_LUCI_LANG_zh-cn=y
|
||||
CONFIG_LUCI_LANG_zh_Hans=y
|
||||
CONFIG_LUCI_LANG_zh_Hant=y
|
||||
CONFIG_LUCI_LANG_ko=y
|
||||
CONFIG_LUCI_LANG_he=y
|
||||
CONFIG_LUCI_LANG_zh-tw=y
|
||||
|
@ -227,10 +229,18 @@ CONFIG_LUCI_LANG_ru=y
|
|||
CONFIG_LUCI_LANG_el=y
|
||||
CONFIG_LUCI_LANG_ca=y
|
||||
CONFIG_LUCI_LANG_es=y
|
||||
CONFIG_LUCI_LANG_pt-br=y
|
||||
CONFIG_LUCI_LANG_pt_BR=y
|
||||
CONFIG_LUCI_LANG_cs=y
|
||||
CONFIG_LUCI_LANG_fr=y
|
||||
CONFIG_LUCI_LANG_it=y
|
||||
CONFIG_LUCI_LANG_ar=y
|
||||
CONFIG_LUCI_LANG_bg=y
|
||||
CONFIG_LUCI_LANG_bn_BD=y
|
||||
CONFIG_LUCI_LANG_fi=y
|
||||
CONFIG_LUCI_LANG_hi=y
|
||||
CONFIG_LUCI_LANG_mr=y
|
||||
CONFIG_LUCI_LANG_nb_NO=y
|
||||
CONFIG_TARGET_ROOTFS_PARTSIZE=512
|
||||
CONFIG_TARGET_KERNEL_PARTSIZE=64
|
||||
CONFIG_OPENSSL_WITH_CHACHA_POLY1305=y
|
||||
# CONFIG_LUCI_CSSTIDY is not set
|
||||
|
|
|
@ -1,17 +1,19 @@
|
|||
CONFIG_TARGET_mediatek=y
|
||||
CONFIG_TARGET_mediatek_mt7623=y
|
||||
CONFIG_TARGET_mediatek_mt7623_DEVICE_7623n-bananapi-bpi-r2=y
|
||||
CONFIG_TARGET_mediatek_mt7623_DEVICE_bpi_bananapi-r2=y
|
||||
CONFIG_TARGET_ROOTFS_EXT4FS=y
|
||||
# CONFIG_TARGET_ROOTFS_SQUASHFS is not set
|
||||
CONFIG_TARGET_ROOTFS_SQUASHFS=y
|
||||
CONFIG_PACKAGE_kmod-cryptodev=y
|
||||
CONFIG_OPENSSL_HARDWARE_SUPPORT=y
|
||||
CONFIG_OPENSSL_ENGINE_CRYPTO=y
|
||||
CONFIG_OPENSSL_ENGINE_DIGEST=y
|
||||
CONFIG_PACKAGE_wmt=y
|
||||
CONFIG_PACKAGE_kmod-mt6625l-wlan-gen2=y
|
||||
CONFIG_PACKAGE_u-boot-bpi_r2=y
|
||||
CONFIG_PACKAGE_uboot-envtools=y
|
||||
CONFIG_PACKAGE_attr=y
|
||||
CONFIG_PACKAGE_f2fs-tools=y
|
||||
CONFIG_PACKAGE_f2fsck=y
|
||||
CONFIG_PACKAGE_mkf2fs=y
|
||||
# CONFIG_PACKAGE_kmod-fs-nfs-v3 is not set
|
||||
# CONFIG_PACKAGE_kmod-fs-nfs-v4 is not set
|
||||
# CONFIG_PACKAGE_kmod-rtl8812au-ct is not set
|
||||
# CONFIG_PACKAGE_kmod-mt6625l-bt is not set
|
||||
# CONFIG_PACKAGE_kmod-mt6625l-wlan-gen-2 is not set
|
||||
|
|
7
config-espressobin
Normal file
7
config-espressobin
Normal file
|
@ -0,0 +1,7 @@
|
|||
CONFIG_TARGET_mvebu=y
|
||||
CONFIG_TARGET_mvebu_cortexa53=y
|
||||
CONFIG_TARGET_mvebu_cortexa53_DEVICE_globalscale_espressobin-v7=y
|
||||
CONFIG_PACKAGE_kmod-6lowpan=y
|
||||
CONFIG_PACKAGE_luci-app-advanced-reboot=y
|
||||
# CONFIG_KERNEL_CC_OPTIMIZE_FOR_PERFORMANCE is not set
|
||||
CONFIG_KERNEL_CC_OPTIMIZE_FOR_SIZE=y
|
|
@ -3,4 +3,5 @@ CONFIG_TARGET_bcm27xx_bcm2709=y
|
|||
CONFIG_TARGET_bcm27xx_bcm2709_DEVICE_rpi-2=y
|
||||
CONFIG_PACKAGE_kmod-ath10k-ct=n
|
||||
CONFIG_PACKAGE_kmod-ath9k=y
|
||||
CONFIG_PACKAGE_rpi-eeprom=y
|
||||
CONFIG_PACKAGE_bcm27xx-eeprom=y
|
||||
CONFIG_PACKAGE_bcm27xx-userland=y
|
||||
|
|
|
@ -3,4 +3,5 @@ CONFIG_TARGET_bcm27xx_bcm2711=y
|
|||
CONFIG_TARGET_bcm27xx_bcm2711_DEVICE_rpi-4=y
|
||||
CONFIG_PACKAGE_kmod-ath10k-ct=n
|
||||
CONFIG_PACKAGE_kmod-ath9k=y
|
||||
CONFIG_PACKAGE_rpi-eeprom=y
|
||||
CONFIG_PACKAGE_bcm27xx-eeprom=y
|
||||
CONFIG_PACKAGE_bcm27xx-userland=y
|
||||
|
|
|
@ -3,3 +3,5 @@ CONFIG_TARGET_mvebu_cortexa9=y
|
|||
CONFIG_TARGET_mvebu_cortexa9_DEVICE_linksys_wrt32x=y
|
||||
CONFIG_PACKAGE_kmod-6lowpan=y
|
||||
CONFIG_PACKAGE_luci-app-advanced-reboot=y
|
||||
# CONFIG_KERNEL_CC_OPTIMIZE_FOR_PERFORMANCE is not set
|
||||
CONFIG_KERNEL_CC_OPTIMIZE_FOR_SIZE=y
|
||||
|
|
13
patches/download-ipv4.patch
Normal file
13
patches/download-ipv4.patch
Normal file
|
@ -0,0 +1,13 @@
|
|||
--- a/scripts/download.pl 2020-04-12 21:41:19.548645048 +0200
|
||||
+++ b/scripts/download.pl 2020-04-12 21:41:28.752479609 +0200
|
||||
@@ -82,8 +82,8 @@
|
||||
}
|
||||
|
||||
return $have_curl
|
||||
- ? (qw(curl -f --connect-timeout 20 --retry 5 --location --insecure), shellwords($ENV{CURL_OPTIONS} || ''), $url)
|
||||
- : (qw(wget --tries=5 --timeout=20 --no-check-certificate --output-document=-), shellwords($ENV{WGET_OPTIONS} || ''), $url)
|
||||
+ ? (qw(curl -4 -f --connect-timeout 20 --retry 5 --location --insecure), shellwords($ENV{CURL_OPTIONS} || ''), $url)
|
||||
+ : (qw(wget -4 --tries=5 --timeout=20 --no-check-certificate --output-document=-), shellwords($ENV{WGET_OPTIONS} || ''), $url)
|
||||
;
|
||||
}
|
||||
|
14
patches/ipt-nat6.patch
Normal file
14
patches/ipt-nat6.patch
Normal file
|
@ -0,0 +1,14 @@
|
|||
--- a/package/kernel/linux/modules/netfilter.mk 2020-03-20 15:41:58.620893747 +0100
|
||||
+++ b/package/kernel/linux/modules/netfilter.mk 2020-03-20 15:45:34.389015301 +0100
|
||||
@@ -483,8 +483,10 @@
|
||||
define KernelPackage/ipt-nat6
|
||||
TITLE:=IPv6 NAT targets
|
||||
DEPENDS:=@IPV6
|
||||
KCONFIG:=$(KCONFIG_IPT_NAT6)
|
||||
- FILES:=$(foreach mod,$(IPT_NAT6-m),$(LINUX_DIR)/net/$(mod).ko)
|
||||
+ FILES:= \
|
||||
+ $(LINUX_DIR)/net/ipv6/netfilter/ip6t_NPT.ko \
|
||||
+ $(LINUX_DIR)/net/ipv6/netfilter/ip6table_nat.ko
|
||||
AUTOLOAD:=$(call AutoLoad,43,$(notdir $(IPT_NAT6-m)))
|
||||
$(call AddDepends/ipt,+kmod-nf-nat6)
|
||||
$(call AddDepends/ipt,+kmod-ipt-conntrack)
|
11
patches/package-too-long.patch
Normal file
11
patches/package-too-long.patch
Normal file
|
@ -0,0 +1,11 @@
|
|||
--- a/package/Makefile 2020-04-04 15:52:15.706831084 +0200
|
||||
+++ b/package/Makefile 2020-04-04 15:53:54.645052663 +0200
|
||||
@@ -66,7 +66,7 @@
|
||||
rm -rf $(TARGET_DIR) $(TARGET_DIR_ORIG)
|
||||
mkdir -p $(TARGET_DIR)/tmp
|
||||
$(call opkg,$(TARGET_DIR)) install \
|
||||
- $(call opkg_package_files,$(foreach pkg,$(shell cat $(PACKAGE_INSTALL_FILES) 2>/dev/null),$(pkg)$(call GetABISuffix,$(pkg))))
|
||||
+ $(subst $(TOPDIR)/,,$(call opkg_package_files,$(foreach pkg,$(shell cat $(PACKAGE_INSTALL_FILES) 2>/dev/null),$(pkg)$(call GetABISuffix,$(pkg)))))
|
||||
@for file in $(PACKAGE_INSTALL_FILES); do \
|
||||
[ -s $$file.flags ] || continue; \
|
||||
for flag in `cat $$file.flags`; do \
|
|
@ -1,7 +1,7 @@
|
|||
Index: package/kernel/linux/modules/usb.mk
|
||||
===================================================================
|
||||
--- package/kernel/linux/modules/usb.mk (revisione 42462)
|
||||
+++ package/kernel/linux/modules/usb.mk (copia locale)
|
||||
--- a/package/kernel/linux/modules/usb.mk (revisione 42462)
|
||||
+++ b/package/kernel/linux/modules/usb.mk (copia locale)
|
||||
@@ -1091,8 +1091,21 @@
|
||||
endef
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
78
root/package/boot/uboot-envtools/Makefile
Normal file
78
root/package/boot/uboot-envtools/Makefile
Normal file
|
@ -0,0 +1,78 @@
|
|||
#
|
||||
# Copyright (C) 2006-2014 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=uboot-envtools
|
||||
PKG_DISTNAME:=u-boot
|
||||
PKG_VERSION:=2020.04
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE:=$(PKG_DISTNAME)-$(PKG_VERSION).tar.bz2
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_DISTNAME)-$(PKG_VERSION)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_DISTNAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_URL:=https://git.denx.de/u-boot.git
|
||||
PKG_SOURCE_VERSION:=36fec02b1f90b92cf51ec531564f9284eae27ab4
|
||||
PKG_MIRROR_HASH:=fe732aaf037d9cc3c0909bad8362af366ae964bbdac6913a34081ff4ad565372
|
||||
|
||||
PKG_BUILD_DEPENDS:=fstools
|
||||
|
||||
PKG_LICENSE:=GPL-2.0 GPL-2.0+
|
||||
PKG_LICENSE_FILES:=Licenses/README
|
||||
|
||||
PKG_FLAGS:=nonshared
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/uboot-envtools
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=Boot Loaders
|
||||
TITLE:=read/modify U-Boot bootloader environment
|
||||
URL:=http://www.denx.de/wiki/U-Boot
|
||||
endef
|
||||
|
||||
define Package/uboot-envtools/description
|
||||
This package includes tools to read and modify U-Boot bootloader environment.
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
touch $(PKG_BUILD_DIR)/include/config.h
|
||||
mkdir -p $(PKG_BUILD_DIR)/include/config
|
||||
touch $(PKG_BUILD_DIR)/include/config/auto.conf
|
||||
mkdir -p $(PKG_BUILD_DIR)/include/generated
|
||||
touch $(PKG_BUILD_DIR)/include/generated/autoconf.h
|
||||
endef
|
||||
|
||||
MAKE_FLAGS += \
|
||||
TARGET_CFLAGS="$(TARGET_CFLAGS)" \
|
||||
TARGET_LDFLAGS="$(TARGET_LDFLAGS)" \
|
||||
no-dot-config-targets=envtools \
|
||||
envtools
|
||||
|
||||
define Package/uboot-envtools/conffiles
|
||||
/etc/config/ubootenv
|
||||
/etc/fw_env.config
|
||||
endef
|
||||
|
||||
define Package/uboot-envtools/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/env/fw_printenv $(1)/usr/sbin
|
||||
$(LN) fw_printenv $(1)/usr/sbin/fw_setenv
|
||||
$(INSTALL_DIR) $(1)/lib
|
||||
$(INSTALL_DATA) ./files/uboot-envtools.sh $(1)/lib
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(if $(wildcard ./files/$(BOARD)), \
|
||||
$(INSTALL_DATA) ./files/$(BOARD) \
|
||||
$(1)/etc/uci-defaults/30_uboot-envtools \
|
||||
)
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,uboot-envtools))
|
|
@ -1,58 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2013-2019 OpenWrt.org
|
||||
# Copyright (C) 2019 Alexey Loukianov
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_VERSION:=2019.01
|
||||
|
||||
PKG_HASH:=50bd7e5a466ab828914d080d5f6a432345b500e8fba1ad3b7b61e95e60d51c22
|
||||
|
||||
PKG_MAINTAINER:=Alexey Loukianov <lx2@lexa2.ru>
|
||||
|
||||
include $(INCLUDE_DIR)/u-boot.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define U-Boot/Default
|
||||
BUILD_TARGET:=mediatek
|
||||
UBOOT_IMAGE:=u-boot.bin
|
||||
UENV:=default
|
||||
HIDDEN:=1
|
||||
endef
|
||||
|
||||
define U-Boot/mt7623n_bpir2
|
||||
BUILD_SUBTARGET:=mt7623
|
||||
NAME:=Bannana PI R2 (mt7623)
|
||||
BUILD_DEVICES:=7623n-bananapi-bpi-r2
|
||||
endef
|
||||
|
||||
UBOOT_TARGETS := \
|
||||
mt7623n_bpir2
|
||||
|
||||
UBOOT_CONFIGURE_VARS += USE_PRIVATE_LIBGCC=yes
|
||||
|
||||
UBOOT_MAKE_FLAGS = \
|
||||
HOSTCC="$(HOSTCC)" \
|
||||
HOSTCFLAGS="$(HOST_CFLAGS) $(HOST_CPPFLAGS) -std=gnu11" \
|
||||
HOSTLDFLAGS="$(HOST_LDFLAGS)"
|
||||
|
||||
define Build/Prepare
|
||||
$(call Build/Prepare/Default)
|
||||
$(CP) uEnv-$(UENV).txt $(PKG_BUILD_DIR)/uEnv.txt
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(STAGING_DIR_IMAGE)
|
||||
$(CP) $(PKG_BUILD_DIR)/$(UBOOT_IMAGE) $(STAGING_DIR_IMAGE)/$(BUILD_DEVICES)-uboot-mediatek.bin
|
||||
$(CP) $(PKG_BUILD_DIR)/uEnv.txt $(STAGING_DIR_IMAGE)/$(BUILD_DEVICES)-uEnv.txt
|
||||
endef
|
||||
|
||||
define Package/u-boot/install/default
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage/U-Boot))
|
|
@ -1,39 +0,0 @@
|
|||
diff --git a/configs/mt7623n_bpir2_defconfig b/configs/mt7623n_bpir2_defconfig
|
||||
index ae4fb280..74252cd0 100644
|
||||
--- a/configs/mt7623n_bpir2_defconfig
|
||||
+++ b/configs/mt7623n_bpir2_defconfig
|
||||
@@ -3,6 +3,7 @@ CONFIG_SYS_THUMB_BUILD=y
|
||||
CONFIG_ARCH_MEDIATEK=y
|
||||
CONFIG_SYS_TEXT_BASE=0x81e00000
|
||||
CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
+CONFIG_TARGET_MT7623=y
|
||||
CONFIG_NR_DRAM_BANKS=1
|
||||
CONFIG_FIT=y
|
||||
CONFIG_FIT_VERBOSE=y
|
||||
@@ -11,7 +12,7 @@ CONFIG_SYS_CONSOLE_IS_IN_ENV=y
|
||||
CONFIG_DEFAULT_FDT_FILE="mt7623n-bananapi-bpi-r2"
|
||||
# CONFIG_DISPLAY_BOARDINFO is not set
|
||||
CONFIG_HUSH_PARSER=y
|
||||
-CONFIG_SYS_PROMPT="U-Boot> "
|
||||
+CONFIG_SYS_PROMPT="BPI-R2> "
|
||||
CONFIG_CMD_BOOTMENU=y
|
||||
# CONFIG_CMD_ELF is not set
|
||||
# CONFIG_CMD_XIMG is not set
|
||||
@@ -51,3 +52,14 @@ CONFIG_MTK_TIMER=y
|
||||
CONFIG_WDT_MTK=y
|
||||
CONFIG_LZMA=y
|
||||
# CONFIG_EFI_LOADER is not set
|
||||
+
|
||||
+CONFIG_CMD_BOOTZ=y
|
||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
+
|
||||
+CONFIG_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="uEnv.txt"
|
||||
+
|
||||
+#enables savenenv-command
|
||||
+CONFIG_ENV_IS_IN_MMC=y
|
||||
+
|
||||
+CONFIG_CMD_ASKENV=y
|
||||
--
|
||||
1.8.3.1
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
From 2a59134ba1d841cf1a7845017656b74b74412aaf Mon Sep 17 00:00:00 2001
|
||||
From: Frank Wunderlich <frank-w@public-files.de>
|
||||
Date: Mon, 3 Dec 2018 15:32:58 +0100
|
||||
Subject: adding saveenv-command for bananapi r2
|
||||
|
||||
bananapi r2 can be booted from sd-card and emmc
|
||||
saving the environment have to choose the storage
|
||||
from which the device has booted
|
||||
|
||||
also the offset is set to 1MB-50Kb to make sure env is written
|
||||
to block "user data area" between uboot and first partition
|
||||
|
||||
https://www.fw-web.de/dokuwiki/lib/exe/fetch.php?cache=&media=bpi-r2:boot-structure.png
|
||||
|
||||
v3: removed changes in defconfig (users choice)
|
||||
v2: fixed bracket-style in if-else statement
|
||||
|
||||
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
|
||||
|
||||
diff --git a/board/mediatek/mt7623/mt7623_rfb.c b/board/mediatek/mt7623/mt7623_rfb.c
|
||||
index 08468b50..4ec27649 100644
|
||||
--- a/board/mediatek/mt7623/mt7623_rfb.c
|
||||
+++ b/board/mediatek/mt7623/mt7623_rfb.c
|
||||
@@ -14,3 +14,22 @@ int board_init(void)
|
||||
|
||||
return 0;
|
||||
}
|
||||
+
|
||||
+int mmc_get_boot_dev(void)
|
||||
+{
|
||||
+ int g_mmc_devid = -1;
|
||||
+ char *uflag = (char *)0x81DFFFF0;
|
||||
+ if (strncmp(uflag,"eMMC",4)==0) {
|
||||
+ g_mmc_devid = 0;
|
||||
+ printf("Boot From Emmc(id:%d)\n\n", g_mmc_devid);
|
||||
+ } else {
|
||||
+ g_mmc_devid = 1;
|
||||
+ printf("Boot From SD(id:%d)\n\n", g_mmc_devid);
|
||||
+ }
|
||||
+ return g_mmc_devid;
|
||||
+}
|
||||
+
|
||||
+int mmc_get_env_dev(void)
|
||||
+{
|
||||
+ return mmc_get_boot_dev();
|
||||
+}
|
||||
diff --git a/include/configs/mt7623.h b/include/configs/mt7623.h
|
||||
index ba763501..fb6ac073 100644
|
||||
--- a/include/configs/mt7623.h
|
||||
+++ b/include/configs/mt7623.h
|
||||
@@ -53,4 +53,7 @@
|
||||
#define CONFIG_EXTRA_ENV_SETTINGS \
|
||||
FDT_HIGH
|
||||
|
||||
+#define CONFIG_SYS_MMC_ENV_DEV 0
|
||||
+#define CONFIG_ENV_OFFSET 0xF3800
|
||||
+
|
||||
#endif
|
||||
--
|
||||
1.8.3.1
|
||||
|
|
@ -1,189 +0,0 @@
|
|||
From e4033f535d7f6f86f354d36037565a319c02c324 Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Thu, 20 Dec 2018 16:12:51 +0800
|
||||
Subject: reset: MedaiTek: add reset controller driver for MediaTek SoCs
|
||||
|
||||
This patch adds reset controller driver for MediaTek SoCs.
|
||||
|
||||
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
|
||||
diff --git a/arch/arm/include/asm/arch-mediatek/reset.h b/arch/arm/include/asm/arch-mediatek/reset.h
|
||||
new file mode 100644
|
||||
index 00000000..9704666d
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/include/asm/arch-mediatek/reset.h
|
||||
@@ -0,0 +1,13 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0 */
|
||||
+/*
|
||||
+ * Copyright (C) 2018 MediaTek Inc.
|
||||
+ */
|
||||
+
|
||||
+#ifndef __MEDIATEK_RESET_H
|
||||
+#define __MEDIATEK_RESET_H
|
||||
+
|
||||
+#include <dm.h>
|
||||
+
|
||||
+int mediatek_reset_bind(struct udevice *pdev, u32 regofs, u32 num_regs);
|
||||
+
|
||||
+#endif /* __MEDIATEK_RESET_H */
|
||||
diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig
|
||||
index 9c5208b7..3a6d61f4 100644
|
||||
--- a/drivers/reset/Kconfig
|
||||
+++ b/drivers/reset/Kconfig
|
||||
@@ -106,4 +106,11 @@ config RESET_SOCFPGA
|
||||
help
|
||||
Support for reset controller on SoCFPGA platform.
|
||||
|
||||
+config RESET_MEDIATEK
|
||||
+ bool "Reset controller driver for MediaTek SoCs"
|
||||
+ depends on DM_RESET && ARCH_MEDIATEK && CLK
|
||||
+ default y
|
||||
+ help
|
||||
+ Support for reset controller on MediaTek SoCs.
|
||||
+
|
||||
endmenu
|
||||
diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile
|
||||
index f4520878..8a4dcab8 100644
|
||||
--- a/drivers/reset/Makefile
|
||||
+++ b/drivers/reset/Makefile
|
||||
@@ -17,3 +17,4 @@ obj-$(CONFIG_AST2500_RESET) += ast2500-reset.o
|
||||
obj-$(CONFIG_RESET_ROCKCHIP) += reset-rockchip.o
|
||||
obj-$(CONFIG_RESET_MESON) += reset-meson.o
|
||||
obj-$(CONFIG_RESET_SOCFPGA) += reset-socfpga.o
|
||||
+obj-$(CONFIG_RESET_MEDIATEK) += reset-mediatek.o
|
||||
diff --git a/drivers/reset/reset-mediatek.c b/drivers/reset/reset-mediatek.c
|
||||
new file mode 100644
|
||||
index 00000000..e3614e6e
|
||||
--- /dev/null
|
||||
+++ b/drivers/reset/reset-mediatek.c
|
||||
@@ -0,0 +1,102 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Copyright (C) 2018 MediaTek Inc.
|
||||
+ *
|
||||
+ * Author: Ryder Lee <ryder.lee@mediatek.com>
|
||||
+ * Weijie Gao <weijie.gao@mediatek.com>
|
||||
+ */
|
||||
+
|
||||
+#include <common.h>
|
||||
+#include <dm.h>
|
||||
+#include <dm/lists.h>
|
||||
+#include <regmap.h>
|
||||
+#include <reset-uclass.h>
|
||||
+#include <syscon.h>
|
||||
+
|
||||
+struct mediatek_reset_priv {
|
||||
+ struct regmap *regmap;
|
||||
+ u32 regofs;
|
||||
+ u32 nr_resets;
|
||||
+};
|
||||
+
|
||||
+static int mediatek_reset_request(struct reset_ctl *reset_ctl)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int mediatek_reset_free(struct reset_ctl *reset_ctl)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int mediatek_reset_assert(struct reset_ctl *reset_ctl)
|
||||
+{
|
||||
+ struct mediatek_reset_priv *priv = dev_get_priv(reset_ctl->dev);
|
||||
+ int id = reset_ctl->id;
|
||||
+
|
||||
+ if (id >= priv->nr_resets)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ return regmap_update_bits(priv->regmap,
|
||||
+ priv->regofs + ((id / 32) << 2), BIT(id % 32), BIT(id % 32));
|
||||
+}
|
||||
+
|
||||
+static int mediatek_reset_deassert(struct reset_ctl *reset_ctl)
|
||||
+{
|
||||
+ struct mediatek_reset_priv *priv = dev_get_priv(reset_ctl->dev);
|
||||
+ int id = reset_ctl->id;
|
||||
+
|
||||
+ if (id >= priv->nr_resets)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ return regmap_update_bits(priv->regmap,
|
||||
+ priv->regofs + ((id / 32) << 2), BIT(id % 32), 0);
|
||||
+}
|
||||
+
|
||||
+struct reset_ops mediatek_reset_ops = {
|
||||
+ .request = mediatek_reset_request,
|
||||
+ .free = mediatek_reset_free,
|
||||
+ .rst_assert = mediatek_reset_assert,
|
||||
+ .rst_deassert = mediatek_reset_deassert,
|
||||
+};
|
||||
+
|
||||
+static int mediatek_reset_probe(struct udevice *dev)
|
||||
+{
|
||||
+ struct mediatek_reset_priv *priv = dev_get_priv(dev);
|
||||
+
|
||||
+ if (!priv->regofs && !priv->nr_resets)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ priv->regmap = syscon_node_to_regmap(dev_ofnode(dev));
|
||||
+ if (IS_ERR(priv->regmap))
|
||||
+ return PTR_ERR(priv->regmap);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int mediatek_reset_bind(struct udevice *pdev, u32 regofs, u32 num_regs)
|
||||
+{
|
||||
+ struct udevice *rst_dev;
|
||||
+ struct mediatek_reset_priv *priv;
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = device_bind_driver_to_node(pdev, "mediatek_reset", "reset",
|
||||
+ dev_ofnode(pdev), &rst_dev);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ priv = malloc(sizeof(struct mediatek_reset_priv));
|
||||
+ priv->regofs = regofs;
|
||||
+ priv->nr_resets = num_regs * 32;
|
||||
+ rst_dev->priv = priv;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+U_BOOT_DRIVER(mediatek_reset) = {
|
||||
+ .name = "mediatek_reset",
|
||||
+ .id = UCLASS_RESET,
|
||||
+ .probe = mediatek_reset_probe,
|
||||
+ .ops = &mediatek_reset_ops,
|
||||
+ .priv_auto_alloc_size = sizeof(struct mediatek_reset_priv),
|
||||
+};
|
||||
diff --git a/include/dt-bindings/reset/mtk-reset.h b/include/dt-bindings/reset/mtk-reset.h
|
||||
new file mode 100644
|
||||
index 00000000..5f0a74f2
|
||||
--- /dev/null
|
||||
+++ b/include/dt-bindings/reset/mtk-reset.h
|
||||
@@ -0,0 +1,18 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0 */
|
||||
+/*
|
||||
+ * Copyright (C) 2018 MediaTek Inc.
|
||||
+ */
|
||||
+
|
||||
+#ifndef _DT_BINDINGS_MTK_RESET_H_
|
||||
+#define _DT_BINDINGS_MTK_RESET_H_
|
||||
+
|
||||
+/* ETHSYS */
|
||||
+#define ETHSYS_PPE_RST 31
|
||||
+#define ETHSYS_EPHY_RST 24
|
||||
+#define ETHSYS_GMAC_RST 23
|
||||
+#define ETHSYS_ESW_RST 16
|
||||
+#define ETHSYS_FE_RST 6
|
||||
+#define ETHSYS_MCM_RST 2
|
||||
+#define ETHSYS_SYS_RST 0
|
||||
+
|
||||
+#endif /* _DT_BINDINGS_MTK_RESET_H_ */
|
||||
--
|
||||
1.8.3.1
|
||||
|
|
@ -1,109 +0,0 @@
|
|||
From ab7ad2d077ef18d6d853c8838bc116fbbd0ac154 Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Thu, 20 Dec 2018 16:12:52 +0800
|
||||
Subject: clk: MediaTek: bind ethsys reset controller
|
||||
|
||||
The ethsys contains not only the clock gating controller, but also the
|
||||
reset controller for the whole ethernet subsystem and its components.
|
||||
|
||||
This patch adds binding of the reset controller so that the ethernet node
|
||||
can have references on it.
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
|
||||
diff --git a/drivers/clk/mediatek/clk-mt7623.c b/drivers/clk/mediatek/clk-mt7623.c
|
||||
index c6b09d8e..87ad4f79 100644
|
||||
--- a/drivers/clk/mediatek/clk-mt7623.c
|
||||
+++ b/drivers/clk/mediatek/clk-mt7623.c
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <common.h>
|
||||
#include <dm.h>
|
||||
+#include <asm/arch-mediatek/reset.h>
|
||||
#include <asm/io.h>
|
||||
#include <dt-bindings/clock/mt7623-clk.h>
|
||||
|
||||
@@ -782,6 +783,19 @@ static int mt7623_ethsys_probe(struct udevice *dev)
|
||||
return mtk_common_clk_gate_init(dev, &mt7623_clk_tree, eth_cgs);
|
||||
}
|
||||
|
||||
+static int mt7623_ethsys_bind(struct udevice *dev)
|
||||
+{
|
||||
+ int ret = 0;
|
||||
+
|
||||
+#if CONFIG_IS_ENABLED(RESET_MEDIATEK)
|
||||
+ ret = mediatek_reset_bind(dev, ETHSYS_RST_CTRL_OFS, 1);
|
||||
+ if (ret)
|
||||
+ debug("Warning: failed to bind ethsys reset controller\n");
|
||||
+#endif
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
static const struct udevice_id mt7623_apmixed_compat[] = {
|
||||
{ .compatible = "mediatek,mt7623-apmixedsys" },
|
||||
{ }
|
||||
@@ -865,6 +879,7 @@ U_BOOT_DRIVER(mtk_clk_ethsys) = {
|
||||
.id = UCLASS_CLK,
|
||||
.of_match = mt7623_ethsys_compat,
|
||||
.probe = mt7623_ethsys_probe,
|
||||
+ .bind = mt7623_ethsys_bind,
|
||||
.priv_auto_alloc_size = sizeof(struct mtk_cg_priv),
|
||||
.ops = &mtk_clk_gate_ops,
|
||||
};
|
||||
diff --git a/drivers/clk/mediatek/clk-mt7629.c b/drivers/clk/mediatek/clk-mt7629.c
|
||||
index 2601b6cf..6a9f6013 100644
|
||||
--- a/drivers/clk/mediatek/clk-mt7629.c
|
||||
+++ b/drivers/clk/mediatek/clk-mt7629.c
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <common.h>
|
||||
#include <dm.h>
|
||||
+#include <asm/arch-mediatek/reset.h>
|
||||
#include <asm/io.h>
|
||||
#include <dt-bindings/clock/mt7629-clk.h>
|
||||
|
||||
@@ -602,6 +603,19 @@ static int mt7629_ethsys_probe(struct udevice *dev)
|
||||
return mtk_common_clk_gate_init(dev, &mt7629_clk_tree, eth_cgs);
|
||||
}
|
||||
|
||||
+static int mt7629_ethsys_bind(struct udevice *dev)
|
||||
+{
|
||||
+ int ret = 0;
|
||||
+
|
||||
+#if CONFIG_IS_ENABLED(RESET_MEDIATEK)
|
||||
+ ret = mediatek_reset_bind(dev, ETHSYS_RST_CTRL_OFS, 1);
|
||||
+ if (ret)
|
||||
+ debug("Warning: failed to bind ethsys reset controller\n");
|
||||
+#endif
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
static int mt7629_sgmiisys_probe(struct udevice *dev)
|
||||
{
|
||||
return mtk_common_clk_gate_init(dev, &mt7629_clk_tree, sgmii_cgs);
|
||||
@@ -695,6 +709,7 @@ U_BOOT_DRIVER(mtk_clk_ethsys) = {
|
||||
.id = UCLASS_CLK,
|
||||
.of_match = mt7629_ethsys_compat,
|
||||
.probe = mt7629_ethsys_probe,
|
||||
+ .bind = mt7629_ethsys_bind,
|
||||
.priv_auto_alloc_size = sizeof(struct mtk_cg_priv),
|
||||
.ops = &mtk_clk_gate_ops,
|
||||
};
|
||||
diff --git a/drivers/clk/mediatek/clk-mtk.h b/drivers/clk/mediatek/clk-mtk.h
|
||||
index 74152ed9..7847388b 100644
|
||||
--- a/drivers/clk/mediatek/clk-mtk.h
|
||||
+++ b/drivers/clk/mediatek/clk-mtk.h
|
||||
@@ -23,6 +23,8 @@
|
||||
#define CLK_PARENT_TOPCKGEN BIT(5)
|
||||
#define CLK_PARENT_MASK GENMASK(5, 4)
|
||||
|
||||
+#define ETHSYS_RST_CTRL_OFS 0x34
|
||||
+
|
||||
/* struct mtk_pll_data - hardware-specific PLLs data */
|
||||
struct mtk_pll_data {
|
||||
const int id;
|
||||
--
|
||||
1.8.3.1
|
||||
|
File diff suppressed because it is too large
Load diff
|
@ -1,76 +0,0 @@
|
|||
From fbdf1c37235d4a5a50eaafff41cacff4fd3a6e9f Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Thu, 20 Dec 2018 16:12:54 +0800
|
||||
Subject: arm: dts: add ethernet related node for MT7623 SoC
|
||||
|
||||
This patch adds ethernet gmac node for MT7623 with MT7530 gigabit switch.
|
||||
|
||||
Signed-off-by: Mark Lee <Mark-MC.Lee@mediatek.com>
|
||||
|
||||
diff --git a/arch/arm/dts/mt7623.dtsi b/arch/arm/dts/mt7623.dtsi
|
||||
index f50f4ef1..448d1d73 100644
|
||||
--- a/arch/arm/dts/mt7623.dtsi
|
||||
+++ b/arch/arm/dts/mt7623.dtsi
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <dt-bindings/interrupt-controller/irq.h>
|
||||
#include <dt-bindings/interrupt-controller/arm-gic.h>
|
||||
#include <dt-bindings/power/mt7623-power.h>
|
||||
+#include <dt-bindings/reset/mtk-reset.h>
|
||||
#include "skeleton.dtsi"
|
||||
|
||||
/ {
|
||||
@@ -248,8 +249,26 @@
|
||||
};
|
||||
|
||||
ethsys: syscon@1b000000 {
|
||||
- compatible = "mediatek,mt7623-ethsys";
|
||||
+ compatible = "mediatek,mt7623-ethsys", "syscon";
|
||||
reg = <0x1b000000 0x1000>;
|
||||
#clock-cells = <1>;
|
||||
+ #reset-cells = <1>;
|
||||
+ };
|
||||
+
|
||||
+ eth: ethernet@1b100000 {
|
||||
+ compatible = "mediatek,mt7623-eth", "syscon";
|
||||
+ reg = <0x1b100000 0x20000>;
|
||||
+ clocks = <&topckgen CLK_TOP_ETHIF_SEL>,
|
||||
+ <ðsys CLK_ETHSYS_ESW>,
|
||||
+ <ðsys CLK_ETHSYS_GP1>,
|
||||
+ <ðsys CLK_ETHSYS_GP2>,
|
||||
+ <&apmixedsys CLK_APMIXED_TRGPLL>;
|
||||
+ clock-names = "ethif", "esw", "gp1", "gp2", "trgpll";
|
||||
+ power-domains = <&scpsys MT7623_POWER_DOMAIN_ETH>;
|
||||
+ resets = <ðsys ETHSYS_FE_RST>,
|
||||
+ <ðsys ETHSYS_MCM_RST>;
|
||||
+ reset-names = "fe", "mcm";
|
||||
+ mediatek,ethsys = <ðsys>;
|
||||
+ status = "disabled";
|
||||
};
|
||||
};
|
||||
diff --git a/arch/arm/dts/mt7623n-bananapi-bpi-r2.dts b/arch/arm/dts/mt7623n-bananapi-bpi-r2.dts
|
||||
index 84a77fde..51628bb6 100644
|
||||
--- a/arch/arm/dts/mt7623n-bananapi-bpi-r2.dts
|
||||
+++ b/arch/arm/dts/mt7623n-bananapi-bpi-r2.dts
|
||||
@@ -67,6 +67,19 @@
|
||||
};
|
||||
};
|
||||
|
||||
+ð {
|
||||
+ status = "okay";
|
||||
+ mediatek,gmac-id = <0>;
|
||||
+ phy-mode = "rgmii";
|
||||
+ mediatek,switch = "mt7530";
|
||||
+ reset-gpios = <&gpio 33 GPIO_ACTIVE_HIGH>;
|
||||
+
|
||||
+ fixed-link {
|
||||
+ speed = <1000>;
|
||||
+ full-duplex;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
&mmc0 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&mmc0_pins_default>;
|
||||
--
|
||||
1.8.3.1
|
||||
|
|
@ -1,95 +0,0 @@
|
|||
From 038e3dc3801007f5025a2e57bb4b715c48b9590d Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Thu, 20 Dec 2018 16:12:55 +0800
|
||||
Subject: arm: dts: add ethernet related node for MT7629 SoC
|
||||
|
||||
This patch adds ethernet gmac node for MT7629 with internal gigabit phy.
|
||||
|
||||
Signed-off-by: Mark Lee <Mark-MC.Lee@mediatek.com>
|
||||
|
||||
diff --git a/arch/arm/dts/mt7629-rfb.dts b/arch/arm/dts/mt7629-rfb.dts
|
||||
index a6d28a06..95d10aa6 100644
|
||||
--- a/arch/arm/dts/mt7629-rfb.dts
|
||||
+++ b/arch/arm/dts/mt7629-rfb.dts
|
||||
@@ -22,6 +22,17 @@
|
||||
};
|
||||
};
|
||||
|
||||
+ð {
|
||||
+ status = "okay";
|
||||
+ mediatek,gmac-id = <1>;
|
||||
+ phy-mode = "gmii";
|
||||
+ phy-handle = <&phy0>;
|
||||
+
|
||||
+ phy0: ethernet-phy@0 {
|
||||
+ reg = <0>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
&pinctrl {
|
||||
qspi_pins: qspi-pins {
|
||||
mux {
|
||||
diff --git a/arch/arm/dts/mt7629.dtsi b/arch/arm/dts/mt7629.dtsi
|
||||
index e6052bbd..c87115e0 100644
|
||||
--- a/arch/arm/dts/mt7629.dtsi
|
||||
+++ b/arch/arm/dts/mt7629.dtsi
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <dt-bindings/interrupt-controller/irq.h>
|
||||
#include <dt-bindings/interrupt-controller/arm-gic.h>
|
||||
#include <dt-bindings/power/mt7629-power.h>
|
||||
+#include <dt-bindings/reset/mtk-reset.h>
|
||||
#include "skeleton.dtsi"
|
||||
|
||||
/ {
|
||||
@@ -228,6 +229,48 @@
|
||||
compatible = "mediatek,mt7629-ethsys", "syscon";
|
||||
reg = <0x1b000000 0x1000>;
|
||||
#clock-cells = <1>;
|
||||
+ #reset-cells = <1>;
|
||||
+ };
|
||||
+
|
||||
+ eth: ethernet@1b100000 {
|
||||
+ compatible = "mediatek,mt7629-eth", "syscon";
|
||||
+ reg = <0x1b100000 0x20000>;
|
||||
+ clocks = <&topckgen CLK_TOP_ETH_SEL>,
|
||||
+ <&topckgen CLK_TOP_F10M_REF_SEL>,
|
||||
+ <ðsys CLK_ETH_ESW_EN>,
|
||||
+ <ðsys CLK_ETH_GP0_EN>,
|
||||
+ <ðsys CLK_ETH_GP1_EN>,
|
||||
+ <ðsys CLK_ETH_GP2_EN>,
|
||||
+ <ðsys CLK_ETH_FE_EN>,
|
||||
+ <&sgmiisys0 CLK_SGMII_TX_EN>,
|
||||
+ <&sgmiisys0 CLK_SGMII_RX_EN>,
|
||||
+ <&sgmiisys0 CLK_SGMII_CDR_REF>,
|
||||
+ <&sgmiisys0 CLK_SGMII_CDR_FB>,
|
||||
+ <&sgmiisys1 CLK_SGMII_TX_EN>,
|
||||
+ <&sgmiisys1 CLK_SGMII_RX_EN>,
|
||||
+ <&sgmiisys1 CLK_SGMII_CDR_REF>,
|
||||
+ <&sgmiisys1 CLK_SGMII_CDR_FB>,
|
||||
+ <&apmixedsys CLK_APMIXED_SGMIPLL>,
|
||||
+ <&apmixedsys CLK_APMIXED_ETH2PLL>;
|
||||
+ clock-names = "ethif", "sgmiitop", "esw", "gp0", "gp1", "gp2",
|
||||
+ "fe", "sgmii_tx250m", "sgmii_rx250m",
|
||||
+ "sgmii_cdr_ref", "sgmii_cdr_fb",
|
||||
+ "sgmii2_tx250m", "sgmii2_rx250m",
|
||||
+ "sgmii2_cdr_ref", "sgmii2_cdr_fb",
|
||||
+ "sgmii_ck", "eth2pll";
|
||||
+ assigned-clocks = <&topckgen CLK_TOP_ETH_SEL>,
|
||||
+ <&topckgen CLK_TOP_F10M_REF_SEL>;
|
||||
+ assigned-clock-parents = <&topckgen CLK_TOP_UNIVPLL1_D2>,
|
||||
+ <&topckgen CLK_TOP_SGMIIPLL_D2>;
|
||||
+ power-domains = <&scpsys MT7629_POWER_DOMAIN_ETHSYS>;
|
||||
+ resets = <ðsys ETHSYS_FE_RST>;
|
||||
+ reset-names = "fe";
|
||||
+ mediatek,ethsys = <ðsys>;
|
||||
+ mediatek,sgmiisys = <&sgmiisys0>;
|
||||
+ mediatek,infracfg = <&infracfg>;
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+ status = "disabled";
|
||||
};
|
||||
|
||||
sgmiisys0: syscon@1b128000 {
|
||||
--
|
||||
1.8.3.1
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
From 8da1e0fd083f4c6a71f6735c06698e71250bcc07 Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Thu, 20 Dec 2018 16:12:56 +0800
|
||||
Subject: arm: MediaTek: add ethernet support for MT7623 boards
|
||||
|
||||
Enable ethernet related configs to mt7623n_bpir2_defconfig.
|
||||
Add default IP addresses.
|
||||
Enable noncached memory region required by ethernet driver.
|
||||
|
||||
Signed-off-by: Mark Lee <Mark-MC.Lee@mediatek.com>
|
||||
|
||||
diff --git a/configs/mt7623n_bpir2_defconfig b/configs/mt7623n_bpir2_defconfig
|
||||
index 74252cd0..bb67f328 100644
|
||||
--- a/configs/mt7623n_bpir2_defconfig
|
||||
+++ b/configs/mt7623n_bpir2_defconfig
|
||||
@@ -29,6 +29,7 @@ CONFIG_CMD_FAT=y
|
||||
CONFIG_CMD_FS_GENERIC=y
|
||||
CONFIG_OF_EMBED=y
|
||||
CONFIG_DEFAULT_DEVICE_TREE="mt7623n-bananapi-bpi-r2"
|
||||
+CONFIG_NET_RANDOM_ETHADDR=y
|
||||
CONFIG_REGMAP=y
|
||||
CONFIG_SYSCON=y
|
||||
# CONFIG_BLOCK_CACHE is not set
|
||||
@@ -38,6 +39,11 @@ CONFIG_DM_MMC=y
|
||||
# CONFIG_MMC_QUIRKS is not set
|
||||
CONFIG_MMC_HS400_SUPPORT=y
|
||||
CONFIG_MMC_MTK=y
|
||||
+CONFIG_DM_RESET=y
|
||||
+CONFIG_RESET_MEDIATEK=y
|
||||
+CONFIG_PHY_FIXED=y
|
||||
+CONFIG_DM_ETH=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
CONFIG_PINCTRL=y
|
||||
CONFIG_PINCONF=y
|
||||
CONFIG_PINCTRL_MT7623=y
|
||||
diff --git a/include/configs/mt7623.h b/include/configs/mt7623.h
|
||||
index fb6ac073..7d26debb 100644
|
||||
--- a/include/configs/mt7623.h
|
||||
+++ b/include/configs/mt7623.h
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
/* Size of malloc() pool */
|
||||
#define CONFIG_SYS_MALLOC_LEN SZ_4M
|
||||
+#define CONFIG_SYS_NONCACHED_MEMORY SZ_1M
|
||||
|
||||
/* Environment */
|
||||
#define CONFIG_ENV_SIZE SZ_4K
|
||||
@@ -56,4 +57,8 @@
|
||||
#define CONFIG_SYS_MMC_ENV_DEV 0
|
||||
#define CONFIG_ENV_OFFSET 0x100000
|
||||
|
||||
+/* Ethernet */
|
||||
+#define CONFIG_IPADDR 192.168.1.1
|
||||
+#define CONFIG_SERVERIP 192.168.1.2
|
||||
+
|
||||
#endif
|
||||
--
|
||||
1.8.3.1
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
From 0fcb7ab842170e1ea7e9bf4d309af584b1e54388 Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Thu, 20 Dec 2018 16:12:57 +0800
|
||||
Subject: arm: MediaTek: add ethernet support for MT7629 boards
|
||||
|
||||
Enable ethernet related configs to mt7629_rfb_defconfig.
|
||||
Add default IP addresses.
|
||||
Enable noncached memory region required by ethernet driver.
|
||||
|
||||
Signed-off-by: Mark Lee <Mark-MC.Lee@mediatek.com>
|
||||
|
||||
diff --git a/configs/mt7629_rfb_defconfig b/configs/mt7629_rfb_defconfig
|
||||
index 1729d13c..fdd5f575 100644
|
||||
--- a/configs/mt7629_rfb_defconfig
|
||||
+++ b/configs/mt7629_rfb_defconfig
|
||||
@@ -32,6 +32,7 @@ CONFIG_CMD_PING=y
|
||||
CONFIG_OF_EMBED=y
|
||||
CONFIG_DEFAULT_DEVICE_TREE="mt7629-rfb"
|
||||
CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-parents"
|
||||
+CONFIG_NET_RANDOM_ETHADDR=y
|
||||
CONFIG_SPL_DM_SEQ_ALIAS=y
|
||||
CONFIG_REGMAP=y
|
||||
CONFIG_SPL_REGMAP=y
|
||||
@@ -51,6 +52,10 @@ CONFIG_SPI_FLASH_MACRONIX=y
|
||||
CONFIG_SPI_FLASH_SPANSION=y
|
||||
CONFIG_SPI_FLASH_STMICRO=y
|
||||
CONFIG_SPI_FLASH_WINBOND=y
|
||||
+CONFIG_DM_RESET=y
|
||||
+CONFIG_RESET_MEDIATEK=y
|
||||
+CONFIG_DM_ETH=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
CONFIG_PINCTRL=y
|
||||
CONFIG_PINCONF=y
|
||||
CONFIG_PINCTRL_MT7629=y
|
||||
diff --git a/include/configs/mt7629.h b/include/configs/mt7629.h
|
||||
index a665a5eb..9910d8c8 100644
|
||||
--- a/include/configs/mt7629.h
|
||||
+++ b/include/configs/mt7629.h
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
/* Size of malloc() pool */
|
||||
#define CONFIG_SYS_MALLOC_LEN SZ_4M
|
||||
+#define CONFIG_SYS_NONCACHED_MEMORY SZ_1M
|
||||
|
||||
/* Environment */
|
||||
#define CONFIG_ENV_SIZE SZ_4K
|
||||
@@ -54,4 +55,8 @@
|
||||
/* DRAM */
|
||||
#define CONFIG_SYS_SDRAM_BASE 0x40000000
|
||||
|
||||
+/* Ethernet */
|
||||
+#define CONFIG_IPADDR 192.168.1.1
|
||||
+#define CONFIG_SERVERIP 192.168.1.2
|
||||
+
|
||||
#endif
|
||||
--
|
||||
1.8.3.1
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
From 31ca82655b5f623303e45508a820205b071df258 Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Thu, 20 Dec 2018 16:12:58 +0800
|
||||
Subject: MAINTAINERS: ARM MEDIATEK: update file entries
|
||||
|
||||
This patch adds new file entries for MediaTek SoCs
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
|
||||
diff --git a/MAINTAINERS b/MAINTAINERS
|
||||
index f86fdf9c..e192db07 100644
|
||||
--- a/MAINTAINERS
|
||||
+++ b/MAINTAINERS
|
||||
@@ -176,6 +176,8 @@ F: drivers/ram/mediatek/
|
||||
F: drivers/spi/mtk_qspi.c
|
||||
F: drivers/timer/mtk_timer.c
|
||||
F: drivers/watchdog/mtk_wdt.c
|
||||
+F: drivers/net/mtk_eth.c
|
||||
+F: drivers/reset/reset-mediatek.c
|
||||
F: tools/mtk_image.c
|
||||
F: tools/mtk_image.h
|
||||
N: mediatek
|
||||
--
|
||||
1.8.3.1
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
From d4b93c443372d651bd6f8b78070c54338ee35b91 Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Thu, 20 Dec 2018 16:12:59 +0800
|
||||
Subject: configs: MediaTek: use OF_SEPARATE instead of OF_EMBED
|
||||
|
||||
This patch replace OF_EMBED with OF_SEPARATE of defconfig files of
|
||||
MediaTek boards because now OF_EMBED is only used for debugging purpose.
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Reviewed-by: Simon Glass <sjg@chromium.org>
|
||||
|
||||
diff --git a/configs/mt7623n_bpir2_defconfig b/configs/mt7623n_bpir2_defconfig
|
||||
index bb67f328..a9f4506e 100644
|
||||
--- a/configs/mt7623n_bpir2_defconfig
|
||||
+++ b/configs/mt7623n_bpir2_defconfig
|
||||
@@ -27,7 +27,7 @@ CONFIG_CMD_READ=y
|
||||
CONFIG_CMD_PING=y
|
||||
CONFIG_CMD_FAT=y
|
||||
CONFIG_CMD_FS_GENERIC=y
|
||||
-CONFIG_OF_EMBED=y
|
||||
+CONFIG_OF_SEPARATE=y
|
||||
CONFIG_DEFAULT_DEVICE_TREE="mt7623n-bananapi-bpi-r2"
|
||||
CONFIG_NET_RANDOM_ETHADDR=y
|
||||
CONFIG_REGMAP=y
|
||||
diff --git a/configs/mt7629_rfb_defconfig b/configs/mt7629_rfb_defconfig
|
||||
index fdd5f575..1da9932d 100644
|
||||
--- a/configs/mt7629_rfb_defconfig
|
||||
+++ b/configs/mt7629_rfb_defconfig
|
||||
@@ -29,7 +29,7 @@ CONFIG_CMD_SF_TEST=y
|
||||
# CONFIG_CMD_NFS is not set
|
||||
CONFIG_CMD_PING=y
|
||||
# CONFIG_PARTITIONS is not set
|
||||
-CONFIG_OF_EMBED=y
|
||||
+CONFIG_OF_SEPARATE=y
|
||||
CONFIG_DEFAULT_DEVICE_TREE="mt7629-rfb"
|
||||
CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-parents"
|
||||
CONFIG_NET_RANDOM_ETHADDR=y
|
||||
--
|
||||
1.8.3.1
|
||||
|
|
@ -1,326 +0,0 @@
|
|||
From d6755b9b0e59ea0193914e169f74df51d556fbb7 Mon Sep 17 00:00:00 2001
|
||||
From: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
|
||||
Date: Mon, 14 Jan 2019 22:38:14 +0100
|
||||
Subject: test: add test for lib/lmb.c
|
||||
|
||||
Add basic tests for the lmb memory allocation code used to reserve and
|
||||
allocate memory during boot.
|
||||
|
||||
Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
|
||||
Reviewed-by: Simon Glass <sjg@chromium.org>
|
||||
|
||||
diff --git a/test/lib/Makefile b/test/lib/Makefile
|
||||
index ea68fae5..5a636aac 100644
|
||||
--- a/test/lib/Makefile
|
||||
+++ b/test/lib/Makefile
|
||||
@@ -3,3 +3,4 @@
|
||||
# (C) Copyright 2018
|
||||
# Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc
|
||||
obj-y += hexdump.o
|
||||
+obj-y += lmb.o
|
||||
diff --git a/test/lib/lmb.c b/test/lib/lmb.c
|
||||
new file mode 100644
|
||||
index 00000000..dd7ba14b
|
||||
--- /dev/null
|
||||
+++ b/test/lib/lmb.c
|
||||
@@ -0,0 +1,297 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0+
|
||||
+/*
|
||||
+ * (C) Copyright 2018 Simon Goldschmidt
|
||||
+ */
|
||||
+
|
||||
+#include <common.h>
|
||||
+#include <lmb.h>
|
||||
+#include <dm/test.h>
|
||||
+#include <test/ut.h>
|
||||
+
|
||||
+static int check_lmb(struct unit_test_state *uts, struct lmb *lmb,
|
||||
+ phys_addr_t ram_base, phys_size_t ram_size,
|
||||
+ unsigned long num_reserved,
|
||||
+ phys_addr_t base1, phys_size_t size1,
|
||||
+ phys_addr_t base2, phys_size_t size2,
|
||||
+ phys_addr_t base3, phys_size_t size3)
|
||||
+{
|
||||
+ ut_asserteq(lmb->memory.cnt, 1);
|
||||
+ ut_asserteq(lmb->memory.region[0].base, ram_base);
|
||||
+ ut_asserteq(lmb->memory.region[0].size, ram_size);
|
||||
+
|
||||
+ ut_asserteq(lmb->reserved.cnt, num_reserved);
|
||||
+ if (num_reserved > 0) {
|
||||
+ ut_asserteq(lmb->reserved.region[0].base, base1);
|
||||
+ ut_asserteq(lmb->reserved.region[0].size, size1);
|
||||
+ }
|
||||
+ if (num_reserved > 1) {
|
||||
+ ut_asserteq(lmb->reserved.region[1].base, base2);
|
||||
+ ut_asserteq(lmb->reserved.region[1].size, size2);
|
||||
+ }
|
||||
+ if (num_reserved > 2) {
|
||||
+ ut_asserteq(lmb->reserved.region[2].base, base3);
|
||||
+ ut_asserteq(lmb->reserved.region[2].size, size3);
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#define ASSERT_LMB(lmb, ram_base, ram_size, num_reserved, base1, size1, \
|
||||
+ base2, size2, base3, size3) \
|
||||
+ ut_assert(!check_lmb(uts, lmb, ram_base, ram_size, \
|
||||
+ num_reserved, base1, size1, base2, size2, base3, \
|
||||
+ size3))
|
||||
+
|
||||
+/*
|
||||
+ * Test helper function that reserves 64 KiB somewhere in the simulated RAM and
|
||||
+ * then does some alloc + free tests.
|
||||
+ */
|
||||
+static int test_multi_alloc(struct unit_test_state *uts,
|
||||
+ const phys_addr_t ram, const phys_size_t ram_size,
|
||||
+ const phys_addr_t alloc_64k_addr)
|
||||
+{
|
||||
+ const phys_addr_t ram_end = ram + ram_size;
|
||||
+ const phys_addr_t alloc_64k_end = alloc_64k_addr + 0x10000;
|
||||
+
|
||||
+ struct lmb lmb;
|
||||
+ long ret;
|
||||
+ phys_addr_t a, a2, b, b2, c, d;
|
||||
+
|
||||
+ /* check for overflow */
|
||||
+ ut_assert(ram_end == 0 || ram_end > ram);
|
||||
+ ut_assert(alloc_64k_end > alloc_64k_addr);
|
||||
+ /* check input addresses + size */
|
||||
+ ut_assert(alloc_64k_addr >= ram + 8);
|
||||
+ ut_assert(alloc_64k_end <= ram_end - 8);
|
||||
+
|
||||
+ lmb_init(&lmb);
|
||||
+
|
||||
+ ret = lmb_add(&lmb, ram, ram_size);
|
||||
+ ut_asserteq(ret, 0);
|
||||
+
|
||||
+ /* reserve 64KiB somewhere */
|
||||
+ ret = lmb_reserve(&lmb, alloc_64k_addr, 0x10000);
|
||||
+ ut_asserteq(ret, 0);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 1, alloc_64k_addr, 0x10000,
|
||||
+ 0, 0, 0, 0);
|
||||
+
|
||||
+ /* allocate somewhere, should be at the end of RAM */
|
||||
+ a = lmb_alloc(&lmb, 4, 1);
|
||||
+ ut_asserteq(a, ram_end - 4);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 2, alloc_64k_addr, 0x10000,
|
||||
+ ram_end - 4, 4, 0, 0);
|
||||
+ /* alloc below end of reserved region -> below reserved region */
|
||||
+ b = lmb_alloc_base(&lmb, 4, 1, alloc_64k_end);
|
||||
+ ut_asserteq(b, alloc_64k_addr - 4);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 2,
|
||||
+ alloc_64k_addr - 4, 0x10000 + 4, ram_end - 4, 4, 0, 0);
|
||||
+
|
||||
+ /* 2nd time */
|
||||
+ c = lmb_alloc(&lmb, 4, 1);
|
||||
+ ut_asserteq(c, ram_end - 8);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 2,
|
||||
+ alloc_64k_addr - 4, 0x10000 + 4, ram_end - 8, 8, 0, 0);
|
||||
+ d = lmb_alloc_base(&lmb, 4, 1, alloc_64k_end);
|
||||
+ ut_asserteq(d, alloc_64k_addr - 8);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 2,
|
||||
+ alloc_64k_addr - 8, 0x10000 + 8, ram_end - 8, 8, 0, 0);
|
||||
+
|
||||
+ ret = lmb_free(&lmb, a, 4);
|
||||
+ ut_asserteq(ret, 0);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 2,
|
||||
+ alloc_64k_addr - 8, 0x10000 + 8, ram_end - 8, 4, 0, 0);
|
||||
+ /* allocate again to ensure we get the same address */
|
||||
+ a2 = lmb_alloc(&lmb, 4, 1);
|
||||
+ ut_asserteq(a, a2);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 2,
|
||||
+ alloc_64k_addr - 8, 0x10000 + 8, ram_end - 8, 8, 0, 0);
|
||||
+ ret = lmb_free(&lmb, a2, 4);
|
||||
+ ut_asserteq(ret, 0);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 2,
|
||||
+ alloc_64k_addr - 8, 0x10000 + 8, ram_end - 8, 4, 0, 0);
|
||||
+
|
||||
+ ret = lmb_free(&lmb, b, 4);
|
||||
+ ut_asserteq(ret, 0);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 3,
|
||||
+ alloc_64k_addr - 8, 4, alloc_64k_addr, 0x10000,
|
||||
+ ram_end - 8, 4);
|
||||
+ /* allocate again to ensure we get the same address */
|
||||
+ b2 = lmb_alloc_base(&lmb, 4, 1, alloc_64k_end);
|
||||
+ ut_asserteq(b, b2);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 2,
|
||||
+ alloc_64k_addr - 8, 0x10000 + 8, ram_end - 8, 4, 0, 0);
|
||||
+ ret = lmb_free(&lmb, b2, 4);
|
||||
+ ut_asserteq(ret, 0);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 3,
|
||||
+ alloc_64k_addr - 8, 4, alloc_64k_addr, 0x10000,
|
||||
+ ram_end - 8, 4);
|
||||
+
|
||||
+ ret = lmb_free(&lmb, c, 4);
|
||||
+ ut_asserteq(ret, 0);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 2,
|
||||
+ alloc_64k_addr - 8, 4, alloc_64k_addr, 0x10000, 0, 0);
|
||||
+ ret = lmb_free(&lmb, d, 4);
|
||||
+ ut_asserteq(ret, 0);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 1, alloc_64k_addr, 0x10000,
|
||||
+ 0, 0, 0, 0);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int test_multi_alloc_512mb(struct unit_test_state *uts,
|
||||
+ const phys_addr_t ram)
|
||||
+{
|
||||
+ return test_multi_alloc(uts, ram, 0x20000000, ram + 0x10000000);
|
||||
+}
|
||||
+
|
||||
+/* Create a memory region with one reserved region and allocate */
|
||||
+static int lib_test_lmb_simple(struct unit_test_state *uts)
|
||||
+{
|
||||
+ /* simulate 512 MiB RAM beginning at 1GiB */
|
||||
+ return test_multi_alloc_512mb(uts, 0x40000000);
|
||||
+}
|
||||
+
|
||||
+DM_TEST(lib_test_lmb_simple, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
|
||||
+
|
||||
+/* Simulate 512 MiB RAM, allocate some blocks that fit/don't fit */
|
||||
+static int test_bigblock(struct unit_test_state *uts, const phys_addr_t ram)
|
||||
+{
|
||||
+ const phys_size_t ram_size = 0x20000000;
|
||||
+ const phys_size_t big_block_size = 0x10000000;
|
||||
+ const phys_addr_t ram_end = ram + ram_size;
|
||||
+ const phys_addr_t alloc_64k_addr = ram + 0x10000000;
|
||||
+ struct lmb lmb;
|
||||
+ long ret;
|
||||
+ phys_addr_t a, b;
|
||||
+
|
||||
+ /* check for overflow */
|
||||
+ ut_assert(ram_end == 0 || ram_end > ram);
|
||||
+
|
||||
+ lmb_init(&lmb);
|
||||
+
|
||||
+ ret = lmb_add(&lmb, ram, ram_size);
|
||||
+ ut_asserteq(ret, 0);
|
||||
+
|
||||
+ /* reserve 64KiB in the middle of RAM */
|
||||
+ ret = lmb_reserve(&lmb, alloc_64k_addr, 0x10000);
|
||||
+ ut_asserteq(ret, 0);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 1, alloc_64k_addr, 0x10000,
|
||||
+ 0, 0, 0, 0);
|
||||
+
|
||||
+ /* allocate a big block, should be below reserved */
|
||||
+ a = lmb_alloc(&lmb, big_block_size, 1);
|
||||
+ ut_asserteq(a, ram);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 1, a,
|
||||
+ big_block_size + 0x10000, 0, 0, 0, 0);
|
||||
+ /* allocate 2nd big block */
|
||||
+ /* This should fail, printing an error */
|
||||
+ b = lmb_alloc(&lmb, big_block_size, 1);
|
||||
+ ut_asserteq(b, 0);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 1, a,
|
||||
+ big_block_size + 0x10000, 0, 0, 0, 0);
|
||||
+
|
||||
+ ret = lmb_free(&lmb, a, big_block_size);
|
||||
+ ut_asserteq(ret, 0);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 1, alloc_64k_addr, 0x10000,
|
||||
+ 0, 0, 0, 0);
|
||||
+
|
||||
+ /* allocate too big block */
|
||||
+ /* This should fail, printing an error */
|
||||
+ a = lmb_alloc(&lmb, ram_size, 1);
|
||||
+ ut_asserteq(a, 0);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 1, alloc_64k_addr, 0x10000,
|
||||
+ 0, 0, 0, 0);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int lib_test_lmb_big(struct unit_test_state *uts)
|
||||
+{
|
||||
+ return test_bigblock(uts, 0x40000000);
|
||||
+}
|
||||
+
|
||||
+DM_TEST(lib_test_lmb_big, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
|
||||
+
|
||||
+/* Simulate 512 MiB RAM, allocate a block without previous reservation */
|
||||
+static int test_noreserved(struct unit_test_state *uts, const phys_addr_t ram)
|
||||
+{
|
||||
+ const phys_size_t ram_size = 0x20000000;
|
||||
+ const phys_addr_t ram_end = ram + ram_size;
|
||||
+ struct lmb lmb;
|
||||
+ long ret;
|
||||
+ phys_addr_t a, b;
|
||||
+
|
||||
+ /* check for overflow */
|
||||
+ ut_assert(ram_end == 0 || ram_end > ram);
|
||||
+
|
||||
+ lmb_init(&lmb);
|
||||
+
|
||||
+ ret = lmb_add(&lmb, ram, ram_size);
|
||||
+ ut_asserteq(ret, 0);
|
||||
+
|
||||
+ /* allocate a block */
|
||||
+ a = lmb_alloc(&lmb, 4, 1);
|
||||
+ ut_assert(a != 0);
|
||||
+ /* and free it */
|
||||
+ ret = lmb_free(&lmb, a, 4);
|
||||
+ ut_asserteq(ret, 0);
|
||||
+
|
||||
+ /* allocate a block with base*/
|
||||
+ b = lmb_alloc_base(&lmb, 4, 1, ram_end);
|
||||
+ ut_assert(a == b);
|
||||
+ /* and free it */
|
||||
+ ret = lmb_free(&lmb, b, 4);
|
||||
+ ut_asserteq(ret, 0);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int lib_test_lmb_noreserved(struct unit_test_state *uts)
|
||||
+{
|
||||
+ return test_noreserved(uts, 0x40000000);
|
||||
+}
|
||||
+
|
||||
+DM_TEST(lib_test_lmb_noreserved, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
|
||||
+
|
||||
+/*
|
||||
+ * Simulate a RAM that starts at 0 and allocate down to address 0, which must
|
||||
+ * fail as '0' means failure for the lmb_alloc functions.
|
||||
+ */
|
||||
+static int lib_test_lmb_at_0(struct unit_test_state *uts)
|
||||
+{
|
||||
+ const phys_addr_t ram = 0;
|
||||
+ const phys_size_t ram_size = 0x20000000;
|
||||
+ struct lmb lmb;
|
||||
+ long ret;
|
||||
+ phys_addr_t a, b;
|
||||
+
|
||||
+ lmb_init(&lmb);
|
||||
+
|
||||
+ ret = lmb_add(&lmb, ram, ram_size);
|
||||
+ ut_asserteq(ret, 0);
|
||||
+
|
||||
+ /* allocate nearly everything */
|
||||
+ a = lmb_alloc(&lmb, ram_size - 4, 1);
|
||||
+ ut_asserteq(a, ram + 4);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 1, a, ram_size - 4,
|
||||
+ 0, 0, 0, 0);
|
||||
+ /* allocate the rest */
|
||||
+ /* This should fail as the allocated address would be 0 */
|
||||
+ b = lmb_alloc(&lmb, 4, 1);
|
||||
+ ut_asserteq(b, 0);
|
||||
+ /* check that this was an error by checking lmb */
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 1, a, ram_size - 4,
|
||||
+ 0, 0, 0, 0);
|
||||
+ /* check that this was an error by freeing b */
|
||||
+ ret = lmb_free(&lmb, b, 4);
|
||||
+ ut_asserteq(ret, -1);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 1, a, ram_size - 4,
|
||||
+ 0, 0, 0, 0);
|
||||
+
|
||||
+ ret = lmb_free(&lmb, a, ram_size - 4);
|
||||
+ ut_asserteq(ret, 0);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 0, 0, 0, 0, 0, 0, 0);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+DM_TEST(lib_test_lmb_at_0, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
|
||||
--
|
||||
1.8.3.1
|
||||
|
|
@ -1,157 +0,0 @@
|
|||
From 8d8854693b9a288c6dbcf5382e74e6ce05839b33 Mon Sep 17 00:00:00 2001
|
||||
From: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
|
||||
Date: Mon, 14 Jan 2019 22:38:15 +0100
|
||||
Subject: lmb: fix allocation at end of address range
|
||||
|
||||
The lmb code fails if base + size of RAM overflows to zero.
|
||||
|
||||
Fix this by calculating end as 'base + size - 1' instead of 'base + size'
|
||||
where appropriate.
|
||||
|
||||
Added tests to assert this is fixed.
|
||||
|
||||
Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
|
||||
|
||||
diff --git a/lib/lmb.c b/lib/lmb.c
|
||||
index 17054173..6d3dcf4e 100644
|
||||
--- a/lib/lmb.c
|
||||
+++ b/lib/lmb.c
|
||||
@@ -43,7 +43,10 @@ void lmb_dump_all(struct lmb *lmb)
|
||||
static long lmb_addrs_overlap(phys_addr_t base1,
|
||||
phys_size_t size1, phys_addr_t base2, phys_size_t size2)
|
||||
{
|
||||
- return ((base1 < (base2+size2)) && (base2 < (base1+size1)));
|
||||
+ const phys_addr_t base1_end = base1 + size1 - 1;
|
||||
+ const phys_addr_t base2_end = base2 + size2 - 1;
|
||||
+
|
||||
+ return ((base1 <= base2_end) && (base2 <= base1_end));
|
||||
}
|
||||
|
||||
static long lmb_addrs_adjacent(phys_addr_t base1, phys_size_t size1,
|
||||
@@ -89,18 +92,9 @@ static void lmb_coalesce_regions(struct lmb_region *rgn,
|
||||
|
||||
void lmb_init(struct lmb *lmb)
|
||||
{
|
||||
- /* Create a dummy zero size LMB which will get coalesced away later.
|
||||
- * This simplifies the lmb_add() code below...
|
||||
- */
|
||||
- lmb->memory.region[0].base = 0;
|
||||
- lmb->memory.region[0].size = 0;
|
||||
- lmb->memory.cnt = 1;
|
||||
+ lmb->memory.cnt = 0;
|
||||
lmb->memory.size = 0;
|
||||
-
|
||||
- /* Ditto. */
|
||||
- lmb->reserved.region[0].base = 0;
|
||||
- lmb->reserved.region[0].size = 0;
|
||||
- lmb->reserved.cnt = 1;
|
||||
+ lmb->reserved.cnt = 0;
|
||||
lmb->reserved.size = 0;
|
||||
}
|
||||
|
||||
@@ -110,9 +104,10 @@ static long lmb_add_region(struct lmb_region *rgn, phys_addr_t base, phys_size_t
|
||||
unsigned long coalesced = 0;
|
||||
long adjacent, i;
|
||||
|
||||
- if ((rgn->cnt == 1) && (rgn->region[0].size == 0)) {
|
||||
+ if (rgn->cnt == 0) {
|
||||
rgn->region[0].base = base;
|
||||
rgn->region[0].size = size;
|
||||
+ rgn->cnt = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -183,7 +178,7 @@ long lmb_free(struct lmb *lmb, phys_addr_t base, phys_size_t size)
|
||||
{
|
||||
struct lmb_region *rgn = &(lmb->reserved);
|
||||
phys_addr_t rgnbegin, rgnend;
|
||||
- phys_addr_t end = base + size;
|
||||
+ phys_addr_t end = base + size - 1;
|
||||
int i;
|
||||
|
||||
rgnbegin = rgnend = 0; /* supress gcc warnings */
|
||||
@@ -191,7 +186,7 @@ long lmb_free(struct lmb *lmb, phys_addr_t base, phys_size_t size)
|
||||
/* Find the region where (base, size) belongs to */
|
||||
for (i=0; i < rgn->cnt; i++) {
|
||||
rgnbegin = rgn->region[i].base;
|
||||
- rgnend = rgnbegin + rgn->region[i].size;
|
||||
+ rgnend = rgnbegin + rgn->region[i].size - 1;
|
||||
|
||||
if ((rgnbegin <= base) && (end <= rgnend))
|
||||
break;
|
||||
@@ -209,7 +204,7 @@ long lmb_free(struct lmb *lmb, phys_addr_t base, phys_size_t size)
|
||||
|
||||
/* Check to see if region is matching at the front */
|
||||
if (rgnbegin == base) {
|
||||
- rgn->region[i].base = end;
|
||||
+ rgn->region[i].base = end + 1;
|
||||
rgn->region[i].size -= size;
|
||||
return 0;
|
||||
}
|
||||
@@ -225,7 +220,7 @@ long lmb_free(struct lmb *lmb, phys_addr_t base, phys_size_t size)
|
||||
* beginging of the hole and add the region after hole.
|
||||
*/
|
||||
rgn->region[i].size = base - rgn->region[i].base;
|
||||
- return lmb_add_region(rgn, end, rgnend - end);
|
||||
+ return lmb_add_region(rgn, end + 1, rgnend - end);
|
||||
}
|
||||
|
||||
long lmb_reserve(struct lmb *lmb, phys_addr_t base, phys_size_t size)
|
||||
diff --git a/test/lib/lmb.c b/test/lib/lmb.c
|
||||
index dd7ba14b..fb7ca45e 100644
|
||||
--- a/test/lib/lmb.c
|
||||
+++ b/test/lib/lmb.c
|
||||
@@ -146,8 +146,15 @@ static int test_multi_alloc_512mb(struct unit_test_state *uts,
|
||||
/* Create a memory region with one reserved region and allocate */
|
||||
static int lib_test_lmb_simple(struct unit_test_state *uts)
|
||||
{
|
||||
+ int ret;
|
||||
+
|
||||
/* simulate 512 MiB RAM beginning at 1GiB */
|
||||
- return test_multi_alloc_512mb(uts, 0x40000000);
|
||||
+ ret = test_multi_alloc_512mb(uts, 0x40000000);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ /* simulate 512 MiB RAM beginning at 1.5GiB */
|
||||
+ return test_multi_alloc_512mb(uts, 0xE0000000);
|
||||
}
|
||||
|
||||
DM_TEST(lib_test_lmb_simple, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
|
||||
@@ -206,7 +213,15 @@ static int test_bigblock(struct unit_test_state *uts, const phys_addr_t ram)
|
||||
|
||||
static int lib_test_lmb_big(struct unit_test_state *uts)
|
||||
{
|
||||
- return test_bigblock(uts, 0x40000000);
|
||||
+ int ret;
|
||||
+
|
||||
+ /* simulate 512 MiB RAM beginning at 1GiB */
|
||||
+ ret = test_bigblock(uts, 0x40000000);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ /* simulate 512 MiB RAM beginning at 1.5GiB */
|
||||
+ return test_bigblock(uts, 0xE0000000);
|
||||
}
|
||||
|
||||
DM_TEST(lib_test_lmb_big, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
|
||||
@@ -247,7 +262,15 @@ static int test_noreserved(struct unit_test_state *uts, const phys_addr_t ram)
|
||||
|
||||
static int lib_test_lmb_noreserved(struct unit_test_state *uts)
|
||||
{
|
||||
- return test_noreserved(uts, 0x40000000);
|
||||
+ int ret;
|
||||
+
|
||||
+ /* simulate 512 MiB RAM beginning at 1GiB */
|
||||
+ ret = test_noreserved(uts, 0x40000000);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ /* simulate 512 MiB RAM beginning at 1.5GiB */
|
||||
+ return test_noreserved(uts, 0xE0000000);
|
||||
}
|
||||
|
||||
DM_TEST(lib_test_lmb_noreserved, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
|
||||
--
|
||||
1.8.3.1
|
||||
|
|
@ -1,208 +0,0 @@
|
|||
From 0b66765ffcdc995177753b7e6607be477593041e Mon Sep 17 00:00:00 2001
|
||||
From: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
|
||||
Date: Mon, 14 Jan 2019 22:38:16 +0100
|
||||
Subject: lib: lmb: reserving overlapping regions should fail
|
||||
|
||||
lmb_add_region handles overlapping regions wrong: instead of merging
|
||||
or rejecting to add a new reserved region that overlaps an existing
|
||||
one, it just adds the new region.
|
||||
|
||||
Since internally the same function is used for lmb_alloc, change
|
||||
lmb_add_region to reject overlapping regions.
|
||||
|
||||
Also, to keep reserved memory correct after 'free', reserved entries
|
||||
created by allocating memory must not set their size to a multiple
|
||||
of alignment but to the original size. This ensures the reserved
|
||||
region is completely removed when the caller calls 'lmb_free', as
|
||||
this one takes the same size as passed to 'lmb_alloc' etc.
|
||||
|
||||
Add test to assert this.
|
||||
|
||||
Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
|
||||
|
||||
diff --git a/lib/lmb.c b/lib/lmb.c
|
||||
index 6d3dcf4e..cd297f82 100644
|
||||
--- a/lib/lmb.c
|
||||
+++ b/lib/lmb.c
|
||||
@@ -131,6 +131,9 @@ static long lmb_add_region(struct lmb_region *rgn, phys_addr_t base, phys_size_t
|
||||
rgn->region[i].size += size;
|
||||
coalesced++;
|
||||
break;
|
||||
+ } else if (lmb_addrs_overlap(base, size, rgnbase, rgnsize)) {
|
||||
+ /* regions overlap */
|
||||
+ return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -269,11 +272,6 @@ static phys_addr_t lmb_align_down(phys_addr_t addr, phys_size_t size)
|
||||
return addr & ~(size - 1);
|
||||
}
|
||||
|
||||
-static phys_addr_t lmb_align_up(phys_addr_t addr, ulong size)
|
||||
-{
|
||||
- return (addr + (size - 1)) & ~(size - 1);
|
||||
-}
|
||||
-
|
||||
phys_addr_t __lmb_alloc_base(struct lmb *lmb, phys_size_t size, ulong align, phys_addr_t max_addr)
|
||||
{
|
||||
long i, j;
|
||||
@@ -302,8 +300,7 @@ phys_addr_t __lmb_alloc_base(struct lmb *lmb, phys_size_t size, ulong align, phy
|
||||
if (j < 0) {
|
||||
/* This area isn't reserved, take it */
|
||||
if (lmb_add_region(&lmb->reserved, base,
|
||||
- lmb_align_up(size,
|
||||
- align)) < 0)
|
||||
+ size) < 0)
|
||||
return 0;
|
||||
return base;
|
||||
}
|
||||
diff --git a/test/lib/lmb.c b/test/lib/lmb.c
|
||||
index fb7ca45e..e6acb70e 100644
|
||||
--- a/test/lib/lmb.c
|
||||
+++ b/test/lib/lmb.c
|
||||
@@ -227,13 +227,16 @@ static int lib_test_lmb_big(struct unit_test_state *uts)
|
||||
DM_TEST(lib_test_lmb_big, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
|
||||
|
||||
/* Simulate 512 MiB RAM, allocate a block without previous reservation */
|
||||
-static int test_noreserved(struct unit_test_state *uts, const phys_addr_t ram)
|
||||
+static int test_noreserved(struct unit_test_state *uts, const phys_addr_t ram,
|
||||
+ const phys_addr_t alloc_size, const ulong align)
|
||||
{
|
||||
const phys_size_t ram_size = 0x20000000;
|
||||
const phys_addr_t ram_end = ram + ram_size;
|
||||
struct lmb lmb;
|
||||
long ret;
|
||||
phys_addr_t a, b;
|
||||
+ const phys_addr_t alloc_size_aligned = (alloc_size + align - 1) &
|
||||
+ ~(align - 1);
|
||||
|
||||
/* check for overflow */
|
||||
ut_assert(ram_end == 0 || ram_end > ram);
|
||||
@@ -242,20 +245,43 @@ static int test_noreserved(struct unit_test_state *uts, const phys_addr_t ram)
|
||||
|
||||
ret = lmb_add(&lmb, ram, ram_size);
|
||||
ut_asserteq(ret, 0);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 0, 0, 0, 0, 0, 0, 0);
|
||||
|
||||
/* allocate a block */
|
||||
- a = lmb_alloc(&lmb, 4, 1);
|
||||
+ a = lmb_alloc(&lmb, alloc_size, align);
|
||||
ut_assert(a != 0);
|
||||
- /* and free it */
|
||||
- ret = lmb_free(&lmb, a, 4);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 1, ram + ram_size - alloc_size_aligned,
|
||||
+ alloc_size, 0, 0, 0, 0);
|
||||
+ /* allocate another block */
|
||||
+ b = lmb_alloc(&lmb, alloc_size, align);
|
||||
+ ut_assert(b != 0);
|
||||
+ if (alloc_size == alloc_size_aligned) {
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 1, ram + ram_size -
|
||||
+ (alloc_size_aligned * 2), alloc_size * 2, 0, 0, 0,
|
||||
+ 0);
|
||||
+ } else {
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 2, ram + ram_size -
|
||||
+ (alloc_size_aligned * 2), alloc_size, ram + ram_size
|
||||
+ - alloc_size_aligned, alloc_size, 0, 0);
|
||||
+ }
|
||||
+ /* and free them */
|
||||
+ ret = lmb_free(&lmb, b, alloc_size);
|
||||
ut_asserteq(ret, 0);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 1, ram + ram_size - alloc_size_aligned,
|
||||
+ alloc_size, 0, 0, 0, 0);
|
||||
+ ret = lmb_free(&lmb, a, alloc_size);
|
||||
+ ut_asserteq(ret, 0);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 0, 0, 0, 0, 0, 0, 0);
|
||||
|
||||
/* allocate a block with base*/
|
||||
- b = lmb_alloc_base(&lmb, 4, 1, ram_end);
|
||||
+ b = lmb_alloc_base(&lmb, alloc_size, align, ram_end);
|
||||
ut_assert(a == b);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 1, ram + ram_size - alloc_size_aligned,
|
||||
+ alloc_size, 0, 0, 0, 0);
|
||||
/* and free it */
|
||||
- ret = lmb_free(&lmb, b, 4);
|
||||
+ ret = lmb_free(&lmb, b, alloc_size);
|
||||
ut_asserteq(ret, 0);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 0, 0, 0, 0, 0, 0, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -265,16 +291,30 @@ static int lib_test_lmb_noreserved(struct unit_test_state *uts)
|
||||
int ret;
|
||||
|
||||
/* simulate 512 MiB RAM beginning at 1GiB */
|
||||
- ret = test_noreserved(uts, 0x40000000);
|
||||
+ ret = test_noreserved(uts, 0x40000000, 4, 1);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/* simulate 512 MiB RAM beginning at 1.5GiB */
|
||||
- return test_noreserved(uts, 0xE0000000);
|
||||
+ return test_noreserved(uts, 0xE0000000, 4, 1);
|
||||
}
|
||||
|
||||
DM_TEST(lib_test_lmb_noreserved, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
|
||||
|
||||
+static int lib_test_lmb_unaligned_size(struct unit_test_state *uts)
|
||||
+{
|
||||
+ int ret;
|
||||
+
|
||||
+ /* simulate 512 MiB RAM beginning at 1GiB */
|
||||
+ ret = test_noreserved(uts, 0x40000000, 5, 8);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ /* simulate 512 MiB RAM beginning at 1.5GiB */
|
||||
+ return test_noreserved(uts, 0xE0000000, 5, 8);
|
||||
+}
|
||||
+
|
||||
+DM_TEST(lib_test_lmb_unaligned_size, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
|
||||
/*
|
||||
* Simulate a RAM that starts at 0 and allocate down to address 0, which must
|
||||
* fail as '0' means failure for the lmb_alloc functions.
|
||||
@@ -318,3 +358,42 @@ static int lib_test_lmb_at_0(struct unit_test_state *uts)
|
||||
}
|
||||
|
||||
DM_TEST(lib_test_lmb_at_0, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
|
||||
+
|
||||
+/* Check that calling lmb_reserve with overlapping regions fails. */
|
||||
+static int lib_test_lmb_overlapping_reserve(struct unit_test_state *uts)
|
||||
+{
|
||||
+ const phys_addr_t ram = 0x40000000;
|
||||
+ const phys_size_t ram_size = 0x20000000;
|
||||
+ struct lmb lmb;
|
||||
+ long ret;
|
||||
+
|
||||
+ lmb_init(&lmb);
|
||||
+
|
||||
+ ret = lmb_add(&lmb, ram, ram_size);
|
||||
+ ut_asserteq(ret, 0);
|
||||
+
|
||||
+ ret = lmb_reserve(&lmb, 0x40010000, 0x10000);
|
||||
+ ut_asserteq(ret, 0);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 1, 0x40010000, 0x10000,
|
||||
+ 0, 0, 0, 0);
|
||||
+ /* allocate overlapping region should fail */
|
||||
+ ret = lmb_reserve(&lmb, 0x40011000, 0x10000);
|
||||
+ ut_asserteq(ret, -1);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 1, 0x40010000, 0x10000,
|
||||
+ 0, 0, 0, 0);
|
||||
+ /* allocate 3nd region */
|
||||
+ ret = lmb_reserve(&lmb, 0x40030000, 0x10000);
|
||||
+ ut_asserteq(ret, 0);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 2, 0x40010000, 0x10000,
|
||||
+ 0x40030000, 0x10000, 0, 0);
|
||||
+ /* allocate 2nd region */
|
||||
+ ret = lmb_reserve(&lmb, 0x40020000, 0x10000);
|
||||
+ ut_assert(ret >= 0);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 1, 0x40010000, 0x30000,
|
||||
+ 0, 0, 0, 0);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+DM_TEST(lib_test_lmb_overlapping_reserve,
|
||||
+ DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
|
||||
--
|
||||
1.8.3.1
|
||||
|
|
@ -1,117 +0,0 @@
|
|||
From 83dc6df2cff9e91e77890107c74d4858182e4b61 Mon Sep 17 00:00:00 2001
|
||||
From: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
|
||||
Date: Mon, 14 Jan 2019 22:38:17 +0100
|
||||
Subject: fdt: parse "reserved-memory" for memory reservation
|
||||
|
||||
boot_fdt_add_mem_rsv_regions() adds reserved memory sections to an lmb
|
||||
struct. Currently, it only parses regions described by /memreserve/
|
||||
entries.
|
||||
|
||||
Extend this to the more commonly used scheme of the "reserved-memory"
|
||||
node.
|
||||
|
||||
Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
|
||||
Reviewed-by: Simon Glass <sjg@chromium.org>
|
||||
|
||||
diff --git a/common/image-fdt.c b/common/image-fdt.c
|
||||
index 95748f0a..5c0d6db3 100644
|
||||
--- a/common/image-fdt.c
|
||||
+++ b/common/image-fdt.c
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#include <common.h>
|
||||
#include <fdt_support.h>
|
||||
+#include <fdtdec.h>
|
||||
#include <errno.h>
|
||||
#include <image.h>
|
||||
#include <linux/libfdt.h>
|
||||
@@ -67,30 +68,66 @@ static const image_header_t *image_get_fdt(ulong fdt_addr)
|
||||
}
|
||||
#endif
|
||||
|
||||
+static void boot_fdt_reserve_region(struct lmb *lmb, uint64_t addr,
|
||||
+ uint64_t size)
|
||||
+{
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = lmb_reserve(lmb, addr, size);
|
||||
+ if (!ret) {
|
||||
+ debug(" reserving fdt memory region: addr=%llx size=%llx\n",
|
||||
+ (unsigned long long)addr, (unsigned long long)size);
|
||||
+ } else {
|
||||
+ puts("ERROR: reserving fdt memory region failed ");
|
||||
+ printf("(addr=%llx size=%llx)\n",
|
||||
+ (unsigned long long)addr, (unsigned long long)size);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
/**
|
||||
- * boot_fdt_add_mem_rsv_regions - Mark the memreserve sections as unusable
|
||||
+ * boot_fdt_add_mem_rsv_regions - Mark the memreserve and reserved-memory
|
||||
+ * sections as unusable
|
||||
* @lmb: pointer to lmb handle, will be used for memory mgmt
|
||||
* @fdt_blob: pointer to fdt blob base address
|
||||
*
|
||||
- * Adds the memreserve regions in the dtb to the lmb block. Adding the
|
||||
- * memreserve regions prevents u-boot from using them to store the initrd
|
||||
- * or the fdt blob.
|
||||
+ * Adds the and reserved-memorymemreserve regions in the dtb to the lmb block.
|
||||
+ * Adding the memreserve regions prevents u-boot from using them to store the
|
||||
+ * initrd or the fdt blob.
|
||||
*/
|
||||
void boot_fdt_add_mem_rsv_regions(struct lmb *lmb, void *fdt_blob)
|
||||
{
|
||||
uint64_t addr, size;
|
||||
- int i, total;
|
||||
+ int i, total, ret;
|
||||
+ int nodeoffset, subnode;
|
||||
+ struct fdt_resource res;
|
||||
|
||||
if (fdt_check_header(fdt_blob) != 0)
|
||||
return;
|
||||
|
||||
+ /* process memreserve sections */
|
||||
total = fdt_num_mem_rsv(fdt_blob);
|
||||
for (i = 0; i < total; i++) {
|
||||
if (fdt_get_mem_rsv(fdt_blob, i, &addr, &size) != 0)
|
||||
continue;
|
||||
- printf(" reserving fdt memory region: addr=%llx size=%llx\n",
|
||||
- (unsigned long long)addr, (unsigned long long)size);
|
||||
- lmb_reserve(lmb, addr, size);
|
||||
+ boot_fdt_reserve_region(lmb, addr, size);
|
||||
+ }
|
||||
+
|
||||
+ /* process reserved-memory */
|
||||
+ nodeoffset = fdt_subnode_offset(fdt_blob, 0, "reserved-memory");
|
||||
+ if (nodeoffset >= 0) {
|
||||
+ subnode = fdt_first_subnode(fdt_blob, nodeoffset);
|
||||
+ while (subnode >= 0) {
|
||||
+ /* check if this subnode has a reg property */
|
||||
+ ret = fdt_get_resource(fdt_blob, subnode, "reg", 0,
|
||||
+ &res);
|
||||
+ if (!ret) {
|
||||
+ addr = res.start;
|
||||
+ size = res.end - res.start + 1;
|
||||
+ boot_fdt_reserve_region(lmb, addr, size);
|
||||
+ }
|
||||
+
|
||||
+ subnode = fdt_next_subnode(fdt_blob, subnode);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/lib/Makefile b/lib/Makefile
|
||||
index a6dd928a..358789ff 100644
|
||||
--- a/lib/Makefile
|
||||
+++ b/lib/Makefile
|
||||
@@ -30,6 +30,7 @@ obj-y += crc7.o
|
||||
obj-y += crc8.o
|
||||
obj-y += crc16.o
|
||||
obj-$(CONFIG_ERRNO_STR) += errno_str.o
|
||||
+obj-$(CONFIG_OF_LIBFDT) += fdtdec.o
|
||||
obj-$(CONFIG_FIT) += fdtdec_common.o
|
||||
obj-$(CONFIG_TEST_FDTDEC) += fdtdec_test.o
|
||||
obj-$(CONFIG_GZIP_COMPRESSED) += gzip.o
|
||||
--
|
||||
1.8.3.1
|
||||
|
|
@ -1,312 +0,0 @@
|
|||
From 16448a9becefd10a64601a08bbcacea38075db70 Mon Sep 17 00:00:00 2001
|
||||
From: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
|
||||
Date: Mon, 14 Jan 2019 22:38:18 +0100
|
||||
Subject: lib: lmb: extend lmb for checks at load time
|
||||
|
||||
This adds two new functions, lmb_alloc_addr and
|
||||
lmb_get_unreserved_size.
|
||||
|
||||
lmb_alloc_addr behaves like lmb_alloc, but it tries to allocate a
|
||||
pre-specified address range. Unlike lmb_reserve, this address range
|
||||
must be inside one of the memory ranges that has been set up with
|
||||
lmb_add.
|
||||
|
||||
lmb_get_unreserved_size returns the number of bytes that can be
|
||||
used up to the next reserved region or the end of valid ram. This
|
||||
can be 0 if the address passed is reserved.
|
||||
|
||||
Added test for these new functions.
|
||||
|
||||
Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
|
||||
|
||||
diff --git a/include/lmb.h b/include/lmb.h
|
||||
index f04d0580..7d7e2a78 100644
|
||||
--- a/include/lmb.h
|
||||
+++ b/include/lmb.h
|
||||
@@ -38,6 +38,9 @@ extern phys_addr_t lmb_alloc_base(struct lmb *lmb, phys_size_t size, ulong align
|
||||
phys_addr_t max_addr);
|
||||
extern phys_addr_t __lmb_alloc_base(struct lmb *lmb, phys_size_t size, ulong align,
|
||||
phys_addr_t max_addr);
|
||||
+extern phys_addr_t lmb_alloc_addr(struct lmb *lmb, phys_addr_t base,
|
||||
+ phys_size_t size);
|
||||
+extern phys_size_t lmb_get_unreserved_size(struct lmb *lmb, phys_addr_t addr);
|
||||
extern int lmb_is_reserved(struct lmb *lmb, phys_addr_t addr);
|
||||
extern long lmb_free(struct lmb *lmb, phys_addr_t base, phys_size_t size);
|
||||
|
||||
diff --git a/lib/lmb.c b/lib/lmb.c
|
||||
index cd297f82..e380a0a7 100644
|
||||
--- a/lib/lmb.c
|
||||
+++ b/lib/lmb.c
|
||||
@@ -313,6 +313,59 @@ phys_addr_t __lmb_alloc_base(struct lmb *lmb, phys_size_t size, ulong align, phy
|
||||
return 0;
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * Try to allocate a specific address range: must be in defined memory but not
|
||||
+ * reserved
|
||||
+ */
|
||||
+phys_addr_t lmb_alloc_addr(struct lmb *lmb, phys_addr_t base, phys_size_t size)
|
||||
+{
|
||||
+ long j;
|
||||
+
|
||||
+ /* Check if the requested address is in one of the memory regions */
|
||||
+ j = lmb_overlaps_region(&lmb->memory, base, size);
|
||||
+ if (j >= 0) {
|
||||
+ /*
|
||||
+ * Check if the requested end address is in the same memory
|
||||
+ * region we found.
|
||||
+ */
|
||||
+ if (lmb_addrs_overlap(lmb->memory.region[j].base,
|
||||
+ lmb->memory.region[j].size, base + size -
|
||||
+ 1, 1)) {
|
||||
+ /* ok, reserve the memory */
|
||||
+ if (lmb_reserve(lmb, base, size) >= 0)
|
||||
+ return base;
|
||||
+ }
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/* Return number of bytes from a given address that are free */
|
||||
+phys_size_t lmb_get_unreserved_size(struct lmb *lmb, phys_addr_t addr)
|
||||
+{
|
||||
+ int i;
|
||||
+ long j;
|
||||
+
|
||||
+ /* check if the requested address is in the memory regions */
|
||||
+ j = lmb_overlaps_region(&lmb->memory, addr, 1);
|
||||
+ if (j >= 0) {
|
||||
+ for (i = 0; i < lmb->reserved.cnt; i++) {
|
||||
+ if (addr < lmb->reserved.region[i].base) {
|
||||
+ /* first reserved range > requested address */
|
||||
+ return lmb->reserved.region[i].base - addr;
|
||||
+ }
|
||||
+ if (lmb->reserved.region[i].base +
|
||||
+ lmb->reserved.region[i].size > addr) {
|
||||
+ /* requested addr is in this reserved range */
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+ /* if we come here: no reserved ranges above requested addr */
|
||||
+ return lmb->memory.region[lmb->memory.cnt - 1].base +
|
||||
+ lmb->memory.region[lmb->memory.cnt - 1].size - addr;
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
int lmb_is_reserved(struct lmb *lmb, phys_addr_t addr)
|
||||
{
|
||||
int i;
|
||||
diff --git a/test/lib/lmb.c b/test/lib/lmb.c
|
||||
index e6acb70e..058d3c33 100644
|
||||
--- a/test/lib/lmb.c
|
||||
+++ b/test/lib/lmb.c
|
||||
@@ -397,3 +397,205 @@ static int lib_test_lmb_overlapping_reserve(struct unit_test_state *uts)
|
||||
|
||||
DM_TEST(lib_test_lmb_overlapping_reserve,
|
||||
DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
|
||||
+
|
||||
+/*
|
||||
+ * Simulate 512 MiB RAM, reserve 3 blocks, allocate addresses in between.
|
||||
+ * Expect addresses outside the memory range to fail.
|
||||
+ */
|
||||
+static int test_alloc_addr(struct unit_test_state *uts, const phys_addr_t ram)
|
||||
+{
|
||||
+ const phys_size_t ram_size = 0x20000000;
|
||||
+ const phys_addr_t ram_end = ram + ram_size;
|
||||
+ const phys_size_t alloc_addr_a = ram + 0x8000000;
|
||||
+ const phys_size_t alloc_addr_b = ram + 0x8000000 * 2;
|
||||
+ const phys_size_t alloc_addr_c = ram + 0x8000000 * 3;
|
||||
+ struct lmb lmb;
|
||||
+ long ret;
|
||||
+ phys_addr_t a, b, c, d, e;
|
||||
+
|
||||
+ /* check for overflow */
|
||||
+ ut_assert(ram_end == 0 || ram_end > ram);
|
||||
+
|
||||
+ lmb_init(&lmb);
|
||||
+
|
||||
+ ret = lmb_add(&lmb, ram, ram_size);
|
||||
+ ut_asserteq(ret, 0);
|
||||
+
|
||||
+ /* reserve 3 blocks */
|
||||
+ ret = lmb_reserve(&lmb, alloc_addr_a, 0x10000);
|
||||
+ ut_asserteq(ret, 0);
|
||||
+ ret = lmb_reserve(&lmb, alloc_addr_b, 0x10000);
|
||||
+ ut_asserteq(ret, 0);
|
||||
+ ret = lmb_reserve(&lmb, alloc_addr_c, 0x10000);
|
||||
+ ut_asserteq(ret, 0);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 3, alloc_addr_a, 0x10000,
|
||||
+ alloc_addr_b, 0x10000, alloc_addr_c, 0x10000);
|
||||
+
|
||||
+ /* allocate blocks */
|
||||
+ a = lmb_alloc_addr(&lmb, ram, alloc_addr_a - ram);
|
||||
+ ut_asserteq(a, ram);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 3, ram, 0x8010000,
|
||||
+ alloc_addr_b, 0x10000, alloc_addr_c, 0x10000);
|
||||
+ b = lmb_alloc_addr(&lmb, alloc_addr_a + 0x10000,
|
||||
+ alloc_addr_b - alloc_addr_a - 0x10000);
|
||||
+ ut_asserteq(b, alloc_addr_a + 0x10000);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 2, ram, 0x10010000,
|
||||
+ alloc_addr_c, 0x10000, 0, 0);
|
||||
+ c = lmb_alloc_addr(&lmb, alloc_addr_b + 0x10000,
|
||||
+ alloc_addr_c - alloc_addr_b - 0x10000);
|
||||
+ ut_asserteq(c, alloc_addr_b + 0x10000);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 1, ram, 0x18010000,
|
||||
+ 0, 0, 0, 0);
|
||||
+ d = lmb_alloc_addr(&lmb, alloc_addr_c + 0x10000,
|
||||
+ ram_end - alloc_addr_c - 0x10000);
|
||||
+ ut_asserteq(d, alloc_addr_c + 0x10000);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 1, ram, ram_size,
|
||||
+ 0, 0, 0, 0);
|
||||
+
|
||||
+ /* allocating anything else should fail */
|
||||
+ e = lmb_alloc(&lmb, 1, 1);
|
||||
+ ut_asserteq(e, 0);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 1, ram, ram_size,
|
||||
+ 0, 0, 0, 0);
|
||||
+
|
||||
+ ret = lmb_free(&lmb, d, ram_end - alloc_addr_c - 0x10000);
|
||||
+ ut_asserteq(ret, 0);
|
||||
+
|
||||
+ /* allocate at 3 points in free range */
|
||||
+
|
||||
+ d = lmb_alloc_addr(&lmb, ram_end - 4, 4);
|
||||
+ ut_asserteq(d, ram_end - 4);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 2, ram, 0x18010000,
|
||||
+ d, 4, 0, 0);
|
||||
+ ret = lmb_free(&lmb, d, 4);
|
||||
+ ut_asserteq(ret, 0);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 1, ram, 0x18010000,
|
||||
+ 0, 0, 0, 0);
|
||||
+
|
||||
+ d = lmb_alloc_addr(&lmb, ram_end - 128, 4);
|
||||
+ ut_asserteq(d, ram_end - 128);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 2, ram, 0x18010000,
|
||||
+ d, 4, 0, 0);
|
||||
+ ret = lmb_free(&lmb, d, 4);
|
||||
+ ut_asserteq(ret, 0);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 1, ram, 0x18010000,
|
||||
+ 0, 0, 0, 0);
|
||||
+
|
||||
+ d = lmb_alloc_addr(&lmb, alloc_addr_c + 0x10000, 4);
|
||||
+ ut_asserteq(d, alloc_addr_c + 0x10000);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 1, ram, 0x18010004,
|
||||
+ 0, 0, 0, 0);
|
||||
+ ret = lmb_free(&lmb, d, 4);
|
||||
+ ut_asserteq(ret, 0);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 1, ram, 0x18010000,
|
||||
+ 0, 0, 0, 0);
|
||||
+
|
||||
+ /* allocate at the bottom */
|
||||
+ ret = lmb_free(&lmb, a, alloc_addr_a - ram);
|
||||
+ ut_asserteq(ret, 0);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 1, ram + 0x8000000, 0x10010000,
|
||||
+ 0, 0, 0, 0);
|
||||
+ d = lmb_alloc_addr(&lmb, ram, 4);
|
||||
+ ut_asserteq(d, ram);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 2, d, 4,
|
||||
+ ram + 0x8000000, 0x10010000, 0, 0);
|
||||
+
|
||||
+ /* check that allocating outside memory fails */
|
||||
+ if (ram_end != 0) {
|
||||
+ ret = lmb_alloc_addr(&lmb, ram_end, 1);
|
||||
+ ut_asserteq(ret, 0);
|
||||
+ }
|
||||
+ if (ram != 0) {
|
||||
+ ret = lmb_alloc_addr(&lmb, ram - 1, 1);
|
||||
+ ut_asserteq(ret, 0);
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int lib_test_lmb_alloc_addr(struct unit_test_state *uts)
|
||||
+{
|
||||
+ int ret;
|
||||
+
|
||||
+ /* simulate 512 MiB RAM beginning at 1GiB */
|
||||
+ ret = test_alloc_addr(uts, 0x40000000);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ /* simulate 512 MiB RAM beginning at 1.5GiB */
|
||||
+ return test_alloc_addr(uts, 0xE0000000);
|
||||
+}
|
||||
+
|
||||
+DM_TEST(lib_test_lmb_alloc_addr, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
|
||||
+
|
||||
+/* Simulate 512 MiB RAM, reserve 3 blocks, check addresses in between */
|
||||
+static int test_get_unreserved_size(struct unit_test_state *uts,
|
||||
+ const phys_addr_t ram)
|
||||
+{
|
||||
+ const phys_size_t ram_size = 0x20000000;
|
||||
+ const phys_addr_t ram_end = ram + ram_size;
|
||||
+ const phys_size_t alloc_addr_a = ram + 0x8000000;
|
||||
+ const phys_size_t alloc_addr_b = ram + 0x8000000 * 2;
|
||||
+ const phys_size_t alloc_addr_c = ram + 0x8000000 * 3;
|
||||
+ struct lmb lmb;
|
||||
+ long ret;
|
||||
+ phys_size_t s;
|
||||
+
|
||||
+ /* check for overflow */
|
||||
+ ut_assert(ram_end == 0 || ram_end > ram);
|
||||
+
|
||||
+ lmb_init(&lmb);
|
||||
+
|
||||
+ ret = lmb_add(&lmb, ram, ram_size);
|
||||
+ ut_asserteq(ret, 0);
|
||||
+
|
||||
+ /* reserve 3 blocks */
|
||||
+ ret = lmb_reserve(&lmb, alloc_addr_a, 0x10000);
|
||||
+ ut_asserteq(ret, 0);
|
||||
+ ret = lmb_reserve(&lmb, alloc_addr_b, 0x10000);
|
||||
+ ut_asserteq(ret, 0);
|
||||
+ ret = lmb_reserve(&lmb, alloc_addr_c, 0x10000);
|
||||
+ ut_asserteq(ret, 0);
|
||||
+ ASSERT_LMB(&lmb, ram, ram_size, 3, alloc_addr_a, 0x10000,
|
||||
+ alloc_addr_b, 0x10000, alloc_addr_c, 0x10000);
|
||||
+
|
||||
+ /* check addresses in between blocks */
|
||||
+ s = lmb_get_unreserved_size(&lmb, ram);
|
||||
+ ut_asserteq(s, alloc_addr_a - ram);
|
||||
+ s = lmb_get_unreserved_size(&lmb, ram + 0x10000);
|
||||
+ ut_asserteq(s, alloc_addr_a - ram - 0x10000);
|
||||
+ s = lmb_get_unreserved_size(&lmb, alloc_addr_a - 4);
|
||||
+ ut_asserteq(s, 4);
|
||||
+
|
||||
+ s = lmb_get_unreserved_size(&lmb, alloc_addr_a + 0x10000);
|
||||
+ ut_asserteq(s, alloc_addr_b - alloc_addr_a - 0x10000);
|
||||
+ s = lmb_get_unreserved_size(&lmb, alloc_addr_a + 0x20000);
|
||||
+ ut_asserteq(s, alloc_addr_b - alloc_addr_a - 0x20000);
|
||||
+ s = lmb_get_unreserved_size(&lmb, alloc_addr_b - 4);
|
||||
+ ut_asserteq(s, 4);
|
||||
+
|
||||
+ s = lmb_get_unreserved_size(&lmb, alloc_addr_c + 0x10000);
|
||||
+ ut_asserteq(s, ram_end - alloc_addr_c - 0x10000);
|
||||
+ s = lmb_get_unreserved_size(&lmb, alloc_addr_c + 0x20000);
|
||||
+ ut_asserteq(s, ram_end - alloc_addr_c - 0x20000);
|
||||
+ s = lmb_get_unreserved_size(&lmb, ram_end - 4);
|
||||
+ ut_asserteq(s, 4);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int lib_test_lmb_get_unreserved_size(struct unit_test_state *uts)
|
||||
+{
|
||||
+ int ret;
|
||||
+
|
||||
+ /* simulate 512 MiB RAM beginning at 1GiB */
|
||||
+ ret = test_get_unreserved_size(uts, 0x40000000);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ /* simulate 512 MiB RAM beginning at 1.5GiB */
|
||||
+ return test_get_unreserved_size(uts, 0xE0000000);
|
||||
+}
|
||||
+
|
||||
+DM_TEST(lib_test_lmb_get_unreserved_size,
|
||||
+ DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
|
||||
--
|
||||
1.8.3.1
|
||||
|
|
@ -1,138 +0,0 @@
|
|||
From 94e5a755db2a72b8bdaceb634b732ed59816b5ac Mon Sep 17 00:00:00 2001
|
||||
From: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
|
||||
Date: Mon, 14 Jan 2019 22:38:19 +0100
|
||||
Subject: fs: prevent overwriting reserved memory
|
||||
|
||||
This fixes CVE-2018-18440 ("insufficient boundary checks in filesystem
|
||||
image load") by using lmb to check the load size of a file against
|
||||
reserved memory addresses.
|
||||
|
||||
Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
|
||||
Reviewed-by: Simon Glass <sjg@chromium.org>
|
||||
|
||||
diff --git a/fs/fs.c b/fs/fs.c
|
||||
index cb265174..7fd22101 100644
|
||||
--- a/fs/fs.c
|
||||
+++ b/fs/fs.c
|
||||
@@ -429,13 +429,57 @@ int fs_size(const char *filename, loff_t *size)
|
||||
return ret;
|
||||
}
|
||||
|
||||
-int fs_read(const char *filename, ulong addr, loff_t offset, loff_t len,
|
||||
- loff_t *actread)
|
||||
+#ifdef CONFIG_LMB
|
||||
+/* Check if a file may be read to the given address */
|
||||
+static int fs_read_lmb_check(const char *filename, ulong addr, loff_t offset,
|
||||
+ loff_t len, struct fstype_info *info)
|
||||
+{
|
||||
+ struct lmb lmb;
|
||||
+ int ret;
|
||||
+ loff_t size;
|
||||
+ loff_t read_len;
|
||||
+
|
||||
+ /* get the actual size of the file */
|
||||
+ ret = info->size(filename, &size);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+ if (offset >= size) {
|
||||
+ /* offset >= EOF, no bytes will be written */
|
||||
+ return 0;
|
||||
+ }
|
||||
+ read_len = size - offset;
|
||||
+
|
||||
+ /* limit to 'len' if it is smaller */
|
||||
+ if (len && len < read_len)
|
||||
+ read_len = len;
|
||||
+
|
||||
+ lmb_init_and_reserve(&lmb, gd->bd->bi_dram[0].start,
|
||||
+ gd->bd->bi_dram[0].size, (void *)gd->fdt_blob);
|
||||
+ lmb_dump_all(&lmb);
|
||||
+
|
||||
+ if (lmb_alloc_addr(&lmb, addr, read_len) == addr)
|
||||
+ return 0;
|
||||
+
|
||||
+ printf("** Reading file would overwrite reserved memory **\n");
|
||||
+ return -ENOSPC;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
+static int _fs_read(const char *filename, ulong addr, loff_t offset, loff_t len,
|
||||
+ int do_lmb_check, loff_t *actread)
|
||||
{
|
||||
struct fstype_info *info = fs_get_info(fs_type);
|
||||
void *buf;
|
||||
int ret;
|
||||
|
||||
+#ifdef CONFIG_LMB
|
||||
+ if (do_lmb_check) {
|
||||
+ ret = fs_read_lmb_check(filename, addr, offset, len, info);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
/*
|
||||
* We don't actually know how many bytes are being read, since len==0
|
||||
* means read the whole file.
|
||||
@@ -452,6 +496,12 @@ int fs_read(const char *filename, ulong addr, loff_t offset, loff_t len,
|
||||
return ret;
|
||||
}
|
||||
|
||||
+int fs_read(const char *filename, ulong addr, loff_t offset, loff_t len,
|
||||
+ loff_t *actread)
|
||||
+{
|
||||
+ return _fs_read(filename, addr, offset, len, 0, actread);
|
||||
+}
|
||||
+
|
||||
int fs_write(const char *filename, ulong addr, loff_t offset, loff_t len,
|
||||
loff_t *actwrite)
|
||||
{
|
||||
@@ -622,7 +672,7 @@ int do_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
|
||||
pos = 0;
|
||||
|
||||
time = get_timer(0);
|
||||
- ret = fs_read(filename, addr, pos, bytes, &len_read);
|
||||
+ ret = _fs_read(filename, addr, pos, bytes, 1, &len_read);
|
||||
time = get_timer(time);
|
||||
if (ret < 0)
|
||||
return 1;
|
||||
diff --git a/include/lmb.h b/include/lmb.h
|
||||
index 7d7e2a78..62da85e7 100644
|
||||
--- a/include/lmb.h
|
||||
+++ b/include/lmb.h
|
||||
@@ -31,6 +31,8 @@ struct lmb {
|
||||
extern struct lmb lmb;
|
||||
|
||||
extern void lmb_init(struct lmb *lmb);
|
||||
+extern void lmb_init_and_reserve(struct lmb *lmb, phys_addr_t base,
|
||||
+ phys_size_t size, void *fdt_blob);
|
||||
extern long lmb_add(struct lmb *lmb, phys_addr_t base, phys_size_t size);
|
||||
extern long lmb_reserve(struct lmb *lmb, phys_addr_t base, phys_size_t size);
|
||||
extern phys_addr_t lmb_alloc(struct lmb *lmb, phys_size_t size, ulong align);
|
||||
diff --git a/lib/lmb.c b/lib/lmb.c
|
||||
index e380a0a7..3407705f 100644
|
||||
--- a/lib/lmb.c
|
||||
+++ b/lib/lmb.c
|
||||
@@ -98,6 +98,19 @@ void lmb_init(struct lmb *lmb)
|
||||
lmb->reserved.size = 0;
|
||||
}
|
||||
|
||||
+/* Initialize the struct, add memory and call arch/board reserve functions */
|
||||
+void lmb_init_and_reserve(struct lmb *lmb, phys_addr_t base, phys_size_t size,
|
||||
+ void *fdt_blob)
|
||||
+{
|
||||
+ lmb_init(lmb);
|
||||
+ lmb_add(lmb, base, size);
|
||||
+ arch_lmb_reserve(lmb);
|
||||
+ board_lmb_reserve(lmb);
|
||||
+
|
||||
+ if (IMAGE_ENABLE_OF_LIBFDT && fdt_blob)
|
||||
+ boot_fdt_add_mem_rsv_regions(lmb, fdt_blob);
|
||||
+}
|
||||
+
|
||||
/* This routine called with relocation disabled. */
|
||||
static long lmb_add_region(struct lmb_region *rgn, phys_addr_t base, phys_size_t size)
|
||||
{
|
||||
--
|
||||
1.8.3.1
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
From 2e3bdfbc449a5558ebbb55e36feee31f69fe32f7 Mon Sep 17 00:00:00 2001
|
||||
From: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
|
||||
Date: Mon, 14 Jan 2019 22:38:20 +0100
|
||||
Subject: bootm: use new common function lmb_init_and_reserve
|
||||
|
||||
This reduces duplicate code only.
|
||||
|
||||
Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
|
||||
Reviewed-by: Simon Glass <sjg@chromium.org>
|
||||
|
||||
diff --git a/common/bootm.c b/common/bootm.c
|
||||
index 8bf84ebc..31e4f0f7 100644
|
||||
--- a/common/bootm.c
|
||||
+++ b/common/bootm.c
|
||||
@@ -56,15 +56,11 @@ static void boot_start_lmb(bootm_headers_t *images)
|
||||
ulong mem_start;
|
||||
phys_size_t mem_size;
|
||||
|
||||
- lmb_init(&images->lmb);
|
||||
-
|
||||
mem_start = env_get_bootm_low();
|
||||
mem_size = env_get_bootm_size();
|
||||
|
||||
- lmb_add(&images->lmb, (phys_addr_t)mem_start, mem_size);
|
||||
-
|
||||
- arch_lmb_reserve(&images->lmb);
|
||||
- board_lmb_reserve(&images->lmb);
|
||||
+ lmb_init_and_reserve(&images->lmb, (phys_addr_t)mem_start, mem_size,
|
||||
+ NULL);
|
||||
}
|
||||
#else
|
||||
#define lmb_reserve(lmb, base, size)
|
||||
--
|
||||
1.8.3.1
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
From 8b554b62dcab25c0072c5b6880d0fcf079cc9d87 Mon Sep 17 00:00:00 2001
|
||||
From: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
|
||||
Date: Mon, 14 Jan 2019 22:38:21 +0100
|
||||
Subject: lmb: remove unused extern declaration
|
||||
|
||||
lmb.h includes an extern declaration of "struct lmb lmb;" which
|
||||
is not used anywhere, so remove it.
|
||||
|
||||
Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
|
||||
|
||||
diff --git a/include/lmb.h b/include/lmb.h
|
||||
index 62da85e7..1bb003e3 100644
|
||||
--- a/include/lmb.h
|
||||
+++ b/include/lmb.h
|
||||
@@ -28,8 +28,6 @@ struct lmb {
|
||||
struct lmb_region reserved;
|
||||
};
|
||||
|
||||
-extern struct lmb lmb;
|
||||
-
|
||||
extern void lmb_init(struct lmb *lmb);
|
||||
extern void lmb_init_and_reserve(struct lmb *lmb, phys_addr_t base,
|
||||
phys_size_t size, void *fdt_blob);
|
||||
--
|
||||
1.8.3.1
|
||||
|
|
@ -1,172 +0,0 @@
|
|||
From 2e972e30c0b07736fedcc4fad53cfe49249495a5 Mon Sep 17 00:00:00 2001
|
||||
From: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
|
||||
Date: Mon, 14 Jan 2019 22:38:22 +0100
|
||||
Subject: tftp: prevent overwriting reserved memory
|
||||
|
||||
This fixes CVE-2018-18439 ("insufficient boundary checks in network
|
||||
image boot") by using lmb to check for a valid range to store
|
||||
received blocks.
|
||||
|
||||
Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
|
||||
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
|
||||
|
||||
diff --git a/net/tftp.c b/net/tftp.c
|
||||
index 68ffd814..a9335b1b 100644
|
||||
--- a/net/tftp.c
|
||||
+++ b/net/tftp.c
|
||||
@@ -17,6 +17,8 @@
|
||||
#include <flash.h>
|
||||
#endif
|
||||
|
||||
+DECLARE_GLOBAL_DATA_PTR;
|
||||
+
|
||||
/* Well known TFTP port # */
|
||||
#define WELL_KNOWN_PORT 69
|
||||
/* Millisecs to timeout for lost pkt */
|
||||
@@ -81,6 +83,10 @@ static ulong tftp_block_wrap;
|
||||
/* memory offset due to wrapping */
|
||||
static ulong tftp_block_wrap_offset;
|
||||
static int tftp_state;
|
||||
+static ulong tftp_load_addr;
|
||||
+#ifdef CONFIG_LMB
|
||||
+static ulong tftp_load_size;
|
||||
+#endif
|
||||
#ifdef CONFIG_TFTP_TSIZE
|
||||
/* The file size reported by the server */
|
||||
static int tftp_tsize;
|
||||
@@ -164,10 +170,11 @@ static void mcast_cleanup(void)
|
||||
|
||||
#endif /* CONFIG_MCAST_TFTP */
|
||||
|
||||
-static inline void store_block(int block, uchar *src, unsigned len)
|
||||
+static inline int store_block(int block, uchar *src, unsigned int len)
|
||||
{
|
||||
ulong offset = block * tftp_block_size + tftp_block_wrap_offset;
|
||||
ulong newsize = offset + len;
|
||||
+ ulong store_addr = tftp_load_addr + offset;
|
||||
#ifdef CONFIG_SYS_DIRECT_FLASH_TFTP
|
||||
int i, rc = 0;
|
||||
|
||||
@@ -175,24 +182,32 @@ static inline void store_block(int block, uchar *src, unsigned len)
|
||||
/* start address in flash? */
|
||||
if (flash_info[i].flash_id == FLASH_UNKNOWN)
|
||||
continue;
|
||||
- if (load_addr + offset >= flash_info[i].start[0]) {
|
||||
+ if (store_addr >= flash_info[i].start[0]) {
|
||||
rc = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (rc) { /* Flash is destination for this packet */
|
||||
- rc = flash_write((char *)src, (ulong)(load_addr+offset), len);
|
||||
+ rc = flash_write((char *)src, store_addr, len);
|
||||
if (rc) {
|
||||
flash_perror(rc);
|
||||
- net_set_state(NETLOOP_FAIL);
|
||||
- return;
|
||||
+ return rc;
|
||||
}
|
||||
} else
|
||||
#endif /* CONFIG_SYS_DIRECT_FLASH_TFTP */
|
||||
{
|
||||
- void *ptr = map_sysmem(load_addr + offset, len);
|
||||
-
|
||||
+ void *ptr;
|
||||
+
|
||||
+#ifdef CONFIG_LMB
|
||||
+ if (store_addr < tftp_load_addr ||
|
||||
+ store_addr + len > tftp_load_addr + tftp_load_size) {
|
||||
+ puts("\nTFTP error: ");
|
||||
+ puts("trying to overwrite reserved memory...\n");
|
||||
+ return -1;
|
||||
+ }
|
||||
+#endif
|
||||
+ ptr = map_sysmem(store_addr, len);
|
||||
memcpy(ptr, src, len);
|
||||
unmap_sysmem(ptr);
|
||||
}
|
||||
@@ -203,6 +218,8 @@ static inline void store_block(int block, uchar *src, unsigned len)
|
||||
|
||||
if (net_boot_file_size < newsize)
|
||||
net_boot_file_size = newsize;
|
||||
+
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
/* Clear our state ready for a new transfer */
|
||||
@@ -606,7 +623,11 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
|
||||
timeout_count_max = tftp_timeout_count_max;
|
||||
net_set_timeout_handler(timeout_ms, tftp_timeout_handler);
|
||||
|
||||
- store_block(tftp_cur_block - 1, pkt + 2, len);
|
||||
+ if (store_block(tftp_cur_block - 1, pkt + 2, len)) {
|
||||
+ eth_halt();
|
||||
+ net_set_state(NETLOOP_FAIL);
|
||||
+ break;
|
||||
+ }
|
||||
|
||||
/*
|
||||
* Acknowledge the block just received, which will prompt
|
||||
@@ -695,6 +716,25 @@ static void tftp_timeout_handler(void)
|
||||
}
|
||||
}
|
||||
|
||||
+/* Initialize tftp_load_addr and tftp_load_size from load_addr and lmb */
|
||||
+static int tftp_init_load_addr(void)
|
||||
+{
|
||||
+#ifdef CONFIG_LMB
|
||||
+ struct lmb lmb;
|
||||
+ phys_size_t max_size;
|
||||
+
|
||||
+ lmb_init_and_reserve(&lmb, gd->bd->bi_dram[0].start,
|
||||
+ gd->bd->bi_dram[0].size, (void *)gd->fdt_blob);
|
||||
+
|
||||
+ max_size = lmb_get_unreserved_size(&lmb, load_addr);
|
||||
+ if (!max_size)
|
||||
+ return -1;
|
||||
+
|
||||
+ tftp_load_size = max_size;
|
||||
+#endif
|
||||
+ tftp_load_addr = load_addr;
|
||||
+ return 0;
|
||||
+}
|
||||
|
||||
void tftp_start(enum proto_t protocol)
|
||||
{
|
||||
@@ -791,7 +831,14 @@ void tftp_start(enum proto_t protocol)
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
- printf("Load address: 0x%lx\n", load_addr);
|
||||
+ if (tftp_init_load_addr()) {
|
||||
+ eth_halt();
|
||||
+ net_set_state(NETLOOP_FAIL);
|
||||
+ puts("\nTFTP error: ");
|
||||
+ puts("trying to overwrite reserved memory...\n");
|
||||
+ return;
|
||||
+ }
|
||||
+ printf("Load address: 0x%lx\n", tftp_load_addr);
|
||||
puts("Loading: *\b");
|
||||
tftp_state = STATE_SEND_RRQ;
|
||||
#ifdef CONFIG_CMD_BOOTEFI
|
||||
@@ -842,9 +889,15 @@ void tftp_start_server(void)
|
||||
{
|
||||
tftp_filename[0] = 0;
|
||||
|
||||
+ if (tftp_init_load_addr()) {
|
||||
+ eth_halt();
|
||||
+ net_set_state(NETLOOP_FAIL);
|
||||
+ puts("\nTFTP error: trying to overwrite reserved memory...\n");
|
||||
+ return;
|
||||
+ }
|
||||
printf("Using %s device\n", eth_get_name());
|
||||
printf("Listening for TFTP transfer on %pI4\n", &net_ip);
|
||||
- printf("Load address: 0x%lx\n", load_addr);
|
||||
+ printf("Load address: 0x%lx\n", tftp_load_addr);
|
||||
|
||||
puts("Loading: *\b");
|
||||
|
||||
--
|
||||
1.8.3.1
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
From 72bc6aa0bc7f034bd6966c872819f19af69f2b64 Mon Sep 17 00:00:00 2001
|
||||
From: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
|
||||
Date: Mon, 14 Jan 2019 22:38:23 +0100
|
||||
Subject: arm: bootm: fix sp detection at end of address range
|
||||
|
||||
This fixes 'arch_lmb_reserve()' for ARM that tries to detect in which
|
||||
DRAM bank 'sp' is in.
|
||||
|
||||
This code failed if a bank was at the end of physical address range
|
||||
(i.e. size + length overflowed to 0).
|
||||
|
||||
To fix this, calculate 'bank_end' as 'size + length - 1' so that such
|
||||
banks end at 0xffffffff, not 0.
|
||||
|
||||
Fixes: 15751403b6 ("ARM: bootm: don't assume sp is in DRAM bank 0")
|
||||
Reported-by: Frank Wunderlich <frank-w@public-files.de>
|
||||
Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
|
||||
Reviewed-by: Stephen Warren <swarren@nvidia.com>
|
||||
|
||||
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
|
||||
index c3c1d2fd..329f20c2 100644
|
||||
--- a/arch/arm/lib/bootm.c
|
||||
+++ b/arch/arm/lib/bootm.c
|
||||
@@ -64,13 +64,15 @@ void arch_lmb_reserve(struct lmb *lmb)
|
||||
/* adjust sp by 4K to be safe */
|
||||
sp -= 4096;
|
||||
for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++) {
|
||||
- if (sp < gd->bd->bi_dram[bank].start)
|
||||
+ if (!gd->bd->bi_dram[bank].size ||
|
||||
+ sp < gd->bd->bi_dram[bank].start)
|
||||
continue;
|
||||
+ /* Watch out for RAM at end of address space! */
|
||||
bank_end = gd->bd->bi_dram[bank].start +
|
||||
- gd->bd->bi_dram[bank].size;
|
||||
- if (sp >= bank_end)
|
||||
+ gd->bd->bi_dram[bank].size - 1;
|
||||
+ if (sp > bank_end)
|
||||
continue;
|
||||
- lmb_reserve(lmb, sp, bank_end - sp);
|
||||
+ lmb_reserve(lmb, sp, bank_end - sp + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
--
|
||||
1.8.3.1
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
From 7b492a978a09fbc95340dbcdc1e14d604ac6ae76 Mon Sep 17 00:00:00 2001
|
||||
From: Frank Wunderlich <frank-w@public-files.de>
|
||||
Date: Wed, 23 Jan 2019 16:16:45 +0100
|
||||
Subject: [defconfig] added strings and setenv used for lstftp
|
||||
|
||||
|
||||
diff --git a/configs/mt7623n_bpir2_defconfig b/configs/mt7623n_bpir2_defconfig
|
||||
index a9f4506e..bac45d11 100644
|
||||
--- a/configs/mt7623n_bpir2_defconfig
|
||||
+++ b/configs/mt7623n_bpir2_defconfig
|
||||
@@ -22,7 +22,6 @@ CONFIG_CMD_GPT=y
|
||||
CONFIG_CMD_MMC=y
|
||||
CONFIG_CMD_PART=y
|
||||
CONFIG_CMD_READ=y
|
||||
-# CONFIG_CMD_SETEXPR is not set
|
||||
# CONFIG_CMD_NFS is not set
|
||||
CONFIG_CMD_PING=y
|
||||
CONFIG_CMD_FAT=y
|
||||
@@ -69,3 +68,5 @@ CONFIG_DEFAULT_ENV_FILE="uEnv.txt"
|
||||
CONFIG_ENV_IS_IN_MMC=y
|
||||
|
||||
CONFIG_CMD_ASKENV=y
|
||||
+CONFIG_CMD_STRINGS=y
|
||||
+CONFIG_CMD_SETEXPR=y
|
||||
--
|
||||
1.8.3.1
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
From 0164e641d4a64dcff5d5394b168d612b174d83bd Mon Sep 17 00:00:00 2001
|
||||
From: Frank Wunderlich <frank-w@public-files.de>
|
||||
Date: Wed, 23 Jan 2019 16:30:39 +0100
|
||||
Subject: increase size for environment 4k => 8k
|
||||
|
||||
|
||||
diff --git a/include/configs/mt7623.h b/include/configs/mt7623.h
|
||||
index 7d26debb..aa0314db 100644
|
||||
--- a/include/configs/mt7623.h
|
||||
+++ b/include/configs/mt7623.h
|
||||
@@ -27,7 +27,7 @@
|
||||
#define CONFIG_SYS_NONCACHED_MEMORY SZ_1M
|
||||
|
||||
/* Environment */
|
||||
-#define CONFIG_ENV_SIZE SZ_4K
|
||||
+#define CONFIG_ENV_SIZE SZ_8K
|
||||
/* Allow to overwrite serial and ethaddr */
|
||||
#define CONFIG_ENV_OVERWRITE
|
||||
|
||||
--
|
||||
1.8.3.1
|
||||
|
|
@ -1,216 +0,0 @@
|
|||
From 17843557032cc342117591939483d238e80bd169 Mon Sep 17 00:00:00 2001
|
||||
From: Frank Wunderlich <frank-w@public-files.de>
|
||||
Date: Fri, 28 Dec 2018 17:56:19 +0100
|
||||
Subject: [bootmenu] added key-input (1-9,a-f)
|
||||
|
||||
|
||||
diff --git a/cmd/bootmenu.c b/cmd/bootmenu.c
|
||||
index 7f88c1ed..0935fd40 100644
|
||||
--- a/cmd/bootmenu.c
|
||||
+++ b/cmd/bootmenu.c
|
||||
@@ -39,7 +39,22 @@ struct bootmenu_data {
|
||||
|
||||
enum bootmenu_key {
|
||||
KEY_NONE = 0,
|
||||
- KEY_UP,
|
||||
+ KEY_1,
|
||||
+ KEY_2,
|
||||
+ KEY_3,
|
||||
+ KEY_4,
|
||||
+ KEY_5,
|
||||
+ KEY_6,
|
||||
+ KEY_7,
|
||||
+ KEY_8,
|
||||
+ KEY_9,
|
||||
+ KEY_a,
|
||||
+ KEY_b,
|
||||
+ KEY_c,
|
||||
+ KEY_d,
|
||||
+ KEY_e,
|
||||
+ KEY_f,
|
||||
+ KEY_UP = 20,
|
||||
KEY_DOWN,
|
||||
KEY_SELECT,
|
||||
};
|
||||
@@ -77,6 +92,23 @@ static void bootmenu_print_entry(void *data)
|
||||
puts(ANSI_COLOR_RESET);
|
||||
}
|
||||
|
||||
+bool get_bootmenu_key(enum bootmenu_key *key, int c)
|
||||
+{
|
||||
+ /* ANSI '1~9' - was pressed */
|
||||
+ if (c <= '9' && c >= '1' )
|
||||
+ {
|
||||
+ *key = c-48;
|
||||
+ return true;
|
||||
+ }else
|
||||
+ /* ANSI 'a~f' - was pressed */
|
||||
+ if (c <= 'f' && c >= 'a' )
|
||||
+ {
|
||||
+ *key = c-87;
|
||||
+ return true;
|
||||
+ }
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
static void bootmenu_autoboot_loop(struct bootmenu_data *menu,
|
||||
enum bootmenu_key *key, int *esc)
|
||||
{
|
||||
@@ -97,23 +129,23 @@ static void bootmenu_autoboot_loop(struct bootmenu_data *menu,
|
||||
|
||||
menu->delay = -1;
|
||||
c = getc();
|
||||
-
|
||||
- switch (c) {
|
||||
- case '\e':
|
||||
- *esc = 1;
|
||||
- *key = KEY_NONE;
|
||||
- break;
|
||||
- case '\r':
|
||||
- *key = KEY_SELECT;
|
||||
- break;
|
||||
- default:
|
||||
- *key = KEY_NONE;
|
||||
- break;
|
||||
+ if (!get_bootmenu_key(key,c))
|
||||
+ {
|
||||
+ switch (c) {
|
||||
+ case '\e':
|
||||
+ *esc = 1;
|
||||
+ *key = KEY_NONE;
|
||||
+ break;
|
||||
+ case '\r':
|
||||
+ *key = KEY_SELECT;
|
||||
+ break;
|
||||
+ default:
|
||||
+ *key = KEY_NONE;
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
-
|
||||
break;
|
||||
}
|
||||
-
|
||||
if (menu->delay < 0)
|
||||
break;
|
||||
|
||||
@@ -140,47 +172,49 @@ static void bootmenu_loop(struct bootmenu_data *menu,
|
||||
|
||||
c = getc();
|
||||
|
||||
- switch (*esc) {
|
||||
- case 0:
|
||||
- /* First char of ANSI escape sequence '\e' */
|
||||
- if (c == '\e') {
|
||||
- *esc = 1;
|
||||
- *key = KEY_NONE;
|
||||
- }
|
||||
- break;
|
||||
- case 1:
|
||||
- /* Second char of ANSI '[' */
|
||||
- if (c == '[') {
|
||||
- *esc = 2;
|
||||
- *key = KEY_NONE;
|
||||
- } else {
|
||||
- *esc = 0;
|
||||
- }
|
||||
- break;
|
||||
- case 2:
|
||||
- case 3:
|
||||
- /* Third char of ANSI (number '1') - optional */
|
||||
- if (*esc == 2 && c == '1') {
|
||||
- *esc = 3;
|
||||
+ if (!get_bootmenu_key(key,c))
|
||||
+ {
|
||||
+ switch (*esc) {
|
||||
+ case 0:
|
||||
+ /* First char of ANSI escape sequence '\e' */
|
||||
+ if (c == '\e') {
|
||||
+ *esc = 1;
|
||||
+ *key = KEY_NONE;
|
||||
+ }
|
||||
+ break;
|
||||
+ case 1:
|
||||
+ /* Second char of ANSI '[' */
|
||||
+ if (c == '[') {
|
||||
+ *esc = 2;
|
||||
*key = KEY_NONE;
|
||||
+ } else {
|
||||
+ *esc = 0;
|
||||
+ }
|
||||
break;
|
||||
- }
|
||||
+ case 2:
|
||||
+ case 3:
|
||||
+ /* Third char of ANSI (number '1') - optional */
|
||||
+ if (*esc == 2 && c == '1') {
|
||||
+ *esc = 3;
|
||||
+ *key = KEY_NONE;
|
||||
+ break;
|
||||
+ }
|
||||
|
||||
- *esc = 0;
|
||||
+ *esc = 0;
|
||||
|
||||
- /* ANSI 'A' - key up was pressed */
|
||||
- if (c == 'A')
|
||||
- *key = KEY_UP;
|
||||
- /* ANSI 'B' - key down was pressed */
|
||||
- else if (c == 'B')
|
||||
- *key = KEY_DOWN;
|
||||
- /* other key was pressed */
|
||||
- else
|
||||
- *key = KEY_NONE;
|
||||
+ /* ANSI 'A' - key up was pressed */
|
||||
+ if (c == 'A')
|
||||
+ *key = KEY_UP;
|
||||
+ /* ANSI 'B' - key down was pressed */
|
||||
+ else if (c == 'B')
|
||||
+ *key = KEY_DOWN;
|
||||
+ /* other key was pressed */
|
||||
+ else
|
||||
+ *key = KEY_NONE;
|
||||
|
||||
- break;
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
-
|
||||
/* enter key was pressed */
|
||||
if (c == '\r')
|
||||
*key = KEY_SELECT;
|
||||
@@ -203,6 +237,14 @@ static char *bootmenu_choice_entry(void *data)
|
||||
bootmenu_loop(menu, &key, &esc);
|
||||
}
|
||||
|
||||
+ if (key < KEY_UP && key > KEY_NONE)
|
||||
+ {
|
||||
+ menu->active = key-1;
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+
|
||||
switch (key) {
|
||||
case KEY_UP:
|
||||
if (menu->active > 0)
|
||||
@@ -222,6 +264,7 @@ static char *bootmenu_choice_entry(void *data)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
+ }
|
||||
}
|
||||
|
||||
/* never happens */
|
||||
@@ -466,7 +509,7 @@ void menu_display_statusline(struct menu *m)
|
||||
printf(ANSI_CURSOR_POSITION, menu->count + 5, 1);
|
||||
puts(ANSI_CLEAR_LINE);
|
||||
printf(ANSI_CURSOR_POSITION, menu->count + 6, 1);
|
||||
- puts(" Press UP/DOWN to move, ENTER to select");
|
||||
+ puts(" Press UP/DOWN to move or Press 1~9,a~f to choose, ENTER to select");
|
||||
puts(ANSI_CLEAR_LINE_TO_END);
|
||||
printf(ANSI_CURSOR_POSITION, menu->count + 7, 1);
|
||||
puts(ANSI_CLEAR_LINE);
|
||||
--
|
||||
1.8.3.1
|
||||
|
|
@ -1,91 +0,0 @@
|
|||
scriptaddr=0x83000000
|
||||
device=mmc
|
||||
bootenv=uEnv.txt
|
||||
kernel=uImage
|
||||
loadaddr=0x80200000
|
||||
#default bootargs will be overidden by buildargs
|
||||
bootargs=console=ttyS0,115200 root=/dev/mmcblk1p2 rw rootwait ip=dhcp
|
||||
|
||||
console=earlyprintk console=ttyS0,115200 console=tty1 fbcon=map:0
|
||||
roottmpl=${rootdev} rootfstype=ext4 rootwait
|
||||
prepsetroot=setenv setroot setenv root ${roottmpl}
|
||||
bootopts=vmalloc=496M debug=7 initcall_debug=0
|
||||
graphic=video=1920x1080 drm.debug=0x7
|
||||
|
||||
buildargs=setenv bootargs "console=${console} root=${root} ${bootopts} ${graphic}"
|
||||
|
||||
checkenv=test -e ${device} ${partition} ${bootenv}
|
||||
importenv=env import -t ${scriptaddr} ${filesize}
|
||||
loadbootenv=if fatload ${device} ${partition} ${scriptaddr} ${bootenv};then run importenv;else echo "fatload (${bootenv}) failed";fi
|
||||
resetenv=env default -a;printenv;
|
||||
|
||||
# Here we assume that SD card id mmcblk1 and eMMC is mmcblk0 in linux. Swap them if your DTS define them in reverse order.
|
||||
usesd=setenv partition 1:1; setenv rootdev /dev/mmcblk0p2; setenv bootdev SD; setenv swaproot 'run useemmc';
|
||||
useemmc=setenv partition 0:1; setenv rootdev /dev/mmcblk1p2; setenv bootdev eMMC; setenv swaproot 'run usesd';
|
||||
|
||||
checkbootedfrom=if itest.l *81dffff0 == 434d4d65 ; then setenv bootedfrom eMMC; else setenv bootedfrom SD; fi;
|
||||
|
||||
checkroot=fatinfo ${device} ${partition}
|
||||
checksd=fatinfo ${device} 1:1
|
||||
checkmmc=fatinfo ${device} 0:1
|
||||
|
||||
reportbootedfrom=echo "Preloader/U-Boot loaded from ${bootedfrom}."; run validroot || echo "Both SD and eMMC pt#1 are not FAT, falling back to U-Boot shell."
|
||||
reportvalidroot=run validroot || echo "Both SD and eMMC pt#1 are not FAT, falling back to U-Boot shell."
|
||||
reportrootswapwarn=if test "${bootedfrom}" != "${bootdev}" ; then echo "Warning: Partition 1 on ${bootedfrom} is not FAT, failing back to ${bootdev}"; fi; true;
|
||||
reportbootdev=echo "Booting from ${bootdev}."
|
||||
reportboot=run reportbootedfrom reportvalidroot reportrootswapwarn reportbootdev
|
||||
|
||||
detectroot=run useemmc; run checkbootedfrom; if test "${bootedfrom}" == "SD"; then run usesd; fi; run validateroot;
|
||||
validateroot=setenv validroot false; run checkroot || run swaproot; run checkroot && setenv validroot true || run swaproot;
|
||||
|
||||
newboot=run prepsetroot; run setroot;run buildargs;printenv bootargs;fatload ${device} ${partition} ${loadaddr} ${kernel}; bootm
|
||||
|
||||
reloadenv=run detectroot; if run validroot; then if run checkenv; then run loadbootenv; run detectroot; else echo uEnv.txt file not found on ${bootdev}; fi; fi;
|
||||
reloadmenu=run reloadenv; run reportboot; if run validroot; then if run checkenv; then run loadbootenv; else echo uEnv.txt file not found on ${bootdev}; fi; bootmenu; fi;
|
||||
|
||||
lskernel=ls ${device} ${partition};
|
||||
lsdtb=ls ${device} ${partition} dtb
|
||||
askkernel=askenv kernelinput "enter uImage-name:";
|
||||
askdtb=askenv dtbinput "enter dtb-name:";
|
||||
|
||||
#bootmenu
|
||||
boot0=run lskernel;run askkernel;if printenv kernelinput ;then setenv kernel ${kernelinput};run lsdtb;run askdtb;if printenv dtbinput ;then setenv fdt ${dtbinput};fi; run newboot2; fi;
|
||||
boot1=run newboot;
|
||||
|
||||
bootmenu_default=2
|
||||
bootmenu_0=1. Enter kernel-name to boot from SD/EMMC.=run boot0
|
||||
bootmenu_1=2. Boot kernel from TFTP.=run bootnet
|
||||
bootmenu_2=3. Boot from SD/EMMC.=run boot1
|
||||
bootmenu_3=4. Boot from eMMC.=run useemmc; run boot1
|
||||
bootmenu_4=5. Boot from SD.=run usesd; run boot1
|
||||
|
||||
#Netboot
|
||||
ipaddr=192.168.0.11
|
||||
netmask=255.255.255.0
|
||||
serverip=192.168.0.10
|
||||
|
||||
bootfile=uImage
|
||||
netbootargs=console=ttyS0,115200 root=/dev/mmcblk1p2 rw rootwait
|
||||
#ip=dhcp sets ip on eth0 instead of wan
|
||||
|
||||
lstftp=tftp ${loadaddr} ${serverip}:files.lst;setexpr listend ${loadaddr} + ${filesize};mw.b ${listend} 00 2;strings ${loadaddr};
|
||||
#md.b ${loadaddr} 60;
|
||||
|
||||
bootnet=run lstftp;run askkernel;if printenv kernelinput ;then setenv bootfile "${kernelinput}"; fi;printenv; setenv bootargs ${netbootargs};tftp ${loadaddr} ${bootfile};bootm
|
||||
|
||||
#separate fdt+dto
|
||||
dtaddr=0x83f00000
|
||||
fdt_high=0xffffffff
|
||||
|
||||
loadfdt=fatload ${device} ${partition} ${dtaddr} dtb/${fdt}
|
||||
loadkernel=echo "loading kernel ${kernel}...";fatload ${device} ${partition} ${loadaddr} ${kernel}
|
||||
|
||||
loaddto=echo "loaddto:${dto}";fdt addr ${dtaddr};fdt resize 8192; setexpr fdtovaddr ${dtaddr} + F000;fatload ${device} ${partition} ${fdtovaddr} dtb/${dto} && fdt apply ${fdtovaddr}
|
||||
loaddtolist=for dto in ${dtolist} ; do run loaddto ; done
|
||||
|
||||
bootall=if printenv fdt; then run loadfdt; if printenv dtolist;then run loaddtolist;fi; bootm ${loadaddr} - ${dtaddr} ;else bootm; fi
|
||||
newboot2=run prepsetroot; run setroot;run buildargs; printenv bootargs; run loadkernel; run bootall;
|
||||
|
||||
#automatic reload from sd/emmc
|
||||
bootdelay=0
|
||||
bootcmd=setenv bootdelay 3; run reloadmenu;
|
|
@ -1,49 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2016 Gary Wang <gary.wang@bananapi.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)/kernel.mk
|
||||
|
||||
PKG_NAME:=uboot-mtk-bpi-r2
|
||||
PKG_VERSION:=v1.0
|
||||
PKG_RELEASE:=1
|
||||
HOSTCPPFLAGS:="-I."
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/BPI-SINOVOIP/BPI-R2-LEDE-Uboot.git
|
||||
PKG_SOURCE_VERSION:=b05a4e323e1fd8727fcfe32c35d562f12b88a23b
|
||||
|
||||
PKG_LICENSE:=GPL-2.0 GPL-2.0+
|
||||
PKG_LICENSE_FILES:=Licenses/README
|
||||
|
||||
PKG_MAINTAINER:=Gary Wang <gary.wang@bananapi.com>
|
||||
|
||||
include $(INCLUDE_DIR)/u-boot.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define U-Boot/bpi_r2
|
||||
BUILD_TARGET:=mediatek
|
||||
NAME:=Mediatek Banana Pi R2 board
|
||||
BUILD_DEVICES:=7623n-bananapi-bpi-r2
|
||||
endef
|
||||
|
||||
UBOOT_TARGETS := \
|
||||
bpi_r2
|
||||
|
||||
|
||||
UBOOT_CONFIGURE_VARS += USE_PRIVATE_LIBGCC=yes
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(STAGING_DIR_IMAGE)
|
||||
$(CP) $(PKG_BUILD_DIR)/$(UBOOT_IMAGE) $(STAGING_DIR_IMAGE)/mtk-bpi-r2-uboot.bin
|
||||
$(CP) $(PKG_BUILD_DIR)/bpi_r2_preloader/EMMC_PRELOADER_1600MHz.img $(STAGING_DIR_IMAGE)/mtk-bpi-r2-preloader-emmc.bin
|
||||
$(CP) $(PKG_BUILD_DIR)/bpi_r2_preloader/SD_PRELOADER_1600MHz.img $(STAGING_DIR_IMAGE)/mtk-bpi-r2-preloader-sd.bin
|
||||
endef
|
||||
|
||||
define Package/u-boot/install/default
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage/U-Boot))
|
|
@ -1,56 +0,0 @@
|
|||
Index: uboot-mtk-bpi-r2-v1.0/arch/arm/include/asm/io.h
|
||||
===================================================================
|
||||
--- uboot-mtk-bpi-r2-v1.0.orig/arch/arm/include/asm/io.h
|
||||
+++ uboot-mtk-bpi-r2-v1.0/arch/arm/include/asm/io.h
|
||||
@@ -75,7 +75,7 @@ static inline phys_addr_t virt_to_phys(v
|
||||
#define __arch_putw(v,a) (*(volatile unsigned short *)(a) = (v))
|
||||
#define __arch_putl(v,a) (*(volatile unsigned int *)(a) = (v))
|
||||
|
||||
-extern inline void __raw_writesb(unsigned long addr, const void *data,
|
||||
+static inline void __raw_writesb(unsigned long addr, const void *data,
|
||||
int bytelen)
|
||||
{
|
||||
uint8_t *buf = (uint8_t *)data;
|
||||
@@ -83,7 +83,7 @@ extern inline void __raw_writesb(unsigne
|
||||
__arch_putb(*buf++, addr);
|
||||
}
|
||||
|
||||
-extern inline void __raw_writesw(unsigned long addr, const void *data,
|
||||
+static inline void __raw_writesw(unsigned long addr, const void *data,
|
||||
int wordlen)
|
||||
{
|
||||
uint16_t *buf = (uint16_t *)data;
|
||||
@@ -91,7 +91,7 @@ extern inline void __raw_writesw(unsigne
|
||||
__arch_putw(*buf++, addr);
|
||||
}
|
||||
|
||||
-extern inline void __raw_writesl(unsigned long addr, const void *data,
|
||||
+static inline void __raw_writesl(unsigned long addr, const void *data,
|
||||
int longlen)
|
||||
{
|
||||
uint32_t *buf = (uint32_t *)data;
|
||||
@@ -99,21 +99,21 @@ extern inline void __raw_writesl(unsigne
|
||||
__arch_putl(*buf++, addr);
|
||||
}
|
||||
|
||||
-extern inline void __raw_readsb(unsigned long addr, void *data, int bytelen)
|
||||
+static inline void __raw_readsb(unsigned long addr, void *data, int bytelen)
|
||||
{
|
||||
uint8_t *buf = (uint8_t *)data;
|
||||
while(bytelen--)
|
||||
*buf++ = __arch_getb(addr);
|
||||
}
|
||||
|
||||
-extern inline void __raw_readsw(unsigned long addr, void *data, int wordlen)
|
||||
+static inline void __raw_readsw(unsigned long addr, void *data, int wordlen)
|
||||
{
|
||||
uint16_t *buf = (uint16_t *)data;
|
||||
while(wordlen--)
|
||||
*buf++ = __arch_getw(addr);
|
||||
}
|
||||
|
||||
-extern inline void __raw_readsl(unsigned long addr, void *data, int longlen)
|
||||
+static inline void __raw_readsl(unsigned long addr, void *data, int longlen)
|
||||
{
|
||||
uint32_t *buf = (uint32_t *)data;
|
||||
while(longlen--)
|
|
@ -1,38 +0,0 @@
|
|||
Index: uboot-mtk-bpi-r2-v1.0/arch/arm/lib/board.c
|
||||
===================================================================
|
||||
--- uboot-mtk-bpi-r2-v1.0.orig/arch/arm/lib/board.c
|
||||
+++ uboot-mtk-bpi-r2-v1.0/arch/arm/lib/board.c
|
||||
@@ -69,24 +69,15 @@ extern void dataflash_print_info(void);
|
||||
************************************************************************
|
||||
* May be supplied by boards if desired
|
||||
*/
|
||||
-inline void __coloured_LED_init(void) {}
|
||||
-void coloured_LED_init(void) __attribute__((weak, alias("__coloured_LED_init")));
|
||||
-inline void __red_led_on(void) {}
|
||||
-void red_led_on(void) __attribute__((weak, alias("__red_led_on")));
|
||||
-inline void __red_led_off(void) {}
|
||||
-void red_led_off(void) __attribute__((weak, alias("__red_led_off")));
|
||||
-inline void __green_led_on(void) {}
|
||||
-void green_led_on(void) __attribute__((weak, alias("__green_led_on")));
|
||||
-inline void __green_led_off(void) {}
|
||||
-void green_led_off(void) __attribute__((weak, alias("__green_led_off")));
|
||||
-inline void __yellow_led_on(void) {}
|
||||
-void yellow_led_on(void) __attribute__((weak, alias("__yellow_led_on")));
|
||||
-inline void __yellow_led_off(void) {}
|
||||
-void yellow_led_off(void) __attribute__((weak, alias("__yellow_led_off")));
|
||||
-inline void __blue_led_on(void) {}
|
||||
-void blue_led_on(void) __attribute__((weak, alias("__blue_led_on")));
|
||||
-inline void __blue_led_off(void) {}
|
||||
-void blue_led_off(void) __attribute__((weak, alias("__blue_led_off")));
|
||||
+__weak void coloured_LED_init(void) {}
|
||||
+__weak void red_led_on(void) {}
|
||||
+__weak void red_led_off(void) {}
|
||||
+__weak void green_led_on(void) {}
|
||||
+__weak void green_led_off(void) {}
|
||||
+__weak void yellow_led_on(void) {}
|
||||
+__weak void yellow_led_off(void) {}
|
||||
+__weak void blue_led_on(void) {}
|
||||
+__weak void blue_led_off(void) {}
|
||||
|
||||
/*
|
||||
************************************************************************
|
|
@ -1,14 +0,0 @@
|
|||
Index: uboot-mtk-bpi-r2-v1.0/common/main.c
|
||||
===================================================================
|
||||
--- uboot-mtk-bpi-r2-v1.0.orig/common/main.c
|
||||
+++ uboot-mtk-bpi-r2-v1.0/common/main.c
|
||||
@@ -27,8 +27,7 @@ DECLARE_GLOBAL_DATA_PTR;
|
||||
/*
|
||||
* Board-specific Platform code can reimplement show_boot_progress () if needed
|
||||
*/
|
||||
-void inline __show_boot_progress (int val) {}
|
||||
-void show_boot_progress (int val) __attribute__((weak, alias("__show_boot_progress")));
|
||||
+__weak void show_boot_progress(int val) {}
|
||||
|
||||
#define MAX_DELAY_STOP_STR 32
|
||||
|
|
@ -1,287 +0,0 @@
|
|||
--- /dev/null
|
||||
+++ b/include/linux/compiler-gcc7.h
|
||||
@@ -0,0 +1,284 @@
|
||||
+#ifndef __LINUX_COMPILER_H
|
||||
+#error "Please don't include <linux/compiler-gcc.h> directly, include <linux/compiler.h> instead."
|
||||
+#endif
|
||||
+
|
||||
+/*
|
||||
+ * Common definitions for all gcc versions go here.
|
||||
+ */
|
||||
+#define GCC_VERSION (__GNUC__ * 10000 \
|
||||
+ + __GNUC_MINOR__ * 100 \
|
||||
+ + __GNUC_PATCHLEVEL__)
|
||||
+
|
||||
+/* Optimization barrier */
|
||||
+
|
||||
+/* The "volatile" is due to gcc bugs */
|
||||
+#define barrier() __asm__ __volatile__("": : :"memory")
|
||||
+/*
|
||||
+ * This version is i.e. to prevent dead stores elimination on @ptr
|
||||
+ * where gcc and llvm may behave differently when otherwise using
|
||||
+ * normal barrier(): while gcc behavior gets along with a normal
|
||||
+ * barrier(), llvm needs an explicit input variable to be assumed
|
||||
+ * clobbered. The issue is as follows: while the inline asm might
|
||||
+ * access any memory it wants, the compiler could have fit all of
|
||||
+ * @ptr into memory registers instead, and since @ptr never escaped
|
||||
+ * from that, it proofed that the inline asm wasn't touching any of
|
||||
+ * it. This version works well with both compilers, i.e. we're telling
|
||||
+ * the compiler that the inline asm absolutely may see the contents
|
||||
+ * of @ptr. See also: https://llvm.org/bugs/show_bug.cgi?id=15495
|
||||
+ */
|
||||
+#define barrier_data(ptr) __asm__ __volatile__("": :"r"(ptr) :"memory")
|
||||
+
|
||||
+/*
|
||||
+ * This macro obfuscates arithmetic on a variable address so that gcc
|
||||
+ * shouldn't recognize the original var, and make assumptions about it.
|
||||
+ *
|
||||
+ * This is needed because the C standard makes it undefined to do
|
||||
+ * pointer arithmetic on "objects" outside their boundaries and the
|
||||
+ * gcc optimizers assume this is the case. In particular they
|
||||
+ * assume such arithmetic does not wrap.
|
||||
+ *
|
||||
+ * A miscompilation has been observed because of this on PPC.
|
||||
+ * To work around it we hide the relationship of the pointer and the object
|
||||
+ * using this macro.
|
||||
+ *
|
||||
+ * Versions of the ppc64 compiler before 4.1 had a bug where use of
|
||||
+ * RELOC_HIDE could trash r30. The bug can be worked around by changing
|
||||
+ * the inline assembly constraint from =g to =r, in this particular
|
||||
+ * case either is valid.
|
||||
+ */
|
||||
+#define RELOC_HIDE(ptr, off) \
|
||||
+({ \
|
||||
+ unsigned long __ptr; \
|
||||
+ __asm__ ("" : "=r"(__ptr) : "0"(ptr)); \
|
||||
+ (typeof(ptr)) (__ptr + (off)); \
|
||||
+})
|
||||
+
|
||||
+/* Make the optimizer believe the variable can be manipulated arbitrarily. */
|
||||
+#define OPTIMIZER_HIDE_VAR(var) \
|
||||
+ __asm__ ("" : "=r" (var) : "0" (var))
|
||||
+
|
||||
+#ifdef __CHECKER__
|
||||
+#define __must_be_array(a) 0
|
||||
+#else
|
||||
+/* &a[0] degrades to a pointer: a different type from an array */
|
||||
+#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
|
||||
+#endif
|
||||
+
|
||||
+/*
|
||||
+ * Force always-inline if the user requests it so via the .config,
|
||||
+ * or if gcc is too old:
|
||||
+ */
|
||||
+#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \
|
||||
+ !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4)
|
||||
+#define inline inline __attribute__((always_inline)) notrace
|
||||
+#define __inline__ __inline__ __attribute__((always_inline)) notrace
|
||||
+#define __inline __inline __attribute__((always_inline)) notrace
|
||||
+#else
|
||||
+/* A lot of inline functions can cause havoc with function tracing */
|
||||
+#define inline inline notrace
|
||||
+#define __inline__ __inline__ notrace
|
||||
+#define __inline __inline notrace
|
||||
+#endif
|
||||
+
|
||||
+#define __always_inline inline __attribute__((always_inline))
|
||||
+#define noinline __attribute__((noinline))
|
||||
+
|
||||
+#define __deprecated __attribute__((deprecated))
|
||||
+#define __packed __attribute__((packed))
|
||||
+#define __weak __attribute__((weak))
|
||||
+#define __alias(symbol) __attribute__((alias(#symbol)))
|
||||
+
|
||||
+/*
|
||||
+ * it doesn't make sense on ARM (currently the only user of __naked)
|
||||
+ * to trace naked functions because then mcount is called without
|
||||
+ * stack and frame pointer being set up and there is no chance to
|
||||
+ * restore the lr register to the value before mcount was called.
|
||||
+ *
|
||||
+ * The asm() bodies of naked functions often depend on standard calling
|
||||
+ * conventions, therefore they must be noinline and noclone.
|
||||
+ *
|
||||
+ * GCC 4.[56] currently fail to enforce this, so we must do so ourselves.
|
||||
+ * See GCC PR44290.
|
||||
+ */
|
||||
+#define __naked __attribute__((naked)) noinline __noclone notrace
|
||||
+
|
||||
+#define __noreturn __attribute__((noreturn))
|
||||
+
|
||||
+/*
|
||||
+ * From the GCC manual:
|
||||
+ *
|
||||
+ * Many functions have no effects except the return value and their
|
||||
+ * return value depends only on the parameters and/or global
|
||||
+ * variables. Such a function can be subject to common subexpression
|
||||
+ * elimination and loop optimization just as an arithmetic operator
|
||||
+ * would be.
|
||||
+ * [...]
|
||||
+ */
|
||||
+#define __pure __attribute__((pure))
|
||||
+#define __aligned(x) __attribute__((aligned(x)))
|
||||
+#define __printf(a, b) __attribute__((format(printf, a, b)))
|
||||
+#define __scanf(a, b) __attribute__((format(scanf, a, b)))
|
||||
+#define __attribute_const__ __attribute__((__const__))
|
||||
+#define __maybe_unused __attribute__((unused))
|
||||
+#define __always_unused __attribute__((unused))
|
||||
+
|
||||
+/* gcc version specific checks */
|
||||
+
|
||||
+#if GCC_VERSION < 30200
|
||||
+# error Sorry, your compiler is too old - please upgrade it.
|
||||
+#endif
|
||||
+
|
||||
+#if GCC_VERSION < 30300
|
||||
+# define __used __attribute__((__unused__))
|
||||
+#else
|
||||
+# define __used __attribute__((__used__))
|
||||
+#endif
|
||||
+
|
||||
+#ifdef CONFIG_GCOV_KERNEL
|
||||
+# if GCC_VERSION < 30400
|
||||
+# error "GCOV profiling support for gcc versions below 3.4 not included"
|
||||
+# endif /* __GNUC_MINOR__ */
|
||||
+#endif /* CONFIG_GCOV_KERNEL */
|
||||
+
|
||||
+#if GCC_VERSION >= 30400
|
||||
+#define __must_check __attribute__((warn_unused_result))
|
||||
+#define __malloc __attribute__((__malloc__))
|
||||
+#endif
|
||||
+
|
||||
+#if GCC_VERSION >= 40000
|
||||
+
|
||||
+/* GCC 4.1.[01] miscompiles __weak */
|
||||
+#ifdef __KERNEL__
|
||||
+# if GCC_VERSION >= 40100 && GCC_VERSION <= 40101
|
||||
+# error Your version of gcc miscompiles the __weak directive
|
||||
+# endif
|
||||
+#endif
|
||||
+
|
||||
+#define __used __attribute__((__used__))
|
||||
+#define __compiler_offsetof(a, b) \
|
||||
+ __builtin_offsetof(a, b)
|
||||
+
|
||||
+#if GCC_VERSION >= 40100 && GCC_VERSION < 40600
|
||||
+# define __compiletime_object_size(obj) __builtin_object_size(obj, 0)
|
||||
+#endif
|
||||
+
|
||||
+#if GCC_VERSION >= 40300
|
||||
+/* Mark functions as cold. gcc will assume any path leading to a call
|
||||
+ * to them will be unlikely. This means a lot of manual unlikely()s
|
||||
+ * are unnecessary now for any paths leading to the usual suspects
|
||||
+ * like BUG(), printk(), panic() etc. [but let's keep them for now for
|
||||
+ * older compilers]
|
||||
+ *
|
||||
+ * Early snapshots of gcc 4.3 don't support this and we can't detect this
|
||||
+ * in the preprocessor, but we can live with this because they're unreleased.
|
||||
+ * Maketime probing would be overkill here.
|
||||
+ *
|
||||
+ * gcc also has a __attribute__((__hot__)) to move hot functions into
|
||||
+ * a special section, but I don't see any sense in this right now in
|
||||
+ * the kernel context
|
||||
+ */
|
||||
+#define __cold __attribute__((__cold__))
|
||||
+
|
||||
+#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
|
||||
+
|
||||
+#ifndef __CHECKER__
|
||||
+# define __compiletime_warning(message) __attribute__((warning(message)))
|
||||
+# define __compiletime_error(message) __attribute__((error(message)))
|
||||
+#endif /* __CHECKER__ */
|
||||
+#endif /* GCC_VERSION >= 40300 */
|
||||
+
|
||||
+#if GCC_VERSION >= 40500
|
||||
+/*
|
||||
+ * Mark a position in code as unreachable. This can be used to
|
||||
+ * suppress control flow warnings after asm blocks that transfer
|
||||
+ * control elsewhere.
|
||||
+ *
|
||||
+ * Early snapshots of gcc 4.5 don't support this and we can't detect
|
||||
+ * this in the preprocessor, but we can live with this because they're
|
||||
+ * unreleased. Really, we need to have autoconf for the kernel.
|
||||
+ */
|
||||
+#define unreachable() __builtin_unreachable()
|
||||
+
|
||||
+/* Mark a function definition as prohibited from being cloned. */
|
||||
+#define __noclone __attribute__((__noclone__, __optimize__("no-tracer")))
|
||||
+
|
||||
+#endif /* GCC_VERSION >= 40500 */
|
||||
+
|
||||
+#if GCC_VERSION >= 40600
|
||||
+/*
|
||||
+ * When used with Link Time Optimization, gcc can optimize away C functions or
|
||||
+ * variables which are referenced only from assembly code. __visible tells the
|
||||
+ * optimizer that something else uses this function or variable, thus preventing
|
||||
+ * this.
|
||||
+ */
|
||||
+#define __visible __attribute__((externally_visible))
|
||||
+#endif
|
||||
+
|
||||
+
|
||||
+#if GCC_VERSION >= 40900 && !defined(__CHECKER__)
|
||||
+/*
|
||||
+ * __assume_aligned(n, k): Tell the optimizer that the returned
|
||||
+ * pointer can be assumed to be k modulo n. The second argument is
|
||||
+ * optional (default 0), so we use a variadic macro to make the
|
||||
+ * shorthand.
|
||||
+ *
|
||||
+ * Beware: Do not apply this to functions which may return
|
||||
+ * ERR_PTRs. Also, it is probably unwise to apply it to functions
|
||||
+ * returning extra information in the low bits (but in that case the
|
||||
+ * compiler should see some alignment anyway, when the return value is
|
||||
+ * massaged by 'flags = ptr & 3; ptr &= ~3;').
|
||||
+ */
|
||||
+#define __assume_aligned(a, ...) __attribute__((__assume_aligned__(a, ## __VA_ARGS__)))
|
||||
+#endif
|
||||
+
|
||||
+/*
|
||||
+ * GCC 'asm goto' miscompiles certain code sequences:
|
||||
+ *
|
||||
+ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
|
||||
+ *
|
||||
+ * Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
|
||||
+ *
|
||||
+ * (asm goto is automatically volatile - the naming reflects this.)
|
||||
+ */
|
||||
+#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
|
||||
+
|
||||
+#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
|
||||
+#if GCC_VERSION >= 40400
|
||||
+#define __HAVE_BUILTIN_BSWAP32__
|
||||
+#define __HAVE_BUILTIN_BSWAP64__
|
||||
+#endif
|
||||
+#if GCC_VERSION >= 40800
|
||||
+#define __HAVE_BUILTIN_BSWAP16__
|
||||
+#endif
|
||||
+#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */
|
||||
+
|
||||
+#if GCC_VERSION >= 50000
|
||||
+#define KASAN_ABI_VERSION 4
|
||||
+#elif GCC_VERSION >= 40902
|
||||
+#define KASAN_ABI_VERSION 3
|
||||
+#endif
|
||||
+
|
||||
+#if GCC_VERSION >= 40902
|
||||
+/*
|
||||
+ * Tell the compiler that address safety instrumentation (KASAN)
|
||||
+ * should not be applied to that function.
|
||||
+ * Conflicts with inlining: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368
|
||||
+ */
|
||||
+#define __no_sanitize_address __attribute__((no_sanitize_address))
|
||||
+#endif
|
||||
+
|
||||
+#endif /* gcc version >= 40000 specific checks */
|
||||
+
|
||||
+#if !defined(__noclone)
|
||||
+#define __noclone /* not needed */
|
||||
+#endif
|
||||
+
|
||||
+#if !defined(__no_sanitize_address)
|
||||
+#define __no_sanitize_address
|
||||
+#endif
|
||||
+
|
||||
+/*
|
||||
+ * A trick to suppress uninitialized variable warning without generating any
|
||||
+ * code
|
||||
+ */
|
||||
+#define uninitialized_var(x) x = x
|
|
@ -1,287 +0,0 @@
|
|||
--- /dev/null
|
||||
+++ b/include/linux/compiler-gcc8.h
|
||||
@@ -0,0 +1,284 @@
|
||||
+#ifndef __LINUX_COMPILER_H
|
||||
+#error "Please don't include <linux/compiler-gcc.h> directly, include <linux/compiler.h> instead."
|
||||
+#endif
|
||||
+
|
||||
+/*
|
||||
+ * Common definitions for all gcc versions go here.
|
||||
+ */
|
||||
+#define GCC_VERSION (__GNUC__ * 10000 \
|
||||
+ + __GNUC_MINOR__ * 100 \
|
||||
+ + __GNUC_PATCHLEVEL__)
|
||||
+
|
||||
+/* Optimization barrier */
|
||||
+
|
||||
+/* The "volatile" is due to gcc bugs */
|
||||
+#define barrier() __asm__ __volatile__("": : :"memory")
|
||||
+/*
|
||||
+ * This version is i.e. to prevent dead stores elimination on @ptr
|
||||
+ * where gcc and llvm may behave differently when otherwise using
|
||||
+ * normal barrier(): while gcc behavior gets along with a normal
|
||||
+ * barrier(), llvm needs an explicit input variable to be assumed
|
||||
+ * clobbered. The issue is as follows: while the inline asm might
|
||||
+ * access any memory it wants, the compiler could have fit all of
|
||||
+ * @ptr into memory registers instead, and since @ptr never escaped
|
||||
+ * from that, it proofed that the inline asm wasn't touching any of
|
||||
+ * it. This version works well with both compilers, i.e. we're telling
|
||||
+ * the compiler that the inline asm absolutely may see the contents
|
||||
+ * of @ptr. See also: https://llvm.org/bugs/show_bug.cgi?id=15495
|
||||
+ */
|
||||
+#define barrier_data(ptr) __asm__ __volatile__("": :"r"(ptr) :"memory")
|
||||
+
|
||||
+/*
|
||||
+ * This macro obfuscates arithmetic on a variable address so that gcc
|
||||
+ * shouldn't recognize the original var, and make assumptions about it.
|
||||
+ *
|
||||
+ * This is needed because the C standard makes it undefined to do
|
||||
+ * pointer arithmetic on "objects" outside their boundaries and the
|
||||
+ * gcc optimizers assume this is the case. In particular they
|
||||
+ * assume such arithmetic does not wrap.
|
||||
+ *
|
||||
+ * A miscompilation has been observed because of this on PPC.
|
||||
+ * To work around it we hide the relationship of the pointer and the object
|
||||
+ * using this macro.
|
||||
+ *
|
||||
+ * Versions of the ppc64 compiler before 4.1 had a bug where use of
|
||||
+ * RELOC_HIDE could trash r30. The bug can be worked around by changing
|
||||
+ * the inline assembly constraint from =g to =r, in this particular
|
||||
+ * case either is valid.
|
||||
+ */
|
||||
+#define RELOC_HIDE(ptr, off) \
|
||||
+({ \
|
||||
+ unsigned long __ptr; \
|
||||
+ __asm__ ("" : "=r"(__ptr) : "0"(ptr)); \
|
||||
+ (typeof(ptr)) (__ptr + (off)); \
|
||||
+})
|
||||
+
|
||||
+/* Make the optimizer believe the variable can be manipulated arbitrarily. */
|
||||
+#define OPTIMIZER_HIDE_VAR(var) \
|
||||
+ __asm__ ("" : "=r" (var) : "0" (var))
|
||||
+
|
||||
+#ifdef __CHECKER__
|
||||
+#define __must_be_array(a) 0
|
||||
+#else
|
||||
+/* &a[0] degrades to a pointer: a different type from an array */
|
||||
+#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
|
||||
+#endif
|
||||
+
|
||||
+/*
|
||||
+ * Force always-inline if the user requests it so via the .config,
|
||||
+ * or if gcc is too old:
|
||||
+ */
|
||||
+#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \
|
||||
+ !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4)
|
||||
+#define inline inline __attribute__((always_inline)) notrace
|
||||
+#define __inline__ __inline__ __attribute__((always_inline)) notrace
|
||||
+#define __inline __inline __attribute__((always_inline)) notrace
|
||||
+#else
|
||||
+/* A lot of inline functions can cause havoc with function tracing */
|
||||
+#define inline inline notrace
|
||||
+#define __inline__ __inline__ notrace
|
||||
+#define __inline __inline notrace
|
||||
+#endif
|
||||
+
|
||||
+#define __always_inline inline __attribute__((always_inline))
|
||||
+#define noinline __attribute__((noinline))
|
||||
+
|
||||
+#define __deprecated __attribute__((deprecated))
|
||||
+#define __packed __attribute__((packed))
|
||||
+#define __weak __attribute__((weak))
|
||||
+#define __alias(symbol) __attribute__((alias(#symbol)))
|
||||
+
|
||||
+/*
|
||||
+ * it doesn't make sense on ARM (currently the only user of __naked)
|
||||
+ * to trace naked functions because then mcount is called without
|
||||
+ * stack and frame pointer being set up and there is no chance to
|
||||
+ * restore the lr register to the value before mcount was called.
|
||||
+ *
|
||||
+ * The asm() bodies of naked functions often depend on standard calling
|
||||
+ * conventions, therefore they must be noinline and noclone.
|
||||
+ *
|
||||
+ * GCC 4.[56] currently fail to enforce this, so we must do so ourselves.
|
||||
+ * See GCC PR44290.
|
||||
+ */
|
||||
+#define __naked __attribute__((naked)) noinline __noclone notrace
|
||||
+
|
||||
+#define __noreturn __attribute__((noreturn))
|
||||
+
|
||||
+/*
|
||||
+ * From the GCC manual:
|
||||
+ *
|
||||
+ * Many functions have no effects except the return value and their
|
||||
+ * return value depends only on the parameters and/or global
|
||||
+ * variables. Such a function can be subject to common subexpression
|
||||
+ * elimination and loop optimization just as an arithmetic operator
|
||||
+ * would be.
|
||||
+ * [...]
|
||||
+ */
|
||||
+#define __pure __attribute__((pure))
|
||||
+#define __aligned(x) __attribute__((aligned(x)))
|
||||
+#define __printf(a, b) __attribute__((format(printf, a, b)))
|
||||
+#define __scanf(a, b) __attribute__((format(scanf, a, b)))
|
||||
+#define __attribute_const__ __attribute__((__const__))
|
||||
+#define __maybe_unused __attribute__((unused))
|
||||
+#define __always_unused __attribute__((unused))
|
||||
+
|
||||
+/* gcc version specific checks */
|
||||
+
|
||||
+#if GCC_VERSION < 30200
|
||||
+# error Sorry, your compiler is too old - please upgrade it.
|
||||
+#endif
|
||||
+
|
||||
+#if GCC_VERSION < 30300
|
||||
+# define __used __attribute__((__unused__))
|
||||
+#else
|
||||
+# define __used __attribute__((__used__))
|
||||
+#endif
|
||||
+
|
||||
+#ifdef CONFIG_GCOV_KERNEL
|
||||
+# if GCC_VERSION < 30400
|
||||
+# error "GCOV profiling support for gcc versions below 3.4 not included"
|
||||
+# endif /* __GNUC_MINOR__ */
|
||||
+#endif /* CONFIG_GCOV_KERNEL */
|
||||
+
|
||||
+#if GCC_VERSION >= 30400
|
||||
+#define __must_check __attribute__((warn_unused_result))
|
||||
+#define __malloc __attribute__((__malloc__))
|
||||
+#endif
|
||||
+
|
||||
+#if GCC_VERSION >= 40000
|
||||
+
|
||||
+/* GCC 4.1.[01] miscompiles __weak */
|
||||
+#ifdef __KERNEL__
|
||||
+# if GCC_VERSION >= 40100 && GCC_VERSION <= 40101
|
||||
+# error Your version of gcc miscompiles the __weak directive
|
||||
+# endif
|
||||
+#endif
|
||||
+
|
||||
+#define __used __attribute__((__used__))
|
||||
+#define __compiler_offsetof(a, b) \
|
||||
+ __builtin_offsetof(a, b)
|
||||
+
|
||||
+#if GCC_VERSION >= 40100 && GCC_VERSION < 40600
|
||||
+# define __compiletime_object_size(obj) __builtin_object_size(obj, 0)
|
||||
+#endif
|
||||
+
|
||||
+#if GCC_VERSION >= 40300
|
||||
+/* Mark functions as cold. gcc will assume any path leading to a call
|
||||
+ * to them will be unlikely. This means a lot of manual unlikely()s
|
||||
+ * are unnecessary now for any paths leading to the usual suspects
|
||||
+ * like BUG(), printk(), panic() etc. [but let's keep them for now for
|
||||
+ * older compilers]
|
||||
+ *
|
||||
+ * Early snapshots of gcc 4.3 don't support this and we can't detect this
|
||||
+ * in the preprocessor, but we can live with this because they're unreleased.
|
||||
+ * Maketime probing would be overkill here.
|
||||
+ *
|
||||
+ * gcc also has a __attribute__((__hot__)) to move hot functions into
|
||||
+ * a special section, but I don't see any sense in this right now in
|
||||
+ * the kernel context
|
||||
+ */
|
||||
+#define __cold __attribute__((__cold__))
|
||||
+
|
||||
+#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
|
||||
+
|
||||
+#ifndef __CHECKER__
|
||||
+# define __compiletime_warning(message) __attribute__((warning(message)))
|
||||
+# define __compiletime_error(message) __attribute__((error(message)))
|
||||
+#endif /* __CHECKER__ */
|
||||
+#endif /* GCC_VERSION >= 40300 */
|
||||
+
|
||||
+#if GCC_VERSION >= 40500
|
||||
+/*
|
||||
+ * Mark a position in code as unreachable. This can be used to
|
||||
+ * suppress control flow warnings after asm blocks that transfer
|
||||
+ * control elsewhere.
|
||||
+ *
|
||||
+ * Early snapshots of gcc 4.5 don't support this and we can't detect
|
||||
+ * this in the preprocessor, but we can live with this because they're
|
||||
+ * unreleased. Really, we need to have autoconf for the kernel.
|
||||
+ */
|
||||
+#define unreachable() __builtin_unreachable()
|
||||
+
|
||||
+/* Mark a function definition as prohibited from being cloned. */
|
||||
+#define __noclone __attribute__((__noclone__, __optimize__("no-tracer")))
|
||||
+
|
||||
+#endif /* GCC_VERSION >= 40500 */
|
||||
+
|
||||
+#if GCC_VERSION >= 40600
|
||||
+/*
|
||||
+ * When used with Link Time Optimization, gcc can optimize away C functions or
|
||||
+ * variables which are referenced only from assembly code. __visible tells the
|
||||
+ * optimizer that something else uses this function or variable, thus preventing
|
||||
+ * this.
|
||||
+ */
|
||||
+#define __visible __attribute__((externally_visible))
|
||||
+#endif
|
||||
+
|
||||
+
|
||||
+#if GCC_VERSION >= 40900 && !defined(__CHECKER__)
|
||||
+/*
|
||||
+ * __assume_aligned(n, k): Tell the optimizer that the returned
|
||||
+ * pointer can be assumed to be k modulo n. The second argument is
|
||||
+ * optional (default 0), so we use a variadic macro to make the
|
||||
+ * shorthand.
|
||||
+ *
|
||||
+ * Beware: Do not apply this to functions which may return
|
||||
+ * ERR_PTRs. Also, it is probably unwise to apply it to functions
|
||||
+ * returning extra information in the low bits (but in that case the
|
||||
+ * compiler should see some alignment anyway, when the return value is
|
||||
+ * massaged by 'flags = ptr & 3; ptr &= ~3;').
|
||||
+ */
|
||||
+#define __assume_aligned(a, ...) __attribute__((__assume_aligned__(a, ## __VA_ARGS__)))
|
||||
+#endif
|
||||
+
|
||||
+/*
|
||||
+ * GCC 'asm goto' miscompiles certain code sequences:
|
||||
+ *
|
||||
+ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
|
||||
+ *
|
||||
+ * Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
|
||||
+ *
|
||||
+ * (asm goto is automatically volatile - the naming reflects this.)
|
||||
+ */
|
||||
+#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
|
||||
+
|
||||
+#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
|
||||
+#if GCC_VERSION >= 40400
|
||||
+#define __HAVE_BUILTIN_BSWAP32__
|
||||
+#define __HAVE_BUILTIN_BSWAP64__
|
||||
+#endif
|
||||
+#if GCC_VERSION >= 40800
|
||||
+#define __HAVE_BUILTIN_BSWAP16__
|
||||
+#endif
|
||||
+#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */
|
||||
+
|
||||
+#if GCC_VERSION >= 50000
|
||||
+#define KASAN_ABI_VERSION 4
|
||||
+#elif GCC_VERSION >= 40902
|
||||
+#define KASAN_ABI_VERSION 3
|
||||
+#endif
|
||||
+
|
||||
+#if GCC_VERSION >= 40902
|
||||
+/*
|
||||
+ * Tell the compiler that address safety instrumentation (KASAN)
|
||||
+ * should not be applied to that function.
|
||||
+ * Conflicts with inlining: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368
|
||||
+ */
|
||||
+#define __no_sanitize_address __attribute__((no_sanitize_address))
|
||||
+#endif
|
||||
+
|
||||
+#endif /* gcc version >= 40000 specific checks */
|
||||
+
|
||||
+#if !defined(__noclone)
|
||||
+#define __noclone /* not needed */
|
||||
+#endif
|
||||
+
|
||||
+#if !defined(__no_sanitize_address)
|
||||
+#define __no_sanitize_address
|
||||
+#endif
|
||||
+
|
||||
+/*
|
||||
+ * A trick to suppress uninitialized variable warning without generating any
|
||||
+ * code
|
||||
+ */
|
||||
+#define uninitialized_var(x) x = x
|
|
@ -1,98 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2016 OpenWrt.org
|
||||
# Copyright (C) 2019 Ycarus (Yannick Chabanois) OpenMPTCProuter.com
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
VIDEO_MENU:=Video Support
|
||||
|
||||
#
|
||||
# FB TFT Display
|
||||
#
|
||||
|
||||
define KernelPackage/fb-tft-all
|
||||
SUBMENU:=$(VIDEO_MENU)
|
||||
TITLE:=Framebuffer support for all TFT displays
|
||||
DEPENDS:=+kmod-fb-tft
|
||||
KCONFIG:= \
|
||||
CONFIG_STAGING=y \
|
||||
CONFIG_FB_TFT_AGM1264K_FL=m \
|
||||
CONFIG_FB_TFT_BD663474=m \
|
||||
CONFIG_FB_TFT_HX8340BN=m \
|
||||
CONFIG_FB_TFT_HX8347D=m \
|
||||
CONFIG_FB_TFT_HX8353D=m \
|
||||
CONFIG_FB_TFT_HX8357D=m \
|
||||
CONFIG_FB_TFT_ILI9163=m \
|
||||
CONFIG_FB_TFT_ILI9320=m \
|
||||
CONFIG_FB_TFT_ILI9325=m \
|
||||
CONFIG_FB_TFT_ILI9340=m \
|
||||
CONFIG_FB_TFT_ILI9341=m \
|
||||
CONFIG_FB_TFT_ILI9481=m \
|
||||
CONFIG_FB_TFT_ILI9486=m \
|
||||
CONFIG_FB_TFT_PCD8544=m \
|
||||
CONFIG_FB_TFT_RA8875=m \
|
||||
CONFIG_FB_TFT_S6D02A1=m \
|
||||
CONFIG_FB_TFT_S6D1121=m \
|
||||
CONFIG_FB_TFT_SH1106=m \
|
||||
CONFIG_FB_TFT_SSD1289=m \
|
||||
CONFIG_FB_TFT_SSD1305=m \
|
||||
CONFIG_FB_TFT_SSD1306=m \
|
||||
CONFIG_FB_TFT_SSD1325=m \
|
||||
CONFIG_FB_TFT_SSD1331=m \
|
||||
CONFIG_FB_TFT_SSD1351=m \
|
||||
CONFIG_FB_TFT_ST7735R=m \
|
||||
CONFIG_FB_TFT_ST7789V=m \
|
||||
CONFIG_FB_TFT_TINYLCD=m \
|
||||
CONFIG_FB_TFT_TLS8204=m \
|
||||
CONFIG_FB_TFT_UC1611=m \
|
||||
CONFIG_FB_TFT_UC1701=m \
|
||||
CONFIG_FB_TFT_UPD161704=m \
|
||||
CONFIG_FB_TFT_WATTEROTT=m \
|
||||
CONFIG_FB_FLEX=m \
|
||||
CONFIG_FB_TFT_FBTFT_DEVICE=m
|
||||
FILES:=\
|
||||
$(LINUX_DIR)/drivers/staging/fbtft/fbtft_device.ko \
|
||||
$(LINUX_DIR)/drivers/staging/fbtft/flexfb.ko \
|
||||
$(LINUX_DIR)/drivers/staging/fbtft/fb_agm1264k-fl.ko \
|
||||
$(LINUX_DIR)/drivers/staging/fbtft/fb_bd663474.ko \
|
||||
$(LINUX_DIR)/drivers/staging/fbtft/fb_hx8340bn.ko \
|
||||
$(LINUX_DIR)/drivers/staging/fbtft/fb_hx8347d.ko \
|
||||
$(LINUX_DIR)/drivers/staging/fbtft/fb_hx8353d.ko \
|
||||
$(LINUX_DIR)/drivers/staging/fbtft/fb_hx8357d.ko \
|
||||
$(LINUX_DIR)/drivers/staging/fbtft/fb_ili9163.ko \
|
||||
$(LINUX_DIR)/drivers/staging/fbtft/fb_ili9320.ko \
|
||||
$(LINUX_DIR)/drivers/staging/fbtft/fb_ili9325.ko \
|
||||
$(LINUX_DIR)/drivers/staging/fbtft/fb_ili9340.ko \
|
||||
$(LINUX_DIR)/drivers/staging/fbtft/fb_ili9341.ko \
|
||||
$(LINUX_DIR)/drivers/staging/fbtft/fb_ili9481.ko \
|
||||
$(LINUX_DIR)/drivers/staging/fbtft/fb_ili9486.ko \
|
||||
$(LINUX_DIR)/drivers/staging/fbtft/fb_pcd8544.ko \
|
||||
$(LINUX_DIR)/drivers/staging/fbtft/fb_ra8875.ko \
|
||||
$(LINUX_DIR)/drivers/staging/fbtft/fb_s6d02a1.ko \
|
||||
$(LINUX_DIR)/drivers/staging/fbtft/fb_s6d1121.ko \
|
||||
$(LINUX_DIR)/drivers/staging/fbtft/fb_sh1106.ko \
|
||||
$(LINUX_DIR)/drivers/staging/fbtft/fb_ssd1289.ko \
|
||||
$(LINUX_DIR)/drivers/staging/fbtft/fb_ssd1305.ko \
|
||||
$(LINUX_DIR)/drivers/staging/fbtft/fb_ssd1306.ko \
|
||||
$(LINUX_DIR)/drivers/staging/fbtft/fb_ssd1325.ko \
|
||||
$(LINUX_DIR)/drivers/staging/fbtft/fb_ssd1331.ko \
|
||||
$(LINUX_DIR)/drivers/staging/fbtft/fb_ssd1351.ko \
|
||||
$(LINUX_DIR)/drivers/staging/fbtft/fb_st7735r.ko \
|
||||
$(LINUX_DIR)/drivers/staging/fbtft/fb_st7789v.ko \
|
||||
$(LINUX_DIR)/drivers/staging/fbtft/fb_tinylcd.ko \
|
||||
$(LINUX_DIR)/drivers/staging/fbtft/fb_tls8204.ko \
|
||||
$(LINUX_DIR)/drivers/staging/fbtft/fb_uc1611.ko \
|
||||
$(LINUX_DIR)/drivers/staging/fbtft/fb_uc1701.ko \
|
||||
$(LINUX_DIR)/drivers/staging/fbtft/fb_upd161704.ko \
|
||||
$(LINUX_DIR)/drivers/staging/fbtft/fb_watterott.ko
|
||||
|
||||
AUTOLOAD:=$(call AutoLoad,06,fbtft_device)
|
||||
endef
|
||||
|
||||
define KernelPackage/fb-tft-all/description
|
||||
Kernel support for small TFT LCD display modules
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,fb-tft-all))
|
|
@ -1,65 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2012-2016 OpenWrt.org
|
||||
# Copyright (C) 2017 LEDE project
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
#include $(INCLUDE_DIR)/image.mk
|
||||
|
||||
PKG_NAME:=mt7623n-preloader
|
||||
PKG_VERSION:=2017-08-03
|
||||
PKG_RELEASE:=888ad5203d0c9d7dd3d6855c2a9234a70d78dc50
|
||||
|
||||
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)/$(PKG_NAME)-$(PKG_RELEASE)
|
||||
|
||||
PKG_FLAGS:=nonshared
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
BPI_PRELOADER_URL:=@GITHUB/BPI-SINOVOIP/BPI-files/$(PKG_RELEASE)/SD/100MB/
|
||||
BPI_PRELOADER_PREFIX:=bpi-preloader-$(PKG_RELEASE)
|
||||
|
||||
define Download/BPI-R2-preloader-2k.img.gz
|
||||
FILE:=$(BPI_PRELOADER_PREFIX)-BPI-R2-preloader-2k.img.gz
|
||||
URL:=$(BPI_PRELOADER_URL)
|
||||
URL_FILE:=BPI-R2-preloader-2k.img.gz
|
||||
HASH:=9a961a26be17dd410866a2385fca47b6f0e7cce88eed6248ff5fb145cf935d93
|
||||
endef
|
||||
$(eval $(call Download,BPI-R2-preloader-2k.img.gz))
|
||||
|
||||
|
||||
define Package/mt7623n-preloader
|
||||
SECTION:=boot
|
||||
CATEGORY:=Boot Loaders
|
||||
DEPENDS:=@TARGET_mediatek_mt7623
|
||||
TITLE:=mt7623n-preloader
|
||||
DEFAULT:=y if TARGET_mediatek
|
||||
endef
|
||||
|
||||
define Package/mt7623n-preloader/description
|
||||
Preloader image for mt7623n based boards like Bannana Pi R2.
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
rm -rf $(PKG_BUILD_DIR)
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
cp $(DL_DIR)/$(BPI_PRELOADER_PREFIX)-BPI-R2-preloader-2k.img.gz $(PKG_BUILD_DIR)/bpi-r2-preloader.bin.gz
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
true
|
||||
endef
|
||||
|
||||
define Package/brcm2708-gpu-fw/install
|
||||
true
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
mkdir -p $(STAGING_DIR_IMAGE)
|
||||
gunzip -c $(PKG_BUILD_DIR)/bpi-r2-preloader.bin.gz > $(STAGING_DIR_IMAGE)/bpi-r2-preloader.bin
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,mt7623n-preloader))
|
|
@ -0,0 +1,40 @@
|
|||
--- a/options.h
|
||||
+++ b/options.h
|
||||
@@ -341,6 +341,8 @@ struct fw3_zone
|
||||
struct list_head masq_src;
|
||||
struct list_head masq_dest;
|
||||
|
||||
+ bool fullcone;
|
||||
+
|
||||
bool mtu_fix;
|
||||
|
||||
struct list_head cthelpers;
|
||||
--- a/zones.c
|
||||
+++ b/zones.c
|
||||
@@ -77,6 +77,8 @@ const struct fw3_option fw3_zone_opts[]
|
||||
FW3_LIST("masq_src", network, zone, masq_src),
|
||||
FW3_LIST("masq_dest", network, zone, masq_dest),
|
||||
|
||||
+ FW3_OPT("fullcone", bool, zone, fullcone),
|
||||
+
|
||||
FW3_OPT("extra", string, zone, extra_src),
|
||||
FW3_OPT("extra_src", string, zone, extra_src),
|
||||
FW3_OPT("extra_dest", string, zone, extra_dest),
|
||||
@@ -709,7 +711,16 @@ print_zone_rule(struct fw3_ipt_handle *h
|
||||
(mdest = next_addr(mdest, &zone->masq_dest,
|
||||
handle->family, false)) || first_dest;
|
||||
first_dest = false)
|
||||
- {
|
||||
+ if (zone->fullcone && (access("/usr/lib/iptables/libipt_FULLCONENAT.so", 0) == 0)) {
|
||||
+ r = fw3_ipt_rule_new(handle);
|
||||
+ fw3_ipt_rule_src_dest(r, msrc, mdest);
|
||||
+ fw3_ipt_rule_target(r, "FULLCONENAT");
|
||||
+ fw3_ipt_rule_append(r, "zone_%s_postrouting", zone->name);
|
||||
+ r = fw3_ipt_rule_new(handle);
|
||||
+ fw3_ipt_rule_src_dest(r, msrc, mdest);
|
||||
+ fw3_ipt_rule_target(r, "FULLCONENAT");
|
||||
+ fw3_ipt_rule_append(r, "zone_%s_prerouting", zone->name);
|
||||
+ } else {
|
||||
r = fw3_ipt_rule_new(handle);
|
||||
fw3_ipt_rule_src_dest(r, msrc, mdest);
|
||||
fw3_ipt_rule_target(r, "MASQUERADE");
|
6501
root/target/linux/generic/config-5.4
Normal file
6501
root/target/linux/generic/config-5.4
Normal file
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
23667
root/target/linux/generic/hack-5.4/690-mptcp_trunk.patch
Normal file
23667
root/target/linux/generic/hack-5.4/690-mptcp_trunk.patch
Normal file
File diff suppressed because it is too large
Load diff
1037
root/target/linux/generic/hack-5.4/692-tcp_nanqinlang.patch
Normal file
1037
root/target/linux/generic/hack-5.4/692-tcp_nanqinlang.patch
Normal file
File diff suppressed because it is too large
Load diff
116
root/target/linux/generic/hack-5.4/998-ndpi-netfilter.patch
Normal file
116
root/target/linux/generic/hack-5.4/998-ndpi-netfilter.patch
Normal file
|
@ -0,0 +1,116 @@
|
|||
diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h
|
||||
index 21f887c..59980ec 100644
|
||||
--- a/include/net/netfilter/nf_conntrack_extend.h
|
||||
+++ b/include/net/netfilter/nf_conntrack_extend.h
|
||||
@@ -28,7 +28,8 @@ enum nf_ct_ext_id {
|
||||
#if IS_ENABLED(CONFIG_NETFILTER_SYNPROXY)
|
||||
NF_CT_EXT_SYNPROXY,
|
||||
#endif
|
||||
- NF_CT_EXT_NUM,
|
||||
+ NF_CT_EXT_CUSTOM,
|
||||
+ NF_CT_EXT_NUM=NF_CT_EXT_CUSTOM+CONFIG_NF_CONNTRACK_CUSTOM,
|
||||
};
|
||||
|
||||
#define NF_CT_EXT_HELPER_TYPE struct nf_conn_help
|
||||
@@ -96,5 +97,6 @@ struct nf_ct_ext_type {
|
||||
};
|
||||
|
||||
int nf_ct_extend_register(const struct nf_ct_ext_type *type);
|
||||
+int nf_ct_extend_custom_register(struct nf_ct_ext_type *type,unsigned long int cid);
|
||||
void nf_ct_extend_unregister(const struct nf_ct_ext_type *type);
|
||||
#endif /* _NF_CONNTRACK_EXTEND_H */
|
||||
diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig
|
||||
index 7581e82..30a11eb 100644
|
||||
--- a/net/netfilter/Kconfig
|
||||
+++ b/net/netfilter/Kconfig
|
||||
@@ -85,6 +85,16 @@ config NF_CONNTRACK_SECMARK
|
||||
|
||||
If unsure, say 'N'.
|
||||
|
||||
+config NF_CONNTRACK_CUSTOM
|
||||
+ int "Number of custom extend"
|
||||
+ range 0 8
|
||||
+ depends on NETFILTER_ADVANCED
|
||||
+ default "2"
|
||||
+ help
|
||||
+ This parameter specifies how many custom extensions can be registered.
|
||||
+
|
||||
+ The default value is 2.
|
||||
+
|
||||
config NF_CONNTRACK_ZONES
|
||||
bool 'Connection tracking zones'
|
||||
depends on NETFILTER_ADVANCED
|
||||
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
|
||||
index 85f643c..44e2fdd 100644
|
||||
--- a/net/netfilter/nf_conntrack_core.c
|
||||
+++ b/net/netfilter/nf_conntrack_core.c
|
||||
@@ -1971,7 +1971,7 @@ int nf_conntrack_set_hashsize(const char *val, const struct kernel_param *kp)
|
||||
static __always_inline unsigned int total_extension_size(void)
|
||||
{
|
||||
/* remember to add new extensions below */
|
||||
- BUILD_BUG_ON(NF_CT_EXT_NUM > 9);
|
||||
+ BUILD_BUG_ON(NF_CT_EXT_NUM > 12);
|
||||
|
||||
return sizeof(struct nf_ct_ext) +
|
||||
sizeof(struct nf_conn_help)
|
||||
diff --git a/net/netfilter/nf_conntrack_extend.c b/net/netfilter/nf_conntrack_extend.c
|
||||
index 9fe0ddc..5a9054e 100644
|
||||
--- a/net/netfilter/nf_conntrack_extend.c
|
||||
+++ b/net/netfilter/nf_conntrack_extend.c
|
||||
@@ -108,11 +108,56 @@ int nf_ct_extend_register(const struct nf_ct_ext_type *type)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(nf_ct_extend_register);
|
||||
|
||||
+static unsigned long int nf_ct_ext_cust_id[CONFIG_NF_CONNTRACK_CUSTOM];
|
||||
+static enum nf_ct_ext_id
|
||||
+nf_ct_extend_get_custom_id(unsigned long int ext_id);
|
||||
+
|
||||
+int nf_ct_extend_custom_register(struct nf_ct_ext_type *type,
|
||||
+ unsigned long int cid)
|
||||
+{
|
||||
+ int ret;
|
||||
+ enum nf_ct_ext_id new_id = nf_ct_extend_get_custom_id(cid);
|
||||
+ if(!new_id)
|
||||
+ return -EBUSY;
|
||||
+ type->id = new_id;
|
||||
+ ret = nf_ct_extend_register(type);
|
||||
+ if(ret < 0) {
|
||||
+ mutex_lock(&nf_ct_ext_type_mutex);
|
||||
+ nf_ct_ext_cust_id[new_id - NF_CT_EXT_CUSTOM] = 0;
|
||||
+ mutex_unlock(&nf_ct_ext_type_mutex);
|
||||
+ }
|
||||
+ return ret;
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(nf_ct_extend_custom_register);
|
||||
+
|
||||
+static enum nf_ct_ext_id
|
||||
+nf_ct_extend_get_custom_id(unsigned long int ext_id)
|
||||
+{
|
||||
+ enum nf_ct_ext_id ret = 0;
|
||||
+ int i;
|
||||
+ mutex_lock(&nf_ct_ext_type_mutex);
|
||||
+ for(i = 0; i < CONFIG_NF_CONNTRACK_CUSTOM; i++) {
|
||||
+ if(!nf_ct_ext_cust_id[i]) {
|
||||
+ nf_ct_ext_cust_id[i] = ext_id;
|
||||
+ ret = i+NF_CT_EXT_CUSTOM;
|
||||
+ break;
|
||||
+ }
|
||||
+ if(nf_ct_ext_cust_id[i] == ext_id) {
|
||||
+ ret = i+NF_CT_EXT_CUSTOM;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ mutex_unlock(&nf_ct_ext_type_mutex);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
/* This MUST be called in process context. */
|
||||
void nf_ct_extend_unregister(const struct nf_ct_ext_type *type)
|
||||
{
|
||||
mutex_lock(&nf_ct_ext_type_mutex);
|
||||
RCU_INIT_POINTER(nf_ct_ext_types[type->id], NULL);
|
||||
+ if(type->id >= NF_CT_EXT_CUSTOM && type->id < NF_CT_EXT_NUM)
|
||||
+ nf_ct_ext_cust_id[type->id-NF_CT_EXT_CUSTOM] = 0;
|
||||
mutex_unlock(&nf_ct_ext_type_mutex);
|
||||
synchronize_rcu();
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
--- a/net/core/dev.c 2018-08-10 10:31:41.199494561 +0200
|
||||
+++ b/net/core/dev.c 2018-08-10 10:32:03.635272509 +0200
|
||||
@@ -6613,9 +6613,11 @@
|
||||
}
|
||||
}
|
||||
if (dev->flags != old_flags) {
|
||||
+ /*
|
||||
pr_info("device %s %s promiscuous mode\n",
|
||||
dev->name,
|
||||
dev->flags & IFF_PROMISC ? "entered" : "left");
|
||||
+ */
|
||||
if (audit_enabled) {
|
||||
current_uid_gid(&uid, &gid);
|
||||
audit_log(current->audit_context, GFP_ATOMIC,
|
19
root/target/linux/mediatek/Makefile
Normal file
19
root/target/linux/mediatek/Makefile
Normal file
|
@ -0,0 +1,19 @@
|
|||
# Copyright (c) 2015 OpenWrt.org
|
||||
#
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
ARCH:=arm
|
||||
BOARD:=mediatek
|
||||
BOARDNAME:=MediaTek Ralink ARM
|
||||
SUBTARGETS:=mt7622 mt7623 mt7629
|
||||
FEATURES:=squashfs nand ramdisk fpu ext4 usb
|
||||
|
||||
KERNEL_PATCHVER:=5.4
|
||||
KERNEL_TESTING_PATCHVER:=5.4
|
||||
|
||||
include $(INCLUDE_DIR)/target.mk
|
||||
DEFAULT_PACKAGES += \
|
||||
kmod-leds-gpio kmod-gpio-button-hotplug \
|
||||
wpad-mini uboot-envtools partx-utils e2fsprogs
|
||||
|
||||
$(eval $(call BuildTarget))
|
|
@ -1,104 +0,0 @@
|
|||
#
|
||||
# Copyright (C) 2012-2015 OpenWrt.org
|
||||
# Copyright (C) 2016-2017 LEDE project
|
||||
#
|
||||
# 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
|
||||
|
||||
# for arm
|
||||
KERNEL_LOADADDR := 0x80008000
|
||||
|
||||
# for arm64
|
||||
ifeq ($(SUBTARGET),mt7622)
|
||||
KERNEL_LOADADDR = 0x41080000
|
||||
endif
|
||||
|
||||
ifndef $(CONFIG_TARGET_ROOTFS_PARTSIZE)
|
||||
CONFIG_TARGET_ROOTFS_PARTSIZE := 512
|
||||
endif
|
||||
|
||||
ifndef $(CONFIG_TARGET_KERNEL_PARTSIZE)
|
||||
CONFIG_TARGET_KERNEL_PARTSIZE := 64
|
||||
endif
|
||||
|
||||
FAT32_BLOCK_SIZE=1024
|
||||
FAT32_BLOCKS=$(shell echo $$(($(CONFIG_TARGET_KERNEL_PARTSIZE)*1024*1024/$(FAT32_BLOCK_SIZE))))
|
||||
|
||||
define Build/mediatek-sdcard
|
||||
rm -f $@.boot
|
||||
mkfs.fat $@.boot -C $(FAT32_BLOCKS)
|
||||
mcopy -i $@.boot $(STAGING_DIR_IMAGE)/$(DEVICE_NAME)-uEnv.txt ::uEnv.txt
|
||||
mcopy -i $@.boot $(IMAGE_KERNEL) ::uImage
|
||||
./gen_mediatek_sdcard_img.sh $@ \
|
||||
$(STAGING_DIR_IMAGE)/bpi-r2-preloader.bin \
|
||||
$(STAGING_DIR_IMAGE)/$(DEVICE_NAME)-uboot-mediatek.bin \
|
||||
$@.boot \
|
||||
$(IMAGE_ROOTFS) \
|
||||
$(CONFIG_TARGET_KERNEL_PARTSIZE) \
|
||||
$(CONFIG_TARGET_ROOTFS_PARTSIZE)
|
||||
rm -f $@.boot
|
||||
endef
|
||||
|
||||
define Build/sysupgrade-emmc
|
||||
rm -f $@.recovery
|
||||
mkfs.fat -C $@.recovery 3070
|
||||
|
||||
dd bs="512" of="$@" if="$(IMAGE_KERNEL)"
|
||||
dd bs="512" of="$@" if="$@.recovery" seek="67072"
|
||||
dd bs="512" of="$@" if="$(IMAGE_ROOTFS)" seek="87552"
|
||||
dd if=/dev/zero of="$@" bs=128k count=1 oflag=append conv=notrunc
|
||||
endef
|
||||
|
||||
define Build/sysupgrade-bpi-r2-sd
|
||||
dd bs="1024" if="$(STAGING_DIR_IMAGE)/mtk-bpi-r2-preloader-sd.bin" of="$@" seek="0"
|
||||
dd bs="1024" if="$(STAGING_DIR_IMAGE)/mtk-bpi-r2-uboot.bin" of="$@" seek="320"
|
||||
dd bs="1024" if="$(IMAGE_KERNEL)" of="$@" seek="2048"
|
||||
dd bs="1024" if="$(IMAGE_ROOTFS)" of="$@" seek="67584"
|
||||
endef
|
||||
define Build/sysupgrade-bpi-r2-emmc
|
||||
dd bs="1024" if="$(STAGING_DIR_IMAGE)/mtk-bpi-r2-preloader-emmc.bin" of="$@" seek="0"
|
||||
dd bs="1024" if="$(STAGING_DIR_IMAGE)/mtk-bpi-r2-uboot.bin" of="$@" seek="320"
|
||||
dd bs="1024" if="$(IMAGE_KERNEL)" of="$@" seek="2048"
|
||||
dd bs="1024" if="$(IMAGE_ROOTFS)" of="$@" seek="67584"
|
||||
endef
|
||||
|
||||
# default all platform image(fit) build
|
||||
define Device/Default
|
||||
PROFILES = Default $$(DEVICE_NAME)
|
||||
KERNEL_NAME := zImage
|
||||
# FILESYSTEMS := squashfs
|
||||
DEVICE_DTS_DIR := $(DTS_DIR)
|
||||
IMAGES := sysupgrade.bin
|
||||
IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata
|
||||
ifeq ($(SUBTARGET),mt7623)
|
||||
DEVICE_VARS := MEDIATEK_UBOOT
|
||||
KERNEL_NAME := zImage
|
||||
KERNEL := kernel-bin | append-dtb | uImage none
|
||||
KERNEL_INITRAMFS := kernel-bin | append-dtb | uImage none
|
||||
FILESYSTEMS := ext4
|
||||
endif
|
||||
ifeq ($(SUBTARGET),mt7622)
|
||||
FILESYSTEMS := squashfs
|
||||
KERNEL_NAME := Image
|
||||
KERNEL = kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
|
||||
KERNEL_INITRAMFS = kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
|
||||
endif
|
||||
endef
|
||||
|
||||
ifeq ($(SUBTARGET),mt7622)
|
||||
include mt7622.mk
|
||||
endif
|
||||
|
||||
ifeq ($(SUBTARGET),mt7623)
|
||||
include mt7623.mk
|
||||
endif
|
||||
|
||||
define Image/Build
|
||||
$(call Image/Build/$(1),$(1))
|
||||
endef
|
||||
|
||||
$(eval $(call BuildImage))
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (C) 2013 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
set -e
|
||||
[ $# -eq 7 ] || {
|
||||
echo "SYNTAX: $0 <file> <preloader image> <u-boot image> <bootfs image> <rootfs image> <bootfs size> <rootfs size>"
|
||||
exit 1
|
||||
}
|
||||
|
||||
OUTPUT="$1"
|
||||
PRELOADER="$2"
|
||||
UBOOT="$3"
|
||||
BOOTFS="$4"
|
||||
ROOTFS="$5"
|
||||
BOOTFSSIZE="$6"
|
||||
ROOTFSSIZE="$7"
|
||||
|
||||
head=4
|
||||
sect=63
|
||||
|
||||
set `ptgen -o $OUTPUT -h $head -s $sect -l 1024 -t c -p ${BOOTFSSIZE}M -t 83 -p ${ROOTFSSIZE}M -a 0`
|
||||
|
||||
BOOT_OFFSET="$(($1 / 512))"
|
||||
BOOT_SIZE="$(($2 / 512))"
|
||||
ROOTFS_OFFSET="$(($3 / 512))"
|
||||
ROOTFS_SIZE="$(($4 / 512))"
|
||||
|
||||
PRELOADER_OFFSET=2 # 2KB
|
||||
UBOOT_OFFSET=320 # 320KB
|
||||
|
||||
SDMMC_BOOT="SDMMC_BOOT\x00\x00\x01\x00\x00\x00\x00\x02\x00\x00"
|
||||
BRLYT="\
|
||||
BRLYT\x00\x00\x00\x01\x00\x00\x00\x00\x08\x00\x00\
|
||||
\x00\x08\x00\x00\x42\x42\x42\x42\x08\x00\x01\x00\x00\x08\x00\x00\
|
||||
\x00\x08\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
|
||||
|
||||
echo -en "${SDMMC_BOOT}" | dd bs=1 of="${OUTPUT}" seek=0 conv=notrunc
|
||||
echo -en "${BRLYT}" | dd bs=1 of="${OUTPUT}" seek=512 conv=notrunc
|
||||
|
||||
dd bs=1024 if="${PRELOADER}" of="${OUTPUT}" seek="${PRELOADER_OFFSET}" conv=notrunc
|
||||
dd bs=1024 if="${UBOOT}" of="${OUTPUT}" seek="${UBOOT_OFFSET}" conv=notrunc
|
||||
dd bs=512 if="${BOOTFS}" of="${OUTPUT}" seek="${BOOT_OFFSET}" conv=notrunc
|
||||
dd bs=512 if="${ROOTFS}" of="${OUTPUT}" seek="${ROOTFS_OFFSET}" conv=notrunc
|
|
@ -1,26 +0,0 @@
|
|||
define Device/7623a-unielec-u7623-02-emmc-512m
|
||||
DEVICE_TITLE := MTK7623a UniElec U7623-02 (eMMC/512MB RAM)
|
||||
DEVICE_DTS := mt7623a-unielec-u7623-02-emmc-512M
|
||||
DEVICE_PACKAGES := mkf2fs e2fsprogs kmod-fs-vfat kmod-nls-cp437 kmod-nls-iso8859-1 kmod-mmc
|
||||
SUPPORTED_DEVICES := unielec,u7623-02-emmc-512m
|
||||
IMAGES := sysupgrade-emmc.bin.gz
|
||||
IMAGE/sysupgrade-emmc.bin.gz := sysupgrade-emmc | gzip | append-metadata
|
||||
endef
|
||||
|
||||
TARGET_DEVICES += 7623a-unielec-u7623-02-emmc-512m
|
||||
|
||||
define Device/7623n-bananapi-bpi-r2
|
||||
DEVICE_TITLE := MTK7623n BananaPi R2
|
||||
DEVICE_DTS := mt7623n-bananapi-bpi-r2
|
||||
# DEVICE_PACKAGES := wmt uboot-mtk-bpi-r2 kmod-crypto-hw-mtk kmod-nat-hw-mtk
|
||||
DEVICE_PACKAGES := wmt uboot-mtk-bpi-r2 kmod-crypto-hw-mtk kmod-mt6625l-wlan-gen2 kmod-usb-core kmod-ata-core kmod-usb3 kmod-usb2 kmod-usb-ohci mt7623n-preloader
|
||||
SUPPORTED_DEVICES := bananapi,bpi-r2
|
||||
IMAGES := sysupgrade.tar sysupgrade-sd.img.gz sysupgrade-emmc.img.gz sdcard.img.gz
|
||||
# IMAGES := sdcard.img.gz
|
||||
IMAGE/sysupgrade.tar := sysupgrade-tar | append-metadata
|
||||
IMAGE/sysupgrade-sd.img.gz := sysupgrade-bpi-r2-sd | gzip | append-metadata
|
||||
IMAGE/sysupgrade-emmc.img.gz := sysupgrade-bpi-r2-emmc | gzip | append-metadata
|
||||
IMAGE/sdcard.img.gz := mediatek-sdcard | gzip | append-metadata
|
||||
endef
|
||||
|
||||
TARGET_DEVICES += 7623n-bananapi-bpi-r2
|
|
@ -6,7 +6,7 @@ define KernelPackage/ata-ahci-mtk
|
|||
$(LINUX_DIR)/drivers/ata/libahci_platform.ko
|
||||
AUTOLOAD:=$(call AutoLoad,40,libahci libahci_platform ahci_mtk,1)
|
||||
$(call AddDepends/ata)
|
||||
DEPENDS+=@TARGET_mediatek_mt7622
|
||||
DEPENDS+=@(TARGET_mediatek_mt7622||TARGET_mediatek_mt7623)
|
||||
endef
|
||||
|
||||
define KernelPackage/ata-ahci-mtk/description
|
||||
|
@ -49,38 +49,3 @@ define KernelPackage/crypto-hw-mtk/description
|
|||
endef
|
||||
|
||||
$(eval $(call KernelPackage,crypto-hw-mtk))
|
||||
|
||||
define KernelPackage/nat-hw-mtk
|
||||
TITLE:= MediaTek's hardware NAT module
|
||||
DEPENDS:=@TARGET_mediatek @!LINUX_4_19
|
||||
KCONFIG:= \
|
||||
CONFIG_NET_MEDIATEK_HNAT=y
|
||||
FILES:=$(LINUX_DIR)/drivers/net/ethernet/mediatek/mtk_hnat/mtkhnat.ko
|
||||
AUTOLOAD:=$(call AutoLoad,90,mtkhnat)
|
||||
endef
|
||||
|
||||
define KernelPackage/nat-hw-mtk/description
|
||||
MediaTek's hardware NAT driver.
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,nat-hw-mtk))
|
||||
|
||||
define KernelPackage/mt6625l-wlan-gen2
|
||||
SUBMENU:=$(NETWORK_DEVICES_MENU)
|
||||
TITLE:=Mediatek mt66xx wlan_gen2 driver
|
||||
DEPENDS:=@TARGET_mediatek +kmod-mac80211 +@DRIVER_11N_SUPPORT
|
||||
KCONFIG:= \
|
||||
CONFIG_MTK_WAPI_SUPPORT=y \
|
||||
CONFIG_MTK_PASSPOINT_R1_SUPPORT=y \
|
||||
CONFIG_MTK_PASSPOINT_R2_SUPPORT=y \
|
||||
CONFIG_MTK_WIFI_MCC_SUPPORT=y \
|
||||
CONFIG_MTK_COMBO_WIFI
|
||||
FILES:=$(LINUX_DIR)/drivers/misc/mediatek/connectivity/wlan/gen2/wlan_gen2.ko
|
||||
AUTOLOAD:=$(call AutoProbe,wlan_gen2)
|
||||
endef
|
||||
|
||||
define KernelPackage/wlan-gen2/description
|
||||
This package contains the Mediatek mt66xx wlan_gen2 kernel module
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,mt6625l-wlan-gen2))
|
|
@ -9,13 +9,9 @@ mediatek_setup_interfaces()
|
|||
local board="$1"
|
||||
|
||||
case $board in
|
||||
'mediatek,mt7623a-rfb-emmc')
|
||||
ucidef_set_interface_lan "lan0 lan1 lan2 lan3"
|
||||
ucidef_set_interface_wan eth1
|
||||
;;
|
||||
'bananapi,bpi-r2'|\
|
||||
"unielec,u7623"*)
|
||||
ucidef_set_interface_lan "lan"
|
||||
bananapi,bpi-r2|\
|
||||
unielec,u7623-02-emmc-512m)
|
||||
ucidef_set_interfaces_lan_wan "wan1 wan2 wan3 wan4" "lan"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
@ -25,9 +21,8 @@ mediatek_setup_macs()
|
|||
local board="$1"
|
||||
|
||||
case $board in
|
||||
"unielec,u7623"*)
|
||||
mac=$(cat /sys/class/net/wan/address)
|
||||
ucidef_set_interface_macaddr "lan" $mac
|
||||
unielec,u7623-02-emmc-512m)
|
||||
ucidef_set_interface_macaddr "lan" "$(cat /sys/class/net/lan/address)"
|
||||
;;
|
||||
esac
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
#!/bin/sh
|
||||
# Copyright (C) 2018 OpenWrt.org
|
||||
|
||||
RECOVERY_PART=/dev/mmcblk0p1
|
||||
|
||||
preinit_set_mac_address() {
|
||||
local mac
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/functions/system.sh
|
||||
|
||||
case $(board_name) in
|
||||
unielec,u7623-02-emmc-512m)
|
||||
if [ -b $RECOVERY_PART ]; then
|
||||
insmod nls_cp437
|
||||
insmod nls_iso8859-1
|
||||
insmod fat
|
||||
insmod vfat
|
||||
mkdir -p /tmp/recovery
|
||||
mount -o rw,noatime $RECOVERY_PART /tmp/recovery
|
||||
|
||||
if [ -f "/tmp/recovery/mac_addr" ];
|
||||
then
|
||||
mac=$(cat /tmp/recovery/mac_addr)
|
||||
else
|
||||
mac=$(cat /sys/class/net/eth0/address)
|
||||
echo "$mac" > /tmp/recovery/mac_addr
|
||||
fi
|
||||
|
||||
sync
|
||||
umount /tmp/recovery
|
||||
rm -rf /tmp/recovery
|
||||
fi
|
||||
|
||||
ip link set dev lan address $mac 2> /dev/null
|
||||
|
||||
mac=$(macaddr_add $mac 1)
|
||||
|
||||
ip link set dev wan1 address $mac 2>/dev/null
|
||||
ip link set dev wan2 address $mac 2>/dev/null
|
||||
ip link set dev wan3 address $mac 2>/dev/null
|
||||
ip link set dev wan4 address $mac 2>/dev/null
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
boot_hook_add preinit_main preinit_set_mac_address
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/sh
|
||||
# Copyright (C) 2012-2015 OpenWrt.org
|
||||
|
||||
move_config() {
|
||||
local partdev
|
||||
|
||||
. /lib/upgrade/common.sh
|
||||
|
||||
if export_bootdevice && export_partdevice partdev -1; then
|
||||
if mount -t vfat -o rw,noatime "/dev/$partdev" /mnt; then
|
||||
if [ -f /mnt/sysupgrade.tgz ]; then
|
||||
mv -f /mnt/sysupgrade.tgz /
|
||||
fi
|
||||
umount /mnt
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
boot_hook_add preinit_mount_root move_config
|
154
root/target/linux/mediatek/mt7623/base-files/lib/upgrade/platform.sh
Executable file
154
root/target/linux/mediatek/mt7623/base-files/lib/upgrade/platform.sh
Executable file
|
@ -0,0 +1,154 @@
|
|||
platform_do_upgrade() {
|
||||
local board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
unielec,u7623-02-emmc-512m)
|
||||
#Keep the persisten random mac address (if it exists)
|
||||
mkdir -p /tmp/recovery
|
||||
mount -o rw,noatime /dev/mmcblk0p1 /tmp/recovery
|
||||
[ -f "/tmp/recovery/mac_addr" ] && \
|
||||
mv -f /tmp/recovery/mac_addr /tmp/
|
||||
umount /tmp/recovery
|
||||
|
||||
#1310720 is the offset in bytes from the start of eMMC and to
|
||||
#the location of the kernel (2560 512 byte sectors)
|
||||
get_image "$1" | dd of=/dev/mmcblk0 bs=1310720 seek=1 conv=fsync
|
||||
|
||||
mount -o rw,noatime /dev/mmcblk0p1 /tmp/recovery
|
||||
[ -f "/tmp/mac_addr" ] && mv -f /tmp/mac_addr /tmp/recovery
|
||||
sync
|
||||
umount /tmp/recovery
|
||||
;;
|
||||
bananapi,bpi-r2)
|
||||
local diskdev partdev diff
|
||||
|
||||
export_bootdevice && export_partdevice diskdev -2 || {
|
||||
echo "Unable to determine upgrade device"
|
||||
return 1
|
||||
}
|
||||
|
||||
sync
|
||||
|
||||
if [ "$SAVE_PARTITIONS" = "1" ]; then
|
||||
get_partitions "/dev/$diskdev" bootdisk
|
||||
|
||||
#extract the boot sector from the image
|
||||
get_image "$@" | dd of=/tmp/image.bs count=1 bs=512b
|
||||
|
||||
get_partitions /tmp/image.bs image
|
||||
|
||||
#compare tables
|
||||
diff="$(grep -F -x -v -f /tmp/partmap.bootdisk /tmp/partmap.image)"
|
||||
else
|
||||
diff=1
|
||||
fi
|
||||
|
||||
if [ -n "$diff" ]; then
|
||||
get_image "$@" | dd of="/dev/$diskdev" bs=4096 conv=fsync
|
||||
|
||||
# Separate removal and addtion is necessary; otherwise, partition 1
|
||||
# will be missing if it overlaps with the old partition 2
|
||||
partx -d - "/dev/$diskdev"
|
||||
partx -a - "/dev/$diskdev"
|
||||
|
||||
return 0
|
||||
fi
|
||||
|
||||
#write uboot image
|
||||
get_image "$@" | dd of="$diskdev" bs=1024 skip=320 seek=320 count=700 conv=fsync
|
||||
#iterate over each partition from the image and write it to the boot disk
|
||||
while read part start size; do
|
||||
part="$(($part - 2))"
|
||||
if export_partdevice partdev $part; then
|
||||
echo "Writing image to /dev/$partdev..."
|
||||
get_image "$@" | dd of="/dev/$partdev" ibs="512" obs=1M skip="$start" count="$size" conv=fsync
|
||||
else
|
||||
echo "Unable to find partition $part device, skipped."
|
||||
fi
|
||||
done < /tmp/partmap.image
|
||||
|
||||
#copy partition uuid
|
||||
echo "Writing new UUID to /dev/$diskdev..."
|
||||
get_image "$@" | dd of="/dev/$diskdev" bs=1 skip=440 count=4 seek=440 conv=fsync
|
||||
;;
|
||||
*)
|
||||
default_do_upgrade "$1"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
PART_NAME=firmware
|
||||
|
||||
platform_check_image() {
|
||||
local board=$(board_name)
|
||||
local magic="$(get_magic_long "$1")"
|
||||
|
||||
[ "$#" -gt 1 ] && return 1
|
||||
|
||||
case "$board" in
|
||||
unielec,u7623-02-emmc-512m)
|
||||
[ "$magic" != "27051956" ] && {
|
||||
echo "Invalid image type."
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
;;
|
||||
bananapi,bpi-r2)
|
||||
local diskdev partdev diff
|
||||
|
||||
export_bootdevice && export_partdevice diskdev -2 || {
|
||||
echo "Unable to determine upgrade device"
|
||||
return 1
|
||||
}
|
||||
|
||||
get_partitions "/dev/$diskdev" bootdisk
|
||||
|
||||
#extract the boot sector from the image
|
||||
get_image "$@" | dd of=/tmp/image.bs count=1 bs=512b 2>/dev/null
|
||||
|
||||
get_partitions /tmp/image.bs image
|
||||
|
||||
#compare tables
|
||||
diff="$(grep -F -x -v -f /tmp/partmap.bootdisk /tmp/partmap.image)"
|
||||
|
||||
rm -f /tmp/image.bs /tmp/partmap.bootdisk /tmp/partmap.image
|
||||
|
||||
if [ -n "$diff" ]; then
|
||||
echo "Partition layout has changed. Full image will be written."
|
||||
ask_bool 0 "Abort" && exit 1
|
||||
return 0
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Sysupgrade is not supported on your board yet."
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
platform_copy_config_emmc() {
|
||||
mkdir -p /recovery
|
||||
mount -o rw,noatime /dev/mmcblk0p1 /recovery
|
||||
cp -af "$UPGRADE_BACKUP" "/recovery/$BACKUP_FILE"
|
||||
sync
|
||||
umount /recovery
|
||||
}
|
||||
|
||||
platform_copy_config() {
|
||||
case "$(board_name)" in
|
||||
unielec,u7623-02-emmc-512m)
|
||||
platform_copy_config_emmc
|
||||
;;
|
||||
bananapi,bpi-r2)
|
||||
local partdev
|
||||
|
||||
if export_partdevice partdev -1; then
|
||||
mount -t vfat -o rw,noatime "/dev/$partdev" /mnt
|
||||
cp -af "$CONF_TAR" /mnt/
|
||||
umount /mnt
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
561
root/target/linux/mediatek/mt7623/config-5.4
Normal file
561
root/target/linux/mediatek/mt7623/config-5.4
Normal file
|
@ -0,0 +1,561 @@
|
|||
# CONFIG_AIO is not set
|
||||
CONFIG_ALIGNMENT_TRAP=y
|
||||
CONFIG_ARCH_32BIT_OFF_T=y
|
||||
CONFIG_ARCH_CLOCKSOURCE_DATA=y
|
||||
CONFIG_ARCH_HAS_BINFMT_FLAT=y
|
||||
CONFIG_ARCH_HAS_DEBUG_VIRTUAL=y
|
||||
CONFIG_ARCH_HAS_ELF_RANDOMIZE=y
|
||||
CONFIG_ARCH_HAS_FORTIFY_SOURCE=y
|
||||
CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y
|
||||
CONFIG_ARCH_HAS_KCOV=y
|
||||
CONFIG_ARCH_HAS_KEEPINITRD=y
|
||||
CONFIG_ARCH_HAS_MEMBARRIER_SYNC_CORE=y
|
||||
CONFIG_ARCH_HAS_PHYS_TO_DMA=y
|
||||
CONFIG_ARCH_HAS_SETUP_DMA_OPS=y
|
||||
CONFIG_ARCH_HAS_SET_MEMORY=y
|
||||
CONFIG_ARCH_HAS_STRICT_KERNEL_RWX=y
|
||||
CONFIG_ARCH_HAS_STRICT_MODULE_RWX=y
|
||||
CONFIG_ARCH_HAS_TEARDOWN_DMA_OPS=y
|
||||
CONFIG_ARCH_HAS_TICK_BROADCAST=y
|
||||
CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y
|
||||
CONFIG_ARCH_HIBERNATION_POSSIBLE=y
|
||||
CONFIG_ARCH_KEEP_MEMBLOCK=y
|
||||
CONFIG_ARCH_MEDIATEK=y
|
||||
CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
|
||||
# CONFIG_ARCH_MILBEAUT is not set
|
||||
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_RDA is not set
|
||||
CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y
|
||||
CONFIG_ARCH_SUPPORTS_UPROBES=y
|
||||
CONFIG_ARCH_SUSPEND_POSSIBLE=y
|
||||
CONFIG_ARCH_USE_BUILTIN_BSWAP=y
|
||||
CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y
|
||||
CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT=y
|
||||
CONFIG_ARCH_WANT_GENERAL_HUGETLB=y
|
||||
CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
|
||||
CONFIG_ARM=y
|
||||
CONFIG_ARM_APPENDED_DTB=y
|
||||
CONFIG_ARM_ARCH_TIMER=y
|
||||
CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y
|
||||
# CONFIG_ARM_ATAG_DTB_COMPAT is not set
|
||||
CONFIG_ARM_CPU_SUSPEND=y
|
||||
# CONFIG_ARM_CPU_TOPOLOGY is not set
|
||||
# CONFIG_ARM_ERRATA_814220 is not set
|
||||
# CONFIG_ARM_ERRATA_857271 is not set
|
||||
# CONFIG_ARM_ERRATA_857272 is not set
|
||||
CONFIG_ARM_GIC=y
|
||||
CONFIG_ARM_HAS_SG_CHAIN=y
|
||||
CONFIG_ARM_L1_CACHE_SHIFT=6
|
||||
CONFIG_ARM_L1_CACHE_SHIFT_6=y
|
||||
# CONFIG_ARM_LPAE is not set
|
||||
CONFIG_ARM_MEDIATEK_CPUFREQ=y
|
||||
CONFIG_ARM_PATCH_IDIV=y
|
||||
CONFIG_ARM_PATCH_PHYS_VIRT=y
|
||||
# CONFIG_ARM_SMMU is not set
|
||||
CONFIG_ARM_THUMB=y
|
||||
CONFIG_ARM_THUMBEE=y
|
||||
CONFIG_ARM_UNWIND=y
|
||||
CONFIG_ARM_VIRT_EXT=y
|
||||
CONFIG_ATAGS=y
|
||||
CONFIG_AUTO_ZRELADDR=y
|
||||
# CONFIG_BACKLIGHT_CLASS_DEVICE is not set
|
||||
CONFIG_BINFMT_FLAT_ARGVP_ENVP_ON_STACK=y
|
||||
CONFIG_BLK_DEV_LOOP=y
|
||||
CONFIG_BLK_MQ_PCI=y
|
||||
CONFIG_BLK_PM=y
|
||||
CONFIG_BOUNCE=y
|
||||
# CONFIG_CACHE_L2X0 is not set
|
||||
CONFIG_CC_CAN_LINK=y
|
||||
CONFIG_CC_HAS_ASM_INLINE=y
|
||||
CONFIG_CC_HAS_KASAN_GENERIC=y
|
||||
CONFIG_CC_HAS_WARN_MAYBE_UNINITIALIZED=y
|
||||
CONFIG_CLEANCACHE=y
|
||||
CONFIG_CLKDEV_LOOKUP=y
|
||||
CONFIG_CLKSRC_MMIO=y
|
||||
CONFIG_CLONE_BACKWARDS=y
|
||||
CONFIG_CMDLINE="earlyprintk console=ttyS0,115200 rootfstype=squashfs,jffs2"
|
||||
CONFIG_CMDLINE_FROM_BOOTLOADER=y
|
||||
CONFIG_COMMON_CLK=y
|
||||
CONFIG_COMMON_CLK_MEDIATEK=y
|
||||
CONFIG_COMMON_CLK_MT2701=y
|
||||
# CONFIG_COMMON_CLK_MT2701_AUDSYS is not set
|
||||
CONFIG_COMMON_CLK_MT2701_BDPSYS=y
|
||||
CONFIG_COMMON_CLK_MT2701_ETHSYS=y
|
||||
# CONFIG_COMMON_CLK_MT2701_G3DSYS is not set
|
||||
CONFIG_COMMON_CLK_MT2701_HIFSYS=y
|
||||
CONFIG_COMMON_CLK_MT2701_IMGSYS=y
|
||||
CONFIG_COMMON_CLK_MT2701_MMSYS=y
|
||||
CONFIG_COMMON_CLK_MT2701_VDECSYS=y
|
||||
# CONFIG_COMMON_CLK_MT7622 is not set
|
||||
# CONFIG_COMMON_CLK_MT7629 is not set
|
||||
# CONFIG_COMMON_CLK_MT8135 is not set
|
||||
# CONFIG_COMMON_CLK_MT8173 is not set
|
||||
CONFIG_COMMON_CLK_MT8516=y
|
||||
# CONFIG_COMMON_CLK_MT8516_AUDSYS is not set
|
||||
CONFIG_COMPAT_32BIT_TIME=y
|
||||
CONFIG_COREDUMP=y
|
||||
# CONFIG_CPUFREQ_DT is not set
|
||||
CONFIG_CPU_32v6K=y
|
||||
CONFIG_CPU_32v7=y
|
||||
CONFIG_CPU_ABRT_EV7=y
|
||||
# CONFIG_CPU_BPREDICT_DISABLE is not set
|
||||
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_FREQ=y
|
||||
CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
|
||||
CONFIG_CPU_FREQ_GOV_ATTR_SET=y
|
||||
CONFIG_CPU_FREQ_GOV_COMMON=y
|
||||
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
|
||||
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
|
||||
CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
|
||||
CONFIG_CPU_FREQ_GOV_POWERSAVE=y
|
||||
# CONFIG_CPU_FREQ_GOV_USERSPACE is not set
|
||||
CONFIG_CPU_FREQ_STAT=y
|
||||
CONFIG_CPU_HAS_ASID=y
|
||||
# CONFIG_CPU_HOTPLUG_STATE_CONTROL is not set
|
||||
# CONFIG_CPU_ICACHE_DISABLE is not set
|
||||
# CONFIG_CPU_ICACHE_MISMATCH_WORKAROUND is not set
|
||||
CONFIG_CPU_PABRT_V7=y
|
||||
CONFIG_CPU_PM=y
|
||||
CONFIG_CPU_RMAP=y
|
||||
CONFIG_CPU_SPECTRE=y
|
||||
# CONFIG_CPU_THERMAL is not set
|
||||
CONFIG_CPU_THUMB_CAPABLE=y
|
||||
CONFIG_CPU_TLB_V7=y
|
||||
CONFIG_CPU_V7=y
|
||||
CONFIG_CRC16=y
|
||||
# CONFIG_CRC32_SARWATE is not set
|
||||
CONFIG_CRC32_SLICEBY8=y
|
||||
CONFIG_CROSS_MEMORY_ATTACH=y
|
||||
CONFIG_CRYPTO_ACOMP2=y
|
||||
CONFIG_CRYPTO_AEAD=y
|
||||
CONFIG_CRYPTO_AEAD2=y
|
||||
CONFIG_CRYPTO_AKCIPHER2=y
|
||||
CONFIG_CRYPTO_CRC32=y
|
||||
CONFIG_CRYPTO_CRC32C=y
|
||||
CONFIG_CRYPTO_CTR=y
|
||||
CONFIG_CRYPTO_DEFLATE=y
|
||||
CONFIG_CRYPTO_DEV_MEDIATEK=y
|
||||
CONFIG_CRYPTO_DRBG=y
|
||||
CONFIG_CRYPTO_DRBG_HMAC=y
|
||||
CONFIG_CRYPTO_DRBG_MENU=y
|
||||
CONFIG_CRYPTO_HASH=y
|
||||
CONFIG_CRYPTO_HASH2=y
|
||||
CONFIG_CRYPTO_HASH_INFO=y
|
||||
CONFIG_CRYPTO_HMAC=y
|
||||
CONFIG_CRYPTO_HW=y
|
||||
CONFIG_CRYPTO_JITTERENTROPY=y
|
||||
CONFIG_CRYPTO_KPP2=y
|
||||
CONFIG_CRYPTO_LIB_AES=y
|
||||
CONFIG_CRYPTO_LIB_SHA256=y
|
||||
CONFIG_CRYPTO_LZO=y
|
||||
CONFIG_CRYPTO_MANAGER=y
|
||||
CONFIG_CRYPTO_MANAGER2=y
|
||||
CONFIG_CRYPTO_NULL=y
|
||||
CONFIG_CRYPTO_NULL2=y
|
||||
CONFIG_CRYPTO_RNG=y
|
||||
CONFIG_CRYPTO_RNG2=y
|
||||
CONFIG_CRYPTO_RNG_DEFAULT=y
|
||||
CONFIG_CRYPTO_SEQIV=y
|
||||
CONFIG_CRYPTO_SHA1=y
|
||||
CONFIG_CRYPTO_SHA256=y
|
||||
CONFIG_CRYPTO_SHA512=y
|
||||
CONFIG_CRYPTO_ZSTD=y
|
||||
CONFIG_DCACHE_WORD_ACCESS=y
|
||||
CONFIG_DEBUG_ALIGN_RODATA=y
|
||||
CONFIG_DEBUG_BUGVERBOSE=y
|
||||
CONFIG_DEBUG_GPIO=y
|
||||
CONFIG_DEBUG_INFO=y
|
||||
CONFIG_DEBUG_LL=y
|
||||
CONFIG_DEBUG_LL_INCLUDE="debug/8250.S"
|
||||
CONFIG_DEBUG_MISC=y
|
||||
CONFIG_DEBUG_MT6589_UART0=y
|
||||
# CONFIG_DEBUG_MT8127_UART0 is not set
|
||||
# CONFIG_DEBUG_MT8135_UART3 is not set
|
||||
CONFIG_DEBUG_PREEMPT=y
|
||||
CONFIG_DEBUG_UART_8250=y
|
||||
# CONFIG_DEBUG_UART_8250_FLOW_CONTROL is not set
|
||||
CONFIG_DEBUG_UART_8250_SHIFT=2
|
||||
# CONFIG_DEBUG_UART_8250_WORD is not set
|
||||
CONFIG_DEBUG_UART_PHYS=0x11004000
|
||||
CONFIG_DEBUG_UART_VIRT=0xf1004000
|
||||
CONFIG_DEBUG_UNCOMPRESS=y
|
||||
# CONFIG_DEBUG_USER is not set
|
||||
CONFIG_DMADEVICES=y
|
||||
CONFIG_DMA_ENGINE=y
|
||||
CONFIG_DMA_OF=y
|
||||
CONFIG_DMA_REMAP=y
|
||||
CONFIG_DTC=y
|
||||
CONFIG_EARLY_PRINTK=y
|
||||
CONFIG_EDAC_ATOMIC_SCRUB=y
|
||||
CONFIG_EDAC_SUPPORT=y
|
||||
CONFIG_EINT_MTK=y
|
||||
CONFIG_ELF_CORE=y
|
||||
# CONFIG_ENERGY_MODEL is not set
|
||||
CONFIG_EXT4_FS=y
|
||||
# CONFIG_F2FS_CHECK_FS is not set
|
||||
CONFIG_F2FS_FS=y
|
||||
# CONFIG_F2FS_FS_SECURITY is not set
|
||||
CONFIG_F2FS_FS_XATTR=y
|
||||
CONFIG_F2FS_STAT_FS=y
|
||||
CONFIG_FIXED_PHY=y
|
||||
CONFIG_FIX_EARLYCON_MEM=y
|
||||
CONFIG_FREEZER=y
|
||||
# CONFIG_FSL_QDMA is not set
|
||||
CONFIG_FS_IOMAP=y
|
||||
CONFIG_FS_MBCACHE=y
|
||||
CONFIG_FW_LOADER_PAGED_BUF=y
|
||||
CONFIG_GENERIC_ALLOCATOR=y
|
||||
CONFIG_GENERIC_BUG=y
|
||||
CONFIG_GENERIC_CLOCKEVENTS=y
|
||||
CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
|
||||
CONFIG_GENERIC_CPU_AUTOPROBE=y
|
||||
CONFIG_GENERIC_EARLY_IOREMAP=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_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_GPIOLIB=y
|
||||
CONFIG_GPIO_SYSFS=y
|
||||
# CONFIG_HABANA_AI is not set
|
||||
CONFIG_HANDLE_DOMAIN_IRQ=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_ARCH_AUDITSYSCALL=y
|
||||
CONFIG_HAVE_ARCH_BITREVERSE=y
|
||||
CONFIG_HAVE_ARCH_JUMP_LABEL=y
|
||||
CONFIG_HAVE_ARCH_KGDB=y
|
||||
CONFIG_HAVE_ARCH_PFN_VALID=y
|
||||
CONFIG_HAVE_ARCH_SECCOMP_FILTER=y
|
||||
CONFIG_HAVE_ARCH_THREAD_STRUCT_WHITELIST=y
|
||||
CONFIG_HAVE_ARCH_TRACEHOOK=y
|
||||
CONFIG_HAVE_ARM_ARCH_TIMER=y
|
||||
CONFIG_HAVE_ARM_SMCCC=y
|
||||
CONFIG_HAVE_CLK=y
|
||||
CONFIG_HAVE_CLK_PREPARE=y
|
||||
CONFIG_HAVE_CONTEXT_TRACKING=y
|
||||
CONFIG_HAVE_COPY_THREAD_TLS=y
|
||||
CONFIG_HAVE_C_RECORDMCOUNT=y
|
||||
CONFIG_HAVE_DEBUG_KMEMLEAK=y
|
||||
CONFIG_HAVE_DMA_CONTIGUOUS=y
|
||||
CONFIG_HAVE_DYNAMIC_FTRACE=y
|
||||
CONFIG_HAVE_DYNAMIC_FTRACE_WITH_REGS=y
|
||||
CONFIG_HAVE_EBPF_JIT=y
|
||||
CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
|
||||
CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
|
||||
CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
|
||||
CONFIG_HAVE_FUNCTION_TRACER=y
|
||||
CONFIG_HAVE_IDE=y
|
||||
CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y
|
||||
CONFIG_HAVE_LD_DEAD_CODE_DATA_ELIMINATION=y
|
||||
CONFIG_HAVE_MOD_ARCH_SPECIFIC=y
|
||||
CONFIG_HAVE_NET_DSA=y
|
||||
CONFIG_HAVE_OPROFILE=y
|
||||
CONFIG_HAVE_OPTPROBES=y
|
||||
CONFIG_HAVE_PCI=y
|
||||
CONFIG_HAVE_PERF_EVENTS=y
|
||||
CONFIG_HAVE_PERF_REGS=y
|
||||
CONFIG_HAVE_PERF_USER_STACK_DUMP=y
|
||||
CONFIG_HAVE_PROC_CPU=y
|
||||
CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
|
||||
CONFIG_HAVE_RSEQ=y
|
||||
CONFIG_HAVE_SMP=y
|
||||
CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
|
||||
CONFIG_HAVE_UID16=y
|
||||
CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y
|
||||
CONFIG_HIGHMEM=y
|
||||
# CONFIG_HIGHPTE is not set
|
||||
CONFIG_HOTPLUG_CPU=y
|
||||
CONFIG_HWMON=y
|
||||
CONFIG_HW_RANDOM=y
|
||||
CONFIG_HW_RANDOM_MTK=y
|
||||
CONFIG_HZ_FIXED=0
|
||||
CONFIG_I2C=y
|
||||
CONFIG_I2C_BOARDINFO=y
|
||||
CONFIG_I2C_CHARDEV=y
|
||||
CONFIG_I2C_MT65XX=y
|
||||
# CONFIG_I2C_NVIDIA_GPU is not set
|
||||
CONFIG_ICPLUS_PHY=y
|
||||
# CONFIG_IGC is not set
|
||||
CONFIG_IIO=y
|
||||
# CONFIG_IIO_BUFFER is not set
|
||||
# CONFIG_IIO_TRIGGER is not set
|
||||
CONFIG_INITRAMFS_COMPRESSION=""
|
||||
CONFIG_INITRAMFS_ROOT_GID=1000
|
||||
CONFIG_INITRAMFS_ROOT_UID=1000
|
||||
CONFIG_INITRAMFS_SOURCE="/openwrt/trunk/build_dir/target-arm_cortex-a7_musl-1.1.14_eabi/root-mediatek /openwrt/trunk/target/linux/generic/image/initramfs-base-files.txt"
|
||||
CONFIG_INIT_STACK_NONE=y
|
||||
# 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_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_LEDS_MT6323=y
|
||||
CONFIG_LIBFDT=y
|
||||
CONFIG_LOCK_DEBUGGING_SUPPORT=y
|
||||
CONFIG_LOCK_SPIN_ON_OWNER=y
|
||||
CONFIG_LZO_COMPRESS=y
|
||||
CONFIG_LZO_DECOMPRESS=y
|
||||
# CONFIG_MACH_MT2701 is not set
|
||||
# CONFIG_MACH_MT6589 is not set
|
||||
# CONFIG_MACH_MT6592 is not set
|
||||
CONFIG_MACH_MT7623=y
|
||||
# CONFIG_MACH_MT7629 is not set
|
||||
# CONFIG_MACH_MT8127 is not set
|
||||
# CONFIG_MACH_MT8135 is not set
|
||||
CONFIG_MAGIC_SYSRQ=y
|
||||
CONFIG_MDIO_BITBANG=y
|
||||
CONFIG_MDIO_BUS=y
|
||||
CONFIG_MDIO_DEVICE=y
|
||||
CONFIG_MDIO_GPIO=y
|
||||
CONFIG_MEDIATEK_MT6577_AUXADC=y
|
||||
CONFIG_MEDIATEK_WATCHDOG=y
|
||||
CONFIG_MEMFD_CREATE=y
|
||||
CONFIG_MFD_CORE=y
|
||||
CONFIG_MFD_MT6397=y
|
||||
# CONFIG_MFD_STPMIC1 is not set
|
||||
CONFIG_MFD_SYSCON=y
|
||||
CONFIG_MIGHT_HAVE_CACHE_L2X0=y
|
||||
CONFIG_MIGRATION=y
|
||||
# CONFIG_MISC_ALCOR_PCI is not set
|
||||
CONFIG_MMC=y
|
||||
CONFIG_MMC_BLOCK=y
|
||||
CONFIG_MMC_MTK=y
|
||||
CONFIG_MMC_SDHCI=y
|
||||
# CONFIG_MMC_SDHCI_PCI is not set
|
||||
CONFIG_MMC_SDHCI_PLTFM=y
|
||||
# CONFIG_MMC_TIFM_SD is not set
|
||||
CONFIG_MODULES_USE_ELF_REL=y
|
||||
# CONFIG_MT753X_GSW is not set
|
||||
CONFIG_MTD_BLOCK2MTD=y
|
||||
CONFIG_MTD_CMDLINE_PARTS=y
|
||||
CONFIG_MTD_SPI_NOR=y
|
||||
CONFIG_MTD_SPLIT_FIRMWARE=y
|
||||
CONFIG_MTD_SPLIT_UIMAGE_FW=y
|
||||
CONFIG_MTD_UBI=y
|
||||
CONFIG_MTD_UBI_BEB_LIMIT=20
|
||||
CONFIG_MTD_UBI_BLOCK=y
|
||||
# CONFIG_MTD_UBI_FASTMAP is not set
|
||||
# CONFIG_MTD_UBI_GLUEBI is not set
|
||||
CONFIG_MTD_UBI_WL_THRESHOLD=4096
|
||||
# CONFIG_MTK_CMDQ is not set
|
||||
# CONFIG_MTK_CQDMA is not set
|
||||
CONFIG_MTK_EFUSE=y
|
||||
# CONFIG_MTK_HSDMA is not set
|
||||
CONFIG_MTK_INFRACFG=y
|
||||
# CONFIG_MTK_IOMMU is not set
|
||||
# CONFIG_MTK_IOMMU_V1 is not set
|
||||
CONFIG_MTK_PMIC_WRAP=y
|
||||
CONFIG_MTK_SCPSYS=y
|
||||
CONFIG_MTK_THERMAL=y
|
||||
CONFIG_MTK_TIMER=y
|
||||
# CONFIG_MTK_UART_APDMA is not set
|
||||
CONFIG_MUTEX_SPIN_ON_OWNER=y
|
||||
CONFIG_NEED_DMA_MAP_STATE=y
|
||||
CONFIG_NEON=y
|
||||
CONFIG_NET_DEVLINK=y
|
||||
CONFIG_NET_DSA=y
|
||||
CONFIG_NET_DSA_MT7530=y
|
||||
CONFIG_NET_DSA_TAG_MTK=y
|
||||
# CONFIG_NET_DSA_TAG_QCA is not set
|
||||
CONFIG_NET_FLOW_LIMIT=y
|
||||
CONFIG_NET_MEDIATEK_SOC=y
|
||||
CONFIG_NET_SWITCHDEV=y
|
||||
# CONFIG_NET_VENDOR_AURORA is not set
|
||||
CONFIG_NET_VENDOR_MEDIATEK=y
|
||||
# CONFIG_NET_VENDOR_WIZNET is not set
|
||||
CONFIG_NLS=y
|
||||
CONFIG_NO_HZ=y
|
||||
CONFIG_NO_HZ_COMMON=y
|
||||
CONFIG_NO_HZ_IDLE=y
|
||||
CONFIG_NR_CPUS=4
|
||||
CONFIG_NVMEM=y
|
||||
# CONFIG_NVMEM_REBOOT_MODE is not set
|
||||
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_OF_NET=y
|
||||
CONFIG_OLD_SIGACTION=y
|
||||
CONFIG_OLD_SIGSUSPEND3=y
|
||||
CONFIG_PADATA=y
|
||||
CONFIG_PAGE_OFFSET=0xC0000000
|
||||
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_MESON is not set
|
||||
CONFIG_PCI_MSI=y
|
||||
CONFIG_PCI_MSI_IRQ_DOMAIN=y
|
||||
# CONFIG_PCI_V3_SEMI is not set
|
||||
CONFIG_PERF_USE_VMALLOC=y
|
||||
CONFIG_PGTABLE_LEVELS=2
|
||||
CONFIG_PHYLIB=y
|
||||
CONFIG_PHYLINK=y
|
||||
CONFIG_PHY_MTK_TPHY=y
|
||||
# CONFIG_PHY_MTK_UFS is not set
|
||||
# CONFIG_PHY_MTK_XSPHY is not set
|
||||
CONFIG_PINCTRL=y
|
||||
CONFIG_PINCTRL_MT2701=y
|
||||
CONFIG_PINCTRL_MT6397=y
|
||||
CONFIG_PINCTRL_MT7623=y
|
||||
CONFIG_PINCTRL_MTK=y
|
||||
CONFIG_PINCTRL_MTK_MOORE=y
|
||||
CONFIG_PM=y
|
||||
CONFIG_PM_CLK=y
|
||||
# CONFIG_PM_DEBUG is not set
|
||||
CONFIG_PM_GENERIC_DOMAINS=y
|
||||
CONFIG_PM_GENERIC_DOMAINS_OF=y
|
||||
CONFIG_PM_GENERIC_DOMAINS_SLEEP=y
|
||||
CONFIG_PM_OPP=y
|
||||
CONFIG_PM_SLEEP=y
|
||||
CONFIG_PM_SLEEP_SMP=y
|
||||
CONFIG_POWER_RESET=y
|
||||
CONFIG_POWER_SUPPLY=y
|
||||
CONFIG_POWER_SUPPLY_HWMON=y
|
||||
CONFIG_PREEMPT=y
|
||||
CONFIG_PREEMPTION=y
|
||||
CONFIG_PREEMPT_COUNT=y
|
||||
# CONFIG_PREEMPT_NONE is not set
|
||||
CONFIG_PREEMPT_RCU=y
|
||||
CONFIG_PRINTK_TIME=y
|
||||
CONFIG_PWM=y
|
||||
CONFIG_PWM_MEDIATEK=y
|
||||
# CONFIG_PWM_MTK_DISP is not set
|
||||
CONFIG_PWM_SYSFS=y
|
||||
# CONFIG_QCOM_SPMI_ADC5 is not set
|
||||
CONFIG_RAS=y
|
||||
CONFIG_RATIONAL=y
|
||||
CONFIG_RCU_CPU_STALL_TIMEOUT=21
|
||||
# CONFIG_RCU_EXPERT is not set
|
||||
CONFIG_RCU_NEED_SEGCBLIST=y
|
||||
CONFIG_RCU_STALL_COMMON=y
|
||||
CONFIG_REFCOUNT_FULL=y
|
||||
CONFIG_REGMAP=y
|
||||
CONFIG_REGMAP_I2C=y
|
||||
CONFIG_REGMAP_MMIO=y
|
||||
CONFIG_REGMAP_SPI=y
|
||||
CONFIG_REGULATOR=y
|
||||
CONFIG_REGULATOR_FIXED_VOLTAGE=y
|
||||
CONFIG_REGULATOR_GPIO=y
|
||||
CONFIG_REGULATOR_MT6323=y
|
||||
# CONFIG_REGULATOR_MT6380 is not set
|
||||
# CONFIG_REGULATOR_MT6397 is not set
|
||||
# CONFIG_REGULATOR_QCOM_SPMI is not set
|
||||
CONFIG_RESET_CONTROLLER=y
|
||||
CONFIG_RFS_ACCEL=y
|
||||
CONFIG_RPS=y
|
||||
CONFIG_RTC_CLASS=y
|
||||
# CONFIG_RTC_DRV_MT6397 is not set
|
||||
# CONFIG_RTC_DRV_MT7622 is not set
|
||||
CONFIG_RTC_I2C_AND_SPI=y
|
||||
CONFIG_RWSEM_SPIN_ON_OWNER=y
|
||||
# CONFIG_SENSORS_OCC_P8_I2C is not set
|
||||
# CONFIG_SERIAL_8250_DMA is not set
|
||||
CONFIG_SERIAL_8250_FSL=y
|
||||
CONFIG_SERIAL_8250_MT6577=y
|
||||
CONFIG_SERIAL_8250_NR_UARTS=4
|
||||
CONFIG_SERIAL_8250_RUNTIME_UARTS=4
|
||||
CONFIG_SERIAL_MCTRL_GPIO=y
|
||||
CONFIG_SGL_ALLOC=y
|
||||
CONFIG_SMP=y
|
||||
# CONFIG_SMP_ON_UP is not set
|
||||
CONFIG_SPARSE_IRQ=y
|
||||
CONFIG_SPI=y
|
||||
CONFIG_SPI_BITBANG=y
|
||||
CONFIG_SPI_MASTER=y
|
||||
CONFIG_SPI_MEM=y
|
||||
CONFIG_SPI_MT65XX=y
|
||||
CONFIG_SPMI=y
|
||||
CONFIG_SRCU=y
|
||||
# CONFIG_STRIP_ASM_SYMS is not set
|
||||
CONFIG_SUSPEND=y
|
||||
CONFIG_SUSPEND_FREEZER=y
|
||||
CONFIG_SWCONFIG=y
|
||||
CONFIG_SWPHY=y
|
||||
CONFIG_SWP_EMULATE=y
|
||||
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
|
||||
CONFIG_TASKS_RCU=y
|
||||
CONFIG_THERMAL=y
|
||||
CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y
|
||||
CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0
|
||||
CONFIG_THERMAL_GOV_STEP_WISE=y
|
||||
CONFIG_THERMAL_OF=y
|
||||
# CONFIG_THUMB2_KERNEL is not set
|
||||
CONFIG_TICK_CPU_ACCOUNTING=y
|
||||
CONFIG_TIMER_OF=y
|
||||
CONFIG_TIMER_PROBE=y
|
||||
# CONFIG_TI_CPSW_PHY_SEL is not set
|
||||
CONFIG_TREE_SRCU=y
|
||||
# CONFIG_TRUSTED_FOUNDATIONS is not set
|
||||
CONFIG_UBIFS_FS=y
|
||||
# CONFIG_UBIFS_FS_ADVANCED_COMPR is not set
|
||||
CONFIG_UBIFS_FS_LZO=y
|
||||
CONFIG_UBIFS_FS_ZLIB=y
|
||||
CONFIG_UBIFS_FS_ZSTD=y
|
||||
CONFIG_UEVENT_HELPER_PATH=""
|
||||
CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h"
|
||||
CONFIG_UNINLINE_SPIN_UNLOCK=y
|
||||
CONFIG_UNWINDER_ARM=y
|
||||
# CONFIG_UNWINDER_FRAME_POINTER is not set
|
||||
CONFIG_USB=y
|
||||
CONFIG_USB_COMMON=y
|
||||
# CONFIG_USB_EHCI_HCD is not set
|
||||
CONFIG_USB_SUPPORT=y
|
||||
CONFIG_USB_XHCI_HCD=y
|
||||
CONFIG_USB_XHCI_MTK=y
|
||||
CONFIG_USB_XHCI_PLATFORM=y
|
||||
CONFIG_USE_OF=y
|
||||
CONFIG_VFP=y
|
||||
CONFIG_VFPv3=y
|
||||
CONFIG_VM_EVENT_COUNTERS=y
|
||||
CONFIG_WATCHDOG_CORE=y
|
||||
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_COMPRESS=y
|
||||
CONFIG_ZSTD_DECOMPRESS=y
|
|
@ -0,0 +1,51 @@
|
|||
From 0593f719ca873722c6ac66604f027a63663c9b64 Mon Sep 17 00:00:00 2001
|
||||
From: Alexey Loukianov <lx2@lexa2.ru>
|
||||
Date: Fri, 7 Jun 2019 12:33:45 +0300
|
||||
Subject: [PATCH 04/12] mediatek: fix packet corruption on bridged interface
|
||||
|
||||
This fixes problem that was reported here:
|
||||
http://forum.banana-pi.org/t/openwrt-18-06-malformed-ip-packets-at-bridged-interface/
|
||||
|
||||
Fix is to set both gmacs to use trgmii mode.
|
||||
This fix is not technically correct as second gmac
|
||||
does not support trgmii mode but current driver
|
||||
implementation seems to handle it somehow and
|
||||
it is the only way to have both gmacs enabled
|
||||
and avoid corruption of the packets on brigded
|
||||
lanX interfaces.
|
||||
|
||||
Signed-off-by: Alexey Loukianov <lx2@lexa2.ru>
|
||||
---
|
||||
.../0067-dts-bpi-r2-fix-second-gmac.patch | 20 +++++++++++++++++++
|
||||
1 file changed, 20 insertions(+)
|
||||
create mode 100644 target/linux/mediatek/patches-4.14/0067-dts-bpi-r2-fix-second-gmac.patch
|
||||
|
||||
diff --git a/target/linux/mediatek/patches-4.14/0067-dts-bpi-r2-fix-second-gmac.patch b/target/linux/mediatek/patches-4.14/0067-dts-bpi-r2-fix-second-gmac.patch
|
||||
new file mode 100644
|
||||
index 0000000000..145c188972
|
||||
--- /dev/null
|
||||
+++ b/target/linux/mediatek/patches-4.14/0067-dts-bpi-r2-fix-second-gmac.patch
|
||||
@@ -0,0 +1,20 @@
|
||||
+--- a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
|
||||
++++ b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
|
||||
+@@ -141,7 +141,7 @@
|
||||
+ gmac1: mac@1 {
|
||||
+ compatible = "mediatek,eth-mac";
|
||||
+ reg = <1>;
|
||||
+- phy-mode = "rgmii";
|
||||
++ phy-mode = "trgmii";
|
||||
+
|
||||
+ fixed-link {
|
||||
+ speed = <1000>;
|
||||
+@@ -206,7 +206,7 @@
|
||||
+ reg = <5>;
|
||||
+ label = "cpu";
|
||||
+ ethernet = <&gmac1>;
|
||||
+- phy-mode = "rgmii";
|
||||
++ phy-mode = "trgmii";
|
||||
+
|
||||
+ fixed-link {
|
||||
+ speed = <1000>;
|
||||
--
|
||||
2.23.0
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
--- a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
|
||||
+++ b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
chosen {
|
||||
stdout-path = "serial2:115200n8";
|
||||
+ bootargs = "console=ttyS2,115200n8 root=/dev/mmcblk1p2 rootfstype=ext4 rootwait vmalloc=496M";
|
||||
};
|
||||
|
||||
cpus {
|
|
@ -0,0 +1,54 @@
|
|||
From 97fdec52fff8079d3af104e8723602a3cb9d2a11 Mon Sep 17 00:00:00 2001
|
||||
From: Frank Wunderlich <frank-w@public-files.de>
|
||||
Date: Thu, 20 Jun 2019 23:06:41 +0200
|
||||
Subject: [PATCH] net: dts: add second gmac for bananapi r2
|
||||
|
||||
---
|
||||
arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts | 18 ++++++++++++++++--
|
||||
1 file changed, 16 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
|
||||
index 2b760f90f38c..fad09608b86c 100644
|
||||
--- a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
|
||||
+++ b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
|
||||
@@ -143,13 +143,25 @@
|
||||
};
|
||||
};
|
||||
|
||||
+ gmac1: mac@1 {
|
||||
+ compatible = "mediatek,eth-mac";
|
||||
+ reg = <1>;
|
||||
+ label = "wan";
|
||||
+ phy-mode = "rgmii";
|
||||
+ phy-handle = <&ephy0>;
|
||||
+ };
|
||||
+
|
||||
mdio: mdio-bus {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
- switch@0 {
|
||||
- compatible = "mediatek,mt7530";
|
||||
+ ephy0: ethernet-phy@0 {
|
||||
reg = <0>;
|
||||
+ };
|
||||
+
|
||||
+ switch@1f {
|
||||
+ compatible = "mediatek,mt7530";
|
||||
+ reg = <0x1f>;
|
||||
reset-gpios = <&pio 33 0>;
|
||||
core-supply = <&mt6323_vpa_reg>;
|
||||
io-supply = <&mt6323_vemc3v3_reg>;
|
||||
@@ -158,10 +170,12 @@
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
+/* Disabled, is now handled by gmac1 (eth1/wan) via phy-handle!
|
||||
port@0 {
|
||||
reg = <0>;
|
||||
label = "wan";
|
||||
};
|
||||
+*/
|
||||
|
||||
port@1 {
|
||||
reg = <1>;
|
|
@ -0,0 +1,39 @@
|
|||
From 934747eba782050ba87a29a3a59f805e36410685 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Ren=C3=A9=20van=20Dorst?= <opensource@vdorst.com>
|
||||
Date: Fri, 21 Jun 2019 10:04:05 +0200
|
||||
Subject: [PATCH] net: ethernet: mediatek: support net-labels
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
With this patch, device name can be set within dts file in the same way as dsa
|
||||
port can.
|
||||
Add: label = "wan"; to GMAC node.
|
||||
|
||||
Signed-off-by: René van Dorst <opensource@vdorst.com>
|
||||
---
|
||||
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||
index c61069340f4f..87ced6269411 100644
|
||||
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
||||
@@ -2756,6 +2756,7 @@ static const struct net_device_ops mtk_netdev_ops = {
|
||||
|
||||
static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np)
|
||||
{
|
||||
+ const char *name = of_get_property(np, "label", NULL);
|
||||
const __be32 *_id = of_get_property(np, "reg", NULL);
|
||||
struct phylink *phylink;
|
||||
int phy_mode, id, err;
|
||||
@@ -2846,6 +2847,9 @@ static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np)
|
||||
eth->netdev[id]->irq = eth->irq[0];
|
||||
eth->netdev[id]->dev.of_node = np;
|
||||
|
||||
+ if (name)
|
||||
+ strlcpy(eth->netdev[id]->name, name, IFNAMSIZ);
|
||||
+
|
||||
return 0;
|
||||
|
||||
free_netdev:
|
|
@ -0,0 +1,22 @@
|
|||
From 3a466fd3d5b921c085fd3c863cab3f1afdb90c9c Mon Sep 17 00:00:00 2001
|
||||
From: Frank Wunderlich <frank-w@public-files.de>
|
||||
Date: Sun, 12 Jan 2020 16:46:33 +0100
|
||||
Subject: [PATCH] arm: dts: add pause to port6 of switch
|
||||
|
||||
to be same as gmac0
|
||||
---
|
||||
arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
|
||||
index 52343bd76fe5..7b8383af87e0 100644
|
||||
--- a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
|
||||
+++ b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
|
||||
@@ -253,6 +253,7 @@
|
||||
fixed-link {
|
||||
speed = <1000>;
|
||||
full-duplex;
|
||||
+ pause;
|
||||
};
|
||||
};
|
||||
};
|
249
root/target/linux/mediatek/patches-5.4/0110-rtc-mt6397.patch
Normal file
249
root/target/linux/mediatek/patches-5.4/0110-rtc-mt6397.patch
Normal file
|
@ -0,0 +1,249 @@
|
|||
--- a/drivers/rtc/rtc-mt6397.c 2020-03-05 23:43:52.000000000 +0800
|
||||
+++ b/drivers/rtc/rtc-mt6397.c 2020-03-18 00:54:20.445907453 +0800
|
||||
@@ -4,48 +4,18 @@
|
||||
* Author: Tianping.Fang <tianping.fang@mediatek.com>
|
||||
*/
|
||||
|
||||
-#include <linux/delay.h>
|
||||
-#include <linux/init.h>
|
||||
+#include <linux/err.h>
|
||||
+#include <linux/interrupt.h>
|
||||
+#include <linux/mfd/mt6397/core.h>
|
||||
#include <linux/module.h>
|
||||
+#include <linux/mutex.h>
|
||||
+#include <linux/platform_device.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/rtc.h>
|
||||
-#include <linux/irqdomain.h>
|
||||
-#include <linux/platform_device.h>
|
||||
-#include <linux/of_address.h>
|
||||
-#include <linux/of_irq.h>
|
||||
-#include <linux/io.h>
|
||||
-#include <linux/mfd/mt6397/core.h>
|
||||
-
|
||||
-#define RTC_BBPU 0x0000
|
||||
-#define RTC_BBPU_CBUSY BIT(6)
|
||||
-
|
||||
-#define RTC_WRTGR 0x003c
|
||||
+#include <linux/mfd/mt6397/rtc.h>
|
||||
+#include <linux/mod_devicetable.h>
|
||||
|
||||
-#define RTC_IRQ_STA 0x0002
|
||||
-#define RTC_IRQ_STA_AL BIT(0)
|
||||
-#define RTC_IRQ_STA_LP BIT(3)
|
||||
-
|
||||
-#define RTC_IRQ_EN 0x0004
|
||||
-#define RTC_IRQ_EN_AL BIT(0)
|
||||
-#define RTC_IRQ_EN_ONESHOT BIT(2)
|
||||
-#define RTC_IRQ_EN_LP BIT(3)
|
||||
-#define RTC_IRQ_EN_ONESHOT_AL (RTC_IRQ_EN_ONESHOT | RTC_IRQ_EN_AL)
|
||||
-
|
||||
-#define RTC_AL_MASK 0x0008
|
||||
-#define RTC_AL_MASK_DOW BIT(4)
|
||||
-
|
||||
-#define RTC_TC_SEC 0x000a
|
||||
-/* Min, Hour, Dom... register offset to RTC_TC_SEC */
|
||||
-#define RTC_OFFSET_SEC 0
|
||||
-#define RTC_OFFSET_MIN 1
|
||||
-#define RTC_OFFSET_HOUR 2
|
||||
-#define RTC_OFFSET_DOM 3
|
||||
-#define RTC_OFFSET_DOW 4
|
||||
-#define RTC_OFFSET_MTH 5
|
||||
-#define RTC_OFFSET_YEAR 6
|
||||
-#define RTC_OFFSET_COUNT 7
|
||||
-
|
||||
-#define RTC_AL_SEC 0x0018
|
||||
+#include <linux/mfd/mt6397/rtc.h>
|
||||
|
||||
#define RTC_AL_SEC_MASK 0x003f
|
||||
#define RTC_AL_MIN_MASK 0x003f
|
||||
@@ -55,26 +25,8 @@
|
||||
#define RTC_AL_MTH_MASK 0x000f
|
||||
#define RTC_AL_YEA_MASK 0x007f
|
||||
|
||||
-#define RTC_PDN2 0x002e
|
||||
-#define RTC_PDN2_PWRON_ALARM BIT(4)
|
||||
-
|
||||
-#define RTC_MIN_YEAR 1968
|
||||
-#define RTC_BASE_YEAR 1900
|
||||
-#define RTC_NUM_YEARS 128
|
||||
-#define RTC_MIN_YEAR_OFFSET (RTC_MIN_YEAR - RTC_BASE_YEAR)
|
||||
-
|
||||
-struct mt6397_rtc {
|
||||
- struct device *dev;
|
||||
- struct rtc_device *rtc_dev;
|
||||
- struct mutex lock;
|
||||
- struct regmap *regmap;
|
||||
- int irq;
|
||||
- u32 addr_base;
|
||||
-};
|
||||
-
|
||||
static int mtk_rtc_write_trigger(struct mt6397_rtc *rtc)
|
||||
{
|
||||
- unsigned long timeout = jiffies + HZ;
|
||||
int ret;
|
||||
u32 data;
|
||||
|
||||
@@ -82,19 +34,13 @@ static int mtk_rtc_write_trigger(struct
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
- while (1) {
|
||||
- ret = regmap_read(rtc->regmap, rtc->addr_base + RTC_BBPU,
|
||||
- &data);
|
||||
- if (ret < 0)
|
||||
- break;
|
||||
- if (!(data & RTC_BBPU_CBUSY))
|
||||
- break;
|
||||
- if (time_after(jiffies, timeout)) {
|
||||
- ret = -ETIMEDOUT;
|
||||
- break;
|
||||
- }
|
||||
- cpu_relax();
|
||||
- }
|
||||
+ ret = regmap_read_poll_timeout(rtc->regmap,
|
||||
+ rtc->addr_base + RTC_BBPU, data,
|
||||
+ !(data & RTC_BBPU_CBUSY),
|
||||
+ MTK_RTC_POLL_DELAY_US,
|
||||
+ MTK_RTC_POLL_TIMEOUT);
|
||||
+ if (ret < 0)
|
||||
+ dev_err(rtc->dev, "failed to write WRTGE: %d\n", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -338,19 +284,19 @@ static int mtk_rtc_probe(struct platform
|
||||
return rtc->irq;
|
||||
|
||||
rtc->regmap = mt6397_chip->regmap;
|
||||
- rtc->dev = &pdev->dev;
|
||||
mutex_init(&rtc->lock);
|
||||
|
||||
platform_set_drvdata(pdev, rtc);
|
||||
|
||||
- rtc->rtc_dev = devm_rtc_allocate_device(rtc->dev);
|
||||
+ rtc->rtc_dev = devm_rtc_allocate_device(&pdev->dev);
|
||||
if (IS_ERR(rtc->rtc_dev))
|
||||
return PTR_ERR(rtc->rtc_dev);
|
||||
|
||||
- ret = request_threaded_irq(rtc->irq, NULL,
|
||||
- mtk_rtc_irq_handler_thread,
|
||||
- IRQF_ONESHOT | IRQF_TRIGGER_HIGH,
|
||||
- "mt6397-rtc", rtc);
|
||||
+ ret = devm_request_threaded_irq(&pdev->dev, rtc->irq, NULL,
|
||||
+ mtk_rtc_irq_handler_thread,
|
||||
+ IRQF_ONESHOT | IRQF_TRIGGER_HIGH,
|
||||
+ "mt6397-rtc", rtc);
|
||||
+
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n",
|
||||
rtc->irq, ret);
|
||||
@@ -372,15 +318,6 @@ out_free_irq:
|
||||
return ret;
|
||||
}
|
||||
|
||||
-static int mtk_rtc_remove(struct platform_device *pdev)
|
||||
-{
|
||||
- struct mt6397_rtc *rtc = platform_get_drvdata(pdev);
|
||||
-
|
||||
- free_irq(rtc->irq, rtc);
|
||||
-
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
static int mt6397_rtc_suspend(struct device *dev)
|
||||
{
|
||||
@@ -407,6 +344,7 @@ static SIMPLE_DEV_PM_OPS(mt6397_pm_ops,
|
||||
mt6397_rtc_resume);
|
||||
|
||||
static const struct of_device_id mt6397_rtc_of_match[] = {
|
||||
+ { .compatible = "mediatek,mt6323-rtc", },
|
||||
{ .compatible = "mediatek,mt6397-rtc", },
|
||||
{ }
|
||||
};
|
||||
@@ -419,7 +357,6 @@ static struct platform_driver mtk_rtc_dr
|
||||
.pm = &mt6397_pm_ops,
|
||||
},
|
||||
.probe = mtk_rtc_probe,
|
||||
- .remove = mtk_rtc_remove,
|
||||
};
|
||||
|
||||
module_platform_driver(mtk_rtc_driver);
|
||||
diff --git a/include/linux/mfd/mt6397/rtc.h b/include/linux/mfd/mt6397/rtc.h
|
||||
new file mode 100644
|
||||
index 000000000000..f84b9163c0ee
|
||||
--- /dev/null
|
||||
+++ b/include/linux/mfd/mt6397/rtc.h
|
||||
@@ -0,0 +1,71 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0 */
|
||||
+/*
|
||||
+ * Copyright (C) 2014-2019 MediaTek Inc.
|
||||
+ *
|
||||
+ * Author: Tianping.Fang <tianping.fang@mediatek.com>
|
||||
+ * Sean Wang <sean.wang@mediatek.com>
|
||||
+ */
|
||||
+
|
||||
+#ifndef _LINUX_MFD_MT6397_RTC_H_
|
||||
+#define _LINUX_MFD_MT6397_RTC_H_
|
||||
+
|
||||
+#include <linux/jiffies.h>
|
||||
+#include <linux/mutex.h>
|
||||
+#include <linux/regmap.h>
|
||||
+#include <linux/rtc.h>
|
||||
+
|
||||
+#define RTC_BBPU 0x0000
|
||||
+#define RTC_BBPU_CBUSY BIT(6)
|
||||
+#define RTC_BBPU_KEY (0x43 << 8)
|
||||
+
|
||||
+#define RTC_WRTGR 0x003c
|
||||
+
|
||||
+#define RTC_IRQ_STA 0x0002
|
||||
+#define RTC_IRQ_STA_AL BIT(0)
|
||||
+#define RTC_IRQ_STA_LP BIT(3)
|
||||
+
|
||||
+#define RTC_IRQ_EN 0x0004
|
||||
+#define RTC_IRQ_EN_AL BIT(0)
|
||||
+#define RTC_IRQ_EN_ONESHOT BIT(2)
|
||||
+#define RTC_IRQ_EN_LP BIT(3)
|
||||
+#define RTC_IRQ_EN_ONESHOT_AL (RTC_IRQ_EN_ONESHOT | RTC_IRQ_EN_AL)
|
||||
+
|
||||
+#define RTC_AL_MASK 0x0008
|
||||
+#define RTC_AL_MASK_DOW BIT(4)
|
||||
+
|
||||
+#define RTC_TC_SEC 0x000a
|
||||
+/* Min, Hour, Dom... register offset to RTC_TC_SEC */
|
||||
+#define RTC_OFFSET_SEC 0
|
||||
+#define RTC_OFFSET_MIN 1
|
||||
+#define RTC_OFFSET_HOUR 2
|
||||
+#define RTC_OFFSET_DOM 3
|
||||
+#define RTC_OFFSET_DOW 4
|
||||
+#define RTC_OFFSET_MTH 5
|
||||
+#define RTC_OFFSET_YEAR 6
|
||||
+#define RTC_OFFSET_COUNT 7
|
||||
+
|
||||
+#define RTC_AL_SEC 0x0018
|
||||
+
|
||||
+#define RTC_PDN2 0x002e
|
||||
+#define RTC_PDN2_PWRON_ALARM BIT(4)
|
||||
+
|
||||
+#define RTC_MIN_YEAR 1968
|
||||
+#define RTC_BASE_YEAR 1900
|
||||
+#define RTC_NUM_YEARS 128
|
||||
+#define RTC_MIN_YEAR_OFFSET (RTC_MIN_YEAR - RTC_BASE_YEAR)
|
||||
+
|
||||
+#define MTK_RTC_POLL_DELAY_US 10
|
||||
+#define MTK_RTC_POLL_TIMEOUT (jiffies_to_usecs(HZ))
|
||||
+
|
||||
+struct mt6397_rtc {
|
||||
+ struct device *dev;
|
||||
+ struct rtc_device *rtc_dev;
|
||||
+
|
||||
+ /* Protect register access from multiple tasks */
|
||||
+ struct mutex lock;
|
||||
+ struct regmap *regmap;
|
||||
+ int irq;
|
||||
+ u32 addr_base;
|
||||
+};
|
||||
+
|
||||
+#endif /* _LINUX_MFD_MT6397_RTC_H_ */
|
||||
|
|
@ -0,0 +1,160 @@
|
|||
From 559614ab0ae2c85596218226f095be36c12cf0fa Mon Sep 17 00:00:00 2001
|
||||
From: Josef Friedl <josef.friedl@speed.at>
|
||||
Date: Wed, 3 Jul 2019 12:24:52 +0200
|
||||
Subject: [PATCH] power: reset: add driver for mt6323 poweroff
|
||||
|
||||
add poweroff driver for mt6323 and make Makefile and Kconfig-Entries
|
||||
|
||||
Suggested-by: Frank Wunderlich <frank-w@public-files.de>
|
||||
Signed-off-by: Josef Friedl <josef.friedl@speed.at>
|
||||
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
|
||||
Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com>
|
||||
---
|
||||
changes since v6: none
|
||||
changes since v5: split out mfd/mt6397/core.h
|
||||
changes since v4: none
|
||||
changes since v3: none
|
||||
changes since v2: none (=v2 part 5)
|
||||
---
|
||||
drivers/power/reset/Kconfig | 10 +++
|
||||
drivers/power/reset/Makefile | 1 +
|
||||
drivers/power/reset/mt6323-poweroff.c | 97 +++++++++++++++++++++++++++
|
||||
3 files changed, 108 insertions(+)
|
||||
create mode 100644 drivers/power/reset/mt6323-poweroff.c
|
||||
|
||||
diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
|
||||
index a564237278ff..c721939767eb 100644
|
||||
--- a/drivers/power/reset/Kconfig
|
||||
+++ b/drivers/power/reset/Kconfig
|
||||
@@ -140,6 +140,16 @@ config POWER_RESET_LTC2952
|
||||
This driver supports an external powerdown trigger and board power
|
||||
down via the LTC2952. Bindings are made in the device tree.
|
||||
|
||||
+config POWER_RESET_MT6323
|
||||
+ bool "MediaTek MT6323 power-off driver"
|
||||
+ depends on MFD_MT6397
|
||||
+ help
|
||||
+ The power-off driver is responsible for externally shutdown down
|
||||
+ the power of a remote MediaTek SoC MT6323 is connected to through
|
||||
+ controlling a tiny circuit BBPU inside MT6323 RTC.
|
||||
+
|
||||
+ Say Y if you have a board where MT6323 could be found.
|
||||
+
|
||||
config POWER_RESET_QNAP
|
||||
bool "QNAP power-off driver"
|
||||
depends on OF_GPIO && PLAT_ORION
|
||||
diff --git a/drivers/power/reset/Makefile b/drivers/power/reset/Makefile
|
||||
index 85da3198e4e0..da37f8b851dc 100644
|
||||
--- a/drivers/power/reset/Makefile
|
||||
+++ b/drivers/power/reset/Makefile
|
||||
@@ -11,6 +11,7 @@ obj-$(CONFIG_POWER_RESET_GPIO) += gpio-poweroff.o
|
||||
obj-$(CONFIG_POWER_RESET_GPIO_RESTART) += gpio-restart.o
|
||||
obj-$(CONFIG_POWER_RESET_HISI) += hisi-reboot.o
|
||||
obj-$(CONFIG_POWER_RESET_MSM) += msm-poweroff.o
|
||||
+obj-$(CONFIG_POWER_RESET_MT6323) += mt6323-poweroff.o
|
||||
obj-$(CONFIG_POWER_RESET_QCOM_PON) += qcom-pon.o
|
||||
obj-$(CONFIG_POWER_RESET_OCELOT_RESET) += ocelot-reset.o
|
||||
obj-$(CONFIG_POWER_RESET_PIIX4_POWEROFF) += piix4-poweroff.o
|
||||
diff --git a/drivers/power/reset/mt6323-poweroff.c b/drivers/power/reset/mt6323-poweroff.c
|
||||
new file mode 100644
|
||||
index 000000000000..1caf43d9e46d
|
||||
--- /dev/null
|
||||
+++ b/drivers/power/reset/mt6323-poweroff.c
|
||||
@@ -0,0 +1,97 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Power off through MediaTek PMIC
|
||||
+ *
|
||||
+ * Copyright (C) 2018 MediaTek Inc.
|
||||
+ *
|
||||
+ * Author: Sean Wang <sean.wang@mediatek.com>
|
||||
+ *
|
||||
+ */
|
||||
+
|
||||
+#include <linux/err.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/of.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+#include <linux/mfd/mt6397/core.h>
|
||||
+#include <linux/mfd/mt6397/rtc.h>
|
||||
+
|
||||
+struct mt6323_pwrc {
|
||||
+ struct device *dev;
|
||||
+ struct regmap *regmap;
|
||||
+ u32 base;
|
||||
+};
|
||||
+
|
||||
+static struct mt6323_pwrc *mt_pwrc;
|
||||
+
|
||||
+static void mt6323_do_pwroff(void)
|
||||
+{
|
||||
+ struct mt6323_pwrc *pwrc = mt_pwrc;
|
||||
+ unsigned int val;
|
||||
+ int ret;
|
||||
+
|
||||
+ regmap_write(pwrc->regmap, pwrc->base + RTC_BBPU, RTC_BBPU_KEY);
|
||||
+ regmap_write(pwrc->regmap, pwrc->base + RTC_WRTGR, 1);
|
||||
+
|
||||
+ ret = regmap_read_poll_timeout(pwrc->regmap,
|
||||
+ pwrc->base + RTC_BBPU, val,
|
||||
+ !(val & RTC_BBPU_CBUSY),
|
||||
+ MTK_RTC_POLL_DELAY_US,
|
||||
+ MTK_RTC_POLL_TIMEOUT);
|
||||
+ if (ret)
|
||||
+ dev_err(pwrc->dev, "failed to write BBPU: %d\n", ret);
|
||||
+
|
||||
+ /* Wait some time until system down, otherwise, notice with a warn */
|
||||
+ mdelay(1000);
|
||||
+
|
||||
+ WARN_ONCE(1, "Unable to power off system\n");
|
||||
+}
|
||||
+
|
||||
+static int mt6323_pwrc_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct mt6397_chip *mt6397_chip = dev_get_drvdata(pdev->dev.parent);
|
||||
+ struct mt6323_pwrc *pwrc;
|
||||
+ struct resource *res;
|
||||
+
|
||||
+ pwrc = devm_kzalloc(&pdev->dev, sizeof(*pwrc), GFP_KERNEL);
|
||||
+ if (!pwrc)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
+ pwrc->base = res->start;
|
||||
+ pwrc->regmap = mt6397_chip->regmap;
|
||||
+ pwrc->dev = &pdev->dev;
|
||||
+ mt_pwrc = pwrc;
|
||||
+
|
||||
+ pm_power_off = &mt6323_do_pwroff;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int mt6323_pwrc_remove(struct platform_device *pdev)
|
||||
+{
|
||||
+ if (pm_power_off == &mt6323_do_pwroff)
|
||||
+ pm_power_off = NULL;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id mt6323_pwrc_dt_match[] = {
|
||||
+ { .compatible = "mediatek,mt6323-pwrc" },
|
||||
+ {},
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, mt6323_pwrc_dt_match);
|
||||
+
|
||||
+static struct platform_driver mt6323_pwrc_driver = {
|
||||
+ .probe = mt6323_pwrc_probe,
|
||||
+ .remove = mt6323_pwrc_remove,
|
||||
+ .driver = {
|
||||
+ .name = "mt6323-pwrc",
|
||||
+ .of_match_table = mt6323_pwrc_dt_match,
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
+module_platform_driver(mt6323_pwrc_driver);
|
||||
+
|
||||
+MODULE_DESCRIPTION("Poweroff driver for MT6323 PMIC");
|
||||
+MODULE_AUTHOR("Sean Wang <sean.wang@mediatek.com>");
|
||||
+MODULE_LICENSE("GPL v2");
|
|
@ -0,0 +1,57 @@
|
|||
From c3db4c1163cc20ab0a456086a15c00acb022a67d Mon Sep 17 00:00:00 2001
|
||||
From: Josef Friedl <josef.friedl@speed.at>
|
||||
Date: Thu, 20 Dec 2018 18:27:17 +0100
|
||||
Subject: [PATCH] arm: dts: mt6323: add keys, power-controller, rtc and codec
|
||||
|
||||
support poweroff and power-related keys on bpi-r2
|
||||
|
||||
Suggested-by: Frank Wunderlich <frank-w@public-files.de>
|
||||
Signed-off-by: Josef Friedl <josef.friedl@speed.at>
|
||||
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
|
||||
---
|
||||
changes since v6: none
|
||||
changes since v5: none
|
||||
changes since v4: none
|
||||
changes since v3: none
|
||||
changes since v2: none (=v2 part 7)
|
||||
---
|
||||
arch/arm/boot/dts/mt6323.dtsi | 27 +++++++++++++++++++++++++++
|
||||
1 file changed, 27 insertions(+)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/mt6323.dtsi b/arch/arm/boot/dts/mt6323.dtsi
|
||||
index ba397407c1dd..7fda40ab5fe8 100644
|
||||
--- a/arch/arm/boot/dts/mt6323.dtsi
|
||||
+++ b/arch/arm/boot/dts/mt6323.dtsi
|
||||
@@ -238,5 +238,32 @@
|
||||
regulator-enable-ramp-delay = <216>;
|
||||
};
|
||||
};
|
||||
+
|
||||
+ mt6323keys: mt6323keys {
|
||||
+ compatible = "mediatek,mt6323-keys";
|
||||
+ mediatek,long-press-mode = <1>;
|
||||
+ power-off-time-sec = <0>;
|
||||
+
|
||||
+ power {
|
||||
+ linux,keycodes = <116>;
|
||||
+ wakeup-source;
|
||||
+ };
|
||||
+
|
||||
+ home {
|
||||
+ linux,keycodes = <114>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ codec: mt6397codec {
|
||||
+ compatible = "mediatek,mt6397-codec";
|
||||
+ };
|
||||
+
|
||||
+ power-controller {
|
||||
+ compatible = "mediatek,mt6323-pwrc";
|
||||
+ };
|
||||
+
|
||||
+ rtc {
|
||||
+ compatible = "mediatek,mt6323-rtc";
|
||||
+ };
|
||||
};
|
||||
};
|
|
@ -0,0 +1,500 @@
|
|||
From ae7a8d61a108bb58af8c3ecb16d8e95aad0b1975 Mon Sep 17 00:00:00 2001
|
||||
From: Ryder Lee <ryder.lee@mediatek.com>
|
||||
Date: Wed, 5 Sep 2018 22:09:27 +0800
|
||||
Subject: [PATCH] arm: dts: mt7623: add display subsystem related device nodes
|
||||
|
||||
Add display subsystem related device nodes for MT7623.
|
||||
|
||||
Cc: CK Hu <ck.hu@mediatek.com>
|
||||
Signed-off-by: chunhui dai <chunhui.dai@mediatek.com>
|
||||
Signed-off-by: Bibby Hsieh <bibby.hsieh@mediatek.com>
|
||||
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
|
||||
|
||||
additional fixes:
|
||||
|
||||
[hdmi,dts] fixed dts-warnings
|
||||
author: Bibby Hsieh <bibby.hsieh@mediatek.com>
|
||||
|
||||
[dtsi] fix dpi0-node
|
||||
author: Ryder Lee <ryder.lee@mediatek.com>
|
||||
|
||||
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
|
||||
Tested-by: Frank Wunderlich <frank-w@public-files.de>
|
||||
---
|
||||
arch/arm/boot/dts/mt7623.dtsi | 177 ++++++++++++++++++
|
||||
arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts | 85 +++++++++
|
||||
arch/arm/boot/dts/mt7623n-rfb-emmc.dts | 85 +++++++++
|
||||
3 files changed, 347 insertions(+)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/mt7623.dtsi b/arch/arm/boot/dts/mt7623.dtsi
|
||||
index 59e69f3dffa2..f1880ff04193 100644
|
||||
--- a/arch/arm/boot/dts/mt7623.dtsi
|
||||
+++ b/arch/arm/boot/dts/mt7623.dtsi
|
||||
@@ -23,6 +23,11 @@
|
||||
#address-cells = <2>;
|
||||
#size-cells = <2>;
|
||||
|
||||
+ aliases {
|
||||
+ rdma0 = &rdma0;
|
||||
+ rdma1 = &rdma1;
|
||||
+ };
|
||||
+
|
||||
cpu_opp_table: opp-table {
|
||||
compatible = "operating-points-v2";
|
||||
opp-shared;
|
||||
@@ -320,6 +325,25 @@
|
||||
clock-names = "spi", "wrap";
|
||||
};
|
||||
|
||||
+ mipi_tx0: mipi-dphy@10010000 {
|
||||
+ compatible = "mediatek,mt7623-mipi-tx",
|
||||
+ "mediatek,mt2701-mipi-tx";
|
||||
+ reg = <0 0x10010000 0 0x90>;
|
||||
+ clocks = <&clk26m>;
|
||||
+ clock-output-names = "mipi_tx0_pll";
|
||||
+ #clock-cells = <0>;
|
||||
+ #phy-cells = <0>;
|
||||
+ };
|
||||
+
|
||||
+ cec: cec@10012000 {
|
||||
+ compatible = "mediatek,mt7623-cec",
|
||||
+ "mediatek,mt8173-cec";
|
||||
+ reg = <0 0x10012000 0 0xbc>;
|
||||
+ interrupts = <GIC_SPI 182 IRQ_TYPE_LEVEL_LOW>;
|
||||
+ clocks = <&infracfg CLK_INFRA_CEC>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
cir: cir@10013000 {
|
||||
compatible = "mediatek,mt7623-cir";
|
||||
reg = <0 0x10013000 0 0x1000>;
|
||||
@@ -368,6 +392,18 @@
|
||||
#clock-cells = <1>;
|
||||
};
|
||||
|
||||
+ hdmi_phy: phy@10209100 {
|
||||
+ compatible = "mediatek,mt7623-hdmi-phy",
|
||||
+ "mediatek,mt2701-hdmi-phy";
|
||||
+ reg = <0 0x10209100 0 0x24>;
|
||||
+ clocks = <&apmixedsys CLK_APMIXED_HDMI_REF>;
|
||||
+ clock-names = "pll_ref";
|
||||
+ clock-output-names = "hdmitx_dig_cts";
|
||||
+ #clock-cells = <0>;
|
||||
+ #phy-cells = <0>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
rng: rng@1020f000 {
|
||||
compatible = "mediatek,mt7623-rng";
|
||||
reg = <0 0x1020f000 0 0x1000>;
|
||||
@@ -567,6 +603,16 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
+ hdmiddc0: i2c@11013000 {
|
||||
+ compatible = "mediatek,mt7623-hdmi-ddc",
|
||||
+ "mediatek,mt8173-hdmi-ddc";
|
||||
+ interrupts = <GIC_SPI 81 IRQ_TYPE_LEVEL_LOW>;
|
||||
+ reg = <0 0x11013000 0 0x1C>;
|
||||
+ clocks = <&pericfg CLK_PERI_I2C3>;
|
||||
+ clock-names = "ddc-i2c";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
nor_flash: spi@11014000 {
|
||||
compatible = "mediatek,mt7623-nor",
|
||||
"mediatek,mt8173-nor";
|
||||
@@ -741,6 +787,84 @@
|
||||
#clock-cells = <1>;
|
||||
};
|
||||
|
||||
+ display_components: dispsys@14000000 {
|
||||
+ compatible = "mediatek,mt7623-mmsys",
|
||||
+ "mediatek,mt2701-mmsys";
|
||||
+ reg = <0 0x14000000 0 0x1000>;
|
||||
+ power-domains = <&scpsys MT2701_POWER_DOMAIN_DISP>;
|
||||
+ };
|
||||
+
|
||||
+ ovl@14007000 {
|
||||
+ compatible = "mediatek,mt7623-disp-ovl",
|
||||
+ "mediatek,mt2701-disp-ovl";
|
||||
+ reg = <0 0x14007000 0 0x1000>;
|
||||
+ interrupts = <GIC_SPI 153 IRQ_TYPE_LEVEL_LOW>;
|
||||
+ clocks = <&mmsys CLK_MM_DISP_OVL>;
|
||||
+ iommus = <&iommu MT2701_M4U_PORT_DISP_OVL_0>;
|
||||
+ mediatek,larb = <&larb0>;
|
||||
+ };
|
||||
+
|
||||
+ rdma0: rdma@14008000 {
|
||||
+ compatible = "mediatek,mt7623-disp-rdma",
|
||||
+ "mediatek,mt2701-disp-rdma";
|
||||
+ reg = <0 0x14008000 0 0x1000>;
|
||||
+ interrupts = <GIC_SPI 152 IRQ_TYPE_LEVEL_LOW>;
|
||||
+ clocks = <&mmsys CLK_MM_DISP_RDMA>;
|
||||
+ iommus = <&iommu MT2701_M4U_PORT_DISP_RDMA>;
|
||||
+ mediatek,larb = <&larb0>;
|
||||
+ };
|
||||
+
|
||||
+ wdma@14009000 {
|
||||
+ compatible = "mediatek,mt7623-disp-wdma",
|
||||
+ "mediatek,mt2701-disp-wdma";
|
||||
+ reg = <0 0x14009000 0 0x1000>;
|
||||
+ interrupts = <GIC_SPI 154 IRQ_TYPE_LEVEL_LOW>;
|
||||
+ clocks = <&mmsys CLK_MM_DISP_WDMA>;
|
||||
+ iommus = <&iommu MT2701_M4U_PORT_DISP_WDMA>;
|
||||
+ mediatek,larb = <&larb0>;
|
||||
+ };
|
||||
+
|
||||
+ bls: pwm@1400a000 {
|
||||
+ compatible = "mediatek,mt7623-disp-pwm",
|
||||
+ "mediatek,mt2701-disp-pwm";
|
||||
+ reg = <0 0x1400a000 0 0x1000>;
|
||||
+ #pwm-cells = <2>;
|
||||
+ clocks = <&mmsys CLK_MM_MDP_BLS_26M>,
|
||||
+ <&mmsys CLK_MM_DISP_BLS>;
|
||||
+ clock-names = "main", "mm";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ color@1400b000 {
|
||||
+ compatible = "mediatek,mt7623-disp-color",
|
||||
+ "mediatek,mt2701-disp-color";
|
||||
+ reg = <0 0x1400b000 0 0x1000>;
|
||||
+ interrupts = <GIC_SPI 156 IRQ_TYPE_LEVEL_LOW>;
|
||||
+ clocks = <&mmsys CLK_MM_DISP_COLOR>;
|
||||
+ };
|
||||
+
|
||||
+ dsi: dsi@1400c000 {
|
||||
+ compatible = "mediatek,mt7623-dsi",
|
||||
+ "mediatek,mt2701-dsi";
|
||||
+ reg = <0 0x1400c000 0 0x1000>;
|
||||
+ interrupts = <GIC_SPI 157 IRQ_TYPE_LEVEL_LOW>;
|
||||
+ clocks = <&mmsys CLK_MM_DSI_ENGINE>,
|
||||
+ <&mmsys CLK_MM_DSI_DIG>,
|
||||
+ <&mipi_tx0>;
|
||||
+ clock-names = "engine", "digital", "hs";
|
||||
+ phys = <&mipi_tx0>;
|
||||
+ phy-names = "dphy";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ mutex: mutex@1400e000 {
|
||||
+ compatible = "mediatek,mt7623-disp-mutex",
|
||||
+ "mediatek,mt2701-disp-mutex";
|
||||
+ reg = <0 0x1400e000 0 0x1000>;
|
||||
+ interrupts = <GIC_SPI 161 IRQ_TYPE_LEVEL_LOW>;
|
||||
+ clocks = <&mmsys CLK_MM_MUTEX_32K>;
|
||||
+ };
|
||||
+
|
||||
larb0: larb@14010000 {
|
||||
compatible = "mediatek,mt7623-smi-larb",
|
||||
"mediatek,mt2701-smi-larb";
|
||||
@@ -753,6 +877,44 @@
|
||||
power-domains = <&scpsys MT2701_POWER_DOMAIN_DISP>;
|
||||
};
|
||||
|
||||
+ rdma1: rdma@14012000 {
|
||||
+ compatible = "mediatek,mt7623-disp-rdma",
|
||||
+ "mediatek,mt2701-disp-rdma";
|
||||
+ reg = <0 0x14012000 0 0x1000>;
|
||||
+ interrupts = <GIC_SPI 164 IRQ_TYPE_LEVEL_LOW>;
|
||||
+ clocks = <&mmsys CLK_MM_DISP_RDMA1>;
|
||||
+ iommus = <&iommu MT2701_M4U_PORT_DISP_RDMA1>;
|
||||
+ mediatek,larb = <&larb0>;
|
||||
+ };
|
||||
+
|
||||
+ dpi0: dpi@14014000 {
|
||||
+ compatible = "mediatek,mt7623-dpi",
|
||||
+ "mediatek,mt2701-dpi";
|
||||
+ reg = <0 0x14014000 0 0x1000>;
|
||||
+ interrupts = <GIC_SPI 194 IRQ_TYPE_LEVEL_LOW>;
|
||||
+ clocks = <&mmsys CLK_MM_DPI1_DIGL>,
|
||||
+ <&mmsys CLK_MM_DPI1_ENGINE>,
|
||||
+ <&apmixedsys CLK_APMIXED_TVDPLL>;
|
||||
+ clock-names = "pixel", "engine", "pll";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ hdmi0: hdmi@14015000 {
|
||||
+ compatible = "mediatek,mt7623-hdmi",
|
||||
+ "mediatek,mt8173-hdmi";
|
||||
+ reg = <0 0x14015000 0 0x400>;
|
||||
+ clocks = <&mmsys CLK_MM_HDMI_PIXEL>,
|
||||
+ <&mmsys CLK_MM_HDMI_PLL>,
|
||||
+ <&mmsys CLK_MM_HDMI_AUDIO>,
|
||||
+ <&mmsys CLK_MM_HDMI_SPDIF>;
|
||||
+ clock-names = "pixel", "pll", "bclk", "spdif";
|
||||
+ phys = <&hdmi_phy>;
|
||||
+ phy-names = "hdmi";
|
||||
+ mediatek,syscon-hdmi = <&mmsys 0x900>;
|
||||
+ cec = <&cec>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
imgsys: syscon@15000000 {
|
||||
compatible = "mediatek,mt7623-imgsys",
|
||||
"mediatek,mt2701-imgsys",
|
||||
@@ -1077,6 +1239,21 @@
|
||||
};
|
||||
};
|
||||
|
||||
+ hdmi_pins_a: hdmi-default {
|
||||
+ pins-hdmi {
|
||||
+ pinmux = <MT7623_PIN_123_HTPLG_FUNC_HTPLG>;
|
||||
+ input-enable;
|
||||
+ bias-pull-down;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ hdmi_ddc_pins_a: hdmi_ddc-default {
|
||||
+ pins-hdmi-ddc {
|
||||
+ pinmux = <MT7623_PIN_124_GPIO124_FUNC_HDMISCK>,
|
||||
+ <MT7623_PIN_125_GPIO125_FUNC_HDMISD>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
i2c0_pins_a: i2c0-default {
|
||||
pins-i2c0 {
|
||||
pinmux = <MT7623_PIN_75_SDA0_FUNC_SDA0>,
|
||||
diff --git a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
|
||||
index 2b760f90f38c..7a1763472018 100644
|
||||
--- a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
|
||||
+++ b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
|
||||
@@ -21,6 +21,19 @@
|
||||
stdout-path = "serial2:115200n8";
|
||||
};
|
||||
|
||||
+ connector {
|
||||
+ compatible = "hdmi-connector";
|
||||
+ label = "hdmi";
|
||||
+ type = "d";
|
||||
+ ddc-i2c-bus = <&hdmiddc0>;
|
||||
+
|
||||
+ port {
|
||||
+ hdmi_connector_in: endpoint {
|
||||
+ remote-endpoint = <&hdmi0_out>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
cpus {
|
||||
cpu@0 {
|
||||
proc-supply = <&mt6323_vproc_reg>;
|
||||
@@ -114,10 +127,24 @@
|
||||
};
|
||||
};
|
||||
|
||||
+&bls {
|
||||
+ status = "okay";
|
||||
+
|
||||
+ port {
|
||||
+ bls_out: endpoint {
|
||||
+ remote-endpoint = <&dpi0_in>;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
&btif {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&cec {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&cir {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&cir_pins_a>;
|
||||
@@ -128,6 +155,28 @@
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&dpi0 {
|
||||
+ status = "okay";
|
||||
+
|
||||
+ ports {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+ port@0 {
|
||||
+ reg = <0>;
|
||||
+ dpi0_out: endpoint {
|
||||
+ remote-endpoint = <&hdmi0_in>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ port@1 {
|
||||
+ reg = <1>;
|
||||
+ dpi0_in: endpoint {
|
||||
+ remote-endpoint = <&bls_out>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
ð {
|
||||
status = "okay";
|
||||
|
||||
@@ -199,6 +248,42 @@
|
||||
};
|
||||
};
|
||||
|
||||
+&hdmi0 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&hdmi_pins_a>;
|
||||
+ status = "okay";
|
||||
+
|
||||
+ ports {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+ port@0 {
|
||||
+ reg = <0>;
|
||||
+ hdmi0_in: endpoint {
|
||||
+ remote-endpoint = <&dpi0_out>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ port@1 {
|
||||
+ reg = <1>;
|
||||
+ hdmi0_out: endpoint {
|
||||
+ remote-endpoint = <&hdmi_connector_in>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&hdmiddc0 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&hdmi_ddc_pins_a>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&hdmi_phy {
|
||||
+ mediatek,ibias = <0xa>;
|
||||
+ mediatek,ibias_up = <0x1c>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&i2c0 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&i2c0_pins_a>;
|
||||
diff --git a/arch/arm/boot/dts/mt7623n-rfb-emmc.dts b/arch/arm/boot/dts/mt7623n-rfb-emmc.dts
|
||||
index b7606130ade9..3e5911d8d6bc 100644
|
||||
--- a/arch/arm/boot/dts/mt7623n-rfb-emmc.dts
|
||||
+++ b/arch/arm/boot/dts/mt7623n-rfb-emmc.dts
|
||||
@@ -24,6 +24,19 @@
|
||||
stdout-path = "serial2:115200n8";
|
||||
};
|
||||
|
||||
+ connector {
|
||||
+ compatible = "hdmi-connector";
|
||||
+ label = "hdmi";
|
||||
+ type = "d";
|
||||
+ ddc-i2c-bus = <&hdmiddc0>;
|
||||
+
|
||||
+ port {
|
||||
+ hdmi_connector_in: endpoint {
|
||||
+ remote-endpoint = <&hdmi0_out>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
cpus {
|
||||
cpu@0 {
|
||||
proc-supply = <&mt6323_vproc_reg>;
|
||||
@@ -106,10 +119,24 @@
|
||||
};
|
||||
};
|
||||
|
||||
+&bls {
|
||||
+ status = "okay";
|
||||
+
|
||||
+ port {
|
||||
+ bls_out: endpoint {
|
||||
+ remote-endpoint = <&dpi0_in>;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
&btif {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&cec {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&cir {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&cir_pins_a>;
|
||||
@@ -120,6 +147,28 @@
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&dpi0 {
|
||||
+ status = "okay";
|
||||
+
|
||||
+ ports {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+ port@0 {
|
||||
+ reg = <0>;
|
||||
+ dpi0_out: endpoint {
|
||||
+ remote-endpoint = <&hdmi0_in>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ port@1 {
|
||||
+ reg = <1>;
|
||||
+ dpi0_in: endpoint {
|
||||
+ remote-endpoint = <&bls_out>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
ð {
|
||||
status = "okay";
|
||||
|
||||
@@ -202,6 +251,42 @@
|
||||
};
|
||||
};
|
||||
|
||||
+&hdmi0 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&hdmi_pins_a>;
|
||||
+ status = "okay";
|
||||
+
|
||||
+ ports {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+ port@0 {
|
||||
+ reg = <0>;
|
||||
+ hdmi0_in: endpoint {
|
||||
+ remote-endpoint = <&dpi0_out>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ port@1 {
|
||||
+ reg = <1>;
|
||||
+ hdmi0_out: endpoint {
|
||||
+ remote-endpoint = <&hdmi_connector_in>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&hdmiddc0 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&hdmi_ddc_pins_a>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&hdmi_phy {
|
||||
+ mediatek,ibias = <0xa>;
|
||||
+ mediatek,ibias_up = <0x1c>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&i2c0 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&i2c0_pins_a>;
|
|
@ -0,0 +1,77 @@
|
|||
From 6468d187f12604f38f0a3acde430fdc5c5390771 Mon Sep 17 00:00:00 2001
|
||||
From: Ryder Lee <ryder.lee@mediatek.com>
|
||||
Date: Tue, 23 Jul 2019 11:32:50 +0800
|
||||
Subject: [PATCH] arm: dts: mt7623: add Mali-450 device nodes
|
||||
|
||||
Add nodes for Mali-450 and iommu larb3.
|
||||
|
||||
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
|
||||
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
|
||||
---
|
||||
arch/arm/boot/dts/mt7623.dtsi | 39 ++++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 38 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/mt7623.dtsi b/arch/arm/boot/dts/mt7623.dtsi
|
||||
index 8d0807fd9460..f7905561b30e 100644
|
||||
--- a/arch/arm/boot/dts/mt7623.dtsi
|
||||
+++ b/arch/arm/boot/dts/mt7623.dtsi
|
||||
@@ -3,6 +3,7 @@
|
||||
* Copyright (c) 2017-2018 MediaTek Inc.
|
||||
* Author: John Crispin <john@phrozen.org>
|
||||
* Sean Wang <sean.wang@mediatek.com>
|
||||
+ * Ryder Lee <ryder.lee@mediatek.com>
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -371,7 +372,7 @@
|
||||
interrupts = <GIC_SPI 106 IRQ_TYPE_LEVEL_LOW>;
|
||||
clocks = <&infracfg CLK_INFRA_M4U>;
|
||||
clock-names = "bclk";
|
||||
- mediatek,larbs = <&larb0 &larb1 &larb2>;
|
||||
+ mediatek,larbs = <&larb0 &larb1 &larb2 &larb3>;
|
||||
#iommu-cells = <1>;
|
||||
};
|
||||
|
||||
@@ -794,6 +795,42 @@
|
||||
#reset-cells = <1>;
|
||||
};
|
||||
|
||||
+ larb3: larb@13010000 {
|
||||
+ compatible = "mediatek,mt7623-smi-larb",
|
||||
+ "mediatek,mt2701-smi-larb";
|
||||
+ reg = <0 0x13010000 0 0x1000>;
|
||||
+ mediatek,smi = <&smi_common>;
|
||||
+ mediatek,larb-id = <3>;
|
||||
+ clocks = <&clk26m>, <&clk26m>;
|
||||
+ clock-names = "apb", "smi";
|
||||
+ power-domains = <&scpsys MT2701_POWER_DOMAIN_MFG>;
|
||||
+ };
|
||||
+
|
||||
+ mali: gpu@13040000 {
|
||||
+ compatible = "mediatek,mt7623-mali", "arm,mali-450";
|
||||
+ reg = <0 0x13040000 0 0x30000>;
|
||||
+ interrupts = <GIC_SPI 170 IRQ_TYPE_LEVEL_LOW>,
|
||||
+ <GIC_SPI 171 IRQ_TYPE_LEVEL_LOW>,
|
||||
+ <GIC_SPI 172 IRQ_TYPE_LEVEL_LOW>,
|
||||
+ <GIC_SPI 173 IRQ_TYPE_LEVEL_LOW>,
|
||||
+ <GIC_SPI 174 IRQ_TYPE_LEVEL_LOW>,
|
||||
+ <GIC_SPI 175 IRQ_TYPE_LEVEL_LOW>,
|
||||
+ <GIC_SPI 176 IRQ_TYPE_LEVEL_LOW>,
|
||||
+ <GIC_SPI 177 IRQ_TYPE_LEVEL_LOW>,
|
||||
+ <GIC_SPI 178 IRQ_TYPE_LEVEL_LOW>,
|
||||
+ <GIC_SPI 179 IRQ_TYPE_LEVEL_LOW>,
|
||||
+ <GIC_SPI 180 IRQ_TYPE_LEVEL_LOW>;
|
||||
+ interrupt-names = "gp", "gpmmu", "pp0", "ppmmu0", "pp1",
|
||||
+ "ppmmu1", "pp2", "ppmmu2", "pp3", "ppmmu3",
|
||||
+ "pp";
|
||||
+ clocks = <&topckgen CLK_TOP_MMPLL>,
|
||||
+ <&g3dsys CLK_G3DSYS_CORE>;
|
||||
+ clock-names = "bus", "core";
|
||||
+ power-domains = <&scpsys MT2701_POWER_DOMAIN_MFG>;
|
||||
+ mediatek,larb = <&larb3>;
|
||||
+ resets = <&g3dsys MT2701_G3DSYS_CORE_RST>;
|
||||
+ };
|
||||
+
|
||||
mmsys: syscon@14000000 {
|
||||
compatible = "mediatek,mt7623-mmsys",
|
||||
"mediatek,mt2701-mmsys",
|
|
@ -0,0 +1,68 @@
|
|||
From d87e1a23e51158f9c2923f6213a42d5e942a4091 Mon Sep 17 00:00:00 2001
|
||||
From: Frank Wunderlich <frank-w@public-files.de>
|
||||
Date: Thu, 23 Jan 2020 07:16:30 +0100
|
||||
Subject: [PATCH] lima: power on/off via register (function)
|
||||
|
||||
---
|
||||
drivers/gpu/drm/lima/lima_device.c | 31 ++++++++++++++++++++++++++++++
|
||||
1 file changed, 31 insertions(+)
|
||||
|
||||
diff --git a/drivers/gpu/drm/lima/lima_device.c b/drivers/gpu/drm/lima/lima_device.c
|
||||
index d86b8d81a483..7d5d45e176f2 100644
|
||||
--- a/drivers/gpu/drm/lima/lima_device.c
|
||||
+++ b/drivers/gpu/drm/lima/lima_device.c
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <linux/clk.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/platform_device.h>
|
||||
+#include <linux/pm_runtime.h>
|
||||
|
||||
#include "lima_device.h"
|
||||
#include "lima_gp.h"
|
||||
@@ -287,11 +288,33 @@ static void lima_fini_pp_pipe(struct lima_device *dev)
|
||||
lima_sched_pipe_fini(pipe);
|
||||
}
|
||||
|
||||
+void mtk_set_power(bool on)
|
||||
+{
|
||||
+ if (on) {
|
||||
+ void __iomem *wakeup_register;
|
||||
+ wakeup_register = ioremap(0x10003014 , 0x04);
|
||||
+ writel(0x00000001,wakeup_register); // this may be wrong, may need bitbang 0th bit to 1
|
||||
+ iounmap(wakeup_register);
|
||||
+ }else {
|
||||
+ void __iomem *powerdown_register;
|
||||
+ powerdown_register = ioremap(0x1000300C , 0x04); // powerdown register
|
||||
+ writel(0x00000001,powerdown_register); // this may be wrong, may need bitbang 0th bit to 1
|
||||
+ iounmap(powerdown_register);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
int lima_device_init(struct lima_device *ldev)
|
||||
{
|
||||
int err, i;
|
||||
struct resource *res;
|
||||
|
||||
+ #ifdef CONFIG_MTK_COMBO_CHIP_CONSYS_7623
|
||||
+ mtk_set_power(true);
|
||||
+ pm_runtime_enable(ldev->dev);
|
||||
+ pm_runtime_set_active(ldev->dev);
|
||||
+ pm_runtime_get_sync(ldev->dev);
|
||||
+ #endif
|
||||
+
|
||||
dma_set_coherent_mask(ldev->dev, DMA_BIT_MASK(32));
|
||||
|
||||
err = lima_clk_init(ldev);
|
||||
@@ -385,4 +408,12 @@ void lima_device_fini(struct lima_device *ldev)
|
||||
lima_regulator_fini(ldev);
|
||||
|
||||
lima_clk_fini(ldev);
|
||||
+
|
||||
+ #ifdef CONFIG_MTK_COMBO_CHIP_CONSYS_7623
|
||||
+ pm_runtime_set_suspended(ldev->dev);
|
||||
+ pm_runtime_put_noidle(ldev->dev);
|
||||
+ pm_runtime_disable(ldev->dev);
|
||||
+
|
||||
+ mtk_set_power(false);
|
||||
+ #endif
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
From 452b508468a46ef0fe7357fab6b000c52fd047d3 Mon Sep 17 00:00:00 2001
|
||||
From: Stu Hsieh <stu.hsieh@mediatek.com>
|
||||
Date: Fri, 16 Nov 2018 16:33:00 +0100
|
||||
Subject: [PATCH] drm: Add get_possible_crtc API for dpi, dsi
|
||||
|
||||
Test: build pass and run ok
|
||||
|
||||
Signed-off-by: Stu Hsieh <stu.hsieh@mediatek.com>
|
||||
---
|
||||
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 40 +++++++++++++++++++++
|
||||
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h | 2 ++
|
||||
2 files changed, 42 insertions(+)
|
||||
|
||||
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
|
||||
index efa85973e46b..29796e78b26a 100644
|
||||
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
|
||||
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
|
||||
@@ -237,6 +237,22 @@ static const struct mtk_ddp_comp_match mtk_ddp_matches[DDP_COMPONENT_ID_MAX] = {
|
||||
[DDP_COMPONENT_WDMA1] = { MTK_DISP_WDMA, 1, NULL },
|
||||
};
|
||||
|
||||
+static bool mtk_drm_find_comp_in_ddp(struct mtk_ddp_comp ddp_comp,
|
||||
+ const enum mtk_ddp_comp_id *path,
|
||||
+ unsigned int path_len)
|
||||
+{
|
||||
+ unsigned int i;
|
||||
+
|
||||
+ if (path == NULL)
|
||||
+ return false;
|
||||
+
|
||||
+ for (i = 0U; i < path_len; i++)
|
||||
+ if (ddp_comp.id == path[i])
|
||||
+ return true;
|
||||
+
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
int mtk_ddp_comp_get_id(struct device_node *node,
|
||||
enum mtk_ddp_comp_type comp_type)
|
||||
{
|
||||
@@ -252,6 +268,30 @@ int mtk_ddp_comp_get_id(struct device_node *node,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
+unsigned int mtk_drm_find_possible_crtc_by_comp(struct drm_device *drm,
|
||||
+ struct mtk_ddp_comp ddp_comp)
|
||||
+{
|
||||
+ struct mtk_drm_private *private = drm->dev_private;
|
||||
+ unsigned int ret;
|
||||
+
|
||||
+ if (mtk_drm_find_comp_in_ddp(ddp_comp, private->data->main_path,
|
||||
+ private->data->main_len) == true) {
|
||||
+ ret = BIT(0);
|
||||
+ } else if (mtk_drm_find_comp_in_ddp(ddp_comp,
|
||||
+ private->data->ext_path,
|
||||
+ private->data->ext_len) == true) {
|
||||
+ ret = BIT(1);
|
||||
+ } else if (mtk_drm_find_comp_in_ddp(ddp_comp,
|
||||
+ private->data->third_path,
|
||||
+ private->data->third_len) == true) {
|
||||
+ ret = BIT(2);
|
||||
+ } else {
|
||||
+ DRM_INFO("Failed to find comp in ddp table\n");
|
||||
+ ret = 0;
|
||||
+ }
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
int mtk_ddp_comp_init(struct device *dev, struct device_node *node,
|
||||
struct mtk_ddp_comp *comp, enum mtk_ddp_comp_id comp_id,
|
||||
const struct mtk_ddp_comp_funcs *funcs)
|
||||
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
|
||||
index 0ad287f427cc..97be111c3e52 100644
|
||||
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
|
||||
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
|
||||
@@ -160,6 +160,8 @@ static inline void mtk_ddp_gamma_set(struct mtk_ddp_comp *comp,
|
||||
|
||||
int mtk_ddp_comp_get_id(struct device_node *node,
|
||||
enum mtk_ddp_comp_type comp_type);
|
||||
+unsigned int mtk_drm_find_possible_crtc_by_comp(struct drm_device *drm,
|
||||
+ struct mtk_ddp_comp ddp_comp);
|
||||
int mtk_ddp_comp_init(struct device *dev, struct device_node *comp_node,
|
||||
struct mtk_ddp_comp *comp, enum mtk_ddp_comp_id comp_id,
|
||||
const struct mtk_ddp_comp_funcs *funcs);
|
|
@ -0,0 +1,45 @@
|
|||
From f4ca44932ccf088f225062aafef04d2bd629b2c4 Mon Sep 17 00:00:00 2001
|
||||
From: Jitao Shi <jitao.shi@mediatek.com>
|
||||
Date: Fri, 3 May 2019 17:16:19 +0200
|
||||
Subject: [PATCH] drm/mediatek: dpi/dsi: change the getting possible_crtc way
|
||||
|
||||
[Detail]
|
||||
dpi/dsi get the possible_crtc by
|
||||
mtk_drm_find_possible_crtc_by_comp(*drm_dev, ddp_comp)
|
||||
|
||||
Test: build pass and boot to logo
|
||||
|
||||
Signed-off-by: Jitao Shi <jitao.shi@mediatek.com>
|
||||
---
|
||||
drivers/gpu/drm/mediatek/mtk_dpi.c | 3 ++-
|
||||
drivers/gpu/drm/mediatek/mtk_dsi.c | 3 ++-
|
||||
2 files changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
|
||||
index be6d95c5ff25..00d31b5aa09f 100644
|
||||
--- a/drivers/gpu/drm/mediatek/mtk_dpi.c
|
||||
+++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
|
||||
@@ -604,7 +604,8 @@ static int mtk_dpi_bind(struct device *dev, struct device *master, void *data)
|
||||
drm_encoder_helper_add(&dpi->encoder, &mtk_dpi_encoder_helper_funcs);
|
||||
|
||||
/* Currently DPI0 is fixed to be driven by OVL1 */
|
||||
- dpi->encoder.possible_crtcs = BIT(1);
|
||||
+ dpi->encoder.possible_crtcs =
|
||||
+ mtk_drm_find_possible_crtc_by_comp(drm_dev, dpi->ddp_comp);
|
||||
|
||||
ret = drm_bridge_attach(&dpi->encoder, dpi->bridge, NULL);
|
||||
if (ret) {
|
||||
diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
|
||||
index 224afb666881..2c2d3643f3e8 100644
|
||||
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
|
||||
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
|
||||
@@ -817,7 +817,8 @@ static int mtk_dsi_create_conn_enc(struct drm_device *drm, struct mtk_dsi *dsi)
|
||||
* Currently display data paths are statically assigned to a crtc each.
|
||||
* crtc 0 is OVL0 -> COLOR0 -> AAL -> OD -> RDMA0 -> UFOE -> DSI0
|
||||
*/
|
||||
- dsi->encoder.possible_crtcs = 1;
|
||||
+ dsi->encoder.possible_crtcs =
|
||||
+ mtk_drm_find_possible_crtc_by_comp(drm, dsi->ddp_comp);
|
||||
|
||||
/* If there's a bridge, attach to it and let it create the connector */
|
||||
if (dsi->bridge) {
|
|
@ -0,0 +1,21 @@
|
|||
From 34dd2a86c9e3b3ad1a3a00add409edda2b2ed776 Mon Sep 17 00:00:00 2001
|
||||
From: Frank Wunderlich <frank-w@public-files.de>
|
||||
Date: Tue, 1 Oct 2019 11:21:03 +0200
|
||||
Subject: [PATCH] drm: fix implicit declaration of function 'DRM_INFO'
|
||||
|
||||
---
|
||||
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
|
||||
index 29796e78b26a..e65d83267563 100644
|
||||
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
|
||||
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <linux/of_irq.h>
|
||||
#include <linux/of_platform.h>
|
||||
#include <linux/platform_device.h>
|
||||
+#include <drm/drm_print.h>
|
||||
|
||||
#include "mtk_drm_drv.h"
|
||||
#include "mtk_drm_plane.h"
|
|
@ -0,0 +1,146 @@
|
|||
From 6e3f7375acdcf714d1fcbae1238cd39cc9391560 Mon Sep 17 00:00:00 2001
|
||||
From: Bibby Hsieh <bibby.hsieh@mediatek.com>
|
||||
Date: Fri, 21 Sep 2018 11:28:22 +0800
|
||||
Subject: [PATCH] drm/mediatek: config component output by device node port
|
||||
|
||||
We can select output component by decive node port.
|
||||
Main path default output component is DSI.
|
||||
External path default output component is DPI.
|
||||
|
||||
Signed-off-by: Bibby Hsieh <bibby.hsieh@mediatek.com>
|
||||
|
||||
added small fixes for warnings
|
||||
|
||||
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
|
||||
Tested-by: Frank Wunderlich <frank-w@public-files.de>
|
||||
---
|
||||
drivers/gpu/drm/mediatek/mtk_drm_drv.c | 46 ++++++++++++++++++++++----
|
||||
drivers/gpu/drm/mediatek/mtk_drm_drv.h | 4 +--
|
||||
2 files changed, 42 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
|
||||
index 352b81a7a670..33511c77b800 100644
|
||||
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
|
||||
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
|
||||
@@ -21,6 +21,13 @@
|
||||
#include <drm/drm_of.h>
|
||||
#include <drm/drm_probe_helper.h>
|
||||
#include <drm/drm_vblank.h>
|
||||
+#include <linux/component.h>
|
||||
+#include <linux/iommu.h>
|
||||
+#include <linux/of.h>
|
||||
+#include <linux/of_address.h>
|
||||
+#include <linux/of_graph.h>
|
||||
+#include <linux/of_platform.h>
|
||||
+#include <linux/pm_runtime.h>
|
||||
|
||||
#include "mtk_drm_crtc.h"
|
||||
#include "mtk_drm_ddp.h"
|
||||
@@ -121,7 +128,7 @@ static const struct drm_mode_config_funcs mtk_drm_mode_config_funcs = {
|
||||
.atomic_commit = mtk_atomic_commit,
|
||||
};
|
||||
|
||||
-static const enum mtk_ddp_comp_id mt2701_mtk_ddp_main[] = {
|
||||
+static enum mtk_ddp_comp_id mt2701_mtk_ddp_main[] = {
|
||||
DDP_COMPONENT_OVL0,
|
||||
DDP_COMPONENT_RDMA0,
|
||||
DDP_COMPONENT_COLOR0,
|
||||
@@ -129,12 +136,12 @@ static const enum mtk_ddp_comp_id mt2701_mtk_ddp_main[] = {
|
||||
DDP_COMPONENT_DSI0,
|
||||
};
|
||||
|
||||
-static const enum mtk_ddp_comp_id mt2701_mtk_ddp_ext[] = {
|
||||
+static enum mtk_ddp_comp_id mt2701_mtk_ddp_ext[] = {
|
||||
DDP_COMPONENT_RDMA1,
|
||||
DDP_COMPONENT_DPI0,
|
||||
};
|
||||
|
||||
-static const enum mtk_ddp_comp_id mt2712_mtk_ddp_main[] = {
|
||||
+static enum mtk_ddp_comp_id mt2712_mtk_ddp_main[] = {
|
||||
DDP_COMPONENT_OVL0,
|
||||
DDP_COMPONENT_COLOR0,
|
||||
DDP_COMPONENT_AAL0,
|
||||
@@ -144,7 +151,7 @@ static const enum mtk_ddp_comp_id mt2712_mtk_ddp_main[] = {
|
||||
DDP_COMPONENT_PWM0,
|
||||
};
|
||||
|
||||
-static const enum mtk_ddp_comp_id mt2712_mtk_ddp_ext[] = {
|
||||
+static enum mtk_ddp_comp_id mt2712_mtk_ddp_ext[] = {
|
||||
DDP_COMPONENT_OVL1,
|
||||
DDP_COMPONENT_COLOR1,
|
||||
DDP_COMPONENT_AAL1,
|
||||
@@ -160,7 +167,7 @@ static const enum mtk_ddp_comp_id mt2712_mtk_ddp_third[] = {
|
||||
DDP_COMPONENT_PWM2,
|
||||
};
|
||||
|
||||
-static const enum mtk_ddp_comp_id mt8173_mtk_ddp_main[] = {
|
||||
+static enum mtk_ddp_comp_id mt8173_mtk_ddp_main[] = {
|
||||
DDP_COMPONENT_OVL0,
|
||||
DDP_COMPONENT_COLOR0,
|
||||
DDP_COMPONENT_AAL0,
|
||||
@@ -171,7 +178,7 @@ static const enum mtk_ddp_comp_id mt8173_mtk_ddp_main[] = {
|
||||
DDP_COMPONENT_PWM0,
|
||||
};
|
||||
|
||||
-static const enum mtk_ddp_comp_id mt8173_mtk_ddp_ext[] = {
|
||||
+static enum mtk_ddp_comp_id mt8173_mtk_ddp_ext[] = {
|
||||
DDP_COMPONENT_OVL1,
|
||||
DDP_COMPONENT_COLOR1,
|
||||
DDP_COMPONENT_GAMMA,
|
||||
@@ -510,6 +517,7 @@ static int mtk_drm_probe(struct platform_device *pdev)
|
||||
|
||||
/* Iterate over sibling DISP function blocks */
|
||||
for_each_child_of_node(dev->of_node->parent, node) {
|
||||
+ struct device_node *port, *ep, *remote;
|
||||
const struct of_device_id *of_id;
|
||||
enum mtk_ddp_comp_type comp_type;
|
||||
int comp_id;
|
||||
@@ -572,6 +580,32 @@ static int mtk_drm_probe(struct platform_device *pdev)
|
||||
|
||||
private->ddp_comp[comp_id] = comp;
|
||||
}
|
||||
+
|
||||
+ if (comp_type != MTK_DSI && comp_type != MTK_DPI) {
|
||||
+ port = of_graph_get_port_by_id(node, 0);
|
||||
+ if (!port)
|
||||
+ continue;
|
||||
+ ep = of_get_child_by_name(port, "endpoint");
|
||||
+ of_node_put(port);
|
||||
+ if (!ep)
|
||||
+ continue;
|
||||
+ remote = of_graph_get_remote_port_parent(ep);
|
||||
+ of_node_put(ep);
|
||||
+ if (!remote)
|
||||
+ continue;
|
||||
+ of_id = of_match_node(mtk_ddp_comp_dt_ids, remote);
|
||||
+ if (!of_id)
|
||||
+ continue;
|
||||
+ comp_type = (enum mtk_ddp_comp_type)of_id->data;
|
||||
+ for (i = 0; i < private->data->main_len - 1; i++)
|
||||
+ if (private->data->main_path[i] == comp_id)
|
||||
+ private->data->main_path[i + 1] =
|
||||
+ mtk_ddp_comp_get_id(node, comp_type);
|
||||
+ for (i = 0; i < private->data->ext_len - 1; i++)
|
||||
+ if (private->data->ext_path[i] == comp_id)
|
||||
+ private->data->ext_path[i + 1] =
|
||||
+ mtk_ddp_comp_get_id(node, comp_type);
|
||||
+ }
|
||||
}
|
||||
|
||||
if (!private->mutex_node) {
|
||||
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.h b/drivers/gpu/drm/mediatek/mtk_drm_drv.h
|
||||
index e03fea12ff59..5fb723415ff6 100644
|
||||
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.h
|
||||
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.h
|
||||
@@ -21,9 +21,9 @@ struct drm_property;
|
||||
struct regmap;
|
||||
|
||||
struct mtk_mmsys_driver_data {
|
||||
- const enum mtk_ddp_comp_id *main_path;
|
||||
+ enum mtk_ddp_comp_id *main_path;
|
||||
unsigned int main_len;
|
||||
- const enum mtk_ddp_comp_id *ext_path;
|
||||
+ enum mtk_ddp_comp_id *ext_path;
|
||||
unsigned int ext_len;
|
||||
const enum mtk_ddp_comp_id *third_path;
|
||||
unsigned int third_len;
|
|
@ -0,0 +1,55 @@
|
|||
From ba9c6527b05d294bdda7910db224e327f1460166 Mon Sep 17 00:00:00 2001
|
||||
From: chunhui dai <chunhui.dai@mediatek.com>
|
||||
Date: Wed, 31 Oct 2018 16:59:34 +0800
|
||||
Subject: [PATCH] drm/mediatek: fix boot up for 720 and 480 but 1080
|
||||
|
||||
- 1080 plg in/out with ng/ok
|
||||
- support other resolutions like 1280x1024
|
||||
|
||||
Signed-off-by: chunhui dai <chunhui.dai@mediatek.com>
|
||||
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
|
||||
Tested-by: Frank Wunderlich <frank-w@public-files.de>
|
||||
---
|
||||
drivers/gpu/drm/mediatek/mtk_hdmi_phy.c | 3 +++
|
||||
drivers/gpu/drm/mediatek/mtk_hdmi_phy.h | 1 +
|
||||
drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c | 1 +
|
||||
3 files changed, 5 insertions(+)
|
||||
|
||||
diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c
|
||||
index 5223498502c4..edadb7a700f1 100644
|
||||
--- a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c
|
||||
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c
|
||||
@@ -184,6 +184,9 @@ static int mtk_hdmi_phy_probe(struct platform_device *pdev)
|
||||
return PTR_ERR(phy_provider);
|
||||
}
|
||||
|
||||
+ if (hdmi_phy->conf->pll_default_off)
|
||||
+ hdmi_phy->conf->hdmi_phy_disable_tmds(hdmi_phy);
|
||||
+
|
||||
return of_clk_add_provider(dev->of_node, of_clk_src_simple_get,
|
||||
hdmi_phy->pll);
|
||||
}
|
||||
diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h
|
||||
index 2d8b3182470d..f472fdeb63dc 100644
|
||||
--- a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h
|
||||
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h
|
||||
@@ -22,6 +22,7 @@ struct mtk_hdmi_phy;
|
||||
struct mtk_hdmi_phy_conf {
|
||||
bool tz_disabled;
|
||||
unsigned long flags;
|
||||
+ bool pll_default_off;
|
||||
const struct clk_ops *hdmi_phy_clk_ops;
|
||||
void (*hdmi_phy_enable_tmds)(struct mtk_hdmi_phy *hdmi_phy);
|
||||
void (*hdmi_phy_disable_tmds)(struct mtk_hdmi_phy *hdmi_phy);
|
||||
diff --git a/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c b/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c
|
||||
index d3cc4022e988..6fbedacfc1e8 100644
|
||||
--- a/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c
|
||||
+++ b/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c
|
||||
@@ -239,6 +239,7 @@ static void mtk_hdmi_phy_disable_tmds(struct mtk_hdmi_phy *hdmi_phy)
|
||||
struct mtk_hdmi_phy_conf mtk_hdmi_phy_2701_conf = {
|
||||
.tz_disabled = true,
|
||||
.flags = CLK_SET_RATE_GATE,
|
||||
+ .pll_default_off = true,
|
||||
.hdmi_phy_clk_ops = &mtk_hdmi_phy_pll_ops,
|
||||
.hdmi_phy_enable_tmds = mtk_hdmi_phy_enable_tmds,
|
||||
.hdmi_phy_disable_tmds = mtk_hdmi_phy_disable_tmds,
|
|
@ -0,0 +1,56 @@
|
|||
From aa97a44297179ab6ba1aa8f59e781541a320066b Mon Sep 17 00:00:00 2001
|
||||
From: Frank Wunderlich <frank-w@public-files.de>
|
||||
Date: Fri, 31 Jan 2020 17:28:04 +0100
|
||||
Subject: [PATCH] thermal: mediatek: add sensors-support
|
||||
|
||||
---
|
||||
drivers/thermal/mtk_thermal.c | 22 ++++++++++++++++++++++
|
||||
1 file changed, 22 insertions(+)
|
||||
|
||||
diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c
|
||||
index d1b066383c45..8cf3a69bfa46 100644
|
||||
--- a/drivers/thermal/mtk_thermal.c
|
||||
+++ b/drivers/thermal/mtk_thermal.c
|
||||
@@ -23,6 +23,8 @@
|
||||
#include <linux/reset.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
+#include "thermal_hwmon.h"
|
||||
+
|
||||
/* AUXADC Registers */
|
||||
#define AUXADC_CON1_SET_V 0x008
|
||||
#define AUXADC_CON1_CLR_V 0x00c
|
||||
@@ -990,6 +992,13 @@ static void mtk_thermal_release_periodic_ts(struct mtk_thermal *mt,
|
||||
writel((tmp & (~0x10e)), mt->thermal_base + TEMP_MSRCTL1);
|
||||
}
|
||||
|
||||
+static void mtk_thermal_hwmon_action(void *data)
|
||||
+{
|
||||
+ struct thermal_zone_device *zone = data;
|
||||
+
|
||||
+ thermal_remove_hwmon_sysfs(zone);
|
||||
+}
|
||||
+
|
||||
static int mtk_thermal_probe(struct platform_device *pdev)
|
||||
{
|
||||
int ret, i, ctrl_id;
|
||||
@@ -1094,6 +1103,19 @@ static int mtk_thermal_probe(struct platform_device *pdev)
|
||||
goto err_disable_clk_peri_therm;
|
||||
}
|
||||
|
||||
+ tzdev->tzp->no_hwmon = false;
|
||||
+ ret = thermal_add_hwmon_sysfs(tzdev);
|
||||
+ if (ret)
|
||||
+ dev_err(&pdev->dev,"error in thermal_add_hwmon_sysfs");
|
||||
+ //goto err_disable_clk_peri_therm;
|
||||
+
|
||||
+ ret = devm_add_action(&pdev->dev, mtk_thermal_hwmon_action, tzdev);
|
||||
+ if (ret) {
|
||||
+ dev_err(&pdev->dev,"error in devm_add_action");
|
||||
+ mtk_thermal_hwmon_action(tzdev);
|
||||
+ //goto err_disable_clk_peri_therm;
|
||||
+ }
|
||||
+
|
||||
return 0;
|
||||
|
||||
err_disable_clk_peri_therm:
|
35
root/target/linux/mediatek/patches-5.4/0191-thermal.patch
Normal file
35
root/target/linux/mediatek/patches-5.4/0191-thermal.patch
Normal file
|
@ -0,0 +1,35 @@
|
|||
From 9847677bda4920bbba15499f28009ce095f02c99 Mon Sep 17 00:00:00 2001
|
||||
From: Frank Wunderlich <frank-w@public-files.de>
|
||||
Date: Fri, 31 Jan 2020 18:49:56 +0100
|
||||
Subject: [PATCH] thermal: mediatek: execute hwmon-code only if hwmon_thermal
|
||||
is set
|
||||
|
||||
---
|
||||
drivers/thermal/mtk_thermal.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c
|
||||
index 8cf3a69bfa46..3a646b88f587 100644
|
||||
--- a/drivers/thermal/mtk_thermal.c
|
||||
+++ b/drivers/thermal/mtk_thermal.c
|
||||
@@ -1103,18 +1103,18 @@ static int mtk_thermal_probe(struct platform_device *pdev)
|
||||
goto err_disable_clk_peri_therm;
|
||||
}
|
||||
|
||||
+#ifdef CONFIG_THERMAL_HWMON
|
||||
tzdev->tzp->no_hwmon = false;
|
||||
ret = thermal_add_hwmon_sysfs(tzdev);
|
||||
if (ret)
|
||||
dev_err(&pdev->dev,"error in thermal_add_hwmon_sysfs");
|
||||
- //goto err_disable_clk_peri_therm;
|
||||
|
||||
ret = devm_add_action(&pdev->dev, mtk_thermal_hwmon_action, tzdev);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev,"error in devm_add_action");
|
||||
mtk_thermal_hwmon_action(tzdev);
|
||||
- //goto err_disable_clk_peri_therm;
|
||||
}
|
||||
+#endif
|
||||
|
||||
return 0;
|
||||
|
14
root/target/linux/mediatek/patches-5.4/0230-pthread.patch
Normal file
14
root/target/linux/mediatek/patches-5.4/0230-pthread.patch
Normal file
|
@ -0,0 +1,14 @@
|
|||
--- a/scripts/Makefile 2020-03-21 22:28:13.290800484 +0800
|
||||
+++ b/scripts/Makefile 2020-03-21 22:28:26.230870790 +0800
|
||||
@@ -23,8 +23,8 @@ hostprogs-$(CONFIG_SYSTEM_EXTRA_CERTIFIC
|
||||
|
||||
HOSTCFLAGS_sortextable.o = -I$(srctree)/tools/include
|
||||
HOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include
|
||||
-HOSTLDLIBS_sign-file = -lcrypto
|
||||
-HOSTLDLIBS_extract-cert = -lcrypto
|
||||
+HOSTLDLIBS_sign-file = -lcrypto -lpthread
|
||||
+HOSTLDLIBS_extract-cert = -lcrypto -lpthread
|
||||
|
||||
always := $(hostprogs-y) $(hostprogs-m)
|
||||
|
||||
|
49
root/target/linux/mediatek/patches-5.4/0999-lan-to-wan.patch
Normal file
49
root/target/linux/mediatek/patches-5.4/0999-lan-to-wan.patch
Normal file
|
@ -0,0 +1,49 @@
|
|||
--- a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts 2020-04-19 11:02:56.505715879 +0200
|
||||
+++ b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts 2020-04-19 11:03:53.620780390 +0200
|
||||
@@ -196,7 +196,7 @@
|
||||
gmac1: mac@1 {
|
||||
compatible = "mediatek,eth-mac";
|
||||
reg = <1>;
|
||||
- label = "wan";
|
||||
+ label = "lan";
|
||||
phy-mode = "rgmii";
|
||||
phy-handle = <&ephy0>;
|
||||
local-mac-address = [00 0a 35 00 00 02];
|
||||
@@ -221,31 +221,31 @@
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
-/* Disabled, is now handled by gmac1 (eth1/wan) via phy-handle!
|
||||
+/* Disabled, is now handled by gmac1 (eth1/lan) via phy-handle!
|
||||
port@0 {
|
||||
reg = <0>;
|
||||
- label = "wan";
|
||||
+ label = "lan";
|
||||
};
|
||||
*/
|
||||
|
||||
port@1 {
|
||||
reg = <1>;
|
||||
- label = "lan0";
|
||||
+ label = "wan1";
|
||||
};
|
||||
|
||||
port@2 {
|
||||
reg = <2>;
|
||||
- label = "lan1";
|
||||
+ label = "wan2";
|
||||
};
|
||||
|
||||
port@3 {
|
||||
reg = <3>;
|
||||
- label = "lan2";
|
||||
+ label = "wan3";
|
||||
};
|
||||
|
||||
port@4 {
|
||||
reg = <4>;
|
||||
- label = "lan3";
|
||||
+ label = "wan4";
|
||||
};
|
||||
|
||||
port@6 {
|
Loading…
Reference in a new issue