Skip to content

Commit 692cb5b

Browse files
dtortsbogend
authored andcommitted
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: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
1 parent 730320f commit 692cb5b

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

arch/mips/lantiq/xway/vmmc.c

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
* Copyright (C) 2012 John Crispin <john@phrozen.org>
55
*/
66

7+
#include <linux/err.h>
78
#include <linux/export.h>
9+
#include <linux/gpio/consumer.h>
810
#include <linux/of_platform.h>
9-
#include <linux/of_gpio.h>
1011
#include <linux/dma-mapping.h>
1112

1213
#include <lantiq_soc.h>
@@ -25,23 +26,26 @@ EXPORT_SYMBOL(ltq_get_cp1_base);
2526
static int vmmc_probe(struct platform_device *pdev)
2627
{
2728
#define CP1_SIZE (1 << 20)
29+
struct gpio_desc *gpio;
2830
int gpio_count;
2931
dma_addr_t dma;
3032

3133
cp1_base =
3234
(void *) CPHYSADDR(dma_alloc_coherent(&pdev->dev, CP1_SIZE,
3335
&dma, GFP_KERNEL));
3436

35-
gpio_count = of_gpio_count(pdev->dev.of_node);
37+
gpio_count = gpiod_count(&pdev->dev, NULL);
3638
while (gpio_count > 0) {
37-
enum of_gpio_flags flags;
38-
int gpio = of_get_gpio_flags(pdev->dev.of_node,
39-
--gpio_count, &flags);
40-
if (gpio_request(gpio, "vmmc-relay"))
39+
gpio = devm_gpiod_get_index(&pdev->dev,
40+
NULL, --gpio_count, GPIOD_OUT_HIGH);
41+
if (IS_ERR(gpio)) {
42+
dev_err(&pdev->dev,
43+
"failed to request GPIO idx %d: %d\n",
44+
gpio_count, PTR_ERR(gpio);
4145
continue;
42-
dev_info(&pdev->dev, "requested GPIO %d\n", gpio);
43-
gpio_direction_output(gpio,
44-
(flags & OF_GPIO_ACTIVE_LOW) ? (0) : (1));
46+
}
47+
48+
gpio_consumer_set_name(gpio, "vmmc-relay");
4549
}
4650

4751
dev_info(&pdev->dev, "reserved %dMB at 0x%p", CP1_SIZE >> 20, cp1_base);

0 commit comments

Comments
 (0)