Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (56 commits) sky2: Fix oops in sky2_xmit_frame() after TX timeout Documentation/3c509: document ethtool support af_packet: Don't use skb after dev_queue_xmit() vxge: use pci_dma_mapping_error to test return value netfilter: ebtables: enforce CAP_NET_ADMIN e1000e: fix and commonize code for setting the receive address registers e1000e: e1000e_enable_tx_pkt_filtering() returns wrong value e1000e: perform 10/100 adaptive IFS only on parts that support it e1000e: don't accumulate PHY statistics on PHY read failure e1000e: call pci_save_state() after pci_restore_state() netxen: update version to 4.0.72 netxen: fix set mac addr netxen: fix smatch warning netxen: fix tx ring memory leak tcp: update the netstamp_needed counter when cloning sockets TI DaVinci EMAC: Handle emac module clock correctly. dmfe/tulip: Let dmfe handle DM910x except for SPARC on-board chips ixgbe: Fix compiler warning about variable being used uninitialized netfilter: nf_ct_ftp: fix out of bounds read in update_nl_seq() mv643xx_eth: don't include cache padding in rx desc buffer size ... Fix trivial conflict in drivers/scsi/cxgb3i/cxgb3i_offload.c
This commit is contained in:
@@ -331,8 +331,8 @@ static void bcm54xx_adjust_rxrefclk(struct phy_device *phydev)
|
||||
bool clk125en = true;
|
||||
|
||||
/* Abort if we are using an untested phy. */
|
||||
if (BRCM_PHY_MODEL(phydev) != PHY_ID_BCM57780 ||
|
||||
BRCM_PHY_MODEL(phydev) != PHY_ID_BCM50610 ||
|
||||
if (BRCM_PHY_MODEL(phydev) != PHY_ID_BCM57780 &&
|
||||
BRCM_PHY_MODEL(phydev) != PHY_ID_BCM50610 &&
|
||||
BRCM_PHY_MODEL(phydev) != PHY_ID_BCM50610M)
|
||||
return;
|
||||
|
||||
|
@@ -264,6 +264,8 @@ static int mdio_bus_match(struct device *dev, struct device_driver *drv)
|
||||
(phydev->phy_id & phydrv->phy_id_mask));
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
|
||||
static bool mdio_bus_phy_may_suspend(struct phy_device *phydev)
|
||||
{
|
||||
struct device_driver *drv = phydev->dev.driver;
|
||||
@@ -295,34 +297,88 @@ static bool mdio_bus_phy_may_suspend(struct phy_device *phydev)
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Suspend and resume. Copied from platform_suspend and
|
||||
* platform_resume
|
||||
*/
|
||||
static int mdio_bus_suspend(struct device * dev, pm_message_t state)
|
||||
static int mdio_bus_suspend(struct device *dev)
|
||||
{
|
||||
struct phy_driver *phydrv = to_phy_driver(dev->driver);
|
||||
struct phy_device *phydev = to_phy_device(dev);
|
||||
|
||||
/*
|
||||
* We must stop the state machine manually, otherwise it stops out of
|
||||
* control, possibly with the phydev->lock held. Upon resume, netdev
|
||||
* may call phy routines that try to grab the same lock, and that may
|
||||
* lead to a deadlock.
|
||||
*/
|
||||
if (phydev->attached_dev)
|
||||
phy_stop_machine(phydev);
|
||||
|
||||
if (!mdio_bus_phy_may_suspend(phydev))
|
||||
return 0;
|
||||
|
||||
return phydrv->suspend(phydev);
|
||||
}
|
||||
|
||||
static int mdio_bus_resume(struct device * dev)
|
||||
static int mdio_bus_resume(struct device *dev)
|
||||
{
|
||||
struct phy_driver *phydrv = to_phy_driver(dev->driver);
|
||||
struct phy_device *phydev = to_phy_device(dev);
|
||||
int ret;
|
||||
|
||||
if (!mdio_bus_phy_may_suspend(phydev))
|
||||
return 0;
|
||||
return phydrv->resume(phydev);
|
||||
goto no_resume;
|
||||
|
||||
ret = phydrv->resume(phydev);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
no_resume:
|
||||
if (phydev->attached_dev)
|
||||
phy_start_machine(phydev, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mdio_bus_restore(struct device *dev)
|
||||
{
|
||||
struct phy_device *phydev = to_phy_device(dev);
|
||||
struct net_device *netdev = phydev->attached_dev;
|
||||
int ret;
|
||||
|
||||
if (!netdev)
|
||||
return 0;
|
||||
|
||||
ret = phy_init_hw(phydev);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* The PHY needs to renegotiate. */
|
||||
phydev->link = 0;
|
||||
phydev->state = PHY_UP;
|
||||
|
||||
phy_start_machine(phydev, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct dev_pm_ops mdio_bus_pm_ops = {
|
||||
.suspend = mdio_bus_suspend,
|
||||
.resume = mdio_bus_resume,
|
||||
.freeze = mdio_bus_suspend,
|
||||
.thaw = mdio_bus_resume,
|
||||
.restore = mdio_bus_restore,
|
||||
};
|
||||
|
||||
#define MDIO_BUS_PM_OPS (&mdio_bus_pm_ops)
|
||||
|
||||
#else
|
||||
|
||||
#define MDIO_BUS_PM_OPS NULL
|
||||
|
||||
#endif /* CONFIG_PM */
|
||||
|
||||
struct bus_type mdio_bus_type = {
|
||||
.name = "mdio_bus",
|
||||
.match = mdio_bus_match,
|
||||
.suspend = mdio_bus_suspend,
|
||||
.resume = mdio_bus_resume,
|
||||
.pm = MDIO_BUS_PM_OPS,
|
||||
};
|
||||
EXPORT_SYMBOL(mdio_bus_type);
|
||||
|
||||
|
@@ -378,6 +378,20 @@ void phy_disconnect(struct phy_device *phydev)
|
||||
}
|
||||
EXPORT_SYMBOL(phy_disconnect);
|
||||
|
||||
int phy_init_hw(struct phy_device *phydev)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!phydev->drv || !phydev->drv->config_init)
|
||||
return 0;
|
||||
|
||||
ret = phy_scan_fixups(phydev);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
return phydev->drv->config_init(phydev);
|
||||
}
|
||||
|
||||
/**
|
||||
* phy_attach_direct - attach a network device to a given PHY device pointer
|
||||
* @dev: network device to attach
|
||||
@@ -425,21 +439,7 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
|
||||
/* Do initial configuration here, now that
|
||||
* we have certain key parameters
|
||||
* (dev_flags and interface) */
|
||||
if (phydev->drv->config_init) {
|
||||
int err;
|
||||
|
||||
err = phy_scan_fixups(phydev);
|
||||
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
err = phydev->drv->config_init(phydev);
|
||||
|
||||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return phy_init_hw(phydev);
|
||||
}
|
||||
EXPORT_SYMBOL(phy_attach_direct);
|
||||
|
||||
|
Reference in New Issue
Block a user