Skip to contentSkip to conversation

serial: sc16is7xx: device tree improvements

PATCH Superseded Hugo Villeneuve 4 participants 20 messages Sep 20, 2023 – Sep 27, 2023

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover serial: sc16is7xx: device tree improvements

From: Hugo Villeneuve <[email protected]>

Hello,
this patch series improves DT properties naming and handling, and converts sc16is7xx bindings from text to YAML.

Patch 1 make sure we use the device_property APIs when configuring irda mode.

Patch 2 is in preparation for patch 3, to make sure we recognize "nxp,irda-mode-ports" DT property as well as the (soon to be) legacy property "irda-mode-ports".

Patch 3 adds a vendor prefix to irda-mode-ports property.

Patch 4 is the actual conversion of bindings to YAML. Conversion to YAML has been suggested by Andy Shevchenko during review for another patch series for the sc16is7xx:

Thank you.

Hugo Villeneuve (4):
serial: sc16is7xx: use device_property APIs when configuring irda mode
serial: sc16is7xx: recognize "nxp,irda-mode-ports" DT property
dt-bindings: sc16is7xx: add vendor prefix to irda-mode-ports property
dt-bindings: sc16is7xx: convert to YAML

 .../bindings/serial/nxp,sc16is7xx.txt         | 118 ----------------
 .../bindings/serial/nxp,sc16is7xx.yaml        | 126 ++++++++++++++++++
 drivers/tty/serial/sc16is7xx.c                |  40 ++++--
 3 files changed, 156 insertions(+), 128 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/serial/nxp,sc16is7xx.txt
 create mode 100644 Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml

base-commit: c980248179d655d33af47f0b0bec1ce8660994c6

Signature · 1 line
2.30.2
#1 lore raw

PATCH 1/4 serial: sc16is7xx: use device_property APIs when configuring irda mode

From: Hugo Villeneuve <[email protected]>

Convert driver to be property provider agnostic and allow it to be used on non-OF platforms.

---
 drivers/tty/serial/sc16is7xx.c | 34 ++++++++++++++++++++++++----------
 1 file changed, 24 insertions(+), 10 deletions(-)
drivers/tty/serial/sc16is7xx.c +24 -10
index 1fe2c3e08a35..db2bb1c0d36c 100644
@@ -1408,6 +1408,29 @@ static int sc16is7xx_setup_gpio_chip(struct sc16is7xx_port *s)
 }
 #endif
 
+static void sc16is7xx_setup_irda_ports(struct sc16is7xx_port *s)
+{
+	int i;
+	int ret;
+	int count;
+	u32 irda_port[2];
+	struct device *dev = s->p[0].port.dev;
+
+	count = device_property_count_u32(dev, "irda-mode-ports");
+	if (count < 0 || count > ARRAY_SIZE(irda_port))
+		return;
+
+	ret = device_property_read_u32_array(dev, "irda-mode-ports",
+					     irda_port, count);
+	if (ret)
+		return;
+
+	for (i = 0; i < count; i++) {
+		if (irda_port[i] < s->devtype->nr_uart)
+			s->p[irda_port[i]].irda_mode = true;
+	}
+}
+
 /*
  * Configure ports designated to operate as modem control lines.
  */
@@ -1590,16 +1613,7 @@ static int sc16is7xx_probe(struct device *dev,
 		sc16is7xx_power(&s->p[i].port, 0);
 	}
 
-	if (dev->of_node) {
-		struct property *prop;
-		const __be32 *p;
-		u32 u;
-
-		of_property_for_each_u32(dev->of_node, "irda-mode-ports",
-					 prop, p, u)
-			if (u < devtype->nr_uart)
-				s->p[u].irda_mode = true;
-	}
+	sc16is7xx_setup_irda_ports(s);
 
 	ret = sc16is7xx_setup_mctrl_ports(s);
 	if (ret)
Signature · 1 line
2.30.2
#2 lore raw

PATCH 2/4 serial: sc16is7xx: recognize "nxp,irda-mode-ports" DT property

In reply to Hugo Villeneuve

From: Hugo Villeneuve <[email protected]>

Vendor prefix "nxp," will be added in an upcoming commit to DT binding property "irda-mode-ports".

Prepare to recognize this new property "nxp,irda-mode-ports" and retain backward compatibility with old DTBs by falling back to "irda-mode-ports" when needed.

---
 drivers/tty/serial/sc16is7xx.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/tty/serial/sc16is7xx.c +9 -3
index db2bb1c0d36c..b0154e901358 100644
@@ -1415,13 +1415,19 @@ static void sc16is7xx_setup_irda_ports(struct sc16is7xx_port *s)
 	int count;
 	u32 irda_port[2];
 	struct device *dev = s->p[0].port.dev;
+	const char *prop_name = "nxp,irda-mode-ports";
+
+	count = device_property_count_u32(dev, prop_name);
+	if (count < 0) {
+		/* For backward compatibility with old DTBs. */
+		prop_name = "irda-mode-ports";
+		count = device_property_count_u32(dev, prop_name);
+	}
 
-	count = device_property_count_u32(dev, "irda-mode-ports");
 	if (count < 0 || count > ARRAY_SIZE(irda_port))
 		return;
 
-	ret = device_property_read_u32_array(dev, "irda-mode-ports",
-					     irda_port, count);
+	ret = device_property_read_u32_array(dev, prop_name, irda_port, count);
 	if (ret)
 		return;
 
Signature · 1 line
2.30.2
#3 lore raw

PATCH 3/4 dt-bindings: sc16is7xx: add vendor prefix to irda-mode-ports property

In reply to Hugo Villeneuve

From: Hugo Villeneuve <[email protected]>

The NXP-specific "irda-mode-ports" property lacks a proper vendor prefix. Add "nxp," prefix to comply with DT best practises.

---
 .../devicetree/bindings/serial/nxp,sc16is7xx.txt          | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
Documentation/devicetree/bindings/serial/nxp,sc16is7xx.txt +4 -4
index 1a7e4bff0456..d89815c5c562 100644
@@ -21,8 +21,8 @@ Optional properties:
   the second cell is used to specify the GPIO polarity:
     0 = active high,
     1 = active low.
-- irda-mode-ports: An array that lists the indices of the port that
-		   should operate in IrDA mode.
+- nxp,irda-mode-ports: An array that lists the indices of the port that
+		       should operate in IrDA mode.
 - nxp,modem-control-line-ports: An array that lists the indices of the port that
 				should have shared GPIO lines configured as
 				modem control lines.
@@ -80,8 +80,8 @@ Optional properties:
   the second cell is used to specify the GPIO polarity:
     0 = active high,
     1 = active low.
-- irda-mode-ports: An array that lists the indices of the port that
-		   should operate in IrDA mode.
+- nxp,irda-mode-ports: An array that lists the indices of the port that
+		       should operate in IrDA mode.
 - nxp,modem-control-line-ports: An array that lists the indices of the port that
 				should have shared GPIO lines configured as
 				modem control lines.
Signature · 1 line
2.30.2
Acked-by on v1 3/4
#4 lore raw

Re: [PATCH 3/4] dt-bindings: sc16is7xx: add vendor prefix to irda-mode-ports property

Quoted 4 lines · Hugo Villeneuve

From: Hugo Villeneuve <[email protected]>

The NXP-specific "irda-mode-ports" property lacks a proper vendor prefix. Add "nxp," prefix to comply with DT best practises.

Looks like you've made changes to the driver in a way both will work,

Cheers,
Conor.

Quoted 35 lines
---
 .../devicetree/bindings/serial/nxp,sc16is7xx.txt          | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
Documentation/devicetree/bindings/serial/nxp,sc16is7xx.txt +4 -4
index 1a7e4bff0456..d89815c5c562 100644
@@ -21,8 +21,8 @@ Optional properties:
   the second cell is used to specify the GPIO polarity:
     0 = active high,
     1 = active low.
-- irda-mode-ports: An array that lists the indices of the port that
-		   should operate in IrDA mode.
+- nxp,irda-mode-ports: An array that lists the indices of the port that
+		       should operate in IrDA mode.
 - nxp,modem-control-line-ports: An array that lists the indices of the port that
 				should have shared GPIO lines configured as
 				modem control lines.
@@ -80,8 +80,8 @@ Optional properties:
   the second cell is used to specify the GPIO polarity:
     0 = active high,
     1 = active low.
-- irda-mode-ports: An array that lists the indices of the port that
-		   should operate in IrDA mode.
+- nxp,irda-mode-ports: An array that lists the indices of the port that
+		       should operate in IrDA mode.
 - nxp,modem-control-line-ports: An array that lists the indices of the port that
 				should have shared GPIO lines configured as
 				modem control lines.
Signature · 1 line
2.30.2
maintainer
#5 lore raw

Re: [PATCH 3/4] dt-bindings: sc16is7xx: add vendor prefix to irda-mode-ports property

In reply to Hugo Villeneuve
Quoted 4 lines · Hugo Villeneuve

From: Hugo Villeneuve <[email protected]>

The NXP-specific "irda-mode-ports" property lacks a proper vendor prefix. Add "nxp," prefix to comply with DT best practises.

The opposite direction would be worth carrying in the driver, but I don't think adding a vendor prefix is. I would just leave this as-is.

Rob

#6 lore raw

Re: [PATCH 3/4] dt-bindings: sc16is7xx: add vendor prefix to irda-mode-ports property

Quoted 10 lines · On Thu, 21 Sep 2023 11:24:24 -0500 Rob Herring <[email protected]> wrote:
Quoted 4 lines · Hugo Villeneuve

From: Hugo Villeneuve <[email protected]>

The NXP-specific "irda-mode-ports" property lacks a proper vendor prefix. Add "nxp," prefix to comply with DT best practises.

The opposite direction would be worth carrying in the driver, but I don't think adding a vendor prefix is. I would just leave this as-is.

Rob

Hi Rob,
I am not following you, can you clarify?

Hugo.

maintainer
#7 lore raw

Re: [PATCH 3/4] dt-bindings: sc16is7xx: add vendor prefix to irda-mode-ports property

Quoted 10 lines · Hugo Villeneuve
Quoted 6 lines · On Thu, 21 Sep 2023 11:24:24 -0500 Rob Herring <[email protected]> wrote:
Quoted 4 lines · Hugo Villeneuve

From: Hugo Villeneuve <[email protected]>

The NXP-specific "irda-mode-ports" property lacks a proper vendor prefix. Add "nxp," prefix to comply with DT best practises.

Quoted 7 lines
Quoted 4 lines

The opposite direction would be worth carrying in the driver, but I don't think adding a vendor prefix is. I would just leave this as-is.

Rob

Hi Rob,
I am not following you, can you clarify?

Just keep the property as-is and don't add a 'nxp,' prefixed version. It's not worth carrying the fallback in the driver.

If you were dropping a vendor prefix from a property, then that's worth it because there might be other users added.

Rob

#8 lore raw

Re: [PATCH 3/4] dt-bindings: sc16is7xx: add vendor prefix to irda-mode-ports property

Quoted 19 lines · On Fri, 22 Sep 2023 14:52:06 -0500 Rob Herring <[email protected]> wrote:
Quoted 10 lines · Hugo Villeneuve
Quoted 6 lines · On Thu, 21 Sep 2023 11:24:24 -0500 Rob Herring <[email protected]> wrote:
Quoted 4 lines · Hugo Villeneuve

From: Hugo Villeneuve <[email protected]>

The NXP-specific "irda-mode-ports" property lacks a proper vendor prefix. Add "nxp," prefix to comply with DT best practises.

Quoted 7 lines
Quoted 4 lines

The opposite direction would be worth carrying in the driver, but I don't think adding a vendor prefix is. I would just leave this as-is.

Rob

Hi Rob,
I am not following you, can you clarify?

Quoted 7 lines

Just keep the property as-is and don't add a 'nxp,' prefixed version. It's not worth carrying the fallback in the driver.

If you were dropping a vendor prefix from a property, then that's worth it because there might be other users added.

Rob

Hi Rob,
ok, then I will drop this patch as well as the other titled 'serial: sc16is7xx: recognize "nxp,irda-mode-ports" DT property' for V2.

Hugo.

#9 lore raw

Re: [PATCH 3/4] dt-bindings: sc16is7xx: add vendor prefix to irda-mode-ports property

In reply to Hugo Villeneuve

Hugo Villeneuve wrote on 2023-09-20 17:20:

Quoted 12 lines
Documentation/devicetree/bindings/serial/nxp,sc16is7xx.txt +1 -2
@@ -21,8 +21,8 @@ Optional properties:
   the second cell is used to specify the GPIO polarity:
     0 = active high,
     1 = active low.
-- irda-mode-ports: An array that lists the indices of the port that
-		   should operate in IrDA mode.
+- nxp,irda-mode-ports: An array that lists the indices of the port 

that

Documentation/devicetree/bindings/serial/nxp,sc16is7xx.txt +1 -0
+		       should operate in IrDA mode.
 - nxp,modem-control-line-ports: An array that lists the indices of
Quoted 1 line

the port that

Are you sure you want this line removed?

Quoted 12 lines
Documentation/devicetree/bindings/serial/nxp,sc16is7xx.txt +1 -2
 				should have shared GPIO lines configured as
 				modem control lines.
@@ -80,8 +80,8 @@ Optional properties:
   the second cell is used to specify the GPIO polarity:
     0 = active high,
     1 = active low.
-- irda-mode-ports: An array that lists the indices of the port that
-		   should operate in IrDA mode.
+- nxp,irda-mode-ports: An array that lists the indices of the port 

that

Documentation/devicetree/bindings/serial/nxp,sc16is7xx.txt +1 -0
+		       should operate in IrDA mode.
 - nxp,modem-control-line-ports: An array that lists the indices of
Quoted 1 line

the port that

Same here.

Documentation/devicetree/bindings/serial/nxp,sc16is7xx.txt

Quoted 2 lines
Documentation/devicetree/bindings/serial/nxp,sc16is7xx.txt +0 -0
 				should have shared GPIO lines configured as
 				modem control lines.

Greets,
Maarten

#10 lore raw

Re: [PATCH 3/4] dt-bindings: sc16is7xx: add vendor prefix to irda-mode-ports property

Quoted 16 lines · On Thu, 21 Sep 2023 12:29:13 +0200 [email protected] wrote:

Hugo Villeneuve wrote on 2023-09-20 17:20:

Quoted 12 lines
Documentation/devicetree/bindings/serial/nxp,sc16is7xx.txt +1 -2
@@ -21,8 +21,8 @@ Optional properties:
   the second cell is used to specify the GPIO polarity:
     0 = active high,
     1 = active low.
-- irda-mode-ports: An array that lists the indices of the port that
-		   should operate in IrDA mode.
+- nxp,irda-mode-ports: An array that lists the indices of the port 

that

Documentation/devicetree/bindings/serial/nxp,sc16is7xx.txt +1 -0
+		       should operate in IrDA mode.
 - nxp,modem-control-line-ports: An array that lists the indices of
Quoted 1 line

the port that

Are you sure you want this line removed?

Hi Maarten,
the line "- nxp,modem-control-line-ports..." is not removed, but because it starts with a dash in the source file, maybe it is confusing when looking at the patch only?

Hugo.

Quoted 24 lines
Quoted 13 lines
Documentation/devicetree/bindings/serial/nxp,sc16is7xx.txt +1 -2
 				should have shared GPIO lines configured as
 				modem control lines.
@@ -80,8 +80,8 @@ Optional properties:
   the second cell is used to specify the GPIO polarity:
     0 = active high,
     1 = active low.
-- irda-mode-ports: An array that lists the indices of the port that
-		   should operate in IrDA mode.
+- nxp,irda-mode-ports: An array that lists the indices of the port 

that

Documentation/devicetree/bindings/serial/nxp,sc16is7xx.txt +1 -0
+		       should operate in IrDA mode.
 - nxp,modem-control-line-ports: An array that lists the indices of
Quoted 1 line

the port that

Same here.

Documentation/devicetree/bindings/serial/nxp,sc16is7xx.txt

Quoted 2 lines
Documentation/devicetree/bindings/serial/nxp,sc16is7xx.txt +0 -0
 				should have shared GPIO lines configured as
 				modem control lines.

Greets,
Maarten

#11 lore raw

PATCH 4/4 dt-bindings: sc16is7xx: convert to YAML

In reply to Hugo Villeneuve

From: Hugo Villeneuve <[email protected]>

Convert binding from text format to YAML.

Additions to original text binding:
- add rs485 reference.

---
 .../bindings/serial/nxp,sc16is7xx.txt         | 118 ----------------
 .../bindings/serial/nxp,sc16is7xx.yaml        | 126 ++++++++++++++++++
 2 files changed, 126 insertions(+), 118 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/serial/nxp,sc16is7xx.txt
 create mode 100644 Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml
Documentation/devicetree/bindings/serial/nxp,sc16is7xx.txt deleted +0 -118
deleted file mode 100644
index d89815c5c562..000000000000
@@ -1,118 +0,0 @@
-* NXP SC16IS7xx advanced Universal Asynchronous Receiver-Transmitter (UART)
-* i2c as bus
-
-Required properties:
-- compatible: Should be one of the following:
-  - "nxp,sc16is740" for NXP SC16IS740,
-  - "nxp,sc16is741" for NXP SC16IS741,
-  - "nxp,sc16is750" for NXP SC16IS750,
-  - "nxp,sc16is752" for NXP SC16IS752,
-  - "nxp,sc16is760" for NXP SC16IS760,
-  - "nxp,sc16is762" for NXP SC16IS762.
-- reg: I2C address of the SC16IS7xx device.
-- interrupts: Should contain the UART interrupt
-- clocks: Reference to the IC source clock.
-	OR (when there is no clock provider visible to the platform)
-- clock-frequency: The source clock frequency for the IC.
-
-Optional properties:
-- gpio-controller: Marks the device node as a GPIO controller.
-- #gpio-cells: Should be two. The first cell is the GPIO number and
-  the second cell is used to specify the GPIO polarity:
-    0 = active high,
-    1 = active low.
-- nxp,irda-mode-ports: An array that lists the indices of the port that
-		       should operate in IrDA mode.
-- nxp,modem-control-line-ports: An array that lists the indices of the port that
-				should have shared GPIO lines configured as
-				modem control lines.
-
-Example:
-        sc16is750: sc16is750@51 {
-                compatible = "nxp,sc16is750";
-                reg = <0x51>;
-                clocks = <&clk20m>;
-                interrupt-parent = <&gpio3>;
-                interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
-                gpio-controller;
-                #gpio-cells = <2>;
-        };
-
-	sc16is752: sc16is752@53 {
-		compatible = "nxp,sc16is752";
-		reg = <0x53>;
-		clocks = <&clk20m>;
-		interrupt-parent = <&gpio3>;
-		interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
-		nxp,modem-control-line-ports = <1>; /* Port 1 as modem control lines */
-		gpio-controller; /* Port 0 as GPIOs */
-		#gpio-cells = <2>;
-	};
-
-	sc16is752: sc16is752@54 {
-		compatible = "nxp,sc16is752";
-		reg = <0x54>;
-		clocks = <&clk20m>;
-		interrupt-parent = <&gpio3>;
-		interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
-		nxp,modem-control-line-ports = <0 1>; /* Ports 0 and 1 as modem control lines */
-	};
-
-* spi as bus
-
-Required properties:
-- compatible: Should be one of the following:
-  - "nxp,sc16is740" for NXP SC16IS740,
-  - "nxp,sc16is741" for NXP SC16IS741,
-  - "nxp,sc16is750" for NXP SC16IS750,
-  - "nxp,sc16is752" for NXP SC16IS752,
-  - "nxp,sc16is760" for NXP SC16IS760,
-  - "nxp,sc16is762" for NXP SC16IS762.
-- reg: SPI chip select number.
-- interrupts: Specifies the interrupt source of the parent interrupt
-  controller. The format of the interrupt specifier depends on the
-  parent interrupt controller.
-- clocks: phandle to the IC source clock.
-
-Optional properties:
-- gpio-controller: Marks the device node as a GPIO controller.
-- #gpio-cells: Should be two. The first cell is the GPIO number and
-  the second cell is used to specify the GPIO polarity:
-    0 = active high,
-    1 = active low.
-- nxp,irda-mode-ports: An array that lists the indices of the port that
-		       should operate in IrDA mode.
-- nxp,modem-control-line-ports: An array that lists the indices of the port that
-				should have shared GPIO lines configured as
-				modem control lines.
-
-Example:
-	sc16is750: sc16is750@0 {
-		compatible = "nxp,sc16is750";
-		reg = <0>;
-		clocks = <&clk20m>;
-		interrupt-parent = <&gpio3>;
-		interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
-		gpio-controller;
-		#gpio-cells = <2>;
-	};
-
-	sc16is752: sc16is752@1 {
-		compatible = "nxp,sc16is752";
-		reg = <1>;
-		clocks = <&clk20m>;
-		interrupt-parent = <&gpio3>;
-		interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
-		nxp,modem-control-line-ports = <1>; /* Port 1 as modem control lines */
-		gpio-controller; /* Port 0 as GPIOs */
-		#gpio-cells = <2>;
-	};
-
-	sc16is752: sc16is752@2 {
-		compatible = "nxp,sc16is752";
-		reg = <2>;
-		clocks = <&clk20m>;
-		interrupt-parent = <&gpio3>;
-		interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
-		nxp,modem-control-line-ports = <0 1>; /* Ports 0 and 1 as modem control lines */
-	};
Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml new file +126 -0

126 lines not on this page · raw message

Signature · 1 line
2.30.2
maintainer
#12 lore raw

Re: [PATCH 4/4] dt-bindings: sc16is7xx: convert to YAML

Quoted 7 lines · Hugo Villeneuve

From: Hugo Villeneuve <[email protected]>

Convert binding from text format to YAML.

Additions to original text binding:
- add rs485 reference.

Quoted 8 lines
---
 .../bindings/serial/nxp,sc16is7xx.txt         | 118 ----------------
 .../bindings/serial/nxp,sc16is7xx.yaml        | 126 ++++++++++++++++++
 2 files changed, 126 insertions(+), 118 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/serial/nxp,sc16is7xx.txt
 create mode 100644 Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
Documentation/devicetree/bindings/serial/nxp,sc16is7xx.example.dts:27.13-26: Warning (reg_format): /example-0/serial@51:reg: property has invalid length (4 bytes) (#address-cells == 1, #size-cells == 1) Documentation/devicetree/bindings/serial/nxp,sc16is7xx.example.dts:37.13-26: Warning (reg_format): /example-0/serial@53:reg: property has invalid length (4 bytes) (#address-cells == 1, #size-cells == 1) Documentation/devicetree/bindings/serial/nxp,sc16is7xx.example.dts:48.13-26: Warning (reg_format): /example-0/serial@54:reg: property has invalid length (4 bytes) (#address-cells == 1, #size-cells == 1) Documentation/devicetree/bindings/serial/nxp,sc16is7xx.example.dtb: Warning (pci_device_reg): Failed prerequisite 'reg_format' Documentation/devicetree/bindings/serial/nxp,sc16is7xx.example.dtb: Warning (pci_device_bus_num): Failed prerequisite 'reg_format' Documentation/devicetree/bindings/serial/nxp,sc16is7xx.example.dtb: Warning (simple_bus_reg): Failed prerequisite 'reg_format' Documentation/devicetree/bindings/serial/nxp,sc16is7xx.example.dtb: Warning (i2c_bus_reg): Failed prerequisite 'reg_format' Documentation/devicetree/bindings/serial/nxp,sc16is7xx.example.dtb: Warning (spi_bus_reg): Failed prerequisite 'reg_format'

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]

The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.

#13 lore raw

Re: [PATCH 4/4] dt-bindings: sc16is7xx: convert to YAML

Quoted 23 lines · On Wed, 20 Sep 2023 18:13:10 -0500 Rob Herring <[email protected]> wrote:
Quoted 7 lines · Hugo Villeneuve

From: Hugo Villeneuve <[email protected]>

Convert binding from text format to YAML.

Additions to original text binding:
- add rs485 reference.

Quoted 8 lines
---
 .../bindings/serial/nxp,sc16is7xx.txt         | 118 ----------------
 .../bindings/serial/nxp,sc16is7xx.yaml        | 126 ++++++++++++++++++
 2 files changed, 126 insertions(+), 118 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/serial/nxp,sc16is7xx.txt
 create mode 100644 Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

Quoted 9 lines

dtschema/dtc warnings/errors:
Documentation/devicetree/bindings/serial/nxp,sc16is7xx.example.dts:27.13-26: Warning (reg_format): /example-0/serial@51:reg: property has invalid length (4 bytes) (#address-cells == 1, #size-cells == 1) Documentation/devicetree/bindings/serial/nxp,sc16is7xx.example.dts:37.13-26: Warning (reg_format): /example-0/serial@53:reg: property has invalid length (4 bytes) (#address-cells == 1, #size-cells == 1) Documentation/devicetree/bindings/serial/nxp,sc16is7xx.example.dts:48.13-26: Warning (reg_format): /example-0/serial@54:reg: property has invalid length (4 bytes) (#address-cells == 1, #size-cells == 1) Documentation/devicetree/bindings/serial/nxp,sc16is7xx.example.dtb: Warning (pci_device_reg): Failed prerequisite 'reg_format' Documentation/devicetree/bindings/serial/nxp,sc16is7xx.example.dtb: Warning (pci_device_bus_num): Failed prerequisite 'reg_format' Documentation/devicetree/bindings/serial/nxp,sc16is7xx.example.dtb: Warning (simple_bus_reg): Failed prerequisite 'reg_format' Documentation/devicetree/bindings/serial/nxp,sc16is7xx.example.dtb: Warning (i2c_bus_reg): Failed prerequisite 'reg_format' Documentation/devicetree/bindings/serial/nxp,sc16is7xx.example.dtb: Warning (spi_bus_reg): Failed prerequisite 'reg_format'

Hi Rob,
will fix it for V2.

I was already using 'make DT_CHECKER_FLAGS=-m dt_binding_check', but I incorrectly introduced a space between DT_SCHEMA_FILES= and the filename, and so it was ignored and all schemas were checked, and I lost the warnings in all the noise. I now have fixed it.

Also, if someone is interested, I was trying to specify multiple files with DT_SCHEMA_FILES, and I just found out (after analysing the Makefile) that you need to separate them with the ":" character. It would be a good thing to add it to the documentation, I could submit a patch for this if you like.

Thank you,
Hugo.

Quoted 18 lines

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]

The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.

#14 lore raw

Re: [PATCH 4/4] dt-bindings: sc16is7xx: convert to YAML

In reply to Hugo Villeneuve

Hey,

Quoted 21 lines · Hugo Villeneuve

From: Hugo Villeneuve <[email protected]>

Convert binding from text format to YAML.

Additions to original text binding:
- add rs485 reference.

---
 .../bindings/serial/nxp,sc16is7xx.txt         | 118 ----------------
 .../bindings/serial/nxp,sc16is7xx.yaml        | 126 ++++++++++++++++++
 2 files changed, 126 insertions(+), 118 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/serial/nxp,sc16is7xx.txt
 create mode 100644 Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml
Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml new file +0 -0
new file mode 100644
index 000000000000..508639e09e06

Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml line 7

Quoted 7 lines
Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml new file +7 -0
@@ -0,0 +1,126 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/serial/nxp,sc16is7xx.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NXP SC16IS7xx advanced Universal Asynchronous Receiver-Transmitter (UART)

nit, but my OCD was triggered - capitalise the a in "advanced"?

Quoted 13 lines
Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml new file +13 -0
+
+maintainers:
+  - Hugo Villeneuve <[email protected]>
+
+properties:
+  compatible:
+    enum:
+      - nxp,sc16is740
+      - nxp,sc16is741
+      - nxp,sc16is750
+      - nxp,sc16is752
+      - nxp,sc16is760
+      - nxp,sc16is762

Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml line 30

Quoted 10 lines
Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml new file +10 -0
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+    description: Reference to the IC source clock.

You could probably drop this, if it only has one clock it's a bit redundant.

Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml line 32

Quoted 2 lines
Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml new file +2 -0
+  clock-frequency:
+    description: |

This | should not be needed here, there's no formatting to preserve.

Quoted 55 lines
Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml new file +55 -0
+      When there is no clock provider visible to the platform, this
+      is the source crystal or external clock frequency for the IC in Hz.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 1
+    maximum: 80000000
+
+  gpio-controller:
+    description: Marks the device node as a GPIO controller.
+    type: boolean
+
+  "#gpio-cells":
+    const: 2
+
+  gpio-line-names:
+    minItems: 1
+    maxItems: 8
+
+  nxp,irda-mode-ports:
+    description: |
+      An array that lists the indices of the port that should operate in IrDA
+      mode:
+      0: port A
+      1: port B
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+    minItems: 1
+    maxItems: 2
+    items:
+      minimum: 0
+      maximum: 1
+
+  nxp,modem-control-line-ports:
+    description: |
+      An array that lists the indices of the port that should have shared GPIO
+      lines configured as modem control lines:
+      0: port A
+      1: port B
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+    minItems: 1
+    maxItems: 2
+    items:
+      minimum: 0
+      maximum: 1
+
+allOf:
+  - $ref: /schemas/spi/spi-peripheral-props.yaml#
+  - $ref: /schemas/serial/serial.yaml#
+  - $ref: /schemas/serial/rs485.yaml#
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+oneOf:
+  - required:

Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml line 98

Quoted 10 lines
Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml new file +10 -0
+      - clocks
+  - required:
+      - clock-frequency
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    serial0: serial@51 {

These labels are not used and should be removed.

Otherwise, conversion looks aight to me.

Thanks,
Conor.

Quoted 31 lines
Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml new file +28 -0
+        compatible = "nxp,sc16is750";
+        reg = <0x51>;
+        clocks = <&clk20m>;
+        interrupt-parent = <&gpio3>;
+        interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
+        gpio-controller;
+        #gpio-cells = <2>;
+    };
+
+    serial1: serial@53 {
+        compatible = "nxp,sc16is752";
+        reg = <0x53>;
+        clocks = <&clk20m>;
+        interrupt-parent = <&gpio3>;
+        interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
+        nxp,modem-control-line-ports = <1>; /* Port 1 as modem control lines */
+        gpio-controller; /* Port 0 as GPIOs */
+        #gpio-cells = <2>;
+    };
+
+    serial2: serial@54 {
+        compatible = "nxp,sc16is752";
+        reg = <0x54>;
+        clocks = <&clk20m>;
+        interrupt-parent = <&gpio3>;
+        interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
+        nxp,modem-control-line-ports = <0 1>; /* Ports 0 and 1 as modem control lines */
+    };
Signature · 1 line
2.30.2
#15 lore raw

Re: [PATCH 4/4] dt-bindings: sc16is7xx: convert to YAML

Quoted 18 lines · On Thu, 21 Sep 2023 14:45:06 +0100 Conor Dooley <[email protected]> wrote:

Hey,

Quoted 14 lines · Hugo Villeneuve

From: Hugo Villeneuve <[email protected]>

Convert binding from text format to YAML.

Additions to original text binding:
- add rs485 reference.

---
 .../bindings/serial/nxp,sc16is7xx.txt         | 118 ----------------
 .../bindings/serial/nxp,sc16is7xx.yaml        | 126 ++++++++++++++++++
 2 files changed, 126 insertions(+), 118 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/serial/nxp,sc16is7xx.txt
 create mode 100644 Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml
Quoted 15 lines

Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml line 7

Quoted 13 lines
Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml new file +7 -0
new file mode 100644
index 000000000000..508639e09e06
@@ -0,0 +1,126 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/serial/nxp,sc16is7xx.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NXP SC16IS7xx advanced Universal Asynchronous Receiver-Transmitter (UART)

nit, but my OCD was triggered - capitalise the a in "advanced"?

Hi Conor,
no problem, I like that :)
Will fix it for V2.

Quoted 18 lines
Quoted 18 lines
Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml new file +18 -0
+
+maintainers:
+  - Hugo Villeneuve <[email protected]>
+
+properties:
+  compatible:
+    enum:
+      - nxp,sc16is740
+      - nxp,sc16is741
+      - nxp,sc16is750
+      - nxp,sc16is752
+      - nxp,sc16is760
+      - nxp,sc16is762
+
+  reg:
+    maxItems: 1
+
+  interrupts:
Quoted 8 lines

Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml line 30

Quoted 5 lines
Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml new file +5 -0
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+    description: Reference to the IC source clock.

You could probably drop this, if it only has one clock it's a bit redundant.

I don't understand, because there is already a 'clocks' property in the examples (and also in my real board DTS file) and if I remove it here it will cause a warning:

serial@51: Unevaluated properties are not allowed ('clocks' was unexpected)

Quoted 4 lines

Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml line 32

Quoted 2 lines
Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml new file +2 -0
+  clock-frequency:
+    description: |

This | should not be needed here, there's no formatting to preserve.

Done.

Quoted 60 lines
Quoted 60 lines
Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml new file +59 -0
+      When there is no clock provider visible to the platform, this
+      is the source crystal or external clock frequency for the IC in Hz.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 1
+    maximum: 80000000
+
+  gpio-controller:
+    description: Marks the device node as a GPIO controller.
+    type: boolean
+
+  "#gpio-cells":
+    const: 2
+
+  gpio-line-names:
+    minItems: 1
+    maxItems: 8
+
+  nxp,irda-mode-ports:
+    description: |
+      An array that lists the indices of the port that should operate in IrDA
+      mode:
+      0: port A
+      1: port B
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+    minItems: 1
+    maxItems: 2
+    items:
+      minimum: 0
+      maximum: 1
+
+  nxp,modem-control-line-ports:
+    description: |
+      An array that lists the indices of the port that should have shared GPIO
+      lines configured as modem control lines:
+      0: port A
+      1: port B
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+    minItems: 1
+    maxItems: 2
+    items:
+      minimum: 0
+      maximum: 1
+
+allOf:
+  - $ref: /schemas/spi/spi-peripheral-props.yaml#
+  - $ref: /schemas/serial/serial.yaml#
+  - $ref: /schemas/serial/rs485.yaml#
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+oneOf:
+  - required:
+      - clocks
+  - required:
+      - clock-frequency
+
Quoted 8 lines

Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml line 98

Quoted 6 lines
Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml new file +6 -0
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    serial0: serial@51 {

These labels are not used and should be removed.

Done.

Thank you,
Hugo.

Quoted 36 lines

Otherwise, conversion looks aight to me.

Thanks,
Conor.

Quoted 31 lines
Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml new file +28 -0
+        compatible = "nxp,sc16is750";
+        reg = <0x51>;
+        clocks = <&clk20m>;
+        interrupt-parent = <&gpio3>;
+        interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
+        gpio-controller;
+        #gpio-cells = <2>;
+    };
+
+    serial1: serial@53 {
+        compatible = "nxp,sc16is752";
+        reg = <0x53>;
+        clocks = <&clk20m>;
+        interrupt-parent = <&gpio3>;
+        interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
+        nxp,modem-control-line-ports = <1>; /* Port 1 as modem control lines */
+        gpio-controller; /* Port 0 as GPIOs */
+        #gpio-cells = <2>;
+    };
+
+    serial2: serial@54 {
+        compatible = "nxp,sc16is752";
+        reg = <0x54>;
+        clocks = <&clk20m>;
+        interrupt-parent = <&gpio3>;
+        interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
+        nxp,modem-control-line-ports = <0 1>; /* Ports 0 and 1 as modem control lines */
+    };
Signature · 1 line
2.30.2
#16 lore raw

Re: [PATCH 4/4] dt-bindings: sc16is7xx: convert to YAML

Quoted 11 lines · Hugo Villeneuve
Quoted 8 lines · On Thu, 21 Sep 2023 14:45:06 +0100 Conor Dooley <[email protected]> wrote:

Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml line 30

Quoted 3 lines · Hugo Villeneuve
Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml new file +3 -0
+  clocks:
+    maxItems: 1
+    description: Reference to the IC source clock.

You could probably drop this, if it only has one clock it's a bit redundant.

Quoted 6 lines

I don't understand, because there is already a 'clocks' property in the examples (and also in my real board DTS file) and if I remove it here it will cause a warning:

serial@51: Unevaluated properties are not allowed ('clocks' was unexpected)

Sorry, I was talking about the description.

#17 lore raw

Re: [PATCH 4/4] dt-bindings: sc16is7xx: convert to YAML

Quoted 12 lines · On Fri, 22 Sep 2023 12:35:07 +0100 Conor Dooley <[email protected]> wrote:
Quoted 11 lines · Hugo Villeneuve
Quoted 8 lines · On Thu, 21 Sep 2023 14:45:06 +0100 Conor Dooley <[email protected]> wrote:

Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml line 30

Quoted 3 lines · Hugo Villeneuve
Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml new file +3 -0
+  clocks:
+    maxItems: 1
+    description: Reference to the IC source clock.

You could probably drop this, if it only has one clock it's a bit redundant.

Quoted 8 lines
Quoted 6 lines

I don't understand, because there is already a 'clocks' property in the examples (and also in my real board DTS file) and if I remove it here it will cause a warning:

serial@51: Unevaluated properties are not allowed ('clocks' was unexpected)

Sorry, I was talking about the description.

OK, makes sense. I will remove it.

Hugo.

maintainer
#18 lore raw

Re: [PATCH 4/4] dt-bindings: sc16is7xx: convert to YAML

In reply to Hugo Villeneuve
Quoted 171 lines · Hugo Villeneuve

From: Hugo Villeneuve <[email protected]>

Convert binding from text format to YAML.

Additions to original text binding:
- add rs485 reference.

---
 .../bindings/serial/nxp,sc16is7xx.txt         | 118 ----------------
 .../bindings/serial/nxp,sc16is7xx.yaml        | 126 ++++++++++++++++++
 2 files changed, 126 insertions(+), 118 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/serial/nxp,sc16is7xx.txt
 create mode 100644 Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml
