boards: siemens: iot2050: SM variant, sysinfo support, fixes & cleanups
Subsystems (3)
v2 cover boards: siemens: iot2050: SM variant, sysinfo support, fixes & cleanups
Changes in v2:
- rebased over master, adding the missing 6.12 cherry-picks from devicetree-rebasing
This adds support for the new IOT2050 SM variant, introduces a sysinfo driver which also permits SMBIOS support and switches the board to OF_UPSTREAM. There are some further fixes for the boards included as well.
Not yet included is configuration support for DMA isolation via the PVU as this depends on not yet merged DT bindings and another overlay.
Jan
Baocheng Su (5):
board: siemens: iot2050: Fix coding style
board: siemens: iot2050: Control pcie power for all variants
board: siemens: iot2050: Pass DDR size from FSBL
board: siemens: iot2050: Generalize the fdt fixup
board: iot2050: Support new IOT2050-SM variant
Jan Kiszka (5):
board: siemens: iot2050: Fix mistake in list of writable env vars
board: siemens: iot2050: Stop using special spl DT sources
arm64: dts: ti: iot2050: Add overlays for M.2 used by firmware
board: siemens: iot2050: Migrate to OF_UPSTREAM
smbios: Fill UUID from sysinfo when available
Li Hua Qian (3):
arm64: dts: ti: iot2050: Disable lock-step for all iot2050 boards
sysinfo: Add driver for IOT2050 boards
board: siemens: iot2050: Use sysinfo for board initialization
arch/arm/dts/Makefile | 8 - arch/arm/dts/k3-am65-iot2050-boot-image.dtsi | 19 +- arch/arm/dts/k3-am65-iot2050-common-pg1.dtsi | 46 -- arch/arm/dts/k3-am65-iot2050-common-pg2.dtsi | 51 -- .../dts/k3-am65-iot2050-common-u-boot.dtsi | 18 + arch/arm/dts/k3-am65-iot2050-common.dtsi | 738 ------------------ arch/arm/dts/k3-am65-iot2050-spl.dts | 17 - .../dts/k3-am6528-iot2050-basic-common.dtsi | 61 -- arch/arm/dts/k3-am6528-iot2050-basic-pg2.dts | 24 - arch/arm/dts/k3-am6528-iot2050-basic.dts | 24 - .../k3-am6548-iot2050-advanced-common.dtsi | 52 -- .../arm/dts/k3-am6548-iot2050-advanced-m2.dts | 119 --- .../dts/k3-am6548-iot2050-advanced-pg2.dts | 29 - .../k3-am6548-iot2050-advanced-sm-u-boot.dtsi | 1 + arch/arm/dts/k3-am6548-iot2050-advanced.dts | 24 - arch/arm/mach-k3/am65x/Kconfig | 2 + board/siemens/iot2050/board.c | 226 ++++-- configs/iot2050_defconfig | 7 +- doc/board/siemens/iot2050.rst | 7 +- drivers/sysinfo/Kconfig | 7 + drivers/sysinfo/Makefile | 1 + drivers/sysinfo/iot2050.c | 143 ++++ drivers/sysinfo/iot2050.h | 26 + .../arm64/ti/k3-am65-iot2050-common-pg2.dtsi | 5 - .../src/arm64/ti/k3-am65-iot2050-common.dtsi | 5 + .../src/arm64/ti/k3-am6528-iot2050-basic.dts | 5 - ...48-iot2050-advanced-m2-bkey-ekey-pcie.dtso | 2 +- ...-am6548-iot2050-advanced-m2-bkey-usb3.dtso | 2 +- include/configs/iot2050.h | 5 +- include/sysinfo.h | 1 + lib/smbios.c | 4 + 31 files changed, 379 insertions(+), 1300 deletions(-) delete mode 100644 arch/arm/dts/k3-am65-iot2050-common-pg1.dtsi delete mode 100644 arch/arm/dts/k3-am65-iot2050-common-pg2.dtsi delete mode 100644 arch/arm/dts/k3-am65-iot2050-common.dtsi delete mode 100644 arch/arm/dts/k3-am65-iot2050-spl.dts delete mode 100644 arch/arm/dts/k3-am6528-iot2050-basic-common.dtsi delete mode 100644 arch/arm/dts/k3-am6528-iot2050-basic-pg2.dts delete mode 100644 arch/arm/dts/k3-am6528-iot2050-basic.dts delete mode 100644 arch/arm/dts/k3-am6548-iot2050-advanced-common.dtsi delete mode 100644 arch/arm/dts/k3-am6548-iot2050-advanced-m2.dts delete mode 100644 arch/arm/dts/k3-am6548-iot2050-advanced-pg2.dts create mode 120000 arch/arm/dts/k3-am6548-iot2050-advanced-sm-u-boot.dtsi delete mode 100644 arch/arm/dts/k3-am6548-iot2050-advanced.dts create mode 100644 drivers/sysinfo/iot2050.c create mode 100644 drivers/sysinfo/iot2050.h rename arch/arm/dts/k3-am6548-iot2050-advanced-m2-bkey-ekey-pcie-overlay.dtso => dts/upstream/src/arm64/ti/k3-am6548-iot2050-advanced-m2-bkey-ekey-pcie.dtso (92%) rename arch/arm/dts/k3-am6548-iot2050-advanced-m2-bkey-usb3-overlay.dtso => dts/upstream/src/arm64/ti/k3-am6548-iot2050-advanced-m2-bkey-usb3.dtso (96%)
Signature · 1 line
2.43.0
PATCH v2 1/13 board: siemens: iot2050: Fix mistake in list of writable env vars
From: Jan Kiszka <[email protected]>
This prevented to set m2_manual_config - as evaluated by m2_connector_setup - under strict configurations for secure boot.
--- include/configs/iot2050.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/configs/iot2050.h +1 -1
@@ -39,7 +39,7 @@#define CFG_ENV_FLAGS_LIST_STATIC \ "board_uuid:sw,board_name:sw,board_serial:sw,board_a5e:sw," \ "mlfb:sw,fw_version:sw,seboot_version:sw," \ - "m2_manuel_config:sw," \ + "m2_manual_config:sw," \ "eth1addr:mw,eth2addr:mw,watchdog_timeout_ms:dw,boot_targets:sw"#endif
Signature · 1 line
2.43.0
PATCH v2 2/13 board: siemens: iot2050: Fix coding style
In reply to Jan KiszkaFrom: Baocheng Su <[email protected]>
Add a space after the 'if'
--- board/siemens/iot2050/board.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
board/siemens/iot2050/board.c +1 -1
@@ -220,7 +220,7 @@ void set_board_info_env(void)if (board_is_advanced ()) {if (board_is_pg1 ()) fdtfile ="ti/k3-am6548-iot2050-advanced.dtb" ; -else if (board_is_m2 ()) +else if (board_is_m2 ()) fdtfile ="ti/k3-am6548-iot2050-advanced-m2.dtb" ;else fdtfile ="ti/k3-am6548-iot2050-advanced-pg2.dtb" ;
Signature · 1 line
2.43.0
PATCH v2 3/13 board: siemens: iot2050: Control pcie power for all variants
In reply to Jan KiszkaFrom: Baocheng Su <[email protected]>
The power control pin of pcie interface not only works for M.2 interface but also for miniPCIE, so promote this logic to all variants to workaround the module hang issue.
--- board/siemens/iot2050/board.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
board/siemens/iot2050/board.c +8 -4
@@ -185,6 +185,12 @@ static void remove_mmc1_target(void)free (boot_targets); } +static void enable_pcie_connector_power (void ) +{ +set_pinvalue ("gpio@601000_17" ,"P3V3_PCIE_CON_EN" ,1 ); +udelay (4 *100 ); +} +void set_board_info_env (void ) {struct iot2050_info *info =IOT2050_INFO_DATA ;
@@ -288,10 +294,6 @@ static void m2_connector_setup(void)struct m2_config_pins config_pins;unsigned int n; -/* enable M.2 connector power */ -set_pinvalue ("gpio@601000_17" ,"P3V3_M2_EN" ,1 ); -udelay (4 *100 ); -if (m2_manual_config <CONNECTOR_MODE_INVALID ) { mode_info =" [manual mode]" ; connector_mode = m2_manual_config;
@@ -429,6 +431,8 @@ int board_late_init(void)/* change CTRL_MMR register to let serdes0 not output USB3.0 signals. */ writel (0x3 ,SERDES0_LANE_SELECT ); +enable_pcie_connector_power (); +if (board_is_m2 ())m2_connector_setup ();
Signature · 1 line
2.43.0
PATCH v2 4/13 board: siemens: iot2050: Pass DDR size from FSBL
In reply to Jan KiszkaFrom: Baocheng Su <[email protected]>
Due to new DDR size introduction, the current logic of determining the DDR size is not able to get the correct size.
Instead, the DDR size is determined by the FSBL(SEBOOT) then passed to u-boot through the scratchpad info.
The SEBoot version must be >= D/V01.04.01.02 to support this change.
Also now for some variants, the DDR size may > 2GB, so borrow some code from the TI evm to iot2050 to support more than 2GB DDR.
--- board/siemens/iot2050/board.c | 39 ++++++++++++++++++++++++++--------- doc/board/siemens/iot2050.rst | 3 +++ include/configs/iot2050.h | 3 +++ 3 files changed, 35 insertions(+), 10 deletions(-)
board/siemens/iot2050/board.c +29 -10
@@ -38,6 +38,8 @@ struct iot2050_info {u8 mac_addr_cnt;u8 mac_addr[8 ][ARP_HLEN ];char seboot_version[40 +1 ]; +u8 padding[3 ]; +u32 ddr_size_mb; } __packed;/*
@@ -341,25 +343,42 @@ int board_init(void)int dram_init (void ) { -if (board_is_advanced ()) - gd->ram_size =SZ_2G ; -else - gd->ram_size =SZ_1G ; +struct iot2050_info *info =IOT2050_INFO_DATA ; + gd->ram_size = ((phys_size_t)(info->ddr_size_mb)) <<20 ;return 0 ; } +ulong board_get_usable_ram_top (ulong total_size) +{ +/* Limit RAM used by U-Boot to the DDR low region */ +if (gd->ram_top >0x100000000 ) +return 0x100000000 ; + +return gd->ram_top; +} +int dram_init_banksize (void ) {dram_init (); -/* Bank 0 declares the memory available in the DDR low region */ - gd->bd->bi_dram[0 ].start =CFG_SYS_SDRAM_BASE ; - gd->bd->bi_dram[0 ].size = gd->ram_size; +if (gd->ram_size >SZ_2G ) { +/* Bank 0 declares the memory available in the DDR low region */ + gd->bd->bi_dram[0 ].start =CFG_SYS_SDRAM_BASE ; + gd->bd->bi_dram[0 ].size =SZ_2G ; + +/* Bank 1 declares the memory available in the DDR high region */ + gd->bd->bi_dram[1 ].start =CFG_SYS_SDRAM_BASE1 ; + gd->bd->bi_dram[1 ].size = gd->ram_size -SZ_2G ; + }else { +/* Bank 0 declares the memory available in the DDR low region */ + gd->bd->bi_dram[0 ].start =CFG_SYS_SDRAM_BASE ; + gd->bd->bi_dram[0 ].size = gd->ram_size; -/* Bank 1 declares the memory available in the DDR high region */ - gd->bd->bi_dram[1 ].start =0 ; - gd->bd->bi_dram[1 ].size =0 ; +/* Bank 1 declares the memory available in the DDR high region */ + gd->bd->bi_dram[1 ].start =0 ; + gd->bd->bi_dram[1 ].size =0 ; + }return 0 ; }
doc/board/siemens/iot2050.rst +3 -0
@@ -29,6 +29,9 @@ The following binaries from that source need to be present in the build folder: - seboot_pg1.bin - seboot_pg2.bin +Note that SE-Boot D/V01.04.01.02 or greater is required, otherwise the DDR size +will not be picked up correctly by U-Boot. + When using the watchdog, a related firmware for the R5 core(s) is needed, e.g. https://github.com/siemens/k3-rti-wdt. The name and location of the image is configured via CONFIG_WDT_K3_RTI_FW_FILE.
include/configs/iot2050.h +3 -0
@@ -24,6 +24,9 @@ func(USB, usb, 2)#endif +/* DDR Configuration */ +#define CFG_SYS_SDRAM_BASE1 0x880000000 +/* * This defines all MMC devices, even if the basic variant has no mmc1. * The non-supported device will be removed from the boot targets during
Signature · 1 line
2.43.0
PATCH v2 5/13 board: siemens: iot2050: Generalize the fdt fixup
In reply to Jan KiszkaFrom: Baocheng Su <[email protected]>
The fdt fixup logic actually also applies to other possible variants who also have device tree overlays. So generalize this part by extracting it from the m.2 specific function and make it a standalone one.
Since now we only have M.2 variant consuming the overlay, it may not have immediate effect for other variant, however this makes the future variant more easier to apply fdt fixups.
--- board/siemens/iot2050/board.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-)
board/siemens/iot2050/board.c +19 -13
@@ -245,23 +245,14 @@ void set_board_info_env(void)env_save (); } -static void m2_overlay_prepare (void ) +static void do_overlay_prepare (const char *overlay_path) {#if defined(CONFIG_OF_LIBFDT ) && defined(CONFIG_OF_BOARD_SETUP ) -const char *overlay_path;void *overlay;u64 loadaddr;ofnode node;int ret; -if (connector_mode ==BKEY_PCIEX2 ) -return ; - -if (connector_mode ==BKEY_PCIE_EKEY_PCIE ) - overlay_path ="/fit-images/bkey-ekey-pcie-overlay" ; -else - overlay_path ="/fit-images/bkey-usb3-overlay" ; - node =ofnode_path (overlay_path);if (!ofnode_valid (node)) goto fit_error;
@@ -288,6 +279,21 @@ fit_error:#endif } +static void m2_overlay_prepare (void ) +{ +const char *overlay_path; + +if (connector_mode ==BKEY_PCIEX2 ) +return ; + +if (connector_mode ==BKEY_PCIE_EKEY_PCIE ) + overlay_path ="/fit-images/bkey-ekey-pcie-overlay" ; +else + overlay_path ="/fit-images/bkey-usb3-overlay" ; + +do_overlay_prepare (overlay_path); +} +static void m2_connector_setup (void ) { ulong m2_manual_config = env_get_ulong("m2_manual_config", 10,
@@ -466,7 +472,7 @@ int board_late_init(void) }#if defined(CONFIG_OF_LIBFDT ) && defined(CONFIG_OF_BOARD_SETUP ) -static void m2_fdt_fixup (void *blob) +static void variants_fdt_fixup (void *blob) {void *overlay_copy =NULL ;void *fdt_copy =NULL ;
@@ -506,14 +512,14 @@ cleanup:return ; fixup_error: -pr_err ("Could not apply M.2 device tree overlay\n" ); +pr_err ("Could not apply device tree overlay\n" ); goto cleanup; }int ft_board_setup (void *blob,struct bd_info *bd) {if (board_is_m2 ()) -m2_fdt_fixup (blob); +variants_fdt_fixup (blob);return 0 ; }
Signature · 1 line
2.43.0
PATCH v2 6/13 board: siemens: iot2050: Stop using special spl DT sources
In reply to Jan KiszkaFrom: Jan Kiszka <[email protected]>
We can simply use the default DT, Basic PG1, because no nodes that are different between the variants play a role for SPL. Will help with the migration to OF_UPSTREAM.
--- arch/arm/dts/Makefile | 1 - arch/arm/dts/k3-am65-iot2050-boot-image.dtsi | 4 ++-- arch/arm/dts/k3-am65-iot2050-spl.dts | 17 ----------------- configs/iot2050_defconfig | 1 - 4 files changed, 2 insertions(+), 21 deletions(-) delete mode 100644 arch/arm/dts/k3-am65-iot2050-spl.dts
arch/arm/dts/Makefile +0 -1
@@ -1163,7 +1163,6 @@ dtb-$(CONFIG_STM32MP25X) += \ dtb-$(CONFIG_SOC_K3_AM654) += \ k3-am654-base-board.dtb \ k3-am654-r5-base-board.dtb \ - k3-am65-iot2050-spl.dtb \ k3-am6528-iot2050-basic.dtb \ k3-am6528-iot2050-basic-pg2.dtb \ k3-am6548-iot2050-advanced.dtb \
arch/arm/dts/k3-am65-iot2050-boot-image.dtsi +2 -2
@@ -84,12 +84,12 @@ }; fdt-0 { - description = "k3-am65-iot2050-spl.dtb"; + description = "k3-am6528-iot2050-basic.dtb"; type = "flat_dt"; arch = "arm"; compression = "none"; blob-ext { - filename = "spl/dts/k3-am65-iot2050-spl.dtb"; + filename = "spl/dts/k3-am6528-iot2050-basic.dtb"; }; }; };
arch/arm/dts/k3-am65-iot2050-spl.dts deleted +0 -17
@@ -1,17 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Copyright (c) Siemens AG, 2018-2021 - * - * Authors: - * Jan Kiszka <[email protected]> - */ - -/dts-v1/; - -#include "k3-am65-iot2050-common.dtsi" -#include "k3-am65-iot2050-common-u-boot.dtsi" - -/ { - compatible = "siemens,iot2050", "ti,am654"; - model = "Siemens IOT2050"; -};
configs/iot2050_defconfig +0 -1
@@ -80,7 +80,6 @@ CONFIG_CMD_TIME=y CONFIG_OF_CONTROL=y CONFIG_SPL_OF_CONTROL=y CONFIG_SPL_MULTI_DTB_FIT=y -CONFIG_SPL_OF_LIST="k3-am65-iot2050-spl" CONFIG_SPL_MULTI_DTB_FIT_NO_COMPRESSION=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
Signature · 1 line
2.43.0
PATCH v2 7/13 arm64: dts: ti: iot2050: Disable lock-step for all iot2050 boards
In reply to Jan KiszkaFrom: Li Hua Qian <[email protected]>
The PG1 A variant of the iot2050 series has been identified which partially lacks support for lock-step mode. This implies that all iot2050 boards can't support this mode. As a result, lock-step mode has been disabled across all iot2050 boards for consistency and to avoid potential issues.
[ upstream commit: e0133f883cf115d9e97e704169a9fb6003caefb2 ]
(cherry picked from commit 4b4872feb66a9043741819a57af280ffb4a96608)
--- dts/upstream/src/arm64/ti/k3-am65-iot2050-common-pg2.dtsi | 5 ----- dts/upstream/src/arm64/ti/k3-am65-iot2050-common.dtsi | 5 +++++ dts/upstream/src/arm64/ti/k3-am6528-iot2050-basic.dts | 5 ----- 3 files changed, 5 insertions(+), 10 deletions(-)
dts/upstream/src/arm64/ti/k3-am65-iot2050-common-pg2.dtsi +0 -5
@@ -9,11 +9,6 @@ * Common bits of the IOT2050 Basic and Advanced variants, PG2 */ -&mcu_r5fss0 { - /* lock-step mode not supported on PG2 boards */ - ti,cluster-mode = <0>; -}; - &main_pmx0 { cp2102n_reset_pin_default: cp2102n-reset-default-pins { pinctrl-single,pins = <
dts/upstream/src/arm64/ti/k3-am65-iot2050-common.dtsi +5 -0
@@ -635,3 +635,8 @@ ti,fifo-depth = <DP83867_PHYCR_FIFO_DEPTH_4_B_NIB>; }; }; + +&mcu_r5fss0 { + /* lock-step mode not supported on iot2050 boards */ + ti,cluster-mode = <0>; +};
dts/upstream/src/arm64/ti/k3-am6528-iot2050-basic.dts +0 -5
@@ -22,8 +22,3 @@ compatible = "siemens,iot2050-basic", "ti,am654"; model = "SIMATIC IOT2050 Basic"; }; - -&mcu_r5fss0 { - /* lock-step mode not supported on this board */ - ti,cluster-mode = <0>; -};
Signature · 1 line
2.43.0
PATCH v2 8/13 arm64: dts: ti: iot2050: Add overlays for M.2 used by firmware
In reply to Jan KiszkaFrom: Jan Kiszka <[email protected]>
To allow firmware to pick up all DTs from here, move the overlays that are normally applied during DT fixup to the kernel source as well. Hook then into the build nevertheless to ensure that regular checks are performed.
[ upstream commit: dba27d026fc841d28a0ed373f617cc84ec0e4504 ]
(cherry picked from commit 741915246a92fc4c21537f9623a69612f7cef03a)
--- ...48-iot2050-advanced-m2-bkey-ekey-pcie.dtso | 27 +++++++++++ ...-am6548-iot2050-advanced-m2-bkey-usb3.dtso | 47 +++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 dts/upstream/src/arm64/ti/k3-am6548-iot2050-advanced-m2-bkey-ekey-pcie.dtso create mode 100644 dts/upstream/src/arm64/ti/k3-am6548-iot2050-advanced-m2-bkey-usb3.dtso
dts/upstream/src/arm64/ti/k3-am6548-iot2050-advanced-m2-bkey-ekey-pcie.dtso new file +27 -0
@@ -0,0 +1,27 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * IOT2050 M.2 variant, overlay for B-key PCIE0_LANE0 + E-key PCIE1_LANE0 + * Copyright (c) Siemens AG, 2022-2024 + * + * Authors: + * Chao Zeng <[email protected]> + * Jan Kiszka <[email protected]> + */ + +/dts-v1/; +/plugin/; + +#include <dt-bindings/phy/phy.h> +#include <dt-bindings/gpio/gpio.h> + +&pcie0_rc { + num-lanes = <1>; + phys = <&serdes0 PHY_TYPE_PCIE 1>; + phy-names = "pcie-phy0"; + reset-gpios = <&main_gpio1 15 GPIO_ACTIVE_HIGH>; + status = "okay"; +}; + +&pcie1_rc { + status = "okay"; +};
dts/upstream/src/arm64/ti/k3-am6548-iot2050-advanced-m2-bkey-usb3.dtso new file +47 -0
47 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH v2 9/13 board: siemens: iot2050: Migrate to OF_UPSTREAM
In reply to Jan KiszkaFrom: Jan Kiszka <[email protected]>
This requires some tweaking of the defconfig and board_fit_config_name_match so that the new sources are taken into account.
--- arch/arm/dts/Makefile | 7 - arch/arm/dts/k3-am65-iot2050-boot-image.dtsi | 16 +- arch/arm/dts/k3-am65-iot2050-common-pg1.dtsi | 46 -- arch/arm/dts/k3-am65-iot2050-common-pg2.dtsi | 51 -- arch/arm/dts/k3-am65-iot2050-common.dtsi | 738 ------------------ .../dts/k3-am6528-iot2050-basic-common.dtsi | 61 -- arch/arm/dts/k3-am6528-iot2050-basic-pg2.dts | 24 - arch/arm/dts/k3-am6528-iot2050-basic.dts | 24 - .../k3-am6548-iot2050-advanced-common.dtsi | 52 -- ...50-advanced-m2-bkey-ekey-pcie-overlay.dtso | 27 - ...iot2050-advanced-m2-bkey-usb3-overlay.dtso | 47 -- .../arm/dts/k3-am6548-iot2050-advanced-m2.dts | 119 --- .../dts/k3-am6548-iot2050-advanced-pg2.dts | 29 - arch/arm/dts/k3-am6548-iot2050-advanced.dts | 24 - board/siemens/iot2050/board.c | 4 +- configs/iot2050_defconfig | 6 +- 16 files changed, 15 insertions(+), 1260 deletions(-) delete mode 100644 arch/arm/dts/k3-am65-iot2050-common-pg1.dtsi delete mode 100644 arch/arm/dts/k3-am65-iot2050-common-pg2.dtsi delete mode 100644 arch/arm/dts/k3-am65-iot2050-common.dtsi delete mode 100644 arch/arm/dts/k3-am6528-iot2050-basic-common.dtsi delete mode 100644 arch/arm/dts/k3-am6528-iot2050-basic-pg2.dts delete mode 100644 arch/arm/dts/k3-am6528-iot2050-basic.dts delete mode 100644 arch/arm/dts/k3-am6548-iot2050-advanced-common.dtsi delete mode 100644 arch/arm/dts/k3-am6548-iot2050-advanced-m2-bkey-ekey-pcie-overlay.dtso delete mode 100644 arch/arm/dts/k3-am6548-iot2050-advanced-m2-bkey-usb3-overlay.dtso delete mode 100644 arch/arm/dts/k3-am6548-iot2050-advanced-m2.dts delete mode 100644 arch/arm/dts/k3-am6548-iot2050-advanced-pg2.dts delete mode 100644 arch/arm/dts/k3-am6548-iot2050-advanced.dts
arch/arm/dts/Makefile +0 -7
@@ -1163,13 +1163,6 @@ dtb-$(CONFIG_STM32MP25X) += \ dtb-$(CONFIG_SOC_K3_AM654) += \ k3-am654-base-board.dtb \ k3-am654-r5-base-board.dtb \ - k3-am6528-iot2050-basic.dtb \ - k3-am6528-iot2050-basic-pg2.dtb \ - k3-am6548-iot2050-advanced.dtb \ - k3-am6548-iot2050-advanced-pg2.dtb \ - k3-am6548-iot2050-advanced-m2.dtb \ - k3-am6548-iot2050-advanced-m2-bkey-usb3-overlay.dtbo \ - k3-am6548-iot2050-advanced-m2-bkey-ekey-pcie-overlay.dtbo \ k3-am654-icssg2.dtbo dtb-$(CONFIG_SOC_K3_J721E) += k3-j721e-r5-common-proc-board.dtb \
arch/arm/dts/k3-am65-iot2050-boot-image.dtsi +8 -8
@@ -84,12 +84,12 @@ }; fdt-0 { - description = "k3-am6528-iot2050-basic.dtb"; + description = "ti/k3-am6528-iot2050-basic.dtb"; type = "flat_dt"; arch = "arm"; compression = "none"; blob-ext { - filename = "spl/dts/k3-am6528-iot2050-basic.dtb"; + filename = "spl/dts/ti/k3-am6528-iot2050-basic.dtb"; }; }; };
@@ -205,10 +205,10 @@ }; fit@380000 { - fit,fdt-list-val = "k3-am6528-iot2050-basic", "k3-am6548-iot2050-advanced"; + fit,fdt-list-val = "ti/k3-am6528-iot2050-basic", "ti/k3-am6548-iot2050-advanced"; configurations { - default = "k3-am6528-iot2050-basic"; + default = "ti/k3-am6528-iot2050-basic"; @config-SEQ { loadables = #ifdef CONFIG_WDT_K3_RTI_FW_FILE
@@ -229,7 +229,7 @@ }; fit@380000 { - fit,fdt-list-val = "k3-am6528-iot2050-basic-pg2", "k3-am6548-iot2050-advanced-pg2", "k3-am6548-iot2050-advanced-m2"; + fit,fdt-list-val = "ti/k3-am6528-iot2050-basic-pg2", "ti/k3-am6548-iot2050-advanced-pg2", "ti/k3-am6548-iot2050-advanced-m2"; images { bkey-usb3-overlay {
@@ -239,7 +239,7 @@ arch = "arm64"; compression = "none"; blob-ext { - filename = "k3-am6548-iot2050-advanced-m2-bkey-usb3-overlay.dtbo"; + filename = "ti/k3-am6548-iot2050-advanced-m2-bkey-usb3.dtbo"; }; hash { algo = "sha256";
@@ -253,7 +253,7 @@ arch = "arm64"; compression = "none"; blob-ext { - filename = "k3-am6548-iot2050-advanced-m2-bkey-ekey-pcie-overlay.dtbo"; + filename = "ti/k3-am6548-iot2050-advanced-m2-bkey-ekey-pcie.dtbo"; }; hash { algo = "sha256";
@@ -262,7 +262,7 @@ }; configurations { - default = "k3-am6528-iot2050-basic-pg2"; + default = "ti/k3-am6528-iot2050-basic-pg2"; @config-SEQ { loadables = #ifdef CONFIG_WDT_K3_RTI_FW_FILE
arch/arm/dts/k3-am65-iot2050-common-pg1.dtsi deleted +0 -46
46 lines not on this page · raw message
arch/arm/dts/k3-am65-iot2050-common-pg2.dtsi deleted +0 -51
51 lines not on this page · raw message
arch/arm/dts/k3-am65-iot2050-common.dtsi deleted +0 -738
738 lines not on this page · raw message
arch/arm/dts/k3-am6528-iot2050-basic-common.dtsi deleted +0 -61
61 lines not on this page · raw message
arch/arm/dts/k3-am6528-iot2050-basic-pg2.dts deleted +0 -24
@@ -1,24 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Copyright (c) Siemens AG, 2018-2021 - * - * Authors: - * Le Jin <[email protected]> - * Jan Kiszka <[email protected]> - * - * AM6528-based (dual-core) IOT2050 Basic variant, Product Generation 2 - * 1 GB RAM, no eMMC, main_uart0 on connector X30 - * - * Product homepage: - * https://new.siemens.com/global/en/products/automation/pc-based/iot-gateways/simatic-iot2050.html - */ - -/dts-v1/; - -#include "k3-am6528-iot2050-basic-common.dtsi" -#include "k3-am65-iot2050-common-pg2.dtsi" - -/ { - compatible = "siemens,iot2050-basic-pg2", "ti,am654"; - model = "SIMATIC IOT2050 Basic PG2"; -};
arch/arm/dts/k3-am6528-iot2050-basic.dts deleted +0 -24
@@ -1,24 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Copyright (c) Siemens AG, 2018-2021 - * - * Authors: - * Le Jin <[email protected]> - * Jan Kiszka <[email protected]> - * - * AM6528-based (dual-core) IOT2050 Basic variant, Product Generation 1 - * 1 GB RAM, no eMMC, main_uart0 on connector X30 - * - * Product homepage: - * https://new.siemens.com/global/en/products/automation/pc-based/iot-gateways/simatic-iot2050.html - */ - -/dts-v1/; - -#include "k3-am6528-iot2050-basic-common.dtsi" -#include "k3-am65-iot2050-common-pg1.dtsi" - -/ { - compatible = "siemens,iot2050-basic", "ti,am654"; - model = "SIMATIC IOT2050 Basic"; -};
arch/arm/dts/k3-am6548-iot2050-advanced-common.dtsi deleted +0 -52
52 lines not on this page · raw message
arch/arm/dts/k3-am6548-iot2050-advanced-m2-bkey-ekey-pcie-overlay.dtso deleted +0 -27
@@ -1,27 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * IOT2050 M.2 variant, overlay for B-key PCIE0_LANE0 + E-key PCIE1_LANE0 - * Copyright (c) Siemens AG, 2022 - * - * Authors: - * Chao Zeng <[email protected]> - * Jan Kiszka <[email protected]> - */ - -/dts-v1/; -/plugin/; - -#include <dt-bindings/phy/phy.h> -#include <dt-bindings/gpio/gpio.h> - -&pcie0_rc { - num-lanes = <1>; - phys = <&serdes0 PHY_TYPE_PCIE 1>; - phy-names = "pcie-phy0"; - reset-gpios = <&main_gpio1 15 GPIO_ACTIVE_HIGH>; - status = "okay"; -}; - -&pcie1_rc { - status = "okay"; -};
arch/arm/dts/k3-am6548-iot2050-advanced-m2-bkey-usb3-overlay.dtso deleted +0 -47
47 lines not on this page · raw message
arch/arm/dts/k3-am6548-iot2050-advanced-m2.dts deleted +0 -119
119 lines not on this page · raw message
arch/arm/dts/k3-am6548-iot2050-advanced-pg2.dts deleted +0 -29
@@ -1,29 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Copyright (c) Siemens AG, 2018-2021 - * - * Authors: - * Le Jin <[email protected]> - * Jan Kiszka <[email protected]> - * - * AM6548-based (quad-core) IOT2050 Advanced variant, Product Generation 2 - * 2 GB RAM, 16 GB eMMC, USB-serial converter on connector X30 - * - * Product homepage: - * https://new.siemens.com/global/en/products/automation/pc-based/iot-gateways/simatic-iot2050.html - */ - -/dts-v1/; - -#include "k3-am6548-iot2050-advanced-common.dtsi" -#include "k3-am65-iot2050-common-pg2.dtsi" - -/ { - compatible = "siemens,iot2050-advanced-pg2", "ti,am654"; - model = "SIMATIC IOT2050 Advanced PG2"; -}; - -&mcu_r5fss0 { - /* lock-step mode not supported on this board */ - ti,cluster-mode = <0>; -};
arch/arm/dts/k3-am6548-iot2050-advanced.dts deleted +0 -24
@@ -1,24 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Copyright (c) Siemens AG, 2018-2021 - * - * Authors: - * Le Jin <[email protected]> - * Jan Kiszka <[email protected]> - * - * AM6548-based (quad-core) IOT2050 Advanced variant, Product Generation 1 - * 2 GB RAM, 16 GB eMMC, USB-serial converter on connector X30 - * - * Product homepage: - * https://new.siemens.com/global/en/products/automation/pc-based/iot-gateways/simatic-iot2050.html - */ - -/dts-v1/; - -#include "k3-am6548-iot2050-advanced-common.dtsi" -#include "k3-am65-iot2050-common-pg1.dtsi" - -/ { - compatible = "siemens,iot2050-advanced", "ti,am654"; - model = "SIMATIC IOT2050 Advanced"; -};
board/siemens/iot2050/board.c +2 -2
@@ -395,8 +395,8 @@ int board_fit_config_name_match(const char *name)struct iot2050_info *info =IOT2050_INFO_DATA ;char upper_name[32 ]; -/* skip the prefix "k3-am65x8-" */ - name +=10 ; +/* skip the prefix "ti/k3-am65x8-" */ + name +=13 ;if (info->magic !=IOT2050_INFO_MAGIC ||strlen (name) >=sizeof (upper_name))
configs/iot2050_defconfig +5 -1
@@ -17,7 +17,7 @@ CONFIG_ENV_OFFSET=0x680000 CONFIG_ENV_SECT_SIZE=0x20000 CONFIG_DM_GPIO=y CONFIG_SPL_DM_SPI=y -CONFIG_DEFAULT_DEVICE_TREE="k3-am6528-iot2050-basic" +CONFIG_DEFAULT_DEVICE_TREE="ti/k3-am6528-iot2050-basic" CONFIG_SPL_TEXT_BASE=0x80080000 CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_DM_RESET=y
@@ -79,7 +79,11 @@ CONFIG_CMD_TIME=y # CONFIG_ISO_PARTITION is not set CONFIG_OF_CONTROL=y CONFIG_SPL_OF_CONTROL=y +CONFIG_OF_UPSTREAM=y +CONFIG_OF_LIST="ti/k3-am6528-iot2050-basic ti/k3-am6528-iot2050-basic-pg2 ti/k3-am6548-iot2050-advanced ti/k3-am6548-iot2050-advanced-pg2 ti/k3-am6548-iot2050-advanced-m2" +CONFIG_OF_OVERLAY_LIST="ti/k3-am6548-iot2050-advanced-m2-bkey-usb3 ti/k3-am6548-iot2050-advanced-m2-bkey-ekey-pcie" CONFIG_SPL_MULTI_DTB_FIT=y +CONFIG_SPL_OF_LIST="ti/k3-am6528-iot2050-basic" CONFIG_SPL_MULTI_DTB_FIT_NO_COMPRESSION=y CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
Signature · 1 line
2.43.0
PATCH v2 10/13 board: iot2050: Support new IOT2050-SM variant
In reply to Jan KiszkaFrom: Baocheng Su <[email protected]>
Main differences between the new variant and Advanced PG2:
1. Arduino interface is removed. Instead, an new ASIC is added for communicating with PLC 1200 signal modules.
2. USB 3.0 type A connector is removed, only USB 2.0 type A connector is avaiable.
3. DP interface is tailored down. Instead, to communicate with the PLC 1200 signal modules, a USB 3.0 type B connector is added but the signal is not USB.
4. DDR size is increased to 4 GB.
5. Two sensors are added, one tilt sensor and one light sensor.
--- arch/arm/dts/k3-am65-iot2050-boot-image.dtsi | 5 ++++- .../dts/k3-am6548-iot2050-advanced-sm-u-boot.dtsi | 1 + board/siemens/iot2050/board.c | 15 ++++++++++++++- configs/iot2050_defconfig | 2 +- doc/board/siemens/iot2050.rst | 4 +++- 5 files changed, 23 insertions(+), 4 deletions(-) create mode 120000 arch/arm/dts/k3-am6548-iot2050-advanced-sm-u-boot.dtsi
arch/arm/dts/k3-am65-iot2050-boot-image.dtsi +4 -1
@@ -229,7 +229,10 @@ }; fit@380000 { - fit,fdt-list-val = "ti/k3-am6528-iot2050-basic-pg2", "ti/k3-am6548-iot2050-advanced-pg2", "ti/k3-am6548-iot2050-advanced-m2"; + fit,fdt-list-val = "ti/k3-am6528-iot2050-basic-pg2", + "ti/k3-am6548-iot2050-advanced-pg2", + "ti/k3-am6548-iot2050-advanced-m2", + "ti/k3-am6548-iot2050-advanced-sm"; images { bkey-usb3-overlay {
arch/arm/dts/k3-am6548-iot2050-advanced-sm-u-boot.dtsi new file +1 -0
@@ -0,0 +1 @@ +k3-am6528-iot2050-basic-pg2-u-boot.dtsi
board/siemens/iot2050/board.c +14 -1
@@ -174,6 +174,14 @@ static bool board_is_m2(void)strcmp ((char *)info->name,"IOT2050-ADVANCED-M2" ) ==0 ; } +static bool board_is_sm (void ) +{ +struct iot2050_info *info =IOT2050_INFO_DATA ; + +return info->magic ==IOT2050_INFO_MAGIC && +strcmp ((char *)info->name,"IOT2050-ADVANCED-SM" ) ==0 ; +} +static void remove_mmc1_target (void ) {char *boot_targets =strdup (env_get ("boot_targets" ));
@@ -189,7 +197,10 @@ static void remove_mmc1_target(void)static void enable_pcie_connector_power (void ) { -set_pinvalue ("gpio@601000_17" ,"P3V3_PCIE_CON_EN" ,1 ); +if (board_is_sm ()) +set_pinvalue ("gpio@601000_22" ,"P3V3_PCIE_CON_EN" ,1 ); +else +set_pinvalue ("gpio@601000_17" ,"P3V3_PCIE_CON_EN" ,1 );udelay (4 *100 ); }
@@ -230,6 +241,8 @@ void set_board_info_env(void) fdtfile ="ti/k3-am6548-iot2050-advanced.dtb" ; else if (board_is_m2()) fdtfile ="ti/k3-am6548-iot2050-advanced-m2.dtb" ; + else if (board_is_sm()) + fdtfile ="ti/k3-am6548-iot2050-advanced-sm.dtb" ; else fdtfile ="ti/k3-am6548-iot2050-advanced-pg2.dtb" ; }else {
configs/iot2050_defconfig +1 -1
@@ -80,7 +80,7 @@ CONFIG_CMD_TIME=y CONFIG_OF_CONTROL=y CONFIG_SPL_OF_CONTROL=y CONFIG_OF_UPSTREAM=y -CONFIG_OF_LIST="ti/k3-am6528-iot2050-basic ti/k3-am6528-iot2050-basic-pg2 ti/k3-am6548-iot2050-advanced ti/k3-am6548-iot2050-advanced-pg2 ti/k3-am6548-iot2050-advanced-m2" +CONFIG_OF_LIST="ti/k3-am6528-iot2050-basic ti/k3-am6528-iot2050-basic-pg2 ti/k3-am6548-iot2050-advanced ti/k3-am6548-iot2050-advanced-pg2 ti/k3-am6548-iot2050-advanced-m2 ti/k3-am6548-iot2050-advanced-sm" CONFIG_OF_OVERLAY_LIST="ti/k3-am6548-iot2050-advanced-m2-bkey-usb3 ti/k3-am6548-iot2050-advanced-m2-bkey-ekey-pcie" CONFIG_SPL_MULTI_DTB_FIT=y CONFIG_SPL_OF_LIST="ti/k3-am6528-iot2050-basic"
doc/board/siemens/iot2050.rst +3 -1
@@ -8,7 +8,9 @@ The SIMATIC IOT2050 is an open industrial IoT gateway that is using the TI AM6528 GP (Basic variant) or the AM6548 HS (Advanced variant). The Advanced variant is prepared for secure boot. M.2 Variant also uses the AM6548 HS. Instead of a MiniPCI connector, it comes with two M.2 connectors and can -support 5G/WIFI/BT applications or connect an SSD. +support 5G/WIFI/BT applications or connect an SSD. Compared with the AM6548 +Advanced variant, SM variant removes the Arduino interface, and adds a new +ASIC for communicating with the PLC 1200 signal modules. The IOT2050 starts only from OSPI. It loads a Siemens-provided bootloader called SE-Boot for the MCU domain (R5F cores), then hands over to ATF and
Signature · 1 line
2.43.0
PATCH v2 11/13 smbios: Fill UUID from sysinfo when available
In reply to Jan KiszkaFrom: Jan Kiszka <[email protected]>
Allow for the sysinfo drivers to provide a system UUID to SMBIOS. Will be first used by the IOT2050 boards.
Based on original patch by Li Hua Qian.
--- include/sysinfo.h | 1 + lib/smbios.c | 4 ++++ 2 files changed, 5 insertions(+)
include/sysinfo.h +1 -0
@@ -49,6 +49,7 @@ enum sysinfo_id {SYSINFO_ID_SMBIOS_SYSTEM_SERIAL ,SYSINFO_ID_SMBIOS_SYSTEM_SKU ,SYSINFO_ID_SMBIOS_SYSTEM_FAMILY , +SYSINFO_ID_SMBIOS_SYSTEM_UUID ,SYSINFO_ID_SMBIOS_BASEBOARD_MANUFACTURER ,SYSINFO_ID_SMBIOS_BASEBOARD_PRODUCT , SYSINFO_ID_SMBIOS_BASEBOARD_VERSION,
lib/smbios.c +4 -0
@@ -387,6 +387,7 @@ static int smbios_write_type1(ulong *current, int handle,struct smbios_type1 *t;int len =sizeof (struct smbios_type1 );char *serial_str =env_get ("serial#" ); +char uuid[sizeof (t->uuid)]; t =map_sysmem (*current, len);memset (t,0 ,sizeof (struct smbios_type1 ));
@@ -409,6 +410,9 @@ static int smbios_write_type1(ulong *current, int handle,SYSINFO_ID_SMBIOS_SYSTEM_SERIAL , NULL); } +if (!sysinfo_get_str (ctx->dev,SYSINFO_ID_SMBIOS_SYSTEM_UUID , +sizeof (uuid), uuid)) +strncpy ((char *)t->uuid, uuid,sizeof (t->uuid)); t->wakeup_type =SMBIOS_WAKEUP_TYPE_UNKNOWN ; t->sku_number =smbios_add_prop_si (ctx,"sku" ,SYSINFO_ID_SMBIOS_SYSTEM_SKU ,NULL );
Signature · 1 line
2.43.0
Re: [PATCH v2 11/13] smbios: Fill UUID from sysinfo when available
Quoted 6 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
Allow for the sysinfo drivers to provide a system UUID to SMBIOS. Will be first used by the IOT2050 boards.
Quoted 7 lines
Based on original patch by Li Hua Qian.
Signed-off-by Jan Kiszka <[email protected]>--- include/sysinfo.h | 1 + lib/smbios.c | 4 ++++ 2 files changed, 5 insertions(+)
What is this used for? Would you mind adding a comment for it? Should mention that it is a struct uuid
Quoted 36 lines
include/sysinfo.h +1
-0@@ -49,6 +49,7 @@ enum sysinfo_id {SYSINFO_ID_SMBIOS_SYSTEM_SERIAL ,SYSINFO_ID_SMBIOS_SYSTEM_SKU ,SYSINFO_ID_SMBIOS_SYSTEM_FAMILY , +SYSINFO_ID_SMBIOS_SYSTEM_UUID ,SYSINFO_ID_SMBIOS_BASEBOARD_MANUFACTURER ,SYSINFO_ID_SMBIOS_BASEBOARD_PRODUCT , SYSINFO_ID_SMBIOS_BASEBOARD_VERSION,lib/smbios.c +4
-1@@ -387,6 +387,7 @@ static int smbios_write_type1(ulong *current, int handle,struct smbios_type1 *t;int len =sizeof (struct smbios_type1 );char *serial_str =env_get ("serial#" ); +char uuid[sizeof (t->uuid)]; t =map_sysmem (*current, len);memset (t,0 ,sizeof (struct smbios_type1 ));@@ -409,6 +410,9 @@ static int smbios_write_type1(ulong *current, int handle,SYSINFO_ID_SMBIOS_SYSTEM_SERIAL , NULL); } +if (!sysinfo_get_str (ctx->dev,SYSINFO_ID_SMBIOS_SYSTEM_UUID , +sizeof (uuid), uuid)) +strncpy ((char *)t->uuid, uuid,sizeof (t->uuid)); t->wakeup_type =SMBIOS_WAKEUP_TYPE_UNKNOWN ; t->sku_number =smbios_add_prop_si (ctx,"sku" ,SYSINFO_ID_SMBIOS_SYSTEM_SKU ,NULL ); --
Quoted 2 lines
2.43.0
Regards,
SImon
Re: [PATCH v2 11/13] smbios: Fill UUID from sysinfo when available
Quoted 15 lines · Simon Glass
Quoted 6 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
Allow for the sysinfo drivers to provide a system UUID to SMBIOS. Will be first used by the IOT2050 boards.
Quoted 7 lines
Based on original patch by Li Hua Qian.
Signed-off-by Jan Kiszka <[email protected]>--- include/sysinfo.h | 1 + lib/smbios.c | 4 ++++ 2 files changed, 5 insertions(+)
Quoted 5 lines
Reviewed-by Simon Glass <[email protected]>What is this used for? Would you mind adding a comment for it? Should mention that it is a struct uuid
What exactly is unclear here? The System UUID is a part of the SMBIOS spec that U-Boot just ignored so far.
Jan
Quoted 41 lines
Quoted 36 lines
include/sysinfo.h +1
-0@@ -49,6 +49,7 @@ enum sysinfo_id {SYSINFO_ID_SMBIOS_SYSTEM_SERIAL ,SYSINFO_ID_SMBIOS_SYSTEM_SKU ,SYSINFO_ID_SMBIOS_SYSTEM_FAMILY , +SYSINFO_ID_SMBIOS_SYSTEM_UUID ,SYSINFO_ID_SMBIOS_BASEBOARD_MANUFACTURER ,SYSINFO_ID_SMBIOS_BASEBOARD_PRODUCT , SYSINFO_ID_SMBIOS_BASEBOARD_VERSION,lib/smbios.c +4
-1@@ -387,6 +387,7 @@ static int smbios_write_type1(ulong *current, int handle,struct smbios_type1 *t;int len =sizeof (struct smbios_type1 );char *serial_str =env_get ("serial#" ); +char uuid[sizeof (t->uuid)]; t =map_sysmem (*current, len);memset (t,0 ,sizeof (struct smbios_type1 ));@@ -409,6 +410,9 @@ static int smbios_write_type1(ulong *current, int handle,SYSINFO_ID_SMBIOS_SYSTEM_SERIAL , NULL); } +if (!sysinfo_get_str (ctx->dev,SYSINFO_ID_SMBIOS_SYSTEM_UUID , +sizeof (uuid), uuid)) +strncpy ((char *)t->uuid, uuid,sizeof (t->uuid)); t->wakeup_type =SMBIOS_WAKEUP_TYPE_UNKNOWN ; t->sku_number =smbios_add_prop_si (ctx,"sku" ,SYSINFO_ID_SMBIOS_SYSTEM_SKU ,NULL ); --Quoted 2 lines
2.43.0
Regards,
SImon
Signature · 2 lines
Siemens AG, Technology Linux Expert Center
Re: [PATCH v2 11/13] smbios: Fill UUID from sysinfo when available
Hi Jan,
Quoted 17 lines · Jan Kiszka
Quoted 15 lines · Simon Glass
Quoted 13 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
Allow for the sysinfo drivers to provide a system UUID to SMBIOS. Will be first used by the IOT2050 boards.
Based on original patch by Li Hua Qian.
Signed-off-by Jan Kiszka <[email protected]>--- include/sysinfo.h | 1 + lib/smbios.c | 4 ++++ 2 files changed, 5 insertions(+)
Quoted 8 lines
Quoted 5 lines
Reviewed-by Simon Glass <[email protected]>What is this used for? Would you mind adding a comment for it? Should mention that it is a struct uuid
What exactly is unclear here? The System UUID is a part of the SMBIOS spec that U-Boot just ignored so far.
OK, well that just mention that, along with the data type.
Regards,
Simon
Re: [PATCH v2 11/13] smbios: Fill UUID from sysinfo when available
Quoted 22 lines · Simon Glass
Hi Jan,
Quoted 19 lines · Jan Kiszka
Quoted 17 lines · Simon Glass
Quoted 6 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
Allow for the sysinfo drivers to provide a system UUID to SMBIOS. Will be first used by the IOT2050 boards.
Quoted 7 lines
Based on original patch by Li Hua Qian.
Signed-off-by Jan Kiszka <[email protected]>--- include/sysinfo.h | 1 + lib/smbios.c | 4 ++++ 2 files changed, 5 insertions(+)Reviewed-by Simon Glass <[email protected]>
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
What is this used for? Would you mind adding a comment for it? Should mention that it is a struct uuid
What exactly is unclear here? The System UUID is a part of the SMBIOS spec that U-Boot just ignored so far.
OK, well that just mention that, along with the data type.
Now that I look at your data type comment again: It's actually not ok to misuse sysinfo_get_str for transporting this. The UUID is not converted into a string by the driver, it is rather returned raw and may even terminate prematurely if containing some zero. We need a new sysinfo_get_bin or raw op.
Jan
Signature · 2 lines
Siemens AG, Technology Linux Expert Center
Re: [PATCH v2 11/13] smbios: Fill UUID from sysinfo when available
Hi Jan,
Quoted 31 lines · Jan Kiszka
Quoted 29 lines · Simon Glass
Hi Jan,
Quoted 25 lines · Jan Kiszka
Quoted 15 lines · Simon Glass
Quoted 6 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
Allow for the sysinfo drivers to provide a system UUID to SMBIOS. Will be first used by the IOT2050 boards.
Quoted 7 lines
Based on original patch by Li Hua Qian.
Signed-off-by Jan Kiszka <[email protected]>--- include/sysinfo.h | 1 + lib/smbios.c | 4 ++++ 2 files changed, 5 insertions(+)Quoted 5 lines
Reviewed-by Simon Glass <[email protected]>What is this used for? Would you mind adding a comment for it? Should mention that it is a struct uuid
What exactly is unclear here? The System UUID is a part of the SMBIOS spec that U-Boot just ignored so far.
Quoted 8 lines
Quoted 2 lines
OK, well that just mention that, along with the data type.
Now that I look at your data type comment again: It's actually not ok to misuse
sysinfo_get_strfor transporting this. The UUID is not converted into a string by the driver, it is rather returned raw and may even terminate prematurely if containing some zero. We need a newsysinfo_get_binor raw op.
Yes, perhaps just sysinfo_get() to read binary info?
Regards,
Simon
Re: [PATCH v2 11/13] smbios: Fill UUID from sysinfo when available
Quoted 37 lines · Simon Glass
Hi Jan,
Quoted 34 lines · Jan Kiszka
Quoted 31 lines · Simon Glass
Hi Jan,
Quoted 17 lines · Jan Kiszka
Quoted 15 lines · Simon Glass
Quoted 13 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
Allow for the sysinfo drivers to provide a system UUID to SMBIOS. Will be first used by the IOT2050 boards.
Based on original patch by Li Hua Qian.
Signed-off-by Jan Kiszka <[email protected]>--- include/sysinfo.h | 1 + lib/smbios.c | 4 ++++ 2 files changed, 5 insertions(+)Quoted 8 lines
Quoted 5 lines
Reviewed-by Simon Glass <[email protected]>What is this used for? Would you mind adding a comment for it? Should mention that it is a struct uuid
What exactly is unclear here? The System UUID is a part of the SMBIOS spec that U-Boot just ignored so far.
OK, well that just mention that, along with the data type.
Quoted 8 lines
Quoted 5 lines
Now that I look at your data type comment again: It's actually not ok to misuse
sysinfo_get_strfor transporting this. The UUID is not converted into a string by the driver, it is rather returned raw and may even terminate prematurely if containing some zero. We need a newsysinfo_get_binor raw op.Yes, perhaps just
sysinfo_get()to read binary info?
-EEXIST: "Return the sysinfo device for the sysinfo in question"
Jan
Signature · 2 lines
Siemens AG, Technology Linux Expert Center
Re: [PATCH v2 11/13] smbios: Fill UUID from sysinfo when available
In reply to Jan KiszkaQuoted 39 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
Allow for the sysinfo drivers to provide a system UUID to SMBIOS. Will be first used by the IOT2050 boards.
Based on original patch by Li Hua Qian.
Signed-off-by Jan Kiszka <[email protected]>Reviewed-by Simon Glass <[email protected]>--- include/sysinfo.h | 1 + lib/smbios.c | 4 ++++ 2 files changed, 5 insertions(+)include/sysinfo.h +1
-0@@ -49,6 +49,7 @@ enum sysinfo_id {SYSINFO_ID_SMBIOS_SYSTEM_SERIAL ,SYSINFO_ID_SMBIOS_SYSTEM_SKU ,SYSINFO_ID_SMBIOS_SYSTEM_FAMILY , +SYSINFO_ID_SMBIOS_SYSTEM_UUID ,SYSINFO_ID_SMBIOS_BASEBOARD_MANUFACTURER ,SYSINFO_ID_SMBIOS_BASEBOARD_PRODUCT , SYSINFO_ID_SMBIOS_BASEBOARD_VERSION,lib/smbios.c +1
-0@@ -387,6 +387,7 @@ static int smbios_write_type1(ulong *current, int handle,struct smbios_type1 *t;int len =sizeof (struct smbios_type1 );char *serial_str =env_get ("serial#" ); +char uuid[sizeof (t->uuid)]; t =map_sysmem (*current, len);memset (t,0 ,sizeof (struct smbios_type1 ));
lib/smbios.c static int smbios_write_type1(ulong *current, int handle, · line 418
Quoted 9 lines
lib/smbios.c +3
-0@@ -409,6 +410,9 @@ static int smbios_write_type1(ulong *current, int handle,SYSINFO_ID_SMBIOS_SYSTEM_SERIAL , NULL); } +if (!sysinfo_get_str (ctx->dev,SYSINFO_ID_SMBIOS_SYSTEM_UUID , +sizeof (uuid), uuid)) +strncpy ((char *)t->uuid, uuid,sizeof (t->uuid)); t->wakeup_type =SMBIOS_WAKEUP_TYPE_UNKNOWN ; t->sku_number =smbios_add_prop_si (ctx,"sku" ,SYSINFO_ID_SMBIOS_SYSTEM_SKU ,NULL );
This commit leads to sandbox (and sandbox with clang) failing a ton of tests:
https://source.denx.de/u-boot/u-boot/-/jobs/929474
Without this commit in the series, iot2050 fails to build.
Signature · 1 line
Tom
Re: [PATCH v2 11/13] smbios: Fill UUID from sysinfo when available
Quoted 55 lines · Tom Rini
Quoted 39 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
Allow for the sysinfo drivers to provide a system UUID to SMBIOS. Will be first used by the IOT2050 boards.
Based on original patch by Li Hua Qian.
Signed-off-by Jan Kiszka <[email protected]>Reviewed-by Simon Glass <[email protected]>--- include/sysinfo.h | 1 + lib/smbios.c | 4 ++++ 2 files changed, 5 insertions(+)include/sysinfo.h +1
-0@@ -49,6 +49,7 @@ enum sysinfo_id {SYSINFO_ID_SMBIOS_SYSTEM_SERIAL ,SYSINFO_ID_SMBIOS_SYSTEM_SKU ,SYSINFO_ID_SMBIOS_SYSTEM_FAMILY , +SYSINFO_ID_SMBIOS_SYSTEM_UUID ,SYSINFO_ID_SMBIOS_BASEBOARD_MANUFACTURER ,SYSINFO_ID_SMBIOS_BASEBOARD_PRODUCT , SYSINFO_ID_SMBIOS_BASEBOARD_VERSION,lib/smbios.c +1
-0@@ -387,6 +387,7 @@ static int smbios_write_type1(ulong *current, int handle,struct smbios_type1 *t;int len =sizeof (struct smbios_type1 );char *serial_str =env_get ("serial#" ); +char uuid[sizeof (t->uuid)]; t =map_sysmem (*current, len);memset (t,0 ,sizeof (struct smbios_type1 ));lib/smbios.c static int smbios_write_type1(ulong *current, int handle, · line 418
Quoted 9 lines
lib/smbios.c +3
-0@@ -409,6 +410,9 @@ static int smbios_write_type1(ulong *current, int handle,SYSINFO_ID_SMBIOS_SYSTEM_SERIAL , NULL); } +if (!sysinfo_get_str (ctx->dev,SYSINFO_ID_SMBIOS_SYSTEM_UUID , +sizeof (uuid), uuid)) +strncpy ((char *)t->uuid, uuid,sizeof (t->uuid)); t->wakeup_type =SMBIOS_WAKEUP_TYPE_UNKNOWN ; t->sku_number =smbios_add_prop_si (ctx,"sku" ,SYSINFO_ID_SMBIOS_SYSTEM_SKU ,NULL );This commit leads to sandbox (and sandbox with clang) failing a ton of tests:
https://source.denx.de/u-boot/u-boot/-/jobs/929474
Quoted 2 lines
Without this commit in the series, iot2050 fails to build.
Strange on first sight - we will look into this. As this patch and the following 2 are only adding a feature, maybe you could already merge the first 10 patches? Would make v3 shorter for us.
Thanks,
Jan
Signature · 2 lines
Siemens AG, Technology Linux Expert Center
Re: [PATCH v2 11/13] smbios: Fill UUID from sysinfo when available
Hi Jan,
Quoted 27 lines · Jan Kiszka
Quoted 25 lines · Tom Rini
Quoted 23 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
Allow for the sysinfo drivers to provide a system UUID to SMBIOS. Will be first used by the IOT2050 boards.
Based on original patch by Li Hua Qian.
Signed-off-by Jan Kiszka <[email protected]>Reviewed-by Simon Glass <[email protected]>--- include/sysinfo.h | 1 + lib/smbios.c | 4 ++++ 2 files changed, 5 insertions(+)include/sysinfo.h +1
-0@@ -49,6 +49,7 @@ enum sysinfo_id {SYSINFO_ID_SMBIOS_SYSTEM_SERIAL ,SYSINFO_ID_SMBIOS_SYSTEM_SKU ,SYSINFO_ID_SMBIOS_SYSTEM_FAMILY , + SYSINFO_ID_SMBIOS_SYSTEM_UUID,
Quoted 8 lines
Quoted 8 lines
lib/smbios.c static int smbios_write_type1(ulong *current, int
Quoted 8 lines
include/sysinfo.h +0
-0SYSINFO_ID_SMBIOS_BASEBOARD_MANUFACTURER ,SYSINFO_ID_SMBIOS_BASEBOARD_PRODUCT , SYSINFO_ID_SMBIOS_BASEBOARD_VERSION,lib/smbios.c +0
-0@@ -387,6 +387,7 @@ static int smbios_write_type1(ulong *current, int
handle,
Quoted 8 lines
Quoted 8 lines
lib/smbios.c static int smbios_write_type1(ulong *current, int
Quoted 8 lines
lib/smbios.c +1
-0struct smbios_type1 *t;int len =sizeof (struct smbios_type1 );char *serial_str =env_get ("serial#" ); +char uuid[sizeof (t->uuid)]; t =map_sysmem (*current, len);memset (t,0 ,sizeof (struct smbios_type1 ));@@ -409,6 +410,9 @@ static int smbios_write_type1(ulong *current, int
handle,
Quoted 1 line
Quoted 1 line
Quoted 1 line
SYSINFO_ID_SMBIOS_SYSTEM_SERIAL,
Quoted 8 lines
Quoted 8 lines
lib/smbios.c static int smbios_write_type1(ulong *current, int handle,
Quoted 8 lines
NULL); }lib/smbios.c +3
-0+if (!sysinfo_get_str (ctx->dev,SYSINFO_ID_SMBIOS_SYSTEM_UUID , +sizeof (uuid), uuid)) +strncpy ((char *)t->uuid, uuid,sizeof (t->uuid)); t->wakeup_type =SMBIOS_WAKEUP_TYPE_UNKNOWN ; t->sku_number = smbios_add_prop_si(ctx, "sku", SYSINFO_ID_SMBIOS_SYSTEM_SKU,
NULL);
Quoted 11 lines
Quoted 7 lines
This commit leads to sandbox (and sandbox with clang) failing a ton of tests:
https://source.denx.de/u-boot/u-boot/-/jobs/929474Without this commit in the series, iot2050 fails to build.
Strange on first sight - we will look into this. As this patch and the following 2 are only adding a feature, maybe you could already merge the first 10 patches? Would make v3 shorter for us.
I marked the first 10 patches as 'under review'. I'm not sure who is picking them up, probably Tom.
Regards,
Simon
Re: [PATCH v2 11/13] smbios: Fill UUID from sysinfo when available
In reply to Jan KiszkaQuoted 56 lines · Jan Kiszka
Quoted 55 lines · Tom Rini
Quoted 39 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
Allow for the sysinfo drivers to provide a system UUID to SMBIOS. Will be first used by the IOT2050 boards.
Based on original patch by Li Hua Qian.
Signed-off-by Jan Kiszka <[email protected]>Reviewed-by Simon Glass <[email protected]>--- include/sysinfo.h | 1 + lib/smbios.c | 4 ++++ 2 files changed, 5 insertions(+)include/sysinfo.h +1
-0@@ -49,6 +49,7 @@ enum sysinfo_id {SYSINFO_ID_SMBIOS_SYSTEM_SERIAL ,SYSINFO_ID_SMBIOS_SYSTEM_SKU ,SYSINFO_ID_SMBIOS_SYSTEM_FAMILY , +SYSINFO_ID_SMBIOS_SYSTEM_UUID ,SYSINFO_ID_SMBIOS_BASEBOARD_MANUFACTURER ,SYSINFO_ID_SMBIOS_BASEBOARD_PRODUCT , SYSINFO_ID_SMBIOS_BASEBOARD_VERSION,lib/smbios.c +1
-0@@ -387,6 +387,7 @@ static int smbios_write_type1(ulong *current, int handle,struct smbios_type1 *t;int len =sizeof (struct smbios_type1 );char *serial_str =env_get ("serial#" ); +char uuid[sizeof (t->uuid)]; t =map_sysmem (*current, len);memset (t,0 ,sizeof (struct smbios_type1 ));lib/smbios.c static int smbios_write_type1(ulong *current, int handle, · line 418
Quoted 9 lines
lib/smbios.c +3
-0@@ -409,6 +410,9 @@ static int smbios_write_type1(ulong *current, int handle,SYSINFO_ID_SMBIOS_SYSTEM_SERIAL , NULL); } +if (!sysinfo_get_str (ctx->dev,SYSINFO_ID_SMBIOS_SYSTEM_UUID , +sizeof (uuid), uuid)) +strncpy ((char *)t->uuid, uuid,sizeof (t->uuid)); t->wakeup_type =SMBIOS_WAKEUP_TYPE_UNKNOWN ; t->sku_number =smbios_add_prop_si (ctx,"sku" ,SYSINFO_ID_SMBIOS_SYSTEM_SKU ,NULL );This commit leads to sandbox (and sandbox with clang) failing a ton of tests:
https://source.denx.de/u-boot/u-boot/-/jobs/929474
Quoted 6 lines
Quoted 2 lines
Without this commit in the series, iot2050 fails to build.
Strange on first sight - we will look into this. As this patch and the following 2 are only adding a feature, maybe you could already merge the first 10 patches? Would make v3 shorter for us.
OK, I'll see how just the first 10 go shortly.
Signature · 1 line
Tom
PATCH v2 12/13 sysinfo: Add driver for IOT2050 boards
In reply to Jan KiszkaFrom: Li Hua Qian <[email protected]>
This brings a sysinfo driver and DT entry for the IOT2050 board series. It translates the board information passed from SE-Boot to SPL into values that can be retrieved via the sysinfo API. Will is already used to fill the SMBIOS table when booting via EFI.
--- .../dts/k3-am65-iot2050-common-u-boot.dtsi | 18 +++ configs/iot2050_defconfig | 1 + drivers/sysinfo/Kconfig | 7 + drivers/sysinfo/Makefile | 1 + drivers/sysinfo/iot2050.c | 143 ++++++++++++++++++ drivers/sysinfo/iot2050.h | 26 ++++ 6 files changed, 196 insertions(+) create mode 100644 drivers/sysinfo/iot2050.c create mode 100644 drivers/sysinfo/iot2050.h
arch/arm/dts/k3-am65-iot2050-common-u-boot.dtsi +18 -0
@@ -14,6 +14,24 @@ spi0 = &ospi0; }; + sysinfo { + compatible = "siemens,sysinfo-iot2050"; + /* TI_SRAM_SCRATCH_BOARD_EEPROM_START */ + offset = <0x40280000>; + bootph-all; + + smbios { + system { + manufacturer = "SIEMENS AG"; + product = "SIMATIC IOT2050"; + }; + + baseboard { + manufacturer = "SIEMENS AG"; + }; + }; + }; + leds { bootph-all; status-led-red {
configs/iot2050_defconfig +1 -0
@@ -141,6 +141,7 @@ CONFIG_SOC_TI=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_CADENCE_QSPI=y +CONFIG_SYSINFO=y CONFIG_SYSRESET=y CONFIG_SPL_SYSRESET=y CONFIG_SYSRESET_TI_SCI=y
drivers/sysinfo/Kconfig +7 -0
@@ -31,6 +31,13 @@ config SYSINFO_RCAR3 help Support querying SoC version information for Renesas R-Car Gen3. +config SYSINFO_IOT2050 + bool "Enable sysinfo driver for the Siemens IOT2050" + depends on TARGET_IOT2050_A53 + default y if TARGET_IOT2050_A53 + help + Support querying device information for Siemens IOT2050. + config SYSINFO_SANDBOX bool "Enable sysinfo driver for the Sandbox board" help
drivers/sysinfo/Makefile +1 -0
@@ -5,6 +5,7 @@ obj-y += sysinfo-uclass.o obj-$(CONFIG_SYSINFO_GAZERBEAM) += gazerbeam.o obj-$(CONFIG_SYSINFO_GPIO) += gpio.o +obj-$(CONFIG_SYSINFO_IOT2050) += iot2050.o obj-$(CONFIG_SYSINFO_RCAR3) += rcar3.o obj-$(CONFIG_SYSINFO_SANDBOX) += sandbox.o obj-$(CONFIG_SYSINFO_SMBIOS) += smbios.o
drivers/sysinfo/iot2050.c new file +143 -0
143 lines not on this page · raw message
drivers/sysinfo/iot2050.h new file +26 -0
@@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (c) Siemens AG, 2024 +*/ + +#include <sysinfo.h> + +enum sysinfo_id_iot2050 { +BOARD_MLFB =SYSINFO_ID_SMBIOS_SYSTEM_VERSION , +BOARD_SERIAL =SYSINFO_ID_SMBIOS_SYSTEM_SERIAL , +BOARD_UUID =SYSINFO_ID_SMBIOS_SYSTEM_UUID , +BOARD_A5E =SYSINFO_ID_SMBIOS_BASEBOARD_PRODUCT , +BOARD_NAME =SYSINFO_ID_SMBIOS_BASEBOARD_VERSION , +BOARD_SEBOOT_VER =SYSINFO_ID_USER +0 , +BOARD_MAC_ADDR_CNT =SYSINFO_ID_USER +1 , +BOARD_MAC_ADDR_1 =SYSINFO_ID_USER +2 , +BOARD_MAC_ADDR_START =BOARD_MAC_ADDR_1 , +BOARD_MAC_ADDR_2 =SYSINFO_ID_USER +3 , +BOARD_MAC_ADDR_3 =SYSINFO_ID_USER +4 , +BOARD_MAC_ADDR_4 =SYSINFO_ID_USER +5 , +BOARD_MAC_ADDR_5 =SYSINFO_ID_USER +6 , +BOARD_MAC_ADDR_6 =SYSINFO_ID_USER +7 , +BOARD_MAC_ADDR_7 =SYSINFO_ID_USER +8 , +BOARD_MAC_ADDR_8 =SYSINFO_ID_USER +9 , +BOARD_DDR_SIZE =SYSINFO_ID_USER +10 , +};
Signature · 1 line
2.43.0
Re: [PATCH v2 12/13] sysinfo: Add driver for IOT2050 boards
Quoted 11 lines · Jan Kiszka
From: Li Hua Qian <[email protected]>
This brings a sysinfo driver and DT entry for the IOT2050 board series. It translates the board information passed from SE-Boot to SPL into values that can be retrieved via the sysinfo API. Will is already used to fill the SMBIOS table when booting via EFI.
Signed-off-by Li Hua Qian <[email protected]>[Jan: split-off as separate patch, cleanup]Signed-off-by Jan Kiszka <[email protected]>
Quoted 10 lines
--- .../dts/k3-am65-iot2050-common-u-boot.dtsi | 18 +++ configs/iot2050_defconfig | 1 + drivers/sysinfo/Kconfig | 7 + drivers/sysinfo/Makefile | 1 + drivers/sysinfo/iot2050.c | 143 ++++++++++++++++++ drivers/sysinfo/iot2050.h | 26 ++++ 6 files changed, 196 insertions(+) create mode 100644 drivers/sysinfo/iot2050.c create mode 100644 drivers/sysinfo/iot2050.h
I think strlcpy() might be better than strncpy() for this case
The idea with sysinfo is that we use the same enum for all boards, so please add your new things to sysinfo.h
Do you actually want all the sysinfo info in capitals? If so, that's fine, just checking...
Quoted 154 lines
arch/arm/dts/k3-am65-iot2050-common-u-boot.dtsi +18
-0@@ -14,6 +14,24 @@ spi0 = &ospi0; }; + sysinfo { + compatible = "siemens,sysinfo-iot2050"; + /* TI_SRAM_SCRATCH_BOARD_EEPROM_START */ + offset = <0x40280000>; + bootph-all; + + smbios { + system { + manufacturer = "SIEMENS AG"; + product = "SIMATIC IOT2050"; + }; + + baseboard { + manufacturer = "SIEMENS AG"; + }; + }; + }; + leds { bootph-all; status-led-red {configs/iot2050_defconfig +1
-0@@ -141,6 +141,7 @@ CONFIG_SOC_TI=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_CADENCE_QSPI=y +CONFIG_SYSINFO=y CONFIG_SYSRESET=y CONFIG_SPL_SYSRESET=y CONFIG_SYSRESET_TI_SCI=ydrivers/sysinfo/Kconfig +7
-0@@ -31,6 +31,13 @@ config SYSINFO_RCAR3 help Support querying SoC version information for Renesas R-Car Gen3. +config SYSINFO_IOT2050 + bool "Enable sysinfo driver for the Siemens IOT2050" + depends on TARGET_IOT2050_A53 + default y if TARGET_IOT2050_A53 + help + Support querying device information for Siemens IOT2050. + config SYSINFO_SANDBOX bool "Enable sysinfo driver for the Sandbox board" helpdrivers/sysinfo/Makefile +1
-0@@ -5,6 +5,7 @@ obj-y += sysinfo-uclass.o obj-$(CONFIG_SYSINFO_GAZERBEAM) += gazerbeam.o obj-$(CONFIG_SYSINFO_GPIO) += gpio.o +obj-$(CONFIG_SYSINFO_IOT2050) += iot2050.o obj-$(CONFIG_SYSINFO_RCAR3) += rcar3.o obj-$(CONFIG_SYSINFO_SANDBOX) += sandbox.o obj-$(CONFIG_SYSINFO_SMBIOS) += smbios.odrivers/sysinfo/iot2050.c new file +76
-0@@ -0,0 +1,143 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (c) Siemens AG, 2024 +*/ + +#include <dm.h> +#include <sysinfo.h> +#include <net.h> +#include <asm/arch/hardware.h> + +#include "iot2050.h" + +#define IOT2050_INFO_MAGIC 0x20502050 + +struct iot2050_info { +u32 magic; +u16 size; +char name[20 +1 ]; +char serial[16 +1 ]; +char mlfb[18 +1 ]; +char uuid[32 +1 ]; +char a5e[18 +1 ]; +u8 mac_addr_cnt; +u8 mac_addr[8 ][ARP_HLEN ]; +char seboot_version[40 +1 ]; +u8 padding[3 ]; +u32 ddr_size_mb; +} __packed; + +/** +* struct sysinfo_iot2050_priv - sysinfo private data +* @info: iot2050 board info +*/ +struct sysinfo_iot2050_priv { +struct iot2050_info *info; +}; + +static int sysinfo_iot2050_detect (struct udevice *dev) +{ +struct sysinfo_iot2050_priv *priv =dev_get_priv (dev); + +if (priv->info ==NULL || priv->info->magic !=IOT2050_INFO_MAGIC ) +return -EFAULT ; + +return 0 ; +} + +static int sysinfo_iot2050_get_str (struct udevice *dev,int id,size_t size, +char *val) +{ +struct sysinfo_iot2050_priv *priv =dev_get_priv (dev); +char byte_str[3 ] = {0 }; +unsigned int n; + +switch (id) { +case BOARD_NAME : +strncpy (val, priv->info->name, size); +break ; +case BOARD_SERIAL : +strncpy (val, priv->info->serial, size); +break ; +case BOARD_MLFB : +strncpy (val, priv->info->mlfb, size); +break ; +case BOARD_UUID : +for (n =0 ; n <min (size, (size_t )16 ); n++) { +memcpy (byte_str, priv->info->uuid + n *2 ,2 ); + val[n] = (char )hextoul (byte_str,NULL ); + } +break ; +case BOARD_A5E : +strncpy (val, priv->info->a5e, size); +break ; +case BOARD_SEBOOT_VER : +strncpy (val, priv->info->seboot_version, size); +break ;
drivers/sysinfo/iot2050.c line 86
Quoted 10 lines
drivers/sysinfo/iot2050.c new file +10
-0+case BOARD_MAC_ADDR_1 : +case BOARD_MAC_ADDR_2 : +case BOARD_MAC_ADDR_3 : +case BOARD_MAC_ADDR_4 : +case BOARD_MAC_ADDR_5 : +case BOARD_MAC_ADDR_6 : +case BOARD_MAC_ADDR_7 : +case BOARD_MAC_ADDR_8 : +memcpy (val, priv->info->mac_addr[id -BOARD_MAC_ADDR_START ], +ARP_HLEN );
For this, we really need another parameter to get_str(), i.e. the index, since we don't know how many MACs there will be. So how about adding a few new operations?
int (*get_item_count)(struct udevice *dev, int id);
int (*get_str_item)(struct udevice *dev, int id, int index, size_t size, char *val);
Quoted 66 lines
drivers/sysinfo/iot2050.c new file +57
-0+return 0 ; +case BOARD_DDR_SIZE : +memcpy (val, &priv->info->ddr_size_mb, +sizeof (priv->info->ddr_size_mb)); +return 0 ; +default : +return -EINVAL ; + }; + + val[size -1 ] ='\0' ; +return 0 ; +} + +static int sysinfo_iot2050_get_int (struct udevice *dev,int id,int *val) +{ +struct sysinfo_iot2050_priv *priv =dev_get_priv (dev); + +switch (id) { +case BOARD_MAC_ADDR_CNT : + *val = priv->info->mac_addr_cnt; +return 0 ; +default : +return -EINVAL ; + }; +} + +static const struct sysinfo_ops sysinfo_iot2050_ops = { + .detect = sysinfo_iot2050_detect, + .get_str = sysinfo_iot2050_get_str, + .get_int = sysinfo_iot2050_get_int, +}; + +static int sysinfo_iot2050_probe (struct udevice *dev) +{ +struct sysinfo_iot2050_priv *priv =dev_get_priv (dev); +unsigned long offset; + + offset =dev_read_u32_default (dev,"offset" , +TI_SRAM_SCRATCH_BOARD_EEPROM_START ); + priv->info = (struct iot2050_info *)offset; + +return 0 ; +} + +static const struct udevice_id sysinfo_iot2050_ids[] = { + { .compatible ="siemens,sysinfo-iot2050" }, + {/* sentinel */ } +}; + +U_BOOT_DRIVER (sysinfo_iot2050) = { + .name ="sysinfo_iot2050" , + .id =UCLASS_SYSINFO , + .of_match = sysinfo_iot2050_ids, + .ops = &sysinfo_iot2050_ops, + .priv_auto =sizeof (struct sysinfo_iot2050_priv ), + .probe = sysinfo_iot2050_probe, +};drivers/sysinfo/iot2050.h new file +3
-0@@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (c) Siemens AG, 2024
drivers/sysinfo/iot2050.h line 13
Quoted 10 lines
drivers/sysinfo/iot2050.h new file +10
-0+*/ + +#include <sysinfo.h> + +enum sysinfo_id_iot2050 { +BOARD_MLFB =SYSINFO_ID_SMBIOS_SYSTEM_VERSION , +BOARD_SERIAL =SYSINFO_ID_SMBIOS_SYSTEM_SERIAL , +BOARD_UUID =SYSINFO_ID_SMBIOS_SYSTEM_UUID , +BOARD_A5E =SYSINFO_ID_SMBIOS_BASEBOARD_PRODUCT , +BOARD_NAME =SYSINFO_ID_SMBIOS_BASEBOARD_VERSION ,
Do you need to rename these? It seems better to use the standard names, although I do think they are quite long.
drivers/sysinfo/iot2050.h line 25
Quoted 12 lines
drivers/sysinfo/iot2050.h new file +12
-0+BOARD_SEBOOT_VER =SYSINFO_ID_USER +0 , +BOARD_MAC_ADDR_CNT =SYSINFO_ID_USER +1 , +BOARD_MAC_ADDR_1 =SYSINFO_ID_USER +2 , +BOARD_MAC_ADDR_START =BOARD_MAC_ADDR_1 , +BOARD_MAC_ADDR_2 =SYSINFO_ID_USER +3 , +BOARD_MAC_ADDR_3 =SYSINFO_ID_USER +4 , +BOARD_MAC_ADDR_4 =SYSINFO_ID_USER +5 , +BOARD_MAC_ADDR_5 =SYSINFO_ID_USER +6 , +BOARD_MAC_ADDR_6 =SYSINFO_ID_USER +7 , +BOARD_MAC_ADDR_7 =SYSINFO_ID_USER +8 , +BOARD_MAC_ADDR_8 =SYSINFO_ID_USER +9 , + BOARD_DDR_SIZE = SYSINFO_ID_USER + 10,
These are the ones which should be added as standard. Be sure to comment them as necessary.
Regards,
Simon
Re: [PATCH v2 12/13] sysinfo: Add driver for IOT2050 boards
Quoted 23 lines · Simon Glass
Quoted 11 lines · Jan Kiszka
From: Li Hua Qian <[email protected]>
This brings a sysinfo driver and DT entry for the IOT2050 board series. It translates the board information passed from SE-Boot to SPL into values that can be retrieved via the sysinfo API. Will is already used to fill the SMBIOS table when booting via EFI.
Signed-off-by Li Hua Qian <[email protected]>[Jan: split-off as separate patch, cleanup]Signed-off-by Jan Kiszka <[email protected]>Quoted 10 lines
--- .../dts/k3-am65-iot2050-common-u-boot.dtsi | 18 +++ configs/iot2050_defconfig | 1 + drivers/sysinfo/Kconfig | 7 + drivers/sysinfo/Makefile | 1 + drivers/sysinfo/iot2050.c | 143 ++++++++++++++++++ drivers/sysinfo/iot2050.h | 26 ++++ 6 files changed, 196 insertions(+) create mode 100644 drivers/sysinfo/iot2050.c create mode 100644 drivers/sysinfo/iot2050.h
Quoted 2 lines
I think
strlcpy()might be better thanstrncpy()for this case
Ack.
Quoted 3 lines
The idea with sysinfo is that we use the same enum for all boards, so please add your new things to
sysinfo.h
See below.
Quoted 3 lines
Do you actually want all the sysinfo info in capitals? If so, that's fine, just checking...
This is how it is being shipped already, yes.
Quoted 169 lines
Quoted 154 lines
arch/arm/dts/k3-am65-iot2050-common-u-boot.dtsi +18
-0@@ -14,6 +14,24 @@ spi0 = &ospi0; }; + sysinfo { + compatible = "siemens,sysinfo-iot2050"; + /* TI_SRAM_SCRATCH_BOARD_EEPROM_START */ + offset = <0x40280000>; + bootph-all; + + smbios { + system { + manufacturer = "SIEMENS AG"; + product = "SIMATIC IOT2050"; + }; + + baseboard { + manufacturer = "SIEMENS AG"; + }; + }; + }; + leds { bootph-all; status-led-red {configs/iot2050_defconfig +1
-0@@ -141,6 +141,7 @@ CONFIG_SOC_TI=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_CADENCE_QSPI=y +CONFIG_SYSINFO=y CONFIG_SYSRESET=y CONFIG_SPL_SYSRESET=y CONFIG_SYSRESET_TI_SCI=ydrivers/sysinfo/Kconfig +7
-0@@ -31,6 +31,13 @@ config SYSINFO_RCAR3 help Support querying SoC version information for Renesas R-Car Gen3. +config SYSINFO_IOT2050 + bool "Enable sysinfo driver for the Siemens IOT2050" + depends on TARGET_IOT2050_A53 + default y if TARGET_IOT2050_A53 + help + Support querying device information for Siemens IOT2050. + config SYSINFO_SANDBOX bool "Enable sysinfo driver for the Sandbox board" helpdrivers/sysinfo/Makefile +1
-0@@ -5,6 +5,7 @@ obj-y += sysinfo-uclass.o obj-$(CONFIG_SYSINFO_GAZERBEAM) += gazerbeam.o obj-$(CONFIG_SYSINFO_GPIO) += gpio.o +obj-$(CONFIG_SYSINFO_IOT2050) += iot2050.o obj-$(CONFIG_SYSINFO_RCAR3) += rcar3.o obj-$(CONFIG_SYSINFO_SANDBOX) += sandbox.o obj-$(CONFIG_SYSINFO_SMBIOS) += smbios.odrivers/sysinfo/iot2050.c new file +76
-0@@ -0,0 +1,143 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (c) Siemens AG, 2024 +*/ + +#include <dm.h> +#include <sysinfo.h> +#include <net.h> +#include <asm/arch/hardware.h> + +#include "iot2050.h" + +#define IOT2050_INFO_MAGIC 0x20502050 + +struct iot2050_info { +u32 magic; +u16 size; +char name[20 +1 ]; +char serial[16 +1 ]; +char mlfb[18 +1 ]; +char uuid[32 +1 ]; +char a5e[18 +1 ]; +u8 mac_addr_cnt; +u8 mac_addr[8 ][ARP_HLEN ]; +char seboot_version[40 +1 ]; +u8 padding[3 ]; +u32 ddr_size_mb; +} __packed; + +/** +* struct sysinfo_iot2050_priv - sysinfo private data +* @info: iot2050 board info +*/ +struct sysinfo_iot2050_priv { +struct iot2050_info *info; +}; + +static int sysinfo_iot2050_detect (struct udevice *dev) +{ +struct sysinfo_iot2050_priv *priv =dev_get_priv (dev); + +if (priv->info ==NULL || priv->info->magic !=IOT2050_INFO_MAGIC ) +return -EFAULT ; + +return 0 ; +} + +static int sysinfo_iot2050_get_str (struct udevice *dev,int id,size_t size, +char *val) +{ +struct sysinfo_iot2050_priv *priv =dev_get_priv (dev); +char byte_str[3 ] = {0 }; +unsigned int n; + +switch (id) { +case BOARD_NAME : +strncpy (val, priv->info->name, size); +break ; +case BOARD_SERIAL : +strncpy (val, priv->info->serial, size); +break ; +case BOARD_MLFB : +strncpy (val, priv->info->mlfb, size); +break ; +case BOARD_UUID : +for (n =0 ; n <min (size, (size_t )16 ); n++) { +memcpy (byte_str, priv->info->uuid + n *2 ,2 ); + val[n] = (char )hextoul (byte_str,NULL ); + } +break ; +case BOARD_A5E : +strncpy (val, priv->info->a5e, size); +break ; +case BOARD_SEBOOT_VER : +strncpy (val, priv->info->seboot_version, size); +break ;drivers/sysinfo/iot2050.c line 86
Quoted 10 lines
drivers/sysinfo/iot2050.c new file +10
-0+case BOARD_MAC_ADDR_1 : +case BOARD_MAC_ADDR_2 : +case BOARD_MAC_ADDR_3 : +case BOARD_MAC_ADDR_4 : +case BOARD_MAC_ADDR_5 : +case BOARD_MAC_ADDR_6 : +case BOARD_MAC_ADDR_7 : +case BOARD_MAC_ADDR_8 : +memcpy (val, priv->info->mac_addr[id -BOARD_MAC_ADDR_START ], +ARP_HLEN );For this, we really need another parameter to
get_str(), i.e. the index, since we don't know how many MACs there will be. So how about adding a few new operations?
Quoted 3 lines
int (*get_item_count)(struct udevice *dev, int id);
int (*get_str_item)(struct udevice *dev, int id, int index,size_tsize, char *val);
Ok, makes sense.
Quoted 72 lines
Quoted 72 lines
drivers/sysinfo/iot2050.c new file +57
-0+return 0 ; +case BOARD_DDR_SIZE : +memcpy (val, &priv->info->ddr_size_mb, +sizeof (priv->info->ddr_size_mb)); +return 0 ; +default : +return -EINVAL ; + }; + + val[size -1 ] ='\0' ; +return 0 ; +} + +static int sysinfo_iot2050_get_int (struct udevice *dev,int id,int *val) +{ +struct sysinfo_iot2050_priv *priv =dev_get_priv (dev); + +switch (id) { +case BOARD_MAC_ADDR_CNT : + *val = priv->info->mac_addr_cnt; +return 0 ; +default : +return -EINVAL ; + }; +} + +static const struct sysinfo_ops sysinfo_iot2050_ops = { + .detect = sysinfo_iot2050_detect, + .get_str = sysinfo_iot2050_get_str, + .get_int = sysinfo_iot2050_get_int, +}; + +static int sysinfo_iot2050_probe (struct udevice *dev) +{ +struct sysinfo_iot2050_priv *priv =dev_get_priv (dev); +unsigned long offset; + + offset =dev_read_u32_default (dev,"offset" , +TI_SRAM_SCRATCH_BOARD_EEPROM_START ); + priv->info = (struct iot2050_info *)offset; + +return 0 ; +} + +static const struct udevice_id sysinfo_iot2050_ids[] = { + { .compatible ="siemens,sysinfo-iot2050" }, + {/* sentinel */ } +}; + +U_BOOT_DRIVER (sysinfo_iot2050) = { + .name ="sysinfo_iot2050" , + .id =UCLASS_SYSINFO , + .of_match = sysinfo_iot2050_ids, + .ops = &sysinfo_iot2050_ops, + .priv_auto =sizeof (struct sysinfo_iot2050_priv ), + .probe = sysinfo_iot2050_probe, +};drivers/sysinfo/iot2050.h new file +8
-0@@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (c) Siemens AG, 2024 +*/ + +#include <sysinfo.h> + +enum sysinfo_id_iot2050 {
Quoted 8 lines
drivers/sysinfo/iot2050.h line 13
Quoted 5 lines
drivers/sysinfo/iot2050.h new file +5
-0+BOARD_MLFB =SYSINFO_ID_SMBIOS_SYSTEM_VERSION , +BOARD_SERIAL =SYSINFO_ID_SMBIOS_SYSTEM_SERIAL , +BOARD_UUID =SYSINFO_ID_SMBIOS_SYSTEM_UUID , +BOARD_A5E =SYSINFO_ID_SMBIOS_BASEBOARD_PRODUCT , + BOARD_NAME = SYSINFO_ID_SMBIOS_BASEBOARD_VERSION,Do you need to rename these? It seems better to use the standard names, although I do think they are quite long.
We don't rename, we map pre-existing field names in EEPROM and pre-existing board-specific U-Boot env vars to sysinfo fields here.
Quoted 14 lines
drivers/sysinfo/iot2050.h line 25
Quoted 13 lines
drivers/sysinfo/iot2050.h new file +12
-0+BOARD_SEBOOT_VER =SYSINFO_ID_USER +0 , +BOARD_MAC_ADDR_CNT =SYSINFO_ID_USER +1 , +BOARD_MAC_ADDR_1 =SYSINFO_ID_USER +2 , +BOARD_MAC_ADDR_START =BOARD_MAC_ADDR_1 , +BOARD_MAC_ADDR_2 =SYSINFO_ID_USER +3 , +BOARD_MAC_ADDR_3 =SYSINFO_ID_USER +4 , +BOARD_MAC_ADDR_4 =SYSINFO_ID_USER +5 , +BOARD_MAC_ADDR_5 =SYSINFO_ID_USER +6 , +BOARD_MAC_ADDR_6 =SYSINFO_ID_USER +7 , +BOARD_MAC_ADDR_7 =SYSINFO_ID_USER +8 , +BOARD_MAC_ADDR_8 =SYSINFO_ID_USER +9 , + BOARD_DDR_SIZE = SYSINFO_ID_USER + 10,
Quoted 2 lines
These are the ones which should be added as standard. Be sure to comment them as necessary.
You mean that BOARD_MAC_ADDR and BOARD_DDR_SIZE should become SYSINFO_ID_BOARD_MAC_ADDR and SYSINFO_ID_BOARD_DDR_SIZE? But BOARD_SEBOOT_VER is nothing that has any meaning beyond our board.
Jan
Signature · 2 lines
Siemens AG, Technology Linux Expert Center
Re: [PATCH v2 12/13] sysinfo: Add driver for IOT2050 boards
Hi Jan,
Quoted 298 lines · Jan Kiszka
Quoted 23 lines · Simon Glass
Quoted 11 lines · Jan Kiszka
From: Li Hua Qian <[email protected]>
This brings a sysinfo driver and DT entry for the IOT2050 board series. It translates the board information passed from SE-Boot to SPL into values that can be retrieved via the sysinfo API. Will is already used to fill the SMBIOS table when booting via EFI.
Signed-off-by Li Hua Qian <[email protected]>[Jan: split-off as separate patch, cleanup]Signed-off-by Jan Kiszka <[email protected]>Quoted 10 lines
--- .../dts/k3-am65-iot2050-common-u-boot.dtsi | 18 +++ configs/iot2050_defconfig | 1 + drivers/sysinfo/Kconfig | 7 + drivers/sysinfo/Makefile | 1 + drivers/sysinfo/iot2050.c | 143 ++++++++++++++++++ drivers/sysinfo/iot2050.h | 26 ++++ 6 files changed, 196 insertions(+) create mode 100644 drivers/sysinfo/iot2050.c create mode 100644 drivers/sysinfo/iot2050.hQuoted 2 lines
I think
strlcpy()might be better thanstrncpy()for this caseAck.
Quoted 3 lines
The idea with sysinfo is that we use the same enum for all boards, so please add your new things to
sysinfo.hSee below.
Quoted 3 lines
Do you actually want all the sysinfo info in capitals? If so, that's fine, just checking...
This is how it is being shipped already, yes.
Quoted 169 lines
Quoted 154 lines
arch/arm/dts/k3-am65-iot2050-common-u-boot.dtsi +18
-0@@ -14,6 +14,24 @@ spi0 = &ospi0; }; + sysinfo { + compatible = "siemens,sysinfo-iot2050"; + /* TI_SRAM_SCRATCH_BOARD_EEPROM_START */ + offset = <0x40280000>; + bootph-all; + + smbios { + system { + manufacturer = "SIEMENS AG"; + product = "SIMATIC IOT2050"; + }; + + baseboard { + manufacturer = "SIEMENS AG"; + }; + }; + }; + leds { bootph-all; status-led-red {configs/iot2050_defconfig +1
-0@@ -141,6 +141,7 @@ CONFIG_SOC_TI=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_CADENCE_QSPI=y +CONFIG_SYSINFO=y CONFIG_SYSRESET=y CONFIG_SPL_SYSRESET=y CONFIG_SYSRESET_TI_SCI=ydrivers/sysinfo/Kconfig +7
-0@@ -31,6 +31,13 @@ config SYSINFO_RCAR3 help Support querying SoC version information for Renesas R-Car Gen3. +config SYSINFO_IOT2050 + bool "Enable sysinfo driver for the Siemens IOT2050" + depends on TARGET_IOT2050_A53 + default y if TARGET_IOT2050_A53 + help + Support querying device information for Siemens IOT2050. + config SYSINFO_SANDBOX bool "Enable sysinfo driver for the Sandbox board" helpdrivers/sysinfo/Makefile +1
-0@@ -5,6 +5,7 @@ obj-y += sysinfo-uclass.o obj-$(CONFIG_SYSINFO_GAZERBEAM) += gazerbeam.o obj-$(CONFIG_SYSINFO_GPIO) += gpio.o +obj-$(CONFIG_SYSINFO_IOT2050) += iot2050.o obj-$(CONFIG_SYSINFO_RCAR3) += rcar3.o obj-$(CONFIG_SYSINFO_SANDBOX) += sandbox.o obj-$(CONFIG_SYSINFO_SMBIOS) += smbios.odrivers/sysinfo/iot2050.c new file +76
-0@@ -0,0 +1,143 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (c) Siemens AG, 2024 +*/ + +#include <dm.h> +#include <sysinfo.h> +#include <net.h> +#include <asm/arch/hardware.h> + +#include "iot2050.h" + +#define IOT2050_INFO_MAGIC 0x20502050 + +struct iot2050_info { +u32 magic; +u16 size; +char name[20 +1 ]; +char serial[16 +1 ]; +char mlfb[18 +1 ]; +char uuid[32 +1 ]; +char a5e[18 +1 ]; +u8 mac_addr_cnt; +u8 mac_addr[8 ][ARP_HLEN ]; +char seboot_version[40 +1 ]; +u8 padding[3 ]; +u32 ddr_size_mb; +} __packed; + +/** +* struct sysinfo_iot2050_priv - sysinfo private data +* @info: iot2050 board info +*/ +struct sysinfo_iot2050_priv { +struct iot2050_info *info; +}; + +static int sysinfo_iot2050_detect (struct udevice *dev) +{ +struct sysinfo_iot2050_priv *priv =dev_get_priv (dev); + +if (priv->info ==NULL || priv->info->magic !=IOT2050_INFO_MAGIC ) +return -EFAULT ; + +return 0 ; +} + +static int sysinfo_iot2050_get_str (struct udevice *dev,int id,size_t size, +char *val) +{ +struct sysinfo_iot2050_priv *priv =dev_get_priv (dev); +char byte_str[3 ] = {0 }; +unsigned int n; + +switch (id) { +case BOARD_NAME : +strncpy (val, priv->info->name, size); +break ; +case BOARD_SERIAL : +strncpy (val, priv->info->serial, size); +break ; +case BOARD_MLFB : +strncpy (val, priv->info->mlfb, size); +break ; +case BOARD_UUID : +for (n =0 ; n <min (size, (size_t )16 ); n++) { +memcpy (byte_str, priv->info->uuid + n *2 ,2 ); + val[n] = (char )hextoul (byte_str,NULL ); + } +break ; +case BOARD_A5E : +strncpy (val, priv->info->a5e, size); +break ; +case BOARD_SEBOOT_VER : +strncpy (val, priv->info->seboot_version, size); +break ;drivers/sysinfo/iot2050.c line 86
Quoted 10 lines
drivers/sysinfo/iot2050.c new file +10
-0+case BOARD_MAC_ADDR_1 : +case BOARD_MAC_ADDR_2 : +case BOARD_MAC_ADDR_3 : +case BOARD_MAC_ADDR_4 : +case BOARD_MAC_ADDR_5 : +case BOARD_MAC_ADDR_6 : +case BOARD_MAC_ADDR_7 : +case BOARD_MAC_ADDR_8 : +memcpy (val, priv->info->mac_addr[id -BOARD_MAC_ADDR_START ], +ARP_HLEN );For this, we really need another parameter to
get_str(), i.e. the index, since we don't know how many MACs there will be. So how about adding a few new operations?Quoted 3 lines
int (*get_item_count)(struct udevice *dev, int id);
int (*get_str_item)(struct udevice *dev, int id, int index,size_tsize, char *val);Ok, makes sense.
Quoted 72 lines
Quoted 72 lines
drivers/sysinfo/iot2050.c new file +57
-0+return 0 ; +case BOARD_DDR_SIZE : +memcpy (val, &priv->info->ddr_size_mb, +sizeof (priv->info->ddr_size_mb)); +return 0 ; +default : +return -EINVAL ; + }; + + val[size -1 ] ='\0' ; +return 0 ; +} + +static int sysinfo_iot2050_get_int (struct udevice *dev,int id,int *val) +{ +struct sysinfo_iot2050_priv *priv =dev_get_priv (dev); + +switch (id) { +case BOARD_MAC_ADDR_CNT : + *val = priv->info->mac_addr_cnt; +return 0 ; +default : +return -EINVAL ; + }; +} + +static const struct sysinfo_ops sysinfo_iot2050_ops = { + .detect = sysinfo_iot2050_detect, + .get_str = sysinfo_iot2050_get_str, + .get_int = sysinfo_iot2050_get_int, +}; + +static int sysinfo_iot2050_probe (struct udevice *dev) +{ +struct sysinfo_iot2050_priv *priv =dev_get_priv (dev); +unsigned long offset; + + offset =dev_read_u32_default (dev,"offset" , +TI_SRAM_SCRATCH_BOARD_EEPROM_START ); + priv->info = (struct iot2050_info *)offset; + +return 0 ; +} + +static const struct udevice_id sysinfo_iot2050_ids[] = { + { .compatible ="siemens,sysinfo-iot2050" }, + {/* sentinel */ } +}; + +U_BOOT_DRIVER (sysinfo_iot2050) = { + .name ="sysinfo_iot2050" , + .id =UCLASS_SYSINFO , + .of_match = sysinfo_iot2050_ids, + .ops = &sysinfo_iot2050_ops, + .priv_auto =sizeof (struct sysinfo_iot2050_priv ), + .probe = sysinfo_iot2050_probe, +};drivers/sysinfo/iot2050.h new file +8
-0@@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (c) Siemens AG, 2024 +*/ + +#include <sysinfo.h> + +enum sysinfo_id_iot2050 {Quoted 8 lines
drivers/sysinfo/iot2050.h line 13
Quoted 5 lines
drivers/sysinfo/iot2050.h new file +5
-0+BOARD_MLFB =SYSINFO_ID_SMBIOS_SYSTEM_VERSION , +BOARD_SERIAL =SYSINFO_ID_SMBIOS_SYSTEM_SERIAL , +BOARD_UUID =SYSINFO_ID_SMBIOS_SYSTEM_UUID , +BOARD_A5E =SYSINFO_ID_SMBIOS_BASEBOARD_PRODUCT , + BOARD_NAME = SYSINFO_ID_SMBIOS_BASEBOARD_VERSION,Do you need to rename these? It seems better to use the standard names, although I do think they are quite long.
Quoted 2 lines
We don't rename, we map pre-existing field names in EEPROM and pre-existing board-specific U-Boot env vars to sysinfo fields here.
Yes, that's what I mean. Can you just use the SYSINFO_ID... values directory, rather than creating mapping?
Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
drivers/sysinfo/iot2050.h new file +12
-0+BOARD_SEBOOT_VER =SYSINFO_ID_USER +0 , +BOARD_MAC_ADDR_CNT =SYSINFO_ID_USER +1 , +BOARD_MAC_ADDR_1 =SYSINFO_ID_USER +2 , +BOARD_MAC_ADDR_START =BOARD_MAC_ADDR_1 , +BOARD_MAC_ADDR_2 =SYSINFO_ID_USER +3 , +BOARD_MAC_ADDR_3 =SYSINFO_ID_USER +4 , +BOARD_MAC_ADDR_4 =SYSINFO_ID_USER +5 , +BOARD_MAC_ADDR_5 =SYSINFO_ID_USER +6 , +BOARD_MAC_ADDR_6 =SYSINFO_ID_USER +7 , +BOARD_MAC_ADDR_7 =SYSINFO_ID_USER +8 , +BOARD_MAC_ADDR_8 =SYSINFO_ID_USER +9 , + BOARD_DDR_SIZE = SYSINFO_ID_USER + 10,
Quoted 6 lines
Quoted 2 lines
These are the ones which should be added as standard. Be sure to comment them as necessary.
You mean that
BOARD_MAC_ADDRandBOARD_DDR_SIZEshould becomeSYSINFO_ID_BOARD_MAC_ADDRandSYSINFO_ID_BOARD_DDR_SIZE? ButBOARD_SEBOOT_VERis nothing that has any meaning beyond our board.
For BOARD_SEBOOT_VER, I don't know what it is, but just add a comment and put it in sysinfo.h. It is OK to add board-specific stufff there.
Is BOARD_DDR_SIZE the memory size? Perhaps rename it to RAM_SIZE ?
Regards,
Simon
Re: [PATCH v2 12/13] sysinfo: Add driver for IOT2050 boards
Quoted 301 lines · Simon Glass
Hi Jan,
Quoted 298 lines · Jan Kiszka
Quoted 23 lines · Simon Glass
Quoted 11 lines · Jan Kiszka
From: Li Hua Qian <[email protected]>
This brings a sysinfo driver and DT entry for the IOT2050 board series. It translates the board information passed from SE-Boot to SPL into values that can be retrieved via the sysinfo API. Will is already used to fill the SMBIOS table when booting via EFI.
Signed-off-by Li Hua Qian <[email protected]>[Jan: split-off as separate patch, cleanup]Signed-off-by Jan Kiszka <[email protected]>Quoted 10 lines
--- .../dts/k3-am65-iot2050-common-u-boot.dtsi | 18 +++ configs/iot2050_defconfig | 1 + drivers/sysinfo/Kconfig | 7 + drivers/sysinfo/Makefile | 1 + drivers/sysinfo/iot2050.c | 143 ++++++++++++++++++ drivers/sysinfo/iot2050.h | 26 ++++ 6 files changed, 196 insertions(+) create mode 100644 drivers/sysinfo/iot2050.c create mode 100644 drivers/sysinfo/iot2050.hQuoted 2 lines
I think
strlcpy()might be better thanstrncpy()for this caseAck.
Quoted 3 lines
The idea with sysinfo is that we use the same enum for all boards, so please add your new things to
sysinfo.hSee below.
Quoted 3 lines
Do you actually want all the sysinfo info in capitals? If so, that's fine, just checking...
This is how it is being shipped already, yes.
Quoted 169 lines
Quoted 154 lines
arch/arm/dts/k3-am65-iot2050-common-u-boot.dtsi +18
-0@@ -14,6 +14,24 @@ spi0 = &ospi0; }; + sysinfo { + compatible = "siemens,sysinfo-iot2050"; + /* TI_SRAM_SCRATCH_BOARD_EEPROM_START */ + offset = <0x40280000>; + bootph-all; + + smbios { + system { + manufacturer = "SIEMENS AG"; + product = "SIMATIC IOT2050"; + }; + + baseboard { + manufacturer = "SIEMENS AG"; + }; + }; + }; + leds { bootph-all; status-led-red {configs/iot2050_defconfig +1
-0@@ -141,6 +141,7 @@ CONFIG_SOC_TI=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_CADENCE_QSPI=y +CONFIG_SYSINFO=y CONFIG_SYSRESET=y CONFIG_SPL_SYSRESET=y CONFIG_SYSRESET_TI_SCI=ydrivers/sysinfo/Kconfig +7
-0@@ -31,6 +31,13 @@ config SYSINFO_RCAR3 help Support querying SoC version information for Renesas R-Car Gen3. +config SYSINFO_IOT2050 + bool "Enable sysinfo driver for the Siemens IOT2050" + depends on TARGET_IOT2050_A53 + default y if TARGET_IOT2050_A53 + help + Support querying device information for Siemens IOT2050. + config SYSINFO_SANDBOX bool "Enable sysinfo driver for the Sandbox board" helpdrivers/sysinfo/Makefile +1
-0@@ -5,6 +5,7 @@ obj-y += sysinfo-uclass.o obj-$(CONFIG_SYSINFO_GAZERBEAM) += gazerbeam.o obj-$(CONFIG_SYSINFO_GPIO) += gpio.o +obj-$(CONFIG_SYSINFO_IOT2050) += iot2050.o obj-$(CONFIG_SYSINFO_RCAR3) += rcar3.o obj-$(CONFIG_SYSINFO_SANDBOX) += sandbox.o obj-$(CONFIG_SYSINFO_SMBIOS) += smbios.odrivers/sysinfo/iot2050.c new file +76
-0@@ -0,0 +1,143 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (c) Siemens AG, 2024 +*/ + +#include <dm.h> +#include <sysinfo.h> +#include <net.h> +#include <asm/arch/hardware.h> + +#include "iot2050.h" + +#define IOT2050_INFO_MAGIC 0x20502050 + +struct iot2050_info { +u32 magic; +u16 size; +char name[20 +1 ]; +char serial[16 +1 ]; +char mlfb[18 +1 ]; +char uuid[32 +1 ]; +char a5e[18 +1 ]; +u8 mac_addr_cnt; +u8 mac_addr[8 ][ARP_HLEN ]; +char seboot_version[40 +1 ]; +u8 padding[3 ]; +u32 ddr_size_mb; +} __packed; + +/** +* struct sysinfo_iot2050_priv - sysinfo private data +* @info: iot2050 board info +*/ +struct sysinfo_iot2050_priv { +struct iot2050_info *info; +}; + +static int sysinfo_iot2050_detect (struct udevice *dev) +{ +struct sysinfo_iot2050_priv *priv =dev_get_priv (dev); + +if (priv->info ==NULL || priv->info->magic !=IOT2050_INFO_MAGIC ) +return -EFAULT ; + +return 0 ; +} + +static int sysinfo_iot2050_get_str (struct udevice *dev,int id,size_t size, +char *val) +{ +struct sysinfo_iot2050_priv *priv =dev_get_priv (dev); +char byte_str[3 ] = {0 }; +unsigned int n; + +switch (id) { +case BOARD_NAME : +strncpy (val, priv->info->name, size); +break ; +case BOARD_SERIAL : +strncpy (val, priv->info->serial, size); +break ; +case BOARD_MLFB : +strncpy (val, priv->info->mlfb, size); +break ; +case BOARD_UUID : +for (n =0 ; n <min (size, (size_t )16 ); n++) { +memcpy (byte_str, priv->info->uuid + n *2 ,2 ); + val[n] = (char )hextoul (byte_str,NULL ); + } +break ; +case BOARD_A5E : +strncpy (val, priv->info->a5e, size); +break ; +case BOARD_SEBOOT_VER : +strncpy (val, priv->info->seboot_version, size); +break ;drivers/sysinfo/iot2050.c line 86
Quoted 10 lines
drivers/sysinfo/iot2050.c new file +10
-0+case BOARD_MAC_ADDR_1 : +case BOARD_MAC_ADDR_2 : +case BOARD_MAC_ADDR_3 : +case BOARD_MAC_ADDR_4 : +case BOARD_MAC_ADDR_5 : +case BOARD_MAC_ADDR_6 : +case BOARD_MAC_ADDR_7 : +case BOARD_MAC_ADDR_8 : +memcpy (val, priv->info->mac_addr[id -BOARD_MAC_ADDR_START ], +ARP_HLEN );For this, we really need another parameter to
get_str(), i.e. the index, since we don't know how many MACs there will be. So how about adding a few new operations?Quoted 3 lines
int (*get_item_count)(struct udevice *dev, int id);
int (*get_str_item)(struct udevice *dev, int id, int index,size_tsize, char *val);Ok, makes sense.
Quoted 80 lines
Quoted 67 lines
drivers/sysinfo/iot2050.c new file +57
-0+return 0 ; +case BOARD_DDR_SIZE : +memcpy (val, &priv->info->ddr_size_mb, +sizeof (priv->info->ddr_size_mb)); +return 0 ; +default : +return -EINVAL ; + }; + + val[size -1 ] ='\0' ; +return 0 ; +} + +static int sysinfo_iot2050_get_int (struct udevice *dev,int id,int *val) +{ +struct sysinfo_iot2050_priv *priv =dev_get_priv (dev); + +switch (id) { +case BOARD_MAC_ADDR_CNT : + *val = priv->info->mac_addr_cnt; +return 0 ; +default : +return -EINVAL ; + }; +} + +static const struct sysinfo_ops sysinfo_iot2050_ops = { + .detect = sysinfo_iot2050_detect, + .get_str = sysinfo_iot2050_get_str, + .get_int = sysinfo_iot2050_get_int, +}; + +static int sysinfo_iot2050_probe (struct udevice *dev) +{ +struct sysinfo_iot2050_priv *priv =dev_get_priv (dev); +unsigned long offset; + + offset =dev_read_u32_default (dev,"offset" , +TI_SRAM_SCRATCH_BOARD_EEPROM_START ); + priv->info = (struct iot2050_info *)offset; + +return 0 ; +} + +static const struct udevice_id sysinfo_iot2050_ids[] = { + { .compatible ="siemens,sysinfo-iot2050" }, + {/* sentinel */ } +}; + +U_BOOT_DRIVER (sysinfo_iot2050) = { + .name ="sysinfo_iot2050" , + .id =UCLASS_SYSINFO , + .of_match = sysinfo_iot2050_ids, + .ops = &sysinfo_iot2050_ops, + .priv_auto =sizeof (struct sysinfo_iot2050_priv ), + .probe = sysinfo_iot2050_probe, +};drivers/sysinfo/iot2050.h new file +3
-0@@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (c) Siemens AG, 2024 drivers/sysinfo/iot2050.h line 13
Quoted 10 lines
drivers/sysinfo/iot2050.h new file +10
-0+*/ + +#include <sysinfo.h> + +enum sysinfo_id_iot2050 { +BOARD_MLFB =SYSINFO_ID_SMBIOS_SYSTEM_VERSION , +BOARD_SERIAL =SYSINFO_ID_SMBIOS_SYSTEM_SERIAL , +BOARD_UUID =SYSINFO_ID_SMBIOS_SYSTEM_UUID , +BOARD_A5E =SYSINFO_ID_SMBIOS_BASEBOARD_PRODUCT , +BOARD_NAME =SYSINFO_ID_SMBIOS_BASEBOARD_VERSION ,Do you need to rename these? It seems better to use the standard names, although I do think they are quite long.
Quoted 6 lines
Quoted 2 lines
We don't rename, we map pre-existing field names in EEPROM and pre-existing board-specific U-Boot env vars to sysinfo fields here.
Yes, that's what I mean. Can you just use the
SYSINFO_ID... values directory, rather than creating mapping?
The mapping is unavoidable ("pre-existing"), and here is the most logical point for me as it avoids that we have to do it twice: first in the sysinfo driver (EEPROM->SYSINFO_ID) and then again in set_board_info_env (SYSINFO_ID->env-vars).
Quoted 18 lines
Quoted 18 lines
Quoted 17 lines
Quoted 4 lines
drivers/sysinfo/iot2050.h new file +2
-0+BOARD_SEBOOT_VER =SYSINFO_ID_USER +0 , + BOARD_MAC_ADDR_CNT = SYSINFO_ID_USER + 1,drivers/sysinfo/iot2050.h line 25
Quoted 10 lines
drivers/sysinfo/iot2050.h new file +10
-0+BOARD_MAC_ADDR_1 =SYSINFO_ID_USER +2 , +BOARD_MAC_ADDR_START =BOARD_MAC_ADDR_1 , +BOARD_MAC_ADDR_2 =SYSINFO_ID_USER +3 , +BOARD_MAC_ADDR_3 =SYSINFO_ID_USER +4 , +BOARD_MAC_ADDR_4 =SYSINFO_ID_USER +5 , +BOARD_MAC_ADDR_5 =SYSINFO_ID_USER +6 , +BOARD_MAC_ADDR_6 =SYSINFO_ID_USER +7 , +BOARD_MAC_ADDR_7 =SYSINFO_ID_USER +8 , +BOARD_MAC_ADDR_8 =SYSINFO_ID_USER +9 , + BOARD_DDR_SIZE = SYSINFO_ID_USER + 10,These are the ones which should be added as standard. Be sure to comment them as necessary.
Quoted 7 lines
Quoted 3 lines
You mean that
BOARD_MAC_ADDRandBOARD_DDR_SIZEshould becomeSYSINFO_ID_BOARD_MAC_ADDRandSYSINFO_ID_BOARD_DDR_SIZE? ButBOARD_SEBOOT_VERis nothing that has any meaning beyond our board.For
BOARD_SEBOOT_VER, I don't know what it is, but just add a comment and put it insysinfo.h. It is OK to add board-specific stufff there.
This still makes no sense to me. What is the point of SYSINFO_ID_USER then? Why does it exists and is being used elsewhere when it shouldn't?
Quoted 2 lines
Is
BOARD_DDR_SIZEthe memory size? Perhaps rename it toRAM_SIZE?
Yes, and I'm also considering to append "_MB" in order to clarify the unit.
Jan
Signature · 2 lines
Siemens AG, Technology Linux Expert Center
Re: [PATCH v2 12/13] sysinfo: Add driver for IOT2050 boards
Hi Jan,
Quoted 306 lines · Jan Kiszka
Quoted 304 lines · Simon Glass
Hi Jan,
Quoted 300 lines · Jan Kiszka
Quoted 23 lines · Simon Glass
Quoted 11 lines · Jan Kiszka
From: Li Hua Qian <[email protected]>
This brings a sysinfo driver and DT entry for the IOT2050 board series. It translates the board information passed from SE-Boot to SPL into values that can be retrieved via the sysinfo API. Will is already used to fill the SMBIOS table when booting via EFI.
Signed-off-by Li Hua Qian <[email protected]>[Jan: split-off as separate patch, cleanup]Signed-off-by Jan Kiszka <[email protected]>Quoted 10 lines
--- .../dts/k3-am65-iot2050-common-u-boot.dtsi | 18 +++ configs/iot2050_defconfig | 1 + drivers/sysinfo/Kconfig | 7 + drivers/sysinfo/Makefile | 1 + drivers/sysinfo/iot2050.c | 143 ++++++++++++++++++ drivers/sysinfo/iot2050.h | 26 ++++ 6 files changed, 196 insertions(+) create mode 100644 drivers/sysinfo/iot2050.c create mode 100644 drivers/sysinfo/iot2050.hQuoted 2 lines
I think
strlcpy()might be better thanstrncpy()for this caseAck.
Quoted 3 lines
The idea with sysinfo is that we use the same enum for all boards, so please add your new things to
sysinfo.hSee below.
Quoted 3 lines
Do you actually want all the sysinfo info in capitals? If so, that's fine, just checking...
This is how it is being shipped already, yes.
Quoted 169 lines
Quoted 154 lines
arch/arm/dts/k3-am65-iot2050-common-u-boot.dtsi +18
-0@@ -14,6 +14,24 @@ spi0 = &ospi0; }; + sysinfo { + compatible = "siemens,sysinfo-iot2050"; + /* TI_SRAM_SCRATCH_BOARD_EEPROM_START */ + offset = <0x40280000>; + bootph-all; + + smbios { + system { + manufacturer = "SIEMENS AG"; + product = "SIMATIC IOT2050"; + }; + + baseboard { + manufacturer = "SIEMENS AG"; + }; + }; + }; + leds { bootph-all; status-led-red {configs/iot2050_defconfig +1
-0@@ -141,6 +141,7 @@ CONFIG_SOC_TI=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_CADENCE_QSPI=y +CONFIG_SYSINFO=y CONFIG_SYSRESET=y CONFIG_SPL_SYSRESET=y CONFIG_SYSRESET_TI_SCI=ydrivers/sysinfo/Kconfig +7
-0@@ -31,6 +31,13 @@ config SYSINFO_RCAR3 help Support querying SoC version information for Renesas R-Car Gen3. +config SYSINFO_IOT2050 + bool "Enable sysinfo driver for the Siemens IOT2050" + depends on TARGET_IOT2050_A53 + default y if TARGET_IOT2050_A53 + help + Support querying device information for Siemens IOT2050. + config SYSINFO_SANDBOX bool "Enable sysinfo driver for the Sandbox board" helpdrivers/sysinfo/Makefile +1
-0@@ -5,6 +5,7 @@ obj-y += sysinfo-uclass.o obj-$(CONFIG_SYSINFO_GAZERBEAM) += gazerbeam.o obj-$(CONFIG_SYSINFO_GPIO) += gpio.o +obj-$(CONFIG_SYSINFO_IOT2050) += iot2050.o obj-$(CONFIG_SYSINFO_RCAR3) += rcar3.o obj-$(CONFIG_SYSINFO_SANDBOX) += sandbox.o obj-$(CONFIG_SYSINFO_SMBIOS) += smbios.odrivers/sysinfo/iot2050.c new file +76
-0@@ -0,0 +1,143 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (c) Siemens AG, 2024 +*/ + +#include <dm.h> +#include <sysinfo.h> +#include <net.h> +#include <asm/arch/hardware.h> + +#include "iot2050.h" + +#define IOT2050_INFO_MAGIC 0x20502050 + +struct iot2050_info { +u32 magic; +u16 size; +char name[20 +1 ]; +char serial[16 +1 ]; +char mlfb[18 +1 ]; +char uuid[32 +1 ]; +char a5e[18 +1 ]; +u8 mac_addr_cnt; +u8 mac_addr[8 ][ARP_HLEN ]; +char seboot_version[40 +1 ]; +u8 padding[3 ]; +u32 ddr_size_mb; +} __packed; + +/** +* struct sysinfo_iot2050_priv - sysinfo private data +* @info: iot2050 board info +*/ +struct sysinfo_iot2050_priv { +struct iot2050_info *info; +}; + +static int sysinfo_iot2050_detect (struct udevice *dev) +{ +struct sysinfo_iot2050_priv *priv =dev_get_priv (dev); + +if (priv->info ==NULL || priv->info->magic !=IOT2050_INFO_MAGIC ) +return -EFAULT ; + +return 0 ; +} + +static int sysinfo_iot2050_get_str (struct udevice *dev,int id,size_t size, +char *val) +{ +struct sysinfo_iot2050_priv *priv =dev_get_priv (dev); +char byte_str[3 ] = {0 }; +unsigned int n; + +switch (id) { +case BOARD_NAME : +strncpy (val, priv->info->name, size); +break ; +case BOARD_SERIAL : +strncpy (val, priv->info->serial, size); +break ; +case BOARD_MLFB : +strncpy (val, priv->info->mlfb, size); +break ; +case BOARD_UUID : +for (n =0 ; n <min (size, (size_t )16 ); n++) { +memcpy (byte_str, priv->info->uuid + n *2 ,2 ); + val[n] = (char )hextoul (byte_str,NULL ); + } +break ; +case BOARD_A5E : +strncpy (val, priv->info->a5e, size); +break ; +case BOARD_SEBOOT_VER : +strncpy (val, priv->info->seboot_version, size); +break ;drivers/sysinfo/iot2050.c line 86
Quoted 10 lines
drivers/sysinfo/iot2050.c new file +10
-0+case BOARD_MAC_ADDR_1 : +case BOARD_MAC_ADDR_2 : +case BOARD_MAC_ADDR_3 : +case BOARD_MAC_ADDR_4 : +case BOARD_MAC_ADDR_5 : +case BOARD_MAC_ADDR_6 : +case BOARD_MAC_ADDR_7 : +case BOARD_MAC_ADDR_8 : +memcpy (val, priv->info->mac_addr[id -BOARD_MAC_ADDR_START ], +ARP_HLEN );For this, we really need another parameter to
get_str(), i.e. the index, since we don't know how many MACs there will be. So how about adding a few new operations?Quoted 3 lines
int (*get_item_count)(struct udevice *dev, int id);
int (*get_str_item)(struct udevice *dev, int id, int index,size_tsize, char *val);Ok, makes sense.
Quoted 72 lines
Quoted 72 lines
drivers/sysinfo/iot2050.c new file +57
-0+return 0 ; +case BOARD_DDR_SIZE : +memcpy (val, &priv->info->ddr_size_mb, +sizeof (priv->info->ddr_size_mb)); +return 0 ; +default : +return -EINVAL ; + }; + + val[size -1 ] ='\0' ; +return 0 ; +} + +static int sysinfo_iot2050_get_int (struct udevice *dev,int id,int *val) +{ +struct sysinfo_iot2050_priv *priv =dev_get_priv (dev); + +switch (id) { +case BOARD_MAC_ADDR_CNT : + *val = priv->info->mac_addr_cnt; +return 0 ; +default : +return -EINVAL ; + }; +} + +static const struct sysinfo_ops sysinfo_iot2050_ops = { + .detect = sysinfo_iot2050_detect, + .get_str = sysinfo_iot2050_get_str, + .get_int = sysinfo_iot2050_get_int, +}; + +static int sysinfo_iot2050_probe (struct udevice *dev) +{ +struct sysinfo_iot2050_priv *priv =dev_get_priv (dev); +unsigned long offset; + + offset =dev_read_u32_default (dev,"offset" , +TI_SRAM_SCRATCH_BOARD_EEPROM_START ); + priv->info = (struct iot2050_info *)offset; + +return 0 ; +} + +static const struct udevice_id sysinfo_iot2050_ids[] = { + { .compatible ="siemens,sysinfo-iot2050" }, + {/* sentinel */ } +}; + +U_BOOT_DRIVER (sysinfo_iot2050) = { + .name ="sysinfo_iot2050" , + .id =UCLASS_SYSINFO , + .of_match = sysinfo_iot2050_ids, + .ops = &sysinfo_iot2050_ops, + .priv_auto =sizeof (struct sysinfo_iot2050_priv ), + .probe = sysinfo_iot2050_probe, +};drivers/sysinfo/iot2050.h new file +8
-0@@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (c) Siemens AG, 2024 +*/ + +#include <sysinfo.h> + +enum sysinfo_id_iot2050 {Quoted 8 lines
drivers/sysinfo/iot2050.h line 13
Quoted 5 lines
drivers/sysinfo/iot2050.h new file +5
-0+BOARD_MLFB =SYSINFO_ID_SMBIOS_SYSTEM_VERSION , +BOARD_SERIAL =SYSINFO_ID_SMBIOS_SYSTEM_SERIAL , +BOARD_UUID =SYSINFO_ID_SMBIOS_SYSTEM_UUID , +BOARD_A5E =SYSINFO_ID_SMBIOS_BASEBOARD_PRODUCT , + BOARD_NAME = SYSINFO_ID_SMBIOS_BASEBOARD_VERSION,Do you need to rename these? It seems better to use the standard names, although I do think they are quite long.
We don't rename, we map pre-existing field names in EEPROM and pre-existing board-specific U-Boot env vars to sysinfo fields here.
Quoted 8 lines
Quoted 3 lines
Yes, that's what I mean. Can you just use the
SYSINFO_ID... values directory, rather than creating mapping?The mapping is unavoidable ("pre-existing"), and here is the most logical point for me as it avoids that we have to do it twice: first in the sysinfo driver (
EEPROM->SYSINFO_ID) and then again inset_board_info_env(SYSINFO_ID->env-vars).
If the EEPROM is storing it in an internal format, there should be a mapping.
Quoted 23 lines
Quoted 23 lines
Quoted 22 lines
Quoted 16 lines
Quoted 5 lines
drivers/sysinfo/iot2050.h new file +2
-0+BOARD_SEBOOT_VER =SYSINFO_ID_USER +0 , + BOARD_MAC_ADDR_CNT = SYSINFO_ID_USER + 1,drivers/sysinfo/iot2050.h line 25
Quoted 10 lines
drivers/sysinfo/iot2050.h new file +10
-0+BOARD_MAC_ADDR_1 =SYSINFO_ID_USER +2 , +BOARD_MAC_ADDR_START =BOARD_MAC_ADDR_1 , +BOARD_MAC_ADDR_2 =SYSINFO_ID_USER +3 , +BOARD_MAC_ADDR_3 =SYSINFO_ID_USER +4 , +BOARD_MAC_ADDR_4 =SYSINFO_ID_USER +5 , +BOARD_MAC_ADDR_5 =SYSINFO_ID_USER +6 , +BOARD_MAC_ADDR_6 =SYSINFO_ID_USER +7 , +BOARD_MAC_ADDR_7 =SYSINFO_ID_USER +8 , +BOARD_MAC_ADDR_8 =SYSINFO_ID_USER +9 , + BOARD_DDR_SIZE = SYSINFO_ID_USER + 10,Quoted 2 lines
These are the ones which should be added as standard. Be sure to comment them as necessary.
You mean that
BOARD_MAC_ADDRandBOARD_DDR_SIZEshould becomeSYSINFO_ID_BOARD_MAC_ADDRandSYSINFO_ID_BOARD_DDR_SIZE? ButBOARD_SEBOOT_VERis nothing that has any meaning beyond our board.
Quoted 6 lines
Quoted 3 lines
For
BOARD_SEBOOT_VER, I don't know what it is, but just add a comment and put it insysinfo.h. It is OK to add board-specific stufff there.This still makes no sense to me. What is the point of
SYSINFO_ID_USERthen? Why does it exists and is being used elsewhere when it shouldn't?
It's just that we should be trying to use common things where we can. If everyone creates their own set of MAC addresses, it just gets confusing. If you use an implied mapping for your use case, what will happen if someone else comes along and changes it?
Quoted 5 lines
Quoted 3 lines
Is
BOARD_DDR_SIZEthe memory size? Perhaps rename it toRAM_SIZE?Yes, and I'm also considering to append "
_MB" in order to clarify the unit.
Yes that's a good idea.
I've sent a patch changing the naming, BTW.
Regards,
Simon
PATCH v2 13/13 board: siemens: iot2050: Use sysinfo for board initialization
In reply to Jan KiszkaFrom: Li Hua Qian <[email protected]>
Drop the info structure parsing of the board in favor of our new sysinfo driver to avoid code duplication.
--- arch/arm/mach-k3/am65x/Kconfig | 2 + board/siemens/iot2050/board.c | 142 +++++++++++++++++++-------------- configs/iot2050_defconfig | 1 - 3 files changed, 82 insertions(+), 63 deletions(-)
arch/arm/mach-k3/am65x/Kconfig +2 -0
@@ -34,6 +34,8 @@ config TARGET_IOT2050_A53 select BOARD_LATE_INIT select SYS_DISABLE_DCACHE_OPS select BINMAN + select SYSINFO + select SPL_SYSINFO if SPL help This builds U-Boot for the IOT2050 devices.
board/siemens/iot2050/board.c +80 -62
221 lines not on this page · raw message
configs/iot2050_defconfig +0 -1
@@ -141,7 +141,6 @@ CONFIG_SOC_TI=y CONFIG_SPI=y CONFIG_DM_SPI=y CONFIG_CADENCE_QSPI=y -CONFIG_SYSINFO=y CONFIG_SYSRESET=y CONFIG_SPL_SYSRESET=y CONFIG_SYSRESET_TI_SCI=y
Signature · 1 line
2.43.0
Re: (subset) [PATCH v2 00/13] boards: siemens: iot2050: SM variant, sysinfo support, fixes & cleanups
In reply to Jan KiszkaQuoted 9 lines · Jan Kiszka
Changes in v2:
- rebased over master, adding the missing 6.12 cherry-picks from devicetree-rebasingThis adds support for the new IOT2050 SM variant, introduces a sysinfo driver which also permits SMBIOS support and switches the board to
OF_UPSTREAM. There are some further fixes for the boards included as well.[...]
Applied to u-boot/master, thanks!
Signature · 1 line
Tom