Skip to contentSkip to conversation

clk: add support for cdce9xx clock synthesizer

PATCH New Tero Kristo 2 participants 9 messages Sep 27, 2019 – Oct 12, 2019

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

cover clk: add support for cdce9xx clock synthesizer

Hi,

This series adds basic support for TI cdce9xx clock synthesizers. The code is loosely based on linux side driver for the same, the DT binding is pretty much directly copied over from there.

This is needed initially just for setting up the crystal capacitance value for the TI IDK board family, which is using the synthesizer for providing networking clocks. If the capacitance value is incorrect, lost packets may occur.

-Tero

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

#1 lore raw

PATCH 1/4 clk: cdce9xx: add support for cdce9xx clock synthesizer

Add support for CDCE913/925/937/949 family of devices. These are modular PLL-based low cost, high performance, programmable clock synthesizers, multipliers and dividers. They generate up to 9 output clocks from a single input frequency. The initial version of the driver does not support programming of the PLLs, and thus they run in the bypass mode only. The code is loosely based on the linux kernel cdce9xx driver.

---
 doc/device-tree-bindings/clock/ti,cdce9xx.txt |  49 ++++
 drivers/clk/Kconfig                           |   7 +
 drivers/clk/Makefile                          |   1 +
 drivers/clk/clk-cdce9xx.c                     | 254 ++++++++++++++++++
 4 files changed, 311 insertions(+)
 create mode 100644 doc/device-tree-bindings/clock/ti,cdce9xx.txt
 create mode 100644 drivers/clk/clk-cdce9xx.c
doc/device-tree-bindings/clock/ti,cdce9xx.txt new file +49 -0
new file mode 100644
index 0000000000..0d01f2d5cc
@@ -0,0 +1,49 @@
+Binding for TI CDCE913/925/937/949 programmable I2C clock synthesizers.
+
+Reference
+This binding uses the common clock binding[1].
+
+[1] Documentation/devicetree/bindings/clock/clock-bindings.txt
+[2] http://www.ti.com/product/cdce913
+[3] http://www.ti.com/product/cdce925
+[4] http://www.ti.com/product/cdce937
+[5] http://www.ti.com/product/cdce949
+
+The driver provides clock sources for each output Y1 through Y5.
+
+Required properties:
+ - compatible: Shall be one of the following:
+	- "ti,cdce913": 1-PLL, 3 Outputs
+	- "ti,cdce925": 2-PLL, 5 Outputs
+	- "ti,cdce937": 3-PLL, 7 Outputs
+	- "ti,cdce949": 4-PLL, 9 Outputs
+ - reg: I2C device address.
+ - clocks: Points to a fixed parent clock that provides the input frequency.
+ - #clock-cells: From common clock bindings: Shall be 1.
+
+Optional properties:
+ - xtal-load-pf: Crystal load-capacitor value to fine-tune performance on a
+                 board, or to compensate for external influences.
+
+For all PLL1, PLL2, ... an optional child node can be used to specify spread
+spectrum clocking parameters for a board.
+  - spread-spectrum: SSC mode as defined in the data sheet.
+  - spread-spectrum-center: Use "centered" mode instead of "max" mode. When
+    present, the clock runs at the requested frequency on average. Otherwise
+    the requested frequency is the maximum value of the SCC range.
+
+
+Example:
+
+	clockgen: cdce925pw at 64 {
+		compatible = "cdce925";
+		reg = <0x64>;
+		clocks = <&xtal_27Mhz>;
+		#clock-cells = <1>;
+		xtal-load-pf = <5>;
+		/* PLL options to get SSC 1% centered */
+		PLL2 {
+			spread-spectrum = <4>;
+			spread-spectrum-center;
+		};
+	};
drivers/clk/Kconfig +7 -0
index 95fe0aea2c..210494ea4b 100644
@@ -125,6 +125,13 @@ config CLK_STM32MP1
 	  Enable the STM32 clock (RCC) driver. Enable support for
 	  manipulating STM32MP1's on-SoC clocks.
 
