aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/imx.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2016-04-30serial: imx: Use generic uart-has-rtscts DT propertyGeert Uytterhoeven1-1/+2
Convert the Freescale IMX UART driver from using the vendor-specific "fsl,uart-has-rtscts" to the generic "uart-has-rtscts" DT property, as documented by the Generic Serial DT Bindings. The old vendor-specific property is still recognized by the driver for backwards compatibility, but deprecated. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-30serial: imx: implement DSR irq handling for DTE modeUwe Kleine-König1-3/+17
Enable reporting of DSR events (which is named DTR in the registers because Freescale uses the names as seem from a DCE). Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-30serial: imx: reorder functions to simplify next patchUwe Kleine-König1-49/+49
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-30serial: imx: only count 0->1 transitions for RNGUwe Kleine-König1-1/+1
According to tty_ioctl(4) (from man-pages 4.04) the rng member only counts 0->1 transitions. For the other signals (DSR, CD, CTS) both edges are supposed to be counted. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-30serial: imx: make sure unhandled irqs are disabledUwe Kleine-König1-1/+22
Make sure that events that are not handled in the irq function don't trigger an interrupt. When the serial port is operated in DTE mode, the events for DCD and RI events are enabled after a system reset by default. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-30serial: imx: let irq handler return IRQ_NONE if no event was handledUwe Kleine-König1-4/+13
This gives the irq core a chance to disable the serial interrupt in case an event isn't cleared in the handler. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-30serial: imx: fix polarity of RIUwe Kleine-König1-3/+3
When in DTE mode, the bit USR2_RIIN is active low. So invert the logic accordingly. Fixes: 90ebc4838666 ("serial: imx: repair and complete handshaking") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-30serial: imx: support RS-485 Rx disable on TxBaruch Siach1-3/+12
Some RS-232 to RS-485 transceivers require Rx to be disabled on Tx to avoid echo of Tx data into the Rx buffer. Specifically, the XR3160E RS-232/RS-485/RS-422 transceiver behaves this way. This commit disables Rx on active Tx when SER_RS485_ENABLED is active and SER_RS485_RX_DURING_TX is disabled. Note that this is a change in behavior of the driver. Until now SER_RS485_RX_DURING_TX was enabled unconditionally even when disabled in the TIOCSRS485 ioctl serial_rs485 flags field. Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-06serial: imx: Fix suspend / resume.Martin Fuzzey1-1/+4
When a non console i.MX UART is enabled in the device tree, system suspend fails due to an unprepared clock: [ 638.794563] PM: Syncing filesystems ... done. [ 638.878902] Freezing user space processes ... (elapsed 0.002 seconds) done. [ 638.888454] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done. [ 638.996697] PM: suspend of devices complete after 97.200 msecs [ 639.002611] PM: suspend devices took 0.100 seconds [ 639.013020] PM: late suspend of devices complete after 2.288 msecs [ 639.021486] ------------[ cut here ]------------ [ 639.026147] WARNING: CPU: 0 PID: 488 at drivers/clk/clk.c:732 clk_core_enable+0xc0/0x12c() [ 639.034413] Modules linked in: [ 639.037490] CPU: 0 PID: 488 Comm: system_server Tainted: G W 4.4.0-rc5-pknbsp-svn2214-atag-v4.4-rc5-121-gebfd9cb #1304 [ 639.049312] Hardware name: Freescale i.MX53 (Device Tree Support) [ 639.055444] [<c0016d54>] (unwind_backtrace) from [<c00140f8>] (show_stack+0x20/0x24) [ 639.063199] [<c00140f8>] (show_stack) from [<c02c99a0>] (dump_stack+0x20/0x28) [ 639.070442] [<c02c99a0>] (dump_stack) from [<c0024ca8>] (warn_slowpath_common+0x88/0xc0) [ 639.078541] [<c0024ca8>] (warn_slowpath_common) from [<c0024d0c>] (warn_slowpath_null+0x2c/0x34) [ 639.087332] [<c0024d0c>] (warn_slowpath_null) from [<c05171e8>] (clk_core_enable+0xc0/0x12c) [ 639.095777] [<c05171e8>] (clk_core_enable) from [<c05172f8>] (clk_enable+0x2c/0x40) [ 639.103441] [<c05172f8>] (clk_enable) from [<c0349880>] (imx_serial_port_suspend_noirq+0x20/0xe0) [ 639.112336] [<c0349880>] (imx_serial_port_suspend_noirq) from [<c03a26a0>] (dpm_run_callback+0x68/0x16c) [ 639.121825] [<c03a26a0>] (dpm_run_callback) from [<c03a2898>] (__device_suspend_noirq+0xf4/0x22c) [ 639.130705] [<c03a2898>] (__device_suspend_noirq) from [<c03a4b0c>] (dpm_suspend_noirq+0x148/0x30c) [ 639.139764] [<c03a4b0c>] (dpm_suspend_noirq) from [<c00511d4>] (suspend_devices_and_enter+0x2e8/0x6a4) [ 639.149078] [<c00511d4>] (suspend_devices_and_enter) from [<c00518a0>] (pm_suspend+0x310/0x4b8) [ 639.157782] [<c00518a0>] (pm_suspend) from [<c00500ec>] (state_store+0x7c/0xcc) [ 639.165099] [<c00500ec>] (state_store) from [<c02cb6dc>] (kobj_attr_store+0x1c/0x28) [ 639.172858] [<c02cb6dc>] (kobj_attr_store) from [<c01633d4>] (sysfs_kf_write+0x54/0x58) [ 639.180871] [<c01633d4>] (sysfs_kf_write) from [<c01629b4>] (kernfs_fop_write+0x100/0x1c8) [ 639.189152] [<c01629b4>] (kernfs_fop_write) from [<c00fb8b8>] (__vfs_write+0x3c/0xe8) [ 639.196991] [<c00fb8b8>] (__vfs_write) from [<c00fc810>] (vfs_write+0xa4/0x160) [ 639.204307] [<c00fc810>] (vfs_write) from [<c00fcac4>] (SyS_write+0x4c/0x98) [ 639.211363] [<c00fcac4>] (SyS_write) from [<c0010760>] (ret_fast_syscall+0x0/0x3c) This does not happen for the common case of a single UART used as a console (since imx_console_setup() already does a prepare) Signed-off-by: Martin Fuzzey <mfuzzey@parkeon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-13serial: imx: implement handshaking using gpios with the mctrl_gpio helperUwe Kleine-König1-20/+69
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-13serial: imx: reorder functions and simplify a bitUwe Kleine-König1-45/+45
Now that imx_mctrl_check is implemented below imx_get_mctrl the former can call the latter directly instead of via sport->port.ops->get_mctrl. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-13serial: imx: repair and complete handshakingUwe Kleine-König1-6/+17
The .get_mctrl callback should not report the status of RTS or LOOP, so drop this. Instead implement reporting the state of CAR (aka DCD) and RI. For .set_mctrl implement setting the DTR line. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-13serial: imx: fix a possible NULL dereferenceLABBE Corentin1-5/+2
of_match_device could return NULL, and so cause a NULL pointer dereference later. Even if the probability of this case is very low, fixing it made static analyzers happy. Solving this with of_device_get_match_data made also code simplier. Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-12Merge 4.3-rc5 into tty-nextGreg Kroah-Hartman1-6/+14
We want the tty fixes and reverts in here as well so that people can properly test and use it. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04Revert "serial: imx: remove unbalanced clk_prepare"Fabio Estevam1-6/+14
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: imx: also update RX stats in DMA pathLucas Stach1-0/+1
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 Stach1-7/+8
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 Stach1-26/+5
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 Stach1-2/+9
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 Stach1-14/+11
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 Stach1-9/+22
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 Stach1-18/+19
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: imx: add earlycon supportLucas Stach1-0/+32
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-08-14serial: imx: save and restore context in the suspend pathEduardo Valentin1-21/+37
This change teaches the imx serial driver to save its context and restore it across suspend and resume path. To do so, it introduces serial_imx_restore_context() and serial_imx_save_context() functions. They use a shadow set of registers to save key registers and restore them accordingly. These functions can be reused on other situations, when the device context is lost. Cc: Fabio Estevam <festevam@gmail.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Jiri Slaby <jslaby@suse.com> Cc: linux-serial@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14serial: imx: allow waking up on RTSDEduardo Valentin1-0/+7
This patch sets RTSDEN bit when going into idle (Stop mode). We add the RTSDEN for the case RTS is sent from the remote connection. This way we allow the system to wakeup when RTS is received. Cc: Fabio Stevam <festevam@gmail.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Jiri Slaby <jslaby@suse.com> Cc: linux-serial@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14serial: imx: introduce serial_imx_enable_wakeup()Eduardo Valentin1-8/+14
This change is a code reorganization. Here we introduce serial_imx_enable_wakeup() helper function to do the job of configuring and preparing wakeup sources on imx serial device. The idea is to allow other parts of the code to call this function whenever the device is known to go to idle. Cc: Fabio Estevam <festevam@gmail.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Jiri Slaby <jslaby@suse.com> Cc: linux-serial@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14serial: imx: remove unbalanced clk_prepareEduardo Valentin1-14/+6
The current code attempts to prepare clk_per and clk_ipg before using the device. However, the result is an extra prepare call on each clock. Here is the output of uart clocks (only uart enabled and used as console): $ grep uart /sys/kernel/debug/clk/clk_summary uart_serial 1 2 80000000 0 0 uart 1 2 66000000 0 0 This patch balances the calls of prepares. The result is: $ grep uart /sys/kernel/debug/clk/clk_summary uart_serial 1 1 80000000 0 0 uart 1 1 66000000 0 0 Cc: Fabio Estevam <festevam@gmail.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Jiri Slaby <jslaby@suse.com> Cc: linux-serial@vger.kernel.org Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-03Serial: imx: add dev_pm_ops to support suspend to ram/diskShenwei Wang1-32/+94
When system goes into low power states like SUSPEND_MEM and HIBERNATION, the hardware IP block may be powered off to reduce the power consumption. This power down may cause problems on some imx platforms, because the hardware settings are reset to its power on default values which may differ from the ones when it power off. This patch added the dev_pm_ops and implemented two callbacks: suspend_noirq and resume_noirq, which will save the necessory hardware parameters right before power down and recover them before system uses the hardware. Because added the dev_pm_ops, the old suspend/resume callbacks under platform_driver will not be called any more. Changed their prototypes and moved those two callbacks into dev_pm_ops too. Signed-off-by: Shenwei Wang <shenwei.wang@freescale.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-07-27Revert "tty: serial: imx.c: Reset UART before activating interrupts"Fabio Estevam1-23/+9
This reverts commit e95044ba4fee93f5ea8a1a24b2d921e148503833. Commit e95044ba4fee93 ("tty: serial: imx.c: Reset UART before activating interrupts") terribly messes up with the console on mx6 boards, so let's revert it. Reported-by: kernelci.org bot <bot@kernelci.org> Cc: David Jander <david@protonic.nl> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-07-27Merge 4.2-rc4 into tty-nextGreg Kroah-Hartman1-8/+7
Other serial driver work wants to build on patches now in 4.2-rc4 so merge the branch so this can properly happen. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-07-23Revert "serial: imx: initialized DMA w/o HW flow enabled"David Jander1-8/+7
This reverts commit 068500e08dc87ea9a453cc4a500cf3ab28d0f936. According to some tests, SDMA support is broken at least for i.MX6 without HW flow control. Different forms of data-corruption appear either with the ROM firmware for the SDMA controller as well as when loading Freescale provided SDMA firmware versions 1.1 or 3.1. Signed-off-by: David Jander <david@protonic.nl> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-07-23tty: serial: imx.c: Reset UART before activating interruptsDavid Jander1-9/+23
If the UART has been in use before this driver was loaded, IRQs might be active and get fired as soon as we set the handler, which will crash in the spin_lock_irqsave(&sport->port.lock, flags) because port.lock is not initialized until the port is added at the end of probe. Signed-off-by: David Jander <david@protonic.nl> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-07-23serial: imx: reduce irq-latency after rx overflowManfred Schlaegl1-1/+0
To prevent problems with interrupt latency, and due to the fact, that the error will be counted anyway (icount.overrun), the dev_err is simply removed. Background: If an rx-fifo overflow occurs a dev_err message was called in interrupt context. Since dev_err messages are written to console in a synchronous way (unbuffered), and console may be a serial terminal, this leads to a highly increased interrupt-latency (several milliseconds). As a result of the high latency more rx-fifo overflows will happen, and therefore a feedback loop of errors is created. Signed-off-by: Manfred Schlaegl <manfred.schlaegl@gmx.at> Acked-By: Alexander Stein <alexander.stein@systec-electronic.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-07-23serial: imx: count tty buffer overrunsManfred Schlaegl1-3/+9
As can be seen in function uart_insert_char (serial_core) the element buf_overrun of struct uart_icount is used to count overruns of tty-buffer. Added support for counting of overruns in imx driver analogue to serial_core. Signed-off-by: Manfred Schlaegl <manfred.schlaegl@gmx.at> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-07-23serial: imx: Disable irqs before requesting themFabio Estevam1-1/+14
Disable interrupts before requesting them in order to fix a kernel oops after lauching a kernel via kexec. Tested on a imx6sl-evk board. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-08Merge 4.1-rc7 into tty-nextGreg Kroah-Hartman1-0/+8
This fixes up a merge issue with the amba-pl011.c driver, and we want the fixes in this branch as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-24serial: imx: Fix DMA handling for IDLE condition abortsPhilipp Zabel1-0/+8
The driver configures the IDLE condition to interrupt the SDMA engine. Since the SDMA UART ROM script doesn't clear the IDLE bit itself, this caused repeated 1-byte DMA transfers, regardless of available data in the RX FIFO. Also, when returning due to the IDLE condition, the UART ROM script already increased its counter, causing residue to be off by one. This patch clears the IDLE condition to avoid repeated 1-byte DMA transfers and decreases count by when the DMA transfer was aborted due to the IDLE condition, fixing serial transfers using DMA on i.MX6Q. Reported-by: Peter Seiderer <ps.report@gmx.net> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Tested-by: Fabio Estevam <fabio.estevam@freescale.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-10serial: imx: Constify platform_device_idKrzysztof Kozlowski1-1/+1
The platform_device_id is not modified by the driver and core uses it as const. Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-06serial: imx: Remove return value from imx_setup_ufcr()Fabio Estevam1-2/+1
The return value from imx_setup_ufcr() is always 0 and its value is never checked, so better to remove the return value. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-06serial: imx: protect Soft Reset of port with lockJiada Wang1-7/+6
Previously Soft Reset (clear of SRST bit in UCR2 register) of UART in startup is not protected by lock, which may have race with console_write, as console_write may occur at anytime even when UART port is shutdown. To avoid this race, protect Soft reset of UART port with spin_lock. Signed-off-by: Jiada Wang <jiada_wang@mentor.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-11serial: imx: Add braces to avoid ambiguous 'else'Fabio Estevam1-3/+3
Commit 17b8f2a3fdca29 ("serial: imx: add support for half duplex rs485") introduced the following build warning: drivers/tty/serial/imx.c: In function 'imx_set_termios': drivers/tty/serial/imx.c:1301:7: warning: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses] Add the suggested braces to avoid the build warning. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-07serial: imx: add support for half duplex rs485Uwe Kleine-König1-12/+95
The transmitter is expected to be controlled by the UART's RTS pin. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-07serial: imx: drop support for IRDAUwe Kleine-König1-148/+9
Support for IRDA was added in 2009 in commit v2.6.31-rc1~399^2~2. There are no in-tree users. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-07serial: imx: fix comment about which machines use the i.MX21 typeUwe Kleine-König1-1/+1
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-07serial: imx: reformat and cleanup copyright headerUwe Kleine-König1-13/+6
Fix indention, remove old address of the FSF, remove in-file changelog, mention Freescale. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-07serial: imx: drop members from driver data that are only used during probeUwe Kleine-König1-10/+11
There is no benefit in keeping this information in RAM when it's not used any more, so better use function local variables instead. These members are unused since c0d1c6b0f0dc ("serial: imx: Fix the reporting of interrupts") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-07serial: imx: remove long dead codeUwe Kleine-König1-9/+0
This if (0) exists since the driver was introduced in commit c49bde83eb6a ([ARM PATCH] 1956/2: Re: Motorola i.MX serial driver) back in 2004. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-07serial: imx: Fix clearing of receiver overrun flagUwe Kleine-König1-5/+3
The writeable bits in the USR2 register are all "write 1 to clear" so only write the bits that actually should be cleared. Fixes: f1f836e4209e ("serial: imx: Add Rx Fifo overrun error message") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-07serial: imx: Do not store/restore the UBRC registerFabio Estevam1-3/+1
UBRC is a read-only register, so we should not store and restore it inside imx_flush_buffer(). Reported-by: Fugang Duan <B38611@freescale.com> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Acked-by: Fugang Duan <B38611@freescale.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-07serial:imx make of_device_id array constSanjeev Sharma1-1/+1
Make of_device_id array const. Signed-off-by: Sanjeev Sharma <Sanjeev_Sharma@mentor.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>