Re: [PATCH] mmc: omap: remove clock rate hard coding

2011-12-27 Thread Chris Ball
Hi,

On Tue, Dec 20 2011, Venkatraman S wrote:
 From: Balaji TK balaj...@ti.com

 MMC master clock rate can vary for each instance of the MMC controller
 on the device. Use clk_get_rate instead to get the value.

   Signed-off-by: Balaji TK  balaj...@ti.com
   Reviewed-by: Venkatraman S svenk...@ti.com

Thanks, pushed to mmc-next for 3.3.

- Chris.
-- 
Chris Ball   c...@laptop.org   http://printf.net/
One Laptop Per Child
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] mmc: omap: remove clock rate hard coding

2011-12-20 Thread Venkatraman S
From: Balaji TK balaj...@ti.com

MMC master clock rate can vary for each instance of the MMC controller
on the device. Use clk_get_rate instead to get the value.

  Signed-off-by: Balaji TK  balaj...@ti.com
  Reviewed-by: Venkatraman S svenk...@ti.com
---
 drivers/mmc/host/omap_hsmmc.c |7 +++
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index d5fe43d..5b35c7e 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -120,7 +120,6 @@
 
 #define MMC_AUTOSUSPEND_DELAY  100
 #define MMC_TIMEOUT_MS 20
-#define OMAP_MMC_MASTER_CLOCK  9600
 #define OMAP_MMC_MIN_CLOCK 40
 #define OMAP_MMC_MAX_CLOCK 5200
 #define DRIVER_NAMEomap_hsmmc
@@ -598,12 +597,12 @@ static void omap_hsmmc_disable_irq(struct omap_hsmmc_host 
*host)
 }
 
 /* Calculate divisor for the given clock frequency */
-static u16 calc_divisor(struct mmc_ios *ios)
+static u16 calc_divisor(struct omap_hsmmc_host *host, struct mmc_ios *ios)
 {
u16 dsor = 0;
 
if (ios-clock) {
-   dsor = DIV_ROUND_UP(OMAP_MMC_MASTER_CLOCK, ios-clock);
+   dsor = DIV_ROUND_UP(clk_get_rate(host-fclk), ios-clock);
if (dsor  250)
dsor = 250;
}
@@ -623,7 +622,7 @@ static void omap_hsmmc_set_clock(struct omap_hsmmc_host 
*host)
 
regval = OMAP_HSMMC_READ(host-base, SYSCTL);
regval = regval  ~(CLKD_MASK | DTO_MASK);
-   regval = regval | (calc_divisor(ios)  6) | (DTO  16);
+   regval = regval | (calc_divisor(host, ios)  6) | (DTO  16);
OMAP_HSMMC_WRITE(host-base, SYSCTL, regval);
OMAP_HSMMC_WRITE(host-base, SYSCTL,
OMAP_HSMMC_READ(host-base, SYSCTL) | ICE);
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] mmc: omap: remove clock rate hard coding

2011-12-20 Thread Shilimkar, Santosh
On Tue, Dec 20, 2011 at 3:12 PM, Venkatraman S svenk...@ti.com wrote:
 From: Balaji TK balaj...@ti.com

 MMC master clock rate can vary for each instance of the MMC controller
 on the device. Use clk_get_rate instead to get the value.

  Signed-off-by: Balaji TK  balaj...@ti.com
  Reviewed-by: Venkatraman S svenk...@ti.com
 ---
Finally.
Feel free to add if you need one
Acked-by: Santosh Shilimkar santosh.shilim...@ti.com
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] mmc: omap: remove clock rate hard coding

2011-12-20 Thread Hebbar, Gururaja
On Tue, Dec 20, 2011 at 15:12, S, Venkatraman wrote:
 From: Balaji TK balaj...@ti.com
 
 MMC master clock rate can vary for each instance of the MMC controller
 on the device. Use clk_get_rate instead to get the value.
 
   Signed-off-by: Balaji TK  balaj...@ti.com
   Reviewed-by: Venkatraman S svenk...@ti.com
 ---
  drivers/mmc/host/omap_hsmmc.c |7 +++
  1 files changed, 3 insertions(+), 4 deletions(-)
 
 diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
 index d5fe43d..5b35c7e 100644
 --- a/drivers/mmc/host/omap_hsmmc.c
 +++ b/drivers/mmc/host/omap_hsmmc.c
 @@ -120,7 +120,6 @@
  
  #define MMC_AUTOSUSPEND_DELAY100
  #define MMC_TIMEOUT_MS   20
 -#define OMAP_MMC_MASTER_CLOCK9600
  #define OMAP_MMC_MIN_CLOCK   40
  #define OMAP_MMC_MAX_CLOCK   5200
  #define DRIVER_NAME  omap_hsmmc
 @@ -598,12 +597,12 @@ static void omap_hsmmc_disable_irq(struct 
 omap_hsmmc_host *host)
  }
  
  /* Calculate divisor for the given clock frequency */
 -static u16 calc_divisor(struct mmc_ios *ios)
 +static u16 calc_divisor(struct omap_hsmmc_host *host, struct mmc_ios *ios)
  {
   u16 dsor = 0;
  
   if (ios-clock) {
 - dsor = DIV_ROUND_UP(OMAP_MMC_MASTER_CLOCK, ios-clock);
 + dsor = DIV_ROUND_UP(clk_get_rate(host-fclk), ios-clock);
   if (dsor  250)
   dsor = 250;
   }
 @@ -623,7 +622,7 @@ static void omap_hsmmc_set_clock(struct omap_hsmmc_host 
 *host)
  
   regval = OMAP_HSMMC_READ(host-base, SYSCTL);
   regval = regval  ~(CLKD_MASK | DTO_MASK);
 - regval = regval | (calc_divisor(ios)  6) | (DTO  16);
 + regval = regval | (calc_divisor(host, ios)  6) | (DTO  16);
   OMAP_HSMMC_WRITE(host-base, SYSCTL, regval);
   OMAP_HSMMC_WRITE(host-base, SYSCTL,
   OMAP_HSMMC_READ(host-base, SYSCTL) | ICE);
 -- 
 1.7.1
 
 --
 To unsubscribe from this list: send the line unsubscribe linux-omap in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 

Tested on AM335x platform.

Tested-by: Hebbar, Gururaja gururaja.heb...@ti.com

Regards, 
Gururaja
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html