summaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-11-27 10:31:27 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2013-11-27 10:42:53 +0100
commit6d2f0d57beeda5f380a20f5b31b6f0cd431fe377 (patch)
tree38c0ab44950eabe0ee8bf3beab58dabb915c8aa4 /drivers/pinctrl
parente586a64d3e3c2e5fb6363271fb079126b7e9fa0f (diff)
downloadbarebox-6d2f0d57beeda5f380a20f5b31b6f0cd431fe377.tar.gz
barebox-6d2f0d57beeda5f380a20f5b31b6f0cd431fe377.tar.xz
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>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r--drivers/pinctrl/pinctrl.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/drivers/pinctrl/pinctrl.c b/drivers/pinctrl/pinctrl.c
index 7c797d35bc..de8361d15f 100644
--- a/drivers/pinctrl/pinctrl.c
+++ b/drivers/pinctrl/pinctrl.c
@@ -49,7 +49,7 @@ static int pinctrl_config_one(struct device_node *np)
return pdev->ops->set_state(pdev, np);
}
-int pinctrl_select_state(struct device_d *dev, const char *name)
+int of_pinctrl_select_state(struct device_node *np, const char *name)
{
int state, ret;
char *propname;
@@ -57,13 +57,9 @@ int pinctrl_select_state(struct device_d *dev, const char *name)
const __be32 *list;
int size, config;
phandle phandle;
- struct device_node *np_config, *np;
+ struct device_node *np_config;
const char *statename;
- np = dev->device_node;
- if (!np)
- return 0;
-
if (!of_find_property(np, "pinctrl-0", NULL))
return 0;
@@ -125,6 +121,22 @@ err:
return ret;
}
+int of_pinctrl_select_state_default(struct device_node *np)
+{
+ return of_pinctrl_select_state(np, "default");
+}
+
+int pinctrl_select_state(struct device_d *dev, const char *name)
+{
+ struct device_node *np;
+
+ np = dev->device_node;
+ if (!np)
+ return 0;
+
+ return of_pinctrl_select_state(np, name);
+}
+
int pinctrl_select_state_default(struct device_d *dev)
{
return pinctrl_select_state(dev, "default");