AT91:mmc:fix multiple read/write error

According to datasheet,set block count before multiple read/write.

Signed-off-by: elen.song <elen.song@atmel.com>
Acked-by: Andy Fleming <afleming@freescale.com>
master
elen.song 14 years ago committed by Andy Fleming
parent b1f1e821d3
commit c310fc8404
  1. 9
      drivers/mmc/atmel_mci.h
  2. 4
      drivers/mmc/gen_atmel_mci.c

@ -36,7 +36,7 @@ typedef struct atmel_mci {
u32 sdcr; /* 0x0c */ u32 sdcr; /* 0x0c */
u32 argr; /* 0x10 */ u32 argr; /* 0x10 */
u32 cmdr; /* 0x14 */ u32 cmdr; /* 0x14 */
u32 _18; /* 0x18 */ u32 blkr; /* 0x18 */
u32 _1c; /* 0x1c */ u32 _1c; /* 0x1c */
u32 rspr; /* 0x20 */ u32 rspr; /* 0x20 */
u32 rspr1; /* 0x24 */ u32 rspr1; /* 0x24 */
@ -67,6 +67,7 @@ typedef struct atmel_mci {
#define MMCI_SDCR 0x000c #define MMCI_SDCR 0x000c
#define MMCI_ARGR 0x0010 #define MMCI_ARGR 0x0010
#define MMCI_CMDR 0x0014 #define MMCI_CMDR 0x0014
#define MMCI_BLKR 0x0018
#define MMCI_RSPR 0x0020 #define MMCI_RSPR 0x0020
#define MMCI_RSPR1 0x0024 #define MMCI_RSPR1 0x0024
#define MMCI_RSPR2 0x0028 #define MMCI_RSPR2 0x0028
@ -140,6 +141,12 @@ typedef struct atmel_mci {
#define MMCI_TRTYP_OFFSET 19 #define MMCI_TRTYP_OFFSET 19
#define MMCI_TRTYP_SIZE 2 #define MMCI_TRTYP_SIZE 2
/* Bitfields in BLKR */
#define MMCI_BCNT_OFFSET 0
#define MMCI_BCNT_SIZE 16
#define MMCI_BLKLEN_OFFSET 16
#define MMCI_BLKLEN_SIZE 16
/* Bitfields in RSPRx */ /* Bitfields in RSPRx */
#define MMCI_RSP_OFFSET 0 #define MMCI_RSP_OFFSET 0
#define MMCI_RSP_SIZE 32 #define MMCI_RSP_SIZE 32

@ -183,6 +183,10 @@ mci_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
/* Figure out the transfer arguments */ /* Figure out the transfer arguments */
cmdr = mci_encode_cmd(cmd, data, &error_flags); cmdr = mci_encode_cmd(cmd, data, &error_flags);
if (data)
writel(MMCI_BF(BCNT, data->blocks) |
MMCI_BF(BLKLEN, mmc->read_bl_len), &mci->blkr);
/* Send the command */ /* Send the command */
writel(cmd->cmdarg, &mci->argr); writel(cmd->cmdarg, &mci->argr);
writel(cmdr, &mci->cmdr); writel(cmdr, &mci->cmdr);

Loading…
Cancel
Save