Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Jan 2016 13:51:15 +0000 (UTC)
From:      Zbigniew Bodek <zbb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r294424 - in head/sys: boot/fdt/dts/arm dev/uart
Message-ID:  <201601201351.u0KDpFJR065560@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: zbb
Date: Wed Jan 20 13:51:14 2016
New Revision: 294424
URL: https://svnweb.freebsd.org/changeset/base/294424

Log:
  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

Modified:
  head/sys/boot/fdt/dts/arm/db78460.dts
  head/sys/boot/fdt/dts/arm/rk3188.dtsi
  head/sys/boot/fdt/dts/arm/sun4i-a10.dtsi
  head/sys/boot/fdt/dts/arm/sun7i-a20.dtsi
  head/sys/dev/uart/uart_dev_ns8250.c

Modified: head/sys/boot/fdt/dts/arm/db78460.dts
==============================================================================
--- head/sys/boot/fdt/dts/arm/db78460.dts	Wed Jan 20 13:47:44 2016	(r294423)
+++ head/sys/boot/fdt/dts/arm/db78460.dts	Wed Jan 20 13:51:14 2016	(r294424)
@@ -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>;
 		};

Modified: head/sys/boot/fdt/dts/arm/rk3188.dtsi
==============================================================================
--- head/sys/boot/fdt/dts/arm/rk3188.dtsi	Wed Jan 20 13:47:44 2016	(r294423)
+++ head/sys/boot/fdt/dts/arm/rk3188.dtsi	Wed Jan 20 13:51:14 2016	(r294424)
@@ -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";
 		};

Modified: head/sys/boot/fdt/dts/arm/sun4i-a10.dtsi
==============================================================================
--- head/sys/boot/fdt/dts/arm/sun4i-a10.dtsi	Wed Jan 20 13:47:44 2016	(r294423)
+++ head/sys/boot/fdt/dts/arm/sun4i-a10.dtsi	Wed Jan 20 13:51:14 2016	(r294424)
@@ -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 {

Modified: head/sys/boot/fdt/dts/arm/sun7i-a20.dtsi
==============================================================================
--- head/sys/boot/fdt/dts/arm/sun7i-a20.dtsi	Wed Jan 20 13:47:44 2016	(r294423)
+++ head/sys/boot/fdt/dts/arm/sun7i-a20.dtsi	Wed Jan 20 13:51:14 2016	(r294424)
@@ -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 {

Modified: head/sys/dev/uart/uart_dev_ns8250.c
==============================================================================
--- head/sys/dev/uart/uart_dev_ns8250.c	Wed Jan 20 13:47:44 2016	(r294423)
+++ head/sys/dev/uart/uart_dev_ns8250.c	Wed Jan 20 13:51:14 2016	(r294424)
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601201351.u0KDpFJR065560>