Re: [PATCH] phylib: Add support for the LXT973 phy.
From: Andy Fleming <hidden>
Date: 2010-06-01 22:39:24
On Mon, May 31, 2010 at 8:09 AM, Richard Cochran [off-list ref] wrote:
This patch implements a work around for Erratum 5, "3.3 V Fiber Speed Selection." If the hardware wiring does not respect this erratum, then fiber optic mode will not work properly. Signed-off-by: Richard Cochran <redacted>
+static int lxt973_probe(struct phy_device *phydev)
+{
+ int val = phy_read(phydev, MII_LXT973_PCR);
+
+ if (val & PCR_FIBER_SELECT) {
+ /*
+ * If fiber is selected, then the only correct setting
+ * is 100Mbps, full duplex, and auto negotiation off.
+ */
+ val = phy_read(phydev, MII_BMCR);
+ val |= (BMCR_SPEED100 | BMCR_FULLDPLX);
+ val &= ~BMCR_ANENABLE;
+ phy_write(phydev, MII_BMCR, val);
+ /* Remember that the port is in fiber mode. */
+ phydev->priv = lxt973_probe;That's a bit hacky. There is a dev_flags field, which could be used for this. Probably, we should add a more general way of saying what sort of port this is. But don't use the presence and absence of "priv", as it could one day get used for a different purpose, and this seems like it would leave us open to strange bugs. Also, is this erratum true for all lxt973 models, or is it fixed in some revisions? Andy