All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 4/5] mmc: sh_sdhi: Add MMC version 5.0 support
Date: Sun, 14 May 2017 06:49:08 +0900	[thread overview]
Message-ID: <CABMQnVL=_HFa7hDM-bGoEyRLS5UtGksFjs2FtZABekM9ydSORg@mail.gmail.com> (raw)
In-Reply-To: <20170513135118.8134-4-marek.vasut+renesas@gmail.com>

Hi,

2017-05-13 22:51 GMT+09:00 Marek Vasut <marek.vasut@gmail.com>:
> From: Kouei Abe <kouei.abe.cp@renesas.com>
>
> Renesas SDHI SD/MMC driver did not support MMC version 5.0 devices.
> This adds MMC version 5.0 device support.
>
> Signed-off-by: Kouei Abe <kouei.abe.cp@renesas.com>
> Signed-off-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
> Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
> Cc: Jaehoon Chung <jh80.chung@samsung.com>

Reviewed-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>

> ---
>  arch/arm/mach-rmobile/include/mach/sh_sdhi.h |  7 ++++++-
>  drivers/mmc/sh_sdhi.c                        | 24 +++++++++++++++++++-----
>  2 files changed, 25 insertions(+), 6 deletions(-)
>
> diff --git a/arch/arm/mach-rmobile/include/mach/sh_sdhi.h b/arch/arm/mach-rmobile/include/mach/sh_sdhi.h
> index a5ea45b707..1fb0648b12 100644
> --- a/arch/arm/mach-rmobile/include/mach/sh_sdhi.h
> +++ b/arch/arm/mach-rmobile/include/mach/sh_sdhi.h
> @@ -50,8 +50,10 @@
>  /* SDHI CMD VALUE */
>  #define CMD_MASK                       0x0000ffff
>  #define SDHI_APP                       0x0040
> +#define SDHI_MMC_SEND_OP_COND          0x0701
>  #define SDHI_SD_APP_SEND_SCR           0x0073
>  #define SDHI_SD_SWITCH                 0x1C06
> +#define SDHI_MMC_SEND_EXT_CSD          0x1C08
>
>  /* SDHI_PORTSEL */
>  #define USE_1PORT                      (1 << 8) /* 1 port */
> @@ -120,7 +122,10 @@
>  #define CLK_ENABLE                     (1 << 8)
>
>  /* SDHI_OPTION */
> -#define OPT_BUS_WIDTH_1                        (1 << 15)       /* bus width = 1 bit */
> +#define OPT_BUS_WIDTH_M                        (5 << 13)       /* 101b (15-13bit) */
> +#define OPT_BUS_WIDTH_1                        (4 << 13)       /* bus width = 1 bit */
> +#define OPT_BUS_WIDTH_4                        (0 << 13)       /* bus width = 4 bit */
> +#define OPT_BUS_WIDTH_8                        (1 << 13)       /* bus width = 8 bit */
>
>  /* SDHI_ERR_STS1 */
>  #define ERR_STS1_CRC_ERROR             ((1 << 11) | (1 << 10) | (1 << 9) | \
> diff --git a/drivers/mmc/sh_sdhi.c b/drivers/mmc/sh_sdhi.c
> index d1dd0f0fc3..c64beb6e2a 100644
> --- a/drivers/mmc/sh_sdhi.c
> +++ b/drivers/mmc/sh_sdhi.c
> @@ -489,6 +489,13 @@ static unsigned short sh_sdhi_set_cmd(struct sh_sdhi_host *host,
>                 else /* SD_SWITCH */
>                         opc = SDHI_SD_SWITCH;
>                 break;
> +       case MMC_CMD_SEND_OP_COND:
> +               opc = SDHI_MMC_SEND_OP_COND;
> +               break;
> +       case MMC_CMD_SEND_EXT_CSD:
> +               if (data)
> +                       opc = SDHI_MMC_SEND_EXT_CSD;
> +               break;
>         default:
>                 break;
>         }
> @@ -513,6 +520,7 @@ static unsigned short sh_sdhi_data_trans(struct sh_sdhi_host *host,
>         case MMC_CMD_READ_SINGLE_BLOCK:
>         case SDHI_SD_APP_SEND_SCR:
>         case SDHI_SD_SWITCH: /* SD_SWITCH */
> +       case SDHI_MMC_SEND_EXT_CSD:
>                 ret = sh_sdhi_single_read(host, data);
>                 break;
>         default:
> @@ -648,12 +656,18 @@ static int sh_sdhi_set_ios(struct mmc *mmc)
>         if (ret)
>                 return -EINVAL;
>
> -       if (mmc->bus_width == 4)
> -               sh_sdhi_writew(host, SDHI_OPTION, ~OPT_BUS_WIDTH_1 &
> -                              sh_sdhi_readw(host, SDHI_OPTION));
> +       if (mmc->bus_width == 8)
> +               sh_sdhi_writew(host, SDHI_OPTION,
> +                              OPT_BUS_WIDTH_8 | (~OPT_BUS_WIDTH_M &
> +                              sh_sdhi_readw(host, SDHI_OPTION)));
> +       else if (mmc->bus_width == 4)
> +               sh_sdhi_writew(host, SDHI_OPTION,
> +                              OPT_BUS_WIDTH_4 | (~OPT_BUS_WIDTH_M &
> +                              sh_sdhi_readw(host, SDHI_OPTION)));
>         else
> -               sh_sdhi_writew(host, SDHI_OPTION, OPT_BUS_WIDTH_1 |
> -                              sh_sdhi_readw(host, SDHI_OPTION));
> +               sh_sdhi_writew(host, SDHI_OPTION,
> +                              OPT_BUS_WIDTH_1 | (~OPT_BUS_WIDTH_M &
> +                              sh_sdhi_readw(host, SDHI_OPTION)));
>
>         debug("clock = %d, buswidth = %d\n", mmc->clock, mmc->bus_width);
>
> --
> 2.11.0
>



-- 
Nobuhiro Iwamatsu
   iwamatsu at {nigauri.org / debian.org}
   GPG ID: 40AD1FA6

  reply	other threads:[~2017-05-13 21:49 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20170513135203epcas1p43a7388f762a571764fcfd1035be44dd2@epcas1p4.samsung.com>
2017-05-13 13:51 ` [U-Boot] [PATCH 1/5] mmc: sh_sdhi: Fix Kconfig entry Marek Vasut
2017-05-13 13:51   ` [U-Boot] [PATCH 2/5] mmc: sh_sdhi: Set SD_INFOx interrupt mask before command starting Marek Vasut
2017-05-13 21:45     ` Nobuhiro Iwamatsu
2017-05-25 13:40     ` Jaehoon Chung
2017-05-13 13:51   ` [U-Boot] [PATCH 3/5] mmc: sh_sdhi: Add 64-bit access to sd_buf support Marek Vasut
2017-05-13 21:46     ` Nobuhiro Iwamatsu
2017-05-25 13:43     ` Jaehoon Chung
     [not found]     ` <CGME20170601035058epcas1p16abeaa2e834d0e91d8626dce69646492@epcas1p1.samsung.com>
2017-06-01  3:50       ` [U-Boot] [U-Boot, " Jaehoon Chung
2017-05-13 13:51   ` [U-Boot] [PATCH 4/5] mmc: sh_sdhi: Add MMC version 5.0 support Marek Vasut
2017-05-13 21:49     ` Nobuhiro Iwamatsu [this message]
2017-05-25 13:45     ` Jaehoon Chung
2017-05-13 13:51   ` [U-Boot] [PATCH 5/5] mmc: sh_sdhi: Add SDHI support Marek Vasut
2017-05-13 21:49     ` Nobuhiro Iwamatsu
2017-05-25 13:45     ` Jaehoon Chung
2017-05-13 21:44   ` [U-Boot] [PATCH 1/5] mmc: sh_sdhi: Fix Kconfig entry Nobuhiro Iwamatsu
2017-05-25 13:39   ` Jaehoon Chung
2017-05-30 22:59     ` Nobuhiro Iwamatsu
2017-05-31  2:06       ` Jaehoon Chung
2017-05-31  5:07         ` Nobuhiro Iwamatsu
2017-06-05 11:57           ` Marek Vasut
2017-06-05 13:11             ` Jaehoon Chung
2017-06-05 13:32               ` Marek Vasut
2017-06-07  3:29                 ` Jaehoon Chung
2017-06-07  6:45                   ` Marek Vasut

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CABMQnVL=_HFa7hDM-bGoEyRLS5UtGksFjs2FtZABekM9ydSORg@mail.gmail.com' \
    --to=iwamatsu@nigauri.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.