mbox series

[RFC,0/9] phy-rockchip-inno-usb2: support rk356x usb2phy

Message ID 20210728122606.697619-1-pgwipeout@gmail.com
Headers show
Series phy-rockchip-inno-usb2: support rk356x usb2phy | expand

Message

Peter Geis July 28, 2021, 12:25 p.m. UTC
Good Morning,

This is my series to support the usb2 phy devices on the rk356x.
The rk356x phy has a single muxed interrupt and has moved the usb2phy
nodes out of the grf and into their own nodes.
The phy needs to tie back into the grf for register control, similar to
the rv1108.
By moving the phys into their own nodes, they now have full
#address_cells = 2 register addresses, but they still reside below the 32bit
mmio range.

This driver series only supports the host configuration for the rk356x.
I have have tested it on the following:
rk3566 - Pine64 Quartz64 Model A
rk3399 - Pine64 Rockpro64

Please provide feedback and comments as you see fit.

Peter Geis (9):
  dt-bindings: soc: rockchip: add rk3568-usb2phy-grf
  dt-bindings: phy: phy-rockchip-inno-usb2: add rk3568 documentation
  dt-bindings: usb: generic-ohci: increase maximum clocks
  phy: phy-rockchip-inno-usb2: support #address_cells = 2
  phy: phy-rockchip-inno-usb2: support standalone phy nodes
  phy: phy-rockchip-inno-usb2: support muxed interrupts
  phy: phy-rockchip-inno-usb2: add rk3568 support
  arm64: dts: rockchip: add usb2 nodes to rk3568 device tree
  arm64: dts: rockchip: add Quartz64-A usb2 support

 .../bindings/phy/phy-rockchip-inno-usb2.yaml  |   8 +-
 .../devicetree/bindings/soc/rockchip/grf.yaml |   1 +
 .../devicetree/bindings/usb/generic-ohci.yaml |   2 +-
 .../boot/dts/rockchip/rk3566-quartz64-a.dts   |  52 ++++
 arch/arm64/boot/dts/rockchip/rk356x.dtsi      |  97 +++++++
 drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 259 ++++++++++++++----
 6 files changed, 360 insertions(+), 59 deletions(-)

Comments

Johan Jonker July 28, 2021, 2:36 p.m. UTC | #1
Hi Peter,

On 7/28/21 2:25 PM, Peter Geis wrote:
> Add the documentation for the rk3568-usb2phy-grf node, which is separate
> from the usb2phy node on this chip.
> 
> Signed-off-by: Peter Geis <pgwipeout@gmail.com>
> ---
>  Documentation/devicetree/bindings/soc/rockchip/grf.yaml | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Documentation/devicetree/bindings/soc/rockchip/grf.yaml b/Documentation/devicetree/bindings/soc/rockchip/grf.yaml
> index fa010df51a5c..3b0e06b6ea61 100644
> --- a/Documentation/devicetree/bindings/soc/rockchip/grf.yaml
> +++ b/Documentation/devicetree/bindings/soc/rockchip/grf.yaml
> @@ -16,6 +16,7 @@ properties:
>            - enum:
>                - rockchip,rk3288-sgrf

>                - rockchip,rv1108-usbgrf
> +              - rockchip,rk3568-usb2phy-grf

Could you sort this in alphabetical order?

>            - const: syscon
>        - items:
>            - enum:
>
Johan Jonker July 28, 2021, 3:14 p.m. UTC | #2
Hi Peter,

Some comments. Have a look if it's useful.

On 7/28/21 2:25 PM, Peter Geis wrote:
> The rk3568 usb2phy node is a standalone node with a single muxed
> interrupt.
> Add documentation for it to phy-rockchip-inno-usb2.
> 
> Signed-off-by: Peter Geis <pgwipeout@gmail.com>
> ---
>  .../devicetree/bindings/phy/phy-rockchip-inno-usb2.yaml   | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.yaml b/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.yaml
> index 5bebd86bf8b6..f16fea5cad1c 100644
> --- a/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.yaml
> +++ b/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.yaml
> @@ -18,6 +18,7 @@ properties:
>        - rockchip,rk3328-usb2phy
>        - rockchip,rk3366-usb2phy
>        - rockchip,rk3399-usb2phy
> +      - rockchip,rk3568-usb2phy
>        - rockchip,rv1108-usb2phy
>  
>    reg:
> @@ -50,6 +51,9 @@ properties:
>      description:
>        Phandle to the extcon device providing the cable state for the otg phy.
>  

> +  interrupts:

> +    description: Muxed interrupt for both ports

My spelling checker suggest: Mixed. Don't know what's correct...

> +

For rk3568 only.
Could you test/use something like this?

if:
  properties:
    compatible:
      contains:
        const: rockchip,rk3568-usb2phy

then:
  properties:
    interrupts:
      maxItems: 1

  required:
       - interrupts

