Commit 2662cab8 authored by Don Brace's avatar Don Brace Committed by James Bottomley

hpsa: change how SA controllers are reset

Change how SA controllers are reset by changing PCI power levels.
The hpsa driver was finding the PCI_PM_CTRL_STATE_MASK offset
then reading/writing a bitmask to change the power state. There
are kernel functions that do the same operations. Better to use
the kernel functions.
Signed-off-by: default avatarDon Brace <don.brace@pmcs.com>
Reviewed-by: default avatarScott Teel <scott.teel@pmcs.com>
Reviewed-by: default avatarWebb Scales <webbnh@hp.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent 3b747298
...@@ -5689,30 +5689,22 @@ static int hpsa_controller_hard_reset(struct pci_dev *pdev, ...@@ -5689,30 +5689,22 @@ static int hpsa_controller_hard_reset(struct pci_dev *pdev,
* the controller, place the interface device in D3 then to D0, * the controller, place the interface device in D3 then to D0,
* this causes a secondary PCI reset which will reset the * this causes a secondary PCI reset which will reset the
* controller." */ * controller." */
int pos;
u16 pmcsr; int rc = 0;
pos = pci_find_capability(pdev, PCI_CAP_ID_PM);
if (pos == 0) {
dev_err(&pdev->dev,
"hpsa_reset_controller: "
"PCI PM not supported\n");
return -ENODEV;
}
dev_info(&pdev->dev, "using PCI PM to reset controller\n"); dev_info(&pdev->dev, "using PCI PM to reset controller\n");
/* enter the D3hot power management state */ /* enter the D3hot power management state */
pci_read_config_word(pdev, pos + PCI_PM_CTRL, rc = pci_set_power_state(pdev, PCI_D3hot);
(__force u16 *)&pmcsr); if (rc)
pmcsr &= ~PCI_PM_CTRL_STATE_MASK; return rc;
pmcsr |= (__force u16) PCI_D3hot;
pci_write_config_word(pdev, pos + PCI_PM_CTRL, pmcsr);
msleep(500); msleep(500);
/* enter the D0 power management state */ /* enter the D0 power management state */
pmcsr &= ~PCI_PM_CTRL_STATE_MASK; rc = pci_set_power_state(pdev, PCI_D0);
pmcsr |= (__force u16) PCI_D0; if (rc)
pci_write_config_word(pdev, pos + PCI_PM_CTRL, pmcsr); return rc;
/* /*
* The P600 requires a small delay when changing states. * The P600 requires a small delay when changing states.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment