Skip to contentSkip to conversation

samsung: exynos: Convert SROMC interface to a driver

PATCH In review Simon Glass 2 participants 6 messages Jul 19, 2021 – Jul 30, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 samsung: exynos: Convert SROMC interface to a driver

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.

---

(no changes since v1)

 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
arch/arm/Kconfig +1 -0
index 7f493a8e8fd..28f187cc8dd 100644
@@ -661,6 +661,7 @@ config ARCH_EXYNOS
 	select DM
 	select DM_GPIO
 	select DM_I2C
+	select DM_ETH
 	select DM_KEYBOARD
 	select DM_SERIAL
 	select DM_SPI
arch/arm/dts/exynos5250-smdk5250.dts +1 -0
index e542a790761..afe0cca48a9 100644
@@ -41,6 +41,7 @@
 	};
 
 	sromc@12250000 {
+		compatible = "samsung,exynos5-sromc";
 		bank = <1>;
 		srom-timing = <1 9 12 1 6 1 1>;
 		width = <2>;
arch/arm/mach-exynos/include/mach/sromc.h +0 -18
index 15c9ccc723d..ac229e0d169 100644
@@ -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_ */
board/samsung/common/Makefile +1 -1
index 3593c77cbc2..d31b81abf1e 100644
@@ -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
board/samsung/common/board.c +0 -78

90 lines not on this page · raw message

board/samsung/common/sromc.c new file +76 -0

76 lines not on this page · raw message

board/samsung/smdkv310/smdkv310.c +0 -9
index 8811cbb9ad0..bb61ba1f81c 100644
@@ -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)
 {
configs/arndale_defconfig +0 -1
index bc7af829fb8..4f4ae5f7ba4 100644
@@ -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
configs/odroid-xu3_defconfig +0 -1
index e0b87dfc259..2351e14fc6a 100644
@@ -46,7 +46,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
configs/peach-pi_defconfig +0 -1
index d3fbc4eca96..aad1ff6804f 100644
@@ -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
configs/peach-pit_defconfig +0 -1
index d6d97a84c36..6382419e240 100644
@@ -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
configs/smdk5250_defconfig +0 -1
index a2a20cf6c4c..1e8f24e03f8 100644
@@ -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
configs/smdk5420_defconfig +0 -1
index 04b560a8a80..a322871d5cd 100644
@@ -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
configs/smdkv310_defconfig +0 -1
index 568f95a813c..6b738b47d8f 100644
@@ -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
configs/snow_defconfig +0 -1
index cb7dabfaba6..6090fea2b8f 100644
@@ -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
configs/spring_defconfig +0 -1
index bbe5ab29a8c..d8709b59a74 100644
@@ -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
include/fdtdec.h +0 -2
index e0a49b1e57f..8ac20c9a64f 100644
@@ -140,8 +140,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 */
lib/fdtdec.c +0 -2
index 4b097fb588e..3f178b975ae 100644
@@ -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"),
Signature · 1 line
2.32.0.402.g57bb445576-goog
#1 lore raw

PATCH v2 2/3 test: Fix size_t formats in strlcat test

Some of the printf() formats do not match their types. Fix this.

---

Changes in v2:
- Fix some size_t warnings with recent compilers

 test/lib/strlcat.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
test/lib/strlcat.c +2 -2
index ee61684c405..a0ec037388b 100644
@@ -48,7 +48,7 @@ static int do_test_strlcat(struct unit_test_state *uts, int line, size_t align1,
 	if (expected != actual) {
 		ut_failf(uts, __FILE__, line, __func__,
 			 "strlcat(s2, s1, 2) == len2 < n ? min(len1 + len2, n) : n",
-			 "Expected %#lx (%ld), got %#lx (%ld)",
+			 "Expected %#zx (%zd), got %#zx (%zd)",
 			 expected, expected, actual, actual);
 		return CMD_RET_FAILURE;
 	}
@@ -66,7 +66,7 @@ static int do_test_strlcat(struct unit_test_state *uts, int line, size_t align1,
 	if (len2 < n && s2[i] != '\0') {
 		ut_failf(uts, __FILE__, line, __func__,
 			 "n < len1 && s2[len2 + n] == '\\0'",
-			 "Expected s2[%ld] = '\\0', got %d ('%c')",
+			 "Expected s2[%zd] = '\\0', got %d ('%c')",
 			 i, s2[i], s2[i]);
 		return CMD_RET_FAILURE;
 	}
Signature · 1 line
2.32.0.402.g57bb445576-goog
#2 lore raw

Re: [PATCH v2 2/3] test: Fix size_t formats in strlcat test

Dear Simon Glass,

Quoted 4 lines · Simon Glass

Some of the printf() formats do not match their types. Fix this.

I modified email address to [email protected] : )

Quoted 33 lines

---

Changes in v2:
- Fix some size_t warnings with recent compilers

 test/lib/strlcat.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
test/lib/strlcat.c +1 -1
index ee61684c405..a0ec037388b 100644
@@ -48,7 +48,7 @@ static int do_test_strlcat(struct unit_test_state *uts,
 int line, size_t align1,
        if (expected != actual) {
                ut_failf(uts, __FILE__, line, __func__,
                         "strlcat(s2, s1, 2) == len2 < n ? min(len1 +
 len2, n) : n",
-                        "Expected %#lx (%ld), got %#lx (%ld)",
+                        "Expected %#zx (%zd), got %#zx (%zd)",
                         expected, expected, actual, actual);
                return CMD_RET_FAILURE;
        }
test/lib/strlcat.c +1 -1
@@ -66,7 +66,7 @@ static int do_test_strlcat(struct unit_test_state *uts,
 int line, size_t align1,
        if (len2 < n && s2[i] != '\0') {
                ut_failf(uts, __FILE__, line, __func__,
                         "n < len1 && s2[len2 + n] == '\\0'",
-                        "Expected s2[%ld] = '\\0', got %d ('%c')",
+                        "Expected s2[%zd] = '\\0', got %d ('%c')",
                         i, s2[i], s2[i]);
                return CMD_RET_FAILURE;
        }
Quoted 4 lines

--
2.32.0.402.g57bb445576-goog

applied to u-boot-samsung.

Signature · 2 lines
Thanks,
Minkyu Kang.
#3 lore raw

PATCH v2 3/3 snow: Enable unit tests

In reply to Simon Glass

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.

---

(no changes since v1)

 configs/snow_defconfig | 2 ++
 1 file changed, 2 insertions(+)
configs/snow_defconfig +2 -0
index 6090fea2b8f..63a5713a602 100644
@@ -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
Signature · 1 line
2.32.0.402.g57bb445576-goog
#4 lore raw

Re: [PATCH v2 3/3] snow: Enable unit tests

Dear Simon Glass,

Quoted 26 lines · Simon Glass

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.

---

(no changes since v1)

 configs/snow_defconfig | 2 ++
 1 file changed, 2 insertions(+)
configs/snow_defconfig +2 -1
index 6090fea2b8f..63a5713a602 100644
@@ -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
--
Quoted 3 lines

2.32.0.402.g57bb445576-goog

applied to u-boot-samsung.

Signature · 2 lines
Thanks,
Minkyu Kang.
#5 lore raw
In reply to Simon Glass

Dear Simon Glass,

Quoted 23 lines · Simon Glass

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.

---

(no changes since v1)

 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 -
Quoted 10 lines
 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

applied to u-boot-samsung.

Signature · 2 lines
Thanks,
Minkyu Kang.