diff options
author | Nipun Gupta <nipun.gupta@nxp.com> | 2018-04-27 22:51:58 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2018-05-03 10:22:18 -0400 |
commit | 07397df29e57cde5799af16e8f148ae10ed75285 (patch) | |
tree | 7f4e2606ec8d6a26a5433cb4dac32338178092fd /drivers/base/platform.c | |
parent | 892a0be43edd63e1cd228af3453a064e9e94f08e (diff) |
dma-mapping: move dma configuration to bus infrastructure
ACPI/OF support for configuration of DMA is a bus specific aspect, and
thus should be configured by the bus. Introduces a 'dma_configure' bus
method so that busses can control their DMA capabilities.
Also update the PCI, Platform, ACPI and host1x buses to use the new
method.
Suggested-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com> # PCI parts
Acked-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[hch: simplified host1x_dma_configure based on a comment from Thierry,
rewrote changelog]
Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/base/platform.c')
-rw-r--r-- | drivers/base/platform.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 8075ddc70a17..638d42e93772 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c | |||
@@ -1130,6 +1130,22 @@ int platform_pm_restore(struct device *dev) | |||
1130 | 1130 | ||
1131 | #endif /* CONFIG_HIBERNATE_CALLBACKS */ | 1131 | #endif /* CONFIG_HIBERNATE_CALLBACKS */ |
1132 | 1132 | ||
1133 | int platform_dma_configure(struct device *dev) | ||
1134 | { | ||
1135 | enum dev_dma_attr attr; | ||
1136 | int ret = 0; | ||
1137 | |||
1138 | if (dev->of_node) { | ||
1139 | ret = of_dma_configure(dev, dev->of_node); | ||
1140 | } else if (has_acpi_companion(dev)) { | ||
1141 | attr = acpi_get_dma_attr(to_acpi_device_node(dev->fwnode)); | ||
1142 | if (attr != DEV_DMA_NOT_SUPPORTED) | ||
1143 | ret = acpi_dma_configure(dev, attr); | ||
1144 | } | ||
1145 | |||
1146 | return ret; | ||
1147 | } | ||
1148 | |||
1133 | static const struct dev_pm_ops platform_dev_pm_ops = { | 1149 | static const struct dev_pm_ops platform_dev_pm_ops = { |
1134 | .runtime_suspend = pm_generic_runtime_suspend, | 1150 | .runtime_suspend = pm_generic_runtime_suspend, |
1135 | .runtime_resume = pm_generic_runtime_resume, | 1151 | .runtime_resume = pm_generic_runtime_resume, |
@@ -1141,6 +1157,7 @@ struct bus_type platform_bus_type = { | |||
1141 | .dev_groups = platform_dev_groups, | 1157 | .dev_groups = platform_dev_groups, |
1142 | .match = platform_match, | 1158 | .match = platform_match, |
1143 | .uevent = platform_uevent, | 1159 | .uevent = platform_uevent, |
1160 | .dma_configure = platform_dma_configure, | ||
1144 | .pm = &platform_dev_pm_ops, | 1161 | .pm = &platform_dev_pm_ops, |
1145 | .force_dma = true, | 1162 | .force_dma = true, |
1146 | }; | 1163 | }; |