aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@linux-foundation.org>2008-02-04 22:45:13 -0500
committerJeff Garzik <jeff@garzik.org>2008-02-05 13:31:09 -0500
commit39dbd9587bebedbd72be9a8a30a8c4783f3ef7eb (patch)
tree6adb31718a27d3aa5ebc1a41097111f3c40579a9
parent57f78ab3b0e9338a9241aeff6ee92aecc8f8bcbb (diff)
sky2: fix for Yukon FE (regression in 2.6.25)
The Yukon FE chip has a ram buffer therefore it needs the alignment restriction and hang check workarounds. Therefore: * Autodetect the prescence/absence of ram buffer * Rename the flag value to reflect this * Use it consistently (ie don't reread register) Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r--drivers/net/sky2.c17
-rw-r--r--drivers/net/sky2.h2
2 files changed, 8 insertions, 11 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index dc062367a1c8..9a6295909e43 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -857,7 +857,7 @@ static void sky2_mac_init(struct sky2_hw *hw, unsigned port)
857 sky2_write16(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_OPER_ON); 857 sky2_write16(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_OPER_ON);
858 858
859 /* On chips without ram buffer, pause is controled by MAC level */ 859 /* On chips without ram buffer, pause is controled by MAC level */
860 if (sky2_read8(hw, B2_E_0) == 0) { 860 if (!(hw->flags & SKY2_HW_RAM_BUFFER)) {
861 sky2_write8(hw, SK_REG(port, RX_GMF_LP_THR), 768/8); 861 sky2_write8(hw, SK_REG(port, RX_GMF_LP_THR), 768/8);
862 sky2_write8(hw, SK_REG(port, RX_GMF_UP_THR), 1024/8); 862 sky2_write8(hw, SK_REG(port, RX_GMF_UP_THR), 1024/8);
863 863
@@ -1194,7 +1194,7 @@ static struct sk_buff *sky2_rx_alloc(struct sky2_port *sky2)
1194 struct sk_buff *skb; 1194 struct sk_buff *skb;
1195 int i; 1195 int i;
1196 1196
1197 if (sky2->hw->flags & SKY2_HW_FIFO_HANG_CHECK) { 1197 if (sky2->hw->flags & SKY2_HW_RAM_BUFFER) {
1198 unsigned char *start; 1198 unsigned char *start;
1199 /* 1199 /*
1200 * Workaround for a bug in FIFO that cause hang 1200 * Workaround for a bug in FIFO that cause hang
@@ -1387,6 +1387,7 @@ static int sky2_up(struct net_device *dev)
1387 if (ramsize > 0) { 1387 if (ramsize > 0) {
1388 u32 rxspace; 1388 u32 rxspace;
1389 1389
1390 hw->flags |= SKY2_HW_RAM_BUFFER;
1390 pr_debug(PFX "%s: ram buffer %dK\n", dev->name, ramsize); 1391 pr_debug(PFX "%s: ram buffer %dK\n", dev->name, ramsize);
1391 if (ramsize < 16) 1392 if (ramsize < 16)
1392 rxspace = ramsize / 2; 1393 rxspace = ramsize / 2;
@@ -2026,7 +2027,7 @@ static int sky2_change_mtu(struct net_device *dev, int new_mtu)
2026 2027
2027 synchronize_irq(hw->pdev->irq); 2028 synchronize_irq(hw->pdev->irq);
2028 2029
2029 if (sky2_read8(hw, B2_E_0) == 0) 2030 if (!(hw->flags & SKY2_HW_RAM_BUFFER))
2030 sky2_set_tx_stfwd(hw, port); 2031 sky2_set_tx_stfwd(hw, port);
2031 2032
2032 ctl = gma_read16(hw, port, GM_GP_CTRL); 2033 ctl = gma_read16(hw, port, GM_GP_CTRL);
@@ -2566,7 +2567,7 @@ static void sky2_watchdog(unsigned long arg)
2566 ++active; 2567 ++active;
2567 2568
2568 /* For chips with Rx FIFO, check if stuck */ 2569 /* For chips with Rx FIFO, check if stuck */
2569 if ((hw->flags & SKY2_HW_FIFO_HANG_CHECK) && 2570 if ((hw->flags & SKY2_HW_RAM_BUFFER) &&
2570 sky2_rx_hung(dev)) { 2571 sky2_rx_hung(dev)) {
2571 pr_info(PFX "%s: receiver hang detected\n", 2572 pr_info(PFX "%s: receiver hang detected\n",
2572 dev->name); 2573 dev->name);
@@ -2722,11 +2723,7 @@ static int __devinit sky2_init(struct sky2_hw *hw)
2722 2723
2723 switch(hw->chip_id) { 2724 switch(hw->chip_id) {
2724 case CHIP_ID_YUKON_XL: 2725 case CHIP_ID_YUKON_XL:
2725 hw->flags = SKY2_HW_GIGABIT 2726 hw->flags = SKY2_HW_GIGABIT | SKY2_HW_NEWER_PHY;
2726 | SKY2_HW_NEWER_PHY;
2727 if (hw->chip_rev < 3)
2728 hw->flags |= SKY2_HW_FIFO_HANG_CHECK;
2729
2730 break; 2727 break;
2731 2728
2732 case CHIP_ID_YUKON_EC_U: 2729 case CHIP_ID_YUKON_EC_U:
@@ -2752,7 +2749,7 @@ static int __devinit sky2_init(struct sky2_hw *hw)
2752 dev_err(&hw->pdev->dev, "unsupported revision Yukon-EC rev A1\n"); 2749 dev_err(&hw->pdev->dev, "unsupported revision Yukon-EC rev A1\n");
2753 return -EOPNOTSUPP; 2750 return -EOPNOTSUPP;
2754 } 2751 }
2755 hw->flags = SKY2_HW_GIGABIT | SKY2_HW_FIFO_HANG_CHECK; 2752 hw->flags = SKY2_HW_GIGABIT;
2756 break; 2753 break;
2757 2754
2758 case CHIP_ID_YUKON_FE: 2755 case CHIP_ID_YUKON_FE:
diff --git a/drivers/net/sky2.h b/drivers/net/sky2.h
index 2bced1a0898f..5ab5c1c7c5aa 100644
--- a/drivers/net/sky2.h
+++ b/drivers/net/sky2.h
@@ -2045,7 +2045,7 @@ struct sky2_hw {
2045#define SKY2_HW_FIBRE_PHY 0x00000002 2045#define SKY2_HW_FIBRE_PHY 0x00000002
2046#define SKY2_HW_GIGABIT 0x00000004 2046#define SKY2_HW_GIGABIT 0x00000004
2047#define SKY2_HW_NEWER_PHY 0x00000008 2047#define SKY2_HW_NEWER_PHY 0x00000008
2048#define SKY2_HW_FIFO_HANG_CHECK 0x00000010 2048#define SKY2_HW_RAM_BUFFER 0x00000010
2049#define SKY2_HW_NEW_LE 0x00000020 /* new LSOv2 format */ 2049#define SKY2_HW_NEW_LE 0x00000020 /* new LSOv2 format */
2050#define SKY2_HW_AUTO_TX_SUM 0x00000040 /* new IP decode for Tx */ 2050#define SKY2_HW_AUTO_TX_SUM 0x00000040 /* new IP decode for Tx */
2051#define SKY2_HW_ADV_POWER_CTL 0x00000080 /* additional PHY power regs */ 2051#define SKY2_HW_ADV_POWER_CTL 0x00000080 /* additional PHY power regs */