public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] mmc: question about capacity detection
@ 2014-08-05  7:20 Hannes Petermaier
  2014-08-05  8:55 ` Hannes Petermaier
  0 siblings, 1 reply; 5+ messages in thread
From: Hannes Petermaier @ 2014-08-05  7:20 UTC (permalink / raw)
  To: u-boot

hi folks,

i am actually trying to enable the "enhanced data area" on an 4GB emmc 
device, this i've done successfully with the linux mmc-utils and the 
card has after this "partitioning" 2GB user-partition.

Linux kernel deals correctly with the card.

U-Boot doesn't:

"
MMC: block number 0x301 exceeds max(0x0)
spl: mmc blk read err - 0
### ERROR ### Please RESET the board ###
"

So i debugged around and found the capacity-calculation, which i don't 
fully understand.
"
     if (mmc->high_capacity) {
         csize = (mmc->csd[1] & 0x3f) << 16
             | (mmc->csd[2] & 0xffff0000) >> 16;
         cmult = 8;
     } else {
         csize = (mmc->csd[1] & 0x3ff) << 2
             | (mmc->csd[2] & 0xc0000000) >> 30;
         cmult = (mmc->csd[2] & 0x00038000) >> 15;
     }
"
The else path does for my opinion the right calculation according the 
mmc-specification, the "high_capacity" path i do not understand at all, 
neither i found some specification for this.

In fact my 4GB card (with 2GB enhanced area) works only with "the else" 
path.
my csd Registers:

MMC-card dection:
ocr    : 0xc0ff8080
csd[0] : 0xd04f0132
csd[1] : 0x0f5a13ff
csd[2] : 0xffffffe7
csd[3] : 0x8a4000f1
c_size : 0x00000000003fffff
c_mult : 0x0000000000000008

U-Boot (BuR V2.0)# mmc info
Device: OMAP SD/MMC
Manufacturer ID: fe
OEM: 14e
Name: MMC04
Tran Speed: 52000000
Rd Block Len: 512
MMC version 4.41
High Capacity: Yes
Capacity: 4 TiB
Bus Width: 1-bit

any ideas ?

best regards,
Hannes

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

* [U-Boot] mmc: question about capacity detection
  2014-08-05  7:20 [U-Boot] mmc: question about capacity detection Hannes Petermaier
@ 2014-08-05  8:55 ` Hannes Petermaier
  2014-08-05 11:07   ` [U-Boot] hw_watchdog andrew
  0 siblings, 1 reply; 5+ messages in thread
From: Hannes Petermaier @ 2014-08-05  8:55 UTC (permalink / raw)
  To: u-boot

On 2014-08-05 09:20, Hannes Petermaier wrote:
> hi folks,
>
> i am actually trying to enable the "enhanced data area" on an 4GB emmc 
> device, this i've done successfully with the linux mmc-utils and the 
> card has after this "partitioning" 2GB user-partition.
>
> Linux kernel deals correctly with the card.
>
> U-Boot doesn't:
>
> "
> MMC: block number 0x301 exceeds max(0x0)
> spl: mmc blk read err - 0
> ### ERROR ### Please RESET the board ###
> "
>
> So i debugged around and found the capacity-calculation, which i don't 
> fully understand.
> "
>     if (mmc->high_capacity) {
>         csize = (mmc->csd[1] & 0x3f) << 16
>             | (mmc->csd[2] & 0xffff0000) >> 16;
>         cmult = 8;
>     } else {
>         csize = (mmc->csd[1] & 0x3ff) << 2
>             | (mmc->csd[2] & 0xc0000000) >> 30;
>         cmult = (mmc->csd[2] & 0x00038000) >> 15;
>     }
> "
> The else path does for my opinion the right calculation according the 
> mmc-specification, the "high_capacity" path i do not understand at 
> all, neither i found some specification for this.
>
> In fact my 4GB card (with 2GB enhanced area) works only with "the 
> else" path.
> my csd Registers:
>
> MMC-card dection:
> ocr    : 0xc0ff8080
> csd[0] : 0xd04f0132
> csd[1] : 0x0f5a13ff
> csd[2] : 0xffffffe7
> csd[3] : 0x8a4000f1
> c_size : 0x00000000003fffff
> c_mult : 0x0000000000000008
>
> U-Boot (BuR V2.0)# mmc info
> Device: OMAP SD/MMC
> Manufacturer ID: fe
> OEM: 14e
> Name: MMC04
> Tran Speed: 52000000
> Rd Block Len: 512
> MMC version 4.41
> High Capacity: Yes
> Capacity: 4 TiB
> Bus Width: 1-bit
>
> any ideas ?
>
> best regards,
> Hannes
>
I've digged a bit deeper and found an (for me, as newbie in this) 
interesting webpage:

http://www.hjreggel.net/cardspeed/special-sd.html

there i've found the key to understand the "high_capacity" path:
"...In CSD Version 2.0, the C_SIZE field was extended to 22 bit. The 
C_SIZE_MULT was dropped, assuming a preset multiplier of 2^10 . The 
READ_BL_LEN was kept, but the only value allowed is 9, indicating a 
block length of 512 bytes."

So the code should be as following:

-       if (mmc->high_capacity) {
+       if (mmc->high_capacity && mmc->read_bl_len == MMC_MAX_BLOCK_LEN) {

i'am correct in my thinking ? please some comment.
if yes - i will format a patch for this

best regards,
Hannes

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

* [U-Boot] hw_watchdog
  2014-08-05  8:55 ` Hannes Petermaier
