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: ore@pengutronix.de, Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 6/9] net: dsa: always call port_pre_enable before port_enable
Date: Mon, 16 Jan 2023 14:44:58 +0100	[thread overview]
Message-ID: <20230116134501.2006391-7-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20230116134501.2006391-1-a.fatoum@pengutronix.de>

The barebox DSA support differentiates between a port_pre_enable, that's
called before connecting the PHY to drive a clock if nedeed and the
actual port_enable. For user ports, port_enable of the CPU port is
called, but not port_pre_enable. Fix this.

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

diff --git a/drivers/net/dsa.c b/drivers/net/dsa.c
index c1430a93615b..793bbbb4f18f 100644
--- a/drivers/net/dsa.c
+++ b/drivers/net/dsa.c
@@ -122,6 +122,16 @@ static int dsa_port_start(struct eth_device *edev)
 	if (!ds->cpu_port_users) {
 		struct dsa_port *dpc = ds->dp[ds->cpu_port];
 
+		if (ops->port_pre_enable) {
+			/* In case of RMII interface we need to enable RMII clock
+			 * before talking to the PHY.
+			 */
+			ret = ops->port_pre_enable(dpc, ds->cpu_port,
+						   ds->cpu_port_fixed_phy->interface);
+			if (ret)
+				return ret;
+		}
+
 		if (ops->port_enable) {
 			ret = ops->port_enable(dpc, ds->cpu_port,
 					       ds->cpu_port_fixed_phy);
-- 
2.30.2




  parent reply	other threads:[~2023-01-16 13:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-16 13:44 [PATCH 0/9] net: dsa: add Realtek (rtl8365mb/rtl8366rb) switch support Ahmad Fatoum
2023-01-16 13:44 ` [PATCH 1/9] driver: alias of_match_ptr and DRV_OF_COMPAT Ahmad Fatoum
2023-01-16 13:44 ` [PATCH 2/9] gpiolib: implement gpio_direction_input/output Ahmad Fatoum
2023-01-16 13:44 ` [PATCH 3/9] net: dsa: rename dsa_ops to dsa_switch_ops Ahmad Fatoum
2023-01-16 13:44 ` [PATCH 4/9] net: dsa: factor out dsa_port_alloc helper Ahmad Fatoum
2023-01-16 13:44 ` [PATCH 5/9] net: dsa: populate struct dsa_port::index/dev members Ahmad Fatoum
2023-01-16 13:44 ` Ahmad Fatoum [this message]
2023-01-16 13:44 ` [PATCH 7/9] net: dsa: add some helpers to ease porting kernel drivers Ahmad Fatoum
2023-01-16 13:45 ` [PATCH 8/9] net: dsa: add struct dsa_switch::priv member for driver use Ahmad Fatoum
2023-01-16 13:45 ` [PATCH 9/9] net: dsa: add Realtek (rtl8365mb/rtl8366rb) switch support Ahmad Fatoum
2023-01-23  8:21 ` [PATCH 0/9] " 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=20230116134501.2006391-7-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=ore@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