All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] samsung: exynos: Convert SROMC interface to a driver
@ 2021-03-24 21:44 ` Simon Glass
  2021-03-24 21:44   ` [PATCH 2/3] test: Allow tests to run on any board Simon Glass
                     ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Simon Glass @ 2021-03-24 21:44 UTC (permalink / raw)
  To: u-boot

Add a bus driver for this and use it to configure the bus parameters for
the Ethernet interface. Drop the old pre-driver-model code.

Switch over to use driver model for Ethernet.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 arch/arm/Kconfig                          |  1 +
 arch/arm/dts/exynos5250-smdk5250.dts      |  1 +
 arch/arm/mach-exynos/include/mach/sromc.h | 18 ------
 board/samsung/common/Makefile             |  2 +-
 board/samsung/common/board.c              | 78 -----------------------
 board/samsung/common/sromc.c              | 76 ++++++++++++++++++++++
 board/samsung/smdkv310/smdkv310.c         |  9 ---
 configs/arndale_defconfig                 |  1 -
 configs/odroid-xu3_defconfig              |  1 -
 configs/peach-pi_defconfig                |  1 -
 configs/peach-pit_defconfig               |  1 -
 configs/smdk5250_defconfig                |  1 -
 configs/smdk5420_defconfig                |  1 -
 configs/smdkv310_defconfig                |  1 -
 configs/snow_defconfig                    |  1 -
 configs/spring_defconfig                  |  1 -
 include/fdtdec.h                          |  2 -
 lib/fdtdec.c                              |  2 -
 18 files changed, 79 insertions(+), 119 deletions(-)
 create mode 100644 board/samsung/common/sromc.c

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 3307f2b3fc5..eb25474ab27 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -727,6 +727,7 @@ config ARCH_EXYNOS
 	select DM
 	select DM_GPIO
 	select DM_I2C
+	select DM_ETH
 	select DM_KEYBOARD
 	select DM_SERIAL
 	select DM_SPI
diff --git a/arch/arm/dts/exynos5250-smdk5250.dts b/arch/arm/dts/exynos5250-smdk5250.dts
index e542a790761..afe0cca48a9 100644
--- a/arch/arm/dts/exynos5250-smdk5250.dts
+++ b/arch/arm/dts/exynos5250-smdk5250.dts
@@ -41,6 +41,7 @@
 	};
 
 	sromc at 12250000 {
+		compatible = "samsung,exynos5-sromc";
 		bank = <1>;
 		srom-timing = <1 9 12 1 6 1 1>;
 		width = <2>;
diff --git a/arch/arm/mach-exynos/include/mach/sromc.h b/arch/arm/mach-exynos/include/mach/sromc.h
index 15c9ccc723d..ac229e0d169 100644
--- a/arch/arm/mach-exynos/include/mach/sromc.h
+++ b/arch/arm/mach-exynos/include/mach/sromc.h
@@ -33,22 +33,4 @@ struct s5p_sromc {
 /* Configure the Band Width and Bank Control Regs for required SROMC Bank */
 void s5p_config_sromc(u32 srom_bank, u32 srom_bw_conf, u32 srom_bc_conf);
 
-enum {
-	FDT_SROM_PMC,
-	FDT_SROM_TACP,
-	FDT_SROM_TAH,
-	FDT_SROM_TCOH,
-	FDT_SROM_TACC,
-	FDT_SROM_TCOS,
-	FDT_SROM_TACS,
-
-	FDT_SROM_TIMING_COUNT,
-};
-
-struct fdt_sromc {
-	u8 bank;	/* srom bank number */
-	u8 width;	/* bus width in bytes */
-	unsigned int timing[FDT_SROM_TIMING_COUNT]; /* timing parameters */
-};
-
 #endif /* __ASM_ARCH_SROMC_H_ */
diff --git a/board/samsung/common/Makefile b/board/samsung/common/Makefile
index 3593c77cbc2..d31b81abf1e 100644
--- a/board/samsung/common/Makefile
+++ b/board/samsung/common/Makefile
@@ -7,7 +7,7 @@ obj-$(CONFIG_USB_GADGET_DOWNLOAD) += gadget.o
 obj-$(CONFIG_MISC_COMMON) += misc.o
 
 ifndef CONFIG_SPL_BUILD
-obj-$(CONFIG_BOARD_COMMON)	+= board.o
+obj-$(CONFIG_BOARD_COMMON)	+= board.o sromc.o
 ifdef CONFIG_EXYNOS5_DT
 obj-y += exynos5-dt.o
 obj-$(CONFIG_BOARD_TYPES) += exynos5-dt-types.o
diff --git a/board/samsung/common/board.c b/board/samsung/common/board.c
index 104d2a65746..1c2fe025e89 100644
--- a/board/samsung/common/board.c
+++ b/board/samsung/common/board.c
@@ -26,7 +26,6 @@
 #include <asm/arch/pinmux.h>
 #include <asm/arch/power.h>
 #include <asm/arch/system.h>
-#include <asm/arch/sromc.h>
 #include <lcd.h>
 #include <i2c.h>
 #include <mmc.h>
@@ -195,83 +194,6 @@ int power_init_board(void)
 }
 #endif
 
-#ifdef CONFIG_SMC911X
-static int decode_sromc(const void *blob, struct fdt_sromc *config)
-{
-	int err;
-	int node;
-
-	node = fdtdec_next_compatible(blob, 0, COMPAT_SAMSUNG_EXYNOS5_SROMC);
-	if (node < 0) {
-		debug("Could not find SROMC node\n");
-		return node;
-	}
-
-	config->bank = fdtdec_get_int(blob, node, "bank", 0);
-	config->width = fdtdec_get_int(blob, node, "width", 2);
-
-	err = fdtdec_get_int_array(blob, node, "srom-timing", config->timing,
-			FDT_SROM_TIMING_COUNT);
-	if (err < 0) {
-		debug("Could not decode SROMC configuration Error: %s\n",
-		      fdt_strerror(err));
-		return -FDT_ERR_NOTFOUND;
-	}
-	return 0;
-}
-#endif
-
-int board_eth_init(struct bd_info *bis)
-{
-#ifdef CONFIG_SMC911X
-	u32 smc_bw_conf, smc_bc_conf;
-	struct fdt_sromc config;
-	fdt_addr_t base_addr;
-	int node;
-
-	node = decode_sromc(gd->fdt_blob, &config);
-	if (node < 0) {
-		debug("%s: Could not find sromc configuration\n", __func__);
-		return 0;
-	}
-	node = fdtdec_next_compatible(gd->fdt_blob, node, COMPAT_SMSC_LAN9215);
-	if (node < 0) {
-		debug("%s: Could not find lan9215 configuration\n", __func__);
-		return 0;
-	}
-
-	/* We now have a node, so any problems from now on are errors */
-	base_addr = fdtdec_get_addr(gd->fdt_blob, node, "reg");
-	if (base_addr == FDT_ADDR_T_NONE) {
-		debug("%s: Could not find lan9215 address\n", __func__);
-		return -1;
-	}
-
-	/* Ethernet needs data bus width of 16 bits */
-	if (config.width != 2) {
-		debug("%s: Unsupported bus width %d\n", __func__,
-		      config.width);
-		return -1;
-	}
-	smc_bw_conf = SROMC_DATA16_WIDTH(config.bank)
-			| SROMC_BYTE_ENABLE(config.bank);
-
-	smc_bc_conf = SROMC_BC_TACS(config.timing[FDT_SROM_TACS])   |
-			SROMC_BC_TCOS(config.timing[FDT_SROM_TCOS]) |
-			SROMC_BC_TACC(config.timing[FDT_SROM_TACC]) |
-			SROMC_BC_TCOH(config.timing[FDT_SROM_TCOH]) |
-			SROMC_BC_TAH(config.timing[FDT_SROM_TAH])   |
-			SROMC_BC_TACP(config.timing[FDT_SROM_TACP]) |
-			SROMC_BC_PMC(config.timing[FDT_SROM_PMC]);
-
-	/* Select and configure the SROMC bank */
-	exynos_pinmux_config(PERIPH_ID_SROMC, config.bank);
-	s5p_config_sromc(config.bank, smc_bw_conf, smc_bc_conf);
-	return smc911x_initialize(0, base_addr);
-#endif
-	return 0;
-}
-
 #if defined(CONFIG_DISPLAY_BOARDINFO) || defined(CONFIG_DISPLAY_BOARDINFO_LATE)
 int checkboard(void)
 {
diff --git a/board/samsung/common/sromc.c b/board/samsung/common/sromc.c
new file mode 100644
index 00000000000..76e37dfe262
--- /dev/null
+++ b/board/samsung/common/sromc.c
@@ -0,0 +1,76 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2021 Google LLC
+ */
+
+#define LOG_CATEGORY	UCLASS_ETH
+
+#include <common.h>
+#include <dm.h>
+#include <log.h>
+#include <asm/arch/pinmux.h>
+#include <asm/arch/sromc.h>
+
+enum {
+	FDT_SROM_PMC,
+	FDT_SROM_TACP,
+	FDT_SROM_TAH,
+	FDT_SROM_TCOH,
+	FDT_SROM_TACC,
+	FDT_SROM_TCOS,
+	FDT_SROM_TACS,
+
+	FDT_SROM_TIMING_COUNT,
+};
+
+static int exyno5_sromc_probe(struct udevice *dev)
+{
+	u32 timing[FDT_SROM_TIMING_COUNT]; /* timing parameters */
+	u32 smc_bw_conf, smc_bc_conf;
+	int bank;	/* srom bank number */
+	int width;	/* bus width in bytes */
+	int ret;
+
+	if (!IS_ENABLED(CONFIG_SMC911X))
+		return 0;
+
+	bank = dev_read_s32_default(dev, "bank", 0);
+	width = dev_read_s32_default(dev, "width", 2);
+
+	/* Ethernet needs data bus width of 16 bits */
+	if (width != 2) {
+		log_debug("Unsupported bus width %d\n", width);
+		return log_msg_ret("width", -EINVAL);
+	}
+	ret = dev_read_u32_array(dev, "srom-timing", timing,
+				 FDT_SROM_TIMING_COUNT);
+	if (ret)
+		return log_msg_ret("sromc", -EINVAL);
+
+	smc_bw_conf = SROMC_DATA16_WIDTH(bank) | SROMC_BYTE_ENABLE(bank);
+	smc_bc_conf = SROMC_BC_TACS(timing[FDT_SROM_TACS])   |
+			SROMC_BC_TCOS(timing[FDT_SROM_TCOS]) |
+			SROMC_BC_TACC(timing[FDT_SROM_TACC]) |
+			SROMC_BC_TCOH(timing[FDT_SROM_TCOH]) |
+			SROMC_BC_TAH(timing[FDT_SROM_TAH])   |
+			SROMC_BC_TACP(timing[FDT_SROM_TACP]) |
+			SROMC_BC_PMC(timing[FDT_SROM_PMC]);
+
+	/* Select and configure the SROMC bank */
+	exynos_pinmux_config(PERIPH_ID_SROMC, bank);
+	s5p_config_sromc(bank, smc_bw_conf, smc_bc_conf);
+
+	return 0;
+}
+
+static const struct udevice_id exyno5_sromc_ids[] = {
+	{ .compatible = "samsung,exynos5-sromc" },
+	{}
+};
+
+U_BOOT_DRIVER(exyno5_sromc) = {
+	.name		= "exyno5_sromc",
+	.id		= UCLASS_SIMPLE_BUS,
+	.of_match	= exyno5_sromc_ids,
+	.probe		= exyno5_sromc_probe,
+};
diff --git a/board/samsung/smdkv310/smdkv310.c b/board/samsung/smdkv310/smdkv310.c
index 8811cbb9ad0..bb61ba1f81c 100644
--- a/board/samsung/smdkv310/smdkv310.c
+++ b/board/samsung/smdkv310/smdkv310.c
@@ -73,15 +73,6 @@ int dram_init_banksize(void)
 	return 0;
 }
 
-int board_eth_init(struct bd_info *bis)
-{
-	int rc = 0;
-#ifdef CONFIG_SMC911X
-	rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);
-#endif
-	return rc;
-}
-
 #ifdef CONFIG_DISPLAY_BOARDINFO
 int checkboard(void)
 {
diff --git a/configs/arndale_defconfig b/configs/arndale_defconfig
index 1b4dd324b8d..84b248ddde2 100644
--- a/configs/arndale_defconfig
+++ b/configs/arndale_defconfig
@@ -37,7 +37,6 @@ CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_S5P=y
 CONFIG_MTD=y
 CONFIG_SMC911X=y
-CONFIG_SMC911X_BASE=0x5000000
 CONFIG_SOUND=y
 CONFIG_I2S=y
 CONFIG_I2S_SAMSUNG=y
diff --git a/configs/odroid-xu3_defconfig b/configs/odroid-xu3_defconfig
index 755a2ca9add..1dbb3550e48 100644
--- a/configs/odroid-xu3_defconfig
+++ b/configs/odroid-xu3_defconfig
@@ -45,7 +45,6 @@ CONFIG_SUPPORT_EMMC_BOOT=y
 CONFIG_MMC_DW=y
 CONFIG_MTD=y
 CONFIG_SMC911X=y
-CONFIG_SMC911X_BASE=0x5000000
 CONFIG_DM_PMIC=y
 CONFIG_PMIC_S2MPS11=y
 CONFIG_DM_REGULATOR=y
diff --git a/configs/peach-pi_defconfig b/configs/peach-pi_defconfig
index 01054b0ee48..3cef18c188c 100644
--- a/configs/peach-pi_defconfig
+++ b/configs/peach-pi_defconfig
@@ -53,7 +53,6 @@ CONFIG_SF_DEFAULT_SPEED=50000000
 CONFIG_SPI_FLASH_GIGADEVICE=y
 CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_SMC911X=y
-CONFIG_SMC911X_BASE=0x5000000
 CONFIG_DM_PMIC=y
 CONFIG_PMIC_TPS65090=y
 CONFIG_DM_REGULATOR=y
diff --git a/configs/peach-pit_defconfig b/configs/peach-pit_defconfig
index c6646dcd6e6..da517eab621 100644
--- a/configs/peach-pit_defconfig
+++ b/configs/peach-pit_defconfig
@@ -52,7 +52,6 @@ CONFIG_SF_DEFAULT_SPEED=50000000
 CONFIG_SPI_FLASH_GIGADEVICE=y
 CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_SMC911X=y
-CONFIG_SMC911X_BASE=0x5000000
 CONFIG_DM_PMIC=y
 CONFIG_PMIC_TPS65090=y
 CONFIG_DM_REGULATOR=y
diff --git a/configs/smdk5250_defconfig b/configs/smdk5250_defconfig
index 8e60f46a5c7..84318aac975 100644
--- a/configs/smdk5250_defconfig
+++ b/configs/smdk5250_defconfig
@@ -48,7 +48,6 @@ CONFIG_SF_DEFAULT_SPEED=50000000
 CONFIG_SPI_FLASH_GIGADEVICE=y
 CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_SMC911X=y
-CONFIG_SMC911X_BASE=0x5000000
 CONFIG_DM_PMIC=y
 CONFIG_DM_PMIC_MAX77686=y
 CONFIG_DM_REGULATOR=y
diff --git a/configs/smdk5420_defconfig b/configs/smdk5420_defconfig
index 429b0638cdb..69f6d581f04 100644
--- a/configs/smdk5420_defconfig
+++ b/configs/smdk5420_defconfig
@@ -43,7 +43,6 @@ CONFIG_SF_DEFAULT_SPEED=50000000
 CONFIG_SPI_FLASH_GIGADEVICE=y
 CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_SMC911X=y
-CONFIG_SMC911X_BASE=0x5000000
 CONFIG_DM_PMIC=y
 CONFIG_DM_REGULATOR=y
 CONFIG_EXYNOS_SPI=y
diff --git a/configs/smdkv310_defconfig b/configs/smdkv310_defconfig
index 9d4cf3533eb..5be91670dcc 100644
--- a/configs/smdkv310_defconfig
+++ b/configs/smdkv310_defconfig
@@ -28,6 +28,5 @@ CONFIG_MMC_SDHCI_SDMA=y
 CONFIG_MMC_SDHCI_S5P=y
 CONFIG_MTD=y
 CONFIG_SMC911X=y
-CONFIG_SMC911X_BASE=0x5000000
 CONFIG_USB=y
 CONFIG_DM_USB=y
diff --git a/configs/snow_defconfig b/configs/snow_defconfig
index 76215034acf..8b646cac67a 100644
--- a/configs/snow_defconfig
+++ b/configs/snow_defconfig
@@ -58,7 +58,6 @@ CONFIG_SF_DEFAULT_SPEED=50000000
 CONFIG_SPI_FLASH_GIGADEVICE=y
 CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_SMC911X=y
-CONFIG_SMC911X_BASE=0x5000000
 CONFIG_DM_PMIC=y
 CONFIG_DM_PMIC_MAX77686=y
 CONFIG_PMIC_S5M8767=y
diff --git a/configs/spring_defconfig b/configs/spring_defconfig
index a1fdf1d1f68..8cf4a5dbe17 100644
--- a/configs/spring_defconfig
+++ b/configs/spring_defconfig
@@ -58,7 +58,6 @@ CONFIG_SF_DEFAULT_SPEED=50000000
 CONFIG_SPI_FLASH_GIGADEVICE=y
 CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_SMC911X=y
-CONFIG_SMC911X_BASE=0x5000000
 CONFIG_DM_PMIC=y
 CONFIG_DM_PMIC_MAX77686=y
 CONFIG_PMIC_S5M8767=y
diff --git a/include/fdtdec.h b/include/fdtdec.h
index 62d16609732..38b1352a013 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -139,8 +139,6 @@ enum fdt_compat_id {
 					/* Tegra124 XUSB pad controller */
 	COMPAT_NVIDIA_TEGRA210_XUSB_PADCTL,
 					/* Tegra210 XUSB pad controller */
-	COMPAT_SMSC_LAN9215,		/* SMSC 10/100 Ethernet LAN9215 */
-	COMPAT_SAMSUNG_EXYNOS5_SROMC,	/* Exynos5 SROMC */
 	COMPAT_SAMSUNG_EXYNOS_USB_PHY,	/* Exynos phy controller for usb2.0 */
 	COMPAT_SAMSUNG_EXYNOS5_USB3_PHY,/* Exynos phy controller for usb3.0 */
 	COMPAT_SAMSUNG_EXYNOS_TMU,	/* Exynos TMU */
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 864589193b4..6bb418236d0 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -47,8 +47,6 @@ static const char * const compat_names[COMPAT_COUNT] = {
 	COMPAT(NVIDIA_TEGRA20_NAND, "nvidia,tegra20-nand"),
 	COMPAT(NVIDIA_TEGRA124_XUSB_PADCTL, "nvidia,tegra124-xusb-padctl"),
 	COMPAT(NVIDIA_TEGRA210_XUSB_PADCTL, "nvidia,tegra210-xusb-padctl"),
-	COMPAT(SMSC_LAN9215, "smsc,lan9215"),
-	COMPAT(SAMSUNG_EXYNOS5_SROMC, "samsung,exynos-sromc"),
 	COMPAT(SAMSUNG_EXYNOS_USB_PHY, "samsung,exynos-usb-phy"),
 	COMPAT(SAMSUNG_EXYNOS5_USB3_PHY, "samsung,exynos5250-usb3-phy"),
 	COMPAT(SAMSUNG_EXYNOS_TMU, "samsung,exynos-tmu"),
-- 
2.31.0.291.g576ba9dcdaf-goog

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/3] test: Allow tests to run on any board
  2021-03-24 21:44 ` [PATCH 1/3] samsung: exynos: Convert SROMC interface to a driver Simon Glass
@ 2021-03-24 21:44   ` Simon Glass
  2021-03-26  1:46     ` Sean Anderson
  2021-04-06  4:34     ` Simon Glass
  2021-03-24 21:44   ` [PATCH 3/3] snow: Enable unit tests Simon Glass
  2021-03-25 22:08   ` [PATCH 1/3] samsung: exynos: Convert SROMC interface to a driver Jaehoon Chung
  2 siblings, 2 replies; 8+ messages in thread
From: Simon Glass @ 2021-03-24 21:44 UTC (permalink / raw)
  To: u-boot

Due to a recent change, tests are limited to running on sandbox only.
Correct this so that any architecture can run them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Sean Anderson <seanga2@gmail.com>
Fixes: c79705ea938 ("test: Move dm_test_init() into test-main.c")
---

 include/test/test.h | 9 +++++++++
 test/test-main.c    | 5 ++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/include/test/test.h b/include/test/test.h
index 0b124edd601..bf7d785d8ed 100644
--- a/include/test/test.h
+++ b/include/test/test.h
@@ -124,4 +124,13 @@ enum {
  */
 struct udevice *testbus_get_clear_removed(void);
 
+static inline void arch_reset_for_test(void)
+{
+#ifdef CONFIG_SANDBOX
+#include <asm/state.h>
+
+	state_reset_for_test(state_get_current());
+#endif
+}
+
 #endif /* __TEST_TEST_H */
diff --git a/test/test-main.c b/test/test-main.c
index e1b49e091ab..201e39d8b2a 100644
--- a/test/test-main.c
+++ b/test/test-main.c
@@ -7,7 +7,6 @@
 #include <common.h>
 #include <console.h>
 #include <dm.h>
-#include <asm/state.h>
 #include <dm/root.h>
 #include <dm/test.h>
 #include <dm/uclass-internal.h>
@@ -46,9 +45,9 @@ static int dm_test_pre_run(struct unit_test_state *uts)
 	uts->force_fail_alloc = false;
 	uts->skip_post_probe = false;
 	gd->dm_root = NULL;
-	if (!CONFIG_IS_ENABLED(OF_PLATDATA))
+	if (IS_ENABLED(CONFIG_UT_DM) && !CONFIG_IS_ENABLED(OF_PLATDATA))
 		memset(dm_testdrv_op_count, '\0', sizeof(dm_testdrv_op_count));
-	state_reset_for_test(state_get_current());
+	arch_reset_for_test();
 
 	/* Determine whether to make the live tree available */
 	gd_set_of_root(of_live ? uts->of_root : NULL);
-- 
2.31.0.291.g576ba9dcdaf-goog

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/3] snow: Enable unit tests
  2021-03-24 21:44 ` [PATCH 1/3] samsung: exynos: Convert SROMC interface to a driver Simon Glass
  2021-03-24 21:44   ` [PATCH 2/3] test: Allow tests to run on any board Simon Glass
@ 2021-03-24 21:44   ` Simon Glass
  2021-03-25 22:09     ` Jaehoon Chung
  2021-03-25 22:08   ` [PATCH 1/3] samsung: exynos: Convert SROMC interface to a driver Jaehoon Chung
  2 siblings, 1 reply; 8+ messages in thread
From: Simon Glass @ 2021-03-24 21:44 UTC (permalink / raw)
  To: u-boot

It is useful to have a board with unit tests enabled, to check that this
does not break.

Let's choose snow, since it is not under active development and it is
glorious.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 configs/snow_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configs/snow_defconfig b/configs/snow_defconfig
index 8b646cac67a..0277062428e 100644
--- a/configs/snow_defconfig
+++ b/configs/snow_defconfig
@@ -92,3 +92,5 @@ CONFIG_VIDEO_BRIDGE_NXP_PTN3460=y
 CONFIG_LCD=y
 CONFIG_TPM=y
 CONFIG_ERRNO_STR=y
+CONFIG_UNIT_TEST=y
+# CONFIG_UT_LIB_ASN1 is not set
-- 
2.31.0.291.g576ba9dcdaf-goog

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 1/3] samsung: exynos: Convert SROMC interface to a driver
  2021-03-24 21:44 ` [PATCH 1/3] samsung: exynos: Convert SROMC interface to a driver Simon Glass
  2021-03-24 21:44   ` [PATCH 2/3] test: Allow tests to run on any board Simon Glass
  2021-03-24 21:44   ` [PATCH 3/3] snow: Enable unit tests Simon Glass
@ 2021-03-25 22:08   ` Jaehoon Chung
  2 siblings, 0 replies; 8+ messages in thread
From: Jaehoon Chung @ 2021-03-25 22:08 UTC (permalink / raw)
  To: u-boot

On 3/25/21 6:44 AM, Simon Glass wrote:
> Add a bus driver for this and use it to configure the bus parameters for
> the Ethernet interface. Drop the old pre-driver-model code.
> 
> Switch over to use driver model for Ethernet.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>

Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>

Best Regards,
Jaehoon Chung

> ---
> 
>  arch/arm/Kconfig                          |  1 +
>  arch/arm/dts/exynos5250-smdk5250.dts      |  1 +
>  arch/arm/mach-exynos/include/mach/sromc.h | 18 ------
>  board/samsung/common/Makefile             |  2 +-
>  board/samsung/common/board.c              | 78 -----------------------
>  board/samsung/common/sromc.c              | 76 ++++++++++++++++++++++
>  board/samsung/smdkv310/smdkv310.c         |  9 ---
>  configs/arndale_defconfig                 |  1 -
>  configs/odroid-xu3_defconfig              |  1 -
>  configs/peach-pi_defconfig                |  1 -
>  configs/peach-pit_defconfig               |  1 -
>  configs/smdk5250_defconfig                |  1 -
>  configs/smdk5420_defconfig                |  1 -
>  configs/smdkv310_defconfig                |  1 -
>  configs/snow_defconfig                    |  1 -
>  configs/spring_defconfig                  |  1 -
>  include/fdtdec.h                          |  2 -
>  lib/fdtdec.c                              |  2 -
>  18 files changed, 79 insertions(+), 119 deletions(-)
>  create mode 100644 board/samsung/common/sromc.c
> 
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index 3307f2b3fc5..eb25474ab27 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -727,6 +727,7 @@ config ARCH_EXYNOS
>  	select DM
>  	select DM_GPIO
>  	select DM_I2C
> +	select DM_ETH
>  	select DM_KEYBOARD
>  	select DM_SERIAL
>  	select DM_SPI
> diff --git a/arch/arm/dts/exynos5250-smdk5250.dts b/arch/arm/dts/exynos5250-smdk5250.dts
> index e542a790761..afe0cca48a9 100644
> --- a/arch/arm/dts/exynos5250-smdk5250.dts
> +++ b/arch/arm/dts/exynos5250-smdk5250.dts
> @@ -41,6 +41,7 @@
>  	};
>  
>  	sromc at 12250000 {
> +		compatible = "samsung,exynos5-sromc";
>  		bank = <1>;
>  		srom-timing = <1 9 12 1 6 1 1>;
>  		width = <2>;
> diff --git a/arch/arm/mach-exynos/include/mach/sromc.h b/arch/arm/mach-exynos/include/mach/sromc.h
> index 15c9ccc723d..ac229e0d169 100644
> --- a/arch/arm/mach-exynos/include/mach/sromc.h
> +++ b/arch/arm/mach-exynos/include/mach/sromc.h
> @@ -33,22 +33,4 @@ struct s5p_sromc {
>  /* Configure the Band Width and Bank Control Regs for required SROMC Bank */
>  void s5p_config_sromc(u32 srom_bank, u32 srom_bw_conf, u32 srom_bc_conf);
>  
> -enum {
> -	FDT_SROM_PMC,
> -	FDT_SROM_TACP,
> -	FDT_SROM_TAH,
> -	FDT_SROM_TCOH,
> -	FDT_SROM_TACC,
> -	FDT_SROM_TCOS,
> -	FDT_SROM_TACS,
> -
> -	FDT_SROM_TIMING_COUNT,
> -};
> -
> -struct fdt_sromc {
> -	u8 bank;	/* srom bank number */
> -	u8 width;	/* bus width in bytes */
> -	unsigned int timing[FDT_SROM_TIMING_COUNT]; /* timing parameters */
> -};
> -
>  #endif /* __ASM_ARCH_SROMC_H_ */
> diff --git a/board/samsung/common/Makefile b/board/samsung/common/Makefile
> index 3593c77cbc2..d31b81abf1e 100644
> --- a/board/samsung/common/Makefile
> +++ b/board/samsung/common/Makefile
> @@ -7,7 +7,7 @@ obj-$(CONFIG_USB_GADGET_DOWNLOAD) += gadget.o
>  obj-$(CONFIG_MISC_COMMON) += misc.o
>  
>  ifndef CONFIG_SPL_BUILD
> -obj-$(CONFIG_BOARD_COMMON)	+= board.o
> +obj-$(CONFIG_BOARD_COMMON)	+= board.o sromc.o
>  ifdef CONFIG_EXYNOS5_DT
>  obj-y += exynos5-dt.o
>  obj-$(CONFIG_BOARD_TYPES) += exynos5-dt-types.o
> diff --git a/board/samsung/common/board.c b/board/samsung/common/board.c
> index 104d2a65746..1c2fe025e89 100644
> --- a/board/samsung/common/board.c
> +++ b/board/samsung/common/board.c
> @@ -26,7 +26,6 @@
>  #include <asm/arch/pinmux.h>
>  #include <asm/arch/power.h>
>  #include <asm/arch/system.h>
> -#include <asm/arch/sromc.h>
>  #include <lcd.h>
>  #include <i2c.h>
>  #include <mmc.h>
> @@ -195,83 +194,6 @@ int power_init_board(void)
>  }
>  #endif
>  
> -#ifdef CONFIG_SMC911X
> -static int decode_sromc(const void *blob, struct fdt_sromc *config)
> -{
> -	int err;
> -	int node;
> -
> -	node = fdtdec_next_compatible(blob, 0, COMPAT_SAMSUNG_EXYNOS5_SROMC);
> -	if (node < 0) {
> -		debug("Could not find SROMC node\n");
> -		return node;
> -	}
> -
> -	config->bank = fdtdec_get_int(blob, node, "bank", 0);
> -	config->width = fdtdec_get_int(blob, node, "width", 2);
> -
> -	err = fdtdec_get_int_array(blob, node, "srom-timing", config->timing,
> -			FDT_SROM_TIMING_COUNT);
> -	if (err < 0) {
> -		debug("Could not decode SROMC configuration Error: %s\n",
> -		      fdt_strerror(err));
> -		return -FDT_ERR_NOTFOUND;
> -	}
> -	return 0;
> -}
> -#endif
> -
> -int board_eth_init(struct bd_info *bis)
> -{
> -#ifdef CONFIG_SMC911X
> -	u32 smc_bw_conf, smc_bc_conf;
> -	struct fdt_sromc config;
> -	fdt_addr_t base_addr;
> -	int node;
> -
> -	node = decode_sromc(gd->fdt_blob, &config);
> -	if (node < 0) {
> -		debug("%s: Could not find sromc configuration\n", __func__);
> -		return 0;
> -	}
> -	node = fdtdec_next_compatible(gd->fdt_blob, node, COMPAT_SMSC_LAN9215);
> -	if (node < 0) {
> -		debug("%s: Could not find lan9215 configuration\n", __func__);
> -		return 0;
> -	}
> -
> -	/* We now have a node, so any problems from now on are errors */
> -	base_addr = fdtdec_get_addr(gd->fdt_blob, node, "reg");
> -	if (base_addr == FDT_ADDR_T_NONE) {
> -		debug("%s: Could not find lan9215 address\n", __func__);
> -		return -1;
> -	}
> -
> -	/* Ethernet needs data bus width of 16 bits */
> -	if (config.width != 2) {
> -		debug("%s: Unsupported bus width %d\n", __func__,
> -		      config.width);
> -		return -1;
> -	}
> -	smc_bw_conf = SROMC_DATA16_WIDTH(config.bank)
> -			| SROMC_BYTE_ENABLE(config.bank);
> -
> -	smc_bc_conf = SROMC_BC_TACS(config.timing[FDT_SROM_TACS])   |
> -			SROMC_BC_TCOS(config.timing[FDT_SROM_TCOS]) |
> -			SROMC_BC_TACC(config.timing[FDT_SROM_TACC]) |
> -			SROMC_BC_TCOH(config.timing[FDT_SROM_TCOH]) |
> -			SROMC_BC_TAH(config.timing[FDT_SROM_TAH])   |
> -			SROMC_BC_TACP(config.timing[FDT_SROM_TACP]) |
> -			SROMC_BC_PMC(config.timing[FDT_SROM_PMC]);
> -
> -	/* Select and configure the SROMC bank */
> -	exynos_pinmux_config(PERIPH_ID_SROMC, config.bank);
> -	s5p_config_sromc(config.bank, smc_bw_conf, smc_bc_conf);
> -	return smc911x_initialize(0, base_addr);
> -#endif
> -	return 0;
> -}
> -
>  #if defined(CONFIG_DISPLAY_BOARDINFO) || defined(CONFIG_DISPLAY_BOARDINFO_LATE)
>  int checkboard(void)
>  {
> diff --git a/board/samsung/common/sromc.c b/board/samsung/common/sromc.c
> new file mode 100644
> index 00000000000..76e37dfe262
> --- /dev/null
> +++ b/board/samsung/common/sromc.c
> @@ -0,0 +1,76 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright 2021 Google LLC
> + */
> +
> +#define LOG_CATEGORY	UCLASS_ETH
> +
> +#include <common.h>
> +#include <dm.h>
> +#include <log.h>
> +#include <asm/arch/pinmux.h>
> +#include <asm/arch/sromc.h>
> +
> +enum {
> +	FDT_SROM_PMC,
> +	FDT_SROM_TACP,
> +	FDT_SROM_TAH,
> +	FDT_SROM_TCOH,
> +	FDT_SROM_TACC,
> +	FDT_SROM_TCOS,
> +	FDT_SROM_TACS,
> +
> +	FDT_SROM_TIMING_COUNT,
> +};
> +
> +static int exyno5_sromc_probe(struct udevice *dev)
> +{
> +	u32 timing[FDT_SROM_TIMING_COUNT]; /* timing parameters */
> +	u32 smc_bw_conf, smc_bc_conf;
> +	int bank;	/* srom bank number */
> +	int width;	/* bus width in bytes */
> +	int ret;
> +
> +	if (!IS_ENABLED(CONFIG_SMC911X))
> +		return 0;
> +
> +	bank = dev_read_s32_default(dev, "bank", 0);
> +	width = dev_read_s32_default(dev, "width", 2);
> +
> +	/* Ethernet needs data bus width of 16 bits */
> +	if (width != 2) {
> +		log_debug("Unsupported bus width %d\n", width);
> +		return log_msg_ret("width", -EINVAL);
> +	}
> +	ret = dev_read_u32_array(dev, "srom-timing", timing,
> +				 FDT_SROM_TIMING_COUNT);
> +	if (ret)
> +		return log_msg_ret("sromc", -EINVAL);
> +
> +	smc_bw_conf = SROMC_DATA16_WIDTH(bank) | SROMC_BYTE_ENABLE(bank);
> +	smc_bc_conf = SROMC_BC_TACS(timing[FDT_SROM_TACS])   |
> +			SROMC_BC_TCOS(timing[FDT_SROM_TCOS]) |
> +			SROMC_BC_TACC(timing[FDT_SROM_TACC]) |
> +			SROMC_BC_TCOH(timing[FDT_SROM_TCOH]) |
> +			SROMC_BC_TAH(timing[FDT_SROM_TAH])   |
> +			SROMC_BC_TACP(timing[FDT_SROM_TACP]) |
> +			SROMC_BC_PMC(timing[FDT_SROM_PMC]);
> +
> +	/* Select and configure the SROMC bank */
> +	exynos_pinmux_config(PERIPH_ID_SROMC, bank);
> +	s5p_config_sromc(bank, smc_bw_conf, smc_bc_conf);
> +
> +	return 0;
> +}
> +
> +static const struct udevice_id exyno5_sromc_ids[] = {
> +	{ .compatible = "samsung,exynos5-sromc" },
> +	{}
> +};
> +
> +U_BOOT_DRIVER(exyno5_sromc) = {
> +	.name		= "exyno5_sromc",
> +	.id		= UCLASS_SIMPLE_BUS,
> +	.of_match	= exyno5_sromc_ids,
> +	.probe		= exyno5_sromc_probe,
> +};
> diff --git a/board/samsung/smdkv310/smdkv310.c b/board/samsung/smdkv310/smdkv310.c
> index 8811cbb9ad0..bb61ba1f81c 100644
> --- a/board/samsung/smdkv310/smdkv310.c
> +++ b/board/samsung/smdkv310/smdkv310.c
> @@ -73,15 +73,6 @@ int dram_init_banksize(void)
>  	return 0;
>  }
>  
> -int board_eth_init(struct bd_info *bis)
> -{
> -	int rc = 0;
> -#ifdef CONFIG_SMC911X
> -	rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);
> -#endif
> -	return rc;
> -}
> -
>  #ifdef CONFIG_DISPLAY_BOARDINFO
>  int checkboard(void)
>  {
> diff --git a/configs/arndale_defconfig b/configs/arndale_defconfig
> index 1b4dd324b8d..84b248ddde2 100644
> --- a/configs/arndale_defconfig
> +++ b/configs/arndale_defconfig
> @@ -37,7 +37,6 @@ CONFIG_MMC_SDHCI=y
>  CONFIG_MMC_SDHCI_S5P=y
>  CONFIG_MTD=y
>  CONFIG_SMC911X=y
> -CONFIG_SMC911X_BASE=0x5000000
>  CONFIG_SOUND=y
>  CONFIG_I2S=y
>  CONFIG_I2S_SAMSUNG=y
> diff --git a/configs/odroid-xu3_defconfig b/configs/odroid-xu3_defconfig
> index 755a2ca9add..1dbb3550e48 100644
> --- a/configs/odroid-xu3_defconfig
> +++ b/configs/odroid-xu3_defconfig
> @@ -45,7 +45,6 @@ CONFIG_SUPPORT_EMMC_BOOT=y
>  CONFIG_MMC_DW=y
>  CONFIG_MTD=y
>  CONFIG_SMC911X=y
> -CONFIG_SMC911X_BASE=0x5000000
>  CONFIG_DM_PMIC=y
>  CONFIG_PMIC_S2MPS11=y
>  CONFIG_DM_REGULATOR=y
> diff --git a/configs/peach-pi_defconfig b/configs/peach-pi_defconfig
> index 01054b0ee48..3cef18c188c 100644
> --- a/configs/peach-pi_defconfig
> +++ b/configs/peach-pi_defconfig
> @@ -53,7 +53,6 @@ CONFIG_SF_DEFAULT_SPEED=50000000
>  CONFIG_SPI_FLASH_GIGADEVICE=y
>  CONFIG_SPI_FLASH_WINBOND=y
>  CONFIG_SMC911X=y
> -CONFIG_SMC911X_BASE=0x5000000
>  CONFIG_DM_PMIC=y
>  CONFIG_PMIC_TPS65090=y
>  CONFIG_DM_REGULATOR=y
> diff --git a/configs/peach-pit_defconfig b/configs/peach-pit_defconfig
> index c6646dcd6e6..da517eab621 100644
> --- a/configs/peach-pit_defconfig
> +++ b/configs/peach-pit_defconfig
> @@ -52,7 +52,6 @@ CONFIG_SF_DEFAULT_SPEED=50000000
>  CONFIG_SPI_FLASH_GIGADEVICE=y
>  CONFIG_SPI_FLASH_WINBOND=y
>  CONFIG_SMC911X=y
> -CONFIG_SMC911X_BASE=0x5000000
>  CONFIG_DM_PMIC=y
>  CONFIG_PMIC_TPS65090=y
>  CONFIG_DM_REGULATOR=y
> diff --git a/configs/smdk5250_defconfig b/configs/smdk5250_defconfig
> index 8e60f46a5c7..84318aac975 100644
> --- a/configs/smdk5250_defconfig
> +++ b/configs/smdk5250_defconfig
> @@ -48,7 +48,6 @@ CONFIG_SF_DEFAULT_SPEED=50000000
>  CONFIG_SPI_FLASH_GIGADEVICE=y
>  CONFIG_SPI_FLASH_WINBOND=y
>  CONFIG_SMC911X=y
> -CONFIG_SMC911X_BASE=0x5000000
>  CONFIG_DM_PMIC=y
>  CONFIG_DM_PMIC_MAX77686=y
>  CONFIG_DM_REGULATOR=y
> diff --git a/configs/smdk5420_defconfig b/configs/smdk5420_defconfig
> index 429b0638cdb..69f6d581f04 100644
> --- a/configs/smdk5420_defconfig
> +++ b/configs/smdk5420_defconfig
> @@ -43,7 +43,6 @@ CONFIG_SF_DEFAULT_SPEED=50000000
>  CONFIG_SPI_FLASH_GIGADEVICE=y
>  CONFIG_SPI_FLASH_WINBOND=y
>  CONFIG_SMC911X=y
> -CONFIG_SMC911X_BASE=0x5000000
>  CONFIG_DM_PMIC=y
>  CONFIG_DM_REGULATOR=y
>  CONFIG_EXYNOS_SPI=y
> diff --git a/configs/smdkv310_defconfig b/configs/smdkv310_defconfig
> index 9d4cf3533eb..5be91670dcc 100644
> --- a/configs/smdkv310_defconfig
> +++ b/configs/smdkv310_defconfig
> @@ -28,6 +28,5 @@ CONFIG_MMC_SDHCI_SDMA=y
>  CONFIG_MMC_SDHCI_S5P=y
>  CONFIG_MTD=y
>  CONFIG_SMC911X=y
> -CONFIG_SMC911X_BASE=0x5000000
>  CONFIG_USB=y
>  CONFIG_DM_USB=y
> diff --git a/configs/snow_defconfig b/configs/snow_defconfig
> index 76215034acf..8b646cac67a 100644
> --- a/configs/snow_defconfig
> +++ b/configs/snow_defconfig
> @@ -58,7 +58,6 @@ CONFIG_SF_DEFAULT_SPEED=50000000
>  CONFIG_SPI_FLASH_GIGADEVICE=y
>  CONFIG_SPI_FLASH_WINBOND=y
>  CONFIG_SMC911X=y
> -CONFIG_SMC911X_BASE=0x5000000
>  CONFIG_DM_PMIC=y
>  CONFIG_DM_PMIC_MAX77686=y
>  CONFIG_PMIC_S5M8767=y
> diff --git a/configs/spring_defconfig b/configs/spring_defconfig
> index a1fdf1d1f68..8cf4a5dbe17 100644
> --- a/configs/spring_defconfig
> +++ b/configs/spring_defconfig
> @@ -58,7 +58,6 @@ CONFIG_SF_DEFAULT_SPEED=50000000
>  CONFIG_SPI_FLASH_GIGADEVICE=y
>  CONFIG_SPI_FLASH_WINBOND=y
>  CONFIG_SMC911X=y
> -CONFIG_SMC911X_BASE=0x5000000
>  CONFIG_DM_PMIC=y
>  CONFIG_DM_PMIC_MAX77686=y
>  CONFIG_PMIC_S5M8767=y
> diff --git a/include/fdtdec.h b/include/fdtdec.h
> index 62d16609732..38b1352a013 100644
> --- a/include/fdtdec.h
> +++ b/include/fdtdec.h
> @@ -139,8 +139,6 @@ enum fdt_compat_id {
>  					/* Tegra124 XUSB pad controller */
>  	COMPAT_NVIDIA_TEGRA210_XUSB_PADCTL,
>  					/* Tegra210 XUSB pad controller */
> -	COMPAT_SMSC_LAN9215,		/* SMSC 10/100 Ethernet LAN9215 */
> -	COMPAT_SAMSUNG_EXYNOS5_SROMC,	/* Exynos5 SROMC */
>  	COMPAT_SAMSUNG_EXYNOS_USB_PHY,	/* Exynos phy controller for usb2.0 */
>  	COMPAT_SAMSUNG_EXYNOS5_USB3_PHY,/* Exynos phy controller for usb3.0 */
>  	COMPAT_SAMSUNG_EXYNOS_TMU,	/* Exynos TMU */
> diff --git a/lib/fdtdec.c b/lib/fdtdec.c
> index 864589193b4..6bb418236d0 100644
> --- a/lib/fdtdec.c
> +++ b/lib/fdtdec.c
> @@ -47,8 +47,6 @@ static const char * const compat_names[COMPAT_COUNT] = {
>  	COMPAT(NVIDIA_TEGRA20_NAND, "nvidia,tegra20-nand"),
>  	COMPAT(NVIDIA_TEGRA124_XUSB_PADCTL, "nvidia,tegra124-xusb-padctl"),
>  	COMPAT(NVIDIA_TEGRA210_XUSB_PADCTL, "nvidia,tegra210-xusb-padctl"),
> -	COMPAT(SMSC_LAN9215, "smsc,lan9215"),
> -	COMPAT(SAMSUNG_EXYNOS5_SROMC, "samsung,exynos-sromc"),
>  	COMPAT(SAMSUNG_EXYNOS_USB_PHY, "samsung,exynos-usb-phy"),
>  	COMPAT(SAMSUNG_EXYNOS5_USB3_PHY, "samsung,exynos5250-usb3-phy"),
>  	COMPAT(SAMSUNG_EXYNOS_TMU, "samsung,exynos-tmu"),
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 3/3] snow: Enable unit tests
  2021-03-24 21:44   ` [PATCH 3/3] snow: Enable unit tests Simon Glass
@ 2021-03-25 22:09     ` Jaehoon Chung
  2021-04-23  8:32       ` Minkyu Kang
  0 siblings, 1 reply; 8+ messages in thread
From: Jaehoon Chung @ 2021-03-25 22:09 UTC (permalink / raw)
  To: u-boot

On 3/25/21 6:44 AM, Simon Glass wrote:
> It is useful to have a board with unit tests enabled, to check that this
> does not break.
> 
> Let's choose snow, since it is not under active development and it is
> glorious.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>

Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>

Best Regards,
Jaehoon Chung

> ---
> 
>  configs/snow_defconfig | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/configs/snow_defconfig b/configs/snow_defconfig
> index 8b646cac67a..0277062428e 100644
> --- a/configs/snow_defconfig
> +++ b/configs/snow_defconfig
> @@ -92,3 +92,5 @@ CONFIG_VIDEO_BRIDGE_NXP_PTN3460=y
>  CONFIG_LCD=y
>  CONFIG_TPM=y
>  CONFIG_ERRNO_STR=y
> +CONFIG_UNIT_TEST=y
> +# CONFIG_UT_LIB_ASN1 is not set
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/3] test: Allow tests to run on any board
  2021-03-24 21:44   ` [PATCH 2/3] test: Allow tests to run on any board Simon Glass
@ 2021-03-26  1:46     ` Sean Anderson
  2021-04-06  4:34     ` Simon Glass
  1 sibling, 0 replies; 8+ messages in thread
From: Sean Anderson @ 2021-03-26  1:46 UTC (permalink / raw)
  To: u-boot

On 3/24/21 5:44 PM, Simon Glass wrote:
> Due to a recent change, tests are limited to running on sandbox only.
> Correct this so that any architecture can run them.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Reported-by: Sean Anderson <seanga2@gmail.com>
> Fixes: c79705ea938 ("test: Move dm_test_init() into test-main.c")
> ---
> 
>   include/test/test.h | 9 +++++++++
>   test/test-main.c    | 5 ++---
>   2 files changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/include/test/test.h b/include/test/test.h
> index 0b124edd601..bf7d785d8ed 100644
> --- a/include/test/test.h
> +++ b/include/test/test.h
> @@ -124,4 +124,13 @@ enum {
>    */
>   struct udevice *testbus_get_clear_removed(void);
>   
> +static inline void arch_reset_for_test(void)
> +{
> +#ifdef CONFIG_SANDBOX
> +#include <asm/state.h>
> +
> +	state_reset_for_test(state_get_current());
> +#endif
> +}
> +
>   #endif /* __TEST_TEST_H */
> diff --git a/test/test-main.c b/test/test-main.c
> index e1b49e091ab..201e39d8b2a 100644
> --- a/test/test-main.c
> +++ b/test/test-main.c
> @@ -7,7 +7,6 @@
>   #include <common.h>
>   #include <console.h>
>   #include <dm.h>
> -#include <asm/state.h>
>   #include <dm/root.h>
>   #include <dm/test.h>
>   #include <dm/uclass-internal.h>
> @@ -46,9 +45,9 @@ static int dm_test_pre_run(struct unit_test_state *uts)
>   	uts->force_fail_alloc = false;
>   	uts->skip_post_probe = false;
>   	gd->dm_root = NULL;
> -	if (!CONFIG_IS_ENABLED(OF_PLATDATA))
> +	if (IS_ENABLED(CONFIG_UT_DM) && !CONFIG_IS_ENABLED(OF_PLATDATA))
>   		memset(dm_testdrv_op_count, '\0', sizeof(dm_testdrv_op_count));
> -	state_reset_for_test(state_get_current());
> +	arch_reset_for_test();
>   
>   	/* Determine whether to make the live tree available */
>   	gd_set_of_root(of_live ? uts->of_root : NULL);
> 

Tested-by: Sean Anderson <seanga2@gmail.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/3] test: Allow tests to run on any board
  2021-03-24 21:44   ` [PATCH 2/3] test: Allow tests to run on any board Simon Glass
  2021-03-26  1:46     ` Sean Anderson
@ 2021-04-06  4:34     ` Simon Glass
  1 sibling, 0 replies; 8+ messages in thread
From: Simon Glass @ 2021-04-06  4:34 UTC (permalink / raw)
  To: u-boot

On 3/24/21 5:44 PM, Simon Glass wrote:
> Due to a recent change, tests are limited to running on sandbox only.
> Correct this so that any architecture can run them.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Reported-by: Sean Anderson <seanga2@gmail.com>
> Fixes: c79705ea938 ("test: Move dm_test_init() into test-main.c")
> ---
>
>   include/test/test.h | 9 +++++++++
>   test/test-main.c    | 5 ++---
>   2 files changed, 11 insertions(+), 3 deletions(-)
>
Applied to u-boot-dm, thanks!

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 3/3] snow: Enable unit tests
  2021-03-25 22:09     ` Jaehoon Chung
@ 2021-04-23  8:32       ` Minkyu Kang
  0 siblings, 0 replies; 8+ messages in thread
From: Minkyu Kang @ 2021-04-23  8:32 UTC (permalink / raw)
  To: u-boot

Dear Simon Glass,

On Fri, 26 Mar 2021 at 07:08, Jaehoon Chung <jh80.chung@samsung.com> wrote:

> On 3/25/21 6:44 AM, Simon Glass wrote:
> > It is useful to have a board with unit tests enabled, to check that this
> > does not break.
> >
> > Let's choose snow, since it is not under active development and it is
> > glorious.
> >
> > Signed-off-by: Simon Glass <sjg@chromium.org>
>
> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
>
> Best Regards,
> Jaehoon Chung
>
> > ---
> >
> >  configs/snow_defconfig | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/configs/snow_defconfig b/configs/snow_defconfig
> > index 8b646cac67a..0277062428e 100644
> > --- a/configs/snow_defconfig
> > +++ b/configs/snow_defconfig
> > @@ -92,3 +92,5 @@ CONFIG_VIDEO_BRIDGE_NXP_PTN3460=y
> >  CONFIG_LCD=y
> >  CONFIG_TPM=y
> >  CONFIG_ERRNO_STR=y
> > +CONFIG_UNIT_TEST=y
> > +# CONFIG_UT_LIB_ASN1 is not set
> >
>
>
On my system, compiler warnings have occurred.
Is it fine for you?

test/lib/strlcat.c:51:39: warning: format ?%lx? expects argument of type
?long unsigned int?, but argument 7 has type ?size_t? {aka ?unsigned int?}
[-Wformat=]
   51 |                          "Expected %#lx (%ld), got %#lx (%ld)",
      |                                    ~~~^
      |                                       |
      |                                       long unsigned int
      |                                    %#x
   52 |                          expected, expected, actual, actual);
      |                          ~~~~~~~~
      |                          |
      |                          size_t {aka unsigned int}

-- 
Thanks,
Minkyu Kang.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-04-23  8:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20210324214450epcas1p135757e7a696b0f939cce55d691fcb6de@epcas1p1.samsung.com>
2021-03-24 21:44 ` [PATCH 1/3] samsung: exynos: Convert SROMC interface to a driver Simon Glass
2021-03-24 21:44   ` [PATCH 2/3] test: Allow tests to run on any board Simon Glass
2021-03-26  1:46     ` Sean Anderson
2021-04-06  4:34     ` Simon Glass
2021-03-24 21:44   ` [PATCH 3/3] snow: Enable unit tests Simon Glass
2021-03-25 22:09     ` Jaehoon Chung
2021-04-23  8:32       ` Minkyu Kang
2021-03-25 22:08   ` [PATCH 1/3] samsung: exynos: Convert SROMC interface to a driver Jaehoon Chung

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.