hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/tty/serial/amba-pl011.c
....@@ -1048,6 +1048,9 @@
10481048 */
10491049 static inline void pl011_dma_rx_stop(struct uart_amba_port *uap)
10501050 {
1051
+ if (!uap->using_rx_dma)
1052
+ return;
1053
+
10511054 /* FIXME. Just disable the DMA enable */
10521055 uap->dmacr &= ~UART011_RXDMAE;
10531056 pl011_write(uap->dmacr, uap, REG_DMACR);
....@@ -1757,8 +1760,17 @@
17571760 static void pl011_unthrottle_rx(struct uart_port *port)
17581761 {
17591762 struct uart_amba_port *uap = container_of(port, struct uart_amba_port, port);
1763
+ unsigned long flags;
17601764
1761
- pl011_enable_interrupts(uap);
1765
+ spin_lock_irqsave(&uap->port.lock, flags);
1766
+
1767
+ uap->im = UART011_RTIM;
1768
+ if (!pl011_dma_rx_running(uap))
1769
+ uap->im |= UART011_RXIM;
1770
+
1771
+ pl011_write(uap->im, uap, REG_IMSC);
1772
+
1773
+ spin_unlock_irqrestore(&uap->port.lock, flags);
17621774 }
17631775
17641776 static int pl011_startup(struct uart_port *port)
....@@ -2199,24 +2211,18 @@
21992211 {
22002212 struct uart_amba_port *uap = amba_ports[co->index];
22012213 unsigned int old_cr = 0, new_cr;
2202
- unsigned long flags = 0;
2214
+ unsigned long flags;
22032215 int locked = 1;
22042216
22052217 clk_enable(uap->clk);
22062218
2207
- /*
2208
- * local_irq_save(flags);
2209
- *
2210
- * This local_irq_save() is nonsense. If we come in via sysrq
2211
- * handling then interrupts are already disabled. Aside of
2212
- * that the port.sysrq check is racy on SMP regardless.
2213
- */
2219
+ local_irq_save(flags);
22142220 if (uap->port.sysrq)
22152221 locked = 0;
22162222 else if (oops_in_progress)
2217
- locked = spin_trylock_irqsave(&uap->port.lock, flags);
2223
+ locked = spin_trylock(&uap->port.lock);
22182224 else
2219
- spin_lock_irqsave(&uap->port.lock, flags);
2225
+ spin_lock(&uap->port.lock);
22202226
22212227 /*
22222228 * First save the CR then disable the interrupts
....@@ -2242,7 +2248,8 @@
22422248 pl011_write(old_cr, uap, REG_CR);
22432249
22442250 if (locked)
2245
- spin_unlock_irqrestore(&uap->port.lock, flags);
2251
+ spin_unlock(&uap->port.lock);
2252
+ local_irq_restore(flags);
22462253
22472254 clk_disable(uap->clk);
22482255 }