Browse Source

Merge tag 'mmc-4.1-rc2' of git://git.linaro.org/people/ulf.hansson/mmc

Pull MMC fixes from Ulf Hansson:
 "MMC core:
   - Don't access RPMB partitions for normal read/write
   - Fix hibernation restore sequence

  MMC host:
   - dw_mmc: Fix card detection for non removable cards
   - dw_mmc: Fix sglist issue in 32-bit mode
   - sh_mmcif: Fix timeout value for command request"

* tag 'mmc-4.1-rc2' of git://git.linaro.org/people/ulf.hansson/mmc:
  mmc: dw_mmc: dw_mci_get_cd check MMC_CAP_NONREMOVABLE
  mmc: dw_mmc: init desc in dw_mci_idmac_init
  mmc: card: Don't access RPMB partitions for normal read/write
  mmc: sh_mmcif: Fix timeout value for command request
  mmc: core: add missing pm event in mmc_pm_notify to fix hib restore
Linus Torvalds 10 years ago
parent
commit
a8a0811314

+ 12 - 0
drivers/mmc/card/block.c

@@ -1029,6 +1029,18 @@ static inline void mmc_blk_reset_success(struct mmc_blk_data *md, int type)
 	md->reset_done &= ~type;
 	md->reset_done &= ~type;
 }
 }
 
 
+int mmc_access_rpmb(struct mmc_queue *mq)
+{
+	struct mmc_blk_data *md = mq->data;
+	/*
+	 * If this is a RPMB partition access, return ture
+	 */
+	if (md && md->part_type == EXT_CSD_PART_CONFIG_ACC_RPMB)
+		return true;
+
+	return false;
+}
+
 static int mmc_blk_issue_discard_rq(struct mmc_queue *mq, struct request *req)
 static int mmc_blk_issue_discard_rq(struct mmc_queue *mq, struct request *req)
 {
 {
 	struct mmc_blk_data *md = mq->data;
 	struct mmc_blk_data *md = mq->data;

+ 1 - 1
drivers/mmc/card/queue.c

@@ -38,7 +38,7 @@ static int mmc_prep_request(struct request_queue *q, struct request *req)
 		return BLKPREP_KILL;
 		return BLKPREP_KILL;
 	}
 	}
 
 
-	if (mq && mmc_card_removed(mq->card))
+	if (mq && (mmc_card_removed(mq->card) || mmc_access_rpmb(mq)))
 		return BLKPREP_KILL;
 		return BLKPREP_KILL;
 
 
 	req->cmd_flags |= REQ_DONTPREP;
 	req->cmd_flags |= REQ_DONTPREP;

+ 2 - 0
drivers/mmc/card/queue.h

@@ -73,4 +73,6 @@ extern void mmc_queue_bounce_post(struct mmc_queue_req *);
 extern int mmc_packed_init(struct mmc_queue *, struct mmc_card *);
 extern int mmc_packed_init(struct mmc_queue *, struct mmc_card *);
 extern void mmc_packed_clean(struct mmc_queue *);
 extern void mmc_packed_clean(struct mmc_queue *);
 
 
+extern int mmc_access_rpmb(struct mmc_queue *);
+
 #endif
 #endif

+ 1 - 0
drivers/mmc/core/core.c

@@ -2651,6 +2651,7 @@ int mmc_pm_notify(struct notifier_block *notify_block,
 	switch (mode) {
 	switch (mode) {
 	case PM_HIBERNATION_PREPARE:
 	case PM_HIBERNATION_PREPARE:
 	case PM_SUSPEND_PREPARE:
 	case PM_SUSPEND_PREPARE:
+	case PM_RESTORE_PREPARE:
 		spin_lock_irqsave(&host->lock, flags);
 		spin_lock_irqsave(&host->lock, flags);
 		host->rescan_disable = 1;
 		host->rescan_disable = 1;
 		spin_unlock_irqrestore(&host->lock, flags);
 		spin_unlock_irqrestore(&host->lock, flags);

+ 5 - 2
drivers/mmc/host/dw_mmc.c

@@ -589,9 +589,11 @@ static int dw_mci_idmac_init(struct dw_mci *host)
 		host->ring_size = PAGE_SIZE / sizeof(struct idmac_desc);
 		host->ring_size = PAGE_SIZE / sizeof(struct idmac_desc);
 
 
 		/* Forward link the descriptor list */
 		/* Forward link the descriptor list */
-		for (i = 0, p = host->sg_cpu; i < host->ring_size - 1; i++, p++)
+		for (i = 0, p = host->sg_cpu; i < host->ring_size - 1; i++, p++) {
 			p->des3 = cpu_to_le32(host->sg_dma +
 			p->des3 = cpu_to_le32(host->sg_dma +
 					(sizeof(struct idmac_desc) * (i + 1)));
 					(sizeof(struct idmac_desc) * (i + 1)));
+			p->des1 = 0;
+		}
 
 
 		/* Set the last descriptor as the end-of-ring descriptor */
 		/* Set the last descriptor as the end-of-ring descriptor */
 		p->des3 = cpu_to_le32(host->sg_dma);
 		p->des3 = cpu_to_le32(host->sg_dma);
@@ -1300,7 +1302,8 @@ static int dw_mci_get_cd(struct mmc_host *mmc)
 	int gpio_cd = mmc_gpio_get_cd(mmc);
 	int gpio_cd = mmc_gpio_get_cd(mmc);
 
 
 	/* Use platform get_cd function, else try onboard card detect */
 	/* Use platform get_cd function, else try onboard card detect */
-	if (brd->quirks & DW_MCI_QUIRK_BROKEN_CARD_DETECTION)
+	if ((brd->quirks & DW_MCI_QUIRK_BROKEN_CARD_DETECTION) ||
+	    (mmc->caps & MMC_CAP_NONREMOVABLE))
 		present = 1;
 		present = 1;
 	else if (!IS_ERR_VALUE(gpio_cd))
 	else if (!IS_ERR_VALUE(gpio_cd))
 		present = gpio_cd;
 		present = gpio_cd;

+ 1 - 1
drivers/mmc/host/sh_mmcif.c

@@ -1408,7 +1408,7 @@ static int sh_mmcif_probe(struct platform_device *pdev)
 	host		= mmc_priv(mmc);
 	host		= mmc_priv(mmc);
 	host->mmc	= mmc;
 	host->mmc	= mmc;
 	host->addr	= reg;
 	host->addr	= reg;
-	host->timeout	= msecs_to_jiffies(1000);
+	host->timeout	= msecs_to_jiffies(10000);
 	host->ccs_enable = !pd || !pd->ccs_unsupported;
 	host->ccs_enable = !pd || !pd->ccs_unsupported;
 	host->clk_ctrl2_enable = pd && pd->clk_ctrl2_present;
 	host->clk_ctrl2_enable = pd && pd->clk_ctrl2_present;