mbox series

[0/4] serial: add drivers for the ESP32xx serial devices

Message ID 20230913211449.668796-1-jcmvbkbc@gmail.com
Headers show
Series serial: add drivers for the ESP32xx serial devices | expand

Message

Max Filippov Sept. 13, 2023, 9:14 p.m. UTC
Hello,

this series adds drivers for the UART and ACM controllers found in the
Espressif ESP32 and ESP32S3 SoCs.

Max Filippov (4):
  dt-bindings: serial: document esp32-uart bindings
  drivers/tty/serial: add driver for the ESP32 UART
  dt-bindings: serial: document esp32s3-acm bindings
  drivers/tty/serial: add ESP32S3 ACM device driver

 .../bindings/serial/esp,esp32-acm.yaml        |  40 +
 .../bindings/serial/esp,esp32-uart.yaml       |  48 ++
 drivers/tty/serial/Kconfig                    |  27 +
 drivers/tty/serial/Makefile                   |   2 +
 drivers/tty/serial/esp32_acm.c                | 473 +++++++++++
 drivers/tty/serial/esp32_uart.c               | 766 ++++++++++++++++++
 include/uapi/linux/serial_core.h              |   6 +
 7 files changed, 1362 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/serial/esp,esp32-acm.yaml
 create mode 100644 Documentation/devicetree/bindings/serial/esp,esp32-uart.yaml
 create mode 100644 drivers/tty/serial/esp32_acm.c
 create mode 100644 drivers/tty/serial/esp32_uart.c

Comments

Krzysztof Kozlowski Sept. 14, 2023, 5:54 a.m. UTC | #1
On 13/09/2023 23:14, Max Filippov wrote:
> Add documentation for the ESP32xx UART controllers.
> 
> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
> ---
>  .../bindings/serial/esp,esp32-uart.yaml       | 48 +++++++++++++++++++
>  1 file changed, 48 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/serial/esp,esp32-uart.yaml
> 
> diff --git a/Documentation/devicetree/bindings/serial/esp,esp32-uart.yaml b/Documentation/devicetree/bindings/serial/esp,esp32-uart.yaml
> new file mode 100644
> index 000000000000..8b45ef808107
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/serial/esp,esp32-uart.yaml
> @@ -0,0 +1,48 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/serial/esp,esp32-uart.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: ESP32 UART controller
> +
> +maintainers:
> +  - Max Filippov <jcmvbkbc@gmail.com>
> +
> +description: |

Do not need '|' unless you need to preserve formatting.

> +  ESP32 UART controller is a part of ESP32 SoC series.
> +
> +properties:
> +  compatible:
> +    oneOf:

That's just enum. Your descriptions are useless - tell nothing - so drop
them.

> +      - description: UART controller for the ESP32 SoC
> +        const: esp,esp32-uart

Looks quite generic, so just to be sure? This is not a family name,
right? Neither family names nor wildcards are allowed.

> +      - description: UART controller for the ESP32S3 SoC
> +        const: esp,esp32s3-uart
> +
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  clocks:
> +    maxItems: 1
> +
> +required:
> +  - compatible
> +  - reg
> +  - interrupts
> +  - clocks
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    serial0: serial@60000000 {

Drop unused label.

> +            compatible = "esp,esp32s3-uart";

Use 4 spaces for example indentation.

> +            reg = <0x60000000 0x80>;
> +            interrupts = <27 1 0>;

Use proper define for IRQ flags.

> +            clocks = <&serial_clk>;
> +    };

Best regards,
Krzysztof
Krzysztof Kozlowski Sept. 14, 2023, 5:57 a.m. UTC | #2
On 13/09/2023 23:14, Max Filippov wrote:
> Add documentation for the ESP32S3 ACM controller.

A nit, subject: drop second/last, redundant "bindings". The
"dt-bindings" prefix is already stating that these are bindings.

> 
> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
> ---
>  .../bindings/serial/esp,esp32-acm.yaml        | 40 +++++++++++++++++++
>  1 file changed, 40 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/serial/esp,esp32-acm.yaml
> 
> diff --git a/Documentation/devicetree/bindings/serial/esp,esp32-acm.yaml b/Documentation/devicetree/bindings/serial/esp,esp32-acm.yaml
> new file mode 100644
> index 000000000000..dafbae38aa64
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/serial/esp,esp32-acm.yaml
> @@ -0,0 +1,40 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/serial/esp,esp32-acm.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: ESP32S3 ACM controller
> +
> +maintainers:
> +  - Max Filippov <jcmvbkbc@gmail.com>
> +
> +description: |

Do not need '|' unless you need to preserve formatting.


> +  ESP32S3 ACM controller is a communication device found in the ESP32S3

What is "ACM"? Why is this in serial? Only serial controllers are in
serial. The description is very vague, way too vague.

> +  SoC that is connected to one of its USB controllers.

Same comments as previous patch.

> +
> +properties:
> +  compatible:
> +    const: esp,esp32s3-acm
> +
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    maxItems: 1
> +
> +required:
> +  - compatible
> +  - reg
> +  - interrupts
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    acm@60038000 {
> +            compatible = "esp,esp32s3-acm";

Use 4 spaces for example indentation.

> +            reg = <0x60038000 0x1000>;
> +            interrupts = <96 3 0>;

Same comments as previous patch.

> +    };

Best regards,
Krzysztof
Conor Dooley Sept. 14, 2023, 2:48 p.m. UTC | #3
On Thu, Sep 14, 2023 at 07:55:35AM +0200, Krzysztof Kozlowski wrote:
> On 13/09/2023 23:14, Max Filippov wrote:
> > Add documentation for the ESP32xx UART controllers.
> > 
> > Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
> > ---
> >  .../bindings/serial/esp,esp32-uart.yaml       | 48 +++++++++++++++++++
> >  1 file changed, 48 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/serial/esp,esp32-uart.yaml
> > 
> > diff --git a/Documentation/devicetree/bindings/serial/esp,esp32-uart.yaml b/Documentation/devicetree/bindings/serial/esp,esp32-uart.yaml
> > new file mode 100644
> > index 000000000000..8b45ef808107
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/serial/esp,esp32-uart.yaml
> > @@ -0,0 +1,48 @@
> > +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> > +
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/serial/esp,esp32-uart.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: ESP32 UART controller
> > +
> > +maintainers:
> > +  - Max Filippov <jcmvbkbc@gmail.com>
> > +
> > +description: |
> > +  ESP32 UART controller is a part of ESP32 SoC series.
> 
> 1. Company name?
> 2. ESP32 SoC series suggests esp32 is a series.
> 
> > +
> > +properties:
> > +  compatible:
> > +    oneOf:
> > +      - description: UART controller for the ESP32 SoC
> > +        const: esp,esp32-uart
> 
> Also, the vendor prefix looks incorrect, so again - what is the company
> name?

esp32 is made by expressif, which would match with "esp" as a vendor
prefix.
Max Filippov Sept. 14, 2023, 8:02 p.m. UTC | #4
On Thu, Sep 14, 2023 at 7:48 AM Conor Dooley <conor@kernel.org> wrote:
> On Thu, Sep 14, 2023 at 07:55:35AM +0200, Krzysztof Kozlowski wrote:
> > On 13/09/2023 23:14, Max Filippov wrote:
> > > +description: |
> > > +  ESP32 UART controller is a part of ESP32 SoC series.
> >
> > 1. Company name?
> > 2. ESP32 SoC series suggests esp32 is a series.
> >
> > > +
> > > +properties:
> > > +  compatible:
> > > +    oneOf:
> > > +      - description: UART controller for the ESP32 SoC
> > > +        const: esp,esp32-uart
> >
> > Also, the vendor prefix looks incorrect, so again - what is the company
> > name?
>
> esp32 is made by expressif, which would match with "esp" as a vendor
> prefix.

It's 'Espressif', but otherwise yes, this is a registered vendor prefix. See
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/vendor-prefixes.yaml?h=v6.6-rc1#n443