diff options
author | Matt Carlson <mcarlson@broadcom.com> | 2007-11-13 00:18:04 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2007-11-13 00:18:04 -0500 |
commit | aa6c91fe5913faa2cd2a62de993a3130799412b1 (patch) | |
tree | e3b320593d68b4542beedf496b365378519fb2d2 /drivers | |
parent | 5f60891b80f1a0f0a0015b084f4838ae8b9637c7 (diff) |
[TG3]: Prescaler fix
Internal hardware timers become inaccurate after link events. Clock
frequency switches performed by the CPMU fail to adjust timer
prescalers. The fix is to detect core clock frequency changes during
link events and adjust the timer prescalers accordingly.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/tg3.c | 16 | ||||
-rw-r--r-- | drivers/net/tg3.h | 9 |
2 files changed, 24 insertions, 1 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index bb3b73435170..ecd64a224e95 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -3154,6 +3154,22 @@ static int tg3_setup_phy(struct tg3 *tp, int force_reset) | |||
3154 | err = tg3_setup_copper_phy(tp, force_reset); | 3154 | err = tg3_setup_copper_phy(tp, force_reset); |
3155 | } | 3155 | } |
3156 | 3156 | ||
3157 | if (tp->pci_chip_rev_id == CHIPREV_ID_5784_A0) { | ||
3158 | u32 val, scale; | ||
3159 | |||
3160 | val = tr32(TG3_CPMU_CLCK_STAT) & CPMU_CLCK_STAT_MAC_CLCK_MASK; | ||
3161 | if (val == CPMU_CLCK_STAT_MAC_CLCK_62_5) | ||
3162 | scale = 65; | ||
3163 | else if (val == CPMU_CLCK_STAT_MAC_CLCK_6_25) | ||
3164 | scale = 6; | ||
3165 | else | ||
3166 | scale = 12; | ||
3167 | |||
3168 | val = tr32(GRC_MISC_CFG) & ~GRC_MISC_CFG_PRESCALAR_MASK; | ||
3169 | val |= (scale << GRC_MISC_CFG_PRESCALAR_SHIFT); | ||
3170 | tw32(GRC_MISC_CFG, val); | ||
3171 | } | ||
3172 | |||
3157 | if (tp->link_config.active_speed == SPEED_1000 && | 3173 | if (tp->link_config.active_speed == SPEED_1000 && |
3158 | tp->link_config.active_duplex == DUPLEX_HALF) | 3174 | tp->link_config.active_duplex == DUPLEX_HALF) |
3159 | tw32(MAC_TX_LENGTHS, | 3175 | tw32(MAC_TX_LENGTHS, |
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h index 5b799ff2c4d6..d325ab59b391 100644 --- a/drivers/net/tg3.h +++ b/drivers/net/tg3.h | |||
@@ -874,7 +874,14 @@ | |||
874 | #define TG3_CPMU_HST_ACC 0x0000361c | 874 | #define TG3_CPMU_HST_ACC 0x0000361c |
875 | #define CPMU_HST_ACC_MACCLK_MASK 0x001f0000 | 875 | #define CPMU_HST_ACC_MACCLK_MASK 0x001f0000 |
876 | #define CPMU_HST_ACC_MACCLK_6_25 0x00130000 | 876 | #define CPMU_HST_ACC_MACCLK_6_25 0x00130000 |
877 | /* 0x3620 --> 0x365c unused */ | 877 | /* 0x3620 --> 0x3630 unused */ |
878 | |||
879 | #define TG3_CPMU_CLCK_STAT 0x00003630 | ||
880 | #define CPMU_CLCK_STAT_MAC_CLCK_MASK 0x001f0000 | ||
881 | #define CPMU_CLCK_STAT_MAC_CLCK_62_5 0x00000000 | ||
882 | #define CPMU_CLCK_STAT_MAC_CLCK_12_5 0x00110000 | ||
883 | #define CPMU_CLCK_STAT_MAC_CLCK_6_25 0x00130000 | ||
884 | /* 0x3634 --> 0x365c unused */ | ||
878 | 885 | ||
879 | #define TG3_CPMU_MUTEX_REQ 0x0000365c | 886 | #define TG3_CPMU_MUTEX_REQ 0x0000365c |
880 | #define CPMU_MUTEX_REQ_DRIVER 0x00001000 | 887 | #define CPMU_MUTEX_REQ_DRIVER 0x00001000 |