Skip to contentSkip to conversation

mmc: core: select the operation mode with sysfs

PATCH Superseded Jaehoon Chung 3 participants 3 messages Jan 19, 2012 – Feb 5, 2012 MMC, SD and SDIO

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 mmc: core: select the operation mode with sysfs

This patch is support the sysfs for operation mode.

There are two operation modes(open-ended/pre-defined). Now, operation mode is selected only one at the compile time.

But using this patch, we can change the operation mode with node at runtime.

* pre-defined mode
echo 1 > /sys/class/mmc_host/mmc0/pre_defined_op
* open-ended mode
echo 0 > /sys/class/mmc_host/mmc0/pre_defined_op

---
Changelog v2:
- Add the check point in mmc_cmd23_store()
(If host controller didn't support CMD23, need not to change the ops-mode.)

 drivers/mmc/card/block.c |   14 +++++++-------
 drivers/mmc/core/host.c  |   41 +++++++++++++++++++++++++++++++++++++++++
 include/linux/mmc/host.h |    5 ++++-
 3 files changed, 52 insertions(+), 8 deletions(-)
drivers/mmc/card/block.c +7 -7
index 176b78e..3a190a2 100644
@@ -1390,6 +1390,13 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
 	struct mmc_blk_data *md = mq->data;
 	struct mmc_card *card = md->queue.card;
 
+	if (mmc_host_cmd23(card->host)) {
+		if (mmc_card_mmc(card) ||
+		    (mmc_card_sd(card) &&
+		     card->scr.cmds & SD_SCR_CMD23_SUPPORT))
+			md->flags |= MMC_BLK_CMD23;
+	}
+
 	if (req && !mq->mqrq_prev->req)
 		/* claim host only for the first request */
 		mmc_claim_host(card->host);
@@ -1520,13 +1527,6 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card,
 	blk_queue_logical_block_size(md->queue.queue, 512);
 	set_capacity(md->disk, size);
 
-	if (mmc_host_cmd23(card->host)) {
-		if (mmc_card_mmc(card) ||
-		    (mmc_card_sd(card) &&
-		     card->scr.cmds & SD_SCR_CMD23_SUPPORT))
-			md->flags |= MMC_BLK_CMD23;
-	}
-
 	if (mmc_card_mmc(card) &&
 	    md->flags & MMC_BLK_CMD23 &&
 	    ((card->ext_csd.rel_param & EXT_CSD_WR_REL_PARAM_EN) ||
drivers/mmc/core/host.c +41 -0

53 lines not on this page · raw message

include/linux/mmc/host.h +4 -1
index dd13e05..44fbf6c 100644
@@ -258,6 +258,9 @@ struct mmc_host {
 #define MMC_CAP2_HS200		(MMC_CAP2_HS200_1_8V_SDR | \
 				 MMC_CAP2_HS200_1_2V_SDR)
 
+	struct device_attribute pre_defined_attr;
+	bool			pre_defined_op;	/* CMD23 should be use or not */
+
 	mmc_pm_flag_t		pm_caps;	/* supported pm features */
 	unsigned int        power_notify_type;
 #define MMC_HOST_PW_NOTIFY_NONE		0
@@ -436,7 +439,7 @@ static inline int mmc_card_wake_sdio_irq(struct mmc_host *host)
 
 static inline int mmc_host_cmd23(struct mmc_host *host)
 {
-	return host->caps & MMC_CAP_CMD23;
+	return host->pre_defined_op;
 }
 
 static inline int mmc_boot_partition_access(struct mmc_host *host)
#1 lore raw

Hi,

Quoted 19 lines · Jaehoon Chung

This patch is support the sysfs for operation mode.

There are two operation modes(open-ended/pre-defined). Now, operation mode is selected only one at the compile time.

But using this patch, we can change the operation mode with node at runtime.

* pre-defined mode
echo 1 > /sys/class/mmc_host/mmc0/pre_defined_op
* open-ended mode
echo 0 > /sys/class/mmc_host/mmc0/pre_defined_op

---
Changelog v2:
- Add the check point in mmc_cmd23_store()
(If host controller didn't support CMD23, need not to change the ops-mode.)

Quoted 4 lines
 drivers/mmc/card/block.c |   14 +++++++-------
 drivers/mmc/core/host.c  |   41 +++++++++++++++++++++++++++++++++++++++++
 include/linux/mmc/host.h |    5 ++++-
 3 files changed, 52 insertions(+), 8 deletions(-)

Patches that add sysfs nodes must come with documentation added to Documentation/mmc/mmc-dev-attrs.txt.

Thanks,

- Chris.

Signature · 2 lines
Chris Ball   <[email protected]>   <http://printf.net/>
One Laptop Per Child
#2 lore raw

2012/2/5 Chris Ball <[email protected]>:

Quoted 22 lines

Hi,

Quoted 19 lines · Jaehoon Chung

This patch is support the sysfs for operation mode.

There are two operation modes(open-ended/pre-defined). Now, operation mode is selected only one at the compile time.

But using this patch, we can change the operation mode with node at runtime.

* pre-defined mode
echo 1 > /sys/class/mmc_host/mmc0/pre_defined_op
* open-ended mode
echo 0 > /sys/class/mmc_host/mmc0/pre_defined_op

---
Changelog v2:
      - Add the check point in mmc_cmd23_store()
      (If host controller didn't support CMD23, need not to change the ops-mode.)

Quoted 7 lines
Quoted 4 lines

 drivers/mmc/card/block.c |   14 +++++++------- drivers/mmc/core/host.c  |   41 +++++++++++++++++++++++++++++++++++++++++ include/linux/mmc/host.h |    5 ++++-

 3 files changed, 52 insertions(+), 8 deletions(-)

Patches that add sysfs nodes must come with documentation added to Documentation/mmc/mmc-dev-attrs.txt.

Hi Chris..
Ok..i will add to mmc-dev-attrs.txt and resend the patch.

Best Regards,
Jaehoon Chung

Quoted 11 lines

Thanks,

- Chris.
--
Chris Ball   <[email protected]>   <http://printf.net/>
One Laptop Per Child
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html