All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] mmc: block: support no access to boot partitions
@ 2011-09-23  9:48 Adrian Hunter
  2011-09-23  9:48 ` [PATCH 1/2] mmc: block: fix boot partition switch error path Adrian Hunter
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Adrian Hunter @ 2011-09-23  9:48 UTC (permalink / raw)
  To: Chris Ball; +Cc: linux-mmc, Adrian Hunter

Hi

Here is a minor fix and a patch to support no access to boot partitions.

Adrian Hunter (2):
      mmc: block: fix boot partition switch error path
      mmc: block: support no access to boot partitions

 drivers/mmc/card/block.c     |   18 ++++++++++++++----
 drivers/mmc/host/sdhci-pci.c |    2 ++
 include/linux/mmc/host.h     |   10 ++++++++++
 3 files changed, 26 insertions(+), 4 deletions(-)

Regards
Adrian Hunter

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] mmc: block: fix boot partition switch error path
  2011-09-23  9:48 [PATCH 0/2] mmc: block: support no access to boot partitions Adrian Hunter
@ 2011-09-23  9:48 ` Adrian Hunter
  2011-09-23 13:20   ` Andrei E. Warkentin
  2011-09-23  9:48 ` [PATCH 2/2] mmc: block: support no access to boot partitions Adrian Hunter
  2011-09-23 18:06 ` [PATCH 0/2] " Chris Ball
  2 siblings, 1 reply; 5+ messages in thread
From: Adrian Hunter @ 2011-09-23  9:48 UTC (permalink / raw)
  To: Chris Ball; +Cc: linux-mmc, Adrian Hunter

In the case of a switch error, do not update partition
config as though the switch succeeded, and ensure
blk_end_request is called on the failed request.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
 drivers/mmc/card/block.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index f4a6e0d..2350ac9 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -448,18 +448,23 @@ static inline int mmc_blk_part_switch(struct mmc_card *card,
 {
 	int ret;
 	struct mmc_blk_data *main_md = mmc_get_drvdata(card);
+
 	if (main_md->part_curr == md->part_type)
 		return 0;
 
 	if (mmc_card_mmc(card)) {
-		card->ext_csd.part_config &= ~EXT_CSD_PART_CONFIG_ACC_MASK;
-		card->ext_csd.part_config |= md->part_type;
+		u8 part_config = card->ext_csd.part_config;
+
+		part_config &= ~EXT_CSD_PART_CONFIG_ACC_MASK;
+		part_config |= md->part_type;
 
 		ret = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
-				 EXT_CSD_PART_CONFIG, card->ext_csd.part_config,
+				 EXT_CSD_PART_CONFIG, part_config,
 				 card->ext_csd.part_time);
 		if (ret)
 			return ret;
+
+		card->ext_csd.part_config = part_config;
 	}
 
 	main_md->part_curr = md->part_type;
@@ -1271,6 +1276,11 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
 
 	ret = mmc_blk_part_switch(card, md);
 	if (ret) {
+		if (req) {
+			spin_lock_irq(&md->lock);
+			__blk_end_request_all(req, -EIO);
+			spin_unlock_irq(&md->lock);
+		}
 		ret = 0;
 		goto out;
 	}
-- 
1.7.6


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] mmc: block: support no access to boot partitions
  2011-09-23  9:48 [PATCH 0/2] mmc: block: support no access to boot partitions Adrian Hunter
  2011-09-23  9:48 ` [PATCH 1/2] mmc: block: fix boot partition switch error path Adrian Hunter
@ 2011-09-23  9:48 ` Adrian Hunter
  2011-09-23 18:06 ` [PATCH 0/2] " Chris Ball
  2 siblings, 0 replies; 5+ messages in thread
From: Adrian Hunter @ 2011-09-23  9:48 UTC (permalink / raw)
  To: Chris Ball; +Cc: linux-mmc, Adrian Hunter

Intel Medfield platform blocks access to eMMC boot partitions
which results in switch errors.  Since there is no access,
mmcboot0/1 devices should not be created.  Add a host
capability to reflect that.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
 drivers/mmc/card/block.c     |    2 +-
 drivers/mmc/host/sdhci-pci.c |    2 ++
 include/linux/mmc/host.h     |   10 ++++++++++
 3 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 2350ac9..ad005e5 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -1478,7 +1478,7 @@ static int mmc_blk_alloc_parts(struct mmc_card *card, struct mmc_blk_data *md)
 	if (!mmc_card_mmc(card))
 		return 0;
 
