summaryrefslogtreecommitdiffstats
path: root/sys/boot
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2007-03-28 22:31:32 +0000
committerimp <imp@FreeBSD.org>2007-03-28 22:31:32 +0000
commita57f06c8fd151f8e5b9b9507f3ef871ebd901e65 (patch)
tree8e4aacaa0d17698b44152214a1742cd33ba68056 /sys/boot
parent2be51a36eec133e5f36bc7c68fadc3479347a2b2 (diff)
downloadFreeBSD-src-a57f06c8fd151f8e5b9b9507f3ef871ebd901e65.zip
FreeBSD-src-a57f06c8fd151f8e5b9b9507f3ef871ebd901e65.tar.gz
All SD cards have a block size of 512. The READ_BL_LEN field in the
CSD is usually 512 (well, 9), but for 2GB (and the rogue 4GB SD cards) it is 1024 (or 2048 for 4GB). This value doesn't work for the block read commands (which really want 512). Hardcode 512 for those. This may break really old MMC cards that don't have a 512 block size (I've never seen one: make my day and send me one :-), but since the MMC side of the house is currently broken, it should only have the effect that 2GB (and non-conforming 4GB) SD cards will work. My 'non-conforming' 4GB SD card also works now too. The non-conforming 4GB SD cards were sold for a while before the SD association was worried they would be (a) incompatible (different FAT flavor on them) and (b) confusing for the new SDHC standard and cracked down on suppliers' bogus use of the SD trademark...
Diffstat (limited to 'sys/boot')
-rw-r--r--sys/boot/arm/at91/libat91/sd-card.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/boot/arm/at91/libat91/sd-card.c b/sys/boot/arm/at91/libat91/sd-card.c
index 095b6a1..d0b7beb 100644
--- a/sys/boot/arm/at91/libat91/sd-card.c
+++ b/sys/boot/arm/at91/libat91/sd-card.c
@@ -157,8 +157,9 @@ MCI_GetStatus()
static int
MCI_ReadBlock(int src, unsigned int *dataBuffer, int sizeToRead)
{
- unsigned log2sl = MCI_Device.READ_BL_LEN;
- unsigned sectorLength = 1 << log2sl;
+// unsigned log2sl = MCI_Device.READ_BL_LEN;
+// unsigned sectorLength = 1 << log2sl;
+ unsigned sectorLength = 512;
///////////////////////////////////////////////////////////////////////
if (MCI_Device.state != AT91C_MCI_IDLE)
@@ -195,8 +196,9 @@ MCI_ReadBlock(int src, unsigned int *dataBuffer, int sizeToRead)
int
MCI_read(char* dest, unsigned source, unsigned length)
{
- unsigned log2sl = MCI_Device.READ_BL_LEN;
- unsigned sectorLength = 1 << log2sl;
+// unsigned log2sl = MCI_Device.READ_BL_LEN;
+// unsigned sectorLength = 1 << log2sl;
+ unsigned sectorLength = 512;
int sizeToRead;
unsigned int *walker;
OpenPOWER on IntegriCloud