* [PATCH 0/3] mmc: sh_mmcif: Clock Tweaks
@ 2012-03-28 9:01 Simon Horman
2012-03-28 9:01 ` [PATCH 1/3] mmc: sh_mmcif: double clock speed Simon Horman
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Simon Horman @ 2012-03-28 9:01 UTC (permalink / raw)
To: linux-mmc
Cc: Chris Ball, Guennadi Liakhovetski, Magnus Damm, Cao Minh Hiep,
Simon Horman
Hi,
this series of three small patches cleans up the handling
of clocks in the MMCIF driver a little.
Simon Horman (3):
mmc: sh_mmcif: double clock speed
mmc: sh_mmcif: mmc->f_max should be half of the bus clock
mmc: sh_mmcif: Simplify calculation of mmc->f_min
drivers/mmc/host/sh_mmcif.c | 13 ++++---------
1 files changed, 4 insertions(+), 9 deletions(-)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/3] mmc: sh_mmcif: double clock speed
2012-03-28 9:01 [PATCH 0/3] mmc: sh_mmcif: Clock Tweaks Simon Horman
@ 2012-03-28 9:01 ` Simon Horman
2012-03-28 9:01 ` [PATCH 2/3] mmc: sh_mmcif: mmc->f_max should be half of the bus clock Simon Horman
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2012-03-28 9:01 UTC (permalink / raw)
To: linux-mmc
Cc: Chris Ball, Guennadi Liakhovetski, Magnus Damm, Cao Minh Hiep,
Simon Horman
Correct an off-by one error when calculating the clock divisor in cases
where the host clock is a power of two of the target clock. Previously the
divisor was one greater than the correct value in these cases leading to
the clock being set at half the desired speed.
Thanks to Guennadi Liakhovetski for working with me on
the logic for this change.
Tested-by: Cao Minh Hiep <hiepcm@gmail.com>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
v2
* Rewrite changelog
---
drivers/mmc/host/sh_mmcif.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
index 8057bf3..5014bc4 100644
--- a/drivers/mmc/host/sh_mmcif.c
+++ b/drivers/mmc/host/sh_mmcif.c
@@ -453,7 +453,8 @@ static void sh_mmcif_clock_control(struct sh_mmcif_host *host, unsigned int clk)
sh_mmcif_bitset(host, MMCIF_CE_CLK_CTRL, CLK_SUP_PCLK);
else
sh_mmcif_bitset(host, MMCIF_CE_CLK_CTRL, CLK_CLEAR &
- ((fls(host->clk / clk) - 1) << 16));
+ ((fls(DIV_ROUND_UP(host->clk,
+ clk) - 1) - 1) << 16));
sh_mmcif_bitset(host, MMCIF_CE_CLK_CTRL, CLK_ENABLE);
}
--
1.7.6.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] mmc: sh_mmcif: mmc->f_max should be half of the bus clock
2012-03-28 9:01 [PATCH 0/3] mmc: sh_mmcif: Clock Tweaks Simon Horman
2012-03-28 9:01 ` [PATCH 1/3] mmc: sh_mmcif: double clock speed Simon Horman
@ 2012-03-28 9:01 ` Simon Horman
2012-03-28 9:01 ` [PATCH 3/3] mmc: sh_mmcif: Simplify calculation of mmc->f_min Simon Horman
2012-04-01 4:13 ` [PATCH 0/3] mmc: sh_mmcif: Clock Tweaks Chris Ball
3 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2012-03-28 9:01 UTC (permalink / raw)
To: linux-mmc
Cc: Chris Ball, Guennadi Liakhovetski, Magnus Damm, Cao Minh Hiep,
Simon Horman
mmc->f_max should be half of the bus clock.
And now that mmc->f_max is not equal to the bus clock the
latter should be used directly to calculate mmc->f_min.
Cc: Magnus Damm <magnus.damm@gmail.com>
Tested-by: Cao Minh Hiep <hiepcm@gmail.com>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
drivers/mmc/host/sh_mmcif.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
index 5014bc4..1410baa 100644
--- a/drivers/mmc/host/sh_mmcif.c
+++ b/drivers/mmc/host/sh_mmcif.c
@@ -1297,14 +1297,14 @@ static int __devinit sh_mmcif_probe(struct platform_device *pdev)
spin_lock_init(&host->lock);
mmc->ops = &sh_mmcif_ops;
- mmc->f_max = host->clk;
+ mmc->f_max = host->clk / 2;
/* close to 400KHz */
- if (mmc->f_max < 51200000)
- mmc->f_min = mmc->f_max / 128;
- else if (mmc->f_max < 102400000)
- mmc->f_min = mmc->f_max / 256;
+ if (host->clk < 51200000)
+ mmc->f_min = host->clk / 128;
+ else if (host->clk < 102400000)
+ mmc->f_min = host->clk / 256;
else
- mmc->f_min = mmc->f_max / 512;
+ mmc->f_min = host->clk / 512;
if (pd->ocr)
mmc->ocr_avail = pd->ocr;
mmc->caps = MMC_CAP_MMC_HIGHSPEED;
--
1.7.6.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] mmc: sh_mmcif: Simplify calculation of mmc->f_min
2012-03-28 9:01 [PATCH 0/3] mmc: sh_mmcif: Clock Tweaks Simon Horman
2012-03-28 9:01 ` [PATCH 1/3] mmc: sh_mmcif: double clock speed Simon Horman
2012-03-28 9:01 ` [PATCH 2/3] mmc: sh_mmcif: mmc->f_max should be half of the bus clock Simon Horman
@ 2012-03-28 9:01 ` Simon Horman
2012-03-28 9:26 ` Guennadi Liakhovetski
2012-04-01 4:13 ` [PATCH 0/3] mmc: sh_mmcif: Clock Tweaks Chris Ball
3 siblings, 1 reply; 6+ messages in thread
From: Simon Horman @ 2012-03-28 9:01 UTC (permalink / raw)
To: linux-mmc
Cc: Chris Ball, Guennadi Liakhovetski, Magnus Damm, Cao Minh Hiep,
Simon Horman
There is no need to tune mmc->f_min to a value near 400kHz as the MMC core
begins testing frequencies at 400kHz regardless of the value of mmc->f_min.
As suggested by Guennadi Liakhovetski.
Cc: Magnus Damm <magnus.damm@gmail.com>
Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Tested-by: Cao Minh Hiep <hiepcm@gmail.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
drivers/mmc/host/sh_mmcif.c | 8 +-------
1 files changed, 1 insertions(+), 7 deletions(-)
diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
index 1410baa..f23b9bd 100644
--- a/drivers/mmc/host/sh_mmcif.c
+++ b/drivers/mmc/host/sh_mmcif.c
@@ -1298,13 +1298,7 @@ static int __devinit sh_mmcif_probe(struct platform_device *pdev)
mmc->ops = &sh_mmcif_ops;
mmc->f_max = host->clk / 2;
- /* close to 400KHz */
- if (host->clk < 51200000)
- mmc->f_min = host->clk / 128;
- else if (host->clk < 102400000)
- mmc->f_min = host->clk / 256;
- else
- mmc->f_min = host->clk / 512;
+ mmc->f_min = host->clk / 512;
if (pd->ocr)
mmc->ocr_avail = pd->ocr;
mmc->caps = MMC_CAP_MMC_HIGHSPEED;
--
1.7.6.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 3/3] mmc: sh_mmcif: Simplify calculation of mmc->f_min
2012-03-28 9:01 ` [PATCH 3/3] mmc: sh_mmcif: Simplify calculation of mmc->f_min Simon Horman
@ 2012-03-28 9:26 ` Guennadi Liakhovetski
0 siblings, 0 replies; 6+ messages in thread
From: Guennadi Liakhovetski @ 2012-03-28 9:26 UTC (permalink / raw)
To: Simon Horman; +Cc: linux-mmc, Chris Ball, Magnus Damm, Cao Minh Hiep
On Wed, 28 Mar 2012, Simon Horman wrote:
> There is no need to tune mmc->f_min to a value near 400kHz as the MMC core
> begins testing frequencies at 400kHz regardless of the value of mmc->f_min.
>
> As suggested by Guennadi Liakhovetski.
>
> Cc: Magnus Damm <magnus.damm@gmail.com>
> Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> Tested-by: Cao Minh Hiep <hiepcm@gmail.com>
> Signed-off-by: Simon Horman <horms@verge.net.au>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Thanks
Guennadi
> ---
> drivers/mmc/host/sh_mmcif.c | 8 +-------
> 1 files changed, 1 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c
> index 1410baa..f23b9bd 100644
> --- a/drivers/mmc/host/sh_mmcif.c
> +++ b/drivers/mmc/host/sh_mmcif.c
> @@ -1298,13 +1298,7 @@ static int __devinit sh_mmcif_probe(struct platform_device *pdev)
>
> mmc->ops = &sh_mmcif_ops;
> mmc->f_max = host->clk / 2;
> - /* close to 400KHz */
> - if (host->clk < 51200000)
> - mmc->f_min = host->clk / 128;
> - else if (host->clk < 102400000)
> - mmc->f_min = host->clk / 256;
> - else
> - mmc->f_min = host->clk / 512;
> + mmc->f_min = host->clk / 512;
> if (pd->ocr)
> mmc->ocr_avail = pd->ocr;
> mmc->caps = MMC_CAP_MMC_HIGHSPEED;
> --
> 1.7.6.3
>
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/3] mmc: sh_mmcif: Clock Tweaks
2012-03-28 9:01 [PATCH 0/3] mmc: sh_mmcif: Clock Tweaks Simon Horman
` (2 preceding siblings ...)
2012-03-28 9:01 ` [PATCH 3/3] mmc: sh_mmcif: Simplify calculation of mmc->f_min Simon Horman
@ 2012-04-01 4:13 ` Chris Ball
3 siblings, 0 replies; 6+ messages in thread
From: Chris Ball @ 2012-04-01 4:13 UTC (permalink / raw)
To: Simon Horman; +Cc: linux-mmc, Guennadi Liakhovetski, Magnus Damm, Cao Minh Hiep
Hi,
On Wed, Mar 28 2012, Simon Horman wrote:
> Hi,
>
> this series of three small patches cleans up the handling
> of clocks in the MMCIF driver a little.
>
> Simon Horman (3):
> mmc: sh_mmcif: double clock speed
> mmc: sh_mmcif: mmc->f_max should be half of the bus clock
> mmc: sh_mmcif: Simplify calculation of mmc->f_min
Thanks, pushed all three with Guennadi's ACKs to mmc-next for 3.4.
- Chris.
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
One Laptop Per Child
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-04-01 4:13 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-28 9:01 [PATCH 0/3] mmc: sh_mmcif: Clock Tweaks Simon Horman
2012-03-28 9:01 ` [PATCH 1/3] mmc: sh_mmcif: double clock speed Simon Horman
2012-03-28 9:01 ` [PATCH 2/3] mmc: sh_mmcif: mmc->f_max should be half of the bus clock Simon Horman
2012-03-28 9:01 ` [PATCH 3/3] mmc: sh_mmcif: Simplify calculation of mmc->f_min Simon Horman
2012-03-28 9:26 ` Guennadi Liakhovetski
2012-04-01 4:13 ` [PATCH 0/3] mmc: sh_mmcif: Clock Tweaks Chris Ball
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).