[PATCH 1/2] ARM: imx6: marsboard: simplify ar8035 PHY fixups
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon Jun 28 00:06:26 PDT 2021
These are the same fixups as the riotboard's, itself propably taken from Linux,
where mach-imx registers the same fixups for ar803x PHYs.
Some of these fixups can now be solved by PHY properties added since.
Make use of them and make the remaining MMD indirect phy usage
more compact by using phy_read_mmd_indirect.
Cc: Oleksij Rempel <o.rempel at pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
arch/arm/boards/embest-marsboard/board.c | 24 ++++++------------------
arch/arm/dts/imx6q-marsboard.dts | 5 +++++
2 files changed, 11 insertions(+), 18 deletions(-)
diff --git a/arch/arm/boards/embest-marsboard/board.c b/arch/arm/boards/embest-marsboard/board.c
index 66893434c2cc..72d0aa28f781 100644
--- a/arch/arm/boards/embest-marsboard/board.c
+++ b/arch/arm/boards/embest-marsboard/board.c
@@ -18,28 +18,16 @@ static int ar8035_phy_fixup(struct phy_device *dev)
/* Ar803x phy SmartEEE feature cause link status generates glitch,
* which cause ethernet link down/up issue, so disable SmartEEE
*/
- phy_write(dev, 0xd, 0x3);
- phy_write(dev, 0xe, 0x805d);
- phy_write(dev, 0xd, 0x4003);
+ val = phy_read_mmd_indirect(dev, 0x805d, 0x3);
+ phy_write(dev, MII_MMD_DATA, val & ~(1 << 8));
- val = phy_read(dev, 0xe);
- phy_write(dev, 0xe, val & ~(1 << 8));
+ val = phy_read_mmd_indirect(dev, 0x4003, 0x3);
+ phy_write(dev, MII_MMD_DATA, val & ~(1 << 8));
- /* To enable AR8031 ouput a 125MHz clk from CLK_25M */
- phy_write(dev, 0xd, 0x7);
- phy_write(dev, 0xe, 0x8016);
- phy_write(dev, 0xd, 0x4007);
-
- val = phy_read(dev, 0xe);
+ val = phy_read_mmd_indirect(dev, 0x4007, 0x3);
val &= 0xffe3;
val |= 0x18;
- phy_write(dev, 0xe, val);
-
- /* introduce tx clock delay */
- phy_write(dev, 0x1d, 0x5);
- val = phy_read(dev, 0x1e);
- val |= 0x0100;
- phy_write(dev, 0x1e, val);
+ phy_write(dev, MII_MMD_DATA, val);
return 0;
}
diff --git a/arch/arm/dts/imx6q-marsboard.dts b/arch/arm/dts/imx6q-marsboard.dts
index 1d9f8f005df7..cc5edfff66f9 100644
--- a/arch/arm/dts/imx6q-marsboard.dts
+++ b/arch/arm/dts/imx6q-marsboard.dts
@@ -36,6 +36,11 @@
&fec {
phy-reset-duration = <2>;
+ phy-mode = "rgmii-id";
+};
+
+&rgmii_phy {
+ qca,clk-out-frequency = <125000000>;
};
&ocotp {
--
2.30.2
More information about the barebox
mailing list