From 42595eb7067c6c076e1c98213438be727f883fe2 Mon Sep 17 00:00:00 2001 From: Michael Walle Date: Fri, 25 Feb 2022 18:06:24 +0530 Subject: misc: add sl28cpld base driver Add a multi-function device driver which will probe its children and provides methods to access the device. Signed-off-by: Michael Walle [Rebased] Signed-off-by: Priyanka Jain --- include/sl28cpld.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 include/sl28cpld.h (limited to 'include') diff --git a/include/sl28cpld.h b/include/sl28cpld.h new file mode 100644 index 00000000000..d116607cfb1 --- /dev/null +++ b/include/sl28cpld.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (c) 2021 Michael Walle + */ + +#ifndef __SL28CPLD_H +#define __SL28CPLD_H + +int sl28cpld_read(struct udevice *dev, uint offset); +int sl28cpld_write(struct udevice *dev, uint offset, uint8_t value); +int sl28cpld_update(struct udevice *dev, uint offset, uint8_t clear, + uint8_t set); + +#endif -- cgit v1.3.1 From d36b683a0f4d9cd22aded61595b771c88203f3ab Mon Sep 17 00:00:00 2001 From: Michael Walle Date: Mon, 15 Nov 2021 23:45:46 +0100 Subject: 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 Reviewed-by: Priyanka Jain --- board/kontron/sl28/sl28.c | 28 ++++++++++++++++++++++++++++ include/sl28cpld.h | 2 ++ 2 files changed, 30 insertions(+) (limited to 'include') diff --git a/board/kontron/sl28/sl28.c b/board/kontron/sl28/sl28.c index a4ee8a1ef3e..9cde48e61ef 100644 --- a/board/kontron/sl28/sl28.c +++ b/board/kontron/sl28/sl28.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0+ #include +#include #include #include #include @@ -15,6 +16,7 @@ #include #include +#include #include #include @@ -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; } diff --git a/include/sl28cpld.h b/include/sl28cpld.h index d116607cfb1..9a7c6de31f5 100644 --- a/include/sl28cpld.h +++ b/include/sl28cpld.h @@ -6,6 +6,8 @@ #ifndef __SL28CPLD_H #define __SL28CPLD_H +#define SL28CPLD_VERSION 0x03 + int sl28cpld_read(struct udevice *dev, uint offset); int sl28cpld_write(struct udevice *dev, uint offset, uint8_t value); int sl28cpld_update(struct udevice *dev, uint offset, uint8_t clear, -- cgit v1.3.1 From 453db6056850e1ac1be0a12df72fcf3bd5f61bd3 Mon Sep 17 00:00:00 2001 From: Daniel Klauer Date: Wed, 9 Feb 2022 15:53:41 +0100 Subject: lx2160a: Fix distroboot device list for configs without USB/SCSI/etc The BOOT_TARGET_DEVICES list for distro_bootcmd was hard-coded to assume that all boot devices are available/enabled in the configuration, thus ignoring the actual config settings. The config_distro_bootcmd.h header file specifically has compile-time checks to detect such problems. To allow disabling USB, SCSI, etc. in custom lx2160a board configs, make it depend on the config settings and use only the enabled features. Signed-off-by: Daniel Klauer Reviewed-by: Priyanka Jain --- include/configs/lx2160a_common.h | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/configs/lx2160a_common.h b/include/configs/lx2160a_common.h index e31f8d087f7..4f4b5713dc7 100644 --- a/include/configs/lx2160a_common.h +++ b/include/configs/lx2160a_common.h @@ -244,12 +244,36 @@ "run distro_bootcmd;run sd2_bootcmd;" \ "env exists secureboot && esbc_halt;" +#ifdef CONFIG_CMD_USB +#define BOOT_TARGET_DEVICES_USB(func) func(USB, usb, 0) +#else +#define BOOT_TARGET_DEVICES_USB(func) +#endif + +#ifdef CONFIG_MMC +#define BOOT_TARGET_DEVICES_MMC(func, instance) func(MMC, mmc, instance) +#else +#define BOOT_TARGET_DEVICES_MMC(func) +#endif + +#ifdef CONFIG_SCSI +#define BOOT_TARGET_DEVICES_SCSI(func) func(SCSI, scsi, 0) +#else +#define BOOT_TARGET_DEVICES_SCSI(func) +#endif + +#ifdef CONFIG_CMD_DHCP +#define BOOT_TARGET_DEVICES_DHCP(func) func(DHCP, dhcp, na) +#else +#define BOOT_TARGET_DEVICES_DHCP(func) +#endif + #define BOOT_TARGET_DEVICES(func) \ - func(USB, usb, 0) \ - func(MMC, mmc, 0) \ - func(MMC, mmc, 1) \ - func(SCSI, scsi, 0) \ - func(DHCP, dhcp, na) + BOOT_TARGET_DEVICES_USB(func) \ + BOOT_TARGET_DEVICES_MMC(func, 0) \ + BOOT_TARGET_DEVICES_MMC(func, 1) \ + BOOT_TARGET_DEVICES_SCSI(func) \ + BOOT_TARGET_DEVICES_DHCP(func) #include #endif /* __LX2_COMMON_H */ -- cgit v1.3.1