aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/amba/bus.c1
-rw-r--r--drivers/base/platform.c3
-rw-r--r--drivers/bcma/main.c2
-rw-r--r--drivers/dma/qcom/hidma_mgmt.c2
-rw-r--r--drivers/gpu/host1x/bus.c5
-rw-r--r--drivers/of/device.c6
-rw-r--r--drivers/of/of_reserved_mem.c2
-rw-r--r--drivers/pci/pci-driver.c3
-rw-r--r--include/linux/device.h4
-rw-r--r--include/linux/of_device.h8
10 files changed, 17 insertions, 19 deletions
diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index b1f41f7d8eeb..3b0118786b43 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -204,7 +204,6 @@ struct bus_type amba_bustype = {
204 .uevent = amba_uevent, 204 .uevent = amba_uevent,
205 .dma_configure = platform_dma_configure, 205 .dma_configure = platform_dma_configure,
206 .pm = &amba_pm, 206 .pm = &amba_pm,
207 .force_dma = true,
208}; 207};
209 208
210static int __init amba_init(void) 209static int __init amba_init(void)
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 638d42e93772..c0ff1e73a634 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -1136,7 +1136,7 @@ int platform_dma_configure(struct device *dev)
1136 int ret = 0; 1136 int ret = 0;
1137 1137
1138 if (dev->of_node) { 1138 if (dev->of_node) {
1139 ret = of_dma_configure(dev, dev->of_node); 1139 ret = of_dma_configure(dev, dev->of_node, true);
1140 } else if (has_acpi_companion(dev)) { 1140 } else if (has_acpi_companion(dev)) {
1141 attr = acpi_get_dma_attr(to_acpi_device_node(dev->fwnode)); 1141 attr = acpi_get_dma_attr(to_acpi_device_node(dev->fwnode));
1142 if (attr != DEV_DMA_NOT_SUPPORTED) 1142 if (attr != DEV_DMA_NOT_SUPPORTED)
@@ -1159,7 +1159,6 @@ struct bus_type platform_bus_type = {
1159 .uevent = platform_uevent, 1159 .uevent = platform_uevent,
1160 .dma_configure = platform_dma_configure, 1160 .dma_configure = platform_dma_configure,
1161 .pm = &platform_dev_pm_ops, 1161 .pm = &platform_dev_pm_ops,
1162 .force_dma = true,
1163}; 1162};
1164EXPORT_SYMBOL_GPL(platform_bus_type); 1163EXPORT_SYMBOL_GPL(platform_bus_type);
1165 1164
diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c
index e6986c7608f1..fc1f4acdd189 100644
--- a/drivers/bcma/main.c
+++ b/drivers/bcma/main.c
@@ -207,7 +207,7 @@ static void bcma_of_fill_device(struct device *parent,
207 207
208 core->irq = bcma_of_get_irq(parent, core, 0); 208 core->irq = bcma_of_get_irq(parent, core, 0);
209 209
210 of_dma_configure(&core->dev, node); 210 of_dma_configure(&core->dev, node, false);
211} 211}
212 212
213unsigned int bcma_core_irq(struct bcma_device *core, int num) 213unsigned int bcma_core_irq(struct bcma_device *core, int num)
diff --git a/drivers/dma/qcom/hidma_mgmt.c b/drivers/dma/qcom/hidma_mgmt.c
index 000c7019ca7d..d64edeb6771a 100644
--- a/drivers/dma/qcom/hidma_mgmt.c
+++ b/drivers/dma/qcom/hidma_mgmt.c
@@ -398,7 +398,7 @@ static int __init hidma_mgmt_of_populate_channels(struct device_node *np)
398 } 398 }
399 of_node_get(child); 399 of_node_get(child);
400 new_pdev->dev.of_node = child; 400 new_pdev->dev.of_node = child;
401 of_dma_configure(&new_pdev->dev, child); 401 of_dma_configure(&new_pdev->dev, child, true);
402 /* 402 /*
403 * It is assumed that calling of_msi_configure is safe on 403 * It is assumed that calling of_msi_configure is safe on
404 * platforms with or without MSI support. 404 * platforms with or without MSI support.
diff --git a/drivers/gpu/host1x/bus.c b/drivers/gpu/host1x/bus.c
index 0c79bafae96c..815bdb42e3f0 100644
--- a/drivers/gpu/host1x/bus.c
+++ b/drivers/gpu/host1x/bus.c
@@ -316,7 +316,7 @@ static int host1x_device_match(struct device *dev, struct device_driver *drv)
316 316
317static int host1x_dma_configure(struct device *dev) 317static int host1x_dma_configure(struct device *dev)
318{ 318{
319 return of_dma_configure(dev, dev->of_node); 319 return of_dma_configure(dev, dev->of_node, true);
320} 320}
321 321
322static const struct dev_pm_ops host1x_device_pm_ops = { 322static const struct dev_pm_ops host1x_device_pm_ops = {
@@ -333,7 +333,6 @@ struct bus_type host1x_bus_type = {
333 .match = host1x_device_match, 333 .match = host1x_device_match,
334 .dma_configure = host1x_dma_configure, 334 .dma_configure = host1x_dma_configure,
335 .pm = &host1x_device_pm_ops, 335 .pm = &host1x_device_pm_ops,
336 .force_dma = true,
337}; 336};
338 337
339static void __host1x_device_del(struct host1x_device *device) 338static void __host1x_device_del(struct host1x_device *device)
@@ -422,7 +421,7 @@ static int host1x_device_add(struct host1x *host1x,
422 device->dev.bus = &host1x_bus_type; 421 device->dev.bus = &host1x_bus_type;
423 device->dev.parent = host1x->dev; 422 device->dev.parent = host1x->dev;
424 423
425 of_dma_configure(&device->dev, host1x->dev->of_node); 424 of_dma_configure(&device->dev, host1x->dev->of_node, true);
426 425
427 err = host1x_device_parse_dt(device, driver); 426 err = host1x_device_parse_dt(device, driver);
428 if (err < 0) { 427 if (err < 0) {
diff --git a/drivers/of/device.c b/drivers/of/device.c
index 064c818105bd..33d85511d790 100644
--- a/drivers/of/device.c
+++ b/drivers/of/device.c
@@ -76,6 +76,8 @@ int of_device_add(struct platform_device *ofdev)
76 * of_dma_configure - Setup DMA configuration 76 * of_dma_configure - Setup DMA configuration
77 * @dev: Device to apply DMA configuration 77 * @dev: Device to apply DMA configuration
78 * @np: Pointer to OF node having DMA configuration 78 * @np: Pointer to OF node having DMA configuration
79 * @force_dma: Whether device is to be set up by of_dma_configure() even if
80 * DMA capability is not explicitly described by firmware.
79 * 81 *
80 * Try to get devices's DMA configuration from DT and update it 82 * Try to get devices's DMA configuration from DT and update it
81 * accordingly. 83 * accordingly.
@@ -84,7 +86,7 @@ int of_device_add(struct platform_device *ofdev)
84 * can use a platform bus notifier and handle BUS_NOTIFY_ADD_DEVICE events 86 * can use a platform bus notifier and handle BUS_NOTIFY_ADD_DEVICE events
85 * to fix up DMA configuration. 87 * to fix up DMA configuration.
86 */ 88 */
87int of_dma_configure(struct device *dev, struct device_node *np) 89int of_dma_configure(struct device *dev, struct device_node *np, bool force_dma)
88{ 90{
89 u64 dma_addr, paddr, size = 0; 91 u64 dma_addr, paddr, size = 0;
90 int ret; 92 int ret;
@@ -100,7 +102,7 @@ int of_dma_configure(struct device *dev, struct device_node *np)
100 * DMA configuration regardless of whether "dma-ranges" is 102 * DMA configuration regardless of whether "dma-ranges" is
101 * correctly specified or not. 103 * correctly specified or not.
102 */ 104 */
103 if (!dev->bus->force_dma) 105 if (!force_dma)
104 return ret == -ENODEV ? 0 : ret; 106 return ret == -ENODEV ? 0 : ret;
105 107
106 dma_addr = offset = 0; 108 dma_addr = offset = 0;
diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
index 9a4f4246231d..895c83e0c7b6 100644
--- a/drivers/of/of_reserved_mem.c
+++ b/drivers/of/of_reserved_mem.c
@@ -353,7 +353,7 @@ int of_reserved_mem_device_init_by_idx(struct device *dev,
353 /* ensure that dma_ops is set for virtual devices 353 /* ensure that dma_ops is set for virtual devices
354 * using reserved memory 354 * using reserved memory
355 */ 355 */
356 of_dma_configure(dev, np); 356 of_dma_configure(dev, np, true);
357 357
358 dev_info(dev, "assigned reserved memory node %s\n", rmem->name); 358 dev_info(dev, "assigned reserved memory node %s\n", rmem->name);
359 } else { 359 } else {
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index ba8c6b46269e..f8269a725667 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -1595,7 +1595,7 @@ static int pci_dma_configure(struct device *dev)
1595 1595
1596 if (IS_ENABLED(CONFIG_OF) && bridge->parent && 1596 if (IS_ENABLED(CONFIG_OF) && bridge->parent &&
1597 bridge->parent->of_node) { 1597 bridge->parent->of_node) {
1598 ret = of_dma_configure(dev, bridge->parent->of_node); 1598 ret = of_dma_configure(dev, bridge->parent->of_node, true);
1599 } else if (has_acpi_companion(bridge)) { 1599 } else if (has_acpi_companion(bridge)) {
1600 struct acpi_device *adev = to_acpi_device_node(bridge->fwnode); 1600 struct acpi_device *adev = to_acpi_device_node(bridge->fwnode);
1601 enum dev_dma_attr attr = acpi_get_dma_attr(adev); 1601 enum dev_dma_attr attr = acpi_get_dma_attr(adev);
@@ -1621,7 +1621,6 @@ struct bus_type pci_bus_type = {
1621 .pm = PCI_PM_OPS_PTR, 1621 .pm = PCI_PM_OPS_PTR,
1622 .num_vf = pci_bus_num_vf, 1622 .num_vf = pci_bus_num_vf,
1623 .dma_configure = pci_dma_configure, 1623 .dma_configure = pci_dma_configure,
1624 .force_dma = true,
1625}; 1624};
1626EXPORT_SYMBOL(pci_bus_type); 1625EXPORT_SYMBOL(pci_bus_type);
1627 1626
diff --git a/include/linux/device.h b/include/linux/device.h
index 63aa672bd394..563077d1cdc1 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -98,8 +98,6 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
98 * @p: The private data of the driver core, only the driver core can 98 * @p: The private data of the driver core, only the driver core can
99 * touch this. 99 * touch this.
100 * @lock_key: Lock class key for use by the lock validator 100 * @lock_key: Lock class key for use by the lock validator
101 * @force_dma: Assume devices on this bus should be set up by dma_configure()
102 * even if DMA capability is not explicitly described by firmware.
103 * 101 *
104 * A bus is a channel between the processor and one or more devices. For the 102 * A bus is a channel between the processor and one or more devices. For the
105 * purposes of the device model, all devices are connected via a bus, even if 103 * purposes of the device model, all devices are connected via a bus, even if
@@ -140,8 +138,6 @@ struct bus_type {
140 138
141 struct subsys_private *p; 139 struct subsys_private *p;
142 struct lock_class_key lock_key; 140 struct lock_class_key lock_key;
143
144 bool force_dma;
145}; 141};
146 142
147extern int __must_check bus_register(struct bus_type *bus); 143extern int __must_check bus_register(struct bus_type *bus);
diff --git a/include/linux/of_device.h b/include/linux/of_device.h
index 8da5a1b31ece..165fd302b442 100644
--- a/include/linux/of_device.h
+++ b/include/linux/of_device.h
@@ -55,7 +55,9 @@ static inline struct device_node *of_cpu_device_node_get(int cpu)
55 return of_node_get(cpu_dev->of_node); 55 return of_node_get(cpu_dev->of_node);
56} 56}
57 57
58int of_dma_configure(struct device *dev, struct device_node *np); 58int of_dma_configure(struct device *dev,
59 struct device_node *np,
60 bool force_dma);
59void of_dma_deconfigure(struct device *dev); 61void of_dma_deconfigure(struct device *dev);
60#else /* CONFIG_OF */ 62#else /* CONFIG_OF */
61 63
@@ -105,7 +107,9 @@ static inline struct device_node *of_cpu_device_node_get(int cpu)
105 return NULL; 107 return NULL;
106} 108}
107 109
108static inline int of_dma_configure(struct device *dev, struct device_node *np) 110static inline int of_dma_configure(struct device *dev,
111 struct device_node *np,
112 bool force_dma)
109{ 113{
110 return 0; 114 return 0;
111} 115}