summaryrefslogtreecommitdiffstats
path: root/configs/platform-v7a/patches/barebox-2019.12.0/0003-of-Add-of_bus_n_xxx_cells.patch
diff options
context:
space:
mode:
Diffstat (limited to 'configs/platform-v7a/patches/barebox-2019.12.0/0003-of-Add-of_bus_n_xxx_cells.patch')
-rw-r--r--configs/platform-v7a/patches/barebox-2019.12.0/0003-of-Add-of_bus_n_xxx_cells.patch117
1 files changed, 117 insertions, 0 deletions
diff --git a/configs/platform-v7a/patches/barebox-2019.12.0/0003-of-Add-of_bus_n_xxx_cells.patch b/configs/platform-v7a/patches/barebox-2019.12.0/0003-of-Add-of_bus_n_xxx_cells.patch
new file mode 100644
index 0000000..8bc5926
--- /dev/null
+++ b/configs/platform-v7a/patches/barebox-2019.12.0/0003-of-Add-of_bus_n_xxx_cells.patch
@@ -0,0 +1,117 @@
+From: Sascha Hauer <s.hauer@pengutronix.de>
+Date: Fri, 20 Dec 2019 12:27:02 +0100
+Subject: [PATCH] of: Add of_bus_n_xxx_cells()
+
+Added straight from the Kernel.
+
+Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
+---
+ drivers/of/base.c | 46 ++++++++++++++++++++++++++++------------------
+ include/of.h | 12 ++++++++++++
+ 2 files changed, 40 insertions(+), 18 deletions(-)
+
+diff --git a/drivers/of/base.c b/drivers/of/base.c
+index 98ef5fc0d421..e1d3707d01ee 100644
+--- a/drivers/of/base.c
++++ b/drivers/of/base.c
+@@ -78,36 +78,46 @@ static struct device_node *of_aliases;
+ #define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1
+ #define OF_ROOT_NODE_ADDR_CELLS_DEFAULT 1
+
+-int of_n_addr_cells(struct device_node *np)
++int of_bus_n_addr_cells(struct device_node *np)
+ {
+- const __be32 *ip;
++ u32 cells;
++
++ for (; np; np = np->parent)
++ if (!of_property_read_u32(np, "#address-cells", &cells))
++ return cells;
+
+- do {
+- if (np->parent)
+- np = np->parent;
+- ip = of_get_property(np, "#address-cells", NULL);
+- if (ip)
+- return be32_to_cpup(ip);
+- } while (np->parent);
+ /* No #address-cells property for the root node */
+ return OF_ROOT_NODE_ADDR_CELLS_DEFAULT;
+ }
++
++int of_n_addr_cells(struct device_node *np)
++{
++ if (np->parent)
++ np = np->parent;
++
++ return of_bus_n_addr_cells(np);
++}
+ EXPORT_SYMBOL(of_n_addr_cells);
+
+-int of_n_size_cells(struct device_node *np)
++int of_bus_n_size_cells(struct device_node *np)
+ {
+- const __be32 *ip;
++ u32 cells;
++
++ for (; np; np = np->parent)
++ if (!of_property_read_u32(np, "#size-cells", &cells))
++ return cells;
+
+- do {
+- if (np->parent)
+- np = np->parent;
+- ip = of_get_property(np, "#size-cells", NULL);
+- if (ip)
+- return be32_to_cpup(ip);
+- } while (np->parent);
+ /* No #size-cells property for the root node */
+ return OF_ROOT_NODE_SIZE_CELLS_DEFAULT;
+ }
++
++int of_n_size_cells(struct device_node *np)
++{
++ if (np->parent)
++ np = np->parent;
++
++ return of_bus_n_size_cells(np);
++}
+ EXPORT_SYMBOL(of_n_size_cells);
+
+ struct property *of_find_property(const struct device_node *np,
+diff --git a/include/of.h b/include/of.h
+index 98ddf795cbb4..fb49f40c12a0 100644
+--- a/include/of.h
++++ b/include/of.h
+@@ -113,7 +113,9 @@ struct device_node *of_unflatten_dtb_const(const void *infdt);
+ struct cdev;
+
+ #ifdef CONFIG_OFTREE
++extern int of_bus_n_addr_cells(struct device_node *np);
+ extern int of_n_addr_cells(struct device_node *np);
++extern int of_bus_n_size_cells(struct device_node *np);
+ extern int of_n_size_cells(struct device_node *np);
+
+ extern struct property *of_find_property(const struct device_node *np,
+@@ -330,11 +332,21 @@ static inline struct device_d *of_platform_device_create(struct device_node *np,
+ return NULL;
+ }
+
++static inline int of_bus_n_addr_cells(struct device_node *np)
++{
++ return 0;
++}
++
+ static inline int of_n_addr_cells(struct device_node *np)
+ {
+ return 0;
+ }
+
++static inline int of_bus_n_size_cells(struct device_node *np)
++{
++ return 0;
++}
++
+ static inline int of_n_size_cells(struct device_node *np)
+ {
+ return 0;