netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/6] net: ravb: Fixes for the ravb driver
@ 2023-11-28  8:04 Claudiu
  2023-11-28  8:04 ` [PATCH v2 1/6] net: ravb: Check return value of reset_control_deassert() Claudiu
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: Claudiu @ 2023-11-28  8:04 UTC (permalink / raw)
  To: s.shtylyov, davem, edumazet, kuba, pabeni, richardcochran,
	p.zabel, yoshihiro.shimoda.uh, renesas, robh, biju.das.jz,
	prabhakar.mahadev-lad.rj, mitsuhiro.kimura.kc, masaru.nagai.vx
  Cc: netdev, linux-renesas-soc, linux-kernel

From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

Hi,

This series adds some fixes for ravb driver. Patches in this series
were initilly part of series at [1].

Changes in v2:
- in description of patch 1/6 documented the addition of
  out_free_netdev goto label
- collected tags
- s/out_runtime_disable/out_rpm_disable in patch 2/6
- fixed typos in description of patch 6/6

Changes since [1]:
- addressed review comments
- added patch 6/6

[1] https://lore.kernel.org/all/20231120084606.4083194-1-claudiu.beznea.uj@bp.renesas.com/

Claudiu Beznea (6):
  net: ravb: Check return value of reset_control_deassert()
  net: ravb: Use pm_runtime_resume_and_get()
  net: ravb: Make write access to CXR35 first before accessing other
    EMAC registers
  net: ravb: Start TX queues after HW initialization succeeded
  net: ravb: Stop DMA in case of failures on ravb_open()
  net: ravb: Keep reverse order of operations in ravb_remove()

 drivers/net/ethernet/renesas/ravb_main.c | 58 ++++++++++++++----------
 1 file changed, 35 insertions(+), 23 deletions(-)

-- 
2.39.2


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 1/6] net: ravb: Check return value of reset_control_deassert()
  2023-11-28  8:04 [PATCH v2 0/6] net: ravb: Fixes for the ravb driver Claudiu
@ 2023-11-28  8:04 ` Claudiu
  2023-11-28  8:04 ` [PATCH v2 2/6] net: ravb: Use pm_runtime_resume_and_get() Claudiu
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Claudiu @ 2023-11-28  8:04 UTC (permalink / raw)
  To: s.shtylyov, davem, edumazet, kuba, pabeni, richardcochran,
	p.zabel, yoshihiro.shimoda.uh, renesas, robh, biju.das.jz,
	prabhakar.mahadev-lad.rj, mitsuhiro.kimura.kc, masaru.nagai.vx
  Cc: netdev, linux-renesas-soc, linux-kernel

From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

reset_control_deassert() could return an error. Some devices cannot work
if reset signal de-assert operation fails. To avoid this check the return
code of reset_control_deassert() in ravb_probe() and take proper action.

Along with it, the free_netdev() call from the error path was moved after
reset_control_assert() on its own label (out_free_netdev) to free
netdev in case reset_control_deassert() fails.

Fixes: 0d13a1a464a0 ("ravb: Add reset support")
Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---

Changes in v2:
- documented the addition of out_free_netdev goto label
- collected Rb tags

Changes since [1]:
- added goto label for free_netdev()

[1] https://lore.kernel.org/all/20231120084606.4083194-1-claudiu.beznea.uj@bp.renesas.com/

 drivers/net/ethernet/renesas/ravb_main.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index c70cff80cc99..50c4c79be035 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -2645,7 +2645,10 @@ static int ravb_probe(struct platform_device *pdev)
 	ndev->features = info->net_features;
 	ndev->hw_features = info->net_hw_features;
 
-	reset_control_deassert(rstc);
+	error = reset_control_deassert(rstc);
+	if (error)
+		goto out_free_netdev;
+
 	pm_runtime_enable(&pdev->dev);
 	pm_runtime_get_sync(&pdev->dev);
 
@@ -2872,11 +2875,11 @@ static int ravb_probe(struct platform_device *pdev)
 out_disable_refclk:
 	clk_disable_unprepare(priv->refclk);
 out_release:
-	free_netdev(ndev);
-
 	pm_runtime_put(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
 	reset_control_assert(rstc);
+out_free_netdev:
+	free_netdev(ndev);
 	return error;
 }
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 2/6] net: ravb: Use pm_runtime_resume_and_get()
  2023-11-28  8:04 [PATCH v2 0/6] net: ravb: Fixes for the ravb driver Claudiu
  2023-11-28  8:04 ` [PATCH v2 1/6] net: ravb: Check return value of reset_control_deassert() Claudiu
