aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/of/platform.c
diff options
context:
space:
mode:
authorMarek Szyprowski <m.szyprowski@samsung.com>2013-08-26 08:43:10 -0400
committerMarek Szyprowski <m.szyprowski@samsung.com>2013-08-27 04:53:44 -0400
commit9d8eab7af79cb4ce2de5de39f82c455b1f796963 (patch)
treefd26c89bad9e8bdde9af51b47f5bb476e87a1b52 /drivers/of/platform.c
parent57d74bcf3072b65bde5aa540cedc976a75c48e5c (diff)
drivers: of: add initialization code for dma reserved memory
This patch adds device tree support for contiguous and reserved memory regions defined in device tree. Large memory blocks can be reliably reserved only during early boot. This must happen before the whole memory management subsystem is initialized, because we need to ensure that the given contiguous blocks are not yet allocated by kernel. Also it must happen before kernel mappings for the whole low memory are created, to ensure that there will be no mappings (for reserved blocks) or mapping with special properties can be created (for CMA blocks). This all happens before device tree structures are unflattened, so we need to get reserved memory layout directly from fdt. Later, those reserved memory regions are assigned to devices on each device structure initialization. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Acked-by: Kyungmin Park <kyungmin.park@samsung.com> Acked-by: Michal Nazarewicz <mina86@mina86.com> Acked-by: Tomasz Figa <t.figa@samsung.com> Acked-by: Stephen Warren <swarren@nvidia.com> Reviewed-by: Rob Herring <rob.herring@calxeda.com>
Diffstat (limited to 'drivers/of/platform.c')
-rw-r--r--drivers/of/platform.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index e0a6514ab46c..eeca8a596973 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -21,6 +21,7 @@
21#include <linux/of_device.h> 21#include <linux/of_device.h>
22#include <linux/of_irq.h> 22#include <linux/of_irq.h>
23#include <linux/of_platform.h> 23#include <linux/of_platform.h>
24#include <linux/of_reserved_mem.h>
24#include <linux/platform_device.h> 25#include <linux/platform_device.h>
25 26
26const struct of_device_id of_default_bus_match_table[] = { 27const struct of_device_id of_default_bus_match_table[] = {
@@ -218,6 +219,8 @@ struct platform_device *of_platform_device_create_pdata(
218 dev->dev.bus = &platform_bus_type; 219 dev->dev.bus = &platform_bus_type;
219 dev->dev.platform_data = platform_data; 220 dev->dev.platform_data = platform_data;
220 221
222 of_reserved_mem_device_init(&dev->dev);
223
221 /* We do not fill the DMA ops for platform devices by default. 224 /* We do not fill the DMA ops for platform devices by default.
222 * This is currently the responsibility of the platform code 225 * This is currently the responsibility of the platform code
223 * to do such, possibly using a device notifier 226 * to do such, possibly using a device notifier
@@ -225,6 +228,7 @@ struct platform_device *of_platform_device_create_pdata(
225 228
226 if (of_device_add(dev) != 0) { 229 if (of_device_add(dev) != 0) {
227 platform_device_put(dev); 230 platform_device_put(dev);
231 of_reserved_mem_device_release(&dev->dev);
228 return NULL; 232 return NULL;
229 } 233 }
230 234