[PATCH 20/22] Convert CONFIG_CLOCK_SYNTHESIZER to Kconfig

Tom Rini trini at konsulko.com
Wed Mar 23 22:20:07 CET 2022


This converts the following to Kconfig:
   CONFIG_CLOCK_SYNTHESIZER

Signed-off-by: Tom Rini <trini at konsulko.com>
---
 arch/arm/mach-omap2/am33xx/Kconfig           | 13 +++++++++++++
 arch/arm/mach-omap2/am33xx/clk_synthesizer.c | 14 +++++++-------
 configs/am335x_boneblack_vboot_defconfig     |  1 +
 configs/am335x_evm_defconfig                 |  1 +
 configs/am335x_evm_spiboot_defconfig         |  1 +
 configs/am335x_hs_evm_defconfig              |  1 +
 configs/am335x_hs_evm_uart_defconfig         |  1 +
 include/configs/am335x_evm.h                 |  5 -----
 8 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/arch/arm/mach-omap2/am33xx/Kconfig b/arch/arm/mach-omap2/am33xx/Kconfig
index b8e115dc92bf..23865d4c0704 100644
--- a/arch/arm/mach-omap2/am33xx/Kconfig
+++ b/arch/arm/mach-omap2/am33xx/Kconfig
@@ -207,6 +207,19 @@ config TARGET_PDU001
 
 endchoice
 
+config CLOCK_SYNTHESIZER
+	bool "CDCE913 and CDCEL913 clock synthesizer support"
+	help
+	  The CDCE913 and CDCEL913 devices are modular PLL-based, low cost,
+	  high performance , programmable clock synthesizers. They generate
+	  up to 3 output clocks from a single input frequency. Each output can
+	  be programmed for any clock-frequency.
+
+config CLK_SYNTHESIZER_I2C_ADDR
+	hex "Clock synthesizer i2c bus address"
+	depends on CLOCK_SYNTHESIZER
+	default 0x65
+
 endif
 
 if AM43XX
diff --git a/arch/arm/mach-omap2/am33xx/clk_synthesizer.c b/arch/arm/mach-omap2/am33xx/clk_synthesizer.c
index 59f0d8ea71b8..c9b9502aef62 100644
--- a/arch/arm/mach-omap2/am33xx/clk_synthesizer.c
+++ b/arch/arm/mach-omap2/am33xx/clk_synthesizer.c
@@ -31,12 +31,12 @@ static int clk_synthesizer_reg_read(struct udevice *dev, int addr, u8 *buf)
 
 #if !CONFIG_IS_ENABLED(DM_I2C)
 	/* Send the command byte */
-	rc = i2c_write(CLK_SYNTHESIZER_I2C_ADDR, addr, 1, buf, 1);
+	rc = i2c_write(CONFIG_CLK_SYNTHESIZER_I2C_ADDR, addr, 1, buf, 1);
 	if (rc)
 		printf("Failed to send command to clock synthesizer\n");
 
 	/* Read the Data */
-	return i2c_read(CLK_SYNTHESIZER_I2C_ADDR, addr, 1, buf, 1);
+	return i2c_read(CONFIG_CLK_SYNTHESIZER_I2C_ADDR, addr, 1, buf, 1);
 #else
 	/* Send the command byte */
 	rc = dm_i2c_reg_write(dev, addr, *buf);
@@ -73,7 +73,7 @@ static int clk_synthesizer_reg_write(struct udevice *dev, int addr, u8 val)
 	cmd[1] = val;
 
 #if !CONFIG_IS_ENABLED(DM_I2C)
-	rc = i2c_write(CLK_SYNTHESIZER_I2C_ADDR, addr, 1, cmd, 2);
+	rc = i2c_write(CONFIG_CLK_SYNTHESIZER_I2C_ADDR, addr, 1, cmd, 2);
 #else
 	rc = dm_i2c_write(dev, addr, cmd, 2);
 #endif
@@ -97,17 +97,17 @@ int setup_clock_synthesizer(struct clk_synth *data)
 	u8 val = 0;
 	struct udevice *dev = NULL;
 #if !CONFIG_IS_ENABLED(DM_I2C)
-	rc =  i2c_probe(CLK_SYNTHESIZER_I2C_ADDR);
+	rc =  i2c_probe(CONFIG_CLK_SYNTHESIZER_I2C_ADDR);
 	if (rc) {
 		printf("i2c probe failed at address 0x%x\n",
-		       CLK_SYNTHESIZER_I2C_ADDR);
+		       CONFIG_CLK_SYNTHESIZER_I2C_ADDR);
 		return rc;
 	}
 #else
-	rc = i2c_get_chip_for_busnum(0, CLK_SYNTHESIZER_I2C_ADDR, 1, &dev);
+	rc = i2c_get_chip_for_busnum(0, CONFIG_CLK_SYNTHESIZER_I2C_ADDR, 1, &dev);
 	if (rc) {
 		printf("failed to get device for synthesizer at address 0x%x\n",
-		       CLK_SYNTHESIZER_I2C_ADDR);
+		       CONFIG_CLK_SYNTHESIZER_I2C_ADDR);
 		return rc;
 	}
 #endif
diff --git a/configs/am335x_boneblack_vboot_defconfig b/configs/am335x_boneblack_vboot_defconfig
index c255d172f2aa..3e1296916cba 100644
--- a/configs/am335x_boneblack_vboot_defconfig
+++ b/configs/am335x_boneblack_vboot_defconfig
@@ -6,6 +6,7 @@ CONFIG_ARCH_OMAP2PLUS=y
 CONFIG_TI_COMMON_CMD_OPTIONS=y
 CONFIG_DEFAULT_DEVICE_TREE="am335x-boneblack"
 CONFIG_AM33XX=y
+CONFIG_CLOCK_SYNTHESIZER=y
 CONFIG_SPL=y
 CONFIG_ENV_OFFSET_REDUND=0x280000
 CONFIG_DISTRO_DEFAULTS=y
diff --git a/configs/am335x_evm_defconfig b/configs/am335x_evm_defconfig
index 497127d4065b..fa97ec12d824 100644
--- a/configs/am335x_evm_defconfig
+++ b/configs/am335x_evm_defconfig
@@ -4,6 +4,7 @@ CONFIG_ARCH_OMAP2PLUS=y
 CONFIG_TI_COMMON_CMD_OPTIONS=y
 CONFIG_DEFAULT_DEVICE_TREE="am335x-evm"
 CONFIG_AM33XX=y
+CONFIG_CLOCK_SYNTHESIZER=y
 CONFIG_AM335X_USB0=y
 CONFIG_AM335X_USB0_PERIPHERAL=y
 CONFIG_AM335X_USB1=y
diff --git a/configs/am335x_evm_spiboot_defconfig b/configs/am335x_evm_spiboot_defconfig
index 50653ab91331..abcc3e6e79f9 100644
--- a/configs/am335x_evm_spiboot_defconfig
+++ b/configs/am335x_evm_spiboot_defconfig
@@ -6,6 +6,7 @@ CONFIG_ENV_OFFSET=0x100000
 CONFIG_SPL_DM_SPI=y
 CONFIG_DEFAULT_DEVICE_TREE="am335x-evm"
 CONFIG_AM33XX=y
+CONFIG_CLOCK_SYNTHESIZER=y
 # CONFIG_SPL_MMC is not set
 CONFIG_SPL=y
 CONFIG_SPL_SPI_FLASH_SUPPORT=y
diff --git a/configs/am335x_hs_evm_defconfig b/configs/am335x_hs_evm_defconfig
index 01a4c9ebc10d..b6fd86fa1673 100644
--- a/configs/am335x_hs_evm_defconfig
+++ b/configs/am335x_hs_evm_defconfig
@@ -6,6 +6,7 @@ CONFIG_ISW_ENTRY_ADDR=0x40300350
 CONFIG_TI_COMMON_CMD_OPTIONS=y
 CONFIG_DEFAULT_DEVICE_TREE="am335x-evm"
 CONFIG_AM33XX=y
+CONFIG_CLOCK_SYNTHESIZER=y
 CONFIG_SPL=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_TIMESTAMP=y
diff --git a/configs/am335x_hs_evm_uart_defconfig b/configs/am335x_hs_evm_uart_defconfig
index 0f590500304a..15483176caa6 100644
--- a/configs/am335x_hs_evm_uart_defconfig
+++ b/configs/am335x_hs_evm_uart_defconfig
@@ -6,6 +6,7 @@ CONFIG_ISW_ENTRY_ADDR=0x40301950
 CONFIG_TI_COMMON_CMD_OPTIONS=y
 CONFIG_DEFAULT_DEVICE_TREE="am335x-evm"
 CONFIG_AM33XX=y
+CONFIG_CLOCK_SYNTHESIZER=y
 # CONFIG_SPL_MMC is not set
 CONFIG_SPL=y
 # CONFIG_SPL_FS_FAT is not set
diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index e786672b83da..c4c8f222bd85 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -243,9 +243,4 @@
 #define CONFIG_SYS_MONITOR_BASE		CONFIG_SYS_FLASH_BASE
 #endif  /* NOR support */
 
-#ifdef CONFIG_DRIVER_TI_CPSW
-#define CONFIG_CLOCK_SYNTHESIZER
-#define CLK_SYNTHESIZER_I2C_ADDR 0x65
-#endif
-
 #endif	/* ! __CONFIG_AM335X_EVM_H */
-- 
2.25.1



More information about the U-Boot mailing list