Kartik
109a951a9f
serial: tegra: Read DMA status before terminating
...
Read the DMA status before terminating the DMA, as doing so deletes
the DMA desc.
Also, to get the correct transfer status information, pause the DMA
using dmaengine_pause() before reading the DMA status.
Fixes: e9ea096dd2 ("serial: tegra: add serial driver")
Reviewed-by: Jon Hunter <jonathanh@nvidia.com >
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Acked-by: Thierry Reding <treding@nvidia.com >
Signed-off-by: Akhil R <akhilrajeev@nvidia.com >
Signed-off-by: Kartik <kkartik@nvidia.com >
Link: https://lore.kernel.org/r/1666105086-17326-1-git-send-email-kkartik@nvidia.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2022-11-03 03:43:03 +01:00
Ilpo Järvinen
b7e2647671
serial: tegra: Use uart_xmit_advance()
...
Take advantage of the new uart_xmit_advance() helper.
Reviewed-by: Thierry Reding <treding@nvidia.com >
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Link: https://lore.kernel.org/r/20221019091151.6692-32-ilpo.jarvinen@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2022-11-03 03:35:42 +01:00
Greg Kroah-Hartman
a12c689209
Merge 7e2cd21e02 ("Merge tag 'tty-6.0-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty") into tty-next
...
We need the tty fixes and api additions in this branch.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2022-09-25 09:22:13 +02:00
Ilpo Järvinen
754f68044c
serial: tegra: Use uart_xmit_advance(), fixes icount.tx accounting
...
DMA complete & stop paths did not correctly account Tx'ed characters
into icount.tx. Using uart_xmit_advance() fixes the problem.
Fixes: e9ea096dd2 ("serial: tegra: add serial driver")
Cc: <stable@vger.kernel.org > # serial: Create uart_xmit_advance()
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Link: https://lore.kernel.org/r/20220901143934.8850-3-ilpo.jarvinen@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2022-09-07 16:40:21 +02:00
Ilpo Järvinen
cac8f71941
serial: tegra: Remove custom frame size calculation
...
The number of bits can be calculated using tty_get_frame_size(), no
need for the driver to do it on its own.
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Link: https://lore.kernel.org/r/20220830084925.5608-6-ilpo.jarvinen@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2022-08-30 14:28:33 +02:00
Ilpo Järvinen
bec5b814d4
serial: Make ->set_termios() old ktermios const
...
There should be no reason to adjust old ktermios which is going to get
discarded anyway.
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com >
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com >
Link: https://lore.kernel.org/r/20220816115739.10928-7-ilpo.jarvinen@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2022-08-30 14:22:35 +02:00
Liang He
eb01611056
drivers: tty: serial: Add missing of_node_put() in serial-tegra.c
...
In tegra_uart_init(), of_find_matching_node() will return a node
pointer with refcount incremented. We should use of_node_put()
when it is not used anymore.
Signed-off-by: Liang He <windhl@126.com >
Link: https://lore.kernel.org/r/20220615111747.3963930-1-windhl@126.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2022-06-27 14:36:02 +02:00
Julia Lawall
d93e612d13
serial: tegra: fix typos in comments
...
Spelling mistakes (triple letters) in comments.
Detected with the help of Coccinelle.
Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr >
Link: https://lore.kernel.org/r/20220521111145.81697-23-Julia.Lawall@inria.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2022-06-10 13:32:54 +02:00
Jiri Slaby
988c5bbea5
tty: serial: make use of UART_LCR_WLEN() + tty_get_char_size()
...
Having a generic UART_LCR_WLEN() macro and the tty_get_char_size()
helper, we can remove all those repeated switch-cases in drivers.
Cc: Laxman Dewangan <ldewangan@nvidia.com >
Cc: Thierry Reding <thierry.reding@gmail.com >
Cc: Jonathan Hunter <jonathanh@nvidia.com >
Cc: linux-tegra@vger.kernel.org
Reviewed-by: Thierry Reding <treding@nvidia.com >
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Link: https://lore.kernel.org/r/20220224095558.30929-2-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2022-02-28 21:49:06 +01:00
Patrik John
b40de7469e
serial: tegra: Change lower tolerance baud rate limit for tegra20 and tegra30
...
The current implementation uses 0 as lower limit for the baud rate
tolerance for tegra20 and tegra30 chips which causes isses on UART
initialization as soon as baud rate clock is lower than required even
when within the standard UART tolerance of +/- 4%.
This fix aligns the implementation with the initial commit description
of +/- 4% tolerance for tegra chips other than tegra186 and
tegra194.
Fixes: d781ec21ba ("serial: tegra: report clk rate errors")
Cc: stable <stable@vger.kernel.org >
Signed-off-by: Patrik John <patrik.john@u-blox.com >
Link: https://lore.kernel.org/r/sig.19614244f8.20211123132737.88341-1-patrik.john@u-blox.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-11-25 18:26:32 +01:00
Tang Bin
a6a65f9ee0
serial: tegra: Use of_device_get_match_data
...
Retrieve OF match data, it's better and cleaner to use
'of_device_get_match_data' over 'of_match_device'.
Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com >
Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com >
Link: https://lore.kernel.org/r/20210822032806.3256-3-tangbin@cmss.chinamobile.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-08-26 14:51:10 +02:00
Jon Hunter
cc9ca4d958
serial: tegra: Only print FIFO error message when an error occurs
...
The Tegra serial driver always prints an error message when enabling the
FIFO for devices that have support for checking the FIFO enable status.
Fix this by displaying the error message, only when an error occurs.
Finally, update the error message to make it clear that enabling the
FIFO failed and display the error code.
Fixes: 222dcdff34 ("serial: tegra: check for FIFO mode enabled status")
Cc: <stable@vger.kernel.org >
Acked-by: Thierry Reding <treding@nvidia.com >
Signed-off-by: Jon Hunter <jonathanh@nvidia.com >
Link: https://lore.kernel.org/r/20210630125643.264264-1-jonathanh@nvidia.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-07-21 12:53:00 +02:00
Colin Ian King
3ddb4ce1e6
serial: tegra: Fix a mask operation that is always true
...
Currently the expression lsr | UART_LSR_TEMT is always true and
this seems suspect. I believe the intent was to mask lsr with UART_LSR_TEMT
to check that bit, so the expression should be using the & operator
instead. Fix this.
Fixes: b9c2470fb1 ("serial: tegra: flush the RX fifo on frame error")
Signed-off-by: Colin Ian King <colin.king@canonical.com >
Cc: stable <stable@vger.kernel.org >
Link: https://lore.kernel.org/r/20210426105514.23268-1-colin.king@canonical.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-13 17:07:43 +02:00
Lee Jones
216daa1209
tty: serial: serial-tegra: Provide some missing struct member descriptions
...
Fixes the following W=1 kernel build warning(s):
drivers/tty/serial/serial-tegra.c:94: warning: Function parameter or member 'fifo_mode_enable_status' not described in 'tegra_uart_chip_data'
drivers/tty/serial/serial-tegra.c:94: warning: Function parameter or member 'uart_max_port' not described in 'tegra_uart_chip_data'
drivers/tty/serial/serial-tegra.c:94: warning: Function parameter or member 'max_dma_burst_bytes' not described in 'tegra_uart_chip_data'
drivers/tty/serial/serial-tegra.c:94: warning: Function parameter or member 'error_tolerance_low_range' not described in 'tegra_uart_chip_data'
drivers/tty/serial/serial-tegra.c:94: warning: Function parameter or member 'error_tolerance_high_range' not described in 'tegra_uart_chip_data'
Cc: Laxman Dewangan <ldewangan@nvidia.com >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Jiri Slaby <jirislaby@kernel.org >
Cc: Thierry Reding <thierry.reding@gmail.com >
Cc: Jonathan Hunter <jonathanh@nvidia.com >
Cc: Philipp Zabel <p.zabel@pengutronix.de >
Cc: Sumit Semwal <sumit.semwal@linaro.org >
Cc: "Christian König" <christian.koenig@amd.com >
Cc: linux-serial@vger.kernel.org
Cc: linux-tegra@vger.kernel.org
Cc: linux-media@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: linaro-mm-sig@lists.linaro.org
Signed-off-by: Lee Jones <lee.jones@linaro.org >
Link: https://lore.kernel.org/r/20201104193549.4026187-31-lee.jones@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-11-06 10:54:05 +01:00
Lee Jones
0fd872d716
tty: serial: serial-tegra: Struct headers should start with 'struct <name>'
...
Fixes the following W=1 kernel build warning(s):
drivers/tty/serial/serial-tegra.c:85: warning: cannot understand function prototype: 'struct tegra_uart_chip_data '
Cc: Laxman Dewangan <ldewangan@nvidia.com >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Jiri Slaby <jirislaby@kernel.org >
Cc: Thierry Reding <thierry.reding@gmail.com >
Cc: Jonathan Hunter <jonathanh@nvidia.com >
Cc: Philipp Zabel <p.zabel@pengutronix.de >
Cc: Sumit Semwal <sumit.semwal@linaro.org >
Cc: "Christian König" <christian.koenig@amd.com >
Cc: linux-serial@vger.kernel.org
Cc: linux-tegra@vger.kernel.org
Cc: linux-media@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: linaro-mm-sig@lists.linaro.org
Signed-off-by: Lee Jones <lee.jones@linaro.org >
Link: https://lore.kernel.org/r/20201104193549.4026187-25-lee.jones@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-11-06 10:54:05 +01:00
Gustavo A. R. Silva
df561f6688
treewide: Use fallthrough pseudo-keyword
...
Replace the existing /* fall through */ comments and its variants with
the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
fall-through markings when it is the case.
[1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org >
2020-08-23 17:36:59 -05:00
Greg Kroah-Hartman
dbaab9469b
Merge 5.8-rc7 into tty-next
...
we need the tty/serial fixes in here as well.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-07-27 12:40:56 +02:00
Johan Hovold
707631ce63
serial: tegra: drop bogus NULL tty-port checks
...
The struct tty_port is part of the uart state and will never be NULL in
the receive helpers. Drop the bogus NULL checks and rename the
pointer-variables "port" to differentiate them from struct tty_struct
pointers (which can be NULL).
Fixes: 962963e4ee ("serial: tegra: Switch to using struct tty_port")
Signed-off-by: Johan Hovold <johan@kernel.org >
Acked-by: Thierry Reding <treding@nvidia.com >
Link: https://lore.kernel.org/r/20200710135947.2737-3-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-07-21 20:59:38 +02:00
Johan Hovold
b374c562ee
serial: tegra: fix CREAD handling for PIO
...
Commit 33ae787b74 ("serial: tegra: add support to ignore read") added
support for dropping input in case CREAD isn't set, but for PIO the
ignore_status_mask wasn't checked until after the character had been
put in the receive buffer.
Note that the NULL tty-port test is bogus and will be removed by a
follow-on patch.
Fixes: 33ae787b74 ("serial: tegra: add support to ignore read")
Cc: stable <stable@vger.kernel.org > # 5.4
Cc: Shardar Shariff Md <smohammed@nvidia.com >
Cc: Krishna Yarlagadda <kyarlagadda@nvidia.com >
Signed-off-by: Johan Hovold <johan@kernel.org >
Acked-by: Thierry Reding <treding@nvidia.com >
Link: https://lore.kernel.org/r/20200710135947.2737-2-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-07-21 20:58:25 +02:00
Randolph Maaßen
f1681a9a2a
serial: serial-tegra: reduce irq-latency after rx errors
...
Since dev_err() calls can lead to synchronous writes to another serial
console these calls can provide significant latency during irq-handling
in tegra_uart_isr(). With this latency another interrupt is likely to
apper during handling of the first interrupt, which might lock up the
kernel completely.
These errors are reported to the error counters so converting the
dev_err() to dev_dbg() is appropriate.
Signed-off-by: Randolph Maaßen <gaireg@gaireg.de >
Link: https://lore.kernel.org/r/20200605145714.9964-1-gaireg@gaireg.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-06-27 16:12:45 +02:00
Dmitry Osipenko
1f69a1273b
tty: serial: tegra: Handle RX transfer in PIO mode if DMA wasn't started
...
It is possible to get an instant RX timeout or end-of-transfer interrupt
before RX DMA was started, if transaction is less than 16 bytes. Transfer
should be handled in PIO mode in this case because DMA can't handle it.
This patch brings back the original behaviour of the driver that was
changed by accident by a previous commit, it fixes occasional Bluetooth HW
initialization failures which I started to notice recently.
Fixes: d5e3fadb70 ("tty: serial: tegra: Activate RX DMA transfer by request")
Signed-off-by: Dmitry Osipenko <digetx@gmail.com >
Link: https://lore.kernel.org/r/20200209164415.9632-1-digetx@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-02-10 12:32:13 -08:00
Dmitry Osipenko
5c116fdf56
tty: serial: tegra: Optimize DMA buffer synchronization
...
Synchronize only the dirty part of DMA buffer in order to avoid
unnecessary overhead of syncing of the clean part, which is the case
of every serial DMA transfer in practice.
Signed-off-by: Dmitry Osipenko <digetx@gmail.com >
Link: https://lore.kernel.org/r/20200112180919.5194-3-digetx@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-01-14 14:07:50 +01:00
Dmitry Osipenko
d5e3fadb70
tty: serial: tegra: Activate RX DMA transfer by request
...
This allows DMA engine to go into runtime-suspended mode whenever there is
no data to receive, instead of keeping DMA active all the time while TTY
is opened (i.e. permanently active in practice, like in the case of UART
Bluetooth).
Signed-off-by: Dmitry Osipenko <digetx@gmail.com >
Link: https://lore.kernel.org/r/20200112180919.5194-2-digetx@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-01-14 14:07:50 +01:00
Peter Ujfalusi
84a25d956c
tty: serial: tegra: Use dma_request_chan() directly for channel request
...
dma_request_slave_channel_reason() is:
#define dma_request_slave_channel_reason(dev, name) \
dma_request_chan(dev, name)
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com >
Link: https://lore.kernel.org/r/20191113094618.1725-4-peter.ujfalusi@ti.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-11-13 21:54:16 +08:00
Krishna Yarlagadda
1dce2df3ee
serial: tegra: Add PIO mode support
...
Add PIO mode support in receive and transmit path with RX interrupt
trigger of 16 bytes for Tegra194 and older chips.
Signed-off-by: Shardar Shariff Md <smohammed@nvidia.com >
Signed-off-by: Krishna Yarlagadda <kyarlagadda@nvidia.com >
Link: https://lore.kernel.org/r/1567572187-29820-13-git-send-email-kyarlagadda@nvidia.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-09-05 10:00:05 +02:00
Krishna Yarlagadda
d781ec21ba
serial: tegra: report clk rate errors
...
Standard UART controllers support +/-4% baud rate error tolerance.
Tegra186 only supports 0% to +4% error tolerance whereas other Tegra
chips support standard +/-4% rate. Add chip data for knowing error
tolerance level for each soc. Creating new compatible for Tegra194
chip as it supports baud rate error tolerance of -2 to +2%, different
from older chips.
Signed-off-by: Shardar Shariff Md <smohammed@nvidia.com >
Signed-off-by: Krishna Yarlagadda <kyarlagadda@nvidia.com >
Link: https://lore.kernel.org/r/1567572187-29820-12-git-send-email-kyarlagadda@nvidia.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-09-05 10:00:05 +02:00
Krishna Yarlagadda
f04a3cc8d4
serial: tegra: add support to adjust baud rate
...
Add support to adjust baud rates to fall under supported tolerance
range through DT.
Tegra186 chip has a hardware issue resulting in frame errors when
tolerance level for baud rate is negative. Provided entries to adjust
baud rate to be within acceptable range and work with devices that
can send negative baud rate. Also report error when baud rate set is
out of tolerance range of controller updated in device tree.
Signed-off-by: Shardar Shariff Md <smohammed@nvidia.com >
Signed-off-by: Krishna Yarlagadda <kyarlagadda@nvidia.com >
Link: https://lore.kernel.org/r/1567572187-29820-11-git-send-email-kyarlagadda@nvidia.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-09-05 10:00:05 +02:00
Krishna Yarlagadda
7799a3aa81
serial: tegra: add support to use 8 bytes trigger
...
Add support to use 8 bytes trigger for Tegra186 SOC.
Signed-off-by: Shardar Shariff Md <smohammed@nvidia.com >
Signed-off-by: Krishna Yarlagadda <kyarlagadda@nvidia.com >
Link: https://lore.kernel.org/r/1567572187-29820-9-git-send-email-kyarlagadda@nvidia.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-09-05 10:00:05 +02:00
Krishna Yarlagadda
53d0a062cb
serial: tegra: set maximum num of uart ports to 8
...
Set maximum number of UART ports to 8 as older chips have 5 ports and
Tergra186 and later chips will have 8 ports. Add this info to chip
data. Read device tree compatible of this driver and register uart
driver with max ports of matching chip data.
Signed-off-by: Shardar Shariff Md <smohammed@nvidia.com >
Signed-off-by: Krishna Yarlagadda <kyarlagadda@nvidia.com >
Link: https://lore.kernel.org/r/1567572187-29820-8-git-send-email-kyarlagadda@nvidia.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-09-05 10:00:04 +02:00
Krishna Yarlagadda
222dcdff34
serial: tegra: check for FIFO mode enabled status
...
Chips prior to Tegra186 needed delay of 3 UART clock cycles to avoid
data loss. This issue is fixed in Tegra186 and a new flag is added to
check if FIFO mode is enabled. chip data updated to check if this flag
is available for a chip. Tegra186 has new compatible to enable this
flag.
Signed-off-by: Shardar Shariff Md <smohammed@nvidia.com >
Signed-off-by: Krishna Yarlagadda <kyarlagadda@nvidia.com >
Link: https://lore.kernel.org/r/1567572187-29820-7-git-send-email-kyarlagadda@nvidia.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-09-05 10:00:04 +02:00
Krishna Yarlagadda
cb79f504bb
serial: tegra: report error to upper tty layer
...
Report overrun/parity/frame/break errors to top tty layer. Add support
to ignore break character if IGNBRK is set.
Signed-off-by: Shardar Shariff Md <smohammed@nvidia.com >
Signed-off-by: Krishna Yarlagadda <kyarlagadda@nvidia.com >
Link: https://lore.kernel.org/r/1567572187-29820-5-git-send-email-kyarlagadda@nvidia.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-09-05 10:00:04 +02:00
Shardar Shariff Md
b9c2470fb1
serial: tegra: flush the RX fifo on frame error
...
FIFO reset/flush code implemented now does not follow programming
guidelines. RTS line has to be turned off while flushing FIFOs to
avoid new transfers. Also check LSR bits UART_LSR_TEMT and UART_LSR_DR
to confirm FIFOs are flushed.
Signed-off-by: Shardar Shariff Md <smohammed@nvidia.com >
Signed-off-by: Krishna Yarlagadda <kyarlagadda@nvidia.com >
Link: https://lore.kernel.org/r/1567572187-29820-4-git-send-email-kyarlagadda@nvidia.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-09-05 10:00:03 +02:00
Ahung Cheng
494f79bd23
serial: tegra: avoid reg access when clk disabled
...
This avoids two race conditions from the UART shutdown sequence both
leading to 'Machine check error in AXI2APB' and kernel oops.
One was that the clock was disabled before the DMA was terminated making
it possible for the DMA callbacks to be called after the clock was
disabled. These callbacks could write to the UART registers causing
timeout.
The second was that the clock was disabled before the UART was
completely flagged as closed. This is done after the shutdown is called
and a new write could be started after the clock was disabled.
tegra_uart_start_pio_tx could be called causing timeout.
Given that the baud rate is reset at the end of shutdown sequence, this
fix is to examine the baud rate to avoid register access from both race
conditions.
Besides, terminate the DMA before disabling the clock.
Signed-off-by: Ahung Cheng <ahcheng@nvidia.com >
Signed-off-by: Shardar Mohammed <smohammed@nvidia.com >
Signed-off-by: Krishna Yarlagadda <kyarlagadda@nvidia.com >
Link: https://lore.kernel.org/r/1567572187-29820-3-git-send-email-kyarlagadda@nvidia.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-09-05 10:00:03 +02:00
Shardar Shariff Md
33ae787b74
serial: tegra: add support to ignore read
...
Add support to ignore read characters if CREAD flag is not set.
Signed-off-by: Shardar Shariff Md <smohammed@nvidia.com >
Signed-off-by: Krishna Yarlagadda <kyarlagadda@nvidia.com >
Link: https://lore.kernel.org/r/1567572187-29820-2-git-send-email-kyarlagadda@nvidia.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-09-05 10:00:03 +02:00
Ahung Cheng
18a4c404d2
serial: tegra: protect IER against LCR.DLAB
...
The IER and DLH registers occupy the same address space, selected by
the LCR.DLAB bit. Hence, add port lock to protect IER when LCR.DLAB bit
is set.
Signed-off-by: Ahung Cheng <ahcheng@nvidia.com >
Signed-off-by: Krishna Yarlagadda <kyarlagadda@nvidia.com >
Acked-by: Thierry Reding <treding@nvidia.com >
Link: https://lore.kernel.org/r/1565609303-27000-5-git-send-email-kyarlagadda@nvidia.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-09-04 12:43:54 +02:00
Andreas Abel
6300b140c2
serial: tegra: add internal loopback functionality
...
Add the internal loopback functionality that can be enabled with
TIOCM_LOOP.
Signed-off-by: Andreas Abel <aabel@nvidia.com >
Signed-off-by: Krishna Yarlagadda <kyarlagadda@nvidia.com >
Acked-by: Thierry Reding <treding@nvidia.com >
Link: https://lore.kernel.org/r/1565609303-27000-2-git-send-email-kyarlagadda@nvidia.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-09-04 12:43:54 +02:00
Stephen Boyd
1df2178681
tty: Remove dev_err() usage after platform_get_irq()
...
We don't need dev_err() messages when platform_get_irq() fails now that
platform_get_irq() prints an error message itself when something goes
wrong. Let's remove these prints with a simple semantic patch.
// <smpl>
@@
expression ret;
struct platform_device *E;
@@
ret =
(
platform_get_irq(E, ...)
|
platform_get_irq_byname(E, ...)
);
if ( \( ret < 0 \| ret <= 0 \) )
{
(
-if (ret != -EPROBE_DEFER)
-{ ...
-dev_err(...);
-... }
|
...
-dev_err(...);
)
...
}
// </smpl>
While we're here, remove braces on if statements that only have one
statement (manually).
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Jiri Slaby <jslaby@suse.com >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Signed-off-by: Stephen Boyd <swboyd@chromium.org >
Link: https://lore.kernel.org/r/20190730181557.90391-45-swboyd@chromium.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-09-04 12:43:49 +02:00
Marcel Ziswiler
3957386aeb
serial: tegra: fix some spelling mistakes
...
Fix a few spelling mistakes I stumbled upon while debugging a customers
UART issues.
Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-11-09 08:58:18 -08:00
Greg Kroah-Hartman
4793f2ebff
tty: serial: Remove redundant license text
...
Now that the SPDX tag is in all tty files, that identifies the license
in a specific and legally-defined manner. So the extra GPL text wording
can be removed as it is no longer needed at all.
This is done on a quest to remove the 700+ different ways that files in
the kernel describe the GPL license text. And there's unneeded stuff
like the address (sometimes incorrect) for the FSF which is never
needed.
No copyright headers or other non-license-description text was removed.
Cc: Jiri Slaby <jslaby@suse.com >
Cc: Eric Anholt <eric@anholt.net >
Cc: Stefan Wahren <stefan.wahren@i2se.com >
Cc: Florian Fainelli <f.fainelli@gmail.com >
Cc: Ray Jui <rjui@broadcom.com >
Cc: Scott Branden <sbranden@broadcom.com >
Cc: bcm-kernel-feedback-list@broadcom.com
Cc: "James E.J. Bottomley" <jejb@parisc-linux.org >
Cc: Helge Deller <deller@gmx.de >
Cc: Joachim Eastwood <manabian@gmail.com >
Cc: Matthias Brugger <matthias.bgg@gmail.com >
Cc: Masahiro Yamada <yamada.masahiro@socionext.com >
Cc: Tobias Klauser <tklauser@distanz.ch >
Cc: Russell King <linux@armlinux.org.uk >
Cc: Vineet Gupta <vgupta@synopsys.com >
Cc: Richard Genoud <richard.genoud@gmail.com >
Cc: Alexander Shiyan <shc_work@mail.ru >
Cc: Baruch Siach <baruch@tkos.co.il >
Cc: Pat Gefre <pfg@sgi.com >
Cc: "Guilherme G. Piccoli" <gpiccoli@linux.vnet.ibm.com >
Cc: Jason Wessel <jason.wessel@windriver.com >
Cc: Vladimir Zapolskiy <vz@mleia.com >
Cc: Sylvain Lemieux <slemieux.tyco@gmail.com >
Cc: Carlo Caione <carlo@caione.org >
Cc: Kevin Hilman <khilman@baylibre.com >
Cc: Liviu Dudau <liviu.dudau@arm.com >
Cc: Sudeep Holla <sudeep.holla@arm.com >
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Andy Gross <andy.gross@linaro.org >
Cc: David Brown <david.brown@linaro.org >
Cc: "Andreas Färber" <afaerber@suse.de >
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org >
Cc: Paul Mackerras <paulus@samba.org >
Cc: Michael Ellerman <mpe@ellerman.id.au >
Cc: Kevin Cernekee <cernekee@gmail.com >
Cc: Laxman Dewangan <ldewangan@nvidia.com >
Cc: Thierry Reding <thierry.reding@gmail.com >
Cc: Jonathan Hunter <jonathanh@nvidia.com >
Cc: Barry Song <baohua@kernel.org >
Cc: Patrice Chotard <patrice.chotard@st.com >
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com >
Cc: Alexandre Torgue <alexandre.torgue@st.com >
Cc: Chris Metcalf <cmetcalf@mellanox.com >
Cc: Peter Korsgaard <jacmet@sunsite.dk >
Cc: Timur Tabi <timur@tabi.org >
Cc: Tony Prisk <linux@prisktech.co.nz >
Cc: Michal Simek <michal.simek@xilinx.com >
Cc: "Sören Brinkmann" <soren.brinkmann@xilinx.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2017-11-08 13:08:12 +01:00
Greg Kroah-Hartman
e3b3d0f549
tty: add SPDX identifiers to all remaining files in drivers/tty/
...
It's good to have SPDX identifiers in all files to make it easier to
audit the kernel tree for correct licenses.
Update the drivers/tty files files with the correct SPDX license
identifier based on the license text in the file itself. The SPDX
identifier is a legally binding shorthand, which can be used instead of
the full boiler plate text.
This work is based on a script and data from Thomas Gleixner, Philippe
Ombredanne, and Kate Stewart.
Cc: Jiri Slaby <jslaby@suse.com >
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org >
Cc: Paul Mackerras <paulus@samba.org >
Cc: Michael Ellerman <mpe@ellerman.id.au >
Cc: Chris Metcalf <cmetcalf@mellanox.com >
Cc: Jiri Kosina <jikos@kernel.org >
Cc: David Sterba <dsterba@suse.com >
Cc: James Hogan <jhogan@kernel.org >
Cc: Rob Herring <robh@kernel.org >
Cc: Eric Anholt <eric@anholt.net >
Cc: Stefan Wahren <stefan.wahren@i2se.com >
Cc: Florian Fainelli <f.fainelli@gmail.com >
Cc: Ray Jui <rjui@broadcom.com >
Cc: Scott Branden <sbranden@broadcom.com >
Cc: bcm-kernel-feedback-list@broadcom.com
Cc: "James E.J. Bottomley" <jejb@parisc-linux.org >
Cc: Helge Deller <deller@gmx.de >
Cc: Joachim Eastwood <manabian@gmail.com >
Cc: Matthias Brugger <matthias.bgg@gmail.com >
Cc: Masahiro Yamada <yamada.masahiro@socionext.com >
Cc: Tobias Klauser <tklauser@distanz.ch >
Cc: Russell King <linux@armlinux.org.uk >
Cc: Vineet Gupta <vgupta@synopsys.com >
Cc: Richard Genoud <richard.genoud@gmail.com >
Cc: Alexander Shiyan <shc_work@mail.ru >
Cc: Baruch Siach <baruch@tkos.co.il >
Cc: "Maciej W. Rozycki" <macro@linux-mips.org >
Cc: "Uwe Kleine-König" <kernel@pengutronix.de >
Cc: Pat Gefre <pfg@sgi.com >
Cc: "Guilherme G. Piccoli" <gpiccoli@linux.vnet.ibm.com >
Cc: Jason Wessel <jason.wessel@windriver.com >
Cc: Vladimir Zapolskiy <vz@mleia.com >
Cc: Sylvain Lemieux <slemieux.tyco@gmail.com >
Cc: Carlo Caione <carlo@caione.org >
Cc: Kevin Hilman <khilman@baylibre.com >
Cc: Liviu Dudau <liviu.dudau@arm.com >
Cc: Sudeep Holla <sudeep.holla@arm.com >
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Andy Gross <andy.gross@linaro.org >
Cc: David Brown <david.brown@linaro.org >
Cc: "Andreas Färber" <afaerber@suse.de >
Cc: Kevin Cernekee <cernekee@gmail.com >
Cc: Laxman Dewangan <ldewangan@nvidia.com >
Cc: Thierry Reding <thierry.reding@gmail.com >
Cc: Jonathan Hunter <jonathanh@nvidia.com >
Cc: Barry Song <baohua@kernel.org >
Cc: Patrice Chotard <patrice.chotard@st.com >
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com >
Cc: Alexandre Torgue <alexandre.torgue@st.com >
Cc: "David S. Miller" <davem@davemloft.net >
Cc: Peter Korsgaard <jacmet@sunsite.dk >
Cc: Timur Tabi <timur@tabi.org >
Cc: Tony Prisk <linux@prisktech.co.nz >
Cc: Michal Simek <michal.simek@xilinx.com >
Cc: "Sören Brinkmann" <soren.brinkmann@xilinx.com >
Cc: Thomas Gleixner <tglx@linutronix.de >
Cc: Kate Stewart <kstewart@linuxfoundation.org >
Cc: Philippe Ombredanne <pombredanne@nexb.com >
Cc: Jiri Slaby <jslaby@suse.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2017-11-08 13:08:12 +01:00
Philipp Zabel
f67276a0ee
serial: tegra: explicitly request exclusive reset control
...
Commit a53e35db70 ("reset: Ensure drivers are explicit when requesting
reset lines") started to transition the reset control request API calls
to explicitly state whether the driver needs exclusive or shared reset
control behavior. Convert all drivers requesting exclusive resets to the
explicit API call so the temporary transition helpers can be removed.
No functional changes.
Cc: Laxman Dewangan <ldewangan@nvidia.com >
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Cc: Jiri Slaby <jslaby@suse.com >
Cc: Thierry Reding <thierry.reding@gmail.com >
Cc: Jonathan Hunter <jonathanh@nvidia.com >
Cc: linux-serial@vger.kernel.org
Cc: linux-tegra@vger.kernel.org
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2017-07-30 07:35:28 -07:00
Bhumika Goyal
2331e06865
tty: serial: constify uart_ops structures
...
Declare uart_ops structures as const as they are only stored in the ops
field of an uart_port structure. This field is of type const, so
uart_ops structures having this property can be made const too.
File size details before and after patching.
First line of every .o file shows the file size before patching
and second line shows the size after patching.
text data bss dec hex filename
2977 456 64 3497 da9 drivers/tty/serial/amba-pl010.o
3169 272 64 3505 db1 drivers/tty/serial/amba-pl010.o
3109 456 0 3565 ded drivers/tty/serial/efm32-uart.o
3301 272 0 3573 df5 drivers/tty/serial/efm32-uart.o
10668 753 1 11422 2c9e drivers/tty/serial/icom.o
10860 561 1 11422 2c9e drivers/tty/serial/icom.o
23904 408 8 24320 5f00 drivers/tty/serial/ioc3_serial.o
24088 224 8 24320 5f00 drivers/tty/serial/ioc3_serial.o
10516 560 4 11080 2b48 drivers/tty/serial/ioc4_serial.o
10709 368 4 11081 2b49 drivers/tty/serial/ioc4_serial.o
7853 648 1216 9717 25f5 drivers/tty/serial/mpsc.o
8037 456 1216 9709 25ed drivers/tty/serial/mpsc.o
10248 456 0 10704 29d0 drivers/tty/serial/omap-serial.o
10440 272 0 10712 29d8 drivers/tty/serial/omap-serial.o
8122 532 1984 10638 298e drivers/tty/serial/pmac_zilog.o
8306 340 1984 10630 2986 drivers/tty/serial/pmac_zilog.o
3808 456 0 4264 10a8 drivers/tty/serial/pxa.o
4000 264 0 4264 10a8 drivers/tty/serial/pxa.o
21781 3864 0 25645 642d drivers/tty/serial/serial-tegra.o
22037 3608 0 25645 642d drivers/tty/serial/serial-tegra.o
2481 456 96 3033 bd9 drivers/tty/serial/sprd_serial.o
2673 272 96 3041 be1 drivers/tty/serial/sprd_serial.o
5534 300 512 6346 18ca drivers/tty/serial/vr41xx_siu.o
5630 204 512 6346 18ca drivers/tty/serial/vr41xx_siu.o
6730 1576 128 8434 20f2 drivers/tty/serial/vt8500_serial.o
6986 1320 128 8434 20f2 drivers/tty/serial/vt8500_serial.o
Cross compiled for mips architecture.
3005 488 0 3493 da5 drivers/tty/serial/pnx8xxx_uart.o
3189 304 0 3493 da5 drivers/tty/serial/pnx8xxx_uart.o
4272 196 1056 5524 1594 drivers/tty/serial/dz.o
4368 100 1056 5524 1594 drivers/tty/serial/dz.o
6551 144 16 6711 1a37 drivers/tty/serial/ip22zilog.o
6647 48 16 6711 1a37 drivers/tty/serial/ip22zilog.o
9612 428 1520 11560 2d28 drivers/tty/serial/serial_txx9.o
9708 332 1520 11560 2d28 drivers/tty/serial/serial_txx9.o
4156 296 16 4468 1174 drivers/tty/serial/ar933x_uart.o
4252 200 16 4468 1174 drivers/tty/serial/ar933x_uart.o
Cross compiled for arm archiecture.
11716 1780 44 13540 34e4 drivers/tty/serial/sirfsoc_uart.o
11808 1688 44 13540 34e4 drivers/tty/serial/sirfsoc_uart.o
13352 596 56 14004 36b4 drivers/tty/serial/amba-pl011.o
13444 504 56 14004 36b4 drivers/tty/serial/amba-pl011.o
Cross compiled for sparc architecture.
4664 528 32 5224 1468 drivers/tty/serial/sunhv.o
4848 344 32 5224 1468 drivers/tty/serial/sunhv.o
8080 332 28 8440 20f8 drivers/tty/serial/sunzilog.o
8184 228 28 8440 20f8 drivers/tty/serial/sunzilog.o
Cross compiled for ia64 architecture.
10226 549 472 11247 2bef drivers/tty/serial/sn_console.o
10414 365 472 11251 2bf3 drivers/tty/serial/sn_console.o
The files drivers/tty/serial/zs.o, drivers/tty/serial/lpc32xx_hs.o and
drivers/tty/serial/lantiq.o did not compile.
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2017-01-27 09:23:36 +01:00
Jiri Slaby
394a9e2ca2
TTY: serial, handle platform_get_irq retval properly
...
platform_get_irq can fail, so we should handle negative value when
returned.
[v2]
platform_get_irq can actually return zero on some platforms. So do not
remove checks for irq == 0 there.
Signed-off-by: Jiri Slaby <jslaby@suse.cz >
Cc: Russell King <linux@arm.linux.org.uk >
Cc: "Uwe Kleine-König" <kernel@pengutronix.de >
Cc: Russell King <linux@armlinux.org.uk >
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org >
Cc: Paul Mackerras <paulus@samba.org >
Cc: Michael Ellerman <mpe@ellerman.id.au >
Cc: Laxman Dewangan <ldewangan@nvidia.com >
Cc: Stephen Warren <swarren@wwwdotorg.org >
Cc: Thierry Reding <thierry.reding@gmail.com >
Cc: Alexandre Courbot <gnurou@gmail.com >
Cc: linux-serial@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-tegra@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2016-06-25 09:01:52 -07:00
Thierry Reding
06c5e362ce
serial: tegra: Remove unused variable
...
The local mcr variable is never used in the tegra_uart_set_mctrl()
function, so it should be removed.
Signed-off-by: Thierry Reding <treding@nvidia.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2016-04-30 09:26:55 -07:00
Jon Hunter
32ede4a517
serial: tegra: Add helper function for handling RX buffer
...
In the tegra UART driver there are three places where the RX DMA buffer
is handled and pushed up to the tty layer. In all three instances the
same functions are called and so instead of duplicating the code in three
places, move this code to a new helper function and use this new function.
Signed-off-by: Jon Hunter <jonathanh@nvidia.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2015-10-17 21:07:57 -07:00
Jon Hunter
b0e066ccb5
serial: tegra: Remove redundant code and check in tegra_uart_stop_rx()
...
The serial-tegra driver always uses DMA and hence the driver always
allocates DMA channels. Therefore, the test to see if the RX DMA channel
is initialised in tegra_uart_stop_rx() is unnecessary and so remove
the test and the code that corresponds to the case where the RX DMA
channel is not initialised. Please note that the call to
tegra_uart_stop_rx() should always be before the call to
tegra_uart_shutdown() which will uninitialise the RX DMA channel.
Signed-off-by: Jon Hunter <jonathanh@nvidia.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2015-10-17 21:07:57 -07:00
Jon Hunter
2230a9475f
serial: tegra: Remove unnecessary return statements
...
Some functions in the serial-tegra driver have unnecessary return
statements at the end of a void function and so remove them.
Signed-off-by: Jon Hunter <jonathanh@nvidia.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2015-10-17 21:07:57 -07:00
Jon Hunter
2a24bb28a3
serial: tegra: Handle another RX race condition
...
Commit 853a699739 ("serial: tegra: handle race condition on uart rx
side") attempted to fix a race condition between the RX end of
transmission interrupt and RX DMA completion callback. Despite this
fix there is still another case where these two paths can race and
result in duplicated data. The race condition is as follows:
1. DMA completion interrupt occurs and schedules tasklet to call DMA
callback.
2. DMA callback for the UART driver starts to execute. This will copy
the data from the DMA buffer and restart the DMA. This is done under
uart port spinlock.
3. During the callback, UART interrupt is raised for end of receive. The
UART ISR runs and waits to acquire port spinlock held by the DMA
callback.
4. DMA callback gives up spinlock after copying the data, but before
restarting DMA.
5. UART ISR acquires the spin lock and reads the same DMA buffer because
DMA has not been restarted yet.
The release of the spinlock during the DMA callback was introduced by
commit 9b88748b36 ("tty: serial: tegra: drop uart_port->lock before
calling tty_flip_buffer_push()") to fix a spinlock lock-up issue when
calling tty_flip_buffer_push(). However, since then commit a9c3f68f3c
("tty: Fix low_latency BUG") migrated tty_flip_buffer_push() to always
use a workqueue, allowing tty_flip_buffer_push() to be called from
within atomic sections. Therefore, we can remove the unlocking of the
spinlock from the DMA callback and UART ISR and this will ensure that
the race condition no longer occurs.
Reported-by: Christopher Freeman <cfreeman@nvidia.com >
Signed-off-by: Jon Hunter <jonathanh@nvidia.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2015-10-17 21:07:57 -07:00
Jon Hunter
8f8e48f4d6
serial: tegra: Fix memory leak on DMA setup failure
...
If the call to dmaengine_slave_config() fails, then the DMA buffer will
not be freed/unmapped. Fix this by moving the code that stores the
address of the buffer in the tegra_uart_port structure to before the
call to dmaengine_slave_config().
Reported-by: Alexandre Courbot <acourbot@nvidia.com >
Signed-off-by: Jon Hunter <jonathanh@nvidia.com >
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2015-05-24 12:53:44 -07:00
Jon Hunter
ad909b3f8b
serial: tegra: Correct error handling on DMA setup
...
Function tegra_uart_dma_channel_allocate() does not check that
dma_map_single() mapped the DMA buffer correctly. Add a check for this
and appropriate error handling.
Furthermore, if dmaengine_slave_config() (called by
tegra_uart_dma_channel_allocate()) fails, then memory allocated/mapped
is not freed/unmapped. Therefore, call tegra_uart_dma_channel_free()
instead of just dma_release_channel() if dmaengine_slave_config() fails.
Signed-off-by: Jon Hunter <jonathanh@nvidia.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2015-05-10 19:12:19 +02:00