aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial (follow)
AgeCommit message (Collapse)AuthorFilesLines
2016-07-27sparc: serial: sunhv: fix a double lock bugDan Carpenter1-6/+0
We accidentally take the "port->lock" twice in a row. This old code was supposed to be deleted. Fixes: e58e241c1788 ('sparc: serial: Clean up the locking for -rt') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2016-06-26tty/serial: atmel: enforce tasklet init and termination sequencesNicolas Ferre1-23/+38
As some race conditions are identified in the termination process of tasklets, enforce the atmel_shutdown() sequence. This way we make sure that no new tasklets or software timer are scheduled during shutdown process. An atomic flag is positioned to give this information throughout the code. We also remove tasklet_disable() calls that were leading to deadlocks while stopping the driver. A simpler init/kill sequence is used. Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-26serial: sh-sci: Stop transfers in sci_shutdown()Geert Uytterhoeven1-0/+4
Make sure the transmitter and receiver are stopped when shutting down the port, and related interrupts are disabled. Without this: - New input data may be received into the RX FIFO, possibly triggering a new RX DMA completion, - Transfers will still be enabled on a subsequent startup of the UART, before the UART's FIFOs have been reset, causing reading of stale data. Inspired by a patch in the BSP by Koji Matsuoka <koji.matsuoka.xm@renesas.com>. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25serial: 8250_ingenic: drop #if conditional surrounding earlycon codeMasahiro Yamada2-3/+1
The #if defined(CONFIG_SERIAL_EARLYCON) && !defined(MODULE) conditional has been added to the OF_EARLYCON_DECLARE() define. The same conditional can be dropped from 8250_ingenic.c because the unused symbols will be marked as __maybe_unsed. Also, the Kconfig dependency can become much simpler. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25serial: 8250_mtk: drop !defined(MODULE) conditionalMasahiro Yamada1-1/+1
The !defined(MODULE) conditional has been added to the OF_EARLYCON_DECLARE() define. This commit partially reverts commit 3f5921a60f74 ("serial: 8250/mediatek: fix building with SERIAL_8250=m"). Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Acked-by: Matthias Brugger <matthias.bgg@gmail.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25serial: 8250_uniphier: drop !defined(MODULE) conditionalMasahiro Yamada1-1/+1
The !defined(MODULE) conditional has been added to the OF_EARLYCON_DECLARE() define. Now we can revert commit a2d3ea2f2399 ("serial: 8250/uniphier: fix modular build"). Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25tty/serial/8250: use mctrl_gpio helpersYegor Yefremov5-15/+68
This patch permits the usage for GPIOs to control the CTS/RTS/DTR/DSR/DCD/RI signals. Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25serial: mctrl_gpio: enable API usage only for initialized mctrl_gpios structYegor Yefremov1-0/+18
This workaround is needed for the cases, where mctrl_gpio API is used before mctrl_gpio_init() was invoked. This happens in 8250 during console initialization, as the driver sets DTR signal. Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25serial: mctrl_gpio: add modem control read routineYegor Yefremov2-1/+32
mctrl_gpio_get_outputs() returns the state of following signals: RTS, DTR While defining the routine for reading outputs, fix the comment for mctrl_gpio_get() routine as it returns only the state of the input signals. Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25tty/serial/8250: make UART_MCR register access consistentYegor Yefremov3-26/+35
Introduce serial8250_out_MCR() and serial8250_in_MCR() routines, that replace following calls: serial_out(port, UART_MCR, val) serial_port_out(up, UART_MCR, val) serial_in(port, UART_MCR) This patch is needed in order to integrate reading/writing of MCR signals via SERIAL_MCTRL_GPIO infrastructure later. Reviewed-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25serial: 8250_mid: Read RX buffer on RX DMA timeout for DNVChuah, Kim Tatt1-2/+4
In DNV, when RX DMA is used and number of bytes received is less than transfer size, only RX DMA timeout interrupt is sent. When this happens, read the RX buffer. Signed-off-by: Chuah, Kim Tatt <kim.tatt.chuah@intel.com> Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25serial: 8250_dma: Export serial8250_rx_dma_flush()Chuah, Kim Tatt1-0/+1
Export serial8250_rx_dma_flush() for use by SOC UART drivers. Signed-off-by: Chuah, Kim Tatt <kim.tatt.chuah@intel.com> Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25dmaengine: hsu: Export hsu_dma_get_status()Chuah, Kim Tatt1-5/+17
To allow other code to safely read DMA Channel Status Register (where the register attribute for Channel Error, Descriptor Time Out & Descriptor Done fields are read-clear), export hsu_dma_get_status(). hsu_dma_irq() is renamed to hsu_dma_do_irq() and requires Status Register value to be passed in. Signed-off-by: Chuah, Kim Tatt <kim.tatt.chuah@intel.com> Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25tty: serial: 8250: add CON_CONSDEV to flagsMatthew Leach1-1/+1
When using the 8250 as a boot console and the main console results in messages being printed twice. The console framework will only unregister boot consoles if a new console is registered with the CON_CONSDEV flag set. Set this flag for the univ8250 console to prevent double-registration. Signed-off-by: Matthew Leach <matthew.leach@codethink.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25tty: serial: samsung: add byte-order aware bit functionsMatthew Leach2-9/+35
This driver makes use of the __set_bit() and __clear_bit() functions. When running under big-endian, these functions don't convert the bit indexes when working with peripheral registers, leading to the incorrect bits being set and cleared when running big-endian. Add two new driver functions for setting and clearing bits that are byte-order aware. Signed-off-by: Matthew Leach <matthew@mattleach.net> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25tty: serial: samsung: fixup accessors for endianMatthew Leach1-4/+4
Fix the serial access code to deal with kernels built for big endian operation. Signed-off-by: Matthew Leach <matthew@mattleach.net> Acked-by: Ben Dooks <ben.dooks@codethink.co.uk> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25serial: sirf: make fifo functions staticBen Dooks1-2/+2
The fifo mask functions should be static as they are not used outside of the driver. Fix the following warnings by making them static: drivers/tty/serial/sirfsoc_uart.h:109:5: warning: symbol 'uart_usp_ff_full_mask' was not declared. Should it be static? drivers/tty/serial/sirfsoc_uart.h:117:5: warning: symbol 'uart_usp_ff_empty_mask' was not declared. Should it be static? Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25serial: mps2-uart: make driver explicitly non-modularVladimir Murzin1-25/+4
The Kconfig currently controlling compilation of mps2-uart is: config SERIAL_MPS2_UART bool "MPS2 UART port" depends on ARM || COMPILE_TEST ...meaning that it currently is not being built as a module by anyone. Follow commit 89ebc2742769 ("drivers/tty: make serial/mvebu-uart.c explicitly non-modular") as an example of moving modular code to non-modular: - remove the modular code that is essentially orphaned, so that when reading the driver there is no doubt it is builtin-only. - explicitly disallow a driver unbind, since that doesn't have a sensible use case anyway, and it allows us to drop the ".remove" code for non-modular drivers. - use arch_initcall instead of module_init and remove module_exit. Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code. We also delete the MODULE_LICENSE tag etc. since all that information was (or is now) contained at the top of the file in the comments. Reported-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25serial: mvebu-uart: free the IRQ in ->shutdown()Thomas Petazzoni1-0/+2
As suggested by the serial port infrastructure documentation, the IRQ is requested in ->startup(). However, it is never freed in the ->shutdown() hook. With simple systems that open the serial port once for all and always have at least one process that keep the serial port opened, there was no problem. But with a more complicated system (*cough* systemd *cough*), the serial port is opened/closed many times, which at some point no processes having the serial port open at all. Due to this ->startup() gets called again, tries to request_irq() again, which fails. Fixes: 30530791a7a0 ("serial: mvebu-uart: initial support for Armada-3700 serial port") Cc: <stable@vger.kernel.org> Cc: Ofer Heifetz <oferh@marvell.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25serial/bcm63xx_uart: use correct alias namingJonas Gorski1-2/+6
The bcm63xx_uart driver uses the of alias for determing its id. Recent changes in dts files changed the expected 'uartX' to the recommended 'serialX', breaking serial output. Fix this by checking for a 'serialX' alias as well. Fixes: e3b992d028f8 ("MIPS: BMIPS: Improve BCM6328 device tree") Fixes: 2d52ee82b475 ("MIPS: BMIPS: Improve BCM6368 device tree") Fixes: 7537d273e2f3 ("MIPS: BMIPS: Add device tree example for BCM6358") Signed-off-by: Jonas Gorski <jogo@openwrt.org> Acked-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25serial: m32r_sio: make it explicitly non-modularPaul Gortmaker1-17/+1
The Kconfig currently controlling compilation of this code is: drivers/tty/serial/Kconfig:config SERIAL_M32R_SIO drivers/tty/serial/Kconfig: bool "M32R SIO I/F" ...meaning that it currently is not being built as a module by anyone. Lets remove the modular code that is essentially orphaned, so that when reading the driver there is no doubt it is builtin-only. Since module_init translates to device_initcall in the non-modular case, the init ordering remains unchanged with this commit. We also delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments. We don't replace module.h with init.h since the file already has that. Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Jiri Slaby <jslaby@suse.com> Cc: linux-serial@vger.kernel.org Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25serial: vt8500_serial: make it explicitly non-modularPaul Gortmaker1-28/+2
The Kconfig currently controlling compilation of this code is: drivers/tty/serial/Kconfig:config SERIAL_VT8500 drivers/tty/serial/Kconfig: bool "VIA VT8500 on-chip serial port support" ...meaning that it currently is not being built as a module by anyone. Lets remove the modular code that is essentially orphaned, so that when reading the driver there is no doubt it is builtin-only. We explicitly disallow a driver unbind, since that doesn't have a sensible use case anyway, and it allows us to drop the ".remove" code for non-modular drivers. Since module_init translates to device_initcall in the non-modular case, the init ordering remains unchanged with this commit. We don't replace module.h with init.h since the file already has that. We also delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments. Cc: Tony Prisk <linux@prisktech.co.nz> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Jiri Slaby <jslaby@suse.com> Cc: Alexey Charkov <alchark@gmail.com> Cc: linux-serial@vger.kernel.org Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25serial: pxa: make it explicitly non-modularPaul Gortmaker1-28/+2
The Kconfig currently controlling compilation of this code is: drivers/tty/serial/Kconfig:config SERIAL_PXA drivers/tty/serial/Kconfig: bool "PXA serial port support" ...meaning that it currently is not being built as a module by anyone. Lets remove the modular code that is essentially orphaned, so that when reading the driver there is no doubt it is builtin-only. We explicitly disallow a driver unbind, since that doesn't have a sensible use case anyway, and it allows us to drop the ".remove" code for non-modular drivers. Since module_init translates to device_initcall in the non-modular case, the init ordering remains unchanged with this commit. Also note that MODULE_DEVICE_TABLE and MODULE_ALIAS are both a no-op for non-modular builds. We also delete the MODULE_LICENSE tag since that information is already contained at the top of the file in the comments. Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Jiri Slaby <jslaby@suse.com> Cc: linux-serial@vger.kernel.org Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25serial: 8250_uniphier: add COMPILE_TEST optionMasahiro Yamada1-1/+2
Add COMPILE_TEST for the compilation test coverage. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25serial: max310x: Assign port line automaticallyAlexander Shiyan1-9/+32
This patch makes assignment of port line automatically, so now user allow to use several MAX310X chips. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25serial: max310x: Unregister UARTs on errorAlexander Shiyan1-0/+3
Add uart_remove_one_port() for error path. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25serial: max310x: Remove duplicate bits definitionAlexander Shiyan1-9/+4
Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25serial: max310x: Register UART driver at module_initAlexander Shiyan1-31/+48
This patch moves UART registration at module_init initcall, so this should helps to add multiple chip support in the future. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25serial: max310x: Using resource-managed function for GPIOAlexander Shiyan1-12/+5
Use resource managed functions devm_gpiochip_add_data() to make error & exit path a bit simpler. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25serial: max310x: Fix RS485 handlingAlexander Shiyan1-14/+27
RS485 IOCTLs uses spinlocks, so move regmap functions into a separate work queue. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-258250_pci: Adds support for the WCH CH355 4S cardAlexandr Petrenko1-0/+24
Adds support for the WCH CH355 4S card in the 8250 serial driver. Signed-off-by: Alexandr Petrenko <petrenkoas83@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25serial: samsung: Fix possible out of bounds access on non-DT platformKrzysztof Kozlowski1-2/+2
On non-DeviceTree platforms, the index of serial device is a static variable incremented on each probe. It is incremented even if deferred probe happens when getting the clock in s3c24xx_serial_init_port(). This index is used for referencing elements of statically allocated s3c24xx_serial_ports array. In case of re-probe, the index will point outside of this array leading to memory corruption. Increment the index only on successful probe. Reported-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Fixes: b497549a035c ("[ARM] S3C24XX: Split serial driver into core and per-cpu drivers") Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25serial: samsung: Fix ERR pointer dereference on deferred probeKrzysztof Kozlowski1-5/+13
When the clk_get() of "uart" clock returns EPROBE_DEFER, the next re-probe finishes with success but uses invalid (ERR_PTR) values. This leads to dereferencing of ERR_PTR stored under ourport->clk: 12c30000.serial: Controller clock not found (...) 12c30000.serial: ttySAC3 at MMIO 0x12c30000 (irq = 61, base_baud = 0) is a S3C6400/10 Unable to handle kernel paging request at virtual address fffffdfb (clk_prepare) from [<c039f7d0>] (s3c24xx_serial_pm+0x20/0x128) (s3c24xx_serial_pm) from [<c0395414>] (uart_change_pm+0x38/0x40) (uart_change_pm) from [<c039689c>] (uart_add_one_port+0x31c/0x44c) (uart_add_one_port) from [<c03a035c>] (s3c24xx_serial_probe+0x2a8/0x418) (s3c24xx_serial_probe) from [<c03ee110>] (platform_drv_probe+0x50/0xb0) (platform_drv_probe) from [<c03ecb44>] (driver_probe_device+0x1f4/0x2b0) (driver_probe_device) from [<c03eb0c0>] (bus_for_each_drv+0x44/0x8c) (bus_for_each_drv) from [<c03ec8c8>] (__device_attach+0x9c/0x100) (__device_attach) from [<c03ebf54>] (bus_probe_device+0x84/0x8c) (bus_probe_device) from [<c03ec388>] (deferred_probe_work_func+0x60/0x8c) (deferred_probe_work_func) from [<c012fee4>] (process_one_work+0x120/0x328) (process_one_work) from [<c0130150>] (worker_thread+0x2c/0x4ac) (worker_thread) from [<c0135320>] (kthread+0xd8/0xf4) (kthread) from [<c0107978>] (ret_from_fork+0x14/0x3c) The first unsuccessful clk_get() causes s3c24xx_serial_init_port() to exit with failure but the s3c24xx_uart_port is left half-configured (e.g. port->mapbase is set, clk contains ERR_PTR). On next re-probe, the function s3c24xx_serial_init_port() will exit early with success because of configured port->mapbase and driver will use old values, including the ERR_PTR as clock. Fix this by cleaning the port->mapbase on error path so each re-probe will initialize all of the port settings. Fixes: 60e93575476f ("serial: samsung: enable clock before clearing pending interrupts during init") Cc: <stable@vger.kernel.org> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com> Tested-by: Javier Martinez Canillas <javier@osg.samsung.com> Tested-by: Kevin Hilman <khilman@baylibre.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25serial: 8250_fintek: fix the mismatched IRQ modeJi-Ze Hong (Peter Hong)1-1/+35
Some BIOS only use _OSI("Linux") to distinguish between Linux & Windows. Apply Level/Low to UART trigger mode if Windows, Edge/High mode otherwise. But since 2.6.23 the mainline kernel no longer returns true for _OSI(“Linux”). The default IRQ0~15 trigger mode in Linux is Edge/High mode without ACPI MADT override. It mismatches IRQ mode and makes UART malfunctional on such motherboard. This patch will check the current IRQ mode and apply correct mode to UART. The following link is F81216AD spec PDF: http://html.alldatasheet.com/html-pdf/257956/FINTEK/F81216AD/5569/ 25/F81216AD.html LDN0~3 70h: IRQ channel & Mode register Bit 6~5 : 00 : Active low level mode 01 : Active high edge mode Bit 4 : Sharing Flag (0: not share/1: share) Bit 3~0 : IRQ channel Signed-off-by: Ji-Ze Hong (Peter Hong) <hpeter+linux_kernel@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25serial: pic32_uart: Fix double free of 'sport->irq_fault_name'.Purna Chandra Mandal1-1/+0
Allocated memory for 'sport->irq_fault_name' is freed twice, first in error check of 'if(!sport->irq_rx_name)' and other in fallback handler. Signed-off-by: Purna Chandra Mandal <purna.mandal@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25tty: xuartps: disable clocks when not usedShubhrajyoti Datta1-6/+24
Currently the clocks are enabled at probe and disabled at remove. Instead enable the clocks when used. Signed-off-by: Shubhrajyoti Datta <shubhraj@xilinx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25tty/serial: atmel: fix RS485 half duplex with DMAAlexandre Belloni1-6/+8
When using DMA, half duplex doesn't work properly because rx is not stopped before starting tx. Ensure we call atmel_stop_rx() in the DMA case. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25tty/serial: atmel: add comment for the ring buffer size macroLudovic Desroches1-0/+6
There is a macro named ATMEL_SERIAL_RINGSIZE which suggesting that it corresponds to the real size of the ring buffer. Let warn people that there is a factor of four since allocation size is sizeof(struct atmel_uart_char) * ATMEL_SERIAL_RINGSIZE. Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25tty/serial: atmel: split tx and rx pathsNicolas Ferre1-19/+34
Split TX and RX paths to not schedule RX tasklet on TX events and vice versa. Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25tty/serial: atmel: re-integrate status check in irq handlerNicolas Ferre1-26/+17
The IRQ status check and related actions was done in the tasklet without benefit. So, move it back to the IRQ context to simplify IRQ handling and having the possibility to split the tasklet in two separated ones for receive and transmit actions. Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25serial: serial_core: Perform NULL checks for release/request_port opsFabio Estevam1-4/+4
Doing the following UART bind/unbind sequence on a i.mx platform causes a kernel crash due to NULL pointer dereference: echo 21f4000.serial > /sys/bus/platform/drivers/imx-uart/bind echo 21f4000.serial > /sys/bus/platform/drivers/imx-uart/unbind Fix this problem by adding NULL checks prior to calling release/request_port ops. Reported-by: Fugang Duan <fugang.duan@nxp.com> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Tested-by: Fugang Duan <fugang.duan@nxp.com> Acked-by: Fugang Duan <fugang.duan@nxp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25serial: Make SERIAL_MPS2_UART depend on ARCH_MPS2Geert Uytterhoeven1-1/+1
Enabling support for the UART on the ARM MPS2 platform only make sense when compiling for the ARM MPS2 platform, unless compile-testing. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Vladimir Murzin <vladimir.murzin@arm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25tty: serial: msm: fix definition of msm_stop_dmaBen Dooks1-1/+1
The msm_stop_dma() is not exported from the driver, so make it static to stop the following warning: drivers/tty/serial/msm_serial.c:84:6: warning: symbol 'msm_stop_dma' was not declared. Should it be static? Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> Acked-by: Andy Gross <andy.gross@linaro.org> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org> Reviewed-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25tty: serial: msm: Don't read off end of tx fifoBjorn Andersson1-1/+1
For dm uarts in pio mode tx data is transferred to the fifo register 4 bytes at a time, but care is not taken when these 4 bytes spans the end of the xmit buffer so the loop might read up to 3 bytes past the buffer and then skip the actual data at the beginning of the buffer. Fix this by, analogous to the DMA case, make sure the chunk doesn't wrap the xmit buffer. Fixes: 3a878c430fd6 ("tty: serial: msm: Add TX DMA support") Cc: Ivan Ivanov <iivanov.xz@gmail.com> Cc: stable@vger.kernel.org Reported-by: Frank Rowand <frowand.list@gmail.com> Reported-by: Nicolas Dechesne <nicolas.dechesne@linaro.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Acked-by: Andy Gross <andy.gross@linaro.org> Tested-by: Frank Rowand <frank.rowand@am.sony.com> Reviewed-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25tty:serial:msm:Do not restore Rx interrupts in DMACharanya Venkatraman1-4/+0
Avoid data corruption issues that result in CRC errors during file transfers over serial ports at higher baud rates. The current msm_serial driver masks the FIFO Rx interrupts in msm_start_rx_dma() since Rx FIFO interrupts are not required in DMA mode. However, msm_complete_rx_dma() re-enables the Rx FIFO interrupts which could cause RXSTALE event to be processed when a TXLEV interrupt occurs. The following is the sequence of events that could occur resulting in data corruption. msm_start_rx_dma -> msm_complete_rx_dma --> spin_unlock_irqrestore(&port->lock) --> msm_uart_irq()(For TXLEV interrupt) --> msm_handle_rx_dm() (Read from FIFO resulting in data corruption) The patch fixes the issue by not restoring the RXLEV and RXSTALE interrupts in msm_complete_rx_dma(). These interrupts are required only in FIFO mode. Signed-off-by: Charanya Venkatraman <charanya@codeaurora.org> Acked-by: Andy Gross <andy.gross@linaro.org> Reviewed-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25tty: serial: msm: Cleanup include usageStephen Boyd1-3/+3
The hrtimer include isn't used and neither is serial. Drop those ones. The irq.h header really should be interrupt.h because this is an interrupt user and not an interrupt chip. Finally add wait.h for the wake_up*() usage in this driver and kernel.h for container_of(). Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Acked-by: Andy Gross <andy.gross@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25tty: serial: msm: Only configure MND registers on hw that has itStephen Boyd1-0/+9
The registers that msm_serial_set_mnd_regs() writes only exist on the non-uartdm hardware, so let's return early here if this function is called on uartdm hardware. This also prevents us from messing up the uartclk variable if the uartclk rate happens to be 19.2 or 4.8 MHz. Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Acked-by: Andy Gross <andy.gross@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25tty: serial: msm: Move header file into driverStephen Boyd2-190/+166
This header file is only used by the driver, so let's merge the two together to reduce files and make it easier to see the whole driver without flipping through two files. This also makes it easier to use the structures defined in msm_serial.c in the functions that are defined in msm_serial.h by placing them in the proper locations. Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Acked-by: Andy Gross <andy.gross@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25serial: 8250_early: Add earlycon support for Synopsys DesignWare ABP UARTKefeng Wang1-0/+1
Some board like Hisilicon D02 uses Synopsys DesignWare ABP UART, declare an OF early console for it, so early console device can be enabled with comand line "earlycon"(without option) via the "stdout-path" property in device-tree. Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> Tested-by: Jon Mason <jon.mason@broadcom.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-25serial: sh-sci: Clear (H)SCIF timeout and overrun during resetGeert Uytterhoeven2-0/+6
Add the missing timeout bit definition for (H)SCIF. Clear the timeout and overrun flag bits during UART reset, cfr. the initialization flowchart in the datasheet. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>