-	if (card->ext_csd.boot_size) {
+	if (card->ext_csd.boot_size && mmc_boot_partition_access(card->host)) {
 		ret = mmc_blk_alloc_part(card, md, EXT_CSD_PART_CONFIG_ACC_BOOT0,
 					 card->ext_csd.boot_size >> 9,
 					 true,
diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
index 3b30c51..f8a17f9 100644
--- a/drivers/mmc/host/sdhci-pci.c
+++ b/drivers/mmc/host/sdhci-pci.c
@@ -215,6 +215,8 @@ static int mfd_emmc_probe_slot(struct sdhci_pci_slot *slot)
 
 	slot->host->mmc->caps |= MMC_CAP_8_BIT_DATA;
 
+	slot->host->mmc->caps2 = MMC_CAP2_BOOTPART_NOACC;
+
 	return 0;
 }
 
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index b2aefea..aed5bc7 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -236,6 +236,10 @@ struct mmc_host {
 #define MMC_CAP_CMD23		(1 << 30)	/* CMD23 supported. */
 #define MMC_CAP_HW_RESET	(1 << 31)	/* Hardware reset */
 
+	unsigned int		caps2;		/* More host capabilities */
+
+#define MMC_CAP2_BOOTPART_NOACC	(1 << 0)	/* Boot partition no access */
+
 	mmc_pm_flag_t		pm_caps;	/* supported pm features */
 
 #ifdef CONFIG_MMC_CLKGATE
@@ -404,4 +408,10 @@ static inline int mmc_host_cmd23(struct mmc_host *host)
 {
 	return host->caps & MMC_CAP_CMD23;
 }
+
+static inline int mmc_boot_partition_access(struct mmc_host *host)
+{
+	return !(host->caps2 & MMC_CAP2_BOOTPART_NOACC);
+}
+
 #endif /* LINUX_MMC_HOST_H */
-- 
1.7.6


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] mmc: block: fix boot partition switch error path
  2011-09-23  9:48 ` [PATCH 1/2] mmc: block: fix boot partition switch error path Adrian Hunter
@ 2011-09-23 13:20   ` Andrei E. Warkentin
  0 siblings, 0 replies; 5+ messages in thread
From: Andrei E. Warkentin @ 2011-09-23 13:20 UTC (permalink / raw)
  To: Adrian Hunter; +Cc: Chris Ball, linux-mmc

Hi Adrian,

2011/9/23 Adrian Hunter <adrian.hunter@intel.com>:
> In the case of a switch error, do not update partition
> config as though the switch succeeded, and ensure
> blk_end_request is called on the failed request.
>
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
>  drivers/mmc/card/block.c |   16 +++++++++++++---
>  1 files changed, 13 insertions(+), 3 deletions(-)
>

Thanks for catching these.

Acked-by: Andrei Warkentin <andrey.warkentin@gmail.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] mmc: block: support no access to boot partitions
  2011-09-23  9:48 [PATCH 0/2] mmc: block: support no access to boot partitions Adrian Hunter
  2011-09-23  9:48 ` [PATCH 1/2] mmc: block: fix boot partition switch error path Adrian Hunter
  2011-09-23  9:48 ` [PATCH 2/2] mmc: block: support no access to boot partitions Adrian Hunter
@ 2011-09-23 18:06 ` Chris Ball
  2 siblings, 0 replies; 5+ messages in thread
From: Chris Ball @ 2011-09-23 18:06 UTC (permalink / raw)
  To: Adrian Hunter; +Cc: linux-mmc

Hi Adrian,

On Fri, Sep 23 2011, Adrian Hunter wrote:
> Hi
>
> Here is a minor fix and a patch to support no access to boot partitions.
>
> Adrian Hunter (2):
>       mmc: block: fix boot partition switch error path
>       mmc: block: support no access to boot partitions

Thanks, pushed to mmc-next for 3.2.

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-09-23 18:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-23  9:48 [PATCH 0/2] mmc: block: support no access to boot partitions Adrian Hunter
2011-09-23  9:48 ` [PATCH 1/2] mmc: block: fix boot partition switch error path Adrian Hunter
2011-09-23 13:20   ` Andrei E. Warkentin
2011-09-23  9:48 ` [PATCH 2/2] mmc: block: support no access to boot partitions Adrian Hunter
2011-09-23 18:06 ` [PATCH 0/2] " Chris Ball

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.