lkml.org 
[lkml]   [2021]   [Feb]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC 03/13] of: device: Introduce of_mmio_configure()
Date
The function will traverse a device's bus hierarchy looking for MMIO
limited buses. If found it'll populate the relevant struct device
quirks.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
---
drivers/of/device.c | 19 +++++++++++++++++++
include/linux/of_device.h | 8 ++++++++
2 files changed, 27 insertions(+)

diff --git a/drivers/of/device.c b/drivers/of/device.c
index 6cb86de404f1..b80367a2764b 100644
--- a/drivers/of/device.c
+++ b/drivers/of/device.c
@@ -169,6 +169,25 @@ int of_dma_configure_id(struct device *dev, struct device_node *np,
}
EXPORT_SYMBOL_GPL(of_dma_configure_id);

+int of_mmio_configure(struct device *dev, struct device_node *np)
+{
+#if defined(CONFIG_ARCH_HAS_64BIT_MMIO_BROKEN)
+ struct device_node *node = of_node_get(np);
+
+ do {
+ if (of_property_read_bool(node, "64bit-mmio-broken")) {
+ dev->mmio_64bit_broken = true;
+ dev_dbg(dev, "device behind 64bit mmio broken bus\n");
+ break;
+ }
+ } while ((node = of_get_next_parent(node)));
+
+ of_node_put(node);
+#endif
+ return 0;
+}
+EXPORT_SYMBOL_GPL(of_mmio_configure);
+
int of_device_register(struct platform_device *pdev)
{
device_initialize(&pdev->dev);
diff --git a/include/linux/of_device.h b/include/linux/of_device.h
index 1d7992a02e36..c465edd509c7 100644
--- a/include/linux/of_device.h
+++ b/include/linux/of_device.h
@@ -56,6 +56,9 @@ static inline int of_dma_configure(struct device *dev,
{
return of_dma_configure_id(dev, np, force_dma, NULL);
}
+
+int of_mmio_configure(struct device *dev, struct device_node *np);
+
#else /* CONFIG_OF */

static inline int of_driver_match_device(struct device *dev,
@@ -112,6 +115,11 @@ static inline int of_dma_configure(struct device *dev,
{
return 0;
}
+
+static inline int of_mmio_configure(struct device *dev, struct device_node *np);
+{
+ return 0;
+}
#endif /* CONFIG_OF */

#endif /* _LINUX_OF_DEVICE_H */
--
2.30.1
\
 
 \ /
  Last update: 2021-02-26 15:07    [W:0.148 / U:0.144 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site