[PATCH v5 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 --- Changes for v2: - fix wrong value in CONFIG_IS_ENABLED
Changes for v3: - rebased to the top of next branch
Changes for v4: - remove compiler errors - fix patch style checks
Changes for v5: - remove deprecated nand config for etamin that generates compiler error
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 draco products vs common siemens: board: clean up includes siemens: factoryset: use correct config for soc specific implementation
board/siemens/capricorn/board.c | 5 +- board/siemens/common/board.c | 114 +++++++++++----------------- board/siemens/common/board.h | 24 ++++++ board/siemens/common/board_am335x.c | 58 ++++++++++++++ board/siemens/common/board_am335x.h | 38 ++++++++++ board/siemens/common/factoryset.c | 87 +++++---------------- board/siemens/draco/Kconfig | 2 - board/siemens/draco/Makefile | 2 + board/siemens/draco/board.c | 87 +++++---------------- board/siemens/draco/board.h | 32 ++------ board/siemens/draco/mux.c | 6 +- board/siemens/pxm2/MAINTAINERS | 2 +- board/siemens/pxm2/Makefile | 2 + board/siemens/pxm2/board.c | 34 +++------ 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 | 33 ++------ board/siemens/rut/board.h | 21 ----- board/siemens/rut/mux.c | 5 +- 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 - 27 files changed, 248 insertions(+), 356 deletions(-) create mode 100644 board/siemens/common/board.h create mode 100644 board/siemens/common/board_am335x.c 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

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/board.h | 21 +++++++++++++++++++++ board/siemens/common/factoryset.c | 12 ++++++------ board/siemens/draco/board.c | 13 +++++-------- include/configs/draco-etamin.h | 3 --- include/configs/draco-rastaban.h | 3 --- include/configs/draco-thuban.h | 3 --- 8 files changed, 37 insertions(+), 29 deletions(-) create mode 100644 board/siemens/common/board.h
diff --git a/board/siemens/capricorn/board.c b/board/siemens/capricorn/board.c index 924c88e8fab..81fa340ca42 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/board.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..7ad367439c1 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 "board.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/board.h b/board/siemens/common/board.h new file mode 100644 index 00000000000..0d5b369028f --- /dev/null +++ b/board/siemens/common/board.h @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright Siemens AG 2023 + * + * Common board definitions for siemens boards + */ + +#ifndef _BOARD_COMMON_H_ +#define _BOARD_COMMON_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 /* _BOARD_COMMON_H_ */ diff --git a/board/siemens/common/factoryset.c b/board/siemens/common/factoryset.c index 4e36a6f3199..94c671389dc 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 "board.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..814959583f7 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/board.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/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/common/board.c | 48 +++++++++++++++++++++-- board/siemens/common/board.h | 3 ++ board/siemens/common/factoryset.c | 63 +++++-------------------------- board/siemens/draco/board.c | 23 ++++------- board/siemens/pxm2/board.c | 2 +- board/siemens/rut/board.c | 2 +- 6 files changed, 67 insertions(+), 74 deletions(-)
diff --git a/board/siemens/common/board.c b/board/siemens/common/board.c index 7ad367439c1..80737838a23 100644 --- a/board/siemens/common/board.c +++ b/board/siemens/common/board.c @@ -39,6 +39,48 @@
DECLARE_GLOBAL_DATA_PTR;
+#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 +} + #ifdef CONFIG_SPL_BUILD void set_uart_mux_conf(void) { @@ -49,12 +91,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 +122,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/board.h b/board/siemens/common/board.h index 0d5b369028f..2b49348919a 100644 --- a/board/siemens/common/board.h +++ b/board/siemens/common/board.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 /* _BOARD_COMMON_H_ */ diff --git a/board/siemens/common/factoryset.c b/board/siemens/common/factoryset.c index 94c671389dc..2b3e36d5812 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/board.c b/board/siemens/draco/board.c index 814959583f7..a0a7d51db32 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/pxm2/board.c b/board/siemens/pxm2/board.c index 40aee7c8b3e..2b061aedfc7 100644 --- a/board/siemens/pxm2/board.c +++ b/board/siemens/pxm2/board.c @@ -160,7 +160,6 @@ void spl_siemens_board_init(void) printf("voltage update failed\n"); } } -#endif /* if def CONFIG_SPL_BUILD */
int read_eeprom(void) { @@ -168,6 +167,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/rut/board.c b/board/siemens/rut/board.c index bad0b71ce2d..a530b841a97 100644 --- a/board/siemens/rut/board.c +++ b/board/siemens/rut/board.c @@ -38,6 +38,7 @@ #include "board.h" #include "../common/factoryset.h"
+#ifdef CONFIG_SPL_BUILD /* * Read header information from EEPROM into global structure. */ @@ -46,7 +47,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 80737838a23..9551a29f03d 100644 --- a/board/siemens/common/board.c +++ b/board/siemens/common/board.c @@ -135,10 +135,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 a0a7d51db32..8c5783d0fb4 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.
Move all am355x specifics to a new file 'board_am335x'.
Reviewed-by: Alexander Sverdlin alexander.sverdlin@siemens.com Signed-off-by: Enrico Leto enrico.leto@siemens.com --- board/siemens/common/board.c | 52 +++----------------------- board/siemens/common/board_am335x.c | 58 +++++++++++++++++++++++++++++ board/siemens/common/board_am335x.h | 38 +++++++++++++++++++ board/siemens/draco/Makefile | 2 + board/siemens/draco/board.c | 10 ++--- board/siemens/draco/board.h | 32 +++------------- board/siemens/draco/mux.c | 2 +- board/siemens/pxm2/MAINTAINERS | 2 +- board/siemens/pxm2/Makefile | 2 + board/siemens/pxm2/board.c | 10 ++--- board/siemens/pxm2/board.h | 21 ----------- board/siemens/pxm2/mux.c | 2 +- board/siemens/rut/MAINTAINERS | 2 +- board/siemens/rut/Makefile | 2 + board/siemens/rut/board.c | 10 ++--- board/siemens/rut/board.h | 21 ----------- board/siemens/rut/mux.c | 1 + 17 files changed, 129 insertions(+), 138 deletions(-) create mode 100644 board/siemens/common/board_am335x.c 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.c index 9551a29f03d..bed3d3c3667 100644 --- a/board/siemens/common/board.c +++ b/board/siemens/common/board.c @@ -1,12 +1,11 @@ // SPDX-License-Identifier: GPL-2.0+ /* - * Common board functions for siemens AM335X based boards + * Common board functions for siemens based boards + * + * TI am335x specifics moved to board_am335x.c + * * (C) Copyright 2013 Siemens Schweiz AG * (C) Heiko Schocher, DENX Software Engineering, hs@denx.de. - * - * Based on: - * U-Boot file:/board/ti/am335x/board.c - * Copyright (C) 2011, Texas Instruments, Incorporated - https://www.ti.com/ */
#include <common.h> @@ -81,38 +80,6 @@ int siemens_ee_read_data(uint address, uchar *buffer, int len) #endif }
-#ifdef CONFIG_SPL_BUILD -void set_uart_mux_conf(void) -{ - enable_uart0_pin_mux(); -} - -void set_mux_conf_regs(void) -{ - /* Initalize the board header */ - enable_i2c0_pin_mux(); - - /* 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"); - - enable_board_pin_mux(); -} - -void sdram_init(void) -{ - spl_siemens_board_init(); - board_init_ddr(); - - return; -} -#endif /* #ifdef CONFIG_SPL_BUILD */ - #ifndef CONFIG_SPL_BUILD /* * Basic board specific setup. Pinmux has been handled already. @@ -139,15 +106,6 @@ int board_init(void) } #endif /* #ifndef CONFIG_SPL_BUILD */
-#define OSC (V_OSCK/1000000) -const struct dpll_params dpll_ddr = { - DDR_PLL_FREQ, OSC-1, 1, -1, -1, -1, -1}; - -const struct dpll_params *get_dpll_ddr_params(void) -{ - return &dpll_ddr; -} - #ifndef CONFIG_SPL_BUILD
#define MAX_NR_LEDS 10 @@ -226,7 +184,7 @@ U_BOOT_CMD( * defines the startup state of the led, S1 the special state of the led when * it enters e.g. dfu mode. */ -void set_env_gpios(unsigned char state) +static void set_env_gpios(unsigned char state) { char *ptr_env; char str_tmp[5]; /* must contain "ledX"*/ diff --git a/board/siemens/common/board_am335x.c b/board/siemens/common/board_am335x.c new file mode 100644 index 00000000000..301857d6f90 --- /dev/null +++ b/board/siemens/common/board_am335x.c @@ -0,0 +1,58 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Common board functions for siemens AM335X based boards + * (C) Copyright Siemens AG 2013 + * (C) Heiko Schocher, DENX Software Engineering, hs@denx.de. + * + * Based on: + * U-Boot file:/board/ti/am335x/board.c + * Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/ + */ + +#include <init.h> +#include <serial.h> +#include <asm/arch/clock.h> +#include "board_am335x.h" + +DECLARE_GLOBAL_DATA_PTR; + +#ifdef CONFIG_SPL_BUILD +void set_uart_mux_conf(void) +{ + enable_uart0_pin_mux(); +} + +void set_mux_conf_regs(void) +{ + /* Initalize the board header */ + enable_i2c0_pin_mux(); + + /* enable early the console */ + gd->baudrate = CONFIG_BAUDRATE; + serial_init(); + gd->have_console = 1; + + siemens_ee_setup(); + if (siemens_read_eeprom() < 0) + puts("Could not get board ID.\n"); + + enable_board_pin_mux(); +} + +void sdram_init(void) +{ + spl_siemens_board_init(); + siemens_init_ddr(); + + return; +} +#endif /* #ifdef CONFIG_SPL_BUILD */ + +#define OSC (V_OSCK / 1000000) +const struct dpll_params dpll_ddr = { + DDR_PLL_FREQ, OSC - 1, 1, -1, -1, -1, -1}; + +const struct dpll_params *get_dpll_ddr_params(void) +{ + return &dpll_ddr; +} diff --git a/board/siemens/common/board_am335x.h b/board/siemens/common/board_am335x.h new file mode 100644 index 00000000000..ce5bec4f9cb --- /dev/null +++ b/board/siemens/common/board_am335x.h @@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Common board definitions for am335x based boards + * + * Copyright Siemens AG 2023 + * + * 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 "board.h" + +/* Common functions with product specific implementation */ +void spl_siemens_board_init(void); +void siemens_init_ddr(void); +int siemens_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 e94456ab1c3..9091a94d375 100644 --- a/board/siemens/draco/Makefile +++ b/board/siemens/draco/Makefile @@ -14,6 +14,8 @@ obj-y := mux.o endif
obj-y += board.o +obj-y += ../common/board.o +obj-y += ../common/board_am335x.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 8c5783d0fb4..1b3b1ce0dd1 100644 --- a/board/siemens/draco/board.c +++ b/board/siemens/draco/board.c @@ -37,7 +37,7 @@ #include <watchdog.h> #include <linux/delay.h> #include "board.h" -#include "../common/board.h" +#include "../common/board_am335x.h" #include "../common/factoryset.h" #include <nand.h>
@@ -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 siemens_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 siemens_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_siemens_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..b3a765d2eda 100644 --- a/board/siemens/draco/board.h +++ b/board/siemens/draco/board.h @@ -1,19 +1,14 @@ /* 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 +53,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/draco/mux.c b/board/siemens/draco/mux.c index 2632f050336..594da729058 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 "../common/board_am335x.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/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 e94456ab1c3..9091a94d375 100644 --- a/board/siemens/pxm2/Makefile +++ b/board/siemens/pxm2/Makefile @@ -14,6 +14,8 @@ obj-y := mux.o endif
obj-y += board.o +obj-y += ../common/board.o +obj-y += ../common/board_am335x.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 2b061aedfc7..066ca61d60a 100644 --- a/board/siemens/pxm2/board.c +++ b/board/siemens/pxm2/board.c @@ -35,14 +35,14 @@ #include <miiphy.h> #include <cpsw.h> #include <watchdog.h> -#include "board.h" -#include "../common/factoryset.h" #include "pmic.h" #include <nand.h> #include <bmp_layout.h> +#include "../common/board_am335x.h" +#include "../common/factoryset.h"
#ifdef CONFIG_SPL_BUILD -static void board_init_ddr(void) +void siemens_init_ddr(void) { struct emif_regs pxm2_ddr3_emif_reg_data = { .sdram_config = 0x41805332, @@ -161,7 +161,7 @@ void spl_siemens_board_init(void) } }
-int read_eeprom(void) +int siemens_read_eeprom(void) { /* nothing ToDo here for this board */
@@ -274,5 +274,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/pxm2/mux.c b/board/siemens/pxm2/mux.c index d21ef47771d..9d3cb5c31b9 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 "../common/board_am335x.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/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 e94456ab1c3..9091a94d375 100644 --- a/board/siemens/rut/Makefile +++ b/board/siemens/rut/Makefile @@ -14,6 +14,8 @@ obj-y := mux.o endif
obj-y += board.o +obj-y += ../common/board.o +obj-y += ../common/board_am335x.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 a530b841a97..2c6fbfe1201 100644 --- a/board/siemens/rut/board.c +++ b/board/siemens/rut/board.c @@ -35,19 +35,19 @@ #include <video.h> #include <watchdog.h> #include <linux/delay.h> -#include "board.h" +#include "../common/board_am335x.h" #include "../common/factoryset.h"
#ifdef CONFIG_SPL_BUILD /* * Read header information from EEPROM into global structure. */ -static int read_eeprom(void) +int siemens_read_eeprom(void) { return 0; }
-static void board_init_ddr(void) +void siemens_init_ddr(void) { struct emif_regs rut_ddr3_emif_reg_data = { .sdram_config = 0x61C04AB2, @@ -124,7 +124,7 @@ err: #define REQUEST_AND_PULSE_RESET(N) \ request_and_pulse_reset(N, #N);
-static void spl_siemens_board_init(void) +void spl_siemens_board_init(void) { REQUEST_AND_PULSE_RESET(ETH_PHY_RESET_GPIO); REQUEST_AND_PULSE_RESET(MAXTOUCH_RESET_GPIO); @@ -244,5 +244,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 diff --git a/board/siemens/rut/mux.c b/board/siemens/rut/mux.c index 894a9bf1e3d..090c898ccad 100644 --- a/board/siemens/rut/mux.c +++ b/board/siemens/rut/mux.c @@ -17,6 +17,7 @@ #include <asm/arch/mux.h> #include <asm/io.h> #include <i2c.h> +#include "../common/board_am335x.h"
static struct module_pin_mux uart0_pin_mux[] = { {OFFSET(uart0_rxd), (MODE(0) | PULLUDDIS | RXACTIVE)}, /* UART0_RXD */

Many includes were not removed when code parts were moved or removed.
Signed-off-by: Enrico Leto enrico.leto@siemens.com --- board/siemens/common/board.c | 24 +++--------------------- board/siemens/common/factoryset.c | 12 ++---------- board/siemens/draco/board.c | 25 ++++++------------------- board/siemens/draco/mux.c | 4 +--- board/siemens/pxm2/board.c | 22 ++++------------------ board/siemens/pxm2/mux.c | 4 +--- board/siemens/rut/board.c | 21 +++------------------ board/siemens/rut/mux.c | 4 +--- 8 files changed, 21 insertions(+), 95 deletions(-)
diff --git a/board/siemens/common/board.c b/board/siemens/common/board.c index bed3d3c3667..d280502dccb 100644 --- a/board/siemens/common/board.c +++ b/board/siemens/common/board.c @@ -8,30 +8,12 @@ * (C) Heiko Schocher, DENX Software Engineering, hs@denx.de. */
-#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 <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 <dm/uclass.h> #include <i2c.h> -#include <miiphy.h> -#include <cpsw.h> #include <watchdog.h> +#include <asm/arch/sys_proto.h> +#include <asm/gpio.h> #include <asm/mach-types.h> #include "board.h" #include "factoryset.h" diff --git a/board/siemens/common/factoryset.c b/board/siemens/common/factoryset.c index 2b3e36d5812..0f4c96f1c91 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 "board.h" #include "factoryset.h"
diff --git a/board/siemens/draco/board.c b/board/siemens/draco/board.c index 1b3b1ce0dd1..eeeba9c8e26 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/board_am335x.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 594da729058..c85355f293b 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 "../common/board_am335x.h"
static struct module_pin_mux uart0_pin_mux[] = { diff --git a/board/siemens/pxm2/board.c b/board/siemens/pxm2/board.c index 066ca61d60a..f15a26af18f 100644 --- a/board/siemens/pxm2/board.c +++ b/board/siemens/pxm2/board.c @@ -12,32 +12,18 @@ * 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 "pmic.h" -#include <nand.h> -#include <bmp_layout.h> #include "../common/board_am335x.h" #include "../common/factoryset.h"
diff --git a/board/siemens/pxm2/mux.c b/board/siemens/pxm2/mux.c index 9d3cb5c31b9..c061c95ff2b 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 "../common/board_am335x.h"
static struct module_pin_mux uart0_pin_mux[] = { diff --git a/board/siemens/rut/board.c b/board/siemens/rut/board.c index 2c6fbfe1201..e7571b7654a 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 <linux/delay.h> +#include <nand.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/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 "../common/board_am335x.h" #include "../common/factoryset.h"
diff --git a/board/siemens/rut/mux.c b/board/siemens/rut/mux.c index 090c898ccad..cf0305d2d9c 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> #include "../common/board_am335x.h"
static struct module_pin_mux uart0_pin_mux[] = {

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 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/board/siemens/common/factoryset.c b/board/siemens/common/factoryset.c index 0f4c96f1c91..128522bdd9b 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 "board.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 */

On Mon, Jan 22, 2024 at 11:52:30AM +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.
To be clear, the changes to common siemens code here break the siemens imx8 platforms, so you need to at least build test them too, in v6.
participants (2)
-
Enrico Leto
-
Tom Rini