aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/core/core.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2014-06-30 05:07:25 -0400
committerUlf Hansson <ulf.hansson@linaro.org>2015-01-19 03:56:26 -0500
commit25185f3f31c924eecc6ff4f55f7acceabf24de11 (patch)
tree240b6d8ac9db0e2688938926f545b43335808d9f /drivers/mmc/core/core.c
parenta31edf1e582111f05fb8315da9dd118c837bede5 (diff)
mmc: Add SDIO function devicetree subnode parsing
This adds SDIO devicetree subnode parsing to the mmc core. While SDIO devices are runtime probable they sometimes need nonprobable additional information on embedded systems, like an additional gpio interrupt or a clock. This patch makes it possible to supply this information from the devicetree. SDIO drivers will find a pointer to the devicenode in their devices of_node pointer. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> [hdegoede@redhat.com: Misc. cleanups] Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc/core/core.c')
-rw-r--r--drivers/mmc/core/core.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 9584bffa8b22..d3bfbdfab052 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1232,6 +1232,34 @@ EXPORT_SYMBOL(mmc_of_parse_voltage);
1232 1232
1233#endif /* CONFIG_OF */ 1233#endif /* CONFIG_OF */
1234 1234
1235static int mmc_of_get_func_num(struct device_node *node)
1236{
1237 u32 reg;
1238 int ret;
1239
1240 ret = of_property_read_u32(node, "reg", &reg);
1241 if (ret < 0)
1242 return ret;
1243
1244 return reg;
1245}
1246
1247struct device_node *mmc_of_find_child_device(struct mmc_host *host,
1248 unsigned func_num)
1249{
1250 struct device_node *node;
1251
1252 if (!host->parent || !host->parent->of_node)
1253 return NULL;
1254
1255 for_each_child_of_node(host->parent->of_node, node) {
1256 if (mmc_of_get_func_num(node) == func_num)
1257 return node;
1258 }
1259
1260 return NULL;
1261}
1262
1235#ifdef CONFIG_REGULATOR 1263#ifdef CONFIG_REGULATOR
1236 1264
1237/** 1265/**