summaryrefslogtreecommitdiffstats
path: root/configs/platform-v7a/patches/barebox-2019.12.0/0007-regulator-add-function-to-get-regulator-by-its-name.patch
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2020-01-08 11:16:10 +0100
committerRobert Schwebel <r.schwebel@pengutronix.de>2020-01-08 23:09:03 +0100
commitce5acf4bfd25d7220e71befd86d6b4e1086273ed (patch)
tree14d0b74012d0d0afdf4b0862a40dbb9bcfb2acfb /configs/platform-v7a/patches/barebox-2019.12.0/0007-regulator-add-function-to-get-regulator-by-its-name.patch
parent68bfd2e1fb896d730ff6256d519f954988bf02b9 (diff)
downloadDistroKit-ce5acf4bfd25d7220e71befd86d6b4e1086273ed.tar.gz
DistroKit-ce5acf4bfd25d7220e71befd86d6b4e1086273ed.tar.xz
platform-v7a: Add barebox patchstack
This adds a barebox patchstack which is needed for the rasperrypi which otherwise issues several warnings during boot. While at it add DWC2 USB support as well to finally get networking support for the raspberrypi. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'configs/platform-v7a/patches/barebox-2019.12.0/0007-regulator-add-function-to-get-regulator-by-its-name.patch')
-rw-r--r--configs/platform-v7a/patches/barebox-2019.12.0/0007-regulator-add-function-to-get-regulator-by-its-name.patch73
1 files changed, 73 insertions, 0 deletions
diff --git a/configs/platform-v7a/patches/barebox-2019.12.0/0007-regulator-add-function-to-get-regulator-by-its-name.patch b/configs/platform-v7a/patches/barebox-2019.12.0/0007-regulator-add-function-to-get-regulator-by-its-name.patch
new file mode 100644
index 0000000..0ccafda
--- /dev/null
+++ b/configs/platform-v7a/patches/barebox-2019.12.0/0007-regulator-add-function-to-get-regulator-by-its-name.patch
@@ -0,0 +1,73 @@
+From: Sascha Hauer <s.hauer@pengutronix.de>
+Date: Thu, 19 Dec 2019 19:27:58 +0100
+Subject: [PATCH] regulator: add function to get regulator by its name
+
+Useful for getting regulators that are not correctly associated with a
+device.
+
+Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
+---
+ drivers/regulator/core.c | 30 +++++++++++++++++++++++++++++-
+ include/regulator.h | 1 +
+ 2 files changed, 30 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
+index 4ca035ae9476..f0de7a52e391 100644
+--- a/drivers/regulator/core.c
++++ b/drivers/regulator/core.c
+@@ -327,6 +327,34 @@ struct regulator *regulator_get(struct device_d *dev, const char *supply)
+ return r;
+ }
+
++static struct regulator_internal *regulator_by_name(const char *name)
++{
++ struct regulator_internal *ri;
++
++ list_for_each_entry(ri, &regulator_list, list)
++ if (ri->name && !strcmp(ri->name, name))
++ return ri;
++
++ return NULL;
++}
++
++struct regulator *regulator_get_name(const char *name)
++{
++ struct regulator_internal *ri;
++ struct regulator *r;
++
++ ri = regulator_by_name(name);
++ if (!ri)
++ return ERR_PTR(-ENODEV);
++
++ r = xzalloc(sizeof(*r));
++ r->ri = ri;
++
++ list_add_tail(&r->list, &ri->consumer_list);
++
++ return r;
++}
++
+ /*
+ * regulator_enable - enable a regulator.
+ * @r: the regulator to enable
+@@ -379,7 +407,7 @@ static void regulator_print_one(struct regulator_internal *ri)
+ printf(" consumers:\n");
+
+ list_for_each_entry(r, &ri->consumer_list, list)
+- printf(" %s\n", dev_name(r->dev));
++ printf(" %s\n", r->dev ? dev_name(r->dev) : "none");
+ }
+ }
+
+diff --git a/include/regulator.h b/include/regulator.h
+index 156acb82f8df..a445c5c3d10a 100644
+--- a/include/regulator.h
++++ b/include/regulator.h
+@@ -116,6 +116,7 @@ void regulators_print(void);
+ #ifdef CONFIG_REGULATOR
+
+ struct regulator *regulator_get(struct device_d *, const char *);
++struct regulator *regulator_get_name(const char *name);
+ int regulator_enable(struct regulator *);
+ int regulator_disable(struct regulator *);
+ int regulator_is_enabled_regmap(struct regulator_dev *);