barebox/include/pinctrl.h
Sascha Hauer 6d2f0d57be pinctrl: Add functions to select pinctrl from device_node
Instead of requiring a device pointer, add a functions to select
the pinctrl state based on a device node.
The AM33xx cpsw devicetree description has several subdevices with
pinctrl information attached to them. In barebox we do not handle
the subdevices as distinct devices, so the pinctrl is never configured
correctly and the mdio bus subdevice stops working. This patch makes
it possible to configure the pinctrl without having a device.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-11-27 10:42:53 +01:00

48 lines
1.1 KiB
C

#ifndef PINCTRL_H
#define PINCTRL_H
struct pinctrl_device;
struct pinctrl_ops {
int (*set_state)(struct pinctrl_device *, struct device_node *);
};
struct pinctrl_device {
struct device_d *dev;
struct pinctrl_ops *ops;
struct list_head list;
struct device_node *node;
};
int pinctrl_register(struct pinctrl_device *pdev);
void pinctrl_unregister(struct pinctrl_device *pdev);
#ifdef CONFIG_PINCTRL
int pinctrl_select_state(struct device_d *dev, const char *state);
int pinctrl_select_state_default(struct device_d *dev);
int of_pinctrl_select_state(struct device_node *np, const char *state);
int of_pinctrl_select_state_default(struct device_node *np);
#else
static inline int pinctrl_select_state(struct device_d *dev, const char *state)
{
return -ENODEV;
}
static inline int pinctrl_select_state_default(struct device_d *dev)
{
return -ENODEV;
}
static inline int of_pinctrl_select_state(struct device_node *np, const char *state)
{
return -ENODEV;
}
static inline int of_pinctrl_select_state_default(struct device_node *np)
{
return -ENODEV;
}
#endif
#endif /* PINCTRL_H */