summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Lunn <andrew@lunn.ch>2018-04-18 19:02:58 -0400
committerDavid S. Miller <davem@davemloft.net>2018-04-19 15:59:11 -0400
commitfb78a95e22123da57cb79b98bdc62eb33965ca8a (patch)
tree19e4f0c9e0d647c5f19df7809114da463f552c62
parent4029ea3a8625bc699210623a106e887c2761fead (diff)
net: phy: mdio-gpio: Add #defines for the GPIO index's
The GPIOs are described in device tree using a list, without names. Add defines to indicate what each index in the list means. These defines should also be used by platform devices passing GPIOs via a GPIO lookup table. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/phy/mdio-gpio.c10
-rw-r--r--include/linux/mdio-gpio.h9
2 files changed, 16 insertions, 3 deletions
diff --git a/drivers/net/phy/mdio-gpio.c b/drivers/net/phy/mdio-gpio.c
index 74b982835ac1..281c905ef9fd 100644
--- a/drivers/net/phy/mdio-gpio.c
+++ b/drivers/net/phy/mdio-gpio.c
@@ -24,6 +24,8 @@
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <linux/interrupt.h> 25#include <linux/interrupt.h>
26#include <linux/platform_device.h> 26#include <linux/platform_device.h>
27#include <linux/mdio-bitbang.h>
28#include <linux/mdio-gpio.h>
27#include <linux/gpio.h> 29#include <linux/gpio.h>
28#include <linux/platform_data/mdio-gpio.h> 30#include <linux/platform_data/mdio-gpio.h>
29 31
@@ -38,15 +40,17 @@ struct mdio_gpio_info {
38static int mdio_gpio_get_data(struct device *dev, 40static int mdio_gpio_get_data(struct device *dev,
39 struct mdio_gpio_info *bitbang) 41 struct mdio_gpio_info *bitbang)
40{ 42{
41 bitbang->mdc = devm_gpiod_get_index(dev, NULL, 0, GPIOD_OUT_LOW); 43 bitbang->mdc = devm_gpiod_get_index(dev, NULL, MDIO_GPIO_MDC,
44 GPIOD_OUT_LOW);
42 if (IS_ERR(bitbang->mdc)) 45 if (IS_ERR(bitbang->mdc))
43 return PTR_ERR(bitbang->mdc); 46 return PTR_ERR(bitbang->mdc);
44 47
45 bitbang->mdio = devm_gpiod_get_index(dev, NULL, 1, GPIOD_IN); 48 bitbang->mdio = devm_gpiod_get_index(dev, NULL, MDIO_GPIO_MDIO,
49 GPIOD_IN);
46 if (IS_ERR(bitbang->mdio)) 50 if (IS_ERR(bitbang->mdio))
47 return PTR_ERR(bitbang->mdio); 51 return PTR_ERR(bitbang->mdio);
48 52
49 bitbang->mdo = devm_gpiod_get_index_optional(dev, NULL, 2, 53 bitbang->mdo = devm_gpiod_get_index_optional(dev, NULL, MDIO_GPIO_MDO,
50 GPIOD_OUT_LOW); 54 GPIOD_OUT_LOW);
51 return PTR_ERR_OR_ZERO(bitbang->mdo); 55 return PTR_ERR_OR_ZERO(bitbang->mdo);
52} 56}
diff --git a/include/linux/mdio-gpio.h b/include/linux/mdio-gpio.h
new file mode 100644
index 000000000000..cea443a672cb
--- /dev/null
+++ b/include/linux/mdio-gpio.h
@@ -0,0 +1,9 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __LINUX_MDIO_GPIO_H
3#define __LINUX_MDIO_GPIO_H
4
5#define MDIO_GPIO_MDC 0
6#define MDIO_GPIO_MDIO 1
7#define MDIO_GPIO_MDO 2
8
9#endif