armbian-build/patch/atf/atf-spacemit/005-v1.0.3.patch
Patrick Yavitz 3440691a51 SpacemiT: Add ATF patches (OpenSBI)
Tag: 1.3
Source: https://gitee.com/bianbu-linux/opensbi
Signed-off-by: Patrick Yavitz <pyavitz@armbian.com>
2024-07-01 19:15:00 +02:00

87 lines
2.8 KiB
Diff

From 6f1344573d4ce0638d24d960e9a7d5ff1b0426b6 Mon Sep 17 00:00:00 2001
From: James Deng <james.deng@spacemit.com>
Date: Wed, 19 Jun 2024 15:18:09 +0800
Subject: [PATCH] Update for v1.0.3
---
.../spacemit/plat/k1x/underly_implement.c | 24 ++++++++++++++++++-
.../generic/include/spacemit/k1x/k1x_evb.h | 4 ++--
2 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/lib/utils/psci/spacemit/plat/k1x/underly_implement.c b/lib/utils/psci/spacemit/plat/k1x/underly_implement.c
index 73feec4..654da2d 100644
--- a/lib/utils/psci/spacemit/plat/k1x/underly_implement.c
+++ b/lib/utils/psci/spacemit/plat/k1x/underly_implement.c
@@ -44,6 +44,12 @@ 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 ? */
@@ -60,6 +66,7 @@ void spacemit_top_off(u_register_t mpidr)
(1 << CLUSTER_DDRSD_OFFSET) |
(1 << CLUSTER_APBSD_OFFSET) |
(1 << CLUSTER_VCXOSD_OFFSET) |
+ (1 << 3) |
(1 << CLUSTER_BIT29_OFFSET) |
(1 << CLUSTER_BIT14_OFFSET) |
(1 << CLUSTER_BIT30_OFFSET) |
@@ -72,6 +79,7 @@ void spacemit_top_off(u_register_t mpidr)
(1 << CLUSTER_DDRSD_OFFSET) |
(1 << CLUSTER_APBSD_OFFSET) |
(1 << CLUSTER_VCXOSD_OFFSET) |
+ (1 << 3) |
(1 << CLUSTER_BIT29_OFFSET) |
(1 << CLUSTER_BIT14_OFFSET) |
(1 << CLUSTER_BIT30_OFFSET) |
@@ -80,9 +88,23 @@ void spacemit_top_off(u_register_t mpidr)
writel(value, cluster1_acpr);
value = readl((unsigned int *)PMU_ACPR_UNKONW_REG);
- value |= (1 << 2);
+ 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
+ * */
+ value = readl((unsigned int *)0xd4090104);
+ value |= (1 << 22);
+ writel(value, (unsigned int *)0xd4090104);
+
/* for wakeup debug */
writel(0xffff, (unsigned int *)0xd4051030);
}
diff --git a/platform/generic/include/spacemit/k1x/k1x_evb.h b/platform/generic/include/spacemit/k1x/k1x_evb.h
index 5f5b672..10e8569 100644
--- a/platform/generic/include/spacemit/k1x/k1x_evb.h
+++ b/platform/generic/include/spacemit/k1x/k1x_evb.h
@@ -49,8 +49,8 @@
#define PMU_ACPR_UNKONW_REG (0xd4050038)
-#define CPU_PWR_DOWN_VALUE (0x3)
-#define CLUSTER_PWR_DOWN_VALUE (0x3)
+#define CPU_PWR_DOWN_VALUE (0x1b)
+#define CLUSTER_PWR_DOWN_VALUE (0x7)
#define CLUSTER_AXISDO_OFFSET (31)
#define CLUSTER_DDRSD_OFFSET (27)
#define CLUSTER_APBSD_OFFSET (26)
--
2.39.2