--- zzzz-none-000/linux-3.10.107/drivers/tty/serial/altera_uart.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/tty/serial/altera_uart.c 2021-02-04 17:41:59.000000000 +0000 @@ -163,10 +163,6 @@ spin_unlock_irqrestore(&port->lock, flags); } -static void altera_uart_enable_ms(struct uart_port *port) -{ -} - static void altera_uart_set_termios(struct uart_port *port, struct ktermios *termios, struct ktermios *old) @@ -185,6 +181,12 @@ uart_update_timeout(port, termios->c_cflag, baud); altera_uart_writel(port, baudclk, ALTERA_UART_DIVISOR_REG); spin_unlock_irqrestore(&port->lock, flags); + + /* + * FIXME: port->read_status_mask and port->ignore_status_mask + * need to be initialized based on termios settings for + * INPCK, IGNBRK, IGNPAR, PARMRK, BRKINT + */ } static void altera_uart_rx_chars(struct altera_uart *pp) @@ -231,7 +233,9 @@ flag); } + spin_unlock(&port->lock); tty_flip_buffer_push(&port->state->port); + spin_lock(&port->lock); } static void altera_uart_tx_chars(struct altera_uart *pp) @@ -407,7 +411,6 @@ .start_tx = altera_uart_start_tx, .stop_tx = altera_uart_stop_tx, .stop_rx = altera_uart_stop_rx, - .enable_ms = altera_uart_enable_ms, .break_ctl = altera_uart_break_ctl, .startup = altera_uart_startup, .shutdown = altera_uart_shutdown, @@ -427,7 +430,7 @@ #if defined(CONFIG_SERIAL_ALTERA_UART_CONSOLE) -static void altera_uart_console_putc(struct uart_port *port, const char c) +static void altera_uart_console_putc(struct uart_port *port, int c) { while (!(altera_uart_readl(port, ALTERA_UART_STATUS_REG) & ALTERA_UART_STATUS_TRDY_MSK)) @@ -441,11 +444,7 @@ { struct uart_port *port = &(altera_uart_ports + co->index)->port; - for (; count; count--, s++) { - altera_uart_console_putc(port, *s); - if (*s == '\n') - altera_uart_console_putc(port, '\r'); - } + uart_console_write(port, s, count, altera_uart_console_putc); } static int __init altera_uart_console_setup(struct console *co, char *options) @@ -494,7 +493,7 @@ #define ALTERA_UART_CONSOLE NULL -#endif /* CONFIG_ALTERA_UART_CONSOLE */ +#endif /* CONFIG_SERIAL_ALTERA_UART_CONSOLE */ /* * Define the altera_uart UART driver structure. @@ -509,32 +508,9 @@ .cons = ALTERA_UART_CONSOLE, }; -#ifdef CONFIG_OF -static int altera_uart_get_of_uartclk(struct platform_device *pdev, - struct uart_port *port) -{ - int len; - const __be32 *clk; - - clk = of_get_property(pdev->dev.of_node, "clock-frequency", &len); - if (!clk || len < sizeof(__be32)) - return -ENODEV; - - port->uartclk = be32_to_cpup(clk); - - return 0; -} -#else -static int altera_uart_get_of_uartclk(struct platform_device *pdev, - struct uart_port *port) -{ - return -ENODEV; -} -#endif /* CONFIG_OF */ - static int altera_uart_probe(struct platform_device *pdev) { - struct altera_uart_platform_uart *platp = pdev->dev.platform_data; + struct altera_uart_platform_uart *platp = dev_get_platdata(&pdev->dev); struct uart_port *port; struct resource *res_mem; struct resource *res_irq; @@ -571,7 +547,8 @@ if (platp) port->uartclk = platp->uartclk; else { - ret = altera_uart_get_of_uartclk(pdev, port); + ret = of_property_read_u32(pdev->dev.of_node, "clock-frequency", + &port->uartclk); if (ret) return ret; } @@ -590,6 +567,7 @@ port->iotype = SERIAL_IO_MEM; port->ops = &altera_uart_ops; port->flags = UPF_BOOT_AUTOCONF; + port->dev = &pdev->dev; platform_set_drvdata(pdev, port); @@ -604,7 +582,6 @@ if (port) { uart_remove_one_port(&altera_uart_driver, port); - platform_set_drvdata(pdev, NULL); port->mapbase = 0; } @@ -612,8 +589,9 @@ } #ifdef CONFIG_OF -static struct of_device_id altera_uart_match[] = { +static const struct of_device_id altera_uart_match[] = { { .compatible = "ALTR,uart-1.0", }, + { .compatible = "altr,uart-1.0", }, {}, }; MODULE_DEVICE_TABLE(of, altera_uart_match); @@ -624,7 +602,6 @@ .remove = altera_uart_remove, .driver = { .name = DRV_NAME, - .owner = THIS_MODULE, .of_match_table = of_match_ptr(altera_uart_match), }, };