mirror of
https://github.com/lkl/linux.git
synced 2025-12-19 16:13:19 +09:00
serial: 8250: Change dl_read/write to handle value as u32
Divisor latch read/write functions currently handle the value is int. As the value is related to HW context, u32 makes much more sense than a signed type. While at it, name the parameters in the callback signature. Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20230511121029.13128-2-ilpo.jarvinen@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
9d86719f87
commit
b245aa0cc5
@@ -167,12 +167,12 @@ static unsigned int __maybe_unused serial_icr_read(struct uart_8250_port *up,
|
|||||||
|
|
||||||
void serial8250_clear_and_reinit_fifos(struct uart_8250_port *p);
|
void serial8250_clear_and_reinit_fifos(struct uart_8250_port *p);
|
||||||
|
|
||||||
static inline int serial_dl_read(struct uart_8250_port *up)
|
static inline u32 serial_dl_read(struct uart_8250_port *up)
|
||||||
{
|
{
|
||||||
return up->dl_read(up);
|
return up->dl_read(up);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void serial_dl_write(struct uart_8250_port *up, int value)
|
static inline void serial_dl_write(struct uart_8250_port *up, u32 value)
|
||||||
{
|
{
|
||||||
up->dl_write(up, value);
|
up->dl_write(up, value);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -139,12 +139,12 @@ static void serial8250_em_serial_out(struct uart_port *p, int offset, int value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int serial8250_em_serial_dl_read(struct uart_8250_port *up)
|
static u32 serial8250_em_serial_dl_read(struct uart_8250_port *up)
|
||||||
{
|
{
|
||||||
return serial_in(up, UART_DLL_EM) | serial_in(up, UART_DLM_EM) << 8;
|
return serial_in(up, UART_DLL_EM) | serial_in(up, UART_DLM_EM) << 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void serial8250_em_serial_dl_write(struct uart_8250_port *up, int value)
|
static void serial8250_em_serial_dl_write(struct uart_8250_port *up, u32 value)
|
||||||
{
|
{
|
||||||
serial_out(up, UART_DLL_EM, value & 0xff);
|
serial_out(up, UART_DLL_EM, value & 0xff);
|
||||||
serial_out(up, UART_DLM_EM, value >> 8 & 0xff);
|
serial_out(up, UART_DLM_EM, value >> 8 & 0xff);
|
||||||
|
|||||||
@@ -325,7 +325,7 @@ static const struct serial8250_config uart_config[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Uart divisor latch read */
|
/* Uart divisor latch read */
|
||||||
static int default_serial_dl_read(struct uart_8250_port *up)
|
static u32 default_serial_dl_read(struct uart_8250_port *up)
|
||||||
{
|
{
|
||||||
/* Assign these in pieces to truncate any bits above 7. */
|
/* Assign these in pieces to truncate any bits above 7. */
|
||||||
unsigned char dll = serial_in(up, UART_DLL);
|
unsigned char dll = serial_in(up, UART_DLL);
|
||||||
@@ -335,7 +335,7 @@ static int default_serial_dl_read(struct uart_8250_port *up)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Uart divisor latch write */
|
/* Uart divisor latch write */
|
||||||
static void default_serial_dl_write(struct uart_8250_port *up, int value)
|
static void default_serial_dl_write(struct uart_8250_port *up, u32 value)
|
||||||
{
|
{
|
||||||
serial_out(up, UART_DLL, value & 0xff);
|
serial_out(up, UART_DLL, value & 0xff);
|
||||||
serial_out(up, UART_DLM, value >> 8 & 0xff);
|
serial_out(up, UART_DLM, value >> 8 & 0xff);
|
||||||
@@ -389,12 +389,12 @@ void au_serial_out(struct uart_port *p, int offset, int value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Au1x00 haven't got a standard divisor latch */
|
/* Au1x00 haven't got a standard divisor latch */
|
||||||
static int au_serial_dl_read(struct uart_8250_port *up)
|
static u32 au_serial_dl_read(struct uart_8250_port *up)
|
||||||
{
|
{
|
||||||
return __raw_readl(up->port.membase + 0x28);
|
return __raw_readl(up->port.membase + 0x28);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void au_serial_dl_write(struct uart_8250_port *up, int value)
|
static void au_serial_dl_write(struct uart_8250_port *up, u32 value)
|
||||||
{
|
{
|
||||||
__raw_writel(value, up->port.membase + 0x28);
|
__raw_writel(value, up->port.membase + 0x28);
|
||||||
}
|
}
|
||||||
@@ -847,7 +847,7 @@ static void disable_rsa(struct uart_8250_port *up)
|
|||||||
static int size_fifo(struct uart_8250_port *up)
|
static int size_fifo(struct uart_8250_port *up)
|
||||||
{
|
{
|
||||||
unsigned char old_fcr, old_mcr, old_lcr;
|
unsigned char old_fcr, old_mcr, old_lcr;
|
||||||
unsigned short old_dl;
|
u32 old_dl;
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
old_lcr = serial_in(up, UART_LCR);
|
old_lcr = serial_in(up, UART_LCR);
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ static const struct of_device_id serial_pxa_dt_ids[] = {
|
|||||||
MODULE_DEVICE_TABLE(of, serial_pxa_dt_ids);
|
MODULE_DEVICE_TABLE(of, serial_pxa_dt_ids);
|
||||||
|
|
||||||
/* Uart divisor latch write */
|
/* Uart divisor latch write */
|
||||||
static void serial_pxa_dl_write(struct uart_8250_port *up, int value)
|
static void serial_pxa_dl_write(struct uart_8250_port *up, u32 value)
|
||||||
{
|
{
|
||||||
unsigned int dll;
|
unsigned int dll;
|
||||||
|
|
||||||
|
|||||||
@@ -145,12 +145,12 @@ static void uniphier_serial_out(struct uart_port *p, int offset, int value)
|
|||||||
* The divisor latch register exists at different address.
|
* The divisor latch register exists at different address.
|
||||||
* Override dl_read/write callbacks.
|
* Override dl_read/write callbacks.
|
||||||
*/
|
*/
|
||||||
static int uniphier_serial_dl_read(struct uart_8250_port *up)
|
static u32 uniphier_serial_dl_read(struct uart_8250_port *up)
|
||||||
{
|
{
|
||||||
return readl(up->port.membase + UNIPHIER_UART_DLR);
|
return readl(up->port.membase + UNIPHIER_UART_DLR);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void uniphier_serial_dl_write(struct uart_8250_port *up, int value)
|
static void uniphier_serial_dl_write(struct uart_8250_port *up, u32 value)
|
||||||
{
|
{
|
||||||
writel(value, up->port.membase + UNIPHIER_UART_DLR);
|
writel(value, up->port.membase + UNIPHIER_UART_DLR);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,8 +129,8 @@ struct uart_8250_port {
|
|||||||
const struct uart_8250_ops *ops;
|
const struct uart_8250_ops *ops;
|
||||||
|
|
||||||
/* 8250 specific callbacks */
|
/* 8250 specific callbacks */
|
||||||
int (*dl_read)(struct uart_8250_port *);
|
u32 (*dl_read)(struct uart_8250_port *up);
|
||||||
void (*dl_write)(struct uart_8250_port *, int);
|
void (*dl_write)(struct uart_8250_port *up, u32 value);
|
||||||
|
|
||||||
struct uart_8250_em485 *em485;
|
struct uart_8250_em485 *em485;
|
||||||
void (*rs485_start_tx)(struct uart_8250_port *);
|
void (*rs485_start_tx)(struct uart_8250_port *);
|
||||||
|
|||||||
Reference in New Issue
Block a user