Changeset 1291


Ignore:
Timestamp:
03/09/07 01:07:50 (6 years ago)
Author:
werner
Message:

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

Location:
trunk/src/target/u-boot/patches
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/target/u-boot/patches/mmc-fixes.patch

    r1121 r1291  
    1 include/asm-arm/arch-s3c24x0/regs-sdi.h (S3C2410_SDIDCON_BLKNUM_MASK): typo, 
    2   should be S3C2410_SDIDCNT_BLKNUM_MASK 
    3 cpu/arm920t/s3c24x0/mmc.c (mmc_block_read): use S3C2410_SDIDCON_BLKNUM instead 
    4   of bogus S3C2410_SDIDCON_BLKNUM_MASK 
    5 cpu/arm920t/s3c24x0/mmc.c (mmc_block_read): check SDIDSTA after each FIFO read 
    6   and clear any pending errors 
    7 cpu/arm920t/s3c24x0/mmc.c (mmc_block_read): commented out useless wait for 
    8   S3C2410_SDIDSTA_XFERFINISH, added reset of S3C2410_SDIDSTA_XFERFINISH 
    9 cpu/arm920t/s3c24x0/mmc.c (mmc_cmd): removed unused variables "i" and "status" 
    10 cpu/arm920t/s3c24x0/mmc.c (mmc_init): removed unused variable "i"  
    11 cpu/arm920t/s3c24x0/mmc.c (mmc_init): replaced MMC CID extraction with SD CID 
    12   version 
    13 cpu/arm920t/s3c24x0/mmc.c (mmc_init): added casts to suppress warnings when 
    14   using an "unsigned char *" buffer in sprintf 
    15 include/configs/neo1973.h (CONFIG_SUPPORT_VFAT): just #define, to avoid 
    16   conflict with include/fat.h 
    17 cpu/arm920t/s3c24x0/mmc.c (rca): set this 16 bit value to 1, not 1 << 16 
    18  
    191Index: u-boot/cpu/arm920t/s3c24x0/mmc.c 
    202=================================================================== 
     
    3921        dcon |= S3C2410_SDIDCON_RXAFTERCMD|S3C2410_SDIDCON_XFER_RXSTART; 
    4022        if (wide) 
    41 @@ -145,16 +143,9 @@ static int mmc_block_read(uchar *dst, ul 
    42         resp = mmc_cmd(MMC_CMD_READ_BLOCK, src, CMD_F_RESP); 
    43   
    44         while (len > 0) { 
    45 -               u_int32_t sdidsta = sdi->SDIDSTA; 
    46 -               fifo = FIFO_FILL(sdi); 
    47 -               if (sdidsta & (S3C2410_SDIDSTA_FIFOFAIL| 
    48 -                               S3C2410_SDIDSTA_CRCFAIL| 
    49 -                               S3C2410_SDIDSTA_RXCRCFAIL| 
    50 -                               S3C2410_SDIDSTA_DATATIMEOUT)) { 
    51 -                       printf("mmc_block_read: err SDIDSTA=0x%08x\n", sdidsta); 
    52 -                       return -EIO; 
    53 -               } 
    54 +               u_int32_t sdidsta, trouble; 
    55   
    56 +               fifo = FIFO_FILL(sdi); 
    57                 while (fifo--) { 
    58                         //debug("dst_u32 = 0x%08x\n", dst_u32); 
    59                         *(dst_u32++) = sdi->SDIDAT; 
    60 @@ -165,16 +156,32 @@ static int mmc_block_read(uchar *dst, ul 
    61                                 break; 
    62                         } 
    63                 } 
    64 + 
    65 +               sdidsta = sdi->SDIDSTA; 
    66 +               trouble = sdidsta & 
    67 +                       (S3C2410_SDIDSTA_FIFOFAIL | 
    68 +                       S3C2410_SDIDSTA_CRCFAIL   | 
    69 +                       S3C2410_SDIDSTA_RXCRCFAIL | 
    70 +                       S3C2410_SDIDSTA_DATATIMEOUT); 
    71 +               if (trouble) { 
    72 +                       printf("mmc_block_read: err SDIDSTA=0x%08x\n", sdidsta); 
    73 +                       sdi->SDIDSTA |= trouble; 
    74 +                       return -EIO; 
    75 +               } 
    76         } 
    77   
    78 +#if 0 
    79         debug("waiting for SDIDSTA  (currently 0x%08x\n", sdi->SDIDSTA); 
    80         while (!(sdi->SDIDSTA & (1 << 4))) {} 
    81         debug("done waiting for SDIDSTA (currently 0x%08x\n", sdi->SDIDSTA); 
    82   
    83         sdi->SDIDCON = 0; 
    84 +#endif 
    85   
    86 -       if (!(sdi->SDIDSTA & S3C2410_SDIDSTA_XFERFINISH)) 
    87 +       if (!(sdi->SDIDSTA & S3C2410_SDIDSTA_XFERFINISH)) { 
    88                 debug("mmc_block_read; transfer not finished!\n"); 
    89 +               sdi->SDIDSTA |= S3C2410_SDIDSTA_XFERFINISH; 
    90 +       } 
    91   
     23@@ -309,7 +307,7 @@ int mmc_write(uchar *src, ulong dst, int 
    9224        return 0; 
    9325 } 
    94 @@ -318,7 +325,9 @@ ulong mmc_bread(int dev_num, ulong blknr 
     26  
     27-ulong mmc_bread(int dev_num, ulong blknr, ulong blkcnt, ulong *dst) 
     28+ulong mmc_bread(int dev_num, ulong blknr, ulong blkcnt, void *dst) 
     29 { 
     30        int mmc_block_size = MMC_BLOCK_SIZE; 
     31        ulong src = blknr * mmc_block_size + CFG_MMC_BASE; 
     32@@ -318,7 +316,9 @@ ulong mmc_bread(int dev_num, ulong blknr 
    9533        return blkcnt; 
    9634 } 
     
    10341 static u_int32_t mmc_size(const struct mmc_csd *csd) 
    10442 { 
    105 @@ -331,6 +340,42 @@ static u_int32_t mmc_size(const struct m 
    106         return blocknr * block_len; 
    107  } 
    108   
    109 +struct sd_cid { 
    110 +       char            pnm_0;  /* product name */ 
    111 +       char            oid_1;  /* OEM/application ID */ 
    112 +       char            oid_0; 
    113 +       uint8_t         mid;    /* manufacturer ID */ 
    114 +       char            pnm_4; 
    115 +       char            pnm_3; 
    116 +       char            pnm_2; 
    117 +       char            pnm_1; 
    118 +       uint8_t         psn_2;  /* product serial number */ 
    119 +       uint8_t         psn_1; 
    120 +       uint8_t         psn_0;  /* MSB */ 
    121 +       uint8_t         prv;    /* product revision */ 
    122 +       uint8_t         crc;    /* CRC7 checksum, b0 is unused and set to 1 */ 
    123 +       uint8_t         mdt_1;  /* manufacturing date, LSB, RRRRyyyy yyyymmmm */ 
    124 +       uint8_t         mdt_0;  /* MSB */ 
    125 +       uint8_t         psn_3;  /* LSB */ 
    126 +}; 
    127 + 
    128 +static void print_cid(const struct sd_cid *cid) 
    129 +{ 
    130 +       printf("Manufacturer:       0x%02x, OEM \"%c%c\"\n", 
    131 +           cid->mid, cid->oid_0, cid->oid_1); 
    132 +       printf("Product name:       \"%c%c%c%c%c\", revision %d.%d\n", 
    133 +           cid->pnm_0, cid->pnm_1, cid->pnm_2, cid->pnm_3, cid->pnm_4, 
    134 +           cid->prv >> 4, cid->prv & 15); 
    135 +       printf("Serial number:      %u\n", 
    136 +           cid->psn_0 << 24 | cid->psn_1 << 16 | cid->psn_2 << 8 | 
    137 +           cid->psn_3); 
    138 +       printf("Manufacturing date: %d/%d\n", 
    139 +           cid->mdt_1 & 15, 
    140 +           2000+((cid->mdt_0 & 15) << 4)+((cid->mdt_1 & 0xf0) >> 4)); 
    141 +       printf("CRC:                0x%02x, b0 = %d\n", 
    142 +           cid->crc >> 1, cid->crc & 1); 
    143 +} 
    144 + 
    145  int mmc_init(int verbose) 
    146  { 
    147         int retries, rc = -ENODEV; 
    148 @@ -361,7 +406,6 @@ int mmc_init(int verbose) 
     43@@ -361,7 +361,6 @@ int mmc_init(int verbose) 
    14944  
    15045        printf("trying to detect SD Card...\n"); 
     
    15449                resp = mmc_cmd(55, 0x00000000, CMD_F_RESP); 
    15550                resp = mmc_cmd(41, 0x00300000, CMD_F_RESP); 
    156 @@ -386,6 +430,7 @@ int mmc_init(int verbose) 
    157         /* try to get card id */ 
    158         resp = mmc_cmd(MMC_CMD_ALL_SEND_CID, 0, CMD_F_RESP|CMD_F_RESP_LONG); 
    159         if (resp) { 
    160 +#if 0 
    161                 /* TODO configure mmc driver depending on card attributes */ 
    162                 mmc_cid_t *cid = (mmc_cid_t *)resp; 
    163                 if (verbose) { 
    164 @@ -400,6 +445,29 @@ int mmc_init(int verbose) 
    165                         printf("Month = %d\n",cid->month); 
    166                         printf("Year = %d\n",1997 + cid->year); 
    167                 } 
    168 +               sprintf(mmc_dev.vendor,"Man %02x%02x%02x Snr %02x%02x%02x", 
    169 +                               cid->id[0], cid->id[1], cid->id[2], 
    170 +                               cid->sn[0], cid->sn[1], cid->sn[2]); 
    171 +               sprintf(mmc_dev.product,"%s",cid->name); 
    172 +               sprintf(mmc_dev.revision,"%x %x",cid->hwrev, cid->fwrev); 
    173 +#else 
    174 +               struct sd_cid *cid = (struct sd_cid *) resp; 
    175 + 
    176 +               if (verbose) 
    177 +                       print_cid((struct sd_cid *) resp); 
    178 + 
    179 +               sprintf((char *) mmc_dev.vendor, 
    180 +                   "Man %02 OEM %c%c \"%c%c%c%c%c\"", 
    181 +                   cid->mid, cid->oid_0, cid->oid_1, 
    182 +                   cid->pnm_0, cid->pnm_1, cid->pnm_2, cid->pnm_3, 
    183 +                   cid->pnm_4); 
    184 +               sprintf((char *) mmc_dev.product, "%d", 
    185 +                   cid->psn_0 << 24 | cid->psn_1 << 16 | cid->psn_2 << 8 | 
    186 +                   cid->psn_3); 
    187 +               sprintf((char *) mmc_dev.revision, "%d.%d", 
    188 +                   cid->prv >> 4, cid->prv & 15); 
    189 +#endif 
    190 + 
    191                 /* fill in device description */ 
    192                 mmc_dev.if_type = IF_TYPE_MMC; 
    193                 mmc_dev.part_type = PART_TYPE_DOS; 
    194 @@ -409,11 +477,6 @@ int mmc_init(int verbose) 
    195                 /* FIXME fill in the correct size (is set to 32MByte) */ 
    196                 mmc_dev.blksz = 512; 
    197                 mmc_dev.lba = 0x10000; 
    198 -               sprintf(mmc_dev.vendor,"Man %02x%02x%02x Snr %02x%02x%02x", 
    199 -                               cid->id[0], cid->id[1], cid->id[2], 
    200 -                               cid->sn[0], cid->sn[1], cid->sn[2]); 
    201 -               sprintf(mmc_dev.product,"%s",cid->name); 
    202 -               sprintf(mmc_dev.revision,"%x %x",cid->hwrev, cid->fwrev); 
    203                 mmc_dev.removable = 0; 
    204                 mmc_dev.block_read = mmc_bread; 
    205   
    20651Index: u-boot/include/asm-arm/arch-s3c24x0/regs-sdi.h 
    20752=================================================================== 
     
    22166--- u-boot.orig/include/configs/neo1973.h 
    22267+++ u-boot/include/configs/neo1973.h 
    223 @@ -224,7 +224,7 @@ 
     68@@ -227,7 +227,7 @@ 
    22469 #define CONFIG_EXT2            1 
    22570  
  • trunk/src/target/u-boot/patches/series

    r1176 r1291  
    6565uboot-neo1973-defaultenv.patch 
    6666uboot-nand-markbad-reallybad.patch 
     67mmc-fixes.patch 
Note: See TracChangeset for help on using the changeset viewer.