All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kuan-Wei Chiu <visitorckw@gmail.com>
To: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Cc: me@ziyao.cc, daniel@0x0f.com, jserv@ccns.ncku.edu.tw,
	eleanor15x@gmail.com, u-boot@lists.denx.de, alison.wang@nxp.com,
	angelo@kernel-space.org, trini@konsulko.com
Subject: Re: [PATCH v3 3/6] rtc: goldfish: Support platform data for non-DT probing
Date: Thu, 1 Jan 2026 00:23:12 +0800	[thread overview]
Message-ID: <aVVN8CxdN7od62j_@google.com> (raw)
In-Reply-To: <3983ea9a-e965-472f-aced-d74f27ed95e0@gmx.de>

Hi Heinrich,

On Wed, Dec 31, 2025 at 01:12:45PM +0100, Heinrich Schuchardt wrote:
> On 12/30/25 17:01, Kuan-Wei Chiu wrote:
> > Currently, the Goldfish RTC driver exclusively relies on device tree
> > to retrieve the base address, failing immediately if dev_read_addr()
> > returns FDT_ADDR_T_NONE. This restriction prevents the driver from
> > being used on platforms that instantiate devices via U_BOOT_DRVINFO()
> > instead of device tree, such as the QEMU m68k virt machine.
> > 
> > Add support for platform data to address this limitation. Update the
> > probe function to fall back to retrieving the base address from
> > struct goldfish_rtc_plat if the device tree address is unavailable.
> > Introduce a new header file include/goldfish_rtc.h to define the
> > platform data structure.
> > 
> > Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
> > ---
> > Changes in v3:
> > - New patch.
> > 
> > It appears there is no specific maintainer listed for this driver?
> > 
> >   drivers/rtc/goldfish_rtc.c | 10 ++++++++--
> >   include/goldfish_rtc.h     | 15 +++++++++++++++
> >   2 files changed, 23 insertions(+), 2 deletions(-)
> >   create mode 100644 include/goldfish_rtc.h
> > 
> > diff --git a/drivers/rtc/goldfish_rtc.c b/drivers/rtc/goldfish_rtc.c
> > index e63a2766c76..900daabccb9 100644
> > --- a/drivers/rtc/goldfish_rtc.c
> > +++ b/drivers/rtc/goldfish_rtc.c
> > @@ -9,6 +9,7 @@
> >   #include <div64.h>
> >   #include <dm.h>
> > +#include <goldfish_rtc.h>
> >   #include <mapmem.h>
> >   #include <rtc.h>
> >   #include <linux/io.h>
> > @@ -77,11 +78,16 @@ static int goldfish_rtc_set(struct udevice *dev, const struct rtc_time *time)
> >   static int goldfish_rtc_probe(struct udevice *dev)
> >   {
> >   	struct goldfish_rtc *priv = dev_get_priv(dev);
> > +	struct goldfish_rtc_plat *plat;
> >   	fdt_addr_t addr;
> >   	addr = dev_read_addr(dev);
> > -	if (addr == FDT_ADDR_T_NONE)
> > -		return -EINVAL;
> > +	if (addr == FDT_ADDR_T_NONE) {
> > +		plat = dev_get_plat(dev);
> > +		if (!plat)
> > +			return -EINVAL;
> > +		addr = (fdt_addr_t)plat->base;
> 
> addr is not a pointer, it is an address in the sandbox virtual memory
> address space. This is why map_sysmem() is used below.
> 
> The suggested code fails to build on sandbox_defconfig with the driver
> enabled:
> 
> drivers/rtc/goldfish_rtc.c: In function ‘goldfish_rtc_probe’:
> drivers/rtc/goldfish_rtc.c:89:24: warning: cast from pointer to integer of
> different size [-Wpointer-to-int-cast]
>    89 |                 addr = (fdt_addr_t)plat->base;
>       |
> 
> Please, use
> 
> 	priv->base = plat->base;
> 
> If plat->base is NULL, please, throw -EINVAL.

My apologies for the oversight.
I agree with your suggestion.

I will update the code to assign plat->base directly to priv->base in
the next version. I will also verify the build with sandbox_defconfig
to ensure there are no issues.

Regards,
Kuan-Wei

  reply	other threads:[~2025-12-31 17:47 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-30 16:01 [PATCH v3 0/6] m68k: Add support for QEMU virt machine Kuan-Wei Chiu
2025-12-30 16:01 ` [PATCH v3 1/6] serial: Add Goldfish TTY driver Kuan-Wei Chiu
2025-12-31  3:01   ` Yao Zi
2025-12-31  3:52   ` Daniel Palmer
2025-12-31 12:25   ` Heinrich Schuchardt
2025-12-31 16:18     ` Kuan-Wei Chiu
2025-12-30 16:01 ` [PATCH v3 2/6] timer: Add Goldfish timer driver Kuan-Wei Chiu
2025-12-31  3:49   ` Daniel Palmer
2025-12-31  6:27   ` Yao Zi
2025-12-31 16:15     ` Kuan-Wei Chiu
2025-12-30 16:01 ` [PATCH v3 3/6] rtc: goldfish: Support platform data for non-DT probing Kuan-Wei Chiu
2025-12-31 12:12   ` Heinrich Schuchardt
2025-12-31 16:23     ` Kuan-Wei Chiu [this message]
2025-12-30 16:01 ` [PATCH v3 4/6] m68k: Add support for M68040 CPU Kuan-Wei Chiu
2025-12-30 16:01 ` [PATCH v3 5/6] board: Add QEMU m68k virt board support Kuan-Wei Chiu
2025-12-31  3:59   ` Daniel Palmer
2025-12-30 16:01 ` [PATCH v3 6/6] CI: Add test jobs for QEMU m68k virt machine Kuan-Wei Chiu
2025-12-30 16:09   ` Tom Rini

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=aVVN8CxdN7od62j_@google.com \
    --to=visitorckw@gmail.com \
    --cc=alison.wang@nxp.com \
    --cc=angelo@kernel-space.org \
    --cc=daniel@0x0f.com \
    --cc=eleanor15x@gmail.com \
    --cc=heinrich.schuchardt@canonical.com \
    --cc=jserv@ccns.ncku.edu.tw \
    --cc=me@ziyao.cc \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.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.