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: sha@pengutronix.de, Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 3/5] fixup! net: eqos: Rockchip support
Date: Wed,  9 Jun 2021 10:55:10 +0200	[thread overview]
Message-ID: <20210609085512.3865-4-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20210609085512.3865-1-a.fatoum@pengutronix.de>

Other network controllers have different clock settings when configuring
link speed for RMII vs. RGMII. Split up the callback like with Linux to
make future extension easier.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/net/designware_rockchip.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/net/designware_rockchip.c b/drivers/net/designware_rockchip.c
index a4c7bfe925db..09b53e2cc08d 100644
--- a/drivers/net/designware_rockchip.c
+++ b/drivers/net/designware_rockchip.c
@@ -18,7 +18,8 @@ struct rk_gmac_ops {
 	void (*set_to_rgmii)(struct eqos *eqos,
 			     int tx_delay, int rx_delay);
 	void (*set_to_rmii)(struct eqos *eqos);
-	void (*set_speed)(struct eqos *eqos, int speed);
+	void (*set_rmii_speed)(struct eqos *eqos, int speed);
+	void (*set_rgmii_speed)(struct eqos *eqos, int speed);
 	void (*integrated_phy_powerup)(struct eqos *eqos);
 
 	const struct clk_bulk_data *extra_clks;
@@ -182,7 +183,8 @@ static void rk3568_set_gmac_speed(struct eqos *eqos, int speed)
 static const struct rk_gmac_ops rk3568_ops = {
 	.set_to_rgmii = rk3568_set_to_rgmii,
 	.set_to_rmii = rk3568_set_to_rmii,
-	.set_speed = rk3568_set_gmac_speed,
+	.set_rmii_speed = rk3568_set_gmac_speed,
+	.set_rgmii_speed = rk3568_set_gmac_speed,
 
 	.extra_clks = rk3568_gmac_clks,
 	.num_extra_clks = ARRAY_SIZE(rk3568_gmac_clks),
@@ -228,7 +230,10 @@ static void eqos_rk_adjust_link(struct eth_device *edev)
 	struct eqos *eqos = edev->priv;
 	struct eqos_rk_gmac *priv = to_rk_gmac(eqos);
 
-	priv->ops->set_speed(eqos, edev->phydev->speed);
+	if (phy_interface_mode_is_rgmii(eqos->interface))
+		priv->ops->set_rgmii_speed(eqos, edev->phydev->speed);
+	else
+		priv->ops->set_rmii_speed(eqos, edev->phydev->speed);
 
 	eqos_adjust_link(edev);
 }
-- 
2.29.2


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


  parent reply	other threads:[~2021-06-09  9:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-09  8:55 [PATCH 0/5] fixups for Designware EQOS MAC " Ahmad Fatoum
2021-06-09  8:55 ` [PATCH 1/5] fixup! net: eqos: " Ahmad Fatoum
2021-06-09  8:55 ` [PATCH 2/5] " Ahmad Fatoum
2021-06-09 11:33   ` Sascha Hauer
2021-06-09  8:55 ` Ahmad Fatoum [this message]
2021-06-09  8:55 ` [PATCH 4/5] " Ahmad Fatoum
2021-06-09  8:55 ` [PATCH 5/5] " Ahmad Fatoum

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=20210609085512.3865-4-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=sha@pengutronix.de \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox