public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 2.6.27-rc3-omap1] omap2_nand updates
@ 2008-08-31 21:19 David Brownell
  2008-08-31 21:54 ` Felipe Balbi
  0 siblings, 1 reply; 3+ messages in thread
From: David Brownell @ 2008-08-31 21:19 UTC (permalink / raw)
  To: linux-omap

From: David Brownell <dbrownell@users.sourceforge.net>

Minor updates to the OMAP{2,3} NAND driver:

 - Rename those buffer PIO routines as *_buf16()
 - Get rid of pointless LE16 data conversions; OMAP is always LE
 - Speed up buffer reads by switching to __raw_readsl()

Right now this driver only handles 16-bit NAND, but eventually it
should handle 8-bit too.  Moreover it may be worth using DMA...

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
---
 drivers/mtd/nand/omap2.c |   26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

--- a/drivers/mtd/nand/omap2.c	2008-08-10 21:17:47.000000000 -0700
+++ b/drivers/mtd/nand/omap2.c	2008-08-10 21:19:46.000000000 -0700
@@ -187,39 +187,35 @@ static void omap_hwcontrol(struct mtd_in
 }
 
 /*
- * omap_read_buf - read data from NAND controller into buffer
+ * omap_read_buf16 - read data from NAND controller into buffer
  * @mtd: MTD device structure
  * @buf: buffer to store date
  * @len: number of bytes to read
  */
-static void omap_read_buf(struct mtd_info *mtd, u_char *buf, int len)
+static void omap_read_buf16(struct mtd_info *mtd, u_char *buf, int len)
 {
-	struct omap_nand_info *info = container_of(mtd,
-					struct omap_nand_info, mtd);
-	u16 *p = (u16 *) buf;
-
-	len >>= 1;
+	struct nand_chip *nand = mtd->priv;
 
-	while (len--)
-		*p++ = cpu_to_le16(readw(info->nand.IO_ADDR_R));
+	__raw_readsl(nand->IO_ADDR_R, buf, len / 2);
 }
 
 /*
- * omap_write_buf - write buffer to NAND controller
+ * omap_write_buf16 - write buffer to NAND controller
  * @mtd: MTD device structure
  * @buf: data buffer
  * @len: number of bytes to write
  */
-static void omap_write_buf(struct mtd_info *mtd, const u_char * buf, int len)
+static void omap_write_buf16(struct mtd_info *mtd, const u_char * buf, int len)
 {
 	struct omap_nand_info *info = container_of(mtd,
 						struct omap_nand_info, mtd);
 	u16 *p = (u16 *) buf;
 
+	/* FIXME try bursts of writesw() or DMA ... */
 	len >>= 1;
 
 	while (len--) {
-		writew(cpu_to_le16(*p++), info->nand.IO_ADDR_W);
+		writew(*p++, info->nand.IO_ADDR_W);
 
 		while (GPMC_BUF_EMPTY == (readl(info->gpmc_baseaddr +
 						GPMC_STATUS) & GPMC_BUF_FULL));
@@ -643,8 +639,10 @@ static int __devinit omap_nand_probe(str
 	info->nand.IO_ADDR_W = info->nand.IO_ADDR_R;
 	info->nand.cmd_ctrl  = omap_hwcontrol;
 
-	info->nand.read_buf   = omap_read_buf;
-	info->nand.write_buf  = omap_write_buf;
+	/* REVISIT:  only supports 16-bit NAND flash */
+
+	info->nand.read_buf   = omap_read_buf16;
+	info->nand.write_buf  = omap_write_buf16;
 	info->nand.verify_buf = omap_verify_buf;
 
 	/*

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

* Re: [patch 2.6.27-rc3-omap1] omap2_nand updates
  2008-08-31 21:19 [patch 2.6.27-rc3-omap1] omap2_nand updates David Brownell
@ 2008-08-31 21:54 ` Felipe Balbi
  2008-09-09  1:02   ` Tony Lindgren
  0 siblings, 1 reply; 3+ messages in thread
From: Felipe Balbi @ 2008-08-31 21:54 UTC (permalink / raw)
  To: David Brownell; +Cc: linux-omap

On Sun, Aug 31, 2008 at 02:19:05PM -0700, David Brownell wrote:
> From: David Brownell <dbrownell@users.sourceforge.net>
> 
> Minor updates to the OMAP{2,3} NAND driver:
> 
>  - Rename those buffer PIO routines as *_buf16()
>  - Get rid of pointless LE16 data conversions; OMAP is always LE
>  - Speed up buffer reads by switching to __raw_readsl()
> 
> Right now this driver only handles 16-bit NAND, but eventually it
> should handle 8-bit too.  Moreover it may be worth using DMA...
> 
> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>

Thanks Dave, I'll melded it up in my queue.

-- 
balbi

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

* Re: [patch 2.6.27-rc3-omap1] omap2_nand updates
  2008-08-31 21:54 ` Felipe Balbi
@ 2008-09-09  1:02   ` Tony Lindgren
  0 siblings, 0 replies; 3+ messages in thread
From: Tony Lindgren @ 2008-09-09  1:02 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: David Brownell, linux-omap

* Felipe Balbi <me@felipebalbi.com> [080831 14:54]:
> On Sun, Aug 31, 2008 at 02:19:05PM -0700, David Brownell wrote:
> > From: David Brownell <dbrownell@users.sourceforge.net>
> > 
> > Minor updates to the OMAP{2,3} NAND driver:
> > 
> >  - Rename those buffer PIO routines as *_buf16()
> >  - Get rid of pointless LE16 data conversions; OMAP is always LE
> >  - Speed up buffer reads by switching to __raw_readsl()
> > 
> > Right now this driver only handles 16-bit NAND, but eventually it
> > should handle 8-bit too.  Moreover it may be worth using DMA...
> > 
> > Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
> 
> Thanks Dave, I'll melded it up in my queue.

Pushing to linux-omap tree today.

Tony

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

end of thread, other threads:[~2008-09-09  1:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-31 21:19 [patch 2.6.27-rc3-omap1] omap2_nand updates David Brownell
2008-08-31 21:54 ` Felipe Balbi
2008-09-09  1:02   ` Tony Lindgren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox