board: sl28: print CPLD version on bootup
Most of the time it is very useful to have the version of the board management controller. Now that we have a driver, print it during startup. Signed-off-by: Michael Walle <michael@walle.cc> Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
This commit is contained in:
parent
fea5161322
commit
d36b683a0f
@ -1,6 +1,7 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0+
|
// SPDX-License-Identifier: GPL-2.0+
|
||||||
|
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
|
#include <dm.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fsl_ddr.h>
|
#include <fsl_ddr.h>
|
||||||
@ -15,6 +16,7 @@
|
|||||||
#include <fsl_immap.h>
|
#include <fsl_immap.h>
|
||||||
#include <netdev.h>
|
#include <netdev.h>
|
||||||
|
|
||||||
|
#include <sl28cpld.h>
|
||||||
#include <fdtdec.h>
|
#include <fdtdec.h>
|
||||||
#include <miiphy.h>
|
#include <miiphy.h>
|
||||||
|
|
||||||
@ -39,9 +41,35 @@ int board_eth_init(struct bd_info *bis)
|
|||||||
return pci_eth_init(bis);
|
return pci_eth_init(bis);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int __sl28cpld_read(uint reg)
|
||||||
|
{
|
||||||
|
struct udevice *dev;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = uclass_get_device_by_driver(UCLASS_NOP,
|
||||||
|
DM_DRIVER_GET(sl28cpld), &dev);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
return sl28cpld_read(dev, reg);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void print_cpld_version(void)
|
||||||
|
{
|
||||||
|
int version = __sl28cpld_read(SL28CPLD_VERSION);
|
||||||
|
|
||||||
|
if (version < 0)
|
||||||
|
printf("CPLD: error reading version (%d)\n", version);
|
||||||
|
else
|
||||||
|
printf("CPLD: v%d\n", version);
|
||||||
|
}
|
||||||
|
|
||||||
int checkboard(void)
|
int checkboard(void)
|
||||||
{
|
{
|
||||||
printf("EL: %d\n", current_el());
|
printf("EL: %d\n", current_el());
|
||||||
|
if (CONFIG_IS_ENABLED(SL28CPLD))
|
||||||
|
print_cpld_version();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
#ifndef __SL28CPLD_H
|
#ifndef __SL28CPLD_H
|
||||||
#define __SL28CPLD_H
|
#define __SL28CPLD_H
|
||||||
|
|
||||||
|
#define SL28CPLD_VERSION 0x03
|
||||||
|
|
||||||
int sl28cpld_read(struct udevice *dev, uint offset);
|
int sl28cpld_read(struct udevice *dev, uint offset);
|
||||||
int sl28cpld_write(struct udevice *dev, uint offset, uint8_t value);
|
int sl28cpld_write(struct udevice *dev, uint offset, uint8_t value);
|
||||||
int sl28cpld_update(struct udevice *dev, uint offset, uint8_t clear,
|
int sl28cpld_update(struct udevice *dev, uint offset, uint8_t clear,
|
||||||
|
Loading…
Reference in New Issue
Block a user