Commit 3a127711 authored by Marek Behun's avatar Marek Behun

arm: mvebu: turris_omnia: patch DT with Omnia's serial number

Use ft_board_setup to add the "serial-number" property to the device
tree, so that Linux can display Omnia's serial number in  /proc/cpuinfo.
Signed-off-by: Marek Behun's avatarMarek Behún <marek.behun@nic.cz>
parent 79a75014
......@@ -433,14 +433,17 @@ static struct udevice *get_atsha204a_dev(void)
return dev;
}
static char serial_number[17];
static int valid_serial_number;
int checkboard(void)
{
u32 version_num, serial_num;
int err = 1;
struct udevice *dev = get_atsha204a_dev();
if (dev) {
int err;
u32 version_num, serial_num;
err = atsha204a_wakeup(dev);
if (err)
goto out;
......@@ -458,16 +461,17 @@ int checkboard(void)
goto out;
atsha204a_sleep(dev);
sprintf(serial_number, "%08X%08X", be32_to_cpu(version_num),
be32_to_cpu(serial_num));
valid_serial_number = 1;
}
out:
printf("Turris Omnia:\n");
printf(" RAM size: %i MiB\n", omnia_get_ram_size_gb() * 1024);
if (err)
printf(" Serial Number: unknown\n");
else
printf(" Serial Number: %08X%08X\n", be32_to_cpu(version_num),
be32_to_cpu(serial_num));
printf(" Serial Number: %s\n", valid_serial_number ? serial_number
: "unknown");
return 0;
}
......@@ -532,3 +536,10 @@ out:
return 0;
}
int ft_board_setup(void *blob, bd_t *bd)
{
if (valid_serial_number)
fdt_setprop_string(blob, 0, "serial-number", serial_number);
return 0;
}
......@@ -15,6 +15,7 @@ CONFIG_DEBUG_UART_CLOCK=250000000
CONFIG_SPL_SPI_FLASH_SUPPORT=y
CONFIG_SPL_SPI_SUPPORT=y
CONFIG_DEBUG_UART=y
CONFIG_OF_BOARD_SETUP=y
CONFIG_AHCI=y
CONFIG_DISTRO_DEFAULTS=y
CONFIG_FIT=y
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment