Support building i.MX ARMv7/ARMv8 platforms clock driver as module
Subsystems (3)
v5 cover Support building i.MX ARMv7/ARMv8 platforms clock driver as module
Nowdays, there are more and more requirements of building SoC specific drivers as modules, such as Android GKI (generic kernel image), this patch set supports building i.MX ARMv6/ARMv7 SoCs clock drivers as modules,
The CLK_IMXxxx is introduced for i.MX ARMv7 platforms in order to support various build options, and i.MX1/2/3 platforms now still ONLY support built-in as they are rarely used now.
Changes since V4:
- add empty function of imx_register_uart_clocks() for MODULE build, then all earlycon related clock handler can be built-out for MODULE;
- add module build support for ARMv7 platforms, also add COMPILE_TEST for them;
- add COMPILE_TEST for ARMv8 platforms;
- keep using builtin_platform_driver() for i.MX8QXP clock driver.
Anson Huang (6):
clk: composite: Export clk_hw_register_composite()
clk: imx: Support module build for i.MX5/6/7 and vf610
clk: imx: Support building i.MX common clock driver as module
clk: imx: Add clock configuration for ARMv7 platforms
clk: imx8m: Support module build
clk: imx8qxp: Support building i.MX8QXP clock driver as module
drivers/clk/clk-composite.c | 1 + drivers/clk/imx/Kconfig | 101 ++++++++++++++++++++++++++++++++----- drivers/clk/imx/Makefile | 79 ++++++++++++++--------------- drivers/clk/imx/clk-composite-8m.c | 2 + drivers/clk/imx/clk-cpu.c | 2 + drivers/clk/imx/clk-frac-pll.c | 2 + drivers/clk/imx/clk-gate2.c | 2 + drivers/clk/imx/clk-imx5.c | 5 ++ drivers/clk/imx/clk-imx6q.c | 5 ++ drivers/clk/imx/clk-imx6sl.c | 5 ++ drivers/clk/imx/clk-imx6sll.c | 5 ++ drivers/clk/imx/clk-imx6sx.c | 5 ++ drivers/clk/imx/clk-imx6ul.c | 5 ++ drivers/clk/imx/clk-imx7d.c | 5 ++ drivers/clk/imx/clk-imx7ulp.c | 5 ++ drivers/clk/imx/clk-imx8mm.c | 4 ++ drivers/clk/imx/clk-imx8mn.c | 4 ++ drivers/clk/imx/clk-imx8mp.c | 4 ++ drivers/clk/imx/clk-imx8mq.c | 4 ++ drivers/clk/imx/clk-imx8qxp-lpcg.c | 4 ++ drivers/clk/imx/clk-imx8qxp.c | 4 ++ drivers/clk/imx/clk-pll14xx.c | 5 ++ drivers/clk/imx/clk-sscg-pll.c | 2 + drivers/clk/imx/clk-vf610.c | 5 ++ drivers/clk/imx/clk.c | 17 +++++-- drivers/clk/imx/clk.h | 6 +++ 26 files changed, 231 insertions(+), 57 deletions(-)
Signature · 1 line
2.7.4
PATCH v5 1/6 clk: composite: Export clk_hw_register_composite()
Export clk_hw_register_composite() to support user built as module.
ERROR: modpost: "clk_hw_register_composite" [drivers/clk/imx/mxc-clk.ko] undefined!
---
No change.
--- drivers/clk/clk-composite.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/clk-composite.c +1 -0
@@ -328,6 +328,7 @@ struct clk_hw *clk_hw_register_composite(struct device *dev, const char *name, rate_hw, rate_ops, gate_hw, gate_ops, flags); } +EXPORT_SYMBOL_GPL (clk_hw_register_composite); struct clk_hw *clk_hw_register_composite_pdata(struct device *dev, const char *name,
Signature · 1 line
2.7.4
PATCH v5 2/6 clk: imx: Support module build for i.MX5/6/7 and vf610
In reply to Anson HuangAdd module author, description and license to support module build for i.MX5/6/7 and vf610 SoCs.
---
New patch.
--- drivers/clk/imx/clk-imx5.c | 5 +++++ drivers/clk/imx/clk-imx6q.c | 5 +++++ drivers/clk/imx/clk-imx6sl.c | 5 +++++ drivers/clk/imx/clk-imx6sll.c | 5 +++++ drivers/clk/imx/clk-imx6sx.c | 5 +++++ drivers/clk/imx/clk-imx6ul.c | 5 +++++ drivers/clk/imx/clk-imx7d.c | 5 +++++ drivers/clk/imx/clk-imx7ulp.c | 5 +++++ drivers/clk/imx/clk-vf610.c | 5 +++++ 9 files changed, 45 insertions(+)
drivers/clk/imx/clk-imx5.c +5 -0
@@ -9,6 +9,7 @@#include <linux/clkdev.h> #include <linux/clk-provider.h> #include <linux/err.h> +#include <linux/module.h> #include <linux/of.h> #include <linux/of_address.h> #include <linux/of_irq.h>
@@ -636,3 +637,7 @@ static void __init mx53_clocks_init(struct device_node *np)imx_register_uart_clocks (uart_clks_mx50_mx53); }CLK_OF_DECLARE (imx53_ccm,"fsl,imx53-ccm" , mx53_clocks_init); + +MODULE_AUTHOR ("Shawn Guo <[email protected]>" ); +MODULE_DESCRIPTION ("NXP i.MX5 clock driver" ); +MODULE_LICENSE ("GPL v2" );
drivers/clk/imx/clk-imx6q.c +5 -0
@@ -11,6 +11,7 @@#include <linux/clk-provider.h> #include <linux/err.h> #include <linux/io.h> +#include <linux/module.h> #include <linux/of.h> #include <linux/of_address.h> #include <linux/of_irq.h>
@@ -990,3 +991,7 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)imx_register_uart_clocks (uart_clks); }CLK_OF_DECLARE (imx6q,"fsl,imx6q-ccm" , imx6q_clocks_init); + +MODULE_AUTHOR ("Shawn Guo <[email protected]>" ); +MODULE_DESCRIPTION ("NXP i.MX6Q clock driver" ); +MODULE_LICENSE ("GPL v2" );
drivers/clk/imx/clk-imx6sl.c +5 -0
@@ -6,6 +6,7 @@#include <linux/clk.h> #include <linux/clkdev.h> #include <linux/err.h> +#include <linux/module.h> #include <linux/of.h> #include <linux/of_address.h> #include <linux/of_irq.h>
@@ -455,3 +456,7 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node)imx_register_uart_clocks (uart_clks); }CLK_OF_DECLARE (imx6sl,"fsl,imx6sl-ccm" , imx6sl_clocks_init); + +MODULE_AUTHOR ("Shawn Guo <[email protected]>" ); +MODULE_DESCRIPTION ("NXP i.MX6SL clock driver" ); +MODULE_LICENSE ("GPL v2" );
drivers/clk/imx/clk-imx6sll.c +5 -0
@@ -11,6 +11,7 @@#include <linux/err.h> #include <linux/init.h> #include <linux/io.h> +#include <linux/module.h> #include <linux/of.h> #include <linux/of_address.h>
@@ -376,3 +377,7 @@ static void __init imx6sll_clocks_init(struct device_node *ccm_node)clk_set_rate (hws[IMX6SLL_CLK_AHB ]->clk,132000000 ); }CLK_OF_DECLARE_DRIVER (imx6sll,"fsl,imx6sll-ccm" , imx6sll_clocks_init); + +MODULE_AUTHOR ("Shawn Guo <[email protected]>" ); +MODULE_DESCRIPTION ("NXP i.MX6SLL clock driver" ); +MODULE_LICENSE ("GPL v2" );
drivers/clk/imx/clk-imx6sx.c +5 -0
@@ -10,6 +10,7 @@#include <linux/err.h> #include <linux/init.h> #include <linux/io.h> +#include <linux/module.h> #include <linux/of.h> #include <linux/of_address.h> #include <linux/of_irq.h>
@@ -564,3 +565,7 @@ static void __init imx6sx_clocks_init(struct device_node *ccm_node)imx_register_uart_clocks (uart_clks); }CLK_OF_DECLARE (imx6sx,"fsl,imx6sx-ccm" , imx6sx_clocks_init); + +MODULE_AUTHOR ("Shawn Guo <[email protected]>" ); +MODULE_DESCRIPTION ("NXP i.MX6SX clock driver" ); +MODULE_LICENSE ("GPL v2" );
drivers/clk/imx/clk-imx6ul.c +5 -0
@@ -10,6 +10,7 @@#include <linux/err.h> #include <linux/init.h> #include <linux/io.h> +#include <linux/module.h> #include <linux/of.h> #include <linux/of_address.h> #include <linux/of_irq.h>
@@ -513,3 +514,7 @@ static void __init imx6ul_clocks_init(struct device_node *ccm_node) }CLK_OF_DECLARE (imx6ul,"fsl,imx6ul-ccm" , imx6ul_clocks_init); + +MODULE_AUTHOR ("Frank Li <[email protected]>" ); +MODULE_DESCRIPTION ("NXP i.MX6UL clock driver" ); +MODULE_LICENSE ("GPL v2" );
drivers/clk/imx/clk-imx7d.c +5 -0
@@ -10,6 +10,7 @@#include <linux/err.h> #include <linux/init.h> #include <linux/io.h> +#include <linux/module.h> #include <linux/of.h> #include <linux/of_address.h> #include <linux/of_irq.h>
@@ -906,3 +907,7 @@ static void __init imx7d_clocks_init(struct device_node *ccm_node) }CLK_OF_DECLARE (imx7d,"fsl,imx7d-ccm" , imx7d_clocks_init); + +MODULE_AUTHOR ("Frank Li <[email protected]>" ); +MODULE_DESCRIPTION ("NXP i.MX7D clock driver" ); +MODULE_LICENSE ("GPL v2" );
drivers/clk/imx/clk-imx7ulp.c +5 -0
@@ -12,6 +12,7 @@#include <linux/err.h> #include <linux/init.h> #include <linux/io.h> +#include <linux/module.h> #include <linux/of.h> #include <linux/of_address.h> #include <linux/platform_device.h>
@@ -279,3 +280,7 @@ static void __init imx7ulp_clk_smc1_init(struct device_node *np)of_clk_add_hw_provider (np, of_clk_hw_onecell_get, clk_data); }CLK_OF_DECLARE (imx7ulp_clk_smc1,"fsl,imx7ulp-smc1" , imx7ulp_clk_smc1_init); + +MODULE_AUTHOR ("A.s. Dong <[email protected]>" ); +MODULE_DESCRIPTION ("NXP i.MX7ULP clock driver" ); +MODULE_LICENSE ("GPL v2" );
drivers/clk/imx/clk-vf610.c +5 -0
@@ -5,6 +5,7 @@#include <linux/of_address.h> #include <linux/clk.h> +#include <linux/module.h> #include <linux/syscore_ops.h> #include <dt-bindings/clock/vf610-clock.h>
@@ -468,3 +469,7 @@ static void __init vf610_clocks_init(struct device_node *ccm_node)of_clk_add_provider (np, of_clk_src_onecell_get, &clk_data); }CLK_OF_DECLARE (vf610,"fsl,vf610-ccm" , vf610_clocks_init); + +MODULE_AUTHOR ("Shawn Guo <[email protected]>" ); +MODULE_DESCRIPTION ("NXP VF610 clock driver" ); +MODULE_LICENSE ("GPL v2" );
Signature · 1 line
2.7.4
PATCH v5 3/6 clk: imx: Support building i.MX common clock driver as module
In reply to Anson HuangThere are more and more requirements of building SoC specific drivers as modules, add support for building i.MX common clock driver as module to meet the requirement.
---
Changes since V4:
- add empty function of imx_register_uart_clocks() for MODULE build, and exclude all uart clock related handler when building MODULE.
--- drivers/clk/imx/Kconfig | 8 ++++++-- drivers/clk/imx/Makefile | 40 +++++++++++++++++++------------------- drivers/clk/imx/clk-composite-8m.c | 2 ++ drivers/clk/imx/clk-cpu.c | 2 ++ drivers/clk/imx/clk-frac-pll.c | 2 ++ drivers/clk/imx/clk-gate2.c | 2 ++ drivers/clk/imx/clk-pll14xx.c | 5 +++++ drivers/clk/imx/clk-sscg-pll.c | 2 ++ drivers/clk/imx/clk.c | 17 ++++++++++++---- drivers/clk/imx/clk.h | 6 ++++++ 10 files changed, 60 insertions(+), 26 deletions(-)
drivers/clk/imx/Kconfig +6 -2
@@ -1,8 +1,8 @@ # SPDX-License-Identifier: GPL-2.0 # common clock support for NXP i.MX SoC family. config MXC_CLK - bool - def_bool ARCH_MXC + tristate "IMX clock" + depends on ARCH_MXC config MXC_CLK_SCU bool
@@ -11,24 +11,28 @@ config MXC_CLK_SCU config CLK_IMX8MM bool "IMX8MM CCM Clock Driver" depends on ARCH_MXC + select MXC_CLK help Build the driver for i.MX8MM CCM Clock Driver config CLK_IMX8MN bool "IMX8MN CCM Clock Driver" depends on ARCH_MXC + select MXC_CLK help Build the driver for i.MX8MN CCM Clock Driver config CLK_IMX8MP bool "IMX8MP CCM Clock Driver" depends on ARCH_MXC + select MXC_CLK help Build the driver for i.MX8MP CCM Clock Driver config CLK_IMX8MQ bool "IMX8MQ CCM Clock Driver" depends on ARCH_MXC + select MXC_CLK help Build the driver for i.MX8MQ CCM Clock Driver
drivers/clk/imx/Makefile +20 -20
@@ -1,25 +1,25 @@ # SPDX-License-Identifier: GPL-2.0 -obj-$(CONFIG_MXC_CLK) += \ - clk.o \ - clk-busy.o \ - clk-composite-8m.o \ - clk-cpu.o \ - clk-composite-7ulp.o \ - clk-divider-gate.o \ - clk-fixup-div.o \ - clk-fixup-mux.o \ - clk-frac-pll.o \ - clk-gate-exclusive.o \ - clk-gate2.o \ - clk-pfd.o \ - clk-pfdv2.o \ - clk-pllv1.o \ - clk-pllv2.o \ - clk-pllv3.o \ - clk-pllv4.o \ - clk-sscg-pll.o \ - clk-pll14xx.o +mxc-clk-objs += clk.o +mxc-clk-objs += clk-busy.o +mxc-clk-objs += clk-composite-7ulp.o +mxc-clk-objs += clk-composite-8m.o +mxc-clk-objs += clk-cpu.o +mxc-clk-objs += clk-divider-gate.o +mxc-clk-objs += clk-fixup-div.o +mxc-clk-objs += clk-fixup-mux.o +mxc-clk-objs += clk-frac-pll.o +mxc-clk-objs += clk-gate2.o +mxc-clk-objs += clk-gate-exclusive.o +mxc-clk-objs += clk-pfd.o +mxc-clk-objs += clk-pfdv2.o +mxc-clk-objs += clk-pllv1.o +mxc-clk-objs += clk-pllv2.o +mxc-clk-objs += clk-pllv3.o +mxc-clk-objs += clk-pllv4.o +mxc-clk-objs += clk-pll14xx.o +mxc-clk-objs += clk-sscg-pll.o +obj-$(CONFIG_MXC_CLK) += mxc-clk.o obj-$(CONFIG_MXC_CLK_SCU) += \ clk-scu.o \
drivers/clk/imx/clk-composite-8m.c +2 -0
@@ -5,6 +5,7 @@#include <linux/clk-provider.h> #include <linux/errno.h> +#include <linux/export.h> #include <linux/io.h> #include <linux/slab.h>
@@ -243,3 +244,4 @@ struct clk_hw *imx8m_clk_hw_composite_flags(const char *name,kfree (mux);return ERR_CAST (hw); } +EXPORT_SYMBOL_GPL (imx8m_clk_hw_composite_flags);
drivers/clk/imx/clk-cpu.c +2 -0
@@ -5,6 +5,7 @@#include <linux/clk.h> #include <linux/clk-provider.h> +#include <linux/export.h> #include <linux/slab.h> #include "clk.h"
@@ -104,3 +105,4 @@ struct clk_hw *imx_clk_hw_cpu(const char *name, const char *parent_name,return hw; } +EXPORT_SYMBOL_GPL (imx_clk_hw_cpu);
drivers/clk/imx/clk-frac-pll.c +2 -0
@@ -10,6 +10,7 @@#include <linux/clk-provider.h> #include <linux/err.h> +#include <linux/export.h> #include <linux/io.h> #include <linux/iopoll.h> #include <linux/slab.h>
@@ -233,3 +234,4 @@ struct clk_hw *imx_clk_hw_frac_pll(const char *name,return hw; } +EXPORT_SYMBOL_GPL (imx_clk_hw_frac_pll);
drivers/clk/imx/clk-gate2.c +2 -0
@@ -7,6 +7,7 @@*/ #include <linux/clk-provider.h> +#include <linux/export.h> #include <linux/module.h> #include <linux/slab.h> #include <linux/io.h>
@@ -177,3 +178,4 @@ struct clk_hw *clk_hw_register_gate2(struct device *dev, const char *name,return hw; } +EXPORT_SYMBOL_GPL (clk_hw_register_gate2);
drivers/clk/imx/clk-pll14xx.c +5 -0
@@ -6,6 +6,7 @@#include <linux/bitops.h> #include <linux/clk-provider.h> #include <linux/err.h> +#include <linux/export.h> #include <linux/io.h> #include <linux/iopoll.h> #include <linux/slab.h>
@@ -68,6 +69,7 @@ struct imx_pll14xx_clk imx_1443x_pll = { .rate_table = imx_pll1443x_tbl, .rate_count = ARRAY_SIZE(imx_pll1443x_tbl), }; +EXPORT_SYMBOL_GPL (imx_1443x_pll);struct imx_pll14xx_clk imx_1443x_dram_pll = { .type =PLL_1443X ,
@@ -75,12 +77,14 @@ struct imx_pll14xx_clk imx_1443x_dram_pll = { .rate_count = ARRAY_SIZE(imx_pll1443x_tbl), .flags = CLK_GET_RATE_NOCACHE, }; +EXPORT_SYMBOL_GPL (imx_1443x_dram_pll);struct imx_pll14xx_clk imx_1416x_pll = { .type =PLL_1416X , .rate_table = imx_pll1416x_tbl, .rate_count =ARRAY_SIZE (imx_pll1416x_tbl), }; +EXPORT_SYMBOL_GPL (imx_1416x_pll);static const struct imx_pll14xx_rate_table *imx_get_pll_settings (struct clk_pll14xx *pll,unsigned long rate)
@@ -436,3 +440,4 @@ struct clk_hw *imx_dev_clk_hw_pll14xx(struct device *dev, const char *name,return hw; } +EXPORT_SYMBOL_GPL (imx_dev_clk_hw_pll14xx);
drivers/clk/imx/clk-sscg-pll.c +2 -0
@@ -10,6 +10,7 @@#include <linux/clk-provider.h> #include <linux/err.h> +#include <linux/export.h> #include <linux/io.h> #include <linux/iopoll.h> #include <linux/slab.h>
@@ -537,3 +538,4 @@ struct clk_hw *imx_clk_hw_sscg_pll(const char *name,return hw; } +EXPORT_SYMBOL_GPL (imx_clk_hw_sscg_pll);
drivers/clk/imx/clk.c +13 -4
@@ -3,6 +3,7 @@#include <linux/clk-provider.h> #include <linux/err.h> #include <linux/io.h> +#include <linux/module.h> #include <linux/of.h> #include <linux/slab.h> #include <linux/spinlock.h>
@@ -13,6 +14,7 @@#define CCDR_MMDC_CH1_MASK BIT(16)DEFINE_SPINLOCK (imx_ccm_lock); +EXPORT_SYMBOL_GPL (imx_ccm_lock);void imx_unregister_clocks (struct clk *clks[],unsigned int count) {
@@ -29,8 +31,9 @@ void imx_unregister_hw_clocks(struct clk_hw *hws[], unsigned int count)for (i =0 ; i < count; i++)clk_hw_unregister (hws[i]); } +EXPORT_SYMBOL_GPL (imx_unregister_hw_clocks); -void __init imx_mmdc_mask_handshake (void __iomem *ccm_base, +void imx_mmdc_mask_handshake (void __iomem *ccm_base,unsigned int chn) {unsigned int reg;
@@ -59,8 +62,9 @@ void imx_check_clk_hws(struct clk_hw *clks[], unsigned int count)pr_err ("i.MX clk %u: register failed with %ld\n" , i,PTR_ERR (clks[i])); } +EXPORT_SYMBOL_GPL (imx_check_clk_hws); -static struct clk *__init imx_obtain_fixed_clock_from_dt (const char *name) +static struct clk *imx_obtain_fixed_clock_from_dt (const char *name) {struct of_phandle_args phandle;struct clk *clk =ERR_PTR (-ENODEV );
@@ -80,7 +84,7 @@ static struct clk * __init imx_obtain_fixed_clock_from_dt(const char *name)return clk; } -struct clk *__init imx_obtain_fixed_clock ( +struct clk *imx_obtain_fixed_clock (const char *name,unsigned long rate) {struct clk *clk;
@@ -91,7 +95,7 @@ struct clk * __init imx_obtain_fixed_clock(return clk; } -struct clk_hw *__init imx_obtain_fixed_clock_hw ( +struct clk_hw *imx_obtain_fixed_clock_hw (const char *name,unsigned long rate) {struct clk *clk;
@@ -113,6 +117,7 @@ struct clk_hw * imx_obtain_fixed_clk_hw(struct device_node *np,return __clk_get_hw (clk); } +EXPORT_SYMBOL_GPL (imx_obtain_fixed_clk_hw);/* * This fixups the register CCM_CSCMR1 write value.
@@ -140,6 +145,7 @@ void imx_cscmr1_fixup(u32 *val)return ; } +#ifndef MODULE static int imx_keep_uart_clocks;static struct clk **const *imx_uart_clocks;
@@ -177,3 +183,6 @@ static int __init imx_clk_disable_uart(void) return 0; }late_initcall_sync (imx_clk_disable_uart); +#endif + +MODULE_LICENSE ("GPL v2" );
drivers/clk/imx/clk.h +6 -0
@@ -11,7 +11,13 @@ extern spinlock_t imx_ccm_lock;void imx_check_clocks (struct clk *clks[],unsigned int count);void imx_check_clk_hws (struct clk_hw *clks[],unsigned int count); +#ifndef MODULE void imx_register_uart_clocks (struct clk **const clks[]); +#else +static inline void imx_register_uart_clocks (struct clk **const clks[]) +{ +} +#endif void imx_mmdc_mask_handshake (void __iomem *ccm_base,unsigned int chn);void imx_unregister_clocks (struct clk *clks[],unsigned int count);void imx_unregister_hw_clocks (struct clk_hw *hws[],unsigned int count);
Signature · 1 line
2.7.4
PATCH v5 5/6 clk: imx8m: Support module build
In reply to Anson HuangChange configuration to "tristate", add module author, description and license to support building i.MX8M SoCs clock driver as module.
--- drivers/clk/imx/Kconfig | 16 ++++++++-------- drivers/clk/imx/clk-imx8mm.c | 4 ++++ drivers/clk/imx/clk-imx8mn.c | 4 ++++ drivers/clk/imx/clk-imx8mp.c | 4 ++++ drivers/clk/imx/clk-imx8mq.c | 4 ++++ 5 files changed, 24 insertions(+), 8 deletions(-)
drivers/clk/imx/Kconfig +8 -8
@@ -78,29 +78,29 @@ config CLK_VF610 select MXC_CLK config CLK_IMX8MM - bool "IMX8MM CCM Clock Driver" - depends on ARCH_MXC + tristate "IMX8MM CCM Clock Driver" + depends on ARCH_MXC || COMPILE_TEST select MXC_CLK help Build the driver for i.MX8MM CCM Clock Driver config CLK_IMX8MN - bool "IMX8MN CCM Clock Driver" - depends on ARCH_MXC + tristate "IMX8MN CCM Clock Driver" + depends on ARCH_MXC || COMPILE_TEST select MXC_CLK help Build the driver for i.MX8MN CCM Clock Driver config CLK_IMX8MP - bool "IMX8MP CCM Clock Driver" - depends on ARCH_MXC + tristate "IMX8MP CCM Clock Driver" + depends on ARCH_MXC || COMPILE_TEST select MXC_CLK help Build the driver for i.MX8MP CCM Clock Driver config CLK_IMX8MQ - bool "IMX8MQ CCM Clock Driver" - depends on ARCH_MXC + tristate "IMX8MQ CCM Clock Driver" + depends on ARCH_MXC || COMPILE_TEST select MXC_CLK help Build the driver for i.MX8MQ CCM Clock Driver
drivers/clk/imx/clk-imx8mm.c +4 -0
@@ -657,3 +657,7 @@ static struct platform_driver imx8mm_clk_driver = { }, };module_platform_driver (imx8mm_clk_driver); + +MODULE_AUTHOR ("Bai Ping <[email protected]>" ); +MODULE_DESCRIPTION ("NXP i.MX8MM clock driver" ); +MODULE_LICENSE ("GPL v2" );
drivers/clk/imx/clk-imx8mn.c +4 -0
@@ -608,3 +608,7 @@ static struct platform_driver imx8mn_clk_driver = { }, };module_platform_driver (imx8mn_clk_driver); + +MODULE_AUTHOR ("Anson Huang <[email protected]>" ); +MODULE_DESCRIPTION ("NXP i.MX8MN clock driver" ); +MODULE_LICENSE ("GPL v2" );
drivers/clk/imx/clk-imx8mp.c +4 -0
@@ -773,3 +773,7 @@ static struct platform_driver imx8mp_clk_driver = { }, };module_platform_driver (imx8mp_clk_driver); + +MODULE_AUTHOR ("Anson Huang <[email protected]>" ); +MODULE_DESCRIPTION ("NXP i.MX8MP clock driver" ); +MODULE_LICENSE ("GPL v2" );
drivers/clk/imx/clk-imx8mq.c +4 -0
@@ -643,3 +643,7 @@ static struct platform_driver imx8mq_clk_driver = { }, };module_platform_driver (imx8mq_clk_driver); + +MODULE_AUTHOR ("Abel Vesa <[email protected]>" ); +MODULE_DESCRIPTION ("NXP i.MX8MQ clock driver" ); +MODULE_LICENSE ("GPL v2" );
Signature · 1 line
2.7.4
PATCH v5 4/6 clk: imx: Add clock configuration for ARMv7 platforms
In reply to Anson HuangAdd CONFIG_CLK_xxx for i.MX ARMv7 platforms, and use it as build option instead of CONFIG_SOC_xxx, the CONFIG_CLK_xxx will be selected by default according to CONFIG_SOC_xxx, COMPILE_TEST will be also supported.
---
Changes since V4:
- remove COMPILE_TEST support for i.MX1/2/3;
- add COMPILE_TEST support for i.MX ARMv7 platform ONLY when the corresponding SOC config is NOT set.
--- drivers/clk/imx/Kconfig | 71 +++++++++++++++++++++++++++++++++++++++++++++++- drivers/clk/imx/Makefile | 30 ++++++++++---------- 2 files changed, 85 insertions(+), 16 deletions(-)
drivers/clk/imx/Kconfig +70 -1
@@ -2,12 +2,81 @@ # common clock support for NXP i.MX SoC family. config MXC_CLK tristate "IMX clock" - depends on ARCH_MXC + depends on ARCH_MXC || COMPILE_TEST config MXC_CLK_SCU bool depends on IMX_SCU +config CLK_IMX1 + def_bool SOC_IMX1 + select CLK_MXC + +config CLK_IMX21 + def_bool SOC_IMX21 + select CLK_MXC + +config CLK_IMX25 + def_bool SOC_IMX25 + select CLK_MXC + +config CLK_IMX27 + def_bool SOC_IMX27 + select CLK_MXC + +config CLK_IMX31 + def_bool SOC_IMX31 + select CLK_MXC + +config CLK_IMX35 + def_bool SOC_IMX35 + select CLK_MXC + +config CLK_IMX5 + tristate "IMX5 CCM Clock Driver" if COMPILE_TEST && !SOC_IMX5 + default SOC_IMX5 + select MXC_CLK + +config CLK_IMX6Q + tristate "IMX6Q CCM Clock Driver" if COMPILE_TEST && !SOC_IMX6Q + default SOC_IMX6Q + select MXC_CLK + +config CLK_IMX6SL + tristate "IMX6SL CCM Clock Driver" if COMPILE_TEST && !SOC_IMX6SL + default SOC_IMX6SL + select MXC_CLK + +config CLK_IMX6SLL + tristate "IMX6SLL CCM Clock Driver" if COMPILE_TEST && !SOC_IMX6SLL + default SOC_IMX6SLL + select MXC_CLK + +config CLK_IMX6SX + tristate "IMX6SX CCM Clock Driver" if COMPILE_TEST && !SOC_IMX6SX + default SOC_IMX6SX + select MXC_CLK + +config CLK_IMX6UL + tristate "IMX6UL CCM Clock Driver" if COMPILE_TEST && !SOC_IMX6UL + default SOC_IMX6UL + select MXC_CLK + +config CLK_IMX7D + tristate "IMX7D CCM Clock Driver" if COMPILE_TEST && !SOC_IMX7D + default SOC_IMX7D + select MXC_CLK + +config CLK_IMX7ULP + tristate "IMX7ULP Clock Driver" if COMPILE_TEST && !SOC_IMX7ULP + default SOC_IMX7ULP + select MXC_CLK + +config CLK_VF610 + tristate "VF610 Clock Driver" if COMPILE_TEST && !SOC_VF610 + default SOC_VF610 + select MXC_CLK + config CLK_IMX8MM bool "IMX8MM CCM Clock Driver" depends on ARCH_MXC
drivers/clk/imx/Makefile +15 -15
@@ -31,18 +31,18 @@ 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 -obj-$(CONFIG_SOC_IMX1) += clk-imx1.o -obj-$(CONFIG_SOC_IMX21) += clk-imx21.o -obj-$(CONFIG_SOC_IMX25) += clk-imx25.o -obj-$(CONFIG_SOC_IMX27) += clk-imx27.o -obj-$(CONFIG_SOC_IMX31) += clk-imx31.o -obj-$(CONFIG_SOC_IMX35) += clk-imx35.o -obj-$(CONFIG_SOC_IMX5) += clk-imx5.o -obj-$(CONFIG_SOC_IMX6Q) += clk-imx6q.o -obj-$(CONFIG_SOC_IMX6SL) += clk-imx6sl.o -obj-$(CONFIG_SOC_IMX6SLL) += clk-imx6sll.o -obj-$(CONFIG_SOC_IMX6SX) += clk-imx6sx.o -obj-$(CONFIG_SOC_IMX6UL) += clk-imx6ul.o -obj-$(CONFIG_SOC_IMX7D) += clk-imx7d.o -obj-$(CONFIG_SOC_IMX7ULP) += clk-imx7ulp.o -obj-$(CONFIG_SOC_VF610) += clk-vf610.o +obj-$(CONFIG_CLK_IMX1) += clk-imx1.o +obj-$(CONFIG_CLK_IMX21) += clk-imx21.o +obj-$(CONFIG_CLK_IMX25) += clk-imx25.o +obj-$(CONFIG_CLK_IMX27) += clk-imx27.o +obj-$(CONFIG_CLK_IMX31) += clk-imx31.o +obj-$(CONFIG_CLK_IMX35) += clk-imx35.o +obj-$(CONFIG_CLK_IMX5) += clk-imx5.o +obj-$(CONFIG_CLK_IMX6Q) += clk-imx6q.o +obj-$(CONFIG_CLK_IMX6SL) += clk-imx6sl.o +obj-$(CONFIG_CLK_IMX6SLL) += clk-imx6sll.o +obj-$(CONFIG_CLK_IMX6SX) += clk-imx6sx.o +obj-$(CONFIG_CLK_IMX6UL) += clk-imx6ul.o +obj-$(CONFIG_CLK_IMX7D) += clk-imx7d.o +obj-$(CONFIG_CLK_IMX7ULP) += clk-imx7ulp.o +obj-$(CONFIG_CLK_VF610) += clk-vf610.o
Signature · 1 line
2.7.4
PATCH v5 6/6 clk: imx8qxp: Support building i.MX8QXP clock driver as module
In reply to Anson HuangChange configuration to "tristate", add module author, description and license to support building i.MX8QXP clock drivers as module.
---
Changes since V4:
- keep using builtin_platform_driver();
- add COMPILE_TEST support.
--- drivers/clk/imx/Kconfig | 8 +++++--- drivers/clk/imx/Makefile | 9 ++++----- drivers/clk/imx/clk-imx8qxp-lpcg.c | 4 ++++ drivers/clk/imx/clk-imx8qxp.c | 4 ++++ 4 files changed, 17 insertions(+), 8 deletions(-)
drivers/clk/imx/Kconfig +5 -3
@@ -5,7 +5,8 @@ config MXC_CLK depends on ARCH_MXC || COMPILE_TEST config MXC_CLK_SCU - bool + tristate "IMX SCU clock" + depends on ARCH_MXC || COMPILE_TEST depends on IMX_SCU config CLK_IMX1
@@ -106,8 +107,9 @@ config CLK_IMX8MQ Build the driver for i.MX8MQ CCM Clock Driver config CLK_IMX8QXP - bool "IMX8QXP SCU Clock" - depends on ARCH_MXC && IMX_SCU && ARM64 + tristate "IMX8QXP SCU Clock" + depends on (ARCH_MXC && ARM64) || COMPILE_TEST + depends on IMX_SCU select MXC_CLK_SCU help Build the driver for IMX8QXP SCU based clocks.
drivers/clk/imx/Makefile +4 -5
@@ -21,15 +21,14 @@ mxc-clk-objs += clk-pll14xx.o mxc-clk-objs += clk-sscg-pll.o obj-$(CONFIG_MXC_CLK) += mxc-clk.o -obj-$(CONFIG_MXC_CLK_SCU) += \ - clk-scu.o \ - clk-lpcg-scu.o - 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 + +obj-$(CONFIG_MXC_CLK_SCU) += clk-imx-scu.o clk-imx-lpcg-scu.o +clk-imx-scu-$(CONFIG_CLK_IMX8QXP) += clk-scu.o clk-imx8qxp.o +clk-imx-lpcg-scu-$(CONFIG_CLK_IMX8QXP) += clk-lpcg-scu.o clk-imx8qxp-lpcg.o obj-$(CONFIG_CLK_IMX1) += clk-imx1.o obj-$(CONFIG_CLK_IMX21) += clk-imx21.o
drivers/clk/imx/clk-imx8qxp-lpcg.c +4 -0
@@ -232,3 +232,7 @@ static struct platform_driver imx8qxp_lpcg_clk_driver = { };builtin_platform_driver (imx8qxp_lpcg_clk_driver); + +MODULE_AUTHOR ("Aisheng Dong <[email protected]>" ); +MODULE_DESCRIPTION ("NXP i.MX8QXP LPCG clock driver" ); +MODULE_LICENSE ("GPL v2" );
drivers/clk/imx/clk-imx8qxp.c +4 -0
@@ -152,3 +152,7 @@ static struct platform_driver imx8qxp_clk_driver = { .probe = imx8qxp_clk_probe, };builtin_platform_driver (imx8qxp_clk_driver); + +MODULE_AUTHOR ("Aisheng Dong <[email protected]>" ); +MODULE_DESCRIPTION ("NXP i.MX8QXP clock driver" ); +MODULE_LICENSE ("GPL v2" );
Signature · 1 line
2.7.4
Hi Anson,
Quoted 3 lines · Anson Huang
Nowdays, there are more and more requirements of building SoC specific drivers as modules, such as Android GKI (generic kernel image), this patch set supports building i.MX ARMv6/ARMv7 SoCs clock drivers as modules,
I'm curious, how does the system boot to userspace to be able to load modules without clock support in the kernel ? What if the driver for the device storing the rootfs cope with clocks not being available ? Does this require an initramfs with the clock module ? Even then, how does the serial port driver cope with not having clocks ?
Quoted 46 lines
The
CLK_IMXxxxis introduced for i.MX ARMv7 platforms in order to support various build options, and i.MX1/2/3 platforms now still ONLY support built-in as they are rarely used now.Changes since V4:
- add empty function ofimx_register_uart_clocks()for MODULE build, then all earlycon related clock handler can be built-out for MODULE;
- add module build support for ARMv7 platforms, also addCOMPILE_TESTfor them;
- addCOMPILE_TESTfor ARMv8 platforms;
- keep usingbuiltin_platform_driver()for i.MX8QXP clock driver.Anson Huang (6):
clk: composite: Exportclk_hw_register_composite()
clk: imx: Support module build for i.MX5/6/7 and vf610
clk: imx: Support building i.MX common clock driver as module
clk: imx: Add clock configuration for ARMv7 platforms
clk: imx8m: Support module build
clk: imx8qxp: Support building i.MX8QXP clock driver as moduledrivers/clk/clk-composite.c | 1 + drivers/clk/imx/Kconfig | 101 ++++++++++++++++++++++++++++++++----- drivers/clk/imx/Makefile | 79 ++++++++++++++--------------- drivers/clk/imx/clk-composite-8m.c | 2 + drivers/clk/imx/clk-cpu.c | 2 + drivers/clk/imx/clk-frac-pll.c | 2 + drivers/clk/imx/clk-gate2.c | 2 + drivers/clk/imx/clk-imx5.c | 5 ++ drivers/clk/imx/clk-imx6q.c | 5 ++ drivers/clk/imx/clk-imx6sl.c | 5 ++ drivers/clk/imx/clk-imx6sll.c | 5 ++ drivers/clk/imx/clk-imx6sx.c | 5 ++ drivers/clk/imx/clk-imx6ul.c | 5 ++ drivers/clk/imx/clk-imx7d.c | 5 ++ drivers/clk/imx/clk-imx7ulp.c | 5 ++ drivers/clk/imx/clk-imx8mm.c | 4 ++ drivers/clk/imx/clk-imx8mn.c | 4 ++ drivers/clk/imx/clk-imx8mp.c | 4 ++ drivers/clk/imx/clk-imx8mq.c | 4 ++ drivers/clk/imx/clk-imx8qxp-lpcg.c | 4 ++ drivers/clk/imx/clk-imx8qxp.c | 4 ++ drivers/clk/imx/clk-pll14xx.c | 5 ++ drivers/clk/imx/clk-sscg-pll.c | 2 + drivers/clk/imx/clk-vf610.c | 5 ++ drivers/clk/imx/clk.c | 17 +++++-- drivers/clk/imx/clk.h | 6 +++ 26 files changed, 231 insertions(+), 57 deletions(-)
Signature · 3 lines
Regards, Laurent Pinchart
kernel test robot
build botRe: [PATCH V5 4/6] clk: imx: Add clock configuration for ARMv7 platforms
In reply to Anson HuangThank you for the patch! Yet something to improve:
Hi Anson,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on shawnguo/for-next]
[also build test ERROR on clk/clk-next v5.8-rc3 next-20200702] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Anson-Huang/Support-building-i-MX-ARMv7-ARMv8-platforms-clock-driver-as-module/20200702-233004 base: https://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux.git for-next config: i386-allyesconfig (attached as .config) compiler: gcc-9 (Debian 9.3.0-14) 9.3.0 reproduce (this is a W=1 build): # save the attached .config to linux build tree make W=1 ARCH=i386
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
ld: drivers/clk/imx/clk-imx5.o: in function `mx50_clocks_init':
>> clk-imx5.c:(.init.text+0x1f81): undefined reference to `imx_print_silicon_rev' ld: drivers/clk/imx/clk-imx5.o: in function `mx51_clocks_init': >> clk-imx5.c:(.init.text+0x2744): undefined reference to `mx51_revision' >> ld: clk-imx5.c:(.init.text+0x2750): undefined reference to `imx_print_silicon_rev' ld: drivers/clk/imx/clk-imx5.o: in function `mx53_clocks_init': >> clk-imx5.c:(.init.text+0x3556): undefined reference to `mx53_revision' ld: clk-imx5.c:(.init.text+0x3562): undefined reference to `imx_print_silicon_rev' ld: drivers/clk/imx/clk-imx6q.o: in function `of_assigned_ldb_sels': >> clk-imx6q.c:(.text.unlikely+0x195): undefined reference to `imx_get_soc_revision' ld: drivers/clk/imx/clk-imx6q.o: in function `imx6q_clocks_init': >> clk-imx6q.c:(.init.text+0x146): undefined reference to `imx_get_soc_revision' >> ld: clk-imx6q.c:(.init.text+0x38a5): undefined reference to `imx_get_soc_revision'
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kernel test robot
build botRe: [PATCH V5 4/6] clk: imx: Add clock configuration for ARMv7 platforms
In reply to Anson HuangThank you for the patch! Yet something to improve:
Hi Anson,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on shawnguo/for-next]
[also build test ERROR on clk/clk-next v5.8-rc3 next-20200703] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Anson-Huang/Support-building-i-MX-ARMv7-ARMv8-platforms-clock-driver-as-module/20200702-233004 base: https://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux.git for-next config: h8300-allyesconfig (attached as .config) compiler: h8300-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=h8300
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
h8300-linux-ld: drivers/clk/imx/clk-imx5.o: in function `.L527':
clk-imx5.c:(.init.text+0x3547): undefined reference to `imx_print_silicon_rev'
h8300-linux-ld: drivers/clk/imx/clk-imx5.o: in function `.L637':
clk-imx5.c:(.init.text+0x41a7): undefined reference to `mx51_revision'
>> h8300-linux-ld: clk-imx5.c:(.init.text+0x41b3): undefined reference to `imx_print_silicon_rev'
h8300-linux-ld: drivers/clk/imx/clk-imx5.o: in function `.L788':
clk-imx5.c:(.init.text+0x596b): undefined reference to `mx53_revision'
h8300-linux-ld: clk-imx5.c:(.init.text+0x5977): undefined reference to `imx_print_silicon_rev'
h8300-linux-ld: drivers/clk/imx/clk-imx6q.o: in function `.L20':
clk-imx6q.c:(.text.unlikely+0x2e3): undefined reference to `imx_get_soc_revision'
h8300-linux-ld: drivers/clk/imx/clk-imx6q.o: in function `.L102':
clk-imx6q.c:(.init.text+0xbd): undefined reference to `imx_get_soc_revision'
h8300-linux-ld: drivers/clk/imx/clk-imx6q.o: in function `.L92':
clk-imx6q.c:(.init.text+0x674b): undefined reference to `imx_get_soc_revision'
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kernel test robot
build botRe: [PATCH V5 6/6] clk: imx8qxp: Support building i.MX8QXP clock driver as module
In reply to Anson HuangThank you for the patch! Yet something to improve:
Hi Anson,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on shawnguo/for-next]
[also build test ERROR on clk/clk-next v5.8-rc3 next-20200703] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Anson-Huang/Support-building-i-MX-ARMv7-ARMv8-platforms-clock-driver-as-module/20200702-233004 base: https://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux.git for-next config: i386-allyesconfig (attached as .config) compiler: gcc-9 (Debian 9.3.0-14) 9.3.0 reproduce (this is a W=1 build): # save the attached .config to linux build tree make W=1 ARCH=i386
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
ld: drivers/clk/imx/clk-scu.o: in function `clk_scu_atf_set_cpu_rate':
>> clk-scu.c:(.text+0x48): undefined reference to `__arm_smccc_smc'
ld: drivers/clk/imx/clk-imx5.o: in function `mx50_clocks_init':
clk-imx5.c:(.init.text+0x1f81): undefined reference to `imx_print_silicon_rev'
ld: drivers/clk/imx/clk-imx5.o: in function `mx51_clocks_init':
clk-imx5.c:(.init.text+0x2744): undefined reference to `mx51_revision'
ld: clk-imx5.c:(.init.text+0x2750): undefined reference to `imx_print_silicon_rev'
ld: drivers/clk/imx/clk-imx5.o: in function `mx53_clocks_init':
clk-imx5.c:(.init.text+0x3556): undefined reference to `mx53_revision'
ld: clk-imx5.c:(.init.text+0x3562): undefined reference to `imx_print_silicon_rev'
ld: drivers/clk/imx/clk-imx6q.o: in function `of_assigned_ldb_sels':
clk-imx6q.c:(.text.unlikely+0x195): undefined reference to `imx_get_soc_revision'
ld: drivers/clk/imx/clk-imx6q.o: in function `imx6q_clocks_init':
clk-imx6q.c:(.init.text+0x146): undefined reference to `imx_get_soc_revision'
ld: clk-imx6q.c:(.init.text+0x38a5): undefined reference to `imx_get_soc_revision'
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kernel test robot
build botRe: [PATCH V5 4/6] clk: imx: Add clock configuration for ARMv7 platforms
In reply to Anson HuangThank you for the patch! Perhaps something to improve:
Hi Anson,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on shawnguo/for-next]
[also build test WARNING on clk/clk-next v5.8-rc3 next-20200703] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Anson-Huang/Support-building-i-MX-ARMv7-ARMv8-platforms-clock-driver-as-module/20200702-233004 base: https://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux.git for-next compiler: gcc-9 (Debian 9.3.0-14) 9.3.0
If you fix the issue, kindly add following tag as appropriate
cppcheck warnings: (new ones prefixed by >>)
>> drivers/clk/imx/clk-composite-8m.c:119:9: warning: Identical condition 'ret', second condition is always false [identicalConditionAfterEarlyExit]
return ret;
^
drivers/clk/imx/clk-composite-8m.c:104:6: note: first condition
if (ret)
^
drivers/clk/imx/clk-composite-8m.c:119:9: note: second condition
return ret;
^
>> drivers/clk/imx/clk-composite-8m.c:233:5: warning: Variable 'hw' is reassigned a value before the old one has been used. [redundantAssignment]
hw = clk_hw_register_composite(NULL, name, parent_names, num_parents,
^
drivers/clk/imx/clk-composite-8m.c:180:0: note: Variable 'hw' is reassigned a value before the old one has been used.
struct clk_hw *hw = ERR_PTR(-ENOMEM), *mux_hw; ^
drivers/clk/imx/clk-composite-8m.c:233:5: note: Variable 'hw' is reassigned a value before the old one has been used.
hw = clk_hw_register_composite(NULL, name, parent_names, num_parents,
^
--
>> drivers/clk/imx/clk-imx6sl.c:149:49: warning: Shifting signed 32-bit value by 31 bits is undefined behaviour [shiftTooManyBitsSigned]
while (!(__raw_readl(anatop_base + PLL_ARM) & BM_PLL_ARM_LOCK))
^vim +/ret +119 drivers/clk/imx/clk-composite-8m.c
d3ff9728134eea Abel Vesa 2018-12-01 90
d3ff9728134eea Abel Vesa 2018-12-01 91 static int imx8m_clk_composite_divider_set_rate(struct clk_hw *hw,
d3ff9728134eea Abel Vesa 2018-12-01 92 unsigned long rate,
d3ff9728134eea Abel Vesa 2018-12-01 93 unsigned long parent_rate)
d3ff9728134eea Abel Vesa 2018-12-01 94 {
d3ff9728134eea Abel Vesa 2018-12-01 95 struct clk_divider *divider = to_clk_divider(hw);
79ccef698ac811 Anson Huang 2020-02-12 96 unsigned long flags;
d3ff9728134eea Abel Vesa 2018-12-01 97 int prediv_value;
d3ff9728134eea Abel Vesa 2018-12-01 98 int div_value;
33e7a8422546b5 Colin Ian King 2018-12-09 99 int ret;
d3ff9728134eea Abel Vesa 2018-12-01 100 u32 val;
d3ff9728134eea Abel Vesa 2018-12-01 101
d3ff9728134eea Abel Vesa 2018-12-01 102 ret = imx8m_clk_composite_compute_dividers(rate, parent_rate,
d3ff9728134eea Abel Vesa 2018-12-01 103 &prediv_value, &div_value);
d3ff9728134eea Abel Vesa 2018-12-01 104 if (ret)
d3ff9728134eea Abel Vesa 2018-12-01 105 return -EINVAL;
d3ff9728134eea Abel Vesa 2018-12-01 106
d3ff9728134eea Abel Vesa 2018-12-01 107 spin_lock_irqsave(divider->lock, flags);
d3ff9728134eea Abel Vesa 2018-12-01 108
d3ff9728134eea Abel Vesa 2018-12-01 109 val = readl(divider->reg);
d3ff9728134eea Abel Vesa 2018-12-01 110 val &= ~((clk_div_mask(divider->width) << divider->shift) |
d3ff9728134eea Abel Vesa 2018-12-01 111 (clk_div_mask(PCG_DIV_WIDTH) << PCG_DIV_SHIFT));
d3ff9728134eea Abel Vesa 2018-12-01 112
d3ff9728134eea Abel Vesa 2018-12-01 113 val |= (u32)(prediv_value - 1) << divider->shift;
d3ff9728134eea Abel Vesa 2018-12-01 114 val |= (u32)(div_value - 1) << PCG_DIV_SHIFT;
d3ff9728134eea Abel Vesa 2018-12-01 115 writel(val, divider->reg);
d3ff9728134eea Abel Vesa 2018-12-01 116
d3ff9728134eea Abel Vesa 2018-12-01 117 spin_unlock_irqrestore(divider->lock, flags);
d3ff9728134eea Abel Vesa 2018-12-01 118
d3ff9728134eea Abel Vesa 2018-12-01 @119 return ret;
d3ff9728134eea Abel Vesa 2018-12-01 120 }
d3ff9728134eea Abel Vesa 2018-12-01 121
d3ff9728134eea Abel Vesa 2018-12-01 122 static const struct clk_ops imx8m_clk_composite_divider_ops = {
d3ff9728134eea Abel Vesa 2018-12-01 123 .recalc_rate = imx8m_clk_composite_divider_recalc_rate,
d3ff9728134eea Abel Vesa 2018-12-01 124 .round_rate = imx8m_clk_composite_divider_round_rate,
d3ff9728134eea Abel Vesa 2018-12-01 125 .set_rate = imx8m_clk_composite_divider_set_rate,
d3ff9728134eea Abel Vesa 2018-12-01 126 };
d3ff9728134eea Abel Vesa 2018-12-01 127
f90b68d6c8b008 Peng Fan 2020-05-07 128 static u8 imx8m_clk_composite_mux_get_parent(struct clk_hw *hw)
f90b68d6c8b008 Peng Fan 2020-05-07 129 {
f90b68d6c8b008 Peng Fan 2020-05-07 130 return clk_mux_ops.get_parent(hw);
f90b68d6c8b008 Peng Fan 2020-05-07 131 }
f90b68d6c8b008 Peng Fan 2020-05-07 132
f90b68d6c8b008 Peng Fan 2020-05-07 133 static int imx8m_clk_composite_mux_set_parent(struct clk_hw *hw, u8 index)
f90b68d6c8b008 Peng Fan 2020-05-07 134 {
f90b68d6c8b008 Peng Fan 2020-05-07 135 struct clk_mux *mux = to_clk_mux(hw);
f90b68d6c8b008 Peng Fan 2020-05-07 136 u32 val = clk_mux_index_to_val(mux->table, mux->flags, index);
f90b68d6c8b008 Peng Fan 2020-05-07 137 unsigned long flags = 0;
f90b68d6c8b008 Peng Fan 2020-05-07 138 u32 reg;
f90b68d6c8b008 Peng Fan 2020-05-07 139
f90b68d6c8b008 Peng Fan 2020-05-07 140 if (mux->lock)
f90b68d6c8b008 Peng Fan 2020-05-07 141 spin_lock_irqsave(mux->lock, flags);
f90b68d6c8b008 Peng Fan 2020-05-07 142
f90b68d6c8b008 Peng Fan 2020-05-07 143 reg = readl(mux->reg);
f90b68d6c8b008 Peng Fan 2020-05-07 144 reg &= ~(mux->mask << mux->shift);
f90b68d6c8b008 Peng Fan 2020-05-07 145 val = val << mux->shift;
f90b68d6c8b008 Peng Fan 2020-05-07 146 reg |= val;
f90b68d6c8b008 Peng Fan 2020-05-07 147 /*
f90b68d6c8b008 Peng Fan 2020-05-07 148 * write twice to make sure non-target interface
f90b68d6c8b008 Peng Fan 2020-05-07 149 * SEL_A/B point the same clk input.
f90b68d6c8b008 Peng Fan 2020-05-07 150 */
f90b68d6c8b008 Peng Fan 2020-05-07 151 writel(reg, mux->reg);
f90b68d6c8b008 Peng Fan 2020-05-07 152 writel(reg, mux->reg);
f90b68d6c8b008 Peng Fan 2020-05-07 153
f90b68d6c8b008 Peng Fan 2020-05-07 154 if (mux->lock)
f90b68d6c8b008 Peng Fan 2020-05-07 155 spin_unlock_irqrestore(mux->lock, flags);
f90b68d6c8b008 Peng Fan 2020-05-07 156
f90b68d6c8b008 Peng Fan 2020-05-07 157 return 0;
f90b68d6c8b008 Peng Fan 2020-05-07 158 }
f90b68d6c8b008 Peng Fan 2020-05-07 159
f90b68d6c8b008 Peng Fan 2020-05-07 160 static int
f90b68d6c8b008 Peng Fan 2020-05-07 161 imx8m_clk_composite_mux_determine_rate(struct clk_hw *hw,
f90b68d6c8b008 Peng Fan 2020-05-07 162 struct clk_rate_request *req)
f90b68d6c8b008 Peng Fan 2020-05-07 163 {
f90b68d6c8b008 Peng Fan 2020-05-07 164 return clk_mux_ops.determine_rate(hw, req);
f90b68d6c8b008 Peng Fan 2020-05-07 165 }
f90b68d6c8b008 Peng Fan 2020-05-07 166
f90b68d6c8b008 Peng Fan 2020-05-07 167
f90b68d6c8b008 Peng Fan 2020-05-07 168 static const struct clk_ops imx8m_clk_composite_mux_ops = {
f90b68d6c8b008 Peng Fan 2020-05-07 169 .get_parent = imx8m_clk_composite_mux_get_parent,
f90b68d6c8b008 Peng Fan 2020-05-07 170 .set_parent = imx8m_clk_composite_mux_set_parent,
f90b68d6c8b008 Peng Fan 2020-05-07 171 .determine_rate = imx8m_clk_composite_mux_determine_rate,
f90b68d6c8b008 Peng Fan 2020-05-07 172 };
f90b68d6c8b008 Peng Fan 2020-05-07 173
a4b431f8038a67 Peng Fan 2019-12-12 174 struct clk_hw *imx8m_clk_hw_composite_flags(const char *name,
65a6b7c5f31c39 Abel Vesa 2018-12-14 175 const char * const *parent_names,
d3ff9728134eea Abel Vesa 2018-12-01 176 int num_parents, void __iomem *reg,
62668b68dc8e7d Peng Fan 2020-01-28 177 u32 composite_flags,
d3ff9728134eea Abel Vesa 2018-12-01 178 unsigned long flags)
d3ff9728134eea Abel Vesa 2018-12-01 179 {
d3ff9728134eea Abel Vesa 2018-12-01 180 struct clk_hw *hw = ERR_PTR(-ENOMEM), *mux_hw;
d3ff9728134eea Abel Vesa 2018-12-01 181 struct clk_hw *div_hw, *gate_hw;
d3ff9728134eea Abel Vesa 2018-12-01 182 struct clk_divider *div = NULL;
d3ff9728134eea Abel Vesa 2018-12-01 183 struct clk_gate *gate = NULL;
d3ff9728134eea Abel Vesa 2018-12-01 184 struct clk_mux *mux = NULL;
62668b68dc8e7d Peng Fan 2020-01-28 185 const struct clk_ops *divider_ops;
f90b68d6c8b008 Peng Fan 2020-05-07 186 const struct clk_ops *mux_ops;
d3ff9728134eea Abel Vesa 2018-12-01 187
d3ff9728134eea Abel Vesa 2018-12-01 188 mux = kzalloc(sizeof(*mux), GFP_KERNEL);
d3ff9728134eea Abel Vesa 2018-12-01 189 if (!mux)
d3ff9728134eea Abel Vesa 2018-12-01 190 goto fail;
d3ff9728134eea Abel Vesa 2018-12-01 191
d3ff9728134eea Abel Vesa 2018-12-01 192 mux_hw = &mux->hw;
d3ff9728134eea Abel Vesa 2018-12-01 193 mux->reg = reg;
d3ff9728134eea Abel Vesa 2018-12-01 194 mux->shift = PCG_PCS_SHIFT;
d3ff9728134eea Abel Vesa 2018-12-01 195 mux->mask = PCG_PCS_MASK;
073a01e8d7c23b Peng Fan 2019-11-01 196 mux->lock = &imx_ccm_lock;
d3ff9728134eea Abel Vesa 2018-12-01 197
d3ff9728134eea Abel Vesa 2018-12-01 198 div = kzalloc(sizeof(*div), GFP_KERNEL);
d3ff9728134eea Abel Vesa 2018-12-01 199 if (!div)
d3ff9728134eea Abel Vesa 2018-12-01 200 goto fail;
d3ff9728134eea Abel Vesa 2018-12-01 201
d3ff9728134eea Abel Vesa 2018-12-01 202 div_hw = &div->hw;
d3ff9728134eea Abel Vesa 2018-12-01 203 div->reg = reg;
62668b68dc8e7d Peng Fan 2020-01-28 204 if (composite_flags & IMX_COMPOSITE_CORE) {
62668b68dc8e7d Peng Fan 2020-01-28 205 div->shift = PCG_DIV_SHIFT;
62668b68dc8e7d Peng Fan 2020-01-28 206 div->width = PCG_CORE_DIV_WIDTH;
62668b68dc8e7d Peng Fan 2020-01-28 207 divider_ops = &clk_divider_ops;
f90b68d6c8b008 Peng Fan 2020-05-07 208 mux_ops = &imx8m_clk_composite_mux_ops;
0e40198dc28b62 Peng Fan 2020-05-07 209 } else if (composite_flags & IMX_COMPOSITE_BUS) {
0e40198dc28b62 Peng Fan 2020-05-07 210 div->shift = PCG_PREDIV_SHIFT;
0e40198dc28b62 Peng Fan 2020-05-07 211 div->width = PCG_PREDIV_WIDTH;
0e40198dc28b62 Peng Fan 2020-05-07 212 divider_ops = &imx8m_clk_composite_divider_ops;
0e40198dc28b62 Peng Fan 2020-05-07 213 mux_ops = &imx8m_clk_composite_mux_ops;
62668b68dc8e7d Peng Fan 2020-01-28 214 } else {
d3ff9728134eea Abel Vesa 2018-12-01 215 div->shift = PCG_PREDIV_SHIFT;
d3ff9728134eea Abel Vesa 2018-12-01 216 div->width = PCG_PREDIV_WIDTH;
62668b68dc8e7d Peng Fan 2020-01-28 217 divider_ops = &imx8m_clk_composite_divider_ops;
f90b68d6c8b008 Peng Fan 2020-05-07 218 mux_ops = &clk_mux_ops;
62668b68dc8e7d Peng Fan 2020-01-28 219 }
62668b68dc8e7d Peng Fan 2020-01-28 220
d3ff9728134eea Abel Vesa 2018-12-01 221 div->lock = &imx_ccm_lock;
d3ff9728134eea Abel Vesa 2018-12-01 222 div->flags = CLK_DIVIDER_ROUND_CLOSEST;
d3ff9728134eea Abel Vesa 2018-12-01 223
d3ff9728134eea Abel Vesa 2018-12-01 224 gate = kzalloc(sizeof(*gate), GFP_KERNEL);
d3ff9728134eea Abel Vesa 2018-12-01 225 if (!gate)
d3ff9728134eea Abel Vesa 2018-12-01 226 goto fail;
d3ff9728134eea Abel Vesa 2018-12-01 227
d3ff9728134eea Abel Vesa 2018-12-01 228 gate_hw = &gate->hw;
d3ff9728134eea Abel Vesa 2018-12-01 229 gate->reg = reg;
d3ff9728134eea Abel Vesa 2018-12-01 230 gate->bit_idx = PCG_CGC_SHIFT;
073a01e8d7c23b Peng Fan 2019-11-01 231 gate->lock = &imx_ccm_lock;
d3ff9728134eea Abel Vesa 2018-12-01 232
d3ff9728134eea Abel Vesa 2018-12-01 @233 hw = clk_hw_register_composite(NULL, name, parent_names, num_parents,---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Re: [PATCH V5 4/6] clk: imx: Add clock configuration for ARMv7 platforms
Quoted 11 lines · kernel test robot
url: https://github.com/0day-ci/linux/commits/Anson-Huang/Support-building-i-MX-ARMv7-ARMv8-platforms-clock-driver-as-module/20200702-233004 base: https://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux.git for-next compiler: gcc-9 (Debian 9.3.0-14) 9.3.0If you fix the issue, kindly add following tag as appropriate
Reported-by kernel test robot <[email protected]>cppcheck warnings: (new ones prefixed by >>)
Quoted 1 line
Quoted 1 line
drivers/clk/imx/clk-composite-8m.c:119:9: warning: Identical condition 'ret', second condition is always false [identicalConditionAfterEarlyExit]
Quoted 8 lines
return ret;
^
drivers/clk/imx/clk-composite-8m.c:104:6: note: first condition
if (ret)
^
drivers/clk/imx/clk-composite-8m.c:119:9: note: second condition
return ret;
^This warning seems completely bogus, as far as I can tell the code does exactly what was intended and it is written in a readable way. Since this is a cppcheck warning
(as opposed to gcc or sparse warnings), I think it can be safely ignored.
Quoted 9 lines
Quoted 1 line
Quoted 1 line
drivers/clk/imx/clk-composite-8m.c:233:5: warning: Variable 'hw' is reassigned a value before the old one has been used. [redundantAssignment]hw = clk_hw_register_composite(NULL, name,
parent_names,num_parents,
^
drivers/clk/imx/clk-composite-8m.c:180:0: note: Variable 'hw' is reassigned a value before the old one has been used.struct clk_hw *hw = ERR_PTR(-ENOMEM), *mux_hw;^
drivers/clk/imx/clk-composite-8m.c:233:5: note: Variable 'hw' is reassigned a value before the old one has been used.
hw = clk_hw_register_composite(NULL, name,parent_names,num_parents,
^
Same here, I don't think the warning makes much sense either:
the assignment is unused if the 'goto' is not hit, but in the error case it is important, and it seems cppcheck just gets this wrong.
Quoted 3 lines
Quoted 1 line
Quoted 1 line
drivers/clk/imx/clk-imx6sl.c:149:49: warning: Shifting signed 32-bit value by 31 bits is undefined behaviour [shiftTooManyBitsSigned]while (!(__raw_readl(anatop_base + PLL_ARM) & BM_PLL_ARM_LOCK)) ^
This in turn should be fixed, and the same line appears to be broken when running with CONFIG_CPU_BIG_ENDIAN=y (which otherwise works fine on i.mx) for no reason.
Please fix both the usage of __raw_readl() and the BM_PLL_ARM_LOCK definition.
Arnd
Re: [PATCH V5 4/6] clk: imx: Add clock configuration for ARMv7 platforms
Hi, Arnd
Quoted 54 lines
Subject: Re: [PATCH V5 4/6] clk: imx: Add clock configuration for ARMv7 platforms
Quoted 1 line · kernel test robot
url:
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.
com%2F0day-ci%2Flinux%2Fcommits%2FAnson-Huang%2FSupport-building-i- MX-ARMv7-ARMv8-platforms-clock-driver-as-module%2F20200702-233004& amp;data=02%7C01%7CAnson.Huang%40nxp.com%7C9706e8f5d157453e8fa 308d81ff70b2c%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637 294493188060696&sdata=6GzWrP3DOj4f1wrViK1IfRF8gxq%2F%2F5clb %2B1FOjz0jdU%3D&reserved=0Quoted 1 line
base:
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.kern
el.org%2Fpub%2Fscm%2Flinux%2Fkernel%2Fgit%2Fshawnguo%2Flinux.git&a mp;data=02%7C01%7CAnson.Huang%40nxp.com%7C9706e8f5d157453e8fa3 08d81ff70b2c%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C6372 94493188060696&sdata=JIgR9ova2%2F83tLPZt1iDLKNMFLT2wLNtK2yW OFhlGU4%3D&reserved=0 for-nextQuoted 11 lines
compiler: gcc-9 (Debian 9.3.0-14) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by kernel test robot <[email protected]>cppcheck warnings: (new ones prefixed by >>)
Quoted 3 lines
Quoted 3 lines
drivers/clk/imx/clk-composite-8m.c:119:9: warning: Identical condition 'ret', second condition is always false [identicalConditionAfterEarlyExit]Quoted 8 lines
return ret; ^ drivers/clk/imx/clk-composite-8m.c:104:6: note: first condition if (ret) ^ drivers/clk/imx/clk-composite-8m.c:119:9: note: second condition return ret; ^This warning seems completely bogus, as far as I can tell the code does exactly what was intended and it is written in a readable way. Since this is a cppcheck warning (as opposed to gcc or sparse warnings), I think it can be safely ignored.
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
drivers/clk/imx/clk-composite-8m.c:233:5: warning: Variable 'hw' is reassigned a value before the old one has been used. [redundantAssignment]hw = clk_hw_register_composite(NULL, name,
parent_names,
num_parents,Quoted 2 lines
^
drivers/clk/imx/clk-composite-8m.c:180:0: note: Variable 'hw' isreassigned a value before the old one has been used.
Quoted 3 lines
struct clk_hw *hw = ERR_PTR(-ENOMEM), *mux_hw;^
drivers/clk/imx/clk-composite-8m.c:233:5: note: Variable 'hw' is
Quoted 9 lines
reassigned a value before the old one has been used.
Quoted 1 line
hw = clk_hw_register_composite(NULL, name,
parent_names,
num_parents,Quoted 1 line
^Same here, I don't think the warning makes much sense either:
the assignment is unused if the 'goto' is not hit, but in the error case it is important, and it seems cppcheck just gets this wrong.
OK, so I will drop the local patch of trying fix it as below, and just ignore the build warning:
+++ b/drivers/clk/imx/clk-composite-8m.c
@@ -116,7 +116,7 @@ static int imx8m_clk_composite_divider_set_rate(struct clk_hw *hw,
spin_unlock_irqrestore(divider->lock, flags);
- return ret;
+ return 0;
}
static const struct clk_ops imx8m_clk_composite_divider_ops = {
@@ -177,7 +177,7 @@ struct clk_hw *imx8m_clk_hw_composite_flags(const char *name,
u32 composite_flags, unsigned long flags)
{
- struct clk_hw *hw = ERR_PTR(-ENOMEM), *mux_hw;
+ struct clk_hw *hw, *mux_hw;
struct clk_hw *div_hw, *gate_hw;Quoted 5 lines
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
drivers/clk/imx/clk-imx6sl.c:149:49: warning: Shifting signed 32-bit value by 31 bits is undefined behaviour [shiftTooManyBitsSigned]while (!(__raw_readl(anatop_base + PLL_ARM) &
BM_PLL_ARM_LOCK))
Quoted 8 lines
Quoted 1 line
^This in turn should be fixed, and the same line appears to be broken when running with
CONFIG_CPU_BIG_ENDIAN=y(which otherwise works fine on i.mx) for no reason.Please fix both the usage of
__raw_readl()and theBM_PLL_ARM_LOCKdefinition.
Actually I am a little confused about this, the __raw_readl() should return 'unsigned int'? or with other CONFIG, it may return 'signed int'? I saw some of the drivers also using (unsigned int) before __raw_readl() to force it to u32. And for the BM_PLL_ARM_LOCK, I will fix it, below patch is in my next patch series:
+++ b/drivers/clk/imx/clk-imx6sl.c
@@ -3,6 +3,7 @@
* Copyright 2013-2014 Freescale Semiconductor, Inc. */
+#include <linux/bitfield.h>
#include <linux/clk.h>
#include <linux/clkdev.h>
#include <linux/err.h>
@@ -27,7 +28,7 @@
#define BM_PLL_ARM_DIV_SELECT (0x7f << 0) #define BM_PLL_ARM_POWERDOWN (1 << 12) #define BM_PLL_ARM_ENABLE (1 << 13)
-#define BM_PLL_ARM_LOCK (1 << 31)
+#define BM_PLL_ARM_LOCK BIT(31)
#define PLL_ARM_DIV_792M 66
static const char *step_sels[] = { "osc", "pll2_pfd2", };
@@ -146,7 +147,7 @@ static void imx6sl_enable_pll_arm(bool enable)
val |= BM_PLL_ARM_ENABLE;
val &= ~BM_PLL_ARM_POWERDOWN;
writel_relaxed(val, anatop_base + PLL_ARM);
- while (!(__raw_readl(anatop_base + PLL_ARM) & BM_PLL_ARM_LOCK))
+ while (!((u32)__raw_readl(anatop_base + PLL_ARM) & BM_PLL_ARM_LOCK))
;
} else {Thanks,
Anson
Re: [PATCH V5 4/6] clk: imx: Add clock configuration for ARMv7 platforms
Quoted 9 lines · Anson Huang
Quoted 7 lines
Subject: Re: [PATCH V5 4/6] clk: imx: Add clock configuration for ARMv7 platforms
Same here, I don't think the warning makes much sense either:
the assignment is unused if the 'goto' is not hit, but in the error case it is important, and it seems cppcheck just gets this wrong.OK, so I will drop the local patch of trying fix it as below, and just ignore the build warning:
Ok
Review static int imx8m_clk_composite_divider_set_rate(struct clk_hw *hw, · line 120
Quoted 8 lines
+++
b/drivers/clk/imx/clk-composite-8m.c(quoted diff) +1
-1@@ -116,7 +116,7 @@ static int imx8m_clk_composite_divider_set_rate(struct clk_hw *hw, spin_unlock_irqrestore(divider->lock, flags); - return ret; + return 0; }
This one seems harmless
Review struct clk_hw *imx8m_clk_hw_composite_flags(const char *name, · line 183
Quoted 10 lines
(quoted diff) +1
-1static const struct clk_ops imx8m_clk_composite_divider_ops = {@@ -177,7 +177,7 @@ struct clk_hw *imx8m_clk_hw_composite_flags(const char *name, u32 composite_flags, unsigned long flags) { - struct clk_hw *hw = ERR_PTR(-ENOMEM), *mux_hw; + struct clk_hw *hw, *mux_hw; struct clk_hw *div_hw, *gate_hw;
but this would actually make the code wrong, so dropping both seems better indeed.
Quoted 24 lines
Actually I am a little confused about this, the
__raw_readl()should return 'unsigned int'? or with other CONFIG, it may return 'signed int'? I saw some of the drivers also using (unsigned int) before__raw_readl()to force it to u32. And for theBM_PLL_ARM_LOCK, I will fix it, below patch is in my next patch series:+++
b/drivers/clk/imx/clk-imx6sl.c(quoted diff) +2
-1@@ -3,6 +3,7 @@ * Copyright 2013-2014 Freescale Semiconductor, Inc. */ +#include <linux/bitfield.h> #include <linux/clk.h> #include <linux/clkdev.h> #include <linux/err.h>@@ -27,7 +28,7 @@ #define BM_PLL_ARM_DIV_SELECT (0x7f << 0) #define BM_PLL_ARM_POWERDOWN (1 << 12) #define BM_PLL_ARM_ENABLE (1 << 13) -#define BM_PLL_ARM_LOCK (1 << 31) +#define BM_PLL_ARM_LOCK BIT(31) #define PLL_ARM_DIV_792M 66 static const char *step_sels[] = { "osc", "pll2_pfd2", };
Review static void imx6sl_enable_pll_arm(bool enable) · line 152
Quoted 7 lines
(quoted diff) +1
-1@@ -146,7 +147,7 @@ static void imx6sl_enable_pll_arm(bool enable) val |= BM_PLL_ARM_ENABLE; val &= ~BM_PLL_ARM_POWERDOWN; writel_relaxed(val, anatop_base + PLL_ARM); - while (!(__raw_readl(anatop_base + PLL_ARM) & BM_PLL_ARM_LOCK)) + while (!((u32)__raw_readl(anatop_base + PLL_ARM) & BM_PLL_ARM_LOCK)) ; } else {
This addresses either of the problems ;-)
The issue is in the BM_PLL_ARM_LOCK definition, which shifts a signed integer by 31 bits. You could use BIT(31) in place of (1<<31) or open-code it to "(1u<<31)", but please do it for all those constants consistently.
For the endianness problem, my point was that __raw_readl will return the incorrect byteorder with CONFIG_BIG_ENDIAN, and the driver needs to use readl() or possibly readl_relaxed() instead. The __raw_* accessors are really not meant to be used in drivers at all, and using it as is done here@the minimum results in nonportable code.
Arnd
Hi, Laurent
Quoted 11 lines
Subject: Re: [PATCH V5 0/6] Support building i.MX ARMv7/ARMv8 platforms clock driver as module
Hi Anson,
Quoted 4 lines · Anson Huang
Nowdays, there are more and more requirements of building SoC specific drivers as modules, such as Android GKI (generic kernel image), this patch set supports building i.MX ARMv6/ARMv7 SoCs clock drivers as modules,
Quoted 5 lines
I'm curious, how does the system boot to userspace to be able to load modules without clock support in the kernel ? What if the driver for the device storing the rootfs cope with clocks not being available ? Does this require an initramfs with the clock module ? Even then, how does the serial port driver cope with not having clocks ?
Yes, this requires an initramfs, and in the initramfs, it will insmod those .ko with correct sequence, as per my test and Android GKI test from our Andoird team, the clock and pinctrl need to be insmod first, then the debug console, then other module devices....And this patch series ONLY provides the capability of loadable clock module for this scenario, Linux will still use built-in by default.
Thanks,
Anson