Re: [PATCH 2/2] mmc: sh_mmcif: mmc->f_max should be half of the bus clock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 21 Mar 2012, Simon Horman wrote:

> 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.

The patch seems correct as it stands, however, looking at it - does anyone 
understands why that "close to 400kHz" comment and such a complicated 
calculation? Shouldn't it be just host->clk / 512 always? Maybe this 
should be a separate patch, so, for this one

Acked-by: Guennadi Liakhovetski <g.liakhovetski@xxxxxx>

Thanks
Guennadi

> 
> Cc: Guennadi Liakhovetski <g.liakhovetski@xxxxxx>
> Tested-by: Cao Minh Hiep <hiepcm@xxxxxxxxx>
> Signed-off-by: Simon Horman <horms@xxxxxxxxxxxx>
> ---
>  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
> 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux