[PATCH v6 5/7] siemens: board: clean up products folders vs common

Enrico Leto enrico.leto at siemens.com
Wed Jan 24 15:43:53 CET 2024


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 at siemens.com>
Signed-off-by: Enrico Leto <enrico.leto at 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 at 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 at 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 at siemens.com>
+M:	Enrico Leto <enrico.leto at 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 at 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 at siemens.com>
+M:	Enrico Leto <enrico.leto at 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 at 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
-- 
2.30.2



More information about the U-Boot mailing list