From mboxrd@z Thu Jan 1 00:00:00 1970 From: Romain Izard Date: Tue, 6 Nov 2012 08:41:06 +0000 (UTC) Subject: [U-Boot] generic mmc bug in reading sd card capacity References: <02e101cdb8c9$7a25fe60$6e71fb20$@keyasic.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 2012-11-02, victor wrote: > Hi All, > > Accord to SD spec 2.0, the formula to find out sd card capacity is: > > memory capacity = (C_SIZE+1) * 512K byte > and > C_SIZE is from CSD [69:48] > > Thus, the code in generic mmc is wrong for the high capacity sd card. My > patch is below. > We should be careful about the fact that this only works for SD cards. The size parameter is handled differently on MMC devices larger than 2 GiB. What do you think of the following patch: (Compile tested only, I do not have a board available for testing right now) 8<----------------------------------------------------------------------