2021-03-15 08:37:02

by Neil Armstrong

[permalink] [raw]
Subject: [PATCH 0/3] 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.

Neil Armstrong (3):
dt-bindings: serial: amlogic,meson-uart: add amlogic,uart-fifosize
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(-)

--
2.25.1


2021-03-15 08:37:06

by Neil Armstrong

[permalink] [raw]
Subject: [PATCH 1/3] dt-bindings: serial: amlogic,meson-uart: 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).

Signed-off-by: Neil Armstrong <[email protected]>
---
.../devicetree/bindings/serial/amlogic,meson-uart.yaml | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml b/Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml
index 75ebc9952a99..e0a742112783 100644
--- a/Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml
+++ b/Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml
@@ -55,6 +55,12 @@ properties:
- const: pclk
- const: baud

+
+ amlogic,uart-fifosize:
+ description: The fifo size supported by the UART channel.
+ $ref: /schemas/types.yaml#/definitions/uint32
+ enum: [64, 128]
+
required:
- compatible
- reg
--
2.25.1

2021-03-15 08:37:10

by Neil Armstrong

[permalink] [raw]
Subject: [PATCH 2/3] tty: serial: meson: retrieve port FIFO size from DT

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.

Signed-off-by: Neil Armstrong <[email protected]>
---
drivers/tty/serial/meson_uart.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uart.c
index 69eeef9edfa5..7244b12aefab 100644
--- a/drivers/tty/serial/meson_uart.c
+++ b/drivers/tty/serial/meson_uart.c
@@ -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, "amlogic,uart-fifosize", &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);
--
2.25.1

2021-03-15 08:39:11

by Neil Armstrong

[permalink] [raw]
Subject: [PATCH 3/3] arm64: dts: meson: set 128bytes FIFO size on uart A

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

Signed-off-by: Neil Armstrong <[email protected]>
---
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(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi
index d945c84ab697..571383c12855 100644
--- a/arch/arm64/boot/dts/amlogic/meson-axg.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-axg.dtsi
@@ -1872,6 +1872,7 @@ uart_A: serial@24000 {
status = "disabled";
clocks = <&xtal>, <&clkc CLKID_UART0>, <&xtal>;
clock-names = "xtal", "pclk", "baud";
+ amlogic,uart-fifosize = <128>;
};
};

diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
index b858c5e43cc8..9e898479f118 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
@@ -2311,6 +2311,7 @@ uart_A: serial@24000 {
clocks = <&xtal>, <&clkc CLKID_UART0>, <&xtal>;
clock-names = "xtal", "pclk", "baud";
status = "disabled";
+ amlogic,uart-fifosize = <128>;
};
};

diff --git a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
index 0edd137151f8..bd0b049787fd 100644
--- a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
@@ -295,6 +295,7 @@ uart_A: serial@84c0 {
reg = <0x0 0x84c0 0x0 0x18>;
interrupts = <GIC_SPI 26 IRQ_TYPE_EDGE_RISING>;
status = "disabled";
+ amlogic,uart-fifosize = <128>;
};

uart_B: serial@84dc {
--
2.25.1

2021-03-16 11:16:21

by Kevin Hilman

[permalink] [raw]
Subject: Re: [PATCH 2/3] tty: serial: meson: retrieve port FIFO size from DT

Neil Armstrong <[email protected]> writes:

> 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.
>
> Signed-off-by: Neil Armstrong <[email protected]>

Reviewed-by: Kevin Hilman <[email protected]>

2021-03-23 21:38:11

by Martin Blumenstingl

[permalink] [raw]
Subject: Re: [PATCH 1/3] dt-bindings: serial: amlogic, meson-uart: add amlogic, uart-fifosize property

Hi Neil,

On Mon, Mar 15, 2021 at 9:37 AM Neil Armstrong <[email protected]> wrote:
>
> 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
do we still need wrapping of long lines in commit messages?
if so I think the line above is too long

> a different FIFO size from the other ports (64bytes).
>
> Signed-off-by: Neil Armstrong <[email protected]>
Reviewed-by: Martin Blumenstingl <[email protected]>

one additional note below

> ---
> .../devicetree/bindings/serial/amlogic,meson-uart.yaml | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml b/Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml
> index 75ebc9952a99..e0a742112783 100644
> --- a/Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml
> +++ b/Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml
> @@ -55,6 +55,12 @@ properties:
> - const: pclk
> - const: baud
>
> +
> + amlogic,uart-fifosize:
> + description: The fifo size supported by the UART channel.
> + $ref: /schemas/types.yaml#/definitions/uint32
> + enum: [64, 128]
I personally think this is generic enough to be described as fifo-size
(as it's done in Documentation/devicetree/bindings/serial/8250.yaml)
let's wait and hear what Rob thinks


Best regards,
Martin

2021-03-23 21:39:03

by Martin Blumenstingl

[permalink] [raw]
Subject: Re: [PATCH 2/3] tty: serial: meson: retrieve port FIFO size from DT

On Mon, Mar 15, 2021 at 9:37 AM Neil Armstrong <[email protected]> wrote:
>
> 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.
>
> Signed-off-by: Neil Armstrong <[email protected]>
Reviewed-by: Martin Blumenstingl <[email protected]>

2021-03-24 17:44:29

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH 1/3] dt-bindings: serial: amlogic, meson-uart: add amlogic, uart-fifosize property

On Tue, Mar 23, 2021 at 10:33:15PM +0100, Martin Blumenstingl wrote:
> Hi Neil,
>
> On Mon, Mar 15, 2021 at 9:37 AM Neil Armstrong <[email protected]> wrote:
> >
> > 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
> do we still need wrapping of long lines in commit messages?
> if so I think the line above is too long
>
> > a different FIFO size from the other ports (64bytes).
> >
> > Signed-off-by: Neil Armstrong <[email protected]>
> Reviewed-by: Martin Blumenstingl <[email protected]>
>
> one additional note below
>
> > ---
> > .../devicetree/bindings/serial/amlogic,meson-uart.yaml | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml b/Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml
> > index 75ebc9952a99..e0a742112783 100644
> > --- a/Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml
> > +++ b/Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml
> > @@ -55,6 +55,12 @@ properties:
> > - const: pclk
> > - const: baud
> >
> > +
> > + amlogic,uart-fifosize:
> > + description: The fifo size supported by the UART channel.
> > + $ref: /schemas/types.yaml#/definitions/uint32
> > + enum: [64, 128]
> I personally think this is generic enough to be described as fifo-size
> (as it's done in Documentation/devicetree/bindings/serial/8250.yaml)
> let's wait and hear what Rob thinks

Yes.