summaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/xilinx_uartps.c
Commit message (Collapse)AuthorAgeFilesLines
* serial: uartps: console_setup() can't be placed to init sectionMichal Simek2019-04-201-1/+1
| | | | | | | | | | | | | | [ Upstream commit 4bb1ce2350a598502b23088b169e16b43d4bc639 ] When console device is rebinded, console_setup() is called again. But marking it as __init means that function will be clear after boot is complete. If console device is binded again console_setup() is not found and error "Unable to handle kernel paging request at virtual address" is reported. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
* serial: uartps: Fix stuck ISR if RX disabled with non-empty FIFOAnssi Hannula2019-03-231-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit 7abab1605139bc41442864c18f9573440f7ca105 upstream. If RX is disabled while there are still unprocessed bytes in RX FIFO, cdns_uart_handle_rx() called from interrupt handler will get stuck in the receive loop as read bytes will not get removed from the RX FIFO and CDNS_UART_SR_RXEMPTY bit will never get set. Avoid the stuck handler by checking first if RX is disabled. port->lock protects against race with RX-disabling functions. This HW behavior was mentioned by Nathan Rossi in 43e98facc4a3 ("tty: xuartps: Fix RX hang, and TX corruption in termios call") which fixed a similar issue in cdns_uart_set_termios(). The behavior can also be easily verified by e.g. setting CDNS_UART_CR_RX_DIS at the beginning of cdns_uart_handle_rx() - the following loop will then get stuck. Resetting the FIFO using RXRST would not set RXEMPTY either so simply issuing a reset after RX-disable would not work. I observe this frequently on a ZynqMP board during heavy RX load at 1M baudrate when the reader process exits and thus RX gets disabled. Fixes: 61ec9016988f ("tty/serial: add support for Xilinx PS UART") Signed-off-by: Anssi Hannula <anssi.hannula@bitwise.fi> Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: set suppress_bind_attrs flag only if builtinAnders Roxell2019-01-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [ Upstream commit 646097940ad35aa2c1f2012af932d55976a9f255 ] When the test 'CONFIG_DEBUG_TEST_DRIVER_REMOVE=y' is enabled, arch_initcall(pl011_init) came before subsys_initcall(default_bdi_init). devtmpfs gets killed because we try to remove a file and decrement the wb reference count before the noop_backing_device_info gets initialized. [ 0.332075] Serial: AMBA PL011 UART driver [ 0.485276] 9000000.pl011: ttyAMA0 at MMIO 0x9000000 (irq = 39, base_baud = 0) is a PL011 rev1 [ 0.502382] console [ttyAMA0] enabled [ 0.515710] Unable to handle kernel paging request at virtual address 0000800074c12000 [ 0.516053] Mem abort info: [ 0.516222] ESR = 0x96000004 [ 0.516417] Exception class = DABT (current EL), IL = 32 bits [ 0.516641] SET = 0, FnV = 0 [ 0.516826] EA = 0, S1PTW = 0 [ 0.516984] Data abort info: [ 0.517149] ISV = 0, ISS = 0x00000004 [ 0.517339] CM = 0, WnR = 0 [ 0.517553] [0000800074c12000] user address but active_mm is swapper [ 0.517928] Internal error: Oops: 96000004 [#1] PREEMPT SMP [ 0.518305] Modules linked in: [ 0.518839] CPU: 0 PID: 13 Comm: kdevtmpfs Not tainted 4.19.0-rc5-next-20180928-00002-g2ba39ab0cd01-dirty #82 [ 0.519307] Hardware name: linux,dummy-virt (DT) [ 0.519681] pstate: 80000005 (Nzcv daif -PAN -UAO) [ 0.519959] pc : __destroy_inode+0x94/0x2a8 [ 0.520212] lr : __destroy_inode+0x78/0x2a8 [ 0.520401] sp : ffff0000098c3b20 [ 0.520590] x29: ffff0000098c3b20 x28: 00000000087a3714 [ 0.520904] x27: 0000000000002000 x26: 0000000000002000 [ 0.521179] x25: ffff000009583000 x24: 0000000000000000 [ 0.521467] x23: ffff80007bb52000 x22: ffff80007bbaa7c0 [ 0.521737] x21: ffff0000093f9338 x20: 0000000000000000 [ 0.522033] x19: ffff80007bbb05d8 x18: 0000000000000400 [ 0.522376] x17: 0000000000000000 x16: 0000000000000000 [ 0.522727] x15: 0000000000000400 x14: 0000000000000400 [ 0.523068] x13: 0000000000000001 x12: 0000000000000001 [ 0.523421] x11: 0000000000000000 x10: 0000000000000970 [ 0.523749] x9 : ffff0000098c3a60 x8 : ffff80007bbab190 [ 0.524017] x7 : ffff80007bbaa880 x6 : 0000000000000c88 [ 0.524305] x5 : ffff0000093d96c8 x4 : 61c8864680b583eb [ 0.524567] x3 : ffff0000093d6180 x2 : ffffffffffffffff [ 0.524872] x1 : 0000800074c12000 x0 : 0000800074c12000 [ 0.525207] Process kdevtmpfs (pid: 13, stack limit = 0x(____ptrval____)) [ 0.525529] Call trace: [ 0.525806] __destroy_inode+0x94/0x2a8 [ 0.526108] destroy_inode+0x34/0x88 [ 0.526370] evict+0x144/0x1c8 [ 0.526636] iput+0x184/0x230 [ 0.526871] dentry_unlink_inode+0x118/0x130 [ 0.527152] d_delete+0xd8/0xe0 [ 0.527420] vfs_unlink+0x240/0x270 [ 0.527665] handle_remove+0x1d8/0x330 [ 0.527875] devtmpfsd+0x138/0x1c8 [ 0.528085] kthread+0x14c/0x158 [ 0.528291] ret_from_fork+0x10/0x18 [ 0.528720] Code: 92800002 aa1403e0 d538d081 8b010000 (c85f7c04) [ 0.529367] ---[ end trace 5a3dee47727f877c ]--- Rework to set suppress_bind_attrs flag to avoid removing the device when CONFIG_DEBUG_TEST_DRIVER_REMOVE=y. This applies for pic32_uart and xilinx_uartps as well. Co-developed-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Anders Roxell <anders.roxell@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
* serial: uartps: Fix interrupt mask issue to handle the RX interrupts properlyNava kishore Manne2019-01-091-2/+2
| | | | | | | | | | | | | | commit 260683137ab5276113fc322fdbbc578024185fee upstream. This patch Correct the RX interrupt mask value to handle the RX interrupts properly. Fixes: c8dbdc842d30 ("serial: xuartps: Rewrite the interrupt handling logic") Signed-off-by: Nava kishore Manne <nava.manne@xilinx.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: xuartps: Fix out-of-bounds access through DT aliasGeert Uytterhoeven2018-05-251-1/+1
| | | | | | | | | | | | | | | [ Upstream commit e7d75e18d0fc3f7193b65282b651f980c778d935 ] The cdns_uart_port[] array is indexed using a value derived from the "serialN" alias in DT, which may lead to an out-of-bounds access. Fix this by adding a range check. Fixes: 928e9263492069ee ("tty: xuartps: Initialize ports according to aliases") Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: xuartps: Remove __init marking from early writeJeffy Chen2017-07-301-1/+1
| | | | | | | | | | | | | The earlycon would be alive outside the init code in these cases: 1/ we have keep_bootcon in cmdline. 2/ we don't have a real console to switch to. So remove the __init marking to avoid invalid memory access. Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com> Reviewed-by: Douglas Anderson <dianders@chromium.org> Tested-by: Brian Norris <briannorris@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: uartps: Fix kernel doc warningsNava kishore Manne2017-06-031-0/+1
| | | | | | | | This patch fixes the kernel doc warnings in the driver. Signed-off-by: Nava kishore Manne <navam@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: xilinx_uartps: Fix the error pathShubhrajyoti Datta2017-05-181-4/+5
| | | | | | | Fix the runtime calls in the error path. Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: xuartps: Enable clocks in the pm disable case alsoShubhrajyoti Datta2017-04-081-7/+7
| | | | | | | | | | | When Power management is disabled then the clocks are not getting enabled. This patch enables it for the !PM case also. While at it also pm_runtime_set_active is called before calling pm_runtime_enable. Reported-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: xuartps: Cleanup the clock enableShubhrajyoti Datta2017-03-171-6/+3
| | | | | | | | | The core handles the clocking now. Remove the clock disable in suspend. In resume we enable the clocks and disable after register write. Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: xilinx_uartps: Add pm runtime supportShubhrajyoti Datta2017-03-141-8/+42
| | | | | | | Adds pm runtime support to xilinx uart ps. Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: xuartps: Enable uart loopback modeYasir-Khan2017-01-251-0/+9
| | | | | | | | | | | | This patch adds xilinx uart loopback support by modifying the cdns_uart_set_mctrl function to handle the switch to loopback mode. After this patch, the loopback mode can be enabled/disabled by setting/clearing the TIOCM_LOOP modem bit via TIOCMBIS/TIOCMBIC ioctls respectively. Signed-off-by: Yasir-Khan <yasir_khan@mentor.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: xuartps: Add new compatible string for ZynqMPNava kishore Manne2016-10-271-0/+2
| | | | | | | This patch Adds the new compatible string for ZynqMP SoC. Signed-off-by: Nava kishore Manne <navam@xilinx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: xuartps: Add some register initialisation to cdns_early_console_setup()Scott Telford2016-09-271-1/+26
| | | | | | | | | | | | Add initialisation of control register and baud rate to cdns_early_console_setup(), required when running kernel standalone without a boot loader. Baud rate is only initialised when specified in earlycon command-line option, otherwise it is assumed this has been set by a boot loader. Updated Documentation/kernel-parameters.txt accordingly. Signed-off-by: Scott Telford <stelford@cadence.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: xuartps: Removed unwanted checks while reading the error conditionsNava kishore Manne2016-09-271-37/+35
| | | | | | | | | | | | | This patch Remove the unwated checks while reading the parity,framing, overrun and Break detection errors. Signed-off-by: Nava kishore Manne <navam@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com> [stelford@cadence.com: cherry picked from https://github.com/Xilinx/linux-xlnx commit b1cf74970df5470ffbc8e7876a9edf5e3498ef94] Signed-off-by: Scott Telford <stelford@cadence.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: xuartps: Rewrite the interrupt handling logicAnirudha Sarangi2016-09-271-105/+114
| | | | | | | | | | | | | | | | | | The existing interrupt handling logic has following issues. - Upon a parity error with default configuration, the control never comes out of the ISR thereby hanging Linux. - The error handling logic around framing and parity error are buggy. There are chances that the errors will never be captured. This patch ensures that the status registers are cleared on all cases so that a hang situation never arises. Signed-off-by: Anirudha Sarangi <anirudh@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com> [stelford@cadence.com: cherry picked from https://github.com/Xilinx/linux-xlnx commit ac297e20d399850d7a8e373b6eccf2e183c15165 with manual conflict resolution] Signed-off-by: Scott Telford <stelford@cadence.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: xuartps: Do not enable parity error interruptAnirudha Sarangi2016-09-221-2/+15
| | | | | | | | | | | | | | | | | | | | | | The patch makes changes not to enable parity error interrupt. With the current implementation, each parity error results in two distinct interrupts (almost always). The first one is normal parity error interrupt with no data in the fifo and the second one is a proper Rx interrupt with the received data in the fifo. By disabling parity error interrupt we still ensure handling of parity errors as for the Rx fifo interrupt the parity error still shows up in the interrupt status register. Considering the fact that the by default INPCK and IGNPAR are not set, this is the optimal implementation for parity error handling. Signed-off-by: Anirudha Sarangi <anirudh@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com> [stelford@cadence.com: cherry picked from https://github.com/Xilinx/linux-xlnx commit bf9f610b445e2c9ed33c41e1e0e30b43be4e1f97 with manual conflict resolution] Signed-off-by: Scott Telford <stelford@cadence.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: serial: xuartps: Wait for rx and tx reset done statusNava kishore Manne2016-09-221-0/+8
| | | | | | | | After issuing the reset, driver is not checking the rx and tx reset done status. So, modified driver to wait for the reset done status. Signed-off-by: Nava kishore Manne <navam@xilinx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: xuartps: Adds RXBS register support for zynqmpNava kishore Manne2016-09-221-20/+81
| | | | | | | | | | This patch adds RXBS register access support for zynqmp. To avoid the corner error conditions it will consider only RXBS[2:0] bits while checking the error conditions (Parity,Framing and BRAK). Signed-off-by: Nava kishore Manne <navam@xilinx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: xuartps: constify uart_ops structuresJulia Lawall2016-09-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Check for uart_ops structures that are only stored in the ops field of a uart_port structure. This field is declared const, so uart_ops structures that have this property can be declared as const also. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // <smpl> @r disable optional_qualifier@ identifier i; position p; @@ static struct uart_ops i@p = { ... }; @ok@ identifier r.i; struct uart_port e; position p; @@ e.ops = &i@p; @bad@ position p != {r.p,ok.p}; identifier r.i; struct uart_ops e; @@ e@i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct uart_ops i = { ... }; // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: xuartps: disable clocks when not usedShubhrajyoti Datta2016-06-251-6/+24
| | | | | | | | Currently the clocks are enabled at probe and disabled at remove. Instead enable the clocks when used. Signed-off-by: Shubhrajyoti Datta <shubhraj@xilinx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: xuartps: Enable OF earlycon supportMichal Simek2016-03-071-1/+3
| | | | | | | | | | | | Support early console setup via DT for all listed compatible strings. Remove EARLYCON_DECLARE which was done by: "Use common framework for earlycon declarations" (sha1: 2eaa790989e03900298ad24f77f1086dbbc1aebd) when OF_EARLYCON_DECLARE is defined. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: xuartps: Consolidate TX handlingSoren Brinkmann2016-02-061-57/+40
| | | | | | | | start_tx and the ISR used largely identical code to transmit data. Consolidate that in one place. Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: xuartps: Remove '_OFFSET' suffix from #definesSoren Brinkmann2016-02-061-115/+106
| | | | | | | | | Remove the _OFFSET suffix from all register defines which makes code a little easier to read and avoids a few line breaks. Suggested-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: xuartps: Improve sysrq handlingSoren Brinkmann2016-02-061-15/+5
| | | | | | | | | | | | Handling magic sysrq included dropping a lock to avoid a deadlock that happened when cdns_uart_console_write tried to acquire a lock in the from the sysrq code path. By making the acquisition of the lock in cdns_uart_console_write depending on port->sysrq, cdns_uart_handle_rx can be simplified to simply call uart_handle_sysrq. Suggested-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: xuartps: Cleanup: Reformat if-elseSoren Brinkmann2016-02-061-62/+62
| | | | | | | | Convert an if-else into the more common early return on error, reducing the indent level of the happy path. Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: xuartps: Refactor IRQ handlingSoren Brinkmann2016-02-061-6/+11
| | | | | | | | | The system could deadlock handling RX IRQs when RX-related IRQ conditions became true while the receiver was disabled. To avoid this, enable/disable the RX/TX IRQs together with the receiver/transmitter. Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: xuartps: Move request_irq to after setting up the HWSoren Brinkmann2016-02-061-9/+12
| | | | | | | | | | Request_irq() should be _after_ h/w programming, otherwise an interrupt could be triggered and in-progress before the h/w has been setup. Reported-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: xuartps: Move RX path into helper functionSoren Brinkmann2016-02-061-22/+28
| | | | | | | | | | Move RX-related IRQ handling into a helper function. Fixes a problem where every char received after a parity or frame error in the current isr will also be tagged as a parity or frame error. Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com> Reviewed-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: xuartps: Acquire port lock for shutdownSoren Brinkmann2016-02-061-0/+6
| | | | | | | | | | Shutting down the UART port can happen while console operations are in progress. Holding the port lock serializes these operations and avoids the UART HW to be disabled in the middle of console prints. Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com> Reviewed-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: xuartps: Keep lock for whole ISRSoren Brinkmann2016-02-061-2/+0
| | | | | | | | The RX path in the interrupt handler released a lock unnecessarily. Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com> Reviewed-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: xuartps: Improve startup functionSoren Brinkmann2016-02-061-8/+12
| | | | | | | | | | The startup function is supposed to initialize the UART for receiving. Hence, don't enable the TX part. Also, protect HW accesses with the port lock. Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com> Reviewed-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: xuartps: Clear interrupt status register in shutdownSoren Brinkmann2016-02-061-0/+1
| | | | | | | | | | When shutting down the UART, clear the interrupt status register. Bits in the ISR are cleared by writing them as '1'. Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com> Reviewed-by: Peter Hurley <peter@hurleysoftware.com> Reviewed-by: Moritz Fischer <moritz.fischer@ettus.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: xuartps: Don't consider circular buffer when enabling transmitterSoren Brinkmann2016-02-061-1/+4
| | | | | | | | | | | Restarting the transmitter even if the circ buffer is empty may be necessary to push out remaining data when the port is restarted after being stopped. Cc: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com> Reviewed-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: xuartps: Use spinlock to serialize HW accessSoren Brinkmann2016-02-061-12/+6
| | | | | | | | | | | Instead of disabling the IRQ, use the spin lock to serialize accesses to the HW. This protects the driver from interference of non-IRQ callbacks with each other and makes the driver more consistent in its serialization method. Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com> Reviewed-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: xuartps: Beautify read-modify writesSoren Brinkmann2016-02-061-6/+9
| | | | | | | | | Non-functional, formatting changes to ease reading the code. Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com> Reviewed-by: Peter Hurley <peter@hurleysoftware.com> Reviewed-by: Moritz Fischer <moritz.fischer@ettus.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: xuartps: add __init to earlycon write methodMasahiro Yamada2015-05-101-1/+2
| | | | | | | | Early console functions are only used during the early boot stage. This change just saves a small amount of memory footprint. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: xilinx: Use platform_get_irq to get irq description structureMichal Simek2015-04-281-6/+6
| | | | | | | | | | | | | | | For systems with CONFIG_SERIAL_OF_PLATFORM=y and device_type = "serial"; property in DT of_serial.c driver maps and unmaps IRQ (because driver probe fails). Then a driver is called but irq mapping is not created that's why driver is failing again in again on request_irq(). Based on this use platform_get_irq() instead of platform_get_resource() which is doing irq_desc allocation and driver itself can request IRQ. Fix both xilinx serial drivers in the tree. Signed-off-by: Michal Simek <michal.simek@xilinx.com> CC: <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: xuartps: Fix check in console_setup().Thomas Betker2015-03-261-1/+1
| | | | | | | | | | | cdns_uart_console_setup() checks port->mapbase != 0, but the port may not be initialized yet even if this condition is met [e.g., ioremap() may have failed]. Check port->membase != NULL instead, similar to cdns_early_console_setup(). Signed-off-by: Thomas Betker <thomas.betker@rohde-schwarz.com> Reviewed-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: xuartps: Get rid of register access macros.Thomas Betker2015-03-261-112/+118
| | | | | | | | | | | | | | Get rid of cdns_uart_readl() and cdns_uart_writel() and just call readl() and writel() directly. Most of the patch was created by search-and-replace (I had to convert a few lines manually, and break some lines longer than 80 columns): * s/cdns_uart_readl(/readl(port->membase + /g * s/cdns_uart_writel(\([^,]*\),/writel(\1, port->membase +/g Signed-off-by: Thomas Betker <thomas.betker@rohde-schwarz.com> Acked-by: Sören Brinkmann <soren.brinkmann@xilinx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: xuartps: Fix iobase use.Thomas Betker2015-03-261-1/+0
| | | | | | | | | cdns_uart_get_port() sets port->iobase = 1 to "mark port in use", but this "in use" condition is not checked anywhere else in the code. So remove the line, keeping port->iobase = 0 (which also makes more sense). Signed-off-by: Thomas Betker <thomas.betker@rohde-schwarz.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: xuartps: Fix cdns_uart_port[] definition.Thomas Betker2015-03-261-1/+1
| | | | | | | | | The code assumes that the array cdns_uart_port[] has dimension CDNS_UART_NR_PORTS, so let us define it this way. Signed-off-by: Thomas Betker <thomas.betker@rohde-schwarz.com> Reviewed-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: xuartps: Fix register space size.Thomas Betker2015-03-261-1/+1
| | | | | | | | | The register space size is 0x1000, and this value [not 0xfff] should be provided to request_mem_region(), ioremap(), etc. Signed-off-by: Thomas Betker <thomas.betker@rohde-schwarz.com> Reviewed-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: constify of_device_id arrayFabian Frederick2015-03-261-1/+1
| | | | | | | | | | | of_device_id is always used as const. (See driver.of_match_table and open firmware functions) Signed-off-by: Fabian Frederick <fabf@skynet.be> Acked-by: Peter Korsgaard <peter@korsgaard.com> Acked-by: Timur Tabi <timur@tabi.org> Acked-by: Patrice Chotard <patrice.chotard@st.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: serial: xilinx_uartps: Use Macro for ttyPS0Peter Crosthwaite2015-03-071-1/+2
| | | | | | | | | All instances of "ttyPS" use this macro except for this one. Convert it. Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Acked-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: xuartps: Fix RX hang, and TX corruption in termios callNathan Rossi2015-02-021-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The implementation of flushing the RX FIFO breaks in a number of cases, it is impossible to ensure an complete flush of the RX FIFO due to the hardware not allowing the use of the FIFOs when the receiver is disabled (Reading from the FIFO register does not remove it from the FIFO when the RX_EN=0 or RX_DIS=1). Additionally during an initial set_termios call where RX_DIS=1 causes a hang waiting forever for the RX FIFO to empty. On top of this the FIFO will be cleared by the use of the RXRST bits on the Control Register, making the RX flush pointless (as it does not preserve the data read anyway). Due to the TXRST the TX FIFO and transmitter can be interrupted during frame trasmission, causing corruption and additionally data lost in the FIFO. Most other serial drivers do not flush or clear the FIFOs during a termios configuration change and as such do not have issues with corruption. For this UART controller is it required that the TXRST/RXRST bit be flagged during the change, this means that the data in the FIFO will be dropped when changing configuration. In order to prevent data loss and corruption of the transmitted data, wait until the TX FIFO is empty before changing the configuration. The performance of this may cause the set_termios call to take a longer amount of time especially on lower baud rates, however it is comparable to the same performance hit that a console_write call costs. Signed-off-by: Nathan Rossi <nathan.rossi@xilinx.com> Acked-by: Anirudha Sarangi <anirudh@xilinx.com> Acked-by: Harini Katakam <harinik@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: xuartps: Add support for setting modem control signalsLars-Peter Clausen2014-11-061-1/+21
| | | | | | | | Add support for setting the state of the DTR and RTS signals. Acked-by: Soren Brinkmann <soren.brinkmann@xilinx.com> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: cadence: Add generic earlycon supportMichal Simek2014-09-281-0/+19
| | | | | | | | | | | | Add earlycon support for the cadence serial port. This is based on recent patches: "tty/serial: pl011: add generic earlycon support" (sha1: 0d3c673e7881e691991b2a4745bd4f149603baa2) "tty/serial: add arm/arm64 semihosting earlycon" (sha1: d50d7269ebcb438afa346cdffce0f4e2a1b9e831) Signed-off-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* Merge 3.17-rc5 into tty-nextGreg Kroah-Hartman2014-09-141-1/+1
|\ | | | | | | | | | | We want those fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * tty: xuartps: Fix tx_emtpy() callbackLars-Peter Clausen2014-09-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The tx_empty() callback currently checks the TXEMPTY bit in the interrupt status register to decided whether the FIFO should be reported as empty or not. The bit in this register gets set when the FIFO state transitions from non-empty to empty but is cleared again in the interrupt handler. This means it is not suitable to be used to decided whether the FIFO is currently empty or not. Instead use the TXEMPTY bit from the status register which will be set as long as the FIFO is empty. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Soren Brinkmann <soren.brinkmann@xilinx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>