summaryrefslogtreecommitdiff
path: root/drivers/tty/serial
AgeCommit message (Collapse)AuthorFilesLines
2017-07-17tty: serial: lpuart: Fix the logic for detecting the 32-bit type UARTFabio Estevam1-9/+15
Commit 0d6fce904452 ("tty: serial: lpuart: introduce lpuart_soc_data to represent SoC property") introduced a buggy logic for detecting the 32-bit type UART since the condition: "if (sport->port.iotype & UPIO_MEM32BE)" is always true. Performing such bitfield AND operation is not correct, because in the case of Vybrid UART iotype is UPIO_MEM (2), so: UPIO_MEM & UPIO_MEM32BE = 010 & 110 = 010, which is true. Such logic tells the driver to always treat the UART operations as 32-bit, leading to the driver misbehavior on Vybrid. Fix the 32-bit type detection logic to avoid UART breakage on Vybrid. While at it, introduce a lpuart_is_32() function to help readability. Fixes: 0d6fce904452 ("tty: serial: lpuart: introduce lpuart_soc_data to represent SoC property") Reported-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com> Tested-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-17serial: imx: Prevent TX buffer PIO write when a DMA has been startedIan Jamison1-1/+1
Function imx_transmit_buffer starts a TX DMA if DMA is enabled, since commit 91a1a909f921 ("serial: imx: Support sw flow control in DMA mode"). It also carries on and attempts to write the same TX buffer using PIO. This results in TX data corruption and double-incrementing xmit->tail with the knock-on effect of tail passing head and a page of garbage being sent out. This seems to be triggered mostly when using RS485 half duplex on SMP systems, but is probably not limited to just those. Tested locally on an i.MX6Q with an RS485 half duplex transceiver on UART3, and also by Clemens Gruber. Tested-by: Clemens Gruber <clemens.gruber@pqgruber.com> Signed-off-by: Ian Jamison <ian.dev@arkver.com> Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-17Revert "serial: imx-serial - move DMA buffer configuration to DT"Greg Kroah-Hartman1-17/+8
This reverts commit a3015affdf76ef279fbbb3710a220bab7e9ea04b as there are complaints that it is incorrect. Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Cc: Nandor Han <nandor.han@ge.com> Cc: Romain Perier <romain.perier@collabora.com> Signed-off-by: Greg Kroah-Hartman gregkh@linuxfoundation.org
2017-07-17serial: sh-sci: Uninitialized variables in sysfs filesDan Carpenter1-4/+8
The kstrtol() function returns -ERANGE as well as -EINVAL so these tests are not enough. It's not a super serious bug, but my static checker correctly complains that the "r" variable might be used uninitialized. Fixes: 5d23188a473d ("serial: sh-sci: make RX FIFO parameters tunable via sysfs") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-17serial: st-asc: Potential error pointer dereferenceDan Carpenter1-0/+1
It looks like we intended to return an error code here, because we dereference "ascport->pinctrl" on the next lines. Fixes: 6929cb00a501 ("serial: st-asc: Read in all Pinctrl states") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Lee Jones <lee.jones@linaro.org> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-13drivers: tty: serial: move inline before return typeJoe Perches2-4/+4
Make the code like the rest of the kernel. Link: http://lkml.kernel.org/r/55d3e89d50bb03d603bfb28019fab07f48bdc714.1499284835.git.joe@perches.com Signed-off-by: Joe Perches <joe@perches.com> Cc: Pat Gefre <pfg@sgi.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Jiri Slaby <jslaby@suse.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-07-07Merge tag 'gpio-v4.13-1' of ↵Linus Torvalds1-5/+168
git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio Pull GPIO updates from Linus Walleij: "This is the bulk of GPIO changes for the v4.13 series. Some administrativa: I have a slew of 8250 serial patches and the new IOT2040 serial+GPIO driver coming in through this tree, along with a whole bunch of Exar 8250 fixes. These are ACKed by Greg and also hit drivers/platform/* where they are ACKed by Andy Shevchenko. Speaking about drivers/platform/* there is also a bunch of ACPI stuff coming through that route, again ACKed by Andy. The MCP23S08 changes are coming in here as well. You already have the commits in your tree, so this is just a result of sharing an immutable branch between pin control and GPIO. Core: - Export add/remove for lookup tables so that modules can export GPIO descriptor tables. - Handle GPIO sleep states: it is now possible to flag that a GPIO line may loose its state during suspend/resume of the system to save power. This is used in the Wolfson Micro Arizona driver. - ACPI-based GPIO was tightened up a lot around the edges. - Use bitmap_fill() to speed up a loop. New drivers: - Exar XRA1403 SPI-based GPIO. - MVEBU driver now supports Armada 7K and 8K. - LP87565 PMIC GPIO. - Renesas R-CAR R8A7743 (RZ/G1M). - The new IOT2040 8250 serial/GPIO also comes in through this changeset. Substantial driver changes: - Seriously fix the Exar 8250 GPIO portions to work. - The MCP23S08 was moved out to a pin control driver. - Convert MEVEBU to use regmap for register access. - Drop Vulcan support from the Broadcom driver. - Serious cleanup and improvement of the mockup driver, giving us a better test coverage. Misc: - Lots of janitorial clean up. - A bunch of documentation fixes" * tag 'gpio-v4.13-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (70 commits) serial: exar: Add support for IOT2040 device gpio-exar/8250-exar: Make set of exported GPIOs configurable platform: Accept const properties serial: exar: Factor out platform hooks gpio-exar/8250-exar: Rearrange gpiochip parenthood gpio: exar: Fix iomap request gpio-exar/8250-exar: Do not even instantiate a GPIO device for Commtech cards serial: uapi: Add support for bus termination gpio: rcar: Add R8A7743 (RZ/G1M) support gpio: gpio-wcove: Fix GPIO control register offset calculation gpio: lp87565: Add support for GPIO gpio: dwapb: fix missing first irq for edgeboth irq type MAINTAINERS: Take maintainership for GPIO ACPI support gpio: exar: Fix reading of directions and values gpio: exar: Allocate resources on behalf of the platform device gpio-exar/8250-exar: Fix passing in of parent PCI device gpio: mockup: use devm_kcalloc() where applicable gpio: mockup: add myself as author gpio: mockup: improve the error message gpio: mockup: don't return magic numbers from probe() ...
2017-07-03serial: exar: Add support for IOT2040 deviceJan Kiszka1-1/+128
This implements the setup of RS232 and the switch-over to RS485 or RS422 for the Siemens IOT2040. That uses an EXAR XR17V352 with external logic to switch between the different modes. The external logic is controlled via MPIO pins of the EXAR controller. Only pin 10 can be exported as GPIO on the IOT2040. It is connected to an LED. As the XR17V352 used on the IOT2040 is not equipped with an external EEPROM, it cannot present itself as IOT2040-variant via subvendor/ subdevice IDs. Thus, we have to check via DMI for the target platform. Co-developed with Sascha Weisenberger. Signed-off-by: Sascha Weisenberger <sascha.weisenberger@siemens.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-03gpio-exar/8250-exar: Make set of exported GPIOs configurableJan Kiszka1-3/+12
On the SIMATIC, IOT2040 only a single pin is exportable as GPIO, the rest is required to operate the UART. To allow modeling this case, expand the platform device data structure to specify a (consecutive) pin subset for exporting by the gpio-exar driver. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
2017-07-03serial: exar: Factor out platform hooksJan Kiszka1-5/+27
This prepares the addition of IOT2040 platform support by preparing the needed setup and rs485_config hooks. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-03gpio-exar/8250-exar: Rearrange gpiochip parenthoodJan Kiszka1-0/+2
Set the parent of the exar gpiochip to its platform device, like other gpiochips are doing it. In order to keep the relationship discoverable for ACPI systems, set the platform device companion to the PCI device. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Acked-by: Linus Walleij <linus.walleij@linaro.org>
2017-07-03gpio-exar/8250-exar: Do not even instantiate a GPIO device for Commtech cardsJan Kiszka1-1/+3
Commtech adapters need the MPIOs for internal purposes, and the gpio-exar driver already refused to pick them up. But there is actually no point in even creating the underlying platform device. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-29tty: serial: lpuart: add a more accurate baud rate calculation methodDong Aisheng1-7/+72
On new LPUART versions, the oversampling ratio for the receiver can be changed from 4x (00011) to 32x (11111) which could help us get a more accurate baud rate divider. The idea is to use the best OSR (over-sampling rate) possible. Note, OSR is typically hard-set to 16 in other LPUART instantiations. Loop to find the best OSR value possible, one that generates minimum baud diff iterate through the rest of the supported values of OSR. Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Jiri Slaby <jslaby@suse.com> Cc: Stefan Agner <stefan@agner.ch> Cc: Mingkai Hu <Mingkai.Hu@nxp.com> Cc: Yangbo Lu <yangbo.lu@nxp.com> Acked-by: Fugang Duan <fugang.duan@nxp.com> Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-29tty: serial: lpuart: add earlycon support for imx7ulpDong Aisheng1-0/+13
earlycon is executed quite early before the device tree probe, so we need correctly initialize the port membase and iotype for imx7ulp during early console setup before using. Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Jiri Slaby <jslaby@suse.com> Cc: Stefan Agner <stefan@agner.ch> Cc: Mingkai Hu <Mingkai.Hu@nxp.com> Cc: Yangbo Lu <yangbo.lu@nxp.com> Acked-by: Fugang Duan <fugang.duan@nxp.com> Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-29tty: serial: lpuart: add imx7ulp supportDong Aisheng1-0/+11
The lpuart of imx7ulp is basically the same as ls1021a. It's also 32 bit width register, but unlike ls1021a, it's little endian. Besides that, imx7ulp lpuart has a minor different register layout from ls1021a that it has four extra registers (verid, param, global, pincfg) located at the beginning of register map, which are currently not used by the driver and less to be used later. To ease the register difference handling, we add a reg_off member in lpuart_soc_data structure to represent if the normal lpuart32_{read|write} requires plus a offset to hide the issue. Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Jiri Slaby <jslaby@suse.com> Cc: Stefan Agner <stefan@agner.ch> Cc: Mingkai Hu <Mingkai.Hu@nxp.com> Cc: Yangbo Lu <yangbo.lu@nxp.com> Cc: Fugang Duan <fugang.duan@nxp.com> Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-29tty: serial: lpuart: add little endian 32 bit register supportDong Aisheng1-15/+30
Use standard port->iotype to distinguish endian difference. Note as we read/write register by checking iotype dynamically, we need to initialize the iotype correctly for earlycon as well to avoid a break. Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Jiri Slaby <jslaby@suse.com> (supporter:TTY LAYER) Cc: Stefan Agner <stefan@agner.ch> Cc: Mingkai Hu <Mingkai.Hu@nxp.com> Cc: Yangbo Lu <yangbo.lu@nxp.com> Cc: Fugang Duan <fugang.duan@nxp.com> Cc: Andy Shevchenko <andy.shevchenko@gmail.com> Cc: Nikita Yushchenko <nikita.yoush@cogentembedded.com> Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com> ChangeLog: v3->v4: * Removed unneeded semicolon catched by 0day Robot. v2->v3: * Instead of using global var, use standard port->iotype to distinguish endian difference. v1->v2: * No changes Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-29tty: serial: lpuart: refactor lpuart32_{read|write} prototypeDong Aisheng1-61/+62
Due to the original lpuart32_read/write takes no port specific information arguments, it's hard to distinguish port difference within the API. Although it works before, but not suitable anymore when adding more new chips support. So let's convert it to accept a new struct uart_port argument to make it be able to retrieve more port specific information. This is a preparation for the later adding new chips support more easily. No functions changes. Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Jiri Slaby <jslaby@suse.com> Cc: Stefan Agner <stefan@agner.ch> Cc: Mingkai Hu <Mingkai.Hu@nxp.com> Cc: Yangbo Lu <yangbo.lu@nxp.com> Cc: Fugang Duan <fugang.duan@nxp.com> Cc: Andy Shevchenko <andy.shevchenko@gmail.com> Cc: Nikita Yushchenko <nikita.yoush@cogentembedded.com> Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-29tty: serial: lpuart: introduce lpuart_soc_data to represent SoC propertyDong Aisheng1-20/+27
This is used to dynamically check the SoC specific lpuart properies. Currently only the iotype is added, it functions the same as before. With this, new chips with different iotype will be more easily added. Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Jiri Slaby <jslaby@suse.com> Cc: Stefan Agner <stefan@agner.ch> Cc: Mingkai Hu <Mingkai.Hu@nxp.com> Cc: Yangbo Lu <yangbo.lu@nxp.com> Cc: Fugang Duan <fugang.duan@nxp.com> Cc: Andy Shevchenko <andy.shevchenko@gmail.com> Cc: Nikita Yushchenko <nikita.yoush@cogentembedded.com> Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-29serial: imx-serial - move DMA buffer configuration to DTNandor Han1-8/+17
The size of the DMA buffer can affect the delta time between data being produced and data being consumed. Basically the DMA system will move data to tty buffer when a) DMA buffer is full b) serial line is idle. The situation is visible when producer generates data continuously and there is no possibility for idle line. At this point the DMA buffer is directly affecting the delta time. The patch will add the possibility to configure the DMA buffers in DT, which case by case can be configured separately for every driver instance. The DT configuration is optional and in case missing the driver will use the 4096 buffer with 4 periods (as before), therefore no clients are impacted by this change. Signed-off-by: Nandor Han <nandor.han@ge.com> Signed-off-by: Romain Perier <romain.perier@collabora.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-29serial: imx: Enable RTSD only when neededNandor Han1-1/+3
Currently, this IRQ is always enabled. Some devices might mux these pins to other I/Os, like I2C. This could lead to spurious interrupts. This commit makes this IRQ optional, by using the field have_rtscts. Signed-off-by: Nandor Han <nandor.han@ge.com> Signed-off-by: Romain Perier <romain.perier@collabora.com> Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-29serial: imx: Remove unused members from imx_port structFabio Estevam1-3/+0
IRDA support is gone since commit afe9cbb1a6ad ("serial: imx: drop support for IRDA"), so remove the remaining irda members from imx_port structure. While at it, also remove 'trcv_delay' which is also unused. Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-29serial: 8250: 8250_omap: Fix race b/w dma completion and RX timeoutVignesh R1-2/+21
DMA RX completion handler for UART is called from a tasklet and hence may be delayed depending on the system load. In meanwhile, there may be RX timeout interrupt which can get serviced first before DMA RX completion handler is executed for the completed transfer. omap_8250_rx_dma_flush() which is called on RX timeout interrupt makes sure that the DMA RX buffer is pushed and then the FIFO is drained and also queues a new DMA request. But, when DMA RX completion handler executes, it will erroneously flush the currently queued DMA transfer which sometimes results in data corruption and double queueing of DMA RX requests. Fix this by checking whether RX completion is for the currently queued transfer or not. And also hold port lock when in DMA completion to avoid race wrt RX timeout handler preempting it. Signed-off-by: Vignesh R <vigneshr@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-29serial: 8250: Fix THRE flag usage for CAP_MINIPhil Elwell1-0/+4
The BCM2835 MINI UART has non-standard THRE semantics. Conventionally the bit means that the FIFO is empty (although there may still be a byte in the transmit register), but on 2835 it indicates that the FIFO is not full. This causes interrupts after every byte is transmitted, with the FIFO providing some interrupt latency tolerance. A consequence of this difference is that the usual strategy of writing multiple bytes into the TX FIFO after checking THRE once is unsafe. In the worst case of 7 bytes in the FIFO, writing 8 bytes loses all but the first since by then the FIFO is full. There is an HFIFO ("Hidden FIFO") capability that causes the transmit loop to terminate when both THRE and TEMT are set, i.e. when the TX block is completely idle. This is unnecessarily cautious, potentially causing gaps in transmission. Add a new conditional to the transmit loop, predicated on CAP_MINI, that exits when THRE is no longer set (the FIFO is full). This allows the FIFO to fill quickly but subsequent writes are paced by the transmission rate. Signed-off-by: Phil Elwell <phil@raspberrypi.org> Acked-by: Eric Anholt <eric@anholt.net> Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-20gpio-exar/8250-exar: Fix passing in of parent PCI deviceJan Kiszka1-1/+2
This fixes reloading of the GPIO driver for the same platform device instance as created by the exar UART driver: First of all, the driver sets drvdata to its own value during probing and does not restore the original value on exit. But this won't help anyway as the core clears drvdata after the driver left. Set the platform device parent instead. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2017-06-20tty/serial: meson_uart: update to stable bindingsHelmut Klein1-6/+84
This patch handle the stable UART bindings but also keeps compatibility with the legacy non-stable bindings until all boards uses them. Reviewed-by: Jerome Brunet <jbrunet@baylibre.com> Signed-off-by: Helmut Klein <hgkr.klein@gmail.com> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-20serial: Delete dead code for CIR serial portsMatthias Brugger1-17/+6
Commit e4fda3a04275 ("serial: don't register CIR serial ports") adds a check for PORT_8250_CIR to serial8250_register_8250_port(). But the code isn't needed as the function never takes the branch when the port is CIR serial port. This patch deletes the dead code. Signed-off-by: Matthias Brugger <mbrugger@suse.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-20serial: sirf: make of_device_ids constArvind Yadav1-1/+1
of_device_ids are not supposed to change at runtime. All functions working with of_device_ids provided by <linux/of.h> work with const of_device_ids. So mark the non-const structs as const. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-20serial/mpsc: switch to dma_alloc_attrsChristoph Hellwig1-4/+6
Use dma_alloc_attrs directly instead of the dma_alloc_noncoherent wrapper. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-20tty: serial: Add Actions Semi Owl UART earlyconAndreas Färber3-0/+155
This implements an earlycon for Actions Semi S500/S900 SoCs. Based on LeMaker linux-actions tree. Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-14tty/serial: atmel: make the driver DT onlyAlexandre Belloni1-63/+33
Now that AVR32 is gone, platform_data are not used to initialize the driver anymore, remove that path from the driver. Also remove the now unused struct atmel_uart_data. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Acked-by: Richard Genoud <richard.genoud@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-14tty/serial: atmel: remove atmel_default_console_device handlingAlexandre Belloni1-43/+0
atmel_default_console_device was only used by AVR32, in particular arch/avr32/mach-at32ap/at32ap700x.c which is now gone. Remove it from the driver. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Acked-by: Richard Genoud <richard.genoud@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-13serial: rate limit custom-speed deprecation noticeJohan Hovold1-3/+2
Contrary to what a comment claimed, the ASYNC_SPD flags and custom divisor can be set by a non-privileged user so rate limit the deprecation notice as was intended. Signed-off-by: Johan Hovold <johan@kernel.org> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Reviewed-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-09serial: exar: Leave MPIOs as output for Commtech adaptersJan Kiszka1-4/+11
Commtech adapters apparently need the original setting as outputs, see https://marc.info/?l=linux-gpio&m=149557425201323&w=2. Account for that. Fixes: 7dea8165f1d6 ("serial: exar: Preconfigure xr17v35x MPIOs as output") Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-09tty/serial: atmel: Remove AVR32 bits from the driverAndy Shevchenko2-27/+9
AVR32 is gone. Now it's time to clean up the driver by removing leftovers that was used by AVR32 related code. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Richard Genoud <richard.genoud@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-03serial: uartps: Fix kernel doc warningsNava kishore Manne1-0/+1
This patch fixes the kernel doc warnings in the driver. Signed-off-by: Nava kishore Manne <navam@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-03serial: 8250_of: Add reset supportJoel Stanley1-0/+10
This adds the hooks for an optional reset controller in the 8250 device tree node. Signed-off-by: Joel Stanley <joel@jms.id.au> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-03Fix serial console on SNI RM400 machinesThomas Bogendoerfer1-5/+10
sccnxp driver doesn't get the correct uart clock rate, if CONFIG_HAVE_CLOCK is disabled. Correct usage of clk API to make it work with/without it. Fixes: 90efa75f7ab0 (serial: sccnxp: Using CLK API for getting UART clock) Suggested-by: Russell King - ARM Linux <linux@armlinux.org.uk> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-29Merge 4.12-rc3 into tty-nextGreg Kroah-Hartman7-19/+37
We need the tty fixes/changes here to handle future work. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-25serial: altera_uart: call iounmap() at driver removeTobias Klauser1-0/+1
The driver calls ioremap() in the probe function but doesn't call iounmap() in the remove function correspondingly. Do so now. Follow commit 5c9d6abed9e0 ("serial: altera_jtaguart: adding iounmap()") Cc: Alexey Khoroshilov <khoroshilov@ispras.ru> Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-25serial: imx: ensure UCR3 and UFCR are setup correctlyUwe Kleine-König1-2/+12
Commit e61c38d85b73 ("serial: imx: setup DCEDTE early and ensure DCD and RI irqs to be off") has a flaw: While UCR3 and UFCR were modified using read-modify-write before it switched to write register values independent of the previous state. That's a good idea in principle (and that's why I did it) but needs more care. This patch reinstates read-modify-write for UFCR and for UCR3 ensures that RXDMUXSEL and ADNIMP are set for post imx1. Fixes: e61c38d85b73 ("serial: imx: setup DCEDTE early and ensure DCD and RI irqs to be off") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by: Mika Penttilä <mika.penttila@nextfour.com> Tested-by: Mika Penttilä <mika.penttila@nextfour.com> Acked-by: Steve Twiss <stwiss.opensource@diasemi.com> Tested-by: Steve Twiss <stwiss.opensource@diasemi.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-24serial: 8250: Add CAP_MINI, set for bcm2835auxPhil Elwell3-1/+10
The AUX/mini-UART in the BCM2835 family of procesors is a cut-down 8250 clone. In particular it is lacking support for the following features: CSTOPB PARENB PARODD CMSPAR CS5 CS6 Add a new capability (UART_CAP_MINI) that exposes the restrictions to the user of the termios API by turning off the unsupported features in the request. N.B. It is almost possible to automatically discover the missing features by reading back the LCR register, but the CSIZE bits don't cooperate (contrary to the documentation, both bits are significant, but CS5 and CS6 are mapped to CS7) and the code is much longer. See: https://github.com/raspberrypi/linux/issues/1561 Signed-off-by: Phil Elwell <phil@raspberrypi.org> Acked-by: Eric Anholt <eric@anholt.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-24serial: sh-sci: Update warning message in sci_request_dma_chan()Geert Uytterhoeven1-2/+1
The commit below changed a function call from dma_request_slave_channel_compat() to dma_request_slave_channel(), but forgot to update the printed failure message. Fixes: 219fb0c1436e4893 ("serial: sh-sci: Remove the platform data dma slave rx/tx channel IDs") Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-24serial: meson: hide an unused functionArnd Bergmann1-9/+8
The newly added meson_uart_enable_tx_engine function is only called from the console setup, not the runtime uart, which has an open-coded version of the same register access. This produces a harmless warning when the console code is disabled: drivers/tty/serial/meson_uart.c:127:13: error: 'meson_uart_enable_tx_engine' defined but not used [-Werror=unused-function] Let's move the function inside of the #ifdef to avoid the warning. Fixes: ba50f1df13c8 ("serial: meson: remove unneeded variable assignment in meson_serial_port_write") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-18serial: enable serdev supportJohan Hovold1-2/+2
Enable serdev support by using the new device-registration helpers. Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-18serial: core: fix crash in uart_suspend_portLucas Stach1-1/+1
With serdev we might end up with serial ports that have no cdev exported to userspace, as they are used as the bus interface to other devices. In that case serial_match_port() won't be able to find a matching tty_dev. Skip the irq wakeup enabling in that case, as serdev will make sure to keep the port active, as long as there are devices depending on it. Fixes: 8ee3fde04758 (tty_port: register tty ports with serdev bus) Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-18serial: ifx6x60: fix use-after-free on module unloadJohan Hovold1-1/+1
Make sure to deregister the SPI driver before releasing the tty driver to avoid use-after-free in the SPI remove callback where the tty devices are deregistered. Fixes: 72d4724ea54c ("serial: ifx6x60: Add modem power off function in the platform reboot process") Cc: stable <stable@vger.kernel.org> # 3.8 Cc: Jun Chen <jun.d.chen@intel.com> Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-18serial: altera_jtaguart: adding iounmap()Alexey Khoroshilov1-0/+1
The driver does ioremap(port->mapbase, ALTERA_JTAGUART_SIZE), but there is no any iounmap(). Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru> Acked-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-18serial: exar: Fix stuck MSIsJan Kiszka1-9/+10
After migrating 8250_exar to MSI in 172c33cb61da, we can get stuck without further interrupts because of the special wake-up event these chips send. They are only cleared by reading INT0. As we fail to do so during startup and shutdown, we can leave the interrupt line asserted, which is fatal with edge-triggered MSIs. Add the required reading of INT0 to startup and shutdown. Also account for the fact that a pending wake-up interrupt means we have to return 1 from exar_handle_irq. Drop the unneeded reading of INT1..3 along with this - those never reset anything. An alternative approach would have been disabling the wake-up interrupt. Unfortunately, this feature (REGB[17] = 1) is not available on the XR17D15X. Fixes: 172c33cb61da ("serial: exar: Enable MSI support") Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-18serial: efm32: Fix parity management in 'efm32_uart_console_get_options()'Christophe JAILLET1-3/+8
UARTn_FRAME_PARITY_ODD is 0x0300 UARTn_FRAME_PARITY_EVEN is 0x0200 So if the UART is configured for EVEN parity, it would be reported as ODD. Fix it by correctly testing if the 2 bits are set. Fixes: 3afbd89c9639 ("serial/efm32: add new driver") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-18drivers/tty: 8250: only call fintek_8250_probe when doing port I/OArd Biesheuvel1-1/+1
Commit fa01e2ca9f53 ("serial: 8250: Integrate Fintek into 8250_base") modified the probing logic for PNP0501 devices, to remove a collision between the generic 16550A driver and the Fintek driver, which reused the same ACPI _HID. The Fintek device probe is now incorporated into the common 8250 probe path, and gets called for all discovered 16550A compatible devices, including ones that are MMIO mapped rather than IO mapped. However, the Fintek driver assumes the port base is a I/O address, and proceeds to probe some arbitrary offsets above it. This is generally a wrong thing to do, but on ARM systems (having no native port I/O), this may result in faulting accesses of completely unrelated MMIO regions in the PCI I/O space. Given that this is at serial probe time, this results in hard to diagnose crashes at boot. So let's restrict the Fintek probe to devices that we know are using port I/O in the first place. Fixes: fa01e2ca9f53 ("serial: 8250: Integrate Fintek into 8250_base") Suggested-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Ricardo Ribalda <ricardo.ribalda@gmail.com> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>