mmc: dw_mmc: support transfer mode autodetection
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 Change-Id: I0eafb78c3fd171827664e320b8959f3c5e27094a Signed-off-by: Paweł Jarosz <paweljarosz3691@gmail.com> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
This commit is contained in:
parent
b9370edc3d
commit
39abf9c1e9
|
|
@ -574,6 +574,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;
|
||||
|
||||
if (host->board_init)
|
||||
host->board_init(host);
|
||||
|
|
@ -585,6 +586,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;
|
||||
}
|
||||
|
||||
/* Enumerate at 400KHz */
|
||||
dwmci_setup_bus(host, mmc->cfg->f_min);
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue