mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/9] fixup! scripts/common: Add write_full() and read_full()
@ 2021-11-08  7:52 Ahmad Fatoum
  2021-11-08  7:52 ` [PATCH 2/9] fixup! scripts: Add rk-usb-loader tool Ahmad Fatoum
                   ` (7 more replies)
  0 siblings, 8 replies; 10+ messages in thread
From: Ahmad Fatoum @ 2021-11-08  7:52 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

These files are already in the same directory as common.h and common.c.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 scripts/rkimage.c         | 4 ++--
 scripts/socfpga_mkimage.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/scripts/rkimage.c b/scripts/rkimage.c
index 7262f320eb1e..6e68d508ac96 100644
--- a/scripts/rkimage.c
+++ b/scripts/rkimage.c
@@ -13,8 +13,8 @@
 #include <errno.h>
 #include <stdbool.h>
 
-#include "../common.h"
-#include "../common.c"
+#include "common.h"
+#include "common.c"
 #include "rockchip.h"
 
 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
diff --git a/scripts/socfpga_mkimage.c b/scripts/socfpga_mkimage.c
index d37ca8585a21..e88e75962f9c 100644
--- a/scripts/socfpga_mkimage.c
+++ b/scripts/socfpga_mkimage.c
@@ -10,8 +10,8 @@
 #include <fcntl.h>
 #include <endian.h>
 
-#include "../common.h"
-#include "../common.c"
+#include "common.h"
+#include "common.c"
 
 #define VALIDATION_WORD 0x31305341
 
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 2/9] fixup! scripts: Add rk-usb-loader tool
  2021-11-08  7:52 [PATCH 1/9] fixup! scripts/common: Add write_full() and read_full() Ahmad Fatoum
@ 2021-11-08  7:52 ` Ahmad Fatoum
  2021-11-08  7:52 ` [PATCH 3/9] ARM: Rockchip: init: propagate error in init function Ahmad Fatoum
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Ahmad Fatoum @ 2021-11-08  7:52 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

This file is already in the same directory as common.h and common.c.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 scripts/rk-usb-loader.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/rk-usb-loader.c b/scripts/rk-usb-loader.c
index c742023c60d9..9c2367ed2891 100644
--- a/scripts/rk-usb-loader.c
+++ b/scripts/rk-usb-loader.c
@@ -27,8 +27,8 @@
 #include <fcntl.h>
 #include <libusb.h>
 
-#include "../common.h"
-#include "../common.c"
+#include "common.h"
+#include "common.c"
 #include "rockchip.h"
 
 static void log_error(char *fmt, ...)
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 3/9] ARM: Rockchip: init: propagate error in init function
  2021-11-08  7:52 [PATCH 1/9] fixup! scripts/common: Add write_full() and read_full() Ahmad Fatoum
  2021-11-08  7:52 ` [PATCH 2/9] fixup! scripts: Add rk-usb-loader tool Ahmad Fatoum
@ 2021-11-08  7:52 ` Ahmad Fatoum
  2021-11-08  7:52 ` [PATCH 4/9] ARM: Rockchip: rk3568: make rk3568_lowlevel_init void Ahmad Fatoum
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Ahmad Fatoum @ 2021-11-08  7:52 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

The SoC init functions return an error code when run on a SoC without
support compiled in. Propagate error codes, so this is reported to the
user.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/mach-rockchip/rockchip.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-rockchip/rockchip.c b/arch/arm/mach-rockchip/rockchip.c
index f0b2484c687b..c185b0cc2b65 100644
--- a/arch/arm/mach-rockchip/rockchip.c
+++ b/arch/arm/mach-rockchip/rockchip.c
@@ -6,14 +6,13 @@
 static int rockchip_init(void)
 {
 	if (of_machine_is_compatible("rockchip,rk3188"))
-		rk3188_init();
-	else if (of_machine_is_compatible("rockchip,rk3288"))
-		rk3288_init();
-	else if (of_machine_is_compatible("rockchip,rk3568"))
-		rk3568_init();
-	else
-		pr_err("Unknown rockchip SoC\n");
+		return rk3188_init();
+	if (of_machine_is_compatible("rockchip,rk3288"))
+		return rk3288_init();
+	if (of_machine_is_compatible("rockchip,rk3568"))
+		return rk3568_init();
 
-	return 0;
+	pr_err("Unknown rockchip SoC\n");
+	return -ENODEV;
 }
 postcore_initcall(rockchip_init);
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 4/9] ARM: Rockchip: rk3568: make rk3568_lowlevel_init void
  2021-11-08  7:52 [PATCH 1/9] fixup! scripts/common: Add write_full() and read_full() Ahmad Fatoum
  2021-11-08  7:52 ` [PATCH 2/9] fixup! scripts: Add rk-usb-loader tool Ahmad Fatoum
  2021-11-08  7:52 ` [PATCH 3/9] ARM: Rockchip: init: propagate error in init function Ahmad Fatoum
@ 2021-11-08  7:52 ` Ahmad Fatoum
  2021-11-08  7:52 ` [PATCH 5/9] ARM64: <asm/barebox-arm-head.h>: mark prologue location Ahmad Fatoum
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Ahmad Fatoum @ 2021-11-08  7:52 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

The lowlevel_init can't fail and there's no sane way to deal with an
error that early anyway, so make return type void.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/mach-rockchip/include/mach/rockchip.h | 2 +-
 arch/arm/mach-rockchip/rk3568.c                | 4 +---
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-rockchip/include/mach/rockchip.h b/arch/arm/mach-rockchip/include/mach/rockchip.h
index 722b73d6f88f..269d113bc39f 100644
--- a/arch/arm/mach-rockchip/include/mach/rockchip.h
+++ b/arch/arm/mach-rockchip/include/mach/rockchip.h
@@ -28,6 +28,6 @@ static inline int rk3568_init(void)
 }
 #endif
 
-int rk3568_lowlevel_init(void);
+void rk3568_lowlevel_init(void);
 
 #endif /* __MACH_ROCKCHIP_H */
diff --git a/arch/arm/mach-rockchip/rk3568.c b/arch/arm/mach-rockchip/rk3568.c
index 4e6d3eef8802..234c6d22d171 100644
--- a/arch/arm/mach-rockchip/rk3568.c
+++ b/arch/arm/mach-rockchip/rk3568.c
@@ -90,7 +90,7 @@ static void qos_priority_init(void)
 	writel(0x303, EBC_PRIORITY_REG);
 }
 
-int rk3568_lowlevel_init(void)
+void rk3568_lowlevel_init(void)
 {
 	/*
 	 * When perform idle operation, corresponding clock can
@@ -135,8 +135,6 @@ int rk3568_lowlevel_init(void)
 	writel(0x01ff01d1, USBPHY_U2_GRF_CON1);
 
 	qos_priority_init();
-
-	return 0;
 }
 
 struct rk_bootsource {
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 5/9] ARM64: <asm/barebox-arm-head.h>: mark prologue location
  2021-11-08  7:52 [PATCH 1/9] fixup! scripts/common: Add write_full() and read_full() Ahmad Fatoum
                   ` (2 preceding siblings ...)
  2021-11-08  7:52 ` [PATCH 4/9] ARM: Rockchip: rk3568: make rk3568_lowlevel_init void Ahmad Fatoum
@ 2021-11-08  7:52 ` Ahmad Fatoum
  2021-11-08  8:14   ` Ahmad Fatoum
  2021-11-08  7:52 ` [PATCH 6/9] pinctrl: Rockchip: abort probe on lack of aliases Ahmad Fatoum
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 10+ messages in thread
From: Ahmad Fatoum @ 2021-11-08  7:52 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Unlike with ARM32, barebox prologue on ARM64 starts with the function
prologue, because of the absence of the naked attribute. The code is
written with that in mind (6 branches instead of 8 to account for the
two instructions inserted by the compiler), but it's still suprising.

Add a hint about that in the code.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/include/asm/barebox-arm-head.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/include/asm/barebox-arm-head.h b/arch/arm/include/asm/barebox-arm-head.h
index 8409a77d2e7c..187d12c9fc8d 100644
--- a/arch/arm/include/asm/barebox-arm-head.h
+++ b/arch/arm/include/asm/barebox-arm-head.h
@@ -44,6 +44,8 @@ static inline void __barebox_arm_head(void)
 		"1: b 1b\n"
 #endif
 #else
+		/* two instruction long function prologue */
+		/* only use if stack is initialized! */
 		"b 2f\n"
 		"nop\n"
 		"nop\n"
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 6/9] pinctrl: Rockchip: abort probe on lack of aliases
  2021-11-08  7:52 [PATCH 1/9] fixup! scripts/common: Add write_full() and read_full() Ahmad Fatoum
                   ` (3 preceding siblings ...)
  2021-11-08  7:52 ` [PATCH 5/9] ARM64: <asm/barebox-arm-head.h>: mark prologue location Ahmad Fatoum
