]>
Commit | Line | Data |
---|---|---|
83d290c5 | 1 | // SPDX-License-Identifier: GPL-2.0+ |
0365ffcc MY |
2 | |
3 | #include <common.h> | |
96dedb0d | 4 | #include <dm.h> |
691d719d | 5 | #include <init.h> |
96dedb0d | 6 | #include <sysinfo.h> |
401d1c4f | 7 | #include <asm/global_data.h> |
b08c8c48 | 8 | #include <linux/libfdt.h> |
0365ffcc MY |
9 | #include <linux/compiler.h> |
10 | ||
96dedb0d SG |
11 | DECLARE_GLOBAL_DATA_PTR; |
12 | ||
0365ffcc MY |
13 | int __weak checkboard(void) |
14 | { | |
0365ffcc MY |
15 | return 0; |
16 | } | |
17 | ||
18 | /* | |
96dedb0d SG |
19 | * Check sysinfo for board information. Failing that if the root node of the DTB |
20 | * has a "model" property, show it. | |
21 | * | |
dac326b8 | 22 | * Then call checkboard(). |
0365ffcc | 23 | */ |
f7637cc0 | 24 | int __weak show_board_info(void) |
0365ffcc | 25 | { |
96dedb0d SG |
26 | if (IS_ENABLED(CONFIG_OF_CONTROL)) { |
27 | struct udevice *dev; | |
28 | const char *model; | |
29 | char str[80]; | |
30 | int ret = -ENOSYS; | |
31 | ||
32 | if (IS_ENABLED(CONFIG_SYSINFO)) { | |
33 | /* This might provide more detail */ | |
10f3e157 | 34 | ret = sysinfo_get(&dev); |
93e310c3 MV |
35 | if (!ret) { |
36 | ret = sysinfo_detect(dev); | |
37 | if (!ret) { | |
38 | ret = sysinfo_get_str(dev, | |
96dedb0d SG |
39 | SYSINFO_ID_BOARD_MODEL, |
40 | sizeof(str), str); | |
93e310c3 MV |
41 | } |
42 | } | |
96dedb0d | 43 | } |
0365ffcc | 44 | |
96dedb0d SG |
45 | /* Fail back to the main 'model' if available */ |
46 | if (ret) | |
47 | model = fdt_getprop(gd->fdt_blob, 0, "model", NULL); | |
48 | else | |
49 | model = str; | |
0365ffcc | 50 | |
96dedb0d SG |
51 | if (model) |
52 | printf("Model: %s\n", model); | |
53 | } | |
0365ffcc MY |
54 | |
55 | return checkboard(); | |
56 | } |