Hi

On Mon, Jan 19, 2026 at 2:13 PM Richard GENOUD
<[email protected]> wrote:
>
> Hi,
> Le 19/01/2026 à 12:12, Andre Przywara a écrit :
> > Hi,
> >
> > On 28/10/2025 09:12, Richard Genoud wrote:
> >> Fix pointer from interget warning when compiling for ARM64
> >>
> >> When compiling for arm64, we get this error:
> >> error: passing argument 2 of ‘__memcpy_fromio’ makes pointer from
> >>             integer without a cast [-Wint-conversion]
> >>
> >> Moreover the copy should be made with dedicated readl(), like for any
> >> register access on this peripheral, since they are 32bit wide.
> >>
> >> So, instead of memcpy_fromio(), just use a readl() loop.
> >> Introduce nand_readlcpy() to implement this loop.
> >>
> >> Fixes: 6ddbb1e936c7 ("spl: nand: sunxi: use PIO instead of DMA")
> >> Suggested-by: Andre Przywara <[email protected]>
> >> Signed-off-by: Richard Genoud <[email protected]>
> >> ---
> >>   drivers/mtd/nand/raw/sunxi_nand_spl.c | 14 +++++++++++++-
> >>   1 file changed, 13 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/mtd/nand/raw/sunxi_nand_spl.c b/drivers/mtd/nand/
> >> raw/sunxi_nand_spl.c
> >> index 4f1e2d9a5775..a15f54573df2 100644
> >> --- a/drivers/mtd/nand/raw/sunxi_nand_spl.c
> >> +++ b/drivers/mtd/nand/raw/sunxi_nand_spl.c
> >> @@ -251,6 +251,17 @@ static int nand_change_column(u16 column)
> >>   static const int ecc_bytes[] = {32, 46, 54, 60, 74, 88, 102, 110, 116};
> >> +static void nand_readlcpy(u32 *dest, u32 * __iomem src, size_t len)
> >> +{
> >> +    if (len & 0x3)
> >> +        printf("length should be multiple of 4 (32bits access), data
> >> will be incomplete.\n");
> >
> > This should not be a message printed on the console. There is only
> > one(?) internal user, and the argument is a multiple of 512, if I see
> > that correctly. So it's an internal error that wouldn't happen at all in
> > the moment. It just blows up the code size, and isn't even very
> > descriptive.
> >
> > If you *really* want to check that, you could try to use something like
> > builtin_constant_p, to create a compile-time error, or maybe use
> > debug(). But I would suggest to drop it completely, as it would be
> > pointless with the current code anyway.
> >
> > The rest looks fine, thanks for adding that function.
> Indeed, I can drop it and add a comment to warn future users in this driver.
>
> @Michael, do you want me to do a v3, or just apply this v2 and I'll send
> a fix? (or you just remove those lines when you apply the patch?)
>

No, I will do by myself, I will send a new pull request by today

Michael

> Thanks !
>
> Regards,
> Richard
> >
> > Cheers,
> > Andre
> >
> >> +    len >>= 2;
> >> +
> >> +    while (len--)
> >> +        *dest++ = readl(src++);
> >> +}
> >> +
> >>   static int nand_read_page(const struct nfc_config *conf, u32 offs,
> >>                 void *dest, int len)
> >>   {
> >> @@ -310,7 +321,8 @@ static int nand_read_page(const struct nfc_config
> >> *conf, u32 offs,
> >>               return 1;
> >>           /* Retrieve the data from SRAM */
> >> -        memcpy_fromio(data, SUNXI_NFC_BASE + NFC_RAM0_BASE,
> >> +        nand_readlcpy((u32 *)data,
> >> +                  (void *)(uintptr_t)SUNXI_NFC_BASE + NFC_RAM0_BASE,
> >>                     conf->ecc_size);
> >>           /* Stop the ECC engine */
> >
>
>
> --
> Richard Genoud, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com



-- 
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
[email protected]
__________________________________

Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T. +31 (0)85 111 9172
[email protected]
www.amarulasolutions.com

Reply via email to