@ 2014-08-05 11:07   ` andrew
  2014-08-05 12:22     ` Hannes Petermaier
  2014-08-05 18:49     ` Jeroen Hofstee
  0 siblings, 2 replies; 5+ messages in thread
From: andrew @ 2014-08-05 11:07 UTC (permalink / raw)
  To: u-boot

How can I find out if hw_watchdog is enabled on my U-Boot?
Is there a timing variable that I need to set in "u-boot-env"
Or that part of the code is executed earlier.

Bassically what im experienceing is that sometimes, in some unknown 
conditions, U-Boot will freeze, at the point when is relocating to RAM. 
I belive.
O dont get anything else after DRAM:  64 M.

Kernel which I'm using is 3.10.
Any advice will be very much appreciated.

Thanks.

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

* [U-Boot] hw_watchdog
  2014-08-05 11:07   ` [U-Boot] hw_watchdog andrew
@ 2014-08-05 12:22     ` Hannes Petermaier
  2014-08-05 18:49     ` Jeroen Hofstee
  1 sibling, 0 replies; 5+ messages in thread
From: Hannes Petermaier @ 2014-08-05 12:22 UTC (permalink / raw)
  To: u-boot

On 2014-08-05 13:07, andrew at PolkaSpots.com wrote:
> How can I find out if hw_watchdog is enabled on my U-Boot?
> Is there a timing variable that I need to set in "u-boot-env"
> Or that part of the code is executed earlier.
>
> Bassically what im experienceing is that sometimes, in some unknown 
> conditions, U-Boot will freeze, at the point when is relocating to 
> RAM. I belive.
> O dont get anything else after DRAM:  64 M.
>
> Kernel which I'm using is 3.10.
> Any advice will be very much appreciated.
>
> Thanks.
>
>
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
Hi andrew,
on which plattform you are ?

best regards,
hannes

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

* [U-Boot] hw_watchdog
  2014-08-05 11:07   ` [U-Boot] hw_watchdog andrew
  2014-08-05 12:22     ` Hannes Petermaier
@ 2014-08-05 18:49     ` Jeroen Hofstee
  1 sibling, 0 replies; 5+ messages in thread
From: Jeroen Hofstee @ 2014-08-05 18:49 UTC (permalink / raw)
  To: u-boot

Hello Andrew,

On 05-08-14 13:07, andrew at PolkaSpots.com wrote:
> How can I find out if hw_watchdog is enabled on my U-Boot?

Adding a while(1); to some command should trigger
the wd when enabled. Just make sure you don't brick
your board by making it optional ;)

Regards,
Jeroen

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

end of thread, other threads:[~2014-08-05 18:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-05  7:20 [U-Boot] mmc: question about capacity detection Hannes Petermaier
2014-08-05  8:55 ` Hannes Petermaier
2014-08-05 11:07   ` [U-Boot] hw_watchdog andrew
2014-08-05 12:22     ` Hannes Petermaier
2014-08-05 18:49     ` Jeroen Hofstee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox