From: Adrian Hunter <ext-adrian.hunter@nokia.com>
To: Paul Walmsley <paul@pwsan.com>
Cc: linux-omap@vger.kernel.org
Subject: Re: [PATCH] ARM: OMAP: OneNAND for OMAP3
Date: Mon, 04 Aug 2008 09:56:50 +0300 [thread overview]
Message-ID: <4896A832.3080402@nokia.com> (raw)
In-Reply-To: <alpine.DEB.1.00.0808011030270.19571@utopia.booyaka.com>
Paul Walmsley wrote:
> Hello Adrian,
>
> On Fri, 1 Aug 2008, Adrian Hunter wrote:
>
>> Update OneNAND support for OMAP3.
>
> a few quick comments.
>
Thanks for looking at the code.
>> + reg =
>> omap2_onenand_readw(onenand_base+ONENAND_REG_VERSION_ID);
>
> Just a minor nit - please use spaces around binary & ternary operators per
> CodingStyle.
>
>> + (sync_write?GPMC_CONFIG1_WRITEMULTIPLE_SUPP:0) |
>> + (sync_write?GPMC_CONFIG1_WRITETYPE_SYNC:0) |
>
> as above.
>
>> diff --git a/drivers/mtd/onenand/omap2.c b/drivers/mtd/onenand/omap2.c
>> index ba83900..378ee17 100644
>> --- a/drivers/mtd/onenand/omap2.c
>> +++ b/drivers/mtd/onenand/omap2.c
>> @@ -223,6 +227,155 @@ static inline int omap2_onenand_bufferram_offset(struct
>> mtd_info *mtd, int area)
>> return 0;
>> }
>>
>> +#if defined(CONFIG_ARCH_OMAP3)
>> +
>> +static int omap3_onenand_read_bufferram(struct mtd_info *mtd, int area,
>> + unsigned char *buffer, int offset,
>> + size_t count)
>> +{
>> + struct omap2_onenand *info = container_of(mtd, struct omap2_onenand,
>> mtd);
>> + struct onenand_chip *this = mtd->priv;
>> + dma_addr_t dma_src, dma_dst;
>> + int bram_offset;
>> + unsigned long timeout;
>> + void *buf = (void *)buffer;
>> + size_t xtra;
>> + volatile unsigned *done;
>
> The way this volatile is used doesn't look right...
>
Well, it is correct.
>> + INIT_COMPLETION(info->dma_done);
>> + omap_start_dma(info->dma_channel);
>> +
>> + timeout = jiffies + msecs_to_jiffies(20);
>> + done = &info->dma_done.done;
>
> So the volatile here appears to apply to the address of 'done', but this
> address does not change, correct? Only the value of 'done' itself
> changes.
>
No, the volatile applies to the "unsigned" not the "*".
>> + while (time_before(jiffies, timeout))
>> + if (*done)
>> + break;
>
> Can this be replaced with wait_for_completion_timeout() or something
> similar?
>
No. Performance testing showed that a context switch here is too expensive.
It is better to spin.
>> + dma_unmap_single(&info->pdev->dev, dma_dst, count, DMA_FROM_DEVICE);
>> +
>> + if (!*done) {
>> + dev_err(&info->pdev->dev, "timeout waiting for DMA\n");
>> + goto out_copy;
>> + }
>
> ...
>
>> +static int omap3_onenand_write_bufferram(struct mtd_info *mtd, int area,
>> + const unsigned char *buffer, int
>> offset,
>> + size_t count)
>> +{
>> + struct omap2_onenand *info = container_of(mtd, struct omap2_onenand,
>> mtd);
>> + struct onenand_chip *this = mtd->priv;
>> + dma_addr_t dma_src, dma_dst;
>> + int bram_offset;
>> + unsigned long timeout;
>> + void *buf = (void *)buffer;
>> + volatile unsigned *done;
>
> Same comments in this function per volatile.
>
>
> - Paul
>
next prev parent reply other threads:[~2008-08-04 6:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-01 8:11 [PATCH] ARM: OMAP: OneNAND for OMAP3 Adrian Hunter
2008-08-01 16:45 ` Paul Walmsley
2008-08-04 6:56 ` Adrian Hunter [this message]
2008-08-04 14:02 ` Tony Lindgren
2008-08-06 6:53 ` Adrian Hunter
2008-08-06 6:55 ` [PATCH 1/3] " Adrian Hunter
2008-08-06 6:56 ` [PATCH 2/3] ARM: OMAP: Add fields to GPMC " Adrian Hunter
2008-08-06 6:57 ` [PATCH 3/3] ARM: OMAP: Update OneNAND support Adrian Hunter
2008-08-08 8:48 ` [PATCH] ARM: OMAP: OneNAND for OMAP3 Tony Lindgren
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=4896A832.3080402@nokia.com \
--to=ext-adrian.hunter@nokia.com \
--cc=linux-omap@vger.kernel.org \
--cc=paul@pwsan.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 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.