{
u32 clk_rate;
- clk_rate = clk_get_rate(priv->stmmac_clk);
+ //clk_rate = clk_get_rate(priv->stmmac_clk);
+ clk_rate = clk_get_rate(priv->pclk);
/* Platform provided default clk_csr would be assumed valid
* for all other cases except for the below mentioned ones.
if (!is_valid_ether_addr(priv->dev->dev_addr)) {
priv->hw->mac->get_umac_addr(priv->hw,
priv->dev->dev_addr, 0);
+ if (likely(priv->plat->get_eth_addr))
+ priv->plat->get_eth_addr(priv->plat->bsp_priv,
+ priv->dev->dev_addr);
if (!is_valid_ether_addr(priv->dev->dev_addr))
eth_hw_addr_random(priv->dev);
pr_info("%s: device MAC address %pM\n", priv->dev->name,
}
#ifdef CONFIG_DEBUG_FS
- ret = stmmac_init_fs(dev);
- if (ret < 0)
- pr_warn("%s: failed debugFS registration\n", __func__);
+ if (init_ptp) {
+ ret = stmmac_init_fs(dev);
+ if (ret < 0)
+ pr_warn("%s: failed debugFS registration\n", __func__);
+ }
#endif
/* Start the ball rolling... */
pr_debug("%s: DMA RX/TX processes started...\n", dev->name);
}
clk_prepare_enable(priv->stmmac_clk);
- priv->pclk = devm_clk_get(priv->device, "pclk");
+ //priv->pclk = devm_clk_get(priv->device, "pclk");
+ priv->pclk = devm_clk_get(priv->device, "pclk_mac");
if (IS_ERR(priv->pclk)) {
if (PTR_ERR(priv->pclk) == -EPROBE_DEFER) {
ret = -EPROBE_DEFER;
spin_lock_init(&priv->lock);
spin_lock_init(&priv->tx_lock);
- ret = register_netdev(ndev);
- if (ret) {
- pr_err("%s: ERROR %i registering the device\n", __func__, ret);
- goto error_netdev_register;
- }
-
/* If a specific clk_csr value is passed from the platform
* this means that the CSR Clock Range selection cannot be
* changed at run-time and it is fixed. Viceversa the driver'll try to
}
}
- return 0;
+ ret = register_netdev(ndev);
+ if (ret) {
+ netdev_err(priv->dev, "%s: ERROR %i registering the device\n",
+ __func__, ret);
+ goto error_netdev_register;
+ }
+
+ return ret;
-error_mdio_register:
- unregister_netdev(ndev);
error_netdev_register:
+ if (priv->pcs != STMMAC_PCS_RGMII &&
+ priv->pcs != STMMAC_PCS_TBI &&
+ priv->pcs != STMMAC_PCS_RTBI)
+ stmmac_mdio_unregister(ndev);
+error_mdio_register:
netif_napi_del(&priv->napi);
error_hw_init:
clk_disable_unprepare(priv->pclk);
if (priv->phydev)
phy_stop(priv->phydev);
- spin_lock_irqsave(&priv->lock, flags);
-
netif_device_detach(ndev);
netif_stop_queue(ndev);
napi_disable(&priv->napi);
+ spin_lock_irqsave(&priv->lock, flags);
+
/* Stop TX/RX DMA */
priv->hw->dma->stop_tx(priv->ioaddr);
priv->hw->dma->stop_rx(priv->ioaddr);
if (!netif_running(ndev))
return 0;
- spin_lock_irqsave(&priv->lock, flags);
-
/* Power Down bit, into the PM register, is cleared
* automatically as soon as a magic packet or a Wake-up frame
* is received. Anyway, it's better to manually clear
* from another devices (e.g. serial console).
*/
if (device_may_wakeup(priv->device)) {
+ spin_lock_irqsave(&priv->lock, flags);
priv->hw->mac->pmt(priv->hw, 0);
+ spin_unlock_irqrestore(&priv->lock, flags);
priv->irq_wake = 0;
} else {
pinctrl_pm_select_default_state(priv->device);
stmmac_mdio_reset(priv->mii);
}
- netif_device_attach(ndev);
+ spin_lock_irqsave(&priv->lock, flags);
priv->cur_rx = 0;
priv->dirty_rx = 0;
netif_start_queue(ndev);
+ netif_device_attach(ndev);
+
spin_unlock_irqrestore(&priv->lock, flags);
if (priv->phydev)