diff options
Diffstat (limited to 'arch/arm/mach-omap2/omap4-common.c')
-rw-r--r-- | arch/arm/mach-omap2/omap4-common.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c index 1b93d31fe8e9..bc16c818c6b7 100644 --- a/arch/arm/mach-omap2/omap4-common.c +++ b/arch/arm/mach-omap2/omap4-common.c | |||
@@ -15,11 +15,14 @@ | |||
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/io.h> | 16 | #include <linux/io.h> |
17 | #include <linux/platform_device.h> | 17 | #include <linux/platform_device.h> |
18 | #include <linux/memblock.h> | ||
18 | 19 | ||
19 | #include <asm/hardware/gic.h> | 20 | #include <asm/hardware/gic.h> |
20 | #include <asm/hardware/cache-l2x0.h> | 21 | #include <asm/hardware/cache-l2x0.h> |
22 | #include <asm/mach/map.h> | ||
21 | 23 | ||
22 | #include <plat/irqs.h> | 24 | #include <plat/irqs.h> |
25 | #include <plat/sram.h> | ||
23 | 26 | ||
24 | #include <mach/hardware.h> | 27 | #include <mach/hardware.h> |
25 | #include <mach/omap-wakeupgen.h> | 28 | #include <mach/omap-wakeupgen.h> |
@@ -33,6 +36,54 @@ static void __iomem *l2cache_base; | |||
33 | 36 | ||
34 | static void __iomem *sar_ram_base; | 37 | static void __iomem *sar_ram_base; |
35 | 38 | ||
39 | #ifdef CONFIG_OMAP4_ERRATA_I688 | ||
40 | /* Used to implement memory barrier on DRAM path */ | ||
41 | #define OMAP4_DRAM_BARRIER_VA 0xfe600000 | ||
42 | |||
43 | void __iomem *dram_sync, *sram_sync; | ||
44 | |||
45 | void omap_bus_sync(void) | ||
46 | { | ||
47 | if (dram_sync && sram_sync) { | ||
48 | writel_relaxed(readl_relaxed(dram_sync), dram_sync); | ||
49 | writel_relaxed(readl_relaxed(sram_sync), sram_sync); | ||
50 | isb(); | ||
51 | } | ||
52 | } | ||
53 | |||
54 | static int __init omap_barriers_init(void) | ||
55 | { | ||
56 | struct map_desc dram_io_desc[1]; | ||
57 | phys_addr_t paddr; | ||
58 | u32 size; | ||
59 | |||
60 | if (!cpu_is_omap44xx()) | ||
61 | return -ENODEV; | ||
62 | |||
63 | size = ALIGN(PAGE_SIZE, SZ_1M); | ||
64 | paddr = memblock_alloc(size, SZ_1M); | ||
65 | if (!paddr) { | ||
66 | pr_err("%s: failed to reserve 4 Kbytes\n", __func__); | ||
67 | return -ENOMEM; | ||
68 | } | ||
69 | memblock_free(paddr, size); | ||
70 | memblock_remove(paddr, size); | ||
71 | dram_io_desc[0].virtual = OMAP4_DRAM_BARRIER_VA; | ||
72 | dram_io_desc[0].pfn = __phys_to_pfn(paddr); | ||
73 | dram_io_desc[0].length = size; | ||
74 | dram_io_desc[0].type = MT_MEMORY_SO; | ||
75 | iotable_init(dram_io_desc, ARRAY_SIZE(dram_io_desc)); | ||
76 | dram_sync = (void __iomem *) dram_io_desc[0].virtual; | ||
77 | sram_sync = (void __iomem *) OMAP4_SRAM_VA; | ||
78 | |||
79 | pr_info("OMAP4: Map 0x%08llx to 0x%08lx for dram barrier\n", | ||
80 | (long long) paddr, dram_io_desc[0].virtual); | ||
81 | |||
82 | return 0; | ||
83 | } | ||
84 | core_initcall(omap_barriers_init); | ||
85 | #endif | ||
86 | |||
36 | void __init gic_init_irq(void) | 87 | void __init gic_init_irq(void) |
37 | { | 88 | { |
38 | void __iomem *omap_irq_base; | 89 | void __iomem *omap_irq_base; |