summaryrefslogtreecommitdiff
path: root/drivers/tty/serial
AgeCommit message (Collapse)Author
2015-10-04tty: serial: of_serial: Fix module autoload for OF platform driverLuis de Bethencourt
This platform driver has a OF device ID table but the OF module alias information is not created so module autoloading won't work. Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04tty: serial: apbuart: Fix module autoload for OF platform driverLuis de Bethencourt
This platform driver has a OF device ID table but the OF module alias information is not created so module autoloading won't work. Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: 8250: simplify ralink/alchemy register remap selectionMans Rullgard
Some SoCs, including Ralink/Mediatek and Alchemy Au1xxx, have a 16550-like UART with a non-standard register layout. These are supported by a simple mapping table in 8250_port.c Rather than list every SoC type using this access mode in the ifdefs there, allow selecting the SERIAL_8250_RT288X Kconfig option with any system and default it to y for the known cases needing it. The help text is reworded accordingly. This change simplifies adding support for other SoCs also using the same UART. The name of the option is a little misleading, but not knowing the true origin of this UART, it is as good a choice as any. Signed-off-by: Mans Rullgard <mans@mansr.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: atmel: fix error path of probe functionUwe Kleine-König
If atmel_init_gpios fails the port has already been marked as busy (in line 2629), so this must be undone in the error path. This bug was introduced because I created the patch that finally became 722ccf416ac2 ("serial: atmel: fix error handling when mctrl_gpio_init fails") on top of 3.19 which didn't have commit 6fbb9bdf0f3f ("tty/serial: at91: fix error handling in atmel_serial_probe()") yet. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Fixes: 722ccf416ac2 ("serial: atmel: fix error handling when mctrl_gpio_init fails") Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04Revert "serial: imx: remove unbalanced clk_prepare"Fabio Estevam
This reverts commit 9e7b399d6528eac33a6fbfceb2b92af209c3454d. Commit ("9e7b399d6528ea") causes the following warning and sometimes also hangs the system: ------------[ cut here ]------------ WARNING: CPU: 0 PID: 0 at kernel/locking/mutex.c:868 mutex_trylock+0x20c/0x22c() DEBUG_LOCKS_WARN_ON(in_interrupt()) Modules linked in: CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.2.0-rc7-next-20150818-00001-g14418a6 #4 Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree) Backtrace: [<80012f08>] (dump_backtrace) from [<800130a4>] (show_stack+0x18/0x1c) r6:00000364 r5:00000000 r4:00000000 r3:00000000 [<8001308c>] (show_stack) from [<807902b8>] (dump_stack+0x88/0xa4) [<80790230>] (dump_stack) from [<8002a604>] (warn_slowpath_common+0x80/0xbc) r5:807945c4 r4:80ab3b50 [<8002a584>] (warn_slowpath_common) from [<8002a6e4>] (warn_slowpath_fmt+0x38/0x40) r8:00000000 r7:8131100c r6:8054c3cc r5:8131300c r4:80b0a570 [<8002a6b0>] (warn_slowpath_fmt) from [<807945c4>] (mutex_trylock+0x20c/0x22c) r3:8095d0d8 r2:8095ab28 [<807943b8>] (mutex_trylock) from [<8054c3cc>] (clk_prepare_lock+0x14/0xf4) r7:8131100c r6:be3f0c80 r5:00000037 r4:be3f0c80 [<8054c3b8>] (clk_prepare_lock) from [<8054dbfc>] (clk_prepare+0x18/0x30) r5:00000037 r4:be3f0c80 [<8054dbe4>] (clk_prepare) from [<8036a600>] (imx_console_write+0x30/0x244) r4:812d0bc8 r3:8132b9a4 To reproduce the problem we only need to let the board idle for something like 30 seconds. Tested on a imx6q-sabresd. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Reviewed-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: mctrl_gpio: implement interrupt handlingUwe Kleine-König
This allows to reduce the per-driver boiler plate considerably. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: mctrl-gpio: rename init functionUwe Kleine-König
This is done before adding more functionality to the init function with the existing name. As this new functionality conflicts with stuff drivers are required to implement themselves up to I want to convert them one by one to make reviewing and reverting more easy in case I broke something. Once mctrl_gpio_init is there and all drivers are converted mctrl_gpio_init_noauto can be removed again. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: mxs-auart+imx: allow compile testing on non-Freescale architecturesUwe Kleine-König
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: atmel: allow compile testing on non-atmel architecturesUwe Kleine-König
This commit also fixes compiler warnings and errors seen when building on x86_64. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: imx: also update RX stats in DMA pathLucas Stach
The RX bytecount was only updated in the PIO path and thus the device erroneously reported a value of 0 if DMA is in use. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Acked-by: Jiada Wang <jiada_wang@mentor.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: imx: re-enable DMA support without hardware flow controlLucas Stach
The commit enabling DMA support even if no flow control is present was reverted on the grounds that it uncovered a number of bugs in the code that lead to hanging tty devices and/or missing characters. After tracking down the issues it is clear that those were generic bugs and had nothing to do with flow control being present or not, only that allowing DMA without hardware flow control increased the exposure of that code a lot. Now that those bugs are fixed, it should be safe to re-enable DMA support. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Acked-by: Jiada Wang <jiada_wang@mentor.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: imx: don't use idle condition detect for DMA transfersLucas Stach
The reference manual states that idle condition detect should not be used with DMA transfers, as the ROM SDMA scripts don't check those conditions. The RAM SDMA scripts worked around this, but the change broke compatibility with the ROM scripts. The previous commits fixed the DMA burst sizes, so that the aging timer is now working as described in the reference manual. With this fixed we can remove the hack of using the idle condition detect to stop the DMA transfer if there are no new characters incoming. This should work with both the ROM and RAM SDMA scripts. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Acked-by: Jiada Wang <jiada_wang@mentor.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: imx: configure proper DMA burst sizesLucas Stach
Triggering the DMA engine for every byte is horribly inefficient. Also it doesn't allow to use the aging timer for the RX FIFO as this requires the DMA engine to leave one byte remaining in the FIFO when doing a normal burst transfer. Adjust watermark levels so that the DMA engine can do at least 8 byte burst transfers. This is a conservative value, as the both TX and RX FIFOs are able to contain 32 bytes. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Acked-by: Jiada Wang <jiada_wang@mentor.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: imx: always restart DMA if more data is availableLucas Stach
Simplify the DMA restart logic to always queue up the next transfer immediately if there is at least one more byte available in the FIFO, so that the transfer will finish in a limited time. This way the driver stops to rely on zero length transfers to signal transfers ends. Those will go away when the idle detect DMA requests are disabled. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Acked-by: Jiada Wang <jiada_wang@mentor.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: imx: set up aging timer interrupt as DMA triggerLucas Stach
The DMA transfer is only started once we are sure it will finish in a limited time, i.e. only after we received a RRDY interrupt. In order to allow the watermark level to be raised the aging timer and the corresponding interrupt need to be set up as an additional trigger, so that the transfer is also started if the incoming amount of bytes never reach the watermark. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Acked-by: Jiada Wang <jiada_wang@mentor.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: imx: make setup_ufcr more usefulLucas Stach
This function currently doesn't use its parameter. Change prototype to pass in watermark levels, so we can reuse this function in the DMA setup paths. Also relocate to be near the calling functions. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Acked-by: Jiada Wang <jiada_wang@mentor.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: 8250_dw: don't set UPF_BOOT_AUTOCONF flagHeikki Krogerus
serial8250_register_8250_port adds it to all ports it registers. No need to set it separately. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: 8250_dw: cleanup dw8250_setup_portHeikki Krogerus
Using the same style of declaring variables as used in the other functions of the driver. Passing uart_port to the function instead of uart_8250_port, as it is the one mostly needed. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: 8250_dw: cleanup dw8250_idma_filterHeikki Krogerus
Remove the extra return. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: 8250_dw: rename and comment the fallback dma filterHeikki Krogerus
Adding comment where the purpose of the function is explained. The dma parameters are not used, so removing them, and also moving the assignment of the function to the same place where the other dw8250_data structures members are being set in dw8250_probe. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: 8250_dw: proper support for UARTs without busy functionalityHeikki Krogerus
If the DW_apb_uart is configured with UART_16550_COMPATIBLE configuration parameter set, then the Busy Functionality is not available. These UARTs will never generate the Busy detect indication interrupt, and therefore don't need handling for it. This creates a small optimization for the DW_apb_uarts configured without the busy functionality, but more importantly, it removes the small but real risk of hitting potential issues caused by busy functionality handling when no busy functionality exist. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: 8250_dw: add dw8250_quirks functionHeikki Krogerus
Merging the DT and ACPI specific probe functions into dw8250_quirks. Those functions did not have that much code any more and some of the quirks need to be shared. This will also allow platforms without DT or ACPI to use the driver. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: 8250_dw: only setup the port from one placeHeikki Krogerus
This adds a flag "skip_autocfg" that the platforms that do not have the ADDITIONAL_FEATURES implemented can use to skip the port setup. It's then enough to call dw8250_setup_port just from dw8250_probe based on that flag. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: 8250_dw: hook the DMA in one placeHeikki Krogerus
Instead of assigning the dma member in dw8250_probe_of and dw8250_probe_acpi separately, assigning it in dw8250_probe. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: 8250_dw: adapt to unified device property interfaceHeikki Krogerus
This makes the properties available for all types of platforms instead of just the ones using DT. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: 8250_dw: add separate pointer for the uart_port to dw8250_probeHeikki Krogerus
For convenience, adding separate pointer for the "port" member of struct uart_8250_port that is being filled in the probe function. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: 8250: Add OF earlycon supportScott Wood
This allows earlycon to be used without needing to specify the I/O address on the kernel command line, if linux,stdout-path is specified in the chosen node. Signed-off-by: Scott Wood <scottwood@freescale.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: imx: add earlycon supportLucas Stach
Earlycon allows to have an early debugging console that doesn't need to be statically configured in the kernel config, like earlyprintk, but is set up through the stdout-path DT property. This allows to have the early debugging always built into the kernel and enabled on demand without clashing between different boards or architectures. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04tty/serial: at91: move ATMEL_MAX_UARTAlexandre Belloni
Move ATMEL_MAX_UART from platform_data/atmel.h to atmel_serial.c as this is the only file using it and it is common practise from tty/serial drivers to define it directly in the driver file. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: of-serial: compile correctly when 8250 driver is compiled as moduleMartin Sperl
If the 8250 driver is compiled as a module then CONFIG_SERIAL_8250_MODULE is defined and not CONFIG_SERIAL_8250. This results in all those code sections that require CONFIG_SERIAL_8250 to be defined are not included. This patch fixes the situation and allows 8250 and of-serial to be compiled as a module with the same functionality as when compiled into the kernel. Signed-off-by: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: altera_uart: Use of_property_read_u32 instead of open-coding itTobias Klauser
Use of_property_read_u32 instead of of_get_property with return value checks and endianness conversion. Also remove the !CONFIG_OF implementation of altera_uart_get_of_uartclk as of_property_read_u32 will return a non-zero value for !CONFIG_OF. Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: 8250_ingenic: Enable FIFO for Ingenic UARTsMatt Redfearn
Enable the TX/RX FIFOs present on UARTs in Ingenic SoCs. FIFO sizes vary per device so match these based on the OF compatible string Enabling the FIFOs permits much faster transfer with lower CPU overhead. Tested on Ingenic JZ4780 on the MIPS Ci20 Creator board Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: 8250_ingenic: Enable hardware flow controlMatt Redfearn
The Ingenic UART is similar to a standard 16550, but hardware flow control requires setting a couple of additional, non-standard bits in the MCR. The non-standard "modem control enable" and "hardware flow control mode" bits are set when writing to the MCR register, based on whether the modem control interrupt is active. Additionally the non-16550 compliant parts of the uart need to be masked from higher layers. Tested on Ingenic JZ4780 on MIPS Creator Ci20 board Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: sc16is7xx: Remove unnecessary MODULE_ALIAS()Javier Martinez Canillas
The driver has a I2C device id table that is used to create the modaliases and also "sc16is7xx" is not a supported I2C id, so it's never used. Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: mux: Convert to uart_console_device instead of open-codedAxel Lin
The implementation of mux_console_device() is very similar to uart_console_device(). Setting .data field in mux_console then we can convert to use uart_console_device(). Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: 68328serial: Use NULL for pointersFabio Estevam
Compare pointer-typed values to NULL rather than 0 The semantic patch that makes this change is available in scripts/coccinelle/null/badzero.cocci. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: samsung: Fix UART status handling in DMA modeRobert Baldyga
So far, when interrupt occured in DMA mode, it was handled by terminating DMA transfer and draining data remaining in RX FIFO. It worked well until interrupt was caused by timeout, but the same interrupt can be alse caused by special condition (eg. 'break'), which requires special handling. In such case handling mechanism was the same - DMA transaction was terminated and FIFO was drained, but any special conditions were ingnored. Because of this in DMA mode there was no ability to use, for example, Magic SysRq. This patch fixes this problem by using s3c24xx_serial_rx_drain_fifo() function instead of uart_rx_drain_fifo(), which does the same thing (drains RX FIFO) plus checks UART status to detect special conditions (such as 'break'). Thanks to this we have exactly the same UART status handling in both DMA and PIO mode. This change additionally simplifies RX handling code, as we no longer need uart_rx_drain_fifo() function, so we can remove it. Reported-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Robert Baldyga <r.baldyga@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: samsung: introduce s3c24xx_serial_rx_drain_fifo() functionRobert Baldyga
This patch introduces s3c24xx_serial_rx_drain_fifo() which reads data from RX FIFO and writes it to tty buffer. It also checks for special conditions (such as 'break') and handles it. This function has been separated from s3c24xx_serial_rx_chars_pio() as it contains code which can be used also in DMA mode. Signed-off-by: Robert Baldyga <r.baldyga@samsung.com> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: samsung: remove unneded 'ignore_char' labelRobert Baldyga
This label does nothing special and we don't need to have it anymore. Signed-off-by: Robert Baldyga <r.baldyga@samsung.com> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: samsung: remove unused 'irq' parameterRobert Baldyga
This parameter is not used anywhere, so we can get rid of it. Signed-off-by: Robert Baldyga <r.baldyga@samsung.com> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: sh-sci: Add DT support to DMA setupGeert Uytterhoeven
Add support for obtaining DMA channel information from the device tree. This requires switching from the legacy sh_dmae_slave structures with hardcoded channel numbers and the corresponding filter function to: 1. dma_request_slave_channel_compat(), - On legacy platforms, dma_request_slave_channel_compat() uses the passed DMA channel numbers that originate from platform device data, - On DT-based platforms, dma_request_slave_channel_compat() will retrieve the information from DT. 2. and the generic dmaengine_slave_config() configuration method, which requires filling in DMA register ports and slave bus widths. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: sh-sci: Pause DMA engine and get DMA status againMuhammad Hamza Farooq
Occasionally, DMA transaction completes _after_ DMA engine is stopped. Verify if the transaction has not finished before forcing the engine to stop and push the data Signed-off-by: Muhammad Hamza Farooq <mfarooq@visteon.com> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: sh-sci: Do not terminate DMA engine when race condition occursMuhammad Hamza Farooq
When DMA packet completion and timer expiry take place at the same time, do not terminate the DMA engine, leading by submission of new descriptors, as the DMA communication hasn't necessarily stopped here. Signed-off-by: Muhammad Hamza Farooq <mfarooq@visteon.com> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: sh-sci: Call dma_async_issue_pending when transaction completesMuhammad Hamza Farooq
dmaengine_submit() will not start the DMA operation, it merely adds it to the pending queue. If the queue is no longer running, it won't be restarted until dma_async_issue_pending() is called. Signed-off-by: Muhammad Hamza Farooq <mfarooq@visteon.com> [geert: Add more description] Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: sh-sci: Redirect port interrupts to CPU _only_ when DMA stopsMuhammad Hamza Farooq
Since the DMA engine is not stopped everytime rx_timer_fn is called, the interrupts have to be redirected back to CPU only when incomplete DMA transaction is handled Signed-off-by: Muhammad Hamza Farooq <mfarooq@visteon.com> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: sh-sci: Remove timer on shutdown of portAleksandar Mitev
This prevents DMA timer timeout that can trigger after the port has been closed. Signed-off-by: Aleksandar Mitev <amitev@visteon.com> [geert: Move del_timer_sync() outside spinlock to avoid circular locking dependency between rx_timer_fn() and del_timer_sync()] Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: sh-sci: Stop calling sci_start_rx() from sci_request_dma()Geert Uytterhoeven
There's no need to call sci_start_rx() from sci_request_dma() when DMA setup fails, as sci_startup() will call sci_start_rx() anyway. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: sh-sci: Submit RX DMA from RX interrupt on (H)SCIFGeert Uytterhoeven
For DMA receive requests, the driver is only notified by DMA completion after the whole DMA request has been transferred. If less data is received, it will stay stuck until more data arrives. The driver handles this by setting up a timer handler from the receive interrupt, after reception of the first character. Unlike SCIFA and SCIFB, SCIF and HSCIF don't issue receive interrupts on reception of individual characters if a receive DMA request is in progress, so the timer is never set up. To fix receive DMA on SCIF and HSCIF, submit the receive DMA request from the receive interrupt handler instead. In some sense this is similar to the SCIFA/SCIFB behavior, where the RDRQE (Rx Data Transfer Request Enable) bit is also set from the receive interrupt handler. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: sh-sci: Get rid of the workqueue to handle receive DMA requestsGeert Uytterhoeven
The receive DMA workqueue function work_fn_rx() handles two things: 1. Reception of a full buffer on completion of a receive DMA request, 2. Reception of a partial buffer on receive DMA time-out. The workqueue is kicked by both the receive DMA completion handler, and by a timer to handle DMA time-out. As there are always two receive DMA requests active, it's possible that the receive DMA completion handler is called a second time before the workqueue function runs. As the time-out handler re-enables the receive interrupt, an interrupt may come in before time-out has been fully handled. Move part 1 into the receive DMA completion handler, and move part 2 into the receive DMA time-out handler, to fix these race conditions. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: sh-sci: Shuffle functions aroundGeert Uytterhoeven
This allows to: - Remove forward declarations of static functions, - Coalesce two sections protected by #ifdef CONFIG_SERIAL_SH_SCI_DMA, - Avoid shuffling functions around in the near future, - Avoid adding forward declarations in the near future. No functional changes. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>