net: lantiq: lantiq_xrx200: Move clock prepare to probe function
The switch and the MAC are in one IP core and they use the same clock
signal from the clock generation unit.
Currently the clock architecture in the lantiq SoC code does not allow
to easily share the same clocks, this has to be fixed by switching to
the common clock framework.
As a workaround the clock of the switch and MAC should be activated when
the MAC gets probed and only disabled when the MAC gets removed. This
way it is ensured that the clock is always enabled when the switch or
MAC is used. The switch can not be used without the MAC.
This fixes a data bus error when rebooting the system and deactivating
the switch and mac and later accessing some registers in the cleanup
while the clocks are disabled.
Fixes: fe1a56420c
("net: lantiq: Add Lantiq / Intel VRX200 Ethernet driver")
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
e82b5fe5d4
commit
a44ecfbda4
|
@ -115,12 +115,6 @@ static void xrx200_flush_dma(struct xrx200_chan *ch)
|
|||
static int xrx200_open(struct net_device *net_dev)
|
||||
{
|
||||
struct xrx200_priv *priv = netdev_priv(net_dev);
|
||||
int err;
|
||||
|
||||
/* enable clock gate */
|
||||
err = clk_prepare_enable(priv->clk);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
napi_enable(&priv->chan_tx.napi);
|
||||
ltq_dma_open(&priv->chan_tx.dma);
|
||||
|
@ -155,8 +149,6 @@ static int xrx200_close(struct net_device *net_dev)
|
|||
napi_disable(&priv->chan_tx.napi);
|
||||
ltq_dma_close(&priv->chan_tx.dma);
|
||||
|
||||
clk_disable_unprepare(priv->clk);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -497,6 +489,11 @@ static int xrx200_probe(struct platform_device *pdev)
|
|||
if (err)
|
||||
return err;
|
||||
|
||||
/* enable clock gate */
|
||||
err = clk_prepare_enable(priv->clk);
|
||||
if (err)
|
||||
goto err_uninit_dma;
|
||||
|
||||
/* set IPG to 12 */
|
||||
xrx200_pmac_mask(priv, PMAC_RX_IPG_MASK, 0xb, PMAC_RX_IPG);
|
||||
|
||||
|
@ -514,9 +511,12 @@ static int xrx200_probe(struct platform_device *pdev)
|
|||
|
||||
err = register_netdev(net_dev);
|
||||
if (err)
|
||||
goto err_uninit_dma;
|
||||
goto err_unprepare_clk;
|
||||
return err;
|
||||
|
||||
err_unprepare_clk:
|
||||
clk_disable_unprepare(priv->clk);
|
||||
|
||||
err_uninit_dma:
|
||||
xrx200_hw_cleanup(priv);
|
||||
|
||||
|
@ -536,6 +536,9 @@ static int xrx200_remove(struct platform_device *pdev)
|
|||
/* remove the actual device */
|
||||
unregister_netdev(net_dev);
|
||||
|
||||
/* release the clock */
|
||||
clk_disable_unprepare(priv->clk);
|
||||
|
||||
/* shut down hardware */
|
||||
xrx200_hw_cleanup(priv);
|
||||
|
||||
|
|
Loading…
Reference in New Issue