.. | .. |
---|
737 | 737 | serial_out(p, UART_EFR, UART_EFR_ECB); |
---|
738 | 738 | serial_out(p, UART_LCR, 0); |
---|
739 | 739 | } |
---|
740 | | - serial8250_set_IER(p, sleep ? UART_IERX_SLEEP : 0); |
---|
| 740 | + serial_out(p, UART_IER, sleep ? UART_IERX_SLEEP : 0); |
---|
741 | 741 | if (p->capabilities & UART_CAP_EFR) { |
---|
742 | 742 | serial_out(p, UART_LCR, UART_LCR_CONF_MODE_B); |
---|
743 | 743 | serial_out(p, UART_EFR, efr); |
---|
.. | .. |
---|
1411 | 1411 | |
---|
1412 | 1412 | up->ier &= ~(UART_IER_RLSI | UART_IER_RDI); |
---|
1413 | 1413 | up->port.read_status_mask &= ~UART_LSR_DR; |
---|
1414 | | - serial8250_set_IER(up, up->ier); |
---|
| 1414 | + serial_port_out(port, UART_IER, up->ier); |
---|
1415 | 1415 | |
---|
1416 | 1416 | serial8250_rpm_put(up); |
---|
1417 | 1417 | } |
---|
.. | .. |
---|
1441 | 1441 | serial8250_clear_and_reinit_fifos(p); |
---|
1442 | 1442 | |
---|
1443 | 1443 | p->ier |= UART_IER_RLSI | UART_IER_RDI; |
---|
1444 | | - serial8250_set_IER(p, p->ier); |
---|
| 1444 | + serial_port_out(&p->port, UART_IER, p->ier); |
---|
1445 | 1445 | } |
---|
1446 | 1446 | } |
---|
1447 | 1447 | EXPORT_SYMBOL_GPL(serial8250_em485_stop_tx); |
---|
.. | .. |
---|
1688 | 1688 | mctrl_gpio_disable_ms(up->gpios); |
---|
1689 | 1689 | |
---|
1690 | 1690 | up->ier &= ~UART_IER_MSI; |
---|
1691 | | - serial8250_set_IER(up, up->ier); |
---|
| 1691 | + serial_port_out(port, UART_IER, up->ier); |
---|
1692 | 1692 | } |
---|
1693 | 1693 | |
---|
1694 | 1694 | static void serial8250_enable_ms(struct uart_port *port) |
---|
.. | .. |
---|
1704 | 1704 | up->ier |= UART_IER_MSI; |
---|
1705 | 1705 | |
---|
1706 | 1706 | serial8250_rpm_get(up); |
---|
1707 | | - serial8250_set_IER(up, up->ier); |
---|
| 1707 | + serial_port_out(port, UART_IER, up->ier); |
---|
1708 | 1708 | serial8250_rpm_put(up); |
---|
1709 | 1709 | } |
---|
1710 | 1710 | |
---|
.. | .. |
---|
2171 | 2171 | struct uart_8250_port *up = up_to_u8250p(port); |
---|
2172 | 2172 | |
---|
2173 | 2173 | serial8250_rpm_get(up); |
---|
2174 | | - ier = serial8250_clear_IER(up); |
---|
| 2174 | + /* |
---|
| 2175 | + * First save the IER then disable the interrupts |
---|
| 2176 | + */ |
---|
| 2177 | + ier = serial_port_in(port, UART_IER); |
---|
| 2178 | + if (up->capabilities & UART_CAP_UUE) |
---|
| 2179 | + serial_port_out(port, UART_IER, UART_IER_UUE); |
---|
| 2180 | + else |
---|
| 2181 | + serial_port_out(port, UART_IER, 0); |
---|
2175 | 2182 | |
---|
2176 | 2183 | wait_for_xmitr(up, BOTH_EMPTY); |
---|
2177 | 2184 | /* |
---|
.. | .. |
---|
2184 | 2191 | * and restore the IER |
---|
2185 | 2192 | */ |
---|
2186 | 2193 | wait_for_xmitr(up, BOTH_EMPTY); |
---|
2187 | | - serial8250_set_IER(up, ier); |
---|
| 2194 | + serial_port_out(port, UART_IER, ier); |
---|
2188 | 2195 | serial8250_rpm_put(up); |
---|
2189 | 2196 | } |
---|
2190 | 2197 | |
---|
.. | .. |
---|
2491 | 2498 | */ |
---|
2492 | 2499 | spin_lock_irqsave(&port->lock, flags); |
---|
2493 | 2500 | up->ier = 0; |
---|
2494 | | - serial8250_set_IER(up, 0); |
---|
| 2501 | + serial_port_out(port, UART_IER, 0); |
---|
2495 | 2502 | spin_unlock_irqrestore(&port->lock, flags); |
---|
2496 | 2503 | |
---|
2497 | 2504 | synchronize_irq(port->irq); |
---|
.. | .. |
---|
2863 | 2870 | if (up->capabilities & UART_CAP_RTOIE) |
---|
2864 | 2871 | up->ier |= UART_IER_RTOIE; |
---|
2865 | 2872 | |
---|
2866 | | - serial8250_set_IER(up, up->ier); |
---|
| 2873 | + serial_port_out(port, UART_IER, up->ier); |
---|
2867 | 2874 | #endif |
---|
2868 | 2875 | |
---|
2869 | 2876 | if (up->capabilities & UART_CAP_EFR) { |
---|
.. | .. |
---|
2923 | 2930 | if (up->capabilities & UART_CAP_RTOIE) |
---|
2924 | 2931 | up->ier |= UART_IER_RTOIE; |
---|
2925 | 2932 | |
---|
2926 | | - serial8250_set_IER(up, up->ier); |
---|
| 2933 | + serial_port_out(port, UART_IER, up->ier); |
---|
2927 | 2934 | #endif |
---|
2928 | 2935 | |
---|
2929 | 2936 | spin_unlock_irqrestore(&port->lock, flags); |
---|
.. | .. |
---|
3355 | 3362 | |
---|
3356 | 3363 | #ifdef CONFIG_SERIAL_8250_CONSOLE |
---|
3357 | 3364 | |
---|
3358 | | -static void serial8250_console_putchar_locked(struct uart_port *port, int ch) |
---|
| 3365 | +static void serial8250_console_putchar(struct uart_port *port, int ch) |
---|
3359 | 3366 | { |
---|
3360 | 3367 | struct uart_8250_port *up = up_to_u8250p(port); |
---|
3361 | 3368 | |
---|
3362 | 3369 | wait_for_xmitr(up, UART_LSR_THRE); |
---|
3363 | 3370 | serial_port_out(port, UART_TX, ch); |
---|
3364 | | -} |
---|
3365 | | - |
---|
3366 | | -static void serial8250_console_putchar(struct uart_port *port, int ch) |
---|
3367 | | -{ |
---|
3368 | | - struct uart_8250_port *up = up_to_u8250p(port); |
---|
3369 | | - unsigned int flags; |
---|
3370 | | - |
---|
3371 | | - wait_for_xmitr(up, UART_LSR_THRE); |
---|
3372 | | - |
---|
3373 | | - console_atomic_lock(&flags); |
---|
3374 | | - serial8250_console_putchar_locked(port, ch); |
---|
3375 | | - console_atomic_unlock(flags); |
---|
3376 | 3371 | } |
---|
3377 | 3372 | |
---|
3378 | 3373 | /* |
---|
.. | .. |
---|
3396 | 3391 | serial8250_out_MCR(up, up->mcr | UART_MCR_DTR | UART_MCR_RTS); |
---|
3397 | 3392 | } |
---|
3398 | 3393 | |
---|
3399 | | -void serial8250_console_write_atomic(struct uart_8250_port *up, |
---|
3400 | | - const char *s, unsigned int count) |
---|
3401 | | -{ |
---|
3402 | | - struct uart_port *port = &up->port; |
---|
3403 | | - unsigned int flags; |
---|
3404 | | - unsigned int ier; |
---|
3405 | | - |
---|
3406 | | - console_atomic_lock(&flags); |
---|
3407 | | - |
---|
3408 | | - touch_nmi_watchdog(); |
---|
3409 | | - |
---|
3410 | | - ier = serial8250_clear_IER(up); |
---|
3411 | | - |
---|
3412 | | - if (atomic_fetch_inc(&up->console_printing)) { |
---|
3413 | | - uart_console_write(port, "\n", 1, |
---|
3414 | | - serial8250_console_putchar_locked); |
---|
3415 | | - } |
---|
3416 | | - uart_console_write(port, s, count, serial8250_console_putchar_locked); |
---|
3417 | | - atomic_dec(&up->console_printing); |
---|
3418 | | - |
---|
3419 | | - wait_for_xmitr(up, BOTH_EMPTY); |
---|
3420 | | - serial8250_set_IER(up, ier); |
---|
3421 | | - |
---|
3422 | | - console_atomic_unlock(flags); |
---|
3423 | | -} |
---|
3424 | | - |
---|
3425 | 3394 | /* |
---|
3426 | 3395 | * Print a string to the serial port trying not to disturb |
---|
3427 | 3396 | * any possible real use of the port... |
---|
.. | .. |
---|
3438 | 3407 | struct uart_port *port = &up->port; |
---|
3439 | 3408 | unsigned long flags; |
---|
3440 | 3409 | unsigned int ier; |
---|
| 3410 | + int locked = 1; |
---|
3441 | 3411 | |
---|
3442 | 3412 | touch_nmi_watchdog(); |
---|
3443 | 3413 | |
---|
3444 | | - spin_lock_irqsave(&port->lock, flags); |
---|
| 3414 | + if (oops_in_progress) |
---|
| 3415 | + locked = spin_trylock_irqsave(&port->lock, flags); |
---|
| 3416 | + else |
---|
| 3417 | + spin_lock_irqsave(&port->lock, flags); |
---|
3445 | 3418 | |
---|
3446 | | - ier = serial8250_clear_IER(up); |
---|
| 3419 | + /* |
---|
| 3420 | + * First save the IER then disable the interrupts |
---|
| 3421 | + */ |
---|
| 3422 | + ier = serial_port_in(port, UART_IER); |
---|
| 3423 | + |
---|
| 3424 | + if (up->capabilities & UART_CAP_UUE) |
---|
| 3425 | + serial_port_out(port, UART_IER, UART_IER_UUE); |
---|
| 3426 | + else |
---|
| 3427 | + serial_port_out(port, UART_IER, 0); |
---|
3447 | 3428 | |
---|
3448 | 3429 | /* check scratch reg to see if port powered off during system sleep */ |
---|
3449 | 3430 | if (up->canary && (up->canary != serial_port_in(port, UART_SCR))) { |
---|
.. | .. |
---|
3457 | 3438 | mdelay(port->rs485.delay_rts_before_send); |
---|
3458 | 3439 | } |
---|
3459 | 3440 | |
---|
3460 | | - atomic_inc(&up->console_printing); |
---|
3461 | 3441 | uart_console_write(port, s, count, serial8250_console_putchar); |
---|
3462 | | - atomic_dec(&up->console_printing); |
---|
3463 | 3442 | |
---|
3464 | 3443 | /* |
---|
3465 | 3444 | * Finally, wait for transmitter to become empty |
---|
.. | .. |
---|
3472 | 3451 | if (em485->tx_stopped) |
---|
3473 | 3452 | up->rs485_stop_tx(up); |
---|
3474 | 3453 | } |
---|
3475 | | - serial8250_set_IER(up, ier); |
---|
| 3454 | + |
---|
| 3455 | + serial_port_out(port, UART_IER, ier); |
---|
3476 | 3456 | |
---|
3477 | 3457 | /* |
---|
3478 | 3458 | * The receive handling will happen properly because the |
---|
.. | .. |
---|
3484 | 3464 | if (up->msr_saved_flags) |
---|
3485 | 3465 | serial8250_modem_status(up); |
---|
3486 | 3466 | |
---|
3487 | | - spin_unlock_irqrestore(&port->lock, flags); |
---|
| 3467 | + if (locked) |
---|
| 3468 | + spin_unlock_irqrestore(&port->lock, flags); |
---|
3488 | 3469 | } |
---|
3489 | 3470 | |
---|
3490 | 3471 | static unsigned int probe_baud(struct uart_port *port) |
---|
.. | .. |
---|
3504 | 3485 | |
---|
3505 | 3486 | int serial8250_console_setup(struct uart_port *port, char *options, bool probe) |
---|
3506 | 3487 | { |
---|
3507 | | - struct uart_8250_port *up = up_to_u8250p(port); |
---|
3508 | 3488 | int baud = 9600; |
---|
3509 | 3489 | int bits = 8; |
---|
3510 | 3490 | int parity = 'n'; |
---|
.. | .. |
---|
3513 | 3493 | |
---|
3514 | 3494 | if (!port->iobase && !port->membase) |
---|
3515 | 3495 | return -ENODEV; |
---|
3516 | | - |
---|
3517 | | - atomic_set(&up->console_printing, 0); |
---|
3518 | 3496 | |
---|
3519 | 3497 | if (options) |
---|
3520 | 3498 | uart_parse_options(options, &baud, &parity, &bits, &flow); |
---|