diff options
author | Tom Rini <trini@konsulko.com> | 2015-09-03 14:57:09 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2015-09-03 14:57:09 -0400 |
commit | c9feb427aba860ebc79f9851a1bb49cc456a2d48 (patch) | |
tree | 6a80def1806386e2854d57f740264c6744d96e1d /drivers/pinctrl/pinctrl-uclass.c | |
parent | da9d8580ff9ce17452ef931072e5799a9df8807f (diff) | |
parent | f2acc55e3d28e96a6fcc060a7081eb4e2ad96350 (diff) | |
download | u-boot-c9feb427aba860ebc79f9851a1bb49cc456a2d48.tar.gz |
Merge git://git.denx.de/u-boot-rockchip
Diffstat (limited to 'drivers/pinctrl/pinctrl-uclass.c')
-rw-r--r-- | drivers/pinctrl/pinctrl-uclass.c | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/drivers/pinctrl/pinctrl-uclass.c b/drivers/pinctrl/pinctrl-uclass.c index d96c201e83..58001ef572 100644 --- a/drivers/pinctrl/pinctrl-uclass.c +++ b/drivers/pinctrl/pinctrl-uclass.c @@ -11,6 +11,7 @@ #include <dm/device.h> #include <dm/lists.h> #include <dm/pinctrl.h> +#include <dm/root.h> #include <dm/uclass.h> DECLARE_GLOBAL_DATA_PTR; @@ -159,7 +160,8 @@ static int pinctrl_select_state_full(struct udevice *dev, const char *statename) static int pinconfig_post_bind(struct udevice *dev) { - return 0; + /* Scan the bus for devices */ + return dm_scan_fdt_node(dev, gd->fdt_blob, dev->of_offset, false); } #endif @@ -205,6 +207,31 @@ int pinctrl_select_state(struct udevice *dev, const char *statename) return 0; } +int pinctrl_request(struct udevice *dev, int func, int flags) +{ + struct pinctrl_ops *ops = pinctrl_get_ops(dev); + + if (!ops->request) + return -ENOSYS; + + return ops->request(dev, func, flags); +} + +int pinctrl_request_noflags(struct udevice *dev, int func) +{ + return pinctrl_request(dev, func, 0); +} + +int pinctrl_get_periph_id(struct udevice *dev, struct udevice *periph) +{ + struct pinctrl_ops *ops = pinctrl_get_ops(dev); + + if (!ops->get_periph_id) + return -ENOSYS; + + return ops->get_periph_id(dev, periph); +} + /** * pinconfig_post-bind() - post binding for PINCTRL uclass * Recursively bind child nodes as pinconfig devices in case of full pinctrl. @@ -222,15 +249,10 @@ static int pinctrl_post_bind(struct udevice *dev) } /* - * If set_state callback is set, we assume this pinctrl driver is the - * full implementation. In this case, its child nodes should be bound - * so that peripheral devices can easily search in parent devices - * during later DT-parsing. + * The pinctrl driver child nodes should be bound so that peripheral + * devices can easily search in parent devices during later DT-parsing. */ - if (ops->set_state) - return pinconfig_post_bind(dev); - - return 0; + return pinconfig_post_bind(dev); } UCLASS_DRIVER(pinctrl) = { |