Skip to contentSkip to conversation

tty: serial: meson: add amlogic,uart-fifosize property

PATCH In review Neil Armstrong 2 participants 7 messages Mar 25, 2021 – Apr 26, 2021

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

v2 cover tty: serial: meson: add amlogic,uart-fifosize property

On most of the Amlogic SoCs, the first UART controller in the "Everything-Else" power domain has 128bytes of RX & TX FIFO, so add an optional property to describe a different FIFO size from the other ports (64bytes).

This adds a property in the bindings, reads the property from the driver and updates the DT with the new property.

Changes since v1:
- switched to a more generic "fifo-size"

Neil Armstrong (3):
dt-bindings: serial: amlogic,meson-uart: add fifo-size property
tty: serial: meson: retrieve port FIFO size from DT
arm64: dts: meson: set 128bytes FIFO size on uart A

 .../devicetree/bindings/serial/amlogic,meson-uart.yaml      | 6 ++++++
 arch/arm64/boot/dts/amlogic/meson-axg.dtsi                  | 1 +
 arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi           | 1 +
 arch/arm64/boot/dts/amlogic/meson-gx.dtsi                   | 1 +
 drivers/tty/serial/meson_uart.c                             | 5 ++++-
 5 files changed, 13 insertions(+), 1 deletion(-)
Signature · 7 lines
2.25.1


_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
#1 lore raw

PATCH v2 1/3 dt-bindings: serial: amlogic,meson-uart: add fifo-size property

On most of the Amlogic SoCs, the first UART controller in the "Everything-Else" power domain has 128bytes of RX & TX FIFO, so add an optional property to describe a different FIFO size from the other ports (64bytes).

---
 .../devicetree/bindings/serial/amlogic,meson-uart.yaml      | 6 ++++++
 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml +6 -0
index 75ebc9952a99..8ece7f420c19 100644
@@ -55,6 +55,12 @@ properties:
       - const: pclk
       - const: baud
 
+
+  fifo-size:
+    description: The fifo size supported by the UART channel.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [64, 128]
+
 required:
   - compatible
   - reg
Signature · 7 lines
2.25.1


_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
#2 lore raw

Re: [PATCH v2 1/3] dt-bindings: serial: amlogic,meson-uart: add fifo-size property

Hi Rob,

Quoted 18 lines · Neil Armstrong

On most of the Amlogic SoCs, the first UART controller in the "Everything-Else" power domain has 128bytes of RX & TX FIFO, so add an optional property to describe a different FIFO size from the other ports (64bytes).

---
 .../devicetree/bindings/serial/amlogic,meson-uart.yaml      | 6 ++++++
 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml +0 -0
index 75ebc9952a99..8ece7f420c19 100644
@@ -55,6 +55,12 @@ properties:
       - const: pclk
       - const: baud

Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml properties: · line 66

Quoted 10 lines
Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml +6 -0
 
+
+  fifo-size:
+    description: The fifo size supported by the UART channel.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [64, 128]
+
 required:
   - compatible
   - reg

Is it ok with the generic fifo-size property ?

Neil

#3 lore raw

PATCH v2 2/3 tty: serial: meson: retrieve port FIFO size from DT

In reply to Neil Armstrong

Now the DT bindings has a property to get the FIFO size for a particular port, retrieve it and use to setup the FIFO interrupts threshold.

---
 drivers/tty/serial/meson_uart.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/tty/serial/meson_uart.c +4 -1
index 69eeef9edfa5..ce4dbfb0bd24 100644
@@ -717,6 +717,7 @@ static int meson_uart_probe(struct platform_device *pdev)
 {
 	struct resource *res_mem, *res_irq;
 	struct uart_port *port;
+	u32 fifosize = 64; /* Default is 64, 128 for EE UART_0 */
 	int ret = 0;
 	int id = -1;
 
@@ -743,6 +744,8 @@ static int meson_uart_probe(struct platform_device *pdev)
 	if (!res_irq)
 		return -ENODEV;
 
+	of_property_read_u32(pdev->dev.of_node, "fifo-size", &fifosize);
+
 	if (meson_ports[pdev->id]) {
 		dev_err(&pdev->dev, "port %d already allocated\n", pdev->id);
 		return -EBUSY;
@@ -772,7 +775,7 @@ static int meson_uart_probe(struct platform_device *pdev)
 	port->type = PORT_MESON;
 	port->x_char = 0;
 	port->ops = &meson_uart_ops;
-	port->fifosize = 64;
+	port->fifosize = fifosize;
 
 	meson_ports[pdev->id] = port;
 	platform_set_drvdata(pdev, port);
Signature · 7 lines
2.25.1


_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
#5 lore raw

PATCH v2 3/3 arm64: dts: meson: set 128bytes FIFO size on uart A

In reply to Neil Armstrong

The first UART controller in "Everything-Else" power domain, usually used for Bluetooth HCI has 128bytes FIFO depth.

---
 arch/arm64/boot/dts/amlogic/meson-axg.dtsi        | 1 +
 arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi | 1 +
 arch/arm64/boot/dts/amlogic/meson-gx.dtsi         | 1 +
 3 files changed, 3 insertions(+)
arch/arm64/boot/dts/amlogic/meson-axg.dtsi +1 -0
index d945c84ab697..db3dae932a08 100644
@@ -1872,6 +1872,7 @@ uart_A: serial@24000 {
 				status = "disabled";
 				clocks = <&xtal>, <&clkc CLKID_UART0>, <&xtal>;
 				clock-names = "xtal", "pclk", "baud";
+				fifo-size = <128>;
 			};
 		};
 
arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +1 -0
index b858c5e43cc8..4f5b85ad3120 100644
@@ -2311,6 +2311,7 @@ uart_A: serial@24000 {
 				clocks = <&xtal>, <&clkc CLKID_UART0>, <&xtal>;
 				clock-names = "xtal", "pclk", "baud";
 				status = "disabled";
+				fifo-size = <128>;
 			};
 		};
 
arch/arm64/boot/dts/amlogic/meson-gx.dtsi +1 -0
index 0edd137151f8..8eae0b7d1642 100644
@@ -295,6 +295,7 @@ uart_A: serial@84c0 {
 				reg = <0x0 0x84c0 0x0 0x18>;
 				interrupts = <GIC_SPI 26 IRQ_TYPE_EDGE_RISING>;
 				status = "disabled";
+				fifo-size = <128>;
 			};
 
 			uart_B: serial@84dc {
Signature · 7 lines
2.25.1


_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic