[PATCH net v2 1/3] net: dsa: realtek-smi: don't log an error on EPROBE_DEFER

Subsystems: networking drivers, networking [dsa], the rest

STALE1711d

9 messages, 5 authors, 2021-12-02 · open the first message on its own page

[PATCH net v2 1/3] net: dsa: realtek-smi: don't log an error on EPROBE_DEFER

From: Alvin Šipraga <hidden>
Date: 2021-11-29 11:16:08

From: Alvin Šipraga <redacted>

Probe deferral is not an error, so don't log this as an error:

[0.590156] realtek-smi ethernet-switch: unable to register switch ret = -517

Signed-off-by: Alvin Šipraga <redacted>
---
 drivers/net/dsa/realtek-smi-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

v2: use dev_err_probe() instead of manually checking ret
diff --git a/drivers/net/dsa/realtek-smi-core.c b/drivers/net/dsa/realtek-smi-core.c
index c66ebd0ee217..aae46ada8d83 100644
--- a/drivers/net/dsa/realtek-smi-core.c
+++ b/drivers/net/dsa/realtek-smi-core.c
@@ -456,7 +456,7 @@ static int realtek_smi_probe(struct platform_device *pdev)
 	smi->ds->ops = var->ds_ops;
 	ret = dsa_register_switch(smi->ds);
 	if (ret) {
-		dev_err(dev, "unable to register switch ret = %d\n", ret);
+		dev_err_probe(dev, ret, "unable to register switch\n");
 		return ret;
 	}
 	return 0;
-- 
2.34.0

[PATCH net v2 2/3] net: dsa: rtl8365mb: fix garbled comment

From: Alvin Šipraga <hidden>
Date: 2021-11-29 11:16:10

From: Alvin Šipraga <redacted>

Fixes: 4af2950c50c8 ("net: dsa: realtek-smi: add rtl8365mb subdriver for RTL8365MB-VC")
Signed-off-by: Alvin Šipraga <redacted>
---
 drivers/net/dsa/rtl8365mb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

v2: no change
diff --git a/drivers/net/dsa/rtl8365mb.c b/drivers/net/dsa/rtl8365mb.c
index baaae97283c5..c52225d115d4 100644
--- a/drivers/net/dsa/rtl8365mb.c
+++ b/drivers/net/dsa/rtl8365mb.c
@@ -276,7 +276,7 @@
 		(RTL8365MB_PORT_ISOLATION_REG_BASE + (_physport))
 #define   RTL8365MB_PORT_ISOLATION_MASK			0x07FF
 
-/* MSTP port state registers - indexed by tree instancrSTI (tree ine */
+/* MSTP port state registers - indexed by tree instance */
 #define RTL8365MB_MSTI_CTRL_BASE			0x0A00
 #define RTL8365MB_MSTI_CTRL_REG(_msti, _physport) \
 		(RTL8365MB_MSTI_CTRL_BASE + ((_msti) << 1) + ((_physport) >> 3))
-- 
2.34.0

[PATCH net v2 3/3] net: dsa: rtl8365mb: set RGMII RX delay in steps of 0.3 ns

From: Alvin Šipraga <hidden>
Date: 2021-11-29 11:16:22

From: Alvin Šipraga <redacted>

A contact at Realtek has clarified what exactly the units of RGMII RX
delay are. The answer is that the unit of RX delay is "about 0.3 ns".
Take this into account when parsing rx-internal-delay-ps by
approximating the closest step value. Delays of more than 2.1 ns are
rejected.

This obviously contradicts the previous assumption in the driver that a
step value of 4 was "about 2 ns", but Realtek also points out that it is
easy to find more than one RX delay step value which makes RGMII work.

Fixes: 4af2950c50c8 ("net: dsa: realtek-smi: add rtl8365mb subdriver for RTL8365MB-VC")
Cc: Arınç ÜNAL <redacted>
Signed-off-by: Alvin Šipraga <redacted>
Acked-by: Arınç ÜNAL <redacted>
---
 drivers/net/dsa/rtl8365mb.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

v2: add Arınç's Acked-by
diff --git a/drivers/net/dsa/rtl8365mb.c b/drivers/net/dsa/rtl8365mb.c
index c52225d115d4..bb65576ebf3c 100644
--- a/drivers/net/dsa/rtl8365mb.c
+++ b/drivers/net/dsa/rtl8365mb.c
@@ -760,7 +760,8 @@ static int rtl8365mb_ext_config_rgmii(struct realtek_smi *smi, int port,
 	 *     0 = no delay, 1 = 2 ns delay
 	 *   RX delay:
 	 *     0 = no delay, 7 = maximum delay
-	 *     No units are specified, but there are a total of 8 steps.
+	 *     Each step is approximately 0.3 ns, so the maximum delay is about
+	 *     2.1 ns.
 	 *
 	 * The vendor driver also states that this must be configured *before*
 	 * forcing the external interface into a particular mode, which is done
@@ -771,10 +772,6 @@ static int rtl8365mb_ext_config_rgmii(struct realtek_smi *smi, int port,
 	 * specified. We ignore the detail of the RGMII interface mode
 	 * (RGMII_{RXID, TXID, etc.}), as this is considered to be a PHY-only
 	 * property.
-	 *
-	 * For the RX delay, we assume that a register value of 4 corresponds to
-	 * 2 ns. But this is just an educated guess, so ignore all other values
-	 * to avoid too much confusion.
 	 */
 	if (!of_property_read_u32(dn, "tx-internal-delay-ps", &val)) {
 		val = val / 1000; /* convert to ns */
@@ -787,13 +784,13 @@ static int rtl8365mb_ext_config_rgmii(struct realtek_smi *smi, int port,
 	}
 
 	if (!of_property_read_u32(dn, "rx-internal-delay-ps", &val)) {
-		val = val / 1000; /* convert to ns */
+		val = DIV_ROUND_CLOSEST(val, 300); /* convert to 0.3 ns step */
 
-		if (val == 0 || val == 2)
-			rx_delay = val * 2;
+		if (val <= 7)
+			rx_delay = val;
 		else
 			dev_warn(smi->dev,
-				 "EXT port RX delay must be 0 to 2 ns\n");
+				 "EXT port RX delay must be 0 to 2.1 ns\n");
 	}
 
 	ret = regmap_update_bits(
-- 
2.34.0

Re: [PATCH net v2 1/3] net: dsa: realtek-smi: don't log an error on EPROBE_DEFER

From: Andrew Lunn <andrew@lunn.ch>
Date: 2021-11-29 12:57:47

On Mon, Nov 29, 2021 at 11:30:17AM +0100, Alvin Šipraga wrote:
From: Alvin Šipraga <redacted>

Probe deferral is not an error, so don't log this as an error:

[0.590156] realtek-smi ethernet-switch: unable to register switch ret = -517

Signed-off-by: Alvin Šipraga <redacted>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

Re: [PATCH net v2 2/3] net: dsa: rtl8365mb: fix garbled comment

From: Andrew Lunn <andrew@lunn.ch>
Date: 2021-11-29 12:58:23

On Mon, Nov 29, 2021 at 11:30:18AM +0100, Alvin Šipraga wrote:
From: Alvin Šipraga <redacted>

Fixes: 4af2950c50c8 ("net: dsa: realtek-smi: add rtl8365mb subdriver for RTL8365MB-VC")
Signed-off-by: Alvin Šipraga <redacted>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

Re: [PATCH net v2 3/3] net: dsa: rtl8365mb: set RGMII RX delay in steps of 0.3 ns

From: Andrew Lunn <andrew@lunn.ch>
Date: 2021-11-29 13:02:12

On Mon, Nov 29, 2021 at 11:30:19AM +0100, Alvin Šipraga wrote:
From: Alvin Šipraga <redacted>

A contact at Realtek has clarified what exactly the units of RGMII RX
delay are. The answer is that the unit of RX delay is "about 0.3 ns".
Take this into account when parsing rx-internal-delay-ps by
approximating the closest step value. Delays of more than 2.1 ns are
rejected.

This obviously contradicts the previous assumption in the driver that a
step value of 4 was "about 2 ns", but Realtek also points out that it is
easy to find more than one RX delay step value which makes RGMII work.

Fixes: 4af2950c50c8 ("net: dsa: realtek-smi: add rtl8365mb subdriver for RTL8365MB-VC")
Cc: Arınç ÜNAL <redacted>
Signed-off-by: Alvin Šipraga <redacted>
Acked-by: Arınç ÜNAL <redacted>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

Re: [PATCH net v2 1/3] net: dsa: realtek-smi: don't log an error on EPROBE_DEFER

From: patchwork-bot+netdevbpf@kernel.org
Date: 2021-11-29 13:02:13

Hello:

This series was applied to netdev/net-next.git (master)
by David S. Miller [off-list ref]:

On Mon, 29 Nov 2021 11:30:17 +0100 you wrote:
From: Alvin Šipraga <redacted>

Probe deferral is not an error, so don't log this as an error:

[0.590156] realtek-smi ethernet-switch: unable to register switch ret = -517

Signed-off-by: Alvin Šipraga <redacted>

[...]
Here is the summary with links:
  - [net,v2,1/3] net: dsa: realtek-smi: don't log an error on EPROBE_DEFER
    https://git.kernel.org/netdev/net-next/c/b014861d96a6
  - [net,v2,2/3] net: dsa: rtl8365mb: fix garbled comment
    https://git.kernel.org/netdev/net-next/c/1ecab9370eef
  - [net,v2,3/3] net: dsa: rtl8365mb: set RGMII RX delay in steps of 0.3 ns
    https://git.kernel.org/netdev/net-next/c/ef136837aaf6

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html

Re: [PATCH net v2 1/3] net: dsa: realtek-smi: don't log an error on EPROBE_DEFER

From: Heiner Kallweit <hkallweit1@gmail.com>
Date: 2021-11-29 20:22:53

On 29.11.2021 11:30, Alvin Šipraga wrote:
quoted hunk
From: Alvin Šipraga <redacted>

Probe deferral is not an error, so don't log this as an error:

[0.590156] realtek-smi ethernet-switch: unable to register switch ret = -517

Signed-off-by: Alvin Šipraga <redacted>
---
 drivers/net/dsa/realtek-smi-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

v2: use dev_err_probe() instead of manually checking ret
diff --git a/drivers/net/dsa/realtek-smi-core.c b/drivers/net/dsa/realtek-smi-core.c
index c66ebd0ee217..aae46ada8d83 100644
--- a/drivers/net/dsa/realtek-smi-core.c
+++ b/drivers/net/dsa/realtek-smi-core.c
@@ -456,7 +456,7 @@ static int realtek_smi_probe(struct platform_device *pdev)
 	smi->ds->ops = var->ds_ops;
 	ret = dsa_register_switch(smi->ds);
 	if (ret) {
-		dev_err(dev, "unable to register switch ret = %d\n", ret);
+		dev_err_probe(dev, ret, "unable to register switch\n");
 		return ret;
Nit, following would have been simpler:

if (ret)
	return dev_err_probe(dev, ret, "unable to register switch\n");
 	}
 	return 0;

Re: [PATCH net v2 1/3] net: dsa: realtek-smi: don't log an error on EPROBE_DEFER

From: Alvin Šipraga <hidden>
Date: 2021-12-02 16:25:54

Hi David and Jakub,

I just noticed these patches aren't in the networking pull request for 
5.16-rc4. Indeed, patchwork bot says that they were applied to net-next 
(didn't notice before). Is it now too late for them to land in 5.16?

It is not a big deal, but the interpretation of device tree-specified 
RGMII RX delay is different after this series, hence why I wanted to get 
it in before the driver makes its way into a release.

Maybe I did something wrong? I am pretty new to netdev. :-)

Thanks!

	Alvin

On 11/29/21 14:00, patchwork-bot+netdevbpf@kernel.org wrote:
Hello:

This series was applied to netdev/net-next.git (master)
by David S. Miller [off-list ref]:

On Mon, 29 Nov 2021 11:30:17 +0100 you wrote:
quoted
From: Alvin Šipraga <redacted>

Probe deferral is not an error, so don't log this as an error:

[0.590156] realtek-smi ethernet-switch: unable to register switch ret = -517

Signed-off-by: Alvin Šipraga <redacted>

[...]
Here is the summary with links:
   - [net,v2,1/3] net: dsa: realtek-smi: don't log an error on EPROBE_DEFER
     https://git.kernel.org/netdev/net-next/c/b014861d96a6>>    - [net,v2,2/3] net: dsa: rtl8365mb: fix garbled comment
     https://git.kernel.org/netdev/net-next/c/1ecab9370eef>>    - [net,v2,3/3] net: dsa: rtl8365mb: set RGMII RX delay in steps of 0.3 ns
     https://git.kernel.org/netdev/net-next/c/ef136837aaf6>> 
You are awesome, thank you!

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help