Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'tty-4.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty

Pull tty/serial updates from Greg KH:
"Here is the big tty/serial driver pull request for 4.15-rc1.

Lots of serial driver updates in here, some small vt cleanups, and a
raft of SPDX and license boilerplate cleanups, messing up the diffstat
a bit.

Nothing major, with no realy functional changes except better hardware
support for some platforms.

All of these have been in linux-next for a while with no reported
issues"

* tag 'tty-4.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (110 commits)
tty: ehv_bytechan: fix spelling mistake
tty: serial: meson: allow baud-rates lower than 9600
serial: 8250_fintek: Fix crash with baud rate B0
serial: 8250_fintek: Disable delays for ports != 0
serial: 8250_fintek: Return -EINVAL on invalid configuration
tty: Remove redundant license text
tty: serdev: Remove redundant license text
tty: hvc: Remove redundant license text
tty: serial: Remove redundant license text
tty: add SPDX identifiers to all remaining files in drivers/tty/
tty: serial: jsm: remove redundant pointer ts
tty: serial: jsm: add space before the open parenthesis '('
tty: serial: jsm: fix coding style
tty: serial: jsm: delete space between function name and '('
tty: serial: jsm: add blank line after declarations
tty: serial: jsm: change the type of local variable
tty: serial: imx: remove dead code imx_dma_rxint
tty: serial: imx: disable ageing timer interrupt if dma in use
serial: 8250: fix potential deadlock in rs485-mode
serial: m32r_sio: Drop redundant .data assignment
...

+1279 -1671
+1 -1
Documentation/devicetree/bindings/dma/stm32-dma.txt
··· 71 71 Example: 72 72 73 73 usart1: serial@40011000 { 74 - compatible = "st,stm32-usart", "st,stm32-uart"; 74 + compatible = "st,stm32-uart"; 75 75 reg = <0x40011000 0x400>; 76 76 interrupts = <37>; 77 77 clocks = <&clk_pclk2>;
+1
Documentation/devicetree/bindings/serial/atmel-usart.txt
··· 24 24 - dma-names: "rx" for RX channel, "tx" for TX channel. 25 25 - atmel,fifo-size: maximum number of data the RX and TX FIFOs can store for FIFO 26 26 capable USARTs. 27 + - rs485-rts-delay, rs485-rx-during-tx, linux,rs485-enabled-at-boot-time: see rs485.txt 27 28 28 29 <chip> compatible description: 29 30 - at91rm9200: legacy USART support
+1
Documentation/devicetree/bindings/serial/fsl-imx-uart.txt
··· 9 9 - fsl,irda-mode : Indicate the uart supports irda mode 10 10 - fsl,dte-mode : Indicate the uart works in DTE mode. The uart works 11 11 in DCE mode by default. 12 + - rs485-rts-delay, rs485-rx-during-tx, linux,rs485-enabled-at-boot-time: see rs485.txt 12 13 13 14 Please check Documentation/devicetree/bindings/serial/serial.txt 14 15 for the complete list of generic properties.
+1
Documentation/devicetree/bindings/serial/fsl-lpuart.txt
··· 16 16 Optional properties: 17 17 - dmas: A list of two dma specifiers, one for each entry in dma-names. 18 18 - dma-names: should contain "tx" and "rx". 19 + - rs485-rts-delay, rs485-rx-during-tx, linux,rs485-enabled-at-boot-time: see rs485.txt 19 20 20 21 Note: Optional properties for DMA support. Write them both or both not. 21 22
+1
Documentation/devicetree/bindings/serial/omap_serial.txt
··· 19 19 - dmas : DMA specifier, consisting of a phandle to the DMA controller 20 20 node and a DMA channel number. 21 21 - dma-names : "rx" for receive channel, "tx" for transmit channel. 22 + - rs485-rts-delay, rs485-rx-during-tx, linux,rs485-enabled-at-boot-time: see rs485.txt 22 23 23 24 Example: 24 25
+3 -7
Documentation/devicetree/bindings/serial/st,stm32-usart.txt
··· 2 2 3 3 Required properties: 4 4 - compatible: can be either: 5 - - "st,stm32-usart", 6 5 - "st,stm32-uart", 7 - - "st,stm32f7-usart", 8 6 - "st,stm32f7-uart", 9 - - "st,stm32h7-usart" 10 7 - "st,stm32h7-uart". 11 - depending on whether the device supports synchronous mode 12 - and is compatible with stm32(f4), stm32f7 or stm32h7. 8 + depending is compatible with stm32(f4), stm32f7 or stm32h7. 13 9 - reg: The address and length of the peripheral registers space 14 10 - interrupts: 15 11 - The interrupt line for the USART instance, ··· 29 33 }; 30 34 31 35 usart2: serial@40004400 { 32 - compatible = "st,stm32-usart", "st,stm32-uart"; 36 + compatible = "st,stm32-uart"; 33 37 reg = <0x40004400 0x400>; 34 38 interrupts = <38>; 35 39 clocks = <&clk_pclk1>; ··· 39 43 }; 40 44 41 45 usart1: serial@40011000 { 42 - compatible = "st,stm32-usart", "st,stm32-uart"; 46 + compatible = "st,stm32-uart"; 43 47 reg = <0x40011000 0x400>; 44 48 interrupts = <37>; 45 49 clocks = <&rcc 0 164>;
+6 -6
arch/arm/boot/dts/stm32f429.dtsi
··· 314 314 }; 315 315 316 316 usart2: serial@40004400 { 317 - compatible = "st,stm32-usart", "st,stm32-uart"; 317 + compatible = "st,stm32-uart"; 318 318 reg = <0x40004400 0x400>; 319 319 interrupts = <38>; 320 320 clocks = <&rcc 0 STM32F4_APB1_CLOCK(UART2)>; ··· 322 322 }; 323 323 324 324 usart3: serial@40004800 { 325 - compatible = "st,stm32-usart", "st,stm32-uart"; 325 + compatible = "st,stm32-uart"; 326 326 reg = <0x40004800 0x400>; 327 327 interrupts = <39>; 328 328 clocks = <&rcc 0 STM32F4_APB1_CLOCK(UART3)>; ··· 386 386 }; 387 387 388 388 usart7: serial@40007800 { 389 - compatible = "st,stm32-usart", "st,stm32-uart"; 389 + compatible = "st,stm32-uart"; 390 390 reg = <0x40007800 0x400>; 391 391 interrupts = <82>; 392 392 clocks = <&rcc 0 STM32F4_APB1_CLOCK(UART7)>; ··· 394 394 }; 395 395 396 396 usart8: serial@40007c00 { 397 - compatible = "st,stm32-usart", "st,stm32-uart"; 397 + compatible = "st,stm32-uart"; 398 398 reg = <0x40007c00 0x400>; 399 399 interrupts = <83>; 400 400 clocks = <&rcc 0 STM32F4_APB1_CLOCK(UART8)>; ··· 444 444 }; 445 445 446 446 usart1: serial@40011000 { 447 - compatible = "st,stm32-usart", "st,stm32-uart"; 447 + compatible = "st,stm32-uart"; 448 448 reg = <0x40011000 0x400>; 449 449 interrupts = <37>; 450 450 clocks = <&rcc 0 STM32F4_APB2_CLOCK(USART1)>; ··· 455 455 }; 456 456 457 457 usart6: serial@40011400 { 458 - compatible = "st,stm32-usart", "st,stm32-uart"; 458 + compatible = "st,stm32-uart"; 459 459 reg = <0x40011400 0x400>; 460 460 interrupts = <71>; 461 461 clocks = <&rcc 0 STM32F4_APB2_CLOCK(USART6)>;
+6 -6
arch/arm/boot/dts/stm32f746.dtsi
··· 136 136 }; 137 137 138 138 usart2: serial@40004400 { 139 - compatible = "st,stm32f7-usart", "st,stm32f7-uart"; 139 + compatible = "st,stm32f7-uart"; 140 140 reg = <0x40004400 0x400>; 141 141 interrupts = <38>; 142 142 clocks = <&rcc 1 CLK_USART2>; ··· 144 144 }; 145 145 146 146 usart3: serial@40004800 { 147 - compatible = "st,stm32f7-usart", "st,stm32f7-uart"; 147 + compatible = "st,stm32f7-uart"; 148 148 reg = <0x40004800 0x400>; 149 149 interrupts = <39>; 150 150 clocks = <&rcc 1 CLK_USART3>; ··· 177 177 }; 178 178 179 179 usart7: serial@40007800 { 180 - compatible = "st,stm32f7-usart", "st,stm32f7-uart"; 180 + compatible = "st,stm32f7-uart"; 181 181 reg = <0x40007800 0x400>; 182 182 interrupts = <82>; 183 183 clocks = <&rcc 1 CLK_UART7>; ··· 185 185 }; 186 186 187 187 usart8: serial@40007c00 { 188 - compatible = "st,stm32f7-usart", "st,stm32f7-uart"; 188 + compatible = "st,stm32f7-uart"; 189 189 reg = <0x40007c00 0x400>; 190 190 interrupts = <83>; 191 191 clocks = <&rcc 1 CLK_UART8>; ··· 193 193 }; 194 194 195 195 usart1: serial@40011000 { 196 - compatible = "st,stm32f7-usart", "st,stm32f7-uart"; 196 + compatible = "st,stm32f7-uart"; 197 197 reg = <0x40011000 0x400>; 198 198 interrupts = <37>; 199 199 clocks = <&rcc 1 CLK_USART1>; ··· 201 201 }; 202 202 203 203 usart6: serial@40011400 { 204 - compatible = "st,stm32f7-usart", "st,stm32f7-uart"; 204 + compatible = "st,stm32f7-uart"; 205 205 reg = <0x40011400 0x400>; 206 206 interrupts = <71>; 207 207 clocks = <&rcc 1 CLK_USART6>;
+2 -2
arch/arm/boot/dts/stm32h743.dtsi
··· 67 67 }; 68 68 69 69 usart2: serial@40004400 { 70 - compatible = "st,stm32f7-usart", "st,stm32f7-uart"; 70 + compatible = "st,stm32f7-uart"; 71 71 reg = <0x40004400 0x400>; 72 72 interrupts = <38>; 73 73 status = "disabled"; ··· 99 99 }; 100 100 101 101 usart1: serial@40011000 { 102 - compatible = "st,stm32f7-usart", "st,stm32f7-uart"; 102 + compatible = "st,stm32f7-uart"; 103 103 reg = <0x40011000 0x400>; 104 104 interrupts = <37>; 105 105 status = "disabled";
+17 -20
drivers/acpi/scan.c
··· 1505 1505 adev->flags.coherent_dma = cca; 1506 1506 } 1507 1507 1508 - static int acpi_check_spi_i2c_slave(struct acpi_resource *ares, void *data) 1508 + static int acpi_check_serial_bus_slave(struct acpi_resource *ares, void *data) 1509 1509 { 1510 - bool *is_spi_i2c_slave_p = data; 1510 + bool *is_serial_bus_slave_p = data; 1511 1511 1512 1512 if (ares->type != ACPI_RESOURCE_TYPE_SERIAL_BUS) 1513 1513 return 1; 1514 1514 1515 - /* 1516 - * devices that are connected to UART still need to be enumerated to 1517 - * platform bus 1518 - */ 1519 - if (ares->data.common_serial_bus.type != ACPI_RESOURCE_SERIAL_TYPE_UART) 1520 - *is_spi_i2c_slave_p = true; 1515 + *is_serial_bus_slave_p = true; 1521 1516 1522 1517 /* no need to do more checking */ 1523 1518 return -1; 1524 1519 } 1525 1520 1526 - static bool acpi_is_spi_i2c_slave(struct acpi_device *device) 1521 + static bool acpi_is_serial_bus_slave(struct acpi_device *device) 1527 1522 { 1528 1523 struct list_head resource_list; 1529 - bool is_spi_i2c_slave = false; 1524 + bool is_serial_bus_slave = false; 1530 1525 1531 1526 /* Macs use device properties in lieu of _CRS resources */ 1532 1527 if (x86_apple_machine && 1533 1528 (fwnode_property_present(&device->fwnode, "spiSclkPeriod") || 1534 - fwnode_property_present(&device->fwnode, "i2cAddress"))) 1529 + fwnode_property_present(&device->fwnode, "i2cAddress") || 1530 + fwnode_property_present(&device->fwnode, "baud"))) 1535 1531 return true; 1536 1532 1537 1533 INIT_LIST_HEAD(&resource_list); 1538 - acpi_dev_get_resources(device, &resource_list, acpi_check_spi_i2c_slave, 1539 - &is_spi_i2c_slave); 1534 + acpi_dev_get_resources(device, &resource_list, 1535 + acpi_check_serial_bus_slave, 1536 + &is_serial_bus_slave); 1540 1537 acpi_dev_free_resource_list(&resource_list); 1541 1538 1542 - return is_spi_i2c_slave; 1539 + return is_serial_bus_slave; 1543 1540 } 1544 1541 1545 1542 void acpi_init_device_object(struct acpi_device *device, acpi_handle handle, ··· 1554 1557 acpi_bus_get_flags(device); 1555 1558 device->flags.match_driver = false; 1556 1559 device->flags.initialized = true; 1557 - device->flags.spi_i2c_slave = acpi_is_spi_i2c_slave(device); 1560 + device->flags.serial_bus_slave = acpi_is_serial_bus_slave(device); 1558 1561 acpi_device_clear_enumerated(device); 1559 1562 device_initialize(&device->dev); 1560 1563 dev_set_uevent_suppress(&device->dev, true); ··· 1838 1841 static void acpi_default_enumeration(struct acpi_device *device) 1839 1842 { 1840 1843 /* 1841 - * Do not enumerate SPI/I2C slaves as they will be enumerated by their 1842 - * respective parents. 1844 + * Do not enumerate SPI/I2C/UART slaves as they will be enumerated by 1845 + * their respective parents. 1843 1846 */ 1844 - if (!device->flags.spi_i2c_slave) { 1847 + if (!device->flags.serial_bus_slave) { 1845 1848 acpi_create_platform_device(device, NULL); 1846 1849 acpi_device_set_enumerated(device); 1847 1850 } else { ··· 1938 1941 return; 1939 1942 1940 1943 device->flags.match_driver = true; 1941 - if (ret > 0 && !device->flags.spi_i2c_slave) { 1944 + if (ret > 0 && !device->flags.serial_bus_slave) { 1942 1945 acpi_device_set_enumerated(device); 1943 1946 goto ok; 1944 1947 } ··· 1947 1950 if (ret < 0) 1948 1951 return; 1949 1952 1950 - if (!device->pnp.type.platform_id && !device->flags.spi_i2c_slave) 1953 + if (!device->pnp.type.platform_id && !device->flags.serial_bus_slave) 1951 1954 acpi_device_set_enumerated(device); 1952 1955 else 1953 1956 acpi_default_enumeration(device);
+1
drivers/tty/amiserial.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Serial driver for the amiga builtin port. 3 4 *
+1 -2
drivers/tty/bfin_jtag_comm.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * TTY over Blackfin JTAG Communication 3 4 * 4 5 * Copyright 2008-2009 Analog Devices Inc. 5 6 * 6 7 * Enter bugs at http://blackfin.uclinux.org/ 7 - * 8 - * Licensed under the GPL-2 or later. 9 8 */ 10 9 11 10 #define DRV_NAME "bfin-jtag-comm"
+7 -10
drivers/tty/cyclades.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 #undef BLOCKMOVE 2 3 #define Z_WAKE 3 4 #undef Z_EXT_CHARS_IN_BUFFER ··· 287 286 static DEFINE_TIMER(cyz_timerlist, cyz_poll); 288 287 289 288 #else /* CONFIG_CYZ_INTR */ 290 - static void cyz_rx_restart(unsigned long); 291 - static struct timer_list cyz_rx_full_timer[NR_PORTS]; 289 + static void cyz_rx_restart(struct timer_list *); 292 290 #endif /* CONFIG_CYZ_INTR */ 293 291 294 292 static void cyy_writeb(struct cyclades_port *port, u32 reg, u8 val) ··· 992 992 else 993 993 char_count = rx_put - rx_get + rx_bufsize; 994 994 if (char_count >= readl(&buf_ctrl->rx_threshold) && 995 - !timer_pending(&cyz_rx_full_timer[ 996 - info->line])) 997 - mod_timer(&cyz_rx_full_timer[info->line], 998 - jiffies + 1); 995 + !timer_pending(&info->rx_full_timer)) 996 + mod_timer(&info->rx_full_timer, jiffies + 1); 999 997 #endif 1000 998 info->idle_stats.recv_idle = jiffies; 1001 999 tty_schedule_flip(&info->port); ··· 1195 1197 return IRQ_HANDLED; 1196 1198 } /* cyz_interrupt */ 1197 1199 1198 - static void cyz_rx_restart(unsigned long arg) 1200 + static void cyz_rx_restart(struct timer_list *t) 1199 1201 { 1200 - struct cyclades_port *info = (struct cyclades_port *)arg; 1202 + struct cyclades_port *info = from_timer(info, t, rx_full_timer); 1201 1203 struct cyclades_card *card = info->card; 1202 1204 int retval; 1203 1205 __u32 channel = info->line - card->first_line; ··· 3095 3097 else 3096 3098 info->xmit_fifo_size = 4 * CYZ_FIFO_SIZE; 3097 3099 #ifdef CONFIG_CYZ_INTR 3098 - setup_timer(&cyz_rx_full_timer[port], 3099 - cyz_rx_restart, (unsigned long)info); 3100 + timer_setup(&info->rx_full_timer, cyz_rx_restart, 0); 3100 3101 #endif 3101 3102 } else { 3102 3103 unsigned short chip_number;
+3 -6
drivers/tty/ehv_bytechan.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* ePAPR hypervisor byte channel device driver 2 3 * 3 4 * Copyright 2009-2011 Freescale Semiconductor, Inc. 4 5 * 5 6 * Author: Timur Tabi <timur@freescale.com> 6 - * 7 - * This file is licensed under the terms of the GNU General Public License 8 - * version 2. This program is licensed "as is" without any warranty of any 9 - * kind, whether express or implied. 10 7 * 11 8 * This driver support three distinct interfaces, all of which are related to 12 9 * ePAPR hypervisor byte channels. ··· 325 328 /******************************** TTY DRIVER ********************************/ 326 329 327 330 /* 328 - * byte channel receive interupt handler 331 + * byte channel receive interrupt handler 329 332 * 330 333 * This ISR is called whenever data is available on a byte channel. 331 334 */ ··· 425 428 } 426 429 427 430 /* 428 - * byte channel transmit interupt handler 431 + * byte channel transmit interrupt handler 429 432 * 430 433 * This ISR is called whenever space becomes available for transmitting 431 434 * characters on a byte channel.
+1 -10
drivers/tty/goldfish.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (C) 2007 Google, Inc. 3 4 * Copyright (C) 2012 Intel, Inc. 4 5 * Copyright (C) 2017 Imagination Technologies Ltd. 5 - * 6 - * This software is licensed under the terms of the GNU General Public 7 - * License version 2, as published by the Free Software Foundation, and 8 - * may be copied, distributed, and modified under those terms. 9 - * 10 - * This program is distributed in the hope that it will be useful, 11 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 - * GNU General Public License for more details. 14 - * 15 6 */ 16 7 17 8 #include <linux/console.h>
+1 -2
drivers/tty/hvc/hvc_bfin_jtag.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Console via Blackfin JTAG Communication 3 4 * 4 5 * Copyright 2008-2011 Analog Devices Inc. 5 6 * 6 7 * Enter bugs at http://blackfin.uclinux.org/ 7 - * 8 - * Licensed under the GPL-2 or later. 9 8 */ 10 9 11 10 #include <linux/console.h>
+1 -14
drivers/tty/hvc/hvc_console.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2001 Anton Blanchard <anton@au.ibm.com>, IBM 3 4 * Copyright (C) 2001 Paul Mackerras <paulus@au.ibm.com>, IBM ··· 7 6 * 8 7 * Additional Author(s): 9 8 * Ryan S. Arnold <rsa@us.ibm.com> 10 - * 11 - * This program is free software; you can redistribute it and/or modify 12 - * it under the terms of the GNU General Public License as published by 13 - * the Free Software Foundation; either version 2 of the License, or 14 - * (at your option) any later version. 15 - * 16 - * This program is distributed in the hope that it will be useful, 17 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 - * GNU General Public License for more details. 20 - * 21 - * You should have received a copy of the GNU General Public License 22 - * along with this program; if not, write to the Free Software 23 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 9 */ 25 10 26 11 #include <linux/console.h>
+1 -14
drivers/tty/hvc/hvc_console.h
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * hvc_console.h 3 4 * Copyright (C) 2005 IBM Corporation ··· 9 8 * hvc_console header information: 10 9 * moved here from arch/powerpc/include/asm/hvconsole.h 11 10 * and drivers/char/hvc_console.c 12 - * 13 - * This program is free software; you can redistribute it and/or modify 14 - * it under the terms of the GNU General Public License as published by 15 - * the Free Software Foundation; either version 2 of the License, or 16 - * (at your option) any later version. 17 - * 18 - * This program is distributed in the hope that it will be useful, 19 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 - * GNU General Public License for more details. 22 - * 23 - * You should have received a copy of the GNU General Public License 24 - * along with this program; if not, write to the Free Software 25 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 26 11 */ 27 12 28 13 #ifndef HVC_CONSOLE_H
+2 -11
drivers/tty/hvc/hvc_dcc.c
··· 1 - /* Copyright (c) 2010, 2014 The Linux Foundation. All rights reserved. 2 - * 3 - * This program is free software; you can redistribute it and/or modify 4 - * it under the terms of the GNU General Public License version 2 and 5 - * only version 2 as published by the Free Software Foundation. 6 - * 7 - * This program is distributed in the hope that it will be useful, 8 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 - * GNU General Public License for more details. 11 - */ 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* Copyright (c) 2010, 2014 The Linux Foundation. All rights reserved. */ 12 3 13 4 #include <linux/init.h> 14 5
+1 -15
drivers/tty/hvc/hvc_opal.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * opal driver interface to hvc_console.c 3 4 * 4 5 * Copyright 2011 Benjamin Herrenschmidt <benh@kernel.crashing.org>, IBM Corp. 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License as published by 8 - * the Free Software Foundation; either version 2 of the License, or 9 - * (at your option) any later version. 10 - * 11 - * This program is distributed in the hope that it will be useful, 12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - * GNU General Public License for more details. 15 - * 16 - * You should have received a copy of the GNU General Public License 17 - * along with this program; if not, write to the Free Software 18 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 - * 20 6 */ 21 7 22 8 #undef DEBUG
+1 -14
drivers/tty/hvc/hvc_rtas.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * IBM RTAS driver interface to hvc_console.c 3 4 * ··· 12 11 * 13 12 * inspired by drivers/char/hvc_console.c 14 13 * written by Anton Blanchard and Paul Mackerras 15 - * 16 - * This program is free software; you can redistribute it and/or modify 17 - * it under the terms of the GNU General Public License as published by 18 - * the Free Software Foundation; either version 2 of the License, or 19 - * (at your option) any later version. 20 - * 21 - * This program is distributed in the hope that it will be useful, 22 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 23 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 24 - * GNU General Public License for more details. 25 - * 26 - * You should have received a copy of the GNU General Public License 27 - * along with this program; if not, write to the Free Software 28 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 29 14 */ 30 15 31 16 #include <linux/console.h>
+1 -10
drivers/tty/hvc/hvc_tile.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright 2010 Tilera Corporation. All Rights Reserved. 3 - * 4 - * This program is free software; you can redistribute it and/or 5 - * modify it under the terms of the GNU General Public License 6 - * as published by the Free Software Foundation, version 2. 7 - * 8 - * This program is distributed in the hope that it will be useful, but 9 - * WITHOUT ANY WARRANTY; without even the implied warranty of 10 - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or 11 - * NON INFRINGEMENT. See the GNU General Public License for 12 - * more details. 13 4 * 14 5 * Tilera TILE Processor hypervisor console 15 6 */
+1 -14
drivers/tty/hvc/hvc_udbg.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * udbg interface to hvc_console.c 3 4 * 4 5 * (C) Copyright David Gibson, IBM Corporation 2008. 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License as published by 8 - * the Free Software Foundation; either version 2 of the License, or 9 - * (at your option) any later version. 10 - * 11 - * This program is distributed in the hope that it will be useful, 12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - * GNU General Public License for more details. 15 - * 16 - * You should have received a copy of the GNU General Public License 17 - * along with this program; if not, write to the Free Software 18 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 6 */ 20 7 21 8 #include <linux/console.h>
+1 -14
drivers/tty/hvc/hvc_vio.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * vio driver interface to hvc_console.c 3 4 * ··· 14 13 * 15 14 * Additional Author(s): 16 15 * Ryan S. Arnold <rsa@us.ibm.com> 17 - * 18 - * This program is free software; you can redistribute it and/or modify 19 - * it under the terms of the GNU General Public License as published by 20 - * the Free Software Foundation; either version 2 of the License, or 21 - * (at your option) any later version. 22 - * 23 - * This program is distributed in the hope that it will be useful, 24 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 25 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 - * GNU General Public License for more details. 27 - * 28 - * You should have received a copy of the GNU General Public License 29 - * along with this program; if not, write to the Free Software 30 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 31 16 * 32 17 * TODO: 33 18 *
+1 -14
drivers/tty/hvc/hvc_xen.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * xen console driver interface to hvc_console.c 3 4 * 4 5 * (c) 2007 Gerd Hoffmann <kraxel@suse.de> 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License as published by 8 - * the Free Software Foundation; either version 2 of the License, or 9 - * (at your option) any later version. 10 - * 11 - * This program is distributed in the hope that it will be useful, 12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - * GNU General Public License for more details. 15 - * 16 - * You should have received a copy of the GNU General Public License 17 - * along with this program; if not, write to the Free Software 18 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 6 */ 20 7 21 8 #include <linux/console.h>
+1 -14
drivers/tty/hvc/hvcs.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * IBM eServer Hypervisor Virtual Console Server Device Driver 3 4 * Copyright (C) 2003, 2004 IBM Corp. 4 5 * Ryan S. Arnold (rsa@us.ibm.com) 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License as published by 8 - * the Free Software Foundation; either version 2 of the License, or 9 - * (at your option) any later version. 10 - * 11 - * This program is distributed in the hope that it will be useful, 12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - * GNU General Public License for more details. 15 - * 16 - * You should have received a copy of the GNU General Public License 17 - * along with this program; if not, write to the Free Software 18 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 6 * 20 7 * Author(s) : Ryan S. Arnold <rsa@us.ibm.com> 21 8 *
+1 -14
drivers/tty/hvc/hvsi.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2004 Hollis Blanchard <hollisb@us.ibm.com>, IBM 3 - * 4 - * This program is free software; you can redistribute it and/or modify 5 - * it under the terms of the GNU General Public License as published by 6 - * the Free Software Foundation; either version 2 of the License, or 7 - * (at your option) any later version. 8 - * 9 - * This program is distributed in the hope that it will be useful, 10 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 - * GNU General Public License for more details. 13 - * 14 - * You should have received a copy of the GNU General Public License 15 - * along with this program; if not, write to the Free Software 16 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 4 */ 18 5 19 6 /* Host Virtual Serial Interface (HVSI) is a protocol between the hosted OS
+1
drivers/tty/ipwireless/main.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * IPWireless 3G PCMCIA Network Driver 3 4 *
+1 -5
drivers/tty/isicom.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 - * This program is free software; you can redistribute it and/or 3 - * modify it under the terms of the GNU General Public License 4 - * as published by the Free Software Foundation; either version 5 - * 2 of the License, or (at your option) any later version. 6 - * 7 3 * Original driver code supplied by Multi-Tech 8 4 * 9 5 * Changes
+6 -10
drivers/tty/metag_da.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * dashtty.c - tty driver for Dash channels interface. 3 4 * 4 5 * Copyright (C) 2007,2008,2012 Imagination Technologies 5 - * 6 - * This file is subject to the terms and conditions of the GNU General Public 7 - * License. See the file COPYING in the main directory of this archive 8 - * for more details. 9 - * 10 6 */ 11 7 12 8 #include <linux/atomic.h> ··· 305 309 /* 306 310 * This gets called every DA_TTY_POLL and polls the channels for data 307 311 */ 308 - static void dashtty_timer(unsigned long ignored) 312 + static void dashtty_timer(struct timer_list *poll_timer) 309 313 { 310 314 int channel; 311 315 ··· 319 323 if (channel >= 0) 320 324 fetch_data(channel); 321 325 322 - mod_timer(&poll_timer, jiffies + DA_TTY_POLL); 326 + mod_timer(poll_timer, jiffies + DA_TTY_POLL); 323 327 } 324 328 325 329 static void add_poll_timer(struct timer_list *poll_timer) 326 330 { 327 - setup_pinned_timer(poll_timer, dashtty_timer, 0); 331 + timer_setup(poll_timer, dashtty_timer, TIMER_PINNED); 328 332 poll_timer->expires = jiffies + DA_TTY_POLL; 329 333 330 334 /* ··· 457 461 * buffers. It is used to delay the expensive writeout until the writer has 458 462 * stopped writing. 459 463 */ 460 - static void dashtty_put_timer(unsigned long ignored) 464 + static void dashtty_put_timer(struct timer_list *unused) 461 465 { 462 466 if (atomic_read(&dashtty_xmit_cnt)) 463 467 wake_up_interruptible(&dashtty_waitqueue); ··· 599 603 complete(&dport->xmit_empty); 600 604 } 601 605 602 - setup_timer(&put_timer, dashtty_put_timer, 0); 606 + timer_setup(&put_timer, dashtty_put_timer, 0); 603 607 604 608 init_waitqueue_head(&dashtty_waitqueue); 605 609 dashtty_thread = kthread_create(put_data, NULL, "ttyDA");
+5 -8
drivers/tty/mips_ejtag_fdc.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * TTY driver for MIPS EJTAG Fast Debug Channels. 3 4 * 4 5 * Copyright (C) 2007-2015 Imagination Technologies Ltd 5 - * 6 - * This file is subject to the terms and conditions of the GNU General Public 7 - * License. See the file COPYING in the main directory of this archive for more 8 - * details. 9 6 */ 10 7 11 8 #include <linux/atomic.h> ··· 680 683 * It simply triggers the common FDC handler code and arranges for further 681 684 * polling. 682 685 */ 683 - static void mips_ejtag_fdc_tty_timer(unsigned long opaque) 686 + static void mips_ejtag_fdc_tty_timer(struct timer_list *t) 684 687 { 685 - struct mips_ejtag_fdc_tty *priv = (void *)opaque; 688 + struct mips_ejtag_fdc_tty *priv = from_timer(priv, t, poll_timer); 686 689 687 690 mips_ejtag_fdc_handle(priv); 688 691 if (!priv->removing) ··· 999 1002 raw_spin_unlock_irq(&priv->lock); 1000 1003 } else { 1001 1004 /* If we didn't get an usable IRQ, poll instead */ 1002 - setup_pinned_timer(&priv->poll_timer, mips_ejtag_fdc_tty_timer, 1003 - (unsigned long)priv); 1005 + timer_setup(&priv->poll_timer, mips_ejtag_fdc_tty_timer, 1006 + TIMER_PINNED); 1004 1007 priv->poll_timer.expires = jiffies + FDC_TTY_POLL; 1005 1008 /* 1006 1009 * Always attach the timer to the right CPU. The channels are
+1 -5
drivers/tty/moxa.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /*****************************************************************************/ 2 3 /* 3 4 * moxa.c -- MOXA Intellio family multiport serial driver. ··· 8 7 * 9 8 * This code is loosely based on the Linux serial driver, written by 10 9 * Linus Torvalds, Theodore T'so and others. 11 - * 12 - * This program is free software; you can redistribute it and/or modify 13 - * it under the terms of the GNU General Public License as published by 14 - * the Free Software Foundation; either version 2 of the License, or 15 - * (at your option) any later version. 16 10 */ 17 11 18 12 /*
+8 -14
drivers/tty/mxser.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * mxser.c -- MOXA Smartio/Industio family multiport serial driver. 3 4 * ··· 8 7 * This code is loosely based on the 1.8 moxa driver which is based on 9 8 * Linux serial driver, written by Linus Torvalds, Theodore T'so and 10 9 * others. 11 - * 12 - * This program is free software; you can redistribute it and/or modify 13 - * it under the terms of the GNU General Public License as published by 14 - * the Free Software Foundation; either version 2 of the License, or 15 - * (at your option) any later version. 16 10 * 17 11 * Fed through a cleanup, indent and remove of non 2.6 code by Alan Cox 18 12 * <alan@lxorguk.ukuu.org.uk>. The original 1.8 code is available on ··· 638 642 * This routine is called to set the UART divisor registers to match 639 643 * the specified baud rate for a serial port. 640 644 */ 641 - static int mxser_change_speed(struct tty_struct *tty, 642 - struct ktermios *old_termios) 645 + static int mxser_change_speed(struct tty_struct *tty) 643 646 { 644 647 struct mxser_port *info = tty->driver_data; 645 648 unsigned cflag, cval, fcr; ··· 940 945 /* 941 946 * and set the speed of the serial port 942 947 */ 943 - mxser_change_speed(tty, NULL); 948 + mxser_change_speed(tty); 944 949 spin_unlock_irqrestore(&info->slock, flags); 945 950 946 951 return 0; ··· 1283 1288 if (tty_port_initialized(port)) { 1284 1289 if (flags != (port->flags & ASYNC_SPD_MASK)) { 1285 1290 spin_lock_irqsave(&info->slock, sl_flags); 1286 - mxser_change_speed(tty, NULL); 1291 + mxser_change_speed(tty); 1287 1292 spin_unlock_irqrestore(&info->slock, sl_flags); 1288 1293 } 1289 1294 } else { ··· 1941 1946 unsigned long flags; 1942 1947 1943 1948 spin_lock_irqsave(&info->slock, flags); 1944 - mxser_change_speed(tty, old_termios); 1949 + mxser_change_speed(tty); 1945 1950 spin_unlock_irqrestore(&info->slock, flags); 1946 1951 1947 1952 if ((old_termios->c_cflag & CRTSCTS) && !C_CRTSCTS(tty)) { ··· 2370 2375 mxser_release_vector(brd); 2371 2376 } 2372 2377 2373 - static int mxser_initbrd(struct mxser_board *brd, 2374 - struct pci_dev *pdev) 2378 + static int mxser_initbrd(struct mxser_board *brd) 2375 2379 { 2376 2380 struct mxser_port *info; 2377 2381 unsigned int i; ··· 2634 2640 } 2635 2641 2636 2642 /* mxser_initbrd will hook ISR. */ 2637 - retval = mxser_initbrd(brd, pdev); 2643 + retval = mxser_initbrd(brd); 2638 2644 if (retval) 2639 2645 goto err_rel3; 2640 2646 ··· 2740 2746 brd->info->name, ioaddr[b]); 2741 2747 2742 2748 /* mxser_initbrd will hook ISR. */ 2743 - if (mxser_initbrd(brd, NULL) < 0) { 2749 + if (mxser_initbrd(brd) < 0) { 2744 2750 mxser_release_ISA_res(brd); 2745 2751 brd->info = NULL; 2746 2752 continue;
+2 -16
drivers/tty/n_gsm.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * n_gsm.c GSM 0710 tty multiplexor 3 4 * Copyright (c) 2009/10 Intel Corporation 4 - * 5 - * This program is free software; you can redistribute it and/or modify 6 - * it under the terms of the GNU General Public License version 2 as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it will be useful, 10 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 - * GNU General Public License for more details. 13 - * 14 - * You should have received a copy of the GNU General Public License 15 - * along with this program; if not, write to the Free Software 16 - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 17 5 * 18 6 * * THIS IS A DEVELOPMENT SNAPSHOT IT IS NOT A FINAL RELEASE * 19 7 * ··· 1634 1646 } 1635 1647 1636 1648 skb_queue_head_init(&dlci->skb_list); 1637 - init_timer(&dlci->t1); 1638 - dlci->t1.function = gsm_dlci_t1; 1639 - dlci->t1.data = (unsigned long)dlci; 1649 + setup_timer(&dlci->t1, gsm_dlci_t1, (unsigned long)dlci); 1640 1650 tty_port_init(&dlci->port); 1641 1651 dlci->port.ops = &gsm_port_ops; 1642 1652 dlci->gsm = gsm;
+1 -2
drivers/tty/n_hdlc.c
··· 1 + // SPDX-License-Identifier: GPL-1.0+ 1 2 /* generic HDLC line discipline for Linux 2 3 * 3 4 * Written by Paul Fulghum paulkf@microgate.com ··· 11 10 * Paul Mackerras <Paul.Mackerras@cs.anu.edu.au> 12 11 * 13 12 * Original release 01/11/99 14 - * 15 - * This code is released under the GNU General Public License (GPL) 16 13 * 17 14 * This module implements the tty line discipline N_HDLC for use with 18 15 * tty device drivers that support bit-synchronous HDLC communications.
+1 -13
drivers/tty/n_null.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 #include <linux/types.h> 2 3 #include <linux/errno.h> 3 4 #include <linux/tty.h> ··· 8 7 * n_null.c - Null line discipline used in the failure path 9 8 * 10 9 * Copyright (C) Intel 2017 11 - * 12 - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 13 - * 14 - * This program is free software; you can redistribute it and/or modify 15 - * it under the terms of the GNU General Public License version 2 16 - * as published by the Free Software Foundation. 17 - * 18 - * This program is distributed in the hope that it will be useful, 19 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 - * GNU General Public License for more details. 22 - * 23 - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 24 10 */ 25 11 26 12 static int n_null_open(struct tty_struct *tty)
+1 -3
drivers/tty/n_r3964.c
··· 1 + // SPDX-License-Identifier: GPL-1.0+ 1 2 /* r3964 linediscipline for linux 2 3 * 3 4 * ----------------------------------------------------------- ··· 6 5 * Philips Automation Projects 7 6 * Kassel (Germany) 8 7 * ----------------------------------------------------------- 9 - * This software may be used and distributed according to the terms of 10 - * the GNU General Public License, incorporated herein by reference. 11 - * 12 8 * Author: 13 9 * L. Haag 14 10 *
+1 -11
drivers/tty/n_tracerouter.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * n_tracerouter.c - Trace data router through tty space 3 4 * 4 5 * Copyright (C) Intel 2011 5 - * 6 - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 7 - * 8 - * This program is free software; you can redistribute it and/or modify 9 - * it under the terms of the GNU General Public License version 2 10 - * as published by the Free Software Foundation. 11 - * 12 - * This program is distributed in the hope that it will be useful, 13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 - * GNU General Public License for more details. 16 6 * 17 7 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 18 8 *
+1 -11
drivers/tty/n_tracesink.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * n_tracesink.c - Trace data router and sink path through tty space. 3 4 * 4 5 * Copyright (C) Intel 2011 5 - * 6 - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 7 - * 8 - * This program is free software; you can redistribute it and/or modify 9 - * it under the terms of the GNU General Public License version 2 10 - * as published by the Free Software Foundation. 11 - * 12 - * This program is distributed in the hope that it will be useful, 13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 - * GNU General Public License for more details. 16 6 * 17 7 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 18 8 *
+1 -11
drivers/tty/n_tracesink.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * n_tracesink.h - Kernel driver API to route trace data in kernel space. 3 4 * 4 5 * Copyright (C) Intel 2011 5 - * 6 - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 7 - * 8 - * This program is free software; you can redistribute it and/or modify 9 - * it under the terms of the GNU General Public License version 2 10 - * as published by the Free Software Foundation. 11 - * 12 - * This program is distributed in the hope that it will be useful, 13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 - * GNU General Public License for more details. 16 6 * 17 7 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 18 8 *
+1 -3
drivers/tty/n_tty.c
··· 1 + // SPDX-License-Identifier: GPL-1.0+ 1 2 /* 2 3 * n_tty.c --- implements the N_TTY line discipline. 3 4 * ··· 15 14 * 16 15 * This file also contains code originally written by Linus Torvalds, 17 16 * Copyright 1991, 1992, 1993, and by Julian Cowley, Copyright 1994. 18 - * 19 - * This file may be redistributed under the terms of the GNU General Public 20 - * License. 21 17 * 22 18 * Reduced memory usage for older ARM systems - Russell King. 23 19 *
+1 -14
drivers/tty/nozomi.c
··· 1 + // SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) 1 2 /* 2 3 * nozomi.c -- HSDPA driver Broadband Wireless Data Card - Globe Trotter 3 4 * ··· 21 20 * Copyright (c) 2006 Sphere Systems Ltd 22 21 * Copyright (c) 2006 Option Wireless n/v 23 22 * All rights Reserved. 24 - * 25 - * This program is free software; you can redistribute it and/or modify 26 - * it under the terms of the GNU General Public License as published by 27 - * the Free Software Foundation; either version 2 of the License, or 28 - * (at your option) any later version. 29 - * 30 - * This program is distributed in the hope that it will be useful, 31 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 32 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 33 - * GNU General Public License for more details. 34 - * 35 - * You should have received a copy of the GNU General Public License 36 - * along with this program; if not, write to the Free Software 37 - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 38 23 * 39 24 * -------------------------------------------------------------------------- 40 25 */
+1 -14
drivers/tty/rocket.c
··· 1 + // SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) 1 2 /* 2 3 * RocketPort device driver for Linux 3 4 * 4 5 * Written by Theodore Ts'o, 1995, 1996, 1997, 1998, 1999, 2000. 5 6 * 6 7 * Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2003 by Comtrol, Inc. 7 - * 8 - * This program is free software; you can redistribute it and/or 9 - * modify it under the terms of the GNU General Public License as 10 - * published by the Free Software Foundation; either version 2 of the 11 - * License, or (at your option) any later version. 12 - * 13 - * This program is distributed in the hope that it will be useful, but 14 - * WITHOUT ANY WARRANTY; without even the implied warranty of 15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 - * General Public License for more details. 17 - * 18 - * You should have received a copy of the GNU General Public License 19 - * along with this program; if not, write to the Free Software 20 - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 8 */ 22 9 23 10 /*
+8
drivers/tty/serdev/Kconfig
··· 6 6 help 7 7 Core support for devices connected via a serial port. 8 8 9 + Note that you typically also want to enable TTY port controller support. 10 + 9 11 if SERIAL_DEV_BUS 10 12 11 13 config SERIAL_DEV_CTRL_TTYPORT 12 14 bool "Serial device TTY port controller" 15 + help 16 + Say Y here if you want to use the Serial device bus with common TTY 17 + drivers (e.g. serial drivers). 18 + 19 + If unsure, say Y. 13 20 depends on TTY 14 21 depends on SERIAL_DEV_BUS != m 22 + default y 15 23 16 24 endif
+126 -26
drivers/tty/serdev/core.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (C) 2016-2017 Linaro Ltd., Rob Herring <robh@kernel.org> 3 4 * 4 5 * Based on drivers/spmi/spmi.c: 5 6 * Copyright (c) 2012-2015, The Linux Foundation. All rights reserved. 6 - * 7 - * This program is free software; you can redistribute it and/or modify 8 - * it under the terms of the GNU General Public License version 2 and 9 - * only version 2 as published by the Free Software Foundation. 10 - * 11 - * This program is distributed in the hope that it will be useful, 12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - * GNU General Public License for more details. 15 7 */ 16 8 9 + #include <linux/acpi.h> 17 10 #include <linux/errno.h> 18 11 #include <linux/idr.h> 19 12 #include <linux/kernel.h> ··· 42 49 43 50 static int serdev_device_match(struct device *dev, struct device_driver *drv) 44 51 { 45 - /* TODO: ACPI and platform matching */ 52 + /* TODO: platform matching */ 53 + if (acpi_driver_match_device(dev, drv)) 54 + return 1; 55 + 46 56 return of_driver_match_device(dev, drv); 47 57 } 48 58 49 59 static int serdev_uevent(struct device *dev, struct kobj_uevent_env *env) 50 60 { 51 - /* TODO: ACPI and platform modalias */ 61 + int rc; 62 + 63 + /* TODO: platform modalias */ 64 + rc = acpi_device_uevent_modalias(dev, env); 65 + if (rc != -ENODEV) 66 + return rc; 67 + 52 68 return of_device_uevent_modalias(dev, env); 53 69 } 54 70 ··· 67 65 */ 68 66 int serdev_device_add(struct serdev_device *serdev) 69 67 { 68 + struct serdev_controller *ctrl = serdev->ctrl; 70 69 struct device *parent = serdev->dev.parent; 71 70 int err; 72 71 73 72 dev_set_name(&serdev->dev, "%s-%d", dev_name(parent), serdev->nr); 74 73 74 + /* Only a single slave device is currently supported. */ 75 + if (ctrl->serdev) { 76 + dev_err(&serdev->dev, "controller busy\n"); 77 + return -EBUSY; 78 + } 79 + ctrl->serdev = serdev; 80 + 75 81 err = device_add(&serdev->dev); 76 82 if (err < 0) { 77 83 dev_err(&serdev->dev, "Can't add %s, status %d\n", 78 84 dev_name(&serdev->dev), err); 79 - goto err_device_add; 85 + goto err_clear_serdev; 80 86 } 81 87 82 88 dev_dbg(&serdev->dev, "device %s registered\n", dev_name(&serdev->dev)); 83 89 84 - err_device_add: 90 + return 0; 91 + 92 + err_clear_serdev: 93 + ctrl->serdev = NULL; 85 94 return err; 86 95 } 87 96 EXPORT_SYMBOL_GPL(serdev_device_add); ··· 103 90 */ 104 91 void serdev_device_remove(struct serdev_device *serdev) 105 92 { 93 + struct serdev_controller *ctrl = serdev->ctrl; 94 + 106 95 device_unregister(&serdev->dev); 96 + ctrl->serdev = NULL; 107 97 } 108 98 EXPORT_SYMBOL_GPL(serdev_device_remove); 109 99 ··· 276 260 static ssize_t modalias_show(struct device *dev, 277 261 struct device_attribute *attr, char *buf) 278 262 { 263 + int len; 264 + 265 + len = acpi_device_modalias(dev, buf, PAGE_SIZE - 1); 266 + if (len != -ENODEV) 267 + return len; 268 + 279 269 return of_device_modalias(dev, buf, PAGE_SIZE); 280 270 } 281 271 DEVICE_ATTR_RO(modalias); ··· 317 295 return NULL; 318 296 319 297 serdev->ctrl = ctrl; 320 - ctrl->serdev = serdev; 321 298 device_initialize(&serdev->dev); 322 299 serdev->dev.parent = &ctrl->dev; 323 300 serdev->dev.bus = &serdev_bus_type; ··· 350 329 if (!ctrl) 351 330 return NULL; 352 331 332 + id = ida_simple_get(&ctrl_ida, 0, 0, GFP_KERNEL); 333 + if (id < 0) { 334 + dev_err(parent, 335 + "unable to allocate serdev controller identifier.\n"); 336 + goto err_free; 337 + } 338 + 339 + ctrl->nr = id; 340 + 353 341 device_initialize(&ctrl->dev); 354 342 ctrl->dev.type = &serdev_ctrl_type; 355 343 ctrl->dev.bus = &serdev_bus_type; ··· 366 336 ctrl->dev.of_node = parent->of_node; 367 337 serdev_controller_set_drvdata(ctrl, &ctrl[1]); 368 338 369 - id = ida_simple_get(&ctrl_ida, 0, 0, GFP_KERNEL); 370 - if (id < 0) { 371 - dev_err(parent, 372 - "unable to allocate serdev controller identifier.\n"); 373 - serdev_controller_put(ctrl); 374 - return NULL; 375 - } 376 - 377 - ctrl->nr = id; 378 339 dev_set_name(&ctrl->dev, "serial%d", id); 379 340 380 341 dev_dbg(&ctrl->dev, "allocated controller 0x%p id %d\n", ctrl, id); 381 342 return ctrl; 343 + 344 + err_free: 345 + kfree(ctrl); 346 + 347 + return NULL; 382 348 } 383 349 EXPORT_SYMBOL_GPL(serdev_controller_alloc); 384 350 ··· 411 385 return 0; 412 386 } 413 387 388 + #ifdef CONFIG_ACPI 389 + static acpi_status acpi_serdev_register_device(struct serdev_controller *ctrl, 390 + struct acpi_device *adev) 391 + { 392 + struct serdev_device *serdev = NULL; 393 + int err; 394 + 395 + if (acpi_bus_get_status(adev) || !adev->status.present || 396 + acpi_device_enumerated(adev)) 397 + return AE_OK; 398 + 399 + serdev = serdev_device_alloc(ctrl); 400 + if (!serdev) { 401 + dev_err(&ctrl->dev, "failed to allocate serdev device for %s\n", 402 + dev_name(&adev->dev)); 403 + return AE_NO_MEMORY; 404 + } 405 + 406 + ACPI_COMPANION_SET(&serdev->dev, adev); 407 + acpi_device_set_enumerated(adev); 408 + 409 + err = serdev_device_add(serdev); 410 + if (err) { 411 + dev_err(&serdev->dev, 412 + "failure adding ACPI serdev device. status %d\n", err); 413 + serdev_device_put(serdev); 414 + } 415 + 416 + return AE_OK; 417 + } 418 + 419 + static acpi_status acpi_serdev_add_device(acpi_handle handle, u32 level, 420 + void *data, void **return_value) 421 + { 422 + struct serdev_controller *ctrl = data; 423 + struct acpi_device *adev; 424 + 425 + if (acpi_bus_get_device(handle, &adev)) 426 + return AE_OK; 427 + 428 + return acpi_serdev_register_device(ctrl, adev); 429 + } 430 + 431 + static int acpi_serdev_register_devices(struct serdev_controller *ctrl) 432 + { 433 + acpi_status status; 434 + acpi_handle handle; 435 + 436 + handle = ACPI_HANDLE(ctrl->dev.parent); 437 + if (!handle) 438 + return -ENODEV; 439 + 440 + status = acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, 1, 441 + acpi_serdev_add_device, NULL, ctrl, NULL); 442 + if (ACPI_FAILURE(status)) 443 + dev_dbg(&ctrl->dev, "failed to enumerate serdev slaves\n"); 444 + 445 + if (!ctrl->serdev) 446 + return -ENODEV; 447 + 448 + return 0; 449 + } 450 + #else 451 + static inline int acpi_serdev_register_devices(struct serdev_controller *ctrl) 452 + { 453 + return -ENODEV; 454 + } 455 + #endif /* CONFIG_ACPI */ 456 + 414 457 /** 415 458 * serdev_controller_add() - Add an serdev controller 416 459 * @ctrl: controller to be registered. ··· 489 394 */ 490 395 int serdev_controller_add(struct serdev_controller *ctrl) 491 396 { 492 - int ret; 397 + int ret_of, ret_acpi, ret; 493 398 494 399 /* Can't register until after driver model init */ 495 400 if (WARN_ON(!is_registered)) ··· 499 404 if (ret) 500 405 return ret; 501 406 502 - ret = of_serdev_register_devices(ctrl); 503 - if (ret) 407 + ret_of = of_serdev_register_devices(ctrl); 408 + ret_acpi = acpi_serdev_register_devices(ctrl); 409 + if (ret_of && ret_acpi) { 410 + dev_dbg(&ctrl->dev, "no devices registered: of:%d acpi:%d\n", 411 + ret_of, ret_acpi); 412 + ret = -ENODEV; 504 413 goto out_dev_del; 414 + } 505 415 506 416 dev_dbg(&ctrl->dev, "serdev%d registered: dev:%p\n", 507 417 ctrl->nr, &ctrl->dev);
+18 -13
drivers/tty/serdev/serdev-ttyport.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (C) 2016-2017 Linaro Ltd., Rob Herring <robh@kernel.org> 3 - * 4 - * This program is free software; you can redistribute it and/or modify 5 - * it under the terms of the GNU General Public License version 2 and 6 - * only version 2 as published by the Free Software Foundation. 7 - * 8 - * This program is distributed in the hope that it will be useful, 9 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 - * GNU General Public License for more details. 12 4 */ 13 5 #include <linux/kernel.h> 14 6 #include <linux/serdev.h> ··· 88 96 struct serport *serport = serdev_controller_get_drvdata(ctrl); 89 97 struct tty_struct *tty; 90 98 struct ktermios ktermios; 99 + int ret; 91 100 92 101 tty = tty_init_dev(serport->tty_drv, serport->tty_idx); 93 102 if (IS_ERR(tty)) 94 103 return PTR_ERR(tty); 95 104 serport->tty = tty; 96 105 97 - if (tty->ops->open) 98 - tty->ops->open(serport->tty, NULL); 99 - else 100 - tty_port_open(serport->port, tty, NULL); 106 + if (!tty->ops->open || !tty->ops->close) { 107 + ret = -ENODEV; 108 + goto err_unlock; 109 + } 110 + 111 + ret = tty->ops->open(serport->tty, NULL); 112 + if (ret) 113 + goto err_close; 101 114 102 115 /* Bring the UART into a known 8 bits no parity hw fc state */ 103 116 ktermios = tty->termios; ··· 119 122 120 123 tty_unlock(serport->tty); 121 124 return 0; 125 + 126 + err_close: 127 + tty->ops->close(tty, NULL); 128 + err_unlock: 129 + tty_unlock(tty); 130 + tty_release_struct(tty, serport->tty_idx); 131 + 132 + return ret; 122 133 } 123 134 124 135 static void ttyport_close(struct serdev_controller *ctrl)
+1
drivers/tty/serial/21285.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Driver for the serial port on the 21285 StrongArm-110 core logic chip. 3 4 *
+1 -5
drivers/tty/serial/8250/8250.h
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Driver for 8250/16550-type serial ports 3 4 * 4 5 * Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o. 5 6 * 6 7 * Copyright (C) 2001 Russell King. 7 - * 8 - * This program is free software; you can redistribute it and/or modify 9 - * it under the terms of the GNU General Public License as published by 10 - * the Free Software Foundation; either version 2 of the License, or 11 - * (at your option) any later version. 12 8 */ 13 9 14 10 #include <linux/serial_8250.h>
+1 -4
drivers/tty/serial/8250/8250_accent.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (C) 2005 Russell King. 3 4 * Data taken from include/asm-i386/serial.h 4 - * 5 - * This program is free software; you can redistribute it and/or modify 6 - * it under the terms of the GNU General Public License version 2 as 7 - * published by the Free Software Foundation. 8 5 */ 9 6 #include <linux/module.h> 10 7 #include <linux/init.h>
+1 -4
drivers/tty/serial/8250/8250_acorn.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * linux/drivers/serial/acorn.c 3 4 * 4 5 * Copyright (C) 1996-2003 Russell King. 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License version 2 as 8 - * published by the Free Software Foundation. 9 6 */ 10 7 #include <linux/module.h> 11 8 #include <linux/types.h>
+1 -5
drivers/tty/serial/8250/8250_aspeed_vuart.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Serial Port driver for Aspeed VUART device 3 4 * 4 5 * Copyright (C) 2016 Jeremy Kerr <jk@ozlabs.org>, IBM Corp. 5 6 * Copyright (C) 2006 Arnd Bergmann <arnd@arndb.de>, IBM Corp. 6 - * 7 - * This program is free software; you can redistribute it and/or 8 - * modify it under the terms of the GNU General Public License 9 - * as published by the Free Software Foundation; either version 10 - * 2 of the License, or (at your option) any later version. 11 7 */ 12 8 #include <linux/device.h> 13 9 #include <linux/module.h>
+1 -5
drivers/tty/serial/8250/8250_bcm2835aux.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Serial port driver for BCM2835AUX UART 3 4 * ··· 6 5 * 7 6 * Based on 8250_lpc18xx.c: 8 7 * Copyright (C) 2015 Joachim Eastwood <manabian@gmail.com> 9 - * 10 - * This program is free software; you can redistribute it and/or modify 11 - * it under the terms of the GNU General Public License version 2 as 12 - * published by the Free Software Foundation. 13 - * 14 8 */ 15 9 16 10 #include <linux/clk.h>
+1 -4
drivers/tty/serial/8250/8250_boca.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (C) 2005 Russell King. 3 4 * Data taken from include/asm-i386/serial.h 4 - * 5 - * This program is free software; you can redistribute it and/or modify 6 - * it under the terms of the GNU General Public License version 2 as 7 - * published by the Free Software Foundation. 8 5 */ 9 6 #include <linux/module.h> 10 7 #include <linux/init.h>
+8 -15
drivers/tty/serial/8250/8250_core.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Universal/legacy driver for 8250/16550-type serial ports 3 4 * ··· 12 11 * userspace-configurable "phantom" ports 13 12 * "serial8250" platform devices 14 13 * serial8250_register_8250_port() ports 15 - * 16 - * This program is free software; you can redistribute it and/or modify 17 - * it under the terms of the GNU General Public License as published by 18 - * the Free Software Foundation; either version 2 of the License, or 19 - * (at your option) any later version. 20 14 */ 21 15 22 16 #include <linux/module.h> ··· 258 262 * barely passable results for a 16550A. (Although at the expense 259 263 * of much CPU overhead). 260 264 */ 261 - static void serial8250_timeout(unsigned long data) 265 + static void serial8250_timeout(struct timer_list *t) 262 266 { 263 - struct uart_8250_port *up = (struct uart_8250_port *)data; 267 + struct uart_8250_port *up = from_timer(up, t, timer); 264 268 265 269 up->port.handle_irq(&up->port); 266 270 mod_timer(&up->timer, jiffies + uart_poll_timeout(&up->port)); 267 271 } 268 272 269 - static void serial8250_backup_timeout(unsigned long data) 273 + static void serial8250_backup_timeout(struct timer_list *t) 270 274 { 271 - struct uart_8250_port *up = (struct uart_8250_port *)data; 275 + struct uart_8250_port *up = from_timer(up, t, timer); 272 276 unsigned int iir, ier = 0, lsr; 273 277 unsigned long flags; 274 278 ··· 325 329 if (up->bugs & UART_BUG_THRE) { 326 330 pr_debug("ttyS%d - using backup timer\n", serial_index(port)); 327 331 328 - up->timer.function = serial8250_backup_timeout; 329 - up->timer.data = (unsigned long)up; 332 + up->timer.function = (TIMER_FUNC_TYPE)serial8250_backup_timeout; 330 333 mod_timer(&up->timer, jiffies + 331 334 uart_poll_timeout(port) + HZ / 5); 332 335 } ··· 336 341 * driver used to do this with IRQ0. 337 342 */ 338 343 if (!port->irq) { 339 - up->timer.data = (unsigned long)up; 340 344 mod_timer(&up->timer, jiffies + uart_poll_timeout(port)); 341 345 } else 342 346 retval = serial_link_irq_chain(up); ··· 348 354 struct uart_port *port = &up->port; 349 355 350 356 del_timer_sync(&up->timer); 351 - up->timer.function = serial8250_timeout; 357 + up->timer.function = (TIMER_FUNC_TYPE)serial8250_timeout; 352 358 if (port->irq) 353 359 serial_unlink_irq_chain(up); 354 360 } ··· 519 525 base_ops = port->ops; 520 526 port->ops = &univ8250_port_ops; 521 527 522 - init_timer(&up->timer); 523 - up->timer.function = serial8250_timeout; 528 + timer_setup(&up->timer, serial8250_timeout, 0); 524 529 525 530 up->ops = &univ8250_driver_ops; 526 531
+1 -5
drivers/tty/serial/8250/8250_dma.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * 8250_dma.c - DMA Engine API support for 8250.c 3 4 * 4 5 * Copyright (C) 2013 Intel Corporation 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License as published by 8 - * the Free Software Foundation; either version 2 of the License, or 9 - * (at your option) any later version. 10 6 */ 11 7 #include <linux/tty.h> 12 8 #include <linux/tty_flip.h>
+19 -17
drivers/tty/serial/8250/8250_dw.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Synopsys DesignWare 8250 driver. 3 4 * 4 5 * Copyright 2011 Picochip, Jamie Iles. 5 6 * Copyright 2013 Intel Corporation 6 - * 7 - * This program is free software; you can redistribute it and/or modify 8 - * it under the terms of the GNU General Public License as published by 9 - * the Free Software Foundation; either version 2 of the License, or 10 - * (at your option) any later version. 11 7 * 12 8 * The Synopsys DesignWare 8250 has an extra feature whereby it detects if the 13 9 * LCR is written whilst busy. If it is, then a busy detect interrupt is ··· 252 256 struct ktermios *old) 253 257 { 254 258 unsigned int baud = tty_termios_baud_rate(termios); 259 + unsigned int target_rate, min_rate, max_rate; 255 260 struct dw8250_data *d = p->private_data; 256 261 long rate; 257 - int ret; 262 + int i, ret; 258 263 259 264 if (IS_ERR(d->clk) || !old) 260 265 goto out; 261 266 262 - clk_disable_unprepare(d->clk); 263 - rate = clk_round_rate(d->clk, baud * 16); 264 - if (rate < 0) 265 - ret = rate; 266 - else if (rate == 0) 267 - ret = -ENOENT; 268 - else 269 - ret = clk_set_rate(d->clk, rate); 270 - clk_prepare_enable(d->clk); 267 + /* Find a clk rate within +/-1.6% of an integer multiple of baudx16 */ 268 + target_rate = baud * 16; 269 + min_rate = target_rate - (target_rate >> 6); 270 + max_rate = target_rate + (target_rate >> 6); 271 271 272 - if (!ret) 273 - p->uartclk = rate; 272 + for (i = 1; i <= UART_DIV_MAX; i++) { 273 + rate = clk_round_rate(d->clk, i * target_rate); 274 + if (rate >= i * min_rate && rate <= i * max_rate) 275 + break; 276 + } 277 + if (i <= UART_DIV_MAX) { 278 + clk_disable_unprepare(d->clk); 279 + ret = clk_set_rate(d->clk, rate); 280 + clk_prepare_enable(d->clk); 281 + if (!ret) 282 + p->uartclk = rate; 283 + } 274 284 275 285 out: 276 286 p->status &= ~UPSTAT_AUTOCTS;
+1 -4
drivers/tty/serial/8250/8250_early.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Early serial console for 8250/16550 devices 3 4 * 4 5 * (c) Copyright 2004 Hewlett-Packard Development Company, L.P. 5 6 * Bjorn Helgaas <bjorn.helgaas@hp.com> 6 - * 7 - * This program is free software; you can redistribute it and/or modify 8 - * it under the terms of the GNU General Public License version 2 as 9 - * published by the Free Software Foundation. 10 7 * 11 8 * Based on the 8250.c serial driver, Copyright (C) 2001 Russell King, 12 9 * and on early_printk.c by Andi Kleen.
+1 -13
drivers/tty/serial/8250/8250_em.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Renesas Emma Mobile 8250 driver 3 4 * 4 5 * Copyright (C) 2012 Magnus Damm 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License as published by 8 - * the Free Software Foundation; either version 2 of the License 9 - * 10 - * This program is distributed in the hope that it will be useful, 11 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 - * GNU General Public License for more details. 14 - * 15 - * You should have received a copy of the GNU General Public License 16 - * along with this program; if not, write to the Free Software 17 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 6 */ 19 7 20 8 #include <linux/device.h>
+1 -4
drivers/tty/serial/8250/8250_exar.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Probe module for 8250/16550-type Exar chips PCI serial ports. 3 4 * 4 5 * Based on drivers/tty/serial/8250/8250_pci.c, 5 6 * 6 7 * Copyright (C) 2017 Sudip Mukherjee, All Rights Reserved. 7 - * 8 - * This program is free software; you can redistribute it and/or modify 9 - * it under the terms of the GNU General Public License as published by 10 - * the Free Software Foundation; either version 2 of the License. 11 8 */ 12 9 #include <linux/acpi.h> 13 10 #include <linux/dmi.h>
+1 -4
drivers/tty/serial/8250/8250_exar_st16c554.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Written by Paul B Schroeder < pschroeder "at" uplogix "dot" com > 3 4 * Based on 8250_boca. 4 5 * 5 6 * Copyright (C) 2005 Russell King. 6 7 * Data taken from include/asm-i386/serial.h 7 - * 8 - * This program is free software; you can redistribute it and/or modify 9 - * it under the terms of the GNU General Public License version 2 as 10 - * published by the Free Software Foundation. 11 8 */ 12 9 #include <linux/module.h> 13 10 #include <linux/init.h>
+109 -14
drivers/tty/serial/8250/8250_fintek.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Probe for F81216A LPC to 4 UART 3 4 * 4 5 * Copyright (C) 2014-2016 Ricardo Ribalda, Qtechnology A/S 5 - * 6 - * 7 - * This program is free software; you can redistribute it and/or modify 8 - * it under the terms of the GNU General Public License as published by 9 - * the Free Software Foundation; either version 2 of the License. 10 6 */ 11 7 #include <linux/module.h> 12 8 #include <linux/pci.h> ··· 36 40 #define IRQ_LEVEL_LOW 0 37 41 #define IRQ_EDGE_HIGH BIT(5) 38 42 43 + /* 44 + * F81216H clock source register, the value and mask is the same with F81866, 45 + * but it's on F0h. 46 + * 47 + * Clock speeds for UART (register F0h) 48 + * 00: 1.8432MHz. 49 + * 01: 18.432MHz. 50 + * 10: 24MHz. 51 + * 11: 14.769MHz. 52 + */ 39 53 #define RS485 0xF0 40 54 #define RTS_INVERT BIT(5) 41 55 #define RS485_URA BIT(4) ··· 124 118 if (!request_muxed_region(base_port, 2, "8250_fintek")) 125 119 return -EBUSY; 126 120 121 + /* Force to deactive all SuperIO in this base_port */ 122 + outb(EXIT_KEY, base_port + ADDR_PORT); 123 + 127 124 outb(key, base_port + ADDR_PORT); 128 125 outb(key, base_port + ADDR_PORT); 129 126 return 0; ··· 197 188 if (!pdata) 198 189 return -EINVAL; 199 190 200 - if (rs485->flags & SER_RS485_ENABLED) 191 + /* Hardware do not support same RTS level on send and receive */ 192 + if (!(rs485->flags & SER_RS485_RTS_ON_SEND) == 193 + !(rs485->flags & SER_RS485_RTS_AFTER_SEND)) 194 + return -EINVAL; 195 + 196 + if (rs485->flags & SER_RS485_ENABLED) { 201 197 memset(rs485->padding, 0, sizeof(rs485->padding)); 202 - else 198 + config |= RS485_URA; 199 + } else { 203 200 memset(rs485, 0, sizeof(*rs485)); 201 + } 204 202 205 203 rs485->flags &= SER_RS485_ENABLED | SER_RS485_RTS_ON_SEND | 206 204 SER_RS485_RTS_AFTER_SEND; 205 + 206 + /* Only the first port supports delays */ 207 + if (pdata->index) { 208 + rs485->delay_rts_before_send = 0; 209 + rs485->delay_rts_after_send = 0; 210 + } 207 211 208 212 if (rs485->delay_rts_before_send) { 209 213 rs485->delay_rts_before_send = 1; ··· 227 205 rs485->delay_rts_after_send = 1; 228 206 config |= RXW4C_IRA; 229 207 } 230 - 231 - if ((!!(rs485->flags & SER_RS485_RTS_ON_SEND)) == 232 - (!!(rs485->flags & SER_RS485_RTS_AFTER_SEND))) 233 - rs485->flags &= SER_RS485_ENABLED; 234 - else 235 - config |= RS485_URA; 236 208 237 209 if (rs485->flags & SER_RS485_RTS_ON_SEND) 238 210 config |= RTS_INVERT; ··· 296 280 F81866_UART_CLK_MASK, 297 281 F81866_UART_CLK_14_769MHZ); 298 282 299 - uart->port.uartclk = 921600 * 16; 283 + uart->port.uartclk = 921600 * 16; 300 284 break; 301 285 default: /* leave clock speed untouched */ 286 + break; 287 + } 288 + } 289 + 290 + void fintek_8250_set_termios(struct uart_port *port, struct ktermios *termios, 291 + struct ktermios *old) 292 + { 293 + struct fintek_8250 *pdata = port->private_data; 294 + unsigned int baud = tty_termios_baud_rate(termios); 295 + int i; 296 + u8 reg; 297 + static u32 baudrate_table[] = {115200, 921600, 1152000, 1500000}; 298 + static u8 clock_table[] = { F81866_UART_CLK_1_8432MHZ, 299 + F81866_UART_CLK_14_769MHZ, F81866_UART_CLK_18_432MHZ, 300 + F81866_UART_CLK_24MHZ }; 301 + 302 + /* 303 + * We'll use serial8250_do_set_termios() for baud = 0, otherwise It'll 304 + * crash on baudrate_table[i] % baud with "division by zero". 305 + */ 306 + if (!baud) 307 + goto exit; 308 + 309 + switch (pdata->pid) { 310 + case CHIP_ID_F81216H: 311 + reg = RS485; 312 + break; 313 + case CHIP_ID_F81866: 314 + reg = F81866_UART_CLK; 315 + break; 316 + default: 317 + /* Don't change clocksource with unknown PID */ 318 + dev_warn(port->dev, 319 + "%s: pid: %x Not support. use default set_termios.\n", 320 + __func__, pdata->pid); 321 + goto exit; 322 + } 323 + 324 + for (i = 0; i < ARRAY_SIZE(baudrate_table); ++i) { 325 + if (baud > baudrate_table[i] || baudrate_table[i] % baud != 0) 326 + continue; 327 + 328 + if (port->uartclk == baudrate_table[i] * 16) 329 + break; 330 + 331 + if (fintek_8250_enter_key(pdata->base_port, pdata->key)) 332 + continue; 333 + 334 + port->uartclk = baudrate_table[i] * 16; 335 + 336 + sio_write_reg(pdata, LDN, pdata->index); 337 + sio_write_mask_reg(pdata, reg, F81866_UART_CLK_MASK, 338 + clock_table[i]); 339 + 340 + fintek_8250_exit_key(pdata->base_port); 341 + break; 342 + } 343 + 344 + if (i == ARRAY_SIZE(baudrate_table)) { 345 + baud = tty_termios_baud_rate(old); 346 + tty_termios_encode_baud_rate(termios, baud, baud); 347 + } 348 + 349 + exit: 350 + serial8250_do_set_termios(port, termios, old); 351 + } 352 + 353 + static void fintek_8250_set_termios_handler(struct uart_8250_port *uart) 354 + { 355 + struct fintek_8250 *pdata = uart->port.private_data; 356 + 357 + switch (pdata->pid) { 358 + case CHIP_ID_F81216H: 359 + case CHIP_ID_F81866: 360 + uart->port.set_termios = fintek_8250_set_termios; 361 + break; 362 + 363 + default: 302 364 break; 303 365 } 304 366 } ··· 467 373 memcpy(pdata, &probe_data, sizeof(probe_data)); 468 374 uart->port.private_data = pdata; 469 375 fintek_8250_set_rs485_handler(uart); 376 + fintek_8250_set_termios_handler(uart); 470 377 471 378 return 0; 472 379 }
+1 -4
drivers/tty/serial/8250/8250_fourport.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (C) 2005 Russell King. 3 4 * Data taken from include/asm-i386/serial.h 4 - * 5 - * This program is free software; you can redistribute it and/or modify 6 - * it under the terms of the GNU General Public License version 2 as 7 - * published by the Free Software Foundation. 8 5 */ 9 6 #include <linux/module.h> 10 7 #include <linux/init.h>
+1 -4
drivers/tty/serial/8250/8250_fsl.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 #include <linux/serial_reg.h> 2 3 #include <linux/serial_8250.h> 3 4 ··· 6 5 7 6 /* 8 7 * Freescale 16550 UART "driver", Copyright (C) 2011 Paul Gortmaker. 9 - * 10 - * This program is free software; you can redistribute it and/or modify 11 - * it under the terms of the GNU General Public License version 2 as 12 - * published by the Free Software Foundation. 13 8 * 14 9 * This isn't a full driver; it just provides an alternate IRQ 15 10 * handler to deal with an errata. Everything else is just
+1 -5
drivers/tty/serial/8250/8250_gsc.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Serial Device Initialisation for Lasi/Asp/Wax/Dino 3 4 * 4 5 * (c) Copyright Matthew Wilcox <willy@debian.org> 2001-2002 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License as published by 8 - * the Free Software Foundation; either version 2 of the License, or 9 - * (at your option) any later version. 10 6 */ 11 7 12 8 #include <linux/errno.h>
+1
drivers/tty/serial/8250/8250_hp300.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Driver for the 98626/98644/internal serial interface on hp300/hp400 3 4 * (based on the National Semiconductor INS8250/NS16550AF/WD16C552 UARTs)
+1 -4
drivers/tty/serial/8250/8250_hub6.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (C) 2005 Russell King. 3 4 * Data taken from include/asm-i386/serial.h 4 - * 5 - * This program is free software; you can redistribute it and/or modify 6 - * it under the terms of the GNU General Public License version 2 as 7 - * published by the Free Software Foundation. 8 5 */ 9 6 #include <linux/module.h> 10 7 #include <linux/init.h>
+1 -9
drivers/tty/serial/8250/8250_ingenic.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2010 Lars-Peter Clausen <lars@metafoo.de> 3 4 * Copyright (C) 2015 Imagination Technologies 4 5 * 5 6 * Ingenic SoC UART support 6 - * 7 - * This program is free software; you can redistribute it and/or modify it 8 - * under the terms of the GNU General Public License as published by the 9 - * Free Software Foundation; either version 2 of the License, or (at your 10 - * option) any later version. 11 - * 12 - * You should have received a copy of the GNU General Public License along 13 - * with this program; if not, write to the Free Software Foundation, Inc., 14 - * 675 Mass Ave, Cambridge, MA 02139, USA. 15 7 */ 16 8 17 9 #include <linux/clk.h>
+1 -5
drivers/tty/serial/8250/8250_lpc18xx.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Serial port driver for NXP LPC18xx/43xx UART 3 4 * ··· 7 6 * Based on 8250_mtk.c: 8 7 * Copyright (c) 2014 MundoReader S.L. 9 8 * Matthias Brugger <matthias.bgg@gmail.com> 10 - * 11 - * This program is free software; you can redistribute it and/or modify 12 - * it under the terms of the GNU General Public License version 2 as 13 - * published by the Free Software Foundation. 14 - * 15 9 */ 16 10 17 11 #include <linux/clk.h>
+1 -4
drivers/tty/serial/8250/8250_lpss.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * 8250_lpss.c - Driver for UART on Intel Braswell and various other Intel SoCs 3 4 * 4 5 * Copyright (C) 2016 Intel Corporation 5 6 * Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com> 6 - * 7 - * This program is free software; you can redistribute it and/or modify 8 - * it under the terms of the GNU General Public License version 2 as 9 - * published by the Free Software Foundation. 10 7 */ 11 8 12 9 #include <linux/bitops.h>
+5 -6
drivers/tty/serial/8250/8250_mid.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * 8250_mid.c - Driver for UART on Intel Penwell and various other Intel SOCs 3 4 * 4 5 * Copyright (C) 2015 Intel Corporation 5 6 * Author: Heikki Krogerus <heikki.krogerus@linux.intel.com> 6 - * 7 - * This program is free software; you can redistribute it and/or modify 8 - * it under the terms of the GNU General Public License version 2 as 9 - * published by the Free Software Foundation. 10 7 */ 11 8 12 9 #include <linux/bitops.h> ··· 20 23 #define PCI_DEVICE_ID_INTEL_PNW_UART2 0x081c 21 24 #define PCI_DEVICE_ID_INTEL_PNW_UART3 0x081d 22 25 #define PCI_DEVICE_ID_INTEL_TNG_UART 0x1191 26 + #define PCI_DEVICE_ID_INTEL_CDF_UART 0x18d8 23 27 #define PCI_DEVICE_ID_INTEL_DNV_UART 0x19d8 24 28 25 29 /* Intel MID Specific registers */ 26 - #define INTEL_MID_UART_DNV_FISR 0x08 30 + #define INTEL_MID_UART_FISR 0x08 27 31 #define INTEL_MID_UART_PS 0x30 28 32 #define INTEL_MID_UART_MUL 0x34 29 33 #define INTEL_MID_UART_DIV 0x38 ··· 128 130 { 129 131 struct mid8250 *mid = p->private_data; 130 132 struct uart_8250_port *up = up_to_u8250p(p); 131 - unsigned int fisr = serial_port_in(p, INTEL_MID_UART_DNV_FISR); 133 + unsigned int fisr = serial_port_in(p, INTEL_MID_UART_FISR); 132 134 u32 status; 133 135 int ret = 0; 134 136 int err; ··· 375 377 MID_DEVICE(PCI_DEVICE_ID_INTEL_PNW_UART2, pnw_board), 376 378 MID_DEVICE(PCI_DEVICE_ID_INTEL_PNW_UART3, pnw_board), 377 379 MID_DEVICE(PCI_DEVICE_ID_INTEL_TNG_UART, tng_board), 380 + MID_DEVICE(PCI_DEVICE_ID_INTEL_CDF_UART, dnv_board), 378 381 MID_DEVICE(PCI_DEVICE_ID_INTEL_DNV_UART, dnv_board), 379 382 { }, 380 383 };
+1 -4
drivers/tty/serial/8250/8250_moxa.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * 8250_moxa.c - MOXA Smartio/Industio MUE multiport serial driver. 3 4 * 4 5 * Author: Mathieu OTHACEHE <m.othacehe@gmail.com> 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License version 2 as 8 - * published by the Free Software Foundation. 9 6 */ 10 7 11 8 #include <linux/module.h>
+2 -11
drivers/tty/serial/8250/8250_mtk.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Mediatek 8250 driver. 3 4 * 4 5 * Copyright (c) 2014 MundoReader S.L. 5 6 * Author: Matthias Brugger <matthias.bgg@gmail.com> 6 - * 7 - * This program is free software; you can redistribute it and/or modify 8 - * it under the terms of the GNU General Public License as published by 9 - * the Free Software Foundation; either version 2 of the License, or 10 - * (at your option) any later version. 11 - * 12 - * This program is distributed in the hope that it will be useful, 13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 - * GNU General Public License for more details. 16 7 */ 17 8 #include <linux/clk.h> 18 9 #include <linux/io.h> ··· 52 61 * registers to their default values. 53 62 */ 54 63 baud = uart_get_baud_rate(port, termios, old, 55 - port->uartclk / 16 / 0xffff, 64 + port->uartclk / 16 / UART_DIV_MAX, 56 65 port->uartclk); 57 66 58 67 if (baud <= 115200) {
+1 -6
drivers/tty/serial/8250/8250_of.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Serial Port driver for Open Firmware platform devices 3 4 * 4 5 * Copyright (C) 2006 Arnd Bergmann <arnd@arndb.de>, IBM Corp. 5 - * 6 - * This program is free software; you can redistribute it and/or 7 - * modify it under the terms of the GNU General Public License 8 - * as published by the Free Software Foundation; either version 9 - * 2 of the License, or (at your option) any later version. 10 - * 11 6 */ 12 7 #include <linux/console.h> 13 8 #include <linux/module.h>
+3 -2
drivers/tty/serial/8250/8250_omap.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * 8250-core based driver for the OMAP internal UART 3 4 * ··· 200 199 * Old custom speed handling. 201 200 */ 202 201 if (baud == 38400 && (port->flags & UPF_SPD_MASK) == UPF_SPD_CUST) { 203 - priv->quot = port->custom_divisor & 0xffff; 202 + priv->quot = port->custom_divisor & UART_DIV_MAX; 204 203 /* 205 204 * I assume that nobody is using this. But hey, if somebody 206 205 * would like to specify the divisor _and_ the mode then the ··· 359 358 * Ask the core to calculate the divisor for us. 360 359 */ 361 360 baud = uart_get_baud_rate(port, termios, old, 362 - port->uartclk / 16 / 0xffff, 361 + port->uartclk / 16 / UART_DIV_MAX, 363 362 port->uartclk / 13); 364 363 omap_8250_get_divisor(port, baud, priv); 365 364
+2 -4
drivers/tty/serial/8250/8250_pci.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Probe module for 8250/16550-type PCI serial ports. 3 4 * 4 5 * Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o. 5 6 * 6 7 * Copyright (C) 2001 Russell King, All Rights Reserved. 7 - * 8 - * This program is free software; you can redistribute it and/or modify 9 - * it under the terms of the GNU General Public License as published by 10 - * the Free Software Foundation; either version 2 of the License. 11 8 */ 12 9 #undef DEBUG 13 10 #include <linux/module.h> ··· 3365 3368 { PCI_VDEVICE(INTEL, 0x081c), }, 3366 3369 { PCI_VDEVICE(INTEL, 0x081d), }, 3367 3370 { PCI_VDEVICE(INTEL, 0x1191), }, 3371 + { PCI_VDEVICE(INTEL, 0x18d8), }, 3368 3372 { PCI_VDEVICE(INTEL, 0x19d8), }, 3369 3373 3370 3374 /* Intel platforms with DesignWare UART */
+1 -4
drivers/tty/serial/8250/8250_pnp.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Probe for 8250/16550-type ISAPNP serial ports. 3 4 * ··· 7 6 * Copyright (C) 2001 Russell King, All Rights Reserved. 8 7 * 9 8 * Ported to the Linux PnP Layer - (C) Adam Belay. 10 - * 11 - * This program is free software; you can redistribute it and/or modify 12 - * it under the terms of the GNU General Public License as published by 13 - * the Free Software Foundation; either version 2 of the License. 14 9 */ 15 10 #include <linux/module.h> 16 11 #include <linux/pci.h>
+6 -10
drivers/tty/serial/8250/8250_port.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Base port operations for 8250/16550-type serial ports 3 4 * 4 5 * Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o. 5 6 * Split from 8250_core.c, Copyright (C) 2001 Russell King. 6 - * 7 - * This program is free software; you can redistribute it and/or modify 8 - * it under the terms of the GNU General Public License as published by 9 - * the Free Software Foundation; either version 2 of the License, or 10 - * (at your option) any later version. 11 7 * 12 8 * A note about mapbase / membase 13 9 * ··· 1512 1516 return; 1513 1517 1514 1518 em485->active_timer = NULL; 1515 - hrtimer_cancel(&em485->start_tx_timer); 1516 1519 1517 1520 __stop_tx_rs485(p); 1518 1521 } ··· 1575 1580 serial8250_stop_rx(&up->port); 1576 1581 1577 1582 em485->active_timer = NULL; 1578 - if (hrtimer_is_queued(&em485->stop_tx_timer)) 1579 - hrtimer_cancel(&em485->stop_tx_timer); 1580 1583 1581 1584 mcr = serial8250_in_MCR(up); 1582 1585 if (!!(up->port.rs485.flags & SER_RS485_RTS_ON_SEND) != ··· 2579 2586 serial_dl_write(up, quot); 2580 2587 2581 2588 /* XR17V35x UARTs have an extra fractional divisor register (DLD) */ 2582 - if (up->port.type == PORT_XR17V35X) 2589 + if (up->port.type == PORT_XR17V35X) { 2590 + /* Preserve bits not related to baudrate; DLD[7:4]. */ 2591 + quot_frac |= serial_port_in(port, 0x2) & 0xf0; 2583 2592 serial_port_out(port, 0x2, quot_frac); 2593 + } 2584 2594 } 2585 2595 2586 2596 static unsigned int serial8250_get_baud_rate(struct uart_port *port, ··· 2597 2601 * causing transmission errors. 2598 2602 */ 2599 2603 return uart_get_baud_rate(port, termios, old, 2600 - port->uartclk / 16 / 0xffff, 2604 + port->uartclk / 16 / UART_DIV_MAX, 2601 2605 port->uartclk); 2602 2606 } 2603 2607
+1 -6
drivers/tty/serial/8250/8250_pxa.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * drivers/tty/serial/8250/8250_pxa.c -- driver for PXA on-board UARTS 3 4 * Copyright: (C) 2013 Sergei Ianovich <ynvich@gmail.com> ··· 8 7 * Copyright: (C) 2003 Monta Vista Software, Inc. 9 8 * 10 9 * Based on drivers/serial/8250.c by Russell King. 11 - * 12 - * This program is free software; you can redistribute it and/or modify 13 - * it under the terms of the GNU General Public License as published by 14 - * the Free Software Foundation; either version 2 of the License, or 15 - * (at your option) any later version. 16 - * 17 10 */ 18 11 19 12 #include <linux/device.h>
+1 -10
drivers/tty/serial/8250/8250_uniphier.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright (C) 2015 Masahiro Yamada <yamada.masahiro@socionext.com> 3 - * 4 - * This program is free software; you can redistribute it and/or modify 5 - * it under the terms of the GNU General Public License as published by 6 - * the Free Software Foundation; either version 2 of the License, or 7 - * (at your option) any later version. 8 - * 9 - * This program is distributed in the hope that it will be useful, 10 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 - * GNU General Public License for more details. 13 4 */ 14 5 15 6 #include <linux/clk.h>
+1
drivers/tty/serial/8250/serial_cs.c
··· 1 + // SPDX-License-Identifier: (GPL-2.0 OR MPL-1.1) 1 2 /*====================================================================== 2 3 3 4 A driver for PCMCIA serial devices
+1 -5
drivers/tty/serial/altera_jtaguart.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * altera_jtaguart.c -- Altera JTAG UART driver 3 4 * ··· 7 6 * (C) Copyright 2003-2007, Greg Ungerer <gerg@snapgear.com> 8 7 * (C) Copyright 2008, Thomas Chou <thomas@wytron.com.tw> 9 8 * (C) Copyright 2010, Tobias Klauser <tklauser@distanz.ch> 10 - * 11 - * This program is free software; you can redistribute it and/or modify 12 - * it under the terms of the GNU General Public License as published by 13 - * the Free Software Foundation; either version 2 of the License, or 14 - * (at your option) any later version. 15 9 */ 16 10 17 11 #include <linux/kernel.h>
+5 -9
drivers/tty/serial/altera_uart.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * altera_uart.c -- Altera UART driver 3 4 * ··· 7 6 * (C) Copyright 2003-2007, Greg Ungerer <gerg@snapgear.com> 8 7 * (C) Copyright 2008, Thomas Chou <thomas@wytron.com.tw> 9 8 * (C) Copyright 2010, Tobias Klauser <tklauser@distanz.ch> 10 - * 11 - * This program is free software; you can redistribute it and/or modify 12 - * it under the terms of the GNU General Public License as published by 13 - * the Free Software Foundation; either version 2 of the License, or 14 - * (at your option) any later version. 15 9 */ 16 10 17 11 #include <linux/kernel.h> ··· 284 288 return IRQ_RETVAL(isr); 285 289 } 286 290 287 - static void altera_uart_timer(unsigned long data) 291 + static void altera_uart_timer(struct timer_list *t) 288 292 { 289 - struct uart_port *port = (void *)data; 290 - struct altera_uart *pp = container_of(port, struct altera_uart, port); 293 + struct altera_uart *pp = from_timer(pp, t, tmr); 294 + struct uart_port *port = &pp->port; 291 295 292 296 altera_uart_interrupt(0, port); 293 297 mod_timer(&pp->tmr, jiffies + uart_poll_timeout(port)); ··· 310 314 int ret; 311 315 312 316 if (!port->irq) { 313 - setup_timer(&pp->tmr, altera_uart_timer, (unsigned long)port); 317 + timer_setup(&pp->tmr, altera_uart_timer, 0); 314 318 mod_timer(&pp->tmr, jiffies + uart_poll_timeout(port)); 315 319 return 0; 316 320 }
+1 -14
drivers/tty/serial/amba-pl010.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Driver for AMBA serial ports 3 4 * ··· 6 5 * 7 6 * Copyright 1999 ARM Limited 8 7 * Copyright (C) 2000 Deep Blue Solutions Ltd. 9 - * 10 - * This program is free software; you can redistribute it and/or modify 11 - * it under the terms of the GNU General Public License as published by 12 - * the Free Software Foundation; either version 2 of the License, or 13 - * (at your option) any later version. 14 - * 15 - * This program is distributed in the hope that it will be useful, 16 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 - * GNU General Public License for more details. 19 - * 20 - * You should have received a copy of the GNU General Public License 21 - * along with this program; if not, write to the Free Software 22 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 8 * 24 9 * This is a generic driver for ARM AMBA-type serial ports. They 25 10 * have a lot of 16550-like features, but are not register compatible.
+8 -24
drivers/tty/serial/amba-pl011.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Driver for AMBA serial ports 3 4 * ··· 7 6 * Copyright 1999 ARM Limited 8 7 * Copyright (C) 2000 Deep Blue Solutions Ltd. 9 8 * Copyright (C) 2010 ST-Ericsson SA 10 - * 11 - * This program is free software; you can redistribute it and/or modify 12 - * it under the terms of the GNU General Public License as published by 13 - * the Free Software Foundation; either version 2 of the License, or 14 - * (at your option) any later version. 15 - * 16 - * This program is distributed in the hope that it will be useful, 17 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 - * GNU General Public License for more details. 20 - * 21 - * You should have received a copy of the GNU General Public License 22 - * along with this program; if not, write to the Free Software 23 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 9 * 25 10 * This is a generic driver for ARM AMBA-type serial ports. They 26 11 * have a lot of 16550-like features, but are not register compatible. ··· 268 281 unsigned int old_status; 269 282 unsigned int fifosize; /* vendor-specific */ 270 283 unsigned int old_cr; /* state during shutdown */ 271 - bool autorts; 272 284 unsigned int fixed_baud; /* vendor-set fixed baud rate */ 273 285 char type[12]; 274 286 #ifdef CONFIG_DMA_ENGINE ··· 1064 1078 * Every polling, It checks the residue in the dma buffer and transfer 1065 1079 * data to the tty. Also, last_residue is updated for the next polling. 1066 1080 */ 1067 - static void pl011_dma_rx_poll(unsigned long args) 1081 + static void pl011_dma_rx_poll(struct timer_list *t) 1068 1082 { 1069 - struct uart_amba_port *uap = (struct uart_amba_port *)args; 1083 + struct uart_amba_port *uap = from_timer(uap, t, dmarx.timer); 1070 1084 struct tty_port *port = &uap->port.state->port; 1071 1085 struct pl011_dmarx_data *dmarx = &uap->dmarx; 1072 1086 struct dma_chan *rxchan = uap->dmarx.chan; ··· 1178 1192 dev_dbg(uap->port.dev, "could not trigger initial " 1179 1193 "RX DMA job, fall back to interrupt mode\n"); 1180 1194 if (uap->dmarx.poll_rate) { 1181 - init_timer(&(uap->dmarx.timer)); 1182 - uap->dmarx.timer.function = pl011_dma_rx_poll; 1183 - uap->dmarx.timer.data = (unsigned long)uap; 1195 + timer_setup(&uap->dmarx.timer, pl011_dma_rx_poll, 0); 1184 1196 mod_timer(&uap->dmarx.timer, 1185 1197 jiffies + 1186 1198 msecs_to_jiffies(uap->dmarx.poll_rate)); ··· 1572 1588 TIOCMBIT(TIOCM_OUT2, UART011_CR_OUT2); 1573 1589 TIOCMBIT(TIOCM_LOOP, UART011_CR_LBE); 1574 1590 1575 - if (uap->autorts) { 1591 + if (port->status & UPSTAT_AUTORTS) { 1576 1592 /* We need to disable auto-RTS if we want to turn RTS off */ 1577 1593 TIOCMBIT(TIOCM_RTS, UART011_CR_RTSEN); 1578 1594 } ··· 1826 1842 { 1827 1843 unsigned int cr; 1828 1844 1829 - uap->autorts = false; 1845 + uap->port.status &= ~(UPSTAT_AUTOCTS | UPSTAT_AUTORTS); 1830 1846 spin_lock_irq(&uap->port.lock); 1831 1847 cr = pl011_read(uap, REG_CR); 1832 1848 uap->old_cr = cr; ··· 2012 2028 old_cr |= UART011_CR_RTSEN; 2013 2029 2014 2030 old_cr |= UART011_CR_CTSEN; 2015 - uap->autorts = true; 2031 + port->status |= UPSTAT_AUTOCTS | UPSTAT_AUTORTS; 2016 2032 } else { 2017 2033 old_cr &= ~(UART011_CR_CTSEN | UART011_CR_RTSEN); 2018 - uap->autorts = false; 2034 + port->status &= ~(UPSTAT_AUTOCTS | UPSTAT_AUTORTS); 2019 2035 } 2020 2036 2021 2037 if (uap->vendor->oversampling) {
+1
drivers/tty/serial/apbuart.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Driver for GRLIB serial ports (APBUART) 3 4 *
+1 -4
drivers/tty/serial/ar933x_uart.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Atheros AR933X SoC built-in UART driver 3 4 * 4 5 * Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org> 5 6 * 6 7 * Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o. 7 - * 8 - * This program is free software; you can redistribute it and/or modify it 9 - * under the terms of the GNU General Public License version 2 as published 10 - * by the Free Software Foundation. 11 8 */ 12 9 13 10 #include <linux/module.h>
+1 -4
drivers/tty/serial/arc_uart.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * ARC On-Chip(fpga) UART Driver 3 4 * 4 5 * Copyright (C) 2010-2012 Synopsys, Inc. (www.synopsys.com) 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License version 2 as 8 - * published by the Free Software Foundation. 9 6 * 10 7 * vineetg: July 10th 2012 11 8 * -Decoupled the driver from arch/arc
+20 -45
drivers/tty/serial/atmel_serial.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Driver for Atmel AT91 Serial ports 3 4 * Copyright (C) 2003 Rick Bronson ··· 7 6 * Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o. 8 7 * 9 8 * DMA support added by Chip Coldwell. 10 - * 11 - * This program is free software; you can redistribute it and/or modify 12 - * it under the terms of the GNU General Public License as published by 13 - * the Free Software Foundation; either version 2 of the License, or 14 - * (at your option) any later version. 15 - * 16 - * This program is distributed in the hope that it will be useful, 17 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 - * GNU General Public License for more details. 20 - * 21 - * You should have received a copy of the GNU General Public License 22 - * along with this program; if not, write to the Free Software 23 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 - * 25 9 */ 26 10 #include <linux/tty.h> 27 11 #include <linux/ioport.h> ··· 157 171 bool has_hw_timer; 158 172 struct timer_list uart_timer; 159 173 174 + bool tx_stopped; 160 175 bool suspended; 161 176 unsigned int pending; 162 177 unsigned int pending_status; ··· 367 380 */ 368 381 static u_int atmel_tx_empty(struct uart_port *port) 369 382 { 383 + struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); 384 + 385 + if (atmel_port->tx_stopped) 386 + return TIOCSER_TEMT; 370 387 return (atmel_uart_readl(port, ATMEL_US_CSR) & ATMEL_US_TXEMPTY) ? 371 388 TIOCSER_TEMT : 372 389 0; ··· 476 485 * is fully transmitted. 477 486 */ 478 487 atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_TXDIS); 488 + atmel_port->tx_stopped = true; 479 489 480 490 /* Disable interrupts */ 481 491 atmel_uart_writel(port, ATMEL_US_IDR, atmel_port->tx_done_mask); ··· 513 521 514 522 /* re-enable the transmitter */ 515 523 atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_TXEN); 524 + atmel_port->tx_stopped = false; 516 525 } 517 526 518 527 /* ··· 1171 1178 return -EINVAL; 1172 1179 } 1173 1180 1174 - static void atmel_uart_timer_callback(unsigned long data) 1181 + static void atmel_uart_timer_callback(struct timer_list *t) 1175 1182 { 1176 - struct uart_port *port = (void *)data; 1177 - struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); 1183 + struct atmel_uart_port *atmel_port = from_timer(atmel_port, t, 1184 + uart_timer); 1185 + struct uart_port *port = &atmel_port->uart; 1178 1186 1179 1187 if (!atomic_read(&atmel_port->tasklet_shutdown)) { 1180 1188 tasklet_schedule(&atmel_port->tasklet_rx); ··· 1661 1667 } 1662 1668 } 1663 1669 1664 - static void atmel_init_rs485(struct uart_port *port, 1665 - struct platform_device *pdev) 1666 - { 1667 - struct device_node *np = pdev->dev.of_node; 1668 - 1669 - struct serial_rs485 *rs485conf = &port->rs485; 1670 - u32 rs485_delay[2]; 1671 - 1672 - /* rs485 properties */ 1673 - if (of_property_read_u32_array(np, "rs485-rts-delay", 1674 - rs485_delay, 2) == 0) { 1675 - rs485conf->delay_rts_before_send = rs485_delay[0]; 1676 - rs485conf->delay_rts_after_send = rs485_delay[1]; 1677 - rs485conf->flags = 0; 1678 - } 1679 - 1680 - if (of_get_property(np, "rs485-rx-during-tx", NULL)) 1681 - rs485conf->flags |= SER_RS485_RX_DURING_TX; 1682 - 1683 - if (of_get_property(np, "linux,rs485-enabled-at-boot-time", NULL)) 1684 - rs485conf->flags |= SER_RS485_ENABLED; 1685 - } 1686 - 1687 1670 static void atmel_set_ops(struct uart_port *port) 1688 1671 { 1689 1672 struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); ··· 1837 1866 atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_RSTSTA | ATMEL_US_RSTRX); 1838 1867 /* enable xmit & rcvr */ 1839 1868 atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_TXEN | ATMEL_US_RXEN); 1869 + atmel_port->tx_stopped = false; 1840 1870 1841 - setup_timer(&atmel_port->uart_timer, 1842 - atmel_uart_timer_callback, 1843 - (unsigned long)port); 1871 + timer_setup(&atmel_port->uart_timer, atmel_uart_timer_callback, 0); 1844 1872 1845 1873 if (atmel_use_pdc_rx(port)) { 1846 1874 /* set UART timeout */ ··· 2092 2122 2093 2123 /* disable receiver and transmitter */ 2094 2124 atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_TXDIS | ATMEL_US_RXDIS); 2125 + atmel_port->tx_stopped = true; 2095 2126 2096 2127 /* mode */ 2097 2128 if (port->rs485.flags & SER_RS485_ENABLED) { ··· 2178 2207 atmel_uart_writel(port, ATMEL_US_BRGR, quot); 2179 2208 atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_RSTSTA | ATMEL_US_RSTRX); 2180 2209 atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_TXEN | ATMEL_US_RXEN); 2210 + atmel_port->tx_stopped = false; 2181 2211 2182 2212 /* restore interrupts */ 2183 2213 atmel_uart_writel(port, ATMEL_US_IER, imr); ··· 2345 2373 atmel_init_property(atmel_port, pdev); 2346 2374 atmel_set_ops(port); 2347 2375 2348 - atmel_init_rs485(port, pdev); 2376 + of_get_rs485_mode(pdev->dev.of_node, &port->rs485); 2349 2377 2350 2378 port->iotype = UPIO_MEM; 2351 2379 port->flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP; ··· 2422 2450 2423 2451 /* Make sure that tx path is actually able to send characters */ 2424 2452 atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_TXEN); 2453 + atmel_port->tx_stopped = false; 2425 2454 2426 2455 uart_console_write(port, s, count, atmel_console_putchar); 2427 2456 ··· 2484 2511 { 2485 2512 int ret; 2486 2513 struct uart_port *port = &atmel_ports[co->index].uart; 2514 + struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); 2487 2515 int baud = 115200; 2488 2516 int bits = 8; 2489 2517 int parity = 'n'; ··· 2502 2528 atmel_uart_writel(port, ATMEL_US_IDR, -1); 2503 2529 atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_RSTSTA | ATMEL_US_RSTRX); 2504 2530 atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_TXEN | ATMEL_US_RXEN); 2531 + atmel_port->tx_stopped = false; 2505 2532 2506 2533 if (options) 2507 2534 uart_parse_options(options, &baud, &parity, &bits, &flow);
+1 -5
drivers/tty/serial/atmel_serial.h
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * include/linux/atmel_serial.h 3 4 * ··· 7 6 * 8 7 * USART registers. 9 8 * Based on AT91RM9200 datasheet revision E. 10 - * 11 - * This program is free software; you can redistribute it and/or modify 12 - * it under the terms of the GNU General Public License as published by 13 - * the Free Software Foundation; either version 2 of the License, or 14 - * (at your option) any later version. 15 9 */ 16 10 17 11 #ifndef ATMEL_SERIAL_H
+1 -4
drivers/tty/serial/bcm63xx_uart.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 - * This file is subject to the terms and conditions of the GNU General Public 3 - * License. See the file "COPYING" in the main directory of this archive 4 - * for more details. 5 - * 6 3 * Derived from many drivers using generic_serial interface. 7 4 * 8 5 * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
+2 -3
drivers/tty/serial/bfin_sport_uart.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Blackfin On-Chip Sport Emulated UART Driver 3 4 * 4 5 * Copyright 2006-2009 Analog Devices Inc. 5 6 * 6 7 * Enter bugs at http://blackfin.uclinux.org/ 7 - * 8 - * Licensed under the GPL-2 or later. 9 8 */ 10 9 11 10 /* ··· 583 584 spin_unlock_irqrestore(&up->port.lock, flags); 584 585 } 585 586 586 - struct uart_ops sport_uart_ops = { 587 + static const struct uart_ops sport_uart_ops = { 587 588 .tx_empty = sport_tx_empty, 588 589 .set_mctrl = sport_set_mctrl, 589 590 .get_mctrl = sport_get_mctrl,
+1 -2
drivers/tty/serial/bfin_sport_uart.h
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Blackfin On-Chip Sport Emulated UART Driver 3 4 * 4 5 * Copyright 2006-2008 Analog Devices Inc. 5 6 * 6 7 * Enter bugs at http://blackfin.uclinux.org/ 7 - * 8 - * Licensed under the GPL-2 or later. 9 8 */ 10 9 11 10 /*
+4 -6
drivers/tty/serial/bfin_uart.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Blackfin On-Chip Serial Driver 3 4 * 4 5 * Copyright 2006-2011 Analog Devices Inc. 5 6 * 6 7 * Enter bugs at http://blackfin.uclinux.org/ 7 - * 8 - * Licensed under the GPL-2 or later. 9 8 */ 10 9 11 10 #if defined(CONFIG_SERIAL_BFIN_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) ··· 455 456 tty_flip_buffer_push(&uart->port.state->port); 456 457 } 457 458 458 - void bfin_serial_rx_dma_timeout(struct bfin_serial_port *uart) 459 + void bfin_serial_rx_dma_timeout(struct timer_list *t) 459 460 { 461 + struct bfin_serial_port *uart = from_timer(uart, t, rx_dma_timer); 460 462 int x_pos, pos; 461 463 unsigned long flags; 462 464 ··· 624 624 set_dma_start_addr(uart->rx_dma_channel, (unsigned long)uart->rx_dma_buf.buf); 625 625 enable_dma(uart->rx_dma_channel); 626 626 627 - uart->rx_dma_timer.data = (unsigned long)(uart); 628 - uart->rx_dma_timer.function = (void *)bfin_serial_rx_dma_timeout; 629 627 uart->rx_dma_timer.expires = jiffies + DMA_RX_FLUSH_JIFFIES; 630 628 add_timer(&(uart->rx_dma_timer)); 631 629 #else ··· 1314 1316 } 1315 1317 uart->rx_dma_channel = res->start; 1316 1318 1317 - init_timer(&(uart->rx_dma_timer)); 1319 + timer_setup(&uart->rx_dma_timer, bfin_serial_rx_dma_timeout, 0); 1318 1320 #endif 1319 1321 1320 1322 #if defined(SERIAL_BFIN_CTSRTS) || \
+1 -5
drivers/tty/serial/clps711x.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Driver for CLPS711x serial ports 3 4 * ··· 6 5 * 7 6 * Copyright 1999 ARM Limited 8 7 * Copyright (C) 2000 Deep Blue Solutions Ltd. 9 - * 10 - * This program is free software; you can redistribute it and/or modify 11 - * it under the terms of the GNU General Public License as published by 12 - * the Free Software Foundation; either version 2 of the License, or 13 - * (at your option) any later version. 14 8 */ 15 9 16 10 #if defined(CONFIG_SERIAL_CLPS711X_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
+1 -5
drivers/tty/serial/cpm_uart/cpm_uart.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Driver for CPM (SCC/SMC) serial ports 3 4 * ··· 6 5 * 7 6 * 2006 (c) MontaVista Software, Inc. 8 7 * Vitaly Bordug <vbordug@ru.mvista.com> 9 - * 10 - * This file is licensed under the terms of the GNU General Public License 11 - * version 2. This program is licensed "as is" without any warranty of any 12 - * kind, whether express or implied. 13 - * 14 8 */ 15 9 #ifndef CPM_UART_H 16 10 #define CPM_UART_H
+1 -15
drivers/tty/serial/cpm_uart/cpm_uart_core.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Driver for CPM (SCC/SMC) serial ports; core driver 3 4 * ··· 13 12 * (C) 2004 Intracom, S.A. 14 13 * (C) 2005-2006 MontaVista Software, Inc. 15 14 * Vitaly Bordug <vbordug@ru.mvista.com> 16 - * 17 - * This program is free software; you can redistribute it and/or modify 18 - * it under the terms of the GNU General Public License as published by 19 - * the Free Software Foundation; either version 2 of the License, or 20 - * (at your option) any later version. 21 - * 22 - * This program is distributed in the hope that it will be useful, 23 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 24 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 - * GNU General Public License for more details. 26 - * 27 - * You should have received a copy of the GNU General Public License 28 - * along with this program; if not, write to the Free Software 29 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 30 - * 31 15 */ 32 16 33 17 #include <linux/module.h>
+1 -15
drivers/tty/serial/cpm_uart/cpm_uart_cpm1.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Driver for CPM (SCC/SMC) serial ports; CPM1 definitions 3 4 * ··· 9 8 * (C) 2004 Intracom, S.A. 10 9 * (C) 2006 MontaVista Software, Inc. 11 10 * Vitaly Bordug <vbordug@ru.mvista.com> 12 - * 13 - * This program is free software; you can redistribute it and/or modify 14 - * it under the terms of the GNU General Public License as published by 15 - * the Free Software Foundation; either version 2 of the License, or 16 - * (at your option) any later version. 17 - * 18 - * This program is distributed in the hope that it will be useful, 19 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 - * GNU General Public License for more details. 22 - * 23 - * You should have received a copy of the GNU General Public License 24 - * along with this program; if not, write to the Free Software 25 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 26 - * 27 11 */ 28 12 29 13 #include <linux/module.h>
+1 -15
drivers/tty/serial/cpm_uart/cpm_uart_cpm2.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Driver for CPM (SCC/SMC) serial ports; CPM2 definitions 3 4 * ··· 9 8 * (C) 2004 Intracom, S.A. 10 9 * (C) 2006 MontaVista Software, Inc. 11 10 * Vitaly Bordug <vbordug@ru.mvista.com> 12 - * 13 - * This program is free software; you can redistribute it and/or modify 14 - * it under the terms of the GNU General Public License as published by 15 - * the Free Software Foundation; either version 2 of the License, or 16 - * (at your option) any later version. 17 - * 18 - * This program is distributed in the hope that it will be useful, 19 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 - * GNU General Public License for more details. 22 - * 23 - * You should have received a copy of the GNU General Public License 24 - * along with this program; if not, write to the Free Software 25 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 26 - * 27 11 */ 28 12 29 13 #include <linux/module.h>
+1 -5
drivers/tty/serial/digicolor-usart.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Driver for Conexant Digicolor serial ports (USART) 3 4 * 4 5 * Author: Baruch Siach <baruch@tkos.co.il> 5 6 * 6 7 * Copyright (C) 2014 Paradox Innovation Ltd. 7 - * 8 - * This program is free software; you can redistribute it and/or modify 9 - * it under the terms of the GNU General Public License as published by 10 - * the Free Software Foundation; either version 2 of the License, or 11 - * (at your option) any later version. 12 8 */ 13 9 14 10 #include <linux/module.h>
+1
drivers/tty/serial/dz.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * dz.c: Serial port driver for DECstations equipped 3 4 * with the DZ chipset.
+1 -12
drivers/tty/serial/earlycon-arm-semihost.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (C) 2012 ARM Ltd. 3 4 * Author: Marc Zyngier <marc.zyngier@arm.com> ··· 6 5 * Adapted for ARM and earlycon: 7 6 * Copyright (C) 2014 Linaro Ltd. 8 7 * Author: Rob Herring <robh@kernel.org> 9 - * 10 - * This program is free software: you can redistribute it and/or modify 11 - * it under the terms of the GNU General Public License version 2 as 12 - * published by the Free Software Foundation. 13 - * 14 - * This program is distributed in the hope that it will be useful, 15 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 - * GNU General Public License for more details. 18 - * 19 - * You should have received a copy of the GNU General Public License 20 - * along with this program. If not, see <http://www.gnu.org/licenses/>. 21 8 */ 22 9 #include <linux/kernel.h> 23 10 #include <linux/console.h>
+1 -4
drivers/tty/serial/earlycon.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (C) 2014 Linaro Ltd. 3 4 * Author: Rob Herring <robh@kernel.org> ··· 6 5 * Based on 8250 earlycon: 7 6 * (c) Copyright 2004 Hewlett-Packard Development Company, L.P. 8 7 * Bjorn Helgaas <bjorn.helgaas@hp.com> 9 - * 10 - * This program is free software: you can redistribute it and/or modify 11 - * it under the terms of the GNU General Public License version 2 as 12 - * published by the Free Software Foundation. 13 8 */ 14 9 15 10 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+1
drivers/tty/serial/efm32-uart.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 #if defined(CONFIG_SERIAL_EFM32_UART_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 2 3 #define SUPPORT_SYSRQ 3 4 #endif
+20 -13
drivers/tty/serial/fsl_lpuart.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Freescale lpuart serial port driver 3 4 * 4 5 * Copyright 2012-2014 Freescale Semiconductor, Inc. 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License as published by 8 - * the Free Software Foundation; either version 2 of the License, or 9 - * (at your option) any later version. 10 6 */ 11 7 12 8 #if defined(CONFIG_SERIAL_FSL_LPUART_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) ··· 1628 1632 { 1629 1633 struct lpuart_port *sport = container_of(port, struct lpuart_port, port); 1630 1634 unsigned long flags; 1631 - unsigned long ctrl, old_ctrl, bd, modem; 1635 + unsigned long ctrl, old_ctrl, modem; 1632 1636 unsigned int baud; 1633 1637 unsigned int old_csize = old ? old->c_cflag & CSIZE : CS8; 1634 1638 1635 1639 ctrl = old_ctrl = lpuart32_read(&sport->port, UARTCTRL); 1636 - bd = lpuart32_read(&sport->port, UARTBAUD); 1637 1640 modem = lpuart32_read(&sport->port, UARTMODIR); 1638 1641 /* 1639 1642 * only support CS8 and CS7, and for CS7 must enable PE. ··· 2207 2212 if (ret) 2208 2213 goto failed_attach_port; 2209 2214 2215 + of_get_rs485_mode(np, &sport->port.rs485); 2216 + 2217 + if (sport->port.rs485.flags & SER_RS485_RX_DURING_TX) { 2218 + dev_err(&pdev->dev, "driver doesn't support RX during TX\n"); 2219 + return -ENOSYS; 2220 + } 2221 + 2222 + if (sport->port.rs485.delay_rts_before_send || 2223 + sport->port.rs485.delay_rts_after_send) { 2224 + dev_err(&pdev->dev, "driver doesn't support RTS delays\n"); 2225 + return -ENOSYS; 2226 + } 2227 + 2228 + if (sport->port.rs485.flags & SER_RS485_ENABLED) { 2229 + sport->port.rs485.flags |= SER_RS485_RTS_ON_SEND; 2230 + writeb(UARTMODEM_TXRTSE, sport->port.membase + UARTMODEM); 2231 + } 2232 + 2210 2233 sport->dma_tx_chan = dma_request_slave_channel(sport->port.dev, "tx"); 2211 2234 if (!sport->dma_tx_chan) 2212 2235 dev_info(sport->port.dev, "DMA tx channel request failed, " ··· 2234 2221 if (!sport->dma_rx_chan) 2235 2222 dev_info(sport->port.dev, "DMA rx channel request failed, " 2236 2223 "operating without rx DMA\n"); 2237 - 2238 - if (of_property_read_bool(np, "linux,rs485-enabled-at-boot-time")) { 2239 - sport->port.rs485.flags |= SER_RS485_ENABLED; 2240 - sport->port.rs485.flags |= SER_RS485_RTS_ON_SEND; 2241 - writeb(UARTMODEM_TXRTSE, sport->port.membase + UARTMODEM); 2242 - } 2243 2224 2244 2225 return 0; 2245 2226
+1 -15
drivers/tty/serial/icom.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * icom.c 3 4 * ··· 7 6 * Serial device driver. 8 7 * 9 8 * Based on code from serial.c 10 - * 11 - * This program is free software; you can redistribute it and/or modify 12 - * it under the terms of the GNU General Public License as published by 13 - * the Free Software Foundation; either version 2 of the License, or 14 - * (at your option) any later version. 15 - * 16 - * This program is distributed in the hope that it will be useful, 17 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 - * GNU General Public License for more details. 20 - * 21 - * You should have received a copy of the GNU General Public License 22 - * along with this program; if not, write to the Free Software 23 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 - * 25 9 */ 26 10 #include <linux/module.h> 27 11 #include <linux/kernel.h>
+1 -14
drivers/tty/serial/icom.h
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * icom.h 3 4 * 4 5 * Copyright (C) 2001 Michael Anderson, IBM Corporation 5 6 * 6 7 * Serial device driver include file. 7 - * 8 - * This program is free software; you can redistribute it and/or modify 9 - * it under the terms of the GNU General Public License as published by 10 - * the Free Software Foundation; either version 2 of the License, or 11 - * (at your option) any later version. 12 - * 13 - * This program is distributed in the hope that it will be useful, 14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 - * GNU General Public License for more details. 17 - * 18 - * You should have received a copy of the GNU General Public License 19 - * along with this program; if not, write to the Free Software 20 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 8 */ 22 9 23 10 #include <linux/serial_core.h>
+3 -17
drivers/tty/serial/ifx6x60.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /**************************************************************************** 2 3 * 3 4 * Driver for the IFX 6x60 spi modem. ··· 10 9 * 11 10 * Copyright (C) 2009, 2010 Intel Corp 12 11 * Russ Gorby <russ.gorby@intel.com> 13 - * 14 - * This program is free software; you can redistribute it and/or modify 15 - * it under the terms of the GNU General Public License version 2 as 16 - * published by the Free Software Foundation. 17 - * 18 - * This program is distributed in the hope that it will be useful, 19 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 - * GNU General Public License for more details. 22 - * 23 - * You should have received a copy of the GNU General Public License 24 - * along with this program; if not, write to the Free Software 25 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 26 - * USA 27 12 * 28 13 * Driver modified by Intel from Option gtm501l_spi.c 29 14 * ··· 1016 1029 spin_lock_init(&ifx_dev->write_lock); 1017 1030 spin_lock_init(&ifx_dev->power_lock); 1018 1031 ifx_dev->power_status = 0; 1019 - init_timer(&ifx_dev->spi_timer); 1020 - ifx_dev->spi_timer.function = ifx_spi_timeout; 1021 - ifx_dev->spi_timer.data = (unsigned long)ifx_dev; 1032 + setup_timer(&ifx_dev->spi_timer, ifx_spi_timeout, 1033 + (unsigned long)ifx_dev); 1022 1034 ifx_dev->modem = pl_data->modem_type; 1023 1035 ifx_dev->use_dma = pl_data->use_dma; 1024 1036 ifx_dev->max_hz = pl_data->max_hz;
+1 -17
drivers/tty/serial/ifx6x60.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /**************************************************************************** 2 3 * 3 4 * Driver for the IFX spi modem. 4 5 * 5 6 * Copyright (C) 2009, 2010 Intel Corp 6 7 * Jim Stanley <jim.stanley@intel.com> 7 - * 8 - * 9 - * This program is free software; you can redistribute it and/or modify 10 - * it under the terms of the GNU General Public License version 2 as 11 - * published by the Free Software Foundation. 12 - * 13 - * This program is distributed in the hope that it will be useful, 14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 - * GNU General Public License for more details. 17 - * 18 - * You should have received a copy of the GNU General Public License 19 - * along with this program; if not, write to the Free Software 20 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 21 - * USA 22 - * 23 - * 24 8 * 25 9 *****************************************************************************/ 26 10 #ifndef _IFX6X60_H
+48 -55
drivers/tty/serial/imx.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Driver for Motorola/Freescale IMX serial ports 3 4 * ··· 6 5 * 7 6 * Author: Sascha Hauer <sascha@saschahauer.de> 8 7 * Copyright (C) 2004 Pengutronix 9 - * 10 - * This program is free software; you can redistribute it and/or modify 11 - * it under the terms of the GNU General Public License as published by 12 - * the Free Software Foundation; either version 2 of the License, or 13 - * (at your option) any later version. 14 - * 15 - * This program is distributed in the hope that it will be useful, 16 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 - * GNU General Public License for more details. 19 8 */ 20 9 21 10 #if defined(CONFIG_SERIAL_IMX_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) ··· 325 334 { 326 335 *ucr2 &= ~(UCR2_CTSC | UCR2_CTS); 327 336 328 - mctrl_gpio_set(sport->gpios, sport->port.mctrl | TIOCM_RTS); 337 + sport->port.mctrl |= TIOCM_RTS; 338 + mctrl_gpio_set(sport->gpios, sport->port.mctrl); 329 339 } 330 340 331 341 static void imx_port_rts_inactive(struct imx_port *sport, unsigned long *ucr2) ··· 334 342 *ucr2 &= ~UCR2_CTSC; 335 343 *ucr2 |= UCR2_CTS; 336 344 337 - mctrl_gpio_set(sport->gpios, sport->port.mctrl & ~TIOCM_RTS); 345 + sport->port.mctrl &= ~TIOCM_RTS; 346 + mctrl_gpio_set(sport->gpios, sport->port.mctrl); 338 347 } 339 348 340 349 static void imx_port_rts_auto(struct imx_port *sport, unsigned long *ucr2) ··· 707 714 { 708 715 unsigned long temp; 709 716 710 - sport->dma_is_rxing = 1; 711 - 712 717 /* disable the receiver ready and aging timer interrupts */ 713 718 temp = readl(sport->port.membase + UCR1); 714 719 temp &= ~(UCR1_RRDYEN); ··· 723 732 } 724 733 725 734 static void clear_rx_errors(struct imx_port *sport); 726 - static int start_rx_dma(struct imx_port *sport); 727 - /* 728 - * If the RXFIFO is filled with some data, and then we 729 - * arise a DMA operation to receive them. 730 - */ 731 - static void imx_dma_rxint(struct imx_port *sport) 732 - { 733 - unsigned long temp; 734 - unsigned long flags; 735 - 736 - spin_lock_irqsave(&sport->port.lock, flags); 737 - 738 - temp = readl(sport->port.membase + USR2); 739 - if ((temp & USR2_RDR) && !sport->dma_is_rxing) { 740 - 741 - imx_disable_rx_int(sport); 742 - 743 - /* tell the DMA to receive the data. */ 744 - start_rx_dma(sport); 745 - } 746 - 747 - spin_unlock_irqrestore(&sport->port.lock, flags); 748 - } 749 735 750 736 /* 751 737 * We have a modem side uart, so the meanings of RTS and CTS are inverted. ··· 784 816 sts = readl(sport->port.membase + USR1); 785 817 sts2 = readl(sport->port.membase + USR2); 786 818 787 - if (sts & (USR1_RRDY | USR1_AGTIM)) { 788 - if (sport->dma_is_enabled) 789 - imx_dma_rxint(sport); 790 - else 791 - imx_rxint(irq, dev_id); 819 + if (!sport->dma_is_enabled && (sts & (USR1_RRDY | USR1_AGTIM))) { 820 + imx_rxint(irq, dev_id); 792 821 ret = IRQ_HANDLED; 793 822 } 794 823 ··· 1039 1074 desc->callback_param = sport; 1040 1075 1041 1076 dev_dbg(dev, "RX: prepare for the DMA.\n"); 1077 + sport->dma_is_rxing = 1; 1042 1078 sport->rx_cookie = dmaengine_submit(desc); 1043 1079 dma_async_issue_pending(chan); 1044 1080 return 0; ··· 1131 1165 goto err; 1132 1166 } 1133 1167 1134 - sport->rx_buf = kzalloc(PAGE_SIZE, GFP_KERNEL); 1168 + sport->rx_buf = kzalloc(RX_BUF_SIZE, GFP_KERNEL); 1135 1169 if (!sport->rx_buf) { 1136 1170 ret = -ENOMEM; 1137 1171 goto err; ··· 1172 1206 temp = readl(sport->port.membase + UCR1); 1173 1207 temp |= UCR1_RDMAEN | UCR1_TDMAEN | UCR1_ATDMAEN; 1174 1208 writel(temp, sport->port.membase + UCR1); 1175 - 1176 - temp = readl(sport->port.membase + UCR2); 1177 - temp |= UCR2_ATEN; 1178 - writel(temp, sport->port.membase + UCR2); 1179 1209 1180 1210 imx_setup_ufcr(sport, TXTL_DMA, RXTL_DMA); 1181 1211 ··· 1373 1411 temp = readl(sport->port.membase + UCR1); 1374 1412 temp &= ~UCR1_TDMAEN; 1375 1413 writel(temp, sport->port.membase + UCR1); 1376 - sport->dma_is_txing = false; 1414 + sport->dma_is_txing = 0; 1377 1415 } 1378 1416 1379 1417 /* 1380 1418 * According to the Reference Manual description of the UART SRST bit: 1419 + * 1381 1420 * "Reset the transmit and receive state machines, 1382 1421 * all FIFOs and register USR1, USR2, UBIR, UBMR, UBRC, URXD, UTXD 1383 - * and UTS[6-3]". As we don't need to restore the old values from 1384 - * USR1, USR2, URXD, UTXD, only save/restore the other four registers 1422 + * and UTS[6-3]". 1423 + * 1424 + * We don't need to restore the old values from USR1, USR2, URXD and 1425 + * UTXD. UBRC is read only, so only save/restore the other three 1426 + * registers. 1385 1427 */ 1386 1428 ubir = readl(sport->port.membase + UBIR); 1387 1429 ubmr = readl(sport->port.membase + UBMR); ··· 2017 2051 if (of_get_property(np, "rts-gpios", NULL)) 2018 2052 sport->have_rtsgpio = 1; 2019 2053 2054 + of_get_rs485_mode(np, &sport->port.rs485); 2055 + 2020 2056 return 0; 2021 2057 } 2022 2058 #else ··· 2080 2112 sport->port.fifosize = 32; 2081 2113 sport->port.ops = &imx_pops; 2082 2114 sport->port.rs485_config = imx_rs485_config; 2083 - sport->port.rs485.flags = 2084 - SER_RS485_RTS_ON_SEND | SER_RS485_RX_DURING_TX; 2115 + sport->port.rs485.flags |= SER_RS485_RTS_ON_SEND; 2085 2116 sport->port.flags = UPF_BOOT_AUTOCONF; 2086 - init_timer(&sport->timer); 2087 - sport->timer.function = imx_timeout; 2088 - sport->timer.data = (unsigned long)sport; 2117 + setup_timer(&sport->timer, imx_timeout, (unsigned long)sport); 2089 2118 2090 2119 sport->gpios = mctrl_gpio_init(&sport->port, 0); 2091 2120 if (IS_ERR(sport->gpios)) ··· 2311 2346 return 0; 2312 2347 } 2313 2348 2349 + static int imx_serial_port_freeze(struct device *dev) 2350 + { 2351 + struct platform_device *pdev = to_platform_device(dev); 2352 + struct imx_port *sport = platform_get_drvdata(pdev); 2353 + 2354 + uart_suspend_port(&imx_reg, &sport->port); 2355 + 2356 + /* Needed to enable clock in suspend_noirq */ 2357 + return clk_prepare(sport->clk_ipg); 2358 + } 2359 + 2360 + static int imx_serial_port_thaw(struct device *dev) 2361 + { 2362 + struct platform_device *pdev = to_platform_device(dev); 2363 + struct imx_port *sport = platform_get_drvdata(pdev); 2364 + 2365 + uart_resume_port(&imx_reg, &sport->port); 2366 + 2367 + clk_unprepare(sport->clk_ipg); 2368 + 2369 + return 0; 2370 + } 2371 + 2314 2372 static const struct dev_pm_ops imx_serial_port_pm_ops = { 2315 2373 .suspend_noirq = imx_serial_port_suspend_noirq, 2316 2374 .resume_noirq = imx_serial_port_resume_noirq, 2375 + .freeze_noirq = imx_serial_port_suspend_noirq, 2376 + .restore_noirq = imx_serial_port_resume_noirq, 2317 2377 .suspend = imx_serial_port_suspend, 2318 2378 .resume = imx_serial_port_resume, 2379 + .freeze = imx_serial_port_freeze, 2380 + .thaw = imx_serial_port_thaw, 2381 + .restore = imx_serial_port_thaw, 2319 2382 }; 2320 2383 2321 2384 static struct platform_driver serial_imx_driver = {
+1 -4
drivers/tty/serial/ioc3_serial.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 - * This file is subject to the terms and conditions of the GNU General Public 3 - * License. See the file "COPYING" in the main directory of this archive 4 - * for more details. 5 - * 6 3 * Copyright (C) 2005 Silicon Graphics, Inc. All Rights Reserved. 7 4 */ 8 5
+1 -4
drivers/tty/serial/ioc4_serial.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 - * This file is subject to the terms and conditions of the GNU General Public 3 - * License. See the file "COPYING" in the main directory of this archive 4 - * for more details. 5 - * 6 3 * Copyright (C) 2003-2006 Silicon Graphics, Inc. All Rights Reserved. 7 4 */ 8 5
+1
drivers/tty/serial/ip22zilog.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Driver for Zilog serial chips found on SGI workstations and 3 4 * servers. This driver could actually be made more generic.
+1 -10
drivers/tty/serial/jsm/jsm.h
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /************************************************************************ 2 3 * Copyright 2003 Digi International (www.digi.com) 3 4 * 4 5 * Copyright (C) 2004 IBM Corporation. All rights reserved. 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License as published by 8 - * the Free Software Foundation; either version 2, or (at your option) 9 - * any later version. 10 - * 11 - * This program is distributed in the hope that it will be useful, 12 - * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the 13 - * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 14 - * PURPOSE. See the GNU General Public License for more details. 15 6 * 16 7 * Contact Information: 17 8 * Scott H Kilau <Scott_Kilau@digi.com>
+1 -10
drivers/tty/serial/jsm/jsm_cls.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Copyright 2003 Digi International (www.digi.com) 3 4 * Scott H Kilau <Scott_Kilau at digi dot com> 4 - * 5 - * This program is free software; you can redistribute it and/or modify 6 - * it under the terms of the GNU General Public License as published by 7 - * the Free Software Foundation; either version 2, or (at your option) 8 - * any later version. 9 - * 10 - * This program is distributed in the hope that it will be useful, 11 - * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the 12 - * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 13 - * PURPOSE. See the GNU General Public License for more details. 14 5 * 15 6 * NOTE TO LINUX KERNEL HACKERS: DO NOT REFORMAT THIS CODE! 16 7 *
+1 -10
drivers/tty/serial/jsm/jsm_driver.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /************************************************************************ 2 3 * Copyright 2003 Digi International (www.digi.com) 3 4 * 4 5 * Copyright (C) 2004 IBM Corporation. All rights reserved. 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License as published by 8 - * the Free Software Foundation; either version 2, or (at your option) 9 - * any later version. 10 - * 11 - * This program is distributed in the hope that it will be useful, 12 - * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the 13 - * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 14 - * PURPOSE. See the GNU General Public License for more details. 15 6 * 16 7 * Contact Information: 17 8 * Scott H Kilau <Scott_Kilau@digi.com>
+1 -10
drivers/tty/serial/jsm/jsm_neo.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /************************************************************************ 2 3 * Copyright 2003 Digi International (www.digi.com) 3 4 * 4 5 * Copyright (C) 2004 IBM Corporation. All rights reserved. 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License as published by 8 - * the Free Software Foundation; either version 2, or (at your option) 9 - * any later version. 10 - * 11 - * This program is distributed in the hope that it will be useful, 12 - * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the 13 - * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 14 - * PURPOSE. See the GNU General Public License for more details. 15 6 * 16 7 * Contact Information: 17 8 * Scott H Kilau <Scott_Kilau@digi.com>
+8 -19
drivers/tty/serial/jsm/jsm_tty.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /************************************************************************ 2 3 * Copyright 2003 Digi International (www.digi.com) 3 4 * 4 5 * Copyright (C) 2004 IBM Corporation. All rights reserved. 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License as published by 8 - * the Free Software Foundation; either version 2, or (at your option) 9 - * any later version. 10 - * 11 - * This program is distributed in the hope that it will be useful, 12 - * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the 13 - * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 14 - * PURPOSE. See the GNU General Public License for more details. 15 6 * 16 7 * Contact Information: 17 8 * Scott H Kilau <Scott_Kilau@digi.com> ··· 27 36 static inline int jsm_get_mstat(struct jsm_channel *ch) 28 37 { 29 38 unsigned char mstat; 30 - unsigned result; 39 + int result; 31 40 32 41 jsm_dbg(IOCTL, &ch->ch_bd->pci_dev, "start\n"); 33 42 ··· 115 124 static void jsm_tty_write(struct uart_port *port) 116 125 { 117 126 struct jsm_channel *channel; 127 + 118 128 channel = container_of(port, struct jsm_channel, uart_port); 119 129 channel->ch_bd->bd_ops->copy_data_from_queue_to_uart(channel); 120 130 } ··· 267 275 static void jsm_tty_close(struct uart_port *port) 268 276 { 269 277 struct jsm_board *bd; 270 - struct ktermios *ts; 271 278 struct jsm_channel *channel = 272 279 container_of(port, struct jsm_channel, uart_port); 273 280 274 281 jsm_dbg(CLOSE, &channel->ch_bd->pci_dev, "start\n"); 275 282 276 283 bd = channel->ch_bd; 277 - ts = &port->state->port.tty->termios; 278 284 279 285 channel->ch_flags &= ~(CH_STOPI); 280 286 ··· 463 473 } else 464 474 set_bit(line, linemap); 465 475 brd->channels[i]->uart_port.line = line; 466 - rc = uart_add_one_port (&jsm_uart_driver, &brd->channels[i]->uart_port); 467 - if (rc){ 476 + rc = uart_add_one_port(&jsm_uart_driver, &brd->channels[i]->uart_port); 477 + if (rc) { 468 478 printk(KERN_INFO "jsm: Port %d failed. Aborting...\n", i); 469 479 return rc; 470 - } 471 - else 480 + } else 472 481 printk(KERN_INFO "jsm: Port %d added\n", i); 473 482 } 474 483 ··· 530 541 tp = port->tty; 531 542 532 543 bd = ch->ch_bd; 533 - if(!bd) 544 + if (!bd) 534 545 return; 535 546 536 547 spin_lock_irqsave(&ch->ch_lock, lock_flags); ··· 770 781 if (qleft < 256) { 771 782 /* HWFLOW */ 772 783 if (ch->ch_c_cflag & CRTSCTS) { 773 - if(!(ch->ch_flags & CH_RECEIVER_OFF)) { 784 + if (!(ch->ch_flags & CH_RECEIVER_OFF)) { 774 785 bd_ops->disable_receiver(ch); 775 786 ch->ch_flags |= (CH_RECEIVER_OFF); 776 787 jsm_dbg(READ, &ch->ch_bd->pci_dev,
+1 -4
drivers/tty/serial/kgdb_nmi.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * KGDB NMI serial console 3 4 * ··· 7 6 * Colin Cross <ccross@android.com> 8 7 * Copyright 2012 Linaro Ltd. 9 8 * Anton Vorontsov <anton.vorontsov@linaro.org> 10 - * 11 - * This program is free software; you can redistribute it and/or modify it 12 - * under the terms of the GNU General Public License version 2 as published 13 - * by the Free Software Foundation. 14 9 */ 15 10 16 11 #include <linux/kernel.h>
+1 -4
drivers/tty/serial/kgdboc.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Based on the same principle as kgdboe using the NETPOLL api, this 3 4 * driver uses a console polling api to implement a gdb serial inteface ··· 7 6 * Maintainer: Jason Wessel <jason.wessel@windriver.com> 8 7 * 9 8 * 2007-2008 (c) Jason Wessel - Wind River Systems, Inc. 10 - * 11 - * This file is licensed under the terms of the GNU General Public 12 - * License version 2. This program is licensed "as is" without any 13 - * warranty of any kind, whether express or implied. 14 9 */ 15 10 #include <linux/kernel.h> 16 11 #include <linux/ctype.h>
+1 -13
drivers/tty/serial/lantiq.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o. 3 - * 4 - * This program is free software; you can redistribute it and/or modify it 5 - * under the terms of the GNU General Public License version 2 as published 6 - * by the Free Software Foundation. 7 - * 8 - * This program is distributed in the hope that it will be useful, 9 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 - * GNU General Public License for more details. 12 - * 13 - * You should have received a copy of the GNU General Public License 14 - * along with this program; if not, write to the Free Software 15 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 4 * 17 5 * Copyright (C) 2004 Infineon IFAP DC COM CPE 18 6 * Copyright (C) 2007 Felix Fietkau <nbd@openwrt.org>
+1 -10
drivers/tty/serial/lpc32xx_hs.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * High Speed Serial Ports on NXP LPC32xx SoC 3 4 * ··· 7 6 * 8 7 * Copyright (C) 2010 NXP Semiconductors 9 8 * Copyright (C) 2012 Roland Stigge 10 - * 11 - * This program is free software; you can redistribute it and/or modify 12 - * it under the terms of the GNU General Public License as published by 13 - * the Free Software Foundation; either version 2 of the License, or 14 - * (at your option) any later version. 15 - * 16 - * This program is distributed in the hope that it will be useful, 17 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 - * GNU General Public License for more details. 20 9 */ 21 10 22 11 #include <linux/module.h>
+4 -10
drivers/tty/serial/m32r_sio.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * m32r_sio.c 3 4 * ··· 9 8 * 10 9 * Copyright (C) 2001 Russell King. 11 10 * Copyright (C) 2004 Hirokazu Takata <takata at linux-m32r.org> 12 - * 13 - * This program is free software; you can redistribute it and/or modify 14 - * it under the terms of the GNU General Public License as published by 15 - * the Free Software Foundation; either version 2 of the License, or 16 - * (at your option) any later version. 17 11 */ 18 12 19 13 /* ··· 507 511 /* 508 512 * This function is used to handle ports that do not have an interrupt. 509 513 */ 510 - static void m32r_sio_timeout(unsigned long data) 514 + static void m32r_sio_timeout(struct timer_list *t) 511 515 { 512 - struct uart_sio_port *up = (struct uart_sio_port *)data; 516 + struct uart_sio_port *up = from_timer(up, t, timer); 513 517 unsigned int timeout; 514 518 unsigned int sts; 515 519 ··· 572 576 573 577 timeout = timeout > 6 ? (timeout / 2 - 2) : 1; 574 578 575 - up->timer.data = (unsigned long)up; 576 579 mod_timer(&up->timer, jiffies + timeout); 577 580 } else { 578 581 retval = serial_link_irq_chain(up); ··· 902 907 903 908 up->port.line = i; 904 909 up->port.ops = &m32r_sio_pops; 905 - init_timer(&up->timer); 906 - up->timer.function = m32r_sio_timeout; 910 + timer_setup(&up->timer, m32r_sio_timeout, 0); 907 911 908 912 uart_add_one_port(drv, &up->port); 909 913 }
+1 -3
drivers/tty/serial/m32r_sio_reg.h
··· 1 + // SPDX-License-Identifier: GPL-1.0+ 1 2 /* 2 3 * m32r_sio_reg.h 3 4 * 4 5 * Copyright (C) 1992, 1994 by Theodore Ts'o. 5 6 * Copyright (C) 2004 Hirokazu Takata <takata at linux-m32r.org> 6 - * 7 - * Redistribution of this file is permitted under the terms of the GNU 8 - * Public License (GPL) 9 7 * 10 8 * These are the UART port assignments, expressed as offsets from the base 11 9 * register. These assignments should hold for any serial port based on
+4 -12
drivers/tty/serial/max3100.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * 3 4 * Copyright (C) 2008 Christian Pellegrin <chripell@evolware.org> 4 - * 5 - * This program is free software; you can redistribute it and/or modify 6 - * it under the terms of the GNU General Public License as published by 7 - * the Free Software Foundation; either version 2 of the License, or 8 - * (at your option) any later version. 9 - * 10 5 * 11 6 * Notes: the MAX3100 doesn't provide an interrupt on CTS so we have 12 7 * to use polling for flow control. TX empty IRQ is unusable, since ··· 258 263 struct max3100_port *s = container_of(w, struct max3100_port, work); 259 264 int rxchars; 260 265 u16 tx, rx; 261 - int conf, cconf, rts, crts; 266 + int conf, cconf, crts; 262 267 struct circ_buf *xmit = &s->port.state->xmit; 263 268 264 269 dev_dbg(&s->spi->dev, "%s\n", __func__); ··· 269 274 conf = s->conf; 270 275 cconf = s->conf_commit; 271 276 s->conf_commit = 0; 272 - rts = s->rts; 273 277 crts = s->rts_commit; 274 278 s->rts_commit = 0; 275 279 spin_unlock(&s->conf_lock); ··· 430 436 dev_dbg(&s->spi->dev, "%s\n", __func__); 431 437 432 438 cflag = termios->c_cflag; 433 - param_new = 0; 434 439 param_mask = 0; 435 440 436 441 baud = tty_termios_baud_rate(termios); ··· 780 787 max3100s[i]->poll_time = 1; 781 788 max3100s[i]->max3100_hw_suspend = pdata->max3100_hw_suspend; 782 789 max3100s[i]->minor = i; 783 - init_timer(&max3100s[i]->timer); 784 - max3100s[i]->timer.function = max3100_timeout; 785 - max3100s[i]->timer.data = (unsigned long) max3100s[i]; 790 + setup_timer(&max3100s[i]->timer, max3100_timeout, 791 + (unsigned long)max3100s[i]); 786 792 787 793 dev_dbg(&spi->dev, "%s: adding port %d\n", __func__, i); 788 794 max3100s[i]->port.irq = max3100s[i]->irq;
+1 -5
drivers/tty/serial/max310x.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Maxim (Dallas) MAX3107/8/9, MAX14830 serial driver 3 4 * ··· 7 6 * Based on max3100.c, by Christian Pellegrin <chripell@evolware.org> 8 7 * Based on max3110.c, by Feng Tang <feng.tang@intel.com> 9 8 * Based on max3107.c, by Aavamobile 10 - * 11 - * This program is free software; you can redistribute it and/or modify 12 - * it under the terms of the GNU General Public License as published by 13 - * the Free Software Foundation; either version 2 of the License, or 14 - * (at your option) any later version. 15 9 */ 16 10 17 11 #include <linux/bitops.h>
+1 -5
drivers/tty/serial/mcf.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /****************************************************************************/ 2 3 3 4 /* 4 5 * mcf.c -- Freescale ColdFire UART driver 5 6 * 6 7 * (C) Copyright 2003-2007, Greg Ungerer <gerg@uclinux.org> 7 - * 8 - * This program is free software; you can redistribute it and/or modify 9 - * it under the terms of the GNU General Public License as published by 10 - * the Free Software Foundation; either version 2 of the License, or 11 - * (at your option) any later version. 12 8 */ 13 9 14 10 /****************************************************************************/
+1 -4
drivers/tty/serial/men_z135_uart.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * MEN 16z135 High Speed UART 3 4 * 4 5 * Copyright (C) 2014 MEN Mikroelektronik GmbH (www.men.de) 5 6 * Author: Johannes Thumshirn <johannes.thumshirn@men.de> 6 - * 7 - * This program is free software; you can redistribute it and/or modify it 8 - * under the terms of the GNU General Public License as published by the Free 9 - * Software Foundation; version 2 of the License. 10 7 */ 11 8 #define pr_fmt(fmt) KBUILD_MODNAME ":" fmt 12 9
+18 -13
drivers/tty/serial/meson_uart.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Based on meson_uart.c, by AMLOGIC, INC. 3 4 * 4 5 * Copyright (C) 2014 Carlo Caione <carlo@caione.org> 5 - * 6 - * This program is free software; you can redistribute it and/or modify it 7 - * under the terms of the GNU General Public License version 2 as published 8 - * by the Free Software Foundation. 9 - * 10 - * This program is distributed in the hope that it will be useful, 11 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 - * GNU General Public License for more details. 14 - * 15 6 */ 7 + 8 + #if defined(CONFIG_SERIAL_MESON_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 9 + #define SUPPORT_SYSRQ 10 + #endif 16 11 17 12 #include <linux/clk.h> 18 13 #include <linux/console.h> ··· 178 183 { 179 184 struct tty_port *tport = &port->state->port; 180 185 char flag; 181 - u32 status, ch, mode; 186 + u32 ostatus, status, ch, mode; 182 187 183 188 do { 184 189 flag = TTY_NORMAL; 185 190 port->icount.rx++; 186 - status = readl(port->membase + AML_UART_STATUS); 191 + ostatus = status = readl(port->membase + AML_UART_STATUS); 187 192 188 193 if (status & AML_UART_ERR) { 189 194 if (status & AML_UART_TX_FIFO_WERR) ··· 210 215 211 216 ch = readl(port->membase + AML_UART_RFIFO); 212 217 ch &= 0xff; 218 + 219 + if ((ostatus & AML_UART_FRAME_ERR) && (ch == 0)) { 220 + port->icount.brk++; 221 + flag = TTY_BREAK; 222 + if (uart_handle_break(port)) 223 + continue; 224 + } 225 + 226 + if (uart_handle_sysrq_char(port, ch)) 227 + continue; 213 228 214 229 if ((status & port->ignore_status_mask) == 0) 215 230 tty_insert_flip_char(tport, ch, flag); ··· 367 362 368 363 writel(val, port->membase + AML_UART_CONTROL); 369 364 370 - baud = uart_get_baud_rate(port, termios, old, 9600, 4000000); 365 + baud = uart_get_baud_rate(port, termios, old, 50, 4000000); 371 366 meson_uart_change_speed(port, baud); 372 367 373 368 port->read_status_mask = AML_UART_TX_FIFO_WERR;
+1 -4
drivers/tty/serial/mpc52xx_uart.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Driver for the PSC of the Freescale MPC52xx PSCs configured as UARTs. 3 4 * ··· 24 23 * Grant Likely <grant.likely@secretlab.ca> 25 24 * Copyright (C) 2004-2006 Sylvain Munaut <tnt@246tNt.com> 26 25 * Copyright (C) 2003 MontaVista, Software, Inc. 27 - * 28 - * This file is licensed under the terms of the GNU General Public License 29 - * version 2. This program is licensed "as is" without any warranty of any 30 - * kind, whether express or implied. 31 26 */ 32 27 33 28 #undef DEBUG
+1 -4
drivers/tty/serial/mps2-uart.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * MPS2 UART driver 3 4 * 4 5 * Copyright (C) 2015 ARM Limited 5 6 * 6 7 * Author: Vladimir Murzin <vladimir.murzin@arm.com> 7 - * 8 - * This program is free software; you can redistribute it and/or modify 9 - * it under the terms of the GNU General Public License version 2 as 10 - * published by the Free Software Foundation. 11 8 * 12 9 * TODO: support for SysRq 13 10 */
+2 -4
drivers/tty/serial/mpsc.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Generic driver for the MPSC (UART mode) on Marvell parts (e.g., GT64240, 3 4 * GT64260, MV64340, MV64360, GT96100, ... ). ··· 11 10 * taken from PPCBoot (now U-Boot). Also based on drivers/serial/8250.c 12 11 * by Russell King. 13 12 * 14 - * 2004 (c) MontaVista, Software, Inc. This file is licensed under 15 - * the terms of the GNU General Public License version 2. This program 16 - * is licensed "as is" without any warranty of any kind, whether express 17 - * or implied. 13 + * 2004 (c) MontaVista, Software, Inc. 18 14 */ 19 15 /* 20 16 * The MPSC interface is much like a typical network controller's interface.
+1 -9
drivers/tty/serial/msm_serial.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Driver for msm7k serial device and console 3 4 * 4 5 * Copyright (C) 2007 Google, Inc. 5 6 * Author: Robert Love <rlove@google.com> 6 7 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 7 - * 8 - * This software is licensed under the terms of the GNU General Public 9 - * License version 2, as published by the Free Software Foundation, and 10 - * may be copied, distributed, and modified under those terms. 11 - * 12 - * This program is distributed in the hope that it will be useful, 13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 - * GNU General Public License for more details. 16 8 */ 17 9 18 10 #if defined(CONFIG_SERIAL_MSM_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
+2 -7
drivers/tty/serial/mux.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 ** mux.c: 3 4 ** serial driver for the Mux console found in some PA-RISC servers. 4 5 ** 5 6 ** (c) Copyright 2002 Ryan Bradetich 6 7 ** (c) Copyright 2002 Hewlett-Packard Company 7 - ** 8 - ** This program is free software; you can redistribute it and/or modify 9 - ** it under the terms of the GNU General Public License as published by 10 - ** the Free Software Foundation; either version 2 of the License, or 11 - ** (at your option) any later version. 12 8 ** 13 9 ** This Driver currently only supports the console (port 0) on the MUX. 14 10 ** Additional work will be needed on this driver to enable the full ··· 572 576 573 577 if(port_cnt > 0) { 574 578 /* Start the Mux timer */ 575 - init_timer(&mux_timer); 576 - mux_timer.function = mux_poll; 579 + setup_timer(&mux_timer, mux_poll, 0UL); 577 580 mod_timer(&mux_timer, jiffies + MUX_POLL_DELAY); 578 581 579 582 #ifdef CONFIG_SERIAL_MUX_CONSOLE
+389 -106
drivers/tty/serial/mvebu-uart.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * *************************************************************************** 3 4 * Marvell Armada-3700 Serial Driver 4 5 * Author: Wilson Ding <dingwei@marvell.com> 5 6 * Copyright (C) 2015 Marvell International Ltd. 6 - * *************************************************************************** 7 - * This program is free software: you can redistribute it and/or modify it 8 - * under the terms of the GNU General Public License as published by the Free 9 - * Software Foundation, either version 2 of the License, or any later version. 10 - * 11 - * This program is distributed in the hope that it will be useful, 12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - * GNU General Public License for more details. 15 - * 16 - * You should have received a copy of the GNU General Public License 17 - * along with this program. If not, see <http://www.gnu.org/licenses/>. 18 7 * *************************************************************************** 19 8 */ 20 9 ··· 27 38 #include <linux/tty_flip.h> 28 39 29 40 /* Register Map */ 30 - #define UART_RBR 0x00 31 - #define RBR_BRK_DET BIT(15) 32 - #define RBR_FRM_ERR_DET BIT(14) 33 - #define RBR_PAR_ERR_DET BIT(13) 34 - #define RBR_OVR_ERR_DET BIT(12) 41 + #define UART_STD_RBR 0x00 42 + #define UART_EXT_RBR 0x18 35 43 36 - #define UART_TSH 0x04 44 + #define UART_STD_TSH 0x04 45 + #define UART_EXT_TSH 0x1C 37 46 38 - #define UART_CTRL 0x08 47 + #define UART_STD_CTRL1 0x08 48 + #define UART_EXT_CTRL1 0x04 39 49 #define CTRL_SOFT_RST BIT(31) 40 50 #define CTRL_TXFIFO_RST BIT(15) 41 51 #define CTRL_RXFIFO_RST BIT(14) 42 - #define CTRL_ST_MIRR_EN BIT(13) 43 - #define CTRL_LPBK_EN BIT(12) 44 52 #define CTRL_SND_BRK_SEQ BIT(11) 45 - #define CTRL_PAR_EN BIT(10) 46 - #define CTRL_TWO_STOP BIT(9) 47 - #define CTRL_TX_HFL_INT BIT(8) 48 - #define CTRL_RX_HFL_INT BIT(7) 49 - #define CTRL_TX_EMP_INT BIT(6) 50 - #define CTRL_TX_RDY_INT BIT(5) 51 - #define CTRL_RX_RDY_INT BIT(4) 52 53 #define CTRL_BRK_DET_INT BIT(3) 53 54 #define CTRL_FRM_ERR_INT BIT(2) 54 55 #define CTRL_PAR_ERR_INT BIT(1) 55 56 #define CTRL_OVR_ERR_INT BIT(0) 56 - #define CTRL_RX_INT (CTRL_RX_RDY_INT | CTRL_BRK_DET_INT |\ 57 - CTRL_FRM_ERR_INT | CTRL_PAR_ERR_INT | CTRL_OVR_ERR_INT) 57 + #define CTRL_BRK_INT (CTRL_BRK_DET_INT | CTRL_FRM_ERR_INT | \ 58 + CTRL_PAR_ERR_INT | CTRL_OVR_ERR_INT) 58 59 59 - #define UART_STAT 0x0c 60 + #define UART_STD_CTRL2 UART_STD_CTRL1 61 + #define UART_EXT_CTRL2 0x20 62 + #define CTRL_STD_TX_RDY_INT BIT(5) 63 + #define CTRL_EXT_TX_RDY_INT BIT(6) 64 + #define CTRL_STD_RX_RDY_INT BIT(4) 65 + #define CTRL_EXT_RX_RDY_INT BIT(5) 66 + 67 + #define UART_STAT 0x0C 60 68 #define STAT_TX_FIFO_EMP BIT(13) 61 - #define STAT_RX_FIFO_EMP BIT(12) 62 69 #define STAT_TX_FIFO_FUL BIT(11) 63 - #define STAT_TX_FIFO_HFL BIT(10) 64 - #define STAT_RX_TOGL BIT(9) 65 - #define STAT_RX_FIFO_FUL BIT(8) 66 - #define STAT_RX_FIFO_HFL BIT(7) 67 70 #define STAT_TX_EMP BIT(6) 68 - #define STAT_TX_RDY BIT(5) 69 - #define STAT_RX_RDY BIT(4) 71 + #define STAT_STD_TX_RDY BIT(5) 72 + #define STAT_EXT_TX_RDY BIT(15) 73 + #define STAT_STD_RX_RDY BIT(4) 74 + #define STAT_EXT_RX_RDY BIT(14) 70 75 #define STAT_BRK_DET BIT(3) 71 76 #define STAT_FRM_ERR BIT(2) 72 77 #define STAT_PAR_ERR BIT(1) ··· 69 86 | STAT_PAR_ERR | STAT_OVR_ERR) 70 87 71 88 #define UART_BRDV 0x10 89 + #define BRDV_BAUD_MASK 0x3FF 72 90 73 - #define MVEBU_NR_UARTS 1 91 + #define MVEBU_NR_UARTS 2 74 92 75 93 #define MVEBU_UART_TYPE "mvebu-uart" 94 + #define DRIVER_NAME "mvebu_serial" 95 + 96 + enum { 97 + /* Either there is only one summed IRQ... */ 98 + UART_IRQ_SUM = 0, 99 + /* ...or there are two separate IRQ for RX and TX */ 100 + UART_RX_IRQ = 0, 101 + UART_TX_IRQ, 102 + UART_IRQ_COUNT 103 + }; 104 + 105 + /* Diverging register offsets */ 106 + struct uart_regs_layout { 107 + unsigned int rbr; 108 + unsigned int tsh; 109 + unsigned int ctrl; 110 + unsigned int intr; 111 + }; 112 + 113 + /* Diverging flags */ 114 + struct uart_flags { 115 + unsigned int ctrl_tx_rdy_int; 116 + unsigned int ctrl_rx_rdy_int; 117 + unsigned int stat_tx_rdy; 118 + unsigned int stat_rx_rdy; 119 + }; 120 + 121 + /* Driver data, a structure for each UART port */ 122 + struct mvebu_uart_driver_data { 123 + bool is_ext; 124 + struct uart_regs_layout regs; 125 + struct uart_flags flags; 126 + }; 127 + 128 + /* MVEBU UART driver structure */ 129 + struct mvebu_uart { 130 + struct uart_port *port; 131 + struct clk *clk; 132 + int irq[UART_IRQ_COUNT]; 133 + unsigned char __iomem *nb; 134 + struct mvebu_uart_driver_data *data; 135 + }; 136 + 137 + static struct mvebu_uart *to_mvuart(struct uart_port *port) 138 + { 139 + return (struct mvebu_uart *)port->private_data; 140 + } 141 + 142 + #define IS_EXTENDED(port) (to_mvuart(port)->data->is_ext) 143 + 144 + #define UART_RBR(port) (to_mvuart(port)->data->regs.rbr) 145 + #define UART_TSH(port) (to_mvuart(port)->data->regs.tsh) 146 + #define UART_CTRL(port) (to_mvuart(port)->data->regs.ctrl) 147 + #define UART_INTR(port) (to_mvuart(port)->data->regs.intr) 148 + 149 + #define CTRL_TX_RDY_INT(port) (to_mvuart(port)->data->flags.ctrl_tx_rdy_int) 150 + #define CTRL_RX_RDY_INT(port) (to_mvuart(port)->data->flags.ctrl_rx_rdy_int) 151 + #define STAT_TX_RDY(port) (to_mvuart(port)->data->flags.stat_tx_rdy) 152 + #define STAT_RX_RDY(port) (to_mvuart(port)->data->flags.stat_rx_rdy) 76 153 77 154 static struct uart_port mvebu_uart_ports[MVEBU_NR_UARTS]; 78 - 79 - struct mvebu_uart_data { 80 - struct uart_port *port; 81 - struct clk *clk; 82 - }; 83 155 84 156 /* Core UART Driver Operations */ 85 157 static unsigned int mvebu_uart_tx_empty(struct uart_port *port) ··· 165 127 166 128 static void mvebu_uart_stop_tx(struct uart_port *port) 167 129 { 168 - unsigned int ctl = readl(port->membase + UART_CTRL); 130 + unsigned int ctl = readl(port->membase + UART_INTR(port)); 169 131 170 - ctl &= ~CTRL_TX_RDY_INT; 171 - writel(ctl, port->membase + UART_CTRL); 132 + ctl &= ~CTRL_TX_RDY_INT(port); 133 + writel(ctl, port->membase + UART_INTR(port)); 172 134 } 173 135 174 136 static void mvebu_uart_start_tx(struct uart_port *port) 175 137 { 176 - unsigned int ctl = readl(port->membase + UART_CTRL); 138 + unsigned int ctl; 139 + struct circ_buf *xmit = &port->state->xmit; 177 140 178 - ctl |= CTRL_TX_RDY_INT; 179 - writel(ctl, port->membase + UART_CTRL); 141 + if (IS_EXTENDED(port) && !uart_circ_empty(xmit)) { 142 + writel(xmit->buf[xmit->tail], port->membase + UART_TSH(port)); 143 + xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); 144 + port->icount.tx++; 145 + } 146 + 147 + ctl = readl(port->membase + UART_INTR(port)); 148 + ctl |= CTRL_TX_RDY_INT(port); 149 + writel(ctl, port->membase + UART_INTR(port)); 180 150 } 181 151 182 152 static void mvebu_uart_stop_rx(struct uart_port *port) 183 153 { 184 - unsigned int ctl = readl(port->membase + UART_CTRL); 154 + unsigned int ctl; 185 155 186 - ctl &= ~CTRL_RX_INT; 187 - writel(ctl, port->membase + UART_CTRL); 156 + ctl = readl(port->membase + UART_CTRL(port)); 157 + ctl &= ~CTRL_BRK_INT; 158 + writel(ctl, port->membase + UART_CTRL(port)); 159 + 160 + ctl = readl(port->membase + UART_INTR(port)); 161 + ctl &= ~CTRL_RX_RDY_INT(port); 162 + writel(ctl, port->membase + UART_INTR(port)); 188 163 } 189 164 190 165 static void mvebu_uart_break_ctl(struct uart_port *port, int brk) ··· 206 155 unsigned long flags; 207 156 208 157 spin_lock_irqsave(&port->lock, flags); 209 - ctl = readl(port->membase + UART_CTRL); 158 + ctl = readl(port->membase + UART_CTRL(port)); 210 159 if (brk == -1) 211 160 ctl |= CTRL_SND_BRK_SEQ; 212 161 else 213 162 ctl &= ~CTRL_SND_BRK_SEQ; 214 - writel(ctl, port->membase + UART_CTRL); 163 + writel(ctl, port->membase + UART_CTRL(port)); 215 164 spin_unlock_irqrestore(&port->lock, flags); 216 165 } 217 166 ··· 222 171 char flag = 0; 223 172 224 173 do { 225 - if (status & STAT_RX_RDY) { 226 - ch = readl(port->membase + UART_RBR); 174 + if (status & STAT_RX_RDY(port)) { 175 + ch = readl(port->membase + UART_RBR(port)); 227 176 ch &= 0xff; 228 177 flag = TTY_NORMAL; 229 178 port->icount.rx++; ··· 249 198 goto ignore_char; 250 199 251 200 if (status & port->ignore_status_mask & STAT_PAR_ERR) 252 - status &= ~STAT_RX_RDY; 201 + status &= ~STAT_RX_RDY(port); 253 202 254 203 status &= port->read_status_mask; 255 204 ··· 258 207 259 208 status &= ~port->ignore_status_mask; 260 209 261 - if (status & STAT_RX_RDY) 210 + if (status & STAT_RX_RDY(port)) 262 211 tty_insert_flip_char(tport, ch, flag); 263 212 264 213 if (status & STAT_BRK_DET) ··· 272 221 273 222 ignore_char: 274 223 status = readl(port->membase + UART_STAT); 275 - } while (status & (STAT_RX_RDY | STAT_BRK_DET)); 224 + } while (status & (STAT_RX_RDY(port) | STAT_BRK_DET)); 276 225 277 226 tty_flip_buffer_push(tport); 278 227 } ··· 284 233 unsigned int st; 285 234 286 235 if (port->x_char) { 287 - writel(port->x_char, port->membase + UART_TSH); 236 + writel(port->x_char, port->membase + UART_TSH(port)); 288 237 port->icount.tx++; 289 238 port->x_char = 0; 290 239 return; ··· 296 245 } 297 246 298 247 for (count = 0; count < port->fifosize; count++) { 299 - writel(xmit->buf[xmit->tail], port->membase + UART_TSH); 248 + writel(xmit->buf[xmit->tail], port->membase + UART_TSH(port)); 300 249 xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); 301 250 port->icount.tx++; 302 251 ··· 320 269 struct uart_port *port = (struct uart_port *)dev_id; 321 270 unsigned int st = readl(port->membase + UART_STAT); 322 271 323 - if (st & (STAT_RX_RDY | STAT_OVR_ERR | STAT_FRM_ERR | STAT_BRK_DET)) 272 + if (st & (STAT_RX_RDY(port) | STAT_OVR_ERR | STAT_FRM_ERR | 273 + STAT_BRK_DET)) 324 274 mvebu_uart_rx_chars(port, st); 325 275 326 - if (st & STAT_TX_RDY) 276 + if (st & STAT_TX_RDY(port)) 277 + mvebu_uart_tx_chars(port, st); 278 + 279 + return IRQ_HANDLED; 280 + } 281 + 282 + static irqreturn_t mvebu_uart_rx_isr(int irq, void *dev_id) 283 + { 284 + struct uart_port *port = (struct uart_port *)dev_id; 285 + unsigned int st = readl(port->membase + UART_STAT); 286 + 287 + if (st & (STAT_RX_RDY(port) | STAT_OVR_ERR | STAT_FRM_ERR | 288 + STAT_BRK_DET)) 289 + mvebu_uart_rx_chars(port, st); 290 + 291 + return IRQ_HANDLED; 292 + } 293 + 294 + static irqreturn_t mvebu_uart_tx_isr(int irq, void *dev_id) 295 + { 296 + struct uart_port *port = (struct uart_port *)dev_id; 297 + unsigned int st = readl(port->membase + UART_STAT); 298 + 299 + if (st & STAT_TX_RDY(port)) 327 300 mvebu_uart_tx_chars(port, st); 328 301 329 302 return IRQ_HANDLED; ··· 355 280 356 281 static int mvebu_uart_startup(struct uart_port *port) 357 282 { 283 + struct mvebu_uart *mvuart = to_mvuart(port); 284 + unsigned int ctl; 358 285 int ret; 359 286 360 287 writel(CTRL_TXFIFO_RST | CTRL_RXFIFO_RST, 361 - port->membase + UART_CTRL); 288 + port->membase + UART_CTRL(port)); 362 289 udelay(1); 363 - writel(CTRL_RX_INT, port->membase + UART_CTRL); 364 290 365 - ret = request_irq(port->irq, mvebu_uart_isr, port->irqflags, "serial", 366 - port); 367 - if (ret) { 368 - dev_err(port->dev, "failed to request irq\n"); 369 - return ret; 291 + /* Clear the error bits of state register before IRQ request */ 292 + ret = readl(port->membase + UART_STAT); 293 + ret |= STAT_BRK_ERR; 294 + writel(ret, port->membase + UART_STAT); 295 + 296 + writel(CTRL_BRK_INT, port->membase + UART_CTRL(port)); 297 + 298 + ctl = readl(port->membase + UART_INTR(port)); 299 + ctl |= CTRL_RX_RDY_INT(port); 300 + writel(ctl, port->membase + UART_INTR(port)); 301 + 302 + if (!mvuart->irq[UART_TX_IRQ]) { 303 + /* Old bindings with just one interrupt (UART0 only) */ 304 + ret = devm_request_irq(port->dev, mvuart->irq[UART_IRQ_SUM], 305 + mvebu_uart_isr, port->irqflags, 306 + dev_name(port->dev), port); 307 + if (ret) { 308 + dev_err(port->dev, "unable to request IRQ %d\n", 309 + mvuart->irq[UART_IRQ_SUM]); 310 + return ret; 311 + } 312 + } else { 313 + /* New bindings with an IRQ for RX and TX (both UART) */ 314 + ret = devm_request_irq(port->dev, mvuart->irq[UART_RX_IRQ], 315 + mvebu_uart_rx_isr, port->irqflags, 316 + dev_name(port->dev), port); 317 + if (ret) { 318 + dev_err(port->dev, "unable to request IRQ %d\n", 319 + mvuart->irq[UART_RX_IRQ]); 320 + return ret; 321 + } 322 + 323 + ret = devm_request_irq(port->dev, mvuart->irq[UART_TX_IRQ], 324 + mvebu_uart_tx_isr, port->irqflags, 325 + dev_name(port->dev), 326 + port); 327 + if (ret) { 328 + dev_err(port->dev, "unable to request IRQ %d\n", 329 + mvuart->irq[UART_TX_IRQ]); 330 + devm_free_irq(port->dev, mvuart->irq[UART_RX_IRQ], 331 + port); 332 + return ret; 333 + } 370 334 } 371 335 372 336 return 0; ··· 413 299 414 300 static void mvebu_uart_shutdown(struct uart_port *port) 415 301 { 416 - writel(0, port->membase + UART_CTRL); 302 + struct mvebu_uart *mvuart = to_mvuart(port); 417 303 418 - free_irq(port->irq, port); 304 + writel(0, port->membase + UART_INTR(port)); 305 + 306 + if (!mvuart->irq[UART_TX_IRQ]) { 307 + devm_free_irq(port->dev, mvuart->irq[UART_IRQ_SUM], port); 308 + } else { 309 + devm_free_irq(port->dev, mvuart->irq[UART_RX_IRQ], port); 310 + devm_free_irq(port->dev, mvuart->irq[UART_TX_IRQ], port); 311 + } 312 + } 313 + 314 + static int mvebu_uart_baud_rate_set(struct uart_port *port, unsigned int baud) 315 + { 316 + struct mvebu_uart *mvuart = to_mvuart(port); 317 + unsigned int baud_rate_div; 318 + u32 brdv; 319 + 320 + if (IS_ERR(mvuart->clk)) 321 + return -PTR_ERR(mvuart->clk); 322 + 323 + /* 324 + * The UART clock is divided by the value of the divisor to generate 325 + * UCLK_OUT clock, which is 16 times faster than the baudrate. 326 + * This prescaler can achieve all standard baudrates until 230400. 327 + * Higher baudrates could be achieved for the extended UART by using the 328 + * programmable oversampling stack (also called fractional divisor). 329 + */ 330 + baud_rate_div = DIV_ROUND_UP(port->uartclk, baud * 16); 331 + brdv = readl(port->membase + UART_BRDV); 332 + brdv &= ~BRDV_BAUD_MASK; 333 + brdv |= baud_rate_div; 334 + writel(brdv, port->membase + UART_BRDV); 335 + 336 + return 0; 419 337 } 420 338 421 339 static void mvebu_uart_set_termios(struct uart_port *port, ··· 459 313 460 314 spin_lock_irqsave(&port->lock, flags); 461 315 462 - port->read_status_mask = STAT_RX_RDY | STAT_OVR_ERR | 463 - STAT_TX_RDY | STAT_TX_FIFO_FUL; 316 + port->read_status_mask = STAT_RX_RDY(port) | STAT_OVR_ERR | 317 + STAT_TX_RDY(port) | STAT_TX_FIFO_FUL; 464 318 465 319 if (termios->c_iflag & INPCK) 466 320 port->read_status_mask |= STAT_FRM_ERR | STAT_PAR_ERR; ··· 471 325 STAT_FRM_ERR | STAT_PAR_ERR | STAT_OVR_ERR; 472 326 473 327 if ((termios->c_cflag & CREAD) == 0) 474 - port->ignore_status_mask |= STAT_RX_RDY | STAT_BRK_ERR; 328 + port->ignore_status_mask |= STAT_RX_RDY(port) | STAT_BRK_ERR; 475 329 476 - if (old) 477 - tty_termios_copy_hw(termios, old); 330 + /* 331 + * Maximum achievable frequency with simple baudrate divisor is 230400. 332 + * Since the error per bit frame would be of more than 15%, achieving 333 + * higher frequencies would require to implement the fractional divisor 334 + * feature. 335 + */ 336 + baud = uart_get_baud_rate(port, termios, old, 0, 230400); 337 + if (mvebu_uart_baud_rate_set(port, baud)) { 338 + /* No clock available, baudrate cannot be changed */ 339 + if (old) 340 + baud = uart_get_baud_rate(port, old, NULL, 0, 230400); 341 + } else { 342 + tty_termios_encode_baud_rate(termios, baud, baud); 343 + uart_update_timeout(port, termios->c_cflag, baud); 344 + } 478 345 479 - baud = uart_get_baud_rate(port, termios, old, 0, 460800); 480 - uart_update_timeout(port, termios->c_cflag, baud); 346 + /* Only the following flag changes are supported */ 347 + if (old) { 348 + termios->c_iflag &= INPCK | IGNPAR; 349 + termios->c_iflag |= old->c_iflag & ~(INPCK | IGNPAR); 350 + termios->c_cflag &= CREAD | CBAUD; 351 + termios->c_cflag |= old->c_cflag & ~(CREAD | CBAUD); 352 + termios->c_lflag = old->c_lflag; 353 + } 481 354 482 355 spin_unlock_irqrestore(&port->lock, flags); 483 356 } ··· 521 356 { 522 357 unsigned int st = readl(port->membase + UART_STAT); 523 358 524 - if (!(st & STAT_RX_RDY)) 359 + if (!(st & STAT_RX_RDY(port))) 525 360 return NO_POLL_CHAR; 526 361 527 - return readl(port->membase + UART_RBR); 362 + return readl(port->membase + UART_RBR(port)); 528 363 } 529 364 530 365 static void mvebu_uart_put_poll_char(struct uart_port *port, unsigned char c) ··· 540 375 udelay(1); 541 376 } 542 377 543 - writel(c, port->membase + UART_TSH); 378 + writel(c, port->membase + UART_TSH(port)); 544 379 } 545 380 #endif 546 381 ··· 578 413 break; 579 414 } 580 415 581 - writel(c, port->membase + UART_TSH); 416 + /* At early stage, DT is not parsed yet, only use UART0 */ 417 + writel(c, port->membase + UART_STD_TSH); 582 418 583 419 for (;;) { 584 420 st = readl(port->membase + UART_STAT); ··· 624 458 static void mvebu_uart_console_putchar(struct uart_port *port, int ch) 625 459 { 626 460 wait_for_xmitr(port); 627 - writel(ch, port->membase + UART_TSH); 461 + writel(ch, port->membase + UART_TSH(port)); 628 462 } 629 463 630 464 static void mvebu_uart_console_write(struct console *co, const char *s, ··· 632 466 { 633 467 struct uart_port *port = &mvebu_uart_ports[co->index]; 634 468 unsigned long flags; 635 - unsigned int ier; 469 + unsigned int ier, intr, ctl; 636 470 int locked = 1; 637 471 638 472 if (oops_in_progress) ··· 640 474 else 641 475 spin_lock_irqsave(&port->lock, flags); 642 476 643 - ier = readl(port->membase + UART_CTRL) & 644 - (CTRL_RX_INT | CTRL_TX_RDY_INT); 645 - writel(0, port->membase + UART_CTRL); 477 + ier = readl(port->membase + UART_CTRL(port)) & CTRL_BRK_INT; 478 + intr = readl(port->membase + UART_INTR(port)) & 479 + (CTRL_RX_RDY_INT(port) | CTRL_TX_RDY_INT(port)); 480 + writel(0, port->membase + UART_CTRL(port)); 481 + writel(0, port->membase + UART_INTR(port)); 646 482 647 483 uart_console_write(port, s, count, mvebu_uart_console_putchar); 648 484 649 485 wait_for_xmitr(port); 650 486 651 487 if (ier) 652 - writel(ier, port->membase + UART_CTRL); 488 + writel(ier, port->membase + UART_CTRL(port)); 489 + 490 + if (intr) { 491 + ctl = intr | readl(port->membase + UART_INTR(port)); 492 + writel(ctl, port->membase + UART_INTR(port)); 493 + } 653 494 654 495 if (locked) 655 496 spin_unlock_irqrestore(&port->lock, flags); ··· 711 538 712 539 static struct uart_driver mvebu_uart_driver = { 713 540 .owner = THIS_MODULE, 714 - .driver_name = "mvebu_serial", 541 + .driver_name = DRIVER_NAME, 715 542 .dev_name = "ttyMV", 716 543 .nr = MVEBU_NR_UARTS, 717 544 #ifdef CONFIG_SERIAL_MVEBU_CONSOLE ··· 719 546 #endif 720 547 }; 721 548 549 + static const struct of_device_id mvebu_uart_of_match[]; 550 + 551 + /* Counter to keep track of each UART port id when not using CONFIG_OF */ 552 + static int uart_num_counter; 553 + 722 554 static int mvebu_uart_probe(struct platform_device *pdev) 723 555 { 724 556 struct resource *reg = platform_get_resource(pdev, IORESOURCE_MEM, 0); 725 - struct resource *irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 557 + const struct of_device_id *match = of_match_device(mvebu_uart_of_match, 558 + &pdev->dev); 726 559 struct uart_port *port; 727 - struct mvebu_uart_data *data; 728 - int ret; 560 + struct mvebu_uart *mvuart; 561 + int ret, id, irq; 729 562 730 - if (!reg || !irq) { 731 - dev_err(&pdev->dev, "no registers/irq defined\n"); 563 + if (!reg) { 564 + dev_err(&pdev->dev, "no registers defined\n"); 732 565 return -EINVAL; 733 566 } 734 567 735 - port = &mvebu_uart_ports[0]; 568 + /* Assume that all UART ports have a DT alias or none has */ 569 + id = of_alias_get_id(pdev->dev.of_node, "serial"); 570 + if (!pdev->dev.of_node || id < 0) 571 + pdev->id = uart_num_counter++; 572 + else 573 + pdev->id = id; 574 + 575 + if (pdev->id >= MVEBU_NR_UARTS) { 576 + dev_err(&pdev->dev, "cannot have more than %d UART ports\n", 577 + MVEBU_NR_UARTS); 578 + return -EINVAL; 579 + } 580 + 581 + port = &mvebu_uart_ports[pdev->id]; 736 582 737 583 spin_lock_init(&port->lock); 738 584 ··· 763 571 port->fifosize = 32; 764 572 port->iotype = UPIO_MEM32; 765 573 port->flags = UPF_FIXED_PORT; 766 - port->line = 0; /* single port: force line number to 0 */ 574 + port->line = pdev->id; 767 575 768 - port->irq = irq->start; 576 + /* 577 + * IRQ number is not stored in this structure because we may have two of 578 + * them per port (RX and TX). Instead, use the driver UART structure 579 + * array so called ->irq[]. 580 + */ 581 + port->irq = 0; 769 582 port->irqflags = 0; 770 583 port->mapbase = reg->start; 771 584 ··· 778 581 if (IS_ERR(port->membase)) 779 582 return -PTR_ERR(port->membase); 780 583 781 - data = devm_kzalloc(&pdev->dev, sizeof(struct mvebu_uart_data), 782 - GFP_KERNEL); 783 - if (!data) 584 + mvuart = devm_kzalloc(&pdev->dev, sizeof(struct mvebu_uart), 585 + GFP_KERNEL); 586 + if (!mvuart) 784 587 return -ENOMEM; 785 588 786 - data->port = port; 589 + /* Get controller data depending on the compatible string */ 590 + mvuart->data = (struct mvebu_uart_driver_data *)match->data; 591 + mvuart->port = port; 787 592 788 - port->private_data = data; 789 - platform_set_drvdata(pdev, data); 593 + port->private_data = mvuart; 594 + platform_set_drvdata(pdev, mvuart); 595 + 596 + /* Get fixed clock frequency */ 597 + mvuart->clk = devm_clk_get(&pdev->dev, NULL); 598 + if (IS_ERR(mvuart->clk)) { 599 + if (PTR_ERR(mvuart->clk) == -EPROBE_DEFER) 600 + return PTR_ERR(mvuart->clk); 601 + 602 + if (IS_EXTENDED(port)) { 603 + dev_err(&pdev->dev, "unable to get UART clock\n"); 604 + return PTR_ERR(mvuart->clk); 605 + } 606 + } else { 607 + if (!clk_prepare_enable(mvuart->clk)) 608 + port->uartclk = clk_get_rate(mvuart->clk); 609 + } 610 + 611 + /* Manage interrupts */ 612 + if (platform_irq_count(pdev) == 1) { 613 + /* Old bindings: no name on the single unamed UART0 IRQ */ 614 + irq = platform_get_irq(pdev, 0); 615 + if (irq < 0) { 616 + dev_err(&pdev->dev, "unable to get UART IRQ\n"); 617 + return irq; 618 + } 619 + 620 + mvuart->irq[UART_IRQ_SUM] = irq; 621 + } else { 622 + /* 623 + * New bindings: named interrupts (RX, TX) for both UARTS, 624 + * only make use of uart-rx and uart-tx interrupts, do not use 625 + * uart-sum of UART0 port. 626 + */ 627 + irq = platform_get_irq_byname(pdev, "uart-rx"); 628 + if (irq < 0) { 629 + dev_err(&pdev->dev, "unable to get 'uart-rx' IRQ\n"); 630 + return irq; 631 + } 632 + 633 + mvuart->irq[UART_RX_IRQ] = irq; 634 + 635 + irq = platform_get_irq_byname(pdev, "uart-tx"); 636 + if (irq < 0) { 637 + dev_err(&pdev->dev, "unable to get 'uart-tx' IRQ\n"); 638 + return irq; 639 + } 640 + 641 + mvuart->irq[UART_TX_IRQ] = irq; 642 + } 643 + 644 + /* UART Soft Reset*/ 645 + writel(CTRL_SOFT_RST, port->membase + UART_CTRL(port)); 646 + udelay(1); 647 + writel(0, port->membase + UART_CTRL(port)); 790 648 791 649 ret = uart_add_one_port(&mvebu_uart_driver, port); 792 650 if (ret) ··· 849 597 return 0; 850 598 } 851 599 600 + static struct mvebu_uart_driver_data uart_std_driver_data = { 601 + .is_ext = false, 602 + .regs.rbr = UART_STD_RBR, 603 + .regs.tsh = UART_STD_TSH, 604 + .regs.ctrl = UART_STD_CTRL1, 605 + .regs.intr = UART_STD_CTRL2, 606 + .flags.ctrl_tx_rdy_int = CTRL_STD_TX_RDY_INT, 607 + .flags.ctrl_rx_rdy_int = CTRL_STD_RX_RDY_INT, 608 + .flags.stat_tx_rdy = STAT_STD_TX_RDY, 609 + .flags.stat_rx_rdy = STAT_STD_RX_RDY, 610 + }; 611 + 612 + static struct mvebu_uart_driver_data uart_ext_driver_data = { 613 + .is_ext = true, 614 + .regs.rbr = UART_EXT_RBR, 615 + .regs.tsh = UART_EXT_TSH, 616 + .regs.ctrl = UART_EXT_CTRL1, 617 + .regs.intr = UART_EXT_CTRL2, 618 + .flags.ctrl_tx_rdy_int = CTRL_EXT_TX_RDY_INT, 619 + .flags.ctrl_rx_rdy_int = CTRL_EXT_RX_RDY_INT, 620 + .flags.stat_tx_rdy = STAT_EXT_TX_RDY, 621 + .flags.stat_rx_rdy = STAT_EXT_RX_RDY, 622 + }; 623 + 852 624 /* Match table for of_platform binding */ 853 625 static const struct of_device_id mvebu_uart_of_match[] = { 854 - { .compatible = "marvell,armada-3700-uart", }, 626 + { 627 + .compatible = "marvell,armada-3700-uart", 628 + .data = (void *)&uart_std_driver_data, 629 + }, 630 + { 631 + .compatible = "marvell,armada-3700-uart-ext", 632 + .data = (void *)&uart_ext_driver_data, 633 + }, 855 634 {} 856 635 }; 857 636
+1 -4
drivers/tty/serial/mxs-auart.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Application UART driver for: 3 4 * Freescale STMP37XX/STMP378X ··· 10 9 * Provide Alphascale ASM9260 support. 11 10 * Copyright 2008-2010 Freescale Semiconductor, Inc. 12 11 * Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved. 13 - * 14 - * The code contained herein is licensed under the GNU General Public 15 - * License. You may obtain a copy of the GNU General Public License 16 - * Version 2 or later at the following locations: 17 12 */ 18 13 19 14 #if defined(CONFIG_SERIAL_MXS_AUART_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
+1 -13
drivers/tty/serial/netx-serial.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (c) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix 3 - * 4 - * This program is free software; you can redistribute it and/or modify 5 - * it under the terms of the GNU General Public License version 2 6 - * as published by the Free Software Foundation. 7 - * 8 - * This program is distributed in the hope that it will be useful, 9 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 - * GNU General Public License for more details. 12 - * 13 - * You should have received a copy of the GNU General Public License 14 - * along with this program; if not, write to the Free Software 15 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 4 */ 17 5 18 6 #if defined(CONFIG_SERIAL_NETX_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
+4 -19
drivers/tty/serial/omap-serial.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Driver for OMAP-UART controller. 3 4 * Based on drivers/serial/8250.c ··· 8 7 * Authors: 9 8 * Govindraj R <govindraj.raja@ti.com> 10 9 * Thara Gopinath <thara@ti.com> 11 - * 12 - * This program is free software; you can redistribute it and/or modify 13 - * it under the terms of the GNU General Public License as published by 14 - * the Free Software Foundation; either version 2 of the License, or 15 - * (at your option) any later version. 16 10 * 17 11 * Note: This driver is made separate from 8250 driver as we cannot 18 12 * over load 8250 driver with omap platform specific configuration for ··· 606 610 default: 607 611 break; 608 612 } 609 - } while (!(iir & UART_IIR_NO_INT) && max_count--); 613 + } while (max_count--); 610 614 611 615 spin_unlock(&up->port.lock); 612 616 ··· 689 693 if ((mctrl & TIOCM_RTS) && (port->status & UPSTAT_AUTORTS)) 690 694 up->efr |= UART_EFR_RTS; 691 695 else 692 - up->efr &= UART_EFR_RTS; 696 + up->efr &= ~UART_EFR_RTS; 693 697 serial_out(up, UART_EFR, up->efr); 694 698 serial_out(up, UART_LCR, lcr); 695 699 ··· 1602 1606 struct device_node *np) 1603 1607 { 1604 1608 struct serial_rs485 *rs485conf = &up->port.rs485; 1605 - u32 rs485_delay[2]; 1606 1609 enum of_gpio_flags flags; 1607 1610 int ret; 1608 1611 ··· 1632 1637 up->rts_gpio = -EINVAL; 1633 1638 } 1634 1639 1635 - if (of_property_read_u32_array(np, "rs485-rts-delay", 1636 - rs485_delay, 2) == 0) { 1637 - rs485conf->delay_rts_before_send = rs485_delay[0]; 1638 - rs485conf->delay_rts_after_send = rs485_delay[1]; 1639 - } 1640 - 1641 - if (of_property_read_bool(np, "rs485-rx-during-tx")) 1642 - rs485conf->flags |= SER_RS485_RX_DURING_TX; 1643 - 1644 - if (of_property_read_bool(np, "linux,rs485-enabled-at-boot-time")) 1645 - rs485conf->flags |= SER_RS485_ENABLED; 1640 + of_get_rs485_mode(np, rs485conf); 1646 1641 1647 1642 return 0; 1648 1643 }
+1 -13
drivers/tty/serial/owl-uart.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Actions Semi Owl family serial console 3 4 * ··· 6 5 * Author: Actions Semi, Inc. 7 6 * 8 7 * Copyright (c) 2016-2017 Andreas Färber 9 - * 10 - * This program is free software; you can redistribute it and/or modify it 11 - * under the terms of the GNU General Public License as published by the 12 - * Free Software Foundation; either version 2 of the License, or (at your 13 - * option) any later version. 14 - * 15 - * This program is distributed in the hope that it will be useful, 16 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 - * GNU General Public License for more details. 19 - * 20 - * You should have received a copy of the GNU General Public License 21 - * along with this program. If not, see <http://www.gnu.org/licenses/>. 22 8 */ 23 9 24 10 #include <linux/clk.h>
+1 -13
drivers/tty/serial/pch_uart.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 *Copyright (C) 2011 LAPIS Semiconductor Co., Ltd. 3 - * 4 - *This program is free software; you can redistribute it and/or modify 5 - *it under the terms of the GNU General Public License as published by 6 - *the Free Software Foundation; version 2 of the License. 7 - * 8 - *This program is distributed in the hope that it will be useful, 9 - *but WITHOUT ANY WARRANTY; without even the implied warranty of 10 - *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 - *GNU General Public License for more details. 12 - * 13 - *You should have received a copy of the GNU General Public License 14 - *along with this program; if not, write to the Free Software 15 - *Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 16 4 */ 17 5 #if defined(CONFIG_SERIAL_PCH_UART_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 18 6 #define SUPPORT_SYSRQ
+1 -2
drivers/tty/serial/pic32_uart.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * PIC32 Integrated Serial Driver. 3 4 * ··· 6 5 * 7 6 * Authors: 8 7 * Sorin-Andrei Pistirica <andrei.pistirica@microchip.com> 9 - * 10 - * Licensed under GPLv2 or later. 11 8 */ 12 9 13 10 #include <linux/kernel.h>
+1 -2
drivers/tty/serial/pic32_uart.h
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * PIC32 Integrated Serial Driver. 3 4 * ··· 6 5 * 7 6 * Authors: 8 7 * Sorin-Andrei Pistirica <andrei.pistirica@microchip.com> 9 - * 10 - * Licensed under GPLv2 or later. 11 8 */ 12 9 #ifndef __DT_PIC32_UART_H__ 13 10 #define __DT_PIC32_UART_H__
+1 -14
drivers/tty/serial/pmac_zilog.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Driver for PowerMac Z85c30 based ESCC cell found in the 3 4 * "macio" ASICs of various PowerMac models ··· 13 12 * merging back those though. The DMA code still has to get in 14 13 * and once done, I expect that driver to remain fairly stable in 15 14 * the long term, unless we change the driver model again... 16 - * 17 - * This program is free software; you can redistribute it and/or modify 18 - * it under the terms of the GNU General Public License as published by 19 - * the Free Software Foundation; either version 2 of the License, or 20 - * (at your option) any later version. 21 - * 22 - * This program is distributed in the hope that it will be useful, 23 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 24 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 - * GNU General Public License for more details. 26 - * 27 - * You should have received a copy of the GNU General Public License 28 - * along with this program; if not, write to the Free Software 29 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 30 15 * 31 16 * 2004-08-06 Harald Welte <laforge@gnumonks.org> 32 17 * - Enable BREAK interrupt
+3 -8
drivers/tty/serial/pnx8xxx_uart.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * UART driver for PNX8XXX SoCs 3 4 * ··· 8 7 * 9 8 * Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o. 10 9 * Copyright (C) 2000 Deep Blue Solutions Ltd. 11 - * 12 - * This file is licensed under the terms of the GNU General Public License 13 - * version 2. This program is licensed "as is" without any warranty of 14 - * any kind, whether express or implied. 15 - * 16 10 */ 17 11 18 12 #if defined(CONFIG_SERIAL_PNX8XXX_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) ··· 662 666 first = 0; 663 667 664 668 for (i = 0; i < NR_PORTS; i++) { 665 - init_timer(&pnx8xxx_ports[i].timer); 666 - pnx8xxx_ports[i].timer.function = pnx8xxx_timeout; 667 - pnx8xxx_ports[i].timer.data = (unsigned long)&pnx8xxx_ports[i]; 669 + setup_timer(&pnx8xxx_ports[i].timer, pnx8xxx_timeout, 670 + (unsigned long)&pnx8xxx_ports[i]); 668 671 pnx8xxx_ports[i].port.ops = &pnx8xxx_pops; 669 672 } 670 673 }
+1 -5
drivers/tty/serial/pxa.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Based on drivers/serial/8250.c by Russell King. 3 4 * 4 5 * Author: Nicolas Pitre 5 6 * Created: Feb 20, 2003 6 7 * Copyright: (C) 2003 Monta Vista Software, Inc. 7 - * 8 - * This program is free software; you can redistribute it and/or modify 9 - * it under the terms of the GNU General Public License as published by 10 - * the Free Software Foundation; either version 2 of the License, or 11 - * (at your option) any later version. 12 8 * 13 9 * Note 1: This driver is made separate from the already too overloaded 14 10 * 8250.c because it needs some kirks of its own and that'll make it
+1 -4
drivers/tty/serial/rp2.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Driver for Comtrol RocketPort EXPRESS/INFINITY cards 3 4 * ··· 11 10 * 12 11 * rocketport_infinity_express-linux-1.20.tar.gz 13 12 * Copyright (C) 2004-2011 Comtrol, Inc. 14 - * 15 - * This program is free software; you can redistribute it and/or modify it 16 - * under the terms of the GNU General Public License version 2 as published 17 - * by the Free Software Foundation. 18 13 */ 19 14 20 15 #include <linux/bitops.h>
+3 -17
drivers/tty/serial/sa1100.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Driver for SA11x0 serial ports 3 4 * 4 5 * Based on drivers/char/serial.c, by Linus Torvalds, Theodore Ts'o. 5 6 * 6 7 * Copyright (C) 2000 Deep Blue Solutions Ltd. 7 - * 8 - * This program is free software; you can redistribute it and/or modify 9 - * it under the terms of the GNU General Public License as published by 10 - * the Free Software Foundation; either version 2 of the License, or 11 - * (at your option) any later version. 12 - * 13 - * This program is distributed in the hope that it will be useful, 14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 - * GNU General Public License for more details. 17 - * 18 - * You should have received a copy of the GNU General Public License 19 - * along with this program; if not, write to the Free Software 20 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 8 */ 22 9 23 10 #if defined(CONFIG_SERIAL_SA1100_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) ··· 627 640 sa1100_ports[i].port.fifosize = 8; 628 641 sa1100_ports[i].port.line = i; 629 642 sa1100_ports[i].port.iotype = UPIO_MEM; 630 - init_timer(&sa1100_ports[i].timer); 631 - sa1100_ports[i].timer.function = sa1100_timeout; 632 - sa1100_ports[i].timer.data = (unsigned long)&sa1100_ports[i]; 643 + setup_timer(&sa1100_ports[i].timer, sa1100_timeout, 644 + (unsigned long)&sa1100_ports[i]); 633 645 } 634 646 635 647 /*
+1 -4
drivers/tty/serial/samsung.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Driver core for Samsung SoC onboard UARTs. 3 4 * 4 5 * Ben Dooks, Copyright (c) 2003-2008 Simtec Electronics 5 6 * http://armlinux.simtec.co.uk/ 6 - * 7 - * This program is free software; you can redistribute it and/or modify 8 - * it under the terms of the GNU General Public License version 2 as 9 - * published by the Free Software Foundation. 10 7 */ 11 8 12 9 /* Hote on 2410 error handling
+1 -4
drivers/tty/serial/samsung.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 #ifndef __SAMSUNG_H 2 3 #define __SAMSUNG_H 3 4 ··· 7 6 * 8 7 * Ben Dooks, Copyright (c) 2003-2008 Simtec Electronics 9 8 * http://armlinux.simtec.co.uk/ 10 - * 11 - * This program is free software; you can redistribute it and/or modify 12 - * it under the terms of the GNU General Public License version 2 as 13 - * published by the Free Software Foundation. 14 9 */ 15 10 16 11 #include <linux/dmaengine.h>
+1 -5
drivers/tty/serial/sb1250-duart.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Support for the asynchronous serial interface (DUART) included 3 4 * in the BCM1250 and derived System-On-a-Chip (SOC) devices. ··· 9 8 * copyright applies: 10 9 * 11 10 * Copyright (c) 2000, 2001, 2002, 2003, 2004 Broadcom Corporation 12 - * 13 - * This program is free software; you can redistribute it and/or 14 - * modify it under the terms of the GNU General Public License 15 - * as published by the Free Software Foundation; either version 16 - * 2 of the License, or (at your option) any later version. 17 11 * 18 12 * References: 19 13 *
+1 -6
drivers/tty/serial/sc16is7xx.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * SC16IS7xx tty serial driver - Copyright (C) 2014 GridPoint 3 4 * Author: Jon Ringle <jringle@gridpoint.com> 4 5 * 5 6 * Based on max310x.c, by Alexander Shiyan <shc_work@mail.ru> 6 - * 7 - * This program is free software; you can redistribute it and/or modify 8 - * it under the terms of the GNU General Public License as published by 9 - * the Free Software Foundation; either version 2 of the License, or 10 - * (at your option) any later version. 11 - * 12 7 */ 13 8 14 9 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+4 -9
drivers/tty/serial/sccnxp.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * NXP (Philips) SCC+++(SCN+++) serial driver 3 4 * 4 5 * Copyright (C) 2012 Alexander Shiyan <shc_work@mail.ru> 5 6 * 6 7 * Based on sc26xx.c, by Thomas Bogendörfer (tsbogend@alpha.franken.de) 7 - * 8 - * This program is free software; you can redistribute it and/or modify 9 - * it under the terms of the GNU General Public License as published by 10 - * the Free Software Foundation; either version 2 of the License, or 11 - * (at your option) any later version. 12 8 */ 13 9 14 10 #if defined(CONFIG_SERIAL_SCCNXP_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) ··· 461 465 } while (1); 462 466 } 463 467 464 - static void sccnxp_timer(unsigned long data) 468 + static void sccnxp_timer(struct timer_list *t) 465 469 { 466 - struct sccnxp_port *s = (struct sccnxp_port *)data; 470 + struct sccnxp_port *s = from_timer(s, t, timer); 467 471 unsigned long flags; 468 472 469 473 spin_lock_irqsave(&s->lock, flags); ··· 983 987 984 988 dev_err(&pdev->dev, "Unable to reguest IRQ %i\n", s->irq); 985 989 } else { 986 - init_timer(&s->timer); 987 - setup_timer(&s->timer, sccnxp_timer, (unsigned long)s); 990 + timer_setup(&s->timer, sccnxp_timer, 0); 988 991 mod_timer(&s->timer, jiffies + 989 992 usecs_to_jiffies(s->pdata.poll_time_us)); 990 993 return 0;
+1 -12
drivers/tty/serial/serial-tegra.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * serial_tegra.c 3 4 * ··· 7 6 * Copyright (c) 2012-2013, NVIDIA CORPORATION. All rights reserved. 8 7 * 9 8 * Author: Laxman Dewangan <ldewangan@nvidia.com> 10 - * 11 - * This program is free software; you can redistribute it and/or modify it 12 - * under the terms and conditions of the GNU General Public License, 13 - * version 2, as published by the Free Software Foundation. 14 - * 15 - * This program is distributed in the hope it will be useful, but WITHOUT 16 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 18 - * more details. 19 - * 20 - * You should have received a copy of the GNU General Public License 21 - * along with this program. If not, see <http://www.gnu.org/licenses/>. 22 9 */ 23 10 24 11 #include <linux/clk.h>
+38 -16
drivers/tty/serial/serial_core.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Driver core for serial ports 3 4 * ··· 6 5 * 7 6 * Copyright 1999 ARM Limited 8 7 * Copyright (C) 2000-2001 Deep Blue Solutions Ltd. 9 - * 10 - * This program is free software; you can redistribute it and/or modify 11 - * it under the terms of the GNU General Public License as published by 12 - * the Free Software Foundation; either version 2 of the License, or 13 - * (at your option) any later version. 14 - * 15 - * This program is distributed in the hope that it will be useful, 16 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 - * GNU General Public License for more details. 19 - * 20 - * You should have received a copy of the GNU General Public License 21 - * along with this program; if not, write to the Free Software 22 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 8 */ 24 9 #include <linux/module.h> 25 10 #include <linux/tty.h> ··· 1469 1482 static void uart_close(struct tty_struct *tty, struct file *filp) 1470 1483 { 1471 1484 struct uart_state *state = tty->driver_data; 1472 - struct tty_port *port; 1473 1485 1474 1486 if (!state) { 1475 1487 struct uart_driver *drv = tty->driver->driver_state; 1488 + struct tty_port *port; 1476 1489 1477 1490 state = drv->state + tty->index; 1478 1491 port = &state->port; ··· 1482 1495 return; 1483 1496 } 1484 1497 1485 - port = &state->port; 1486 1498 pr_debug("uart_close(%d) called\n", tty->index); 1487 1499 1488 1500 tty_port_close(tty->port, tty, filp); ··· 3011 3025 EXPORT_SYMBOL(uart_resume_port); 3012 3026 EXPORT_SYMBOL(uart_add_one_port); 3013 3027 EXPORT_SYMBOL(uart_remove_one_port); 3028 + 3029 + /** 3030 + * of_get_rs485_mode() - Implement parsing rs485 properties 3031 + * @np: uart node 3032 + * @rs485conf: output parameter 3033 + * 3034 + * This function implements the device tree binding described in 3035 + * Documentation/devicetree/bindings/serial/rs485.txt. 3036 + */ 3037 + void of_get_rs485_mode(struct device_node *np, struct serial_rs485 *rs485conf) 3038 + { 3039 + u32 rs485_delay[2]; 3040 + int ret; 3041 + 3042 + ret = of_property_read_u32_array(np, "rs485-rts-delay", rs485_delay, 2); 3043 + if (!ret) { 3044 + rs485conf->delay_rts_before_send = rs485_delay[0]; 3045 + rs485conf->delay_rts_after_send = rs485_delay[1]; 3046 + } else { 3047 + rs485conf->delay_rts_before_send = 0; 3048 + rs485conf->delay_rts_after_send = 0; 3049 + } 3050 + 3051 + /* 3052 + * clear full-duplex and enabled flags to get to a defined state with 3053 + * the two following properties. 3054 + */ 3055 + rs485conf->flags &= ~(SER_RS485_RX_DURING_TX | SER_RS485_ENABLED); 3056 + 3057 + if (of_property_read_bool(np, "rs485-rx-during-tx")) 3058 + rs485conf->flags |= SER_RS485_RX_DURING_TX; 3059 + 3060 + if (of_property_read_bool(np, "linux,rs485-enabled-at-boot-time")) 3061 + rs485conf->flags |= SER_RS485_ENABLED; 3062 + } 3063 + EXPORT_SYMBOL_GPL(of_get_rs485_mode); 3014 3064 3015 3065 MODULE_DESCRIPTION("Serial driver core"); 3016 3066 MODULE_LICENSE("GPL");
+1 -6
drivers/tty/serial/serial_ks8695.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Driver for KS8695 serial ports 3 4 * 4 5 * Based on drivers/serial/serial_amba.c, by Kam Lee. 5 6 * 6 7 * Copyright 2002-2005 Micrel Inc. 7 - * 8 - * This program is free software; you can redistribute it and/or modify 9 - * it under the terms of the GNU General Public License as published by 10 - * the Free Software Foundation; either version 2 of the License, or 11 - * (at your option) any later version. 12 - * 13 8 */ 14 9 #include <linux/module.h> 15 10 #include <linux/tty.h>
+1 -10
drivers/tty/serial/serial_mctrl_gpio.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Helpers for controlling modem lines via GPIO 3 4 * 4 5 * Copyright (C) 2014 Paratronic S.A. 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License as published by 8 - * the Free Software Foundation; either version 2 of the License, or 9 - * (at your option) any later version. 10 - * 11 - * This program is distributed in the hope that it will be useful, 12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - * GNU General Public License for more details. 15 6 */ 16 7 17 8 #include <linux/err.h>
+1 -11
drivers/tty/serial/serial_mctrl_gpio.h
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Helpers for controlling modem lines via GPIO 3 4 * 4 5 * Copyright (C) 2014 Paratronic S.A. 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License as published by 8 - * the Free Software Foundation; either version 2 of the License, or 9 - * (at your option) any later version. 10 - * 11 - * This program is distributed in the hope that it will be useful, 12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - * GNU General Public License for more details. 15 - * 16 6 */ 17 7 18 8 #ifndef __SERIAL_MCTRL_GPIO__
+1 -4
drivers/tty/serial/serial_txx9.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Derived from many drivers using generic_serial interface, 3 4 * especially serial_tx3912.c by Steven J. Hill and r39xx_serial.c ··· 8 7 * Copyright (C) 2000 Jim Pick <jim@jimpick.com> 9 8 * Copyright (C) 2001 Steven J. Hill (sjhill@realitydiluted.com) 10 9 * Copyright (C) 2000-2002 Toshiba Corporation 11 - * 12 - * This program is free software; you can redistribute it and/or modify 13 - * it under the terms of the GNU General Public License version 2 as 14 - * published by the Free Software Foundation. 15 10 * 16 11 * Serial driver for TX3927/TX4927/TX4925/TX4938 internal SIO controller 17 12 */
+68 -35
drivers/tty/serial/sh-sci.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * SuperH on-chip serial module support. (SCI with no FIFO / with FIFO) 3 4 * ··· 14 13 * Modified to support SecureEdge. David McCullough (2002) 15 14 * Modified to support SH7300 SCIF. Takashi Kusuda (Jun 2003). 16 15 * Removed SH7300 support (Jul 2007). 17 - * 18 - * This file is subject to the terms and conditions of the GNU General Public 19 - * License. See the file "COPYING" in the main directory of this archive 20 - * for more details. 21 16 */ 22 17 #if defined(CONFIG_SERIAL_SH_SCI_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 23 18 #define SUPPORT_SYSRQ ··· 37 40 #include <linux/module.h> 38 41 #include <linux/mm.h> 39 42 #include <linux/of.h> 43 + #include <linux/of_device.h> 40 44 #include <linux/platform_device.h> 41 45 #include <linux/pm_runtime.h> 42 46 #include <linux/scatterlist.h> ··· 150 152 int rx_trigger; 151 153 struct timer_list rx_fifo_timer; 152 154 int rx_fifo_timeout; 155 + u16 hscif_tot; 153 156 154 157 bool has_rtscts; 155 158 bool autorts; ··· 1106 1107 { 1107 1108 struct uart_port *port = dev_get_drvdata(dev); 1108 1109 struct sci_port *sci = to_sci_port(port); 1110 + int v; 1109 1111 1110 - return sprintf(buf, "%d\n", sci->rx_fifo_timeout); 1112 + if (port->type == PORT_HSCIF) 1113 + v = sci->hscif_tot >> HSSCR_TOT_SHIFT; 1114 + else 1115 + v = sci->rx_fifo_timeout; 1116 + 1117 + return sprintf(buf, "%d\n", v); 1111 1118 } 1112 1119 1113 1120 static ssize_t rx_fifo_timeout_store(struct device *dev, ··· 1129 1124 ret = kstrtol(buf, 0, &r); 1130 1125 if (ret) 1131 1126 return ret; 1132 - sci->rx_fifo_timeout = r; 1133 - scif_set_rtrg(port, 1); 1134 - if (r > 0) 1135 - setup_timer(&sci->rx_fifo_timer, rx_fifo_timer_fn, 1136 - (unsigned long)sci); 1127 + 1128 + if (port->type == PORT_HSCIF) { 1129 + if (r < 0 || r > 3) 1130 + return -EINVAL; 1131 + sci->hscif_tot = r << HSSCR_TOT_SHIFT; 1132 + } else { 1133 + sci->rx_fifo_timeout = r; 1134 + scif_set_rtrg(port, 1); 1135 + if (r > 0) 1136 + setup_timer(&sci->rx_fifo_timer, rx_fifo_timer_fn, 1137 + (unsigned long)sci); 1138 + } 1139 + 1137 1140 return count; 1138 1141 } 1139 1142 ··· 1223 1210 dma_free_coherent(chan->device->dev, s->buf_len_rx * 2, s->rx_buf[0], 1224 1211 sg_dma_address(&s->sg_rx[0])); 1225 1212 dma_release_channel(chan); 1226 - if (enable_pio) 1213 + if (enable_pio) { 1214 + spin_lock_irqsave(&port->lock, flags); 1227 1215 sci_start_rx(port); 1216 + spin_unlock_irqrestore(&port->lock, flags); 1217 + } 1228 1218 } 1229 1219 1230 1220 static void sci_dma_rx_complete(void *arg) ··· 1294 1278 dma_unmap_single(chan->device->dev, s->tx_dma_addr, UART_XMIT_SIZE, 1295 1279 DMA_TO_DEVICE); 1296 1280 dma_release_channel(chan); 1297 - if (enable_pio) 1281 + if (enable_pio) { 1282 + spin_lock_irqsave(&port->lock, flags); 1298 1283 sci_start_tx(port); 1284 + spin_unlock_irqrestore(&port->lock, flags); 1285 + } 1299 1286 } 1300 1287 1301 1288 static void sci_submit_rx(struct sci_port *s) ··· 1510 1491 return; 1511 1492 1512 1493 s->cookie_tx = -EINVAL; 1494 + 1495 + /* 1496 + * Don't request a dma channel if no channel was specified 1497 + * in the device tree. 1498 + */ 1499 + if (!of_find_property(port->dev->of_node, "dmas", NULL)) 1500 + return; 1501 + 1513 1502 chan = sci_request_dma_chan(port, DMA_MEM_TO_DEV); 1514 1503 dev_dbg(port->dev, "%s: TX: got channel %p\n", __func__, chan); 1515 1504 if (chan) { ··· 2007 1980 static void sci_break_ctl(struct uart_port *port, int break_state) 2008 1981 { 2009 1982 unsigned short scscr, scsptr; 1983 + unsigned long flags; 2010 1984 2011 1985 /* check wheter the port has SCSPTR */ 2012 1986 if (!sci_getreg(port, SCSPTR)->size) { ··· 2018 1990 return; 2019 1991 } 2020 1992 1993 + spin_lock_irqsave(&port->lock, flags); 2021 1994 scsptr = serial_port_in(port, SCSPTR); 2022 1995 scscr = serial_port_in(port, SCSCR); 2023 1996 ··· 2032 2003 2033 2004 serial_port_out(port, SCSPTR, scsptr); 2034 2005 serial_port_out(port, SCSCR, scscr); 2006 + spin_unlock_irqrestore(&port->lock, flags); 2035 2007 } 2036 2008 2037 2009 static int sci_startup(struct uart_port *port) ··· 2067 2037 spin_lock_irqsave(&port->lock, flags); 2068 2038 sci_stop_rx(port); 2069 2039 sci_stop_tx(port); 2070 - /* Stop RX and TX, disable related interrupts, keep clock source */ 2040 + /* 2041 + * Stop RX and TX, disable related interrupts, keep clock source 2042 + * and HSCIF TOT bits 2043 + */ 2071 2044 scr = serial_port_in(port, SCSCR); 2072 - serial_port_out(port, SCSCR, scr & (SCSCR_CKE1 | SCSCR_CKE0)); 2045 + serial_port_out(port, SCSCR, scr & 2046 + (SCSCR_CKE1 | SCSCR_CKE0 | s->hscif_tot)); 2073 2047 spin_unlock_irqrestore(&port->lock, flags); 2074 2048 2075 2049 #ifdef CONFIG_SERIAL_SH_SCI_DMA ··· 2220 2186 unsigned int status; 2221 2187 struct sci_port *s = to_sci_port(port); 2222 2188 2223 - serial_port_out(port, SCSCR, 0x00); /* TE=0, RE=0, CKE1=0 */ 2189 + serial_port_out(port, SCSCR, s->hscif_tot); /* TE=0, RE=0, CKE1=0 */ 2224 2190 2225 2191 reg = sci_getreg(port, SCFCR); 2226 2192 if (reg->size) ··· 2261 2227 int min_err = INT_MAX, err; 2262 2228 unsigned long max_freq = 0; 2263 2229 int best_clk = -1; 2230 + unsigned long flags; 2264 2231 2265 2232 if ((termios->c_cflag & CSIZE) == CS7) 2266 2233 smr_val |= SCSMR_CHR; ··· 2371 2336 serial_port_out(port, SCCKS, sccks); 2372 2337 } 2373 2338 2339 + spin_lock_irqsave(&port->lock, flags); 2340 + 2374 2341 sci_reset(port); 2375 2342 2376 2343 uart_update_timeout(port, termios->c_cflag, baud); ··· 2390 2353 case 27: smr_val |= SCSMR_SRC_27; break; 2391 2354 } 2392 2355 smr_val |= cks; 2393 - dev_dbg(port->dev, 2394 - "SCR 0x%x SMR 0x%x BRR %u CKS 0x%x DL %u SRR %u\n", 2395 - scr_val, smr_val, brr, sccks, dl, srr); 2396 - serial_port_out(port, SCSCR, scr_val); 2356 + serial_port_out(port, SCSCR, scr_val | s->hscif_tot); 2397 2357 serial_port_out(port, SCSMR, smr_val); 2398 2358 serial_port_out(port, SCBRR, brr); 2399 2359 if (sci_getreg(port, HSSRR)->size) ··· 2403 2369 scr_val = s->cfg->scscr & (SCSCR_CKE1 | SCSCR_CKE0); 2404 2370 smr_val |= serial_port_in(port, SCSMR) & 2405 2371 (SCSMR_CKEDG | SCSMR_SRC_MASK | SCSMR_CKS); 2406 - dev_dbg(port->dev, "SCR 0x%x SMR 0x%x\n", scr_val, smr_val); 2407 - serial_port_out(port, SCSCR, scr_val); 2372 + serial_port_out(port, SCSCR, scr_val | s->hscif_tot); 2408 2373 serial_port_out(port, SCSMR, smr_val); 2409 2374 } 2410 2375 ··· 2439 2406 2440 2407 scr_val |= SCSCR_RE | SCSCR_TE | 2441 2408 (s->cfg->scscr & ~(SCSCR_CKE1 | SCSCR_CKE0)); 2442 - dev_dbg(port->dev, "SCSCR 0x%x\n", scr_val); 2443 - serial_port_out(port, SCSCR, scr_val); 2409 + serial_port_out(port, SCSCR, scr_val | s->hscif_tot); 2444 2410 if ((srr + 1 == 5) && 2445 2411 (port->type == PORT_SCIFA || port->type == PORT_SCIFB)) { 2446 2412 /* ··· 2485 2453 s->rx_frame = (100 * bits * HZ) / (baud / 10); 2486 2454 #ifdef CONFIG_SERIAL_SH_SCI_DMA 2487 2455 s->rx_timeout = DIV_ROUND_UP(s->buf_len_rx * 2 * s->rx_frame, 1000); 2488 - dev_dbg(port->dev, "DMA Rx t-out %ums, tty t-out %u jiffies\n", 2489 - s->rx_timeout * 1000 / HZ, port->timeout); 2490 2456 if (s->rx_timeout < msecs_to_jiffies(20)) 2491 2457 s->rx_timeout = msecs_to_jiffies(20); 2492 2458 #endif 2493 2459 2494 2460 if ((termios->c_cflag & CREAD) != 0) 2495 2461 sci_start_rx(port); 2462 + 2463 + spin_unlock_irqrestore(&port->lock, flags); 2496 2464 2497 2465 sci_port_disable(s); 2498 2466 ··· 2805 2773 } 2806 2774 2807 2775 sci_port->rx_fifo_timeout = 0; 2776 + sci_port->hscif_tot = 0; 2808 2777 2809 2778 /* SCIFA on sh7723 and sh7724 need a custom sampling rate that doesn't 2810 2779 * match the SoC datasheet, this should be investigated. Let platform ··· 2893 2860 ctrl_temp = SCSCR_RE | SCSCR_TE | 2894 2861 (sci_port->cfg->scscr & ~(SCSCR_CKE1 | SCSCR_CKE0)) | 2895 2862 (ctrl & (SCSCR_CKE1 | SCSCR_CKE0)); 2896 - serial_port_out(port, SCSCR, ctrl_temp); 2863 + serial_port_out(port, SCSCR, ctrl_temp | sci_port->hscif_tot); 2897 2864 2898 2865 uart_console_write(port, s, count, serial_console_putchar); 2899 2866 ··· 3021 2988 sysfs_remove_file(&dev->dev.kobj, 3022 2989 &dev_attr_rx_fifo_trigger.attr); 3023 2990 } 3024 - if (port->port.type == PORT_SCIFA || port->port.type == PORT_SCIFB) { 2991 + if (port->port.type == PORT_SCIFA || port->port.type == PORT_SCIFB || 2992 + port->port.type == PORT_HSCIF) { 3025 2993 sysfs_remove_file(&dev->dev.kobj, 3026 2994 &dev_attr_rx_fifo_timeout.attr); 3027 2995 } ··· 3078 3044 unsigned int *dev_id) 3079 3045 { 3080 3046 struct device_node *np = pdev->dev.of_node; 3081 - const struct of_device_id *match; 3082 3047 struct plat_sci_port *p; 3083 3048 struct sci_port *sp; 3049 + const void *data; 3084 3050 int id; 3085 3051 3086 3052 if (!IS_ENABLED(CONFIG_OF) || !np) 3087 3053 return NULL; 3088 3054 3089 - match = of_match_node(of_sci_match, np); 3090 - if (!match) 3091 - return NULL; 3055 + data = of_device_get_match_data(&pdev->dev); 3092 3056 3093 3057 p = devm_kzalloc(&pdev->dev, sizeof(struct plat_sci_port), GFP_KERNEL); 3094 3058 if (!p) ··· 3102 3070 sp = &sci_ports[id]; 3103 3071 *dev_id = id; 3104 3072 3105 - p->type = SCI_OF_TYPE(match->data); 3106 - p->regtype = SCI_OF_REGTYPE(match->data); 3073 + p->type = SCI_OF_TYPE(data); 3074 + p->regtype = SCI_OF_REGTYPE(data); 3107 3075 3108 3076 sp->has_rtscts = of_property_read_bool(np, "uart-has-rtscts"); 3109 3077 ··· 3205 3173 if (ret) 3206 3174 return ret; 3207 3175 } 3208 - if (sp->port.type == PORT_SCIFA || sp->port.type == PORT_SCIFB) { 3176 + if (sp->port.type == PORT_SCIFA || sp->port.type == PORT_SCIFB || 3177 + sp->port.type == PORT_HSCIF) { 3209 3178 ret = sysfs_create_file(&dev->dev.kobj, 3210 3179 &dev_attr_rx_fifo_timeout.attr); 3211 3180 if (ret) { ··· 3277 3244 early_serial_buf, ARRAY_SIZE(early_serial_buf)); 3278 3245 #endif 3279 3246 #ifdef CONFIG_SERIAL_SH_SCI_EARLYCON 3280 - static struct __init plat_sci_port port_cfg; 3247 + static struct plat_sci_port port_cfg __initdata; 3281 3248 3282 3249 static int __init early_console_setup(struct earlycon_device *device, 3283 3250 int type)
+3
drivers/tty/serial/sh-sci.h
··· 63 63 #define SCSCR_TDRQE BIT(15) /* Tx Data Transfer Request Enable */ 64 64 #define SCSCR_RDRQE BIT(14) /* Rx Data Transfer Request Enable */ 65 65 66 + /* Serial Control Register, HSCIF-only bits */ 67 + #define HSSCR_TOT_SHIFT 14 68 + 66 69 /* SCxSR (Serial Status Register) on SCI */ 67 70 #define SCI_TDRE BIT(7) /* Transmit Data Register Empty */ 68 71 #define SCI_RDRF BIT(6) /* Receive Data Register Full */
+1 -2
drivers/tty/serial/sirfsoc_uart.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Driver for CSR SiRFprimaII onboard UARTs. 3 4 * 4 5 * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company. 5 - * 6 - * Licensed under GPLv2 or later. 7 6 */ 8 7 9 8 #include <linux/module.h>
+1 -2
drivers/tty/serial/sirfsoc_uart.h
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Drivers for CSR SiRFprimaII onboard UARTs. 3 4 * 4 5 * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company. 5 - * 6 - * Licensed under GPLv2 or later. 7 6 */ 8 7 #include <linux/bitops.h> 9 8 #include <linux/log2.h>
+1 -22
drivers/tty/serial/sn_console.c
··· 8 8 * 9 9 * Copyright (c) 2004-2006 Silicon Graphics, Inc. All Rights Reserved. 10 10 * 11 - * This program is free software; you can redistribute it and/or modify it 12 - * under the terms of version 2 of the GNU General Public License 13 - * as published by the Free Software Foundation. 14 - * 15 - * This program is distributed in the hope that it would be useful, but 16 - * WITHOUT ANY WARRANTY; without even the implied warranty of 17 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 - * 19 - * Further, this software is distributed without any warranty that it is 20 - * free of the rightful claim of any third person regarding infringement 21 - * or the like. Any license provided herein, whether implied or 22 - * otherwise, applies only to this software file. Patent licenses, if 23 - * any, provided herein do not apply to combinations of this program with 24 - * other software, or any other product whatsoever. 25 - * 26 - * You should have received a copy of the GNU General Public 27 - * License along with this program; if not, write the Free Software 28 - * Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 29 - * 30 11 * Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane, 31 12 * Mountain View, CA 94043, or: 32 13 * ··· 668 687 * timer to poll for input and push data from the console 669 688 * buffer. 670 689 */ 671 - init_timer(&port->sc_timer); 672 - port->sc_timer.function = sn_sal_timer_poll; 673 - port->sc_timer.data = (unsigned long)port; 690 + setup_timer(&port->sc_timer, sn_sal_timer_poll, (unsigned long)port); 674 691 675 692 if (IS_RUNNING_ON_SIMULATOR()) 676 693 port->sc_interrupt_timeout = 6;
+1 -9
drivers/tty/serial/sprd_serial.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (C) 2012-2015 Spreadtrum Communications Inc. 3 - * 4 - * This software is licensed under the terms of the GNU General Public 5 - * License version 2, as published by the Free Software Foundation, and 6 - * may be copied, distributed, and modified under those terms. 7 - * 8 - * This program is distributed in the hope that it will be useful, 9 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 - * GNU General Public License for more details. 12 4 */ 13 5 14 6 #if defined(CONFIG_SERIAL_SPRD_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
+1 -6
drivers/tty/serial/st-asc.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * st-asc.c: ST Asynchronous serial controller (ASC) driver 3 4 * 4 5 * Copyright (C) 2003-2013 STMicroelectronics (R&D) Limited 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License as published by 8 - * the Free Software Foundation; either version 2 of the License, or 9 - * (at your option) any later version. 10 - * 11 6 */ 12 7 13 8 #if defined(CONFIG_SERIAL_ST_ASC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
+1 -4
drivers/tty/serial/stm32-usart.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (C) Maxime Coquelin 2015 3 4 * Copyright (C) STMicroelectronics SA 2017 4 5 * Authors: Maxime Coquelin <mcoquelin.stm32@gmail.com> 5 6 * Gerald Baeza <gerald.baeza@st.com> 6 - * License terms: GNU General Public License (GPL), version 2 7 7 * 8 8 * Inspired by st-asc.c from STMicroelectronics (c) 9 9 */ ··· 736 736 737 737 #ifdef CONFIG_OF 738 738 static const struct of_device_id stm32_match[] = { 739 - { .compatible = "st,stm32-usart", .data = &stm32f4_info}, 740 739 { .compatible = "st,stm32-uart", .data = &stm32f4_info}, 741 - { .compatible = "st,stm32f7-usart", .data = &stm32f7_info}, 742 740 { .compatible = "st,stm32f7-uart", .data = &stm32f7_info}, 743 - { .compatible = "st,stm32h7-usart", .data = &stm32h7_info}, 744 741 { .compatible = "st,stm32h7-uart", .data = &stm32h7_info}, 745 742 {}, 746 743 };
+1 -1
drivers/tty/serial/stm32-usart.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (C) Maxime Coquelin 2015 3 4 * Copyright (C) STMicroelectronics SA 2017 4 5 * Authors: Maxime Coquelin <mcoquelin.stm32@gmail.com> 5 6 * Gerald Baeza <gerald_baeza@yahoo.fr> 6 - * License terms: GNU General Public License (GPL), version 2 7 7 */ 8 8 9 9 #define DRIVER_NAME "stm32-usart"
+1
drivers/tty/serial/suncore.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* suncore.c 2 3 * 3 4 * Common SUN serial routines. Based entirely
+1
drivers/tty/serial/sunhv.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* sunhv.c: Serial driver for SUN4V hypervisor console. 2 3 * 3 4 * Copyright (C) 2006, 2007 David S. Miller (davem@davemloft.net)
+1
drivers/tty/serial/sunsab.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* sunsab.c: ASYNC Driver for the SIEMENS SAB82532 DUSCC. 2 3 * 3 4 * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be)
+1
drivers/tty/serial/sunsu.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * su.c: Small serial driver for keyboard/mouse interface on sparc32/PCI 3 4 *
+1
drivers/tty/serial/sunzilog.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* sunzilog.c: Zilog serial driver for Sparc systems. 2 3 * 3 4 * Driver for Zilog serial chips found on Sun workstations and
+1 -10
drivers/tty/serial/tilegx.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright 2013 Tilera Corporation. All Rights Reserved. 3 - * 4 - * This program is free software; you can redistribute it and/or 5 - * modify it under the terms of the GNU General Public License 6 - * as published by the Free Software Foundation, version 2. 7 - * 8 - * This program is distributed in the hope that it will be useful, but 9 - * WITHOUT ANY WARRANTY; without even the implied warranty of 10 - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or 11 - * NON INFRINGEMENT. See the GNU General Public License for 12 - * more details. 13 4 * 14 5 * TILEGx UART driver. 15 6 */
+1 -13
drivers/tty/serial/timbuart.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * timbuart.c timberdale FPGA UART driver 3 4 * Copyright (c) 2009 Intel Corporation 4 - * 5 - * This program is free software; you can redistribute it and/or modify 6 - * it under the terms of the GNU General Public License version 2 as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it will be useful, 10 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 - * GNU General Public License for more details. 13 - * 14 - * You should have received a copy of the GNU General Public License 15 - * along with this program; if not, write to the Free Software 16 - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 17 5 */ 18 6 19 7 /* Supports:
+1 -13
drivers/tty/serial/timbuart.h
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * timbuart.c timberdale FPGA GPIO driver 3 4 * Copyright (c) 2009 Intel Corporation 4 - * 5 - * This program is free software; you can redistribute it and/or modify 6 - * it under the terms of the GNU General Public License version 2 as 7 - * published by the Free Software Foundation. 8 - * 9 - * This program is distributed in the hope that it will be useful, 10 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 - * GNU General Public License for more details. 13 - * 14 - * You should have received a copy of the GNU General Public License 15 - * along with this program; if not, write to the Free Software 16 - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 17 5 */ 18 6 19 7 /* Supports:
+2 -5
drivers/tty/serial/uartlite.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * uartlite.c: Serial driver for Xilinx uartlite serial controller 3 4 * 4 5 * Copyright (C) 2006 Peter Korsgaard <jacmet@sunsite.dk> 5 6 * Copyright (C) 2007 Secret Lab Technologies Ltd. 6 - * 7 - * This file is licensed under the terms of the GNU General Public License 8 - * version 2. This program is licensed "as is" without any warranty of any 9 - * kind, whether express or implied. 10 7 */ 11 8 12 9 #include <linux/platform_device.h> ··· 736 739 err_plat: 737 740 uart_unregister_driver(&ulite_uart_driver); 738 741 err_uart: 739 - pr_err("registering uartlite driver failed: err=%i", ret); 742 + pr_err("registering uartlite driver failed: err=%i\n", ret); 740 743 return ret; 741 744 } 742 745
+2 -4
drivers/tty/serial/ucc_uart.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Freescale QUICC Engine UART device driver 3 4 * 4 5 * Author: Timur Tabi <timur@freescale.com> 5 6 * 6 - * Copyright 2007 Freescale Semiconductor, Inc. This file is licensed under 7 - * the terms of the GNU General Public License version 2. This program 8 - * is licensed "as is" without any warranty of any kind, whether express 9 - * or implied. 7 + * Copyright 2007 Freescale Semiconductor, Inc. 10 8 * 11 9 * This driver adds support for UART devices via Freescale's QUICC Engine 12 10 * found on some Freescale SOCs.
+1 -14
drivers/tty/serial/vr41xx_siu.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Driver for NEC VR4100 series Serial Interface Unit. 3 4 * 4 5 * Copyright (C) 2004-2008 Yoichi Yuasa <yuasa@linux-mips.org> 5 6 * 6 7 * Based on drivers/serial/8250.c, by Russell King. 7 - * 8 - * This program is free software; you can redistribute it and/or modify 9 - * it under the terms of the GNU General Public License as published by 10 - * the Free Software Foundation; either version 2 of the License, or 11 - * (at your option) any later version. 12 - * 13 - * This program is distributed in the hope that it will be useful, 14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 - * GNU General Public License for more details. 17 - * 18 - * You should have received a copy of the GNU General Public License 19 - * along with this program; if not, write to the Free Software 20 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 8 */ 22 9 23 10 #if defined(CONFIG_SERIAL_VR41XX_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
+1 -9
drivers/tty/serial/vt8500_serial.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (C) 2010 Alexey Charkov <alchark@gmail.com> 3 4 * 4 5 * Based on msm_serial.c, which is: 5 6 * Copyright (C) 2007 Google, Inc. 6 7 * Author: Robert Love <rlove@google.com> 7 - * 8 - * This software is licensed under the terms of the GNU General Public 9 - * License version 2, as published by the Free Software Foundation, and 10 - * may be copied, distributed, and modified under those terms. 11 - * 12 - * This program is distributed in the hope that it will be useful, 13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 - * GNU General Public License for more details. 16 8 */ 17 9 18 10 #if defined(CONFIG_SERIAL_VT8500_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
+2 -7
drivers/tty/serial/xilinx_uartps.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 2 3 * Cadence UART driver (found in Xilinx Zynq) 3 4 * 4 5 * 2011 - 2014 (C) Xilinx Inc. 5 - * 6 - * This program is free software; you can redistribute it 7 - * and/or modify it under the terms of the GNU General Public 8 - * License as published by the Free Software Foundation; 9 - * either version 2 of the License, or (at your option) any 10 - * later version. 11 6 * 12 7 * This driver has originally been pushed by Xilinx using a Zynq-branding. This 13 8 * still shows in the naming of this file, the kconfig symbols and some symbols ··· 1668 1673 uart_unregister_driver(&cdns_uart_uart_driver); 1669 1674 } 1670 1675 1671 - module_init(cdns_uart_init); 1676 + arch_initcall(cdns_uart_init); 1672 1677 module_exit(cdns_uart_exit); 1673 1678 1674 1679 MODULE_DESCRIPTION("Driver for Cadence UART");
+1
drivers/tty/serial/zs.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * zs.c: Serial port driver for IOASIC DECstations. 3 4 *
+2 -4
drivers/tty/synclink.c
··· 1 + // SPDX-License-Identifier: GPL-1.0+ 1 2 /* 2 3 * $Id: synclink.c,v 4.38 2005/11/07 16:30:34 paulkf Exp $ 3 4 * ··· 13 12 * Derived from serial.c written by Theodore Ts'o and Linus Torvalds 14 13 * 15 14 * Original release 01/11/99 16 - * 17 - * This code is released under the GNU General Public License (GPL) 18 15 * 19 16 * This driver is primarily intended for use in synchronous 20 17 * HDLC mode. Asynchronous mode is also provided. ··· 4097 4098 if (request_dma(info->dma_level,info->device_name) < 0){ 4098 4099 printk( "%s(%d):Can't request DMA channel on device %s DMA=%d\n", 4099 4100 __FILE__,__LINE__,info->device_name, info->dma_level ); 4100 - mgsl_release_resources( info ); 4101 - return -ENODEV; 4101 + goto errout; 4102 4102 } 4103 4103 info->dma_requested = true; 4104 4104
+1 -1
drivers/tty/synclinkmp.c
··· 1 + // SPDX-License-Identifier: GPL-1.0+ 1 2 /* 2 3 * $Id: synclinkmp.c,v 4.38 2005/07/15 13:29:44 paulkf Exp $ 3 4 * ··· 11 10 * Microgate and SyncLink are trademarks of Microgate Corporation 12 11 * 13 12 * Derived from serial.c written by Theodore Ts'o and Linus Torvalds 14 - * This code is released under the GNU General Public License (GPL) 15 13 * 16 14 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 15 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+11 -7
drivers/tty/sysrq.c
··· 246 246 * architecture has no support for it: 247 247 */ 248 248 if (!trigger_all_cpu_backtrace()) { 249 - struct pt_regs *regs = get_irq_regs(); 249 + struct pt_regs *regs = NULL; 250 250 251 + if (in_irq()) 252 + regs = get_irq_regs(); 251 253 if (regs) { 252 254 pr_info("CPU%d:\n", smp_processor_id()); 253 255 show_regs(regs); ··· 268 266 269 267 static void sysrq_handle_showregs(int key) 270 268 { 271 - struct pt_regs *regs = get_irq_regs(); 269 + struct pt_regs *regs = NULL; 270 + 271 + if (in_irq()) 272 + regs = get_irq_regs(); 272 273 if (regs) 273 274 show_regs(regs); 274 275 perf_event_print_debug(); ··· 654 649 state->reset_seq_version = sysrq_reset_seq_version; 655 650 } 656 651 657 - static void sysrq_do_reset(unsigned long _state) 652 + static void sysrq_do_reset(struct timer_list *t) 658 653 { 659 - struct sysrq_state *state = (struct sysrq_state *) _state; 654 + struct sysrq_state *state = from_timer(state, t, keyreset_timer); 660 655 661 656 state->reset_requested = true; 662 657 ··· 673 668 mod_timer(&state->keyreset_timer, 674 669 jiffies + msecs_to_jiffies(sysrq_reset_downtime_ms)); 675 670 else 676 - sysrq_do_reset((unsigned long)state); 671 + sysrq_do_reset(&state->keyreset_timer); 677 672 } 678 673 679 674 static void sysrq_detect_reset_sequence(struct sysrq_state *state, ··· 909 904 sysrq->handle.handler = handler; 910 905 sysrq->handle.name = "sysrq"; 911 906 sysrq->handle.private = sysrq; 912 - setup_timer(&sysrq->keyreset_timer, 913 - sysrq_do_reset, (unsigned long)sysrq); 907 + timer_setup(&sysrq->keyreset_timer, sysrq_do_reset, 0); 914 908 915 909 error = input_register_handle(&sysrq->handle); 916 910 if (error) {
+2 -4
drivers/tty/tty_audit.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Creating audit events from TTY input. 3 4 * 4 - * Copyright (C) 2007 Red Hat, Inc. All rights reserved. This copyrighted 5 - * material is made available to anyone wishing to use, modify, copy, or 6 - * redistribute it subject to the terms and conditions of the GNU General 7 - * Public License v.2. 5 + * Copyright (C) 2007 Red Hat, Inc. All rights reserved. 8 6 * 9 7 * Authors: Miloslav Trmac <mitr@redhat.com> 10 8 */
+1
drivers/tty/tty_baudrate.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds 3 4 */
+2 -1
drivers/tty/tty_buffer.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Tty buffer allocation management 3 4 */ ··· 447 446 * Callers other than flush_to_ldisc() need to exclude the kworker 448 447 * from concurrent use of the line discipline, see paste_selection(). 449 448 * 450 - * Returns the number of bytes not processed 449 + * Returns the number of bytes processed 451 450 */ 452 451 int tty_ldisc_receive_buf(struct tty_ldisc *ld, const unsigned char *p, 453 452 char *f, int count)
+1
drivers/tty/tty_io.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (C) 1991, 1992 Linus Torvalds 3 4 */
+1
drivers/tty/tty_ioctl.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds 3 4 *
+1
drivers/tty/tty_jobctrl.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (C) 1991, 1992 Linus Torvalds 3 4 */
+1
drivers/tty/tty_ldisc.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 #include <linux/types.h> 2 3 #include <linux/errno.h> 3 4 #include <linux/kmod.h>
+1 -3
drivers/tty/tty_ldsem.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Ldisc rw semaphore 3 4 * ··· 23 22 * Michel Lespinasse <walken@google.com>. 24 23 * 25 24 * Copyright (C) 2013 Peter Hurley <peter@hurleysoftware.com> 26 - * 27 - * This file may be redistributed under the terms of the GNU General Public 28 - * License v2. 29 25 */ 30 26 31 27 #include <linux/list.h>
+3 -2
drivers/tty/tty_port.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Tty port functions 3 4 */ ··· 79 78 * @driver: tty_driver for this device 80 79 * @index: index of the tty 81 80 * 82 - * Provide the tty layer wit ha link from a tty (specified by @index) to a 81 + * Provide the tty layer with a link from a tty (specified by @index) to a 83 82 * tty_port (@port). Use this only if neither tty_port_register_device nor 84 83 * tty_port_install is used in the driver. If used, this has to be called before 85 84 * tty_register_driver. ··· 236 235 237 236 /** 238 237 * tty_port_destroy -- destroy inited port 239 - * @port: tty port to be doestroyed 238 + * @port: tty port to be destroyed 240 239 * 241 240 * When a port was initialized using tty_port_init, one has to destroy the 242 241 * port by this function. Either indirectly by using tty_port refcounting
+6 -19
drivers/tty/vcc.c
··· 361 361 return rv; 362 362 } 363 363 364 - static void vcc_rx_timer(unsigned long index) 364 + static void vcc_rx_timer(struct timer_list *t) 365 365 { 366 + struct vcc_port *port = from_timer(port, t, rx_timer); 366 367 struct vio_driver_state *vio; 367 - struct vcc_port *port; 368 368 unsigned long flags; 369 369 int rv; 370 - 371 - port = vcc_get_ne(index); 372 - if (!port) 373 - return; 374 370 375 371 spin_lock_irqsave(&port->lock, flags); 376 372 port->rx_timer.expires = 0; ··· 387 391 vcc_put(port, false); 388 392 } 389 393 390 - static void vcc_tx_timer(unsigned long index) 394 + static void vcc_tx_timer(struct timer_list *t) 391 395 { 392 - struct vcc_port *port; 396 + struct vcc_port *port = from_timer(port, t, tx_timer); 393 397 struct vio_vcc *pkt; 394 398 unsigned long flags; 395 399 int tosend = 0; 396 400 int rv; 397 - 398 - port = vcc_get_ne(index); 399 - if (!port) 400 - return; 401 401 402 402 spin_lock_irqsave(&port->lock, flags); 403 403 port->tx_timer.expires = 0; ··· 637 645 if (rv) 638 646 goto free_domain; 639 647 640 - init_timer(&port->rx_timer); 641 - port->rx_timer.function = vcc_rx_timer; 642 - port->rx_timer.data = port->index; 643 - 644 - init_timer(&port->tx_timer); 645 - port->tx_timer.function = vcc_tx_timer; 646 - port->tx_timer.data = port->index; 648 + timer_setup(&port->rx_timer, vcc_rx_timer, 0); 649 + timer_setup(&port->tx_timer, vcc_tx_timer, 0); 647 650 648 651 dev_set_drvdata(&vdev->dev, port); 649 652
+1
drivers/tty/vt/consolemap.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * consolemap.c 3 4 *
+1
drivers/tty/vt/keyboard.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Written for linux by Johan Myreen as a translation from 3 4 * the assembly version by Linus (with diacriticals added)
+60 -53
drivers/tty/vt/vt.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Copyright (C) 1991, 1992 Linus Torvalds 3 4 */ ··· 103 102 #include <linux/uaccess.h> 104 103 #include <linux/kdb.h> 105 104 #include <linux/ctype.h> 105 + #include <linux/bsearch.h> 106 106 107 107 #define MAX_NR_CON_DRIVER 16 108 108 ··· 2144 2142 uint32_t last; 2145 2143 }; 2146 2144 2147 - static int bisearch(uint32_t ucs, const struct interval *table, int max) 2145 + static int ucs_cmp(const void *key, const void *elt) 2148 2146 { 2149 - int min = 0; 2150 - int mid; 2147 + uint32_t ucs = *(uint32_t *)key; 2148 + struct interval e = *(struct interval *) elt; 2151 2149 2152 - if (ucs < table[0].first || ucs > table[max].last) 2153 - return 0; 2154 - while (max >= min) { 2155 - mid = (min + max) / 2; 2156 - if (ucs > table[mid].last) 2157 - min = mid + 1; 2158 - else if (ucs < table[mid].first) 2159 - max = mid - 1; 2160 - else 2161 - return 1; 2162 - } 2150 + if (ucs > e.last) 2151 + return 1; 2152 + else if (ucs < e.first) 2153 + return -1; 2163 2154 return 0; 2164 2155 } 2165 2156 ··· 2164 2169 { 0xFE10, 0xFE19 }, { 0xFE30, 0xFE6F }, { 0xFF00, 0xFF60 }, 2165 2170 { 0xFFE0, 0xFFE6 }, { 0x20000, 0x2FFFD }, { 0x30000, 0x3FFFD } 2166 2171 }; 2167 - return bisearch(ucs, double_width, ARRAY_SIZE(double_width) - 1); 2172 + if (ucs < double_width[0].first || 2173 + ucs > double_width[ARRAY_SIZE(double_width) - 1].last) 2174 + return 0; 2175 + 2176 + return bsearch(&ucs, double_width, ARRAY_SIZE(double_width), 2177 + sizeof(struct interval), ucs_cmp) != NULL; 2168 2178 } 2169 2179 2170 2180 static void con_flush(struct vc_data *vc, unsigned long draw_from, ··· 2205 2205 console_lock(); 2206 2206 vc = tty->driver_data; 2207 2207 if (vc == NULL) { 2208 - printk(KERN_ERR "vt: argh, driver_data is NULL !\n"); 2208 + pr_err("vt: argh, driver_data is NULL !\n"); 2209 2209 console_unlock(); 2210 2210 return 0; 2211 2211 } ··· 3190 3190 3191 3191 pr_info("Console: switching "); 3192 3192 if (!deflt) 3193 - printk(KERN_CONT "consoles %d-%d ", first+1, last+1); 3193 + pr_cont("consoles %d-%d ", first + 1, last + 1); 3194 3194 if (j >= 0) { 3195 3195 struct vc_data *vc = vc_cons[j].d; 3196 3196 3197 - printk(KERN_CONT "to %s %s %dx%d\n", 3198 - vc->vc_can_do_color ? "colour" : "mono", 3199 - desc, vc->vc_cols, vc->vc_rows); 3197 + pr_cont("to %s %s %dx%d\n", 3198 + vc->vc_can_do_color ? "colour" : "mono", 3199 + desc, vc->vc_cols, vc->vc_rows); 3200 3200 3201 3201 if (k >= 0) { 3202 3202 vc = vc_cons[k].d; 3203 3203 update_screen(vc); 3204 3204 } 3205 - } else 3206 - printk(KERN_CONT "to %s\n", desc); 3205 + } else { 3206 + pr_cont("to %s\n", desc); 3207 + } 3207 3208 3208 3209 retval = 0; 3209 3210 err: ··· 3623 3622 con_driver, con_dev_groups, 3624 3623 "vtcon%i", con_driver->node); 3625 3624 if (IS_ERR(con_driver->dev)) { 3626 - printk(KERN_WARNING "Unable to create device for %s; " 3627 - "errno = %ld\n", con_driver->desc, 3628 - PTR_ERR(con_driver->dev)); 3625 + pr_warn("Unable to create device for %s; errno = %ld\n", 3626 + con_driver->desc, PTR_ERR(con_driver->dev)); 3629 3627 con_driver->dev = NULL; 3630 3628 } else { 3631 3629 vtconsole_init_device(con_driver); ··· 3761 3761 3762 3762 vtconsole_class = class_create(THIS_MODULE, "vtconsole"); 3763 3763 if (IS_ERR(vtconsole_class)) { 3764 - printk(KERN_WARNING "Unable to create vt console class; " 3765 - "errno = %ld\n", PTR_ERR(vtconsole_class)); 3764 + pr_warn("Unable to create vt console class; errno = %ld\n", 3765 + PTR_ERR(vtconsole_class)); 3766 3766 vtconsole_class = NULL; 3767 3767 } 3768 3768 ··· 3778 3778 "vtcon%i", con->node); 3779 3779 3780 3780 if (IS_ERR(con->dev)) { 3781 - printk(KERN_WARNING "Unable to create " 3782 - "device for %s; errno = %ld\n", 3783 - con->desc, PTR_ERR(con->dev)); 3781 + pr_warn("Unable to create device for %s; errno = %ld\n", 3782 + con->desc, PTR_ERR(con->dev)); 3784 3783 con->dev = NULL; 3785 3784 } else { 3786 3785 vtconsole_init_device(con); ··· 4120 4121 return -EINVAL; 4121 4122 if (op->charcount > 512) 4122 4123 return -EINVAL; 4123 - if (!op->height) { /* Need to guess font height [compat] */ 4124 - int h, i; 4125 - u8 __user *charmap = op->data; 4126 - u8 tmp; 4127 - 4128 - /* If from KDFONTOP ioctl, don't allow things which can be done in userland, 4129 - so that we can get rid of this soon */ 4130 - if (!(op->flags & KD_FONT_FLAG_OLD)) 4131 - return -EINVAL; 4132 - for (h = 32; h > 0; h--) 4133 - for (i = 0; i < op->charcount; i++) { 4134 - if (get_user(tmp, &charmap[32*i+h-1])) 4135 - return -EFAULT; 4136 - if (tmp) 4137 - goto nonzero; 4138 - } 4139 - return -EINVAL; 4140 - nonzero: 4141 - op->height = h; 4142 - } 4143 4124 if (op->width <= 0 || op->width > 32 || op->height > 32) 4144 4125 return -EINVAL; 4145 4126 size = (op->width+7)/8 * 32 * op->charcount; 4146 4127 if (size > max_font_size) 4147 4128 return -ENOSPC; 4148 - font.charcount = op->charcount; 4149 - font.height = op->height; 4150 - font.width = op->width; 4129 + 4151 4130 font.data = memdup_user(op->data, size); 4152 4131 if (IS_ERR(font.data)) 4153 4132 return PTR_ERR(font.data); 4133 + 4134 + if (!op->height) { /* Need to guess font height [compat] */ 4135 + int h, i; 4136 + u8 *charmap = font.data; 4137 + 4138 + /* 4139 + * If from KDFONTOP ioctl, don't allow things which can be done 4140 + * in userland,so that we can get rid of this soon 4141 + */ 4142 + if (!(op->flags & KD_FONT_FLAG_OLD)) { 4143 + kfree(font.data); 4144 + return -EINVAL; 4145 + } 4146 + 4147 + for (h = 32; h > 0; h--) 4148 + for (i = 0; i < op->charcount; i++) 4149 + if (charmap[32*i+h-1]) 4150 + goto nonzero; 4151 + 4152 + kfree(font.data); 4153 + return -EINVAL; 4154 + 4155 + nonzero: 4156 + op->height = h; 4157 + } 4158 + 4159 + font.charcount = op->charcount; 4160 + font.width = op->width; 4161 + font.height = op->height; 4162 + 4154 4163 console_lock(); 4155 4164 if (vc->vc_mode != KD_TEXT) 4156 4165 rc = -EINVAL;
+2 -1
fs/proc/proc_tty.c
··· 15 15 #include <linux/tty.h> 16 16 #include <linux/seq_file.h> 17 17 #include <linux/bitops.h> 18 + #include "internal.h" 18 19 19 20 /* 20 21 * The /proc/tty directory inodes... ··· 166 165 if (!ent) 167 166 return; 168 167 169 - remove_proc_entry(driver->driver_name, proc_tty_driver); 168 + remove_proc_entry(ent->name, proc_tty_driver); 170 169 171 170 driver->proc_entry = NULL; 172 171 }
+1 -1
include/acpi/acpi_bus.h
··· 211 211 u32 of_compatible_ok:1; 212 212 u32 coherent_dma:1; 213 213 u32 cca_seen:1; 214 - u32 spi_i2c_slave:1; 214 + u32 serial_bus_slave:1; 215 215 u32 reserved:19; 216 216 }; 217 217
+3
include/linux/cyclades.h
··· 157 157 struct cyclades_icount icount; 158 158 struct completion shutdown_wait; 159 159 int throttle; 160 + #ifdef CONFIG_CYZ_INTR 161 + struct timer_list rx_full_timer; 162 + #endif 160 163 }; 161 164 162 165 #define CLOSING_WAIT_DELAY 30*HZ
+5
include/linux/serial_core.h
··· 501 501 (cflag) & CRTSCTS || \ 502 502 !((cflag) & CLOCAL)) 503 503 504 + /* 505 + * Common device tree parsing helpers 506 + */ 507 + void of_get_rs485_mode(struct device_node *np, struct serial_rs485 *rs485conf); 508 + 504 509 #endif /* LINUX_SERIAL_CORE_H */
+1
include/uapi/linux/serial_reg.h
··· 158 158 */ 159 159 #define UART_DLL 0 /* Out: Divisor Latch Low */ 160 160 #define UART_DLM 1 /* Out: Divisor Latch High */ 161 + #define UART_DIV_MAX 0xFFFF /* Max divisor value */ 161 162 162 163 /* 163 164 * LCR=0xBF (or DLAB=1 for 16C660)