All of lore.kernel.org
 help / color / mirror / Atom feed
* mmc0: Invalid maximum block size, assuming 512 bytes
@ 2016-01-19 15:33 Mason
  2016-01-20  1:17 ` Shawn Lin
  0 siblings, 1 reply; 9+ messages in thread
From: Mason @ 2016-01-19 15:33 UTC (permalink / raw)
  To: linux-mmc
  Cc: Michal Simek, Soren Brinkmann, Suman Tripathi, Arnd Bergmann,
	Ulf Hansson, Sebastian Frias

Hello,

My SoC provides an Arasan SDIO/eMMC controller supported by the
drivers/mmc/host/sdhci-of-arasan.c driver.

At init, the driver prints a warning to the console:

[    0.887301] sdhci: Secure Digital Host Controller Interface driver
[    0.893537] sdhci: Copyright(c) Pierre Ossman
[    0.897928] sdhci-pltfm: SDHCI platform and OF driver helper
[    0.903903] sdhci-arasan 21000.mmc: No vmmc regulator found
[    0.909537] sdhci-arasan 21000.mmc: No vqmmc regulator found
[    0.915247] mmc0: Invalid maximum block size, assuming 512 bytes
[    0.953797] mmc0: SDHCI controller on 21000.mmc [21000.mmc] using ADMA
[    0.961494] sdhci-arasan 21200.mmc: No vmmc regulator found
[    0.967110] sdhci-arasan 21200.mmc: No vqmmc regulator found

Is "mmc0: Invalid maximum block size, assuming 512 bytes" something
serious which requires investigating, in your experience?

The corresponding DT is:

mmc0: mmc@21000 {
	compatible = "arasan,sdhci-8.9a";
	reg = <0x21000 0x200>;
	clock-names = "clk_xin", "clk_ahb";
	clocks = <&sdio_clk>, <&clkgen 1>;
	interrupts = <60 IRQ_TYPE_LEVEL_HIGH>;
};

Regards.

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

* Re: mmc0: Invalid maximum block size, assuming 512 bytes
  2016-01-19 15:33 mmc0: Invalid maximum block size, assuming 512 bytes Mason
@ 2016-01-20  1:17 ` Shawn Lin
  2016-01-21 15:00   ` Mason
  0 siblings, 1 reply; 9+ messages in thread
From: Shawn Lin @ 2016-01-20  1:17 UTC (permalink / raw)
  To: Mason, linux-mmc
  Cc: shawn.lin, Michal Simek, Soren Brinkmann, Suman Tripathi,
	Arnd Bergmann, Ulf Hansson, Sebastian Frias

On 2016/1/19 23:33, Mason wrote:
> Hello,
>
> My SoC provides an Arasan SDIO/eMMC controller supported by the
> drivers/mmc/host/sdhci-of-arasan.c driver.
>
> At init, the driver prints a warning to the console:
>
> [    0.887301] sdhci: Secure Digital Host Controller Interface driver
> [    0.893537] sdhci: Copyright(c) Pierre Ossman
> [    0.897928] sdhci-pltfm: SDHCI platform and OF driver helper
> [    0.903903] sdhci-arasan 21000.mmc: No vmmc regulator found
> [    0.909537] sdhci-arasan 21000.mmc: No vqmmc regulator found
> [    0.915247] mmc0: Invalid maximum block size, assuming 512 bytes
> [    0.953797] mmc0: SDHCI controller on 21000.mmc [21000.mmc] using ADMA
> [    0.961494] sdhci-arasan 21200.mmc: No vmmc regulator found
> [    0.967110] sdhci-arasan 21200.mmc: No vqmmc regulator found
>
> Is "mmc0: Invalid maximum block size, assuming 512 bytes" something
> serious which requires investigating, in your experience?
>

you can look into this commit 0633f654241
 From <SD host controller simplified specfication version 3.00>
sdhci doesn't support blocks of 4096 bytes.

But at least check my arasan-5.1 databook, it supports 4096 from
the capabilities register. So, you don't force arasan to use
SDHCI_QUIRK_FORCE_BLK_SZ_2048, then sdhci core force it to be 512 bytes.
Not serious problem, just a proper warn.

> The corresponding DT is:
>
> mmc0: mmc@21000 {
> 	compatible = "arasan,sdhci-8.9a";
> 	reg = <0x21000 0x200>;
> 	clock-names = "clk_xin", "clk_ahb";
> 	clocks = <&sdio_clk>, <&clkgen 1>;
> 	interrupts = <60 IRQ_TYPE_LEVEL_HIGH>;
> };
>
> Regards.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>
>


-- 
Best Regards
Shawn Lin


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

* Re: mmc0: Invalid maximum block size, assuming 512 bytes
  2016-01-20  1:17 ` Shawn Lin
