Add Maxim 77802 clocks support
Subsystems (5)
v9 cover Add Maxim 77802 clocks support
Hello Mike,
This series add support for the clocks present in the Maxim 77802 Power Managment IC. Previously, the series was part of a bigger one [0] that aimed to add support for all the devices in the max77802 PMIC. But now the Maxim 77802 PMIC dependencies were already merged for 3.17 so the series can be split and each driver can go through the relevant tree.
The support needed for the clocks in the max77802 is very similar to the one for the ones in the max77686 so a generic driver was added that allows to remove the duplicated code for both drivers. Patch 01/06 adds a dt binding include that can be used to share the max77686 clocks between the driver and the DTS files. Patch 02/06 adds the generic clock driver for maxim pmic clocks and patch 03/06 converts the existing max77686 clock driver to the generic one. Patch 04/06 adds some improvements to the max77686 clock driver DT binding. Patch 05/06 adds the max77802 clock driver and finally patch 06/06 adds the DT binding documentation for this driver.
I kept the version numbering from the old series so this is version 9 although there were no changes on the max77802 clock driver since v5 of the old series and all the patches had been already acked by you so I hope there won't be issues to get them merged.
The series were tested on an Exynos5250 Snow (max77686) and Exynos5420 Peach Pit (max77802) machines and applies cleanly to both 3.17-rc1 and today's linux-next (20140818).
Javier Martinez Canillas (6):
clk: max77686: Add DT include for MAX77686 PMIC clock
clk: Add generic driver for Maxim PMIC clocks
clk: max77686: Convert to the generic max clock driver
clk: max77686: Improve Maxim 77686 PMIC clocks binding
clk: Add driver for Maxim 77802 PMIC clocks
clk: max77802: Add DT binding documentation
.../devicetree/bindings/clock/maxim,max77686.txt | 16 +- .../devicetree/bindings/clock/maxim,max77802.txt | 44 +++++ drivers/clk/Kconfig | 11 ++ drivers/clk/Makefile | 2 + drivers/clk/clk-max-gen.c | 192 +++++++++++++++++++++ drivers/clk/clk-max-gen.h | 32 ++++ drivers/clk/clk-max77686.c | 183 +------------------- drivers/clk/clk-max77802.c | 98 +++++++++++ include/dt-bindings/clock/maxim,max77686.h | 23 +++ include/dt-bindings/clock/maxim,max77802.h | 22 +++ 10 files changed, 445 insertions(+), 178 deletions(-) create mode 100644 Documentation/devicetree/bindings/clock/maxim,max77802.txt create mode 100644 drivers/clk/clk-max-gen.c create mode 100644 drivers/clk/clk-max-gen.h create mode 100644 drivers/clk/clk-max77802.c create mode 100644 include/dt-bindings/clock/maxim,max77686.h create mode 100644 include/dt-bindings/clock/maxim,max77802.h
Best regards,
Javier
PATCH v9 1/6 clk: max77686: Add DT include for MAX77686 PMIC clock
This patch adds a dt-binding include for Maxim 77686 PMIC clock IDs that can be used by both the max77686 clock driver and Device Tree source files.
---
Changes since v6: None
Changes since v5:
- Improve wording in commit message. Suggested by Andreas Farber.
Changes since v4: None
Changes since v3:
- Keep the note that this patch needs another change due wakeup ordering problems.
--- drivers/clk/clk-max77686.c | 7 +------ include/dt-bindings/clock/maxim,max77686.h | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 include/dt-bindings/clock/maxim,max77686.h
drivers/clk/clk-max77686.c +1 -6
@@ -30,12 +30,7 @@#include <linux/mutex.h> #include <linux/clkdev.h> -enum { -MAX77686_CLK_AP =0 , -MAX77686_CLK_CP , -MAX77686_CLK_PMIC , -MAX77686_CLKS_NUM , -}; +#include <dt-bindings/clock/maxim,max77686.h> struct max77686_clk {struct max77686_dev *iodev;
include/dt-bindings/clock/maxim,max77686.h new file +23 -0
@@ -0,0 +1,23 @@ +/* +* Copyright (C) 2014 Google, Inc +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +* +* Device Tree binding constants clocks for the Maxim 77686 PMIC. +*/ + +#ifndef _DT_BINDINGS_CLOCK_MAXIM_MAX77686_CLOCK_H +#define _DT_BINDINGS_CLOCK_MAXIM_MAX77686_CLOCK_H + +/* Fixed rate clocks. */ + +#define MAX77686_CLK_AP 0 +#define MAX77686_CLK_CP 1 +#define MAX77686_CLK_PMIC 2 + +/* Total number of clocks. */ +#define MAX77686_CLKS_NUM (MAX77686_CLK_PMIC + 1) + +#endif /* _DT_BINDINGS_CLOCK_MAXIM_MAX77686_CLOCK_H */
Signature · 1 line
2.0.1
PATCH v9 2/6 clk: Add generic driver for Maxim PMIC clocks
In reply to Javier Martinez CanillasMaxim Integrated Power Management ICs are very similar with regard to their clock outputs. Most of the clock drivers for these chips are duplicating code and are simpler enough that can be converted to use a generic driver to consolidate code and avoid duplication.
---
Changes since v6: None
Changes since v5:
- Fix generic driver changes merged into max77802 clock patch by mistake. Suggested by Yadwinder Singh Brar.
- Register clock lookups using clk_register_clkdev() instead of doing manually.
- Use the managed devm_clk_register() function and remove clk un-registration.
- Add "clock-output-names" property support. Suggested by Yadwinder Singh Brar.
- Return the rate unconditionally in recalc_rate. Suggested by Mike Turquette.
Changes since v4: None
Changes since v3:
- Don't change clock-names property to make clear that it's the consumer clock name and should not match the producer clock. Suggested by Doug Anderson.
--- drivers/clk/Kconfig | 3 + drivers/clk/Makefile | 1 + drivers/clk/clk-max-gen.c | 192 ++++++++++++++++++++++++++++++++++++++++++++++ drivers/clk/clk-max-gen.h | 32 ++++++++ 4 files changed, 228 insertions(+) create mode 100644 drivers/clk/clk-max-gen.c create mode 100644 drivers/clk/clk-max-gen.h
drivers/clk/Kconfig +3 -0
@@ -32,6 +32,9 @@ config COMMON_CLK_WM831X source "drivers/clk/versatile/Kconfig" +config COMMON_CLK_MAX_GEN + bool + config COMMON_CLK_MAX77686 tristate "Clock driver for Maxim 77686 MFD" depends on MFD_MAX77686
drivers/clk/Makefile +1 -0
@@ -22,6 +22,7 @@ obj-$(CONFIG_ARCH_CLPS711X) += clk-clps711x.o obj-$(CONFIG_ARCH_EFM32) += clk-efm32gg.o obj-$(CONFIG_ARCH_HIGHBANK) += clk-highbank.o obj-$(CONFIG_MACH_LOONGSON1) += clk-ls1x.o +obj-$(CONFIG_COMMON_CLK_MAX_GEN) += clk-max-gen.o obj-$(CONFIG_COMMON_CLK_MAX77686) += clk-max77686.o obj-$(CONFIG_ARCH_MOXART) += clk-moxart.o obj-$(CONFIG_ARCH_NOMADIK) += clk-nomadik.o
drivers/clk/clk-max-gen.c new file +192 -0
192 lines not on this page · raw message
drivers/clk/clk-max-gen.h new file +32 -0
@@ -0,0 +1,32 @@ +/* +* clk-max-gen.h - Generic clock driver for Maxim PMICs clocks +* +* Copyright (C) 2014 Google, Inc +* +* 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. +* +*/ + +#ifndef __CLK_MAX_GEN_H__ +#define __CLK_MAX_GEN_H__ + +#include <linux/types.h> +#include <linux/device.h> +#include <linux/clkdev.h> +#include <linux/regmap.h> +#include <linux/platform_device.h> + +int max_gen_clk_probe (struct platform_device *pdev,struct regmap *regmap, +u32 reg,struct clk_init_data *clks_init,int num_init); +int max_gen_clk_remove (struct platform_device *pdev,int num_init); +extern struct clk_ops max_gen_clk_ops; + +#endif /* __CLK_MAX_GEN_H__ */
Signature · 1 line
2.0.1
PATCH v9 3/6 clk: max77686: Convert to the generic max clock driver
In reply to Javier Martinez CanillasClocks drivers for Maxim PMIC are very similar so they can be converted to use the generic Maxim clock driver.
Also, while being there use module_platform_driver() helper macro to eliminate more boilerplate code.
--- drivers/clk/Kconfig | 1 + drivers/clk/clk-max77686.c | 176 +++------------------------------------------ 2 files changed, 9 insertions(+), 168 deletions(-)
drivers/clk/Kconfig +1 -0
@@ -38,6 +38,7 @@ config COMMON_CLK_MAX_GEN config COMMON_CLK_MAX77686 tristate "Clock driver for Maxim 77686 MFD" depends on MFD_MAX77686 + select COMMON_CLK_MAX_GEN ---help--- This driver supports Maxim 77686 crystal oscillator clock.
drivers/clk/clk-max77686.c +8 -168
212 lines not on this page · raw message
Signature · 1 line
2.0.1
PATCH v9 4/6 clk: max77686: Improve Maxim 77686 PMIC clocks binding
In reply to Javier Martinez CanillasLike most clock drivers, the Maxim 77686 PMIC clock binding follows the convention that the "#clock-cells" property is used to specify the number of cells in a clock provider.
But the binding document is not clear enough that it shall be set to 1 since the PMIC support multiple clocks outputs.
Also, explain that the clocks identifiers are defined in a header file that can be included by Device Tree source with client nodes to avoid using magic numbers.
Finally, add "clock-output-names" as an optional property since now is supported by the clock driver.
---
Changes since v6: None
Changes since v5:
- Fix generic driver changes merged into max77802 clock patch by mistake. Suggested by Yadwinder Singh Brar.
- Register clock lookups using clk_register_clkdev() instead of doing manually.
- Use the managed devm_clk_register() function and remove clk un-registration.
- Add "clock-output-names" property support. Suggested by Yadwinder Singh Brar.
- Return the rate unconditionally in recalc_rate. Suggested by Mike Turquette.
Changes since v4: None
Changes since v3:
- Don't change clock-names property to make clear that it's the consumer clock name and should not match the producer clock. Suggested by Doug Anderson.
--- .../devicetree/bindings/clock/maxim,max77686.txt | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
Documentation/devicetree/bindings/clock/maxim,max77686.txt +12 -4
@@ -9,13 +9,21 @@ The MAX77686 contains three 32.768khz clock outputs that can be controlled Following properties should be presend in main device node of the MFD chip. Required properties: -- #clock-cells: simple one-cell clock specifier format is used, where the - only cell is used as an index of the clock inside the provider. Following - indices are allowed: + +- #clock-cells: from common clock binding; shall be set to 1. + +Optional properties: +- clock-output-names: From common clock binding. + +Each clock is assigned an identifier and client nodes can use this identifier +to specify the clock which they consume. Following indices are allowed: - 0: 32khz_ap clock, - 1: 32khz_cp clock, - 2: 32khz_pmic clock. +Clocks are defined as preprocessor macros in dt-bindings/clock/maxim,max77686.h +header and can be used in device tree sources. + Example: Node of the MFD chip max77686: max77686 at 09 {
@@ -34,5 +42,5 @@ Example: Clock consumer node compatible = "bar,foo"; /* ... */ clock-names = "my-clock"; - clocks = <&max77686 2>; + clocks = <&max77686 MAX77686_CLK_PMIC>; };
Signature · 1 line
2.0.1
PATCH v9 5/6 clk: Add driver for Maxim 77802 PMIC clocks
In reply to Javier Martinez CanillasThe MAX77802 PMIC has two 32.768kHz Buffered Clock Outputs with Low Jitter Mode. This patch adds support for these two clocks.
---
Changes since v6: None
Changes since v5: None
Changes since v4: None
Changes since v3: None
Changes since v2: None
Changes since v1:
- Use module_platform_driver() instead of having init/exit functions. Suggested by Mark Brown.
- Use the generic maxim clock driver to reduce code duplication with clk-max77686.c driver.
--- drivers/clk/Kconfig | 7 +++ drivers/clk/Makefile | 1 + drivers/clk/clk-max77802.c | 98 ++++++++++++++++++++++++++++++ include/dt-bindings/clock/maxim,max77802.h | 22 +++++++ 4 files changed, 128 insertions(+) create mode 100644 drivers/clk/clk-max77802.c create mode 100644 include/dt-bindings/clock/maxim,max77802.h
drivers/clk/Kconfig +7 -0
@@ -42,6 +42,13 @@ config COMMON_CLK_MAX77686 ---help--- This driver supports Maxim 77686 crystal oscillator clock. +config COMMON_CLK_MAX77802 + tristate "Clock driver for Maxim 77802 PMIC" + depends on MFD_MAX77686 + select COMMON_CLK_MAX_GEN + ---help--- + This driver supports Maxim 77802 crystal oscillator clock. + config COMMON_CLK_SI5351 tristate "Clock driver for SiLabs 5351A/B/C" depends on I2C
drivers/clk/Makefile +1 -0
@@ -24,6 +24,7 @@ obj-$(CONFIG_ARCH_HIGHBANK) += clk-highbank.o obj-$(CONFIG_MACH_LOONGSON1) += clk-ls1x.o obj-$(CONFIG_COMMON_CLK_MAX_GEN) += clk-max-gen.o obj-$(CONFIG_COMMON_CLK_MAX77686) += clk-max77686.o +obj-$(CONFIG_COMMON_CLK_MAX77802) += clk-max77802.o obj-$(CONFIG_ARCH_MOXART) += clk-moxart.o obj-$(CONFIG_ARCH_NOMADIK) += clk-nomadik.o obj-$(CONFIG_ARCH_NSPIRE) += clk-nspire.o
drivers/clk/clk-max77802.c new file +98 -0
98 lines not on this page · raw message
include/dt-bindings/clock/maxim,max77802.h new file +22 -0
@@ -0,0 +1,22 @@ +/* +* Copyright (C) 2014 Google, Inc +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +* +* Device Tree binding constants clocks for the Maxim 77802 PMIC. +*/ + +#ifndef _DT_BINDINGS_CLOCK_MAXIM_MAX77802_CLOCK_H +#define _DT_BINDINGS_CLOCK_MAXIM_MAX77802_CLOCK_H + +/* Fixed rate clocks. */ + +#define MAX77802_CLK_32K_AP 0 +#define MAX77802_CLK_32K_CP 1 + +/* Total number of clocks. */ +#define MAX77802_CLKS_NUM (MAX77802_CLK_32K_CP + 1) + +#endif /* _DT_BINDINGS_CLOCK_MAXIM_MAX77802_CLOCK_H */
Signature · 1 line
2.0.1
PATCH v9 6/6 clk: max77802: Add DT binding documentation
In reply to Javier Martinez CanillasAdd Device Tree binding documentation for the clocks outputs in the Maxim 77802 Power Management IC.
---
Changes since v6: None
Changes since v5:
- Fix typo error in DT binding. Suggested by Andreas Farber.
- Add "clock-output-names" as an optional property since now is supported.
Changes since v4: None
Changes since v3:
- Don't use the same clock driver name in clock-names since it's a consumer concept and most probably will be different. Suggested by Doug Anderson.
Changes since v2:
- Split the DT binding documentation in a separate patch.
--- .../devicetree/bindings/clock/maxim,max77802.txt | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/maxim,max77802.txt
Documentation/devicetree/bindings/clock/maxim,max77802.txt new file +44 -0
@@ -0,0 +1,44 @@ +Binding for Maxim MAX77802 32k clock generator block + +This is a part of device tree bindings of MAX77802 multi-function device. +More information can be found in bindings/mfd/max77802.txt file. + +The MAX77802 contains two 32.768khz clock outputs that can be controlled +(gated/ungated) over I2C. + +Following properties should be present in main device node of the MFD chip. + +Required properties: +- #clock-cells: From common clock binding; shall be set to 1. + +Optional properties: +- clock-output-names: From common clock binding. + +Each clock is assigned an identifier and client nodes can use this identifier +to specify the clock which they consume. Following indices are allowed: + - 0: 32khz_ap clock, + - 1: 32khz_cp clock. + +Clocks are defined as preprocessor macros in dt-bindings/clock/maxim,max77802.h +header and can be used in device tree sources. + +Example: Node of the MFD chip + + max77802: max77802 at 09 { + compatible = "maxim,max77802"; + interrupt-parent = <&wakeup_eint>; + interrupts = <26 0>; + reg = <0x09>; + #clock-cells = <1>; + + /* ... */ + }; + +Example: Clock consumer node + + foo at 0 { + compatible = "bar,foo"; + /* ... */ + clock-names = "my-clock"; + clocks = <&max77802 MAX77802_CLK_32K_AP>; + };
Signature · 1 line
2.0.1
Javier Martinez Canillas
maintainerHello Mike,
Quoted 7 lines · Javier Martinez Canillas
This series add support for the clocks present in the Maxim 77802 Power Managment IC. Previously, the series was part of a bigger one [0] that aimed to add support for all the devices in the max77802 PMIC. But now the Maxim 77802 PMIC dependencies were already merged for 3.17 so the series can be split and each driver can go through the relevant tree.
This series was first posted for 3.17 and you acked the whole set but it missed 3.17 because had as a dependency some changes in the max77802 mfd driver. Those dependencies made for 3.17 and that's why I re-posted it for 3.18 about a month ago.
Since we are in 3.17-rc4 already, I'm afraid that this series may miss 3.18 again, is there anything else you need from me to pick this series? It will obviously conflict with Tomeu's "Per-user clock constraints" series [0] so if you want I can rebase it on top of your clk-next-tomeu-kirkwood-v2 branch [1].
Thanks a lot and best regards,
Javier
[0]: https://lkml.org/lkml/2014/9/1/466
[1]: https://git.linaro.org/people/mike.turquette/linux.git/shortlog/refs/heads/clk-next-tomeu-kirkwood-v2
Quoting Javier Martinez Canillas (2014-09-07 23:49:28)
Quoted 17 lines
Hello Mike,
Quoted 7 lines · Javier Martinez Canillas
This series add support for the clocks present in the Maxim 77802 Power Managment IC. Previously, the series was part of a bigger one [0] that aimed to add support for all the devices in the max77802 PMIC. But now the Maxim 77802 PMIC dependencies were already merged for 3.17 so the series can be split and each driver can go through the relevant tree.
This series was first posted for 3.17 and you acked the whole set but it missed 3.17 because had as a dependency some changes in the max77802 mfd driver. Those dependencies made for 3.17 and that's why I re-posted it for 3.18 about a month ago.
Quoted 5 lines
Since we are in 3.17-rc4 already, I'm afraid that this series may miss 3.18 again, is there anything else you need from me to pick this series? It will obviously conflict with Tomeu's "Per-user clock constraints" series [0] so if you want I can rebase it on top of your clk-next-tomeu-kirkwood-v2 branch [1].
Thanks for pinging me about it. I've pulled this series into clk-next for 3.18. Everything is going to conflict with Tomeu's series so we'll just handle that when it comes to merge his series (which I've since removed from clk-next due to pending issues).
Regards,
Mike
Quoted 6 lines
Thanks a lot and best regards,
Javier[0]: https://lkml.org/lkml/2014/9/1/466
[1]: https://git.linaro.org/people/mike.turquette/linux.git/shortlog/refs/heads/clk-next-tomeu-kirkwood-v2
Hello Mike,
Quoted 8 lines · Mike Turquette
Quoting Javier Martinez Canillas (2014-09-07 23:49:28)
Quoted 6 lines
Since we are in 3.17-rc4 already, I'm afraid that this series may miss 3.18 again, is there anything else you need from me to pick this series? It will obviously conflict with Tomeu's "Per-user clock constraints" series [0] so if you want I can rebase it on top of your clk-next-tomeu-kirkwood-v2 branch [1].
Quoted 5 lines
Thanks for pinging me about it. I've pulled this series into clk-next for 3.18. Everything is going to conflict with Tomeu's series so we'll just handle that when it comes to merge his series (which I've since removed from clk-next due to pending issues).
Great, thanks a lot!
Quoted 3 lines
Regards,
Mike
Best regards,
Javier