[PATCH v6 0/7] board: siemens: clean up subfolders

The common folder was initialially created for the common parts of the products based on draco-am355x board family. We have the product lines 'pxm2', 'rut' and the base line unfortunately named 'draco'! Adding the new capricorn-imx8 board family, the files were enhanced without cleanup.
Simplify first EEPROM probe and access that implements both i2c with & without driver model. Use abstraction functions for this.
Move all am355x specifics to a new file 'board_am335x'.
Clean-up includes, config checks, maintainer.
Signed-off-by: Enrico Leto enrico.leto@siemens.com
Enrico Leto (7): siemens: eeprom: clean up definitions siemens: eeprom: simplify setup & read siemens draco: i2c: use driver model for u-boot siemens: board: etamin: remove deprecated nand config siemens: board: clean up products folders vs common siemens: board: clean up includes siemens: factoryset: use correct config for soc specific implementation
board/siemens/capricorn/Makefile | 1 + board/siemens/capricorn/board.c | 6 +- .../common/{board.c => board_am335x.c} | 44 +++------- board/siemens/common/board_am335x.h | 39 +++++++++ board/siemens/common/eeprom.c | 52 +++++++++++ board/siemens/common/eeprom.h | 24 +++++ board/siemens/common/factoryset.c | 87 ++++--------------- board/siemens/common/factoryset.h | 2 +- board/siemens/draco/Kconfig | 2 - board/siemens/draco/Makefile | 2 + board/siemens/draco/board.c | 87 ++++--------------- board/siemens/draco/board.h | 31 ++----- board/siemens/draco/mux.c | 6 +- board/siemens/pxm2/MAINTAINERS | 2 +- board/siemens/pxm2/Makefile | 2 + board/siemens/pxm2/board.c | 39 +++------ board/siemens/pxm2/board.h | 21 ----- board/siemens/pxm2/mux.c | 6 +- board/siemens/rut/MAINTAINERS | 2 +- board/siemens/rut/Makefile | 2 + board/siemens/rut/board.c | 38 +++----- board/siemens/rut/board.h | 21 ----- board/siemens/rut/mux.c | 4 +- configs/draco-etamin_defconfig | 4 +- configs/draco-rastaban_defconfig | 4 +- configs/draco-thuban_defconfig | 4 +- include/configs/draco-etamin.h | 3 - include/configs/draco-rastaban.h | 3 - include/configs/draco-thuban.h | 3 - 29 files changed, 216 insertions(+), 325 deletions(-) rename board/siemens/common/{board.c => board_am335x.c} (87%) create mode 100644 board/siemens/common/board_am335x.h create mode 100644 board/siemens/common/eeprom.c create mode 100644 board/siemens/common/eeprom.h delete mode 100644 board/siemens/pxm2/board.h delete mode 100644 board/siemens/rut/board.h

Move the I2C and EEPROM address definitions in common board header.
Reviewed-by: Alexander Sverdlin alexander.sverdlin@siemens.com Signed-off-by: Enrico Leto enrico.leto@siemens.com --- board/siemens/capricorn/board.c | 5 ++--- board/siemens/common/board.c | 6 +++--- board/siemens/common/eeprom.h | 21 +++++++++++++++++++++ board/siemens/common/factoryset.c | 12 ++++++------ board/siemens/draco/board.c | 13 +++++-------- board/siemens/pxm2/board.c | 1 + board/siemens/rut/board.c | 1 + include/configs/draco-etamin.h | 3 --- include/configs/draco-rastaban.h | 3 --- include/configs/draco-thuban.h | 3 --- 10 files changed, 39 insertions(+), 29 deletions(-) create mode 100644 board/siemens/common/eeprom.h
diff --git a/board/siemens/capricorn/board.c b/board/siemens/capricorn/board.c index 924c88e8fab..5f7e2b1e899 100644 --- a/board/siemens/capricorn/board.c +++ b/board/siemens/capricorn/board.c @@ -28,6 +28,7 @@ #include <asm/arch-imx8/clock.h> #endif #include <linux/delay.h> +#include "../common/eeprom.h" #include "../common/factoryset.h"
#define GPIO_PAD_CTRL \ @@ -337,13 +338,11 @@ void board_late_mmc_env_init(void) }
#ifndef CONFIG_SPL_BUILD -int factoryset_read_eeprom(int i2c_addr); - static int load_parameters_from_factoryset(void) { int ret;
- ret = factoryset_read_eeprom(EEPROM_I2C_ADDR); + ret = factoryset_read_eeprom(SIEMENS_EE_I2C_ADDR); if (ret) return ret;
diff --git a/board/siemens/common/board.c b/board/siemens/common/board.c index d077751cbe1..420c4965816 100644 --- a/board/siemens/common/board.c +++ b/board/siemens/common/board.c @@ -34,7 +34,8 @@ #include <cpsw.h> #include <watchdog.h> #include <asm/mach-types.h> -#include "../common/factoryset.h" +#include "eeprom.h" +#include "factoryset.h"
DECLARE_GLOBAL_DATA_PTR;
@@ -70,7 +71,6 @@ void sdram_init(void) #endif /* #ifdef CONFIG_SPL_BUILD */
#ifndef CONFIG_SPL_BUILD -#define FACTORYSET_EEPROM_ADDR 0x50 /* * Basic board specific setup. Pinmux has been handled already. */ @@ -88,7 +88,7 @@ int board_init(void) gd->bd->bi_boot_params = CFG_SYS_SDRAM_BASE + 0x100;
#ifdef CONFIG_FACTORYSET - factoryset_read_eeprom(FACTORYSET_EEPROM_ADDR); + factoryset_read_eeprom(SIEMENS_EE_I2C_ADDR); #endif
gpmc_init(); diff --git a/board/siemens/common/eeprom.h b/board/siemens/common/eeprom.h new file mode 100644 index 00000000000..a21d42789a5 --- /dev/null +++ b/board/siemens/common/eeprom.h @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright Siemens AG 2023 + * + * Common board definitions for siemens boards + */ + +#ifndef _COMMON_EEPROM_H_ +#define _COMMON_EEPROM_H_ + +/* EEPROM @ I2C */ +#define SIEMENS_EE_I2C_BUS 0 +#define SIEMENS_EE_I2C_ADDR 0x50 + +/* EEPROM mapping */ +#define SIEMENS_EE_ADDR_NAND_GEO 0x80 +#define SIEMENS_EE_ADDR_DDR3 0x90 +#define SIEMENS_EE_ADDR_CHIP 0x120 +#define SIEMENS_EE_ADDR_FACTORYSET 0x400 + +#endif /* _COMMON_EEPROM_H_ */ diff --git a/board/siemens/common/factoryset.c b/board/siemens/common/factoryset.c index 4e36a6f3199..b5befab9f52 100644 --- a/board/siemens/common/factoryset.c +++ b/board/siemens/common/factoryset.c @@ -22,11 +22,11 @@ #include <net.h> #include <errno.h> #include <g_dnl.h> +#include "eeprom.h" #include "factoryset.h"
-#define EEPR_PG_SZ 0x80 -#define EEPROM_FATORYSET_OFFSET 0x400 -#define OFF_PG EEPROM_FATORYSET_OFFSET/EEPR_PG_SZ +#define EEPR_PG_SZ 0x80 +#define OFF_PG (SIEMENS_EE_ADDR_FACTORYSET / EEPR_PG_SZ)
/* Global variable that contains necessary information from FactorySet */ struct factorysetcontainer factory_dat; @@ -159,7 +159,7 @@ int factoryset_read_eeprom(int i2c_addr) #endif
#if CONFIG_IS_ENABLED(DM_I2C) - ret = uclass_get_device_by_seq(UCLASS_I2C, EEPROM_I2C_BUS, &bus); + ret = uclass_get_device_by_seq(UCLASS_I2C, SIEMENS_EE_I2C_BUS, &bus); if (ret) goto err;
@@ -171,14 +171,14 @@ int factoryset_read_eeprom(int i2c_addr) if (ret) goto err;
- ret = dm_i2c_read(dev, EEPROM_FATORYSET_OFFSET, hdr, sizeof(hdr)); + ret = dm_i2c_read(dev, SIEMENS_EE_ADDR_FACTORYSET, hdr, sizeof(hdr)); if (ret) goto err; #else if (i2c_probe(i2c_addr)) goto err;
- if (i2c_read(i2c_addr, EEPROM_FATORYSET_OFFSET, 2, hdr, sizeof(hdr))) + if (i2c_read(i2c_addr, SIEMENS_EE_ADDR_FACTORYSET, 2, hdr, sizeof(hdr))) goto err; #endif
diff --git a/board/siemens/draco/board.c b/board/siemens/draco/board.c index 8b13d23aca7..367a300b897 100644 --- a/board/siemens/draco/board.c +++ b/board/siemens/draco/board.c @@ -37,6 +37,7 @@ #include <watchdog.h> #include <linux/delay.h> #include "board.h" +#include "../common/eeprom.h" #include "../common/factoryset.h" #include <nand.h>
@@ -132,16 +133,12 @@ struct am335x_nand_geometry { u8 nand_bus; };
-#define EEPROM_ADDR 0x50 -#define EEPROM_ADDR_DDR3 0x90 -#define EEPROM_ADDR_CHIP 0x120 - static int draco_read_nand_geometry(void) { struct am335x_nand_geometry geo;
/* Read NAND geometry */ - if (i2c_read(EEPROM_ADDR, 0x80, 2, + if (i2c_read(SIEMENS_EE_I2C_ADDR, SIEMENS_EE_ADDR_NAND_GEO, 2, (uchar *)&geo, sizeof(struct am335x_nand_geometry))) { printf("Could not read the NAND geomtery; something fundamentally wrong on the I2C bus.\n"); return -EIO; @@ -164,20 +161,20 @@ static int draco_read_nand_geometry(void) static int read_eeprom(void) { /* Check if baseboard eeprom is available */ - if (i2c_probe(EEPROM_ADDR)) { + if (i2c_probe(SIEMENS_EE_I2C_ADDR)) { printf("Could not probe the EEPROM; something fundamentally wrong on the I2C bus.\n"); return 1; }
#ifdef CONFIG_SPL_BUILD /* Read Siemens eeprom data (DDR3) */ - if (i2c_read(EEPROM_ADDR, EEPROM_ADDR_DDR3, 2, + if (i2c_read(SIEMENS_EE_I2C_ADDR, SIEMENS_EE_ADDR_DDR3, 2, (uchar *)&settings.ddr3, sizeof(struct ddr3_data))) { printf("Could not read the EEPROM; something fundamentally wrong on the I2C bus.\nUse default DDR3 timings\n"); set_default_ddr3_timings(); } /* Read Siemens eeprom data (CHIP) */ - if (i2c_read(EEPROM_ADDR, EEPROM_ADDR_CHIP, 2, + if (i2c_read(SIEMENS_EE_I2C_ADDR, SIEMENS_EE_ADDR_CHIP, 2, (uchar *)&settings.chip, sizeof(settings.chip))) printf("Could not read chip settings\n");
diff --git a/board/siemens/pxm2/board.c b/board/siemens/pxm2/board.c index 40aee7c8b3e..9e85d9b921d 100644 --- a/board/siemens/pxm2/board.c +++ b/board/siemens/pxm2/board.c @@ -36,6 +36,7 @@ #include <cpsw.h> #include <watchdog.h> #include "board.h" +#include "../common/eeprom.h" #include "../common/factoryset.h" #include "pmic.h" #include <nand.h> diff --git a/board/siemens/rut/board.c b/board/siemens/rut/board.c index bad0b71ce2d..49318b32035 100644 --- a/board/siemens/rut/board.c +++ b/board/siemens/rut/board.c @@ -36,6 +36,7 @@ #include <watchdog.h> #include <linux/delay.h> #include "board.h" +#include "../common/eeprom.h" #include "../common/factoryset.h"
/* diff --git a/include/configs/draco-etamin.h b/include/configs/draco-etamin.h index 97585a4fd12..6ae85b575b7 100644 --- a/include/configs/draco-etamin.h +++ b/include/configs/draco-etamin.h @@ -69,9 +69,6 @@ /* Physical Memory Map */ #define CFG_MAX_RAM_BANK_SIZE (1024 << 20) /* 1GB */
-#define EEPROM_ADDR_DDR3 0x90 -#define EEPROM_ADDR_CHIP 0x120 - /* nedded by compliance test in read mode */
#undef COMMON_ENV_DFU_ARGS diff --git a/include/configs/draco-rastaban.h b/include/configs/draco-rastaban.h index 0991ebfd00c..1b95606cca9 100644 --- a/include/configs/draco-rastaban.h +++ b/include/configs/draco-rastaban.h @@ -34,9 +34,6 @@ /* Physical Memory Map */ #define CFG_MAX_RAM_BANK_SIZE (1024 << 20) /* 1GB */
-#define EEPROM_ADDR_DDR3 0x90 -#define EEPROM_ADDR_CHIP 0x120 - /* Default env settings */ #define CFG_EXTRA_ENV_SETTINGS \ "hostname=rastaban\0" \ diff --git a/include/configs/draco-thuban.h b/include/configs/draco-thuban.h index f4c04c55ebf..629558e27ec 100644 --- a/include/configs/draco-thuban.h +++ b/include/configs/draco-thuban.h @@ -27,9 +27,6 @@ /* Physical Memory Map */ #define CFG_MAX_RAM_BANK_SIZE (1024 << 20) /* 1GB */
-#define EEPROM_ADDR_DDR3 0x90 -#define EEPROM_ADDR_CHIP 0x120 - /* Default env settings */ #define CFG_EXTRA_ENV_SETTINGS \ "hostname=thuban\0" \

Since we have boards using the driver model or not for i2c, use abstraction function to probe the i2c, check the EEPROM and read from EEPROM.
Signed-off-by: Enrico Leto enrico.leto@siemens.com --- board/siemens/capricorn/Makefile | 1 + board/siemens/common/board.c | 8 ++-- board/siemens/common/eeprom.c | 52 +++++++++++++++++++++++++ board/siemens/common/eeprom.h | 3 ++ board/siemens/common/factoryset.c | 63 +++++-------------------------- board/siemens/draco/Makefile | 1 + board/siemens/draco/board.c | 23 ++++------- board/siemens/draco/mux.c | 2 +- board/siemens/pxm2/Makefile | 1 + board/siemens/pxm2/board.c | 2 +- board/siemens/pxm2/mux.c | 2 +- board/siemens/rut/Makefile | 1 + board/siemens/rut/board.c | 2 +- 13 files changed, 84 insertions(+), 77 deletions(-) create mode 100644 board/siemens/common/eeprom.c
diff --git a/board/siemens/capricorn/Makefile b/board/siemens/capricorn/Makefile index d5846cc8e3c..4dafac10829 100644 --- a/board/siemens/capricorn/Makefile +++ b/board/siemens/capricorn/Makefile @@ -4,6 +4,7 @@ #
obj-y += board.o +obj-y += ../common/eeprom.o
ifdef CONFIG_SPL_BUILD obj-y += spl.o diff --git a/board/siemens/common/board.c b/board/siemens/common/board.c index 420c4965816..e412858c4a9 100644 --- a/board/siemens/common/board.c +++ b/board/siemens/common/board.c @@ -29,7 +29,6 @@ #include <asm/io.h> #include <asm/emif.h> #include <asm/gpio.h> -#include <i2c.h> #include <miiphy.h> #include <cpsw.h> #include <watchdog.h> @@ -39,6 +38,7 @@
DECLARE_GLOBAL_DATA_PTR;
+ #ifdef CONFIG_SPL_BUILD void set_uart_mux_conf(void) { @@ -49,12 +49,13 @@ void set_mux_conf_regs(void) { /* Initalize the board header */ enable_i2c0_pin_mux(); - i2c_set_bus_num(0);
/* enable early the console */ gd->baudrate = CONFIG_BAUDRATE; serial_init(); gd->have_console = 1; + + siemens_ee_setup(); if (read_eeprom() < 0) puts("Could not get board ID.\n");
@@ -79,8 +80,7 @@ int board_init(void) #if defined(CONFIG_HW_WATCHDOG) hw_watchdog_init(); #endif /* defined(CONFIG_HW_WATCHDOG) */ - i2c_set_bus_num(0); - if (read_eeprom() < 0) + if (siemens_ee_setup() < 0) puts("Could not get board ID.\n"); #ifdef CONFIG_MACH_TYPE gd->bd->bi_arch_number = CONFIG_MACH_TYPE; diff --git a/board/siemens/common/eeprom.c b/board/siemens/common/eeprom.c new file mode 100644 index 00000000000..fc93df91d52 --- /dev/null +++ b/board/siemens/common/eeprom.c @@ -0,0 +1,52 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * + * Read EEPROM data + * (C) Copyright 2024 Siemens AG + */ + +#include <dm/uclass.h> +#include <i2c.h> +#include "eeprom.h" + +#if CONFIG_IS_ENABLED(DM_I2C) +static struct udevice *i2c_dev; +#endif + +/* Probe I2C and set-up EEPROM */ +int siemens_ee_setup(void) +{ +#if CONFIG_IS_ENABLED(DM_I2C) + struct udevice *bus; + int ret; + + ret = uclass_get_device_by_seq(UCLASS_I2C, SIEMENS_EE_I2C_BUS, &bus); + if (ret) + goto err; + + ret = dm_i2c_probe(bus, SIEMENS_EE_I2C_ADDR, 0, &i2c_dev); + if (ret) + goto err; + if (i2c_set_chip_offset_len(i2c_dev, 2)) + goto err; +#else + i2c_set_bus_num(SIEMENS_EE_I2C_BUS); + if (i2c_probe(SIEMENS_EE_I2C_ADDR)) + goto err; +#endif + return 0; + +err: + printf("Could not probe the EEPROM; something fundamentally wrong on the I2C bus.\n"); + return 1; +} + +/* Read data from EEPROM */ +int siemens_ee_read_data(uint address, uchar *buffer, int len) +{ +#if CONFIG_IS_ENABLED(DM_I2C) + return dm_i2c_read(i2c_dev, address, buffer, len); +#else + return i2c_read(SIEMENS_EE_I2C_ADDR, address, 2, buffer, len); +#endif +} diff --git a/board/siemens/common/eeprom.h b/board/siemens/common/eeprom.h index a21d42789a5..a5ef5abbafd 100644 --- a/board/siemens/common/eeprom.h +++ b/board/siemens/common/eeprom.h @@ -18,4 +18,7 @@ #define SIEMENS_EE_ADDR_CHIP 0x120 #define SIEMENS_EE_ADDR_FACTORYSET 0x400
+int siemens_ee_setup(void); +int siemens_ee_read_data(uint address, uchar *buffer, int len); + #endif /* _COMMON_EEPROM_H_ */ diff --git a/board/siemens/common/factoryset.c b/board/siemens/common/factoryset.c index b5befab9f52..4a1277340a7 100644 --- a/board/siemens/common/factoryset.c +++ b/board/siemens/common/factoryset.c @@ -148,39 +148,14 @@ int factoryset_read_eeprom(int i2c_addr) int i, pages = 0, size = 0; unsigned char eeprom_buf[0x3c00], hdr[4], buf[MAX_STRING_LENGTH]; unsigned char *cp, *cp1; -#if CONFIG_IS_ENABLED(DM_I2C) - struct udevice *bus, *dev; - int ret; -#endif
#if defined(CONFIG_DFU_OVER_USB) factory_dat.usb_vendor_id = CONFIG_USB_GADGET_VENDOR_NUM; factory_dat.usb_product_id = CONFIG_USB_GADGET_PRODUCT_NUM; #endif
-#if CONFIG_IS_ENABLED(DM_I2C) - ret = uclass_get_device_by_seq(UCLASS_I2C, SIEMENS_EE_I2C_BUS, &bus); - if (ret) - goto err; - - ret = dm_i2c_probe(bus, i2c_addr, 0, &dev); - if (ret) - goto err; - - ret = i2c_set_chip_offset_len(dev, 2); - if (ret) - goto err; - - ret = dm_i2c_read(dev, SIEMENS_EE_ADDR_FACTORYSET, hdr, sizeof(hdr)); - if (ret) - goto err; -#else - if (i2c_probe(i2c_addr)) - goto err; - - if (i2c_read(i2c_addr, SIEMENS_EE_ADDR_FACTORYSET, 2, hdr, sizeof(hdr))) + if (siemens_ee_read_data(SIEMENS_EE_ADDR_FACTORYSET, hdr, sizeof(hdr))) goto err; -#endif
if ((hdr[0] != 0x99) || (hdr[1] != 0x80)) { printf("FactorySet is not right in eeprom.\n"); @@ -201,33 +176,16 @@ int factoryset_read_eeprom(int i2c_addr) * data after every time we got a record from eeprom */ debug("Read eeprom page :\n"); - for (i = 0; i < pages; i++) { -#if CONFIG_IS_ENABLED(DM_I2C) - ret = dm_i2c_read(dev, (OFF_PG + i) * EEPR_PG_SZ, - eeprom_buf + (i * EEPR_PG_SZ), EEPR_PG_SZ); - if (ret) + for (i = 0; i < pages; i++) + if (siemens_ee_read_data((OFF_PG + i) * EEPR_PG_SZ, + eeprom_buf + (i * EEPR_PG_SZ), EEPR_PG_SZ)) goto err; -#else - if (i2c_read(i2c_addr, (OFF_PG + i) * EEPR_PG_SZ, 2, - eeprom_buf + (i * EEPR_PG_SZ), EEPR_PG_SZ)) - goto err; -#endif - }
- if (size % EEPR_PG_SZ) { -#if CONFIG_IS_ENABLED(DM_I2C) - ret = dm_i2c_read(dev, (OFF_PG + pages) * EEPR_PG_SZ, - eeprom_buf + (pages * EEPR_PG_SZ), - size % EEPR_PG_SZ); - if (ret) - goto err; -#else - if (i2c_read(i2c_addr, (OFF_PG + pages) * EEPR_PG_SZ, 2, - eeprom_buf + (pages * EEPR_PG_SZ), - (size % EEPR_PG_SZ))) + if (size % EEPR_PG_SZ) + if (siemens_ee_read_data((OFF_PG + pages) * EEPR_PG_SZ, + eeprom_buf + (pages * EEPR_PG_SZ), + size % EEPR_PG_SZ)) goto err; -#endif - }
/* we do below just for eeprom align */ for (i = 0; i < size; i++) @@ -249,9 +207,8 @@ int factoryset_read_eeprom(int i2c_addr)
#if CONFIG_IS_ENABLED(TARGET_GIEDI) || CONFIG_IS_ENABLED(TARGET_DENEB) /* get mac address for WLAN */ - ret = get_factory_record_val(cp, size, (uchar *)"WLAN1", (uchar *)"mac", - buf, MAX_STRING_LENGTH); - if (ret > 0) { + if (get_factory_record_val(cp, size, (uchar *)"WLAN1", (uchar *)"mac", + buf, MAX_STRING_LENGTH) > 0) { cp1 = buf; for (i = 0; i < 6; i++) { factory_dat.mac_wlan[i] = hextoul((char *)cp1, NULL); diff --git a/board/siemens/draco/Makefile b/board/siemens/draco/Makefile index e94456ab1c3..1d0cb82bcb6 100644 --- a/board/siemens/draco/Makefile +++ b/board/siemens/draco/Makefile @@ -14,6 +14,7 @@ obj-y := mux.o endif
obj-y += board.o +obj-y += ../common/eeprom.o ifndef CONFIG_SPL_BUILD obj-y += ../common/factoryset.o endif diff --git a/board/siemens/draco/board.c b/board/siemens/draco/board.c index 367a300b897..30ad9d7ab3a 100644 --- a/board/siemens/draco/board.c +++ b/board/siemens/draco/board.c @@ -138,8 +138,8 @@ static int draco_read_nand_geometry(void) struct am335x_nand_geometry geo;
/* Read NAND geometry */ - if (i2c_read(SIEMENS_EE_I2C_ADDR, SIEMENS_EE_ADDR_NAND_GEO, 2, - (uchar *)&geo, sizeof(struct am335x_nand_geometry))) { + if (siemens_ee_read_data(SIEMENS_EE_ADDR_NAND_GEO, (uchar *)&geo, + sizeof(struct am335x_nand_geometry))) { printf("Could not read the NAND geomtery; something fundamentally wrong on the I2C bus.\n"); return -EIO; } @@ -155,27 +155,21 @@ static int draco_read_nand_geometry(void) return 0; }
+#ifdef CONFIG_SPL_BUILD /* * Read header information from EEPROM into global structure. */ static int read_eeprom(void) { - /* Check if baseboard eeprom is available */ - if (i2c_probe(SIEMENS_EE_I2C_ADDR)) { - printf("Could not probe the EEPROM; something fundamentally wrong on the I2C bus.\n"); - return 1; - } - -#ifdef CONFIG_SPL_BUILD /* Read Siemens eeprom data (DDR3) */ - if (i2c_read(SIEMENS_EE_I2C_ADDR, SIEMENS_EE_ADDR_DDR3, 2, - (uchar *)&settings.ddr3, sizeof(struct ddr3_data))) { + if (siemens_ee_read_data(SIEMENS_EE_ADDR_DDR3, (uchar *)&settings.ddr3, + sizeof(struct ddr3_data))) { printf("Could not read the EEPROM; something fundamentally wrong on the I2C bus.\nUse default DDR3 timings\n"); set_default_ddr3_timings(); } /* Read Siemens eeprom data (CHIP) */ - if (i2c_read(SIEMENS_EE_I2C_ADDR, SIEMENS_EE_ADDR_CHIP, 2, - (uchar *)&settings.chip, sizeof(settings.chip))) + if (siemens_ee_read_data(SIEMENS_EE_ADDR_CHIP, (uchar *)&settings.chip, + sizeof(settings.chip))) printf("Could not read chip settings\n");
if (ddr3_default.magic == settings.ddr3.magic && @@ -199,11 +193,8 @@ static int read_eeprom(void) print_ddr3_timings();
return draco_read_nand_geometry(); -#endif - return 0; }
-#ifdef CONFIG_SPL_BUILD static void board_init_ddr(void) { struct emif_regs draco_ddr3_emif_reg_data = { diff --git a/board/siemens/draco/mux.c b/board/siemens/draco/mux.c index 2632f050336..56d8f45c349 100644 --- a/board/siemens/draco/mux.c +++ b/board/siemens/draco/mux.c @@ -16,7 +16,7 @@ #include <asm/arch/mux.h> #include <asm/io.h> #include <i2c.h> -#include "board.h" +#include "eeprom.h"
static struct module_pin_mux uart0_pin_mux[] = { {OFFSET(uart0_rxd), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* UART0_RXD */ diff --git a/board/siemens/pxm2/Makefile b/board/siemens/pxm2/Makefile index e94456ab1c3..1d0cb82bcb6 100644 --- a/board/siemens/pxm2/Makefile +++ b/board/siemens/pxm2/Makefile @@ -14,6 +14,7 @@ obj-y := mux.o endif
obj-y += board.o +obj-y += ../common/eeprom.o ifndef CONFIG_SPL_BUILD obj-y += ../common/factoryset.o endif diff --git a/board/siemens/pxm2/board.c b/board/siemens/pxm2/board.c index 9e85d9b921d..16b0d3df757 100644 --- a/board/siemens/pxm2/board.c +++ b/board/siemens/pxm2/board.c @@ -161,7 +161,6 @@ void spl_siemens_board_init(void) printf("voltage update failed\n"); } } -#endif /* if def CONFIG_SPL_BUILD */
int read_eeprom(void) { @@ -169,6 +168,7 @@ int read_eeprom(void)
return 0; } +#endif /* if def CONFIG_SPL_BUILD */
#if (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD)) || \ (defined(CONFIG_SPL_ETH) && defined(CONFIG_SPL_BUILD)) diff --git a/board/siemens/pxm2/mux.c b/board/siemens/pxm2/mux.c index d21ef47771d..07cf5675927 100644 --- a/board/siemens/pxm2/mux.c +++ b/board/siemens/pxm2/mux.c @@ -17,7 +17,7 @@ #include <asm/arch/mux.h> #include <asm/io.h> #include <i2c.h> -#include "board.h" +#include "eeprom.h"
static struct module_pin_mux uart0_pin_mux[] = { {OFFSET(uart0_rxd), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* UART0_RXD */ diff --git a/board/siemens/rut/Makefile b/board/siemens/rut/Makefile index e94456ab1c3..1d0cb82bcb6 100644 --- a/board/siemens/rut/Makefile +++ b/board/siemens/rut/Makefile @@ -14,6 +14,7 @@ obj-y := mux.o endif
obj-y += board.o +obj-y += ../common/eeprom.o ifndef CONFIG_SPL_BUILD obj-y += ../common/factoryset.o endif diff --git a/board/siemens/rut/board.c b/board/siemens/rut/board.c index 49318b32035..d9e84db03ef 100644 --- a/board/siemens/rut/board.c +++ b/board/siemens/rut/board.c @@ -39,6 +39,7 @@ #include "../common/eeprom.h" #include "../common/factoryset.h"
+#ifdef CONFIG_SPL_BUILD /* * Read header information from EEPROM into global structure. */ @@ -47,7 +48,6 @@ static int read_eeprom(void) return 0; }
-#ifdef CONFIG_SPL_BUILD static void board_init_ddr(void) { struct emif_regs rut_ddr3_emif_reg_data = {

Add support for driver model where EEPROM data are read in draco board.
Reviewed-by: Alexander Sverdlin alexander.sverdlin@siemens.com Signed-off-by: Enrico Leto enrico.leto@siemens.com --- configs/draco-etamin_defconfig | 4 +++- configs/draco-rastaban_defconfig | 4 +++- configs/draco-thuban_defconfig | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/configs/draco-etamin_defconfig b/configs/draco-etamin_defconfig index a89494f9083..ec9331e625a 100644 --- a/configs/draco-etamin_defconfig +++ b/configs/draco-etamin_defconfig @@ -86,8 +86,10 @@ CONFIG_CLK=y CONFIG_CLK_TI_CTRL=y CONFIG_DFU_NAND=y CONFIG_SYS_DFU_DATA_BUF_SIZE=0x100000 -CONFIG_SYS_I2C_LEGACY=y +CONFIG_DM_I2C=y +# CONFIG_SPL_DM_I2C is not set CONFIG_SPL_SYS_I2C_LEGACY=y +CONFIG_I2C_SET_DEFAULT_BUS_NUM=y # CONFIG_SPL_DM_MMC is not set CONFIG_MMC_OMAP_HS=y CONFIG_MTD=y diff --git a/configs/draco-rastaban_defconfig b/configs/draco-rastaban_defconfig index f4a9b860bf0..03fbe494901 100644 --- a/configs/draco-rastaban_defconfig +++ b/configs/draco-rastaban_defconfig @@ -84,8 +84,10 @@ CONFIG_CLK=y CONFIG_CLK_TI_CTRL=y CONFIG_DFU_NAND=y CONFIG_SYS_DFU_DATA_BUF_SIZE=0x100000 -CONFIG_SYS_I2C_LEGACY=y +CONFIG_DM_I2C=y +# CONFIG_SPL_DM_I2C is not set CONFIG_SPL_SYS_I2C_LEGACY=y +CONFIG_I2C_SET_DEFAULT_BUS_NUM=y # CONFIG_MMC is not set CONFIG_MTD=y CONFIG_MTD_RAW_NAND=y diff --git a/configs/draco-thuban_defconfig b/configs/draco-thuban_defconfig index cf2c46b3d20..fcc9b0380f4 100644 --- a/configs/draco-thuban_defconfig +++ b/configs/draco-thuban_defconfig @@ -84,8 +84,10 @@ CONFIG_CLK=y CONFIG_CLK_TI_CTRL=y CONFIG_DFU_NAND=y CONFIG_SYS_DFU_DATA_BUF_SIZE=0x100000 -CONFIG_SYS_I2C_LEGACY=y +CONFIG_DM_I2C=y +# CONFIG_SPL_DM_I2C is not set CONFIG_SPL_SYS_I2C_LEGACY=y +CONFIG_I2C_SET_DEFAULT_BUS_NUM=y # CONFIG_MMC is not set CONFIG_MTD=y CONFIG_MTD_RAW_NAND=y

NAND was used in the early development phase of etamin. The board runs now on MMC. This setting is no more used -> remove to simplify the board file.
Further clean-up of etamin should remove all NAND settings. Complete clean- up of etamin board will take place in a separate patch serie.
Signed-off-by: Enrico Leto enrico.leto@siemens.com --- board/siemens/common/board.c | 4 ---- board/siemens/draco/Kconfig | 2 -- board/siemens/draco/board.c | 26 -------------------------- 3 files changed, 32 deletions(-)
diff --git a/board/siemens/common/board.c b/board/siemens/common/board.c index e412858c4a9..e5a42d734bb 100644 --- a/board/siemens/common/board.c +++ b/board/siemens/common/board.c @@ -93,10 +93,6 @@ int board_init(void)
gpmc_init();
-#if CONFIG_IS_ENABLED(NAND_CS_INIT) - board_nand_cs_init(); -#endif - return 0; } #endif /* #ifndef CONFIG_SPL_BUILD */ diff --git a/board/siemens/draco/Kconfig b/board/siemens/draco/Kconfig index 0cdf5bc9812..9d45c4239be 100644 --- a/board/siemens/draco/Kconfig +++ b/board/siemens/draco/Kconfig @@ -44,6 +44,4 @@ config SYS_SOC config SYS_CONFIG_NAME default "draco-etamin"
-config NAND_CS_INIT - def_bool y endif diff --git a/board/siemens/draco/board.c b/board/siemens/draco/board.c index 30ad9d7ab3a..d108d3e49db 100644 --- a/board/siemens/draco/board.c +++ b/board/siemens/draco/board.c @@ -358,30 +358,4 @@ U_BOOT_CMD( #endif /* #if defined(CONFIG_DRIVER_TI_CPSW) */ #endif /* #if (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD)) */
-#if CONFIG_IS_ENABLED(NAND_CS_INIT) -#define ETAMIN_NAND_GPMC_CONFIG1 0x00000800 -#define ETAMIN_NAND_GPMC_CONFIG2 0x001e1e00 -#define ETAMIN_NAND_GPMC_CONFIG3 0x001e1e00 -#define ETAMIN_NAND_GPMC_CONFIG4 0x16051807 -#define ETAMIN_NAND_GPMC_CONFIG5 0x00151e1e -#define ETAMIN_NAND_GPMC_CONFIG6 0x16000f80 - -/* GPMC definitions for second nand cs1 */ -static const u32 gpmc_nand_config[] = { - ETAMIN_NAND_GPMC_CONFIG1, - ETAMIN_NAND_GPMC_CONFIG2, - ETAMIN_NAND_GPMC_CONFIG3, - ETAMIN_NAND_GPMC_CONFIG4, - ETAMIN_NAND_GPMC_CONFIG5, - ETAMIN_NAND_GPMC_CONFIG6, - /*CONFIG7- computed as params */ -}; - -static void board_nand_cs_init(void) -{ - enable_gpmc_cs_config(gpmc_nand_config, &gpmc_cfg->cs[1], - 0x18000000, GPMC_SIZE_16M); -} -#endif - #include "../common/board.c"

The common folder was initialially created for the common parts of the products based on draco-am355x board family. These are the product lines 'pxm2', 'rut' and the base line named 'draco'!
Adding the new capricorn-imx8 board family, common was enhanced without cleanup. - rename 'common/board.c' to 'common/board_am335x.c' - add 'common/board_am335x.h' for export to the product lines
Reviewed-by: Alexander Sverdlin alexander.sverdlin@siemens.com Signed-off-by: Enrico Leto enrico.leto@siemens.com --- .../common/{board.c => board_am335x.c} | 7 ++-- board/siemens/common/board_am335x.h | 39 +++++++++++++++++++ board/siemens/draco/Makefile | 1 + board/siemens/draco/board.c | 8 ++-- board/siemens/draco/board.h | 31 +++------------ board/siemens/pxm2/MAINTAINERS | 2 +- board/siemens/pxm2/Makefile | 1 + board/siemens/pxm2/board.c | 10 ++--- board/siemens/pxm2/board.h | 21 ---------- board/siemens/rut/MAINTAINERS | 2 +- board/siemens/rut/Makefile | 1 + board/siemens/rut/board.c | 10 ++--- board/siemens/rut/board.h | 21 ---------- 13 files changed, 64 insertions(+), 90 deletions(-) rename board/siemens/common/{board.c => board_am335x.c} (98%) create mode 100644 board/siemens/common/board_am335x.h delete mode 100644 board/siemens/pxm2/board.h delete mode 100644 board/siemens/rut/board.h
diff --git a/board/siemens/common/board.c b/board/siemens/common/board_am335x.c similarity index 98% rename from board/siemens/common/board.c rename to board/siemens/common/board_am335x.c index e5a42d734bb..c55ca983bdd 100644 --- a/board/siemens/common/board.c +++ b/board/siemens/common/board_am335x.c @@ -33,6 +33,7 @@ #include <cpsw.h> #include <watchdog.h> #include <asm/mach-types.h> +#include "board_am335x.h" #include "eeprom.h" #include "factoryset.h"
@@ -56,7 +57,7 @@ void set_mux_conf_regs(void) gd->have_console = 1;
siemens_ee_setup(); - if (read_eeprom() < 0) + if (draco_read_eeprom() < 0) puts("Could not get board ID.\n");
enable_board_pin_mux(); @@ -64,8 +65,8 @@ void set_mux_conf_regs(void)
void sdram_init(void) { - spl_siemens_board_init(); - board_init_ddr(); + spl_draco_board_init(); + draco_init_ddr();
return; } diff --git a/board/siemens/common/board_am335x.h b/board/siemens/common/board_am335x.h new file mode 100644 index 00000000000..3a20352d457 --- /dev/null +++ b/board/siemens/common/board_am335x.h @@ -0,0 +1,39 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Board definitions for draco products + * + * (C) Copyright 2013 Siemens Schweiz AG + * (C) Heiko Schocher, DENX Software Engineering, hs@denx.de. + * + * Based on: + * TI AM335x boards information header + * u-boot:/board/ti/am335x/board.h + * + * Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/ + */ + +#ifndef _BOARD_AM335X_H_ +#define _BOARD_AM335X_H_ + +#include "eeprom.h" + +/* Common functions with product specific implementation */ +void spl_draco_board_init(void); +void draco_init_ddr(void); +int draco_read_eeprom(void); + +#ifdef CONFIG_SPL_BUILD +/* Mux for init: uart?, i2c0 to read the main EEPROM */ +void enable_uart0_pin_mux(void); +void enable_uart1_pin_mux(void); +void enable_uart2_pin_mux(void); +void enable_uart3_pin_mux(void); +void enable_uart4_pin_mux(void); +void enable_uart5_pin_mux(void); +void enable_i2c0_pin_mux(void); + +/* Main mux function to enable other pinmux required on the board */ +void enable_board_pin_mux(void); +#endif /* CONFIG_SPL_BUILD */ + +#endif /* _BOARD_AM335X_H_ */ diff --git a/board/siemens/draco/Makefile b/board/siemens/draco/Makefile index 1d0cb82bcb6..aae536472c5 100644 --- a/board/siemens/draco/Makefile +++ b/board/siemens/draco/Makefile @@ -14,6 +14,7 @@ obj-y := mux.o endif
obj-y += board.o +obj-y += ../common/board_am335x.o obj-y += ../common/eeprom.o ifndef CONFIG_SPL_BUILD obj-y += ../common/factoryset.o diff --git a/board/siemens/draco/board.c b/board/siemens/draco/board.c index d108d3e49db..2412a04a9a1 100644 --- a/board/siemens/draco/board.c +++ b/board/siemens/draco/board.c @@ -159,7 +159,7 @@ static int draco_read_nand_geometry(void) /* * Read header information from EEPROM into global structure. */ -static int read_eeprom(void) +int draco_read_eeprom(void) { /* Read Siemens eeprom data (DDR3) */ if (siemens_ee_read_data(SIEMENS_EE_ADDR_DDR3, (uchar *)&settings.ddr3, @@ -195,7 +195,7 @@ static int read_eeprom(void) return draco_read_nand_geometry(); }
-static void board_init_ddr(void) +void draco_init_ddr(void) { struct emif_regs draco_ddr3_emif_reg_data = { .zq_config = 0x50074BE4, @@ -242,7 +242,7 @@ struct ctrl_ioregs draco_ddr3_ioregs = { &draco_ddr3_cmd_ctrl_data, &draco_ddr3_emif_reg_data, 0); }
-static void spl_siemens_board_init(void) +void spl_draco_board_init(void) { return; } @@ -357,5 +357,3 @@ U_BOOT_CMD( ); #endif /* #if defined(CONFIG_DRIVER_TI_CPSW) */ #endif /* #if (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD)) */ - -#include "../common/board.c" diff --git a/board/siemens/draco/board.h b/board/siemens/draco/board.h index f027427d1fb..935f340a8f2 100644 --- a/board/siemens/draco/board.h +++ b/board/siemens/draco/board.h @@ -1,19 +1,15 @@ /* SPDX-License-Identifier: GPL-2.0+ */ /* - * board.h + * Board definitions for draco products * * (C) Copyright 2013 Siemens Schweiz AG * (C) Heiko Schocher, DENX Software Engineering, hs@denx.de. * - * Based on: - * TI AM335x boards information header - * u-boot:/board/ti/am335x/board.h - * - * Copyright (C) 2011, Texas Instruments, Incorporated - https://www.ti.com/ + * TI am335x specifics moved to ../common/board_am335x.h */
-#ifndef _BOARD_H_ -#define _BOARD_H_ +#ifndef _BOARD_DRACO_H_ +#define _BOARD_DRACO_H_
#define PARGS(x) #x , /* Parameter Name */ \ settings.ddr3.x, /* EEPROM Value */ \ @@ -58,21 +54,4 @@ struct draco_baseboard_id { struct chip_data chip; };
-/* - * We have three pin mux functions that must exist. We must be able to enable - * uart0, for initial output and i2c0 to read the main EEPROM. We then have a - * main pinmux function that can be overridden to enable all other pinmux that - * is required on the board. - */ -void enable_uart0_pin_mux(void); -void enable_uart1_pin_mux(void); -void enable_uart2_pin_mux(void); -void enable_uart3_pin_mux(void); -void enable_uart4_pin_mux(void); -void enable_uart5_pin_mux(void); -void enable_i2c0_pin_mux(void); -void enable_board_pin_mux(void); - -/* Forwared declaration, defined in common board.c */ -void set_env_gpios(unsigned char state); -#endif +#endif /* _BOARD_DRACO_H_ */ diff --git a/board/siemens/pxm2/MAINTAINERS b/board/siemens/pxm2/MAINTAINERS index dc02fe87c9b..49025446079 100644 --- a/board/siemens/pxm2/MAINTAINERS +++ b/board/siemens/pxm2/MAINTAINERS @@ -1,5 +1,5 @@ PXM2 BOARD -M: Samuel Egli samuel.egli@siemens.com +M: Enrico Leto enrico.leto@siemens.com S: Maintained F: board/siemens/pxm2/ F: include/configs/pxm2.h diff --git a/board/siemens/pxm2/Makefile b/board/siemens/pxm2/Makefile index 1d0cb82bcb6..aae536472c5 100644 --- a/board/siemens/pxm2/Makefile +++ b/board/siemens/pxm2/Makefile @@ -14,6 +14,7 @@ obj-y := mux.o endif
obj-y += board.o +obj-y += ../common/board_am335x.o obj-y += ../common/eeprom.o ifndef CONFIG_SPL_BUILD obj-y += ../common/factoryset.o diff --git a/board/siemens/pxm2/board.c b/board/siemens/pxm2/board.c index 16b0d3df757..bff6d20251e 100644 --- a/board/siemens/pxm2/board.c +++ b/board/siemens/pxm2/board.c @@ -35,7 +35,7 @@ #include <miiphy.h> #include <cpsw.h> #include <watchdog.h> -#include "board.h" +#include "../common/board_am335x.h" #include "../common/eeprom.h" #include "../common/factoryset.h" #include "pmic.h" @@ -43,7 +43,7 @@ #include <bmp_layout.h>
#ifdef CONFIG_SPL_BUILD -static void board_init_ddr(void) +void draco_init_ddr(void) { struct emif_regs pxm2_ddr3_emif_reg_data = { .sdram_config = 0x41805332, @@ -135,7 +135,7 @@ int voltage_update(unsigned int module, unsigned char vddx_op_vol_sel) const struct dpll_params dpll_mpu_pxm2 = { 720, OSC-1, 1, -1, -1, -1, -1};
-void spl_siemens_board_init(void) +void spl_draco_board_init(void) { uchar buf[4]; /* @@ -162,7 +162,7 @@ void spl_siemens_board_init(void) } }
-int read_eeprom(void) +int draco_read_eeprom(void) { /* nothing ToDo here for this board */
@@ -275,5 +275,3 @@ int board_late_init(void) return 0; } #endif - -#include "../common/board.c" diff --git a/board/siemens/pxm2/board.h b/board/siemens/pxm2/board.h deleted file mode 100644 index 9067e4d5aa8..00000000000 --- a/board/siemens/pxm2/board.h +++ /dev/null @@ -1,21 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ -/* - * board.h - * - * (C) Copyright 2013 Siemens Schweiz AG - * (C) Heiko Schocher, DENX Software Engineering, hs@denx.de. - * - * Based on: - * TI AM335x boards information header - * u-boot:/board/ti/am335x/board.h - * - * Copyright (C) 2011, Texas Instruments, Incorporated - https://www.ti.com/ - */ - -#ifndef _BOARD_H_ -#define _BOARD_H_ - -void enable_uart0_pin_mux(void); -void enable_i2c0_pin_mux(void); -void enable_board_pin_mux(void); -#endif diff --git a/board/siemens/rut/MAINTAINERS b/board/siemens/rut/MAINTAINERS index 1e92710904b..4d8e2567099 100644 --- a/board/siemens/rut/MAINTAINERS +++ b/board/siemens/rut/MAINTAINERS @@ -1,5 +1,5 @@ RUT BOARD -M: Samuel Egli samuel.egli@siemens.com +M: Enrico Leto enrico.leto@siemens.com S: Maintained F: board/siemens/rut/ F: include/configs/rut.h diff --git a/board/siemens/rut/Makefile b/board/siemens/rut/Makefile index 1d0cb82bcb6..aae536472c5 100644 --- a/board/siemens/rut/Makefile +++ b/board/siemens/rut/Makefile @@ -14,6 +14,7 @@ obj-y := mux.o endif
obj-y += board.o +obj-y += ../common/board_am335x.o obj-y += ../common/eeprom.o ifndef CONFIG_SPL_BUILD obj-y += ../common/factoryset.o diff --git a/board/siemens/rut/board.c b/board/siemens/rut/board.c index d9e84db03ef..1e0e131addf 100644 --- a/board/siemens/rut/board.c +++ b/board/siemens/rut/board.c @@ -35,7 +35,7 @@ #include <video.h> #include <watchdog.h> #include <linux/delay.h> -#include "board.h" +#include "../common/board_am335x.h" #include "../common/eeprom.h" #include "../common/factoryset.h"
@@ -43,12 +43,12 @@ /* * Read header information from EEPROM into global structure. */ -static int read_eeprom(void) +int draco_read_eeprom(void) { return 0; }
-static void board_init_ddr(void) +void draco_init_ddr(void) { struct emif_regs rut_ddr3_emif_reg_data = { .sdram_config = 0x61C04AB2, @@ -125,7 +125,7 @@ err: #define REQUEST_AND_PULSE_RESET(N) \ request_and_pulse_reset(N, #N);
-static void spl_siemens_board_init(void) +void spl_draco_board_init(void) { REQUEST_AND_PULSE_RESET(ETH_PHY_RESET_GPIO); REQUEST_AND_PULSE_RESET(MAXTOUCH_RESET_GPIO); @@ -245,5 +245,3 @@ int board_late_init(void) return 0; } #endif - -#include "../common/board.c" diff --git a/board/siemens/rut/board.h b/board/siemens/rut/board.h deleted file mode 100644 index 9067e4d5aa8..00000000000 --- a/board/siemens/rut/board.h +++ /dev/null @@ -1,21 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ -/* - * board.h - * - * (C) Copyright 2013 Siemens Schweiz AG - * (C) Heiko Schocher, DENX Software Engineering, hs@denx.de. - * - * Based on: - * TI AM335x boards information header - * u-boot:/board/ti/am335x/board.h - * - * Copyright (C) 2011, Texas Instruments, Incorporated - https://www.ti.com/ - */ - -#ifndef _BOARD_H_ -#define _BOARD_H_ - -void enable_uart0_pin_mux(void); -void enable_i2c0_pin_mux(void); -void enable_board_pin_mux(void); -#endif

Many includes were not removed when code parts were moved or removed.
Signed-off-by: Enrico Leto enrico.leto@siemens.com --- board/siemens/capricorn/board.c | 1 - board/siemens/common/board_am335x.c | 19 +------------------ board/siemens/common/factoryset.c | 12 ++---------- board/siemens/draco/board.c | 25 ++++++------------------- board/siemens/draco/mux.c | 4 +--- board/siemens/pxm2/board.c | 26 ++++++-------------------- board/siemens/pxm2/mux.c | 4 +--- board/siemens/rut/board.c | 25 +++++-------------------- board/siemens/rut/mux.c | 4 +--- 9 files changed, 23 insertions(+), 97 deletions(-)
diff --git a/board/siemens/capricorn/board.c b/board/siemens/capricorn/board.c index 5f7e2b1e899..0d66a75bbfa 100644 --- a/board/siemens/capricorn/board.c +++ b/board/siemens/capricorn/board.c @@ -22,7 +22,6 @@ #include <asm/gpio.h> #include <asm/arch/imx8-pins.h> #include <asm/arch/iomux.h> -#include <firmware/imx/sci/sci.h> #include <asm/arch/sys_proto.h> #ifndef CONFIG_SPL #include <asm/arch-imx8/clock.h> diff --git a/board/siemens/common/board_am335x.c b/board/siemens/common/board_am335x.c index c55ca983bdd..445af9ddbf6 100644 --- a/board/siemens/common/board_am335x.c +++ b/board/siemens/common/board_am335x.c @@ -9,29 +9,12 @@ * Copyright (C) 2011, Texas Instruments, Incorporated - https://www.ti.com/ */
-#include <common.h> #include <command.h> -#include <env.h> -#include <errno.h> -#include <init.h> -#include <malloc.h> #include <serial.h> -#include <spl.h> -#include <asm/arch/cpu.h> -#include <asm/arch/hardware.h> -#include <asm/arch/omap.h> -#include <asm/arch/ddr_defs.h> +#include <watchdog.h> #include <asm/arch/clock.h> -#include <asm/arch/gpio.h> -#include <asm/arch/mmc_host_def.h> #include <asm/arch/sys_proto.h> -#include <asm/global_data.h> -#include <asm/io.h> -#include <asm/emif.h> #include <asm/gpio.h> -#include <miiphy.h> -#include <cpsw.h> -#include <watchdog.h> #include <asm/mach-types.h> #include "board_am335x.h" #include "eeprom.h" diff --git a/board/siemens/common/factoryset.c b/board/siemens/common/factoryset.c index 4a1277340a7..b20af95d13d 100644 --- a/board/siemens/common/factoryset.c +++ b/board/siemens/common/factoryset.c @@ -7,21 +7,13 @@
#if !defined(CONFIG_SPL_BUILD)
-#include <common.h> #include <env.h> -#include <dm.h> -#include <env_internal.h> -#include <i2c.h> -#include <log.h> +#include <g_dnl.h> +#include <net.h> #include <asm/io.h> #if !CONFIG_IS_ENABLED(TARGET_GIEDI) && !CONFIG_IS_ENABLED(TARGET_DENEB) #include <asm/arch/cpu.h> #endif -#include <asm/arch/sys_proto.h> -#include <asm/unaligned.h> -#include <net.h> -#include <errno.h> -#include <g_dnl.h> #include "eeprom.h" #include "factoryset.h"
diff --git a/board/siemens/draco/board.c b/board/siemens/draco/board.c index 2412a04a9a1..fc3eb06ccf2 100644 --- a/board/siemens/draco/board.c +++ b/board/siemens/draco/board.c @@ -12,34 +12,21 @@ * Copyright (C) 2011, Texas Instruments, Incorporated - https://www.ti.com/ */
-#include <common.h> #include <command.h> +#include <cpsw.h> #include <env.h> -#include <errno.h> #include <init.h> -#include <net.h> -#include <spl.h> -#include <asm/arch/cpu.h> -#include <asm/arch/hardware.h> -#include <asm/arch/omap.h> -#include <asm/arch/ddr_defs.h> +#include <linux/delay.h> +#include <nand.h> #include <asm/arch/clock.h> -#include <asm/arch/gpio.h> -#include <asm/arch/mmc_host_def.h> -#include <asm/arch/sys_proto.h> +#include <asm/arch/ddr_defs.h> #include <asm/arch/mem.h> -#include <asm/io.h> -#include <asm/emif.h> +#include <asm/arch/sys_proto.h> #include <asm/gpio.h> -#include <i2c.h> -#include <miiphy.h> -#include <cpsw.h> -#include <watchdog.h> -#include <linux/delay.h> +#include <asm/io.h> #include "board.h" #include "../common/eeprom.h" #include "../common/factoryset.h" -#include <nand.h>
#ifdef CONFIG_SPL_BUILD static struct draco_baseboard_id __section(".data") settings; diff --git a/board/siemens/draco/mux.c b/board/siemens/draco/mux.c index 56d8f45c349..4149e628475 100644 --- a/board/siemens/draco/mux.c +++ b/board/siemens/draco/mux.c @@ -10,12 +10,10 @@ * Copyright (C) 2011 Texas Instruments Incorporated - https://www.ti.com/ */
-#include <common.h> +#include <asm/io.h> #include <asm/arch/sys_proto.h> #include <asm/arch/hardware.h> #include <asm/arch/mux.h> -#include <asm/io.h> -#include <i2c.h> #include "eeprom.h"
static struct module_pin_mux uart0_pin_mux[] = { diff --git a/board/siemens/pxm2/board.c b/board/siemens/pxm2/board.c index bff6d20251e..888c7c09baf 100644 --- a/board/siemens/pxm2/board.c +++ b/board/siemens/pxm2/board.c @@ -12,35 +12,21 @@ * Copyright (C) 2011, Texas Instruments, Incorporated - https://www.ti.com/ */
-#include <common.h> +#include <cpsw.h> #include <env.h> -#include <errno.h> +#include <i2c.h> #include <init.h> -#include <log.h> -#include <malloc.h> +#include <nand.h> #include <net.h> -#include <spl.h> -#include <asm/arch/cpu.h> -#include <asm/arch/hardware.h> -#include <asm/arch/omap.h> -#include <asm/arch/ddr_defs.h> #include <asm/arch/clock.h> -#include <asm/arch/gpio.h> -#include <asm/arch/mmc_host_def.h> +#include <asm/arch/ddr_defs.h> #include <asm/arch/sys_proto.h> -#include <asm/io.h> -#include <asm/emif.h> #include <asm/gpio.h> -#include <i2c.h> -#include <miiphy.h> -#include <cpsw.h> -#include <watchdog.h> +#include <asm/io.h> +#include "pmic.h" #include "../common/board_am335x.h" #include "../common/eeprom.h" #include "../common/factoryset.h" -#include "pmic.h" -#include <nand.h> -#include <bmp_layout.h>
#ifdef CONFIG_SPL_BUILD void draco_init_ddr(void) diff --git a/board/siemens/pxm2/mux.c b/board/siemens/pxm2/mux.c index 07cf5675927..bdf460b5920 100644 --- a/board/siemens/pxm2/mux.c +++ b/board/siemens/pxm2/mux.c @@ -11,12 +11,10 @@ * Copyright (C) 2011 Texas Instruments Incorporated - https://www.ti.com/ */
-#include <common.h> +#include <asm/io.h> #include <asm/arch/sys_proto.h> #include <asm/arch/hardware.h> #include <asm/arch/mux.h> -#include <asm/io.h> -#include <i2c.h> #include "eeprom.h"
static struct module_pin_mux uart0_pin_mux[] = { diff --git a/board/siemens/rut/board.c b/board/siemens/rut/board.c index 1e0e131addf..8d316918e7a 100644 --- a/board/siemens/rut/board.c +++ b/board/siemens/rut/board.c @@ -10,31 +10,16 @@ * Copyright (C) 2011, Texas Instruments, Incorporated - https://www.ti.com/ */
-#include <common.h> +#include <cpsw.h> #include <env.h> -#include <errno.h> #include <init.h> -#include <malloc.h> -#include <net.h> -#include <spi.h> -#include <spl.h> -#include <asm/arch/cpu.h> -#include <asm/arch/hardware.h> -#include <asm/arch/omap.h> -#include <asm/arch/ddr_defs.h> +#include <linux/delay.h> +#include <nand.h> #include <asm/arch/clock.h> -#include <asm/arch/gpio.h> -#include <asm/arch/mmc_host_def.h> +#include <asm/arch/ddr_defs.h> #include <asm/arch/sys_proto.h> -#include <asm/io.h> -#include <asm/emif.h> #include <asm/gpio.h> -#include <i2c.h> -#include <miiphy.h> -#include <cpsw.h> -#include <video.h> -#include <watchdog.h> -#include <linux/delay.h> +#include <asm/io.h> #include "../common/board_am335x.h" #include "../common/eeprom.h" #include "../common/factoryset.h" diff --git a/board/siemens/rut/mux.c b/board/siemens/rut/mux.c index 894a9bf1e3d..8947e4e537c 100644 --- a/board/siemens/rut/mux.c +++ b/board/siemens/rut/mux.c @@ -11,12 +11,10 @@ * Copyright (C) 2011 Texas Instruments Incorporated - https://www.ti.com/ */
-#include <common.h> +#include <asm/io.h> #include <asm/arch/sys_proto.h> #include <asm/arch/hardware.h> #include <asm/arch/mux.h> -#include <asm/io.h> -#include <i2c.h>
static struct module_pin_mux uart0_pin_mux[] = { {OFFSET(uart0_rxd), (MODE(0) | PULLUDDIS | RXACTIVE)}, /* UART0_RXD */

Adding the capricorn board family some parts diverge from draco family. The switches used were not pertinent and need to be enhanced for each new board of the capricorn family. Replace them through the SOC name 'AM33XX' and 'IMX8'.
Signed-off-by: Enrico Leto enrico.leto@siemens.com --- board/siemens/common/factoryset.c | 6 +++--- board/siemens/common/factoryset.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/board/siemens/common/factoryset.c b/board/siemens/common/factoryset.c index b20af95d13d..a250ccfe252 100644 --- a/board/siemens/common/factoryset.c +++ b/board/siemens/common/factoryset.c @@ -11,7 +11,7 @@ #include <g_dnl.h> #include <net.h> #include <asm/io.h> -#if !CONFIG_IS_ENABLED(TARGET_GIEDI) && !CONFIG_IS_ENABLED(TARGET_DENEB) +#if CONFIG_IS_ENABLED(AM33XX) #include <asm/arch/cpu.h> #endif #include "eeprom.h" @@ -197,7 +197,7 @@ int factoryset_read_eeprom(int i2c_addr) cp1 += 3; }
-#if CONFIG_IS_ENABLED(TARGET_GIEDI) || CONFIG_IS_ENABLED(TARGET_DENEB) +#if CONFIG_IS_ENABLED(IMX8) /* get mac address for WLAN */ if (get_factory_record_val(cp, size, (uchar *)"WLAN1", (uchar *)"mac", buf, MAX_STRING_LENGTH) > 0) { @@ -304,7 +304,7 @@ static int factoryset_mac_env_set(void)
eth_env_set_enetaddr("ethaddr", mac_addr);
-#if CONFIG_IS_ENABLED(TARGET_GIEDI) || CONFIG_IS_ENABLED(TARGET_DENEB) +#if CONFIG_IS_ENABLED(IMX8) eth_env_set_enetaddr("eth1addr", mac_addr);
/* wlan mac */ diff --git a/board/siemens/common/factoryset.h b/board/siemens/common/factoryset.h index 8fa6c3b3d3b..ee8bcd0f20d 100644 --- a/board/siemens/common/factoryset.h +++ b/board/siemens/common/factoryset.h @@ -11,7 +11,7 @@
struct factorysetcontainer { uchar mac[6]; -#if CONFIG_IS_ENABLED(TARGET_GIEDI) || CONFIG_IS_ENABLED(TARGET_DENEB) +#if CONFIG_IS_ENABLED(IMX8) uchar mac_wlan[6]; #endif int usb_vendor_id;

On Wed, Jan 24, 2024 at 03:43:48PM +0100, Enrico Leto wrote:
The common folder was initialially created for the common parts of the products based on draco-am355x board family. We have the product lines 'pxm2', 'rut' and the base line unfortunately named 'draco'! Adding the new capricorn-imx8 board family, the files were enhanced without cleanup. Simplify first EEPROM probe and access that implements both i2c with & without driver model. Use abstraction functions for this. Move all am355x specifics to a new file 'board_am335x'. Clean-up includes, config checks, maintainer.
Signed-off-by: Enrico Leto enrico.leto@siemens.com
Thanks, this is indeed building for me as well and I'll apply it soon.
In terms of future work, many of the siemens platforms need to migrate to using DM_I2C, and should also move from using OF_EMBED to using OF_SEPARATE if possible.

On Wed, 24 Jan 2024 15:43:48 +0100, Enrico Leto wrote:
The common folder was initialially created for the common parts of the products based on draco-am355x board family. We have the product lines 'pxm2', 'rut' and the base line unfortunately named 'draco'! Adding the new capricorn-imx8 board family, the files were enhanced without cleanup. Simplify first EEPROM probe and access that implements both i2c with & without driver model. Use abstraction functions for this.
[...]
Applied to u-boot/master, thanks!
participants (2)
-
Enrico Leto
-
Tom Rini