[U-Boot] [PATCH 3/6] mmc: fsl_esdhc: Add CMD11 support to switch to 1.8V

Andy Fleming afleming at gmail.com
Thu Jun 19 17:23:55 CEST 2014


On Sun, Jun 15, 2014 at 7:46 PM, Otavio Salvador
<otavio at ossystems.com.br> wrote:
> This adds support to switch to 1.8V in case CMD11 succeeds.
>
> Signed-off-by: Otavio Salvador <otavio at ossystems.com.br>
> ---
>
>  drivers/mmc/fsl_esdhc.c | 30 +++++++++++++++++++++++-------
>  include/fsl_esdhc.h     |  2 ++
>  include/mmc.h           |  1 +
>  3 files changed, 26 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
> index 5541613..c75b38f 100644
> --- a/drivers/mmc/fsl_esdhc.c
> +++ b/drivers/mmc/fsl_esdhc.c
> @@ -47,19 +47,21 @@ struct fsl_esdhc {
>         uint    fevt;           /* Force event register */
>         uint    admaes;         /* ADMA error status register */
>         uint    adsaddr;        /* ADMA system address register */
> -       char    reserved2[160]; /* reserved */
> +       char    reserved2[100]; /* reserved */
> +       uint    vendorspec;     /* Vendor Specific register */
> +       char    reserved3[59];  /* reserved */
>         uint    hostver;        /* Host controller version register */
> -       char    reserved3[4];   /* reserved */
> -       uint    dmaerraddr;     /* DMA error address register */
>         char    reserved4[4];   /* reserved */
> -       uint    dmaerrattr;     /* DMA error attribute register */
> +       uint    dmaerraddr;     /* DMA error address register */
>         char    reserved5[4];   /* reserved */
> +       uint    dmaerrattr;     /* DMA error attribute register */
> +       char    reserved6[4];   /* reserved */
>         uint    hostcapblt2;    /* Host controller capabilities register 2 */
> -       char    reserved6[8];   /* reserved */
> +       char    reserved7[8];   /* reserved */
>         uint    tcr;            /* Tuning control register */
> -       char    reserved7[28];  /* reserved */
> +       char    reserved8[28];  /* reserved */
>         uint    sddirctl;       /* SD direction control register */
> -       char    reserved8[712]; /* reserved */
> +       char    reserved9[712]; /* reserved */
>         uint    scr;            /* eSDHC control register */
>  };
>
> @@ -334,6 +336,15 @@ esdhc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
>                 goto out;
>         }
>
> +       /* Switch voltage to 1.8V if CMD11 succeeded */
> +       if (cmd->cmdidx == SD_CMD_SWITCH_UHS18V) {
> +               esdhc_setbits32(&regs->vendorspec, ESDHC_VENDORSPEC_VSELECT);
> +
> +               printf("Run CMD11 1.8V switch\n");
> +               /* Sleep for 5 ms - max time for card to switch to 1.8V */
> +               udelay(5000);
> +       }
> +


This seems like the wrong place to put this sort of change. send_cmd
is meant to deal with sending a command and dealing with any errors.
Voltage changes should probably be handled by set_ios. It looks like
Linux actually implements a separate op for voltage change, but the
operation should be:

send CMD11
deactivate clock
change voltage
wait 5ms
reactivate clock
wait 1ms
check for errors


Andy


More information about the U-Boot mailing list