@ 2021-11-08  7:52 ` Ahmad Fatoum
  2021-11-08  7:52 ` [PATCH 7/9] clk: handle CLK_OF_DECLARE in deep probe Ahmad Fatoum
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Ahmad Fatoum @ 2021-11-08  7:52 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

The driver depends on the existence of aliases and will read
out-of-bounds if they are missing for a node. Make failure
graceful by aborting before that happens.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/pinctrl/pinctrl-rockchip.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c
index 4f0951bb289a..1fdb9a913ad3 100644
--- a/drivers/pinctrl/pinctrl-rockchip.c
+++ b/drivers/pinctrl/pinctrl-rockchip.c
@@ -334,6 +334,9 @@ static int rockchip_gpio_probe(struct device_d *dev)
 	int ret, bankno;
 
 	bankno = of_alias_get_id(dev->device_node, "gpio");
+	if (bankno < 0)
+		return bankno;
+
 	bank = &ctrl->pin_banks[bankno];
 	gpio = &bank->bgpio_chip.gc;
 
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 7/9] clk: handle CLK_OF_DECLARE in deep probe
  2021-11-08  7:52 [PATCH 1/9] fixup! scripts/common: Add write_full() and read_full() Ahmad Fatoum
                   ` (4 preceding siblings ...)
  2021-11-08  7:52 ` [PATCH 6/9] pinctrl: Rockchip: abort probe on lack of aliases Ahmad Fatoum
