]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ARM: i.MX6: add ethernet phy fixup for KSZ9031
authorSascha Hauer <s.hauer@pengutronix.de>
Thu, 20 Jun 2013 15:34:33 +0000 (17:34 +0200)
committerLothar Waßmann <LW@KARO-electronics.de>
Mon, 16 Jun 2014 13:23:39 +0000 (15:23 +0200)
The KSZ9031 is used on the i.MX6 based Data Modul eDM-QMX6
board. It needs the same fixup to the rx/tx delays as other
i.MX6 boards.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
arch/arm/mach-imx/mach-imx6q.c

index e60456d85c9d867218eca5e244034ef348592376..baa0dcfada8dfc96ea25b922a735fd3ec12052c8 100644 (file)
@@ -108,6 +108,27 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_PLX, 0x8609, ventana_pciesw_early_fixup);
 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_PLX, 0x8606, ventana_pciesw_early_fixup);
 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_PLX, 0x8604, ventana_pciesw_early_fixup);
 
+static void mmd_write_reg(struct phy_device *dev, int device, int reg, int val)
+{
+       phy_write(dev, 0x0d, device);
+       phy_write(dev, 0x0e, reg);
+       phy_write(dev, 0x0d, (1 << 14) | device);
+       phy_write(dev, 0x0e, val);
+}
+
+static int ksz9031rn_phy_fixup(struct phy_device *dev)
+{
+       /*
+        * min rx data delay, max rx/tx clock delay,
+        * min rx/tx control delay
+        */
+       mmd_write_reg(dev, 2, 4, 0);
+       mmd_write_reg(dev, 2, 5, 0);
+       mmd_write_reg(dev, 2, 8, 0x003ff);
+
+       return 0;
+}
+
 static int ar8031_phy_fixup(struct phy_device *dev)
 {
        u16 val;