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);
napi_disable(&priv->chan_tx.napi);
ltq_dma_close(&priv->chan_tx.dma);
- clk_disable_unprepare(priv->clk);
-
return 0;
}
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);
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);
/* remove the actual device */
unregister_netdev(net_dev);
+ /* release the clock */
+ clk_disable_unprepare(priv->clk);
+
/* shut down hardware */
xrx200_hw_cleanup(priv);