mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH master v2 0/3] ARM: rpi3: fix misc recent breakage
@ 2022-04-25  6:25 Ahmad Fatoum
  2022-04-25  6:25 ` [PATCH master v2 1/3] ARM: asm: fix miscompilation of 32-bit ENTRY_FUNCTION_WITHSTACK Ahmad Fatoum
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2022-04-25  6:25 UTC (permalink / raw)
  To: barebox; +Cc: ore

barebox v2022.04.0 on the Raspberry Pi 3b is malformated, silent on the
mini UART and slow. Fix the root causes behind these issues.

This series is a bit bigger than what normally goes direct into master,
but I'd prefer it's applied directly to master, so we have the proper
fixes in v2022.05.0.

v1 -> v2:
  - remove duplicated __ARM_SETUP_STACK

Ahmad Fatoum (3):
  ARM: asm: fix miscompilation of 32-bit ENTRY_FUNCTION_WITHSTACK
  clk: add BCM2835 auxiliary peripheral clock driver
  clocksource: assign non-zero priorities to all clocksources

 arch/arm/include/asm/barebox-arm.h          | 10 +++-
 arch/arm/mach-at91/at91rm9200_time.c        |  1 +
 arch/arm/mach-davinci/time.c                |  1 +
 arch/arm/mach-ep93xx/clocksource.c          |  1 +
 arch/arm/mach-mxs/clocksource-imx23.c       |  1 +
 arch/arm/mach-mxs/clocksource-imx28.c       |  1 +
 arch/arm/mach-pxa/clocksource.c             |  1 +
 arch/arm/mach-samsung/s3c-timer.c           |  1 +
 arch/arm/mach-tegra/tegra20-timer.c         |  1 +
 arch/arm/mach-versatile/core.c              |  1 +
 arch/mips/lib/csrc-r4k.c                    |  1 +
 arch/mips/mach-xburst/csrc-jz4750.c         |  1 +
 arch/openrisc/lib/clock.c                   |  1 +
 arch/powerpc/mach-mpc5xxx/time.c            |  1 +
 arch/powerpc/mach-mpc85xx/time.c            |  1 +
 arch/sandbox/board/clock.c                  |  1 +
 drivers/clk/Makefile                        |  1 +
 drivers/clk/bcm/Makefile                    |  2 +
 drivers/clk/bcm/clk-bcm2835-aux.c           | 66 +++++++++++++++++++++
 drivers/clocksource/amba-sp804.c            |  1 +
 drivers/clocksource/arm_architected_timer.c |  1 +
 drivers/clocksource/arm_global_timer.c      |  1 +
 drivers/clocksource/arm_smp_twd.c           |  1 +
 drivers/clocksource/armv7m_systick.c        |  1 +
 drivers/clocksource/bcm2835.c               |  1 +
 drivers/clocksource/clps711x.c              |  1 +
 drivers/clocksource/digic.c                 |  1 +
 drivers/clocksource/dw_apb_timer.c          |  1 +
 drivers/clocksource/efi.c                   |  1 +
 drivers/clocksource/kvx_timer.c             |  1 +
 drivers/clocksource/mvebu.c                 |  1 +
 drivers/clocksource/nomadik.c               |  1 +
 drivers/clocksource/orion.c                 |  1 +
 drivers/clocksource/rk_timer.c              |  1 +
 drivers/clocksource/timer-atmel-pit.c       |  1 +
 drivers/clocksource/timer-imx-gpt.c         |  1 +
 drivers/clocksource/timer-ti-32k.c          |  1 +
 drivers/clocksource/timer-ti-dm.c           |  1 +
 drivers/clocksource/uemd.c                  |  1 +
 39 files changed, 112 insertions(+), 2 deletions(-)
 create mode 100644 drivers/clk/bcm/Makefile
 create mode 100644 drivers/clk/bcm/clk-bcm2835-aux.c

-- 
2.30.2


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


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

* [PATCH master v2 1/3] ARM: asm: fix miscompilation of 32-bit ENTRY_FUNCTION_WITHSTACK
  2022-04-25  6:25 [PATCH master v2 0/3] ARM: rpi3: fix misc recent breakage Ahmad Fatoum
@ 2022-04-25  6:25 ` Ahmad Fatoum
  2022-04-25  8:16   ` Ahmad Fatoum
  2022-04-25  6:25 ` [PATCH master v2 2/3] clk: add BCM2835 auxiliary peripheral clock driver Ahmad Fatoum
  2022-04-25  6:25 ` [PATCH master v2 3/3] clocksource: assign non-zero priorities to all clocksources Ahmad Fatoum
  2 siblings, 1 reply; 5+ messages in thread
From: Ahmad Fatoum @ 2022-04-25  6:25 UTC (permalink / raw)
  To: barebox; +Cc: ore, Ahmad Fatoum

gcc-11.1.1 shipped with OSELAS.Toolchain-2021.07.0 hoists a single
instruction from __ARM_SETUP_STACK in front of __barebox_arm_head
breaking the barebox header format for the Raspberry Pi 3. This can't
happen with ARM64 and the Raspberry Pi entry points are currently the
only 32-bit users.

While the resulting barebox image was still bootable, header detection
would fail. Add an intermediate naked function to work around this.

This is not required for plain ENTRY_FUNCTION, because the
board-supplied entry point is already NAKED. For
ENTRY_FUNCTION_WITH_FUNCTION, that same entry point is intentionally
non-naked to reduce pitfalls for board code authors..

Fixes: 880c9803b95a ("ARM: implement ENTRY_FUNCTION_WITHSTACK")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/include/asm/barebox-arm.h | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/arm/include/asm/barebox-arm.h b/arch/arm/include/asm/barebox-arm.h
index d915cde294a4..8b0c00633277 100644
--- a/arch/arm/include/asm/barebox-arm.h
+++ b/arch/arm/include/asm/barebox-arm.h
@@ -194,15 +194,21 @@ static inline unsigned long arm_mem_barebox_image(unsigned long membase,
 	void name(ulong r0, ulong r1, ulong r2);			\
 									\
 	static void __##name(ulong, ulong, ulong);			\
+	static void ____##name(ulong, ulong, ulong);			\
 									\
 	void NAKED __section(.text_head_entry_##name)	name		\
 				(ulong r0, ulong r1, ulong r2)		\
 		{							\
 			__barebox_arm_head();				\
-			__ARM_SETUP_STACK(stack_top);			\
 			__##name(r0, r1, r2);				\
 		}							\
-		static void noinline __##name				\
+		static void NAKED noinline __##name			\
+			(ulong r0, ulong r1, ulong r2)			\
+		{							\
+			__ARM_SETUP_STACK(stack_top);			\
+			____##name(r0, r1, r2);				\
+		}							\
+		static void noinline ____##name				\
 			(ulong arg0, ulong arg1, ulong arg2)
 
 
-- 
2.30.2


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


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

* [PATCH master v2 2/3] clk: add BCM2835 auxiliary peripheral clock driver
  2022-04-25  6:25 [PATCH master v2 0/3] ARM: rpi3: fix misc recent breakage Ahmad Fatoum
  2022-04-25  6:25 ` [PATCH master v2 1/3] ARM: asm: fix miscompilation of 32-bit ENTRY_FUNCTION_WITHSTACK Ahmad Fatoum
@ 2022-04-25  6:25 ` Ahmad Fatoum
  2022-04-25  6:25 ` [PATCH master v2 3/3] clocksource: assign non-zero priorities to all clocksources Ahmad Fatoum
  2 siblings, 0 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2022-04-25  6:25 UTC (permalink / raw)
  To: barebox; +Cc: ore, Ahmad Fatoum

Commit f6ce1103fdc4 ("ARM: rpi: move clk support to a separate driver")
replaced board code setting up clocks with clkdev_add_physbase() with a
proper cprman driver that registers fixed clocks and can be referenced
from device tree.

It was not fully equivalent though, because the mini UART's clock was no
longer registered as that is provided by a different clock controller.

Import the Linux v5.17 bcm2835-aux-clk driver to fix console usage on
Raspberry Pi 3b.

Fixes: f6ce1103fdc4 ("ARM: rpi: move clk support to a separate driver")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/clk/Makefile              |  1 +
 drivers/clk/bcm/Makefile          |  2 +
 drivers/clk/bcm/clk-bcm2835-aux.c | 66 +++++++++++++++++++++++++++++++
 3 files changed, 69 insertions(+)
 create mode 100644 drivers/clk/bcm/Makefile
 create mode 100644 drivers/clk/bcm/clk-bcm2835-aux.c

diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile
index ee503c1edb5f..baf452de9873 100644
--- a/drivers/clk/Makefile
+++ b/drivers/clk/Makefile
@@ -26,4 +26,5 @@ obj-$(CONFIG_CLK_SIFIVE)	+= sifive/
 obj-$(CONFIG_SOC_STARFIVE)	+= starfive/
 obj-$(CONFIG_COMMON_CLK_STM32F)		+= clk-stm32f4.o
 obj-$(CONFIG_MACH_RPI_COMMON)	+= clk-rpi.o
+obj-y				+= bcm/
 obj-$(CONFIG_COMMON_CLK_SCMI)	+= clk-scmi.o
diff --git a/drivers/clk/bcm/Makefile b/drivers/clk/bcm/Makefile
new file mode 100644
index 000000000000..1539e9f592a8
--- /dev/null
+++ b/drivers/clk/bcm/Makefile
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
+obj-$(CONFIG_ARCH_BCM283X)	+= clk-bcm2835-aux.o
diff --git a/drivers/clk/bcm/clk-bcm2835-aux.c b/drivers/clk/bcm/clk-bcm2835-aux.c
new file mode 100644
index 000000000000..385cfd5d3f06
--- /dev/null
+++ b/drivers/clk/bcm/clk-bcm2835-aux.c
@@ -0,0 +1,66 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2015 Broadcom
+ */
+
+#include <linux/clk.h>
+#include <io.h>
+#include <of_address.h>
+#include <driver.h>
+#include <init.h>
+#include <dt-bindings/clock/bcm2835-aux.h>
+
+#define BCM2835_AUXIRQ		0x00
+#define BCM2835_AUXENB		0x04
+
+static int bcm2835_aux_clk_probe(struct device_d *dev)
+{
+	struct clk_hw_onecell_data *onecell;
+	const char *parent;
+	struct clk *parent_clk;
+	void __iomem *reg, *gate;
+
+	parent_clk = clk_get(dev, NULL);
+	if (IS_ERR(parent_clk))
+		return PTR_ERR(parent_clk);
+	parent = __clk_get_name(parent_clk);
+
+	reg = of_iomap(dev->device_node, 0);
+	if (!reg)
+		return -ENOMEM;
+
+	onecell = kmalloc(struct_size(onecell, hws, BCM2835_AUX_CLOCK_COUNT),
+			  GFP_KERNEL);
+	if (!onecell)
+		return -ENOMEM;
+	onecell->num = BCM2835_AUX_CLOCK_COUNT;
+
+	gate = reg + BCM2835_AUXENB;
+	onecell->hws[BCM2835_AUX_CLOCK_UART] =
+		clk_hw_register_gate(dev, "aux_uart", parent, 0, gate, 0, 0, NULL);
+
+	onecell->hws[BCM2835_AUX_CLOCK_SPI1] =
+		clk_hw_register_gate(dev, "aux_spi1", parent, 0, gate, 1, 0, NULL);
+
+	onecell->hws[BCM2835_AUX_CLOCK_SPI2] =
+		clk_hw_register_gate(dev, "aux_spi2", parent, 0, gate, 2, 0, NULL);
+
+	return of_clk_add_hw_provider(dev->device_node, of_clk_hw_onecell_get,
+				      onecell);
+}
+
+static const struct of_device_id bcm2835_aux_clk_of_match[] = {
+	{ .compatible = "brcm,bcm2835-aux", },
+	{},
+};
+
+static struct driver_d bcm2835_aux_clk_driver = {
+	.name = "bcm2835-aux-clk",
+	.of_compatible = bcm2835_aux_clk_of_match,
+	.probe          = bcm2835_aux_clk_probe,
+};
+core_platform_driver(bcm2835_aux_clk_driver);
+
+MODULE_AUTHOR("Eric Anholt <eric@anholt.net>");
+MODULE_DESCRIPTION("BCM2835 auxiliary peripheral clock driver");
+MODULE_LICENSE("GPL");
-- 
2.30.2


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


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

* [PATCH master v2 3/3] clocksource: assign non-zero priorities to all clocksources
  2022-04-25  6:25 [PATCH master v2 0/3] ARM: rpi3: fix misc recent breakage Ahmad Fatoum
  2022-04-25  6:25 ` [PATCH master v2 1/3] ARM: asm: fix miscompilation of 32-bit ENTRY_FUNCTION_WITHSTACK Ahmad Fatoum
  2022-04-25  6:25 ` [PATCH master v2 2/3] clk: add BCM2835 auxiliary peripheral clock driver Ahmad Fatoum
@ 2022-04-25  6:25 ` Ahmad Fatoum
  2 siblings, 0 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2022-04-25  6:25 UTC (permalink / raw)
  To: barebox; +Cc: ore, Ahmad Fatoum

Most barebox clocksources have a zero priority and if multiple of them
exist, but no higher priority ones, the first to call init_clock wins.

Some supported boards like the Raspberry Pi additionally depended on
initcall ordering to favor one zero-priority clocksource over another.
With the move to deep probe and with Commit b641580deb8c ("of: platform:
Ensure timers are probed early"), device tree blob iteration order could
now dictate which clocksource is ultimately used. This led to a 20 times
slower clock source being chosen on the Raspberry Pi, because the ARM
architected timer was taken instead of the bcm2835 timer.

Fix the root cause by assigning priorities to all clocksource drivers.
Priorities chosen are:

  50: device_initcall
  60: coredevice_initcall
  70: postcore_initcall
  80: core_initcall

These priorities are all below 100, which was previously the lowest
positive priority and as they are positive, they win against the dummy
clocksource. This should ensure no priority inversion happens.

Fixes: b641580deb8c ("of: platform: Ensure timers are probed early")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/mach-at91/at91rm9200_time.c        | 1 +
 arch/arm/mach-davinci/time.c                | 1 +
 arch/arm/mach-ep93xx/clocksource.c          | 1 +
 arch/arm/mach-mxs/clocksource-imx23.c       | 1 +
 arch/arm/mach-mxs/clocksource-imx28.c       | 1 +
 arch/arm/mach-pxa/clocksource.c             | 1 +
 arch/arm/mach-samsung/s3c-timer.c           | 1 +
 arch/arm/mach-tegra/tegra20-timer.c         | 1 +
 arch/arm/mach-versatile/core.c              | 1 +
 arch/mips/lib/csrc-r4k.c                    | 1 +
 arch/mips/mach-xburst/csrc-jz4750.c         | 1 +
 arch/openrisc/lib/clock.c                   | 1 +
 arch/powerpc/mach-mpc5xxx/time.c            | 1 +
 arch/powerpc/mach-mpc85xx/time.c            | 1 +
 arch/sandbox/board/clock.c                  | 1 +
 drivers/clocksource/amba-sp804.c            | 1 +
 drivers/clocksource/arm_architected_timer.c | 1 +
 drivers/clocksource/arm_global_timer.c      | 1 +
 drivers/clocksource/arm_smp_twd.c           | 1 +
 drivers/clocksource/armv7m_systick.c        | 1 +
 drivers/clocksource/bcm2835.c               | 1 +
 drivers/clocksource/clps711x.c              | 1 +
 drivers/clocksource/digic.c                 | 1 +
 drivers/clocksource/dw_apb_timer.c          | 1 +
 drivers/clocksource/efi.c                   | 1 +
 drivers/clocksource/kvx_timer.c             | 1 +
 drivers/clocksource/mvebu.c                 | 1 +
 drivers/clocksource/nomadik.c               | 1 +
 drivers/clocksource/orion.c                 | 1 +
 drivers/clocksource/rk_timer.c              | 1 +
 drivers/clocksource/timer-atmel-pit.c       | 1 +
 drivers/clocksource/timer-imx-gpt.c         | 1 +
 drivers/clocksource/timer-ti-32k.c          | 1 +
 drivers/clocksource/timer-ti-dm.c           | 1 +
 drivers/clocksource/uemd.c                  | 1 +
 35 files changed, 35 insertions(+)

diff --git a/arch/arm/mach-at91/at91rm9200_time.c b/arch/arm/mach-at91/at91rm9200_time.c
index ccbefbbc33a2..110d77088169 100644
--- a/arch/arm/mach-at91/at91rm9200_time.c
+++ b/arch/arm/mach-at91/at91rm9200_time.c
@@ -35,6 +35,7 @@ static struct clocksource cs = {
 	.mask	= CLOCKSOURCE_MASK(20),
 	.read	= at91rm9200_clocksource_read,
 	.shift	= 10,
+	.priority = 80,
 };
 
 static int clocksource_init (void)
diff --git a/arch/arm/mach-davinci/time.c b/arch/arm/mach-davinci/time.c
index 52b3ac3e6823..c54e49470b72 100644
--- a/arch/arm/mach-davinci/time.c
+++ b/arch/arm/mach-davinci/time.c
@@ -96,6 +96,7 @@ static uint64_t davinci_cs_read(void)
 static struct clocksource davinci_cs = {
 	.read	= davinci_cs_read,
 	.mask	= CLOCKSOURCE_MASK(32),
+	.priority = 80,
 };
 
 static int timer32_config(struct timer_s *t)
diff --git a/arch/arm/mach-ep93xx/clocksource.c b/arch/arm/mach-ep93xx/clocksource.c
index 1f3ff7f8f20a..e2a3a397803f 100644
--- a/arch/arm/mach-ep93xx/clocksource.c
+++ b/arch/arm/mach-ep93xx/clocksource.c
@@ -37,6 +37,7 @@ static struct clocksource cs = {
 	.read	= ep93xx_clocksource_read,
 	.mask	= CLOCKSOURCE_MASK(32),
 	.shift	= 10,
+	.priority = 80,
 };
 
 static int clocksource_init(void)
diff --git a/arch/arm/mach-mxs/clocksource-imx23.c b/arch/arm/mach-mxs/clocksource-imx23.c
index 0a6716f87958..ba5aad9f30dc 100644
--- a/arch/arm/mach-mxs/clocksource-imx23.c
+++ b/arch/arm/mach-mxs/clocksource-imx23.c
@@ -34,6 +34,7 @@ static struct clocksource cs = {
 	.read	= imx23_clocksource_read,
 	.mask	= CLOCKSOURCE_MASK(16),
 	.shift	= 10,
+	.priority = 80,
 };
 
 static int imx23_clocksource_clock_change(struct notifier_block *nb, unsigned long event, void *data)
diff --git a/arch/arm/mach-mxs/clocksource-imx28.c b/arch/arm/mach-mxs/clocksource-imx28.c
index ea6d4b514630..65d8155ad244 100644
--- a/arch/arm/mach-mxs/clocksource-imx28.c
+++ b/arch/arm/mach-mxs/clocksource-imx28.c
@@ -39,6 +39,7 @@ static struct clocksource imx28_cs = {
 	.read	= imx28_clocksource_read,
 	.mask	= CLOCKSOURCE_MASK(32),
 	.shift	= 17,
+	.priority = 80,
 };
 
 static int imx28_clocksource_init(void)
diff --git a/arch/arm/mach-pxa/clocksource.c b/arch/arm/mach-pxa/clocksource.c
index ebfe6f1c330f..3bc95827d88d 100644
--- a/arch/arm/mach-pxa/clocksource.c
+++ b/arch/arm/mach-pxa/clocksource.c
@@ -28,6 +28,7 @@ static struct clocksource cs = {
 	.read	= pxa_clocksource_read,
 	.mask	= 0xffffffff,
 	.shift	= 20,
+	.priority = 80,
 };
 
 static int clocksource_init(void)
diff --git a/arch/arm/mach-samsung/s3c-timer.c b/arch/arm/mach-samsung/s3c-timer.c
index 6f38df395851..38bcebc7c4cb 100644
--- a/arch/arm/mach-samsung/s3c-timer.c
+++ b/arch/arm/mach-samsung/s3c-timer.c
@@ -101,6 +101,7 @@ static struct clocksource cs = {
 	.read = s3c_clocksource_read,
 	.mask = CLOCKSOURCE_MASK(TIMER_WIDTH),
 	.shift = TIMER_SHIFT,
+	.priority = 80,
 };
 
 static int s3c_clk_src_init(void)
diff --git a/arch/arm/mach-tegra/tegra20-timer.c b/arch/arm/mach-tegra/tegra20-timer.c
index 34d34f772331..8ca8cb24fad5 100644
--- a/arch/arm/mach-tegra/tegra20-timer.c
+++ b/arch/arm/mach-tegra/tegra20-timer.c
@@ -41,6 +41,7 @@ static uint64_t tegra20_timer_cs_read(void)
 static struct clocksource cs = {
 	.read	= tegra20_timer_cs_read,
 	.mask	= CLOCKSOURCE_MASK(32),
+	.priority = 80,
 };
 
 static int tegra20_timer_probe(struct device_d *dev)
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index eb94a07dc907..9a2a9cad80cc 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -92,6 +92,7 @@ static struct clocksource vpb_cs = {
 	.read = vpb_clocksource_read,
 	.mask = CLOCKSOURCE_MASK(32),
 	.shift = 10,
+	.priority = 80,
 };
 
 /* From Linux v2.6.35
diff --git a/arch/mips/lib/csrc-r4k.c b/arch/mips/lib/csrc-r4k.c
index 9facf04bd3e9..35fba3a29ca6 100644
--- a/arch/mips/lib/csrc-r4k.c
+++ b/arch/mips/lib/csrc-r4k.c
@@ -23,6 +23,7 @@ static uint64_t c0_hpt_read(void)
 static struct clocksource cs = {
 	.read	= c0_hpt_read,
 	.mask	= CLOCKSOURCE_MASK(32),
+	.priority = 70,
 };
 
 static int clocksource_init(void)
diff --git a/arch/mips/mach-xburst/csrc-jz4750.c b/arch/mips/mach-xburst/csrc-jz4750.c
index 302709e59747..43135ac4987e 100644
--- a/arch/mips/mach-xburst/csrc-jz4750.c
+++ b/arch/mips/mach-xburst/csrc-jz4750.c
@@ -23,6 +23,7 @@ static uint64_t jz4750_cs_read(void)
 static struct clocksource jz4750_cs = {
 	.read	= jz4750_cs_read,
 	.mask   = CLOCKSOURCE_MASK(32),
+	.priority = 80,
 };
 
 static int clocksource_init(void)
diff --git a/arch/openrisc/lib/clock.c b/arch/openrisc/lib/clock.c
index 5ff978e8411a..651b163f13cb 100644
--- a/arch/openrisc/lib/clock.c
+++ b/arch/openrisc/lib/clock.c
@@ -28,6 +28,7 @@ static struct clocksource cs = {
 	.read	= openrisc_clocksource_read,
 	.mask	= 0xffffffff,
 	.shift	= 12,
+	.priority = 80,
 };
 
 static int clocksource_init(void)
diff --git a/arch/powerpc/mach-mpc5xxx/time.c b/arch/powerpc/mach-mpc5xxx/time.c
index 8981b14eeb7d..d690d50f0d5a 100644
--- a/arch/powerpc/mach-mpc5xxx/time.c
+++ b/arch/powerpc/mach-mpc5xxx/time.c
@@ -29,6 +29,7 @@ static struct clocksource cs = {
 	.read	= ppc_clocksource_read,
 	.mask	= CLOCKSOURCE_MASK(32),
 	.shift	= 15,
+	.priority = 80,
 };
 
 static int clocksource_init(void)
diff --git a/arch/powerpc/mach-mpc85xx/time.c b/arch/powerpc/mach-mpc85xx/time.c
index 067bce8ea64e..5981995ac2ae 100644
--- a/arch/powerpc/mach-mpc85xx/time.c
+++ b/arch/powerpc/mach-mpc85xx/time.c
@@ -28,6 +28,7 @@ static uint64_t ppc_clocksource_read(void)
 static struct clocksource cs = {
 	.read	= ppc_clocksource_read,
 	.mask	= CLOCKSOURCE_MASK(64),
+	.priority = 80,
 };
 
 static int clocksource_init(void)
diff --git a/arch/sandbox/board/clock.c b/arch/sandbox/board/clock.c
index b005e71633ff..1787fb578626 100644
--- a/arch/sandbox/board/clock.c
+++ b/arch/sandbox/board/clock.c
@@ -28,6 +28,7 @@ static struct clocksource cs = {
 	.read	= linux_clocksource_read,
 	.mask	= CLOCKSOURCE_MASK(32),
 	.shift	= 10,
+	.priority = 80,
 };
 
 static int clocksource_init (void)
diff --git a/drivers/clocksource/amba-sp804.c b/drivers/clocksource/amba-sp804.c
index a22e567301b2..fcb2b0254bc3 100644
--- a/drivers/clocksource/amba-sp804.c
+++ b/drivers/clocksource/amba-sp804.c
@@ -26,6 +26,7 @@ static struct clocksource sp804_clksrc = {
 	.read	= sp804_read,
 	.shift	= 20,
 	.mask	= CLOCKSOURCE_MASK(32),
+	.priority = 60,
 };
 
 static int sp804_probe(struct amba_device *dev, const struct amba_id *id)
diff --git a/drivers/clocksource/arm_architected_timer.c b/drivers/clocksource/arm_architected_timer.c
index 16e40a1a0b3b..d5948fe9482c 100644
--- a/drivers/clocksource/arm_architected_timer.c
+++ b/drivers/clocksource/arm_architected_timer.c
@@ -19,6 +19,7 @@ static struct clocksource cs = {
 	.read	= arm_arch_clocksource_read,
 	.mask	= CLOCKSOURCE_MASK(64),
 	.shift	= 0,
+	.priority = 70,
 };
 
 static int arm_arch_timer_probe(struct device_d *dev)
diff --git a/drivers/clocksource/arm_global_timer.c b/drivers/clocksource/arm_global_timer.c
index f18c6e4152f9..65bfca355855 100644
--- a/drivers/clocksource/arm_global_timer.c
+++ b/drivers/clocksource/arm_global_timer.c
@@ -60,6 +60,7 @@ static struct clocksource cs = {
 	.read	= arm_global_clocksource_read,
 	.mask	= CLOCKSOURCE_MASK(64),
 	.shift	= 0,
+	.priority = 70,
 };
 
 static int arm_global_timer_probe(struct device_d *dev)
diff --git a/drivers/clocksource/arm_smp_twd.c b/drivers/clocksource/arm_smp_twd.c
index bc0c4a00b2f9..1ad754bb2b7a 100644
--- a/drivers/clocksource/arm_smp_twd.c
+++ b/drivers/clocksource/arm_smp_twd.c
@@ -35,6 +35,7 @@ static struct clocksource smp_twd_clksrc = {
 	.read	= smp_twd_read,
 	.shift	= 20,
 	.mask	= CLOCKSOURCE_MASK(32),
+	.priority = 60,
 };
 
 #define SMP_TWD_MAX_FREQ (25 *1000 * 1000)
diff --git a/drivers/clocksource/armv7m_systick.c b/drivers/clocksource/armv7m_systick.c
index 5f9222c50b8a..16d89c23bde5 100644
--- a/drivers/clocksource/armv7m_systick.c
+++ b/drivers/clocksource/armv7m_systick.c
@@ -34,6 +34,7 @@ static struct clocksource cs = {
 	.read	= armv7m_systick_clocksource_read,
 	.mask	= CLOCKSOURCE_MASK(24),
 	.shift	= 0,
+	.priority = 70,
 };
 
 static int armv7m_systick_probe(struct device_d *dev)
diff --git a/drivers/clocksource/bcm2835.c b/drivers/clocksource/bcm2835.c
index 5134b349157c..d84341fc4083 100644
--- a/drivers/clocksource/bcm2835.c
+++ b/drivers/clocksource/bcm2835.c
@@ -28,6 +28,7 @@ static uint64_t stc_read_cycles(void)
 static struct clocksource bcm2835_stc = {
 	.read = stc_read_cycles,
 	.mask = CLOCKSOURCE_MASK(32),
+	.priority = 80,
 };
 
 static int bcm2835_cs_probe(struct device_d *dev)
diff --git a/drivers/clocksource/clps711x.c b/drivers/clocksource/clps711x.c
index cd099604786e..1fe7f6c89114 100644
--- a/drivers/clocksource/clps711x.c
+++ b/drivers/clocksource/clps711x.c
@@ -19,6 +19,7 @@ static uint64_t clps711x_cs_read(void)
 static struct clocksource clps711x_cs = {
 	.read = clps711x_cs_read,
 	.mask = CLOCKSOURCE_MASK(16),
+	.priority = 60,
 };
 
 static int clps711x_cs_probe(struct device_d *dev)
diff --git a/drivers/clocksource/digic.c b/drivers/clocksource/digic.c
index 1a335582b733..234985aece44 100644
--- a/drivers/clocksource/digic.c
+++ b/drivers/clocksource/digic.c
@@ -26,6 +26,7 @@ static uint64_t digic_cs_read(void)
 static struct clocksource digic_cs = {
 	.read	= digic_cs_read,
 	.mask   = CLOCKSOURCE_MASK(16),
+	.priority = 60,
 };
 
 static int digic_timer_probe(struct device_d *dev)
diff --git a/drivers/clocksource/dw_apb_timer.c b/drivers/clocksource/dw_apb_timer.c
index aef4f16d1494..251089cf7e16 100644
--- a/drivers/clocksource/dw_apb_timer.c
+++ b/drivers/clocksource/dw_apb_timer.c
@@ -94,6 +94,7 @@ static struct clocksource dw_apb_clksrc = {
 	.read  = dw_apb_clocksource_read,
 	.mask  = CLOCKSOURCE_MASK(32),
 	.shift = 0,
+	.priority = 50,
 };
 
 static int dw_apb_timer_probe(struct device_d *dev)
diff --git a/drivers/clocksource/efi.c b/drivers/clocksource/efi.c
index 5c8c5fd46b1e..9df5226573bc 100644
--- a/drivers/clocksource/efi.c
+++ b/drivers/clocksource/efi.c
@@ -93,6 +93,7 @@ static struct clocksource efi_cs = {
 	.mask   = CLOCKSOURCE_MASK(64),
 	.shift  = 0,
 	.init   = efi_cs_init,
+	.priority = 80,
 };
 
 static int efi_cs_probe(struct device_d *dev)
diff --git a/drivers/clocksource/kvx_timer.c b/drivers/clocksource/kvx_timer.c
index 2a05d8deedce..259755eacdda 100644
--- a/drivers/clocksource/kvx_timer.c
+++ b/drivers/clocksource/kvx_timer.c
@@ -21,6 +21,7 @@ static struct clocksource kvx_clksrc = {
 	.read	= kvx_pm_read,
 	.mask	= CLOCKSOURCE_MASK(64),
 	.shift	= 0,
+	.priority = 70,
 };
 
 static int kvx_timer_probe(struct device_d *dev)
diff --git a/drivers/clocksource/mvebu.c b/drivers/clocksource/mvebu.c
index eb5246e4e79b..d3214955dc8f 100644
--- a/drivers/clocksource/mvebu.c
+++ b/drivers/clocksource/mvebu.c
@@ -42,6 +42,7 @@ static struct clocksource cs = {
 	.read	= mvebu_clocksource_read,
 	.mask	= CLOCKSOURCE_MASK(32),
 	.shift	= 10,
+	.priority = 70,
 };
 
 static int mvebu_timer_probe(struct device_d *dev)
diff --git a/drivers/clocksource/nomadik.c b/drivers/clocksource/nomadik.c
index d71d9da6b8c0..7cf10352eac7 100644
--- a/drivers/clocksource/nomadik.c
+++ b/drivers/clocksource/nomadik.c
@@ -71,6 +71,7 @@ static struct clocksource nmdk_clksrc = {
 	.read	= nmdk_read_timer,
 	.shift	= 20,
 	.mask	= CLOCKSOURCE_MASK(32),
+	.priority = 60,
 };
 
 static void nmdk_timer_reset(void)
diff --git a/drivers/clocksource/orion.c b/drivers/clocksource/orion.c
index d40b09e5debc..4a5684980064 100644
--- a/drivers/clocksource/orion.c
+++ b/drivers/clocksource/orion.c
@@ -31,6 +31,7 @@ static struct clocksource clksrc = {
 	.read	= orion_clocksource_read,
 	.mask	= CLOCKSOURCE_MASK(32),
 	.shift	= 10,
+	.priority = 70,
 };
 
 static int orion_timer_probe(struct device_d *dev)
diff --git a/drivers/clocksource/rk_timer.c b/drivers/clocksource/rk_timer.c
index 5cc8d32b601b..e94103077103 100644
--- a/drivers/clocksource/rk_timer.c
+++ b/drivers/clocksource/rk_timer.c
@@ -32,6 +32,7 @@ static struct clocksource rkcs = {
 	.read   = rockchip_get_ticks,
 	.mask   = CLOCKSOURCE_MASK(32),
 	.shift  = 10,
+	.priority = 80,
 };
 
 static int rockchip_timer_probe(struct device_d *dev)
diff --git a/drivers/clocksource/timer-atmel-pit.c b/drivers/clocksource/timer-atmel-pit.c
index bbbc81788ce4..a133e384d74c 100644
--- a/drivers/clocksource/timer-atmel-pit.c
+++ b/drivers/clocksource/timer-atmel-pit.c
@@ -36,6 +36,7 @@ static struct clocksource cs = {
 	.read	= at91sam9_clocksource_read,
 	.mask	= CLOCKSOURCE_MASK(32),
 	.shift	= 10,
+	.priority = 70,
 };
 
 static void at91_pit_stop(void)
diff --git a/drivers/clocksource/timer-imx-gpt.c b/drivers/clocksource/timer-imx-gpt.c
index 28f90d967d3f..7ca879f4f008 100644
--- a/drivers/clocksource/timer-imx-gpt.c
+++ b/drivers/clocksource/timer-imx-gpt.c
@@ -64,6 +64,7 @@ static struct clocksource cs = {
 	.read	= imx_clocksource_read,
 	.mask	= CLOCKSOURCE_MASK(32),
 	.shift	= 10,
+	.priority = 70,
 };
 
 static int imx_clocksource_clock_change(struct notifier_block *nb, unsigned long event, void *data)
diff --git a/drivers/clocksource/timer-ti-32k.c b/drivers/clocksource/timer-ti-32k.c
index 1f3f15561e09..21cb68636954 100644
--- a/drivers/clocksource/timer-ti-32k.c
+++ b/drivers/clocksource/timer-ti-32k.c
@@ -47,6 +47,7 @@ static struct clocksource s32k_cs = {
 	.read = s32k_clocksource_read,
 	.mask	= CLOCKSOURCE_MASK(32),
 	.shift = 10,
+	.priority = 70,
 };
 
 /**
diff --git a/drivers/clocksource/timer-ti-dm.c b/drivers/clocksource/timer-ti-dm.c
index d43609ad1967..cdd297f10c91 100644
--- a/drivers/clocksource/timer-ti-dm.c
+++ b/drivers/clocksource/timer-ti-dm.c
@@ -62,6 +62,7 @@ static struct clocksource dmtimer_cs = {
 	.read	= dmtimer_read,
 	.mask	= CLOCKSOURCE_MASK(32),
 	.shift	= 10,
+	.priority = 70,
 };
 
 static int omap_dmtimer_probe(struct device_d *dev)
diff --git a/drivers/clocksource/uemd.c b/drivers/clocksource/uemd.c
index 342260c5644b..a763eadc0c86 100644
--- a/drivers/clocksource/uemd.c
+++ b/drivers/clocksource/uemd.c
@@ -52,6 +52,7 @@ static uint64_t uemd_timer_cs_read(void)
 static struct clocksource uemd_cs = {
 	.read = uemd_timer_cs_read,
 	.mask = CLOCKSOURCE_MASK(32),
+	.priority = 60,
 };
 
 static int uemd_timer_probe(struct device_d *dev)
-- 
2.30.2


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


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

* Re: [PATCH master v2 1/3] ARM: asm: fix miscompilation of 32-bit ENTRY_FUNCTION_WITHSTACK
  2022-04-25  6:25 ` [PATCH master v2 1/3] ARM: asm: fix miscompilation of 32-bit ENTRY_FUNCTION_WITHSTACK Ahmad Fatoum
@ 2022-04-25  8:16   ` Ahmad Fatoum
  0 siblings, 0 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2022-04-25  8:16 UTC (permalink / raw)
  To: barebox; +Cc: ore

On 25.04.22 08:25, Ahmad Fatoum wrote:
> gcc-11.1.1 shipped with OSELAS.Toolchain-2021.07.0 hoists a single
> instruction from __ARM_SETUP_STACK in front of __barebox_arm_head
> breaking the barebox header format for the Raspberry Pi 3. This can't
> happen with ARM64 and the Raspberry Pi entry points are currently the
> only 32-bit users.
> 
> While the resulting barebox image was still bootable, header detection
> would fail. Add an intermediate naked function to work around this.
> 
> This is not required for plain ENTRY_FUNCTION, because the
> board-supplied entry point is already NAKED. For
> ENTRY_FUNCTION_WITH_FUNCTION, that same entry point is intentionally
> non-naked to reduce pitfalls for board code authors..
> 
> Fixes: 880c9803b95a ("ARM: implement ENTRY_FUNCTION_WITHSTACK")
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  arch/arm/include/asm/barebox-arm.h | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/include/asm/barebox-arm.h b/arch/arm/include/asm/barebox-arm.h
> index d915cde294a4..8b0c00633277 100644
> --- a/arch/arm/include/asm/barebox-arm.h
> +++ b/arch/arm/include/asm/barebox-arm.h
> @@ -194,15 +194,21 @@ static inline unsigned long arm_mem_barebox_image(unsigned long membase,
>  	void name(ulong r0, ulong r1, ulong r2);			\
>  									\
>  	static void __##name(ulong, ulong, ulong);			\
> +	static void ____##name(ulong, ulong, ulong);			\
>  									\
>  	void NAKED __section(.text_head_entry_##name)	name		\
>  				(ulong r0, ulong r1, ulong r2)		\
>  		{							\
>  			__barebox_arm_head();				\
> -			__ARM_SETUP_STACK(stack_top);			\
>  			__##name(r0, r1, r2);				\
>  		}							\
> -		static void noinline __##name				\
> +		static void NAKED noinline __##name			\
> +			(ulong r0, ulong r1, ulong r2)			\
> +		{							\
> +			__ARM_SETUP_STACK(stack_top);			\
> +			____##name(r0, r1, r2);				\
> +		}							\
> +		static void noinline ____##name				\

I see now I could just make it call ENTRY_FUNCTION on arm32 with stack setup
and leave it unchanged for ARM64. Will do so for v3.

>  			(ulong arg0, ulong arg1, ulong arg2)
>  
>  


-- 
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] 5+ messages in thread

end of thread, other threads:[~2022-04-25  8:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-25  6:25 [PATCH master v2 0/3] ARM: rpi3: fix misc recent breakage Ahmad Fatoum
2022-04-25  6:25 ` [PATCH master v2 1/3] ARM: asm: fix miscompilation of 32-bit ENTRY_FUNCTION_WITHSTACK Ahmad Fatoum
2022-04-25  8:16   ` Ahmad Fatoum
2022-04-25  6:25 ` [PATCH master v2 2/3] clk: add BCM2835 auxiliary peripheral clock driver Ahmad Fatoum
2022-04-25  6:25 ` [PATCH master v2 3/3] clocksource: assign non-zero priorities to all clocksources Ahmad Fatoum

mail archive of the barebox mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://lore.barebox.org/barebox/0 barebox/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 barebox barebox/ https://lore.barebox.org/barebox \
		barebox@lists.infradead.org barebox@lists.infradead.org
	public-inbox-index barebox

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git