Commit 90c2d2eb authored by Dmitry Torokhov's avatar Dmitry Torokhov Committed by Thomas Bogendoerfer

MIPS: pci: lantiq: switch to using gpiod API

This patch switches the driver from legacy gpio API to the newer
gpiod API.
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
parent 056a68ce
...@@ -9,11 +9,11 @@ ...@@ -9,11 +9,11 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/of_gpio.h>
#include <linux/of_irq.h> #include <linux/of_irq.h>
#include <linux/of_pci.h> #include <linux/of_pci.h>
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
__iomem void *ltq_pci_mapped_cfg; __iomem void *ltq_pci_mapped_cfg;
static __iomem void *ltq_pci_membase; static __iomem void *ltq_pci_membase;
static int reset_gpio; static struct gpio_desc *reset_gpio;
static struct clk *clk_pci, *clk_external; static struct clk *clk_pci, *clk_external;
static struct resource pci_io_resource; static struct resource pci_io_resource;
static struct resource pci_mem_resource; static struct resource pci_mem_resource;
...@@ -95,6 +95,7 @@ static int ltq_pci_startup(struct platform_device *pdev) ...@@ -95,6 +95,7 @@ static int ltq_pci_startup(struct platform_device *pdev)
struct device_node *node = pdev->dev.of_node; struct device_node *node = pdev->dev.of_node;
const __be32 *req_mask, *bus_clk; const __be32 *req_mask, *bus_clk;
u32 temp_buffer; u32 temp_buffer;
int error;
/* get our clocks */ /* get our clocks */
clk_pci = clk_get(&pdev->dev, NULL); clk_pci = clk_get(&pdev->dev, NULL);
...@@ -123,17 +124,14 @@ static int ltq_pci_startup(struct platform_device *pdev) ...@@ -123,17 +124,14 @@ static int ltq_pci_startup(struct platform_device *pdev)
clk_disable(clk_external); clk_disable(clk_external);
/* setup reset gpio used by pci */ /* setup reset gpio used by pci */
reset_gpio = of_get_named_gpio(node, "gpio-reset", 0); reset_gpio = devm_gpiod_get_optional(&pdev->dev, "reset",
if (gpio_is_valid(reset_gpio)) { GPIOD_OUT_LOW);
int ret = devm_gpio_request(&pdev->dev, error = PTR_ERR_OR_ZERO(reset_gpio);
reset_gpio, "pci-reset"); if (error) {
if (ret) { dev_err(&pdev->dev, "failed to request gpio: %d\n", error);
dev_err(&pdev->dev, return error;
"failed to request gpio %d\n", reset_gpio);
return ret;
}
gpio_direction_output(reset_gpio, 1);
} }
gpiod_set_consumer_name(reset_gpio, "pci_reset");
/* enable auto-switching between PCI and EBU */ /* enable auto-switching between PCI and EBU */
ltq_pci_w32(0xa, PCI_CR_CLK_CTRL); ltq_pci_w32(0xa, PCI_CR_CLK_CTRL);
...@@ -195,11 +193,11 @@ static int ltq_pci_startup(struct platform_device *pdev) ...@@ -195,11 +193,11 @@ static int ltq_pci_startup(struct platform_device *pdev)
ltq_ebu_w32(ltq_ebu_r32(LTQ_EBU_PCC_IEN) | 0x10, LTQ_EBU_PCC_IEN); ltq_ebu_w32(ltq_ebu_r32(LTQ_EBU_PCC_IEN) | 0x10, LTQ_EBU_PCC_IEN);
/* toggle reset pin */ /* toggle reset pin */
if (gpio_is_valid(reset_gpio)) { if (reset_gpio) {
__gpio_set_value(reset_gpio, 0); gpiod_set_value_cansleep(reset_gpio, 1);
wmb(); wmb();
mdelay(1); mdelay(1);
__gpio_set_value(reset_gpio, 1); gpiod_set_value_cansleep(reset_gpio, 0);
} }
return 0; return 0;
} }
......
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