From af2d7e096b9f5e276a3d3a0e1d5bdfe1f972bcf0 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 | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-dw-rockchip.c b/drivers/pci/controller/dwc/pcie-dw-rockchip.c index 4fedaf4136e2..c2203da4b6ca 100644 --- a/drivers/pci/controller/dwc/pcie-dw-rockchip.c +++ b/drivers/pci/controller/dwc/pcie-dw-rockchip.c @@ -818,8 +818,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); @@ -1285,16 +1293,6 @@ static int rk_pcie_really_probe(void *p) dev_info(dev, "no vpcie3v3 regulator found\n"); } - /* - * 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. - */ - gpiod_set_value_cansleep(rk_pcie->rst_gpio, 0); - ret = rk_pcie_enable_power(rk_pcie); if (ret) return ret;