diff mbox

[2/7] mmc: sdhci-esdhc-imx: add SDHCI_TRANSFER_MODE read function

Message ID 1382365627-26816-3-git-send-email-b29396@freescale.com (mailing list archive)
State New, archived
Headers show

Commit Message

Aisheng Dong Oct. 21, 2013, 2:27 p.m. UTC
Used to read out the correct value of SDHCI_TRANSFER_MODE register
for upper layer.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
---
 drivers/mmc/host/sdhci-esdhc-imx.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

Comments

John Tobias Oct. 21, 2013, 4:01 p.m. UTC | #1
Hi Dong,

I compiled my kernel after applying your patch but it didn't compile
it correctly due to esdhc_is_usdhc function. It should be
is_imx6_usdhc?

Regards,

john

On Mon, Oct 21, 2013 at 7:27 AM, Dong Aisheng <b29396@freescale.com> wrote:
> Used to read out the correct value of SDHCI_TRANSFER_MODE register
> for upper layer.
>
> Signed-off-by: Dong Aisheng <b29396@freescale.com>
> ---
>  drivers/mmc/host/sdhci-esdhc-imx.c |   16 ++++++++++++++++
>  1 files changed, 16 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
> index 461a4c3..2be77e0 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -385,6 +385,22 @@ static u16 esdhc_readw_le(struct sdhci_host *host, int reg)
>                 return ret;
>         }
>
> +       if (unlikely(reg == SDHCI_TRANSFER_MODE)) {
> +               if (esdhc_is_usdhc(imx_data)) {
> +                       u32 m = readl(host->ioaddr + ESDHC_MIX_CTRL);
> +                       ret = m & ESDHC_MIX_CTRL_SDHCI_MASK;
> +                       /* Swap AC23 bit */
> +                       if (m & ESDHC_MIX_CTRL_AC23EN) {
> +                               ret &= ~ESDHC_MIX_CTRL_AC23EN;
> +                               ret |= SDHCI_TRNS_AUTO_CMD23;
> +                       }
> +               } else {
> +                       ret = readw(host->ioaddr + SDHCI_TRANSFER_MODE);
> +               }
> +
> +               return ret;
> +       }
> +
>         return readw(host->ioaddr + reg);
>  }
>
> --
> 1.7.2.rc3
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Dong Aisheng Oct. 21, 2013, 4:29 p.m. UTC | #2
Hi John,

You need apply this patch series first which introduced esdhc_is_usdhc.
http://permalink.gmane.org/gmane.linux.kernel.mmc/23074

Please refer to Chris tree:
https://git.kernel.org/cgit/linux/kernel/git/cjb/mmc.git/log/?h=mmc-next

Regards
Dong Aisheng

On Tue, Oct 22, 2013 at 12:01 AM, John Tobias <john.tobias.ph@gmail.com> wrote:
> Hi Dong,
>
> I compiled my kernel after applying your patch but it didn't compile
> it correctly due to esdhc_is_usdhc function. It should be
> is_imx6_usdhc?
>
> Regards,
>
> john
>
> On Mon, Oct 21, 2013 at 7:27 AM, Dong Aisheng <b29396@freescale.com> wrote:
>> Used to read out the correct value of SDHCI_TRANSFER_MODE register
>> for upper layer.
>>
>> Signed-off-by: Dong Aisheng <b29396@freescale.com>
>> ---
>>  drivers/mmc/host/sdhci-esdhc-imx.c |   16 ++++++++++++++++
>>  1 files changed, 16 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
>> index 461a4c3..2be77e0 100644
>> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
>> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
>> @@ -385,6 +385,22 @@ static u16 esdhc_readw_le(struct sdhci_host *host, int reg)
>>                 return ret;
>>         }
>>
>> +       if (unlikely(reg == SDHCI_TRANSFER_MODE)) {
>> +               if (esdhc_is_usdhc(imx_data)) {
>> +                       u32 m = readl(host->ioaddr + ESDHC_MIX_CTRL);
>> +                       ret = m & ESDHC_MIX_CTRL_SDHCI_MASK;
>> +                       /* Swap AC23 bit */
>> +                       if (m & ESDHC_MIX_CTRL_AC23EN) {
>> +                               ret &= ~ESDHC_MIX_CTRL_AC23EN;
>> +                               ret |= SDHCI_TRNS_AUTO_CMD23;
>> +                       }
>> +               } else {
>> +                       ret = readw(host->ioaddr + SDHCI_TRANSFER_MODE);
>> +               }
>> +
>> +               return ret;
>> +       }
>> +
>>         return readw(host->ioaddr + reg);
>>  }
>>
>> --
>> 1.7.2.rc3
>>
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
diff mbox

Patch

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index 461a4c3..2be77e0 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -385,6 +385,22 @@  static u16 esdhc_readw_le(struct sdhci_host *host, int reg)
 		return ret;
 	}
 
+	if (unlikely(reg == SDHCI_TRANSFER_MODE)) {
+		if (esdhc_is_usdhc(imx_data)) {
+			u32 m = readl(host->ioaddr + ESDHC_MIX_CTRL);
+			ret = m & ESDHC_MIX_CTRL_SDHCI_MASK;
+			/* Swap AC23 bit */
+			if (m & ESDHC_MIX_CTRL_AC23EN) {
+				ret &= ~ESDHC_MIX_CTRL_AC23EN;
+				ret |= SDHCI_TRNS_AUTO_CMD23;
+			}
+		} else {
+			ret = readw(host->ioaddr + SDHCI_TRANSFER_MODE);
+		}
+
+		return ret;
+	}
+
 	return readw(host->ioaddr + reg);
 }