[#4776] BF54x, BF51x SD host driver: Wrong capacity for 8GB SDHC card

Document created by Aaronwu Employee on Aug 30, 2013
Version 1Show Document
  • View in full screen mode

[#4776] BF54x, BF51x SD host driver: Wrong capacity for 8GB SDHC card

Submitted By: Yi Li

Open Date

2009-01-07 04:37:09     Close Date

2009-01-21 01:02:04

Priority:

Low     Assignee:

Nobody

Status:

Closed     Fixed In Release:

N/A

Found In Release:

N/A     Release:

Category:

N/A     Board:

EZKIT Lite

Processor:

ALL     Silicon Revision:

Is this bug repeatable?:

Yes     Resolution:

N/A

Uboot version or rev.:

    Toolchain version or rev.:

svn trunk 4.1

App binary format:

N/A     

Summary: BF54x, BF51x SD host driver: Wrong capacity for 8GB SDHC card

Details:

 

I am testing with a 8GB transend SDHC card, however, the capacity shown by the sd host driver is only 3.51 GB. And fdisk cannot find the missing 4.5GB either.

 

 

"mmc0: new SDHC card at address b368                                                                                                            

mmcblk0: mmc0:b368 SDC   3.51 GiB                                                                                                              

mmcblk0: p1 p2   "

 

Follow-ups

 

--- Yi Li                                                    2009-01-07 22:21:56

update:

 

fdisk can read the capacity of card correctly. So this is a mmc block layer

issue.

 

"root:/> fdisk /dev/mmcblk0                                           

        

                                                                              

 

Command (m for help): p                                                       

 

                                                                              

 

Disk /dev/mmcblk0: 8068 MB, 8068268032 bytes                                  

 

249 heads, 62 sectors/track, 1020 cylinders                                   

 

Units = cylinders of 15438 * 512 = 7904256 bytes                              

 

                                                                              

 

        Device Boot      Start         End      Blocks  Id System             

 

/dev/mmcblk0p1               1        1020     7873349  83 Linux              

 

"

 

--- Cliff Cai                                                2009-01-08 04:49:25

 

 

 

 

--- Robin Getz                                               2009-01-08 15:35:41

Has this been reported upstream yet?

 

I didn't see anything on lkml?

 

 

--- Yi Li                                                    2009-01-08 21:16:57

I will have a double check, see whether it still exists after kernel upgrading

yesterday.

 

--- Yi Li                                                    2009-01-13 03:21:56

Post to LKML at: http://lkml.org/lkml/2009/1/8/474, and I also posted a fix.

 

--- Robin Getz                                               2009-01-13 07:52:55

Excellent - thanks

 

Were you going to commit - or wait for feedback?

 

Since LBD is defined as "Enable block devices of size 2TB and

larger." - and your card is much less than that - I think the printk fix

patch is the right one.

         

-Robin

 

--- Yi Li                                                    2009-01-21 01:02:04

Seems no response from LKML:

 

The issue is in mmc/card/block.c: mmc_block_probe().

 

"string_get_size(get_capacity(md->disk) << 9, STRING_UNITS_2,

                       cap_str, sizeof(cap_str));

"

get_capacity() returns a type "sector_t" value, since I am working

on

a 32-bit processor (Analog Devices BF537),

and I did not enable CONFIG_LBD, "sector_t" is actually a 32-bit

"unsigned long".  So  "get_capacity(md->disk) <<

9" loses the MSB.

 

 

--- Robin Getz                                               2009-01-21 07:42:57

Yi:

 

I would send a patch to Andrew Morton (for -mm) and Greg KH (for stable), and

see if they take it.

 

 

 

-Robin

 

 

 

    Files

    Changes

    Commits

    Dependencies

    Duplicates

    Associations

    Tags

 

File Name     File Type     File Size     Posted By

No Files Were Found

Attachments

    Outcomes