diff mbox series

[06/17] dt-bindings: net: mscc-miim: Add resets property

Message ID 20240430083730.134918-7-herve.codina@bootlin.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series Add support for the LAN966x PCI device using a DT overlay | expand

Checks

Context Check Description
netdev/series_format fail Series longer than 15 patches
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 8 this patch: 8
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 9 of 9 maintainers
netdev/build_clang success Errors and warnings before: 8 this patch: 8
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 8 this patch: 8
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 14 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Herve Codina April 30, 2024, 8:37 a.m. UTC
Add the (optional) resets property.
The mscc-miim device is impacted by the switch reset especially when the
mscc-miim device is used as part of the LAN966x PCI device.

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
---
 Documentation/devicetree/bindings/net/mscc,miim.yaml | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Andrew Lunn April 30, 2024, 1:55 p.m. UTC | #1
On Tue, Apr 30, 2024 at 10:37:15AM +0200, Herve Codina wrote:
> Add the (optional) resets property.
> The mscc-miim device is impacted by the switch reset especially when the
> mscc-miim device is used as part of the LAN966x PCI device.
> 
> Signed-off-by: Herve Codina <herve.codina@bootlin.com>
> ---
>  Documentation/devicetree/bindings/net/mscc,miim.yaml | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/net/mscc,miim.yaml b/Documentation/devicetree/bindings/net/mscc,miim.yaml
> index 5b292e7c9e46..a8c92cec85a6 100644
> --- a/Documentation/devicetree/bindings/net/mscc,miim.yaml
> +++ b/Documentation/devicetree/bindings/net/mscc,miim.yaml
> @@ -38,6 +38,14 @@ properties:
>  
>    clock-frequency: true
>  
> +  resets:
> +    items:
> +      - description: Reset controller used for switch core reset (soft reset)

A follow up to the comment on the next patch. I think it should be
made clear in the patch and the binding, the aim is to reset the MDIO
bus master, not the switch. It just happens that the MDIO bus master
is within the domain of the switch core, and so the switch core reset
also resets the MDIO bus master.

Architecturally, this is important. I would not expect the MDIO driver
to be resetting the switch, the switch driver should be doing
that. But we have seen some odd Qualcomm patches where the MDIO driver
has been doing things outside the scope of MDIO, playing with resets
and clocks which are not directly related to the MDIO bus master. I
want to avoid any confusion here, especially when Qualcomm tries
again, and maybe points at this code.

	Andrew
Herve Codina April 30, 2024, 3:40 p.m. UTC | #2
Hi Andrew,

On Tue, 30 Apr 2024 15:55:58 +0200
Andrew Lunn <andrew@lunn.ch> wrote:

> On Tue, Apr 30, 2024 at 10:37:15AM +0200, Herve Codina wrote:
> > Add the (optional) resets property.
> > The mscc-miim device is impacted by the switch reset especially when the
> > mscc-miim device is used as part of the LAN966x PCI device.
> > 
> > Signed-off-by: Herve Codina <herve.codina@bootlin.com>
> > ---
> >  Documentation/devicetree/bindings/net/mscc,miim.yaml | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/net/mscc,miim.yaml b/Documentation/devicetree/bindings/net/mscc,miim.yaml
> > index 5b292e7c9e46..a8c92cec85a6 100644
> > --- a/Documentation/devicetree/bindings/net/mscc,miim.yaml
> > +++ b/Documentation/devicetree/bindings/net/mscc,miim.yaml
> > @@ -38,6 +38,14 @@ properties:
> >  
> >    clock-frequency: true
> >  
> > +  resets:
> > +    items:
> > +      - description: Reset controller used for switch core reset (soft reset)  
> 
> A follow up to the comment on the next patch. I think it should be
> made clear in the patch and the binding, the aim is to reset the MDIO
> bus master, not the switch. It just happens that the MDIO bus master
> is within the domain of the switch core, and so the switch core reset
> also resets the MDIO bus master.

