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

* [PATCH 2/2] ARM: imx6: marsboard: enable deep-probe
  2021-06-28  7:06 [PATCH 1/2] ARM: imx6: marsboard: simplify ar8035 PHY fixups Ahmad Fatoum
@ 2021-06-28  7:06 ` Ahmad Fatoum
  2021-06-28 20:40 ` [PATCH 1/2] ARM: imx6: marsboard: simplify ar8035 PHY fixups Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2021-06-28  7:06 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Everything done by the mars board code is unrelated to probe order,
so turn it into a driver and enable deep probe for it.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/boards/embest-marsboard/board.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/arch/arm/boards/embest-marsboard/board.c b/arch/arm/boards/embest-marsboard/board.c
index 72d0aa28f781..a11b7b6579c0 100644
--- a/arch/arm/boards/embest-marsboard/board.c
+++ b/arch/arm/boards/embest-marsboard/board.c
@@ -10,6 +10,7 @@
 #include <envfs.h>
 #include <mach/bbu.h>
 #include <linux/phy.h>
+#include <deep-probe.h>
 
 static int ar8035_phy_fixup(struct phy_device *dev)
 {
@@ -32,11 +33,8 @@ static int ar8035_phy_fixup(struct phy_device *dev)
 	return 0;
 }
 
-static int marsboard_device_init(void)
+static int marsboard_device_init(struct device_d *dev)
 {
-	if (!of_machine_is_compatible("embest,imx6q-marsboard"))
-		return 0;
-
 	barebox_set_hostname("marsboard");
 
 	phy_register_fixup_for_uid(0x004dd072, 0xffffffef, ar8035_phy_fixup);
@@ -48,4 +46,16 @@ static int marsboard_device_init(void)
 
 	return 0;
 }
-device_initcall(marsboard_device_init);
+
+static const struct of_device_id marsboard_of_match[] = {
+	{ .compatible = "embest,imx6q-marsboard" },
+	{ /* sentinel */ },
+};
+BAREBOX_DEEP_PROBE_ENABLE(marsboard_of_match);
+
+static struct driver_d marsboard_driver = {
+	.name = "board-mars",
+	.probe = marsboard_device_init,
+	.of_compatible = marsboard_of_match,
+};
+postcore_platform_driver(marsboard_driver);
-- 
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

* Re: [PATCH 1/2] ARM: imx6: marsboard: simplify ar8035 PHY fixups
  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 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2021-06-28 20:40 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox, Oleksij Rempel

On Mon, Jun 28, 2021 at 09:06:26AM +0200, Ahmad Fatoum wrote:
> 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(-)

Applied, thanks

Sascha


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
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