Merge tag 'sched-urgent-2020-12-27' of git://git.kernel.org/pub/scm/linux/kernel...
[linux/fpc-iii.git] / arch / riscv / include / asm / soc.h
blob6c8363b1f3272ea669ce9761783dc30436e6656f
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3 * Copyright (C) 2020 Western Digital Corporation or its affiliates.
4 * Copyright (C) 2020 Google, Inc
5 */
7 #ifndef _ASM_RISCV_SOC_H
8 #define _ASM_RISCV_SOC_H
10 #include <linux/of.h>
11 #include <linux/linkage.h>
12 #include <linux/types.h>
14 #define SOC_EARLY_INIT_DECLARE(name, compat, fn) \
15 static const struct of_device_id __soc_early_init__##name \
16 __used __section("__soc_early_init_table") \
17 = { .compatible = compat, .data = fn }
19 void soc_early_init(void);
21 extern unsigned long __soc_early_init_table_start;
22 extern unsigned long __soc_early_init_table_end;
25 * Allows Linux to provide a device tree, which is necessary for SOCs that
26 * don't provide a useful one on their own.
28 struct soc_builtin_dtb {
29 unsigned long vendor_id;
30 unsigned long arch_id;
31 unsigned long imp_id;
32 void *(*dtb_func)(void);
36 * The argument name must specify a valid DTS file name without the dts
37 * extension.
39 #define SOC_BUILTIN_DTB_DECLARE(name, vendor, arch, impl) \
40 extern void *__dtb_##name##_begin; \
42 static __init __used \
43 void *__soc_builtin_dtb_f__##name(void) \
44 { \
45 return (void *)&__dtb_##name##_begin; \
46 } \
48 static const struct soc_builtin_dtb __soc_builtin_dtb__##name \
49 __used __section("__soc_builtin_dtb_table") = \
50 { \
51 .vendor_id = vendor, \
52 .arch_id = arch, \
53 .imp_id = impl, \
54 .dtb_func = __soc_builtin_dtb_f__##name, \
57 extern unsigned long __soc_builtin_dtb_table_start;
58 extern unsigned long __soc_builtin_dtb_table_end;
60 void *soc_lookup_builtin_dtb(void);
62 #endif