diff mbox series

[1/1] dt-bindings: usb: ci-hdrc-usb2: Fix number of clocks

Message ID 20230706093928.3580544-1-alexander.stein@ew.tq-group.com (mailing list archive)
State New, archived
Headers show
Series [1/1] dt-bindings: usb: ci-hdrc-usb2: Fix number of clocks | expand

Commit Message

Alexander Stein July 6, 2023, 9:39 a.m. UTC
Some (older) IP cores require 3 clocks, named 'ipg', 'ahb' and 'per' while
more recent IP cores just require one. Fix the number and explicitly
state the clock-names.

Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
From I can tell, is that imx25, imx27, imx35 have specified 3 clocks in
their DT.
IMHO minItems for 'clock-names' can be removed as I presume that this
property is not set when only one clock is used.

 Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Rob Herring (Arm) July 6, 2023, 7:18 p.m. UTC | #1
On Thu, Jul 06, 2023 at 11:39:28AM +0200, Alexander Stein wrote:
> Some (older) IP cores require 3 clocks, named 'ipg', 'ahb' and 'per' while
> more recent IP cores just require one. Fix the number and explicitly
> state the clock-names.
> 
> Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> ---
> >From I can tell, is that imx25, imx27, imx35 have specified 3 clocks in
> their DT.
> IMHO minItems for 'clock-names' can be removed as I presume that this
> property is not set when only one clock is used.

Rather than presume, did you test that? Well, I did[1] and can confirm.

Reviewed-by: Rob Herring <robh@kernel.org>

[1] https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20230706093928.3580544-1-alexander.stein@ew.tq-group.com/
Alexander Stein July 7, 2023, 5:59 a.m. UTC | #2
Hi,

Am Donnerstag, 6. Juli 2023, 21:18:25 CEST schrieb Rob Herring:
> On Thu, Jul 06, 2023 at 11:39:28AM +0200, Alexander Stein wrote:
> > Some (older) IP cores require 3 clocks, named 'ipg', 'ahb' and 'per' while
> > more recent IP cores just require one. Fix the number and explicitly
> > state the clock-names.
> > 
> > Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> > ---
> > 
> > >From I can tell, is that imx25, imx27, imx35 have specified 3 clocks in
> > 
> > their DT.
> > IMHO minItems for 'clock-names' can be removed as I presume that this
> > property is not set when only one clock is used.
> 
> Rather than presume, did you test that? Well, I did[1] and can confirm.

Okay, probably my wording was bad. There are a lot of users (e.g. imx8mm, 
imx8mn) which only have one clock but still provide some clock-names property.
It works just because it is not called 'ipg', but some SoC specific clock 
name.
So this patch should cause some warnings, but these users were incorrect in 
the first place. Following up this patch, they need to be fixed.

Best regards,
Alexander

> Reviewed-by: Rob Herring <robh@kernel.org>
> 
> [1]
> https://patchwork.ozlabs.org/project/devicetree-bindings/patch/202307060939
> 28.3580544-1-alexander.stein@ew.tq-group.com/
Xu Yang July 7, 2023, 7:06 a.m. UTC | #3
Hi Alexander,

> -----Original Message-----
> 
> Hi,
> 
> Am Donnerstag, 6. Juli 2023, 21:18:25 CEST schrieb Rob Herring:
> > On Thu, Jul 06, 2023 at 11:39:28AM +0200, Alexander Stein wrote:
> > > Some (older) IP cores require 3 clocks, named 'ipg', 'ahb' and 'per' while
> > > more recent IP cores just require one. Fix the number and explicitly
> > > state the clock-names.
> > >
> > > Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> > > ---
> > >
> > > >From I can tell, is that imx25, imx27, imx35 have specified 3 clocks in
> > >
> > > their DT.
> > > IMHO minItems for 'clock-names' can be removed as I presume that this
> > > property is not set when only one clock is used.
> >
> > Rather than presume, did you test that? Well, I did[1] and can confirm.
> 
> Okay, probably my wording was bad. There are a lot of users (e.g. imx8mm,
> imx8mn) which only have one clock but still provide some clock-names property.
> It works just because it is not called 'ipg', but some SoC specific clock
> name.
> So this patch should cause some warnings, but these users were incorrect in
> the first place. Following up this patch, they need to be fixed.

It means that all the usb nodes need to contain 'ipg', 'ahb', 'per' clock
names with your patch. It's unexpected due to only imx25, imx27, imx35
need this. I think you need to narrow this property to specific SoCs.

Thanks,
Xu Yang

> 
> Best regards,
> Alexander
> 
> > Reviewed-by: Rob Herring <robh@kernel.org>
> >
Alexander Stein July 7, 2023, 8:34 a.m. UTC | #4
Hi Xu Yang,

thanks for your feedback.

Am Freitag, 7. Juli 2023, 09:06:09 CEST schrieb Xu Yang:
> Hi Alexander,
> 
> > -----Original Message-----
> > 
> > Hi,
> > 
> > Am Donnerstag, 6. Juli 2023, 21:18:25 CEST schrieb Rob Herring:
> > > On Thu, Jul 06, 2023 at 11:39:28AM +0200, Alexander Stein wrote:
> > > > Some (older) IP cores require 3 clocks, named 'ipg', 'ahb' and 'per'
> > > > while
> > > > more recent IP cores just require one. Fix the number and explicitly
> > > > state the clock-names.
> > > > 
> > > > Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> > > > ---
> > > > 
> > > > >From I can tell, is that imx25, imx27, imx35 have specified 3 clocks
> > > > >in
> > > > 
> > > > their DT.
> > > > IMHO minItems for 'clock-names' can be removed as I presume that this
> > > > property is not set when only one clock is used.
> > > 
> > > Rather than presume, did you test that? Well, I did[1] and can confirm.
> > 
> > Okay, probably my wording was bad. There are a lot of users (e.g. imx8mm,
> > imx8mn) which only have one clock but still provide some clock-names
> > property. It works just because it is not called 'ipg', but some SoC
> > specific clock name.
> > So this patch should cause some warnings, but these users were incorrect
> > in
> > the first place. Following up this patch, they need to be fixed.
> 
> It means that all the usb nodes need to contain 'ipg', 'ahb', 'per' clock
> names with your patch.

That's not true. They only need these 3 clocks iff they specify clock-names. 
If there is only one clock, there is no need to specify clock-names.
TBH: If there is just one clock, which is not called 'ipg', the driver doesn't 
care about the name at all.

> It's unexpected due to only imx25, imx27, imx35
> need this. I think you need to narrow this property to specific SoCs.

That's a good idea, but I would consider adding property conditionals as a 
follow up patch.

Best regards,
Alexander

> Thanks,
> Xu Yang
> 
> > Best regards,
> > Alexander
> > 
> > > Reviewed-by: Rob Herring <robh@kernel.org>
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml
index 782402800d4a..8aab1e831578 100644
--- a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml
+++ b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml
@@ -76,11 +76,13 @@  properties:
 
   clocks:
     minItems: 1
-    maxItems: 2
+    maxItems: 3
 
   clock-names:
-    minItems: 1
-    maxItems: 2
+    items:
+      - const: ipg
+      - const: ahb
+      - const: per
 
   dr_mode: true