Add OF bindings to Micrel ksz9021 PHY
Subsystems (4)
PATCH v3 1/1 Add OF bindings to Micrel ksz9021 PHY
Some boards require custom parameters be passed to the Micrel PHY. Allow these boards to specify custom timing parameters in the device tree node.
Changes since v2:
- limited the scope to just ksz9021 rather than all PHYs
Changes since v1:
- removed redefinition of registers and addresses
Sean Cross (1):
net/phy: micrel: Add OF configuration support for ksz9021
.../devicetree/bindings/net/micrel-ksz9021.txt | 19 +++++++ drivers/net/phy/micrel.c | 57 +++++++++++++++++++- 2 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/net/micrel-ksz9021.txt
Signature · 1 line
1.7.9.5
PATCH v3 1/1 net/phy: micrel: Add OF configuration support for ksz9021
Some boards require custom PHY configuration, for example due to trace length differences. Add the ability to configure these registers in order to get the PHY to function on boards that need it.
Because PHYs are auto-detected based on MDIO device IDs, allow PHY configuration to be specified in the parent Ethernet device node if no PHY device node is present.
--- .../devicetree/bindings/net/micrel-ksz9021.txt | 19 +++++++ drivers/net/phy/micrel.c | 57 +++++++++++++++++++- 2 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/net/micrel-ksz9021.txt
Documentation/devicetree/bindings/net/micrel-ksz9021.txt new file +19 -0
@@ -0,0 +1,19 @@ +Micrel KSZ9021 Gigabit Ethernet PHY + +Some boards require special tuning values, particularly when it comes to +clock delays. You can specify clock delay values by adding +micrel-specific properties to an Ethernet OF device node. + +Optional properties: +- micrel,clk-control-pad-skew : Timing offset for the MII clock line +- micrel,rx-data-pad-skew : Timing offset for the RX MII pad +- micrel,tx-data-pad-skew : Timing offset for the TX MII pad + +Example: + &enet { + micrel,clk-control-pad-skew = <0xf0f0>; + micrel,rx-data-pad-skew = <0x0000>; + micrel,tx-data-pad-skew = <0xffff>; + status = "okay"; + }; +
drivers/net/phy/micrel.c +56 -1
87 lines not on this page · raw message
Signature · 1 line
1.7.9.5
David Miller
maintainerRe: [PATCH v3] net/phy: micrel: Add OF configuration support for ksz9021
From: Sean Cross <[email protected]>
Date: Thu, 1 Aug 2013 09:19:17 +0000
Quoted 9 lines
Some boards require custom PHY configuration, for example due to trace length differences. Add the ability to configure these registers in order to get the PHY to function on boards that need it.
Because PHYs are auto-detected based on MDIO device IDs, allow PHY configuration to be specified in the parent Ethernet device node if no PHY device node is present.
Signed-off-by Sean Cross <[email protected]>
Can someone knowledgable in this area please review this patch?
Thanks.
RE: [PATCH v3] net/phy: micrel: Add OF configuration support for ksz9021
In reply to Sean CrossFrom: Sean Cross [mailto:[email protected]]
Data: Thursday, August 01, 2013 5:19 PM
Quoted 12 lines
Documentation/devicetree/bindings/net/micrel-ksz9021.txt new file +9
-0@@ -0,0 +1,19 @@ +Micrel KSZ9021 Gigabit Ethernet PHY + +Some boards require special tuning values, particularly when it comes +to clock delays. You can specify clock delay values by adding +micrel-specific properties to an Ethernet OF device node. + +Optional properties: +- micrel,clk-control-pad-skew : Timing offset for the MII clock line +- micrel,rx-data-pad-skew : Timing offset for the RX MII pad
Documentation/devicetree/bindings/net/micrel-ksz9021.txt line 19
Quoted 10 lines
Documentation/devicetree/bindings/net/micrel-ksz9021.txt new file +10
-0+- micrel,tx-data-pad-skew : Timing offset for the TX MII pad + +Example: + &enet { + micrel,clk-control-pad-skew = <0xf0f0>; + micrel,rx-data-pad-skew = <0x0000>; + micrel,tx-data-pad-skew = <0xffff>; + status = "okay"; + }; +
The phy binding must be the phy node, not the ethernet node. Pls refer to:
Documentation/devicetree/booting-without-of.txt Documentation/devicetree/bindings/net/phy.txt
Documentation/devicetree/bindings/net/micrel-ksz9021.txt
Quoted 7 lines
Documentation/devicetree/bindings/net/micrel-ksz9021.txt new file +7
-0+static int ksz9021_config_init(struct phy_device *phydev) { + struct device *dev = &phydev->dev; + struct device_node *of_node = dev->of_node; + + if (!of_node && dev->parent->of_node) + of_node = dev->parent->of_node; +
If phy binding is phy node, there only check of_node, don't re-evaluate the phy node.
Thanks,
Andy
Re: [PATCH v3] net/phy: micrel: Add OF configuration support for ksz9021
Quoted 24 lines · On Monday, 5 August, 2013 at 9:58 AM, Duan Fugang-B38611 wrote:
From: Sean Cross [mailto:[email protected]]
Data: Thursday, August 01, 2013 5:19 PMQuoted 21 lines
Documentation/devicetree/bindings/net/micrel-ksz9021.txt new file +18
-0@@ -0,0 +1,19 @@ +Micrel KSZ9021 Gigabit Ethernet PHY + +Some boards require special tuning values, particularly when it comes +to clock delays. You can specify clock delay values by adding +micrel-specific properties to an Ethernet OF device node. + +Optional properties: +- micrel,clk-control-pad-skew : Timing offset for the MII clock line +- micrel,rx-data-pad-skew : Timing offset for the RX MII pad +- micrel,tx-data-pad-skew : Timing offset for the TX MII pad + +Example: + &enet { + micrel,clk-control-pad-skew = <0xf0f0>; + micrel,rx-data-pad-skew = <0x0000>; + micrel,tx-data-pad-skew = <0xffff>; + status = "okay"; + };
Quoted 8 lines
Documentation/devicetree/bindings/net/micrel-ksz9021.txt line 19
Quoted 1 line
Documentation/devicetree/bindings/net/micrel-ksz9021.txt new file +1
-0+The phy binding must be the phy node, not the ethernet node. Pls refer to:
Documentation/devicetree/booting-without-of.txtDocumentation/devicetree/bindings/net/phy.txt
This won't necessarily work. In my board, I don't think it's possible to manually specify the PHY, as most of the fields required by the OF PHY node don't apply to this device (at least according to phy.txt). There are no interrupts, no interrupt parent, and it's unclear what the reg or linux,phandle fields do. All of these are required fields, none of which seem to apply to this particular board. Furthermore, it doesn't seem to be possible to specify a particular PHY, such as the ksz9021.
I see the pattern of getting OF settings from a parent's node used elsewhere in the kernel. For example, in mmc_of_parse(), or more similarly in the chipidea ci_hdrc_probe() driver.
Quoted 10 lines
Documentation/devicetree/bindings/net/micrel-ksz9021.txt
Quoted 7 lines
Documentation/devicetree/bindings/net/micrel-ksz9021.txt new file +7
-0+static int ksz9021_config_init(struct phy_device *phydev) { + struct device *dev = &phydev->dev; + struct device_node *of_node = dev->of_node; + + if (!of_node && dev->parent->of_node) + of_node = dev->parent->of_node; +If phy binding is phy node, there only check
of_node, don't re-evaluate the phy node.
It's done this way in case it's not possible to add a phy node, as in this case.
RE: [PATCH v3] net/phy: micrel: Add OF configuration support for ksz9021
From: Sean Cross [mailto:[email protected]]
Data: Monday, August 05, 2013 10:24 AM
Quoted 22 lines
Quoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/net/micrel-ksz9021.txt new file +5
-0+Example: + &enet { + micrel,clk-control-pad-skew = <0xf0f0>; micrel,rx-data-pad-skew = +<0x0000>; micrel,tx-data-pad-skew = <0xffff>; status = "okay"; +};Quoted 8 lines
Quoted 1 line
+
The phy binding must be the phy node, not the ethernet node. Pls refer to:
Documentation/devicetree/booting-without-of.txtDocumentation/devicetree/bindings/net/phy.txtThis won't necessarily work. In my board, I don't think it's possible to manually specify the PHY, as most of the fields required by the OF PHY node don't apply to this device (at least according to phy.txt). There are no interrupts, no interrupt parent, and it's unclear what the reg or linux,phandle fields do. All of these are required fields, none of which seem to apply to this particular board. Furthermore, it doesn't seem to be possible to specify a particular PHY, such as the ksz9021.
Quoted 3 lines
I see the pattern of getting OF settings from a parent's node used elsewhere in the kernel. For example, in
mmc_of_parse(), or more similarly in the chipideaci_hdrc_probe()driver.
Yes, the patch is only reasonable for your platform, but it is the phy driver for different platforms that you must considerate. Please add more example cases in binding doc.