Skip to contentSkip to conversation

arm: ep93xx: CCF conversion

PATCH Applied Alexander Sverdlin 3 participants 5 messages Oct 18, 2021 – Oct 20, 2021

Subsystems (5)
lore
Share & tools
lore

Alexander Sverdlin

author maintainer
#0 lore raw

v3 cover arm: ep93xx: CCF conversion

This series series of patches converts ep93xx to Common Clock Framework.

It consists of preparation patches to use clk_prepare_enable where it is needed, instead of clk_enable used in ep93xx drivers prior to CCF and a patch converting mach-ep93xx/clock.c to CCF.

v2->v3:
Rebased the series onto v5.15-rc5
v1->v2:
- added SoB

Alexander Sverdlin (1):
ASoC: cirrus: i2s: Prepare clock before using it

Nikita Shubin (1):
ep93xx: clock: convert in-place to COMMON_CLK

 arch/arm/Kconfig              |   2 +-
 arch/arm/mach-ep93xx/clock.c  | 975 +++++++++++++++++++---------------
 arch/arm/mach-ep93xx/core.c   |   2 +-
 arch/arm/mach-ep93xx/soc.h    |  42 +-
 sound/soc/cirrus/ep93xx-i2s.c |  12 +-
 5 files changed, 587 insertions(+), 446 deletions(-)
Signature · 1 line
2.33.0
author maintainer
#1 lore raw

PATCH v3 1/2 ASoC: cirrus: i2s: Prepare clock before using it

Use clk_prepare_enable()/clk_disable_unprepare() in preparation for switch to Common Clock Framework, otherwise the following is visible:

WARNING: CPU: 0 PID: 97 at drivers/clk/clk.c:1011 clk_core_enable+0x9c/0xbc
Enabling unprepared mclk
...
Hardware name: Cirrus Logic EDB9302 Evaluation Board

...
clk_core_enable
clk_core_enable_lock
ep93xx_i2s_hw_params
snd_soc_dai_hw_params
soc_pcm_hw_params
snd_pcm_hw_params
snd_pcm_ioctl
...

---
 sound/soc/cirrus/ep93xx-i2s.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
sound/soc/cirrus/ep93xx-i2s.c +6 -6
index 0d26550d0df8..4d3179f03202 100644
@@ -111,9 +111,9 @@ static void ep93xx_i2s_enable(struct ep93xx_i2s_info *info, int stream)
 	if ((ep93xx_i2s_read_reg(info, EP93XX_I2S_TX0EN) & 0x1) == 0 &&
 	    (ep93xx_i2s_read_reg(info, EP93XX_I2S_RX0EN) & 0x1) == 0) {
 		/* Enable clocks */
-		clk_enable(info->mclk);
-		clk_enable(info->sclk);
-		clk_enable(info->lrclk);
+		clk_prepare_enable(info->mclk);
+		clk_prepare_enable(info->sclk);
+		clk_prepare_enable(info->lrclk);
 
 		/* Enable i2s */
 		ep93xx_i2s_write_reg(info, EP93XX_I2S_GLCTRL, 1);
@@ -156,9 +156,9 @@ static void ep93xx_i2s_disable(struct ep93xx_i2s_info *info, int stream)
 		ep93xx_i2s_write_reg(info, EP93XX_I2S_GLCTRL, 0);
 
 		/* Disable clocks */
-		clk_disable(info->lrclk);
-		clk_disable(info->sclk);
-		clk_disable(info->mclk);
+		clk_disable_unprepare(info->lrclk);
+		clk_disable_unprepare(info->sclk);
+		clk_disable_unprepare(info->mclk);
 	}
 }
 
Signature · 1 line
2.33.0
author maintainer
#2 lore raw

PATCH v3 2/2 ep93xx: clock: convert in-place to COMMON_CLK

In reply to Alexander Sverdlin

From: Nikita Shubin <[email protected]>

Converted in-place without moving file to drivers/clk.

tested on ts7250 (EP9302).

Only setting rate and change parent tested for, as they are missing on ts7250:
- video
- I2S
- ADC/KEYPAD
- PWM

Only video and I2S clock are interesting, as they are GATE + double DIV + MUX, all other are pretty much common but require ep93xx_syscon_swlocked_write to set registers.

---
 arch/arm/Kconfig             |   2 +-
 arch/arm/mach-ep93xx/clock.c | 975 ++++++++++++++++++++---------------
 arch/arm/mach-ep93xx/core.c  |   2 +-
 arch/arm/mach-ep93xx/soc.h   |  42 +-
 4 files changed, 581 insertions(+), 440 deletions(-)
arch/arm/Kconfig +1 -1
index 59baf6c132a7..b2249f830945 100644
@@ -347,7 +347,7 @@ config ARCH_EP93XX
 	select CLKSRC_MMIO
 	select CPU_ARM920T
 	select GPIOLIB
-	select HAVE_LEGACY_CLK
+	select COMMON_CLK
 	help
 	  This enables support for the Cirrus EP93xx series of CPUs.
 
arch/arm/mach-ep93xx/clock.c +558 -417

1,123 lines not on this page · raw message

arch/arm/mach-ep93xx/core.c +1 -1
index 4659132a0509..a3b4e843456a 100644
@@ -214,7 +214,7 @@ static int ep93xx_ohci_power_on(struct platform_device *pdev)
 			return PTR_ERR(ep93xx_ohci_host_clock);
 	}
 
-	return clk_enable(ep93xx_ohci_host_clock);
+	return clk_prepare_enable(ep93xx_ohci_host_clock);
 }
 
 static void ep93xx_ohci_power_off(struct platform_device *pdev)
arch/arm/mach-ep93xx/soc.h +21 -21

74 lines not on this page · raw message

Signature · 1 line
2.33.0
#3 lore raw
In reply to Alexander Sverdlin
This series was applied to soc/soc.git (for-next) by Arnd Bergmann <[email protected]>:

Hello:

This series was applied to soc/soc.git (for-next)
by Arnd Bergmann <[email protected]>:

Quoted 10 lines · On Mon, 18 Oct 2021 12:31:03 +0200 you wrote:

This series series of patches converts ep93xx to Common Clock Framework.

It consists of preparation patches to use clk_prepare_enable where it is needed, instead of clk_enable used in ep93xx drivers prior to CCF and a patch converting mach-ep93xx/clock.c to CCF.

[...]

Here is the summary with links:
- [v3,1/2] ASoC: cirrus: i2s: Prepare clock before using it

    https://git.kernel.org/soc/soc/c/f4ff6b56bc8a
  - [v3,2/2] ep93xx: clock: convert in-place to COMMON_CLK
    https://git.kernel.org/soc/soc/c/9645ccc7bd7a

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html

#4 lore raw
In reply to Alexander Sverdlin

From: Arnd Bergmann <[email protected]>

Quoted 10 lines · Alexander Sverdlin

This series series of patches converts ep93xx to Common Clock Framework.

It consists of preparation patches to use clk_prepare_enable where it is needed, instead of clk_enable used in ep93xx drivers prior to CCF and a patch converting mach-ep93xx/clock.c to CCF.

[...]

Applied to arm/drivers, thanks!

[1/2] ASoC: cirrus: i2s: Prepare clock before using it

      commit: f4ff6b56bc8ab2fcad6885813cd28ccc81224981
[2/2] ep93xx: clock: convert in-place to COMMON_CLK
      commit: 9645ccc7bd7a16cd73c3be9dee70cd702b03be37

       Arnd