From 75a1d7280a72d587d54b6af653234a96210f7177 Mon Sep 17 00:00:00 2001 From: Kuan-Wei Chiu Date: Sat, 16 May 2026 16:39:56 +0900 Subject: timer: goldfish: Use __raw_readl() The Goldfish timer registers are native endian, so they act as big-endian on the m68k virt machine. Currently, this driver uses readl(), which works by luck because it's currently broken on m68k. Use __raw_readl() instead to avoid breaking this driver when the endianness of readl() is fixed. Signed-off-by: Kuan-Wei Chiu Tested-by: Daniel Palmer Reviewed-by: Simon Glass Signed-off-by: Daniel Palmer --- drivers/timer/goldfish_timer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/timer') diff --git a/drivers/timer/goldfish_timer.c b/drivers/timer/goldfish_timer.c index 70673bbd93c..91277d7932a 100644 --- a/drivers/timer/goldfish_timer.c +++ b/drivers/timer/goldfish_timer.c @@ -31,8 +31,8 @@ static u64 goldfish_timer_get_count(struct udevice *dev) * We must read LOW before HIGH to latch the high 32-bit value * and ensure a consistent 64-bit timestamp. */ - low = readl(priv->base + TIMER_TIME_LOW); - high = readl(priv->base + TIMER_TIME_HIGH); + low = __raw_readl(priv->base + TIMER_TIME_LOW); + high = __raw_readl(priv->base + TIMER_TIME_HIGH); time = ((u64)high << 32) | low; -- cgit v1.3.1 From 9c04852e59699a1653bffad40044eb87387950a5 Mon Sep 17 00:00:00 2001 From: Francois Berder Date: Tue, 19 May 2026 11:41:54 +0200 Subject: timer: sp804: Fix dev_read_addr error check dev_read_addr returns FDT_ADDR_T_NONE (-1) in case of error and not 0. Signed-off-by: Francois Berder --- drivers/timer/sp804_timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/timer') diff --git a/drivers/timer/sp804_timer.c b/drivers/timer/sp804_timer.c index 05532e3330c..d1a5fc8c5bf 100644 --- a/drivers/timer/sp804_timer.c +++ b/drivers/timer/sp804_timer.c @@ -44,7 +44,7 @@ static int sp804_clk_of_to_plat(struct udevice *dev) struct sp804_timer_plat *plat = dev_get_plat(dev); plat->base = dev_read_addr(dev); - if (!plat->base) + if (plat->base == FDT_ADDR_T_NONE) return -ENOENT; return 0; -- cgit v1.3.1 From eab66c3a9085e07b227847b0c442ee8d2efb241d Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Tue, 26 May 2026 15:53:06 +0800 Subject: timer: orion: Use dev_remap_addr_index() Use dev_remap_addr_index() which supports both live device tree and flat DT backends, avoiding direct dependency on devfdt_* helpers. No functional changes. Signed-off-by: Peng Fan --- drivers/timer/orion-timer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/timer') diff --git a/drivers/timer/orion-timer.c b/drivers/timer/orion-timer.c index 821b681a232..4d1c6b5cef2 100644 --- a/drivers/timer/orion-timer.c +++ b/drivers/timer/orion-timer.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include #include @@ -113,7 +114,7 @@ static int orion_timer_probe(struct udevice *dev) enum input_clock_type type = dev_get_driver_data(dev); struct orion_timer_priv *priv = dev_get_priv(dev); - priv->base = devfdt_remap_addr_index(dev, 0); + priv->base = dev_remap_addr_index(dev, 0); if (!priv->base) { debug("unable to map registers\n"); return -ENOMEM; -- cgit v1.3.1 From 2bc9c58e7f09e5c5383ad63f85f35b686d63c0bf Mon Sep 17 00:00:00 2001 From: Kuan-Wei Chiu Date: Mon, 8 Jun 2026 15:47:48 +0000 Subject: timer: goldfish: Return error when device address is invalid goldfish_timer_of_to_plat() currently returns success even when dev_read_addr() fails to find a valid address. This leaves plat->reg unset and defers the failure to probe(). Return -EINVAL immediately when the address is FDT_ADDR_T_NONE so the failure is reported at the of_to_plat stage where it belongs. This aligns the driver with the recent fix introduced in the goldfish serial driver by Naveen Kumar Chaudhary. [1] Link: https://lore.kernel.org/u-boot/vgwnt6mnls3lf3zdm6mz5siztzkvppte4ykszbvifjzukvmksf@maaxe5agqpim/ [1] Signed-off-by: Kuan-Wei Chiu --- drivers/timer/goldfish_timer.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers/timer') diff --git a/drivers/timer/goldfish_timer.c b/drivers/timer/goldfish_timer.c index 91277d7932a..59ce43fcb46 100644 --- a/drivers/timer/goldfish_timer.c +++ b/drivers/timer/goldfish_timer.c @@ -45,8 +45,10 @@ static int goldfish_timer_of_to_plat(struct udevice *dev) fdt_addr_t addr; addr = dev_read_addr(dev); - if (addr != FDT_ADDR_T_NONE) - plat->reg = addr; + if (addr == FDT_ADDR_T_NONE) + return -EINVAL; + + plat->reg = addr; return 0; } -- cgit v1.3.1