@ 2023-11-28  8:04 ` Claudiu
  2023-11-28  8:04 ` [PATCH v2 3/6] net: ravb: Make write access to CXR35 first before accessing other EMAC registers Claudiu
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Claudiu @ 2023-11-28  8:04 UTC (permalink / raw)
  To: s.shtylyov, davem, edumazet, kuba, pabeni, richardcochran,
	p.zabel, yoshihiro.shimoda.uh, renesas, robh, biju.das.jz,
	prabhakar.mahadev-lad.rj, mitsuhiro.kimura.kc, masaru.nagai.vx
  Cc: netdev, linux-renesas-soc, linux-kernel

From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

pm_runtime_get_sync() may return an error. In case it returns with an error
dev->power.usage_count needs to be decremented. pm_runtime_resume_and_get()
takes care of this. Thus use it.

Fixes: c156633f1353 ("Renesas Ethernet AVB driver proper")
Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---

Changes in v2:
- s/out_runtime_disable/out_rpm_disable
- collected Rb tag

Changes since [1]:
- added goto label for pm_runtime_disable(); with this innecessary
  changes were removed

[1] https://lore.kernel.org/all/20231120084606.4083194-1-claudiu.beznea.uj@bp.renesas.com/

 drivers/net/ethernet/renesas/ravb_main.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 50c4c79be035..0af2ace286be 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -2650,7 +2650,9 @@ static int ravb_probe(struct platform_device *pdev)
 		goto out_free_netdev;
 
 	pm_runtime_enable(&pdev->dev);
-	pm_runtime_get_sync(&pdev->dev);
+	error = pm_runtime_resume_and_get(&pdev->dev);
+	if (error < 0)
+		goto out_rpm_disable;
 
 	if (info->multi_irqs) {
 		if (info->err_mgmt_irqs)
@@ -2876,6 +2878,7 @@ static int ravb_probe(struct platform_device *pdev)
 	clk_disable_unprepare(priv->refclk);
 out_release:
 	pm_runtime_put(&pdev->dev);
+out_rpm_disable:
 	pm_runtime_disable(&pdev->dev);
 	reset_control_assert(rstc);
 out_free_netdev:
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 3/6] net: ravb: Make write access to CXR35 first before accessing other EMAC registers
  2023-11-28  8:04 [PATCH v2 0/6] net: ravb: Fixes for the ravb driver Claudiu
  2023-11-28  8:04 ` [PATCH v2 1/6] net: ravb: Check return value of reset_control_deassert() Claudiu
  2023-11-28  8:04 ` [PATCH v2 2/6] net: ravb: Use pm_runtime_resume_and_get() Claudiu
@ 2023-11-28  8:04 ` Claudiu
  2023-11-28  8:04 ` [PATCH v2 4/6] net: ravb: Start TX queues after HW initialization succeeded Claudiu
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Claudiu @ 2023-11-28  8:04 UTC (permalink / raw)
  To: s.shtylyov, davem, edumazet, kuba, pabeni, richardcochran,
	p.zabel, yoshihiro.shimoda.uh, renesas, robh, biju.das.jz,
	prabhakar.mahadev-lad.rj, mitsuhiro.kimura.kc, masaru.nagai.vx
  Cc: netdev, linux-renesas-soc, linux-kernel

