mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-09-11 17:01:36 +02:00
When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"' I failed to notice that b4 noticed it was based on next and so took that as the base commit and merged that part of next to master. This reverts commit c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35. Reported-by: Jonas Karlman <jonas@kwiboo.se> Signed-off-by: Tom Rini <trini@konsulko.com>
79 lines
1.5 KiB
C
79 lines
1.5 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* Copyright (c) 2017 Intel Corporation
|
|
*/
|
|
#include <common.h>
|
|
#include <env.h>
|
|
#include <init.h>
|
|
#include <mmc.h>
|
|
#include <u-boot/md5.h>
|
|
|
|
#include <asm/cache.h>
|
|
#include <asm/pmu.h>
|
|
#include <asm/scu.h>
|
|
#include <asm/u-boot-x86.h>
|
|
|
|
/* List of Intel Tangier LSSs */
|
|
#define PMU_LSS_TANGIER_SDIO0_01 1
|
|
|
|
int board_early_init_r(void)
|
|
{
|
|
pmu_turn_power(PMU_LSS_TANGIER_SDIO0_01, true);
|
|
return 0;
|
|
}
|
|
|
|
static void assign_serial(void)
|
|
{
|
|
struct mmc *mmc = find_mmc_device(0);
|
|
unsigned char ssn[16];
|
|
char usb0addr[18];
|
|
char serial[33];
|
|
int i;
|
|
|
|
if (!mmc)
|
|
return;
|
|
|
|
md5((unsigned char *)mmc->cid, sizeof(mmc->cid), ssn);
|
|
|
|
snprintf(usb0addr, sizeof(usb0addr), "02:00:86:%02x:%02x:%02x",
|
|
ssn[13], ssn[14], ssn[15]);
|
|
env_set("usb0addr", usb0addr);
|
|
|
|
for (i = 0; i < 16; i++)
|
|
snprintf(&serial[2 * i], 3, "%02x", ssn[i]);
|
|
env_set("serial#", serial);
|
|
|
|
#if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_ENV_IS_NOWHERE)
|
|
env_save();
|
|
#endif
|
|
}
|
|
|
|
static void assign_hardware_id(void)
|
|
{
|
|
struct ipc_ifwi_version v;
|
|
char hardware_id[4];
|
|
int ret;
|
|
|
|
ret = scu_ipc_command(IPCMSG_GET_FW_REVISION, 1, NULL, 0, (u32 *)&v, 4);
|
|
if (ret < 0)
|
|
printf("Can't retrieve hardware revision\n");
|
|
|
|
snprintf(hardware_id, sizeof(hardware_id), "%02X", v.hardware_id);
|
|
env_set("hardware_id", hardware_id);
|
|
|
|
#if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_ENV_IS_NOWHERE)
|
|
env_save();
|
|
#endif
|
|
}
|
|
|
|
int board_late_init(void)
|
|
{
|
|
if (!env_get("serial#"))
|
|
assign_serial();
|
|
|
|
if (!env_get("hardware_id"))
|
|
assign_hardware_id();
|
|
|
|
return 0;
|
|
}
|