aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgbe/ixgbe_main.c
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2009-04-29 04:08:58 -0400
committerDavid S. Miller <davem@davemloft.net>2009-04-29 20:32:33 -0400
commit6b73e10d2d89f9ce773f9b47d61b195936d059ba (patch)
tree108a5d6ad55cb795d6afb0e0846c6782f42f5c90 /drivers/net/ixgbe/ixgbe_main.c
parent0f07c4ee8c800923ae7918c231532a9256233eed (diff)
ixgbe: Use generic MDIO definitions and functions
Compile-tested only. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ixgbe/ixgbe_main.c')
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 01a88265d401..661bed64407f 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -4642,6 +4642,40 @@ static int ixgbe_set_mac(struct net_device *netdev, void *p)
4642 return 0; 4642 return 0;
4643} 4643}
4644 4644
4645static int
4646ixgbe_mdio_read(struct net_device *netdev, int prtad, int devad, u16 addr)
4647{
4648 struct ixgbe_adapter *adapter = netdev_priv(netdev);
4649 struct ixgbe_hw *hw = &adapter->hw;
4650 u16 value;
4651 int rc;
4652
4653 if (prtad != hw->phy.mdio.prtad)
4654 return -EINVAL;
4655 rc = hw->phy.ops.read_reg(hw, addr, devad, &value);
4656 if (!rc)
4657 rc = value;
4658 return rc;
4659}
4660
4661static int ixgbe_mdio_write(struct net_device *netdev, int prtad, int devad,
4662 u16 addr, u16 value)
4663{
4664 struct ixgbe_adapter *adapter = netdev_priv(netdev);
4665 struct ixgbe_hw *hw = &adapter->hw;
4666
4667 if (prtad != hw->phy.mdio.prtad)
4668 return -EINVAL;
4669 return hw->phy.ops.write_reg(hw, addr, devad, value);
4670}
4671
4672static int ixgbe_ioctl(struct net_device *netdev, struct ifreq *req, int cmd)
4673{
4674 struct ixgbe_adapter *adapter = netdev_priv(netdev);
4675
4676 return mdio_mii_ioctl(&adapter->hw.phy.mdio, if_mii(req), cmd);
4677}
4678
4645#ifdef CONFIG_NET_POLL_CONTROLLER 4679#ifdef CONFIG_NET_POLL_CONTROLLER
4646/* 4680/*
4647 * Polling 'interrupt' - used by things like netconsole to send skbs 4681 * Polling 'interrupt' - used by things like netconsole to send skbs
@@ -4675,6 +4709,7 @@ static const struct net_device_ops ixgbe_netdev_ops = {
4675 .ndo_vlan_rx_register = ixgbe_vlan_rx_register, 4709 .ndo_vlan_rx_register = ixgbe_vlan_rx_register,
4676 .ndo_vlan_rx_add_vid = ixgbe_vlan_rx_add_vid, 4710 .ndo_vlan_rx_add_vid = ixgbe_vlan_rx_add_vid,
4677 .ndo_vlan_rx_kill_vid = ixgbe_vlan_rx_kill_vid, 4711 .ndo_vlan_rx_kill_vid = ixgbe_vlan_rx_kill_vid,
4712 .ndo_do_ioctl = ixgbe_ioctl,
4678#ifdef CONFIG_NET_POLL_CONTROLLER 4713#ifdef CONFIG_NET_POLL_CONTROLLER
4679 .ndo_poll_controller = ixgbe_netpoll, 4714 .ndo_poll_controller = ixgbe_netpoll,
4680#endif 4715#endif
@@ -4789,6 +4824,13 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
4789 /* PHY */ 4824 /* PHY */
4790 memcpy(&hw->phy.ops, ii->phy_ops, sizeof(hw->phy.ops)); 4825 memcpy(&hw->phy.ops, ii->phy_ops, sizeof(hw->phy.ops));
4791 hw->phy.sfp_type = ixgbe_sfp_type_unknown; 4826 hw->phy.sfp_type = ixgbe_sfp_type_unknown;
4827 /* ixgbe_identify_phy_generic will set prtad and mmds properly */
4828 hw->phy.mdio.prtad = MDIO_PRTAD_NONE;
4829 hw->phy.mdio.mmds = 0;
4830 hw->phy.mdio.mode_support = MDIO_SUPPORTS_C45 | MDIO_EMULATE_C22;
4831 hw->phy.mdio.dev = netdev;
4832 hw->phy.mdio.mdio_read = ixgbe_mdio_read;
4833 hw->phy.mdio.mdio_write = ixgbe_mdio_write;
4792 4834
4793 /* set up this timer and work struct before calling get_invariants 4835 /* set up this timer and work struct before calling get_invariants
4794 * which might start the timer 4836 * which might start the timer