From b20e79f0bba277a33f7e0af3776c959fa1c31117 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Wed, 23 Mar 2022 17:20:07 -0400 Subject: [PATCH] Convert CONFIG_CLOCK_SYNTHESIZER to Kconfig This converts the following to Kconfig: CONFIG_CLOCK_SYNTHESIZER Signed-off-by: Tom Rini --- 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 b8e115dc92..23865d4c07 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 59f0d8ea71..c9b9502aef 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 c255d172f2..3e1296916c 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 497127d406..fa97ec12d8 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 50653ab913..abcc3e6e79 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 01a4c9ebc1..b6fd86fa16 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 0f59050030..15483176ca 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 e786672b83..c4c8f222bd 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.39.5