Re: [PATCH 1/2] mmc: sh_mmcif: double clock speed

2012-03-24 Thread Guennadi Liakhovetski
Hi Simon

On Wed, 21 Mar 2012, Simon Horman wrote:

 This corrects an off-by one error when calculating the clock divisor.
 The code previously assumed that for example a divisor of 2 is
 set using a value of 0001 (the inverse of 1/2), a divisor of 4 is
 set using a value of 0010 (the inverse of 1/4) etc.. However, the correct
 values are , 0001, etc...
 
 The use of DIV_ROUND_UP() was suggested by Guennadi Liakhovetski to avoid
 understating the divisor by one in the case where the host clock is not a
 binary power of the MMCIF clock.

The patch looks good, but the commit message is not quite right. Cases of 
host-clk / clk != 2^n are handled by using fls(x - 1) instead of fls(x) - 
1, as you initially suggested. DIV_ROUND_UP() is needed for divisions with 
a residue. E.g., for host clock 13MHz, target clock 3MHz you want a 
divisor of 5, resulting in 2  16, not 4, resulting in 1  16. With this 
fixed

Acked-by: Guennadi Liakhovetski g.liakhovet...@gmx.de

Thanks
Guennadi

 
 Cc: Guennadi Liakhovetski g.liakhovet...@gmx.de
 Tested-by: Cao Minh Hiep hie...@gmail.com
 Signed-off-by: Simon Horman ho...@verge.net.au
 ---
  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
 

---
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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2012-03-24 Thread Guennadi Liakhovetski
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.liakhovet...@gmx.de

Thanks
Guennadi

 
 Cc: Guennadi Liakhovetski g.liakhovet...@gmx.de
 Tested-by: Cao Minh Hiep hie...@gmail.com
 Signed-off-by: Simon Horman ho...@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  5120)
 - mmc-f_min = mmc-f_max / 128;
 - else if (mmc-f_max  10240)
 - mmc-f_min = mmc-f_max / 256;
 + if (host-clk  5120)
 + mmc-f_min = host-clk / 128;
 + else if (host-clk  10240)
 + 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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/4] arm: at91: dt: sam9g25ek add mci support

2012-03-24 Thread Grant Likely
On Thu, 22 Mar 2012 15:53:01 +0100, Nicolas Ferre nicolas.fe...@atmel.com 
wrote:
 On 03/21/2012 07:03 PM, ludovic.desroc...@atmel.com :
  From: Ludovic Desroches ludovic.desroc...@atmel.com
  
  Signed-off-by: Ludovic Desroches ludovic.desroc...@atmel.com
 
 Signed-off-by: Nicolas Ferre nicolas.fe...@atmel.com

I think you really mean Acked-by.  It is only appropriate to add a
Signed-off-by tag when you have actually picked up and either
committed or reposted a patch.  When replying to a patch on the
mailing list and giving your okay, the correct tag is either
Acked-by or Reviewed-by  (The difference being that Acked-by
infers that you have some authority over the areas touched by the
patch).

See Documentation/SubmittingPatches

g.

 
  ---
   arch/arm/boot/dts/at91sam9g25ek.dts |   16 
   1 files changed, 16 insertions(+), 0 deletions(-)
  
  diff --git a/arch/arm/boot/dts/at91sam9g25ek.dts 
  b/arch/arm/boot/dts/at91sam9g25ek.dts
  index 7a13d09..960de2b 100644
  --- a/arch/arm/boot/dts/at91sam9g25ek.dts
  +++ b/arch/arm/boot/dts/at91sam9g25ek.dts
  @@ -32,6 +32,22 @@
  phy-mode = rmii;
  status = okay;
  };
  +
  +   mmc0: mmc@f0008000 {
  +   status = okay;
  +   slot@0 {
  +   bus-width = 4;
  +   cd-gpios = pioD 15 0;
  +   };
  +   };
  +
  +   mmc1: mmc@f000c000 {
  +   status = okay;
  +   slot@0 {
  +   bus-width = 4;
  +   cd-gpios = pioD 14 0;
  +   };
  +   };
  };
   
  usb0: ohci@0060 {
 
 
 -- 
 Nicolas Ferre
 
 ___
 linux-arm-kernel mailing list
 linux-arm-ker...@lists.infradead.org
 http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

-- 
Grant Likely, B.Sc, P.Eng.
Secret Lab Technologies,Ltd.
--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html