+config CLK_CDCE9XX
+	bool "Enable CDCD9XX clock driver"
+	depends on CLK
+	help
+	   Enable the clock synthesizer driver for CDCE913/925/937/949
+	   series of chips.
+
 source "drivers/clk/analogbits/Kconfig"
 source "drivers/clk/at91/Kconfig"
 source "drivers/clk/exynos/Kconfig"
drivers/clk/Makefile +1 -0
index 68aabe1ca9..40b1f3b5b2 100644
@@ -43,3 +43,4 @@ obj-$(CONFIG_SANDBOX) += clk_sandbox_test.o
 obj-$(CONFIG_SANDBOX_CLK_CCF) += clk_sandbox_ccf.o
 obj-$(CONFIG_STM32H7) += clk_stm32h7.o
 obj-$(CONFIG_CLK_TI_SCI) += clk-ti-sci.o
+obj-$(CONFIG_CLK_CDCE9XX) += clk-cdce9xx.o
drivers/clk/clk-cdce9xx.c new file +254 -0

254 lines not on this page · raw message

Signature · 4 lines
2.17.1

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
#2 lore raw

PATCH 1/4 clk: cdce9xx: add support for cdce9xx clock synthesizer

Quoted 8 lines · Tero Kristo

Add support for CDCE913/925/937/949 family of devices. These are modular PLL-based low cost, high performance, programmable clock synthesizers, multipliers and dividers. They generate up to 9 output clocks from a single input frequency. The initial version of the driver does not support programming of the PLLs, and thus they run in the bypass mode only. The code is loosely based on the linux kernel cdce9xx driver.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191012/e8525ddc/attachment.sig>
#3 lore raw

PATCH 2/4 board: ti: am57xx-idk: Configure the CDCE913 clock synthesizer

In reply to Tero Kristo

AM57xx-IDK boards contain the CDCE913 clock synthesizer, and their reset crystal capacitance load value of 10pF is wrong leading into lost packets in certain networking tests. Add DT data for this device, and probe it from the board file to program the crystal capacitance load value to 0pF to avoid any problems.

---
 arch/arm/dts/am571x-idk-u-boot.dtsi        |  5 +++++
 arch/arm/dts/am572x-idk-u-boot.dtsi        |  5 +++++
 arch/arm/dts/am574x-idk-u-boot.dtsi        |  5 +++++
 arch/arm/dts/am57xx-idk-common-u-boot.dtsi | 23 ++++++++++++++++++++++
 board/ti/am57xx/board.c                    |  5 +++++
 configs/am57xx_evm_defconfig               |  2 ++
 6 files changed, 45 insertions(+)
 create mode 100644 arch/arm/dts/am571x-idk-u-boot.dtsi
 create mode 100644 arch/arm/dts/am572x-idk-u-boot.dtsi
 create mode 100644 arch/arm/dts/am574x-idk-u-boot.dtsi
 create mode 100644 arch/arm/dts/am57xx-idk-common-u-boot.dtsi
arch/arm/dts/am571x-idk-u-boot.dtsi new file +5 -0
new file mode 100644
index 0000000000..65199200ed
@@ -0,0 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/
+ */
+#include "am57xx-idk-common-u-boot.dtsi"
arch/arm/dts/am572x-idk-u-boot.dtsi new file +5 -0
new file mode 100644
index 0000000000..65199200ed
@@ -0,0 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/
+ */
+#include "am57xx-idk-common-u-boot.dtsi"
arch/arm/dts/am574x-idk-u-boot.dtsi new file +5 -0
new file mode 100644
index 0000000000..65199200ed
@@ -0,0 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/
+ */
+#include "am57xx-idk-common-u-boot.dtsi"
arch/arm/dts/am57xx-idk-common-u-boot.dtsi new file +23 -0
new file mode 100644
index 0000000000..b07aea0048
@@ -0,0 +1,23 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/
+ */
+#include "omap5-u-boot.dtsi"
+
+/ {
+	xtal25mhz: xtal25mhz {
+		compatible = "fixed-clock";
+		#clock-cells = <0>;
+		clock-frequency = <25000000>;
+	};
+};
+
+&i2c1 {
+	cdce913: cdce913 at 65 {
+		compatible = "ti,cdce913";
+		reg = <0x65>;
+		clocks = <&xtal25mhz>;
+		#clock-cells = <1>;
+		xtal-load-pf = <0>;
+	};
+};
board/ti/am57xx/board.c +5 -0
index f78e6c2e1f..237a834c53 100644
@@ -30,6 +30,7 @@
 #include <dwc3-omap-uboot.h>
 #include <ti-usb-phy-uboot.h>
 #include <mmc.h>
+#include <dm/uclass.h>
 
 #include "../common/board_detect.h"
 #include "mux_data.h"
@@ -689,6 +690,7 @@ int board_late_init(void)
 {
 	setup_board_eeprom_env();
 	u8 val;
+	struct udevice *dev;
 
 	/*
 	 * DEV_CTRL.DEV_ON = 1 please - else palmas switches off in 8 seconds
@@ -720,6 +722,9 @@ int board_late_init(void)
 
 	am57x_idk_lcd_detect();
 
+	/* Just probe the potentially supported cdce913 device */
+	uclass_get_device(UCLASS_CLK, 0, &dev);
+
 #if !defined(CONFIG_SPL_BUILD)
 	board_ti_set_ethaddr(2);
 #endif
configs/am57xx_evm_defconfig +2 -0
index 3b613e135c..e2f558cde7 100644
@@ -98,3 +98,5 @@ CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments"
 CONFIG_USB_GADGET_VENDOR_NUM=0x0451
 CONFIG_USB_GADGET_PRODUCT_NUM=0xd022
+CONFIG_CLK=y
+CONFIG_CLK_CDCE9XX=y
Signature · 4 lines
2.17.1

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
#4 lore raw

PATCH 2/4 board: ti: am57xx-idk: Configure the CDCE913 clock synthesizer

Quoted 7 lines · Tero Kristo

AM57xx-IDK boards contain the CDCE913 clock synthesizer, and their reset crystal capacitance load value of 10pF is wrong leading into lost packets in certain networking tests. Add DT data for this device, and probe it from the board file to program the crystal capacitance load value to 0pF to avoid any problems.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191012/5475374d/attachment.sig>
#5 lore raw

PATCH 3/4 board: ti: am43xx-idk: Configure the CDCE913 clock synthesizer

In reply to Tero Kristo

AM43xx-IDK boards contain the CDCE913 clock synthesizer, and their reset crystal capacitance load value of 10pF is wrong leading into lost packets in certain networking tests. Add DT data for this device, and probe it from the board file to program the crystal capacitance load value to 0pF to avoid any problems.

---
 arch/arm/dts/am437x-idk-evm-u-boot.dtsi | 14 ++++++++++++++
 board/ti/am43xx/board.c                 |  5 +++++
 configs/am43xx_evm_defconfig            |  2 ++
 3 files changed, 21 insertions(+)
arch/arm/dts/am437x-idk-evm-u-boot.dtsi +14 -0
index 3aa9195e44..50fe09cfc3 100644
@@ -9,6 +9,12 @@
 	ocp {
 		u-boot,dm-spl;
 	};
+
+	xtal25mhz: xtal25mhz {
+		compatible = "fixed-clock";
+		#clock-cells = <0>;
+		clock-frequency = <25000000>;
+	};
 };
 
 &uart0 {
@@ -17,6 +23,14 @@
 
 &i2c0 {
 	u-boot,dm-spl;
+
+	cdce913: cdce913 at 65 {
+		compatible = "ti,cdce913";
+		reg = <0x65>;
+		clocks = <&xtal25mhz>;
+		#clock-cells = <1>;
+		xtal-load-pf = <0>;
+	};
 };
 
 &mmc1 {
board/ti/am43xx/board.c +5 -0
index 2e09cc20e8..f5ecf871bc 100644
@@ -720,6 +720,7 @@ static int device_okay(const char *path)
 
 int board_late_init(void)
 {
+	struct udevice *dev;
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 	set_board_info_env(NULL);
 
@@ -737,6 +738,10 @@ int board_late_init(void)
 	if (device_okay("/ocp/omap_dwc3 at 483c0000"))
 		enable_usb_clocks(1);
 #endif
+
+	/* Just probe the potentially supported cdce913 device */
+	uclass_get_device(UCLASS_CLK, 0, &dev);
+
 	return 0;
 }
 #endif
configs/am43xx_evm_defconfig +2 -0
index 7c74047f3a..7367c6952b 100644
@@ -78,3 +78,5 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x0403
 CONFIG_USB_GADGET_PRODUCT_NUM=0xbd00
 CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_USB_ETHER=y
+CONFIG_CLK=y
+CONFIG_CLK_CDCE9XX=y
Signature · 4 lines
2.17.1

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
#6 lore raw

PATCH 3/4 board: ti: am43xx-idk: Configure the CDCE913 clock synthesizer

Quoted 7 lines · Tero Kristo

AM43xx-IDK boards contain the CDCE913 clock synthesizer, and their reset crystal capacitance load value of 10pF is wrong leading into lost packets in certain networking tests. Add DT data for this device, and probe it from the board file to program the crystal capacitance load value to 0pF to avoid any problems.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191012/2da36806/attachment.sig>
#7 lore raw

PATCH 4/4 board: ti: am335x-ice: Configure the CDCE913 clock synthesizer

In reply to Tero Kristo

AM335x-ICE boards contain the CDCE913 clock synthesizer, and their reset crystal capacitance load value of 10pF is wrong leading into lost packets in certain networking tests. Add DT data for this device, and probe it from the board file to program the crystal capacitance load value to 0pF to avoid any problems.

---
 arch/arm/dts/am335x-icev2-u-boot.dtsi | 21 +++++++++++++++++++++
 board/ti/am335x/board.c               |  4 ++++
 configs/am335x_evm_defconfig          |  2 ++
 3 files changed, 27 insertions(+)
 create mode 100644 arch/arm/dts/am335x-icev2-u-boot.dtsi
arch/arm/dts/am335x-icev2-u-boot.dtsi new file +21 -0
new file mode 100644
index 0000000000..cc9569af03
@@ -0,0 +1,21 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/
+ */
+/ {
+	xtal25mhz: xtal25mhz {
+		compatible = "fixed-clock";
+		#clock-cells = <0>;
+		clock-frequency = <25000000>;
+	};
+};
+
+&i2c0 {
+	cdce913: cdce913 at 65 {
+		compatible = "ti,cdce913";
+		reg = <0x65>;
+		clocks = <&xtal25mhz>;
+		#clock-cells = <1>;
+		xtal-load-pf = <0>;
+	};
+};
board/ti/am335x/board.c +4 -0
index 7eaa6cd96d..499c872227 100644
@@ -791,6 +791,7 @@ int board_init(void)
 #ifdef CONFIG_BOARD_LATE_INIT
 int board_late_init(void)
 {
+	struct udevice *dev;
 #if !defined(CONFIG_SPL_BUILD)
 	uint8_t mac_addr[6];
 	uint32_t mac_hi, mac_lo;
@@ -871,6 +872,9 @@ int board_late_init(void)
 			env_set("serial#", board_serial);
 	}
 
+	/* Just probe the potentially supported cdce913 device */
+	uclass_get_device(UCLASS_CLK, 0, &dev);
+
 	return 0;
 }
 #endif
configs/am335x_evm_defconfig +2 -0
index 2aa9b65caf..93a28b290b 100644
@@ -77,3 +77,5 @@ CONFIG_DYNAMIC_CRC_TABLE=y
 CONFIG_RSA=y
 CONFIG_LZO=y
 # CONFIG_OF_LIBFDT_OVERLAY is not set
+CONFIG_CLK=y
+CONFIG_CLK_CDCE9XX=y
Signature · 4 lines
2.17.1

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
#8 lore raw

PATCH 4/4 board: ti: am335x-ice: Configure the CDCE913 clock synthesizer

Quoted 7 lines · Tero Kristo

AM335x-ICE boards contain the CDCE913 clock synthesizer, and their reset crystal capacitance load value of 10pF is wrong leading into lost packets in certain networking tests. Add DT data for this device, and probe it from the board file to program the crystal capacitance load value to 0pF to avoid any problems.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191012/2129d324/attachment.sig>