1.. SPDX-License-Identifier: GPL-2.0 2 3========================= 4MDIO bus and PHYs in ACPI 5========================= 6 7The PHYs on an MDIO bus [1] are probed and registered using 8fwnode_mdiobus_register_phy(). 9 10Later, for connecting these PHYs to their respective MACs, the PHYs registered 11on the MDIO bus have to be referenced. 12 13This document introduces two _DSD properties that are to be used 14for connecting PHYs on the MDIO bus [3] to the MAC layer. 15 16These properties are defined in accordance with the "Device 17Properties UUID For _DSD" [2] document and the 18daffd814-6eba-4d8c-8a91-bc9bbf4aa301 UUID must be used in the Device 19Data Descriptors containing them. 20 21phy-handle 22---------- 23For each MAC node, a device property "phy-handle" is used to reference 24the PHY that is registered on an MDIO bus. This is mandatory for 25network interfaces that have PHYs connected to MAC via MDIO bus. 26 27During the MDIO bus driver initialization, PHYs on this bus are probed 28using the _ADR object as shown below and are registered on the MDIO bus. 29 30.. code-block:: none 31 32 Scope(\_SB.MDI0) 33 { 34 Device(PHY1) { 35 Name (_ADR, 0x1) 36 } // end of PHY1 37 38 Device(PHY2) { 39 Name (_ADR, 0x2) 40 } // end of PHY2 41 } 42 43Later, during the MAC driver initialization, the registered PHY devices 44have to be retrieved from the MDIO bus. For this, the MAC driver needs 45references to the previously registered PHYs which are provided 46as device object references (e.g. \_SB.MDI0.PHY1). 47 48phy-mode 49-------- 50The "phy-mode" _DSD property is used to describe the connection to 51the PHY. The valid values for "phy-mode" are defined in [4]. 52 53The following ASL example illustrates the usage of these properties. 54 55DSDT entry for MDIO node 56------------------------ 57 58The MDIO bus has an SoC component (MDIO controller) and a platform 59component (PHYs on the MDIO bus). 60 61a) Silicon Component 62This node describes the MDIO controller, MDI0 63--------------------------------------------- 64 65.. code-block:: none 66 67 Scope(_SB) 68 { 69 Device(MDI0) { 70 Name(_HID, "NXP0006") 71 Name(_CCA, 1) 72 Name(_UID, 0) 73 Name(_CRS, ResourceTemplate() { 74 Memory32Fixed(ReadWrite, MDI0_BASE, MDI_LEN) 75 Interrupt(ResourceConsumer, Level, ActiveHigh, Shared) 76 { 77 MDI0_IT 78 } 79 }) // end of _CRS for MDI0 80 } // end of MDI0 81 } 82 83b) Platform Component 84The PHY1 and PHY2 nodes represent the PHYs connected to MDIO bus MDI0 85--------------------------------------------------------------------- 86 87.. code-block:: none 88 89 Scope(\_SB.MDI0) 90 { 91 Device(PHY1) { 92 Name (_ADR, 0x1) 93 } // end of PHY1 94 95 Device(PHY2) { 96 Name (_ADR, 0x2) 97 } // end of PHY2 98 } 99 100DSDT entries representing MAC nodes 101----------------------------------- 102 103Below are the MAC nodes where PHY nodes are referenced. 104phy-mode and phy-handle are used as explained earlier. 105------------------------------------------------------ 106 107.. code-block:: none 108 109 Scope(\_SB.MCE0.PR17) 110 { 111 Name (_DSD, Package () { 112 ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), 113 Package () { 114 Package (2) {"phy-mode", "rgmii-id"}, 115 Package (2) {"phy-handle", \_SB.MDI0.PHY1} 116 } 117 }) 118 } 119 120 Scope(\_SB.MCE0.PR18) 121 { 122 Name (_DSD, Package () { 123 ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), 124 Package () { 125 Package (2) {"phy-mode", "rgmii-id"}, 126 Package (2) {"phy-handle", \_SB.MDI0.PHY2}} 127 } 128 }) 129 } 130 131References 132========== 133 134[1] Documentation/networking/phy.rst 135 136[2] https://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdf 137 138[3] Documentation/firmware-guide/acpi/DSD-properties-rules.rst 139 140[4] Documentation/devicetree/bindings/net/ethernet-controller.yaml 141