1 // SPDX-License-Identifier: GPL-2.0-only
3 * Code commons to all DaVinci SoCs.
5 * Author: Mark A. Greer <mgreer@mvista.com>
7 * 2009 (c) MontaVista Software, Inc.
9 #include <linux/module.h>
11 #include <linux/etherdevice.h>
12 #include <linux/davinci_emac.h>
13 #include <linux/dma-mapping.h>
14 #include <linux/platform_data/davinci-cpufreq.h>
17 #include <asm/mach/map.h>
22 struct davinci_soc_info davinci_soc_info
;
23 EXPORT_SYMBOL(davinci_soc_info
);
25 static int __init
davinci_init_id(struct davinci_soc_info
*soc_info
)
28 struct davinci_id
*dip
;
33 base
= ioremap(soc_info
->jtag_id_reg
, SZ_4K
);
35 pr_err("Unable to map JTAG ID register\n");
39 soc_info
->jtag_id
= __raw_readl(base
);
42 variant
= (soc_info
->jtag_id
& 0xf0000000) >> 28;
43 part_no
= (soc_info
->jtag_id
& 0x0ffff000) >> 12;
45 for (i
= 0, dip
= soc_info
->ids
; i
< soc_info
->ids_num
;
47 /* Don't care about the manufacturer right now */
48 if ((dip
->part_no
== part_no
) && (dip
->variant
== variant
)) {
49 soc_info
->cpu_id
= dip
->cpu_id
;
50 pr_info("DaVinci %s variant 0x%x\n", dip
->name
,
55 pr_err("Unknown DaVinci JTAG ID 0x%x\n", soc_info
->jtag_id
);
59 void __init
davinci_common_init(const struct davinci_soc_info
*soc_info
)
68 memcpy(&davinci_soc_info
, soc_info
, sizeof(struct davinci_soc_info
));
70 if (davinci_soc_info
.io_desc
&& (davinci_soc_info
.io_desc_num
> 0))
71 iotable_init(davinci_soc_info
.io_desc
,
72 davinci_soc_info
.io_desc_num
);
75 * Normally devicemaps_init() would flush caches and tlb after
76 * mdesc->map_io(), but we must also do it here because of the CPU
77 * revision check below.
79 local_flush_tlb_all();
83 * We want to check CPU revision early for cpu_is_xxxx() macros.
84 * IO space mapping must be initialized before we can do that.
86 ret
= davinci_init_id(&davinci_soc_info
);
94 panic("davinci_common_init: SoC Initialization failed\n");
97 void __init
davinci_init_late(void)
99 davinci_cpufreq_init();