mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Oleksij Rempel <o.rempel@pengutronix.de>,
	Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 1/2] ARM: imx6: marsboard: simplify ar8035 PHY fixups
Date: Mon, 28 Jun 2021 09:06:26 +0200	[thread overview]
Message-ID: <20210628070627.16329-1-a.fatoum@pengutronix.de> (raw)

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


             reply	other threads:[~2021-06-28  7:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-28  7:06 Ahmad Fatoum [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210628070627.16329-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=o.rempel@pengutronix.de \
    --subject='Re: [PATCH 1/2] ARM: imx6: marsboard: simplify ar8035 PHY fixups' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox