[v2,3/4] dt-bindings: serial: snps-dw-apb-uart: Add Allwinner A733

Message ID 09f3a181436e6f19317224e583c2fdaa787797d7.1792439398.git.vinicius.eduardo.pedrosa@gmail.com (mailing list archive)
State New
Headers
Series serial: 8250_dw: Allwinner A733 UART support |

Commit Message

Vinicius Pedrosa Oct. 19, 2026, 8:06 p.m. UTC
The Allwinner A733 UART is a DesignWare APB UART, but it needs
SoC-specific handling so the driver can avoid stopping its clock during
termios changes.

Add an A733-specific compatible, with "snps,dw-apb-uart" as the
fallback.

Signed-off-by: Vinicius Pedrosa <vinicius.eduardo.pedrosa@gmail.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
---
 Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Andre Przywara Oct. 21, 2026, 2:54 p.m. UTC | #1
Hi Vinicius,

On 10/19/26 22:06, Vinicius Pedrosa wrote:
> The Allwinner A733 UART is a DesignWare APB UART, but it needs
> SoC-specific handling so the driver can avoid stopping its clock during
> termios changes.
> 
> Add an A733-specific compatible, with "snps,dw-apb-uart" as the
> fallback.
> 
> Signed-off-by: Vinicius Pedrosa <vinicius.eduardo.pedrosa@gmail.com>
> Acked-by: Conor Dooley <conor.dooley@microchip.com>
> ---
>   Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml b/Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml
> index e2ca126d58ba..532392dd54cf 100644
> --- a/Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml
> +++ b/Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml
> @@ -60,6 +60,7 @@ properties:
>             - const: renesas,rzn1-uart
>         - items:
>             - enum:
> +              - allwinner,sun60i-a733-uart

So if I understand correctly, this compatible is really there for the 
clock gating issue, right? As the DLF part is now somewhat correctly 
auto-detected?
Can you share what your termios test looks like? Because I assume this 
affects more Allwinner SoCs (the DLF change definitely does).
Then we should add more compatible strings here. If there is a simple 
test, I am happy to run this on a bunch of boards, to give you a list.

Cheers,
Andre

>                 - anlogic,dr1v90-uart
>                 - brcm,bcm11351-dw-apb-uart
>                 - brcm,bcm21664-dw-apb-uart
  
Vinicius Pedrosa Oct. 21, 2026, 5:58 p.m. UTC | #2
Hi Andre,

On Wed, 21 Oct 2026, Andre Przywara wrote:

> So if I understand correctly, this compatible is really there for the
> clock gating issue, right? As the DLF part is now somewhat correctly
> auto-detected?

Yes, the compatible is only for the clock issue (SKIP_SET_RATE). The
false DLF detection is handled generically by patch 2.

> Can you share what your termios test looks like? Because I assume this
> affects more Allwinner SoCs (the DLF change definitely does).
> Then we should add more compatible strings here. If there is a simple
> test, I am happy to run this on a bunch of boards, to give you a list.

I reduced the termios test to a small standalone reproducer and retested
it on the A733. While the serial console is continuously transmitting,
this program toggles CLOCAL and restores it:

    #include <fcntl.h>
    #include <stdio.h>
    #include <termios.h>
    #include <unistd.h>

    int main(int argc, char **argv)
    {
            const char *dev = argc > 1 ? argv[1] : "/dev/console";
            struct termios orig, changed;
            int fd = open(dev, O_RDWR | O_NOCTTY | O_NONBLOCK);

            if (fd < 0 || tcgetattr(fd, &orig)) {
                    perror(dev);
                    return 1;
            }

            changed = orig;
            changed.c_cflag ^= CLOCAL;

            if (tcsetattr(fd, TCSANOW, &changed) ||
                tcsetattr(fd, TCSANOW, &orig)) {
                    perror("tcsetattr");
                    return 1;
            }

            return 0;
    }

I compile it with:

    cc -O2 -o clocal-toggle clocal-toggle.c

and run 300 iterations from a shell on the serial console, keeping the
console busy:

    dmesg -n 1
    (while :; do seq 1 1000; done) &
    gen=$!
    i=0
    while [ "$i" -lt 300 ]; do
            ./clocal-toggle || break
            i=$((i + 1))
    done
    kill $gen

CLOCAL doesn't change the framing, so the output should stay a clean
1..1000 sequence. A bad run shows garbage characters and missing lines.

On the A733 I ran this test five times without SKIP_SET_RATE and all
five runs were corrupted. With the A733 compatible selecting
SKIP_SET_RATE, all five were clean.

Running the same test on your other Allwinner boards would be very
useful. I also have a small script that checks the capture, if that
helps.

Thanks,
Vinicius
  

Patch

diff --git a/Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml b/Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml
index e2ca126d58ba..532392dd54cf 100644
--- a/Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml
+++ b/Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml
@@ -60,6 +60,7 @@  properties:
           - const: renesas,rzn1-uart
       - items:
           - enum:
+              - allwinner,sun60i-a733-uart
               - anlogic,dr1v90-uart
               - brcm,bcm11351-dw-apb-uart
               - brcm,bcm21664-dw-apb-uart