public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4 1/6] nand: Try to align the default buffers
Date: Fri, 7 Sep 2012 20:43:02 +0200	[thread overview]
Message-ID: <201209072043.02598.marex@denx.de> (raw)
In-Reply-To: <5FBF8E85CA34454794F0F7ECBA79798F379F39950D@HQMAIL04.nvidia.com>

Dear Tom Warren,

> Simon,
> 
> > -----Original Message-----
> > From: Simon Glass [mailto:sjg at chromium.org]
> > Sent: Sunday, July 29, 2012 11:53 PM
> > To: U-Boot Mailing List
> > Cc: Tom Warren; Stephen Warren; Scott Wood; Simon Glass
> > Subject: [PATCH v4 1/6] nand: Try to align the default buffers
> > 
> > The NAND layer needs to use cache-aligned buffers by default. Towards
> > this goal. align the default buffers and their members according to the
> > minimum DMA alignment defined for the architecture.
> > 
> > Signed-off-by: Simon Glass <sjg@chromium.org>
> > ---
> > Changes in v2:
> > - Add new patch to align default buffers in nand_base
> > 
> >  drivers/mtd/nand/nand_base.c |    3 ++-
> >  include/linux/mtd/nand.h     |    7 ++++---
> >  2 files changed, 6 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
> > index bfd668f..891af1f 100644
> > --- a/drivers/mtd/nand/nand_base.c
> > +++ b/drivers/mtd/nand/nand_base.c
> > @@ -2936,7 +2936,8 @@ int nand_scan_tail(struct mtd_info *mtd)
> > 
> >  	struct nand_chip *chip = mtd->priv;
> >  	
> >  	if (!(chip->options & NAND_OWN_BUFFERS))
> > 
> > -		chip->buffers = kmalloc(sizeof(*chip->buffers), GFP_KERNEL);
> > +		chip->buffers = memalign(ARCH_DMA_MINALIGN,
> > +					 sizeof(*chip->buffers));
> > 
> >  	if (!chip->buffers)
> >  	
> >  		return -ENOMEM;
> > 
> > diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index
> > 82704de..dc839e7 100644
> > --- a/include/linux/mtd/nand.h
> > +++ b/include/linux/mtd/nand.h
> > @@ -391,9 +391,10 @@ struct nand_ecc_ctrl {
> > 
> >   * consecutive order.
> >   */
> >  
> >  struct nand_buffers {
> > 
> > -	uint8_t	ecccalc[NAND_MAX_OOBSIZE];
> > -	uint8_t	ecccode[NAND_MAX_OOBSIZE];
> > -	uint8_t databuf[NAND_MAX_PAGESIZE + NAND_MAX_OOBSIZE];
> > +	uint8_t	ecccalc[ALIGN(NAND_MAX_OOBSIZE, ARCH_DMA_MINALIGN)];
> > +	uint8_t	ecccode[ALIGN(NAND_MAX_OOBSIZE, ARCH_DMA_MINALIGN)];
> > +	uint8_t databuf[ALIGN(NAND_MAX_PAGESIZE + NAND_MAX_OOBSIZE,
> > +			      ARCH_DMA_MINALIGN)];
> > 
> >  };


include asm/cache.h or something ?

> This causes build failures in the M28EVK build (./MAKEALL -a arm, with
> current u-boot-tegra/next & gcc 4.4.1):
> 
> In file included from mxs_nand.c:29:
> /home/tom/denx/uboot-tegra/include/linux/mtd/nand.h:394: warning: implicit
> declaration of function 'ALIGN'
> /home/tom/denx/uboot-tegra/include/linux/mtd/nand.h:394: error:
> 'ARCH_DMA_MINALIGN' undeclared here (not in a function)
> /home/tom/denx/uboot-tegra/include/linux/mtd/nand.h:394: error: variably
> modified 'ecccalc' at file scope
> /home/tom/denx/uboot-tegra/include/linux/mtd/nand.h:395: error: variably
> modified 'ecccode' at file scope
> /home/tom/denx/uboot-tegra/include/linux/mtd/nand.h:397: error: variably
> modified 'databuf' at file scope make[1]: *** [mxs_nand.o] Error 1
> make[1]: *** Waiting for unfinished jobs....
> make: *** [drivers/mtd/nand/libnand.o] Error 2
> make: *** Waiting for unfinished jobs....
> 
> PTAL. Thanks,
> 
> Tom
> 
> >  /**
> > 
> > --
> > 1.7.7.3

Best regards,
Marek Vasut

  reply	other threads:[~2012-09-07 18:43 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-30  6:53 [U-Boot] [PATCH v4 0/6] tegra: Add NAND flash support Simon Glass
2012-07-30  6:53 ` [U-Boot] [PATCH v4 1/6] nand: Try to align the default buffers Simon Glass
2012-07-30 22:45   ` Scott Wood
2012-09-07 18:20   ` Tom Warren
2012-09-07 18:43     ` Marek Vasut [this message]
2012-09-07 19:58       ` Tom Warren
2012-09-08  5:03         ` Marek Vasut
2012-07-30  6:53 ` [U-Boot] [PATCH v4 2/6] tegra: Add NAND support to funcmux Simon Glass
2012-07-30  6:53 ` [U-Boot] [PATCH v4 3/6] tegra: fdt: Add NAND controller binding and definitions Simon Glass
2012-07-30 23:05   ` Scott Wood
2012-07-31  9:19     ` Simon Glass
2012-07-30  6:53 ` [U-Boot] [PATCH v4 4/6] tegra: fdt: Add NAND definitions to fdt Simon Glass
2012-07-30 22:49   ` Scott Wood
2012-07-31  9:15     ` Simon Glass
2012-07-30  6:53 ` [U-Boot] [PATCH v4 5/6] tegra: nand: Add Tegra NAND driver Simon Glass
2012-07-30 22:32   ` Scott Wood
2012-07-30  6:53 ` [U-Boot] [PATCH v4 6/6] tegra: Enable NAND on Seaboard Simon Glass
2012-11-01 21:57   ` Stephen Warren
2012-11-01 23:13     ` Lucas Stach
2012-11-01 23:16       ` Simon Glass
2012-07-30 17:28 ` [U-Boot] [PATCH v4 0/6] tegra: Add NAND flash support Tom Warren
2012-07-30 17:34 ` Stephen Warren
2012-07-30 17:50   ` Tom Warren
2012-07-31  6:19 ` Thierry Reding
2012-09-07 21:31 ` Tom Warren
2012-09-07 21:33   ` Simon Glass
2012-09-21 21:44     ` Tom Warren
2012-09-21 21:57       ` Stephen Warren
2012-09-27 17:23         ` Simon Glass
2012-09-08  5:02   ` Marek Vasut

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=201209072043.02598.marex@denx.de \
    --to=marex@denx.de \
    --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