* [PATCH] Make cpsw work again on latest beaglebone devicetree conversion
@ 2013-11-27 9:41 Sascha Hauer
2013-11-27 9:41 ` [PATCH 1/2] pinctrl: Add functions to select pinctrl from device_node Sascha Hauer
2013-11-27 9:41 ` [PATCH 2/2] fixup! cpsw: Add devicetree probe support Sascha Hauer
0 siblings, 2 replies; 3+ messages in thread
From: Sascha Hauer @ 2013-11-27 9:41 UTC (permalink / raw)
To: barebox
It turned out we have to configure pinctrl on device nodes on which we
do not have devices in barebox. This resulted in the mdio lines not
being configured.
Sascha
----------------------------------------------------------------
Sascha Hauer (2):
pinctrl: Add functions to select pinctrl from device_node
fixup! cpsw: Add devicetree probe support
drivers/net/cpsw.c | 7 +++++++
drivers/pinctrl/pinctrl.c | 24 ++++++++++++++++++------
include/pinctrl.h | 12 ++++++++++++
3 files changed, 37 insertions(+), 6 deletions(-)
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] pinctrl: Add functions to select pinctrl from device_node
2013-11-27 9:41 [PATCH] Make cpsw work again on latest beaglebone devicetree conversion Sascha Hauer
@ 2013-11-27 9:41 ` Sascha Hauer
2013-11-27 9:41 ` [PATCH 2/2] fixup! cpsw: Add devicetree probe support Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2013-11-27 9:41 UTC (permalink / raw)
To: barebox
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>
---
drivers/pinctrl/pinctrl.c | 24 ++++++++++++++++++------
include/pinctrl.h | 12 ++++++++++++
2 files changed, 30 insertions(+), 6 deletions(-)
diff --git a/drivers/pinctrl/pinctrl.c b/drivers/pinctrl/pinctrl.c
index 7f76d5a..8963ac7 100644
--- a/drivers/pinctrl/pinctrl.c
+++ b/drivers/pinctrl/pinctrl.c
@@ -51,7 +51,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;
@@ -59,13 +59,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;
@@ -127,6 +123,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");
diff --git a/include/pinctrl.h b/include/pinctrl.h
index 7323f8b..0f03b10 100644
--- a/include/pinctrl.h
+++ b/include/pinctrl.h
@@ -20,6 +20,8 @@ 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)
{
@@ -30,6 +32,16 @@ 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 */
--
1.8.4.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/2] fixup! cpsw: Add devicetree probe support
2013-11-27 9:41 [PATCH] Make cpsw work again on latest beaglebone devicetree conversion Sascha Hauer
2013-11-27 9:41 ` [PATCH 1/2] pinctrl: Add functions to select pinctrl from device_node Sascha Hauer
@ 2013-11-27 9:41 ` Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2013-11-27 9:41 UTC (permalink / raw)
To: barebox
---
drivers/net/cpsw.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c
index 801859b..5e68e1b 100644
--- a/drivers/net/cpsw.c
+++ b/drivers/net/cpsw.c
@@ -28,6 +28,7 @@
#include <errno.h>
#include <io.h>
#include <of.h>
+#include <pinctrl.h>
#include <of_net.h>
#include <of_address.h>
#include <xfuncs.h>
@@ -1057,6 +1058,12 @@ static int cpsw_probe_dt(struct cpsw_priv *priv)
return ret;
}
+ if (of_device_is_compatible(child, "ti,davinci_mdio")) {
+ ret = of_pinctrl_select_state_default(child);
+ if (ret)
+ return ret;
+ }
+
if (!strncmp(child->name, "slave", 5)) {
struct cpsw_slave *slave = &priv->slaves[i];
uint32_t phy_id[2];
--
1.8.4.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-11-27 9:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-27 9:41 [PATCH] Make cpsw work again on latest beaglebone devicetree conversion Sascha Hauer
2013-11-27 9:41 ` [PATCH 1/2] pinctrl: Add functions to select pinctrl from device_node Sascha Hauer
2013-11-27 9:41 ` [PATCH 2/2] fixup! cpsw: Add devicetree probe support Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox