serial: stm32: Fix AARCH64 compilation warnings

When building with AARCH64 defconfig, we got warnings, fix them
by using registers base address defined as void __iomem * instead of
fdt_addr_t.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
This commit is contained in:
Patrice Chotard 2023-10-27 16:43:01 +02:00 committed by Patrice Chotard
parent 3e0b12af8a
commit 6261cf6abd
2 changed files with 14 additions and 11 deletions

View file

@ -30,7 +30,7 @@
*/ */
#define ONE_BYTE_B115200_US 87 #define ONE_BYTE_B115200_US 87
static void _stm32_serial_setbrg(fdt_addr_t base, static void _stm32_serial_setbrg(void __iomem *base,
struct stm32_uart_info *uart_info, struct stm32_uart_info *uart_info,
u32 clock_rate, u32 clock_rate,
int baudrate) int baudrate)
@ -75,7 +75,7 @@ static int stm32_serial_setconfig(struct udevice *dev, uint serial_config)
struct stm32x7_serial_plat *plat = dev_get_plat(dev); struct stm32x7_serial_plat *plat = dev_get_plat(dev);
bool stm32f4 = plat->uart_info->stm32f4; bool stm32f4 = plat->uart_info->stm32f4;
u8 uart_enable_bit = plat->uart_info->uart_enable_bit; u8 uart_enable_bit = plat->uart_info->uart_enable_bit;
u32 cr1 = plat->base + CR1_OFFSET(stm32f4); void __iomem *cr1 = plat->base + CR1_OFFSET(stm32f4);
u32 config = 0; u32 config = 0;
uint parity = SERIAL_GET_PARITY(serial_config); uint parity = SERIAL_GET_PARITY(serial_config);
uint bits = SERIAL_GET_BITS(serial_config); uint bits = SERIAL_GET_BITS(serial_config);
@ -122,7 +122,7 @@ static int stm32_serial_getc(struct udevice *dev)
{ {
struct stm32x7_serial_plat *plat = dev_get_plat(dev); struct stm32x7_serial_plat *plat = dev_get_plat(dev);
bool stm32f4 = plat->uart_info->stm32f4; bool stm32f4 = plat->uart_info->stm32f4;
fdt_addr_t base = plat->base; void __iomem *base = plat->base;
u32 isr = readl(base + ISR_OFFSET(stm32f4)); u32 isr = readl(base + ISR_OFFSET(stm32f4));
if ((isr & USART_ISR_RXNE) == 0) if ((isr & USART_ISR_RXNE) == 0)
@ -141,7 +141,7 @@ static int stm32_serial_getc(struct udevice *dev)
return readl(base + RDR_OFFSET(stm32f4)); return readl(base + RDR_OFFSET(stm32f4));
} }
static int _stm32_serial_putc(fdt_addr_t base, static int _stm32_serial_putc(void __iomem *base,
struct stm32_uart_info *uart_info, struct stm32_uart_info *uart_info,
const char c) const char c)
{ {
@ -166,7 +166,7 @@ static int stm32_serial_pending(struct udevice *dev, bool input)
{ {
struct stm32x7_serial_plat *plat = dev_get_plat(dev); struct stm32x7_serial_plat *plat = dev_get_plat(dev);
bool stm32f4 = plat->uart_info->stm32f4; bool stm32f4 = plat->uart_info->stm32f4;
fdt_addr_t base = plat->base; void __iomem *base = plat->base;
if (input) if (input)
return readl(base + ISR_OFFSET(stm32f4)) & return readl(base + ISR_OFFSET(stm32f4)) &
@ -176,7 +176,7 @@ static int stm32_serial_pending(struct udevice *dev, bool input)
USART_ISR_TXE ? 0 : 1; USART_ISR_TXE ? 0 : 1;
} }
static void _stm32_serial_init(fdt_addr_t base, static void _stm32_serial_init(void __iomem *base,
struct stm32_uart_info *uart_info) struct stm32_uart_info *uart_info)
{ {
bool stm32f4 = uart_info->stm32f4; bool stm32f4 = uart_info->stm32f4;
@ -250,11 +250,14 @@ static const struct udevice_id stm32_serial_id[] = {
static int stm32_serial_of_to_plat(struct udevice *dev) static int stm32_serial_of_to_plat(struct udevice *dev)
{ {
struct stm32x7_serial_plat *plat = dev_get_plat(dev); struct stm32x7_serial_plat *plat = dev_get_plat(dev);
fdt_addr_t addr;
plat->base = dev_read_addr(dev); addr = dev_read_addr(dev);
if (plat->base == FDT_ADDR_T_NONE) if (addr == FDT_ADDR_T_NONE)
return -EINVAL; return -EINVAL;
plat->base = (void __iomem *)addr;
return 0; return 0;
} }
@ -297,7 +300,7 @@ static inline struct stm32_uart_info *_debug_uart_info(void)
static inline void _debug_uart_init(void) static inline void _debug_uart_init(void)
{ {
fdt_addr_t base = CONFIG_VAL(DEBUG_UART_BASE); void __iomem *base = (void __iomem *)CONFIG_VAL(DEBUG_UART_BASE);
struct stm32_uart_info *uart_info = _debug_uart_info(); struct stm32_uart_info *uart_info = _debug_uart_info();
_stm32_serial_init(base, uart_info); _stm32_serial_init(base, uart_info);
@ -308,7 +311,7 @@ static inline void _debug_uart_init(void)
static inline void _debug_uart_putc(int c) static inline void _debug_uart_putc(int c)
{ {
fdt_addr_t base = CONFIG_VAL(DEBUG_UART_BASE); void __iomem *base = (void __iomem *)CONFIG_VAL(DEBUG_UART_BASE);
struct stm32_uart_info *uart_info = _debug_uart_info(); struct stm32_uart_info *uart_info = _debug_uart_info();
while (_stm32_serial_putc(base, uart_info, c) == -EAGAIN) while (_stm32_serial_putc(base, uart_info, c) == -EAGAIN)

View file

@ -49,7 +49,7 @@ struct stm32_uart_info stm32h7_info = {
/* Information about a serial port */ /* Information about a serial port */
struct stm32x7_serial_plat { struct stm32x7_serial_plat {
fdt_addr_t base; /* address of registers in physical memory */ void __iomem *base; /* address of registers in physical memory */
struct stm32_uart_info *uart_info; struct stm32_uart_info *uart_info;
unsigned long int clock_rate; unsigned long int clock_rate;
}; };