1
0
mirror of git://projects.qi-hardware.com/xburst-tools.git synced 2024-11-22 18:37:31 +02:00

qi-block-sd-indexing-throughout.patch

Now cards larger than 4GB are normal, we can't use the byte addressing
internally any more for SDHC type card.  This changes us to use block
(512 byte) addressing internally always.

Signed-off-by: Andy Green <andy@openmoko.com>
This commit is contained in:
Andy Green 2008-11-28 10:16:38 +00:00 committed by Andy Green
parent 5dbdcda9b2
commit bcdb949182

View File

@ -105,14 +105,13 @@ unsigned char CRC7(u8 * pu8, int cnt)
unsigned long mmc_bread(int dev_num, unsigned long blknr, unsigned long blkcnt,
void *dst)
{
unsigned long src = blknr * MMC_BLOCK_SIZE;
int ret;
if (!blkcnt)
return 0;
/* printf("mmc_bread(%d, %ld, %ld, %p)\n", dev_num, blknr, blkcnt, dst); */
ret = mmc_read(src, dst, blkcnt * MMC_BLOCK_SIZE);
ret = mmc_read(blknr, dst, blkcnt);
if (ret)
return ret;
@ -433,12 +432,6 @@ int mmc_read(unsigned long src, u8 *dst, int size)
u8 response[16];
int size_original = size;
if ((!size) || (size & (MMC_BLOCK_SIZE - 1))) {
puts("Bad size 0x");
print32(size);
return 0;
}
if (((int)dst) & 1) {
puts("Bad align on dst\n");
return 0;
@ -454,13 +447,13 @@ int mmc_read(unsigned long src, u8 *dst, int size)
switch (card_type) {
case CARDTYPE_SDHC: /* block addressing */
resp = mmc_cmd(MMC_READ_SINGLE_BLOCK,
src >> MMC_BLOCK_SIZE_BITS,
src,
MMC_CMD_ADTC | MMC_RSP_R1 |
MMC_DATA_READ, MMC_BLOCK_SIZE, 1, 0,
(u16 *)&response[0]);
break;
default: /* byte addressing */
resp = mmc_cmd(MMC_READ_SINGLE_BLOCK, src,
resp = mmc_cmd(MMC_READ_SINGLE_BLOCK, src * MMC_BLOCK_SIZE,
MMC_CMD_ADTC | MMC_RSP_R1 | MMC_DATA_READ,
MMC_BLOCK_SIZE, 1, 0,
(u16 *)&response[0]);
@ -477,12 +470,11 @@ int mmc_read(unsigned long src, u8 *dst, int size)
do_pio_read((u16 *)dst, MMC_BLOCK_SIZE >> 1);
if (size >= MMC_BLOCK_SIZE)
size -= MMC_BLOCK_SIZE;
else
size = 0;
if (size)
size--;
dst += MMC_BLOCK_SIZE;
src += MMC_BLOCK_SIZE;
src++;
}
return size_original;
}