devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: Biju Das <biju.das.jz@bp.renesas.com>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Fabrizio Castro <fabrizio.castro.jz@renesas.com>,
	"linux-renesas-soc@vger.kernel.org" 
	<linux-renesas-soc@vger.kernel.org>
Subject: Re: [PATCH 02/16] dt-bindings: usb: Add RZ/V2M USB3DRD binding
Date: Tue, 13 Dec 2022 09:54:41 -0600	[thread overview]
Message-ID: <20221213155441.GA1483198-robh@kernel.org> (raw)
In-Reply-To: <OS0PR01MB59224764F969310126DB202186E39@OS0PR01MB5922.jpnprd01.prod.outlook.com>

On Tue, Dec 13, 2022 at 03:01:34PM +0000, Biju Das wrote:
> Hi Rob,
> 
> > Subject: Re: [PATCH 02/16] dt-bindings: usb: Add RZ/V2M USB3DRD binding
> > 
> > On Mon, Dec 12, 2022 at 05:27:50PM +0000, Biju Das wrote:
> > > Add device tree bindings for the RZ/V2{M, MA} USB3DRD module.
> > >
> > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > > ---
> > >  .../bindings/usb/renesas,rzv2m-usb3drd.yaml   | 123 ++++++++++++++++++
> > >  1 file changed, 123 insertions(+)
> > >  create mode 100644
> > > Documentation/devicetree/bindings/usb/renesas,rzv2m-usb3drd.yaml
> > >
> > > diff --git
> > > a/Documentation/devicetree/bindings/usb/renesas,rzv2m-usb3drd.yaml
> > > b/Documentation/devicetree/bindings/usb/renesas,rzv2m-usb3drd.yaml
> > > new file mode 100644
> > > index 000000000000..0c473c3398b3
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/usb/renesas,rzv2m-usb3drd.yaml
> > > @@ -0,0 +1,123 @@
> > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) %YAML 1.2
> > > +---
> > > +
> > > +title: Renesas RZ/V2M USB 3.1 DRD controller
> > > +
> > > +maintainers:
> > > +  - Biju Das <biju.das.jz@bp.renesas.com>
> > > +
> > > +description: |
> > > +  The RZ/V2{M, MA} USB3.1 DRD module supports the following functions
> > > +  * Role swapping function by the ID pin of the Micro-AB receptacle
> > > +  * Battery Charging Specification Revision 1.2
> > > +
> > > +properties:
> > > +  compatible:
> > > +    items:
> > > +      - enum:
> > > +          - renesas,r9a09g011-usb3drd  # RZ/V2M
> > > +          - renesas,r9a09g055-usb3drd  # RZ/V2MA
> > > +      - const: renesas,rzv2m-usb3drd
> > > +
> > > +  reg:
> > > +    maxItems: 1
> > > +
> > > +  clocks:
> > > +    items:
> > > +      - description: Peripheral AXI clock
> > > +      - description: APB clock
> > > +
> > > +  clock-names:
> > > +    items:
> > > +      - const: peri_axi
> > > +      - const: apb
> > > +
> > > +  power-domains:
> > > +    maxItems: 1
> > > +
> > > +  resets:
> > > +    items:
> > > +      - description: DRD reset
> > > +      - description: Peripheral reset
> > > +
> > > +  reset-names:
> > > +    items:
> > > +      - const: drd_reset
> > > +      - const: aresetn_p
> > > +
> > > +  ranges: true
> > > +
> > > +  '#address-cells':
> > > +    enum: [ 1, 2 ]
> > > +
> > > +  '#size-cells':
> > > +    enum: [ 1, 2 ]
> > > +
> > > +  usb3peri:
> > > +    $ref: /schemas/usb/renesas,usb3-peri.yaml
> > > +
> > > +patternProperties:
> > > +  "^usb@[0-9a-f]+$":
> > > +    type: object
> > > +    $ref: renesas,usb-xhci.yaml#
> > > +
> > > +required:
> > > +  - compatible
> > > +  - reg
> > > +  - clocks
> > > +  - clock-names
> > > +  - power-domains
> > > +  - resets
> > > +  - reset-names
> > > +
> > > +additionalProperties: false
> > > +
> > > +examples:
> > > +  - |
> > > +    #include <dt-bindings/clock/r9a09g011-cpg.h>
> > > +    #include <dt-bindings/interrupt-controller/arm-gic.h>
> > > +
> > > +    usb3drd: usb@85070000 {
> > > +        compatible = "renesas,r9a09g011-usb3drd", "renesas,rzv2m-
> > usb3drd";
> > > +        reg = <0x85070000 0x1000>;
> > > +        clocks = <&cpg CPG_MOD R9A09G011_USB_ACLK_P>,
> > > +                 <&cpg CPG_MOD R9A09G011_USB_PCLK>;
> > > +        clock-names = "peri_axi", "apb";
> > > +        power-domains = <&cpg>;
> > > +        resets = <&cpg R9A09G011_USB_DRD_RESET>,
> > > +                 <&cpg R9A09G011_USB_ARESETN_P>;
> > > +        reset-names = "drd_reset", "aresetn_p";
> > > +        ranges;
> > > +        #address-cells = <1>;
> > > +        #size-cells = <1>;
> > > +
> > > +        usb3host: usb@85060000 {
> > > +           compatible = "renesas,r9a09g011-xhci",
> > > +                        "renesas,rzv2m-xhci";
> > > +           reg = <0x85060000 0x2000>;
> > > +           interrupts = <GIC_SPI 245 IRQ_TYPE_LEVEL_HIGH>;
> > > +           clocks = <&cpg CPG_MOD R9A09G011_USB_ACLK_H>,
> > > +                    <&cpg CPG_MOD R9A09G011_USB_PCLK>;
> > > +           clock-names = "host_axi", "reg";
> > > +           power-domains = <&cpg>;
> > > +           resets = <&cpg R9A09G011_USB_ARESETN_H>;
> > > +        };
> > > +
> > > +        usb3peri: usb3peri {
> > > +           compatible = "renesas,r9a09g011-usb3-peri",
> > > +                        "renesas,rzv2m-usb3-peri";
> > > +           interrupts = <GIC_SPI 246 IRQ_TYPE_LEVEL_HIGH>,
> > > +                        <GIC_SPI 242 IRQ_TYPE_LEVEL_HIGH>,
> > > +                        <GIC_SPI 243 IRQ_TYPE_LEVEL_HIGH>,
> > > +                        <GIC_SPI 244 IRQ_TYPE_LEVEL_HIGH>;
> > > +           interrupt-names = "all_p", "drd", "bc", "gpi";
> > > +           clocks = <&cpg CPG_MOD R9A09G011_USB_ACLK_P>,
> > > +                    <&cpg CPG_MOD R9A09G011_USB_PCLK>;
> > > +           clock-names = "aclk", "reg";
> > > +           power-domains = <&cpg>;
> > > +           resets = <&cpg R9A09G011_USB_ARESETN_P>;
> > > +        };
> > 
> > The USB device ctrlr doesn't have registers? It looks to me like you've
> > created 3 nodes for instantiating drivers rather that because you have 3
> > separate h/w blocks. Either you should split this to 2 independent nodes
> > or move usb3peri resources to the parent node. That would only be
> > interrupts because everything else is already there.
> 
> Address map of USB device controller is 0x85070000-0x85070400
> Address map of USB3 DRD is 0x85070400-0x850704FF

Then your DT should reflect that with 'reg' in usb3peri.

Why does the device ctrlr have a DRD interrupt?

> The advantage of the current split is that, 
> 
> 1) With this model, I can use USB3 storage device for booting and mounting rootFS 
> as XHCI driver is built-in and USB3 device ctrlr is usually module.

Sounds like a Linux problem. What does that have to do with the binding?

> 
> 2) To reuse the usb device controller code as much as possible.
> 
> If I create 2 independent nodes, then there will be more exported API's
> between USB3 peri and USB3 drd driver.

Why if that's a common split, then doesn't Linux have a defined 
interface?

There is no reason you can spawn 2 drivers from 1 DT node if that's what 
you need. Describe h/w blocks, not nodes for drivers. Sometimes the h/w 
isn't partitioned just like Linux would like. That's a Linux problem, 
not something to 'fix' in DT.

Rob

  reply	other threads:[~2022-12-13 15:54 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20221212172804.1277751-1-biju.das.jz@bp.renesas.com>
2022-12-12 17:27 ` [PATCH 02/16] dt-bindings: usb: Add RZ/V2M USB3DRD binding Biju Das
2022-12-12 21:17   ` Rob Herring
2022-12-13  6:43     ` Biju Das
2022-12-13 14:29   ` Rob Herring
2022-12-13 15:01     ` Biju Das
2022-12-13 15:54       ` Rob Herring [this message]
2023-01-11 14:18         ` Biju Das
2022-12-12 17:27 ` [PATCH 04/16] dt-bindings: usb: renesas,usb-xhci: Document RZ/V2M support Biju Das
2022-12-16 16:10   ` Rob Herring
2022-12-16 17:10     ` Biju Das
2022-12-12 17:27 ` [PATCH 08/16] dt-bindings: usb: renesas,usb3-peri: Update reset property Biju Das
2022-12-12 17:27 ` [PATCH 09/16] dt-bindings: usb: renesas,usb3-peri: Document RZ/V2MA bindings Biju Das
2022-12-12 17:28 ` [PATCH 13/16] arm64: dts: renesas: r9a09g011: Add USB3 peripheral node Biju Das
2022-12-12 17:28 ` [PATCH 14/16] arm64: dts: renesas: rzv2mevk2: Enable USB3 DRD and Host Biju Das
2022-12-12 17:28 ` [PATCH 15/16] arm64: dts: renesas: rzv2mevk2: Enable USB3 Peripheral Biju Das
2022-12-12 17:28 ` [PATCH 16/16] arm64: dts: renesas: rzv2mevk2: Enable USB3 role switch Biju Das

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221213155441.GA1483198-robh@kernel.org \
    --to=robh@kernel.org \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=devicetree@vger.kernel.org \
    --cc=fabrizio.castro.jz@renesas.com \
    --cc=geert+renesas@glider.be \
    --cc=gregkh@linuxfoundation.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).