Skip to contentSkip to conversation

Add OF bindings to Micrel PHY

PATCH Superseded Sean Cross 2 participants 5 messages Aug 1, 2013

Subsystems (4)

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Sean Cross

author
#0 lore raw

PATCH 1/1 Add OF bindings to Micrel 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.

Sean Cross (1):
net/phy: micrel: Add OF configuration support

 .../devicetree/bindings/net/micrel-phy.txt         |   20 +++++++
 drivers/net/phy/micrel.c                           |   57 ++++++++++++++++++++
 2 files changed, 77 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/micrel-phy.txt
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH 1/1 net/phy: micrel: Add OF configuration support

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-phy.txt         |   20 +++++++
 drivers/net/phy/micrel.c                           |   57 ++++++++++++++++++++
 2 files changed, 77 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/micrel-phy.txt
Documentation/devicetree/bindings/net/micrel-phy.txt new file +20 -0
new file mode 100644
index 0000000..97c1ef2
@@ -0,0 +1,20 @@
+Micrel KS8737, KSZ8041, KSZ8001, KS8721, KSZ8081, KSZ8091, KSZ8061, KSZ9021,
+KSZ9031, Ethernet PHYs, and KSZ8873MLL and KSZ886X Ethernet switches.
+
+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 +57 -0

81 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#2 lore raw

RE: [PATCH] net/phy: micrel: Add OF configuration support

Quoted 4 lines · Sean Cross
drivers/net/phy/micrel.c +4 -0
+/* Write/read to/from extended registers */
+#define MII_KSZPHY_EXTREG                       0x0b
+#define KSZPHY_EXTREG_WRITE                     0x8000
+

drivers/net/phy/micrel.c line 70

Quoted 10 lines
drivers/net/phy/micrel.c +10 -0
+#define MII_KSZPHY_EXTREG_WRITE                 0x0c
+#define MII_KSZPHY_EXTREG_READ                  0x0d
+
+/* Write/read to/from extended registers */
+#define MII_KSZPHY_EXTREG                       0x0b
+#define KSZPHY_EXTREG_WRITE                     0x8000
+
+#define MII_KSZPHY_EXTREG_WRITE                 0x0c
+#define MII_KSZPHY_EXTREG_READ                  0x0d
+

Pls don't re-define the registers address and field.

drivers/net/phy/micrel.c static int ks8737_config_intr(struct phy_device *phydev) · line 165

Quoted 6 lines
drivers/net/phy/micrel.c +6 -0
+		if (!of_property_read_u32(of_node,
+					  "micrel,clk-control-pad-skew",
+					  &val))
+			kszphy_extended_write(phydev,
+					      MII_KSZPHY_CLK_CONTROL_PAD_SKEW,
+					      val);

When re-set rx/tx clock delay, rx/tx control delay, it is better to do dummy read the extended MII_KSZPHY_CLK_CONTROL_PAD_SKEW register one time.

Thanks,
Andy

author
#3 lore raw

Re: [PATCH] net/phy: micrel: Add OF configuration support

Quoted 12 lines · On Thursday, August 1, 2013 at 1:31 PM, Duan Fugang-B38611 wrote:
Quoted 10 lines · Sean Cross
drivers/net/phy/micrel.c +10 -0
+/* Write/read to/from extended registers */
+#define MII_KSZPHY_EXTREG 0x0b
+#define KSZPHY_EXTREG_WRITE 0x8000
+
+#define MII_KSZPHY_EXTREG_WRITE 0x0c
+#define MII_KSZPHY_EXTREG_READ 0x0d
+
+/* Write/read to/from extended registers */
+#define MII_KSZPHY_EXTREG 0x0b
+#define KSZPHY_EXTREG_WRITE 0x8000
Quoted 8 lines

drivers/net/phy/micrel.c line 63

Quoted 4 lines
drivers/net/phy/micrel.c +4 -0
+
+#define MII_KSZPHY_EXTREG_WRITE 0x0c
+#define MII_KSZPHY_EXTREG_READ 0x0d
+

Pls don't re-define the registers address and field.

My fault. I'll remove this redundancy.

Quoted 10 lines
Quoted 6 lines

+ if (!of_property_read_u32(of_node,
+ "micrel,clk-control-pad-skew",
+ &val))
+ kszphy_extended_write(phydev,
+ MII_KSZPHY_CLK_CONTROL_PAD_SKEW,
+ val);

When re-set rx/tx clock delay, rx/tx control delay, it is better to do dummy read the extended MII_KSZPHY_CLK_CONTROL_PAD_SKEW register one time.

Can you please explain this? I don't see anything in the datasheet I'm looking at (ksz9021rl) describing dummy reads. If both tx and rx skew are adjusted, should there be two dummy reads or just one?

#4 lore raw

RE: [PATCH] net/phy: micrel: Add OF configuration support

Quoted 3 lines · Sean Cross
Quoted 1 line

When re-set rx/tx clock delay, rx/tx control delay, it is better to do dummy read the extended MII_KSZPHY_CLK_CONTROL_PAD_SKEW register one time.

Can you please explain this? I don't see anything in the datasheet I'm looking at (ksz9021rl) describing dummy reads. If both tx and rx skew are adjusted, should there be >two dummy reads or just one?

When freescale engineers do the phy bring up, they add the dummy read. Pls refer the the patchwork: http://patchwork.ozlabs.org/patch/246616/
From ksz9021r1, there have no such condition. After I remove the dummy read, the imx6q sabrelite platform ethernet Gbps mode work fine. For at91 micrel phy fixup, there have no dummy read: http://lists.infradead.org/pipermail/linux-arm-kernel/2013-July/183626.html
So, it just one confuse, and the dummy read is unnecessary.