Fix busy-detect when using DesignWare UART

uart_dev_ns8250 now relies on compatible property instead of additional
'busy-detect' cell. All drivers with compatible = "snps,dw-apb-uart" have
busy detection turned on. DTS files of devices affected by the change
were modified and 'busy-detect' property was removed.

Reviewed by:    andrew, ian, imp
Obtained from:  Semihalf
Sponsored by:   Stormshield
Submitted by:   Bartosz Szczepanek <bsz@semihalf.com>
Differential revision:  https://reviews.freebsd.org/D4218
This commit is contained in:
Zbigniew Bodek 2016-01-20 13:51:14 +00:00
parent a6c981778c
commit 8abfc69d11
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=294424
5 changed files with 15 additions and 22 deletions

View file

@ -111,45 +111,41 @@
};
serial0: serial@12000 {
compatible = "ns16550";
compatible = "snps,dw-apb-uart";
reg = <0x12000 0x20>;
reg-shift = <2>;
current-speed = <115200>;
clock-frequency = <0>;
busy-detect = <1>;
interrupts = <41>;
interrupt-parent = <&MPIC>;
};
serial1: serial@12100 {
compatible = "ns16550";
compatible = "snps,dw-apb-uart";
reg = <0x12100 0x20>;
reg-shift = <2>;
current-speed = <115200>;
clock-frequency = <0>;
busy-detect = <1>;
interrupts = <42>;
interrupt-parent = <&MPIC>;
};
serial2: serial@12200 {
compatible = "ns16550";
compatible = "snps,dw-apb-uart";
reg = <0x12200 0x20>;
reg-shift = <2>;
current-speed = <115200>;
clock-frequency = <0>;
busy-detect = <1>;
interrupts = <43>;
interrupt-parent = <&MPIC>;
};
serial3: serial@12300 {
compatible = "ns16550";
compatible = "snps,dw-apb-uart";
reg = <0x12300 0x20>;
reg-shift = <2>;
current-speed = <115200>;
clock-frequency = <0>;
busy-detect = <1>;
interrupts = <44>;
interrupt-parent = <&MPIC>;
};

View file

@ -179,53 +179,49 @@
};
uart0: serial@10124000 {
compatible = "ns16550";
compatible = "snps,dw-apb-uart";
reg = <0x10124000 0x400>;
reg-shift = <2>;
interrupts = <66>;
interrupt-parent = <&GIC>;
current-speed = <115200>;
clock-frequency = < 24000000 >;
busy-detect = <1>;
broken-txfifo = <1>;
status = "disabled";
};
uart1: serial@10126000 {
compatible = "ns16550";
compatible = "snps,dw-apb-uart";
reg = <0x10126000 0x400>;
reg-shift = <2>;
interrupts = <67>;
interrupt-parent = <&GIC>;
current-speed = <115200>;
clock-frequency = < 24000000 >;
busy-detect = <1>;
broken-txfifo = <1>;
status = "disabled";
};
uart2: serial@20064000 {
compatible = "ns16550";
compatible = "snps,dw-apb-uart";
reg = <0x20064000 0x400>;
reg-shift = <2>;
interrupts = <68>;
interrupt-parent = <&GIC>;
current-speed = <115200>;
clock-frequency = < 24000000 >;
busy-detect = <1>;
broken-txfifo = <1>;
status = "disabled";
};
uart3: serial@20068000 {
compatible = "ns16550";
compatible = "snps,dw-apb-uart";
reg = <0x20068000 0x400>;
reg-shift = <2>;
interrupts = <69>;
interrupt-parent = <&GIC>;
current-speed = <115200>;
clock-frequency = < 24000000 >;
busy-detect = <1>;
broken-txfifo = <1>;
status = "disabled";
};

View file

@ -120,14 +120,13 @@
};
UART0: serial@01c28000 {
compatible = "ns16550";
compatible = "snps,dw-apb-uart";
reg = <0x01c28000 0x400>;
reg-shift = <2>;
interrupts = <1>;
interrupt-parent = <&AINTC>;
current-speed = <115200>;
clock-frequency = < 24000000 >;
busy-detect = <1>;
};
emac@01c0b000 {

View file

@ -126,14 +126,13 @@
};
UART0: serial@01c28000 {
compatible = "ns16550";
compatible = "snps,dw-apb-uart";
reg = <0x01c28000 0x400>;
reg-shift = <2>;
interrupts = <1>;
interrupt-parent = <&GIC>;
current-speed = <115200>;
clock-frequency = < 24000000 >;
busy-detect = <1>;
};
emac@01c0b000 {

View file

@ -457,9 +457,12 @@ ns8250_bus_attach(struct uart_softc *sc)
* Check whether uart requires to read USR reg when IIR_BUSY and
* has broken txfifo.
*/
ns8250->busy_detect = ofw_bus_is_compatible(sc->sc_dev, "snps,dw-apb-uart");
node = ofw_bus_get_node(sc->sc_dev);
if ((OF_getencprop(node, "busy-detect", &cell, sizeof(cell))) > 0)
ns8250->busy_detect = cell ? 1 : 0;
/* XXX: This is kept for a short time for compatibility with older device trees */
if ((OF_getencprop(node, "busy-detect", &cell, sizeof(cell))) > 0
&& cell != 0)
ns8250->busy_detect = 1;
if ((OF_getencprop(node, "broken-txfifo", &cell, sizeof(cell))) > 0)
broken_txfifo = cell ? 1 : 0;
#endif