* [PATCH 0/3] mfd: syscon: Add optional clock support needed on stm32 @ 2018-11-27 16:48 Fabrice Gasnier 2018-11-27 16:48 ` [PATCH 1/3] dt-bindings: mfd: syscon: Add optional clock support Fabrice Gasnier ` (2 more replies) 0 siblings, 3 replies; 6+ messages in thread From: Fabrice Gasnier @ 2018-11-27 16:48 UTC (permalink / raw) To: linux-arm-kernel STM32 syscfg registers are accessed using syscon. It needs syscfg clock to be enabled while accessing registers. This adds support for optional clock on syscon, and the relevant clock in stm32mp157 device tree. Fabrice Gasnier (3): dt-bindings: mfd: syscon: Add optional clock support mfd: syscon: Add optional clock support ARM: dts: stm32: Add clock on stm32mp157c syscfg Documentation/devicetree/bindings/mfd/syscon.txt | 1 + arch/arm/boot/dts/stm32mp157c.dtsi | 1 + drivers/mfd/syscon.c | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+) -- 1.9.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/3] dt-bindings: mfd: syscon: Add optional clock support 2018-11-27 16:48 [PATCH 0/3] mfd: syscon: Add optional clock support needed on stm32 Fabrice Gasnier @ 2018-11-27 16:48 ` Fabrice Gasnier 2018-12-11 22:16 ` Rob Herring 2018-11-27 16:48 ` [PATCH 2/3] " Fabrice Gasnier 2018-11-27 16:48 ` [PATCH 3/3] ARM: dts: stm32: Add clock on stm32mp157c syscfg Fabrice Gasnier 2 siblings, 1 reply; 6+ messages in thread From: Fabrice Gasnier @ 2018-11-27 16:48 UTC (permalink / raw) To: linux-arm-kernel Some system control registers need to be clocked, so the registers can be accessed. Add an optional clock. Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> --- Documentation/devicetree/bindings/mfd/syscon.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/mfd/syscon.txt b/Documentation/devicetree/bindings/mfd/syscon.txt index 25d9e9c..a9aaa51 100644 --- a/Documentation/devicetree/bindings/mfd/syscon.txt +++ b/Documentation/devicetree/bindings/mfd/syscon.txt @@ -17,6 +17,7 @@ Optional property: - reg-io-width: the size (in bytes) of the IO accesses that should be performed on the device. - hwlocks: reference to a phandle of a hardware spinlock provider node. +- clocks: phandle to the syscon clock Examples: gpr: iomuxc-gpr at 20e0000 { -- 1.9.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] dt-bindings: mfd: syscon: Add optional clock support 2018-11-27 16:48 ` [PATCH 1/3] dt-bindings: mfd: syscon: Add optional clock support Fabrice Gasnier @ 2018-12-11 22:16 ` Rob Herring 2018-12-12 8:18 ` Fabrice Gasnier 0 siblings, 1 reply; 6+ messages in thread From: Rob Herring @ 2018-12-11 22:16 UTC (permalink / raw) To: Fabrice Gasnier Cc: mark.rutland, devicetree, alexandre.torgue, arnd, linux-kernel, linux-stm32, mcoquelin.stm32, lee.jones, gabriel.fernandez, linux-arm-kernel On Tue, Nov 27, 2018 at 05:48:15PM +0100, Fabrice Gasnier wrote: > Some system control registers need to be clocked, so the registers can > be accessed. Add an optional clock. > > Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> > --- > Documentation/devicetree/bindings/mfd/syscon.txt | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/Documentation/devicetree/bindings/mfd/syscon.txt b/Documentation/devicetree/bindings/mfd/syscon.txt > index 25d9e9c..a9aaa51 100644 > --- a/Documentation/devicetree/bindings/mfd/syscon.txt > +++ b/Documentation/devicetree/bindings/mfd/syscon.txt > @@ -17,6 +17,7 @@ Optional property: > - reg-io-width: the size (in bytes) of the IO accesses that should be > performed on the device. > - hwlocks: reference to a phandle of a hardware spinlock provider node. > +- clocks: phandle to the syscon clock No. Add clocks to specific bindings using syscon. If you have a node with only 'syscon', then that should be fixed. Rob _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] dt-bindings: mfd: syscon: Add optional clock support 2018-12-11 22:16 ` Rob Herring @ 2018-12-12 8:18 ` Fabrice Gasnier 0 siblings, 0 replies; 6+ messages in thread From: Fabrice Gasnier @ 2018-12-12 8:18 UTC (permalink / raw) To: Rob Herring Cc: mark.rutland, devicetree, alexandre.torgue, arnd, linux-kernel, linux-stm32, mcoquelin.stm32, lee.jones, gabriel.fernandez, linux-arm-kernel On 12/11/18 11:16 PM, Rob Herring wrote: > On Tue, Nov 27, 2018 at 05:48:15PM +0100, Fabrice Gasnier wrote: >> Some system control registers need to be clocked, so the registers can >> be accessed. Add an optional clock. >> >> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> >> --- >> Documentation/devicetree/bindings/mfd/syscon.txt | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/Documentation/devicetree/bindings/mfd/syscon.txt b/Documentation/devicetree/bindings/mfd/syscon.txt >> index 25d9e9c..a9aaa51 100644 >> --- a/Documentation/devicetree/bindings/mfd/syscon.txt >> +++ b/Documentation/devicetree/bindings/mfd/syscon.txt >> @@ -17,6 +17,7 @@ Optional property: >> - reg-io-width: the size (in bytes) of the IO accesses that should be >> performed on the device. >> - hwlocks: reference to a phandle of a hardware spinlock provider node. >> +- clocks: phandle to the syscon clock > > No. Add clocks to specific bindings using syscon. If you have a node > with only 'syscon', then that should be fixed. Hi Rob, Thanks for reviewing, so I'll - add it to Documentation/devicetree/bindings/arm/stm32/stm32-syscon.txt - send a v2 with this change. Best regards, Fabrice > > Rob > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/3] mfd: syscon: Add optional clock support 2018-11-27 16:48 [PATCH 0/3] mfd: syscon: Add optional clock support needed on stm32 Fabrice Gasnier 2018-11-27 16:48 ` [PATCH 1/3] dt-bindings: mfd: syscon: Add optional clock support Fabrice Gasnier @ 2018-11-27 16:48 ` Fabrice Gasnier 2018-11-27 16:48 ` [PATCH 3/3] ARM: dts: stm32: Add clock on stm32mp157c syscfg Fabrice Gasnier 2 siblings, 0 replies; 6+ messages in thread From: Fabrice Gasnier @ 2018-11-27 16:48 UTC (permalink / raw) To: linux-arm-kernel Some system control registers need to be clocked, so the registers can be accessed. Add an optional clock and attach it to regmap. Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> --- drivers/mfd/syscon.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c index b6d05cd..a0ba4ff 100644 --- a/drivers/mfd/syscon.c +++ b/drivers/mfd/syscon.c @@ -12,6 +12,7 @@ * (at your option) any later version. */ +#include <linux/clk.h> #include <linux/err.h> #include <linux/hwspinlock.h> #include <linux/io.h> @@ -45,6 +46,7 @@ struct syscon { static struct syscon *of_syscon_register(struct device_node *np) { + struct clk *clk; struct syscon *syscon; struct regmap *regmap; void __iomem *base; @@ -119,6 +121,18 @@ static struct syscon *of_syscon_register(struct device_node *np) goto err_regmap; } + clk = of_clk_get(np, 0); + if (IS_ERR(clk)) { + ret = PTR_ERR(clk); + /* clock is optional */ + if (ret != -ENOENT) + goto err_clk; + } else { + ret = regmap_mmio_attach_clk(regmap, clk); + if (ret) + goto err_attach; + } + syscon->regmap = regmap; syscon->np = np; @@ -128,6 +142,11 @@ static struct syscon *of_syscon_register(struct device_node *np) return syscon; +err_attach: + if (!IS_ERR(clk)) + clk_put(clk); +err_clk: + regmap_exit(regmap); err_regmap: iounmap(base); err_map: -- 1.9.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] ARM: dts: stm32: Add clock on stm32mp157c syscfg 2018-11-27 16:48 [PATCH 0/3] mfd: syscon: Add optional clock support needed on stm32 Fabrice Gasnier 2018-11-27 16:48 ` [PATCH 1/3] dt-bindings: mfd: syscon: Add optional clock support Fabrice Gasnier 2018-11-27 16:48 ` [PATCH 2/3] " Fabrice Gasnier @ 2018-11-27 16:48 ` Fabrice Gasnier 2 siblings, 0 replies; 6+ messages in thread From: Fabrice Gasnier @ 2018-11-27 16:48 UTC (permalink / raw) To: linux-arm-kernel STM32 syscfg needs a clock to access registers. Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> --- arch/arm/boot/dts/stm32mp157c.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/boot/dts/stm32mp157c.dtsi b/arch/arm/boot/dts/stm32mp157c.dtsi index 8bf1c17..61b2a70 100644 --- a/arch/arm/boot/dts/stm32mp157c.dtsi +++ b/arch/arm/boot/dts/stm32mp157c.dtsi @@ -820,6 +820,7 @@ syscfg: syscon at 50020000 { compatible = "st,stm32mp157-syscfg", "syscon"; reg = <0x50020000 0x400>; + clocks = <&rcc SYSCFG>; }; lptimer2: timer at 50021000 { -- 1.9.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-12-12 8:19 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-11-27 16:48 [PATCH 0/3] mfd: syscon: Add optional clock support needed on stm32 Fabrice Gasnier 2018-11-27 16:48 ` [PATCH 1/3] dt-bindings: mfd: syscon: Add optional clock support Fabrice Gasnier 2018-12-11 22:16 ` Rob Herring 2018-12-12 8:18 ` Fabrice Gasnier 2018-11-27 16:48 ` [PATCH 2/3] " Fabrice Gasnier 2018-11-27 16:48 ` [PATCH 3/3] ARM: dts: stm32: Add clock on stm32mp157c syscfg Fabrice Gasnier
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).