@ 2016-01-21 15:00   ` Mason
  2016-01-22  2:07     ` Shawn Lin
  0 siblings, 1 reply; 9+ messages in thread
From: Mason @ 2016-01-21 15:00 UTC (permalink / raw)
  To: Shawn Lin, linux-mmc
  Cc: Michal Simek, Soren Brinkmann, Suman Tripathi, Arnd Bergmann,
	Ulf Hansson, Sebastian Frias

On 20/01/2016 02:17, Shawn Lin wrote:

> On 2016/1/19 23:33, Mason wrote:
>
>> My SoC provides an Arasan SDIO/eMMC controller supported by the
>> drivers/mmc/host/sdhci-of-arasan.c driver.
>>
>> At init, the driver prints a warning to the console:
>>
>> [    0.887301] sdhci: Secure Digital Host Controller Interface driver
>> [    0.893537] sdhci: Copyright(c) Pierre Ossman
>> [    0.897928] sdhci-pltfm: SDHCI platform and OF driver helper
>> [    0.903903] sdhci-arasan 21000.mmc: No vmmc regulator found
>> [    0.909537] sdhci-arasan 21000.mmc: No vqmmc regulator found
>> [    0.915247] mmc0: Invalid maximum block size, assuming 512 bytes
>> [    0.953797] mmc0: SDHCI controller on 21000.mmc [21000.mmc] using ADMA
>> [    0.961494] sdhci-arasan 21200.mmc: No vmmc regulator found
>> [    0.967110] sdhci-arasan 21200.mmc: No vqmmc regulator found
>>
>> Is "mmc0: Invalid maximum block size, assuming 512 bytes" something
>> serious which requires investigating, in your experience?
> 
> you can look into this commit 0633f654241
>  From <SD host controller simplified specfication version 3.00>
> sdhci doesn't support blocks of 4096 bytes.
> 
> But at least check my arasan-5.1 databook, it supports 4096 from
> the capabilities register. So, you don't force arasan to use
> SDHCI_QUIRK_FORCE_BLK_SZ_2048, then sdhci core force it to be 512 bytes.
> Not serious problem, just a proper warn.
> 
>> The corresponding DT is:
>>
>> mmc0: mmc@21000 {
>> 	compatible = "arasan,sdhci-8.9a";
>> 	reg = <0x21000 0x200>;
>> 	clock-names = "clk_xin", "clk_ahb";
>> 	clocks = <&sdio_clk>, <&clkgen 1>;
>> 	interrupts = <60 IRQ_TYPE_LEVEL_HIGH>;
>> };

Hello Shawn,

Thanks for pointing out SDHCI_QUIRK_FORCE_BLK_SZ_2048.

I don't think there is currently a way to enable this quirk
for the Arasan controller from the device tree, right?

$ git grep SDHCI_QUIRK_FORCE_BLK_SZ_2048 drivers/mmc
drivers/mmc/host/sdhci-bcm-kona.c:              SDHCI_QUIRK_FORCE_BLK_SZ_2048 |
drivers/mmc/host/sdhci-esdhc.h:#define ESDHC_DEFAULT_QUIRKS     (SDHCI_QUIRK_FORCE_BLK_SZ_2048 | \
drivers/mmc/host/sdhci.c:       if (host->quirks & SDHCI_QUIRK_FORCE_BLK_SZ_2048) {
drivers/mmc/host/sdhci.h:#define SDHCI_QUIRK_FORCE_BLK_SZ_2048                  (1<<20)

So that means I have to write code in
drivers/mmc/host/sdhci-of-arasan.c correct?

Regards.


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

* Re: mmc0: Invalid maximum block size, assuming 512 bytes
  2016-01-21 15:00   ` Mason
@ 2016-01-22  2:07     ` Shawn Lin
  2016-01-22  7:17       ` Mason
  0 siblings, 1 reply; 9+ messages in thread
From: Shawn Lin @ 2016-01-22  2:07 UTC (permalink / raw)
  To: Mason, linux-mmc
  Cc: shawn.lin, Michal Simek, Soren Brinkmann, Suman Tripathi,
	Arnd Bergmann, Ulf Hansson, Sebastian Frias

On 2016/1/21 23:00, Mason wrote:
> On 20/01/2016 02:17, Shawn Lin wrote:
>
>> On 2016/1/19 23:33, Mason wrote:
>>
>>> My SoC provides an Arasan SDIO/eMMC controller supported by the
>>> drivers/mmc/host/sdhci-of-arasan.c driver.
>>>
>>> At init, the driver prints a warning to the console:
>>>
>>> [    0.887301] sdhci: Secure Digital Host Controller Interface driver
>>> [    0.893537] sdhci: Copyright(c) Pierre Ossman
>>> [    0.897928] sdhci-pltfm: SDHCI platform and OF driver helper
>>> [    0.903903] sdhci-arasan 21000.mmc: No vmmc regulator found
>>> [    0.909537] sdhci-arasan 21000.mmc: No vqmmc regulator found
>>> [    0.915247] mmc0: Invalid maximum block size, assuming 512 bytes
>>> [    0.953797] mmc0: SDHCI controller on 21000.mmc [21000.mmc] using ADMA
>>> [    0.961494] sdhci-arasan 21200.mmc: No vmmc regulator found
>>> [    0.967110] sdhci-arasan 21200.mmc: No vqmmc regulator found
>>>
>>> Is "mmc0: Invalid maximum block size, assuming 512 bytes" something
>>> serious which requires investigating, in your experience?
>>
>> you can look into this commit 0633f654241
>>   From <SD host controller simplified specfication version 3.00>
>> sdhci doesn't support blocks of 4096 bytes.
>>
>> But at least check my arasan-5.1 databook, it supports 4096 from
>> the capabilities register. So, you don't force arasan to use
>> SDHCI_QUIRK_FORCE_BLK_SZ_2048, then sdhci core force it to be 512 bytes.
>> Not serious problem, just a proper warn.
>>
>>> The corresponding DT is:
>>>
>>> mmc0: mmc@21000 {
>>> 	compatible = "arasan,sdhci-8.9a";
>>> 	reg = <0x21000 0x200>;
>>> 	clock-names = "clk_xin", "clk_ahb";
>>> 	clocks = <&sdio_clk>, <&clkgen 1>;
>>> 	interrupts = <60 IRQ_TYPE_LEVEL_HIGH>;
>>> };
>
> Hello Shawn,
>
> Thanks for pointing out SDHCI_QUIRK_FORCE_BLK_SZ_2048.
>
> I don't think there is currently a way to enable this quirk
> for the Arasan controller from the device tree, right?

Right, no property available fot this.

>
> $ git grep SDHCI_QUIRK_FORCE_BLK_SZ_2048 drivers/mmc
> drivers/mmc/host/sdhci-bcm-kona.c:              SDHCI_QUIRK_FORCE_BLK_SZ_2048 |
> drivers/mmc/host/sdhci-esdhc.h:#define ESDHC_DEFAULT_QUIRKS     (SDHCI_QUIRK_FORCE_BLK_SZ_2048 | \
> drivers/mmc/host/sdhci.c:       if (host->quirks & SDHCI_QUIRK_FORCE_BLK_SZ_2048) {
> drivers/mmc/host/sdhci.h:#define SDHCI_QUIRK_FORCE_BLK_SZ_2048                  (1<<20)
>
> So that means I have to write code in
> drivers/mmc/host/sdhci-of-arasan.c correct?

It depends. If you think 512 block size if okay for you, leave it alone.
Otherwise, add it in drivers/mmc/host/sdhci-of-arasan.c :)



>
> Regards.
>
>
>
>


-- 
Best Regards
Shawn Lin


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

* Re: mmc0: Invalid maximum block size, assuming 512 bytes
  2016-01-22  2:07     ` Shawn Lin
@ 2016-01-22  7:17       ` Mason
  2016-02-01 21:32         ` Mason
  0 siblings, 1 reply; 9+ messages in thread
From: Mason @ 2016-01-22  7:17 UTC (permalink / raw)
  To: Shawn Lin, linux-mmc
  Cc: Michal Simek, Soren Brinkmann, Suman Tripathi, Arnd Bergmann,
	Ulf Hansson, Sebastian Frias

On 22/01/2016 03:07, Shawn Lin wrote:

> On 2016/1/21 23:00, Mason wrote:
>
>> So that means I have to write code in
>> drivers/mmc/host/sdhci-of-arasan.c correct?
> 
> It depends. If you think 512 block size if okay for you, leave it alone.
> Otherwise, add it in drivers/mmc/host/sdhci-of-arasan.c :)

