Message ID | 20210825070154.14336-14-biju.das.jz@bp.renesas.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 0d13a1a464a023379291218ac051e2bf8f46b5d1 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | Add Factorisation code to support Gigabit Ethernet driver | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for net-next |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | warning | 1 maintainers not CCed: p.zabel@pengutronix.de |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 60 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/header_inline | success | Link |
On 8/25/21 10:01 AM, Biju Das wrote: > Reset support is present on R-Car. Let's support it, if it is > available. > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> > Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> [...] > diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c > index 7a144b45e41d..0f85f2d97b18 100644 > --- a/drivers/net/ethernet/renesas/ravb_main.c > +++ b/drivers/net/ethernet/renesas/ravb_main.c [...] > @@ -2349,6 +2358,7 @@ static int ravb_probe(struct platform_device *pdev) > > pm_runtime_put(&pdev->dev); > pm_runtime_disable(&pdev->dev); > + reset_control_assert(rstc); > return error; > } > > @@ -2374,6 +2384,7 @@ static int ravb_remove(struct platform_device *pdev) > netif_napi_del(&priv->napi[RAVB_BE]); > ravb_mdio_release(priv); > pm_runtime_disable(&pdev->dev); > + reset_control_assert(priv->rstc); > free_netdev(ndev); > platform_set_drvdata(pdev, NULL); > Is it possible to get into/out of reset in open()/close() methods? Otherwise, looks good (I'm not much into reset h/w) Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru> MBR, Sergey
Hi Sergei, Thanks for the feedback. > Subject: Re: [PATCH net-next 13/13] ravb: Add reset support > > On 8/25/21 10:01 AM, Biju Das wrote: > > > Reset support is present on R-Car. Let's support it, if it is > > available. > > > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> > > Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> > [...] > > diff --git a/drivers/net/ethernet/renesas/ravb_main.c > > b/drivers/net/ethernet/renesas/ravb_main.c > > index 7a144b45e41d..0f85f2d97b18 100644 > > --- a/drivers/net/ethernet/renesas/ravb_main.c > > +++ b/drivers/net/ethernet/renesas/ravb_main.c > [...] > > > @@ -2349,6 +2358,7 @@ static int ravb_probe(struct platform_device > > *pdev) > > > > pm_runtime_put(&pdev->dev); > > pm_runtime_disable(&pdev->dev); > > + reset_control_assert(rstc); > > return error; > > } > > > > @@ -2374,6 +2384,7 @@ static int ravb_remove(struct platform_device > *pdev) > > netif_napi_del(&priv->napi[RAVB_BE]); > > ravb_mdio_release(priv); > > pm_runtime_disable(&pdev->dev); > > + reset_control_assert(priv->rstc); > > free_netdev(ndev); > > platform_set_drvdata(pdev, NULL); > > > > Is it possible to get into/out of reset in open()/close() methods? No, Reason, Normally reset will be called ravb_mdio_release(priv); pm_runtime_disable(&pdev->dev); reset_control_assert(priv->rstc); After reset assert, We should not access any RAVB registers, otherwise system will hang. There is a high chance that other users(for eg:- mdio) may access ravb registers and system hangs. Regards, Biju > Otherwise, looks good (I'm not much into reset h/w) > > Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru> > > MBR, Sergey
diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h index 117eb22349c5..47c5377e4f42 100644 --- a/drivers/net/ethernet/renesas/ravb.h +++ b/drivers/net/ethernet/renesas/ravb.h @@ -1057,6 +1057,7 @@ struct ravb_private { unsigned int num_tx_desc; /* TX descriptors per packet */ const struct ravb_hw_info *info; + struct reset_control *rstc; }; static inline u32 ravb_read(struct net_device *ndev, enum ravb_reg reg) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 7a144b45e41d..0f85f2d97b18 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -29,6 +29,7 @@ #include <linux/slab.h> #include <linux/spinlock.h> #include <linux/sys_soc.h> +#include <linux/reset.h> #include <asm/div64.h> @@ -2140,6 +2141,7 @@ static int ravb_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; const struct ravb_hw_info *info; + struct reset_control *rstc; struct ravb_private *priv; struct net_device *ndev; int error, irq, q; @@ -2152,6 +2154,11 @@ static int ravb_probe(struct platform_device *pdev) return -EINVAL; } + rstc = devm_reset_control_get_optional_exclusive(&pdev->dev, NULL); + if (IS_ERR(rstc)) + return dev_err_probe(&pdev->dev, PTR_ERR(rstc), + "failed to get cpg reset\n"); + ndev = alloc_etherdev_mqs(sizeof(struct ravb_private), NUM_TX_QUEUE, NUM_RX_QUEUE); if (!ndev) @@ -2162,6 +2169,7 @@ static int ravb_probe(struct platform_device *pdev) ndev->features = info->net_features; ndev->hw_features = info->net_hw_features; + reset_control_deassert(rstc); pm_runtime_enable(&pdev->dev); pm_runtime_get_sync(&pdev->dev); @@ -2179,6 +2187,7 @@ static int ravb_probe(struct platform_device *pdev) priv = netdev_priv(ndev); priv->info = info; + priv->rstc = rstc; priv->ndev = ndev; priv->pdev = pdev; priv->num_tx_ring[RAVB_BE] = BE_TX_RING_SIZE; @@ -2349,6 +2358,7 @@ static int ravb_probe(struct platform_device *pdev) pm_runtime_put(&pdev->dev); pm_runtime_disable(&pdev->dev); + reset_control_assert(rstc); return error; } @@ -2374,6 +2384,7 @@ static int ravb_remove(struct platform_device *pdev) netif_napi_del(&priv->napi[RAVB_BE]); ravb_mdio_release(priv); pm_runtime_disable(&pdev->dev); + reset_control_assert(priv->rstc); free_netdev(ndev); platform_set_drvdata(pdev, NULL);