aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/natsemi.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-20 13:26:46 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-20 13:26:46 -0500
commit91aa69315ef9a76b8f734438617a2e32812b630f (patch)
treeb97040209da15734102f1a40589db887b4c2b06f /drivers/net/natsemi.c
parenta5527c6a586537c1af7ae6db30bb444ee4abdfe8 (diff)
parent6606e17a7f1c3bc1b1e83d0c517f11d094e55bf1 (diff)
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6
* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6: (21 commits) natsemi: Support Aculab E1/T1 PMXc cPCI carrier cards natsemi: Add support for using MII port with no PHY skge: race with workq and RTNL Replace local random function with random32() s2io: RTNL and flush_scheduled_work deadlock 8139too: RTNL and flush_scheduled_work deadlock sis190: RTNL and flush_scheduled_work deadlock r8169: RTNL and flush_scheduled_work deadlock [PATCH] ieee80211softmac: Fix setting of initial transmit rates [PATCH] bcm43xx: OFDM fix for rev 1 cards [PATCH] bcm43xx: Fix for 4311 and 02/07/07 specification changes [PATCH] prism54: correct assignment of DOT1XENABLE in WE-19 codepaths [PATCH] zd1211rw: Readd zd_addr_t cast [PATCH] bcm43xx: Fix for oops on resume [PATCH] bcm43xx: Ignore ampdu status reports [PATCH] wavelan: Use ARRAY_SIZE macro when appropriate [PATCH] hostap: Use ARRAY_SIZE macro when appropriate [PATCH] misc-wireless: Use ARRAY_SIZE macro when appropriate [PATCH] ipw2100: Use ARRAY_SIZE macro when appropriate [PATCH] bcm43xx: Janitorial change - remove two unused variables ...
Diffstat (limited to 'drivers/net/natsemi.c')
-rw-r--r--drivers/net/natsemi.c43
1 files changed, 38 insertions, 5 deletions
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index ffa0afd2eddc..adf29dd66798 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -244,6 +244,9 @@ enum {
244 MII_EN_SCRM = 0x0004, /* enable scrambler (tp) */ 244 MII_EN_SCRM = 0x0004, /* enable scrambler (tp) */
245}; 245};
246 246
247enum {
248 NATSEMI_FLAG_IGNORE_PHY = 0x1,
249};
247 250
248/* array of board data directly indexed by pci_tbl[x].driver_data */ 251/* array of board data directly indexed by pci_tbl[x].driver_data */
249static const struct { 252static const struct {
@@ -251,10 +254,12 @@ static const struct {
251 unsigned long flags; 254 unsigned long flags;
252 unsigned int eeprom_size; 255 unsigned int eeprom_size;
253} natsemi_pci_info[] __devinitdata = { 256} natsemi_pci_info[] __devinitdata = {
257 { "Aculab E1/T1 PMXc cPCI carrier card", NATSEMI_FLAG_IGNORE_PHY, 128 },
254 { "NatSemi DP8381[56]", 0, 24 }, 258 { "NatSemi DP8381[56]", 0, 24 },
255}; 259};
256 260
257static const struct pci_device_id natsemi_pci_tbl[] __devinitdata = { 261static const struct pci_device_id natsemi_pci_tbl[] __devinitdata = {
262 { PCI_VENDOR_ID_NS, 0x0020, 0x12d9, 0x000c, 0, 0, 0 },
258 { PCI_VENDOR_ID_NS, 0x0020, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, 263 { PCI_VENDOR_ID_NS, 0x0020, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
259 { } /* terminate list */ 264 { } /* terminate list */
260}; 265};
@@ -568,6 +573,8 @@ struct netdev_private {
568 u32 intr_status; 573 u32 intr_status;
569 /* Do not touch the nic registers */ 574 /* Do not touch the nic registers */
570 int hands_off; 575 int hands_off;
576 /* Don't pay attention to the reported link state. */
577 int ignore_phy;
571 /* external phy that is used: only valid if dev->if_port != PORT_TP */ 578 /* external phy that is used: only valid if dev->if_port != PORT_TP */
572 int mii; 579 int mii;
573 int phy_addr_external; 580 int phy_addr_external;
@@ -696,7 +703,10 @@ static void __devinit natsemi_init_media (struct net_device *dev)
696 struct netdev_private *np = netdev_priv(dev); 703 struct netdev_private *np = netdev_priv(dev);
697 u32 tmp; 704 u32 tmp;
698 705
699 netif_carrier_off(dev); 706 if (np->ignore_phy)
707 netif_carrier_on(dev);
708 else
709 netif_carrier_off(dev);
700 710
701 /* get the initial settings from hardware */ 711 /* get the initial settings from hardware */
702 tmp = mdio_read(dev, MII_BMCR); 712 tmp = mdio_read(dev, MII_BMCR);
@@ -806,8 +816,13 @@ static int __devinit natsemi_probe1 (struct pci_dev *pdev,
806 np->hands_off = 0; 816 np->hands_off = 0;
807 np->intr_status = 0; 817 np->intr_status = 0;
808 np->eeprom_size = natsemi_pci_info[chip_idx].eeprom_size; 818 np->eeprom_size = natsemi_pci_info[chip_idx].eeprom_size;
819 if (natsemi_pci_info[chip_idx].flags & NATSEMI_FLAG_IGNORE_PHY)
820 np->ignore_phy = 1;
821 else
822 np->ignore_phy = 0;
809 823
810 /* Initial port: 824 /* Initial port:
825 * - If configured to ignore the PHY set up for external.
811 * - If the nic was configured to use an external phy and if find_mii 826 * - If the nic was configured to use an external phy and if find_mii
812 * finds a phy: use external port, first phy that replies. 827 * finds a phy: use external port, first phy that replies.
813 * - Otherwise: internal port. 828 * - Otherwise: internal port.
@@ -815,7 +830,7 @@ static int __devinit natsemi_probe1 (struct pci_dev *pdev,
815 * The address would be used to access a phy over the mii bus, but 830 * The address would be used to access a phy over the mii bus, but
816 * the internal phy is accessed through mapped registers. 831 * the internal phy is accessed through mapped registers.
817 */ 832 */
818 if (readl(ioaddr + ChipConfig) & CfgExtPhy) 833 if (np->ignore_phy || readl(ioaddr + ChipConfig) & CfgExtPhy)
819 dev->if_port = PORT_MII; 834 dev->if_port = PORT_MII;
820 else 835 else
821 dev->if_port = PORT_TP; 836 dev->if_port = PORT_TP;
@@ -825,7 +840,9 @@ static int __devinit natsemi_probe1 (struct pci_dev *pdev,
825 840
826 if (dev->if_port != PORT_TP) { 841 if (dev->if_port != PORT_TP) {
827 np->phy_addr_external = find_mii(dev); 842 np->phy_addr_external = find_mii(dev);
828 if (np->phy_addr_external == PHY_ADDR_NONE) { 843 /* If we're ignoring the PHY it doesn't matter if we can't
844 * find one. */
845 if (!np->ignore_phy && np->phy_addr_external == PHY_ADDR_NONE) {
829 dev->if_port = PORT_TP; 846 dev->if_port = PORT_TP;
830 np->phy_addr_external = PHY_ADDR_INTERNAL; 847 np->phy_addr_external = PHY_ADDR_INTERNAL;
831 } 848 }
@@ -891,6 +908,8 @@ static int __devinit natsemi_probe1 (struct pci_dev *pdev,
891 printk("%02x, IRQ %d", dev->dev_addr[i], irq); 908 printk("%02x, IRQ %d", dev->dev_addr[i], irq);
892 if (dev->if_port == PORT_TP) 909 if (dev->if_port == PORT_TP)
893 printk(", port TP.\n"); 910 printk(", port TP.\n");
911 else if (np->ignore_phy)
912 printk(", port MII, ignoring PHY\n");
894 else 913 else
895 printk(", port MII, phy ad %d.\n", np->phy_addr_external); 914 printk(", port MII, phy ad %d.\n", np->phy_addr_external);
896 } 915 }
@@ -1571,9 +1590,13 @@ static void check_link(struct net_device *dev)
1571{ 1590{
1572 struct netdev_private *np = netdev_priv(dev); 1591 struct netdev_private *np = netdev_priv(dev);
1573 void __iomem * ioaddr = ns_ioaddr(dev); 1592 void __iomem * ioaddr = ns_ioaddr(dev);
1574 int duplex; 1593 int duplex = np->duplex;
1575 u16 bmsr; 1594 u16 bmsr;
1576 1595
1596 /* If we are ignoring the PHY then don't try reading it. */
1597 if (np->ignore_phy)
1598 goto propagate_state;
1599
1577 /* The link status field is latched: it remains low after a temporary 1600 /* The link status field is latched: it remains low after a temporary
1578 * link failure until it's read. We need the current link status, 1601 * link failure until it's read. We need the current link status,
1579 * thus read twice. 1602 * thus read twice.
@@ -1585,7 +1608,7 @@ static void check_link(struct net_device *dev)
1585 if (netif_carrier_ok(dev)) { 1608 if (netif_carrier_ok(dev)) {
1586 if (netif_msg_link(np)) 1609 if (netif_msg_link(np))
1587 printk(KERN_NOTICE "%s: link down.\n", 1610 printk(KERN_NOTICE "%s: link down.\n",
1588 dev->name); 1611 dev->name);
1589 netif_carrier_off(dev); 1612 netif_carrier_off(dev);
1590 undo_cable_magic(dev); 1613 undo_cable_magic(dev);
1591 } 1614 }
@@ -1609,6 +1632,7 @@ static void check_link(struct net_device *dev)
1609 duplex = 1; 1632 duplex = 1;
1610 } 1633 }
1611 1634
1635propagate_state:
1612 /* if duplex is set then bit 28 must be set, too */ 1636 /* if duplex is set then bit 28 must be set, too */
1613 if (duplex ^ !!(np->rx_config & RxAcceptTx)) { 1637 if (duplex ^ !!(np->rx_config & RxAcceptTx)) {
1614 if (netif_msg_link(np)) 1638 if (netif_msg_link(np))
@@ -2819,6 +2843,15 @@ static int netdev_set_ecmd(struct net_device *dev, struct ethtool_cmd *ecmd)
2819 } 2843 }
2820 2844
2821 /* 2845 /*
2846 * If we're ignoring the PHY then autoneg and the internal
2847 * transciever are really not going to work so don't let the
2848 * user select them.
2849 */
2850 if (np->ignore_phy && (ecmd->autoneg == AUTONEG_ENABLE ||
2851 ecmd->port == PORT_TP))
2852 return -EINVAL;
2853
2854 /*
2822 * maxtxpkt, maxrxpkt: ignored for now. 2855 * maxtxpkt, maxrxpkt: ignored for now.
2823 * 2856 *
2824 * transceiver: 2857 * transceiver: