Skip to content

Commit 0344f1c

Browse files
committed
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts: net/mac80211/tx.c
2 parents dad9b33 + ef3a62d commit 0344f1c

File tree

20 files changed

+307
-272
lines changed

20 files changed

+307
-272
lines changed

drivers/net/atlx/atl1.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,6 @@ static int atl1_get_permanent_address(struct atl1_hw *hw)
471471
memcpy(hw->perm_mac_addr, eth_addr, ETH_ALEN);
472472
return 0;
473473
}
474-
return 1;
475474
}
476475

477476
/* see if SPI FLAGS exist ? */

drivers/net/enc28j60.c

Lines changed: 60 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -400,26 +400,31 @@ enc28j60_packet_write(struct enc28j60_net *priv, int len, const u8 *data)
400400
mutex_unlock(&priv->lock);
401401
}
402402

403-
/*
404-
* Wait until the PHY operation is complete.
405-
*/
406-
static int wait_phy_ready(struct enc28j60_net *priv)
403+
static unsigned long msec20_to_jiffies;
404+
405+
static int poll_ready(struct enc28j60_net *priv, u8 reg, u8 mask, u8 val)
407406
{
408-
unsigned long timeout = jiffies + 20 * HZ / 1000;
409-
int ret = 1;
407+
unsigned long timeout = jiffies + msec20_to_jiffies;
410408

411409
/* 20 msec timeout read */
412-
while (nolock_regb_read(priv, MISTAT) & MISTAT_BUSY) {
410+
while ((nolock_regb_read(priv, reg) & mask) != val) {
413411
if (time_after(jiffies, timeout)) {
414412
if (netif_msg_drv(priv))
415-
printk(KERN_DEBUG DRV_NAME
416-
": PHY ready timeout!\n");
417-
ret = 0;
418-
break;
413+
dev_dbg(&priv->spi->dev,
414+
"reg %02x ready timeout!\n", reg);
415+
return -ETIMEDOUT;
419416
}
420417
cpu_relax();
421418
}
422-
return ret;
419+
return 0;
420+
}
421+
422+
/*
423+
* Wait until the PHY operation is complete.
424+
*/
425+
static int wait_phy_ready(struct enc28j60_net *priv)
426+
{
427+
return poll_ready(priv, MISTAT, MISTAT_BUSY, 0) ? 0 : 1;
423428
}
424429

425430
/*
@@ -594,6 +599,32 @@ static void nolock_txfifo_init(struct enc28j60_net *priv, u16 start, u16 end)
594599
nolock_regw_write(priv, ETXNDL, end);
595600
}
596601

602+
/*
603+
* Low power mode shrinks power consumption about 100x, so we'd like
604+
* the chip to be in that mode whenever it's inactive. (However, we
605+
* can't stay in lowpower mode during suspend with WOL active.)
606+
*/
607+
static void enc28j60_lowpower(struct enc28j60_net *priv, bool is_low)
608+
{
609+
if (netif_msg_drv(priv))
610+
dev_dbg(&priv->spi->dev, "%s power...\n",
611+
is_low ? "low" : "high");
612+
613+
mutex_lock(&priv->lock);
614+
if (is_low) {
615+
nolock_reg_bfclr(priv, ECON1, ECON1_RXEN);
616+
poll_ready(priv, ESTAT, ESTAT_RXBUSY, 0);
617+
poll_ready(priv, ECON1, ECON1_TXRTS, 0);
618+
/* ECON2_VRPS was set during initialization */
619+
nolock_reg_bfset(priv, ECON2, ECON2_PWRSV);
620+
} else {
621+
nolock_reg_bfclr(priv, ECON2, ECON2_PWRSV);
622+
poll_ready(priv, ESTAT, ESTAT_CLKRDY, ESTAT_CLKRDY);
623+
/* caller sets ECON1_RXEN */
624+
}
625+
mutex_unlock(&priv->lock);
626+
}
627+
597628
static int enc28j60_hw_init(struct enc28j60_net *priv)
598629
{
599630
u8 reg;
@@ -612,8 +643,8 @@ static int enc28j60_hw_init(struct enc28j60_net *priv)
612643
priv->tx_retry_count = 0;
613644
priv->max_pk_counter = 0;
614645
priv->rxfilter = RXFILTER_NORMAL;
615-
/* enable address auto increment */
616-
nolock_regb_write(priv, ECON2, ECON2_AUTOINC);
646+
/* enable address auto increment and voltage regulator powersave */
647+
nolock_regb_write(priv, ECON2, ECON2_AUTOINC | ECON2_VRPS);
617648

618649
nolock_rxfifo_init(priv, RXSTART_INIT, RXEND_INIT);
619650
nolock_txfifo_init(priv, TXSTART_INIT, TXEND_INIT);
@@ -690,7 +721,7 @@ static int enc28j60_hw_init(struct enc28j60_net *priv)
690721

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

728759
if (!priv->hw_enable) {
729-
if (autoneg == AUTONEG_DISABLE && speed == SPEED_10) {
760+
/* link is in low power mode now; duplex setting
761+
* will take effect on next enc28j60_hw_init().
762+
*/
763+
if (autoneg == AUTONEG_DISABLE && speed == SPEED_10)
730764
priv->full_duplex = (duplex == DUPLEX_FULL);
731-
if (!enc28j60_hw_init(priv)) {
732-
if (netif_msg_drv(priv))
733-
dev_err(&ndev->dev,
734-
"hw_reset() failed\n");
735-
ret = -EINVAL;
736-
}
737-
} else {
765+
else {
738766
if (netif_msg_link(priv))
739767
dev_warn(&ndev->dev,
740768
"unsupported link setting\n");
@@ -1307,7 +1335,8 @@ static int enc28j60_net_open(struct net_device *dev)
13071335
}
13081336
return -EADDRNOTAVAIL;
13091337
}
1310-
/* Reset the hardware here */
1338+
/* Reset the hardware here (and take it out of low power mode) */
1339+
enc28j60_lowpower(priv, false);
13111340
enc28j60_hw_disable(priv);
13121341
if (!enc28j60_hw_init(priv)) {
13131342
if (netif_msg_ifup(priv))
@@ -1337,6 +1366,7 @@ static int enc28j60_net_close(struct net_device *dev)
13371366
printk(KERN_DEBUG DRV_NAME ": %s() enter\n", __FUNCTION__);
13381367

13391368
enc28j60_hw_disable(priv);
1369+
enc28j60_lowpower(priv, true);
13401370
netif_stop_queue(dev);
13411371

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

1570+
enc28j60_lowpower(priv, true);
1571+
15401572
ret = register_netdev(dev);
15411573
if (ret) {
15421574
if (netif_msg_probe(priv))
@@ -1556,7 +1588,7 @@ static int __devinit enc28j60_probe(struct spi_device *spi)
15561588
return ret;
15571589
}
15581590

1559-
static int enc28j60_remove(struct spi_device *spi)
1591+
static int __devexit enc28j60_remove(struct spi_device *spi)
15601592
{
15611593
struct enc28j60_net *priv = dev_get_drvdata(&spi->dev);
15621594

@@ -1573,15 +1605,16 @@ static int enc28j60_remove(struct spi_device *spi)
15731605
static struct spi_driver enc28j60_driver = {
15741606
.driver = {
15751607
.name = DRV_NAME,
1576-
.bus = &spi_bus_type,
15771608
.owner = THIS_MODULE,
1578-
},
1609+
},
15791610
.probe = enc28j60_probe,
15801611
.remove = __devexit_p(enc28j60_remove),
15811612
};
15821613

15831614
static int __init enc28j60_init(void)
15841615
{
1616+
msec20_to_jiffies = msecs_to_jiffies(20);
1617+
15851618
return spi_register_driver(&enc28j60_driver);
15861619
}
15871620

drivers/net/ibm_newemac/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
config IBM_NEW_EMAC
22
tristate "IBM EMAC Ethernet support"
33
depends on PPC_DCR && PPC_MERGE
4+
select CRC32
45
help
56
This driver supports the IBM EMAC family of Ethernet controllers
67
typically found on 4xx embedded PowerPC chips, but also on the

drivers/net/netxen/netxen_nic.h

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,6 @@ struct netxen_hardware_context {
776776

777777
u8 revision_id;
778778
u16 board_type;
779-
u16 max_ports;
780779
struct netxen_board_info boardcfg;
781780
u32 xg_linkup;
782781
u32 qg_linksup;
@@ -863,6 +862,7 @@ struct netxen_adapter {
863862
unsigned char mac_addr[ETH_ALEN];
864863
int mtu;
865864
int portnum;
865+
u8 physical_port;
866866

867867
struct work_struct watchdog_task;
868868
struct timer_list watchdog_timer;
@@ -1034,7 +1034,6 @@ int netxen_rom_se(struct netxen_adapter *adapter, int addr);
10341034

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

10781077
#define NUM_SUPPORTED_BOARDS ARRAY_SIZE(netxen_boards)
10791078

1080-
static inline void get_brd_port_by_type(u32 type, int *ports)
1081-
{
1082-
int i, found = 0;
1083-
for (i = 0; i < NUM_SUPPORTED_BOARDS; ++i) {
1084-
if (netxen_boards[i].brdtype == type) {
1085-
*ports = netxen_boards[i].ports;
1086-
found = 1;
1087-
break;
1088-
}
1089-
}
1090-
if (!found)
1091-
*ports = 0;
1092-
}
1093-
10941079
static inline void get_brd_name_by_type(u32 type, char *name)
10951080
{
10961081
int i, found = 0;
@@ -1169,5 +1154,4 @@ extern int netxen_rom_fast_read(struct netxen_adapter *adapter, int addr,
11691154

11701155
extern struct ethtool_ops netxen_nic_ethtool_ops;
11711156

1172-
extern int physical_port[]; /* physical port # from virtual port.*/
11731157
#endif /* __NETXEN_NIC_H_ */

drivers/net/netxen/netxen_nic_ethtool.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ netxen_nic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p)
369369
for (i = 3; niu_registers[mode].reg[i - 3] != -1; i++) {
370370
/* GB: port specific registers */
371371
if (mode == 0 && i >= 19)
372-
window = physical_port[adapter->portnum] *
372+
window = adapter->physical_port *
373373
NETXEN_NIC_PORT_WINDOW;
374374

375375
NETXEN_NIC_LOCKED_READ_REG(niu_registers[mode].
@@ -527,7 +527,7 @@ netxen_nic_get_pauseparam(struct net_device *dev,
527527
{
528528
struct netxen_adapter *adapter = netdev_priv(dev);
529529
__u32 val;
530-
int port = physical_port[adapter->portnum];
530+
int port = adapter->physical_port;
531531

532532
if (adapter->ahw.board_type == NETXEN_NIC_GBE) {
533533
if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS))
@@ -573,7 +573,7 @@ netxen_nic_set_pauseparam(struct net_device *dev,
573573
{
574574
struct netxen_adapter *adapter = netdev_priv(dev);
575575
__u32 val;
576-
int port = physical_port[adapter->portnum];
576+
int port = adapter->physical_port;
577577
/* read mode */
578578
if (adapter->ahw.board_type == NETXEN_NIC_GBE) {
579579
if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS))

0 commit comments

Comments
 (0)