linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] mmc: core: add a new property
       [not found] <CGME20210217053233epcas1p3f6b8177e5f2d27a4f7dc4f136bdcfa48@epcas1p3.samsung.com>
@ 2021-02-17  5:19 ` DooHyun Hwang
       [not found]   ` <CGME20210217053240epcas1p44ae9b8ae5bd4fe792317cfe0fe683f98@epcas1p4.samsung.com>
       [not found]   ` <CGME20210217053242epcas1p426e4bdc44270bb6b98eb18f33e66023d@epcas1p4.samsung.com>
  0 siblings, 2 replies; 4+ messages in thread
From: DooHyun Hwang @ 2021-02-17  5:19 UTC (permalink / raw)
  To: linux-mmc, linux-kernel, devicetree, ulf.hansson, robh+dt, axboe,
	adrian.hunter, satyat, baolin.wang, ebiggers, gustavoars
  Cc: grant.jung, jt77.jang, junwoo80.lee, jangsub.yi, sh043.lee,
	cw9316.lee, sh8267.baek, wkon.kim, DooHyun Hwang

Add an optional property to not retry multiple block read error
with several single block reads.

DooHyun Hwang (2):
  dt-bindings: mmc: Add no-single-read-retry property
  mmc: core: Add no single read retries

 Documentation/devicetree/bindings/mmc/mmc-controller.yaml | 6 ++++++
 drivers/mmc/core/block.c                                  | 3 ++-
 drivers/mmc/core/host.c                                   | 6 ++++++
 include/linux/mmc/host.h                                  | 3 +++
 4 files changed, 17 insertions(+), 1 deletion(-)

-- 
2.29.0


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

* [PATCH 1/2] dt-bindings: mmc: Add no-single-read-retry property
       [not found]   ` <CGME20210217053240epcas1p44ae9b8ae5bd4fe792317cfe0fe683f98@epcas1p4.samsung.com>
@ 2021-02-17  5:19     ` DooHyun Hwang
  0 siblings, 0 replies; 4+ messages in thread
From: DooHyun Hwang @ 2021-02-17  5:19 UTC (permalink / raw)
  To: linux-mmc, linux-kernel, devicetree, ulf.hansson, robh+dt, axboe,
	adrian.hunter, satyat, baolin.wang, ebiggers, gustavoars
  Cc: grant.jung, jt77.jang, junwoo80.lee, jangsub.yi, sh043.lee,
	cw9316.lee, sh8267.baek, wkon.kim, DooHyun Hwang

Add an optional property to not retry multiple block read error
with several single block reads.

This property makes to handle read errors faster by not retrying
multiple block read errors with single block reads.

Signed-off-by: DooHyun Hwang <dh0421.hwang@samsung.com>
---
 Documentation/devicetree/bindings/mmc/mmc-controller.yaml | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/devicetree/bindings/mmc/mmc-controller.yaml b/Documentation/devicetree/bindings/mmc/mmc-controller.yaml
index e141330c1114..1eb3b73a164a 100644
--- a/Documentation/devicetree/bindings/mmc/mmc-controller.yaml
+++ b/Documentation/devicetree/bindings/mmc/mmc-controller.yaml
@@ -245,6 +245,12 @@ properties:
       Controller is limited to send MMC commands during
       initialization.
 
+  no-single-read-retry:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description:
+      Single block read retrying is not supported
+      when multiple block read fails.
+
   fixed-emmc-driver-type:
     description:
       For non-removable eMMC, enforce this driver type. The value is
-- 
2.29.0


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

* [PATCH 2/2] mmc: core: Add no single read retries
       [not found]   ` <CGME20210217053242epcas1p426e4bdc44270bb6b98eb18f33e66023d@epcas1p4.samsung.com>
@ 2021-02-17  5:19     ` DooHyun Hwang
  0 siblings, 0 replies; 4+ messages in thread
From: DooHyun Hwang @ 2021-02-17  5:19 UTC (permalink / raw)
  To: linux-mmc, linux-kernel, devicetree, ulf.hansson, robh+dt, axboe,
	adrian.hunter, satyat, baolin.wang, ebiggers, gustavoars
  Cc: grant.jung, jt77.jang, junwoo80.lee, jangsub.yi, sh043.lee,
	cw9316.lee, sh8267.baek, wkon.kim, DooHyun Hwang

This makes to handle read errors faster by not retrying
multiple block read(CMD18) errors with single block reads(CMD17).

On some bad SD Cards that have problem with read operations,
it is not helpful to retry multiple block read errors with
several single block reads, and it is delayed to treat read
operations as I/O error as much as retrying single block reads.

Signed-off-by: DooHyun Hwang <dh0421.hwang@samsung.com>
---
 drivers/mmc/core/block.c | 3 ++-
 drivers/mmc/core/host.c  | 6 ++++++
 include/linux/mmc/host.h | 3 +++
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index d666e24fbe0e..e25aaf8fca34 100644
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -1809,7 +1809,8 @@ static void mmc_blk_mq_rw_recovery(struct mmc_queue *mq, struct request *req)
 
 	/* FIXME: Missing single sector read for large sector size */
 	if (!mmc_large_sector(card) && rq_data_dir(req) == READ &&
-	    brq->data.blocks > 1) {
+	    brq->data.blocks > 1 &&
+	    !card->host->no_single_read_retry) {
 		/* Read one sector at a time */
 		mmc_blk_read_single(mq, req);
 		return;
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index 9b89a91b6b47..3bf5b2fc111b 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -352,6 +352,12 @@ int mmc_of_parse(struct mmc_host *host)
 	if (device_property_read_bool(dev, "no-mmc"))
 		host->caps2 |= MMC_CAP2_NO_MMC;
 
+	if (device_property_read_bool(dev, "no-single-read-retry")) {
+		dev_info(host->parent,
+			"Single block read retrying is not supported\n");
+		host->no_single_read_retry = true;
+	}
+
 	/* Must be after "non-removable" check */
 	if (device_property_read_u32(dev, "fixed-emmc-driver-type", &drv_type) == 0) {
 		if (host->caps & MMC_CAP_NONREMOVABLE)
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 26a3c7bc29ae..faec55035a63 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -502,6 +502,9 @@ struct mmc_host {
 	/* Host Software Queue support */
 	bool			hsq_enabled;
 
+	/* Do not retry multi block read as single block read */
+	bool			no_single_read_retry;
+
 	unsigned long		private[] ____cacheline_aligned;
 };
 
-- 
2.29.0


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

* [PATCH 0/2] mmc: core: add a new property
       [not found] <CGME20210217053519epcas1p4204253d3af8e1c6d2a5c3acb73eb877f@epcas1p4.samsung.com>
@ 2021-02-17  5:22 ` DooHyun Hwang
  0 siblings, 0 replies; 4+ messages in thread
From: DooHyun Hwang @ 2021-02-17  5:22 UTC (permalink / raw)
  To: linux-mmc, linux-kernel, devicetree, ulf.hansson, robh+dt, axboe,
	adrian.hunter, satyat, ebiggers, gustavoars
  Cc: grant.jung, jt77.jang, junwoo80.lee, jangsub.yi, sh043.lee,
	cw9316.lee, sh8267.baek, wkon.kim, DooHyun Hwang

Add an optional property to not retry multiple block read error
with several single block reads.

DooHyun Hwang (2):
  dt-bindings: mmc: Add no-single-read-retry property
  mmc: core: Add no single read retries

 Documentation/devicetree/bindings/mmc/mmc-controller.yaml | 6 ++++++
 drivers/mmc/core/block.c                                  | 3 ++-
 drivers/mmc/core/host.c                                   | 6 ++++++
 include/linux/mmc/host.h                                  | 3 +++
 4 files changed, 17 insertions(+), 1 deletion(-)

-- 
2.29.0


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

end of thread, other threads:[~2021-02-17  5:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20210217053233epcas1p3f6b8177e5f2d27a4f7dc4f136bdcfa48@epcas1p3.samsung.com>
2021-02-17  5:19 ` [PATCH 0/2] mmc: core: add a new property DooHyun Hwang
     [not found]   ` <CGME20210217053240epcas1p44ae9b8ae5bd4fe792317cfe0fe683f98@epcas1p4.samsung.com>
2021-02-17  5:19     ` [PATCH 1/2] dt-bindings: mmc: Add no-single-read-retry property DooHyun Hwang
     [not found]   ` <CGME20210217053242epcas1p426e4bdc44270bb6b98eb18f33e66023d@epcas1p4.samsung.com>
2021-02-17  5:19     ` [PATCH 2/2] mmc: core: Add no single read retries DooHyun Hwang
     [not found] <CGME20210217053519epcas1p4204253d3af8e1c6d2a5c3acb73eb877f@epcas1p4.samsung.com>
2021-02-17  5:22 ` [PATCH 0/2] mmc: core: add a new property DooHyun Hwang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).