From: xbw Date: Tue, 4 Mar 2014 07:13:57 +0000 (+0800) Subject: SDMMC: X-Git-Tag: firefly_0821_release~6223 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=fd947cdf7828efec6d82aadcd6e993649669c02a;p=firefly-linux-kernel-4.4.55.git SDMMC: 1.Add the ability to set the ciu clock frequency 2.Handle DW_MCI_QUIRK_IDMAC_DTO properly --- diff --git a/drivers/mmc/host/rk_sdmmc.c b/drivers/mmc/host/rk_sdmmc.c index 7ede50c62f4a..e436e36b0183 100755 --- a/drivers/mmc/host/rk_sdmmc.c +++ b/drivers/mmc/host/rk_sdmmc.c @@ -1598,9 +1598,7 @@ static irqreturn_t dw_mci_interrupt(int irq, void *dev_id) pending = mci_readl(host, MINTSTS); /* read-only mask reg */ - if (pending) { - - /* + /* * DTO fix - version 2.10a and below, and only if internal DMA * is configured. */ @@ -1608,8 +1606,9 @@ static irqreturn_t dw_mci_interrupt(int irq, void *dev_id) if (!pending && ((mci_readl(host, STATUS) >> 17) & 0x1fff)) pending |= SDMMC_INT_DATA_OVER; - } + } + if (pending) { if (pending & DW_MCI_CMD_ERROR_FLAGS) { mci_writel(host, RINTSTS, DW_MCI_CMD_ERROR_FLAGS); host->cmd_status = pending; @@ -2161,6 +2160,7 @@ static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host) struct device_node *np = dev->of_node; const struct dw_mci_drv_data *drv_data = host->drv_data; int idx, ret; + u32 clock_frequency; pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); if (!pdata) { @@ -2187,6 +2187,9 @@ static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host) of_property_read_u32(np, "card-detect-delay", &pdata->detect_delay_ms); + if (!of_property_read_u32(np, "clock-frequency", &clock_frequency)) + pdata->bus_hz = clock_frequency; + if (drv_data && drv_data->parse_dt) { ret = drv_data->parse_dt(host); if (ret) @@ -2244,6 +2247,7 @@ int dw_mci_probe(struct dw_mci *host) host->ciu_clk = devm_clk_get(host->dev, "ciu"); if (IS_ERR(host->ciu_clk)) { dev_dbg(host->dev, "ciu clock not available\n"); + host->bus_hz = host->pdata->bus_hz; } else { ret = clk_prepare_enable(host->ciu_clk); if (ret) { @@ -2256,9 +2260,13 @@ int dw_mci_probe(struct dw_mci *host) //test, modify by xbw host->bus_hz = 50000000; #else - if (IS_ERR(host->ciu_clk)) - host->bus_hz = host->pdata->bus_hz; - else + if (drv_data && drv_data->init) { + ret = drv_data->init(host); + if (ret) { + dev_err(host->dev, + "implementation specific init failed\n"); + goto err_clk_ciu; + } host->bus_hz = clk_get_rate(host->ciu_clk); #endif if (drv_data && drv_data->setup_clock) {