Commit 3038bbdf authored by Jamie Iles's avatar Jamie Iles Committed by Grant Likely

of/gpio: export of_gpio_simple_xlate

Allow GPIO drivers to use of_gpio_simple_xlate.  This is useful for the
generic GPIO driver for example where gpio_chip is embedded in
bgpio_chip and doesn't need of_mm_gpio_chip but has a simple 1:1 GPIO
mapping.

Cc: Anton Vorontsov <avorontsov@ru.mvista.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: default avatarJamie Iles <jamie@jamieiles.com>
Signed-off-by: default avatarGrant Likely <grant.likely@secretlab.ca>
parent 95b68865
...@@ -127,7 +127,7 @@ EXPORT_SYMBOL(of_gpio_count); ...@@ -127,7 +127,7 @@ EXPORT_SYMBOL(of_gpio_count);
* gpio chips. This function performs only one sanity check: whether gpio * gpio chips. This function performs only one sanity check: whether gpio
* is less than ngpios (that is specified in the gpio_chip). * is less than ngpios (that is specified in the gpio_chip).
*/ */
static int of_gpio_simple_xlate(struct gpio_chip *gc, struct device_node *np, int of_gpio_simple_xlate(struct gpio_chip *gc, struct device_node *np,
const void *gpio_spec, u32 *flags) const void *gpio_spec, u32 *flags)
{ {
const __be32 *gpio = gpio_spec; const __be32 *gpio = gpio_spec;
...@@ -152,6 +152,7 @@ static int of_gpio_simple_xlate(struct gpio_chip *gc, struct device_node *np, ...@@ -152,6 +152,7 @@ static int of_gpio_simple_xlate(struct gpio_chip *gc, struct device_node *np,
return n; return n;
} }
EXPORT_SYMBOL(of_gpio_simple_xlate);
/** /**
* of_mm_gpiochip_add - Add memory mapped GPIO chip (bank) * of_mm_gpiochip_add - Add memory mapped GPIO chip (bank)
......
...@@ -57,6 +57,8 @@ extern int of_mm_gpiochip_add(struct device_node *np, ...@@ -57,6 +57,8 @@ extern int of_mm_gpiochip_add(struct device_node *np,
extern void of_gpiochip_add(struct gpio_chip *gc); extern void of_gpiochip_add(struct gpio_chip *gc);
extern void of_gpiochip_remove(struct gpio_chip *gc); extern void of_gpiochip_remove(struct gpio_chip *gc);
extern struct gpio_chip *of_node_to_gpiochip(struct device_node *np); extern struct gpio_chip *of_node_to_gpiochip(struct device_node *np);
extern int of_gpio_simple_xlate(struct gpio_chip *gc, struct device_node *np,
const void *gpio_spec, u32 *flags);
#else /* CONFIG_OF_GPIO */ #else /* CONFIG_OF_GPIO */
...@@ -72,6 +74,13 @@ static inline unsigned int of_gpio_count(struct device_node *np) ...@@ -72,6 +74,13 @@ static inline unsigned int of_gpio_count(struct device_node *np)
return 0; return 0;
} }
static inline int of_gpio_simple_xlate(struct gpio_chip *gc,
struct device_node *np,
const void *gpio_spec, u32 *flags)
{
return -ENOSYS;
}
static inline void of_gpiochip_add(struct gpio_chip *gc) { } static inline void of_gpiochip_add(struct gpio_chip *gc) { }
static inline void of_gpiochip_remove(struct gpio_chip *gc) { } static inline void of_gpiochip_remove(struct gpio_chip *gc) { }
......
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