Exactly.

> 
> Architecturally, this is important. I would not expect the MDIO driver
> to be resetting the switch, the switch driver should be doing
> that. But we have seen some odd Qualcomm patches where the MDIO driver
> has been doing things outside the scope of MDIO, playing with resets
> and clocks which are not directly related to the MDIO bus master. I
> want to avoid any confusion here, especially when Qualcomm tries
> again, and maybe points at this code.
> 

Sure.

We have the same construction with the pinctrl driver used in the LAN966x
  Documentation/devicetree/bindings/pinctrl/mscc,ocelot-pinctrl.yaml

The reset name is 'switch' in the pinctrl binding.
I can use the same description here as the one present in the pinctrl binding:
  description: Optional shared switch reset.
and keep 'switch' as reset name here (consistent with pinctrl reset name).

What do you think about that ?

Best regards,
Hervé
Andrew Lunn April 30, 2024, 4:31 p.m. UTC | #3
> We have the same construction with the pinctrl driver used in the LAN966x
>   Documentation/devicetree/bindings/pinctrl/mscc,ocelot-pinctrl.yaml
> 
> The reset name is 'switch' in the pinctrl binding.
> I can use the same description here as the one present in the pinctrl binding:
>   description: Optional shared switch reset.
> and keep 'switch' as reset name here (consistent with pinctrl reset name).
> 
> What do you think about that ?

It would be good to document what it is shared with. So it seems to be
the switch itself, pinctl and MDIO? Anything else?

    Andrew
Herve Codina May 2, 2024, 9:50 a.m. UTC | #4
Hi Andrew,

On Tue, 30 Apr 2024 18:31:46 +0200
Andrew Lunn <andrew@lunn.ch> wrote:

> > We have the same construction with the pinctrl driver used in the LAN966x
> >   Documentation/devicetree/bindings/pinctrl/mscc,ocelot-pinctrl.yaml
> > 
> > The reset name is 'switch' in the pinctrl binding.
> > I can use the same description here as the one present in the pinctrl binding:
> >   description: Optional shared switch reset.
> > and keep 'switch' as reset name here (consistent with pinctrl reset name).
> > 
> > What do you think about that ?  
> 
> It would be good to document what it is shared with. So it seems to be
> the switch itself, pinctl and MDIO? Anything else?
> 

To be honest, I know that the GPIO controller (microchip,sparx5-sgpio) is
impacted but I don't know if anything else is impacted by this reset.
I can update the description with:
  description:
    Optional shared switch reset.
    This reset is shared with at least pinctrl, GPIO, MDIO and the switch
    itself.

Does it sound better ?

Best regards
Hervé
Conor Dooley May 2, 2024, 10:31 a.m. UTC | #5
On Thu, May 02, 2024 at 11:50:43AM +0200, Herve Codina wrote:
> Hi Andrew,
> 
> On Tue, 30 Apr 2024 18:31:46 +0200
> Andrew Lunn <andrew@lunn.ch> wrote:
> 
> > > We have the same construction with the pinctrl driver used in the LAN966x
> > >   Documentation/devicetree/bindings/pinctrl/mscc,ocelot-pinctrl.yaml
> > > 
> > > The reset name is 'switch' in the pinctrl binding.
> > > I can use the same description here as the one present in the pinctrl binding:
> > >   description: Optional shared switch reset.
> > > and keep 'switch' as reset name here (consistent with pinctrl reset name).
> > > 
> > > What do you think about that ?  
> > 
> > It would be good to document what it is shared with. So it seems to be
> > the switch itself, pinctl and MDIO? Anything else?
> > 
> 
> To be honest, I know that the GPIO controller (microchip,sparx5-sgpio) is
> impacted but I don't know if anything else is impacted by this reset.
> I can update the description with:
>   description:
>     Optional shared switch reset.
>     This reset is shared with at least pinctrl, GPIO, MDIO and the switch
>     itself.
> 
> Does it sound better ?

