hancock: set board version in device-tree

This commit is contained in:
Rene Straub 2018-07-06 20:27:10 +02:00
parent 0aee118629
commit 34e91fa6e1
2 changed files with 32 additions and 3 deletions

View File

@ -34,13 +34,13 @@
#include <cpsw.h>
#include <environment.h>
#include <watchdog.h>
#include <libfdt.h>
#include "../common/bdparser.h"
#include "../common/board_descriptor.h"
#include "board.h"
#include "da9063.h"
#include "sja1105.h"
#include "fileaccess.h"
DECLARE_GLOBAL_DATA_PTR;
@ -369,7 +369,7 @@ static void init_pmic_spl(void)
bus = da9063_claim_i2c_bus();
/* Workaround for pre v1.3 config (reports ID 0x3e) */
/* Workaround for pre v1.3 config (reports ID 0x3e -> 3.14) */
rc = da9063_get_reg(PMIC_REG_CONFIG_ID, &val);
if (!rc && (val == 0x3E)) {
printf("Detected pre v1.3 PMIC config. Fixing registers\n");
@ -836,7 +836,6 @@ static void check_reset_button(void)
int board_late_init(void)
{
#if !defined(CONFIG_SPL_BUILD)
if (read_eeprom() < 0) {
puts("Could not get board ID.\n");
@ -1010,3 +1009,31 @@ int board_fit_config_name_match(const char *name)
return 0;
}
#endif
#if defined(CONFIG_OF_BOARD_SETUP)
static void ft_hw_version(void *blob)
{
int node_offset;
int hw_ver, hw_rev, hw_patch;
char hw_version[16];
bd_get_hw_version(&hw_ver, &hw_rev);
bd_get_hw_patch(&hw_patch);
snprintf(hw_version, sizeof(hw_version), "%d.%d.%d", hw_ver, hw_rev, hw_patch);
node_offset = fdt_path_offset(blob, "/");
if (node_offset != -1) {
fdt_setprop_string(blob, node_offset, "nm,carrierboard,version", hw_version);
}
}
int ft_board_setup(void *blob, bd_t *bd)
{
ft_hw_version(blob);
return 0;
}
#endif

View File

@ -230,6 +230,8 @@
#define CONFIG_CMD_PXE
#define CONFIG_OF_BOARD_SETUP
/* SPL command is not needed */
#undef CONFIG_CMD_SPL