Re: [PATCH V6] mmc: core: Add host capability check for power class

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

 



Ignore this patch

On 14 December 2011 11:44, Girish K S <girish.shivananjappa@xxxxxxxxxx> wrote:
> This patch adds a check whether the host supports maximum current value
> obtained from the device's extended csd register for a selected interface
> voltage and frequency.
>
> cc: Chris Ball <cjb@xxxxxxxxxx>
> Signed-off-by: Girish K S <girish.shivananjappa@xxxxxxxxxx>
> ---
> Changes in v6:
>        Added the check whehter the host supports the max current value
>        read from the extended csd register.
>
> Changes in v5:
>       Replace break statement with appropriate return error value in
>       drivers/mmc/core/mmc.c for unsupported voltage range.
>
> Changes in v4:
>       updated with review comments.
>
> Changes in v3:
>       updated with review comments made by chris ball. patch generated
>       by rebasing to chris balls mmc-next branch.
>
> Changes in v2:
>       This patch version removes some checkpatch error
>
> Changes in v1:
>       This version modifies the power_class_select function prototype.
>       During device enumeration, when the host tries to read the extended
>       csd register after switching to higher bus width, the read fails at
>       higher bus width. So the power_class_select function is modified to
>       reuse the extended csd register values read with 1 bit bus width.
>
>  drivers/mmc/core/mmc.c   |   27 +++++++++++++++++++++++++++
>  include/linux/mmc/card.h |    4 ++++
>  2 files changed, 31 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> index 006e932..30d1cbc 100644
> --- a/drivers/mmc/core/mmc.c
> +++ b/drivers/mmc/core/mmc.c
> @@ -688,6 +688,33 @@ static int mmc_select_powerclass(struct mmc_card *card,
>                pwrclass_val = (pwrclass_val & EXT_CSD_PWR_CL_4BIT_MASK) >>
>                                EXT_CSD_PWR_CL_4BIT_SHIFT;
>
> +       if (card->host->caps & MMC_CAP_MAX_CURRENT_800) {
> +               if (pwrclass_val >= MMC_MAX_CURRENT_800)
> +                       pwrclass_val = MMC_MAX_CURRENT_800;
> +               else if (pwrclass_val >= MMC_MAX_CURRENT_600)
> +                       pwrclass_val = MMC_MAX_CURRENT_600;
> +               else if (pwrclass_val >= MMC_MAX_CURRENT_400)
> +                       pwrclass_val = MMC_MAX_CURRENT_400;
> +               else if (pwrclass_val >= MMC_MAX_CURRENT_200)
> +                       pwrclass_val = MMC_MAX_CURRENT_200;
> +       } else if (card->host->caps & MMC_CAP_MAX_CURRENT_600) {
> +               if (pwrclass_val >= MMC_MAX_CURRENT_600)
> +                       pwrclass_val = MMC_MAX_CURRENT_600;
> +               else if (pwrclass_val >= MMC_MAX_CURRENT_400)
> +                       pwrclass_val = MMC_MAX_CURRENT_400;
> +               else if (pwrclass_val >= MMC_MAX_CURRENT_200)
> +                       pwrclass_val = MMC_MAX_CURRENT_200;
> +       } else if (card->host->caps & MMC_CAP_MAX_CURRENT_400) {
> +               if (pwrclass_val >= MMC_MAX_CURRENT_400)
> +                       pwrclass_val = MMC_MAX_CURRENT_400;
> +               else if (pwrclass_val >= MMC_MAX_CURRENT_200)
> +                       pwrclass_val = MMC_MAX_CURRENT_200;
> +       } else if (card->host->caps & MMC_CAP_MAX_CURRENT_200) {
> +               if (pwrclass_val >= MMC_MAX_CURRENT_200)
> +                       pwrclass_val = MMC_MAX_CURRENT_200;
> +       } else
> +               pwrclass_val = MMC_MAX_CURRENT_200;
> +
>        /* If the power class is different from the default value */
>        if (pwrclass_val > 0) {
>                err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
> diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
> index 9478a6b..c5e031a 100644
> --- a/include/linux/mmc/card.h
> +++ b/include/linux/mmc/card.h
> @@ -195,6 +195,10 @@ struct mmc_part {
>  #define MMC_BLK_DATA_AREA_GP   (1<<2)
>  };
>
> +#define MMC_MAX_CURRENT_200    (0)
> +#define MMC_MAX_CURRENT_400    (7)
> +#define MMC_MAX_CURRENT_600    (11)
> +#define MMC_MAX_CURRENT_800    (13)
>  /*
>  * MMC device
>  */
> --
> 1.7.1
>
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SoC Development]     [Linux Rockchip Development]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Linux SCSI]     [Yosemite News]

  Powered by Linux