Re: [PATCH v4 11/13] mmc: mmci: add f_max to variant structure

2014-05-30 Thread Srinivas Kandagatla

Thanks Ulf,

On 30/05/14 11:28, Ulf Hansson wrote:

  */
>-   if (host->mclk > 1) {
>-   ret = clk_set_rate(host->clk, 1);
>+   if (host->mclk > host->variant->f_max) {

You can use the local variant pointer directly, instead of host->variant.


yes, Will do that in next version.

Thanks,
srini

>+   ret = clk_set_rate(host->clk, host->variant->f_max);
> if (ret < 0)
> goto clk_disable;
> host->mclk = clk_get_rate(host->clk);
>--

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v4 11/13] mmc: mmci: add f_max to variant structure

2014-05-30 Thread Ulf Hansson
On 28 May 2014 15:47,   wrote:
> From: Srinivas Kandagatla 
>
> Some of the controller have maximum supported frequency, This patch adds
> support in variant data structure to specify such restrictions. This
> gives more flexibility in calculating the f_max before passing it to
> mmc-core.
>
> Signed-off-by: Srinivas Kandagatla 
> ---
>  drivers/mmc/host/mmci.c | 14 --
>  1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
> index fd40f9a..202f2d5 100644
> --- a/drivers/mmc/host/mmci.c
> +++ b/drivers/mmc/host/mmci.c
> @@ -67,6 +67,7 @@ static unsigned int fmax = 515633;
>   * @blksz_datactrl4: true if Block size is at b4..b16 position in datactrl
>   *  register
>   * @pwrreg_powerup: power up value for MMCIPOWER register
> + * @f_max: maximum clk frequency supported by the controller.
>   * @signal_direction: input/out direction of bus signals can be indicated
>   * @pwrreg_clkgate: MMCIPOWER register must be used to gate the clock
>   * @busy_detect: true if busy detection on dat0 is supported
> @@ -87,6 +88,7 @@ struct variant_data {
> boolblksz_datactrl16;
> boolblksz_datactrl4;
> u32 pwrreg_powerup;
> +   u32 f_max;
> boolsignal_direction;
> boolpwrreg_clkgate;
> boolbusy_detect;
> @@ -98,6 +100,7 @@ static struct variant_data variant_arm = {
> .fifohalfsize   = 8 * 4,
> .datalength_bits= 16,
> .pwrreg_powerup = MCI_PWR_UP,
> +   .f_max  = 1,
>  };
>
>  static struct variant_data variant_arm_extended_fifo = {
> @@ -105,6 +108,7 @@ static struct variant_data variant_arm_extended_fifo = {
> .fifohalfsize   = 64 * 4,
> .datalength_bits= 16,
> .pwrreg_powerup = MCI_PWR_UP,
> +   .f_max  = 1,
>  };
>
>  static struct variant_data variant_arm_extended_fifo_hwfc = {
> @@ -113,6 +117,7 @@ static struct variant_data variant_arm_extended_fifo_hwfc 
> = {
> .clkreg_enable  = MCI_ARM_HWFCEN,
> .datalength_bits= 16,
> .pwrreg_powerup = MCI_PWR_UP,
> +   .f_max  = 1,
>  };
>
>  static struct variant_data variant_u300 = {
> @@ -123,6 +128,7 @@ static struct variant_data variant_u300 = {
> .datalength_bits= 16,
> .sdio   = true,
> .pwrreg_powerup = MCI_PWR_ON,
> +   .f_max  = 1,
> .signal_direction   = true,
> .pwrreg_clkgate = true,
> .pwrreg_nopower = true,
> @@ -136,6 +142,7 @@ static struct variant_data variant_nomadik = {
> .sdio   = true,
> .st_clkdiv  = true,
> .pwrreg_powerup = MCI_PWR_ON,
> +   .f_max  = 1,
> .signal_direction   = true,
> .pwrreg_clkgate = true,
> .pwrreg_nopower = true,
> @@ -152,6 +159,7 @@ static struct variant_data variant_ux500 = {
> .sdio   = true,
> .st_clkdiv  = true,
> .pwrreg_powerup = MCI_PWR_ON,
> +   .f_max  = 1,
> .signal_direction   = true,
> .pwrreg_clkgate = true,
> .busy_detect= true,
> @@ -171,6 +179,7 @@ static struct variant_data variant_ux500v2 = {
> .st_clkdiv  = true,
> .blksz_datactrl16   = true,
> .pwrreg_powerup = MCI_PWR_ON,
> +   .f_max  = 1,
> .signal_direction   = true,
> .pwrreg_clkgate = true,
> .busy_detect= true,
> @@ -189,6 +198,7 @@ static struct variant_data variant_qcom = {
> .blksz_datactrl4= true,
> .datalength_bits= 24,
> .pwrreg_powerup = MCI_PWR_UP,
> +   .f_max  = 20800,
>  };
>
>  static int mmci_card_busy(struct mmc_host *mmc)
> @@ -1485,8 +1495,8 @@ static int mmci_probe(struct amba_device *dev,
>  * so we try to adjust the clock down to this,
>  * (if possible).
>  */
> -   if (host->mclk > 1) {
> -   ret = clk_set_rate(host->clk, 1);
> +   if (host->mclk > host->variant->f_max) {

You can use the local variant pointer directly, instead of host->variant.

> +   ret = clk_set_rate(host->clk, host->variant->f_max);
> if (ret < 0)
> goto clk_disable;
> host->mclk = clk_get_rate(host->clk);
> --
> 1.9.1
>

Looks good otherwise!

Kind regards
Ulf Hansson
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body

[PATCH v4 11/13] mmc: mmci: add f_max to variant structure

2014-05-28 Thread srinivas . kandagatla
From: Srinivas Kandagatla 

Some of the controller have maximum supported frequency, This patch adds
support in variant data structure to specify such restrictions. This
gives more flexibility in calculating the f_max before passing it to
mmc-core.

Signed-off-by: Srinivas Kandagatla 
---
 drivers/mmc/host/mmci.c | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index fd40f9a..202f2d5 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -67,6 +67,7 @@ static unsigned int fmax = 515633;
  * @blksz_datactrl4: true if Block size is at b4..b16 position in datactrl
  *  register
  * @pwrreg_powerup: power up value for MMCIPOWER register
+ * @f_max: maximum clk frequency supported by the controller.
  * @signal_direction: input/out direction of bus signals can be indicated
  * @pwrreg_clkgate: MMCIPOWER register must be used to gate the clock
  * @busy_detect: true if busy detection on dat0 is supported
@@ -87,6 +88,7 @@ struct variant_data {
boolblksz_datactrl16;
boolblksz_datactrl4;
u32 pwrreg_powerup;
+   u32 f_max;
boolsignal_direction;
boolpwrreg_clkgate;
boolbusy_detect;
@@ -98,6 +100,7 @@ static struct variant_data variant_arm = {
.fifohalfsize   = 8 * 4,
.datalength_bits= 16,
.pwrreg_powerup = MCI_PWR_UP,
+   .f_max  = 1,
 };
 
 static struct variant_data variant_arm_extended_fifo = {
@@ -105,6 +108,7 @@ static struct variant_data variant_arm_extended_fifo = {
.fifohalfsize   = 64 * 4,
.datalength_bits= 16,
.pwrreg_powerup = MCI_PWR_UP,
+   .f_max  = 1,
 };
 
 static struct variant_data variant_arm_extended_fifo_hwfc = {
@@ -113,6 +117,7 @@ static struct variant_data variant_arm_extended_fifo_hwfc = 
{
.clkreg_enable  = MCI_ARM_HWFCEN,
.datalength_bits= 16,
.pwrreg_powerup = MCI_PWR_UP,
+   .f_max  = 1,
 };
 
 static struct variant_data variant_u300 = {
@@ -123,6 +128,7 @@ static struct variant_data variant_u300 = {
.datalength_bits= 16,
.sdio   = true,
.pwrreg_powerup = MCI_PWR_ON,
+   .f_max  = 1,
.signal_direction   = true,
.pwrreg_clkgate = true,
.pwrreg_nopower = true,
@@ -136,6 +142,7 @@ static struct variant_data variant_nomadik = {
.sdio   = true,
.st_clkdiv  = true,
.pwrreg_powerup = MCI_PWR_ON,
+   .f_max  = 1,
.signal_direction   = true,
.pwrreg_clkgate = true,
.pwrreg_nopower = true,
@@ -152,6 +159,7 @@ static struct variant_data variant_ux500 = {
.sdio   = true,
.st_clkdiv  = true,
.pwrreg_powerup = MCI_PWR_ON,
+   .f_max  = 1,
.signal_direction   = true,
.pwrreg_clkgate = true,
.busy_detect= true,
@@ -171,6 +179,7 @@ static struct variant_data variant_ux500v2 = {
.st_clkdiv  = true,
.blksz_datactrl16   = true,
.pwrreg_powerup = MCI_PWR_ON,
+   .f_max  = 1,
.signal_direction   = true,
.pwrreg_clkgate = true,
.busy_detect= true,
@@ -189,6 +198,7 @@ static struct variant_data variant_qcom = {
.blksz_datactrl4= true,
.datalength_bits= 24,
.pwrreg_powerup = MCI_PWR_UP,
+   .f_max  = 20800,
 };
 
 static int mmci_card_busy(struct mmc_host *mmc)
@@ -1485,8 +1495,8 @@ static int mmci_probe(struct amba_device *dev,
 * so we try to adjust the clock down to this,
 * (if possible).
 */
-   if (host->mclk > 1) {
-   ret = clk_set_rate(host->clk, 1);
+   if (host->mclk > host->variant->f_max) {
+   ret = clk_set_rate(host->clk, host->variant->f_max);
if (ret < 0)
goto clk_disable;
host->mclk = clk_get_rate(host->clk);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/