davinci: Encapsulate SoC-specific data in a structure
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / arm / mach-davinci / common.c
blob9a5486f5519c8ade2032a3c4c6024fbb8d7476c6
1 /*
2 * Code commons to all DaVinci SoCs.
4 * Author: Mark A. Greer <mgreer@mvista.com>
6 * 2009 (c) MontaVista Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
11 #include <linux/module.h>
12 #include <linux/io.h>
14 #include <asm/tlb.h>
15 #include <asm/mach/map.h>
17 #include <mach/common.h>
19 struct davinci_soc_info davinci_soc_info;
20 EXPORT_SYMBOL(davinci_soc_info);
22 void __init davinci_common_init(struct davinci_soc_info *soc_info)
24 int ret;
26 if (!soc_info) {
27 ret = -EINVAL;
28 goto err;
31 memcpy(&davinci_soc_info, soc_info, sizeof(struct davinci_soc_info));
33 if (davinci_soc_info.io_desc && (davinci_soc_info.io_desc_num > 0))
34 iotable_init(davinci_soc_info.io_desc,
35 davinci_soc_info.io_desc_num);
38 * Normally devicemaps_init() would flush caches and tlb after
39 * mdesc->map_io(), but we must also do it here because of the CPU
40 * revision check below.
42 local_flush_tlb_all();
43 flush_cache_all();
46 * We want to check CPU revision early for cpu_is_xxxx() macros.
47 * IO space mapping must be initialized before we can do that.
49 davinci_check_revision();
51 return;
53 err:
54 pr_err("davinci_common_init: SoC Initialization failed\n");