Le 17/10/2025 à 09:57, Andre Przywara a écrit :
Hi,

On 16/10/2025 15:27, 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]

Fix that with a cast to (void *)(uintptr_t)

Signed-off-by: Richard Genoud <[email protected]>
---
  drivers/mtd/nand/raw/sunxi_nand_spl.c | 3 ++-
  1 file changed, 2 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..19091ece632b 100644
--- a/drivers/mtd/nand/raw/sunxi_nand_spl.c
+++ b/drivers/mtd/nand/raw/sunxi_nand_spl.c
@@ -310,7 +310,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,
+        memcpy_fromio(data,
+                  (void *)(uintptr_t)SUNXI_NFC_BASE + NFC_RAM0_BASE,

I don't think memcpy_fromio() is correct here in the first place. It looks tempting to use it, but the implementation is not safe to use with Allwinner peripherals: we need to stick to the predefined device register access width. Neither the arm nor the arm64 implementation are fully compliant. If you go by the book, the peripheral registers are 32- bit wide, and must only be accessed via a 32-bit wide access (readl/ writel). Empirically 8-bit accesses to a 32-bit aligned address also seem to work, but not to other addresses. Everything else is unsafe and should be avoided. So can you please replace this call with a for-loop of readl() invocations? This should be safe with all devices, and since the base address is 32-bit aligned, and I assume ecc_size is as well, we are good here.
Ok, sure.

Thanks!


Cheers,
Andre

                    conf->ecc_size);
          /* Stop the ECC engine */



--
Richard Genoud, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

Reply via email to