From: Marc Pignat <marc.pignat@hevs.ch>
To: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: "Pierre Ossman" <drzeus@drzeus.cx>,
"=?iso-8859-1?q?Hans-J=FCrgen?= "@rfoatmel.rfo.atmel.com,
"Linux Kernel list" <linux-kernel@vger.kernel.org>,
"Andrew Victor" <linux@maxim.org.za>,
"Eric BENARD" <ebenard@free.fr>,
"Ville =?iso-8859-1?q?Syrj=E4?="@rfoatmel.rfo.atmel.com
Subject: Re: [PATCH 1/7] mmc: at91_mci: support for block size not modulo 4
Date: Fri, 30 May 2008 14:57:33 +0200 [thread overview]
Message-ID: <200805301457.34320.marc.pignat@hevs.ch> (raw)
In-Reply-To: <483FED84.50100@atmel.com>
Hi Nicolas!
On Friday 30 May 2008, Nicolas Ferre wrote:> From: Marc Pignat <marc.pignat@hevs.ch>> > Implement transfer with size not modulo 4 for at91sam9*. Please note that the> at91rm9200 simply can't handle this.> > Signed-off-by: Marc Pignat <marc.pignat@hevs.ch>> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>> ---
I just want we don't forget that at91sam9260 errata, pointed by someone when Iposted this patch...
44.2.4.4 Data Write Operation and number of bytes The Data Write operation with a number of bytes less than 12 is impossible. Problem Fix/Workaround The PDC counters must always be equal to 12 bytes for data transfers lower than 12 bytes. The BLKLEN or BCNT field are used to specify the real count number.
We should probably fix that thing in the next release and verify if otherchips are affected!
> drivers/mmc/host/at91_mci.c | 15 ++++++++++-----> 1 files changed, 10 insertions(+), 5 deletions(-)> > diff --git a/drivers/mmc/host/at91_mci.c b/drivers/mmc/host/at91_mci.c> index 8979ad3..543b64b 100644> --- a/drivers/mmc/host/at91_mci.c> +++ b/drivers/mmc/host/at91_mci.c> @@ -233,11 +233,11 @@ static void at91_mci_pre_dma_read(struct at91mci_host *host)> > if (i == 0) {> at91_mci_write(host, ATMEL_PDC_RPR, sg->dma_address);> - at91_mci_write(host, ATMEL_PDC_RCR, sg->length / 4);> + at91_mci_write(host, ATMEL_PDC_RCR, (data->blksz & 0x3) ? sg->length : sg->length / 4);> }> else {> at91_mci_write(host, ATMEL_PDC_RNPR, sg->dma_address);> - at91_mci_write(host, ATMEL_PDC_RNCR, sg->length / 4);> + at91_mci_write(host, ATMEL_PDC_RNCR, (data->blksz & 0x3) ? sg->length : sg->length / 4);> }> }> > @@ -430,7 +430,7 @@ static void at91_mci_send_command(struct at91mci_host *host, struct mmc_command> > if (data) {> > - if ( data->blksz & 0x3 ) {> + if ( cpu_is_at91rm9200() && (data->blksz & 0x3) ) {> pr_debug("Unsupported block size\n");> cmd->error = -EINVAL;> mmc_request_done(host->mmc, host->request);> @@ -482,7 +482,10 @@ static void at91_mci_send_command(struct at91mci_host *host, struct mmc_command> } else {> /* zero block length and PDC mode */> mr = at91_mci_read(host, AT91_MCI_MR) & 0x7fff;> - at91_mci_write(host, AT91_MCI_MR, mr | (block_length << 16) | AT91_MCI_PDCMODE);here, we should do something like{ /* blocks smaller than 16 will be rounded up to 16 at91sam9260, and 16 is modulo 4 :) */ if (!(cpu_is_at91sam9260() && size < 16)) mr |= (data->blksz & 0x3) ? AT91_MCI_PDCFBYTE : 0;}> + mr |= (block_length << 16);> + mr |= AT91_MCI_PDCMODE;> + at91_mci_write(host, AT91_MCI_MR, mr);> > /*> * Disable the PDC controller> @@ -517,7 +520,9 @@ static void at91_mci_send_command(struct at91mci_host *host, struct mmc_command> pr_debug("Transmitting %d bytes\n", host->total_length);> > at91_mci_write(host, ATMEL_PDC_TPR, host->physical_address);> - at91_mci_write(host, ATMEL_PDC_TCR, host->total_length / 4);> + at91_mci_write(host, ATMEL_PDC_TCR, (data->blksz & 0x3) ?> + host->total_length : host->total_length / 4);here, we should add something like{ unsigned long size = data->blksz; if (cpu_is_at91sam9260() && size < 16 ) size = 16; at91_mci_write(host, ATMEL_PDC_TCR, (size & 0x3) ? size : size / 4);}> +> ier = AT91_MCI_CMDRDY;> }> }
Best regards
Marcÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
next prev parent reply other threads:[~2008-05-30 13:23 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-30 11:49 [PATCH 0/7] mmc: at91_mci: rework to allow better transfer Nicolas Ferre
2008-05-30 12:18 ` [PATCH 5/7] mmc: at91_mci: update bytes_xfered value once xfer done Nicolas Ferre
2008-06-01 14:44 ` Russell King - ARM Linux
2008-05-30 12:26 ` [PATCH 6/7] mmc: at91_mci: add sdio irq management Nicolas Ferre
2008-05-30 12:28 ` [PATCH 7/7] mmc: at91_mci: do not read irq status twice as it will forget some errors Nicolas Ferre
2008-05-30 12:43 ` [PATCH 1/7] mmc: at91_mci: support for block size not modulo 4 Nicolas Ferre
2008-05-30 12:44 ` [PATCH 2/7] mmc: at91_mci: show timeouts Nicolas Ferre
2008-05-30 12:45 ` [PATCH 3/7] mmc: at91_mci: avoid timeouts Nicolas Ferre
2008-05-30 12:45 ` [PATCH 4/7] mmc: at91_mci: add multiwrite switch Nicolas Ferre
[not found] ` <483FED84.50100@atmel.com>
2008-05-30 12:57 ` Marc Pignat [this message]
[not found] ` <483FEE58.5000500@atmel.com>
2008-06-01 14:42 ` Russell King - ARM Linux
2008-06-09 10:42 ` Pierre Ossman
2008-06-09 13:08 ` Russell King - ARM Linux
2008-06-09 13:42 ` Pierre Ossman
2008-06-09 13:53 ` Russell King - ARM Linux
2008-06-09 13:58 ` Pierre Ossman
2008-06-09 10:46 ` [PATCH 0/7] mmc: at91_mci: rework to allow better transfer Pierre Ossman
2008-06-10 9:54 ` Nicolas Ferre
2008-06-14 16:28 ` Pierre Ossman
2008-06-18 10:04 ` Nicolas Ferre
2008-06-18 10:47 ` Erik Mouw
2008-06-18 11:16 ` Erik Mouw
2008-06-18 11:40 ` Hans J. Koch
2008-06-18 11:47 ` David Woodhouse
2008-06-18 13:35 ` Erik Mouw
2008-06-18 13:37 ` David Woodhouse
2008-06-18 15:17 ` Erik Mouw
2008-06-20 16:30 ` Pierre Ossman
[not found] ` <6306c640806201005n17aba42ag6f0bc344256a1ad@mail.gmail.com>
2008-06-20 17:25 ` Pierre Ossman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200805301457.34320.marc.pignat@hevs.ch \
--to=marc.pignat@hevs.ch \
--cc="=?iso-8859-1?q?Hans-J=FCrgen?= "@rfoatmel.rfo.atmel.com \
--cc="Ville =?iso-8859-1?q?Syrj=E4?="@rfoatmel.rfo.atmel.com \
--cc=drzeus@drzeus.cx \
--cc=ebenard@free.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@maxim.org.za \
--cc=nicolas.ferre@atmel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome