Commit 692cb5b0 authored by Dmitry Torokhov's avatar Dmitry Torokhov Committed by Thomas Bogendoerfer

MIPS: Lantiq: switch vmmc to use gpiod API

This switches vmmc to use gpiod API instead of OF-specific legacy gpio
API that we want to stop exporting from gpiolib.
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
parent 730320fd
...@@ -4,9 +4,10 @@ ...@@ -4,9 +4,10 @@
* Copyright (C) 2012 John Crispin <john@phrozen.org> * Copyright (C) 2012 John Crispin <john@phrozen.org>
*/ */
#include <linux/err.h>
#include <linux/export.h> #include <linux/export.h>
#include <linux/gpio/consumer.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/of_gpio.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <lantiq_soc.h> #include <lantiq_soc.h>
...@@ -25,6 +26,7 @@ EXPORT_SYMBOL(ltq_get_cp1_base); ...@@ -25,6 +26,7 @@ EXPORT_SYMBOL(ltq_get_cp1_base);
static int vmmc_probe(struct platform_device *pdev) static int vmmc_probe(struct platform_device *pdev)
{ {
#define CP1_SIZE (1 << 20) #define CP1_SIZE (1 << 20)
struct gpio_desc *gpio;
int gpio_count; int gpio_count;
dma_addr_t dma; dma_addr_t dma;
...@@ -32,16 +34,18 @@ static int vmmc_probe(struct platform_device *pdev) ...@@ -32,16 +34,18 @@ static int vmmc_probe(struct platform_device *pdev)
(void *) CPHYSADDR(dma_alloc_coherent(&pdev->dev, CP1_SIZE, (void *) CPHYSADDR(dma_alloc_coherent(&pdev->dev, CP1_SIZE,
&dma, GFP_KERNEL)); &dma, GFP_KERNEL));
gpio_count = of_gpio_count(pdev->dev.of_node); gpio_count = gpiod_count(&pdev->dev, NULL);
while (gpio_count > 0) { while (gpio_count > 0) {
enum of_gpio_flags flags; gpio = devm_gpiod_get_index(&pdev->dev,
int gpio = of_get_gpio_flags(pdev->dev.of_node, NULL, --gpio_count, GPIOD_OUT_HIGH);
--gpio_count, &flags); if (IS_ERR(gpio)) {
if (gpio_request(gpio, "vmmc-relay")) dev_err(&pdev->dev,
"failed to request GPIO idx %d: %d\n",
gpio_count, PTR_ERR(gpio);
continue; continue;
dev_info(&pdev->dev, "requested GPIO %d\n", gpio); }
gpio_direction_output(gpio,
(flags & OF_GPIO_ACTIVE_LOW) ? (0) : (1)); gpio_consumer_set_name(gpio, "vmmc-relay");
} }
dev_info(&pdev->dev, "reserved %dMB at 0x%p", CP1_SIZE >> 20, cp1_base); dev_info(&pdev->dev, "reserved %dMB at 0x%p", CP1_SIZE >> 20, cp1_base);
......
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