All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot]  [Question]AT91: MMC read and multiple read failed
@ 2011-07-11  8:42 Song, Elen
  2011-07-11  9:05 ` Reinhard Meyer
  0 siblings, 1 reply; 5+ messages in thread
From: Song, Elen @ 2011-07-11  8:42 UTC (permalink / raw)
  To: u-boot

Hello Reinhard:

I've tried your patch([PATCH] AT91: enable MMC on at91sam(9260/9g20/0xe)ek) on uboot-atmel branch on at91sam9260.The sdcard is correctly initialized,but when I test "mmc read" command, I found two issues.

1.while run command "mmc read 22000000 0 1" to read the first block,it will cause "gen_atmel_mci: CMDR 00051051 (17) ARGR 00000000 (SR: 0c400025) Data Transfer Failed".
Both read and write will fail.Sd1.0 and 2.0 cards face the same problem.
2.cmd 18(multiple read) failed,that means can not run "mmc read 22000000 0 2".

Do you have faced the same problem?

To issues1: "Data Transfer Failed" is caused by transfer data lost(not read),if MCCK too high the host may not receive the data.so I try to reduce the MCCK frequency,it works.
To issues2: While multiple reading ,it did not set block count . so multiple read failed because it don't know how many blocks to read.I set reg MCI_BLKR BCNT bit.It is add in gen_atmel_mci.c.

static int mci_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
{
...
	cmdr = mci_encode_cmd(cmd, data, &error_flags);

	/* Send the command */
	
	+if ((cmd->cmdidx == MMC_CMD_READ_MULTIPLE_BLOCK) ||(cmd->cmdidx == MMC_CMD_WRITE_MULTIPLE_BLOCK))
	+{
	+	writel(data->blocks|mmc->read_bl_len<<16,&mci->blkr);
	+}

	writel(cmd->cmdarg, &mci->argr);
	writel(cmdr, &mci->cmdr);
...

MCI_BLKR should be added in mmc.h:
typedef struct atmel_mci {
	/*	reg	Offset */
	u32	cr;	/* 0x00 */
	u32	mr;	/* 0x04 */
	u32	dtor;	/* 0x08 */
	u32	sdcr;	/* 0x0c */
	u32	argr;	/* 0x10 */
	u32	cmdr;	/* 0x14 */
   - u32	_18;	/* 0x18 */
   + u32	blkr;	/* 0x18 */
...

Do you think it is correct?
In that case,I will deliver a patch.

Best regards
elen.song

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-07-12  2:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-11  8:42 [U-Boot] [Question]AT91: MMC read and multiple read failed Song, Elen
2011-07-11  9:05 ` Reinhard Meyer
2011-07-11 10:13   ` Song, Elen
2011-07-11 10:27     ` Reinhard Meyer
2011-07-12  2:52       ` Song, Elen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.