clk: meson: rework drivers dependencies
Jerome Brunet
maintainerv2 cover clk: meson: rework drivers dependencies
The goal of this patchset to clean-up the dependencies between the controllers and the different clock drivers provided in the meson directory. The expected result is that each controllers can pick the the clock drivers they need, without necessarily pulling everything.
This is becoming important as we are adding more and more controllers to support new amlogic SoC.
Patch 1 and 2 are out of the meson directory but have been acked by Stephen.
Changes since v1 [0]:
* Squashed patch 4 to 14
* Sort Makefile alphanumerically
[0]: https://lkml.kernel.org/r/[email protected]
Jerome Brunet (4):
clk: export some clk_hw function symbols for module drivers
clk: meson: use CONFIG_ARCH_MESON to enter meson clk directory
clk: meson: axg-audio does not require syscon
clk: meson: rework and clean drivers dependencies
drivers/clk/Makefile | 2 +-
drivers/clk/clk.c | 3 +
drivers/clk/meson/Kconfig | 84 +++++++---
drivers/clk/meson/Makefile | 27 ++--
drivers/clk/meson/axg-aoclk.c | 4 +-
drivers/clk/meson/axg-audio.c | 5 +-
drivers/clk/meson/axg.c | 5 +-
drivers/clk/meson/clk-dualdiv.c | 10 +-
drivers/clk/meson/clk-dualdiv.h | 33 ++++
drivers/clk/meson/clk-input.c | 7 +-
drivers/clk/meson/clk-input.h | 19 +++
drivers/clk/meson/clk-mpll.c | 12 +-
drivers/clk/meson/clk-mpll.h | 30 ++++
drivers/clk/meson/clk-phase.c | 75 ++++++++-
drivers/clk/meson/clk-phase.h | 26 ++++
drivers/clk/meson/clk-pll.c | 13 +-
drivers/clk/meson/clk-pll.h | 43 ++++++
drivers/clk/meson/clk-regmap.c | 5 +
drivers/clk/meson/clk-regmap.h | 15 ++
drivers/clk/meson/clk-triphase.c | 68 --------
drivers/clk/meson/clkc.h | 146 ------------------
drivers/clk/meson/gxbb-aoclk.c | 4 +-
drivers/clk/meson/gxbb.c | 5 +-
drivers/clk/meson/meson-aoclk.c | 2 +
drivers/clk/meson/meson-aoclk.h | 5 +-
drivers/clk/meson/meson8b.c | 3 +-
drivers/clk/meson/parm.h | 46 ++++++
drivers/clk/meson/sclk-div.c | 10 +-
.../clk/meson/{clkc-audio.h => sclk-div.h} | 16 +-
drivers/clk/meson/vid-pll-div.c | 10 +-
drivers/clk/meson/vid-pll-div.h | 20 +++
31 files changed, 470 insertions(+), 283 deletions(-)
create mode 100644 drivers/clk/meson/clk-dualdiv.h
create mode 100644 drivers/clk/meson/clk-input.h
create mode 100644 drivers/clk/meson/clk-mpll.h
create mode 100644 drivers/clk/meson/clk-phase.h
create mode 100644 drivers/clk/meson/clk-pll.h
delete mode 100644 drivers/clk/meson/clk-triphase.c
delete mode 100644 drivers/clk/meson/clkc.h
create mode 100644 drivers/clk/meson/parm.h
rename drivers/clk/meson/{clkc-audio.h => sclk-div.h} (54%)
create mode 100644 drivers/clk/meson/vid-pll-div.hSignature · 7 lines
2.20.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Jerome Brunet
maintainerPATCH v2 1/4 clk: export some clk_hw function symbols for module drivers
clk-provider.h provides clk_hw_is_prepared(), clk_hw_is_enabled() and clk_hw_is_prepared() but these symbols are not exported for the modules which prevents a clock driver using them to be compiled as a module. Export them to fix the problem.
--- drivers/clk/clk.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/clk/clk.c +3 -0
@@ -394,16 +394,19 @@ bool clk_hw_is_prepared(const struct clk_hw *hw) {return clk_core_is_prepared (hw->core); } +EXPORT_SYMBOL_GPL (clk_hw_is_prepared);bool clk_hw_rate_is_protected (const struct clk_hw *hw) {return clk_core_rate_is_protected (hw->core); } +EXPORT_SYMBOL_GPL (clk_hw_rate_is_protected);bool clk_hw_is_enabled (const struct clk_hw *hw) {return clk_core_is_enabled (hw->core); } +EXPORT_SYMBOL_GPL (clk_hw_is_enabled);bool __clk_is_enabled (struct clk *clk) {
Signature · 1 line
2.20.1
Jerome Brunet
maintainerPATCH v2 2/4 clk: meson: use CONFIG_ARCH_MESON to enter meson clk directory
In reply to Jerome BrunetUse CONFIG_ARCH_MESON to let make enter the meson clock directory. As part of a rework, CONFIG_COMMON_CLK_AMLOGIC is about to be removed.
--- drivers/clk/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/Makefile +1 -1
@@ -78,7 +78,7 @@ obj-$(CONFIG_ARCH_K3) += keystone/ obj-$(CONFIG_ARCH_KEYSTONE) += keystone/ obj-$(CONFIG_MACH_LOONGSON32) += loongson1/ obj-y += mediatek/ -obj-$(CONFIG_COMMON_CLK_AMLOGIC) += meson/ +obj-$(CONFIG_ARCH_MESON) += meson/ obj-$(CONFIG_MACH_PIC32) += microchip/ ifeq ($(CONFIG_COMMON_CLK), y) obj-$(CONFIG_ARCH_MMP) += mmp/
Signature · 1 line
2.20.1
Jerome Brunet
maintainerPATCH v2 3/4 clk: meson: axg-audio does not require syscon
In reply to Jerome BrunetThe axg audio clock controller uses regmap mmio, not syscon.
--- drivers/clk/meson/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/meson/Kconfig +1 -1
@@ -50,7 +50,7 @@ config COMMON_CLK_AXG_AUDIO tristate "Meson AXG Audio Clock Controller Driver" depends on COMMON_CLK_AXG select COMMON_CLK_AMLOGIC_AUDIO - select MFD_SYSCON + select REGMAP_MMIO help Support for the audio clock controller on AmLogic A113D devices, aka axg, Say Y if you want audio subsystem to work.
Signature · 1 line
2.20.1
Jerome Brunet
maintainerPATCH v2 4/4 clk: meson: rework and clean drivers dependencies
In reply to Jerome BrunetInitially, the meson clock directory only hosted 2 controllers drivers, for meson8 and gxbb. At the time, both used the same set of clock drivers so managing the dependencies was not a big concern.
Since this ancient time, entropy did its job, controllers with different requirement and specific clock drivers have been added. Unfortunately, we did not do a great job at managing the dependencies between the controllers and the different clock drivers. Some drivers, such as clk-phase or vid-pll-div, are compiled even if they are useless on the target (meson8). As we are adding new controllers, we need to be able to pick a driver w/o pulling the whole thing.
The patch aims to clean things up by:
* providing a dedicated CONFIG_ for each clock drivers
* allowing clock drivers to be compiled as a modules, if possible
* stating explicitly which drivers are required by each controller.
---
drivers/clk/meson/Kconfig | 82 +++++++---
drivers/clk/meson/Makefile | 27 ++--
drivers/clk/meson/axg-aoclk.c | 4 +-
drivers/clk/meson/axg-audio.c | 5 +-
drivers/clk/meson/axg.c | 5 +-
drivers/clk/meson/clk-dualdiv.c | 10 +-
drivers/clk/meson/clk-dualdiv.h | 33 ++++
drivers/clk/meson/clk-input.c | 7 +-
drivers/clk/meson/clk-input.h | 19 +++
drivers/clk/meson/clk-mpll.c | 12 +-
drivers/clk/meson/clk-mpll.h | 30 ++++
drivers/clk/meson/clk-phase.c | 75 ++++++++-
drivers/clk/meson/clk-phase.h | 26 ++++
drivers/clk/meson/clk-pll.c | 13 +-
drivers/clk/meson/clk-pll.h | 43 ++++++
drivers/clk/meson/clk-regmap.c | 5 +
drivers/clk/meson/clk-regmap.h | 15 ++
drivers/clk/meson/clk-triphase.c | 68 --------
drivers/clk/meson/clkc.h | 146 ------------------
drivers/clk/meson/gxbb-aoclk.c | 4 +-
drivers/clk/meson/gxbb.c | 5 +-
drivers/clk/meson/meson-aoclk.c | 2 +
drivers/clk/meson/meson-aoclk.h | 5 +-
drivers/clk/meson/meson8b.c | 3 +-
drivers/clk/meson/parm.h | 46 ++++++
drivers/clk/meson/sclk-div.c | 10 +-
.../clk/meson/{clkc-audio.h => sclk-div.h} | 16 +-
drivers/clk/meson/vid-pll-div.c | 10 +-
drivers/clk/meson/vid-pll-div.h | 20 +++
29 files changed, 465 insertions(+), 281 deletions(-)
create mode 100644 drivers/clk/meson/clk-dualdiv.h
create mode 100644 drivers/clk/meson/clk-input.h
create mode 100644 drivers/clk/meson/clk-mpll.h
create mode 100644 drivers/clk/meson/clk-phase.h
create mode 100644 drivers/clk/meson/clk-pll.h
delete mode 100644 drivers/clk/meson/clk-triphase.c
delete mode 100644 drivers/clk/meson/clkc.h
create mode 100644 drivers/clk/meson/parm.h
rename drivers/clk/meson/{clkc-audio.h => sclk-div.h} (54%)
create mode 100644 drivers/clk/meson/vid-pll-div.hdrivers/clk/meson/Kconfig +58 -24
@@ -1,27 +1,47 @@ -config COMMON_CLK_AMLOGIC - bool - depends on ARCH_MESON || COMPILE_TEST - select COMMON_CLK_REGMAP_MESON +config COMMON_CLK_MESON_INPUT + tristate -config COMMON_CLK_AMLOGIC_AUDIO - bool - depends on ARCH_MESON || COMPILE_TEST - select COMMON_CLK_AMLOGIC +config COMMON_CLK_MESON_REGMAP + tristate + select REGMAP -config COMMON_CLK_MESON_AO - bool - depends on OF - depends on ARCH_MESON || COMPILE_TEST - select COMMON_CLK_REGMAP_MESON - select RESET_CONTROLLER +config COMMON_CLK_MESON_DUALDIV + tristate + select COMMON_CLK_MESON_REGMAP -config COMMON_CLK_REGMAP_MESON - bool - select REGMAP +config COMMON_CLK_MESON_MPLL + tristate + select COMMON_CLK_MESON_REGMAP + +config COMMON_CLK_MESON_PHASE + tristate + select COMMON_CLK_MESON_REGMAP + +config COMMON_CLK_MESON_PLL + tristate + select COMMON_CLK_MESON_REGMAP + +config COMMON_CLK_MESON_SCLK_DIV + tristate + select COMMON_CLK_MESON_REGMAP + +config COMMON_CLK_MESON_VID_PLL_DIV + tristate + select COMMON_CLK_MESON_REGMAP + +config COMMON_CLK_MESON_AO_CLKC + tristate + select COMMON_CLK_MESON_REGMAP + select COMMON_CLK_MESON_INPUT + select RESET_CONTROLLER config COMMON_CLK_MESON8B bool - select COMMON_CLK_AMLOGIC + depends on ARCH_MESON + select COMMON_CLK_MESON_REGMAP + select COMMON_CLK_MESON_MPLL + select COMMON_CLK_MESON_PLL + select MFD_SYSCON select RESET_CONTROLLER help Support for the clock controller on AmLogic S802 (Meson8),
@@ -30,8 +50,14 @@ config COMMON_CLK_MESON8B config COMMON_CLK_GXBB bool - select COMMON_CLK_AMLOGIC - select COMMON_CLK_MESON_AO + depends on ARCH_MESON + select COMMON_CLK_MESON_INPUT + select COMMON_CLK_MESON_REGMAP + select COMMON_CLK_MESON_DUALDIV + select COMMON_CLK_MESON_VID_PLL_DIV + select COMMON_CLK_MESON_MPLL + select COMMON_CLK_MESON_PLL + select COMMON_CLK_MESON_AO_CLKC select MFD_SYSCON help Support for the clock controller on AmLogic S905 devices, aka gxbb.
@@ -39,8 +65,13 @@ config COMMON_CLK_GXBB config COMMON_CLK_AXG bool - select COMMON_CLK_AMLOGIC - select COMMON_CLK_MESON_AO + depends on ARCH_MESON + select COMMON_CLK_MESON_INPUT + select COMMON_CLK_MESON_REGMAP + select COMMON_CLK_MESON_DUALDIV + select COMMON_CLK_MESON_MPLL + select COMMON_CLK_MESON_PLL + select COMMON_CLK_MESON_AO_CLKC select MFD_SYSCON help Support for the clock controller on AmLogic A113D devices, aka axg.
@@ -48,8 +79,11 @@ config COMMON_CLK_AXG config COMMON_CLK_AXG_AUDIO tristate "Meson AXG Audio Clock Controller Driver" - depends on COMMON_CLK_AXG - select COMMON_CLK_AMLOGIC_AUDIO + depends on ARCH_MESON + select COMMON_CLK_MESON_INPUT + select COMMON_CLK_MESON_REGMAP + select COMMON_CLK_MESON_PHASE + select COMMON_CLK_MESON_SCLK_DIV select REGMAP_MMIO help Support for the audio clock controller on AmLogic A113D devices,
drivers/clk/meson/Makefile +16 -11
@@ -1,13 +1,18 @@ -# -# Makefile for Meson specific clk -# +# Amlogic clock drivers -obj-$(CONFIG_COMMON_CLK_AMLOGIC) += clk-pll.o clk-mpll.o clk-phase.o vid-pll-div.o -obj-$(CONFIG_COMMON_CLK_AMLOGIC) += clk-input.o clk-dualdiv.o -obj-$(CONFIG_COMMON_CLK_AMLOGIC_AUDIO) += clk-triphase.o sclk-div.o -obj-$(CONFIG_COMMON_CLK_MESON_AO) += meson-aoclk.o +obj-$(CONFIG_COMMON_CLK_MESON_AO_CLKC) += meson-aoclk.o +obj-$(CONFIG_COMMON_CLK_MESON_DUALDIV) += clk-dualdiv.o +obj-$(CONFIG_COMMON_CLK_MESON_INPUT) += clk-input.o +obj-$(CONFIG_COMMON_CLK_MESON_MPLL) += clk-mpll.o +obj-$(CONFIG_COMMON_CLK_MESON_PHASE) += clk-phase.o +obj-$(CONFIG_COMMON_CLK_MESON_PLL) += clk-pll.o +obj-$(CONFIG_COMMON_CLK_MESON_REGMAP) += clk-regmap.o +obj-$(CONFIG_COMMON_CLK_MESON_SCLK_DIV) += sclk-div.o +obj-$(CONFIG_COMMON_CLK_MESON_VID_PLL_DIV) += vid-pll-div.o + +# Amlogic Clock controllers + +obj-$(CONFIG_COMMON_CLK_AXG) += axg.o axg-aoclk.o +obj-$(CONFIG_COMMON_CLK_AXG_AUDIO) += axg-audio.o +obj-$(CONFIG_COMMON_CLK_GXBB) += gxbb.o gxbb-aoclk.o obj-$(CONFIG_COMMON_CLK_MESON8B) += meson8b.o -obj-$(CONFIG_COMMON_CLK_GXBB) += gxbb.o gxbb-aoclk.o -obj-$(CONFIG_COMMON_CLK_AXG) += axg.o axg-aoclk.o -obj-$(CONFIG_COMMON_CLK_AXG_AUDIO) += axg-audio.o -obj-$(CONFIG_COMMON_CLK_REGMAP_MESON) += clk-regmap.o
drivers/clk/meson/axg-aoclk.c +3 -1
@@ -12,10 +12,12 @@#include <linux/platform_device.h> #include <linux/reset-controller.h> #include <linux/mfd/syscon.h> -#include "clkc.h" #include "meson-aoclk.h" #include "axg-aoclk.h" +#include "clk-regmap.h" +#include "clk-dualdiv.h" +#define IN_PREFIX "ao-in-"/*
drivers/clk/meson/axg-audio.c +4 -1
@@ -14,8 +14,11 @@#include <linux/reset.h> #include <linux/slab.h> -#include "clkc-audio.h" #include "axg-audio.h" +#include "clk-input.h" +#include "clk-regmap.h" +#include "clk-phase.h" +#include "sclk-div.h" #define AXG_MST_IN_COUNT 8#define AXG_SLV_SCLK_COUNT 10
drivers/clk/meson/axg.c +4 -1
@@ -17,7 +17,10 @@#include <linux/platform_device.h> #include <linux/regmap.h> -#include "clkc.h" +#include "clk-input.h" +#include "clk-regmap.h" +#include "clk-pll.h" +#include "clk-mpll.h" #include "axg.h" #define IN_PREFIX "ee-in-"
drivers/clk/meson/clk-dualdiv.c +9 -1
@@ -22,7 +22,10 @@*/ #include <linux/clk-provider.h> -#include "clkc.h" +#include <linux/module.h> + +#include "clk-regmap.h" +#include "clk-dualdiv.h" static inline struct meson_clk_dualdiv_data *meson_clk_dualdiv_data (struct clk_regmap *clk)
@@ -128,3 +131,8 @@ const struct clk_ops meson_clk_dualdiv_ro_ops = { .recalc_rate = meson_clk_dualdiv_recalc_rate, };EXPORT_SYMBOL_GPL (meson_clk_dualdiv_ro_ops); + +MODULE_DESCRIPTION ("Amlogic dual divider driver" ); +MODULE_AUTHOR ("Neil Armstrong <[email protected]>" ); +MODULE_AUTHOR ("Jerome Brunet <[email protected]>" ); +MODULE_LICENSE ("GPL v2" );
drivers/clk/meson/clk-dualdiv.h new file +33 -0
@@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (c) 2019 BayLibre, SAS. +* Author: Jerome Brunet <[email protected]> +*/ + +#ifndef __MESON_CLK_DUALDIV_H +#define __MESON_CLK_DUALDIV_H + +#include <linux/clk-provider.h> +#include "parm.h" + +struct meson_clk_dualdiv_param { +unsigned int n1; +unsigned int n2; +unsigned int m1; +unsigned int m2; +unsigned int dual; +}; + +struct meson_clk_dualdiv_data { +struct parm n1; +struct parm n2; +struct parm m1; +struct parm m2; +struct parm dual; +const struct meson_clk_dualdiv_param *table; +}; + +extern const struct clk_ops meson_clk_dualdiv_ops; +extern const struct clk_ops meson_clk_dualdiv_ro_ops; + +#endif /* __MESON_CLK_DUALDIV_H */
drivers/clk/meson/clk-input.c +6 -1
@@ -7,7 +7,8 @@#include <linux/clk.h> #include <linux/clk-provider.h> #include <linux/device.h> -#include "clkc.h" +#include <linux/module.h> +#include "clk-input.h" static const struct clk_ops meson_clk_no_ops = {};
@@ -42,3 +43,7 @@ struct clk_hw *meson_clk_hw_register_input(struct device *dev,return ret ?ERR_PTR (ret) : hw; }EXPORT_SYMBOL_GPL (meson_clk_hw_register_input); + +MODULE_DESCRIPTION ("Amlogic clock input helper" ); +MODULE_AUTHOR ("Jerome Brunet <[email protected]>" ); +MODULE_LICENSE ("GPL v2" );
drivers/clk/meson/clk-input.h new file +19 -0
@@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (c) 2019 BayLibre, SAS. +* Author: Jerome Brunet <[email protected]> +*/ + +#ifndef __MESON_CLK_INPUT_H +#define __MESON_CLK_INPUT_H + +#include <linux/clk-provider.h> + +struct device ; + +struct clk_hw *meson_clk_hw_register_input (struct device *dev, +const char *of_name, +const char *clk_name, +unsigned long flags); + +#endif /* __MESON_CLK_INPUT_H */
drivers/clk/meson/clk-mpll.c +11 -1
@@ -12,7 +12,11 @@*/ #include <linux/clk-provider.h> -#include "clkc.h" +#include <linux/module.h> +#include <linux/spinlock.h> + +#include "clk-regmap.h" +#include "clk-mpll.h" #define SDM_DEN 16384#define N2_MIN 4
@@ -138,9 +142,15 @@ const struct clk_ops meson_clk_mpll_ro_ops = { .recalc_rate = mpll_recalc_rate, .round_rate = mpll_round_rate, }; +EXPORT_SYMBOL_GPL (meson_clk_mpll_ro_ops);const struct clk_ops meson_clk_mpll_ops = { .recalc_rate = mpll_recalc_rate, .round_rate = mpll_round_rate, .set_rate = mpll_set_rate, }; +EXPORT_SYMBOL_GPL (meson_clk_mpll_ops); + +MODULE_DESCRIPTION ("Amlogic MPLL driver" ); +MODULE_AUTHOR ("Michael Turquette <[email protected]>" ); +MODULE_LICENSE ("GPL v2" );
drivers/clk/meson/clk-mpll.h new file +30 -0
@@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (c) 2019 BayLibre, SAS. +* Author: Jerome Brunet <[email protected]> +*/ + +#ifndef __MESON_CLK_MPLL_H +#define __MESON_CLK_MPLL_H + +#include <linux/clk-provider.h> +#include <linux/spinlock.h> + +#include "parm.h" + +struct meson_clk_mpll_data { +struct parm sdm; +struct parm sdm_en; +struct parm n2; +struct parm ssen; +struct parm misc; +spinlock_t *lock; +u8 flags; +}; + +#define CLK_MESON_MPLL_ROUND_CLOSEST BIT(0) + +extern const struct clk_ops meson_clk_mpll_ro_ops; +extern const struct clk_ops meson_clk_mpll_ops; + +#endif /* __MESON_CLK_MPLL_H */
drivers/clk/meson/clk-phase.c +70 -5
100 lines not on this page · raw message
drivers/clk/meson/clk-phase.h new file +26 -0
@@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (c) 2019 BayLibre, SAS. +* Author: Jerome Brunet <[email protected]> +*/ + +#ifndef __MESON_CLK_PHASE_H +#define __MESON_CLK_PHASE_H + +#include <linux/clk-provider.h> +#include "parm.h" + +struct meson_clk_phase_data { +struct parm ph; +}; + +struct meson_clk_triphase_data { +struct parm ph0; +struct parm ph1; +struct parm ph2; +}; + +extern const struct clk_ops meson_clk_phase_ops; +extern const struct clk_ops meson_clk_triphase_ops; + +#endif /* __MESON_CLK_PHASE_H */
drivers/clk/meson/clk-pll.c +9 -4
@@ -32,11 +32,9 @@#include <linux/io.h> #include <linux/math64.h> #include <linux/module.h> -#include <linux/of_address.h> -#include <linux/slab.h> -#include <linux/string.h> -#include "clkc.h" +#include "clk-regmap.h" +#include "clk-pll.h" static inline struct meson_clk_pll_data *meson_clk_pll_data (struct clk_regmap *clk)
@@ -309,8 +307,15 @@ const struct clk_ops meson_clk_pll_ops = { .enable = meson_clk_pll_enable, .disable = meson_clk_pll_disable }; +EXPORT_SYMBOL_GPL (meson_clk_pll_ops);const struct clk_ops meson_clk_pll_ro_ops = { .recalc_rate = meson_clk_pll_recalc_rate, .is_enabled = meson_clk_pll_is_enabled, }; +EXPORT_SYMBOL_GPL (meson_clk_pll_ro_ops); + +MODULE_DESCRIPTION ("Amlogic PLL driver" ); +MODULE_AUTHOR ("Carlo Caione <[email protected]>" ); +MODULE_AUTHOR ("Jerome Brunet <[email protected]>" ); +MODULE_LICENSE ("GPL v2" );
drivers/clk/meson/clk-pll.h new file +43 -0
43 lines not on this page · raw message
drivers/clk/meson/clk-regmap.c +5 -0
@@ -4,6 +4,7 @@* Author: Jerome Brunet <[email protected]> */ +#include <linux/module.h> #include "clk-regmap.h" static int clk_regmap_gate_endisable (struct clk_hw *hw,int enable)
@@ -180,3 +181,7 @@ const struct clk_ops clk_regmap_mux_ro_ops = { .get_parent = clk_regmap_mux_get_parent, };EXPORT_SYMBOL_GPL (clk_regmap_mux_ro_ops); + +MODULE_DESCRIPTION ("Amlogic regmap backed clock driver" ); +MODULE_AUTHOR ("Jerome Brunet <[email protected]>" ); +MODULE_LICENSE ("GPL v2" );
drivers/clk/meson/clk-regmap.h +15 -0
@@ -111,4 +111,19 @@ clk_get_regmap_mux_data(struct clk_regmap *clk)extern const struct clk_ops clk_regmap_mux_ops;extern const struct clk_ops clk_regmap_mux_ro_ops; +#define MESON_GATE (_name, _reg, _bit) \ +struct clk_regmap _name = { \ + .data = &(struct clk_regmap_gate_data){ \ + .offset = (_reg), \ + .bit_idx = (_bit), \ + }, \ + .hw.init = &(struct clk_init_data) { \ + .name = #_name, \ + .ops = &clk_regmap_gate_ops, \ + .parent_names = (const char *[]){ "clk81" }, \ + .num_parents = 1, \ + .flags = (CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED), \ + }, \ +} +#endif /* __CLK_REGMAP_H */
drivers/clk/meson/clk-triphase.c deleted +0 -68
68 lines not on this page · raw message
drivers/clk/meson/clkc.h deleted +0 -146
146 lines not on this page · raw message
drivers/clk/meson/gxbb-aoclk.c +3 -1
@@ -5,10 +5,12 @@*/ #include <linux/platform_device.h> #include <linux/mfd/syscon.h> -#include "clkc.h" #include "meson-aoclk.h" #include "gxbb-aoclk.h" +#include "clk-regmap.h" +#include "clk-dualdiv.h" +#define IN_PREFIX "ao-in-"/* AO Configuration Clock registers offsets */
drivers/clk/meson/gxbb.c +4 -1
@@ -12,9 +12,12 @@#include <linux/platform_device.h> #include <linux/regmap.h> -#include "clkc.h" #include "gxbb.h" +#include "clk-input.h" #include "clk-regmap.h" +#include "clk-pll.h" +#include "clk-mpll.h" +#include "vid-pll-div.h" #define IN_PREFIX "ee-in-"
drivers/clk/meson/meson-aoclk.c +2 -0
@@ -17,6 +17,8 @@#include <linux/slab.h> #include "meson-aoclk.h" +#include "clk-input.h" +static int meson_aoclk_do_reset (struct reset_controller_dev *rcdev,unsigned long id) {
drivers/clk/meson/meson-aoclk.h +4 -1
@@ -11,9 +11,12 @@ #ifndef __MESON_AOCLK_H__ #define __MESON_AOCLK_H__ +#include <linux/clk-provider.h> #include <linux/platform_device.h> +#include <linux/regmap.h> #include <linux/reset-controller.h> -#include "clkc.h" + +#include "clk-regmap.h" struct meson_aoclk_input { const char *name;
drivers/clk/meson/meson8b.c +2 -1
@@ -16,9 +16,10 @@#include <linux/slab.h> #include <linux/regmap.h> -#include "clkc.h" #include "meson8b.h" #include "clk-regmap.h" +#include "clk-pll.h" +#include "clk-mpll.h" static DEFINE_SPINLOCK (meson_clk_lock);
drivers/clk/meson/parm.h new file +46 -0
46 lines not on this page · raw message
drivers/clk/meson/sclk-div.c +9 -1
@@ -16,7 +16,11 @@* duty_cycle = (1 + hi) / (1 + val) */ -#include "clkc-audio.h" +#include <linux/clk-provider.h> +#include <linux/module.h> + +#include "clk-regmap.h" +#include "sclk-div.h" static inline struct meson_sclk_div_data *meson_sclk_div_data (struct clk_regmap *clk)
@@ -241,3 +245,7 @@ const struct clk_ops meson_sclk_div_ops = { .init = sclk_div_init, };EXPORT_SYMBOL_GPL (meson_sclk_div_ops); + +MODULE_DESCRIPTION ("Amlogic Sample divider driver" ); +MODULE_AUTHOR ("Jerome Brunet <[email protected]>" ); +MODULE_LICENSE ("GPL v2" );
drivers/clk/meson/sclk-div.h renamed from drivers/clk/meson/clkc-audio.h +5 -11
@@ -4,16 +4,11 @@* Author: Jerome Brunet <[email protected]> */ -#ifndef __MESON_CLKC_AUDIO_H -#define __MESON_CLKC_AUDIO_H +#ifndef __MESON_SCLK_DIV_H +#define __MESON_SCLK_DIV_H -#include "clkc.h" - -struct meson_clk_triphase_data { - struct parm ph0; - struct parm ph1; - struct parm ph2; -}; +#include <linux/clk-provider.h> +#include "parm.h" struct meson_sclk_div_data { struct parm div;
@@ -22,7 +17,6 @@ struct meson_sclk_div_data { struct clk_duty cached_duty; }; -extern const struct clk_ops meson_clk_triphase_ops;extern const struct clk_ops meson_sclk_div_ops; -#endif /* __MESON_CLKC_AUDIO_H */ +#endif /* __MESON_SCLK_DIV_H */
drivers/clk/meson/vid-pll-div.c +9 -1
@@ -5,7 +5,10 @@*/ #include <linux/clk-provider.h> -#include "clkc.h" +#include <linux/module.h> + +#include "clk-regmap.h" +#include "vid-pll-div.h" static inline struct meson_vid_pll_div_data *meson_vid_pll_div_data (struct clk_regmap *clk)
@@ -89,3 +92,8 @@ static unsigned long meson_vid_pll_div_recalc_rate(struct clk_hw *hw,const struct clk_ops meson_vid_pll_div_ro_ops = { .recalc_rate = meson_vid_pll_div_recalc_rate, }; +EXPORT_SYMBOL_GPL (meson_vid_pll_div_ro_ops); + +MODULE_DESCRIPTION ("Amlogic video pll divider driver" ); +MODULE_AUTHOR ("Neil Armstrong <[email protected]>" ); +MODULE_LICENSE ("GPL v2" );
drivers/clk/meson/vid-pll-div.h new file +20 -0
@@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (c) 2019 BayLibre, SAS. +* Author: Jerome Brunet <[email protected]> +*/ + +#ifndef __MESON_VID_PLL_DIV_H +#define __MESON_VID_PLL_DIV_H + +#include <linux/clk-provider.h> +#include "parm.h" + +struct meson_vid_pll_div_data { +struct parm val; +struct parm sel; +}; + +extern const struct clk_ops meson_vid_pll_div_ro_ops; + +#endif /* __MESON_VID_PLL_DIV_H */
Signature · 1 line
2.20.1
Neil Armstrong
AppliedHi,
Quoted 57 lines · Jerome Brunet
The goal of this patchset to clean-up the dependencies between the controllers and the different clock drivers provided in the meson directory. The expected result is that each controllers can pick the the clock drivers they need, without necessarily pulling everything.
This is becoming important as we are adding more and more controllers to support new amlogic SoC.
Patch 1 and 2 are out of the meson directory but have been acked by Stephen.
Changes since v1 [0]:
* Squashed patch 4 to 14
* SortMakefilealphanumerically[0]: https://lkml.kernel.org/r/[email protected]
Jerome Brunet (4):
clk: export someclk_hwfunction symbols for module drivers
clk: meson: useCONFIG_ARCH_MESONto enter meson clk directory
clk: meson: axg-audio does not require syscon
clk: meson: rework and clean drivers dependenciesdrivers/clk/Makefile | 2 +- drivers/clk/clk.c | 3 + drivers/clk/meson/Kconfig | 84 +++++++--- drivers/clk/meson/Makefile | 27 ++-- drivers/clk/meson/axg-aoclk.c | 4 +- drivers/clk/meson/axg-audio.c | 5 +- drivers/clk/meson/axg.c | 5 +- drivers/clk/meson/clk-dualdiv.c | 10 +- drivers/clk/meson/clk-dualdiv.h | 33 ++++ drivers/clk/meson/clk-input.c | 7 +- drivers/clk/meson/clk-input.h | 19 +++ drivers/clk/meson/clk-mpll.c | 12 +- drivers/clk/meson/clk-mpll.h | 30 ++++ drivers/clk/meson/clk-phase.c | 75 ++++++++- drivers/clk/meson/clk-phase.h | 26 ++++ drivers/clk/meson/clk-pll.c | 13 +- drivers/clk/meson/clk-pll.h | 43 ++++++ drivers/clk/meson/clk-regmap.c | 5 + drivers/clk/meson/clk-regmap.h | 15 ++ drivers/clk/meson/clk-triphase.c | 68 -------- drivers/clk/meson/clkc.h | 146 ------------------ drivers/clk/meson/gxbb-aoclk.c | 4 +- drivers/clk/meson/gxbb.c | 5 +- drivers/clk/meson/meson-aoclk.c | 2 + drivers/clk/meson/meson-aoclk.h | 5 +- drivers/clk/meson/meson8b.c | 3 +- drivers/clk/meson/parm.h | 46 ++++++ drivers/clk/meson/sclk-div.c | 10 +- .../clk/meson/{clkc-audio.h => sclk-div.h} | 16 +- drivers/clk/meson/vid-pll-div.c | 10 +- drivers/clk/meson/vid-pll-div.h | 20 +++ 31 files changed, 470 insertions(+), 283 deletions(-) create mode 100644 drivers/clk/meson/clk-dualdiv.h create mode 100644 drivers/clk/meson/clk-input.h
Quoted 9 lines
create mode 100644 drivers/clk/meson/clk-mpll.h
create mode 100644 drivers/clk/meson/clk-phase.h
create mode 100644 drivers/clk/meson/clk-pll.h
delete mode 100644 drivers/clk/meson/clk-triphase.c
delete mode 100644 drivers/clk/meson/clkc.h
create mode 100644 drivers/clk/meson/parm.h
rename drivers/clk/meson/{clkc-audio.h => sclk-div.h} (54%)
create mode 100644 drivers/clk/meson/vid-pll-div.hApplied to next/drivers for Linux 5.1-rc1
Neil