clk: imx: Remove __init for imx_obtain_fixed_clk_hw() API
PATCH v2 1/5 clk: imx: Remove __init for imx_obtain_fixed_clk_hw() API
Some of i.MX SoCs' clock driver use platform driver model, and they need to call imx_obtain_fixed_clk_hw() API, so imx_obtain_fixed_clk_hw() API should NOT be in .init section.
---
New patch.
--- drivers/clk/imx/clk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/imx/clk.c +2 -2
@@ -94,8 +94,8 @@ struct clk_hw * __init imx_obtain_fixed_clock_hw(return __clk_get_hw (clk); } -struct clk_hw *__init imx_obtain_fixed_clk_hw (struct device_node *np, -const char *name) +struct clk_hw *imx_obtain_fixed_clk_hw (struct device_node *np, +const char *name) {struct clk *clk;
Signature · 1 line
2.7.4
PATCH v2 2/5 clk: imx: Add support for i.MX8M hw based clk provider
Add hw based provider support for i.MX8M composite clk, pll14xx clk and other gate/mux clk APIs, so that new added i.MX8M SoCs can use hw based clk provider.
---
New patch.
--- drivers/clk/imx/clk-composite-8m.c | 4 ++-- drivers/clk/imx/clk-pll14xx.c | 18 +++++++++------- drivers/clk/imx/clk.h | 42 +++++++++++++++++++++++++++++++++----- 3 files changed, 50 insertions(+), 14 deletions(-)
drivers/clk/imx/clk-composite-8m.c +2 -2
@@ -123,7 +123,7 @@ static const struct clk_ops imx8m_clk_composite_divider_ops = { .set_rate = imx8m_clk_composite_divider_set_rate, }; -struct clk *imx8m_clk_composite_flags (const char *name, +struct clk_hw *imx8m_clk_hw_composite_flags (const char *name,const char *const *parent_names,int num_parents,void __iomem *reg,unsigned long flags)
@@ -171,7 +171,7 @@ struct clk *imx8m_clk_composite_flags(const char *name,if (IS_ERR (hw)) goto fail; -return hw->clk; +return hw; fail:kfree (gate);
drivers/clk/imx/clk-pll14xx.c +11 -7
@@ -376,14 +376,15 @@ static const struct clk_ops clk_pll1443x_ops = { .set_rate = clk_pll1443x_set_rate, }; -struct clk *imx_clk_pll14xx (const char *name,const char *parent_name, +struct clk_hw *imx_clk_hw_pll14xx (const char *name,const char *parent_name,void __iomem *base,const struct imx_pll14xx_clk *pll_clk) {struct clk_pll14xx *pll; -struct clk *clk; +struct clk_hw *hw;struct clk_init_data init;u32 val; +int ret; pll =kzalloc (sizeof (*pll),GFP_KERNEL );if (!pll)
@@ -415,16 +416,19 @@ struct clk *imx_clk_pll14xx(const char *name, const char *parent_name, pll->rate_table = pll_clk->rate_table; pll->rate_count = pll_clk->rate_count; + hw = &pll->hw; + val =readl_relaxed (pll->base +GNRL_CTL ); val &= ~BYPASS_MASK ;writel_relaxed (val, pll->base +GNRL_CTL ); - clk =clk_register (NULL , &pll->hw); -if (IS_ERR (clk)) { -pr_err ("%s: failed to register pll %s %lu\n" , - __func__, name,PTR_ERR (clk)); + ret =clk_hw_register (NULL , hw); +if (ret) { +pr_err ("%s: failed to register pll %s %d\n" , + __func__, name, ret);kfree (pll); +return ERR_PTR (ret); } -return clk; +return hw; }
drivers/clk/imx/clk.h +37 -5
73 lines not on this page · raw message
Signature · 1 line
2.7.4
Peng Fan
reviewerRE: [PATCH V2 2/5] clk: imx: Add support for i.MX8M hw based clk provider
Quoted 6 lines
Subject: [PATCH V2 2/5] clk: imx: Add support for i.MX8M hw based clk provider
Add hw based provider support for i.MX8M composite clk, pll14xx clk and other gate/mux clk APIs, so that new added i.MX8M SoCs can use hw based clk provider.
i.MX8M hw composite clk has been in shawn's tree,
https://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux.git/
commit/?h=for-next&id=a4b431f8038a67222fde888a48bcbd704d2daca0
You might be using an old base?
Regards,
Peng.
Quoted 177 lines
Signed-off-by Anson Huang <[email protected]>---
New patch.--- drivers/clk/imx/clk-composite-8m.c | 4 ++-- drivers/clk/imx/clk-pll14xx.c | 18 +++++++++------- drivers/clk/imx/clk.h | 42 +++++++++++++++++++++++++++++++++----- 3 files changed, 50 insertions(+), 14 deletions(-)drivers/clk/imx/clk-composite-8m.c +1
-1@@ -123,7 +123,7 @@ static const struct clk_ops imx8m_clk_composite_divider_ops = { .set_rate = imx8m_clk_composite_divider_set_rate, }; -struct clk *imx8m_clk_composite_flags(const char *name, +struct clk_hw *imx8m_clk_hw_composite_flags(const char *name, const char * const *parent_names, int num_parents, void __iomem *reg,drivers/clk/imx/clk-composite-8m.c +1
-1unsigned long flags)@@ -171,7 +171,7 @@ struct clk *imx8m_clk_composite_flags(const char *name, if (IS_ERR(hw)) goto fail; -return hw->clk; +return hw; fail:drivers/clk/imx/clk-composite-8m.c +0
-0kfree (gate);drivers/clk/imx/clk-pll14xx.c index renamed from drivers/clk/imx/clk-pll14xx.c +0
-0e238427..db12fb6 100644
drivers/clk/imx/clk-pll14xx.c +12
-7@@ -376,14 +376,15 @@ static const struct clk_ops clk_pll1443x_ops = { .set_rate = clk_pll1443x_set_rate, }; -struct clk *imx_clk_pll14xx (const char *name,const char *parent_name, +struct clk_hw *imx_clk_hw_pll14xx (const char *name,const char +*parent_name,void __iomem *base,const struct imx_pll14xx_clk *pll_clk) {struct clk_pll14xx *pll; -struct clk *clk; +struct clk_hw *hw;struct clk_init_data init;u32 val; +int ret; pll =kzalloc (sizeof (*pll),GFP_KERNEL );if (!pll)@@ -415,16 +416,19 @@ struct clk *imx_clk_pll14xx(const char *name,const char *parent_name, pll->rate_table = pll_clk->rate_table; pll->rate_count = pll_clk->rate_count; + hw = &pll->hw; + val =readl_relaxed (pll->base +GNRL_CTL ); val &= ~BYPASS_MASK ;writel_relaxed (val, pll->base +GNRL_CTL ); - clk =clk_register (NULL , &pll->hw); -if (IS_ERR (clk)) { -pr_err ("%s: failed to register pll %s %lu\n" , - __func__, name,PTR_ERR (clk)); + ret =clk_hw_register (NULL , hw); +if (ret) { +pr_err ("%s: failed to register pll %s %d\n" , + __func__, name, ret);kfree (pll); +return ERR_PTR (ret); } -return clk; +return hw;}
drivers/clk/imx/clk.h index renamed from drivers/clk/imx/clk.h +0
-0afc7947..90f9ab8 100644
drivers/clk/imx/clk.h +8
-1@@ -123,8 +123,13 @@ extern struct imx_pll14xx_clk imx_1443x_dram_pll; bypass1, bypass2, base, flags) \to_clk (imx_clk_hw_sscg_pll (name ,parent_names ,num_parents ,parent ,\ bypass1, bypass2, base, flags)) +#define imx_clk_pll14xx (name, parent_name, base, pll_clk) \ + to_clk(imx_clk_hw_pll14xx(name, parent_name, base, pll_clk)) -struct clk *imx_clk_pll14xx(const char *name, const char *parent_name, +#define imx8m_clk_composite_flags (name, parent_names, num_parents, reg, flags) \ + to_clk(imx8m_clk_hw_composite_flags(name, parent_names, num_parents, +reg, flags)) + +struct clk_hw *imx_clk_hw_pll14xx (const char *name,const char +*parent_name,void __iomem *base,const struct imx_pll14xx_clk *pll_clk); struct clk_hw *imx_clk_hw_pllv1(enum imx_pllv1_type type, const char*name, @@ -388,6 +393,14 @@ static inline struct clk *imx_clk_gate4_flags(const char *name,
drivers/clk/imx/clk.h +1
-0reg, shift, 0x3, 0, &imx_ccm_lock, NULL); } +static inline struct clk_hw *imx_clk_hw_gate4_flags(const char *name, constchar *parent,
drivers/clk/imx/clk.h +5
-0+ void __iomem *reg, u8 shift, unsigned long flags) { + return clk_hw_register_gate2(NULL, name, parent, + flags | CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE, + reg, shift, 0x3, 0, &imx_ccm_lock, NULL); } + static inline struct clk_hw *imx_clk_hw_mux(const char *name, void
__iomem*reg,drivers/clk/imx/clk.h +10
-4u8 shift, u8 width, const char * const *parents, int num_parents)@@ -437,6 +450,15 @@ static inline struct clk *imx_clk_mux2_flags(constchar *name, reg, shift, width, 0, &imx_ccm_lock); } +static inline struct clk_hw *imx_clk_hw_mux2_flags (const char *name,void __iomem *reg, +u8 shift,u8 width,const char *const *parents, +int num_parents,unsigned long flags) { +return clk_hw_register_mux (NULL , name, parents, num_parents, + flags |CLK_SET_RATE_NO_REPARENT |CLK_OPS_PARENT_ENABLE , + reg, shift, width,0 , &imx_ccm_lock); } + static inline struct clk_hw *imx_clk_hw_mux_flags(const char *name, void __iomem *reg, u8 shift, u8 width,@@ -453,10 +475,9 @@ struct clk_hw *imx_clk_hw_cpu(const char *name,const char *parent_name, struct clk *div, struct clk *mux, struct clk *pll, struct clk *step); -struct clk *imx8m_clk_composite_flags (const char *name, -const char *const *parent_names, -int num_parents,void __iomem *reg, -unsigned long flags); +struct clk_hw *imx8m_clk_hw_composite_flags (const char *name, +const char *const *parent_names,int num_parents, +void __iomem *reg,unsigned long flags);#define __imx8m_clk_composite (name, parent_names, reg, flags) \imx8m_clk_composite_flags(name,
parent_names, \ @@ -469,6 +490,17
@@ struct clk *imx8m_clk_composite_flags(const char *name, #defineimx8m_clk_composite_critical(name, parent_names, reg)\drivers/clk/imx/clk.h +4
-0__imx8m_clk_composite(name, parent_names, reg, CLK_IS_CRITICAL) +#define __imx8m_clk_hw_composite (name, parent_names, reg, flags) \ + imx8m_clk_hw_composite_flags(name, parent_names, \ + ARRAY_SIZE(parent_names), reg, \ + flags | CLK_SET_RATE_NO_REPARENT |
CLK_OPS_PARENT_ENABLE)drivers/clk/imx/clk.h +6
-0+ +#define imx8m_clk_hw_composite (name, parent_names, reg) \ + __imx8m_clk_hw_composite(name, parent_names, reg, 0) + +#define imx8m_clk_hw_composite_critical (name, parent_names, reg) \ + __imx8m_clk_hw_composite(name, parent_names, reg,
CLK_IS_CRITICAL)
+
structclk_hw*imx_clk_hw_divider_gate(const char *name, const char*parent_name,drivers/clk/imx/clk.h +0
-1unsigned long flags, void __iomem *reg, u8 shift, u8 width, u8 clk_divider_flags, const struct clk_div_table *table, --2.7.4
RE: [PATCH V2 2/5] clk: imx: Add support for i.MX8M hw based clk provider
Quoted 9 lines
Quoted 8 lines
Subject: [PATCH V2 2/5] clk: imx: Add support for i.MX8M hw based clk provider
Add hw based provider support for i.MX8M composite clk, pll14xx clk and other gate/mux clk APIs, so that new added i.MX8M SoCs can use hw based clk provider.
Quoted 5 lines
i.MX8M hw composite clk has been in shawn's tree,
https://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux.git/
commit/?h=for-next&id=a4b431f8038a67222fde888a48bcbd704d2daca0You might be using an old base?
I used linux-next..., will redo the patch series based on Shawn's tree.
Thanks,
Anson
PATCH v2 3/5 dt-bindings: imx: Add clock binding doc for i.MX8MP
In reply to Anson HuangAdd the clock binding doc for i.MX8MP.
---
Changes since V1:
- Remove unuseful examples;
--- .../devicetree/bindings/clock/imx8mp-clock.yaml | 68 +++++ include/dt-bindings/clock/imx8mp-clock.h | 300 +++++++++++++++++++++ 2 files changed, 368 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/imx8mp-clock.yaml create mode 100644 include/dt-bindings/clock/imx8mp-clock.h
Documentation/devicetree/bindings/clock/imx8mp-clock.yaml new file +68 -0
@@ -0,0 +1,68 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/bindings/clock/imx8mp-clock.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NXP i.MX8M Plus Clock Control Module Binding + +maintainers: + - Anson Huang <[email protected]> + +description: + NXP i.MX8M Plus clock control module is an integrated clock controller, which + generates and supplies to all modules. + +properties: + compatible: + const: fsl,imx8mp-ccm + + reg: + maxItems: 1 + + clocks: + items: + - description: 32k osc + - description: 24m osc + - description: ext1 clock input + - description: ext2 clock input + - description: ext3 clock input + - description: ext4 clock input + + clock-names: + items: + - const: osc_32k + - const: osc_24m + - const: clk_ext1 + - const: clk_ext2 + - const: clk_ext3 + - const: clk_ext4 + + '#clock-cells': + const: 1 + description: + The clock consumer should specify the desired clock by having the clock + ID in its "clocks" phandle cell. See include/dt-bindings/clock/imx8mp-clock.h + for the full list of i.MX8M Plus clock IDs. + +required: + - compatible + - reg + - clocks + - clock-names + - '#clock-cells' + +examples: + # Clock Control Module node: + - | + clk: clock-controller@30380000 { + compatible = "fsl,imx8mp-ccm"; + reg = <0x30380000 0x10000>; + #clock-cells = <1>; + clocks = <&osc_32k>, <&osc_24m>, <&clk_ext1>, + <&clk_ext2>, <&clk_ext3>, <&clk_ext4>; + clock-names = "osc_32k", "osc_24m", "clk_ext1", + "clk_ext2", "clk_ext3", "clk_ext4"; + }; + +...
include/dt-bindings/clock/imx8mp-clock.h new file +300 -0
300 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v2 4/5 clk: imx: Add support for i.MX8MP clock driver
In reply to Anson HuangAdd clock driver support for i.MX8MP which is a new SoC of i.MX8M family.
---
Changes since V1:
- Remove unused head files and use clk-provider.h instead of clk.h;
- Switch to use hw based clk provider API;
- Move those ioremap to top of .probe function to save error handling;
- drop comma for after sentinel;
- Add const to clock parent array;
- Remove unnecessary clk parent set.
--- drivers/clk/imx/Kconfig | 6 + drivers/clk/imx/Makefile | 1 + drivers/clk/imx/clk-imx8mp.c | 764 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 771 insertions(+) create mode 100644 drivers/clk/imx/clk-imx8mp.c
drivers/clk/imx/Kconfig +6 -0
@@ -20,6 +20,12 @@ config CLK_IMX8MN help Build the driver for i.MX8MN CCM Clock Driver +config CLK_IMX8MP + bool "IMX8MP CCM Clock Driver" + depends on ARCH_MXC && ARM64 + help + Build the driver for i.MX8MP CCM Clock Driver + config CLK_IMX8MQ bool "IMX8MQ CCM Clock Driver" depends on ARCH_MXC && ARM64
drivers/clk/imx/Makefile +1 -0
@@ -27,6 +27,7 @@ obj-$(CONFIG_MXC_CLK_SCU) += \ obj-$(CONFIG_CLK_IMX8MM) += clk-imx8mm.o obj-$(CONFIG_CLK_IMX8MN) += clk-imx8mn.o +obj-$(CONFIG_CLK_IMX8MP) += clk-imx8mp.o obj-$(CONFIG_CLK_IMX8MQ) += clk-imx8mq.o obj-$(CONFIG_CLK_IMX8QXP) += clk-imx8qxp.o clk-imx8qxp-lpcg.o
drivers/clk/imx/clk-imx8mp.c new file +764 -0
764 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v2 5/5 arm64: defconfig: Enable CONFIG_CLK_IMX8MP by default
In reply to Anson HuangSelect CONFIG_CLK_IMX8MP by default to support i.MX8MP clock driver.
---
No change.
--- arch/arm64/configs/defconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm64/configs/defconfig +1 -0
@@ -701,6 +701,7 @@ CONFIG_COMMON_CLK_PWM=y CONFIG_CLK_RASPBERRYPI=m CONFIG_CLK_IMX8MM=y CONFIG_CLK_IMX8MN=y +CONFIG_CLK_IMX8MP=y CONFIG_CLK_IMX8MQ=y CONFIG_CLK_IMX8QXP=y CONFIG_TI_SCI_CLK=y
Signature · 1 line
2.7.4