* [PATCH] mmc: core: remove waiting time when clkgate_delay is set
@ 2012-02-29 5:52 Chanho Park
2012-03-01 6:34 ` Sujit Reddy Thumma
2012-03-02 21:12 ` Chris Ball
0 siblings, 2 replies; 4+ messages in thread
From: Chanho Park @ 2012-02-29 5:52 UTC (permalink / raw
To: cjb; +Cc: linux-mmc, Chanho Park, Kyungmin Park
Since recent commit("mmc: core: Use delayed work in clock gating
framework":597dd9d79cfbbb1), we always wait "unnecessary" default
clock delay(8 cycles). Actually, we don't need it if clkgate_delay
(unit:ms) is set because we already wait sufficient time to change
the clock due to delayed_workqueue.
This patch removes duplicated waiting time when clkgate_delay is set.
Signed-off-by: Chanho Park <chanho61.park@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
drivers/mmc/core/host.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index c3704e2..d710ce0 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -109,8 +109,11 @@ static void mmc_host_clk_gate_delayed(struct mmc_host *host)
*/
if (!host->clk_requests) {
spin_unlock_irqrestore(&host->clk_lock, flags);
- tick_ns = DIV_ROUND_UP(1000000000, freq);
- ndelay(host->clk_delay * tick_ns);
+ /* wait only when clk_gate_delay is 0*/
+ if (!host->clkgate_delay) {
+ tick_ns = DIV_ROUND_UP(1000000000, freq);
+ ndelay(host->clk_delay * tick_ns);
+ }
} else {
/* New users appeared while waiting for this work */
spin_unlock_irqrestore(&host->clk_lock, flags);
--
1.7.5.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mmc: core: remove waiting time when clkgate_delay is set
2012-02-29 5:52 [PATCH] mmc: core: remove waiting time when clkgate_delay is set Chanho Park
@ 2012-03-01 6:34 ` Sujit Reddy Thumma
2012-03-02 21:12 ` Chris Ball
1 sibling, 0 replies; 4+ messages in thread
From: Sujit Reddy Thumma @ 2012-03-01 6:34 UTC (permalink / raw
To: Chanho Park; +Cc: cjb, linux-mmc, Kyungmin Park
On 2/29/2012 11:22 AM, Chanho Park wrote:
> Since recent commit("mmc: core: Use delayed work in clock gating
> framework":597dd9d79cfbbb1), we always wait "unnecessary" default
> clock delay(8 cycles). Actually, we don't need it if clkgate_delay
> (unit:ms) is set because we already wait sufficient time to change
> the clock due to delayed_workqueue.
> This patch removes duplicated waiting time when clkgate_delay is set.
>
> Signed-off-by: Chanho Park<chanho61.park@samsung.com>
> Signed-off-by: Kyungmin Park<kyungmin.park@samsung.com>
> ---
> drivers/mmc/core/host.c | 7 +++++--
> 1 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
> index c3704e2..d710ce0 100644
> --- a/drivers/mmc/core/host.c
> +++ b/drivers/mmc/core/host.c
> @@ -109,8 +109,11 @@ static void mmc_host_clk_gate_delayed(struct mmc_host *host)
> */
> if (!host->clk_requests) {
> spin_unlock_irqrestore(&host->clk_lock, flags);
> - tick_ns = DIV_ROUND_UP(1000000000, freq);
> - ndelay(host->clk_delay * tick_ns);
> + /* wait only when clk_gate_delay is 0*/
Actually, we should check whether the clkgate_delay is giving sufficient
clock cycles instead of just >0 value. But since min. f_min in freq.
table is 100KHz (8CLK cyles is ~80us) and clkgate_delay can only
specified in milliseconds as of now, I think this should be fine.
> + if (!host->clkgate_delay) {
> + tick_ns = DIV_ROUND_UP(1000000000, freq);
> + ndelay(host->clk_delay * tick_ns);
> + }
> } else {
> /* New users appeared while waiting for this work */
> spin_unlock_irqrestore(&host->clk_lock, flags);
Reviewed-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
Thanks,
Sujit
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mmc: core: remove waiting time when clkgate_delay is set
2012-02-29 5:52 [PATCH] mmc: core: remove waiting time when clkgate_delay is set Chanho Park
2012-03-01 6:34 ` Sujit Reddy Thumma
@ 2012-03-02 21:12 ` Chris Ball
2012-03-04 23:39 ` Chanho Park
1 sibling, 1 reply; 4+ messages in thread
From: Chris Ball @ 2012-03-02 21:12 UTC (permalink / raw
To: Chanho Park; +Cc: linux-mmc, Kyungmin Park, Guennadi Liakhovetski
Hi,
On Wed, Feb 29 2012, Chanho Park wrote:
> Since recent commit("mmc: core: Use delayed work in clock gating
> framework":597dd9d79cfbbb1), we always wait "unnecessary" default
> clock delay(8 cycles). Actually, we don't need it if clkgate_delay
> (unit:ms) is set because we already wait sufficient time to change
> the clock due to delayed_workqueue.
> This patch removes duplicated waiting time when clkgate_delay is set.
>
> Signed-off-by: Chanho Park <chanho61.park@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
> drivers/mmc/core/host.c | 7 +++++--
> 1 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
> index c3704e2..d710ce0 100644
> --- a/drivers/mmc/core/host.c
> +++ b/drivers/mmc/core/host.c
> @@ -109,8 +109,11 @@ static void mmc_host_clk_gate_delayed(struct mmc_host *host)
> */
> if (!host->clk_requests) {
> spin_unlock_irqrestore(&host->clk_lock, flags);
> - tick_ns = DIV_ROUND_UP(1000000000, freq);
> - ndelay(host->clk_delay * tick_ns);
> + /* wait only when clk_gate_delay is 0*/
> + if (!host->clkgate_delay) {
> + tick_ns = DIV_ROUND_UP(1000000000, freq);
> + ndelay(host->clk_delay * tick_ns);
> + }
> } else {
> /* New users appeared while waiting for this work */
> spin_unlock_irqrestore(&host->clk_lock, flags);
Have you seen Guennadi's patch?
http://git.kernel.org/?p=linux/kernel/git/cjb/mmc.git;a=commitdiff;h=63871af54a0f0053de6534afe8da101b988b86b6
- Chris.
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
One Laptop Per Child
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] mmc: core: remove waiting time when clkgate_delay is set
2012-03-02 21:12 ` Chris Ball
@ 2012-03-04 23:39 ` Chanho Park
0 siblings, 0 replies; 4+ messages in thread
From: Chanho Park @ 2012-03-04 23:39 UTC (permalink / raw
To: 'Chris Ball'
Cc: linux-mmc, 'Kyungmin Park',
'Guennadi Liakhovetski'
Hi,
> -----Original Message-----
> From: Chris Ball [mailto:cjb@laptop.org]
> Sent: Saturday, March 03, 2012 6:12 AM
> To: Chanho Park
> Cc: linux-mmc@vger.kernel.org; Kyungmin Park; Guennadi Liakhovetski
> Subject: Re: [PATCH] mmc: core: remove waiting time when clkgate_delay is
> set
>
> Hi,
>
> On Wed, Feb 29 2012, Chanho Park wrote:
> > Since recent commit("mmc: core: Use delayed work in clock gating
> > framework":597dd9d79cfbbb1), we always wait "unnecessary" default
> > clock delay(8 cycles). Actually, we don't need it if clkgate_delay
> > (unit:ms) is set because we already wait sufficient time to change the
> > clock due to delayed_workqueue.
> > This patch removes duplicated waiting time when clkgate_delay is set.
> >
> > Signed-off-by: Chanho Park <chanho61.park@samsung.com>
> > Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> > ---
> > drivers/mmc/core/host.c | 7 +++++--
> > 1 files changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index
> > c3704e2..d710ce0 100644
> > --- a/drivers/mmc/core/host.c
> > +++ b/drivers/mmc/core/host.c
> > @@ -109,8 +109,11 @@ static void mmc_host_clk_gate_delayed(struct
> mmc_host *host)
> > */
> > if (!host->clk_requests) {
> > spin_unlock_irqrestore(&host->clk_lock, flags);
> > - tick_ns = DIV_ROUND_UP(1000000000, freq);
> > - ndelay(host->clk_delay * tick_ns);
> > + /* wait only when clk_gate_delay is 0*/
> > + if (!host->clkgate_delay) {
> > + tick_ns = DIV_ROUND_UP(1000000000, freq);
> > + ndelay(host->clk_delay * tick_ns);
> > + }
> > } else {
> > /* New users appeared while waiting for this work */
> > spin_unlock_irqrestore(&host->clk_lock, flags);
>
> Have you seen Guennadi's patch?
>
> http://git.kernel.org/?p=linux/kernel/git/cjb/mmc.git;a=commitdiff;h=63871
> af54a0f0053de6534afe8da101b988b86b6
I'd already seen the patch. There is no problem if a user didn't set a clkgate_delay.
However, if he wants to set a "clkgate_delay", a "clk_delay" is no longer needed.
Because, clk_delay(basically 8 cycles) always fall within "clkgate_delay".
I remove this "duplicated" wait.
Best regards,
Chanho Park
>
> - Chris.
> --
> Chris Ball <cjb@laptop.org> <http://printf.net/>
> One Laptop Per Child
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-03-04 23:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-29 5:52 [PATCH] mmc: core: remove waiting time when clkgate_delay is set Chanho Park
2012-03-01 6:34 ` Sujit Reddy Thumma
2012-03-02 21:12 ` Chris Ball
2012-03-04 23:39 ` Chanho Park
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.