PCI: iproc: Add 500ms delay during device shutdown
During soft reset (e.g., "reboot" from Linux) on some iProc-based SOCs, the LCPLL clock and PERST both go off simultaneously. This seems in accordance with the PCIe Card Electromechanical spec, r2.0, sec 2.2.3, which says the clock goes inactive after PERST# goes active, but doesn't specify how long the clock should be valid after PERST#. However, we have observed that with the iProc Stingray, some Intel NVMe endpoints, e.g., the P3700 400GB series, are not detected correctly upon the next boot sequence unless the clock remains valid for some time after PERST# is asserted. Delay 500ms after asserting PERST# before performing a reboot. The 500ms is experimentally determined. Signed-off-by: Oza Pawandeep <oza.oza@broadcom.com> [bhelgaas: changelog, add spec reference, fold in iproc_pcie_shutdown() export from Arnd Bergmann <arnd@arndb.de>] Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Ray Jui <ray.jui@broadcom.com> Reviewed-by: Scott Branden <scott.branden@broadcom.com>
This commit is contained in:
parent
39b7a4ff93
commit
b91c26c6a5
|
@ -134,6 +134,13 @@ static int iproc_pcie_pltfm_remove(struct platform_device *pdev)
|
||||||
return iproc_pcie_remove(pcie);
|
return iproc_pcie_remove(pcie);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void iproc_pcie_pltfm_shutdown(struct platform_device *pdev)
|
||||||
|
{
|
||||||
|
struct iproc_pcie *pcie = platform_get_drvdata(pdev);
|
||||||
|
|
||||||
|
iproc_pcie_shutdown(pcie);
|
||||||
|
}
|
||||||
|
|
||||||
static struct platform_driver iproc_pcie_pltfm_driver = {
|
static struct platform_driver iproc_pcie_pltfm_driver = {
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = "iproc-pcie",
|
.name = "iproc-pcie",
|
||||||
|
@ -141,6 +148,7 @@ static struct platform_driver iproc_pcie_pltfm_driver = {
|
||||||
},
|
},
|
||||||
.probe = iproc_pcie_pltfm_probe,
|
.probe = iproc_pcie_pltfm_probe,
|
||||||
.remove = iproc_pcie_pltfm_remove,
|
.remove = iproc_pcie_pltfm_remove,
|
||||||
|
.shutdown = iproc_pcie_pltfm_shutdown,
|
||||||
};
|
};
|
||||||
module_platform_driver(iproc_pcie_pltfm_driver);
|
module_platform_driver(iproc_pcie_pltfm_driver);
|
||||||
|
|
||||||
|
|
|
@ -671,7 +671,7 @@ static struct pci_ops iproc_pcie_ops = {
|
||||||
.write = iproc_pcie_config_write32,
|
.write = iproc_pcie_config_write32,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void iproc_pcie_reset(struct iproc_pcie *pcie)
|
static void iproc_pcie_perst_ctrl(struct iproc_pcie *pcie, bool assert)
|
||||||
{
|
{
|
||||||
u32 val;
|
u32 val;
|
||||||
|
|
||||||
|
@ -683,21 +683,29 @@ static void iproc_pcie_reset(struct iproc_pcie *pcie)
|
||||||
if (pcie->ep_is_internal)
|
if (pcie->ep_is_internal)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/*
|
if (assert) {
|
||||||
* Select perst_b signal as reset source. Put the device into reset,
|
val = iproc_pcie_read_reg(pcie, IPROC_PCIE_CLK_CTRL);
|
||||||
* and then bring it out of reset
|
val &= ~EP_PERST_SOURCE_SELECT & ~EP_MODE_SURVIVE_PERST &
|
||||||
*/
|
~RC_PCIE_RST_OUTPUT;
|
||||||
val = iproc_pcie_read_reg(pcie, IPROC_PCIE_CLK_CTRL);
|
iproc_pcie_write_reg(pcie, IPROC_PCIE_CLK_CTRL, val);
|
||||||
val &= ~EP_PERST_SOURCE_SELECT & ~EP_MODE_SURVIVE_PERST &
|
udelay(250);
|
||||||
~RC_PCIE_RST_OUTPUT;
|
} else {
|
||||||
iproc_pcie_write_reg(pcie, IPROC_PCIE_CLK_CTRL, val);
|
val = iproc_pcie_read_reg(pcie, IPROC_PCIE_CLK_CTRL);
|
||||||
udelay(250);
|
val |= RC_PCIE_RST_OUTPUT;
|
||||||
|
iproc_pcie_write_reg(pcie, IPROC_PCIE_CLK_CTRL, val);
|
||||||
val |= RC_PCIE_RST_OUTPUT;
|
msleep(100);
|
||||||
iproc_pcie_write_reg(pcie, IPROC_PCIE_CLK_CTRL, val);
|
}
|
||||||
msleep(100);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int iproc_pcie_shutdown(struct iproc_pcie *pcie)
|
||||||
|
{
|
||||||
|
iproc_pcie_perst_ctrl(pcie, true);
|
||||||
|
msleep(500);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(iproc_pcie_shutdown);
|
||||||
|
|
||||||
static int iproc_pcie_check_link(struct iproc_pcie *pcie)
|
static int iproc_pcie_check_link(struct iproc_pcie *pcie)
|
||||||
{
|
{
|
||||||
struct device *dev = pcie->dev;
|
struct device *dev = pcie->dev;
|
||||||
|
@ -1379,7 +1387,8 @@ int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res)
|
||||||
goto err_exit_phy;
|
goto err_exit_phy;
|
||||||
}
|
}
|
||||||
|
|
||||||
iproc_pcie_reset(pcie);
|
iproc_pcie_perst_ctrl(pcie, true);
|
||||||
|
iproc_pcie_perst_ctrl(pcie, false);
|
||||||
|
|
||||||
if (pcie->need_ob_cfg) {
|
if (pcie->need_ob_cfg) {
|
||||||
ret = iproc_pcie_map_ranges(pcie, res);
|
ret = iproc_pcie_map_ranges(pcie, res);
|
||||||
|
|
|
@ -110,6 +110,7 @@ struct iproc_pcie {
|
||||||
|
|
||||||
int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res);
|
int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res);
|
||||||
int iproc_pcie_remove(struct iproc_pcie *pcie);
|
int iproc_pcie_remove(struct iproc_pcie *pcie);
|
||||||
|
int iproc_pcie_shutdown(struct iproc_pcie *pcie);
|
||||||
|
|
||||||
#ifdef CONFIG_PCIE_IPROC_MSI
|
#ifdef CONFIG_PCIE_IPROC_MSI
|
||||||
int iproc_msi_init(struct iproc_pcie *pcie, struct device_node *node);
|
int iproc_msi_init(struct iproc_pcie *pcie, struct device_node *node);
|
||||||
|
|
Loading…
Reference in New Issue