Documentation/devicetree/bindings/serial/nxp,sc16is7xx.txt deleted +0 -118
deleted file mode 100644
index d89815c5c562..000000000000
@@ -1,118 +0,0 @@
-* NXP SC16IS7xx advanced Universal Asynchronous Receiver-Transmitter (UART)
-* i2c as bus
-
-Required properties:
-- compatible: Should be one of the following:
-  - "nxp,sc16is740" for NXP SC16IS740,
-  - "nxp,sc16is741" for NXP SC16IS741,
-  - "nxp,sc16is750" for NXP SC16IS750,
-  - "nxp,sc16is752" for NXP SC16IS752,
-  - "nxp,sc16is760" for NXP SC16IS760,
-  - "nxp,sc16is762" for NXP SC16IS762.
-- reg: I2C address of the SC16IS7xx device.
-- interrupts: Should contain the UART interrupt
-- clocks: Reference to the IC source clock.
-	OR (when there is no clock provider visible to the platform)
-- clock-frequency: The source clock frequency for the IC.
-
-Optional properties:
-- gpio-controller: Marks the device node as a GPIO controller.
-- #gpio-cells: Should be two. The first cell is the GPIO number and
-  the second cell is used to specify the GPIO polarity:
-    0 = active high,
-    1 = active low.
-- nxp,irda-mode-ports: An array that lists the indices of the port that
-		       should operate in IrDA mode.
-- nxp,modem-control-line-ports: An array that lists the indices of the port that
-				should have shared GPIO lines configured as
-				modem control lines.
-
-Example:
-        sc16is750: sc16is750@51 {
-                compatible = "nxp,sc16is750";
-                reg = <0x51>;
-                clocks = <&clk20m>;
-                interrupt-parent = <&gpio3>;
-                interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
-                gpio-controller;
-                #gpio-cells = <2>;
-        };
-
-	sc16is752: sc16is752@53 {
-		compatible = "nxp,sc16is752";
-		reg = <0x53>;
-		clocks = <&clk20m>;
-		interrupt-parent = <&gpio3>;
-		interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
-		nxp,modem-control-line-ports = <1>; /* Port 1 as modem control lines */
-		gpio-controller; /* Port 0 as GPIOs */
-		#gpio-cells = <2>;
-	};
-
-	sc16is752: sc16is752@54 {
-		compatible = "nxp,sc16is752";
-		reg = <0x54>;
-		clocks = <&clk20m>;
-		interrupt-parent = <&gpio3>;
-		interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
-		nxp,modem-control-line-ports = <0 1>; /* Ports 0 and 1 as modem control lines */
-	};
-
-* spi as bus
-
-Required properties:
-- compatible: Should be one of the following:
-  - "nxp,sc16is740" for NXP SC16IS740,
-  - "nxp,sc16is741" for NXP SC16IS741,
-  - "nxp,sc16is750" for NXP SC16IS750,
-  - "nxp,sc16is752" for NXP SC16IS752,
-  - "nxp,sc16is760" for NXP SC16IS760,
-  - "nxp,sc16is762" for NXP SC16IS762.
-- reg: SPI chip select number.
-- interrupts: Specifies the interrupt source of the parent interrupt
-  controller. The format of the interrupt specifier depends on the
-  parent interrupt controller.
-- clocks: phandle to the IC source clock.
-
-Optional properties:
-- gpio-controller: Marks the device node as a GPIO controller.
-- #gpio-cells: Should be two. The first cell is the GPIO number and
-  the second cell is used to specify the GPIO polarity:
-    0 = active high,
-    1 = active low.
-- nxp,irda-mode-ports: An array that lists the indices of the port that
-		       should operate in IrDA mode.
-- nxp,modem-control-line-ports: An array that lists the indices of the port that
-				should have shared GPIO lines configured as
-				modem control lines.
-
-Example:
-	sc16is750: sc16is750@0 {
-		compatible = "nxp,sc16is750";
-		reg = <0>;
-		clocks = <&clk20m>;
-		interrupt-parent = <&gpio3>;
-		interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
-		gpio-controller;
-		#gpio-cells = <2>;
-	};
-
-	sc16is752: sc16is752@1 {
-		compatible = "nxp,sc16is752";
-		reg = <1>;
-		clocks = <&clk20m>;
-		interrupt-parent = <&gpio3>;
-		interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
-		nxp,modem-control-line-ports = <1>; /* Port 1 as modem control lines */
-		gpio-controller; /* Port 0 as GPIOs */
-		#gpio-cells = <2>;
-	};
-
-	sc16is752: sc16is752@2 {
-		compatible = "nxp,sc16is752";
-		reg = <2>;
-		clocks = <&clk20m>;
-		interrupt-parent = <&gpio3>;
-		interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
-		nxp,modem-control-line-ports = <0 1>; /* Ports 0 and 1 as modem control lines */
-	};
Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml new file +26 -0
new file mode 100644
index 000000000000..508639e09e06
@@ -0,0 +1,126 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/serial/nxp,sc16is7xx.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NXP SC16IS7xx advanced Universal Asynchronous Receiver-Transmitter (UART)
+
+maintainers:
+  - Hugo Villeneuve <[email protected]>
+
+properties:
+  compatible:
+    enum:
+      - nxp,sc16is740
+      - nxp,sc16is741
+      - nxp,sc16is750
+      - nxp,sc16is752
+      - nxp,sc16is760
+      - nxp,sc16is762
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1

Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml line 36

Quoted 10 lines
Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml new file +10 -0
+
+  clocks:
+    maxItems: 1
+    description: Reference to the IC source clock.
+
+  clock-frequency:
+    description: |
+      When there is no clock provider visible to the platform, this
+      is the source crystal or external clock frequency for the IC in Hz.
+    $ref: /schemas/types.yaml#/definitions/uint32

Don't need a type here. 'clock-frequency' is already defined.

Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml line 42

Quoted 6 lines
Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml new file +6 -0
+    minimum: 1
+    maximum: 80000000
+
+  gpio-controller:
+    description: Marks the device node as a GPIO controller.
+    type: boolean

Just:

gpio-controller: true

#19 lore raw

Re: [PATCH 4/4] dt-bindings: sc16is7xx: convert to YAML

Quoted 176 lines · On Thu, 21 Sep 2023 10:33:19 -0500 Rob Herring <[email protected]> wrote:
Quoted 175 lines · Hugo Villeneuve

From: Hugo Villeneuve <[email protected]>

Convert binding from text format to YAML.

Additions to original text binding:
- add rs485 reference.

---
 .../bindings/serial/nxp,sc16is7xx.txt         | 118 ----------------
 .../bindings/serial/nxp,sc16is7xx.yaml        | 126 ++++++++++++++++++
 2 files changed, 126 insertions(+), 118 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/serial/nxp,sc16is7xx.txt
 create mode 100644 Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml
Documentation/devicetree/bindings/serial/nxp,sc16is7xx.txt deleted +0 -118
deleted file mode 100644
index d89815c5c562..000000000000
@@ -1,118 +0,0 @@
-* NXP SC16IS7xx advanced Universal Asynchronous Receiver-Transmitter (UART)
-* i2c as bus
-
-Required properties:
-- compatible: Should be one of the following:
-  - "nxp,sc16is740" for NXP SC16IS740,
-  - "nxp,sc16is741" for NXP SC16IS741,
-  - "nxp,sc16is750" for NXP SC16IS750,
-  - "nxp,sc16is752" for NXP SC16IS752,
-  - "nxp,sc16is760" for NXP SC16IS760,
-  - "nxp,sc16is762" for NXP SC16IS762.
-- reg: I2C address of the SC16IS7xx device.
-- interrupts: Should contain the UART interrupt
-- clocks: Reference to the IC source clock.
-	OR (when there is no clock provider visible to the platform)
-- clock-frequency: The source clock frequency for the IC.
-
-Optional properties:
-- gpio-controller: Marks the device node as a GPIO controller.
-- #gpio-cells: Should be two. The first cell is the GPIO number and
-  the second cell is used to specify the GPIO polarity:
-    0 = active high,
-    1 = active low.
-- nxp,irda-mode-ports: An array that lists the indices of the port that
-		       should operate in IrDA mode.
-- nxp,modem-control-line-ports: An array that lists the indices of the port that
-				should have shared GPIO lines configured as
-				modem control lines.
-
-Example:
-        sc16is750: sc16is750@51 {
-                compatible = "nxp,sc16is750";
-                reg = <0x51>;
-                clocks = <&clk20m>;
-                interrupt-parent = <&gpio3>;
-                interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
-                gpio-controller;
-                #gpio-cells = <2>;
-        };
-
-	sc16is752: sc16is752@53 {
-		compatible = "nxp,sc16is752";
-		reg = <0x53>;
-		clocks = <&clk20m>;
-		interrupt-parent = <&gpio3>;
-		interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
-		nxp,modem-control-line-ports = <1>; /* Port 1 as modem control lines */
-		gpio-controller; /* Port 0 as GPIOs */
-		#gpio-cells = <2>;
-	};
-
-	sc16is752: sc16is752@54 {
-		compatible = "nxp,sc16is752";
-		reg = <0x54>;
-		clocks = <&clk20m>;
-		interrupt-parent = <&gpio3>;
-		interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
-		nxp,modem-control-line-ports = <0 1>; /* Ports 0 and 1 as modem control lines */
-	};
-
-* spi as bus
-
-Required properties:
-- compatible: Should be one of the following:
-  - "nxp,sc16is740" for NXP SC16IS740,
-  - "nxp,sc16is741" for NXP SC16IS741,
-  - "nxp,sc16is750" for NXP SC16IS750,
-  - "nxp,sc16is752" for NXP SC16IS752,
-  - "nxp,sc16is760" for NXP SC16IS760,
-  - "nxp,sc16is762" for NXP SC16IS762.
-- reg: SPI chip select number.
-- interrupts: Specifies the interrupt source of the parent interrupt
-  controller. The format of the interrupt specifier depends on the
-  parent interrupt controller.
-- clocks: phandle to the IC source clock.
-
-Optional properties:
-- gpio-controller: Marks the device node as a GPIO controller.
-- #gpio-cells: Should be two. The first cell is the GPIO number and
-  the second cell is used to specify the GPIO polarity:
-    0 = active high,
-    1 = active low.
-- nxp,irda-mode-ports: An array that lists the indices of the port that
-		       should operate in IrDA mode.
-- nxp,modem-control-line-ports: An array that lists the indices of the port that
-				should have shared GPIO lines configured as
-				modem control lines.
-
-Example:
-	sc16is750: sc16is750@0 {
-		compatible = "nxp,sc16is750";
-		reg = <0>;
-		clocks = <&clk20m>;
-		interrupt-parent = <&gpio3>;
-		interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
-		gpio-controller;
-		#gpio-cells = <2>;
-	};
-
-	sc16is752: sc16is752@1 {
-		compatible = "nxp,sc16is752";
-		reg = <1>;
-		clocks = <&clk20m>;
-		interrupt-parent = <&gpio3>;
-		interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
-		nxp,modem-control-line-ports = <1>; /* Port 1 as modem control lines */
-		gpio-controller; /* Port 0 as GPIOs */
-		#gpio-cells = <2>;
-	};
-
-	sc16is752: sc16is752@2 {
-		compatible = "nxp,sc16is752";
-		reg = <2>;
-		clocks = <&clk20m>;
-		interrupt-parent = <&gpio3>;
-		interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
-		nxp,modem-control-line-ports = <0 1>; /* Ports 0 and 1 as modem control lines */
-	};
Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml new file +30 -0
new file mode 100644
index 000000000000..508639e09e06
@@ -0,0 +1,126 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/serial/nxp,sc16is7xx.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NXP SC16IS7xx advanced Universal Asynchronous Receiver-Transmitter (UART)
+
+maintainers:
+  - Hugo Villeneuve <[email protected]>
+
+properties:
+  compatible:
+    enum:
+      - nxp,sc16is740
+      - nxp,sc16is741
+      - nxp,sc16is750
+      - nxp,sc16is752
+      - nxp,sc16is760
+      - nxp,sc16is762
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+    description: Reference to the IC source clock.
Quoted 8 lines

Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml line 36

Quoted 6 lines
Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml new file +6 -0
+
+  clock-frequency:
+    description: |
+      When there is no clock provider visible to the platform, this
+      is the source crystal or external clock frequency for the IC in Hz.
+    $ref: /schemas/types.yaml#/definitions/uint32

Don't need a type here. 'clock-frequency' is already defined.

Hi Rob,
will be done for V2.

Quoted 10 lines

Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml line 42

Quoted 6 lines
Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml new file +6 -0
+    minimum: 1
+    maximum: 80000000
+
+  gpio-controller:
+    description: Marks the device node as a GPIO controller.
+    type: boolean

Just:

gpio-controller: true

Done.

Thank you,
Hugo.