From c005a5bfe6e3264ce165acfee91f963f8b970f6f Mon Sep 17 00:00:00 2001 From: Shawn Lin Date: Thu, 12 Aug 2021 09:19:31 +0800 Subject: [PATCH] PCI: rockchip: dw: Request perst IO as output-low state Requesting perst# as high and then drive it low makes some buggy devices fail to work properly, for instance Biwin SSD. It's not mandatory to have a high-low transition for perst# before powering up. So we request it as output-low state directly and remove redundant code. Signed-off-by: Shawn Lin Change-Id: Ib62954f8dccc8a21dd06e7a582263bcf62995f29 --- drivers/pci/controller/dwc/pcie-dw-rockchip.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/dwc/pcie-dw-rockchip.c b/drivers/pci/controller/dwc/pcie-dw-rockchip.c index fa40f51e469d..008567cff71e 100644 --- a/drivers/pci/controller/dwc/pcie-dw-rockchip.c +++ b/drivers/pci/controller/dwc/pcie-dw-rockchip.c @@ -1060,8 +1060,16 @@ static int rk_pcie_resource_get(struct platform_device *pdev, if (IS_ERR(rk_pcie->apb_base)) return PTR_ERR(rk_pcie->apb_base); + /* + * Rest the device before enabling power because some of the + * platforms may use external refclk input with the some power + * rail connect to 100MHz OSC chip. So once the power is up for + * the slot and the refclk is available, which isn't quite follow + * the spec. We should make sure it is in reset state before + * everthing's ready. + */ rk_pcie->rst_gpio = devm_gpiod_get_optional(&pdev->dev, "reset", - GPIOD_OUT_HIGH); + GPIOD_OUT_LOW); if (IS_ERR(rk_pcie->rst_gpio)) { dev_err(&pdev->dev, "invalid reset-gpios property in node\n"); return PTR_ERR(rk_pcie->rst_gpio);