Skip to contentSkip to conversation

clk: si570: Add a driver for SI570 oscillators

PATCH Superseded Soren Brinkmann 1 participant 2 messages Sep 20, 2013

Subsystems (2)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 clk: si570: Add a driver for SI570 oscillators

Add a driver for SILabs 570, 571, 598, 599 programmable oscillators. The devices generate low-jitter clock signals and are reprogrammable via an I2C interface.

---
v3:
- add delay in the path for small frequency changes, which can take up to 100us according to the data sheet
- use real range for usleep_range() argument
- use dev_err() over dev_warn() in set_rate()
- add list of applicable devices for 7ppm DT prop
- remove comments regarding platform data
- ignore 7ppm DT prop for incompatible devices
- replace raw numbers with #defines
- convert DT prop 'temperature-stability' from boolean to u32
- make 'temperature-stability' DT prop required (actually not fully true, for 59x it is ignored and the driver does not require its presence)

v2:
- document clock-output-names in bindings documentation
- don't use wildcards in compatibility string
- change Kconfig entry to "... 570 and compatible devices"
- change some indentation flaws
- use 10000 as MIN and MAX value in usleep_range
- fail probe() if 'factory-fout' is not provided in DT
- default factory fout #defines removed
- use i2c driver_data instead of OF data
- remove some related structs and data
- rename DT property 'initial-fout' => 'clock-frequency' (like si5351 driver)
- add some more details regarding the 'factory-fout' DT property

---
 .../devicetree/bindings/clock/silabs,si570.txt     |  39 ++
 drivers/clk/Kconfig                                |  10 +
 drivers/clk/Makefile                               |   1 +
 drivers/clk/clk-si570.c                            | 534 +++++++++++++++++++++
 4 files changed, 584 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/silabs,si570.txt
 create mode 100644 drivers/clk/clk-si570.c
Documentation/devicetree/bindings/clock/silabs,si570.txt new file +39 -0
new file mode 100644
index 0000000..26aab5c
@@ -0,0 +1,39 @@
+Binding for Silicon Labs 570, 571, 598 and 599 programmable
+I2C clock generators.
+
+Reference
+This binding uses the common clock binding[1]. Details about the devices can be
+found in the data sheets[2][3].
+
+[1] Documentation/devicetree/bindings/clock/clock-bindings.txt
+[2] Si570/571 Data Sheet
+    http://www.silabs.com/Support%20Documents/TechnicalDocs/si570.pdf
+[3] Si598/599 Data Sheet
+    http://www.silabs.com/Support%20Documents/TechnicalDocs/si598-99.pdf
+
+Required properties:
+ - compatible: Shall be one of "silabs,si570", "silabs,si571",
+			       "silabs,si598", "silabs,si599"
+ - reg: I2C device address.
+ - #clock-cells: From common clock bindings: Shall be 0.
+ - factory-fout: Factory set default frequency. This frequency is part specific.
+		 The correct frequency for the part used has to be provided in
+		 order to generate the correct output frequencies. For more
+		 details, please refer to the data sheet.
+ - temperature-stability: Temperature stability of the device. Should be one of:
+			  7, 20, 50 or 100.
+
+Optional properties:
+ - clock-output-names: From common clock bindings. Recommended to be "si570".
+ - clock-frequency: Output frequency to generate. This defines the output
+		    frequency set during boot. It can be reprogrammed during
+		    runtime through the common clock framework.
+
+Example:
+	si570: clock-generator at 5d {
+		#clock-cells = <0>;
+		compatible = "silabs,si570";
+		temperatur-stability = <50>;
+		reg = <0x5d>;
+		factory-fout = <156250000>;
+	};
drivers/clk/Kconfig +10 -0
index 279407a..349b88a 100644
@@ -64,6 +64,16 @@ config COMMON_CLK_SI5351
 	  This driver supports Silicon Labs 5351A/B/C programmable clock
 	  generators.
 
+config COMMON_CLK_SI570
+	tristate "Clock driver for SiLabs 570 and compatible devices"
+	depends on I2C
+	depends on OF
+	select REGMAP_I2C
+	help
+	---help---
+	  This driver supports Silicon Labs 570/571/598/599 programmable
+	  clock generators.
+
 config COMMON_CLK_S2MPS11
 	tristate "Clock driver for S2MPS11 MFD"
 	depends on MFD_SEC_CORE
drivers/clk/Makefile +1 -0
index 7b11106..c0e94b3 100644
@@ -40,6 +40,7 @@ obj-$(CONFIG_COMMON_CLK_AXI_CLKGEN) += clk-axi-clkgen.o
 obj-$(CONFIG_COMMON_CLK_WM831X) += clk-wm831x.o
 obj-$(CONFIG_COMMON_CLK_MAX77686) += clk-max77686.o
 obj-$(CONFIG_COMMON_CLK_SI5351) += clk-si5351.o
+obj-$(CONFIG_COMMON_CLK_SI570) += clk-si570.o
 obj-$(CONFIG_COMMON_CLK_S2MPS11) += clk-s2mps11.o
 obj-$(CONFIG_CLK_TWL6040)	+= clk-twl6040.o
 obj-$(CONFIG_CLK_PPC_CORENET)	+= clk-ppc-corenet.o
drivers/clk/clk-si570.c new file +534 -0

534 lines not on this page · raw message

Signature · 1 line
1.8.4
#1 lore raw

Ignore this one. There is and if statement missing when handling an error. Don't know how that slipped through. Sorry.

S?ren