Commit 9a31328f authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull mmc fixes from Ulf Hansson:
 "Here are a couple of mmc fixes intended for v4.11 rc4.

  MMC core:
   - Fix initialization of HS400-ES eMMC cards
   - A couple of fixes for the mmc block device driver
   - Resolved a compiler warning

  MMC host:
   - sdhci: Do not disable IRQs while waiting for clock
   - sdhci-pci: Do not disable IRQs in sdhci_intel_set_power
   - sdhci-of-arasan: Fix incorrect timeout clock
   - mediatek: Fix bug for setting wrong clock frequency
   - sdhci-of-at91: Use regulator to fix cmd timeout errors
   - ushc: Fix NULL-deref at probe
   - rockchip-dw-mshc: Rename RK1108 to RV1108 in DT"

* tag 'mmc-v4.11-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc:
  mmc: sdhci-pci: Do not disable interrupts in sdhci_intel_set_power
  mmc: sdhci: Do not disable interrupts while waiting for clock
  mmc: ushc: fix NULL-deref at probe
  mmc: sdhci-of-at91: Support external regulators
  mmc: core: mmc_blk_rw_cmd_err - remove unused variable
  mmc: mediatek: Fixed bug where clock frequency could be set wrong
  mmc: block: Fix cmd error reset failure path
  mmc: block: Fix is_waiting_last_req set incorrectly
  mmc: core: Fix access to HS400-ES devices
  mmc: sdhci-of-arasan: fix incorrect timeout clock
  dt-bindings: rockchip-dw-mshc: rename RK1108 to RV1108
parents e8871186 027fb89e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ Required Properties:
	- "rockchip,rk2928-dw-mshc": for Rockchip RK2928 and following,
							before RK3288
	- "rockchip,rk3288-dw-mshc": for Rockchip RK3288
	- "rockchip,rk1108-dw-mshc", "rockchip,rk3288-dw-mshc": for Rockchip RK1108
	- "rockchip,rv1108-dw-mshc", "rockchip,rk3288-dw-mshc": for Rockchip RV1108
	- "rockchip,rk3036-dw-mshc", "rockchip,rk3288-dw-mshc": for Rockchip RK3036
	- "rockchip,rk3368-dw-mshc", "rockchip,rk3288-dw-mshc": for Rockchip RK3368
	- "rockchip,rk3399-dw-mshc", "rockchip,rk3288-dw-mshc": for Rockchip RK3399
+3 −4
Original line number Diff line number Diff line
@@ -1560,11 +1560,8 @@ static bool mmc_blk_rw_cmd_err(struct mmc_blk_data *md, struct mmc_card *card,
			       struct mmc_blk_request *brq, struct request *req,
			       bool old_req_pending)
{
	struct mmc_queue_req *mq_rq;
	bool req_pending;

	mq_rq = container_of(brq, struct mmc_queue_req, brq);

	/*
	 * If this is an SD card and we're writing, we can first
	 * mark the known good sectors as ok.
@@ -1701,6 +1698,7 @@ static void mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *new_req)
		case MMC_BLK_CMD_ERR:
			req_pending = mmc_blk_rw_cmd_err(md, card, brq, old_req, req_pending);
			if (mmc_blk_reset(md, card->host, type)) {
				if (req_pending)
					mmc_blk_rw_cmd_abort(card, old_req);
				mmc_blk_rw_try_restart(mq, new_req);
				return;
@@ -1817,6 +1815,7 @@ void mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
		mmc_blk_issue_flush(mq, req);
	} else {
		mmc_blk_issue_rw_rq(mq, req);
		card->host->context_info.is_waiting_last_req = false;
	}

out:
+1 −1
Original line number Diff line number Diff line
@@ -1730,7 +1730,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
		err = mmc_select_hs400(card);
		if (err)
			goto free_card;
	} else {
	} else if (!mmc_card_hs400es(card)) {
		/* Select the desired bus width optionally */
		err = mmc_select_bus_width(card);
		if (err > 0 && mmc_card_hs(card)) {
+2 −2
Original line number Diff line number Diff line
@@ -580,7 +580,7 @@ static void msdc_set_mclk(struct msdc_host *host, unsigned char timing, u32 hz)
		}
	}
	sdr_set_field(host->base + MSDC_CFG, MSDC_CFG_CKMOD | MSDC_CFG_CKDIV,
			(mode << 8) | (div % 0xff));
		      (mode << 8) | div);
	sdr_set_bits(host->base + MSDC_CFG, MSDC_CFG_CKPDN);
	while (!(readl(host->base + MSDC_CFG) & MSDC_CFG_CKSTB))
		cpu_relax();
@@ -1559,7 +1559,7 @@ static int msdc_drv_probe(struct platform_device *pdev)
	host->src_clk_freq = clk_get_rate(host->src_clk);
	/* Set host parameters to mmc */
	mmc->ops = &mt_msdc_ops;
	mmc->f_min = host->src_clk_freq / (4 * 255);
	mmc->f_min = DIV_ROUND_UP(host->src_clk_freq, 4 * 255);

	mmc->caps |= MMC_CAP_ERASE | MMC_CAP_CMD23;
	/* MMC core transfer sizes tunable parameters */
+5 −9
Original line number Diff line number Diff line
@@ -28,13 +28,9 @@
#include "sdhci-pltfm.h"
#include <linux/of.h>

#define SDHCI_ARASAN_CLK_CTRL_OFFSET	0x2c
#define SDHCI_ARASAN_VENDOR_REGISTER	0x78

#define VENDOR_ENHANCED_STROBE		BIT(0)
#define CLK_CTRL_TIMEOUT_SHIFT		16
#define CLK_CTRL_TIMEOUT_MASK		(0xf << CLK_CTRL_TIMEOUT_SHIFT)
#define CLK_CTRL_TIMEOUT_MIN_EXP	13

#define PHY_CLK_TOO_SLOW_HZ		400000

@@ -163,15 +159,15 @@ static int sdhci_arasan_syscon_write(struct sdhci_host *host,

static unsigned int sdhci_arasan_get_timeout_clock(struct sdhci_host *host)
{
	u32 div;
	unsigned long freq;
	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);

	div = readl(host->ioaddr + SDHCI_ARASAN_CLK_CTRL_OFFSET);
	div = (div & CLK_CTRL_TIMEOUT_MASK) >> CLK_CTRL_TIMEOUT_SHIFT;
	/* SDHCI timeout clock is in kHz */
	freq = DIV_ROUND_UP(clk_get_rate(pltfm_host->clk), 1000);

	freq = clk_get_rate(pltfm_host->clk);
	freq /= 1 << (CLK_CTRL_TIMEOUT_MIN_EXP + div);
	/* or in MHz */
	if (host->caps & SDHCI_TIMEOUT_CLK_UNIT)
		freq = DIV_ROUND_UP(freq, 1000);

	return freq;
}
Loading