Commit 777f245e authored by Paolo Abeni's avatar Paolo Abeni
Browse files

Merge branch 'net-ravb-fixes-for-the-ravb-driver'

Claudiu Beznea says:

====================
net: ravb: Fixes for the ravb driver

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/
====================

Link: https://lore.kernel.org/r/20231128080439.852467-1-claudiu.beznea.uj@bp.renesas.com


Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parents 91fdb30d edf9bc39
Loading
Loading
Loading
Loading
+35 −23
Original line number Diff line number Diff line
@@ -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)
@@ -1811,19 +1812,20 @@ 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:
	/* 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;
@@ -2654,9 +2656,14 @@ 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);
	error = pm_runtime_resume_and_get(&pdev->dev);
	if (error < 0)
		goto out_rpm_disable;

	if (info->multi_irqs) {
		if (info->err_mgmt_irqs)
@@ -2881,11 +2888,12 @@ 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);
out_rpm_disable:
	pm_runtime_disable(&pdev->dev);
	reset_control_assert(rstc);
out_free_netdev:
	free_netdev(ndev);
	return error;
}

@@ -2895,22 +2903,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);