mbox series

[0/7] riscv: sophgo: Add pinctrl support for CV1800 series SoC

Message ID IA1PR20MB49530F0476B98DBB835B344FBBDE2@IA1PR20MB4953.namprd20.prod.outlook.com
Headers show
Series riscv: sophgo: Add pinctrl support for CV1800 series SoC | expand

Message

Inochi Amaoto July 4, 2024, 5:45 a.m. UTC
Add basic pinctrl driver for Sophgo CV1800 series SoCs.
This patch series aims to replace the previous patch from Jisheng [1].
Since the pinctrl of cv1800 has nested mux and its pin definination
is discrete, it is not suitable to use "pinctrl-single" to cover the
pinctrl device.

Note: As current documentation is not enough to guess the pin
configuration of Huashan Pi, only the pinctrl node is added.

[1] https://lore.kernel.org/linux-riscv/20231113005702.2467-1-jszhang@kernel.org/

Inochi Amaoto (7):
  dt-bindings: pinctrl: Add pinctrl for Sophgo CV1800 series SoC.
  pinctrl: sophgo: add support for CV1800B SoC
  pinctrl: sophgo: add support for CV1812H SoC
  pinctrl: sophgo: add support for SG2000 SoC
  pinctrl: sophgo: add support for SG2002 SoC
  riscv: dts: sophgo: cv1800b: add pinctrl support
  riscv: dts: sophgo: cv1812h: add pinctrl support

 .../pinctrl/sophgo,cv1800-pinctrl.yaml        | 120 ++++
 .../boot/dts/sophgo/cv1800b-milkv-duo.dts     |  44 ++
 arch/riscv/boot/dts/sophgo/cv1800b.dtsi       |  10 +
 arch/riscv/boot/dts/sophgo/cv1812h.dtsi       |  10 +
 drivers/pinctrl/Kconfig                       |   1 +
 drivers/pinctrl/Makefile                      |   1 +
 drivers/pinctrl/sophgo/Kconfig                |  54 ++
 drivers/pinctrl/sophgo/Makefile               |   7 +
 drivers/pinctrl/sophgo/pinctrl-cv1800b.c      | 293 ++++++++
 drivers/pinctrl/sophgo/pinctrl-cv1812h.c      | 596 ++++++++++++++++
 drivers/pinctrl/sophgo/pinctrl-cv18xx.c       | 642 ++++++++++++++++++
 drivers/pinctrl/sophgo/pinctrl-cv18xx.h       | 126 ++++
 drivers/pinctrl/sophgo/pinctrl-sg2000.c       | 596 ++++++++++++++++
 drivers/pinctrl/sophgo/pinctrl-sg2002.c       | 373 ++++++++++
 include/dt-bindings/pinctrl/pinctrl-cv1800b.h |  63 ++
 include/dt-bindings/pinctrl/pinctrl-cv1812h.h | 127 ++++
 include/dt-bindings/pinctrl/pinctrl-cv18xx.h  |  19 +
 include/dt-bindings/pinctrl/pinctrl-sg2000.h  | 127 ++++
 include/dt-bindings/pinctrl/pinctrl-sg2002.h  |  79 +++
 19 files changed, 3288 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/sophgo,cv1800-pinctrl.yaml
 create mode 100644 drivers/pinctrl/sophgo/Kconfig
 create mode 100644 drivers/pinctrl/sophgo/Makefile
 create mode 100644 drivers/pinctrl/sophgo/pinctrl-cv1800b.c
 create mode 100644 drivers/pinctrl/sophgo/pinctrl-cv1812h.c
 create mode 100644 drivers/pinctrl/sophgo/pinctrl-cv18xx.c
 create mode 100644 drivers/pinctrl/sophgo/pinctrl-cv18xx.h
 create mode 100644 drivers/pinctrl/sophgo/pinctrl-sg2000.c
 create mode 100644 drivers/pinctrl/sophgo/pinctrl-sg2002.c
 create mode 100644 include/dt-bindings/pinctrl/pinctrl-cv1800b.h
 create mode 100644 include/dt-bindings/pinctrl/pinctrl-cv1812h.h
 create mode 100644 include/dt-bindings/pinctrl/pinctrl-cv18xx.h
 create mode 100644 include/dt-bindings/pinctrl/pinctrl-sg2000.h
 create mode 100644 include/dt-bindings/pinctrl/pinctrl-sg2002.h

--
2.45.2

Comments

Linus Walleij July 5, 2024, 9:50 a.m. UTC | #1
Hi Inochi,

thanks for your patch!

Some comments below:

On Thu, Jul 4, 2024 at 7:47 AM Inochi Amaoto <inochiama@outlook.com> wrote:

> Add pinctrl support for Sophgo CV1800 series SoC.
>
> Signed-off-by: Inochi Amaoto <inochiama@outlook.com>
(...)
> +          bias-pull-up:
> +            type: boolean

description: Setting this true will result in how many Ohms of pull up
and to what voltage?

> +          bias-pull-down:
> +            type: boolean

How many Ohms by default? It's very helpful for designers writing the
device tree to know this.

> +          drive-strength:
> +            $ref: /schemas/types.yaml#/definitions/uint32
> +            minimum: 0
> +            maximum: 7

0,1,  ... 7 ... units of what? What does the values represent?
7 mA? I think not. This should be in mA and parsed to any custom
values.

If you need more resolution, consider using driver-strength-microamp and
parse that value instead.

> +          input-schmitt:
> +            $ref: /schemas/types.yaml#/definitions/uint32
> +            minimum: 0
> +            maximum: 7

What is this custom property? We support input-schmitt-enable
and input-schmitt-disable, if you want to add a new standard property
input-schmitt, then send a separate patch to
Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml
and explain what the argument means, it should be in SI units.

For a full custom property, use sophgo, prefixes.

> +          slew-rate:
> +            enum: [ 0, 1 ]

What is slew rate 0 and 1? What does it represent?

microvolts per second how much (I don't know, just guessing)

> +          sophgo,bus-holder:
> +            description: enable bus holder

This description is a bit too little, we need to know what this thing
is and what it is
used for. If it is definied in some other DT binding then reference that file.

Yours,
Linus Walleij
Inochi Amaoto July 5, 2024, 11:21 a.m. UTC | #2
On Fri, Jul 05, 2024 at 11:50:09AM GMT, Linus Walleij wrote:
> Hi Inochi,
> 
> thanks for your patch!
> 
> Some comments below:
> 
> On Thu, Jul 4, 2024 at 7:47 AM Inochi Amaoto <inochiama@outlook.com> wrote:
> 
> > Add pinctrl support for Sophgo CV1800 series SoC.
> >
> > Signed-off-by: Inochi Amaoto <inochiama@outlook.com>
> (...)
> > +          bias-pull-up:
> > +            type: boolean
> 
> description: Setting this true will result in how many Ohms of pull up
> and to what voltage?
> 
> > +          bias-pull-down:
> > +            type: boolean
> 
> How many Ohms by default? It's very helpful for designers writing the
> device tree to know this.
> 

Pullup in 79k and pulldown is 87k. I will add these to the description.

> > +          drive-strength:
> > +            $ref: /schemas/types.yaml#/definitions/uint32
> > +            minimum: 0
> > +            maximum: 7
> 
> 0,1,  ... 7 ... units of what? What does the values represent?
> 7 mA? I think not. This should be in mA and parsed to any custom
> values.
> 
> If you need more resolution, consider using driver-strength-microamp and
> parse that value instead.
> 

This value depends on the type of the pin. Different pin have different
typical drive strength. I will switch to the real value and check it in
the driver.

> > +          input-schmitt:
> > +            $ref: /schemas/types.yaml#/definitions/uint32
> > +            minimum: 0
> > +            maximum: 7
> 
> What is this custom property? We support input-schmitt-enable
> and input-schmitt-disable, if you want to add a new standard property
> input-schmitt, then send a separate patch to
> Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml
> and explain what the argument means, it should be in SI units.
> 
> For a full custom property, use sophgo, prefixes.
> 

Thanks for the reminder. I have seen `input-schmitt` in the generic 
pinconf table. I will sumbit a new patch and add this to the 
pincfg-node.

> > +          slew-rate:
> > +            enum: [ 0, 1 ]
> 
> What is slew rate 0 and 1? What does it represent?
> 
> microvolts per second how much (I don't know, just guessing)
> 

According to the document from sophgo, 0 is fast rate and 1 is slow.

> > +          sophgo,bus-holder:
> > +            description: enable bus holder
> 
> This description is a bit too little, we need to know what this thing
> is and what it is
> used for. If it is definied in some other DT binding then reference that file.
> 
> Yours,
> Linus Walleij

Thanks I will improve it.

Regards,
Inochi