All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] SPI: fix APB pclk power regression on U300
@ 2010-08-21  9:07 ` Linus Walleij
  0 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2010-08-21  9:07 UTC (permalink / raw)
  To: Grant Likely, spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: Linus Walleij, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

With the introduction of an AMBA PrimeCell per-cell block clock,
the pclk was left on after probe() unless explicitly disabled.
This clock is wired to the same clock on PL022 causing it to stay
always on since.

Fix this up properly by clocking the pclk whenever we want to
write into any PL022 registers and clocking the external clock
whenever we want to transmit messages on the bus.

Signed-off-by: Linus Walleij <linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
---
Tested on U300 and U8500, even though the pclk stuff came in from
the ARM tree it is probably better to carry this through Grants
tree so as not to disturb other patches going in for PL022.
---
 drivers/spi/amba-pl022.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/spi/amba-pl022.c b/drivers/spi/amba-pl022.c
index 5b3f575..59f8cfb 100644
--- a/drivers/spi/amba-pl022.c
+++ b/drivers/spi/amba-pl022.c
@@ -503,8 +503,9 @@ static void giveback(struct pl022 *pl022)
 	msg->state = NULL;
 	if (msg->complete)
 		msg->complete(msg->context);
-	/* This message is completed, so let's turn off the clock! */
+	/* This message is completed, so let's turn off the clocks! */
 	clk_disable(pl022->clk);
+	amba_pclk_disable(pl022->adev);
 }
 
 /**
@@ -1139,9 +1140,10 @@ static void pump_messages(struct work_struct *work)
 	/* Setup the SPI using the per chip configuration */
 	pl022->cur_chip = spi_get_ctldata(pl022->cur_msg->spi);
 	/*
-	 * We enable the clock here, then the clock will be disabled when
+	 * We enable the clocks here, then the clocks will be disabled when
 	 * giveback() is called in each method (poll/interrupt/DMA)
 	 */
+	amba_pclk_enable(pl022->adev);
 	clk_enable(pl022->clk);
 	restore_state(pl022);
 	flush(pl022);
@@ -1787,11 +1789,9 @@ pl022_probe(struct amba_device *adev, struct amba_id *id)
 	}
 
 	/* Disable SSP */
-	clk_enable(pl022->clk);
 	writew((readw(SSP_CR1(pl022->virtbase)) & (~SSP_CR1_MASK_SSE)),
 	       SSP_CR1(pl022->virtbase));
 	load_ssp_default_config(pl022);
-	clk_disable(pl022->clk);
 
 	status = request_irq(adev->irq[0], pl022_interrupt_handler, 0, "pl022",
 			     pl022);
@@ -1819,6 +1819,8 @@ pl022_probe(struct amba_device *adev, struct amba_id *id)
 		goto err_spi_register;
 	}
 	dev_dbg(dev, "probe succeded\n");
+	/* Disable the silicon block pclk and clock it when needed */
+	amba_pclk_disable(adev);
 	return 0;
 
  err_spi_register:
@@ -1880,9 +1882,9 @@ static int pl022_suspend(struct amba_device *adev, pm_message_t state)
 		return status;
 	}
 
-	clk_enable(pl022->clk);
+	amba_pclk_enable(adev);
 	load_ssp_default_config(pl022);
-	clk_disable(pl022->clk);
+	amba_pclk_disable(adev);
 	dev_dbg(&adev->dev, "suspended\n");
 	return 0;
 }
-- 
1.6.3.3


------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 

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

* [PATCH] SPI: fix APB pclk power regression on U300
@ 2010-08-21  9:07 ` Linus Walleij
  0 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2010-08-21  9:07 UTC (permalink / raw)
  To: linux-arm-kernel

With the introduction of an AMBA PrimeCell per-cell block clock,
the pclk was left on after probe() unless explicitly disabled.
This clock is wired to the same clock on PL022 causing it to stay
always on since.

Fix this up properly by clocking the pclk whenever we want to
write into any PL022 registers and clocking the external clock
whenever we want to transmit messages on the bus.

Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
---
Tested on U300 and U8500, even though the pclk stuff came in from
the ARM tree it is probably better to carry this through Grants
tree so as not to disturb other patches going in for PL022.
---
 drivers/spi/amba-pl022.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/spi/amba-pl022.c b/drivers/spi/amba-pl022.c
