diff options
author | Jiang Liu <jiang.liu@huawei.com> | 2012-07-24 05:20:31 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2012-08-23 12:11:16 -0400 |
commit | 5cdaaf8a11ba34fb08877bc1982d6d54b29bb8f4 (patch) | |
tree | 75ede29350e887a6c589d43836eb39a525363a88 /drivers/rapidio/devices | |
parent | 32195aec63caf4a3516e720a3e230af9e1dad974 (diff) |
rapdio/tsi721: Use PCI Express Capability accessors
Use PCI Express Capability access functions to simplify tsi721 driver.
[bhelgaas: use word (16-bit) accesses for PCI_EXP_DEVCTL, PCI_EXP_DEVCTL2]
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Alexandre Bounine <alexandre.bounine@idt.com>
Diffstat (limited to 'drivers/rapidio/devices')
-rw-r--r-- | drivers/rapidio/devices/tsi721.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/drivers/rapidio/devices/tsi721.c b/drivers/rapidio/devices/tsi721.c index 722246cf20ab..fc22b93e0924 100644 --- a/drivers/rapidio/devices/tsi721.c +++ b/drivers/rapidio/devices/tsi721.c | |||
@@ -2212,9 +2212,8 @@ static int __devinit tsi721_probe(struct pci_dev *pdev, | |||
2212 | const struct pci_device_id *id) | 2212 | const struct pci_device_id *id) |
2213 | { | 2213 | { |
2214 | struct tsi721_device *priv; | 2214 | struct tsi721_device *priv; |
2215 | int i, cap; | 2215 | int i; |
2216 | int err; | 2216 | int err; |
2217 | u32 regval; | ||
2218 | 2217 | ||
2219 | priv = kzalloc(sizeof(struct tsi721_device), GFP_KERNEL); | 2218 | priv = kzalloc(sizeof(struct tsi721_device), GFP_KERNEL); |
2220 | if (priv == NULL) { | 2219 | if (priv == NULL) { |
@@ -2320,20 +2319,16 @@ static int __devinit tsi721_probe(struct pci_dev *pdev, | |||
2320 | dev_info(&pdev->dev, "Unable to set consistent DMA mask\n"); | 2319 | dev_info(&pdev->dev, "Unable to set consistent DMA mask\n"); |
2321 | } | 2320 | } |
2322 | 2321 | ||
2323 | cap = pci_pcie_cap(pdev); | 2322 | BUG_ON(!pci_is_pcie(pdev)); |
2324 | BUG_ON(cap == 0); | ||
2325 | 2323 | ||
2326 | /* Clear "no snoop" and "relaxed ordering" bits, use default MRRS. */ | 2324 | /* Clear "no snoop" and "relaxed ordering" bits, use default MRRS. */ |
2327 | pci_read_config_dword(pdev, cap + PCI_EXP_DEVCTL, ®val); | 2325 | pcie_capability_clear_and_set_word(pdev, PCI_EXP_DEVCTL, |
2328 | regval &= ~(PCI_EXP_DEVCTL_READRQ | PCI_EXP_DEVCTL_RELAX_EN | | 2326 | PCI_EXP_DEVCTL_READRQ | PCI_EXP_DEVCTL_RELAX_EN | |
2329 | PCI_EXP_DEVCTL_NOSNOOP_EN); | 2327 | PCI_EXP_DEVCTL_NOSNOOP_EN, |
2330 | regval |= 0x2 << MAX_READ_REQUEST_SZ_SHIFT; | 2328 | 0x2 << MAX_READ_REQUEST_SZ_SHIFT); |
2331 | pci_write_config_dword(pdev, cap + PCI_EXP_DEVCTL, regval); | ||
2332 | 2329 | ||
2333 | /* Adjust PCIe completion timeout. */ | 2330 | /* Adjust PCIe completion timeout. */ |
2334 | pci_read_config_dword(pdev, cap + PCI_EXP_DEVCTL2, ®val); | 2331 | pcie_capability_clear_and_set_word(pdev, PCI_EXP_DEVCTL2, 0xf, 0x2); |
2335 | regval &= ~(0x0f); | ||
2336 | pci_write_config_dword(pdev, cap + PCI_EXP_DEVCTL2, regval | 0x2); | ||
2337 | 2332 | ||
2338 | /* | 2333 | /* |
2339 | * FIXUP: correct offsets of MSI-X tables in the MSI-X Capability Block | 2334 | * FIXUP: correct offsets of MSI-X tables in the MSI-X Capability Block |