diff options
author | Michael Walle <michael@walle.cc> | 2021-11-16 01:45:46 +0300 |
---|---|---|
committer | Priyanka Jain <priyanka.jain@nxp.com> | 2022-02-28 09:29:35 +0300 |
commit | d36b683a0f4d9cd22aded61595b771c88203f3ab (patch) | |
tree | 719ca576392b936d4b87e1b625c050cd1b1722b8 /board/kontron/sl28/sl28.c | |
parent | fea51613222edba814d33a21d9485463cf3988f3 (diff) | |
download | u-boot-d36b683a0f4d9cd22aded61595b771c88203f3ab.tar.xz |
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>
Diffstat (limited to 'board/kontron/sl28/sl28.c')
-rw-r--r-- | board/kontron/sl28/sl28.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/board/kontron/sl28/sl28.c b/board/kontron/sl28/sl28.c index a4ee8a1ef3..9cde48e61e 100644 --- a/board/kontron/sl28/sl28.c +++ b/board/kontron/sl28/sl28.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0+ #include <common.h> +#include <dm.h> #include <malloc.h> #include <errno.h> #include <fsl_ddr.h> @@ -15,6 +16,7 @@ #include <fsl_immap.h> #include <netdev.h> +#include <sl28cpld.h> #include <fdtdec.h> #include <miiphy.h> @@ -39,9 +41,35 @@ int board_eth_init(struct bd_info *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) { printf("EL: %d\n", current_el()); + if (CONFIG_IS_ENABLED(SL28CPLD)) + print_cpld_version(); + return 0; } |