r1291 - trunk/src/target/u-boot/patches

werner at sita.openmoko.org werner at sita.openmoko.org
Fri Mar 9 01:07:55 CET 2007


Author: werner
Date: 2007-03-09 01:07:50 +0100 (Fri, 09 Mar 2007)
New Revision: 1291

Modified:
   trunk/src/target/u-boot/patches/mmc-fixes.patch
   trunk/src/target/u-boot/patches/series
Log:
include/asm-arm/arch-s3c24x0/regs-sdi.h (S3C2410_SDIDCON_BLKNUM_MASK): typo,
  should be S3C2410_SDIDCNT_BLKNUM_MASK
cpu/arm920t/s3c24x0/mmc.c (mmc_block_read): use S3C2410_SDIDCON_BLKNUM instead
  of bogus S3C2410_SDIDCON_BLKNUM_MASK
cpu/arm920t/s3c24x0/mmc.c (mmc_block_read): check SDIDSTA after each FIFO read
  and clear any pending errors
include/configs/neo1973.h (CONFIG_SUPPORT_VFAT): just #define, to avoid
  conflict with include/fat.h
cpu/arm920t/s3c24x0/mmc.c (mmc_cmd): removed unused variables "i" and "status"
cpu/arm920t/s3c24x0/mmc.c (mmc_init): removed unused variable "i"
cpu/arm920t/s3c24x0/mmc.c (rca): set this 16 bit value to 1, not 1 << 16
cpu/arm920t/s3c24x0/mmc.c (mmc_bread): changed type of "dst" from "ulong *" to
  "void *" for compatibility with mmc_dev.block_read
cpu/arm920t/s3c24x0/mmc.c (mmc_bread): don't need to cast "dst" anymore when 
  passing to mmc_read



Modified: trunk/src/target/u-boot/patches/mmc-fixes.patch
===================================================================
--- trunk/src/target/u-boot/patches/mmc-fixes.patch	2007-03-09 00:00:08 UTC (rev 1290)
+++ trunk/src/target/u-boot/patches/mmc-fixes.patch	2007-03-09 00:07:50 UTC (rev 1291)
@@ -1,21 +1,3 @@
-include/asm-arm/arch-s3c24x0/regs-sdi.h (S3C2410_SDIDCON_BLKNUM_MASK): typo,
-  should be S3C2410_SDIDCNT_BLKNUM_MASK
-cpu/arm920t/s3c24x0/mmc.c (mmc_block_read): use S3C2410_SDIDCON_BLKNUM instead
-  of bogus S3C2410_SDIDCON_BLKNUM_MASK
-cpu/arm920t/s3c24x0/mmc.c (mmc_block_read): check SDIDSTA after each FIFO read
-  and clear any pending errors
-cpu/arm920t/s3c24x0/mmc.c (mmc_block_read): commented out useless wait for
-  S3C2410_SDIDSTA_XFERFINISH, added reset of S3C2410_SDIDSTA_XFERFINISH
-cpu/arm920t/s3c24x0/mmc.c (mmc_cmd): removed unused variables "i" and "status"
-cpu/arm920t/s3c24x0/mmc.c (mmc_init): removed unused variable "i" 
-cpu/arm920t/s3c24x0/mmc.c (mmc_init): replaced MMC CID extraction with SD CID
-  version
-cpu/arm920t/s3c24x0/mmc.c (mmc_init): added casts to suppress warnings when
-  using an "unsigned char *" buffer in sprintf
-include/configs/neo1973.h (CONFIG_SUPPORT_VFAT): just #define, to avoid
-  conflict with include/fat.h
-cpu/arm920t/s3c24x0/mmc.c (rca): set this 16 bit value to 1, not 1 << 16
-
 Index: u-boot/cpu/arm920t/s3c24x0/mmc.c
 ===================================================================
 --- u-boot.orig/cpu/arm920t/s3c24x0/mmc.c
@@ -38,60 +20,16 @@
  	dcon |= S3C2410_SDIDCON_BLOCKMODE;
  	dcon |= S3C2410_SDIDCON_RXAFTERCMD|S3C2410_SDIDCON_XFER_RXSTART;
  	if (wide)
