Skip to content

Commit

Permalink
Merge branch 'davem-fixes' of master.kernel.org:/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/jgarzik/netdev-2.6
  • Loading branch information
David S. Miller committed Jun 18, 2008
2 parents f09f7ee + 58c7821 commit 4552e11
Show file tree
Hide file tree
Showing 11 changed files with 189 additions and 242 deletions.
1 change: 0 additions & 1 deletion drivers/net/atlx/atl1.c
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,6 @@ static int atl1_get_permanent_address(struct atl1_hw *hw)
memcpy(hw->perm_mac_addr, eth_addr, ETH_ALEN);
return 0;
}
return 1;
}

/* see if SPI FLAGS exist ? */
Expand Down
87 changes: 60 additions & 27 deletions drivers/net/enc28j60.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,26 +400,31 @@ enc28j60_packet_write(struct enc28j60_net *priv, int len, const u8 *data)
mutex_unlock(&priv->lock);
}

/*
* Wait until the PHY operation is complete.
*/
static int wait_phy_ready(struct enc28j60_net *priv)
static unsigned long msec20_to_jiffies;

static int poll_ready(struct enc28j60_net *priv, u8 reg, u8 mask, u8 val)
{
unsigned long timeout = jiffies + 20 * HZ / 1000;
int ret = 1;
unsigned long timeout = jiffies + msec20_to_jiffies;

/* 20 msec timeout read */
while (nolock_regb_read(priv, MISTAT) & MISTAT_BUSY) {
while ((nolock_regb_read(priv, reg) & mask) != val) {
if (time_after(jiffies, timeout)) {
if (netif_msg_drv(priv))
printk(KERN_DEBUG DRV_NAME
": PHY ready timeout!\n");
ret = 0;
break;
dev_dbg(&priv->spi->dev,
"reg %02x ready timeout!\n", reg);
return -ETIMEDOUT;
}
cpu_relax();
}
return ret;
return 0;
}

/*
* Wait until the PHY operation is complete.
*/
static int wait_phy_ready(struct enc28j60_net *priv)
{
return poll_ready(priv, MISTAT, MISTAT_BUSY, 0) ? 0 : 1;
}

/*
Expand Down Expand Up @@ -594,6 +599,32 @@ static void nolock_txfifo_init(struct enc28j60_net *priv, u16 start, u16 end)
nolock_regw_write(priv, ETXNDL, end);
}

/*
* Low power mode shrinks power consumption about 100x, so we'd like
* the chip to be in that mode whenever it's inactive. (However, we
* can't stay in lowpower mode during suspend with WOL active.)
*/
static void enc28j60_lowpower(struct enc28j60_net *priv, bool is_low)
{
if (netif_msg_drv(priv))
dev_dbg(&priv->spi->dev, "%s power...\n",
is_low ? "low" : "high");

mutex_lock(&priv->lock);
if (is_low) {
nolock_reg_bfclr(priv, ECON1, ECON1_RXEN);
poll_ready(priv, ESTAT, ESTAT_RXBUSY, 0);
poll_ready(priv, ECON1, ECON1_TXRTS, 0);
/* ECON2_VRPS was set during initialization */
nolock_reg_bfset(priv, ECON2, ECON2_PWRSV);
} else {
nolock_reg_bfclr(priv, ECON2, ECON2_PWRSV);
poll_ready(priv, ESTAT, ESTAT_CLKRDY, ESTAT_CLKRDY);
/* caller sets ECON1_RXEN */
}
mutex_unlock(&priv->lock);
}

static int enc28j60_hw_init(struct enc28j60_net *priv)
{
u8 reg;
Expand All @@ -612,8 +643,8 @@ static int enc28j60_hw_init(struct enc28j60_net *priv)
priv->tx_retry_count = 0;
priv->max_pk_counter = 0;
priv->rxfilter = RXFILTER_NORMAL;
/* enable address auto increment */
nolock_regb_write(priv, ECON2, ECON2_AUTOINC);
/* enable address auto increment and voltage regulator powersave */
nolock_regb_write(priv, ECON2, ECON2_AUTOINC | ECON2_VRPS);

nolock_rxfifo_init(priv, RXSTART_INIT, RXEND_INIT);
nolock_txfifo_init(priv, TXSTART_INIT, TXEND_INIT);
Expand Down Expand Up @@ -690,7 +721,7 @@ static int enc28j60_hw_init(struct enc28j60_net *priv)

static void enc28j60_hw_enable(struct enc28j60_net *priv)
{
/* enable interrutps */
/* enable interrupts */
if (netif_msg_hw(priv))
printk(KERN_DEBUG DRV_NAME ": %s() enabling interrupts.\n",
__FUNCTION__);
Expand Down Expand Up @@ -726,15 +757,12 @@ enc28j60_setlink(struct net_device *ndev, u8 autoneg, u16 speed, u8 duplex)
int ret = 0;

if (!priv->hw_enable) {
if (autoneg == AUTONEG_DISABLE && speed == SPEED_10) {
/* link is in low power mode now; duplex setting
* will take effect on next enc28j60_hw_init().
*/
if (autoneg == AUTONEG_DISABLE && speed == SPEED_10)
priv->full_duplex = (duplex == DUPLEX_FULL);
if (!enc28j60_hw_init(priv)) {
if (netif_msg_drv(priv))
dev_err(&ndev->dev,
"hw_reset() failed\n");
ret = -EINVAL;
}
} else {
else {
if (netif_msg_link(priv))
dev_warn(&ndev->dev,
"unsupported link setting\n");
Expand Down Expand Up @@ -1307,7 +1335,8 @@ static int enc28j60_net_open(struct net_device *dev)
}
return -EADDRNOTAVAIL;
}
/* Reset the hardware here */
/* Reset the hardware here (and take it out of low power mode) */
enc28j60_lowpower(priv, false);
enc28j60_hw_disable(priv);
if (!enc28j60_hw_init(priv)) {
if (netif_msg_ifup(priv))
Expand Down Expand Up @@ -1337,6 +1366,7 @@ static int enc28j60_net_close(struct net_device *dev)
printk(KERN_DEBUG DRV_NAME ": %s() enter\n", __FUNCTION__);

enc28j60_hw_disable(priv);
enc28j60_lowpower(priv, true);
netif_stop_queue(dev);

return 0;
Expand Down Expand Up @@ -1537,6 +1567,8 @@ static int __devinit enc28j60_probe(struct spi_device *spi)
dev->watchdog_timeo = TX_TIMEOUT;
SET_ETHTOOL_OPS(dev, &enc28j60_ethtool_ops);

enc28j60_lowpower(priv, true);

ret = register_netdev(dev);
if (ret) {
if (netif_msg_probe(priv))
Expand All @@ -1556,7 +1588,7 @@ static int __devinit enc28j60_probe(struct spi_device *spi)
return ret;
}

static int enc28j60_remove(struct spi_device *spi)
static int __devexit enc28j60_remove(struct spi_device *spi)
{
struct enc28j60_net *priv = dev_get_drvdata(&spi->dev);

Expand All @@ -1573,15 +1605,16 @@ static int enc28j60_remove(struct spi_device *spi)
static struct spi_driver enc28j60_driver = {
.driver = {
.name = DRV_NAME,
.bus = &spi_bus_type,
.owner = THIS_MODULE,
},
},
.probe = enc28j60_probe,
.remove = __devexit_p(enc28j60_remove),
};

static int __init enc28j60_init(void)
{
msec20_to_jiffies = msecs_to_jiffies(20);

return spi_register_driver(&enc28j60_driver);
}

Expand Down
1 change: 1 addition & 0 deletions drivers/net/ibm_newemac/Kconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
config IBM_NEW_EMAC
tristate "IBM EMAC Ethernet support"
depends on PPC_DCR && PPC_MERGE
select CRC32
help
This driver supports the IBM EMAC family of Ethernet controllers
typically found on 4xx embedded PowerPC chips, but also on the
Expand Down
18 changes: 1 addition & 17 deletions drivers/net/netxen/netxen_nic.h
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,6 @@ struct netxen_hardware_context {

u8 revision_id;
u16 board_type;
u16 max_ports;
struct netxen_board_info boardcfg;
u32 xg_linkup;
u32 qg_linksup;
Expand Down Expand Up @@ -863,6 +862,7 @@ struct netxen_adapter {
unsigned char mac_addr[ETH_ALEN];
int mtu;
int portnum;
u8 physical_port;

struct work_struct watchdog_task;
struct timer_list watchdog_timer;
Expand Down Expand Up @@ -1034,7 +1034,6 @@ int netxen_rom_se(struct netxen_adapter *adapter, int addr);

/* Functions from netxen_nic_isr.c */
void netxen_initialize_adapter_sw(struct netxen_adapter *adapter);
void netxen_initialize_adapter_hw(struct netxen_adapter *adapter);
void *netxen_alloc(struct pci_dev *pdev, size_t sz, dma_addr_t * ptr,
struct pci_dev **used_dev);
void netxen_initialize_adapter_ops(struct netxen_adapter *adapter);
Expand Down Expand Up @@ -1077,20 +1076,6 @@ static const struct netxen_brdinfo netxen_boards[] = {

#define NUM_SUPPORTED_BOARDS ARRAY_SIZE(netxen_boards)

static inline void get_brd_port_by_type(u32 type, int *ports)
{
int i, found = 0;
for (i = 0; i < NUM_SUPPORTED_BOARDS; ++i) {
if (netxen_boards[i].brdtype == type) {
*ports = netxen_boards[i].ports;
found = 1;
break;
}
}
if (!found)
*ports = 0;
}

static inline void get_brd_name_by_type(u32 type, char *name)
{
int i, found = 0;
Expand Down Expand Up @@ -1169,5 +1154,4 @@ extern int netxen_rom_fast_read(struct netxen_adapter *adapter, int addr,

extern struct ethtool_ops netxen_nic_ethtool_ops;

extern int physical_port[]; /* physical port # from virtual port.*/
#endif /* __NETXEN_NIC_H_ */
6 changes: 3 additions & 3 deletions drivers/net/netxen/netxen_nic_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ netxen_nic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p)
for (i = 3; niu_registers[mode].reg[i - 3] != -1; i++) {
/* GB: port specific registers */
if (mode == 0 && i >= 19)
window = physical_port[adapter->portnum] *
window = adapter->physical_port *
NETXEN_NIC_PORT_WINDOW;

NETXEN_NIC_LOCKED_READ_REG(niu_registers[mode].
Expand Down Expand Up @@ -527,7 +527,7 @@ netxen_nic_get_pauseparam(struct net_device *dev,
{
struct netxen_adapter *adapter = netdev_priv(dev);
__u32 val;
int port = physical_port[adapter->portnum];
int port = adapter->physical_port;

if (adapter->ahw.board_type == NETXEN_NIC_GBE) {
if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS))
Expand Down Expand Up @@ -573,7 +573,7 @@ netxen_nic_set_pauseparam(struct net_device *dev,
{
struct netxen_adapter *adapter = netdev_priv(dev);
__u32 val;
int port = physical_port[adapter->portnum];
int port = adapter->physical_port;
/* read mode */
if (adapter->ahw.board_type == NETXEN_NIC_GBE) {
if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS))
Expand Down
Loading

0 comments on commit 4552e11

Please sign in to comment.