Skip to contentSkip to conversation

staging: axis-fifo: convert bindings to YAML

PATCH In review Lucas Faria Mendes 2 participants 4 messages Feb 27 – Feb 28

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v3 cover staging: axis-fifo: convert bindings to YAML

Changes since v2:
- Fixed commit message formatting and content.
- Sent as a new thread as requested by the maintainer.
- Added a more detailed explanation for boolean conversion.
- Renamed example node to fifo as requested by maintainer.

Changes since v1:
- Converted use-rx/tx-data to booleans.
- Deleted legacy text binding.
- Renamed example node to dma-controller.

Lucas Faria Mendes (2):
dt-bindings: misc: xlnx,axi-fifo-mm-s: convert to json-schema
staging: axis-fifo: update driver to handle boolean DT properties

 .../bindings/misc/xlnx,axi-fifo-mm-s.yaml     | 95 ++++++++++++++++++
 drivers/staging/axis-fifo/axis-fifo.c         | 56 +++--------
 drivers/staging/axis-fifo/axis-fifo.txt       | 96 -------------------
 3 files changed, 109 insertions(+), 138 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/misc/xlnx,axi-fifo-mm-s.yaml
 delete mode 100644 drivers/staging/axis-fifo/axis-fifo.txt
Signature · 1 line
2.53.0
#1 lore raw

PATCH v3 1/2 dt-bindings: misc: xlnx,axi-fifo-mm-s: convert to json-schema

Convert the Xilinx AXI-Stream FIFO IP core bindings from legacy text format to modern YAML json-schema.

While converting, the following changes were made:
- Updated property types for 'xlnx,use-rx-data' and 'xlnx,use-tx-data' from uint32 to boolean, as they represent hardware features.
- Removed the rigid 32-bit constraint on data width properties to better reflect hardware capabilities.
- Renamed the example node to "fifo" to follow generic naming conventions.
- Removed the legacy text binding file.

---
 .../bindings/misc/xlnx,axi-fifo-mm-s.yaml     | 95 ++++++++++++++++++
 drivers/staging/axis-fifo/axis-fifo.txt       | 96 -------------------
 2 files changed, 95 insertions(+), 96 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/misc/xlnx,axi-fifo-mm-s.yaml
 delete mode 100644 drivers/staging/axis-fifo/axis-fifo.txt
Documentation/devicetree/bindings/misc/xlnx,axi-fifo-mm-s.yaml new file +95 -0
new file mode 100644
index 000000000000..b3e6a2189289
@@ -0,0 +1,95 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/misc/xlnx,axi-fifo-mm-s.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Xilinx AXI-Stream FIFO IP core
+
+maintainers:
+  - Jacob Feder <[email protected]>
+
+description: |
+  The Xilinx AXI-Stream FIFO IP core has read and write AXI-Stream FIFOs,
+  the contents of which can be accessed from the AXI4 memory-mapped interface.
+  This is useful for transferring data from a processor into the FPGA fabric.
+
+  See Xilinx PG080 document for IP details.
+
+  Currently supports only store-forward mode with a 32-bit AXI4-Lite
+  interface.
+
+properties:
+  compatible:
+    enum:
+      - xlnx,axi-fifo-mm-s-4.1
+      - xlnx,axi-fifo-mm-s-4.2
+      - xlnx,axi-fifo-mm-s-4.3
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  interrupt-names:
+    items:
+      - const: interrupt
+
+  xlnx,axi-str-rxd-tdata-width:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    const: 32
+    description:
+      AXI-Stream RX data width in bits. Only 32-bit is supported.
+
+  xlnx,axi-str-txd-tdata-width:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    const: 32
+    description:
+      AXI-Stream TX data width in bits. Only 32-bit is supported.
+
+  xlnx,rx-fifo-depth:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      Depth of RX FIFO in words.
+
+  xlnx,tx-fifo-depth:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      Depth of TX FIFO in words.
+
+  xlnx,use-rx-data:
+    type: boolean
+    description: RX FIFO is enabled.
+
+  xlnx,use-tx-data:
+    type: boolean
+    description: TX FIFO is enabled.
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - xlnx,axi-str-rxd-tdata-width
+  - xlnx,axi-str-txd-tdata-width
+  - xlnx,rx-fifo-depth
+  - xlnx,tx-fifo-depth
+  - xlnx,use-tx-data
+
+additionalProperties: false
+
+examples:
+  - |
+    fifo@43c00000 {
+        compatible = "xlnx,axi-fifo-mm-s-4.1";
+        reg = <0x43c00000 0x10000>;
+        interrupt-names = "interrupt";
+        interrupt-parent = <&intc>;
+        interrupts = <0 29 4>;
+        xlnx,axi-str-rxd-tdata-width = <0x20>;
+        xlnx,axi-str-txd-tdata-width = <0x20>;
+        xlnx,rx-fifo-depth = <0x200>;
+        xlnx,tx-fifo-depth = <0x8000>;
+        xlnx,use-tx-data;
+    };
+
drivers/staging/axis-fifo/axis-fifo.txt deleted +0 -96

96 lines not on this page · raw message

Signature · 1 line
2.53.0
#2 lore raw

Re: [PATCH v3 1/2] dt-bindings: misc: xlnx,axi-fifo-mm-s: convert to json-schema

Quoted 10 lines · Lucas Faria Mendes

Convert the Xilinx AXI-Stream FIFO IP core bindings from legacy text format to modern YAML json-schema.

While converting, the following changes were made:
- Updated property types for 'xlnx,use-rx-data' and 'xlnx,use-tx-data' from uint32 to boolean, as they represent hardware features.
- Removed the rigid 32-bit constraint on data width properties to better reflect hardware capabilities.
- Renamed the example node to "fifo" to follow generic naming conventions.
- Removed the legacy text binding file.

Last is not the change made in conversion. It is THE conversion. Drop.

You also dropped 15 more properties without any explanation!

Documentation/devicetree/bindings/misc/xlnx,axi-fifo-mm-s.yaml

Quoted 14 lines
---
 .../bindings/misc/xlnx,axi-fifo-mm-s.yaml     | 95 ++++++++++++++++++
 drivers/staging/axis-fifo/axis-fifo.txt       | 96 -------------------
 2 files changed, 95 insertions(+), 96 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/misc/xlnx,axi-fifo-mm-s.yaml
 delete mode 100644 drivers/staging/axis-fifo/axis-fifo.txt
Documentation/devicetree/bindings/misc/xlnx,axi-fifo-mm-s.yaml new file +0 -0
new file mode 100644
index 000000000000..b3e6a2189289

You need to respond to previous review you received.

So again - isn't this DMA? or some part of Xilinx SoC? Or FPGA interface? Because for sure this is not a "misc" device.

Quoted 11 lines
Documentation/devicetree/bindings/misc/xlnx,axi-fifo-mm-s.yaml new file +10 -0
@@ -0,0 +1,95 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/misc/xlnx,axi-fifo-mm-s.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Xilinx AXI-Stream FIFO IP core
+
+maintainers:
+  - Jacob Feder <[email protected]>

Documentation/devicetree/bindings/misc/xlnx,axi-fifo-mm-s.yaml line 20

Quoted 10 lines
Documentation/devicetree/bindings/misc/xlnx,axi-fifo-mm-s.yaml new file +10 -0
+
+description: |
+  The Xilinx AXI-Stream FIFO IP core has read and write AXI-Stream FIFOs,
+  the contents of which can be accessed from the AXI4 memory-mapped interface.
+  This is useful for transferring data from a processor into the FPGA fabric.
+
+  See Xilinx PG080 document for IP details.
+
+  Currently supports only store-forward mode with a 32-bit AXI4-Lite
+  interface.

Binding describes hardware, so are you saying hardware supports it or what exactly?

Quoted 7 lines
Documentation/devicetree/bindings/misc/xlnx,axi-fifo-mm-s.yaml new file +7 -0
+
+properties:
+  compatible:
+    enum:
+      - xlnx,axi-fifo-mm-s-4.1
+      - xlnx,axi-fifo-mm-s-4.2
+      - xlnx,axi-fifo-mm-s-4.3

Documentation/devicetree/bindings/misc/xlnx,axi-fifo-mm-s.yaml line 37

Quoted 10 lines
Documentation/devicetree/bindings/misc/xlnx,axi-fifo-mm-s.yaml new file +10 -0
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  interrupt-names:
+    items:
+      - const: interrupt

Pointless name, drop completely interrupt-names.

Documentation/devicetree/bindings/misc/xlnx,axi-fifo-mm-s.yaml line 43

Quoted 6 lines
Documentation/devicetree/bindings/misc/xlnx,axi-fifo-mm-s.yaml new file +6 -0
+
+  xlnx,axi-str-rxd-tdata-width:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    const: 32
+    description:
+      AXI-Stream RX data width in bits. Only 32-bit is supported.

1. Const? So drop it. You don't need that property at all. Plus I don't get why "supported" matters for us - supported by who?

2. Outstaging a binding means you do not preserve ABI but go via regular review, thus: Use standard properties, like bus-width etc. See dt-schema.

Quoted 14 lines
Documentation/devicetree/bindings/misc/xlnx,axi-fifo-mm-s.yaml new file +14 -0
+
+  xlnx,axi-str-txd-tdata-width:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    const: 32
+    description:
+      AXI-Stream TX data width in bits. Only 32-bit is supported.
+
+  xlnx,rx-fifo-depth:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      Depth of RX FIFO in words.
+
+  xlnx,tx-fifo-depth:
+    $ref: /schemas/types.yaml#/definitions/uint32

Documentation/devicetree/bindings/misc/xlnx,axi-fifo-mm-s.yaml line 67

Quoted 10 lines
Documentation/devicetree/bindings/misc/xlnx,axi-fifo-mm-s.yaml new file +10 -0
+    description:
+      Depth of TX FIFO in words.
+
+  xlnx,use-rx-data:
+    type: boolean
+    description: RX FIFO is enabled.
+
+  xlnx,use-tx-data:
+    type: boolean
+    description: TX FIFO is enabled.

I don't get why do you need properties to enable TX or RX. Is there any IP without one?

Quoted 11 lines
Documentation/devicetree/bindings/misc/xlnx,axi-fifo-mm-s.yaml new file +11 -0
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - xlnx,axi-str-rxd-tdata-width
+  - xlnx,axi-str-txd-tdata-width
+  - xlnx,rx-fifo-depth
+  - xlnx,tx-fifo-depth
+  - xlnx,use-tx-data
+

Documentation/devicetree/bindings/misc/xlnx,axi-fifo-mm-s.yaml line 88

Quoted 10 lines
Documentation/devicetree/bindings/misc/xlnx,axi-fifo-mm-s.yaml new file +10 -0
+additionalProperties: false
+
+examples:
+  - |
+    fifo@43c00000 {
+        compatible = "xlnx,axi-fifo-mm-s-4.1";
+        reg = <0x43c00000 0x10000>;
+        interrupt-names = "interrupt";
+        interrupt-parent = <&intc>;
+        interrupts = <0 29 4>;

Use proper defines.

Best regards,
Krzysztof

#3 lore raw

PATCH v3 2/2 staging: axis-fifo: update driver to handle boolean DT properties

In reply to Lucas Faria Mendes

The Device Tree bindings for the AXI-Stream FIFO were converted to json-schema, where 'xlnx,use-rx-data' and 'xlnx,use-tx-data' are now defined as boolean properties.

Update the driver to use of_property_read_bool() instead of of_property_read_u32() for these flags. Also, removed the fixed 32-bit data width check during DT parsing, as the driver should not enforce hardware constraints that are better handled by the schema validation or device initialization.

---
 drivers/staging/axis-fifo/axis-fifo.c | 56 +++++++--------------------
 1 file changed, 14 insertions(+), 42 deletions(-)
drivers/staging/axis-fifo/axis-fifo.c +14 -42
index aa90b27197cf..cdeb944fd354 100644
@@ -246,7 +246,8 @@ static ssize_t axis_fifo_write(struct file *f, const char __user *buf,
 		mutex_lock(&fifo->write_lock);
 
 		ret = wait_event_interruptible(fifo->write_queue,
-			ioread32(fifo->base_addr + XLLF_TDFV_OFFSET) >= words_to_write);
+					       ioread32(fifo->base_addr + XLLF_TDFV_OFFSET)
+					       >= words_to_write);
 		if (ret)
 			goto end_unlock;
 	}
@@ -386,66 +387,37 @@ static void axis_fifo_debugfs_init(struct axis_fifo *fifo)
 
 static int axis_fifo_parse_dt(struct axis_fifo *fifo)
 {
-	int ret;
-	unsigned int value;
 	struct device_node *node = fifo->dt_device->of_node;
+	int ret;
 
-	ret = of_property_read_u32(node, "xlnx,axi-str-rxd-tdata-width",
-				   &value);
+	ret = of_property_read_u32(node, "xlnx,axi-str-rxd-tdata-width", &ret);
 	if (ret) {
 		dev_err(fifo->dt_device, "missing xlnx,axi-str-rxd-tdata-width property\n");
-		goto end;
-	} else if (value != 32) {
-		dev_err(fifo->dt_device, "xlnx,axi-str-rxd-tdata-width only supports 32 bits\n");
-		ret = -EIO;
-		goto end;
+		return -EINVAL;
 	}
 
-	ret = of_property_read_u32(node, "xlnx,axi-str-txd-tdata-width",
-				   &value);
+	ret = of_property_read_u32(node, "xlnx,axi-str-txd-tdata-width", &ret);
 	if (ret) {
 		dev_err(fifo->dt_device, "missing xlnx,axi-str-txd-tdata-width property\n");
-		goto end;
-	} else if (value != 32) {
-		dev_err(fifo->dt_device, "xlnx,axi-str-txd-tdata-width only supports 32 bits\n");
-		ret = -EIO;
-		goto end;
+		return -EINVAL;
 	}
 
-	ret = of_property_read_u32(node, "xlnx,rx-fifo-depth",
-				   &fifo->rx_fifo_depth);
+	ret = of_property_read_u32(node, "xlnx,rx-fifo-depth", &fifo->rx_fifo_depth);
 	if (ret) {
 		dev_err(fifo->dt_device, "missing xlnx,rx-fifo-depth property\n");
-		ret = -EIO;
-		goto end;
+		return -EINVAL;
 	}
 
-	ret = of_property_read_u32(node, "xlnx,tx-fifo-depth",
-				   &fifo->tx_fifo_depth);
+	ret = of_property_read_u32(node, "xlnx,tx-fifo-depth", &fifo->tx_fifo_depth);
 	if (ret) {
 		dev_err(fifo->dt_device, "missing xlnx,tx-fifo-depth property\n");
-		ret = -EIO;
-		goto end;
-	}
-
-	ret = of_property_read_u32(node, "xlnx,use-rx-data",
-				   &fifo->has_rx_fifo);
-	if (ret) {
-		dev_err(fifo->dt_device, "missing xlnx,use-rx-data property\n");
-		ret = -EIO;
-		goto end;
+		return -EINVAL;
 	}
 
-	ret = of_property_read_u32(node, "xlnx,use-tx-data",
-				   &fifo->has_tx_fifo);
-	if (ret) {
-		dev_err(fifo->dt_device, "missing xlnx,use-tx-data property\n");
-		ret = -EIO;
-		goto end;
-	}
+	fifo->has_rx_fifo = of_property_read_bool(node, "xlnx,use-rx-data");
+	fifo->has_tx_fifo = of_property_read_bool(node, "xlnx,use-tx-data");
 
-end:
-	return ret;
+	return 0;
 }
 
 static int axis_fifo_probe(struct platform_device *pdev)
Signature · 1 line
2.53.0