When I measured the read/write throughput to an attached
SD card, I got around 16 MB/s, and I thought raising the
block size might help with throughput?

I'll test and report back.

Regards.


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

* Re: mmc0: Invalid maximum block size, assuming 512 bytes
  2016-01-22  7:17       ` Mason
@ 2016-02-01 21:32         ` Mason
  2016-02-02  8:58           ` Adrian Hunter
  0 siblings, 1 reply; 9+ messages in thread
From: Mason @ 2016-02-01 21:32 UTC (permalink / raw)
  To: linux-mmc
  Cc: Shawn Lin, Michal Simek, Soren Brinkmann, Suman Tripathi,
	Arnd Bergmann, Ulf Hansson, Sebastian Frias

On 22/01/2016 08:17, Mason wrote:

> On 22/01/2016 03:07, Shawn Lin wrote:
> 
>> On 2016/1/21 23:00, Mason wrote:
>>
>>> So that means I have to write code in
>>> drivers/mmc/host/sdhci-of-arasan.c correct?
>>
>> It depends. If you think 512 block size if okay for you, leave it alone.
>> Otherwise, add it in drivers/mmc/host/sdhci-of-arasan.c :)
> 
> When I measured the read/write throughput to an attached
> SD card, I got around 16 MB/s, and I thought raising the
> block size might help with throughput?
> 
> I'll test and report back.

Haven't had time to test yet, but I wanted to ask experienced
folks what to expect when raising the block size from 512 to
2048 bytes?

I don't think it would speed up dd'ing the entire device?
(Especially if we use a large block size in dd.)

Would it perhaps speed up myriads of random accesses?

Regards.


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

* Re: mmc0: Invalid maximum block size, assuming 512 bytes
  2016-02-01 21:32         ` Mason
@ 2016-02-02  8:58           ` Adrian Hunter
  2016-02-02 10:12             ` Mason
  0 siblings, 1 reply; 9+ messages in thread
From: Adrian Hunter @ 2016-02-02  8:58 UTC (permalink / raw)
  To: Mason, linux-mmc
  Cc: Shawn Lin, Michal Simek, Soren Brinkmann, Suman Tripathi,
	Arnd Bergmann, Ulf Hansson, Sebastian Frias

On 01/02/16 23:32, Mason wrote:
> On 22/01/2016 08:17, Mason wrote:
> 
>> On 22/01/2016 03:07, Shawn Lin wrote:
>>
>>> On 2016/1/21 23:00, Mason wrote:
>>>
>>>> So that means I have to write code in
>>>> drivers/mmc/host/sdhci-of-arasan.c correct?
>>>
>>> It depends. If you think 512 block size if okay for you, leave it alone.
>>> Otherwise, add it in drivers/mmc/host/sdhci-of-arasan.c :)
>>
>> When I measured the read/write throughput to an attached
>> SD card, I got around 16 MB/s, and I thought raising the
>> block size might help with throughput?
>>
>> I'll test and report back.
> 
> Haven't had time to test yet, but I wanted to ask experienced
> folks what to expect when raising the block size from 512 to
> 2048 bytes?

mmc block driver sets block size to 512.

What you are looking at is maximum block size.  SDIO uses bigger block
sizes, so it is useful for that.



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

* Re: mmc0: Invalid maximum block size, assuming 512 bytes
  2016-02-02  8:58           ` Adrian Hunter
@ 2016-02-02 10:12             ` Mason
  2016-02-02 11:30               ` Adrian Hunter
  0 siblings, 1 reply; 9+ messages in thread
From: Mason @ 2016-02-02 10:12 UTC (permalink / raw)
  To: Adrian Hunter, linux-mmc
  Cc: Shawn Lin, Michal Simek, Soren Brinkmann, Suman Tripathi,
	Arnd Bergmann, Ulf Hansson, Sebastian Frias, Anton Vorontsov,
	Pierre Ossman

On 02/02/2016 09:58, Adrian Hunter wrote:
> On 01/02/16 23:32, Mason wrote:
>> On 22/01/2016 08:17, Mason wrote:
>>
>>> On 22/01/2016 03:07, Shawn Lin wrote:
>>>
>>>> On 2016/1/21 23:00, Mason wrote:
>>>>
>>>>> So that means I have to write code in
>>>>> drivers/mmc/host/sdhci-of-arasan.c correct?
>>>>
>>>> It depends. If you think 512 block size if okay for you, leave it alone.
>>>> Otherwise, add it in drivers/mmc/host/sdhci-of-arasan.c :)
>>>
>>> When I measured the read/write throughput to an attached
>>> SD card, I got around 16 MB/s, and I thought raising the
>>> block size might help with throughput?
>>>
>>> I'll test and report back.
>>
>> Haven't had time to test yet, but I wanted to ask experienced
>> folks what to expect when raising the block size from 512 to
>> 2048 bytes?
> 
> mmc block driver sets block size to 512.
> 
> What you are looking at is maximum block size.  SDIO uses bigger block
> sizes, so it is useful for that.

You're right. I was looking at this block of code:

	/*
	 * Maximum block size. This varies from controller to controller and
	 * is specified in the capabilities register.
	 */
	if (host->quirks & SDHCI_QUIRK_FORCE_BLK_SZ_2048) {
		mmc->max_blk_size = 2;
	} else {
		mmc->max_blk_size = (caps[0] & SDHCI_MAX_BLOCK_MASK) >>
				SDHCI_MAX_BLOCK_SHIFT;
		if (mmc->max_blk_size >= 3) {
			pr_warn("%s: Invalid maximum block size, assuming 512 bytes\n",
				mmc_hostname(mmc));
			mmc->max_blk_size = 0;
		}
	}

	mmc->max_blk_size = 512 << mmc->max_blk_size;


As Shawn pointed out, this was updated by commit 0633f654241

Author: Anton Vorontsov
Date:   Tue Mar 17 00:14:03 2009 +0300

    sdhci: Add quirk for forcing maximum block size to 2048 bytes
    
    FSL eSDHC controllers can support maximum block size up to 4096 bytes,
    the MBL (Maximum Block Length) field in the capabilities register
    extended by one bit, and is set to 0x3.
    
    But the SDHCI core doesn't support blocks of 4096 bytes, and thus
    forces blksz to the lowest value -- 512 bytes. With this patch we can
    pin up the blksz to the maximum supported block size, i.e. 2048 bytes.


But I'm wondering if the 2048-byte limitation in SDHCI core is
still present?

I see some drivers apparently setting it to a higher value:

host/atmel-mci.c:	mmc->max_blk_size = 32768;
host/dw_mmc.c:		mmc->max_blk_size = 65536;
host/wbsd.c:		mmc->max_blk_size = 4087;

Regards.


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

* Re: mmc0: Invalid maximum block size, assuming 512 bytes
  2016-02-02 10:12             ` Mason
