public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 1/2] nand/denali: Adding Denali NAND driver support
Date: Tue, 4 Mar 2014 12:44:31 -0600	[thread overview]
Message-ID: <1393958671.2697.168.camel@snotra.buserror.net> (raw)
In-Reply-To: <20140304193148.6E7A.AA925319@jp.panasonic.com>

On Tue, 2014-03-04 at 19:31 +0900, Masahiro Yamada wrote:
> Hello Scott, Chin,
> 
> 
> > > +/* this is a helper macro that allows us to
> > > + * format the bank into the proper bits for the controller */
> > > +#define BANK(x) ((x) << 24)
> > > +
> > > +/* Interrupts are cleared by writing a 1 to the appropriate status bit */
> > > +static inline void clear_interrupt(uint32_t irq_mask)
> > > +{
> > > +	uint32_t intr_status_reg = 0;
> > > +	intr_status_reg = INTR_STATUS(denali.flash_bank);
> > > +	__raw_writel(irq_mask, denali.flash_reg + intr_status_reg);
> > > +}
> > 
> > Why are you using raw I/O accessors?  The Linux driver doesn't do this.
> 
> Add ioread32/iowrite32 to arch/arm/include/asm/io.h
> and use them?

We probably should add them given they're the standard arch and bus
independent accessors in Linux, but you could also use readl()/writel().
Why did you choose the raw version?

> There is another problem.
> I think there is a cache coherency problem in this driver code.
> DMA is used in this driver but D-cache is never flushed.
> 
> When D-cache is on (CONFIG_SYS_DCACHE_OFF is not defined),
> ARM processor writes to/reads from the buffer through D-cache.
> On the other hand, Denali NAND controller always wites to/reads from
> the buffer on physical memory.
> So, this driver writes/reads wrong data.
> 
> I had to add flush_dcache_range() function call
> in denali_setup_dma_sequence().

Yes, in Linux this would have been handled through the DMA API.

-Scott

  reply	other threads:[~2014-03-04 18:44 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-21 20:51 [U-Boot] [PATCH v2 1/2] nand/denali: Adding Denali NAND driver support Chin Liang See
2014-02-24  7:48 ` Michal Simek
2014-02-24  8:06   ` Masahiro Yamada
2014-02-24  8:16     ` Michal Simek
2014-02-27 17:04   ` Chin Liang See
2014-02-28 10:37     ` Michal Simek
2014-03-04 23:57       ` Chin Liang See
2014-03-05  6:22         ` Michal Simek
2014-02-27 14:35 ` Masahiro Yamada
2014-02-27 21:02   ` Chin Liang See
2014-02-27 22:32     ` Scott Wood
2014-02-27 23:03       ` Chin Liang See
2014-02-28 12:57         ` Masahiro Yamada
2014-03-05  0:24           ` Chin Liang See
2014-03-04  0:03 ` Scott Wood
2014-03-04 10:31   ` Masahiro Yamada
2014-03-04 18:44     ` Scott Wood [this message]
2014-03-05 17:40     ` Chin Liang See
2014-03-05 17:34   ` Chin Liang See
2014-03-05 18:23     ` Scott Wood
2014-03-05 23:01       ` Chin Liang See
2014-03-05 23:04         ` Scott Wood
2014-03-05 23:09           ` Chin Liang See
2014-03-05 23:11             ` Scott Wood
2014-03-05 23:21               ` Chin Liang See
2014-05-30 10:50 ` Rik Smith
2014-05-30 11:36   ` Masahiro Yamada

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=1393958671.2697.168.camel@snotra.buserror.net \
    --to=scottwood@freescale.com \
    --cc=u-boot@lists.denx.de \
    /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