mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-29 13:46:49 +00:00
atf: Fix regulators for Allwinner, again
This time is done with upstream fix, so it should stick.
This commit is contained in:
parent
f9f4dc976a
commit
9fdc091a5e
@ -23,7 +23,7 @@ make_target() {
|
|||||||
if [ "${DEVICE}" = "iMX8" ]; then
|
if [ "${DEVICE}" = "iMX8" ]; then
|
||||||
CROSS_COMPILE="${TARGET_KERNEL_PREFIX}" LDFLAGS="--no-warn-rwx-segments" CFLAGS="--param=min-pagesize=0" make PLAT=${ATF_PLATFORM} bl31
|
CROSS_COMPILE="${TARGET_KERNEL_PREFIX}" LDFLAGS="--no-warn-rwx-segments" CFLAGS="--param=min-pagesize=0" make PLAT=${ATF_PLATFORM} bl31
|
||||||
else
|
else
|
||||||
CROSS_COMPILE="${TARGET_KERNEL_PREFIX}" LDFLAGS="--no-warn-rwx-segments" CFLAGS="" make PLAT=${ATF_PLATFORM} bl31
|
CROSS_COMPILE="${TARGET_KERNEL_PREFIX}" LDFLAGS="--no-warn-rwx-segments" CFLAGS="" make SUNXI_SETUP_REGULATORS=0 PLAT=${ATF_PLATFORM} bl31
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jernej Skrabec <jernej.skrabec@gmail.com>
|
|
||||||
Date: Sat, 8 Oct 2022 10:40:12 +0200
|
|
||||||
Subject: [PATCH] HACK: Allwinner: Don't set up PMIC
|
|
||||||
|
|
||||||
There are two issues:
|
|
||||||
1. Regulators must be bring up in certain order with delays between
|
|
||||||
steps which are not considered here.
|
|
||||||
2. PMIC setup fails on board without PMIC, like Tanix TX6.
|
|
||||||
|
|
||||||
Since LibreELEC doesn't need things that need additional regulators to
|
|
||||||
be set up in U-Boot like networking, disable PMIC completely in order to
|
|
||||||
avoid above issues.
|
|
||||||
|
|
||||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
|
|
||||||
---
|
|
||||||
plat/allwinner/common/sunxi_bl31_setup.c | 2 --
|
|
||||||
1 file changed, 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/plat/allwinner/common/sunxi_bl31_setup.c b/plat/allwinner/common/sunxi_bl31_setup.c
|
|
||||||
index a32124a182a8..34a68dd80e70 100644
|
|
||||||
--- a/plat/allwinner/common/sunxi_bl31_setup.c
|
|
||||||
+++ b/plat/allwinner/common/sunxi_bl31_setup.c
|
|
||||||
@@ -177,8 +177,6 @@ void bl31_platform_setup(void)
|
|
||||||
if (soc_id == SUNXI_SOC_A64 || soc_id == SUNXI_SOC_H5)
|
|
||||||
mmio_write_32(SUNXI_CCU_BASE + 0x5c, 0x1);
|
|
||||||
|
|
||||||
- sunxi_pmic_setup(soc_id, fdt);
|
|
||||||
-
|
|
||||||
INFO("BL31: Platform setup done\n");
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,84 @@
|
|||||||
|
From 49b268ce3036b2645c3a0caeaefb625f7a2d5982 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Andre Przywara <andre.przywara@arm.com>
|
||||||
|
Date: Fri, 3 Feb 2023 11:11:18 +0000
|
||||||
|
Subject: [PATCH] refactor(fdt): introduce common fdt_node_is_enabled()
|
||||||
|
|
||||||
|
There are several users in the tree which want to check whether a given
|
||||||
|
FDT node is enabled or not: the "status" property holds that
|
||||||
|
information. So far all those users provide private implementations,
|
||||||
|
some of them having issues.
|
||||||
|
|
||||||
|
Export a generic implementation of that function in fdt_wrappers.h, as
|
||||||
|
a "static inline" function to not increase code size.
|
||||||
|
Also replace the existing implementation in Arm's fconf code, which had
|
||||||
|
a tiny bug in needlessly using the property length:
|
||||||
|
"status = [6f 6b 61 79 20];" would pass the check, where it should not.
|
||||||
|
The proper solution is also simpler: status must be a string, and
|
||||||
|
strings must be NUL-terminated in a DT. strcmp() would terminate on the
|
||||||
|
first NUL in *either* of the two strings it compares, so it would never
|
||||||
|
walk beyond the property boundary in the DTB.
|
||||||
|
|
||||||
|
Change-Id: I9d89093432f127c09add6cf5c93a725bc534e5de
|
||||||
|
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
|
||||||
|
---
|
||||||
|
include/common/fdt_wrappers.h | 10 ++++++++++
|
||||||
|
plat/arm/common/fconf/fconf_ethosn_getter.c | 15 ---------------
|
||||||
|
2 files changed, 10 insertions(+), 15 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/include/common/fdt_wrappers.h b/include/common/fdt_wrappers.h
|
||||||
|
index 2929fc23d5bb..b16510f3d971 100644
|
||||||
|
--- a/include/common/fdt_wrappers.h
|
||||||
|
+++ b/include/common/fdt_wrappers.h
|
||||||
|
@@ -10,6 +10,7 @@
|
||||||
|
#define FDT_WRAPPERS_H
|
||||||
|
|
||||||
|
#include <libfdt_env.h>
|
||||||
|
+#include <libfdt.h>
|
||||||
|
|
||||||
|
/* Number of cells, given total length in bytes. Each cell is 4 bytes long */
|
||||||
|
#define NCELLS(len) ((len) / 4U)
|
||||||
|
@@ -53,6 +54,15 @@ static inline uint32_t fdt_blob_size(const void *dtb)
|
||||||
|
return fdt32_to_cpu(dtb_header[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
+static inline bool fdt_node_is_enabled(const void *fdt, int node)
|
||||||
|
+{
|
||||||
|
+ int len;
|
||||||
|
+ const void *prop = fdt_getprop(fdt, node, "status", &len);
|
||||||
|
+
|
||||||
|
+ /* A non-existing status property means the device is enabled. */
|
||||||
|
+ return (prop == NULL) || (len == 5 && strcmp(prop, "okay") == 0);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
#define fdt_for_each_compatible_node(dtb, node, compatible_str) \
|
||||||
|
for (node = fdt_node_offset_by_compatible(dtb, -1, compatible_str); \
|
||||||
|
node >= 0; \
|
||||||
|
diff --git a/plat/arm/common/fconf/fconf_ethosn_getter.c b/plat/arm/common/fconf/fconf_ethosn_getter.c
|
||||||
|
index 0b48a9816338..251471e63b6a 100644
|
||||||
|
--- a/plat/arm/common/fconf/fconf_ethosn_getter.c
|
||||||
|
+++ b/plat/arm/common/fconf/fconf_ethosn_getter.c
|
||||||
|
@@ -20,21 +20,6 @@ struct ethosn_sub_allocator_t {
|
||||||
|
uint32_t stream_id;
|
||||||
|
};
|
||||||
|
|
||||||
|
-static bool fdt_node_is_enabled(const void *fdt, int node)
|
||||||
|
-{
|
||||||
|
- int len;
|
||||||
|
- const char *node_status;
|
||||||
|
-
|
||||||
|
- node_status = fdt_getprop(fdt, node, "status", &len);
|
||||||
|
- if (node_status == NULL ||
|
||||||
|
- (len == 5 && /* Includes null character */
|
||||||
|
- strncmp(node_status, "okay", 4U) == 0)) {
|
||||||
|
- return true;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- return false;
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
static bool fdt_node_has_reserved_memory(const void *fdt, int dev_node)
|
||||||
|
{
|
||||||
|
return fdt_get_property(fdt, dev_node, "memory-region", NULL) != NULL;
|
||||||
|
--
|
||||||
|
2.39.1
|
||||||
|
|
@ -0,0 +1,53 @@
|
|||||||
|
From 8168cbaf31c876e20197dd3c5401292e24e8ae80 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Andre Przywara <andre.przywara@arm.com>
|
||||||
|
Date: Wed, 1 Feb 2023 22:28:37 +0000
|
||||||
|
Subject: [PATCH] fix(allwinner): check RSB availability in DT on H6
|
||||||
|
|
||||||
|
At the moment we access the RSB bus on all Allwinner H6 boards
|
||||||
|
unconditionally, even though some boards do not have any PMIC at all,
|
||||||
|
while others have some I2C devices connected to the same pins.
|
||||||
|
The latter case is just fragile, but the first case leads to a hang on
|
||||||
|
at least one board, as reported by Jernej.
|
||||||
|
|
||||||
|
Scan the devicetree, to check for the availability of the RSB bus node.
|
||||||
|
Proceed only if the RSB DT node is actually enabled.
|
||||||
|
|
||||||
|
Change-Id: Iea7dcfe3e085e173334d098ec4ddcb6c4b085771
|
||||||
|
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
|
||||||
|
Reported-by: Jernej Skrabec <jernej.skrabec@gmail.com>
|
||||||
|
---
|
||||||
|
plat/allwinner/sun50i_h6/sunxi_power.c | 9 ++++++++-
|
||||||
|
1 file changed, 8 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/plat/allwinner/sun50i_h6/sunxi_power.c b/plat/allwinner/sun50i_h6/sunxi_power.c
|
||||||
|
index d298e6b8adaf..1257076dfd1b 100644
|
||||||
|
--- a/plat/allwinner/sun50i_h6/sunxi_power.c
|
||||||
|
+++ b/plat/allwinner/sun50i_h6/sunxi_power.c
|
||||||
|
@@ -8,8 +8,10 @@
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <common/debug.h>
|
||||||
|
+#include <common/fdt_wrappers.h>
|
||||||
|
#include <drivers/allwinner/axp.h>
|
||||||
|
#include <drivers/allwinner/sunxi_rsb.h>
|
||||||
|
+#include <libfdt.h>
|
||||||
|
#include <lib/mmio.h>
|
||||||
|
|
||||||
|
#include <sunxi_cpucfg.h>
|
||||||
|
@@ -63,7 +65,12 @@ static int rsb_init(void)
|
||||||
|
|
||||||
|
int sunxi_pmic_setup(uint16_t socid, const void *fdt)
|
||||||
|
{
|
||||||
|
- int ret;
|
||||||
|
+ int node, ret;
|
||||||
|
+
|
||||||
|
+ node = fdt_node_offset_by_compatible(fdt, 0, "allwinner,sun8i-a23-rsb");
|
||||||
|
+ if ((node < 0) || !fdt_node_is_enabled(fdt, node)) {
|
||||||
|
+ return -ENODEV;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
INFO("PMIC: Probing AXP805 on RSB\n");
|
||||||
|
|
||||||
|
--
|
||||||
|
2.39.1
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user