U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Kuan-Wei Chiu <visitorckw@gmail.com>
To: Daniel Palmer <daniel@thingy.jp>
Cc: trini@konsulko.com, angelo@kernel-space.org, bmeng.cn@gmail.com,
	sjg@chromium.org, u-boot@lists.denx.de
Subject: Re: [PATCH v7 1/9] sysreset: qemu virt: Use map_sysmem()
Date: Tue, 19 May 2026 01:46:10 +0800	[thread overview]
Message-ID: <agtQF8Ain5X7mI_x@google.com> (raw)
In-Reply-To: <20260516074016.885146-2-daniel@thingy.jp>

On Sat, May 16, 2026 at 04:39:53PM +0900, Daniel Palmer wrote:
> In the platform data there is a phys_addr_t (an integer) for the address
> of the register and we pass that as-is into writel() which is fine in most
> places because we don't need to do any mapping and the macro for writel()
> does a cast to a pointer.
> 
> If writel() is a static inline function the address argument is a pointer
> so passing it in as an integer without casting it first causes warnings or
> build failure.
> 
> map_sysmem() handles the casting part and if phys_addr_t is 32bits when
> on a 64bit machine.
> 
> Signed-off-by: Daniel Palmer <daniel@thingy.jp>

Acked-by: Kuan-Wei Chiu <visitorckw@gmail.com>

> ---
>  drivers/sysreset/sysreset_qemu_virt_ctrl.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/sysreset/sysreset_qemu_virt_ctrl.c b/drivers/sysreset/sysreset_qemu_virt_ctrl.c
> index e7cacc9b6e98..61b38d507fc5 100644
> --- a/drivers/sysreset/sysreset_qemu_virt_ctrl.c
> +++ b/drivers/sysreset/sysreset_qemu_virt_ctrl.c
> @@ -8,6 +8,7 @@
>  #include <dm.h>
>  #include <qemu_virt_ctrl.h>
>  #include <sysreset.h>
> +#include <mapmem.h>
>  #include <asm/io.h>
>  #include <linux/err.h>
>  
> @@ -24,6 +25,7 @@
>  static int qemu_virt_ctrl_request(struct udevice *dev, enum sysreset_t type)
>  {
>  	struct qemu_virt_ctrl_plat *plat = dev_get_plat(dev);
> +	void __iomem *reg = map_sysmem(plat->reg + VIRT_CTRL_REG_CMD, 0x4);
>  	u32 val;
>  
>  	switch (type) {
> @@ -38,7 +40,7 @@ static int qemu_virt_ctrl_request(struct udevice *dev, enum sysreset_t type)
>  		return -EPROTONOSUPPORT;
>  	}
>  
> -	writel(val, plat->reg + VIRT_CTRL_REG_CMD);
> +	writel(val, reg);
>  
>  	return -EINPROGRESS;
>  }
> -- 
> 2.53.0
> 

  reply	other threads:[~2026-05-18 17:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-16  7:39 [PATCH v7 0/9] Add virtio-mmio support to m68k virt machine Daniel Palmer
2026-05-16  7:39 ` [PATCH v7 1/9] sysreset: qemu virt: Use map_sysmem() Daniel Palmer
2026-05-18 17:46   ` Kuan-Wei Chiu [this message]
2026-05-16  7:39 ` [PATCH v7 2/9] sysreset: qemu virt: Use __raw_writel() Daniel Palmer
2026-05-16  7:39 ` [PATCH v7 3/9] rtc: goldfish: Use __raw_readl() and __raw_writel() Daniel Palmer
2026-05-16  7:39 ` [PATCH v7 4/9] timer: goldfish: Use __raw_readl() Daniel Palmer
2026-05-16  7:39 ` [PATCH v7 5/9] m68k: Fix writew(), writel(), readw(), readl() endianness for classic m68k Daniel Palmer
2026-05-16  7:39 ` [PATCH v7 6/9] virtio: mmio: Allow instantiation via platform data Daniel Palmer
2026-05-16  7:39 ` [PATCH v7 7/9] virtio: cmd: Depend on VIRTIO_BLK Daniel Palmer
2026-05-16  7:40 ` [PATCH v7 8/9] virtio: blk: Fix converting the vendor id to a string Daniel Palmer
2026-05-16  7:40 ` [PATCH v7 9/9] board: qemu: m68k: Create virtio mmio instances Daniel Palmer
2026-05-23  0:01 ` [PATCH v7 0/9] Add virtio-mmio support to m68k virt machine 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=agtQF8Ain5X7mI_x@google.com \
    --to=visitorckw@gmail.com \
    --cc=angelo@kernel-space.org \
    --cc=bmeng.cn@gmail.com \
    --cc=daniel@thingy.jp \
    --cc=sjg@chromium.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox