summaryrefslogtreecommitdiff
path: root/patches/0017-serial-8250-implement-write_atomic.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/0017-serial-8250-implement-write_atomic.patch')
-rw-r--r--patches/0017-serial-8250-implement-write_atomic.patch105
1 files changed, 54 insertions, 51 deletions
diff --git a/patches/0017-serial-8250-implement-write_atomic.patch b/patches/0017-serial-8250-implement-write_atomic.patch
index a64abb45042e..d26ba2b2d498 100644
--- a/patches/0017-serial-8250-implement-write_atomic.patch
+++ b/patches/0017-serial-8250-implement-write_atomic.patch
@@ -35,7 +35,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
--- a/drivers/tty/serial/8250/8250.h
+++ b/drivers/tty/serial/8250/8250.h
-@@ -132,12 +132,74 @@ static inline void serial_dl_write(struc
+@@ -157,12 +157,74 @@ static inline void serial_dl_write(struc
up->dl_write(up, value);
}
@@ -111,7 +111,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
return true;
}
-@@ -146,7 +208,7 @@ static inline bool serial8250_clear_THRI
+@@ -171,7 +233,7 @@ static inline bool serial8250_clear_THRI
if (!(up->ier & UART_IER_THRI))
return false;
up->ier &= ~UART_IER_THRI;
@@ -210,7 +210,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
return HRTIMER_NORESTART;
--- a/drivers/tty/serial/8250/8250_core.c
+++ b/drivers/tty/serial/8250/8250_core.c
-@@ -255,8 +255,11 @@ static void serial8250_timeout(struct ti
+@@ -254,8 +254,11 @@ static void serial8250_timeout(struct ti
static void serial8250_backup_timeout(struct timer_list *t)
{
struct uart_8250_port *up = from_timer(up, t, timer);
@@ -222,7 +222,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
spin_lock_irqsave(&up->port.lock, flags);
-@@ -265,8 +268,16 @@ static void serial8250_backup_timeout(st
+@@ -264,8 +267,16 @@ static void serial8250_backup_timeout(st
* based handler.
*/
if (up->port.irq) {
@@ -239,7 +239,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
}
iir = serial_in(up, UART_IIR);
-@@ -290,7 +301,7 @@ static void serial8250_backup_timeout(st
+@@ -289,7 +300,7 @@ static void serial8250_backup_timeout(st
serial8250_tx_chars(up);
if (up->port.irq)
@@ -248,7 +248,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
spin_unlock_irqrestore(&up->port.lock, flags);
-@@ -567,6 +578,14 @@ serial8250_register_ports(struct uart_dr
+@@ -566,6 +577,14 @@ serial8250_register_ports(struct uart_dr
#ifdef CONFIG_SERIAL_8250_CONSOLE
@@ -263,7 +263,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
static void univ8250_console_write(struct console *co, const char *s,
unsigned int count)
{
-@@ -660,6 +679,7 @@ static int univ8250_console_match(struct
+@@ -659,6 +678,7 @@ static int univ8250_console_match(struct
static struct console univ8250_console = {
.name = "ttyS",
@@ -271,7 +271,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
.write = univ8250_console_write,
.device = uart_console_device,
.setup = univ8250_console_setup,
-@@ -953,7 +973,7 @@ static void serial_8250_overrun_backoff_
+@@ -952,7 +972,7 @@ static void serial_8250_overrun_backoff_
spin_lock_irqsave(&port->lock, flags);
up->ier |= UART_IER_RLSI | UART_IER_RDI;
up->port.read_status_mask |= UART_LSR_DR;
@@ -333,7 +333,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
value |= UART_MCR_MDCE | UART_MCR_FCM;
--- a/drivers/tty/serial/8250/8250_mtk.c
+++ b/drivers/tty/serial/8250/8250_mtk.c
-@@ -218,12 +218,40 @@ static void mtk8250_shutdown(struct uart
+@@ -222,12 +222,40 @@ static void mtk8250_shutdown(struct uart
static void mtk8250_disable_intrs(struct uart_8250_port *up, int mask)
{
@@ -467,7 +467,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
-@@ -770,7 +770,7 @@ static void serial8250_set_sleep(struct
+@@ -749,7 +749,7 @@ static void serial8250_set_sleep(struct
serial_out(p, UART_EFR, UART_EFR_ECB);
serial_out(p, UART_LCR, 0);
}
@@ -476,7 +476,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
if (p->capabilities & UART_CAP_EFR) {
serial_out(p, UART_LCR, UART_LCR_CONF_MODE_B);
serial_out(p, UART_EFR, efr);
-@@ -1044,8 +1044,11 @@ static int broken_efr(struct uart_8250_p
+@@ -1023,8 +1023,11 @@ static int broken_efr(struct uart_8250_p
*/
static void autoconfig_16550a(struct uart_8250_port *up)
{
@@ -488,7 +488,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
up->port.type = PORT_16550A;
up->capabilities |= UART_CAP_FIFO;
-@@ -1156,6 +1159,11 @@ static void autoconfig_16550a(struct uar
+@@ -1135,6 +1138,11 @@ static void autoconfig_16550a(struct uar
return;
}
@@ -500,7 +500,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
/*
* Try writing and reading the UART_IER_UUE bit (b6).
* If it works, this is probably one of the Xscale platform's
-@@ -1191,6 +1199,9 @@ static void autoconfig_16550a(struct uar
+@@ -1170,6 +1178,9 @@ static void autoconfig_16550a(struct uar
}
serial_out(up, UART_IER, iersave);
@@ -510,7 +510,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
/*
* We distinguish between 16550A and U6 16550A by counting
* how many bytes are in the FIFO.
-@@ -1213,8 +1224,10 @@ static void autoconfig(struct uart_8250_
+@@ -1192,8 +1203,10 @@ static void autoconfig(struct uart_8250_
unsigned char status1, scratch, scratch2, scratch3;
unsigned char save_lcr, save_mcr;
struct uart_port *port = &up->port;
@@ -521,7 +521,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
if (!port->iobase && !port->mapbase && !port->membase)
return;
-@@ -1232,6 +1245,11 @@ static void autoconfig(struct uart_8250_
+@@ -1211,6 +1224,11 @@ static void autoconfig(struct uart_8250_
up->bugs = 0;
if (!(port->flags & UPF_BUGGY_UART)) {
@@ -533,7 +533,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
/*
* Do a simple existence test first; if we fail this,
* there's no point trying anything else.
-@@ -1261,6 +1279,10 @@ static void autoconfig(struct uart_8250_
+@@ -1240,6 +1258,10 @@ static void autoconfig(struct uart_8250_
#endif
scratch3 = serial_in(up, UART_IER) & 0x0f;
serial_out(up, UART_IER, scratch);
@@ -544,7 +544,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
if (scratch2 != 0 || scratch3 != 0x0F) {
/*
* We failed; there's nothing here
-@@ -1358,10 +1380,7 @@ static void autoconfig(struct uart_8250_
+@@ -1337,10 +1359,7 @@ static void autoconfig(struct uart_8250_
serial8250_out_MCR(up, save_mcr);
serial8250_clear_fifos(up);
serial_in(up, UART_RX);
@@ -556,7 +556,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
out_unlock:
spin_unlock_irqrestore(&port->lock, flags);
-@@ -1387,7 +1406,9 @@ static void autoconfig_irq(struct uart_8
+@@ -1366,7 +1385,9 @@ static void autoconfig_irq(struct uart_8
unsigned char save_mcr, save_ier;
unsigned char save_ICP = 0;
unsigned int ICP = 0;
@@ -566,7 +566,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
int irq;
if (port->flags & UPF_FOURPORT) {
-@@ -1397,8 +1418,12 @@ static void autoconfig_irq(struct uart_8
+@@ -1376,8 +1397,12 @@ static void autoconfig_irq(struct uart_8
inb_p(ICP);
}
@@ -580,7 +580,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
/* forget possible initially masked and pending IRQ */
probe_irq_off(probe_irq_on());
-@@ -1430,8 +1455,10 @@ static void autoconfig_irq(struct uart_8
+@@ -1409,8 +1434,10 @@ static void autoconfig_irq(struct uart_8
if (port->flags & UPF_FOURPORT)
outb_p(save_ICP, ICP);
@@ -592,7 +592,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
port->irq = (irq > 0) ? irq : 0;
}
-@@ -1444,7 +1471,7 @@ static void serial8250_stop_rx(struct ua
+@@ -1423,7 +1450,7 @@ static void serial8250_stop_rx(struct ua
up->ier &= ~(UART_IER_RLSI | UART_IER_RDI);
up->port.read_status_mask &= ~UART_LSR_DR;
@@ -601,7 +601,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
serial8250_rpm_put(up);
}
-@@ -1474,7 +1501,7 @@ void serial8250_em485_stop_tx(struct uar
+@@ -1453,7 +1480,7 @@ void serial8250_em485_stop_tx(struct uar
serial8250_clear_and_reinit_fifos(p);
p->ier |= UART_IER_RLSI | UART_IER_RDI;
@@ -610,7 +610,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
}
}
EXPORT_SYMBOL_GPL(serial8250_em485_stop_tx);
-@@ -1711,7 +1738,7 @@ static void serial8250_disable_ms(struct
+@@ -1707,7 +1734,7 @@ static void serial8250_disable_ms(struct
mctrl_gpio_disable_ms(up->gpios);
up->ier &= ~UART_IER_MSI;
@@ -619,7 +619,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
}
static void serial8250_enable_ms(struct uart_port *port)
-@@ -1727,7 +1754,7 @@ static void serial8250_enable_ms(struct
+@@ -1723,7 +1750,7 @@ static void serial8250_enable_ms(struct
up->ier |= UART_IER_MSI;
serial8250_rpm_get(up);
@@ -628,7 +628,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
serial8250_rpm_put(up);
}
-@@ -2146,14 +2173,7 @@ static void serial8250_put_poll_char(str
+@@ -2152,14 +2179,7 @@ static void serial8250_put_poll_char(str
struct uart_8250_port *up = up_to_u8250p(port);
serial8250_rpm_get(up);
@@ -644,7 +644,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
wait_for_xmitr(up, BOTH_EMPTY);
/*
-@@ -2166,7 +2186,7 @@ static void serial8250_put_poll_char(str
+@@ -2172,7 +2192,7 @@ static void serial8250_put_poll_char(str
* and restore the IER
*/
wait_for_xmitr(up, BOTH_EMPTY);
@@ -653,7 +653,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
serial8250_rpm_put(up);
}
-@@ -2175,8 +2195,10 @@ static void serial8250_put_poll_char(str
+@@ -2181,8 +2201,10 @@ static void serial8250_put_poll_char(str
int serial8250_do_startup(struct uart_port *port)
{
struct uart_8250_port *up = up_to_u8250p(port);
@@ -664,7 +664,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
int retval;
if (!port->fifosize)
-@@ -2196,7 +2218,7 @@ int serial8250_do_startup(struct uart_po
+@@ -2202,7 +2224,7 @@ int serial8250_do_startup(struct uart_po
up->acr = 0;
serial_port_out(port, UART_LCR, UART_LCR_CONF_MODE_B);
serial_port_out(port, UART_EFR, UART_EFR_ECB);
@@ -673,7 +673,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
serial_port_out(port, UART_LCR, 0);
serial_icr_write(up, UART_CSR, 0); /* Reset the UART */
serial_port_out(port, UART_LCR, UART_LCR_CONF_MODE_B);
-@@ -2206,7 +2228,7 @@ int serial8250_do_startup(struct uart_po
+@@ -2212,7 +2234,7 @@ int serial8250_do_startup(struct uart_po
if (port->type == PORT_DA830) {
/* Reset the port */
@@ -682,7 +682,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
serial_port_out(port, UART_DA830_PWREMU_MGMT, 0);
mdelay(10);
-@@ -2301,6 +2323,8 @@ int serial8250_do_startup(struct uart_po
+@@ -2307,6 +2329,8 @@ int serial8250_do_startup(struct uart_po
if (port->irq && (up->port.flags & UPF_SHARE_IRQ))
up->port.irqflags |= IRQF_SHARED;
@@ -691,7 +691,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
if (port->irq && !(up->port.flags & UPF_NO_THRE_TEST)) {
unsigned char iir1;
-@@ -2317,6 +2341,9 @@ int serial8250_do_startup(struct uart_po
+@@ -2323,6 +2347,9 @@ int serial8250_do_startup(struct uart_po
*/
spin_lock_irqsave(&port->lock, flags);
@@ -701,7 +701,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
wait_for_xmitr(up, UART_LSR_THRE);
serial_port_out_sync(port, UART_IER, UART_IER_THRI);
udelay(1); /* allow THRE to set */
-@@ -2327,6 +2354,9 @@ int serial8250_do_startup(struct uart_po
+@@ -2333,6 +2360,9 @@ int serial8250_do_startup(struct uart_po
iir = serial_port_in(port, UART_IIR);
serial_port_out(port, UART_IER, 0);
@@ -711,7 +711,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
spin_unlock_irqrestore(&port->lock, flags);
if (port->irqflags & IRQF_SHARED)
-@@ -2383,10 +2413,14 @@ int serial8250_do_startup(struct uart_po
+@@ -2389,10 +2419,14 @@ int serial8250_do_startup(struct uart_po
* Do a quick test to see if we receive an interrupt when we enable
* the TX irq.
*/
@@ -726,7 +726,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
if (lsr & UART_LSR_TEMT && iir & UART_IIR_NO_INT) {
if (!(up->bugs & UART_BUG_TXEN)) {
-@@ -2418,7 +2452,7 @@ int serial8250_do_startup(struct uart_po
+@@ -2424,7 +2458,7 @@ int serial8250_do_startup(struct uart_po
if (up->dma) {
const char *msg = NULL;
@@ -735,7 +735,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
msg = "forbid DMA for kernel console";
else if (serial8250_request_dma(up))
msg = "failed to request DMA";
-@@ -2469,7 +2503,7 @@ void serial8250_do_shutdown(struct uart_
+@@ -2475,7 +2509,7 @@ void serial8250_do_shutdown(struct uart_
*/
spin_lock_irqsave(&port->lock, flags);
up->ier = 0;
@@ -744,7 +744,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
spin_unlock_irqrestore(&port->lock, flags);
synchronize_irq(port->irq);
-@@ -2837,7 +2871,7 @@ serial8250_do_set_termios(struct uart_po
+@@ -2841,7 +2875,7 @@ serial8250_do_set_termios(struct uart_po
if (up->capabilities & UART_CAP_RTOIE)
up->ier |= UART_IER_RTOIE;
@@ -753,7 +753,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
if (up->capabilities & UART_CAP_EFR) {
unsigned char efr = 0;
-@@ -3303,7 +3337,7 @@ EXPORT_SYMBOL_GPL(serial8250_set_default
+@@ -3307,7 +3341,7 @@ EXPORT_SYMBOL_GPL(serial8250_set_default
#ifdef CONFIG_SERIAL_8250_CONSOLE
@@ -762,7 +762,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
{
struct uart_8250_port *up = up_to_u8250p(port);
-@@ -3311,6 +3345,18 @@ static void serial8250_console_putchar(s
+@@ -3315,6 +3349,18 @@ static void serial8250_console_putchar(s
serial_port_out(port, UART_TX, ch);
}
@@ -781,7 +781,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
/*
* Restore serial console when h/w power-off detected
*/
-@@ -3332,6 +3378,32 @@ static void serial8250_console_restore(s
+@@ -3336,6 +3382,32 @@ static void serial8250_console_restore(s
serial8250_out_MCR(up, up->mcr | UART_MCR_DTR | UART_MCR_RTS);
}
@@ -812,12 +812,12 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+}
+
/*
- * Print a string to the serial port trying not to disturb
- * any possible real use of the port...
-@@ -3348,24 +3420,12 @@ void serial8250_console_write(struct uar
+ * Print a string to the serial port using the device FIFO
+ *
+@@ -3381,24 +3453,12 @@ void serial8250_console_write(struct uar
struct uart_port *port = &up->port;
unsigned long flags;
- unsigned int ier;
+ unsigned int ier, use_fifo;
- int locked = 1;
touch_nmi_watchdog();
@@ -841,17 +841,20 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
/* check scratch reg to see if port powered off during system sleep */
if (up->canary && (up->canary != serial_port_in(port, UART_SCR))) {
-@@ -3379,7 +3439,9 @@ void serial8250_console_write(struct uar
- mdelay(port->rs485.delay_rts_before_send);
- }
+@@ -3432,10 +3492,12 @@ void serial8250_console_write(struct uar
+ */
+ !(up->port.flags & UPF_CONS_FLOW);
+ atomic_inc(&up->console_printing);
- uart_console_write(port, s, count, serial8250_console_putchar);
+ if (likely(use_fifo))
+ serial8250_console_fifo_write(up, s, count);
+ else
+ uart_console_write(port, s, count, serial8250_console_putchar);
+ atomic_dec(&up->console_printing);
/*
* Finally, wait for transmitter to become empty
-@@ -3392,8 +3454,7 @@ void serial8250_console_write(struct uar
+@@ -3448,8 +3510,7 @@ void serial8250_console_write(struct uar
if (em485->tx_stopped)
up->rs485_stop_tx(up);
}
@@ -861,7 +864,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
/*
* The receive handling will happen properly because the
-@@ -3405,8 +3466,7 @@ void serial8250_console_write(struct uar
+@@ -3461,8 +3522,7 @@ void serial8250_console_write(struct uar
if (up->msr_saved_flags)
serial8250_modem_status(up);
@@ -871,7 +874,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
}
static unsigned int probe_baud(struct uart_port *port)
-@@ -3426,6 +3486,7 @@ static unsigned int probe_baud(struct ua
+@@ -3482,6 +3542,7 @@ static unsigned int probe_baud(struct ua
int serial8250_console_setup(struct uart_port *port, char *options, bool probe)
{
@@ -879,7 +882,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
int baud = 9600;
int bits = 8;
int parity = 'n';
-@@ -3435,6 +3496,8 @@ int serial8250_console_setup(struct uart
+@@ -3491,6 +3552,8 @@ int serial8250_console_setup(struct uart
if (!port->iobase && !port->membase)
return -ENODEV;