summaryrefslogtreecommitdiff
path: root/drivers/tty/serial/amba-pl011.c
AgeCommit message (Collapse)Author
2015-10-17serial: amba-pl011: fix incorrect integer size in pl011_fifo_to_tty()Timur Tabi
The UART_DUMMY_DR_RX status bit is equal to (1 << 16), so a u16 is too small to hold that value. The result is that UART_DUMMY_DR_RX is never passed to uart_insert_char(). This means that we're always accepting characters, even when CREAD (in termios) is not set. Signed-off-by: Timur Tabi <timur@codeaurora.org> Reviewed-by: Dave Martin <Dave.Martin@arm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-04Revert "uart: pl011: Rename regs with enumeration"Greg Kroah-Hartman
This reverts commit 534e14e2293d8cd714b94513686228453b21fae2 as with this patch the serial console is broken on lots of platforms. Reported-by: Marc Zyngier <marc.zyngier@arm.com> Cc: Jun Nie <jun.nie@linaro.org> Acked-by: Will Deacon <will.deacon@arm.com> Tested-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-04Revert "uart: pl011: Introduce register accessor"Greg Kroah-Hartman
This reverts commit 7b753f318d1456c8e7740f3bd96d1dbb362d5449 as with this patch the serial console is broken on lots of platforms. Reported-by: Marc Zyngier <marc.zyngier@arm.com> Cc: Jun Nie <jun.nie@linaro.org> Acked-by: Will Deacon <will.deacon@arm.com> Tested-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-04Revert "uart: pl011: Introduce register look up table"Greg Kroah-Hartman
This reverts commit 2c096a9eedc6841d3610545f4e6c3d72bd0962be as with this patch the serial console is broken on lots of platforms. Reported-by: Marc Zyngier <marc.zyngier@arm.com> Cc: Jun Nie <jun.nie@linaro.org> Acked-by: Will Deacon <will.deacon@arm.com> Tested-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-04Revert "uart: pl011: Improve LCRH register access decision"Greg Kroah-Hartman
This reverts commit 09dcc7dfc05b31bf0bbcd1511cd1a2644908d5c8 as with this patch the serial console is broken on lots of platforms. Reported-by: Marc Zyngier <marc.zyngier@arm.com> Cc: Jun Nie <jun.nie@linaro.org> Acked-by: Will Deacon <will.deacon@arm.com> Tested-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-04Revert "uart: pl011: Add support to ZTE ZX296702 uart"Greg Kroah-Hartman
This reverts commit 8cd90e50d1408c65c355084b1c7f8f9085f49c6b as with this patch the serial console is broken on lots of platforms. Reported-by: Marc Zyngier <marc.zyngier@arm.com> Cc: Jun Nie <jun.nie@linaro.org> Acked-by: Will Deacon <will.deacon@arm.com> Tested-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-04uart: pl011: Add support to ZTE ZX296702 uartJun Nie
Support ZTE uart with some registers differing offset. Probe as platform device for not AMBA IP ID is available on ZTE uart. Signed-off-by: Jun Nie <jun.nie@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-04uart: pl011: Improve LCRH register access decisionJun Nie
Improve LCRH register access decision as ARM PL011 lcrh register serve as both TX and RX, while other SOC may implement TX and RX function with separated register. Signed-off-by: Jun Nie <jun.nie@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-04uart: pl011: Introduce register look up tableJun Nie
Introduce register look up table as different SOC venders may have different register offset for the some register. Signed-off-by: Jun Nie <jun.nie@linaro.org> Reviewed-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-04uart: pl011: Introduce register accessorJun Nie
Introduce register accessor to ease loop up table access in later patch. Signed-off-by: Jun Nie <jun.nie@linaro.org> Reviewed-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-04uart: pl011: Rename regs with enumerationJun Nie
Rename regs with enumeration to generalize register names. Signed-off-by: Jun Nie <jun.nie@linaro.org> Reviewed-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Jun Nie <jun.nie@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-07-23serial: amba-pl011: Fix devm_ioremap_resource return value checkKrzysztof Kozlowski
Value returned by devm_ioremap_resource() was checked for non-NULL but devm_ioremap_resource() returns IOMEM_ERR_PTR, not NULL. In case of error this could lead to dereference of ERR_PTR. Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com> Cc: <stable@vger.kernel.org> Fixes: 3873e2d7f63a ("drivers: PL011: refactor pl011_probe()") Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-24drivers: PL011: add ACPI probing for SBSA UARTGraeme Gregory
Add the necessary driver boilerplate to let the driver be used when the respective ACPI table is discovered by the ACPI subsystem. [Andre: change table name, add MODULE_DEVICE_TABLE entry and improve commit message] Reviewed-by: Hanjun Guo <hanjun.guo@linaro.org> Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org> Tested-by: Mark Langsdorf <mlangsdo@redhat.com> Tested-by: Naresh Bhat <nbhat@cavium.com> Signed-off-by: Andre Przywara <andre.przywara@arm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-24drivers: PL011: add support for the ARM SBSA generic UARTAndre Przywara
The ARM Server Base System Architecture[1] document describes a generic UART which is a subset of the PL011 UART. It lacks DMA support, baud rate control and modem status line control, among other things. The idea is to move the UART initialization and setup into the firmware (which does this job today already) and let the kernel just use the UART for sending and receiving characters. We use the recent refactoring to build a new struct uart_ops variable which points to some new functions avoiding access to the missing registers. We reuse as much existing PL011 code as possible. In contrast to the PL011 the SBSA UART does not define any AMBA or PrimeCell relations, so we go with a pretty generic probe function which only uses platform device functions. A DT binding is provided with this patch, ACPI support is added in a separate one. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Tested-by: Mark Langsdorf <mlangsdo@redhat.com> Tested-by: Naresh Bhat <nbhat@cavium.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-24drivers: PL011: allow to supply fixed option stringAndre Przywara
The SBSA UART has a fixed baud rate and flow control setting, which cannot be changed or queried by software. Add a vendor specific property to always return fixed values when trying to read the console options. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Tested-by: Mark Langsdorf <mlangsdo@redhat.com> Tested-by: Naresh Bhat <nbhat@cavium.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-24drivers: PL011: allow avoiding UART enabling/disablingAndre Przywara
The SBSA UART should not be enabled or disabled (it is always on), and consequently the spec lacks the UART_CR register. Add a vendor specific property to skip disabling or enabling of the UART. This will be used later by the SBSA UART support. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Tested-by: Mark Langsdorf <mlangsdo@redhat.com> Tested-by: Naresh Bhat <nbhat@cavium.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-24drivers: PL011: move cts_event workaround into separate functionAndre Przywara
To avoid lines with more than 80 characters and to make the pl011_int() function more readable, move the workaround out into a separate function. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Tested-by: Mark Langsdorf <mlangsdo@redhat.com> Tested-by: Naresh Bhat <nbhat@cavium.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-24drivers: PL011: replace UART_MIS reading with _RIS & _IMSCAndre Przywara
The PL011 register UART_MIS is actually a bitwise AND of the UART_RIS and the UART_MISC register. Since the SBSA UART does not include the _MIS register, use the two separate registers to get the same behaviour. Since we are inside the spinlock and we read the _IMSC register only once, there should be no race issue. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Tested-by: Mark Langsdorf <mlangsdo@redhat.com> Tested-by: Naresh Bhat <nbhat@cavium.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-24drivers: PL011: refactor pl011_probe()Andre Przywara
Currently the pl011_probe() function is relying on some AMBA IDs and a device tree node to initialize the driver and a port. Both features are not necessarily required for the driver: - we lack AMBA IDs in the ARM SBSA generic UART and - we lack a DT node in ACPI systems. So lets refactor the function to ease later reuse. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Tested-by: Mark Langsdorf <mlangsdo@redhat.com> Tested-by: Naresh Bhat <nbhat@cavium.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-24drivers: PL011: refactor pl011_set_termios()Andre Przywara
Split the pl011_set_termios() function into smaller chunks to allow easier reuse later when adding SBSA support. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Tested-by: Mark Langsdorf <mlangsdo@redhat.com> Tested-by: Naresh Bhat <nbhat@cavium.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-24drivers: PL011: refactor pl011_shutdown()Andre Przywara
Split the pl011_shutdown() function into smaller chunks to allow easier reuse later when adding SBSA support. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Tested-by: Mark Langsdorf <mlangsdo@redhat.com> Tested-by: Naresh Bhat <nbhat@cavium.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-24drivers: PL011: refactor pl011_startup()Andre Przywara
Split the pl011_startup() function into smaller chunks to allow easier reuse later when adding SBSA support. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Tested-by: Mark Langsdorf <mlangsdo@redhat.com> Tested-by: Naresh Bhat <nbhat@cavium.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-24drivers: PL011: avoid potential unregister_driver callAndre Przywara
Although we care about not unregistering the driver if there are still ports connected during the .remove callback, we do miss this check in the pl011_probe function. So if the current port allocation fails, but there are other ports already registered, we will kill those. So factor out the port removal into a separate function and use that in the probe function, too. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Tested-by: Mark Langsdorf <mlangsdo@redhat.com> Tested-by: Naresh Bhat <nbhat@cavium.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-19serial/amba-pl011: Fix mismerge between v4.1-rc4 and tty-nextDave Martin
In commit 02730d3c053a9af1d402e1c8dc8bbbc5a1340406 (Merge 4.1-rc4 into tty-next), git mismerged some lines, reintroducing a reference to the removed field uart_amba_port.tx_irq_seen. This causes a build failure. This patch removes the mismerged lines, restoring the code to what was in tty-next (which was the intention). Signed-off-by: Dave Martin <Dave.Martin@arm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-18Merge 4.1-rc4 into tty-nextGreg Kroah-Hartman
This resolves some tty driver merge issues. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-09Revert "serial/amba-pl011: Leave the TX IRQ alone when the UART is not open"Dave Martin
This reverts commit f2ee6dfa0e8597eea8b98d240b0033994e20d215. Jakub Kiciński observed that this patch can cause the pl011 driver to hang if if the only process with a pl011 port open is killed by a signal, pl011_shutdown() can get called with an arbitrary amount of data still in the FIFO. Calling _shutdown() with the TX FIFO non-empty is questionable behaviour and my itself be a bug. Since the affected patch was speculative anyway, and brings limited benefit, the simplest course is to remove the assumption that TXIS will always be left asserted after the port is shut down. Signed-off-by: Dave Martin <Dave.Martin@arm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-06serial/amba-pl011: Refactor and simplify TX FIFO handlingDave Martin
Commit 734745c serial/amba-pl011: Activate TX IRQ passively adds some complexity and overhead in the form of a softirq mechanism for transmitting in the absence of interrupts. This patch simplifies the code flow to reduce the reliance on subtle behaviour and avoid fragility under future maintenance. To this end, the TX softirq mechanism is removed and instead pl011_start_tx() will now simply stuff the FIFO until full (guaranteeing future TX IRQs), or until there are no more chars to write (in which case we don't care whether an IRQ happens). Signed-off-by: Dave Martin <Dave.Martin@arm.com> Signed-off-by: Jakub Kicinski <kubakici@wp.pl> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-06Revert "serial/amba-pl011: Leave the TX IRQ alone when the UART is not open"Dave Martin
This reverts commit f2ee6dfa0e8597eea8b98d240b0033994e20d215. Jakub Kiciński observed that this patch can cause the pl011 driver to hang if if the only process with a pl011 port open is killed by a signal, pl011_shutdown() can get called with an arbitrary amount of data still in the FIFO. Calling _shutdown() with the TX FIFO non-empty is questionable behaviour and my itself be a bug. Since the affected patch was speculative anyway, and brings limited benefit, the simplest course is to remove the assumption that TXIS will always be left asserted after the port is shut down. Signed-off-by: Dave Martin <Dave.Martin@arm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-11drivers/tty: serial: remove info messageJorge Ramirez-Ortiz
Unacceptable levels of debug info will happen when the DMA driver defined in the DT/ACPI is a blacklisted module. Another cause for log polution would be the defer probing of the DMA driver taking too long - in which case the message that this commit removes would be cluttering the logs due to the init daemons activity. Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org> Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-07drivers/tty: amba: defer DMA probe until the DMA channel is required.Jorge Ramirez-Ortiz
Fix a race condition that happens when device_initcall(pl011_dma_initicall) is executed before all the devices have been probed - this issue was observed on a hisi_6220 SoC (HiKey board from Linaro). The deferred driver probing framework relies on late_initcall to trigger deferred probes so it is just possible that, even with a valid DMA driver ready to be loaded, we fail to synchronize with it. The proposed implementation delays probing the DMA until dma_startup. As this is invoked on port startup and port resume - but DMA probing is only required once - we avoid calling multiple times using a new field in uart_amba_port to track this scenario. This commit allows for subsequent attempts to associate an external DMA if the DMA driver itself is not available (but present in the deferred probe pending list). Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org> Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-07serial/amba-pl011: Leave the TX IRQ alone when the UART is not openDave Martin
Getting the TX IRQ re-asserted from scratch can be inefficient in some setups. This patch avoids clearing the TX IRQ across pl011_shutdown()... pl011_startup(), so that if the port is closed and reopened, the IRQ will still work afterwards without having to bootstrap it again. The TX IRQ continues to be masked in IMSC when the UART is not in use. Signed-off-by: Dave Martin <Dave.Martin@arm.com> Tested-by: Andre Przywara <andre.przywara@arm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-07serial/amba-pl011: Activate TX IRQ passivelyDave Martin
The current PL011 driver transmits a dummy character when the UART is opened, to assert the TX IRQ for the first time (see pl011_startup()). The UART is put in loopback mode temporarily, so the receiver presumably shouldn't see anything. However... At least some platforms containing a PL011 send characters down the wire even when loopback mode is enabled. This means that a spurious NUL character may be seen at the receiver when the PL011 is opened through the TTY layer. The current code also temporarily sets the baud rate to maximum and the character width to the minimum, to that the dummy TX completes as quickly as possible. If this is seen by the receiver it will result in a framing error and can knock the receiver out of sync -- turning subsequent output into garbage until synchronisation is reestablished. (Particularly problematic during boot with systemd.) To avoid spurious transmissions, this patch removes assumptions about whether the TX IRQ will fire until at least one TX IRQ has been seen. Instead, the UART will unmask the TX IRQ and then slow-start via polling and timer-based soft IRQs initially. If the TTY layer writes enough data to fill the FIFO to the interrupt threshold in one go, the TX IRQ should assert, at which point the driver changes to fully interrupt-driven TX. In this way, the TX IRQ is activated as a side-effect instead of being done deliberately. This should also mean that the driver works on the SBSA Generic UART[1] (a cut-down PL011) without invasive changes. The Generic UART lacks some features needed for the dummy TX approach to work (FIFO disabling and loopback). [1] Server Base System Architecture (ARM-DEN-0029-v2.3) http://infocenter.arm.com/ (click-thru required :/) Signed-off-by: Dave Martin <Dave.Martin@arm.com> Tested-by: Andre Przywara <andre.przywara@arm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07serial: pl011: Add device tree support for RX DMA pollingAndrew Jackson
Add equivalent attributes to those provided in the platform data for use when RX DMA is enabled. Signed-off-by: Andrew Jackson <Andrew.Jackson@arm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07serial: pl011: Don't enable RX DMA if residue processing not supportedAndrew Jackson
If the DMA engine doesn't support residue processing then the RX DMA handling won't work terribly well if polling is enabled. So, disable RX DMA if residue handling isn't available. Signed-off-by: Andrew Jackson <Andrew.Jackson@arm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07serial: pl011: Set length of DMA transferAndrew Jackson
The DMA engines on some systems require that the dma_length is set when using scatter gather lists. Signed-off-by: Andrew Jackson <Andrew.Jackson@arm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07serial: pl011: Avoid assumptions about buffer size when refilling TX DMAAndrew Jackson
The existing code assumed that PL011_DMA_BUFFER_SIZE == UART_XMIT_SIZE, which may not always be the case. This allows for these two being different sizes and not copying too much data. Signed-off-by: Andrew Jackson <Andrew.Jackson@arm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-07serial: pl011: Allocate TX DMA buffer from DMA capable memoryAndrew Jackson
Allocating with __GFP_DMA avoids the need for bounce buffers Signed-off-by: Andrew Jackson <Andrew.Jackson@arm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-06serial: pl011: Fix build breakage with !CONFIG_DMA_ENGINEPeter Hurley
Commit 479e9b94fdce7bc4 ("serial: Refactor uart_flush_buffer() from uart_close") refactored the uart_flush_buffer() in uart_close() into those drivers that define a flush_buffer() method. However, in the amba-pl011 driver configured without CONFIG_DMA_ENGINE, flush_buffer() is a NULL method, so the direct call fails to compile. Check and call the flush_buffer() method through the ops table instead. Reported-by: Fengguang Wu <fengguang.wu@intel.com> Cc: Russell King <linux@arm.linux.org.uk> Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-05serial: Refactor uart_flush_buffer() from uart_close()Peter Hurley
In the context of the final tty & port close, flushing the tx ring buffer after the hardware has already been shutdown and the ring buffer freed is neither required nor desirable. uart_flush_buffer() performs 3 operations: 1. Resets tx ring buffer indices, but the tx ring buffer has already been freed and the indices are reset if the port is re-opened. 2. Calls uart driver's flush_buffer() method 5 in-tree uart drivers define flush_buffer() methods: amba-pl011, atmel-serial, imx, serial-tegra, timbuart These have been refactored into the shutdown() method, if required. 3. Kicks the ldisc for more writing, but this is undesirable. The file handle is being released; any waiting writer will will be kicked out by tty_release() with a warning. Further, the N_TTY ldisc may generate SIGIO for a file handle which is no longer valid. Cc: Nicolas Ferre <nicolas.ferre@atmel.com> Cc: Russell King <linux@arm.linux.org.uk> Cc: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-08serial: amba-pl011: Use container_of() to get uart_amba_portDaniel Thompson
Universally adopt container_of() for all pointer conversion from uart_port to uart_amba_port. Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org> Cc: Peter Hurley <peter@hurleysoftware.com> Cc: Russell King <linux@arm.linux.org.uk> Cc: Jiri Slaby <jslaby@suse.cz> Cc: linux-serial@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-09serial: amba-pl011: Remove redundant labelTushar Behera
The label 'out' is only used to return the error code. We can return the error code directly and remove 'out' label. Signed-off-by: Tushar Behera <tushar.b@samsung.com> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-19serial: Fix IGNBRK handlingPeter Hurley
If IGNBRK is set without either BRKINT or PARMRK set, some uart drivers send a 0x00 byte for BREAK without the TTYBREAK flag to the line discipline, when it should send either nothing or the TTYBREAK flag set. This happens because the read_status_mask masks out the BI condition, which uart_insert_char() then interprets as a normal 0x00 byte. SUS v3 is clear regarding the meaning of IGNBRK; Section 11.2.2, General Terminal Interface - Input Modes, states: "If IGNBRK is set, a break condition detected on input shall be ignored; that is, not put on the input queue and therefore not read by any process." Fix read_status_mask to include the BI bit if IGNBRK is set; the lsr status retains the BI bit if a BREAK is recv'd, which is subsequently ignored in uart_insert_char() when masked with the ignore_status_mask. Affected drivers: 8250 - all serial_txx9 mfd amba-pl010 amba-pl011 atmel_serial bfin_uart dz ip22zilog max310x mxs-auart netx-serial pnx8xxx_uart pxa sb1250-duart sccnxp serial_ks8695 sirfsoc_uart st-asc vr41xx_siu zs sunzilog fsl_lpuart sunsab ucc_uart bcm63xx_uart sunsu efm32-uart pmac_zilog mpsc msm_serial m32r_sio Unaffected drivers: omap-serial rp2 sa1100 imx icom Annotated for fixes: altera_uart mcf Drivers without break detection: 21285 xilinx-uartps altera_jtaguart apbuart arc-uart clps711x max3100 uartlite msm_serial_hs nwpserial lantiq vt8500_serial Unknown: samsung mpc52xx_uart bfin_sport_uart cpm_uart/core Fixes: Bugzilla #71651, '8250_core.c incorrectly handles IGNBRK flag' Reported-by: Ivan <athlon_@mail.ru> Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-20tty/serial: pl011: add DT based earlycon supportRob Herring
Enable DT based earlycon initialization for the pl011 uart. Signed-off-by: Rob Herring <robh@kernel.org> Cc: Russell King <linux@arm.linux.org.uk> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Jiri Slaby <jslaby@suse.cz> Acked-by: Grant Likely <grant.likely@linaro.org>
2014-04-24tty/serial: pl011: add generic earlycon supportRob Herring
Add earlycon support for the pl011 serial port. This allows enabling the pl011 for console when early_params are processed. This is based on the arm64 earlyprintk support and is intended to replace it. Signed-off-by: Rob Herring <robh@kernel.org> Cc: Russell King <linux@arm.linux.org.uk> Cc: Jiri Slaby <jslaby@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-04-16serial: amba-pl011: fix regression, causing an Oops on rmmodGuennadi Liakhovetski
A recent commit ef2889f7ffee67f0aed49e854c72be63f1466759 "serial: pl011: Move uart_register_driver call to device probe" introduced a regression, causing the pl011 driver to Oops if more than 1 port have been probed. Fix the Oops by only calling uart_unregister_driver() once after the last port has been removed. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-04-16serial: pl011: change Rx burst size to half of trigger levelGuennadi Liakhovetski
The amba-pl011.c driver sets DMA burst size equal to FIFO trigger level. If now exactly DMA burst size bytes are received, the DMAC will retrieve them all and no Rx timeout interrupt will be generated. To fix that set the burst size to half the FIFO trigger level. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-13serial: pl011: Move uart_register_driver call to device probeTushar Behera
uart_register_driver call binds the driver to a specific device node through tty_register_driver call. This should typically happen during device probe call. In a multiplatform scenario, it is possible that multiple serial drivers are part of the kernel. Currently the driver registration fails if multiple serial drivers with same default major/minor numbers are included in the kernel. A typical case is observed with amba-pl011 and samsung-uart drivers. Signed-off-by: Tushar Behera <tushar.behera@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-17serial: pl011: fix fall back from DMA to interrupt modeGuennadi Liakhovetski
When falling back from DMA to interrupt mode the receive interrupt has to be re-enabled to catch new incoming data. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-17serial: pl011: (cosmetic) remove superfluous register writeGuennadi Liakhovetski
In pl011_rx_chars() if pl011_dma_rx_trigger_dma() succeeds it will disable the receive interrupt, no need to do this again. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-17serial: amba-pl011: preseserve hardware settings during initialisationJon Medhurst
During initialisation, a UART may already be in use for a console, so take care to preserve things like baud rate and data format to avoid corrupting console output. Signed-off-by: Jon Medhurst <tixy@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>