phy.rst 5.3 KB

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