--- 628895f14ec174bf096677464df65ea328bb056b +++ db217b7965caf4b38fa8cd28fbf443dd3846f20e @@ -756,31 +756,13 @@ msmsdcc_dma_complete_func(struct msm_dmo tasklet_schedule(&host->dma_tlet); } -static int msmsdcc_check_dma_op_req(struct msmsdcc_host *host, - struct mmc_data *data) +static int msmsdcc_check_dma_op_req(struct mmc_data *data) { - int ret = 0; - u32 xfer_size = data->blksz * data->blocks; - - if (host->is_sps_mode) { - /* - * BAM Mode: Fail back on PIO if size is less - * than or equal to four bytes - */ - if (xfer_size <= 4) - ret = -EINVAL; - } else if (!host->is_dma_mode) { - /* - * ADM Mode: Fall back on PIO if size is less than FIFO size - * or not integer multiple of FIFO size - */ - if (xfer_size % MCI_FIFOSIZE) - ret = -EINVAL; - } else { - /* PIO Mode */ - ret = -EINVAL; - } - return ret; + if (((data->blksz * data->blocks) < MCI_FIFOSIZE) || + ((data->blksz * data->blocks) % MCI_FIFOSIZE)) + return -EINVAL; + else + return 0; } static int msmsdcc_config_dma(struct msmsdcc_host *host, struct mmc_data *data) @@ -1087,7 +1069,7 @@ msmsdcc_start_data(struct msmsdcc_host * if (host->curr.wait_for_auto_prog_done) datactrl |= MCI_AUTO_PROG_DONE; - if (!msmsdcc_check_dma_op_req(host, data)) { + if (!msmsdcc_check_dma_op_req(data)) { if (host->is_dma_mode && !msmsdcc_config_dma(host, data)) { datactrl |= MCI_DPSM_DMAENABLE; } else if (host->is_sps_mode) { @@ -1214,9 +1196,11 @@ msmsdcc_data_err(struct msmsdcc_host *ho */ if (!(data->mrq->cmd->opcode == MMC_BUS_TEST_W || data->mrq->cmd->opcode == MMC_BUS_TEST_R)) { - pr_err("%s: CMD%d: Data timeout\n", + pr_err("%s: CMD%d: Data timeout. DAT0 => %d\n", mmc_hostname(host->mmc), - data->mrq->cmd->opcode); + data->mrq->cmd->opcode, + (readl_relaxed(host->base + + MCI_TEST_INPUT) & 0x2) ? 1 : 0); data->error = -ETIMEDOUT; msmsdcc_dump_sdcc_state(host); } @@ -4240,45 +4224,49 @@ void msmsdcc_print_regs(const char *name if (!base) return; - pr_info("===== %s: Register Dumps @base=0x%x =====\n", + pr_err("===== %s: Register Dumps @base=0x%x =====\n", name, (u32)base); for (i = 0; i < no_of_regs; i = i + 4) { - pr_info("Reg=0x%.2x: 0x%.8x, 0x%.8x, 0x%.8x, 0x%.8x.\n", i*4, - (u32)readl_relaxed(base + i*4), - (u32)readl_relaxed(base + ((i+1)*4)), - (u32)readl_relaxed(base + ((i+2)*4)), - (u32)readl_relaxed(base + ((i+3)*4))); + pr_err("Reg=0x%.2x: 0x%.8x, 0x%.8x, 0x%.8x, 0x%.8x\n", i*4, + (u32)readl_relaxed(base + i*4), + (u32)readl_relaxed(base + ((i+1)*4)), + (u32)readl_relaxed(base + ((i+2)*4)), + (u32)readl_relaxed(base + ((i+3)*4))); } } static void msmsdcc_dump_sdcc_state(struct msmsdcc_host *host) { /* Dump current state of SDCC clocks, power and irq */ - pr_info("%s: SDCC PWR is %s\n", mmc_hostname(host->mmc), - (host->pwr ? "ON" : "OFF")); - pr_info("%s: SDCC clks are %s, MCLK rate=%d\n", - mmc_hostname(host->mmc), - (host->clks_on ? "ON" : "OFF"), - (u32)clk_get_rate(host->clk)); - pr_info("%s: SDCC irq is %s\n", mmc_hostname(host->mmc), + pr_err("%s: SDCC PWR is %s\n", mmc_hostname(host->mmc), + (host->pwr ? "ON" : "OFF")); + pr_err("%s: SDCC clks are %s, MCLK rate=%d\n", + mmc_hostname(host->mmc), + (host->clks_on ? "ON" : "OFF"), + (u32)clk_get_rate(host->clk)); + pr_err("%s: SDCC irq is %s\n", mmc_hostname(host->mmc), (host->sdcc_irq_disabled ? "disabled" : "enabled")); /* Now dump SDCC registers. Don't print FIFO registers */ - if (host->clks_on) + if (host->clks_on) { msmsdcc_print_regs("SDCC-CORE", host->base, 28); + pr_err("%s: MCI_TEST_INPUT = 0x%.8x\n", + mmc_hostname(host->mmc), + readl_relaxed(host->base + MCI_TEST_INPUT)); + } if (host->curr.data) { - if (msmsdcc_check_dma_op_req(host, host->curr.data)) - pr_info("%s: PIO mode\n", mmc_hostname(host->mmc)); + if (msmsdcc_check_dma_op_req(host->curr.data)) + pr_err("%s: PIO mode\n", mmc_hostname(host->mmc)); else if (host->is_dma_mode) - pr_info("%s: ADM mode: busy=%d, chnl=%d, crci=%d\n", + pr_err("%s: ADM mode: busy=%d, chnl=%d, crci=%d\n", mmc_hostname(host->mmc), host->dma.busy, host->dma.channel, host->dma.crci); else if (host->is_sps_mode) - pr_info("%s: SPS mode: busy=%d\n", + pr_err("%s: SPS mode: busy=%d\n", mmc_hostname(host->mmc), host->sps.busy); - pr_info("%s: xfer_size=%d, data_xfered=%d, xfer_remain=%d\n", + pr_err("%s: xfer_size=%d, data_xfered=%d, xfer_remain=%d\n", mmc_hostname(host->mmc), host->curr.xfer_size, host->curr.data_xfered, host->curr.xfer_remain); pr_info("%s: got_dataend=%d, prog_enable=%d," @@ -5260,8 +5248,8 @@ msmsdcc_runtime_suspend(struct device *d { struct mmc_host *mmc = dev_get_drvdata(dev); struct msmsdcc_host *host = mmc_priv(mmc); - unsigned long flags; int rc = 0; + unsigned long flags; if (host->plat->is_sdio_al_client) { rc = 0;