]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
rtc: goldfish: Use __raw_readl() and __raw_writel()
authorKuan-Wei Chiu <visitorckw@gmail.com>
Sat, 16 May 2026 07:39:55 +0000 (16:39 +0900)
committerTom Rini <trini@konsulko.com>
Fri, 22 May 2026 22:47:54 +0000 (16:47 -0600)
In QEMU, the Goldfish RTC is explicitly instantiated as a big-endian
device on the m68k virt machine (via the 'big-endian=true' property).
Currently, this driver uses ioread32() and iowrite32(), which works
by luck because the underlying readl() and writel() are currently
broken on m68k.

Use __raw_readl() and __raw_writel() instead to avoid breaking this
driver when the endianness of readl() and writel() is fixed.

Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
Tested-by: Daniel Palmer <daniel@thingy.jp>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Daniel Palmer <daniel@thingy.jp>
drivers/rtc/goldfish_rtc.c

index d2991ca67192faf30c0d601c8172157212a5c06c..4892a63f8d80d05e41ec9c34a6307a749c05102e 100644 (file)
@@ -40,8 +40,8 @@ static int goldfish_rtc_get(struct udevice *dev, struct rtc_time *time)
        u64 time_low;
        u64 now;
 
-       time_low = ioread32(base + GOLDFISH_TIME_LOW);
-       time_high = ioread32(base + GOLDFISH_TIME_HIGH);
+       time_low = __raw_readl(base + GOLDFISH_TIME_LOW);
+       time_high = __raw_readl(base + GOLDFISH_TIME_HIGH);
        now = (time_high << 32) | time_low;
 
        do_div(now, 1000000000U);
@@ -62,8 +62,8 @@ static int goldfish_rtc_set(struct udevice *dev, const struct rtc_time *time)
                return -EINVAL;
 
        now = rtc_mktime(time) * 1000000000ULL;
-       iowrite32(now >> 32, base + GOLDFISH_TIME_HIGH);
-       iowrite32(now, base + GOLDFISH_TIME_LOW);
+       __raw_writel(now >> 32, base + GOLDFISH_TIME_HIGH);
+       __raw_writel(now, base + GOLDFISH_TIME_LOW);
 
        if (time->tm_isdst > 0)
                priv->isdst = 1;