Skip to contentSkip to conversation

mmc: meson-gx: set max block count to 256

PATCH New Heiner Kallweit 2 participants 4 messages Jan 26, 2017 – Jan 30, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: meson-gx: set max block count to 256

So far max_blk_count isn't set what results in a default of value 8 to be used (PAGE_SIZE / block size).
Set max_blk_count to 256 as used in the uboot driver.

---
 drivers/mmc/host/meson-gx-mmc.c | 1 +
 1 file changed, 1 insertion(+)
drivers/mmc/host/meson-gx-mmc.c +1 -0
index 3308b5b6..030425be 100644
@@ -799,6 +799,7 @@ static int meson_mmc_probe(struct platform_device *pdev)
 		goto free_host;
 	}
 
+	mmc->max_blk_count = 256;
 	mmc->ops = &meson_mmc_ops;
 	mmc_add_host(mmc);
 
Signature · 1 line
2.11.0
maintainer
#1 lore raw

PATCH 1/1 mmc: meson-gx: set max block count to 256

Quoted 6 lines · Heiner Kallweit

So far max_blk_count isn't set what results in a default of value 8 to be used (PAGE_SIZE / block size).

Set max_blk_count to 256 as used in the uboot driver.

Thanks for the patch. A minor comment below:

drivers/mmc/host/meson-gx-mmc.c static int meson_mmc_probe(struct platform_device *pdev) · line 802

Quoted 13 lines
---
 drivers/mmc/host/meson-gx-mmc.c | 1 +
 1 file changed, 1 insertion(+)
drivers/mmc/host/meson-gx-mmc.c +1 -0
index 3308b5b6..030425be 100644
@@ -799,6 +799,7 @@ static int meson_mmc_probe(struct platform_device *pdev)
 		goto free_host;
 	}
 
+	mmc->max_blk_count = 256;

A step in the right direction, but the # blocks is actually a 9-bit field (c.f. length field of cmd_cfg part of descriptor (bits 8:0).

So this should be more like:

	/* blk count is 'length' field of cmd_cfg part of descriptor */
	mmc->max_blk_count = CMD_CFG_LENGTH_MASK + 1;

I tested that change locally, so after changing that, please resend and feel free to add:

Kevin

#2 lore raw

PATCH 1/1 mmc: meson-gx: set max block count to 256

Am 27.01.2017 um 19:28 schrieb Kevin Hilman:

Quoted 28 lines
Quoted 6 lines · Heiner Kallweit

So far max_blk_count isn't set what results in a default of value 8 to be used (PAGE_SIZE / block size).

Set max_blk_count to 256 as used in the uboot driver.

Thanks for the patch. A minor comment below:

drivers/mmc/host/meson-gx-mmc.c static int meson_mmc_probe(struct platform_device *pdev) · line 802

Quoted 13 lines
---
 drivers/mmc/host/meson-gx-mmc.c | 1 +
 1 file changed, 1 insertion(+)
drivers/mmc/host/meson-gx-mmc.c +1 -0
index 3308b5b6..030425be 100644
@@ -799,6 +799,7 @@ static int meson_mmc_probe(struct platform_device *pdev)
 		goto free_host;
 	}
 
+	mmc->max_blk_count = 256;

A step in the right direction, but the # blocks is actually a 9-bit field (c.f. length field of cmd_cfg part of descriptor (bits 8:0).

Quoted 8 lines

So this should be more like:

	/* blk count is 'length' field of cmd_cfg part of descriptor */
	mmc->max_blk_count = CMD_CFG_LENGTH_MASK + 1;

I tested that change locally, so after changing that, please resend and feel free to add:

max_blk_count = 0 means unlimited number of blocks. Therefore I think we have to go with: mmc->max_blk_count = CMD_CFG_LENGTH_MASK And I figured out later that we also have to set mmc->max_req_size.

In my tests the system never read / wrote more than 8 blocks in a row, most likely because the upper block layers use 4k blocks.

Therefore setting max_blk_count doesn't really provide a benefit but I think it's cleaner to expose the actual chip limit.

Rgds, Heiner

Quoted 5 lines

Kevin

maintainer
#3 lore raw

PATCH 1/1 mmc: meson-gx: set max block count to 256

Quoted 31 lines · Heiner Kallweit

Am 27.01.2017 um 19:28 schrieb Kevin Hilman:

Quoted 30 lines
Quoted 6 lines · Heiner Kallweit

So far max_blk_count isn't set what results in a default of value 8 to be used (PAGE_SIZE / block size).

Set max_blk_count to 256 as used in the uboot driver.

Thanks for the patch. A minor comment below:

drivers/mmc/host/meson-gx-mmc.c static int meson_mmc_probe(struct platform_device *pdev) · line 802

Quoted 13 lines
---
 drivers/mmc/host/meson-gx-mmc.c | 1 +
 1 file changed, 1 insertion(+)
drivers/mmc/host/meson-gx-mmc.c +1 -0
index 3308b5b6..030425be 100644
@@ -799,6 +799,7 @@ static int meson_mmc_probe(struct platform_device *pdev)
 		goto free_host;
 	}
 
+	mmc->max_blk_count = 256;

A step in the right direction, but the # blocks is actually a 9-bit field (c.f. length field of cmd_cfg part of descriptor (bits 8:0).

So this should be more like:

Quoted 8 lines
Quoted 6 lines
	/* blk count is 'length' field of cmd_cfg part of descriptor */
	mmc->max_blk_count = CMD_CFG_LENGTH_MASK + 1;

I tested that change locally, so after changing that, please resend and feel free to add:

max_blk_count = 0 means unlimited number of blocks. Therefore I think we have to go with: mmc->max_blk_count = CMD_CFG_LENGTH_MASK

Ah, yes. Good catch.

Kevin

Quoted 14 lines

And I figured out later that we also have to set mmc->max_req_size.

In my tests the system never read / wrote more than 8 blocks in a row, most likely because the upper block layers use 4k blocks.

Therefore setting max_blk_count doesn't really provide a benefit but I think it's cleaner to expose the actual chip limit.

Quoted 5 lines

Kevin