index 5b3f575..59f8cfb 100644
--- a/drivers/spi/amba-pl022.c
+++ b/drivers/spi/amba-pl022.c
@@ -503,8 +503,9 @@ static void giveback(struct pl022 *pl022)
 	msg->state = NULL;
 	if (msg->complete)
 		msg->complete(msg->context);
-	/* This message is completed, so let's turn off the clock! */
+	/* This message is completed, so let's turn off the clocks! */
 	clk_disable(pl022->clk);
+	amba_pclk_disable(pl022->adev);
 }
 
 /**
@@ -1139,9 +1140,10 @@ static void pump_messages(struct work_struct *work)
 	/* Setup the SPI using the per chip configuration */
 	pl022->cur_chip = spi_get_ctldata(pl022->cur_msg->spi);
 	/*
-	 * We enable the clock here, then the clock will be disabled when
+	 * We enable the clocks here, then the clocks will be disabled when
 	 * giveback() is called in each method (poll/interrupt/DMA)
 	 */
+	amba_pclk_enable(pl022->adev);
 	clk_enable(pl022->clk);
 	restore_state(pl022);
 	flush(pl022);
@@ -1787,11 +1789,9 @@ pl022_probe(struct amba_device *adev, struct amba_id *id)
 	}
 
 	/* Disable SSP */
-	clk_enable(pl022->clk);
 	writew((readw(SSP_CR1(pl022->virtbase)) & (~SSP_CR1_MASK_SSE)),
 	       SSP_CR1(pl022->virtbase));
 	load_ssp_default_config(pl022);
-	clk_disable(pl022->clk);
 
 	status = request_irq(adev->irq[0], pl022_interrupt_handler, 0, "pl022",
 			     pl022);
@@ -1819,6 +1819,8 @@ pl022_probe(struct amba_device *adev, struct amba_id *id)
 		goto err_spi_register;
 	}
 	dev_dbg(dev, "probe succeded\n");
+	/* Disable the silicon block pclk and clock it when needed */
+	amba_pclk_disable(adev);
 	return 0;
 
  err_spi_register:
@@ -1880,9 +1882,9 @@ static int pl022_suspend(struct amba_device *adev, pm_message_t state)
 		return status;
 	}
 
-	clk_enable(pl022->clk);
+	amba_pclk_enable(adev);
 	load_ssp_default_config(pl022);
-	clk_disable(pl022->clk);
+	amba_pclk_disable(adev);
 	dev_dbg(&adev->dev, "suspended\n");
 	return 0;
 }
-- 
1.6.3.3

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

* Re: [PATCH] SPI: fix APB pclk power regression on U300
  2010-08-21  9:07 ` Linus Walleij
@ 2010-08-23 17:30     ` Kevin Wells
  -1 siblings, 0 replies; 6+ messages in thread
From: Kevin Wells @ 2010-08-23 17:30 UTC (permalink / raw)
  To: Linus Walleij
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

> With the introduction of an AMBA PrimeCell per-cell block clock,
> the pclk was left on after probe() unless explicitly disabled.
> This clock is wired to the same clock on PL022 causing it to stay
> always on since.
>
> Fix this up properly by clocking the pclk whenever we want to
> write into any PL022 registers and clocking the external clock
> whenever we want to transmit messages on the bus.
>
> Signed-off-by: Linus Walleij <linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
> ---
> Tested on U300 and U8500, even though the pclk stuff came in from
> the ARM tree it is probably better to carry this through Grants
> tree so as not to disturb other patches going in for PL022.
> ---
>  drivers/spi/amba-pl022.c |   14 ++++++++------
>  1 files changed, 8 insertions(+), 6 deletions(-)
>

Tested-by : Kevin Wells <wellsk40-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users 
worldwide. Take advantage of special opportunities to increase revenue and 
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d

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