$dayjob hat off, bindings hat on: If you don't know, can we get someone
from Microchip (there's some and a list in CC) to figure it out?

Cheers,
Conor.
Andrew Lunn May 2, 2024, 12:26 p.m. UTC | #6
On Thu, May 02, 2024 at 11:31:00AM +0100, Conor Dooley wrote:
> On Thu, May 02, 2024 at 11:50:43AM +0200, Herve Codina wrote:
> > Hi Andrew,
> > 
> > On Tue, 30 Apr 2024 18:31:46 +0200
> > Andrew Lunn <andrew@lunn.ch> wrote:
> > 
> > > > We have the same construction with the pinctrl driver used in the LAN966x
> > > >   Documentation/devicetree/bindings/pinctrl/mscc,ocelot-pinctrl.yaml
> > > > 
> > > > The reset name is 'switch' in the pinctrl binding.
> > > > I can use the same description here as the one present in the pinctrl binding:
> > > >   description: Optional shared switch reset.
> > > > and keep 'switch' as reset name here (consistent with pinctrl reset name).
> > > > 
> > > > What do you think about that ?  
> > > 
> > > It would be good to document what it is shared with. So it seems to be
> > > the switch itself, pinctl and MDIO? Anything else?
> > > 
> > 
> > To be honest, I know that the GPIO controller (microchip,sparx5-sgpio) is
> > impacted but I don't know if anything else is impacted by this reset.
> > I can update the description with:
> >   description:
> >     Optional shared switch reset.
> >     This reset is shared with at least pinctrl, GPIO, MDIO and the switch
> >     itself.
> > 
> > Does it sound better ?
> 
> $dayjob hat off, bindings hat on: If you don't know, can we get someone
> from Microchip (there's some and a list in CC) to figure it out?

That is probably a good idea, there is potential for hard to find bugs
here, when a device gets an unexpected reset. Change the order things
probe, or an unexpected EPRODE_DEFER could be interesting.

       Andrew
Alexandre Belloni May 2, 2024, 1:22 p.m. UTC | #7
On 02/05/2024 14:26:36+0200, Andrew Lunn wrote:
> On Thu, May 02, 2024 at 11:31:00AM +0100, Conor Dooley wrote:
> > On Thu, May 02, 2024 at 11:50:43AM +0200, Herve Codina wrote:
> > > Hi Andrew,
> > > 
> > > On Tue, 30 Apr 2024 18:31:46 +0200
> > > Andrew Lunn <andrew@lunn.ch> wrote:
> > > 
> > > > > We have the same construction with the pinctrl driver used in the LAN966x
> > > > >   Documentation/devicetree/bindings/pinctrl/mscc,ocelot-pinctrl.yaml
> > > > > 
> > > > > The reset name is 'switch' in the pinctrl binding.
> > > > > I can use the same description here as the one present in the pinctrl binding:
> > > > >   description: Optional shared switch reset.
> > > > > and keep 'switch' as reset name here (consistent with pinctrl reset name).
> > > > > 
> > > > > What do you think about that ?  
> > > > 
> > > > It would be good to document what it is shared with. So it seems to be
> > > > the switch itself, pinctl and MDIO? Anything else?
> > > > 
> > > 
> > > To be honest, I know that the GPIO controller (microchip,sparx5-sgpio) is
> > > impacted but I don't know if anything else is impacted by this reset.
> > > I can update the description with:
> > >   description:
> > >     Optional shared switch reset.
> > >     This reset is shared with at least pinctrl, GPIO, MDIO and the switch
> > >     itself.
> > > 
> > > Does it sound better ?
> > 
> > $dayjob hat off, bindings hat on: If you don't know, can we get someone
> > from Microchip (there's some and a list in CC) to figure it out?
> 
> That is probably a good idea, there is potential for hard to find bugs
> here, when a device gets an unexpected reset. Change the order things
> probe, or an unexpected EPRODE_DEFER could be interesting.
> 


The datasheet states:
"The VCore system comprises all the blocks attached to the VCore Shared
Bus (SBA), including the PCIe, DDR, frame DMA, SI slave, and MIIM slave
blocks. The device includes all the blocks attached to the Switch Core
Register Bus (CSR) including the VRAP slave. For more information about
the VCore System blocks, see Figure 5-1."

However, the reset driver protects the VCORE itself by setting bit 5.
Everything else is going to be reset.
Herve Codina May 3, 2024, 2:21 p.m. UTC | #8
Hi,

On Thu, 2 May 2024 15:22:09 +0200
Alexandre Belloni <alexandre.belloni@bootlin.com> wrote:

> On 02/05/2024 14:26:36+0200, Andrew Lunn wrote:
> > On Thu, May 02, 2024 at 11:31:00AM +0100, Conor Dooley wrote:  
> > > On Thu, May 02, 2024 at 11:50:43AM +0200, Herve Codina wrote:  
> > > > Hi Andrew,
> > > > 
> > > > On Tue, 30 Apr 2024 18:31:46 +0200
> > > > Andrew Lunn <andrew@lunn.ch> wrote:
> > > >   
> > > > > > We have the same construction with the pinctrl driver used in the LAN966x
> > > > > >   Documentation/devicetree/bindings/pinctrl/mscc,ocelot-pinctrl.yaml
> > > > > > 
> > > > > > The reset name is 'switch' in the pinctrl binding.
> > > > > > I can use the same description here as the one present in the pinctrl binding:
> > > > > >   description: Optional shared switch reset.
> > > > > > and keep 'switch' as reset name here (consistent with pinctrl reset name).
> > > > > > 
> > > > > > What do you think about that ?    
> > > > > 
> > > > > It would be good to document what it is shared with. So it seems to be
> > > > > the switch itself, pinctl and MDIO? Anything else?
> > > > >   
> > > > 
> > > > To be honest, I know that the GPIO controller (microchip,sparx5-sgpio) is
> > > > impacted but I don't know if anything else is impacted by this reset.
> > > > I can update the description with:
> > > >   description:
> > > >     Optional shared switch reset.
> > > >     This reset is shared with at least pinctrl, GPIO, MDIO and the switch
> > > >     itself.
> > > > 
> > > > Does it sound better ?  
> > > 
> > > $dayjob hat off, bindings hat on: If you don't know, can we get someone
> > > from Microchip (there's some and a list in CC) to figure it out?  
> > 
> > That is probably a good idea, there is potential for hard to find bugs
> > here, when a device gets an unexpected reset. Change the order things
> > probe, or an unexpected EPRODE_DEFER could be interesting.
> >   
> 
> 
> The datasheet states:
> "The VCore system comprises all the blocks attached to the VCore Shared
> Bus (SBA), including the PCIe, DDR, frame DMA, SI slave, and MIIM slave
> blocks. The device includes all the blocks attached to the Switch Core
> Register Bus (CSR) including the VRAP slave. For more information about
> the VCore System blocks, see Figure 5-1."
> 
> However, the reset driver protects the VCORE itself by setting bit 5.
> Everything else is going to be reset.
> 

Right,
I will update the reset description with:
  description:
    Optional shared switch reset.
    This reset is shared with all blocks attached to the Switch Core Register
    Bus (CSR) including VRAP slave.

Is that better ?

Best regards,
Hervé
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/net/mscc,miim.yaml b/Documentation/devicetree/bindings/net/mscc,miim.yaml
index 5b292e7c9e46..a8c92cec85a6 100644
--- a/Documentation/devicetree/bindings/net/mscc,miim.yaml
+++ b/Documentation/devicetree/bindings/net/mscc,miim.yaml
@@ -38,6 +38,14 @@  properties:
 
   clock-frequency: true
 
+  resets:
+    items:
+      - description: Reset controller used for switch core reset (soft reset)
+
+  reset-names:
+    items:
+      - const: switch
+
 required:
   - compatible
   - reg