Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 56556
b: refs/heads/master
c: 074b8ba
h: refs/heads/master
v: v3
  • Loading branch information
Peer Chen authored and Jeff Garzik committed May 18, 2007
1 parent 7979efb commit bc696a9
Show file tree
Hide file tree
Showing 21 changed files with 124 additions and 132 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e94bd23f67c87011f012f26ca0af3fcf6878eeac
refs/heads/master: 074b8ba3863dd168befdba6c9115e990349a6755
2 changes: 1 addition & 1 deletion trunk/Documentation/networking/netdevices.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ dev->hard_start_xmit:
for this and return -1 when the spin lock fails.
The locking there should also properly protect against
set_multicast_list
Context: Process with BHs disabled or BH (timer).
Context: BHs disabled
Notes: netif_queue_stopped() is guaranteed false
Interrupts must be enabled when calling hard_start_xmit.
(Interrupts must also be enabled when enabling the BH handler.)
Expand Down
6 changes: 0 additions & 6 deletions trunk/drivers/ata/sata_nv.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,12 +288,6 @@ static const struct pci_device_id nv_pci_tbl[] = {
{ PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA), GENERIC },
{ PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA2), GENERIC },
{ PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA3), GENERIC },
{ PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID,
PCI_ANY_ID, PCI_ANY_ID,
PCI_CLASS_STORAGE_IDE<<8, 0xffff00, GENERIC },
{ PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID,
PCI_ANY_ID, PCI_ANY_ID,
PCI_CLASS_STORAGE_RAID<<8, 0xffff00, GENERIC },

{ } /* terminate list */
};
Expand Down
4 changes: 3 additions & 1 deletion trunk/drivers/net/e1000/e1000.h
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,11 @@ struct e1000_adapter {
struct e1000_tx_ring test_tx_ring;
struct e1000_rx_ring test_rx_ring;


int msg_enable;
#ifdef CONFIG_PCI_MSI
boolean_t have_msi;

#endif
/* to not mess up cache alignment, always add to the bottom */
boolean_t tso_force;
boolean_t smart_power_down; /* phy smart power down */
Expand Down
39 changes: 25 additions & 14 deletions trunk/drivers/net/e1000/e1000_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,9 @@ static struct net_device_stats * e1000_get_stats(struct net_device *netdev);
static int e1000_change_mtu(struct net_device *netdev, int new_mtu);
static int e1000_set_mac(struct net_device *netdev, void *p);
static irqreturn_t e1000_intr(int irq, void *data);
#ifdef CONFIG_PCI_MSI
static irqreturn_t e1000_intr_msi(int irq, void *data);
#endif
static boolean_t e1000_clean_tx_irq(struct e1000_adapter *adapter,
struct e1000_tx_ring *tx_ring);
#ifdef CONFIG_E1000_NAPI
Expand Down Expand Up @@ -298,26 +300,31 @@ module_exit(e1000_exit_module);
static int e1000_request_irq(struct e1000_adapter *adapter)
{
struct net_device *netdev = adapter->netdev;
void (*handler) = &e1000_intr;
int irq_flags = IRQF_SHARED;
int err;
int flags, err = 0;

flags = IRQF_SHARED;
#ifdef CONFIG_PCI_MSI
if (adapter->hw.mac_type >= e1000_82571) {
adapter->have_msi = !pci_enable_msi(adapter->pdev);
if (adapter->have_msi) {
handler = &e1000_intr_msi;
irq_flags = 0;
adapter->have_msi = TRUE;
if ((err = pci_enable_msi(adapter->pdev))) {
DPRINTK(PROBE, ERR,
"Unable to allocate MSI interrupt Error: %d\n", err);
adapter->have_msi = FALSE;
}
}

err = request_irq(adapter->pdev->irq, handler, irq_flags, netdev->name,
netdev);
if (err) {
if (adapter->have_msi)
pci_disable_msi(adapter->pdev);
if (adapter->have_msi) {
flags &= ~IRQF_SHARED;
err = request_irq(adapter->pdev->irq, &e1000_intr_msi, flags,
netdev->name, netdev);
if (err)
DPRINTK(PROBE, ERR,
"Unable to allocate interrupt Error: %d\n", err);
} else
#endif
if ((err = request_irq(adapter->pdev->irq, &e1000_intr, flags,
netdev->name, netdev)))
DPRINTK(PROBE, ERR,
"Unable to allocate interrupt Error: %d\n", err);
}

return err;
}
Expand All @@ -328,8 +335,10 @@ static void e1000_free_irq(struct e1000_adapter *adapter)

free_irq(adapter->pdev->irq, netdev);

#ifdef CONFIG_PCI_MSI
if (adapter->have_msi)
pci_disable_msi(adapter->pdev);
#endif
}

/**
Expand Down Expand Up @@ -3735,6 +3744,7 @@ e1000_update_stats(struct e1000_adapter *adapter)

spin_unlock_irqrestore(&adapter->stats_lock, flags);
}
#ifdef CONFIG_PCI_MSI

/**
* e1000_intr_msi - Interrupt Handler
Expand Down Expand Up @@ -3800,6 +3810,7 @@ e1000_intr_msi(int irq, void *data)

return IRQ_HANDLED;
}
#endif

/**
* e1000_intr - Interrupt Handler
Expand Down
11 changes: 0 additions & 11 deletions trunk/drivers/net/gianfar.c
Original file line number Diff line number Diff line change
Expand Up @@ -1025,15 +1025,6 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)

dev->trans_start = jiffies;

/* The powerpc-specific eieio() is used, as wmb() has too strong
* semantics (it requires synchronization between cacheable and
* uncacheable mappings, which eieio doesn't provide and which we
* don't need), thus requiring a more expensive sync instruction. At
* some point, the set of architecture-independent barrier functions
* should be expanded to include weaker barriers.
*/

eieio();
txbdp->status = status;

/* If this was the last BD in the ring, the next one */
Expand Down Expand Up @@ -1310,7 +1301,6 @@ struct sk_buff * gfar_new_skb(struct net_device *dev, struct rxbd8 *bdp)
bdp->length = 0;

/* Mark the buffer empty */
eieio();
bdp->status |= (RXBD_EMPTY | RXBD_INTERRUPT);

return skb;
Expand Down Expand Up @@ -1494,7 +1484,6 @@ int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit)
bdp = priv->cur_rx;

while (!((bdp->status & RXBD_EMPTY) || (--rx_work_limit < 0))) {
rmb();
skb = priv->rx_skbuff[priv->skb_currx];

if (!(bdp->status &
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/net/ibm_emac/ibm_emac_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@ static int emac_link_differs(struct ocp_enet_private *dev)
int duplex = r & EMAC_MR1_FDE ? DUPLEX_FULL : DUPLEX_HALF;
int speed, pause, asym_pause;

if (r & EMAC_MR1_MF_1000)
if (r & (EMAC_MR1_MF_1000 | EMAC_MR1_MF_1000GPCS))
speed = SPEED_1000;
else if (r & EMAC_MR1_MF_100)
speed = SPEED_100;
Expand Down
3 changes: 2 additions & 1 deletion trunk/drivers/net/ibm_emac/ibm_emac_mal.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ int __init mal_register_commac(struct ibm_ocp_mal *mal,
return 0;
}

void mal_unregister_commac(struct ibm_ocp_mal *mal, struct mal_commac *commac)
void __exit mal_unregister_commac(struct ibm_ocp_mal *mal,
struct mal_commac *commac)
{
unsigned long flags;
local_irq_save(flags);
Expand Down
3 changes: 2 additions & 1 deletion trunk/drivers/net/ibm_emac/ibm_emac_mal.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@ void mal_exit(void) __exit;

int mal_register_commac(struct ibm_ocp_mal *mal,
struct mal_commac *commac) __init;
void mal_unregister_commac(struct ibm_ocp_mal *mal, struct mal_commac *commac);
void mal_unregister_commac(struct ibm_ocp_mal *mal,
struct mal_commac *commac) __exit;
int mal_set_rcbs(struct ibm_ocp_mal *mal, int channel, unsigned long size);

/* Returns BD ring offset for a particular channel
Expand Down
60 changes: 15 additions & 45 deletions trunk/drivers/net/ibm_emac/ibm_emac_phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

#include <asm/ocp.h>

#include "ibm_emac_core.h"
#include "ibm_emac_phy.h"

static inline int phy_read(struct mii_phy *phy, int reg)
Expand All @@ -35,38 +34,10 @@ static inline void phy_write(struct mii_phy *phy, int reg, int val)
phy->mdio_write(phy->dev, phy->address, reg, val);
}

/*
* polls MII_BMCR until BMCR_RESET bit clears or operation times out.
*
* returns:
* >= 0 => success, value in BMCR returned to caller
* -EBUSY => failure, RESET bit never cleared
* otherwise => failure, lower level PHY read failed
*/
static int mii_spin_reset_complete(struct mii_phy *phy)
{
int val;
int limit = 10000;

while (limit--) {
val = phy_read(phy, MII_BMCR);
if (val >= 0 && !(val & BMCR_RESET))
return val; /* success */
udelay(10);
}
if (val & BMCR_RESET)
val = -EBUSY;

if (net_ratelimit())
printk(KERN_ERR "emac%d: PHY reset timeout (%d)\n",
((struct ocp_enet_private *)phy->dev->priv)->def->index,
val);
return val;
}

int mii_reset_phy(struct mii_phy *phy)
{
int val;
int limit = 10000;

val = phy_read(phy, MII_BMCR);
val &= ~BMCR_ISOLATE;
Expand All @@ -75,11 +46,16 @@ int mii_reset_phy(struct mii_phy *phy)

udelay(300);

val = mii_spin_reset_complete(phy);
if (val >= 0 && (val & BMCR_ISOLATE))
while (limit--) {
val = phy_read(phy, MII_BMCR);
if (val >= 0 && (val & BMCR_RESET) == 0)
break;
udelay(10);
}
if ((val & BMCR_ISOLATE) && limit > 0)
phy_write(phy, MII_BMCR, val & ~BMCR_ISOLATE);

return val < 0;
return limit <= 0;
}

static int genmii_setup_aneg(struct mii_phy *phy, u32 advertise)
Expand Down Expand Up @@ -126,14 +102,8 @@ static int genmii_setup_aneg(struct mii_phy *phy, u32 advertise)
}

/* Start/Restart aneg */
/* on some PHYs (e.g. National DP83843) a write to MII_ADVERTISE
* causes BMCR_RESET to be set on the next read of MII_BMCR, which
* if not checked for causes the PHY to be reset below */
ctl = mii_spin_reset_complete(phy);
if (ctl < 0)
return ctl;

ctl |= BMCR_ANENABLE | BMCR_ANRESTART;
ctl = phy_read(phy, MII_BMCR);
ctl |= (BMCR_ANENABLE | BMCR_ANRESTART);
phy_write(phy, MII_BMCR, ctl);

return 0;
Expand All @@ -148,13 +118,13 @@ static int genmii_setup_forced(struct mii_phy *phy, int speed, int fd)
phy->duplex = fd;
phy->pause = phy->asym_pause = 0;

/* First reset the PHY */
mii_reset_phy(phy);

ctl = phy_read(phy, MII_BMCR);
if (ctl < 0)
return ctl;
ctl &= ~(BMCR_FULLDPLX | BMCR_SPEED100 | BMCR_ANENABLE | BMCR_SPEED1000);
ctl &= ~(BMCR_FULLDPLX | BMCR_SPEED100 | BMCR_ANENABLE);

/* First reset the PHY */
phy_write(phy, MII_BMCR, ctl | BMCR_RESET);

/* Select speed & duplex */
switch (speed) {
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/net/ibm_emac/ibm_emac_rgmii.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ void rgmii_set_speed(struct ocp_device *ocpdev, int input, int speed)
out_be32(&dev->base->ssr, ssr);
}

void __rgmii_fini(struct ocp_device *ocpdev, int input)
void __exit __rgmii_fini(struct ocp_device *ocpdev, int input)
{
struct ibm_ocp_rgmii *dev = ocp_get_drvdata(ocpdev);
BUG_ON(!dev || dev->users == 0);
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/net/ibm_emac/ibm_emac_rgmii.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ struct ibm_ocp_rgmii {
#ifdef CONFIG_IBM_EMAC_RGMII
int rgmii_attach(void *emac) __init;

void __rgmii_fini(struct ocp_device *ocpdev, int input);
void __rgmii_fini(struct ocp_device *ocpdev, int input) __exit;
static inline void rgmii_fini(struct ocp_device *ocpdev, int input)
{
if (ocpdev)
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/net/ibm_emac/ibm_emac_tah.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ int __init tah_attach(void *emac)
return 0;
}

void __tah_fini(struct ocp_device *ocpdev)
void __exit __tah_fini(struct ocp_device *ocpdev)
{
struct tah_regs *p = ocp_get_drvdata(ocpdev);
BUG_ON(!p);
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/net/ibm_emac/ibm_emac_tah.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ struct tah_regs {
#ifdef CONFIG_IBM_EMAC_TAH
int tah_attach(void *emac) __init;

void __tah_fini(struct ocp_device *ocpdev);
void __tah_fini(struct ocp_device *ocpdev) __exit;
static inline void tah_fini(struct ocp_device *ocpdev)
{
if (ocpdev)
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/net/ibm_emac/ibm_emac_zmii.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ void __zmii_set_speed(struct ocp_device *ocpdev, int input, int speed)
out_be32(&dev->base->ssr, ssr);
}

void __zmii_fini(struct ocp_device *ocpdev, int input)
void __exit __zmii_fini(struct ocp_device *ocpdev, int input)
{
struct ibm_ocp_zmii *dev = ocp_get_drvdata(ocpdev);
BUG_ON(!dev || dev->users == 0);
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/net/ibm_emac/ibm_emac_zmii.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ struct ibm_ocp_zmii {
#ifdef CONFIG_IBM_EMAC_ZMII
int zmii_attach(void *emac) __init;

void __zmii_fini(struct ocp_device *ocpdev, int input);
void __zmii_fini(struct ocp_device *ocpdev, int input) __exit;
static inline void zmii_fini(struct ocp_device *ocpdev, int input)
{
if (ocpdev)
Expand Down
2 changes: 2 additions & 0 deletions trunk/drivers/net/ixgb/ixgb.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ struct ixgb_adapter {
u16 msg_enable;
struct ixgb_hw_stats stats;
uint32_t alloc_rx_buff_failed;
#ifdef CONFIG_PCI_MSI
boolean_t have_msi;
#endif
};
#endif /* _IXGB_H_ */
Loading

0 comments on commit bc696a9

Please sign in to comment.