summaryrefslogtreecommitdiff
path: root/board/xilinx/common/board.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2022-07-26 08:32:37 -0400
committerTom Rini <trini@konsulko.com>2022-07-26 08:32:37 -0400
commite5f6fecda4a606acd2417fb537f331e37c757fa5 (patch)
tree852732e3a6aed34836e1e6650eda62cbbe02eeb2 /board/xilinx/common/board.c
parent6e15cda270a060cf87c6c643a1cc3da65ffb242d (diff)
parent2a75bc1303b34e88745fcecfeacbe94f2a4bd1e2 (diff)
Merge tag 'xilinx-for-v2022.10-rc2' of https://source.denx.de/u-boot/custodians/u-boot-microblaze
Xilinx changes for v2022.10-rc2 fpga: - Convert SYS_FPGA_CHECK_CTRLC and SYS_FPGA_PROG_FEEDBACK to Kconfig - Add support for secure bitstream loading spi: - xilinx_spi: Add support for memopers and supports_op - zynq_qspi: Add support for supports_op/child_pre_probe - zynq_qspi: Fix dummy cycle and qspi speed calculations xilinx: - Get rid of #stream-id-cells - Use fixed partitions for SOM - Add support for UUID reading from FRU - Use strlcpy instead of strncpy - Add reset driver support for ZynqMP and Versal - Enable power domain driver in ZynqMP and Versal zynqmp: - Do no place BSS at 0 which have issue with NULL pointer - Enable SLG gpio driver - Disable LMB for mini configurations - Remove duplicate PMIO_NODE_ID_BASE macro versal: - Add xlnx-versal-resets.h header mmc: - zynq_sdhci: Fix macro for MMC HS relocate-rela: - Fix support for BE hosts - Define all macros for e_machine and reloc types misc: - Get rid of guard macros from ARM and RISC-V lmb: - Add support for disabling LMB serial: - zynq: Fix baudrate calculation tests: - Mark bind tests to run only on sandbox - List also dm uclass and devres
Diffstat (limited to 'board/xilinx/common/board.c')
-rw-r--r--board/xilinx/common/board.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c
index 5f2afb9def4..9b4aded466a 100644
--- a/board/xilinx/common/board.c
+++ b/board/xilinx/common/board.c
@@ -23,6 +23,7 @@
#include <soc.h>
#include <linux/ctype.h>
#include <linux/kernel.h>
+#include <uuid.h>
#include "fru.h"
@@ -86,6 +87,7 @@ int zynq_board_read_rom_ethaddr(unsigned char *ethaddr)
#define EEPROM_HDR_SERIAL_LEN 20
#define EEPROM_HDR_NO_OF_MAC_ADDR 4
#define EEPROM_HDR_ETH_ALEN ETH_ALEN
+#define EEPROM_HDR_UUID_LEN 16
struct xilinx_board_description {
u32 header;
@@ -94,6 +96,7 @@ struct xilinx_board_description {
char revision[EEPROM_HDR_REV_LEN + 1];
char serial[EEPROM_HDR_SERIAL_LEN + 1];
u8 mac_addr[EEPROM_HDR_NO_OF_MAC_ADDR][EEPROM_HDR_ETH_ALEN + 1];
+ char uuid[EEPROM_HDR_UUID_LEN + 1];
};
static int highest_id = -1;
@@ -235,21 +238,23 @@ static int xilinx_read_eeprom_fru(struct udevice *dev, char *name,
}
/* It is clear that FRU was captured and structures were filled */
- strncpy(desc->manufacturer, (char *)fru_data.brd.manufacturer_name,
+ strlcpy(desc->manufacturer, (char *)fru_data.brd.manufacturer_name,
sizeof(desc->manufacturer));
- strncpy(desc->name, (char *)fru_data.brd.product_name,
+ strlcpy(desc->uuid, (char *)fru_data.brd.uuid,
+ sizeof(desc->uuid));
+ strlcpy(desc->name, (char *)fru_data.brd.product_name,
sizeof(desc->name));
for (i = 0; i < sizeof(desc->name); i++) {
if (desc->name[i] == ' ')
desc->name[i] = '\0';
}
- strncpy(desc->revision, (char *)fru_data.brd.rev,
+ strlcpy(desc->revision, (char *)fru_data.brd.rev,
sizeof(desc->revision));
for (i = 0; i < sizeof(desc->revision); i++) {
if (desc->revision[i] == ' ')
desc->revision[i] = '\0';
}
- strncpy(desc->serial, (char *)fru_data.brd.serial_number,
+ strlcpy(desc->serial, (char *)fru_data.brd.serial_number,
sizeof(desc->serial));
while (id < EEPROM_HDR_NO_OF_MAC_ADDR) {
@@ -452,6 +457,19 @@ int board_late_init_xilinx(void)
ret |= env_set_by_index("serial", id,
desc->serial);
+ if (desc->uuid[0]) {
+ char uuid[UUID_STR_LEN + 1];
+ char *t = desc->uuid;
+
+ memset(uuid, 0, UUID_STR_LEN + 1);
+
+ sprintf(uuid, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
+ t[0], t[1], t[2], t[3], t[4], t[5],
+ t[6], t[7], t[8], t[9], t[10], t[11],
+ t[12], t[13], t[14], t[15]);
+ ret |= env_set_by_index("uuid", id, uuid);
+ }
+
if (!CONFIG_IS_ENABLED(NET))
continue;