From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

Hardware manual of RZ/G3S (and RZ/G2L) specifies the following on the
description of CXR35 register (chapter "PHY interface select register
(CXR35)"): "After release reset, make write-access to this register before
making write-access to other registers (except MDIOMOD). Even if not need
to change the value of this register, make write-access to this register
at least one time. Because RGMII/MII MODE is recognized by accessing this
register".

The setup procedure for EMAC module (chapter "Setup procedure" of RZ/G3S,
RZ/G2L manuals) specifies the E-MAC.CXR35 register is the first EMAC
register that is to be configured.

Note [A] from chapter "PHY interface select register (CXR35)" specifies
the following:
[A] The case which CXR35 SEL_XMII is used for the selection of RGMII/MII
in APB Clock 100 MHz.
(1) To use RGMII interface, Set ‘H’03E8_0000’ to this register.
(2) To use MII interface, Set ‘H’03E8_0002’ to this register.

Take into account these indication.

Fixes: 1089877ada8d ("ravb: Add RZ/G2L MII interface support")
Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---

Changes in v2:
- none

Changes since [1]:
- collected Rb tag

[1] https://lore.kernel.org/all/20231120084606.4083194-1-claudiu.beznea.uj@bp.renesas.com/


 drivers/net/ethernet/renesas/ravb_main.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 0af2ace286be..62a986b5de41 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -515,6 +515,15 @@ static void ravb_emac_init_gbeth(struct net_device *ndev)
 {
 	struct ravb_private *priv = netdev_priv(ndev);
 
+	if (priv->phy_interface == PHY_INTERFACE_MODE_MII) {
+		ravb_write(ndev, (1000 << 16) | CXR35_SEL_XMII_MII, CXR35);
+		ravb_modify(ndev, CXR31, CXR31_SEL_LINK0 | CXR31_SEL_LINK1, 0);
+	} else {
+		ravb_write(ndev, (1000 << 16) | CXR35_SEL_XMII_RGMII, CXR35);
+		ravb_modify(ndev, CXR31, CXR31_SEL_LINK0 | CXR31_SEL_LINK1,
+			    CXR31_SEL_LINK0);
+	}
+
 	/* Receive frame limit set register */
 	ravb_write(ndev, GBETH_RX_BUFF_MAX + ETH_FCS_LEN, RFLR);
 
@@ -537,14 +546,6 @@ static void ravb_emac_init_gbeth(struct net_device *ndev)
 
 	/* E-MAC interrupt enable register */
 	ravb_write(ndev, ECSIPR_ICDIP, ECSIPR);
-
-	if (priv->phy_interface == PHY_INTERFACE_MODE_MII) {
-		ravb_modify(ndev, CXR31, CXR31_SEL_LINK0 | CXR31_SEL_LINK1, 0);
-		ravb_write(ndev, (1000 << 16) | CXR35_SEL_XMII_MII, CXR35);
-	} else {
-		ravb_modify(ndev, CXR31, CXR31_SEL_LINK0 | CXR31_SEL_LINK1,
-			    CXR31_SEL_LINK0);
-	}
 }
 
 static void ravb_emac_init_rcar(struct net_device *ndev)
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 4/6] net: ravb: Start TX queues after HW initialization succeeded
  2023-11-28  8:04 [PATCH v2 0/6] net: ravb: Fixes for the ravb driver Claudiu
                   ` (2 preceding siblings ...)
  2023-11-28  8:04 ` [PATCH v2 3/6] net: ravb: Make write access to CXR35 first before accessing other EMAC registers Claudiu