>    rockchip,usbgrf:
>      $ref: /schemas/types.yaml#/definitions/phandle
>      description:
> @@ -78,8 +82,6 @@ properties:
>  

>      required:
>        - "#phy-cells"
> -      - interrupts
> -      - interrupt-names

These are still required for other Rockchip SoCs.
Could you test/use something like this?

      if:
        properties:
          compatible:
            contains:
              const: rockchip,rk3568-usb2phy

      else:
        required:
          - interrupts
          - interrupt-names

>  
>    otg-port:
>      type: object
> @@ -109,8 +111,6 @@ properties:
>  

>      required:
>        - "#phy-cells"
> -      - interrupts
> -      - interrupt-names

dito

>  
>  required:
>    - compatible
>
Peter Geis July 28, 2021, 3:19 p.m. UTC | #3
On Wed, Jul 28, 2021 at 11:14 AM Johan Jonker <jbx6244@gmail.com> wrote:
>
> Hi Peter,
>
> Some comments. Have a look if it's useful.
>
> On 7/28/21 2:25 PM, Peter Geis wrote:
> > The rk3568 usb2phy node is a standalone node with a single muxed
> > interrupt.
> > Add documentation for it to phy-rockchip-inno-usb2.
> >
> > Signed-off-by: Peter Geis <pgwipeout@gmail.com>
> > ---
> >  .../devicetree/bindings/phy/phy-rockchip-inno-usb2.yaml   | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.yaml b/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.yaml
> > index 5bebd86bf8b6..f16fea5cad1c 100644
> > --- a/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.yaml
> > +++ b/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.yaml
> > @@ -18,6 +18,7 @@ properties:
> >        - rockchip,rk3328-usb2phy
> >        - rockchip,rk3366-usb2phy
> >        - rockchip,rk3399-usb2phy
> > +      - rockchip,rk3568-usb2phy
> >        - rockchip,rv1108-usb2phy
> >
> >    reg:
> > @@ -50,6 +51,9 @@ properties:
> >      description:
> >        Phandle to the extcon device providing the cable state for the otg phy.
> >
>
> > +  interrupts:
>
> > +    description: Muxed interrupt for both ports
>
> My spelling checker suggest: Mixed. Don't know what's correct...

It is muxed, all interrupts come over the single line.

>
> > +
>
> For rk3568 only.
> Could you test/use something like this?
>
> if:
>   properties:
>     compatible:
>       contains:
>         const: rockchip,rk3568-usb2phy
>
> then:
>   properties:
>     interrupts:
>       maxItems: 1
>
>   required:
>        - interrupts
>
> >    rockchip,usbgrf:
> >      $ref: /schemas/types.yaml#/definitions/phandle
> >      description:
> > @@ -78,8 +82,6 @@ properties:
> >
>
> >      required:
> >        - "#phy-cells"
> > -      - interrupts
> > -      - interrupt-names
>
> These are still required for other Rockchip SoCs.
> Could you test/use something like this?
>
>       if:
>         properties:
>           compatible:
>             contains:
>               const: rockchip,rk3568-usb2phy
>
>       else:
>         required:
>           - interrupts
>           - interrupt-names

This is all sane to me, I'll check to ensure it works.

>
> >
> >    otg-port:
> >      type: object
> > @@ -109,8 +111,6 @@ properties:
> >
>
> >      required:
> >        - "#phy-cells"
> > -      - interrupts
> > -      - interrupt-names
>
> dito
>
> >
> >  required:
> >    - compatible
> >

Thank you for the feedback!
Peter Geis July 28, 2021, 3:20 p.m. UTC | #4
On Wed, Jul 28, 2021 at 10:36 AM Johan Jonker <jbx6244@gmail.com> wrote:
>
> Hi Peter,
>
> On 7/28/21 2:25 PM, Peter Geis wrote:
> > Add the documentation for the rk3568-usb2phy-grf node, which is separate
> > from the usb2phy node on this chip.
> >
> > Signed-off-by: Peter Geis <pgwipeout@gmail.com>
> > ---
> >  Documentation/devicetree/bindings/soc/rockchip/grf.yaml | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/Documentation/devicetree/bindings/soc/rockchip/grf.yaml b/Documentation/devicetree/bindings/soc/rockchip/grf.yaml
> > index fa010df51a5c..3b0e06b6ea61 100644
> > --- a/Documentation/devicetree/bindings/soc/rockchip/grf.yaml
> > +++ b/Documentation/devicetree/bindings/soc/rockchip/grf.yaml
> > @@ -16,6 +16,7 @@ properties:
> >            - enum:
> >                - rockchip,rk3288-sgrf
>
> >                - rockchip,rv1108-usbgrf
> > +              - rockchip,rk3568-usb2phy-grf
>
> Could you sort this in alphabetical order?

Will do, thanks.

>
> >            - const: syscon
> >        - items:
> >            - enum:
> >