mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
serial: 8250: move RSA functions to 8250_rsa.c
They are RSA-specific, so should live in a preexisting 8250_rsa.c. Move them there. Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20250611100319.186924-13-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
8725679fc4
commit
5a128fb475
3 changed files with 100 additions and 99 deletions
|
@ -318,8 +318,16 @@ static inline void serial8250_pnp_exit(void) { }
|
|||
|
||||
#ifdef CONFIG_SERIAL_8250_RSA
|
||||
void univ8250_rsa_support(struct uart_ops *ops);
|
||||
void rsa_enable(struct uart_8250_port *up);
|
||||
void rsa_disable(struct uart_8250_port *up);
|
||||
void rsa_autoconfig(struct uart_8250_port *up);
|
||||
void rsa_reset(struct uart_8250_port *up);
|
||||
#else
|
||||
static inline void univ8250_rsa_support(struct uart_ops *ops) { }
|
||||
static inline void rsa_enable(struct uart_8250_port *up) {}
|
||||
static inline void rsa_disable(struct uart_8250_port *up) {}
|
||||
static inline void rsa_autoconfig(struct uart_8250_port *up) {}
|
||||
static inline void rsa_reset(struct uart_8250_port *up) {}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SERIAL_8250_FINTEK
|
||||
|
|
|
@ -713,105 +713,6 @@ static void serial8250_clear_IER(struct uart_8250_port *up)
|
|||
serial_out(up, UART_IER, 0);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SERIAL_8250_RSA
|
||||
/*
|
||||
* Attempts to turn on the RSA FIFO. Returns zero on failure.
|
||||
* We set the port uart clock rate if we succeed.
|
||||
*/
|
||||
static int __rsa_enable(struct uart_8250_port *up)
|
||||
{
|
||||
unsigned char mode;
|
||||
int result;
|
||||
|
||||
mode = serial_in(up, UART_RSA_MSR);
|
||||
result = mode & UART_RSA_MSR_FIFO;
|
||||
|
||||
if (!result) {
|
||||
serial_out(up, UART_RSA_MSR, mode | UART_RSA_MSR_FIFO);
|
||||
mode = serial_in(up, UART_RSA_MSR);
|
||||
result = mode & UART_RSA_MSR_FIFO;
|
||||
}
|
||||
|
||||
if (result)
|
||||
up->port.uartclk = SERIAL_RSA_BAUD_BASE * 16;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* If this is an RSA port, see if we can kick it up to the higher speed clock.
|
||||
*/
|
||||
static void rsa_enable(struct uart_8250_port *up)
|
||||
{
|
||||
if (up->port.type != PORT_RSA)
|
||||
return;
|
||||
|
||||
if (up->port.uartclk != SERIAL_RSA_BAUD_BASE * 16) {
|
||||
uart_port_lock_irq(&up->port);
|
||||
__rsa_enable(up);
|
||||
uart_port_unlock_irq(&up->port);
|
||||
}
|
||||
if (up->port.uartclk == SERIAL_RSA_BAUD_BASE * 16)
|
||||
serial_out(up, UART_RSA_FRR, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Attempts to turn off the RSA FIFO and resets the RSA board back to 115kbps compat mode. It is
|
||||
* unknown why interrupts were disabled in here. However, the caller is expected to preserve this
|
||||
* behaviour by grabbing the spinlock before calling this function.
|
||||
*/
|
||||
static void rsa_disable(struct uart_8250_port *up)
|
||||
{
|
||||
unsigned char mode;
|
||||
int result;
|
||||
|
||||
if (up->port.type != PORT_RSA)
|
||||
return;
|
||||
|
||||
if (up->port.uartclk != SERIAL_RSA_BAUD_BASE * 16)
|
||||
return;
|
||||
|
||||
uart_port_lock_irq(&up->port);
|
||||
mode = serial_in(up, UART_RSA_MSR);
|
||||
result = !(mode & UART_RSA_MSR_FIFO);
|
||||
|
||||
if (!result) {
|
||||
serial_out(up, UART_RSA_MSR, mode & ~UART_RSA_MSR_FIFO);
|
||||
mode = serial_in(up, UART_RSA_MSR);
|
||||
result = !(mode & UART_RSA_MSR_FIFO);
|
||||
}
|
||||
|
||||
if (result)
|
||||
up->port.uartclk = SERIAL_RSA_BAUD_BASE_LO * 16;
|
||||
uart_port_unlock_irq(&up->port);
|
||||
}
|
||||
|
||||
static void rsa_autoconfig(struct uart_8250_port *up)
|
||||
{
|
||||
/* Only probe for RSA ports if we got the region. */
|
||||
if (up->port.type != PORT_16550A)
|
||||
return;
|
||||
if (!(up->probe & UART_PROBE_RSA))
|
||||
return;
|
||||
|
||||
if (__rsa_enable(up))
|
||||
up->port.type = PORT_RSA;
|
||||
}
|
||||
|
||||
static void rsa_reset(struct uart_8250_port *up)
|
||||
{
|
||||
if (up->port.type != PORT_RSA)
|
||||
return;
|
||||
|
||||
serial_out(up, UART_RSA_FRR, 0);
|
||||
}
|
||||
#else
|
||||
static inline void rsa_enable(struct uart_8250_port *up) {}
|
||||
static inline void rsa_disable(struct uart_8250_port *up) {}
|
||||
static inline void rsa_autoconfig(struct uart_8250_port *up) {}
|
||||
static inline void rsa_reset(struct uart_8250_port *up) {}
|
||||
#endif /* CONFIG_SERIAL_8250_RSA */
|
||||
|
||||
/*
|
||||
* This is a quickie test to see how big the FIFO is.
|
||||
* It doesn't work at all the time, more's the pity.
|
||||
|
|
|
@ -107,6 +107,98 @@ void univ8250_rsa_support(struct uart_ops *ops)
|
|||
module_param_hw_array(probe_rsa, ulong, ioport, &probe_rsa_count, 0444);
|
||||
MODULE_PARM_DESC(probe_rsa, "Probe I/O ports for RSA");
|
||||
|
||||
/*
|
||||
* Attempts to turn on the RSA FIFO. Returns zero on failure.
|
||||
* We set the port uart clock rate if we succeed.
|
||||
*/
|
||||
static int __rsa_enable(struct uart_8250_port *up)
|
||||
{
|
||||
unsigned char mode;
|
||||
int result;
|
||||
|
||||
mode = serial_in(up, UART_RSA_MSR);
|
||||
result = mode & UART_RSA_MSR_FIFO;
|
||||
|
||||
if (!result) {
|
||||
serial_out(up, UART_RSA_MSR, mode | UART_RSA_MSR_FIFO);
|
||||
mode = serial_in(up, UART_RSA_MSR);
|
||||
result = mode & UART_RSA_MSR_FIFO;
|
||||
}
|
||||
|
||||
if (result)
|
||||
up->port.uartclk = SERIAL_RSA_BAUD_BASE * 16;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* If this is an RSA port, see if we can kick it up to the higher speed clock.
|
||||
*/
|
||||
void rsa_enable(struct uart_8250_port *up)
|
||||
{
|
||||
if (up->port.type != PORT_RSA)
|
||||
return;
|
||||
|
||||
if (up->port.uartclk != SERIAL_RSA_BAUD_BASE * 16) {
|
||||
uart_port_lock_irq(&up->port);
|
||||
__rsa_enable(up);
|
||||
uart_port_unlock_irq(&up->port);
|
||||
}
|
||||
if (up->port.uartclk == SERIAL_RSA_BAUD_BASE * 16)
|
||||
serial_out(up, UART_RSA_FRR, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Attempts to turn off the RSA FIFO and resets the RSA board back to 115kbps compat mode. It is
|
||||
* unknown why interrupts were disabled in here. However, the caller is expected to preserve this
|
||||
* behaviour by grabbing the spinlock before calling this function.
|
||||
*/
|
||||
void rsa_disable(struct uart_8250_port *up)
|
||||
{
|
||||
unsigned char mode;
|
||||
int result;
|
||||
|
||||
if (up->port.type != PORT_RSA)
|
||||
return;
|
||||
|
||||
if (up->port.uartclk != SERIAL_RSA_BAUD_BASE * 16)
|
||||
return;
|
||||
|
||||
uart_port_lock_irq(&up->port);
|
||||
mode = serial_in(up, UART_RSA_MSR);
|
||||
result = !(mode & UART_RSA_MSR_FIFO);
|
||||
|
||||
if (!result) {
|
||||
serial_out(up, UART_RSA_MSR, mode & ~UART_RSA_MSR_FIFO);
|
||||
mode = serial_in(up, UART_RSA_MSR);
|
||||
result = !(mode & UART_RSA_MSR_FIFO);
|
||||
}
|
||||
|
||||
if (result)
|
||||
up->port.uartclk = SERIAL_RSA_BAUD_BASE_LO * 16;
|
||||
uart_port_unlock_irq(&up->port);
|
||||
}
|
||||
|
||||
void rsa_autoconfig(struct uart_8250_port *up)
|
||||
{
|
||||
/* Only probe for RSA ports if we got the region. */
|
||||
if (up->port.type != PORT_16550A)
|
||||
return;
|
||||
if (!(up->probe & UART_PROBE_RSA))
|
||||
return;
|
||||
|
||||
if (__rsa_enable(up))
|
||||
up->port.type = PORT_RSA;
|
||||
}
|
||||
|
||||
void rsa_reset(struct uart_8250_port *up)
|
||||
{
|
||||
if (up->port.type != PORT_RSA)
|
||||
return;
|
||||
|
||||
serial_out(up, UART_RSA_FRR, 0);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SERIAL_8250_DEPRECATED_OPTIONS
|
||||
#ifndef MODULE
|
||||
/*
|
||||
|
|
Loading…
Add table
Reference in a new issue