diff options
author | Matt Carlson <mcarlson@broadcom.com> | 2009-08-25 06:08:16 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-08-26 18:47:53 -0400 |
commit | e7126997342560533317d8467e8516119ebcbd21 (patch) | |
tree | cc592fc98d946756caa30dd6dccde7374d3af2e4 /drivers/net | |
parent | 29ea095fb727ac48228ff2d1af484c27bf1dcbd4 (diff) |
tg3: Preserve PCIe MPS setting for new devs
Most older tg3 devices only supported a PCIe maximum payload size of
128 bytes. More recent devices bump this limit up to 256 bytes
though. This patch modifies the code so that the MPS limit is only
enforced on those devices that only allow the 128 byte setting.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
Reviewed-by: Benjamin Li <benli@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/tg3.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index ca3052d5c409..356b5d0f0403 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -6226,6 +6226,8 @@ static int tg3_chip_reset(struct tg3 *tp) | |||
6226 | udelay(120); | 6226 | udelay(120); |
6227 | 6227 | ||
6228 | if ((tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) && tp->pcie_cap) { | 6228 | if ((tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) && tp->pcie_cap) { |
6229 | u16 val16; | ||
6230 | |||
6229 | if (tp->pci_chip_rev_id == CHIPREV_ID_5750_A0) { | 6231 | if (tp->pci_chip_rev_id == CHIPREV_ID_5750_A0) { |
6230 | int i; | 6232 | int i; |
6231 | u32 cfg_val; | 6233 | u32 cfg_val; |
@@ -6239,12 +6241,22 @@ static int tg3_chip_reset(struct tg3 *tp) | |||
6239 | cfg_val | (1 << 15)); | 6241 | cfg_val | (1 << 15)); |
6240 | } | 6242 | } |
6241 | 6243 | ||
6242 | /* Set PCIE max payload size to 128 bytes and | 6244 | /* Clear the "no snoop" and "relaxed ordering" bits. */ |
6243 | * clear the "no snoop" and "relaxed ordering" bits. | 6245 | pci_read_config_word(tp->pdev, |
6246 | tp->pcie_cap + PCI_EXP_DEVCTL, | ||
6247 | &val16); | ||
6248 | val16 &= ~(PCI_EXP_DEVCTL_RELAX_EN | | ||
6249 | PCI_EXP_DEVCTL_NOSNOOP_EN); | ||
6250 | /* | ||
6251 | * Older PCIe devices only support the 128 byte | ||
6252 | * MPS setting. Enforce the restriction. | ||
6244 | */ | 6253 | */ |
6254 | if (!(tp->tg3_flags & TG3_FLAG_CPMU_PRESENT) || | ||
6255 | (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784)) | ||
6256 | val16 &= ~PCI_EXP_DEVCTL_PAYLOAD; | ||
6245 | pci_write_config_word(tp->pdev, | 6257 | pci_write_config_word(tp->pdev, |
6246 | tp->pcie_cap + PCI_EXP_DEVCTL, | 6258 | tp->pcie_cap + PCI_EXP_DEVCTL, |
6247 | 0); | 6259 | val16); |
6248 | 6260 | ||
6249 | pcie_set_readrq(tp->pdev, 4096); | 6261 | pcie_set_readrq(tp->pdev, 4096); |
6250 | 6262 | ||