Re: [net-next PATCH v1 1/7] Documentation: ACPI: DSD: Document MDIO PHY
From: Calvin Johnson
Date: Thu Oct 01 2020 - 09:27:09 EST
Hi Rafael,
On Wed, Sep 30, 2020 at 06:37:09PM +0200, Rafael J. Wysocki wrote:
> On Wed, Sep 30, 2020 at 6:05 PM Calvin Johnson
> <calvin.johnson@xxxxxxxxxxx> wrote:
> >
> > Introduce ACPI mechanism to get PHYs registered on a MDIO bus and
> > provide them to be connected to MAC.
> >
> > Describe properties "phy-handle" and "phy-mode".
> >
> > Signed-off-by: Calvin Johnson <calvin.johnson@xxxxxxxxxxx>
> > ---
> >
> > Documentation/firmware-guide/acpi/dsd/phy.rst | 78 +++++++++++++++++++
> > 1 file changed, 78 insertions(+)
> > create mode 100644 Documentation/firmware-guide/acpi/dsd/phy.rst
> >
> > diff --git a/Documentation/firmware-guide/acpi/dsd/phy.rst b/Documentation/firmware-guide/acpi/dsd/phy.rst
> > new file mode 100644
> > index 000000000000..f10feb24ec1c
> > --- /dev/null
> > +++ b/Documentation/firmware-guide/acpi/dsd/phy.rst
> > @@ -0,0 +1,78 @@
> > +.. SPDX-License-Identifier: GPL-2.0
> > +
> > +=========================
> > +MDIO bus and PHYs in ACPI
> > +=========================
> > +
> > +The PHYs on an mdiobus are probed and registered using
> > +fwnode_mdiobus_register_phy().
> > +Later, for connecting these PHYs to MAC, the PHYs registered on the
> > +mdiobus have to be referenced.
> > +
> > +phy-handle
> > +-----------
> > +For each MAC node, a property "phy-handle" is used to reference the
> > +PHY that is registered on an MDIO bus.
>
> It is not clear what "a property" means in this context.
>
In rev-2, I'll add more info on this.
During the MDIO bus driver initialization, PHYs on this bus are probed
using the _ADR object as shown below and are registered on the mdio bus.
Scope(\_SB.MDI0)
{
Device(PHY1) {
Name (_ADR, 0x1)
} // end of PHY1
Device(PHY2) {
Name (_ADR, 0x2)
} // end of PHY2
}
Later, during the MAC driver initialization, the registered PHY devices
have to be retrieved from the mdio bus. For this, MAC driver needs reference
to the previously registered PHYs which are provided using reference to the
device as {\_SB.MDI0.PHY1}.
> This should refer to the documents introducing the _DSD-based generic
> device properties rules, including the GUID used below.
>
Sure. I'll refer "Documentation/firmware-guide/acpi/DSD-properties-rules.rst"
> You need to say whether or not the property is mandatory and if it
> isn't mandatory, you need to say what the lack of it means.
>
I'll do that.
> > +
> > +phy-mode
> > +--------
> > +Property "phy-mode" defines the type of PHY interface.
>
> This needs to be more detailed too, IMO. At the very least, please
> list all of the possible values of it and document their meaning.
>
> > +
> > +An example of this is shown below::
> > +
> > +DSDT entry for MACs where PHY nodes are referenced
> > +--------------------------------------------------
> > + Scope(\_SB.MCE0.PR17) // 1G
> > + {
> > + Name (_DSD, Package () {
> > + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
> > + Package () {
> > + Package (2) {"phy-mode", "rgmii-id"},
> > + Package (2) {"phy-handle", Package (){\_SB.MDI0.PHY1}}
>
> What is "phy-handle"?
>
> You haven't introduced it above.
I thought I introduced it earlier in this document as a property. Ofcourse,
more info needs to be added as you mentioned. Other than that am I missing
something?
I've a correction here.
Based on referring some more documents, I'll be using
Package (2) {"phy-handle",\_SB.MDI0.PHY1}
instead of
Package (2) {"phy-handle", Package (){\_SB.MDI0.PHY1}}
.
> > + }
> > + })
> > + }
> > +
> > + Scope(\_SB.MCE0.PR18) // 1G
> > + {
> > + Name (_DSD, Package () {
> > + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
> > + Package () {
> > + Package (2) {"phy-mode", "rgmii-id"},
> > + Package (2) {"phy-handle", Package (){\_SB.MDI0.PHY2}}
> > + }
> > + })
> > + }
> > +
> > +DSDT entry for MDIO node
> > +------------------------
> > +a) Silicon Component
>
> What is this device, exactly?
I'll explain it more clearly.
>
> > +--------------------
> > + Scope(_SB)
> > + {
> > + Device(MDI0) {
> > + Name(_HID, "NXP0006")
> > + Name(_CCA, 1)
> > + Name(_UID, 0)
> > + Name(_CRS, ResourceTemplate() {
> > + Memory32Fixed(ReadWrite, MDI0_BASE, MDI_LEN)
> > + Interrupt(ResourceConsumer, Level, ActiveHigh, Shared)
> > + {
> > + MDI0_IT
> > + }
> > + }) // end of _CRS for MDI0
> > + } // end of MDI0
> > + }
> > +
> > +b) Platform Component
> > +---------------------
> > + Scope(\_SB.MDI0)
> > + {
> > + Device(PHY1) {
> > + Name (_ADR, 0x1)
> > + } // end of PHY1
> > +
> > + Device(PHY2) {
> > + Name (_ADR, 0x2)
> > + } // end of PHY2
> > + }
> > --
>
> What is the connection between the last two pieces of ASL and the _DSD
> definitions above?
In rev-2, I'll explain the relation between these pieces. What I tried to show
is that the MDIO bus has an SoC component(mdio controller) and a platform
component(PHYs on the mdiobus).
In the MAC nodes, the PHYs are referenced and that is done using the "phy-handle"
property.
Thanks
Calvin