@ 2021-11-08  7:52 ` Ahmad Fatoum
  2021-11-08  7:52 ` [PATCH 8/9] ARM: Rockchip: make rk3568's atf_load_bl31 reusable Ahmad Fatoum
  2021-11-08  7:52 ` [PATCH 9/9] ARM: Rockchip: add delimiter between boards and board features Ahmad Fatoum
  7 siblings, 0 replies; 10+ messages in thread
From: Ahmad Fatoum @ 2021-11-08  7:52 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

An assigned-clock-parents referring to a fixed-clock will result in a
warning:

  WARNING: clk: couldn't get parent clock 0 for /ethernet@fe300000

That's because the device for the fixed clock is created on demand and
even after ensuring probe, no driver will have bound against it as
CLK_OF_DECLARE operates outside the driver model.

Fix this by creating devices and binding the dummy driver while
iterating over the CLK_OF_DECLARE list. No functional change for
systems not enabling deep-probe.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/clk/clk.c     | 8 +++++++-
 drivers/of/platform.c | 5 ++++-
 include/of.h          | 6 ++++++
 3 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index fff1e21144dd..189c9c62df5c 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -845,9 +845,15 @@ int of_clk_init(struct device_node *root, const struct of_device_id *matches)
 
 			struct device_node *np = clk_provider->np;
 			if (force || parent_ready(np)) {
+				struct device_d *dev;
 
 				of_pinctrl_select_state_default(np);
-				clk_provider->clk_init_cb(np);
+
+				dev = of_device_create_on_demand(np);
+
+				if (clk_provider->clk_init_cb(np) == 0 && dev)
+					of_platform_device_dummy_drv(dev);
+
 				of_clk_set_defaults(np, true);
 
 				list_del(&clk_provider->node);
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index ea9b8fd9ce9b..ca9b7d153ae4 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -365,11 +365,14 @@ int of_platform_populate(struct device_node *root,
 }
 EXPORT_SYMBOL_GPL(of_platform_populate);
 
-static struct device_d *of_device_create_on_demand(struct device_node *np)
+struct device_d *of_device_create_on_demand(struct device_node *np)
 {
 	struct device_node *parent;
 	struct device_d *parent_dev, *dev;
 
+	if (!deep_probe_is_supported())
+		return NULL;
+
 	parent = of_get_parent(np);
 	if (!parent)
 		return NULL;
diff --git a/include/of.h b/include/of.h
index f9c2b283de71..a9fa2e095c87 100644
--- a/include/of.h
+++ b/include/of.h
@@ -279,6 +279,7 @@ extern struct device_d *of_device_enable_and_register_by_name(const char *name);
 extern struct device_d *of_device_enable_and_register_by_alias(
 							const char *alias);
 
+extern struct device_d *of_device_create_on_demand(struct device_node *np);
 extern int of_device_ensure_probed(struct device_node *np);
 extern int of_device_ensure_probed_by_alias(const char *alias);
 extern int of_devices_ensure_probed_by_property(const char *property_name);
@@ -372,6 +373,11 @@ static inline void of_platform_device_dummy_drv(struct device_d *dev)
 {
 }
 
+struct device_d *of_device_create_on_demand(struct device_node *np)
+{
+	return NULL;
+}
+
 static inline int of_device_ensure_probed(struct device_node *np)
 {
 	return 0;
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 8/9] ARM: Rockchip: make rk3568's atf_load_bl31 reusable
  2021-11-08  7:52 [PATCH 1/9] fixup! scripts/common: Add write_full() and read_full() Ahmad Fatoum
                   ` (5 preceding siblings ...)
  2021-11-08  7:52 ` [PATCH 7/9] clk: handle CLK_OF_DECLARE in deep probe Ahmad Fatoum
@ 2021-11-08  7:52 ` Ahmad Fatoum
  2021-11-08  7:52 ` [PATCH 9/9] ARM: Rockchip: add delimiter between boards and board features Ahmad Fatoum
  7 siblings, 0 replies; 10+ messages in thread
From: Ahmad Fatoum @ 2021-11-08  7:52 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Future support for rk3399 can use the same function, so move the bulk
into a macro. We can't use a function here, because the function itself
uses macros like IS_ENABLED() and get_builtin_firmware(), which we
would have to call outside of the common code, reducing amount of code
we share.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/mach-rockchip/atf.c | 53 ++++++++++++++++++++----------------
 1 file changed, 29 insertions(+), 24 deletions(-)

diff --git a/arch/arm/mach-rockchip/atf.c b/arch/arm/mach-rockchip/atf.c
index 3c4c9d1c8ae6..de22784489b5 100644
--- a/arch/arm/mach-rockchip/atf.c
+++ b/arch/arm/mach-rockchip/atf.c
@@ -33,30 +33,35 @@ static unsigned long load_elf64_image_phdr(const void *elf)
 	return ehdr->e_entry;
 }
 
-void rk3568_atf_load_bl31(void *fdt)
-{
-	const void *bl31_elf, *optee;
-	unsigned long bl31;
-	size_t bl31_elf_size, optee_size;
-	uintptr_t optee_load_address = 0;
-
-	get_builtin_firmware(rk3568_bl31_bin, &bl31_elf, &bl31_elf_size);
-
-	bl31 = load_elf64_image_phdr(bl31_elf);
-
-	if (IS_ENABLED(CONFIG_ARCH_RK3568_OPTEE)) {
-		optee_load_address = RK3568_OPTEE_LOAD_ADDRESS;
+#define rockchip_atf_load_bl31(SOC, atf_bin, tee_bin, fdt) do {                 \
+	const void *bl31_elf, *optee;                                           \
+	unsigned long bl31;                                                     \
+	size_t bl31_elf_size, optee_size;                                       \
+	uintptr_t optee_load_address = 0;                                       \
+										\
+	get_builtin_firmware(atf_bin, &bl31_elf, &bl31_elf_size);               \
+										\
+	bl31 = load_elf64_image_phdr(bl31_elf);                                 \
+										\
+	if (IS_ENABLED(CONFIG_ARCH_##SOC##_OPTEE)) {                            \
+		optee_load_address = SOC##_OPTEE_LOAD_ADDRESS;                  \
+										\
+		get_builtin_firmware(tee_bin, &optee, &optee_size);             \
+										\
+		memcpy((void *)optee_load_address, optee, optee_size);          \
+	}                                                                       \
+										\
+	/* Setup an initial stack for EL2 */                                    \
+	asm volatile("msr sp_el2, %0" : :                                       \
+			"r" (SOC##_BAREBOX_LOAD_ADDRESS - 16) :                 \
+			"cc");                                                  \
+										\
+	bl31_entry(bl31, optee_load_address,                                    \
+		   SOC##_BAREBOX_LOAD_ADDRESS, (uintptr_t)fdt);                 \
+} while (0)                                                                     \
 
-		get_builtin_firmware(rk3568_op_tee_bin, &optee, &optee_size);
 
-		memcpy((void *)optee_load_address, optee, optee_size);
-	}
-
-	/* Setup an initial stack for EL2 */
-	asm volatile("msr sp_el2, %0" : :
-			"r" (RK3568_BAREBOX_LOAD_ADDRESS - 16) :
-			"cc");
-
-	bl31_entry(bl31, optee_load_address,
-		   RK3568_BAREBOX_LOAD_ADDRESS, (uintptr_t)fdt);
+void rk3568_atf_load_bl31(void *fdt)
+{
+	rockchip_atf_load_bl31(RK3568, rk3568_bl31_bin, rk3568_op_tee_bin, fdt);
 }
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 9/9] ARM: Rockchip: add delimiter between boards and board features
  2021-11-08  7:52 [PATCH 1/9] fixup! scripts/common: Add write_full() and read_full() Ahmad Fatoum
                   ` (6 preceding siblings ...)
  2021-11-08  7:52 ` [PATCH 8/9] ARM: Rockchip: make rk3568's atf_load_bl31 reusable Ahmad Fatoum
@ 2021-11-08  7:52 ` Ahmad Fatoum
  7 siblings, 0 replies; 10+ messages in thread
From: Ahmad Fatoum @ 2021-11-08  7:52 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

The CONFIG_ARCH_RK3568_OPTEE is directly after the boards, has a very
generic name and is selectable without CONFIG_ARCH_RK3568. Fix these.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/mach-rockchip/Kconfig | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index b2376c18d034..1ad7ccedf649 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -50,8 +50,11 @@ config MACH_RK3568_EVB
 	help
 	  Say Y here if you are using a RK3568 EVB
 
+comment "select board features:"
+
 config ARCH_RK3568_OPTEE
-	bool "Build OP-TEE binary into barebox"
+	bool "Build rk3568 OP-TEE binary into barebox"
+	depends on ARCH_RK3568
 	help
 	  With this option enabled the RK3568 OP-TEE binary is compiled
 	  into barebox and started along with the BL31 trusted firmware.
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 5/9] ARM64: <asm/barebox-arm-head.h>: mark prologue location
  2021-11-08  7:52 ` [PATCH 5/9] ARM64: <asm/barebox-arm-head.h>: mark prologue location Ahmad Fatoum
@ 2021-11-08  8:14   ` Ahmad Fatoum
  0 siblings, 0 replies; 10+ messages in thread
From: Ahmad Fatoum @ 2021-11-08  8:14 UTC (permalink / raw)
  To: barebox, Sascha Hauer

Hello Sascha,

On 08.11.21 08:52, Ahmad Fatoum wrote:
> Unlike with ARM32, barebox prologue on ARM64 starts with the function
> prologue, because of the absence of the naked attribute. The code is
> written with that in mind (6 branches instead of 8 to account for the
> two instructions inserted by the compiler), but it's still suprising.
> 
> Add a hint about that in the code.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  arch/arm/include/asm/barebox-arm-head.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/arm/include/asm/barebox-arm-head.h b/arch/arm/include/asm/barebox-arm-head.h
> index 8409a77d2e7c..187d12c9fc8d 100644
> --- a/arch/arm/include/asm/barebox-arm-head.h
> +++ b/arch/arm/include/asm/barebox-arm-head.h
> @@ -44,6 +44,8 @@ static inline void __barebox_arm_head(void)
>  		"1: b 1b\n"
>  #endif
>  #else
> +		/* two instruction long function prologue */
> +		/* only use if stack is initialized! */

On the rk3399, the sp points into INTMEM0. When I added a new user to
load_elf64_image_phdr, the function become out-of-line and thus return
from that function broke. Does the rk3568 MaskROM initialize the stack
pointer differently? I want to avoid breaking it when I send out the
remaining rk3399 patches.

>  		"b 2f\n"
>  		"nop\n"
>  		"nop\n"
> 


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-11-08  8:15 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-08  7:52 [PATCH 1/9] fixup! scripts/common: Add write_full() and read_full() Ahmad Fatoum
2021-11-08  7:52 ` [PATCH 2/9] fixup! scripts: Add rk-usb-loader tool Ahmad Fatoum
2021-11-08  7:52 ` [PATCH 3/9] ARM: Rockchip: init: propagate error in init function Ahmad Fatoum
2021-11-08  7:52 ` [PATCH 4/9] ARM: Rockchip: rk3568: make rk3568_lowlevel_init void Ahmad Fatoum
2021-11-08  7:52 ` [PATCH 5/9] ARM64: <asm/barebox-arm-head.h>: mark prologue location Ahmad Fatoum
2021-11-08  8:14   ` Ahmad Fatoum
2021-11-08  7:52 ` [PATCH 6/9] pinctrl: Rockchip: abort probe on lack of aliases Ahmad Fatoum
2021-11-08  7:52 ` [PATCH 7/9] clk: handle CLK_OF_DECLARE in deep probe Ahmad Fatoum
2021-11-08  7:52 ` [PATCH 8/9] ARM: Rockchip: make rk3568's atf_load_bl31 reusable Ahmad Fatoum
2021-11-08  7:52 ` [PATCH 9/9] ARM: Rockchip: add delimiter between boards and board features Ahmad Fatoum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox