From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Laurent Vivier <laurent@vivier.eu>
Cc: linux-kernel@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
linux-rtc@vger.kernel.org, Jiaxun Yang <jiaxun.yang@flygoat.com>,
Stephen Boyd <sboyd@kernel.org>,
John Stultz <john.stultz@linaro.org>,
Alessandro Zummo <a.zummo@towertech.it>,
Geert Uytterhoeven <geert@linux-m68k.org>,
linux-m68k@lists.linux-m68k.org,
Daniel Lezcano <daniel.lezcano@linaro.org>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH v14 3/5] rtc: goldfish: use gf_ioread32()/gf_iowrite32()
Date: Fri, 11 Feb 2022 17:56:50 +0100 [thread overview]
Message-ID: <YgaVUtn6PpXYAewP@piout.net> (raw)
In-Reply-To: <20220130143333.552646-4-laurent@vivier.eu>
On 30/01/2022 15:33:31+0100, Laurent Vivier wrote:
> replace readl()/writel() by gf_ioread32()/gf_iowrite32()
> as done for goldfish-tty.
>
> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> ---
> drivers/rtc/rtc-goldfish.c | 31 ++++++++++++++++---------------
> 1 file changed, 16 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/rtc/rtc-goldfish.c b/drivers/rtc/rtc-goldfish.c
> index 7ab95d052644..eb1929b0cbb6 100644
> --- a/drivers/rtc/rtc-goldfish.c
> +++ b/drivers/rtc/rtc-goldfish.c
> @@ -10,6 +10,7 @@
> #include <linux/of.h>
> #include <linux/platform_device.h>
> #include <linux/rtc.h>
> +#include <linux/goldfish.h>
>
> #define TIMER_TIME_LOW 0x00 /* get low bits of current time */
> /* and update TIMER_TIME_HIGH */
> @@ -41,8 +42,8 @@ static int goldfish_rtc_read_alarm(struct device *dev,
> rtcdrv = dev_get_drvdata(dev);
> base = rtcdrv->base;
>
> - rtc_alarm_low = readl(base + TIMER_ALARM_LOW);
> - rtc_alarm_high = readl(base + TIMER_ALARM_HIGH);
> + rtc_alarm_low = gf_ioread32(base + TIMER_ALARM_LOW);
> + rtc_alarm_high = gf_ioread32(base + TIMER_ALARM_HIGH);
> rtc_alarm = (rtc_alarm_high << 32) | rtc_alarm_low;
>
> do_div(rtc_alarm, NSEC_PER_SEC);
> @@ -50,7 +51,7 @@ static int goldfish_rtc_read_alarm(struct device *dev,
>
> rtc_time64_to_tm(rtc_alarm, &alrm->time);
>
> - if (readl(base + TIMER_ALARM_STATUS))
> + if (gf_ioread32(base + TIMER_ALARM_STATUS))
> alrm->enabled = 1;
> else
> alrm->enabled = 0;
> @@ -71,18 +72,18 @@ static int goldfish_rtc_set_alarm(struct device *dev,
>
> if (alrm->enabled) {
> rtc_alarm64 = rtc_tm_to_time64(&alrm->time) * NSEC_PER_SEC;
> - writel((rtc_alarm64 >> 32), base + TIMER_ALARM_HIGH);
> - writel(rtc_alarm64, base + TIMER_ALARM_LOW);
> - writel(1, base + TIMER_IRQ_ENABLED);
> + gf_iowrite32((rtc_alarm64 >> 32), base + TIMER_ALARM_HIGH);
> + gf_iowrite32(rtc_alarm64, base + TIMER_ALARM_LOW);
> + gf_iowrite32(1, base + TIMER_IRQ_ENABLED);
> } else {
> /*
> * if this function was called with enabled=0
> * then it could mean that the application is
> * trying to cancel an ongoing alarm
> */
> - rtc_status_reg = readl(base + TIMER_ALARM_STATUS);
> + rtc_status_reg = gf_ioread32(base + TIMER_ALARM_STATUS);
> if (rtc_status_reg)
> - writel(1, base + TIMER_CLEAR_ALARM);
> + gf_iowrite32(1, base + TIMER_CLEAR_ALARM);
> }
>
> return 0;
> @@ -98,9 +99,9 @@ static int goldfish_rtc_alarm_irq_enable(struct device *dev,
> base = rtcdrv->base;
>
> if (enabled)
> - writel(1, base + TIMER_IRQ_ENABLED);
> + gf_iowrite32(1, base + TIMER_IRQ_ENABLED);
> else
> - writel(0, base + TIMER_IRQ_ENABLED);
> + gf_iowrite32(0, base + TIMER_IRQ_ENABLED);
>
> return 0;
> }
> @@ -110,7 +111,7 @@ static irqreturn_t goldfish_rtc_interrupt(int irq, void *dev_id)
> struct goldfish_rtc *rtcdrv = dev_id;
> void __iomem *base = rtcdrv->base;
>
> - writel(1, base + TIMER_CLEAR_INTERRUPT);
> + gf_iowrite32(1, base + TIMER_CLEAR_INTERRUPT);
>
> rtc_update_irq(rtcdrv->rtc, 1, RTC_IRQF | RTC_AF);
>
> @@ -128,8 +129,8 @@ static int goldfish_rtc_read_time(struct device *dev, struct rtc_time *tm)
> rtcdrv = dev_get_drvdata(dev);
> base = rtcdrv->base;
>
> - time_low = readl(base + TIMER_TIME_LOW);
> - time_high = readl(base + TIMER_TIME_HIGH);
> + time_low = gf_ioread32(base + TIMER_TIME_LOW);
> + time_high = gf_ioread32(base + TIMER_TIME_HIGH);
> time = (time_high << 32) | time_low;
>
> do_div(time, NSEC_PER_SEC);
> @@ -149,8 +150,8 @@ static int goldfish_rtc_set_time(struct device *dev, struct rtc_time *tm)
> base = rtcdrv->base;
>
> now64 = rtc_tm_to_time64(tm) * NSEC_PER_SEC;
> - writel((now64 >> 32), base + TIMER_TIME_HIGH);
> - writel(now64, base + TIMER_TIME_LOW);
> + gf_iowrite32((now64 >> 32), base + TIMER_TIME_HIGH);
> + gf_iowrite32(now64, base + TIMER_TIME_LOW);
>
> return 0;
> }
> --
> 2.34.1
>
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2022-02-11 16:56 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-30 14:33 [PATCH v14 0/5] m68k: Add Virtual M68k Machine Laurent Vivier
2022-01-30 14:33 ` [PATCH v14 1/5] m68k: add asm/config.h Laurent Vivier
2022-01-30 14:33 ` [PATCH v14 2/5] tty: goldfish: introduce gf_ioread32()/gf_iowrite32() Laurent Vivier
2022-02-10 13:07 ` Geert Uytterhoeven
2022-01-30 14:33 ` [PATCH v14 3/5] rtc: goldfish: use gf_ioread32()/gf_iowrite32() Laurent Vivier
2022-02-10 13:11 ` Geert Uytterhoeven
2022-02-11 16:56 ` Alexandre Belloni [this message]
2022-01-30 14:33 ` [PATCH v14 4/5] clocksource/drivers: Add a goldfish-timer clocksource Laurent Vivier
2022-02-11 8:37 ` John Paul Adrian Glaubitz
2022-02-16 14:31 ` Laurent Vivier
2022-02-28 10:27 ` Daniel Lezcano
2022-03-10 8:15 ` John Paul Adrian Glaubitz
2022-01-30 14:33 ` [PATCH v14 5/5] m68k: introduce a virtual m68k machine Laurent Vivier
2022-02-10 13:18 ` Geert Uytterhoeven
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YgaVUtn6PpXYAewP@piout.net \
--to=alexandre.belloni@bootlin.com \
--cc=a.zummo@towertech.it \
--cc=arnd@arndb.de \
--cc=daniel.lezcano@linaro.org \
--cc=geert@linux-m68k.org \
--cc=jiaxun.yang@flygoat.com \
--cc=john.stultz@linaro.org \
--cc=laurent@vivier.eu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@lists.linux-m68k.org \
--cc=linux-rtc@vger.kernel.org \
--cc=sboyd@kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.