-@@ -145,16 +143,9 @@ static int mmc_block_read(uchar *dst, ul
- 	resp = mmc_cmd(MMC_CMD_READ_BLOCK, src, CMD_F_RESP);
- 
- 	while (len > 0) {
--		u_int32_t sdidsta = sdi->SDIDSTA;
--		fifo = FIFO_FILL(sdi);
--		if (sdidsta & (S3C2410_SDIDSTA_FIFOFAIL|
--				S3C2410_SDIDSTA_CRCFAIL|
--				S3C2410_SDIDSTA_RXCRCFAIL|
--				S3C2410_SDIDSTA_DATATIMEOUT)) {
--			printf("mmc_block_read: err SDIDSTA=0x%08x\n", sdidsta);
--			return -EIO;
--		}
-+		u_int32_t sdidsta, trouble;
- 
-+		fifo = FIFO_FILL(sdi);
- 		while (fifo--) {
- 			//debug("dst_u32 = 0x%08x\n", dst_u32);
- 			*(dst_u32++) = sdi->SDIDAT;
-@@ -165,16 +156,32 @@ static int mmc_block_read(uchar *dst, ul
- 				break;
- 			}
- 		}
-+
-+		sdidsta = sdi->SDIDSTA;
-+		trouble = sdidsta &
-+			(S3C2410_SDIDSTA_FIFOFAIL |
-+			S3C2410_SDIDSTA_CRCFAIL   |
-+			S3C2410_SDIDSTA_RXCRCFAIL |
-+			S3C2410_SDIDSTA_DATATIMEOUT);
-+		if (trouble) {
-+			printf("mmc_block_read: err SDIDSTA=0x%08x\n", sdidsta);
-+			sdi->SDIDSTA |= trouble;
-+			return -EIO;
-+		}
- 	}
- 
-+#if 0
- 	debug("waiting for SDIDSTA  (currently 0x%08x\n", sdi->SDIDSTA);
- 	while (!(sdi->SDIDSTA & (1 << 4))) {}
- 	debug("done waiting for SDIDSTA (currently 0x%08x\n", sdi->SDIDSTA);
- 
- 	sdi->SDIDCON = 0;
-+#endif
- 
--	if (!(sdi->SDIDSTA & S3C2410_SDIDSTA_XFERFINISH))
-+	if (!(sdi->SDIDSTA & S3C2410_SDIDSTA_XFERFINISH)) {
- 		debug("mmc_block_read; transfer not finished!\n");
-+		sdi->SDIDSTA |= S3C2410_SDIDSTA_XFERFINISH;
-+	}
- 
+@@ -309,7 +307,7 @@ int mmc_write(uchar *src, ulong dst, int
  	return 0;
  }
-@@ -318,7 +325,9 @@ ulong mmc_bread(int dev_num, ulong blknr
+ 
+-ulong mmc_bread(int dev_num, ulong blknr, ulong blkcnt, ulong *dst)
++ulong mmc_bread(int dev_num, ulong blknr, ulong blkcnt, void *dst)
+ {
+ 	int mmc_block_size = MMC_BLOCK_SIZE;
+ 	ulong src = blknr * mmc_block_size + CFG_MMC_BASE;
+@@ -318,7 +316,9 @@ ulong mmc_bread(int dev_num, ulong blknr
  	return blkcnt;
  }
  
@@ -102,107 +40,14 @@
  
  static u_int32_t mmc_size(const struct mmc_csd *csd)
  {
-@@ -331,6 +340,42 @@ static u_int32_t mmc_size(const struct m
- 	return blocknr * block_len;
- }
+@@ -361,7 +361,6 @@ int mmc_init(int verbose)
  
-+struct sd_cid {
-+	char		pnm_0;	/* product name */
-+	char		oid_1;	/* OEM/application ID */
-+	char		oid_0;
-+	uint8_t		mid;	/* manufacturer ID */
-+	char		pnm_4;
-+	char		pnm_3;
-+	char		pnm_2;
-+	char		pnm_1;
-+	uint8_t		psn_2;	/* product serial number */
-+	uint8_t		psn_1;
-+	uint8_t		psn_0;	/* MSB */
-+	uint8_t		prv;	/* product revision */
-+	uint8_t		crc;	/* CRC7 checksum, b0 is unused and set to 1 */
-+	uint8_t		mdt_1;	/* manufacturing date, LSB, RRRRyyyy yyyymmmm */
-+	uint8_t		mdt_0;	/* MSB */
-+	uint8_t		psn_3;	/* LSB */
-+};
-+
-+static void print_cid(const struct sd_cid *cid)
-+{
-+	printf("Manufacturer:       0x%02x, OEM \"%c%c\"\n",
-+	    cid->mid, cid->oid_0, cid->oid_1);
-+	printf("Product name:       \"%c%c%c%c%c\", revision %d.%d\n",
-+	    cid->pnm_0, cid->pnm_1, cid->pnm_2, cid->pnm_3, cid->pnm_4,
-+	    cid->prv >> 4, cid->prv & 15);
-+	printf("Serial number:      %u\n",
-+	    cid->psn_0 << 24 | cid->psn_1 << 16 | cid->psn_2 << 8 |
-+	    cid->psn_3);
-+	printf("Manufacturing date: %d/%d\n",
-+	    cid->mdt_1 & 15,
-+	    2000+((cid->mdt_0 & 15) << 4)+((cid->mdt_1 & 0xf0) >> 4));
-+	printf("CRC:                0x%02x, b0 = %d\n",
-+	    cid->crc >> 1, cid->crc & 1);
-+}
-+
- int mmc_init(int verbose)
- {
-  	int retries, rc = -ENODEV;
-@@ -361,7 +406,6 @@ int mmc_init(int verbose)
- 
  	printf("trying to detect SD Card...\n");
  	while (retries--) {
 -		int i;
  		udelay(100000);
  		resp = mmc_cmd(55, 0x00000000, CMD_F_RESP);
  		resp = mmc_cmd(41, 0x00300000, CMD_F_RESP);
-@@ -386,6 +430,7 @@ int mmc_init(int verbose)
- 	/* try to get card id */
- 	resp = mmc_cmd(MMC_CMD_ALL_SEND_CID, 0, CMD_F_RESP|CMD_F_RESP_LONG);
- 	if (resp) {
-+#if 0
- 		/* TODO configure mmc driver depending on card attributes */
- 		mmc_cid_t *cid = (mmc_cid_t *)resp;
- 		if (verbose) {
-@@ -400,6 +445,29 @@ int mmc_init(int verbose)
- 			printf("Month = %d\n",cid->month);
- 			printf("Year = %d\n",1997 + cid->year);
- 		}
-+		sprintf(mmc_dev.vendor,"Man %02x%02x%02x Snr %02x%02x%02x",
-+				cid->id[0], cid->id[1], cid->id[2],
-+				cid->sn[0], cid->sn[1], cid->sn[2]);
-+		sprintf(mmc_dev.product,"%s",cid->name);
-+		sprintf(mmc_dev.revision,"%x %x",cid->hwrev, cid->fwrev);
-+#else
-+		struct sd_cid *cid = (struct sd_cid *) resp;
-+
-+		if (verbose)
-+			print_cid((struct sd_cid *) resp);
-+
-+		sprintf((char *) mmc_dev.vendor,
-+		    "Man %02 OEM %c%c \"%c%c%c%c%c\"",
-+		    cid->mid, cid->oid_0, cid->oid_1,
-+		    cid->pnm_0, cid->pnm_1, cid->pnm_2, cid->pnm_3,
-+		    cid->pnm_4);
-+		sprintf((char *) mmc_dev.product, "%d",
-+		    cid->psn_0 << 24 | cid->psn_1 << 16 | cid->psn_2 << 8 |
-+		    cid->psn_3);
-+		sprintf((char *) mmc_dev.revision, "%d.%d",
-+		    cid->prv >> 4, cid->prv & 15);
-+#endif
-+
- 		/* fill in device description */
- 		mmc_dev.if_type = IF_TYPE_MMC;
- 		mmc_dev.part_type = PART_TYPE_DOS;
-@@ -409,11 +477,6 @@ int mmc_init(int verbose)
- 		/* FIXME fill in the correct size (is set to 32MByte) */
- 		mmc_dev.blksz = 512;
- 		mmc_dev.lba = 0x10000;
--		sprintf(mmc_dev.vendor,"Man %02x%02x%02x Snr %02x%02x%02x",
--				cid->id[0], cid->id[1], cid->id[2],
--				cid->sn[0], cid->sn[1], cid->sn[2]);
--		sprintf(mmc_dev.product,"%s",cid->name);
--		sprintf(mmc_dev.revision,"%x %x",cid->hwrev, cid->fwrev);
- 		mmc_dev.removable = 0;
- 		mmc_dev.block_read = mmc_bread;
- 
 Index: u-boot/include/asm-arm/arch-s3c24x0/regs-sdi.h
 ===================================================================
 --- u-boot.orig/include/asm-arm/arch-s3c24x0/regs-sdi.h
@@ -220,7 +65,7 @@
 ===================================================================
 --- u-boot.orig/include/configs/neo1973.h
 +++ u-boot/include/configs/neo1973.h
-@@ -224,7 +224,7 @@
+@@ -227,7 +227,7 @@
  #define CONFIG_EXT2		1
  
  #define CONFIG_FAT		1

Modified: trunk/src/target/u-boot/patches/series
===================================================================
--- trunk/src/target/u-boot/patches/series	2007-03-09 00:00:08 UTC (rev 1290)
+++ trunk/src/target/u-boot/patches/series	2007-03-09 00:07:50 UTC (rev 1291)
@@ -64,3 +64,4 @@
 uboot-dfu.patch
 uboot-neo1973-defaultenv.patch
 uboot-nand-markbad-reallybad.patch
+mmc-fixes.patch





More information about the commitlog mailing list