diff mbox series

[14/14] clk: meson: rework and clean drivers dependencies

Message ID 20190128180430.28689-15-jbrunet@baylibre.com
State New
Headers show
Series clk: meson: rework drivers dependencies | expand

Commit Message

Jerome Brunet Jan. 28, 2019, 6:04 p.m. UTC
Initially, 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.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>

---
 drivers/clk/meson/Kconfig  | 82 +++++++++++++++++++++++++++-----------
 drivers/clk/meson/Makefile | 21 ++++++----
 2 files changed, 71 insertions(+), 32 deletions(-)

-- 
2.20.1

Comments

Stephen Boyd Jan. 29, 2019, 6:09 p.m. UTC | #1
Quoting Jerome Brunet (2019-01-28 10:04:30)
> Initially, 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.

> 

> Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>


Sounds good to me.

> diff --git a/drivers/clk/meson/Makefile b/drivers/clk/meson/Makefile

> index 2b9490dd9878..8baec10a49a1 100644

> --- a/drivers/clk/meson/Makefile

> +++ b/drivers/clk/meson/Makefile

> @@ -2,12 +2,17 @@

>  # Makefile for Meson specific clk

>  #

>  


Add a comment here that these are all the clk library parts or something
like that?

> -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) += sclk-div.o

> -obj-$(CONFIG_COMMON_CLK_MESON_AO) += meson-aoclk.o

> +obj-$(CONFIG_COMMON_CLK_MESON_INPUT) += clk-input.o

> +obj-$(CONFIG_COMMON_CLK_MESON_REGMAP) += clk-regmap.o

> +obj-$(CONFIG_COMMON_CLK_MESON_DUALDIV) += clk-dualdiv.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_SCLK_DIV) += sclk-div.o

> +obj-$(CONFIG_COMMON_CLK_MESON_VID_PLL_DIV) += vid-pll-div.o

> +obj-$(CONFIG_COMMON_CLK_MESON_AO_CLKC) += meson-aoclk.o

> +


And maybe add a comment here indicating that SoC drivers go below?

>  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

> +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


And sort them by config name alphanumerically?
diff mbox series

Patch

diff --git a/drivers/clk/meson/Kconfig b/drivers/clk/meson/Kconfig
index 2479dab09d70..f2e757aea4f1 100644
--- a/drivers/clk/meson/Kconfig
+++ b/drivers/clk/meson/Kconfig
@@ -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,
diff --git a/drivers/clk/meson/Makefile b/drivers/clk/meson/Makefile
index 2b9490dd9878..8baec10a49a1 100644
--- a/drivers/clk/meson/Makefile
+++ b/drivers/clk/meson/Makefile
@@ -2,12 +2,17 @@ 
 # Makefile for Meson specific clk
 #
 
-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)	+= sclk-div.o
-obj-$(CONFIG_COMMON_CLK_MESON_AO) += meson-aoclk.o
+obj-$(CONFIG_COMMON_CLK_MESON_INPUT) += clk-input.o
+obj-$(CONFIG_COMMON_CLK_MESON_REGMAP) += clk-regmap.o
+obj-$(CONFIG_COMMON_CLK_MESON_DUALDIV) += clk-dualdiv.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_SCLK_DIV) += sclk-div.o
+obj-$(CONFIG_COMMON_CLK_MESON_VID_PLL_DIV) += vid-pll-div.o
+obj-$(CONFIG_COMMON_CLK_MESON_AO_CLKC) += meson-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
+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