@ 2016-02-02 11:30               ` Adrian Hunter
  0 siblings, 0 replies; 9+ messages in thread
From: Adrian Hunter @ 2016-02-02 11:30 UTC (permalink / raw)
  To: Mason, linux-mmc
  Cc: Shawn Lin, Michal Simek, Soren Brinkmann, Suman Tripathi,
	Arnd Bergmann, Ulf Hansson, Sebastian Frias, Anton Vorontsov,
	Pierre Ossman

On 02/02/16 12:12, Mason wrote:
> On 02/02/2016 09:58, Adrian Hunter wrote:
>> On 01/02/16 23:32, Mason wrote:
>>> On 22/01/2016 08:17, Mason wrote:
>>>
>>>> On 22/01/2016 03:07, Shawn Lin wrote:
>>>>
>>>>> On 2016/1/21 23:00, Mason wrote:
>>>>>
>>>>>> So that means I have to write code in
>>>>>> drivers/mmc/host/sdhci-of-arasan.c correct?
>>>>>
>>>>> It depends. If you think 512 block size if okay for you, leave it alone.
>>>>> Otherwise, add it in drivers/mmc/host/sdhci-of-arasan.c :)
>>>>
>>>> When I measured the read/write throughput to an attached
>>>> SD card, I got around 16 MB/s, and I thought raising the
>>>> block size might help with throughput?
>>>>
>>>> I'll test and report back.
>>>
>>> Haven't had time to test yet, but I wanted to ask experienced
>>> folks what to expect when raising the block size from 512 to
>>> 2048 bytes?
>>
>> mmc block driver sets block size to 512.
>>
>> What you are looking at is maximum block size.  SDIO uses bigger block
>> sizes, so it is useful for that.
> 
> You're right. I was looking at this block of code:
> 
> 	/*
> 	 * Maximum block size. This varies from controller to controller and
> 	 * is specified in the capabilities register.
> 	 */
> 	if (host->quirks & SDHCI_QUIRK_FORCE_BLK_SZ_2048) {
> 		mmc->max_blk_size = 2;
> 	} else {
> 		mmc->max_blk_size = (caps[0] & SDHCI_MAX_BLOCK_MASK) >>
> 				SDHCI_MAX_BLOCK_SHIFT;
> 		if (mmc->max_blk_size >= 3) {
> 			pr_warn("%s: Invalid maximum block size, assuming 512 bytes\n",
> 				mmc_hostname(mmc));
> 			mmc->max_blk_size = 0;
> 		}
> 	}
> 
> 	mmc->max_blk_size = 512 << mmc->max_blk_size;
> 
> 
> As Shawn pointed out, this was updated by commit 0633f654241
> 
> Author: Anton Vorontsov
> Date:   Tue Mar 17 00:14:03 2009 +0300
> 
>     sdhci: Add quirk for forcing maximum block size to 2048 bytes
>     
>     FSL eSDHC controllers can support maximum block size up to 4096 bytes,
>     the MBL (Maximum Block Length) field in the capabilities register
>     extended by one bit, and is set to 0x3.
>     
>     But the SDHCI core doesn't support blocks of 4096 bytes, and thus
>     forces blksz to the lowest value -- 512 bytes. With this patch we can
>     pin up the blksz to the maximum supported block size, i.e. 2048 bytes.
> 
> 
> But I'm wondering if the 2048-byte limitation in SDHCI core is
> still present?

The block size field of the Block Size register is only 12 bits, so yes.

> 
> I see some drivers apparently setting it to a higher value:
> 
> host/atmel-mci.c:	mmc->max_blk_size = 32768;
> host/dw_mmc.c:		mmc->max_blk_size = 65536;
> host/wbsd.c:		mmc->max_blk_size = 4087;

Sure, but not SDHCI.


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

end of thread, other threads:[~2016-02-02 11:34 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-19 15:33 mmc0: Invalid maximum block size, assuming 512 bytes Mason
2016-01-20  1:17 ` Shawn Lin
2016-01-21 15:00   ` Mason
2016-01-22  2:07     ` Shawn Lin
2016-01-22  7:17       ` Mason
2016-02-01 21:32         ` Mason
2016-02-02  8:58           ` Adrian Hunter
2016-02-02 10:12             ` Mason
2016-02-02 11:30               ` Adrian Hunter

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.