linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] spi: s3c64xx: do not disable the clock while configuring the spi
@ 2016-07-07  7:23 ` Andi Shyti
  2016-07-07  9:41   ` Krzysztof Kozlowski
                     ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Andi Shyti @ 2016-07-07  7:23 UTC (permalink / raw)
  To: Mark Brown
  Cc: Sylwester Nawrocki, Kukjin Kim, Krzysztof Kozlowski,
	linux-arm-kernel, linux-samsung-soc, linux-spi, linux-kernel,
	Andi Shyti, Andi Shyti

When the clock is coming from the cmu it is not required to be
disabled and then re-enabled in order to change the rate.

Besides, some exynos chipsets (e.g. exynos5433) do not deliver
any to the SFR if one from the pclk ("spi" in this case) or sclk
("busclk") is disabled.

Remove the clock disabling/enabling to avoid falling into this
situation.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
---

Hi,

This patch has been tested by me and Sylwester on Trats2
(exynos4412) and tm2(e) (exynos5433) boards, for big data
(which use dma transfer) and small data.

It also fixes in exynos5433 a synchronus abort caused by the fact
that the pclk (spi) doesn't get delivered if the sclk is disabled
(busclk)

Thanks,
Andi

 drivers/spi/spi-s3c64xx.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index 048c900..c719e73 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -577,9 +577,7 @@ static void s3c64xx_spi_config(struct s3c64xx_spi_driver_data *sdd)
 	u32 val;
 
 	/* Disable Clock */
-	if (sdd->port_conf->clk_from_cmu) {
-		clk_disable_unprepare(sdd->src_clk);
-	} else {
+	if (!sdd->port_conf->clk_from_cmu) {
 		val = readl(regs + S3C64XX_SPI_CLK_CFG);
 		val &= ~S3C64XX_SPI_ENCLK_ENABLE;
 		writel(val, regs + S3C64XX_SPI_CLK_CFG);
@@ -622,11 +620,7 @@ static void s3c64xx_spi_config(struct s3c64xx_spi_driver_data *sdd)
 	writel(val, regs + S3C64XX_SPI_MODE_CFG);
 
 	if (sdd->port_conf->clk_from_cmu) {
-		/* Configure Clock */
-		/* There is half-multiplier before the SPI */
 		clk_set_rate(sdd->src_clk, sdd->cur_speed * 2);
-		/* Enable Clock */
-		clk_prepare_enable(sdd->src_clk);
 	} else {
 		/* Configure Clock */
 		val = readl(regs + S3C64XX_SPI_CLK_CFG);
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] spi: s3c64xx: do not disable the clock while configuring the spi
  2016-07-07  7:23 ` [PATCH] spi: s3c64xx: do not disable the clock while configuring the spi Andi Shyti
@ 2016-07-07  9:41   ` Krzysztof Kozlowski
  2016-07-07  9:58   ` Andi Shyti
  2016-07-07 10:01   ` Applied "spi: s3c64xx: do not disable the clock while configuring the spi" to the spi tree Mark Brown
  2 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2016-07-07  9:41 UTC (permalink / raw)
  To: Andi Shyti, Mark Brown
  Cc: Sylwester Nawrocki, Kukjin Kim, linux-arm-kernel,
	linux-samsung-soc, linux-spi, linux-kernel, Andi Shyti

On 07/07/2016 09:23 AM, Andi Shyti wrote:
> When the clock is coming from the cmu it is not required to be
> disabled and then re-enabled in order to change the rate.
> 
> Besides, some exynos chipsets (e.g. exynos5433) do not deliver
> any to the SFR if one from the pclk ("spi" in this case) or sclk
> ("busclk") is disabled.
> 
> Remove the clock disabling/enabling to avoid falling into this
> situation.
> 
> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
> Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
> ---
> 
> Hi,
> 
> This patch has been tested by me and Sylwester on Trats2
> (exynos4412) and tm2(e) (exynos5433) boards, for big data
> (which use dma transfer) and small data.
> 
> It also fixes in exynos5433 a synchronus abort caused by the fact
> that the pclk (spi) doesn't get delivered if the sclk is disabled
> (busclk)
> 
> Thanks,
> Andi
> 
>  drivers/spi/spi-s3c64xx.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)

Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] spi: s3c64xx: do not disable the clock while configuring the spi
  2016-07-07  7:23 ` [PATCH] spi: s3c64xx: do not disable the clock while configuring the spi Andi Shyti
  2016-07-07  9:41   ` Krzysztof Kozlowski
@ 2016-07-07  9:58   ` Andi Shyti
  2016-07-07 12:24     ` Mark Brown
  2016-07-07 10:01   ` Applied "spi: s3c64xx: do not disable the clock while configuring the spi" to the spi tree Mark Brown
  2 siblings, 1 reply; 5+ messages in thread
From: Andi Shyti @ 2016-07-07  9:58 UTC (permalink / raw)
  To: Mark Brown
  Cc: Sylwester Nawrocki, Kukjin Kim, Krzysztof Kozlowski,
	linux-arm-kernel, linux-samsung-soc, linux-spi, linux-kernel,
	Andi Shyti

Hi,

>  	if (sdd->port_conf->clk_from_cmu) {
> -		/* Configure Clock */
> -		/* There is half-multiplier before the SPI */
>  		clk_set_rate(sdd->src_clk, sdd->cur_speed * 2);

sorry, I will re-send it because I should not remove the comments
above.... in the future someone might wonder why it's multiplied
by 2.

That's called auto review and auto-nack :)

Andi

> -		/* Enable Clock */
> -		clk_prepare_enable(sdd->src_clk);
>  	} else {
>  		/* Configure Clock */
>  		val = readl(regs + S3C64XX_SPI_CLK_CFG);
> -- 
> 2.8.1
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Applied "spi: s3c64xx: do not disable the clock while configuring the spi" to the spi tree
  2016-07-07  7:23 ` [PATCH] spi: s3c64xx: do not disable the clock while configuring the spi Andi Shyti
  2016-07-07  9:41   ` Krzysztof Kozlowski
  2016-07-07  9:58   ` Andi Shyti
@ 2016-07-07 10:01   ` Mark Brown
  2 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2016-07-07 10:01 UTC (permalink / raw)
  To: Andi Shyti
  Cc: Sylwester Nawrocki, Mark Brown, Mark Brown, Sylwester Nawrocki,
	Kukjin Kim, Krzysztof Kozlowski, linux-arm-kernel,
	linux-samsung-soc, linux-spi, linux-kernel, Andi Shyti,
	linux-spi

The patch

   spi: s3c64xx: do not disable the clock while configuring the spi

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From d9aaf1dc984a448ae5630e53a611a8b3489d1f8d Mon Sep 17 00:00:00 2001
From: Andi Shyti <andi.shyti@samsung.com>
Date: Thu, 7 Jul 2016 16:23:57 +0900
Subject: [PATCH] spi: s3c64xx: do not disable the clock while configuring the
 spi

When the clock is coming from the cmu it is not required to be
disabled and then re-enabled in order to change the rate.

Besides, some exynos chipsets (e.g. exynos5433) do not deliver
any to the SFR if one from the pclk ("spi" in this case) or sclk
("busclk") is disabled.

Remove the clock disabling/enabling to avoid falling into this
situation.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/spi/spi-s3c64xx.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index 9f0119f64f93..df88fa161d8a 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -596,9 +596,7 @@ static void s3c64xx_spi_config(struct s3c64xx_spi_driver_data *sdd)
 	u32 val;
 
 	/* Disable Clock */
-	if (sdd->port_conf->clk_from_cmu) {
-		clk_disable_unprepare(sdd->src_clk);
-	} else {
+	if (!sdd->port_conf->clk_from_cmu) {
 		val = readl(regs + S3C64XX_SPI_CLK_CFG);
 		val &= ~S3C64XX_SPI_ENCLK_ENABLE;
 		writel(val, regs + S3C64XX_SPI_CLK_CFG);
@@ -641,11 +639,7 @@ static void s3c64xx_spi_config(struct s3c64xx_spi_driver_data *sdd)
 	writel(val, regs + S3C64XX_SPI_MODE_CFG);
 
 	if (sdd->port_conf->clk_from_cmu) {
-		/* Configure Clock */
-		/* There is half-multiplier before the SPI */
 		clk_set_rate(sdd->src_clk, sdd->cur_speed * 2);
-		/* Enable Clock */
-		clk_prepare_enable(sdd->src_clk);
 	} else {
 		/* Configure Clock */
 		val = readl(regs + S3C64XX_SPI_CLK_CFG);
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] spi: s3c64xx: do not disable the clock while configuring the spi
  2016-07-07  9:58   ` Andi Shyti
@ 2016-07-07 12:24     ` Mark Brown
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2016-07-07 12:24 UTC (permalink / raw)
  To: Andi Shyti
  Cc: Sylwester Nawrocki, Kukjin Kim, Krzysztof Kozlowski,
	linux-arm-kernel, linux-samsung-soc, linux-spi, linux-kernel,
	Andi Shyti

[-- Attachment #1: Type: text/plain, Size: 302 bytes --]

On Thu, Jul 07, 2016 at 06:58:41PM +0900, Andi Shyti wrote:

> sorry, I will re-send it because I should not remove the comments
> above.... in the future someone might wonder why it's multiplied
> by 2.

I already applied and published this, can you please send an incremental
patch fixing the issue?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-07-07 12:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20160707072419epcas1p3ba881fb9b3270eb8cde87380aea7bcf9@epcas1p3.samsung.com>
2016-07-07  7:23 ` [PATCH] spi: s3c64xx: do not disable the clock while configuring the spi Andi Shyti
2016-07-07  9:41   ` Krzysztof Kozlowski
2016-07-07  9:58   ` Andi Shyti
2016-07-07 12:24     ` Mark Brown
2016-07-07 10:01   ` Applied "spi: s3c64xx: do not disable the clock while configuring the spi" to the spi tree Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).