* [spi-devel-general] [PATCH] SPI: fix APB pclk power regression on U300
@ 2010-08-23 17:30     ` Kevin Wells
  0 siblings, 0 replies; 6+ messages in thread
From: Kevin Wells @ 2010-08-23 17:30 UTC (permalink / raw)
  To: linux-arm-kernel

> With the introduction of an AMBA PrimeCell per-cell block clock,
> the pclk was left on after probe() unless explicitly disabled.
> This clock is wired to the same clock on PL022 causing it to stay
> always on since.
>
> Fix this up properly by clocking the pclk whenever we want to
> write into any PL022 registers and clocking the external clock
> whenever we want to transmit messages on the bus.
>
> Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
> ---
> Tested on U300 and U8500, even though the pclk stuff came in from
> the ARM tree it is probably better to carry this through Grants
> tree so as not to disturb other patches going in for PL022.
> ---
> ?drivers/spi/amba-pl022.c | ? 14 ++++++++------
> ?1 files changed, 8 insertions(+), 6 deletions(-)
>

Tested-by : Kevin Wells <wellsk40@gmail.com>

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

* Re: [spi-devel-general] [PATCH] SPI: fix APB pclk power regression on U300
  2010-08-23 17:30     ` [spi-devel-general] " Kevin Wells
@ 2010-09-08 18:24       ` Grant Likely
  -1 siblings, 0 replies; 6+ messages in thread
From: Grant Likely @ 2010-09-08 18:24 UTC (permalink / raw)
  To: Kevin Wells; +Cc: spi-devel-general, Linus Walleij, linux-arm-kernel

On Mon, Aug 23, 2010 at 10:30:17AM -0700, Kevin Wells wrote:
> > With the introduction of an AMBA PrimeCell per-cell block clock,
> > the pclk was left on after probe() unless explicitly disabled.
> > This clock is wired to the same clock on PL022 causing it to stay
> > always on since.
> >
> > Fix this up properly by clocking the pclk whenever we want to
> > write into any PL022 registers and clocking the external clock
> > whenever we want to transmit messages on the bus.
> >
> > Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
> > ---
> > Tested on U300 and U8500, even though the pclk stuff came in from
> > the ARM tree it is probably better to carry this through Grants
> > tree so as not to disturb other patches going in for PL022.
> > ---
> >  drivers/spi/amba-pl022.c |   14 ++++++++------
> >  1 files changed, 8 insertions(+), 6 deletions(-)
> >
> 
> Tested-by : Kevin Wells <wellsk40@gmail.com>

Applied, thanks.

g.

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

* [spi-devel-general] [PATCH] SPI: fix APB pclk power regression on U300
@ 2010-09-08 18:24       ` Grant Likely
  0 siblings, 0 replies; 6+ messages in thread
From: Grant Likely @ 2010-09-08 18:24 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Aug 23, 2010 at 10:30:17AM -0700, Kevin Wells wrote:
> > With the introduction of an AMBA PrimeCell per-cell block clock,
> > the pclk was left on after probe() unless explicitly disabled.
> > This clock is wired to the same clock on PL022 causing it to stay
> > always on since.
> >
> > Fix this up properly by clocking the pclk whenever we want to
> > write into any PL022 registers and clocking the external clock
> > whenever we want to transmit messages on the bus.
> >
> > Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
> > ---
> > Tested on U300 and U8500, even though the pclk stuff came in from
> > the ARM tree it is probably better to carry this through Grants
> > tree so as not to disturb other patches going in for PL022.
> > ---
> > ?drivers/spi/amba-pl022.c | ? 14 ++++++++------
> > ?1 files changed, 8 insertions(+), 6 deletions(-)
> >
> 
> Tested-by : Kevin Wells <wellsk40@gmail.com>

Applied, thanks.

g.

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

end of thread, other threads:[~2010-09-08 18:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-21  9:07 [PATCH] SPI: fix APB pclk power regression on U300 Linus Walleij
2010-08-21  9:07 ` Linus Walleij
     [not found] ` <1282381656-8644-1-git-send-email-linus.walleij-0IS4wlFg1OjSUeElwK9/Pw@public.gmane.org>
2010-08-23 17:30   ` Kevin Wells
2010-08-23 17:30     ` [spi-devel-general] " Kevin Wells
2010-09-08 18:24     ` Grant Likely
2010-09-08 18:24       ` Grant Likely

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.