]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
mtd: rawnand: sunxi_spl: fix pointer from integer without a cast
authorRichard Genoud <richard.genoud@bootlin.com>
Fri, 23 Jan 2026 11:44:37 +0000 (12:44 +0100)
committerMichael Trimarchi <michael@amarulasolutions.com>
Tue, 3 Feb 2026 20:44:25 +0000 (21:44 +0100)
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 <andre.przywara@arm.com>
Signed-off-by: Richard Genoud <richard.genoud@bootlin.com>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
drivers/mtd/nand/raw/sunxi_nand_spl.c

index 4f1e2d9a577568c349e7422885c8ad6e439903b0..4441990dd938a1bdca0e490241144bf360bf5754 100644 (file)
@@ -251,6 +251,15 @@ 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)
+{
+       /* NB: len should be multiple of 4 (32bits access) */
+       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 +319,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 */