1 .. SPDX-License-Identifier: GPL-2.0 1 .. SPDX-License-Identifier: GPL-2.0 2 2 3 ========================= 3 ========================= 4 MDIO bus and PHYs in ACPI 4 MDIO bus and PHYs in ACPI 5 ========================= 5 ========================= 6 6 7 The PHYs on an MDIO bus [phy] are probed and r 7 The PHYs on an MDIO bus [phy] are probed and registered using 8 fwnode_mdiobus_register_phy(). 8 fwnode_mdiobus_register_phy(). 9 9 10 Later, for connecting these PHYs to their resp 10 Later, for connecting these PHYs to their respective MACs, the PHYs registered 11 on the MDIO bus have to be referenced. 11 on the MDIO bus have to be referenced. 12 12 13 This document introduces two _DSD properties t 13 This document introduces two _DSD properties that are to be used 14 for connecting PHYs on the MDIO bus [dsd-prope 14 for connecting PHYs on the MDIO bus [dsd-properties-rules] to the MAC layer. 15 15 16 These properties are defined in accordance wit 16 These properties are defined in accordance with the "Device 17 Properties UUID For _DSD" [dsd-guide] document 17 Properties UUID For _DSD" [dsd-guide] document and the 18 daffd814-6eba-4d8c-8a91-bc9bbf4aa301 UUID must 18 daffd814-6eba-4d8c-8a91-bc9bbf4aa301 UUID must be used in the Device 19 Data Descriptors containing them. 19 Data Descriptors containing them. 20 20 21 phy-handle 21 phy-handle 22 ---------- 22 ---------- 23 For each MAC node, a device property "phy-hand 23 For each MAC node, a device property "phy-handle" is used to reference 24 the PHY that is registered on an MDIO bus. Thi 24 the PHY that is registered on an MDIO bus. This is mandatory for 25 network interfaces that have PHYs connected to 25 network interfaces that have PHYs connected to MAC via MDIO bus. 26 26 27 During the MDIO bus driver initialization, PHY 27 During the MDIO bus driver initialization, PHYs on this bus are probed 28 using the _ADR object as shown below and are r 28 using the _ADR object as shown below and are registered on the MDIO bus. 29 29 30 .. code-block:: none 30 .. code-block:: none 31 31 32 Scope(\_SB.MDI0) 32 Scope(\_SB.MDI0) 33 { 33 { 34 Device(PHY1) { 34 Device(PHY1) { 35 Name (_ADR, 0x1) 35 Name (_ADR, 0x1) 36 } // end of PHY1 36 } // end of PHY1 37 37 38 Device(PHY2) { 38 Device(PHY2) { 39 Name (_ADR, 0x2) 39 Name (_ADR, 0x2) 40 } // end of PHY2 40 } // end of PHY2 41 } 41 } 42 42 43 Later, during the MAC driver initialization, t 43 Later, during the MAC driver initialization, the registered PHY devices 44 have to be retrieved from the MDIO bus. For th 44 have to be retrieved from the MDIO bus. For this, the MAC driver needs 45 references to the previously registered PHYs w 45 references to the previously registered PHYs which are provided 46 as device object references (e.g. \_SB.MDI0.PH 46 as device object references (e.g. \_SB.MDI0.PHY1). 47 47 48 phy-mode 48 phy-mode 49 -------- 49 -------- 50 The "phy-mode" _DSD property is used to descri 50 The "phy-mode" _DSD property is used to describe the connection to 51 the PHY. The valid values for "phy-mode" are d 51 the PHY. The valid values for "phy-mode" are defined in [ethernet-controller]. 52 52 53 managed 53 managed 54 ------- 54 ------- 55 Optional property, which specifies the PHY man 55 Optional property, which specifies the PHY management type. 56 The valid values for "managed" are defined in 56 The valid values for "managed" are defined in [ethernet-controller]. 57 57 58 fixed-link 58 fixed-link 59 ---------- 59 ---------- 60 The "fixed-link" is described by a data-only s 60 The "fixed-link" is described by a data-only subnode of the 61 MAC port, which is linked in the _DSD package 61 MAC port, which is linked in the _DSD package via 62 hierarchical data extension (UUID dbb8e3e6-588 62 hierarchical data extension (UUID dbb8e3e6-5886-4ba6-8795-1319f52a966b 63 in accordance with [dsd-guide] "_DSD Implement 63 in accordance with [dsd-guide] "_DSD Implementation Guide" document). 64 The subnode should comprise a required propert 64 The subnode should comprise a required property ("speed") and 65 possibly the optional ones - complete list of 65 possibly the optional ones - complete list of parameters and 66 their values are specified in [ethernet-contro 66 their values are specified in [ethernet-controller]. 67 67 68 The following ASL example illustrates the usag 68 The following ASL example illustrates the usage of these properties. 69 69 70 DSDT entry for MDIO node 70 DSDT entry for MDIO node 71 ------------------------ 71 ------------------------ 72 72 73 The MDIO bus has an SoC component (MDIO contro 73 The MDIO bus has an SoC component (MDIO controller) and a platform 74 component (PHYs on the MDIO bus). 74 component (PHYs on the MDIO bus). 75 75 76 a) Silicon Component 76 a) Silicon Component 77 This node describes the MDIO controller, MDI0 77 This node describes the MDIO controller, MDI0 78 --------------------------------------------- 78 --------------------------------------------- 79 79 80 .. code-block:: none 80 .. code-block:: none 81 81 82 Scope(_SB) 82 Scope(_SB) 83 { 83 { 84 Device(MDI0) { 84 Device(MDI0) { 85 Name(_HID, "NXP0006") 85 Name(_HID, "NXP0006") 86 Name(_CCA, 1) 86 Name(_CCA, 1) 87 Name(_UID, 0) 87 Name(_UID, 0) 88 Name(_CRS, ResourceTemplate() { 88 Name(_CRS, ResourceTemplate() { 89 Memory32Fixed(ReadWrite, MDI0_BA 89 Memory32Fixed(ReadWrite, MDI0_BASE, MDI_LEN) 90 Interrupt(ResourceConsumer, Leve 90 Interrupt(ResourceConsumer, Level, ActiveHigh, Shared) 91 { 91 { 92 MDI0_IT 92 MDI0_IT 93 } 93 } 94 }) // end of _CRS for MDI0 94 }) // end of _CRS for MDI0 95 } // end of MDI0 95 } // end of MDI0 96 } 96 } 97 97 98 b) Platform Component 98 b) Platform Component 99 The PHY1 and PHY2 nodes represent the PHYs con 99 The PHY1 and PHY2 nodes represent the PHYs connected to MDIO bus MDI0 100 ---------------------------------------------- 100 --------------------------------------------------------------------- 101 101 102 .. code-block:: none 102 .. code-block:: none 103 103 104 Scope(\_SB.MDI0) 104 Scope(\_SB.MDI0) 105 { 105 { 106 Device(PHY1) { 106 Device(PHY1) { 107 Name (_ADR, 0x1) 107 Name (_ADR, 0x1) 108 } // end of PHY1 108 } // end of PHY1 109 109 110 Device(PHY2) { 110 Device(PHY2) { 111 Name (_ADR, 0x2) 111 Name (_ADR, 0x2) 112 } // end of PHY2 112 } // end of PHY2 113 } 113 } 114 114 115 DSDT entries representing MAC nodes 115 DSDT entries representing MAC nodes 116 ----------------------------------- 116 ----------------------------------- 117 117 118 Below are the MAC nodes where PHY nodes are re 118 Below are the MAC nodes where PHY nodes are referenced. 119 phy-mode and phy-handle are used as explained 119 phy-mode and phy-handle are used as explained earlier. 120 ---------------------------------------------- 120 ------------------------------------------------------ 121 121 122 .. code-block:: none 122 .. code-block:: none 123 123 124 Scope(\_SB.MCE0.PR17) 124 Scope(\_SB.MCE0.PR17) 125 { 125 { 126 Name (_DSD, Package () { 126 Name (_DSD, Package () { 127 ToUUID("daffd814-6eba-4d8c-8a91-b 127 ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), 128 Package () { 128 Package () { 129 Package (2) {"phy-mode", 129 Package (2) {"phy-mode", "rgmii-id"}, 130 Package (2) {"phy-handle" 130 Package (2) {"phy-handle", \_SB.MDI0.PHY1} 131 } 131 } 132 }) 132 }) 133 } 133 } 134 134 135 Scope(\_SB.MCE0.PR18) 135 Scope(\_SB.MCE0.PR18) 136 { 136 { 137 Name (_DSD, Package () { 137 Name (_DSD, Package () { 138 ToUUID("daffd814-6eba-4d8c-8a91-bc 138 ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), 139 Package () { 139 Package () { 140 Package (2) {"phy-mode", " 140 Package (2) {"phy-mode", "rgmii-id"}, 141 Package (2) {"phy-handle", 141 Package (2) {"phy-handle", \_SB.MDI0.PHY2}} 142 } 142 } 143 }) 143 }) 144 } 144 } 145 145 146 MAC node example where "managed" property is s 146 MAC node example where "managed" property is specified. 147 ---------------------------------------------- 147 ------------------------------------------------------- 148 148 149 .. code-block:: none 149 .. code-block:: none 150 150 151 Scope(\_SB.PP21.ETH0) 151 Scope(\_SB.PP21.ETH0) 152 { 152 { 153 Name (_DSD, Package () { 153 Name (_DSD, Package () { 154 ToUUID("daffd814-6eba-4d8c-8a91-b 154 ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), 155 Package () { 155 Package () { 156 Package () {"phy-mode", " 156 Package () {"phy-mode", "sgmii"}, 157 Package () {"managed", "i 157 Package () {"managed", "in-band-status"} 158 } 158 } 159 }) 159 }) 160 } 160 } 161 161 162 MAC node example with a "fixed-link" subnode. 162 MAC node example with a "fixed-link" subnode. 163 --------------------------------------------- 163 --------------------------------------------- 164 164 165 .. code-block:: none 165 .. code-block:: none 166 166 167 Scope(\_SB.PP21.ETH1) 167 Scope(\_SB.PP21.ETH1) 168 { 168 { 169 Name (_DSD, Package () { 169 Name (_DSD, Package () { 170 ToUUID("daffd814-6eba-4d8c-8a91-bc 170 ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), 171 Package () { 171 Package () { 172 Package () {"phy-mode", " 172 Package () {"phy-mode", "sgmii"}, 173 }, 173 }, 174 ToUUID("dbb8e3e6-5886-4ba6-8795-13 174 ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"), 175 Package () { 175 Package () { 176 Package () {"fixed-link", 176 Package () {"fixed-link", "LNK0"} 177 } 177 } 178 }) 178 }) 179 Name (LNK0, Package(){ // Data-only 179 Name (LNK0, Package(){ // Data-only subnode of port 180 ToUUID("daffd814-6eba-4d8c-8a91-bc 180 ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), 181 Package () { 181 Package () { 182 Package () {"speed", 1000 182 Package () {"speed", 1000}, 183 Package () {"full-duplex" 183 Package () {"full-duplex", 1} 184 } 184 } 185 }) 185 }) 186 } 186 } 187 187 188 References 188 References 189 ========== 189 ========== 190 190 191 [phy] Documentation/networking/phy.rst 191 [phy] Documentation/networking/phy.rst 192 192 193 [dsd-properties-rules] 193 [dsd-properties-rules] 194 Documentation/firmware-guide/acpi/DSD-prop 194 Documentation/firmware-guide/acpi/DSD-properties-rules.rst 195 195 196 [ethernet-controller] 196 [ethernet-controller] 197 Documentation/devicetree/bindings/net/ethe 197 Documentation/devicetree/bindings/net/ethernet-controller.yaml 198 198 199 [dsd-guide] DSD Guide. 199 [dsd-guide] DSD Guide. 200 https://github.com/UEFI/DSD-Guide/blob/mai 200 https://github.com/UEFI/DSD-Guide/blob/main/dsd-guide.adoc, referenced 201 2021-11-30. 201 2021-11-30.
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.