2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2015-01-14 08:07:05 +00:00
|
|
|
|
|
|
|
#include <common.h>
|
2021-03-21 03:50:06 +00:00
|
|
|
#include <dm.h>
|
2020-05-10 17:40:02 +00:00
|
|
|
#include <init.h>
|
2021-03-21 03:50:06 +00:00
|
|
|
#include <sysinfo.h>
|
2020-10-31 03:38:53 +00:00
|
|
|
#include <asm/global_data.h>
|
2018-03-04 16:20:11 +00:00
|
|
|
#include <linux/libfdt.h>
|
2015-01-14 08:07:05 +00:00
|
|
|
#include <linux/compiler.h>
|
|
|
|
|
2021-03-21 03:50:06 +00:00
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
|
2015-01-14 08:07:05 +00:00
|
|
|
int __weak checkboard(void)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-11-16 16:49:20 +00:00
|
|
|
int __weak show_board_info(void)
|
2015-01-14 08:07:05 +00:00
|
|
|
{
|
2021-03-21 03:50:06 +00:00
|
|
|
if (IS_ENABLED(CONFIG_OF_CONTROL)) {
|
|
|
|
struct udevice *dev;
|
|
|
|
const char *model;
|
|
|
|
char str[80];
|
|
|
|
int ret = -ENOSYS;
|
|
|
|
|
|
|
|
if (IS_ENABLED(CONFIG_SYSINFO)) {
|
|
|
|
/* This might provide more detail */
|
2021-07-04 19:32:04 +00:00
|
|
|
ret = sysinfo_get(&dev);
|
2021-07-04 19:32:05 +00:00
|
|
|
if (!ret) {
|
|
|
|
ret = sysinfo_detect(dev);
|
|
|
|
if (!ret) {
|
|
|
|
ret = sysinfo_get_str(dev,
|
2021-03-21 03:50:06 +00:00
|
|
|
SYSINFO_ID_BOARD_MODEL,
|
|
|
|
sizeof(str), str);
|
2021-07-04 19:32:05 +00:00
|
|
|
}
|
|
|
|
}
|
2021-03-21 03:50:06 +00:00
|
|
|
}
|
2015-01-14 08:07:05 +00:00
|
|
|
|
2021-03-21 03:50:06 +00:00
|
|
|
/* Fail back to the main 'model' if available */
|
|
|
|
if (ret)
|
|
|
|
model = fdt_getprop(gd->fdt_blob, 0, "model", NULL);
|
|
|
|
else
|
|
|
|
model = str;
|
2015-01-14 08:07:05 +00:00
|
|
|
|
2021-03-21 03:50:06 +00:00
|
|
|
if (model)
|
|
|
|
printf("Model: %s\n", model);
|
|
|
|
}
|
2015-01-14 08:07:05 +00:00
|
|
|
|
|
|
|
return checkboard();
|
|
|
|
}
|