@ 2023-11-28  8:04 ` Claudiu
  2023-11-28  8:11   ` Kalesh Anakkur Purayil
  2023-11-28  8:04 ` [PATCH v2 5/6] net: ravb: Stop DMA in case of failures on ravb_open() Claudiu
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 9+ messages in thread
From: Claudiu @ 2023-11-28  8:04 UTC (permalink / raw)
  To: s.shtylyov, davem, edumazet, kuba, pabeni, richardcochran,
	p.zabel, yoshihiro.shimoda.uh, renesas, robh, biju.das.jz,
	prabhakar.mahadev-lad.rj, mitsuhiro.kimura.kc, masaru.nagai.vx
  Cc: netdev, linux-renesas-soc, linux-kernel

From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

ravb_phy_start() may fail. If that happens, the TX queues will remain
started. Thus, move the netif_tx_start_all_queues() after PHY is
successfully initialized.

Fixes: c156633f1353 ("Renesas Ethernet AVB driver proper")
Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---

Changes in v2:
- none

Changes since [1]:
- collected Rb tag

[1] https://lore.kernel.org/all/20231120084606.4083194-1-claudiu.beznea.uj@bp.renesas.com/

 drivers/net/ethernet/renesas/ravb_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 62a986b5de41..2ef46c71f2bb 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -1812,13 +1812,13 @@ static int ravb_open(struct net_device *ndev)
 	if (info->gptp)
 		ravb_ptp_init(ndev, priv->pdev);
 
-	netif_tx_start_all_queues(ndev);
-
 	/* PHY control start */
 	error = ravb_phy_start(ndev);
 	if (error)
 		goto out_ptp_stop;
 
+	netif_tx_start_all_queues(ndev);
+
 	return 0;
 
 out_ptp_stop:
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 5/6] net: ravb: Stop DMA in case of failures on ravb_open()
  2023-11-28  8:04 [PATCH v2 0/6] net: ravb: Fixes for the ravb driver Claudiu
                   ` (3 preceding siblings ...)
  2023-11-28  8:04 ` [PATCH v2 4/6] net: ravb: Start TX queues after HW initialization succeeded Claudiu
@ 2023-11-28  8:04 ` Claudiu
  2023-11-28  8:04 ` [PATCH v2 6/6] net: ravb: Keep reverse order of operations in ravb_remove() Claudiu
  2023-11-30 10:20 ` [PATCH v2 0/6] net: ravb: Fixes for the ravb driver patchwork-bot+netdevbpf
  6 siblings, 0 replies; 9+ messages in thread
From: Claudiu @ 2023-11-28  8:04 UTC (permalink / raw)
  To: s.shtylyov, davem, edumazet, kuba, pabeni, richardcochran,
	p.zabel, yoshihiro.shimoda.uh, renesas, robh, biju.das.jz,
	prabhakar.mahadev-lad.rj, mitsuhiro.kimura.kc, masaru.nagai.vx
  Cc: netdev, linux-renesas-soc, linux-kernel

From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

In case ravb_phy_start() returns with error the settings applied in
ravb_dmac_init() are not reverted (e.g. config mode). For this call
ravb_stop_dma() on failure path of ravb_open().

Fixes: a0d2f20650e8 ("Renesas Ethernet AVB PTP clock driver")
Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---

Changes in v2:
- none

Changes since [1]:
- s/ravb_dma_init/ravb_dmac_init in commit description
- collected Rb tag

[1] https://lore.kernel.org/all/20231120084606.4083194-1-claudiu.beznea.uj@bp.renesas.com/

 drivers/net/ethernet/renesas/ravb_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 2ef46c71f2bb..2396fab3f608 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -1825,6 +1825,7 @@ static int ravb_open(struct net_device *ndev)
 	/* Stop PTP Clock driver */
 	if (info->gptp)
 		ravb_ptp_stop(ndev);
+	ravb_stop_dma(ndev);
 out_free_irq_mgmta:
 	if (!info->multi_irqs)
 		goto out_free_irq;
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 6/6] net: ravb: Keep reverse order of operations in ravb_remove()
  2023-11-28  8:04 [PATCH v2 0/6] net: ravb: Fixes for the ravb driver Claudiu
                   ` (4 preceding siblings ...)
  2023-11-28  8:04 ` [PATCH v2 5/6] net: ravb: Stop DMA in case of failures on ravb_open() Claudiu
@ 2023-11-28  8:04 ` Claudiu
  2023-11-30 10:20 ` [PATCH v2 0/6] net: ravb: Fixes for the ravb driver patchwork-bot+netdevbpf
  6 siblings, 0 replies; 9+ messages in thread
From: Claudiu @ 2023-11-28  8:04 UTC (permalink / raw)
  To: s.shtylyov, davem, edumazet, kuba, pabeni, richardcochran,
	p.zabel, yoshihiro.shimoda.uh, renesas, robh, biju.das.jz,
	prabhakar.mahadev-lad.rj, mitsuhiro.kimura.kc, masaru.nagai.vx
  Cc: netdev, linux-renesas-soc, linux-kernel

From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

On RZ/G3S SMARC Carrier II board having RGMII connections b/w Ethernet
MACs and PHYs it has been discovered that doing unbind/bind for ravb
driver in a loop leads to wrong speed and duplex for Ethernet links and
broken connectivity (the connectivity cannot be restored even with
bringing interface down/up). Before doing unbind/bind the Ethernet
interfaces were configured though systemd. The sh instructions used to
do unbind/bind were:

$ cd /sys/bus/platform/drivers/ravb/
$ while :; do echo 11c30000.ethernet > unbind ; \
  echo 11c30000.ethernet > bind; done

It has been discovered that there is a race b/w IOCTLs initialized by
systemd at the response of success binding and the
"ravb_write(ndev, CCC_OPC_RESET, CCC)" call in ravb_remove() as
follows:

1/ as a result of bind success the user space open/configures the
   interfaces tough an IOCTL; the following stack trace has been
   identified on RZ/G3S:

Call trace:
dump_backtrace+0x9c/0x100
show_stack+0x20/0x38
dump_stack_lvl+0x48/0x60
dump_stack+0x18/0x28
ravb_open+0x70/0xa58
__dev_open+0xf4/0x1e8
__dev_change_flags+0x198/0x218
dev_change_flags+0x2c/0x80
devinet_ioctl+0x640/0x708
inet_ioctl+0x1e4/0x200
sock_do_ioctl+0x50/0x108
sock_ioctl+0x240/0x358
__arm64_sys_ioctl+0xb0/0x100
invoke_syscall+0x50/0x128
el0_svc_common.constprop.0+0xc8/0xf0
do_el0_svc+0x24/0x38
el0_svc+0x34/0xb8
el0t_64_sync_handler+0xc0/0xc8
el0t_64_sync+0x190/0x198

2/ this call may execute concurrently with ravb_remove() as the
   unbind/bind operation was executed in a loop
3/ if the operation mode is changed to RESET (through
   ravb_write(ndev, CCC_OPC_RESET, CCC) call in ravb_remove())
   while the above ravb_open() is in progress it may lead to MAC
   (or PHY, or MAC-PHY connection, the right point hasn't been identified
   at the moment) to be broken, thus the Ethernet connectivity fails to
   restore.

The simple fix for this is to move ravb_write(ndev, CCC_OPC_RESET, CCC))
after unregister_netdev() to avoid resetting the controller while the
netdev interface is still registered.

To avoid future issues in ravb_remove(), the patch follows the proper order
of operations in ravb_remove(): reverse order compared with ravb_probe().
This avoids described races as the IOCTLs as well as unregister_netdev()
(called now at the beginning of ravb_remove()) calls rtnl_lock() before
continuing and IOCTLs check (though devinet_ioctl()) if device is still
registered just after taking the lock:

int devinet_ioctl(struct net *net, unsigned int cmd, struct ifreq *ifr)
{
	// ...

        rtnl_lock();

        ret = -ENODEV;
        dev = __dev_get_by_name(net, ifr->ifr_name);
        if (!dev)
                goto done;

	// ...
done:
        rtnl_unlock();
out:
        return ret;
}

Fixes: c156633f1353 ("Renesas Ethernet AVB driver proper")
Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---

Changes in v2:
- fixed typos in commit description
- collected Rb tag

Changes since [1]:
- s/ravb_dma_init/ravb_dmac_init in commit description
- collected Rb tag

[1] https://lore.kernel.org/all/20231120084606.4083194-1-claudiu.beznea.uj@bp.renesas.com/

 drivers/net/ethernet/renesas/ravb_main.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 2396fab3f608..9178f6d60e74 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -2894,22 +2894,26 @@ static void ravb_remove(struct platform_device *pdev)
 	struct ravb_private *priv = netdev_priv(ndev);
 	const struct ravb_hw_info *info = priv->info;
 
-	/* Stop PTP Clock driver */
-	if (info->ccc_gac)
-		ravb_ptp_stop(ndev);
-
-	clk_disable_unprepare(priv->gptp_clk);
-	clk_disable_unprepare(priv->refclk);
-
-	/* Set reset mode */
-	ravb_write(ndev, CCC_OPC_RESET, CCC);
 	unregister_netdev(ndev);
 	if (info->nc_queues)
 		netif_napi_del(&priv->napi[RAVB_NC]);
 	netif_napi_del(&priv->napi[RAVB_BE]);
+
 	ravb_mdio_release(priv);
+
+	/* Stop PTP Clock driver */
+	if (info->ccc_gac)
+		ravb_ptp_stop(ndev);
+
 	dma_free_coherent(ndev->dev.parent, priv->desc_bat_size, priv->desc_bat,
 			  priv->desc_bat_dma);
+
+	/* Set reset mode */
+	ravb_write(ndev, CCC_OPC_RESET, CCC);
+
+	clk_disable_unprepare(priv->gptp_clk);
+	clk_disable_unprepare(priv->refclk);
+
 	pm_runtime_put_sync(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
 	reset_control_assert(priv->rstc);
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 4/6] net: ravb: Start TX queues after HW initialization succeeded
  2023-11-28  8:04 ` [PATCH v2 4/6] net: ravb: Start TX queues after HW initialization succeeded Claudiu
@ 2023-11-28  8:11   ` Kalesh Anakkur Purayil
  0 siblings, 0 replies; 9+ messages in thread
From: Kalesh Anakkur Purayil @ 2023-11-28  8:11 UTC (permalink / raw)
  To: Claudiu
  Cc: s.shtylyov, davem, edumazet, kuba, pabeni, richardcochran,
	p.zabel, yoshihiro.shimoda.uh, renesas, robh, biju.das.jz,
	prabhakar.mahadev-lad.rj, mitsuhiro.kimura.kc, masaru.nagai.vx,
	netdev, linux-renesas-soc, linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 1617 bytes --]

On Tue, Nov 28, 2023 at 1:35 PM Claudiu <claudiu.beznea@tuxon.dev> wrote:

> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
>
> ravb_phy_start() may fail. If that happens, the TX queues will remain
> started. Thus, move the netif_tx_start_all_queues() after PHY is
> successfully initialized.
>
> Fixes: c156633f1353 ("Renesas Ethernet AVB driver proper")
> Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
> ---
>
> Changes in v2:
> - none
>
> Changes since [1]:
> - collected Rb tag
>
> [1]
> https://lore.kernel.org/all/20231120084606.4083194-1-claudiu.beznea.uj@bp.renesas.com/
>
>  drivers/net/ethernet/renesas/ravb_main.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>

Looks good to me.

Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

>
> diff --git a/drivers/net/ethernet/renesas/ravb_main.c
> b/drivers/net/ethernet/renesas/ravb_main.c
> index 62a986b5de41..2ef46c71f2bb 100644
> --- a/drivers/net/ethernet/renesas/ravb_main.c
> +++ b/drivers/net/ethernet/renesas/ravb_main.c
> @@ -1812,13 +1812,13 @@ static int ravb_open(struct net_device *ndev)
>         if (info->gptp)
>                 ravb_ptp_init(ndev, priv->pdev);
>
> -       netif_tx_start_all_queues(ndev);
> -
>         /* PHY control start */
>         error = ravb_phy_start(ndev);
>         if (error)
>                 goto out_ptp_stop;
>
> +       netif_tx_start_all_queues(ndev);
> +
>         return 0;
>
>  out_ptp_stop:
> --
> 2.39.2
>
>
>

-- 
Regards,
Kalesh A P

[-- Attachment #1.2: Type: text/html, Size: 2800 bytes --]

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4239 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 0/6] net: ravb: Fixes for the ravb driver
  2023-11-28  8:04 [PATCH v2 0/6] net: ravb: Fixes for the ravb driver Claudiu
                   ` (5 preceding siblings ...)
  2023-11-28  8:04 ` [PATCH v2 6/6] net: ravb: Keep reverse order of operations in ravb_remove() Claudiu
@ 2023-11-30 10:20 ` patchwork-bot+netdevbpf
  6 siblings, 0 replies; 9+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-11-30 10:20 UTC (permalink / raw)
  To: claudiu beznea
  Cc: s.shtylyov, davem, edumazet, kuba, pabeni, richardcochran,
	p.zabel, yoshihiro.shimoda.uh, renesas, robh, biju.das.jz,
	prabhakar.mahadev-lad.rj, mitsuhiro.kimura.kc, masaru.nagai.vx,
	netdev, linux-renesas-soc, linux-kernel

Hello:

This series was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Tue, 28 Nov 2023 10:04:33 +0200 you wrote:
> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
> 
> Hi,
> 
> This series adds some fixes for ravb driver. Patches in this series
> were initilly part of series at [1].
> 
> [...]

Here is the summary with links:
  - [v2,1/6] net: ravb: Check return value of reset_control_deassert()
    https://git.kernel.org/netdev/net/c/d8eb6ea4b302
  - [v2,2/6] net: ravb: Use pm_runtime_resume_and_get()
    https://git.kernel.org/netdev/net/c/88b74831faae
  - [v2,3/6] net: ravb: Make write access to CXR35 first before accessing other EMAC registers
    https://git.kernel.org/netdev/net/c/d78c0ced60d5
  - [v2,4/6] net: ravb: Start TX queues after HW initialization succeeded
    https://git.kernel.org/netdev/net/c/6f32c0866020
  - [v2,5/6] net: ravb: Stop DMA in case of failures on ravb_open()
    https://git.kernel.org/netdev/net/c/eac16a733427
  - [v2,6/6] net: ravb: Keep reverse order of operations in ravb_remove()
    https://git.kernel.org/netdev/net/c/edf9bc396e05

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



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-11-30 10:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-28  8:04 [PATCH v2 0/6] net: ravb: Fixes for the ravb driver Claudiu
2023-11-28  8:04 ` [PATCH v2 1/6] net: ravb: Check return value of reset_control_deassert() Claudiu
2023-11-28  8:04 ` [PATCH v2 2/6] net: ravb: Use pm_runtime_resume_and_get() Claudiu
2023-11-28  8:04 ` [PATCH v2 3/6] net: ravb: Make write access to CXR35 first before accessing other EMAC registers Claudiu
2023-11-28  8:04 ` [PATCH v2 4/6] net: ravb: Start TX queues after HW initialization succeeded Claudiu
2023-11-28  8:11   ` Kalesh Anakkur Purayil
2023-11-28  8:04 ` [PATCH v2 5/6] net: ravb: Stop DMA in case of failures on ravb_open() Claudiu
2023-11-28  8:04 ` [PATCH v2 6/6] net: ravb: Keep reverse order of operations in ravb_remove() Claudiu
2023-11-30 10:20 ` [PATCH v2 0/6] net: ravb: Fixes for the ravb driver patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).