* packet processing for this device must be stopped before this call.
*/
static void
-fec_restart(struct net_device *ndev, int duplex)
+fec_restart(struct net_device *ndev)
{
struct fec_enet_private *fep = netdev_priv(ndev);
const struct platform_device_id *id_entry =
}
/* Enable MII mode */
- if (duplex) {
+ if (fep->full_duplex == DUPLEX_FULL) {
/* FD enable */
writel(0x04, fep->hwp + FEC_X_CNTRL);
} else {
writel(0x0, fep->hwp + FEC_X_CNTRL);
}
- fep->full_duplex = duplex;
-
/* Set MII speed */
writel(fep->phy_speed, fep->hwp + FEC_MII_SPEED);
if (netif_device_present(ndev) || netif_running(ndev)) {
napi_disable(&fep->napi);
netif_tx_lock_bh(ndev);
- fec_restart(ndev, fep->full_duplex);
+ fec_restart(ndev);
netif_wake_queue(ndev);
netif_tx_unlock_bh(ndev);
napi_enable(&fep->napi);
status_change = 1;
}
- if (fep->full_duplex != phy_dev->duplex)
+ if (fep->full_duplex != phy_dev->duplex) {
+ fep->full_duplex = phy_dev->duplex;
status_change = 1;
+ }
if (phy_dev->speed != fep->speed) {
fep->speed = phy_dev->speed;
if (status_change) {
napi_disable(&fep->napi);
netif_tx_lock_bh(ndev);
- fec_restart(ndev, phy_dev->duplex);
+ fec_restart(ndev);
netif_wake_queue(ndev);
netif_tx_unlock_bh(ndev);
napi_enable(&fep->napi);
if (netif_running(ndev)) {
napi_disable(&fep->napi);
netif_tx_lock_bh(ndev);
- fec_restart(ndev, fep->full_duplex);
+ fec_restart(ndev);
netif_wake_queue(ndev);
netif_tx_unlock_bh(ndev);
napi_enable(&fep->napi);
return ret;
}
- fec_restart(ndev, fep->full_duplex);
+ fec_restart(ndev);
napi_enable(&fep->napi);
phy_start(fep->phy_dev);
netif_start_queue(ndev);
/* Resume the device after updates */
if (netif_running(netdev) && changed & FEATURES_NEED_QUIESCE) {
- fec_restart(netdev, fep->phy_dev->duplex);
+ fec_restart(netdev);
netif_wake_queue(netdev);
netif_tx_unlock_bh(netdev);
napi_enable(&fep->napi);
ndev->hw_features = ndev->features;
- fec_restart(ndev, 0);
+ fec_restart(ndev);
return 0;
}
rtnl_lock();
if (netif_running(ndev)) {
- fec_restart(ndev, fep->full_duplex);
+ fec_restart(ndev);
netif_tx_lock_bh(ndev);
netif_device_attach(ndev);
netif_tx_unlock_bh(ndev);