amba_pl011: Add cts-event-workaround DT property
authorPhil Elwell <phil@raspberrypi.org>
Fri, 29 Sep 2017 09:32:19 +0000 (10:32 +0100)
committerRaspbian kernel package updater <root@raspbian.org>
Sat, 31 Mar 2018 14:55:30 +0000 (15:55 +0100)
The BCM2835 PL011 implementation seems to have a bug that can lead to a
transmission lockup if CTS changes frequently. A workaround was added to
the driver with a vendor-specific flag to enable it, but this flag is
currently not set for ARM implementations.

Add a "cts-event-workaround" property to Pi DTBs and use the presence
of that property to force the flag to be enabled in the driver.

See: https://github.com/raspberrypi/linux/issues/1280

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
Documentation/devicetree/bindings/serial/pl011.txt
arch/arm/boot/dts/bcm270x.dtsi
drivers/tty/serial/amba-pl011.c

index 77863aefe9ef1eafe648b530c1570333aea7940b..8d65b0ec2828b6abb07589407a5126fde6e49a0e 100644 (file)
@@ -35,6 +35,9 @@ Optional properties:
 - poll-timeout-ms:
           Poll timeout when auto-poll is set, default
           3000ms.
+- cts-event-workaround:
+          Enables the (otherwise vendor-specific) workaround for the
+          CTS-induced TX lockup.
 
 See also bindings/arm/primecell.txt
 
index caa66393518603529d284f360b2000b0ed4852ef..6af5a365137754160d6c700431ac6870639d7d41 100644 (file)
                        interrupts = <2 17>, <2 18>;
                };
 
+               serial@7e201000 { /* uart0 */
+                       /* Enable CTS bug workaround */
+                       cts-event-workaround;
+               };
+
                sdhost: sdhost@7e202000 {
                        compatible = "brcm,bcm2835-sdhost";
                        reg = <0x7e202000 0x100>;
index a17489a1174ef81ba3d85801fa27757579a9d2a3..460c7d3e2962509a69eee5208ced765306b3bc7a 100644 (file)
@@ -2578,6 +2578,11 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id)
        if (IS_ERR(uap->clk))
                return PTR_ERR(uap->clk);
 
+       if (of_property_read_bool(dev->dev.of_node, "cts-event-workaround")) {
+           vendor->cts_event_workaround = true;
+           dev_info(&dev->dev, "cts_event_workaround enabled\n");
+       }
+
        uap->reg_offset = vendor->reg_offset;
        uap->vendor = vendor;
        uap->fifosize = vendor->get_fifosize(dev);