Commit a61fca3e authored by Mathis MARION's avatar Mathis MARION Committed by Federico Vaga

Support for non-generic iomap: ARM compatibility

Some architectures such as ARM don't use asm-generic/iomap.h and instead
define their own implementation for ioread32 and iowrite32.
This can be checked using the CONFIG_GENERIC_IOMAP preprocessor.

The signature used inside asm-generic/io.h uses volatile for the address
parameter. Thus it is necessary to accomodate this change.

Moreover, ARM uses macros to define ioread32be and iowrite32be, so it is
necessary to define a function on top of the macro to allow for
assignation.
Note: other architectures may not use macros, or use macros for ioread32
and iowrite32, in which case this patch may not work and has to be
adapted.
Signed-off-by: 's avatarGwenhael GOAVEC <gwenhael.goavec@femto-st.fr>
Signed-off-by: 's avatarMathis MARION <mathis.marion@grenoble-inp.org>
parent 7f4ea5bd
......@@ -78,13 +78,30 @@ enum fa_bus_resource {
ADC_CARR_VME_ADDR,
};
#ifndef CONFIG_GENERIC_IOMAP
static inline u32 (ioread32be)(const volatile void __iomem *addr)
{
return ioread32be(addr);
}
static inline void (iowrite32be)(u32 value, volatile void __iomem *addr)
{
iowrite32be(value, addr);
}
#endif
struct fa_memory_ops {
#ifdef CONFIG_GENERIC_IOMAP
#if KERNEL_VERSION(5, 8, 0) <= LINUX_VERSION_CODE
u32 (*read)(const void *addr);
#else
u32 (*read)(void *addr);
#endif
void (*write)(u32 value, void *addr);
#else
u32 (*read)(const volatile void *addr);
void (*write)(u32 value, volatile void *addr);
#endif
};
/*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment