diff options
author | Matt Carlson <mcarlson@broadcom.com> | 2007-10-08 02:28:17 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:54:45 -0400 |
commit | 795d01c523dd9f22acc70fe86ed30e605e00024d (patch) | |
tree | 2ef37449a25c1ab68537fe4c2ddce4bb9fe8805a | |
parent | 9974a356b204833b32173210ca25edfdc24dcdd5 (diff) |
[TG3]: ASIC decoding and basic CPMU support.
Newer products change the way the ASIC revision is obtained. This patch
implements how the driver will extract the revision number.
This patch also adds preliminary CPMU support. CPMU stands for Central
Power Management Unit. The CPMU's role is to put the chip into lower
power states when the operating conditions allow it.
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>
-rw-r--r-- | drivers/net/tg3.c | 21 | ||||
-rw-r--r-- | drivers/net/tg3.h | 9 |
2 files changed, 22 insertions, 8 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 4f9fbe268ec..482b7df5524 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -595,7 +595,8 @@ static void tg3_switch_clocks(struct tg3 *tp) | |||
595 | u32 clock_ctrl = tr32(TG3PCI_CLOCK_CTRL); | 595 | u32 clock_ctrl = tr32(TG3PCI_CLOCK_CTRL); |
596 | u32 orig_clock_ctrl; | 596 | u32 orig_clock_ctrl; |
597 | 597 | ||
598 | if (tp->tg3_flags2 & TG3_FLG2_5780_CLASS) | 598 | if ((tp->tg3_flags & TG3_FLAG_CPMU_PRESENT) || |
599 | (tp->tg3_flags2 & TG3_FLG2_5780_CLASS)) | ||
599 | return; | 600 | return; |
600 | 601 | ||
601 | orig_clock_ctrl = clock_ctrl; | 602 | orig_clock_ctrl = clock_ctrl; |
@@ -1400,6 +1401,7 @@ static int tg3_set_power_state(struct tg3 *tp, pci_power_t state) | |||
1400 | tw32_wait_f(TG3PCI_CLOCK_CTRL, base_val | CLOCK_CTRL_ALTCLK | | 1401 | tw32_wait_f(TG3PCI_CLOCK_CTRL, base_val | CLOCK_CTRL_ALTCLK | |
1401 | CLOCK_CTRL_PWRDOWN_PLL133, 40); | 1402 | CLOCK_CTRL_PWRDOWN_PLL133, 40); |
1402 | } else if ((tp->tg3_flags2 & TG3_FLG2_5780_CLASS) || | 1403 | } else if ((tp->tg3_flags2 & TG3_FLG2_5780_CLASS) || |
1404 | (tp->tg3_flags & TG3_FLAG_CPMU_PRESENT) || | ||
1403 | (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906)) { | 1405 | (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906)) { |
1404 | /* do nothing */ | 1406 | /* do nothing */ |
1405 | } else if (!((tp->tg3_flags2 & TG3_FLG2_5750_PLUS) && | 1407 | } else if (!((tp->tg3_flags2 & TG3_FLG2_5750_PLUS) && |
@@ -6147,11 +6149,13 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy) | |||
6147 | /* This works around an issue with Athlon chipsets on | 6149 | /* This works around an issue with Athlon chipsets on |
6148 | * B3 tigon3 silicon. This bit has no effect on any | 6150 | * B3 tigon3 silicon. This bit has no effect on any |
6149 | * other revision. But do not set this on PCI Express | 6151 | * other revision. But do not set this on PCI Express |
6150 | * chips. | 6152 | * chips and don't even touch the clocks if the CPMU is present. |
6151 | */ | 6153 | */ |
6152 | if (!(tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS)) | 6154 | if (!(tp->tg3_flags & TG3_FLAG_CPMU_PRESENT)) { |
6153 | tp->pci_clock_ctrl |= CLOCK_CTRL_DELAY_PCI_GRANT; | 6155 | if (!(tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS)) |
6154 | tw32_f(TG3PCI_CLOCK_CTRL, tp->pci_clock_ctrl); | 6156 | tp->pci_clock_ctrl |= CLOCK_CTRL_DELAY_PCI_GRANT; |
6157 | tw32_f(TG3PCI_CLOCK_CTRL, tp->pci_clock_ctrl); | ||
6158 | } | ||
6155 | 6159 | ||
6156 | if (tp->pci_chip_rev_id == CHIPREV_ID_5704_A0 && | 6160 | if (tp->pci_chip_rev_id == CHIPREV_ID_5704_A0 && |
6157 | (tp->tg3_flags & TG3_FLAG_PCIX_MODE)) { | 6161 | (tp->tg3_flags & TG3_FLAG_PCIX_MODE)) { |
@@ -10527,6 +10531,13 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
10527 | 10531 | ||
10528 | tp->pci_chip_rev_id = (misc_ctrl_reg >> | 10532 | tp->pci_chip_rev_id = (misc_ctrl_reg >> |
10529 | MISC_HOST_CTRL_CHIPREV_SHIFT); | 10533 | MISC_HOST_CTRL_CHIPREV_SHIFT); |
10534 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_USE_PROD_ID_REG) { | ||
10535 | u32 prod_id_asic_rev; | ||
10536 | |||
10537 | pci_read_config_dword(tp->pdev, TG3PCI_PRODID_ASICREV, | ||
10538 | &prod_id_asic_rev); | ||
10539 | tp->pci_chip_rev_id = prod_id_asic_rev & PROD_ID_ASIC_REV_MASK; | ||
10540 | } | ||
10530 | 10541 | ||
10531 | /* Wrong chip ID in 5752 A0. This code can be removed later | 10542 | /* Wrong chip ID in 5752 A0. This code can be removed later |
10532 | * as A0 is not in production. | 10543 | * as A0 is not in production. |
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h index c4f845dd1e8..79ce68cf836 100644 --- a/drivers/net/tg3.h +++ b/drivers/net/tg3.h | |||
@@ -121,6 +121,7 @@ | |||
121 | #define ASIC_REV_5755 0x0a | 121 | #define ASIC_REV_5755 0x0a |
122 | #define ASIC_REV_5787 0x0b | 122 | #define ASIC_REV_5787 0x0b |
123 | #define ASIC_REV_5906 0x0c | 123 | #define ASIC_REV_5906 0x0c |
124 | #define ASIC_REV_USE_PROD_ID_REG 0x0f | ||
124 | #define GET_CHIP_REV(CHIP_REV_ID) ((CHIP_REV_ID) >> 8) | 125 | #define GET_CHIP_REV(CHIP_REV_ID) ((CHIP_REV_ID) >> 8) |
125 | #define CHIPREV_5700_AX 0x70 | 126 | #define CHIPREV_5700_AX 0x70 |
126 | #define CHIPREV_5700_BX 0x71 | 127 | #define CHIPREV_5700_BX 0x71 |
@@ -214,7 +215,9 @@ | |||
214 | #define TG3PCI_DUAL_MAC_CTRL 0x000000b8 | 215 | #define TG3PCI_DUAL_MAC_CTRL 0x000000b8 |
215 | #define DUAL_MAC_CTRL_CH_MASK 0x00000003 | 216 | #define DUAL_MAC_CTRL_CH_MASK 0x00000003 |
216 | #define DUAL_MAC_CTRL_ID 0x00000004 | 217 | #define DUAL_MAC_CTRL_ID 0x00000004 |
217 | /* 0xbc --> 0x100 unused */ | 218 | #define TG3PCI_PRODID_ASICREV 0x000000bc |
219 | #define PROD_ID_ASIC_REV_MASK 0x0fffffff | ||
220 | /* 0xc0 --> 0x100 unused */ | ||
218 | 221 | ||
219 | /* 0x100 --> 0x200 unused */ | 222 | /* 0x100 --> 0x200 unused */ |
220 | 223 | ||
@@ -2213,7 +2216,7 @@ struct tg3 { | |||
2213 | #define TG3_FLAG_JUMBO_RING_ENABLE 0x00800000 | 2216 | #define TG3_FLAG_JUMBO_RING_ENABLE 0x00800000 |
2214 | #define TG3_FLAG_10_100_ONLY 0x01000000 | 2217 | #define TG3_FLAG_10_100_ONLY 0x01000000 |
2215 | #define TG3_FLAG_PAUSE_AUTONEG 0x02000000 | 2218 | #define TG3_FLAG_PAUSE_AUTONEG 0x02000000 |
2216 | 2219 | #define TG3_FLAG_CPMU_PRESENT 0x04000000 | |
2217 | #define TG3_FLAG_40BIT_DMA_BUG 0x08000000 | 2220 | #define TG3_FLAG_40BIT_DMA_BUG 0x08000000 |
2218 | #define TG3_FLAG_BROKEN_CHECKSUMS 0x10000000 | 2221 | #define TG3_FLAG_BROKEN_CHECKSUMS 0x10000000 |
2219 | #define TG3_FLAG_SUPPORT_MSI 0x20000000 | 2222 | #define TG3_FLAG_SUPPORT_MSI 0x20000000 |
@@ -2285,7 +2288,7 @@ struct tg3 { | |||
2285 | u32 pwrmgmt_thresh; | 2288 | u32 pwrmgmt_thresh; |
2286 | 2289 | ||
2287 | /* PCI block */ | 2290 | /* PCI block */ |
2288 | u16 pci_chip_rev_id; | 2291 | u32 pci_chip_rev_id; |
2289 | u8 pci_cacheline_sz; | 2292 | u8 pci_cacheline_sz; |
2290 | u8 pci_lat_timer; | 2293 | u8 pci_lat_timer; |
2291 | u8 pci_hdr_type; | 2294 | u8 pci_hdr_type; |