mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] ARM: imx6: marsboard: simplify ar8035 PHY fixups
@ 2021-06-28  7:06 Ahmad Fatoum
  2021-06-28  7:06 ` [PATCH 2/2] ARM: imx6: marsboard: enable deep-probe Ahmad Fatoum
  2021-06-28 20:40 ` [PATCH 1/2] ARM: imx6: marsboard: simplify ar8035 PHY fixups Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2021-06-28  7:06 UTC (permalink / raw)
  To: barebox; +Cc: Oleksij Rempel, Ahmad Fatoum

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@pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum@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


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-28 20:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-28  7:06 [PATCH 1/2] ARM: imx6: marsboard: simplify ar8035 PHY fixups Ahmad Fatoum
2021-06-28  7:06 ` [PATCH 2/2] ARM: imx6: marsboard: enable deep-probe Ahmad Fatoum
2021-06-28 20:40 ` [PATCH 1/2] ARM: imx6: marsboard: simplify ar8035 PHY fixups Sascha Hauer

mail archive of the barebox mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://lore.barebox.org/barebox/0 barebox/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 barebox barebox/ https://lore.barebox.org/barebox \
		barebox@lists.infradead.org barebox@lists.infradead.org
	public-inbox-index barebox

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git