[U-Boot] [PATCH v4 14/19] mmc: dw_mmc: support transfer mode autodetection

Paweł Jarosz paweljarosz3691 at gmail.com
Fri Aug 18 09:36:23 UTC 2017


Hi,


W dniu 18.08.2017 o 09:02, Jaehoon Chung pisze:
> On 08/17/2017 10:15 PM, =?UTF-8?q?Pawe=C5=82=20Jarosz?= wrote:
>> dw_mmc supports two transfer modes in u-boot: idma and fifo.
>> This patch adds autodetection of transfer mode and eliminates setting this in host config struct
>>
>> Signed-off-by: Paweł Jarosz <paweljarosz3691 at gmail.com>
>> ---
>> Changes since v1:
>> - none
>>
>> Changes since v2:
>> - none
>>
>> Changes since v3:
>> - none
>>
>>   drivers/mmc/dw_mmc.c | 8 ++++++++
>>   include/dwmmc.h      | 4 ++++
>>   2 files changed, 12 insertions(+)
>>
>> diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c
>> index 700f764..2cc4d67 100644
>> --- a/drivers/mmc/dw_mmc.c
>> +++ b/drivers/mmc/dw_mmc.c
>> @@ -428,6 +428,7 @@ static int dwmci_set_ios(struct mmc *mmc)
>>   static int dwmci_init(struct mmc *mmc)
>>   {
>>   	struct dwmci_host *host = mmc->priv;
>> +	uint32_t use_dma;
> Does it need to use unit32_t for use_dma?

SDMMC_GET_TRANS_MODE returns 2 bit value so i guess it can be uint8_t.

>>   
>>   	if (host->board_init)
>>   		host->board_init(host);
>> @@ -439,6 +440,13 @@ static int dwmci_init(struct mmc *mmc)
>>   		return -EIO;
>>   	}
>>   
>> +	use_dma = SDMMC_GET_TRANS_MODE(dwmci_readl(host, DWMCI_HCON));
>> +	if (use_dma == DMA_INTERFACE_IDMA) {
>> +		host->fifo_mode = 0;
>> +	} else {
>> +		host->fifo_mode = 1;
>> +	}
> Don't need to use the brackets.

i will do that in the next version.

Thanks for your comments.

Regards,
Paweł

> Best Regards,
> Jaehoon Chung
>
>> +
>>   	/* Enumerate at 400KHz */
>>   	dwmci_setup_bus(host, mmc->cfg->f_min);
>>   
>> diff --git a/include/dwmmc.h b/include/dwmmc.h
>> index 4dda009..269536d 100644
>> --- a/include/dwmmc.h
>> +++ b/include/dwmmc.h
>> @@ -115,6 +115,10 @@
>>   #define RX_WMARK_SHIFT		16
>>   #define RX_WMARK_MASK		(0xfff << RX_WMARK_SHIFT)
>>   
>> +/* HCON Register */
>> +#define DMA_INTERFACE_IDMA		(0x0)
>> +#define SDMMC_GET_TRANS_MODE(x)		(((x)>>16) & 0x3)
>> +
>>   #define DWMCI_IDMAC_OWN		(1 << 31)
>>   #define DWMCI_IDMAC_CH		(1 << 4)
>>   #define DWMCI_IDMAC_FS		(1 << 3)
>>



More information about the U-Boot mailing list