linux-mips
[Top] [All Lists]

[PATCH 4/5] MIPS: lantiq: improve pci reset gpio handling

To: Ralf Baechle <ralf@linux-mips.org>
Subject: [PATCH 4/5] MIPS: lantiq: improve pci reset gpio handling
From: John Crispin <blogic@openwrt.org>
Date: Sat, 19 Jan 2013 10:54:26 +0100
Cc: linux-mips@linux-mips.org, John Crispin <blogic@openwrt.org>
In-reply-to: <1358589267-11514-1-git-send-email-blogic@openwrt.org>
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
References: <1358589267-11514-1-git-send-email-blogic@openwrt.org>
Sender: linux-mips-bounce@linux-mips.org
We need to make sure that the reset gpio is available and also set a sane
default state.

Signed-off-by: John Crispin <blogic@openwrt.org>
---
 arch/mips/pci/pci-lantiq.c |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/arch/mips/pci/pci-lantiq.c b/arch/mips/pci/pci-lantiq.c
index 9568178..f32664b 100644
--- a/arch/mips/pci/pci-lantiq.c
+++ b/arch/mips/pci/pci-lantiq.c
@@ -129,8 +129,16 @@ static int ltq_pci_startup(struct platform_device *pdev)
 
        /* setup reset gpio used by pci */
        reset_gpio = of_get_named_gpio(node, "gpio-reset", 0);
-       if (gpio_is_valid(reset_gpio))
-               devm_gpio_request(&pdev->dev, reset_gpio, "pci-reset");
+       if (gpio_is_valid(reset_gpio)) {
+               int ret = devm_gpio_request(&pdev->dev,
+                                               reset_gpio, "pci-reset");
+               if (ret) {
+                       dev_err(&pdev->dev,
+                               "failed to request gpio %d\n", reset_gpio);
+                       return ret;
+               }
+               gpio_direction_output(reset_gpio, 1);
+       }
 
        /* enable auto-switching between PCI and EBU */
        ltq_pci_w32(0xa, PCI_CR_CLK_CTRL);
-- 
1.7.10.4


<Prev in Thread] Current Thread [Next in Thread>