Re: [PATCH v2] clk: Add driver for the si544 clock generator chip
On 19-03-18 22:08, Stephen Boyd wrote: Quoting Mike Looijmans (2018-03-19 08:04:15) On 18-03-18 13:52, Rob Herring wrote: On Thu, Mar 15, 2018 at 12:50:08PM +0100, Mike Looijmans wrote: +Required properties: + - compatible: One of "silabs,si514a", "silabs,si514b" "silabs,si514c" according + to the speed grade of the chip. + - reg: I2C device address. + - #clock-cells: From common clock bindings: Shall be 0. + +Optional properties: + - clock-output-names: From common clock bindings. Recommended to be "si544". What's the point if there is only 1 clock output? I have a board with 6 of these chips, and the clock registration fails if they don't have unique names. Providing a clock-output-names property was the easiest way around it. Should I just omit the line or change the wording to reflect the above or is there a better solution (maybe I can use the DT node name as clock name in the driver, will look into that) I would leave clock-output-names for now. One day we can get off of strings in CCF. Soon perhaps. + +Example: +si544: clock-generator@55 { clock-controller@55 is the standard node name. I'll change and post patch v3 I made some comments on v1. Please fold those into v3. Thanks, found them on patchwork, somehow they didn't end up in my mailbox. Comments are clear, will incorporate them, I only have trouble with your remark on the DT documentation "Can this reference stuff go to the bottom of this document?". I copied the style from the other documents in the same directory, I'm slightly puzzled about where the reference part should go now. Kind regards, Mike Looijmans System Expert TOPIC Products Materiaalweg 4, NL-5681 RJ Best Postbus 440, NL-5680 AK Best Telefoon: +31 (0) 499 33 69 79 E-mail: mike.looijm...@topicproducts.com Website: www.topicproducts.com Please consider the environment before printing this e-mail
Re: [PATCH v2] clk: Add driver for the si544 clock generator chip
On 19-03-18 22:08, Stephen Boyd wrote: Quoting Mike Looijmans (2018-03-19 08:04:15) On 18-03-18 13:52, Rob Herring wrote: On Thu, Mar 15, 2018 at 12:50:08PM +0100, Mike Looijmans wrote: +Required properties: + - compatible: One of "silabs,si514a", "silabs,si514b" "silabs,si514c" according + to the speed grade of the chip. + - reg: I2C device address. + - #clock-cells: From common clock bindings: Shall be 0. + +Optional properties: + - clock-output-names: From common clock bindings. Recommended to be "si544". What's the point if there is only 1 clock output? I have a board with 6 of these chips, and the clock registration fails if they don't have unique names. Providing a clock-output-names property was the easiest way around it. Should I just omit the line or change the wording to reflect the above or is there a better solution (maybe I can use the DT node name as clock name in the driver, will look into that) I would leave clock-output-names for now. One day we can get off of strings in CCF. Soon perhaps. + +Example: +si544: clock-generator@55 { clock-controller@55 is the standard node name. I'll change and post patch v3 I made some comments on v1. Please fold those into v3. Thanks, found them on patchwork, somehow they didn't end up in my mailbox. Comments are clear, will incorporate them, I only have trouble with your remark on the DT documentation "Can this reference stuff go to the bottom of this document?". I copied the style from the other documents in the same directory, I'm slightly puzzled about where the reference part should go now. Kind regards, Mike Looijmans System Expert TOPIC Products Materiaalweg 4, NL-5681 RJ Best Postbus 440, NL-5680 AK Best Telefoon: +31 (0) 499 33 69 79 E-mail: mike.looijm...@topicproducts.com Website: www.topicproducts.com Please consider the environment before printing this e-mail
Re: [PATCH v2] clk: Add driver for the si544 clock generator chip
Quoting Mike Looijmans (2018-03-20 00:15:36) > Thanks, found them on patchwork, somehow they didn't end up in my mailbox. > > Comments are clear, will incorporate them, I only have trouble with your > remark on the DT documentation "Can this reference stuff go to the bottom of > this document?". I copied the style from the other documents in the same > directory, I'm slightly puzzled about where the reference part should go now. > > Ok. It's fine either way.
Re: [PATCH v2] clk: Add driver for the si544 clock generator chip
Quoting Mike Looijmans (2018-03-20 00:15:36) > Thanks, found them on patchwork, somehow they didn't end up in my mailbox. > > Comments are clear, will incorporate them, I only have trouble with your > remark on the DT documentation "Can this reference stuff go to the bottom of > this document?". I copied the style from the other documents in the same > directory, I'm slightly puzzled about where the reference part should go now. > > Ok. It's fine either way.
Re: [PATCH v2] clk: Add driver for the si544 clock generator chip
Quoting Mike Looijmans (2018-03-19 08:04:15) > On 18-03-18 13:52, Rob Herring wrote: > > On Thu, Mar 15, 2018 at 12:50:08PM +0100, Mike Looijmans wrote: > >> +Required properties: > >> + - compatible: One of "silabs,si514a", "silabs,si514b" "silabs,si514c" > >> according > >> + to the speed grade of the chip. > >> + - reg: I2C device address. > >> + - #clock-cells: From common clock bindings: Shall be 0. > >> + > >> +Optional properties: > >> + - clock-output-names: From common clock bindings. Recommended to be > >> "si544". > > > > What's the point if there is only 1 clock output? > > I have a board with 6 of these chips, and the clock registration fails if > they > don't have unique names. Providing a clock-output-names property was the > easiest way around it. > > Should I just omit the line or change the wording to reflect the above or is > there a better solution (maybe I can use the DT node name as clock name in > the > driver, will look into that) I would leave clock-output-names for now. One day we can get off of strings in CCF. Soon perhaps. > > > > >> + > >> +Example: > >> +si544: clock-generator@55 { > > > > clock-controller@55 is the standard node name. > > I'll change and post patch v3 > I made some comments on v1. Please fold those into v3.
Re: [PATCH v2] clk: Add driver for the si544 clock generator chip
Quoting Mike Looijmans (2018-03-19 08:04:15) > On 18-03-18 13:52, Rob Herring wrote: > > On Thu, Mar 15, 2018 at 12:50:08PM +0100, Mike Looijmans wrote: > >> +Required properties: > >> + - compatible: One of "silabs,si514a", "silabs,si514b" "silabs,si514c" > >> according > >> + to the speed grade of the chip. > >> + - reg: I2C device address. > >> + - #clock-cells: From common clock bindings: Shall be 0. > >> + > >> +Optional properties: > >> + - clock-output-names: From common clock bindings. Recommended to be > >> "si544". > > > > What's the point if there is only 1 clock output? > > I have a board with 6 of these chips, and the clock registration fails if > they > don't have unique names. Providing a clock-output-names property was the > easiest way around it. > > Should I just omit the line or change the wording to reflect the above or is > there a better solution (maybe I can use the DT node name as clock name in > the > driver, will look into that) I would leave clock-output-names for now. One day we can get off of strings in CCF. Soon perhaps. > > > > >> + > >> +Example: > >> +si544: clock-generator@55 { > > > > clock-controller@55 is the standard node name. > > I'll change and post patch v3 > I made some comments on v1. Please fold those into v3.
Re: [PATCH v2] clk: Add driver for the si544 clock generator chip
On 18-03-18 13:52, Rob Herring wrote: On Thu, Mar 15, 2018 at 12:50:08PM +0100, Mike Looijmans wrote: This patch adds the driver and devicetree documentation for the Silicon Labs SI544 clock generator chip. This is an I2C controlled oscillator capable of generating clock signals ranging from 200kHz to 1500MHz. Signed-off-by: Mike Looijmans--- v2: Add u64 cast to ls_div_bits calculation loop When ls_div_bits is non-zero, the hs_div must always be even .../devicetree/bindings/clock/silabs,si544.txt | 25 ++ drivers/clk/Kconfig| 10 + drivers/clk/Makefile | 1 + drivers/clk/clk-si544.c| 422 + 4 files changed, 458 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/silabs,si544.txt create mode 100644 drivers/clk/clk-si544.c diff --git a/Documentation/devicetree/bindings/clock/silabs,si544.txt b/Documentation/devicetree/bindings/clock/silabs,si544.txt new file mode 100644 index 000..eec1787 --- /dev/null +++ b/Documentation/devicetree/bindings/clock/silabs,si544.txt @@ -0,0 +1,25 @@ +Binding for Silicon Labs 544 programmable I2C clock generator. + +Reference +This binding uses the common clock binding[1]. Details about the device can be +found in the datasheet[2]. + +[1] Documentation/devicetree/bindings/clock/clock-bindings.txt +[2] Si544 datasheet +https://www.silabs.com/documents/public/data-sheets/si544-datasheet.pdf + +Required properties: + - compatible: One of "silabs,si514a", "silabs,si514b" "silabs,si514c" according + to the speed grade of the chip. + - reg: I2C device address. + - #clock-cells: From common clock bindings: Shall be 0. + +Optional properties: + - clock-output-names: From common clock bindings. Recommended to be "si544". What's the point if there is only 1 clock output? I have a board with 6 of these chips, and the clock registration fails if they don't have unique names. Providing a clock-output-names property was the easiest way around it. Should I just omit the line or change the wording to reflect the above or is there a better solution (maybe I can use the DT node name as clock name in the driver, will look into that) + +Example: + si544: clock-generator@55 { clock-controller@55 is the standard node name. I'll change and post patch v3 + reg = <0x55>; + #clock-cells = <0>; + compatible = "silabs,si544b"; + }; Otherwise, for the binding: Reviewed-by: Rob Herring Kind regards, Mike Looijmans System Expert TOPIC Products Materiaalweg 4, NL-5681 RJ Best Postbus 440, NL-5680 AK Best Telefoon: +31 (0) 499 33 69 79 E-mail: mike.looijm...@topicproducts.com Website: www.topicproducts.com Please consider the environment before printing this e-mail
Re: [PATCH v2] clk: Add driver for the si544 clock generator chip
On 18-03-18 13:52, Rob Herring wrote: On Thu, Mar 15, 2018 at 12:50:08PM +0100, Mike Looijmans wrote: This patch adds the driver and devicetree documentation for the Silicon Labs SI544 clock generator chip. This is an I2C controlled oscillator capable of generating clock signals ranging from 200kHz to 1500MHz. Signed-off-by: Mike Looijmans --- v2: Add u64 cast to ls_div_bits calculation loop When ls_div_bits is non-zero, the hs_div must always be even .../devicetree/bindings/clock/silabs,si544.txt | 25 ++ drivers/clk/Kconfig| 10 + drivers/clk/Makefile | 1 + drivers/clk/clk-si544.c| 422 + 4 files changed, 458 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/silabs,si544.txt create mode 100644 drivers/clk/clk-si544.c diff --git a/Documentation/devicetree/bindings/clock/silabs,si544.txt b/Documentation/devicetree/bindings/clock/silabs,si544.txt new file mode 100644 index 000..eec1787 --- /dev/null +++ b/Documentation/devicetree/bindings/clock/silabs,si544.txt @@ -0,0 +1,25 @@ +Binding for Silicon Labs 544 programmable I2C clock generator. + +Reference +This binding uses the common clock binding[1]. Details about the device can be +found in the datasheet[2]. + +[1] Documentation/devicetree/bindings/clock/clock-bindings.txt +[2] Si544 datasheet +https://www.silabs.com/documents/public/data-sheets/si544-datasheet.pdf + +Required properties: + - compatible: One of "silabs,si514a", "silabs,si514b" "silabs,si514c" according + to the speed grade of the chip. + - reg: I2C device address. + - #clock-cells: From common clock bindings: Shall be 0. + +Optional properties: + - clock-output-names: From common clock bindings. Recommended to be "si544". What's the point if there is only 1 clock output? I have a board with 6 of these chips, and the clock registration fails if they don't have unique names. Providing a clock-output-names property was the easiest way around it. Should I just omit the line or change the wording to reflect the above or is there a better solution (maybe I can use the DT node name as clock name in the driver, will look into that) + +Example: + si544: clock-generator@55 { clock-controller@55 is the standard node name. I'll change and post patch v3 + reg = <0x55>; + #clock-cells = <0>; + compatible = "silabs,si544b"; + }; Otherwise, for the binding: Reviewed-by: Rob Herring Kind regards, Mike Looijmans System Expert TOPIC Products Materiaalweg 4, NL-5681 RJ Best Postbus 440, NL-5680 AK Best Telefoon: +31 (0) 499 33 69 79 E-mail: mike.looijm...@topicproducts.com Website: www.topicproducts.com Please consider the environment before printing this e-mail
Re: [PATCH v2] clk: Add driver for the si544 clock generator chip
On Thu, Mar 15, 2018 at 12:50:08PM +0100, Mike Looijmans wrote: > This patch adds the driver and devicetree documentation for the > Silicon Labs SI544 clock generator chip. This is an I2C controlled > oscillator capable of generating clock signals ranging from 200kHz > to 1500MHz. > > Signed-off-by: Mike Looijmans> --- > v2: Add u64 cast to ls_div_bits calculation loop > When ls_div_bits is non-zero, the hs_div must always be even > > .../devicetree/bindings/clock/silabs,si544.txt | 25 ++ > drivers/clk/Kconfig| 10 + > drivers/clk/Makefile | 1 + > drivers/clk/clk-si544.c| 422 > + > 4 files changed, 458 insertions(+) > create mode 100644 Documentation/devicetree/bindings/clock/silabs,si544.txt > create mode 100644 drivers/clk/clk-si544.c > > diff --git a/Documentation/devicetree/bindings/clock/silabs,si544.txt > b/Documentation/devicetree/bindings/clock/silabs,si544.txt > new file mode 100644 > index 000..eec1787 > --- /dev/null > +++ b/Documentation/devicetree/bindings/clock/silabs,si544.txt > @@ -0,0 +1,25 @@ > +Binding for Silicon Labs 544 programmable I2C clock generator. > + > +Reference > +This binding uses the common clock binding[1]. Details about the device can > be > +found in the datasheet[2]. > + > +[1] Documentation/devicetree/bindings/clock/clock-bindings.txt > +[2] Si544 datasheet > +https://www.silabs.com/documents/public/data-sheets/si544-datasheet.pdf > + > +Required properties: > + - compatible: One of "silabs,si514a", "silabs,si514b" "silabs,si514c" > according > + to the speed grade of the chip. > + - reg: I2C device address. > + - #clock-cells: From common clock bindings: Shall be 0. > + > +Optional properties: > + - clock-output-names: From common clock bindings. Recommended to be "si544". What's the point if there is only 1 clock output? > + > +Example: > + si544: clock-generator@55 { clock-controller@55 is the standard node name. > + reg = <0x55>; > + #clock-cells = <0>; > + compatible = "silabs,si544b"; > + }; Otherwise, for the binding: Reviewed-by: Rob Herring
Re: [PATCH v2] clk: Add driver for the si544 clock generator chip
On Thu, Mar 15, 2018 at 12:50:08PM +0100, Mike Looijmans wrote: > This patch adds the driver and devicetree documentation for the > Silicon Labs SI544 clock generator chip. This is an I2C controlled > oscillator capable of generating clock signals ranging from 200kHz > to 1500MHz. > > Signed-off-by: Mike Looijmans > --- > v2: Add u64 cast to ls_div_bits calculation loop > When ls_div_bits is non-zero, the hs_div must always be even > > .../devicetree/bindings/clock/silabs,si544.txt | 25 ++ > drivers/clk/Kconfig| 10 + > drivers/clk/Makefile | 1 + > drivers/clk/clk-si544.c| 422 > + > 4 files changed, 458 insertions(+) > create mode 100644 Documentation/devicetree/bindings/clock/silabs,si544.txt > create mode 100644 drivers/clk/clk-si544.c > > diff --git a/Documentation/devicetree/bindings/clock/silabs,si544.txt > b/Documentation/devicetree/bindings/clock/silabs,si544.txt > new file mode 100644 > index 000..eec1787 > --- /dev/null > +++ b/Documentation/devicetree/bindings/clock/silabs,si544.txt > @@ -0,0 +1,25 @@ > +Binding for Silicon Labs 544 programmable I2C clock generator. > + > +Reference > +This binding uses the common clock binding[1]. Details about the device can > be > +found in the datasheet[2]. > + > +[1] Documentation/devicetree/bindings/clock/clock-bindings.txt > +[2] Si544 datasheet > +https://www.silabs.com/documents/public/data-sheets/si544-datasheet.pdf > + > +Required properties: > + - compatible: One of "silabs,si514a", "silabs,si514b" "silabs,si514c" > according > + to the speed grade of the chip. > + - reg: I2C device address. > + - #clock-cells: From common clock bindings: Shall be 0. > + > +Optional properties: > + - clock-output-names: From common clock bindings. Recommended to be "si544". What's the point if there is only 1 clock output? > + > +Example: > + si544: clock-generator@55 { clock-controller@55 is the standard node name. > + reg = <0x55>; > + #clock-cells = <0>; > + compatible = "silabs,si544b"; > + }; Otherwise, for the binding: Reviewed-by: Rob Herring
[PATCH v2] clk: Add driver for the si544 clock generator chip
This patch adds the driver and devicetree documentation for the Silicon Labs SI544 clock generator chip. This is an I2C controlled oscillator capable of generating clock signals ranging from 200kHz to 1500MHz. Signed-off-by: Mike Looijmans--- v2: Add u64 cast to ls_div_bits calculation loop When ls_div_bits is non-zero, the hs_div must always be even .../devicetree/bindings/clock/silabs,si544.txt | 25 ++ drivers/clk/Kconfig| 10 + drivers/clk/Makefile | 1 + drivers/clk/clk-si544.c| 422 + 4 files changed, 458 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/silabs,si544.txt create mode 100644 drivers/clk/clk-si544.c diff --git a/Documentation/devicetree/bindings/clock/silabs,si544.txt b/Documentation/devicetree/bindings/clock/silabs,si544.txt new file mode 100644 index 000..eec1787 --- /dev/null +++ b/Documentation/devicetree/bindings/clock/silabs,si544.txt @@ -0,0 +1,25 @@ +Binding for Silicon Labs 544 programmable I2C clock generator. + +Reference +This binding uses the common clock binding[1]. Details about the device can be +found in the datasheet[2]. + +[1] Documentation/devicetree/bindings/clock/clock-bindings.txt +[2] Si544 datasheet +https://www.silabs.com/documents/public/data-sheets/si544-datasheet.pdf + +Required properties: + - compatible: One of "silabs,si514a", "silabs,si514b" "silabs,si514c" according + to the speed grade of the chip. + - reg: I2C device address. + - #clock-cells: From common clock bindings: Shall be 0. + +Optional properties: + - clock-output-names: From common clock bindings. Recommended to be "si544". + +Example: + si544: clock-generator@55 { + reg = <0x55>; + #clock-cells = <0>; + compatible = "silabs,si544b"; + }; diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig index 98ce9fc..5c7dc8e 100644 --- a/drivers/clk/Kconfig +++ b/drivers/clk/Kconfig @@ -91,6 +91,16 @@ config COMMON_CLK_SI514 This driver supports the Silicon Labs 514 programmable clock generator. +config COMMON_CLK_SI544 + tristate "Clock driver for SiLabs 544 devices" + depends on I2C + depends on OF + select REGMAP_I2C + help + ---help--- + This driver supports the Silicon Labs 544 programmable clock + generator. + config COMMON_CLK_SI570 tristate "Clock driver for SiLabs 570 and compatible devices" depends on I2C diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile index 71ec41e..bde614a 100644 --- a/drivers/clk/Makefile +++ b/drivers/clk/Makefile @@ -44,6 +44,7 @@ obj-$(CONFIG_COMMON_CLK_S2MPS11) += clk-s2mps11.o obj-$(CONFIG_COMMON_CLK_SCPI) += clk-scpi.o obj-$(CONFIG_COMMON_CLK_SI5351)+= clk-si5351.o obj-$(CONFIG_COMMON_CLK_SI514) += clk-si514.o +obj-$(CONFIG_COMMON_CLK_SI544) += clk-si544.o obj-$(CONFIG_COMMON_CLK_SI570) += clk-si570.o obj-$(CONFIG_ARCH_STM32) += clk-stm32f4.o obj-$(CONFIG_ARCH_STM32) += clk-stm32h7.o diff --git a/drivers/clk/clk-si544.c b/drivers/clk/clk-si544.c new file mode 100644 index 000..a392acf --- /dev/null +++ b/drivers/clk/clk-si544.c @@ -0,0 +1,422 @@ +/* + * Driver for Silicon Labs Si544 Programmable Oscillator + * + * Copyright (C) 2018 Topic Embedded Products + * + * Author: Mike Looijmans + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include + +/* I2C registers (decimal as in datasheet) */ +#define SI544_REG_CONTROL 7 +#define SI544_REG_OE_STATE 17 +#define SI544_REG_HS_DIV 23 +#define SI544_REG_LS_HS_DIV24 +#define SI544_REG_FBDIV0 26 +#define SI544_REG_FBDIV8 27 +#define SI544_REG_FBDIV16 28 +#define SI544_REG_FBDIV24 29 +#define SI544_REG_FBDIV32 30 +#define SI544_REG_FBDIV40 31 +#define SI544_REG_FCAL_OVR 69 +#define SI544_REG_ADPLL_DELTA_M0 231 +#define SI544_REG_ADPLL_DELTA_M8 232 +#define SI544_REG_ADPLL_DELTA_M16 233 +#define SI544_REG_PAGE_SELECT 255 + +/* Register values */ +#define SI544_CONTROL_RESETBIT(7) +#define SI544_CONTROL_MS_ICAL2 BIT(3) + +#define SI544_OE_STATE_ODC_OE BIT(0) + +/* Max freq depends on speed grade */ +#define SI544_MIN_FREQ 20U + +/* Si544 Internal oscilator
[PATCH v2] clk: Add driver for the si544 clock generator chip
This patch adds the driver and devicetree documentation for the Silicon Labs SI544 clock generator chip. This is an I2C controlled oscillator capable of generating clock signals ranging from 200kHz to 1500MHz. Signed-off-by: Mike Looijmans --- v2: Add u64 cast to ls_div_bits calculation loop When ls_div_bits is non-zero, the hs_div must always be even .../devicetree/bindings/clock/silabs,si544.txt | 25 ++ drivers/clk/Kconfig| 10 + drivers/clk/Makefile | 1 + drivers/clk/clk-si544.c| 422 + 4 files changed, 458 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/silabs,si544.txt create mode 100644 drivers/clk/clk-si544.c diff --git a/Documentation/devicetree/bindings/clock/silabs,si544.txt b/Documentation/devicetree/bindings/clock/silabs,si544.txt new file mode 100644 index 000..eec1787 --- /dev/null +++ b/Documentation/devicetree/bindings/clock/silabs,si544.txt @@ -0,0 +1,25 @@ +Binding for Silicon Labs 544 programmable I2C clock generator. + +Reference +This binding uses the common clock binding[1]. Details about the device can be +found in the datasheet[2]. + +[1] Documentation/devicetree/bindings/clock/clock-bindings.txt +[2] Si544 datasheet +https://www.silabs.com/documents/public/data-sheets/si544-datasheet.pdf + +Required properties: + - compatible: One of "silabs,si514a", "silabs,si514b" "silabs,si514c" according + to the speed grade of the chip. + - reg: I2C device address. + - #clock-cells: From common clock bindings: Shall be 0. + +Optional properties: + - clock-output-names: From common clock bindings. Recommended to be "si544". + +Example: + si544: clock-generator@55 { + reg = <0x55>; + #clock-cells = <0>; + compatible = "silabs,si544b"; + }; diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig index 98ce9fc..5c7dc8e 100644 --- a/drivers/clk/Kconfig +++ b/drivers/clk/Kconfig @@ -91,6 +91,16 @@ config COMMON_CLK_SI514 This driver supports the Silicon Labs 514 programmable clock generator. +config COMMON_CLK_SI544 + tristate "Clock driver for SiLabs 544 devices" + depends on I2C + depends on OF + select REGMAP_I2C + help + ---help--- + This driver supports the Silicon Labs 544 programmable clock + generator. + config COMMON_CLK_SI570 tristate "Clock driver for SiLabs 570 and compatible devices" depends on I2C diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile index 71ec41e..bde614a 100644 --- a/drivers/clk/Makefile +++ b/drivers/clk/Makefile @@ -44,6 +44,7 @@ obj-$(CONFIG_COMMON_CLK_S2MPS11) += clk-s2mps11.o obj-$(CONFIG_COMMON_CLK_SCPI) += clk-scpi.o obj-$(CONFIG_COMMON_CLK_SI5351)+= clk-si5351.o obj-$(CONFIG_COMMON_CLK_SI514) += clk-si514.o +obj-$(CONFIG_COMMON_CLK_SI544) += clk-si544.o obj-$(CONFIG_COMMON_CLK_SI570) += clk-si570.o obj-$(CONFIG_ARCH_STM32) += clk-stm32f4.o obj-$(CONFIG_ARCH_STM32) += clk-stm32h7.o diff --git a/drivers/clk/clk-si544.c b/drivers/clk/clk-si544.c new file mode 100644 index 000..a392acf --- /dev/null +++ b/drivers/clk/clk-si544.c @@ -0,0 +1,422 @@ +/* + * Driver for Silicon Labs Si544 Programmable Oscillator + * + * Copyright (C) 2018 Topic Embedded Products + * + * Author: Mike Looijmans + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include + +/* I2C registers (decimal as in datasheet) */ +#define SI544_REG_CONTROL 7 +#define SI544_REG_OE_STATE 17 +#define SI544_REG_HS_DIV 23 +#define SI544_REG_LS_HS_DIV24 +#define SI544_REG_FBDIV0 26 +#define SI544_REG_FBDIV8 27 +#define SI544_REG_FBDIV16 28 +#define SI544_REG_FBDIV24 29 +#define SI544_REG_FBDIV32 30 +#define SI544_REG_FBDIV40 31 +#define SI544_REG_FCAL_OVR 69 +#define SI544_REG_ADPLL_DELTA_M0 231 +#define SI544_REG_ADPLL_DELTA_M8 232 +#define SI544_REG_ADPLL_DELTA_M16 233 +#define SI544_REG_PAGE_SELECT 255 + +/* Register values */ +#define SI544_CONTROL_RESETBIT(7) +#define SI544_CONTROL_MS_ICAL2 BIT(3) + +#define SI544_OE_STATE_ODC_OE BIT(0) + +/* Max freq depends on speed grade */ +#define SI544_MIN_FREQ 20U + +/* Si544 Internal oscilator runs at 55.05 MHz */ +#define FXO