diff --git a/patch/atf/atf-spacemit/006-v1.0.7.patch b/patch/atf/atf-spacemit/006-v1.0.7.patch new file mode 100644 index 000000000..0555feb82 --- /dev/null +++ b/patch/atf/atf-spacemit/006-v1.0.7.patch @@ -0,0 +1,94 @@ +From 94bf83cc0bd1c86e51f48174fa17e23427903c59 Mon Sep 17 00:00:00 2001 +From: James Deng +Date: Thu, 11 Jul 2024 14:56:36 +0800 +Subject: [PATCH] Update for v1.0.7 + +--- + debian/opensbi-spacemit.postinst | 24 ++++++++++++++----- + .../spacemit/plat/k1x/underly_implement.c | 13 ---------- + 2 files changed, 18 insertions(+), 19 deletions(-) + +diff --git a/debian/opensbi-spacemit.postinst b/debian/opensbi-spacemit.postinst +index 9ce082e..dce7154 100755 +--- a/debian/opensbi-spacemit.postinst ++++ b/debian/opensbi-spacemit.postinst +@@ -4,9 +4,11 @@ set -e + case "$1" in + configure) + target="" +- if grep -q '^spacemit' /sys/firmware/devicetree/base/model; then ++ if grep -q '^spacemit' /sys/firmware/devicetree/base/model || grep -q '^spacemit' /sys/devices/soc0/family; then + target="spacemit" + else ++ echo "Neither /sys/firmware/devicetree/base/model nor /sys/devices/soc0/family starts with 'spacemit'." ++ echo "This may indicate that you are installing this package in a chroot environment." + exit 0 + fi + +@@ -35,17 +37,27 @@ configure) + ;; + *) + echo "Unsupported root=$ROOT" +- exit 0 ++ exit 1 + ;; + esac + else + echo "Missing root= in cmdline" +- exit 0 ++ exit 1 + fi + +- if [ -n "$target" ] && [ -e $OPENSBI ]; then +- dd if=/usr/lib/riscv64-linux-gnu/opensbi/generic/fw_dynamic.itb of=$OPENSBI seek=$OPENSBI_SEEK bs=1K && sync +- fi ++ # 待检查文件/分区列表 ++ files="/usr/lib/riscv64-linux-gnu/opensbi/generic/fw_dynamic.itb $OPENSBI" ++ for file in $files; do ++ if [ ! -e "$file" ]; then ++ # 任意不存在则退出 ++ echo "Missing $file" ++ exit 1 ++ fi ++ done ++ ++ # 此前已经做了所有检查 ++ dd if=/usr/lib/riscv64-linux-gnu/opensbi/generic/fw_dynamic.itb of=$OPENSBI seek=$OPENSBI_SEEK bs=1K && sync ++ + ;; + esac + +diff --git a/lib/utils/psci/spacemit/plat/k1x/underly_implement.c b/lib/utils/psci/spacemit/plat/k1x/underly_implement.c +index 654da2d..94d53bf 100644 +--- a/lib/utils/psci/spacemit/plat/k1x/underly_implement.c ++++ b/lib/utils/psci/spacemit/plat/k1x/underly_implement.c +@@ -44,12 +44,6 @@ void spacemit_top_on(u_register_t mpidr) + (1 << CLUSTER_BIT25_OFFSET) | + (1 << CLUSTER_BIT13_OFFSET)); + writel(value, cluster1_acpr); +- +- /* enable the gpio edge detected function again +- * */ +- value = readl((unsigned int *)0xd4051000); +- value &= ~(1 << 21); +- writel(value, (unsigned int *)0xd4051000); + } + + /* D1P & D2 ? */ +@@ -91,13 +85,6 @@ void spacemit_top_off(u_register_t mpidr) + value |= (1 << 2) | (1 << 0); + writel(value, (unsigned int *)PMU_ACPR_UNKONW_REG); + +- /* disable the gpio edge detect function +- * this may cause the system cann't enter D2 +- * */ +- value = readl((unsigned int *)0xd4051000); +- value |= (1 << 21); +- writel(value, (unsigned int *)0xd4051000); +- + /* enable the refbuf function which will enhance the + * driving capability of the internal 26M to PLL path + * */ +-- +2.39.2 +