From: Brian Norris <computersforpeace@gmail.com>
To: Huang Shijie <shijie8@gmail.com>
Cc: s.hauer@pengutronix.de, akinobu.mita@gmail.com,
josh@joshtriplett.org, linux-mtd@lists.infradead.org,
dwmw2@infradead.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 3/4] mtd: nand: kill the the NAND_MAX_PAGESIZE/NAND_MAX_OOBSIZE for nand_buffers{}
Date: Sat, 11 Jan 2014 15:39:37 -0800 [thread overview]
Message-ID: <20140111233937.GF1992@norris-Latitude-E6410> (raw)
In-Reply-To: <1387555350-989-4-git-send-email-shijie8@gmail.com>
On Sat, Dec 21, 2013 at 12:02:29AM +0800, Huang Shijie wrote:
> The patch converts the arrays to buffer pointers for nand_buffers{}.
>
> The cafe_nand.c is the only NAND_OWN_BUFFERS user which allocates
> a nand_buffers{} itself.
>
> This patch disables the DMA for nand_scan_ident, and restore the DMA
> status after we finish the nand_scan_ident. By this way, we can get the
> mtd->writesize and mtd->oobsize, and then allocates the cafe->dmabuf
> with them.
>
> Since the cafe_nand.c uses the NAND_ECC_HW_SYNDROME ECC mode, we do not
> allocate the buffers for @ecccalc and @ecccode.
>
> Signed-off-by: Huang Shijie <shijie8@gmail.com>
> ---
> drivers/mtd/nand/cafe_nand.c | 49 ++++++++++++++++++++++++++++++++------------
> drivers/mtd/nand/nand_base.c | 19 +++++++++++++----
> include/linux/mtd/nand.h | 12 +++++------
> 3 files changed, 57 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/mtd/nand/cafe_nand.c b/drivers/mtd/nand/cafe_nand.c
> index c34985a..e9186e7 100644
> --- a/drivers/mtd/nand/cafe_nand.c
> +++ b/drivers/mtd/nand/cafe_nand.c
> @@ -627,6 +627,8 @@ static int cafe_nand_probe(struct pci_dev *pdev,
> struct cafe_priv *cafe;
> uint32_t ctrl;
> int err = 0;
> + int old_dma;
> + struct nand_buffers *nbuf;
>
> /* Very old versions shared the same PCI ident for all three
> functions on the chip. Verify the class too... */
> @@ -657,13 +659,6 @@ static int cafe_nand_probe(struct pci_dev *pdev,
> err = -ENOMEM;
> goto out_free_mtd;
> }
> - cafe->dmabuf = dma_alloc_coherent(&cafe->pdev->dev, 2112 + sizeof(struct nand_buffers),
> - &cafe->dmaaddr, GFP_KERNEL);
> - if (!cafe->dmabuf) {
> - err = -ENOMEM;
> - goto out_ior;
> - }
> - cafe->nand.buffers = (void *)cafe->dmabuf + 2112;
When you move this after nand_scan_ident(), you forgot to move all the code
that uses dmabuf and dmabuf:
/* Set up DMA address */
cafe_writel(cafe, cafe->dmaaddr & 0xffffffff, NAND_DMA_ADDR0);
if (sizeof(cafe->dmaaddr) > 4)
/* Shift in two parts to shut the compiler up */
cafe_writel(cafe, (cafe->dmaaddr >> 16) >> 16, NAND_DMA_ADDR1);
else
cafe_writel(cafe, 0, NAND_DMA_ADDR1);
cafe_dev_dbg(&cafe->pdev->dev, "Set DMA address to %x (virt %p)\n",
cafe_readl(cafe, NAND_DMA_ADDR0), cafe->dmabuf);
This code needs to stay after the point where you actually allocate the buffer.
It could also use some testing on real Cafe NAND hardware, since I don't
know what kind of use the !DMA case was getting.
>
> cafe->rs = init_rs_non_canonical(12, &cafe_mul, 0, 1, 8);
> if (!cafe->rs) {
Brian
next prev parent reply other threads:[~2014-01-11 23:39 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-20 16:02 [PATCH 0/4] mtd: kill the NAND_MAX_PAGESIZE/NAND_MAX_OOBSIZE Huang Shijie
2013-12-20 16:02 ` [PATCH 1/4] mtd: mxc-nand: " Huang Shijie
2013-12-20 16:02 ` [PATCH 2/4] mtd: denali: " Huang Shijie
2013-12-20 16:02 ` [PATCH 3/4] mtd: nand: kill the the NAND_MAX_PAGESIZE/NAND_MAX_OOBSIZE for nand_buffers{} Huang Shijie
2014-01-11 23:39 ` Brian Norris [this message]
2014-01-11 23:43 ` Russell King - ARM Linux
2014-01-12 0:04 ` Brian Norris
2014-01-13 6:27 ` [PATCH fix] " Huang Shijie
2014-01-29 0:23 ` Brian Norris
2013-12-20 16:02 ` [PATCH 4/4] mtd: nand: remove the NAND_MAX_PAGESIZE/NAND_MAX_OOBSIZE Huang Shijie
2014-01-29 0:23 ` Brian Norris
2013-12-20 17:13 ` [PATCH 0/4] mtd: kill " Josh Triplett
2014-01-11 23:47 ` Brian Norris
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=20140111233937.GF1992@norris-Latitude-E6410 \
--to=computersforpeace@gmail.com \
--cc=akinobu.mita@gmail.com \
--cc=dwmw2@infradead.org \
--cc=josh@joshtriplett.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=s.hauer@pengutronix.de \
--cc=shijie8@gmail.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