Skip to content

Commit 209a20d

Browse files
pnewman-ctigregkh
authored andcommitted
serial: exar: moved generic_rs485 further up in 8250_exar.c
Preparatory patch moving generic_rs485_config and generic_rs485_supported higher in the file to allow for CTI setup functions to use them. Signed-off-by: Parker Newman <[email protected]> Link: https://lore.kernel.org/r/a7bf2a42de759908c058246ec15f60bde9a5dc65.1713382717.git.pnewman@connecttech.com Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 393b520 commit 209a20d

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

drivers/tty/serial/8250/8250_exar.c

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,31 @@ struct exar8250 {
197197
int line[];
198198
};
199199

200+
static int generic_rs485_config(struct uart_port *port, struct ktermios *termios,
201+
struct serial_rs485 *rs485)
202+
{
203+
bool is_rs485 = !!(rs485->flags & SER_RS485_ENABLED);
204+
u8 __iomem *p = port->membase;
205+
u8 value;
206+
207+
value = readb(p + UART_EXAR_FCTR);
208+
if (is_rs485)
209+
value |= UART_FCTR_EXAR_485;
210+
else
211+
value &= ~UART_FCTR_EXAR_485;
212+
213+
writeb(value, p + UART_EXAR_FCTR);
214+
215+
if (is_rs485)
216+
writeb(UART_EXAR_RS485_DLY(4), p + UART_MSR);
217+
218+
return 0;
219+
}
220+
221+
static const struct serial_rs485 generic_rs485_supported = {
222+
.flags = SER_RS485_ENABLED | SER_RS485_RTS_ON_SEND,
223+
};
224+
200225
static void exar_pm(struct uart_port *port, unsigned int state, unsigned int old)
201226
{
202227
/*
@@ -459,27 +484,6 @@ static void xr17v35x_unregister_gpio(struct uart_8250_port *port)
459484
port->port.private_data = NULL;
460485
}
461486

462-
static int generic_rs485_config(struct uart_port *port, struct ktermios *termios,
463-
struct serial_rs485 *rs485)
464-
{
465-
bool is_rs485 = !!(rs485->flags & SER_RS485_ENABLED);
466-
u8 __iomem *p = port->membase;
467-
u8 value;
468-
469-
value = readb(p + UART_EXAR_FCTR);
470-
if (is_rs485)
471-
value |= UART_FCTR_EXAR_485;
472-
else
473-
value &= ~UART_FCTR_EXAR_485;
474-
475-
writeb(value, p + UART_EXAR_FCTR);
476-
477-
if (is_rs485)
478-
writeb(UART_EXAR_RS485_DLY(4), p + UART_MSR);
479-
480-
return 0;
481-
}
482-
483487
static int sealevel_rs485_config(struct uart_port *port, struct ktermios *termios,
484488
struct serial_rs485 *rs485)
485489
{
@@ -518,10 +522,6 @@ static int sealevel_rs485_config(struct uart_port *port, struct ktermios *termio
518522
return 0;
519523
}
520524

521-
static const struct serial_rs485 generic_rs485_supported = {
522-
.flags = SER_RS485_ENABLED | SER_RS485_RTS_ON_SEND,
523-
};
524-
525525
static const struct exar8250_platform exar8250_default_platform = {
526526
.register_gpio = xr17v35x_register_gpio,
527527
.unregister_gpio = xr17v35x_unregister_gpio,

0 commit comments

Comments
 (0)