spi-topcliff-pch: add recovery processing in case wait-event timeout
[zen-stable.git] / arch / arm / plat-s5p / dev-mfc.c
bloba30d36b7f61bb62c41124ba4ba9e7441e30b9d9f
1 /* linux/arch/arm/plat-s5p/dev-mfc.c
3 * Copyright (C) 2010-2011 Samsung Electronics Co.Ltd
5 * Base S5P MFC resource and device definitions
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
13 #include <linux/kernel.h>
14 #include <linux/interrupt.h>
15 #include <linux/platform_device.h>
16 #include <linux/dma-mapping.h>
17 #include <linux/memblock.h>
18 #include <linux/ioport.h>
20 #include <mach/map.h>
21 #include <plat/devs.h>
22 #include <plat/irqs.h>
23 #include <plat/mfc.h>
25 struct s5p_mfc_reserved_mem {
26 phys_addr_t base;
27 unsigned long size;
28 struct device *dev;
31 static struct s5p_mfc_reserved_mem s5p_mfc_mem[2] __initdata;
33 void __init s5p_mfc_reserve_mem(phys_addr_t rbase, unsigned int rsize,
34 phys_addr_t lbase, unsigned int lsize)
36 int i;
38 s5p_mfc_mem[0].dev = &s5p_device_mfc_r.dev;
39 s5p_mfc_mem[0].base = rbase;
40 s5p_mfc_mem[0].size = rsize;
42 s5p_mfc_mem[1].dev = &s5p_device_mfc_l.dev;
43 s5p_mfc_mem[1].base = lbase;
44 s5p_mfc_mem[1].size = lsize;
46 for (i = 0; i < ARRAY_SIZE(s5p_mfc_mem); i++) {
47 struct s5p_mfc_reserved_mem *area = &s5p_mfc_mem[i];
48 if (memblock_remove(area->base, area->size)) {
49 printk(KERN_ERR "Failed to reserve memory for MFC device (%ld bytes at 0x%08lx)\n",
50 area->size, (unsigned long) area->base);
51 area->base = 0;
56 static int __init s5p_mfc_memory_init(void)
58 int i;
60 for (i = 0; i < ARRAY_SIZE(s5p_mfc_mem); i++) {
61 struct s5p_mfc_reserved_mem *area = &s5p_mfc_mem[i];
62 if (!area->base)
63 continue;
65 if (dma_declare_coherent_memory(area->dev, area->base,
66 area->base, area->size,
67 DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE) == 0)
68 printk(KERN_ERR "Failed to declare coherent memory for MFC device (%ld bytes at 0x%08lx)\n",
69 area->size, (unsigned long) area->base);
71 return 0;
73 device_initcall(s5p_mfc_memory_init);