public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Amit Singh Tomar <amitsinght@marvell.com>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Hui-Ping Chen <hpchen0nvt@gmail.com>,
	miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com,
	robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
	esben@geanix.com, linux-arm-kernel@lists.infradead.org,
	linux-mtd@lists.infradead.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH v5 2/2] mtd: rawnand: nuvoton: add new driver for the Nuvoton MA35 SoC
Date: Mon, 23 Sep 2024 23:35:22 +0530	[thread overview]
Message-ID: <fad03af4-5dff-4a02-8fc2-926275feb386@marvell.com> (raw)
In-Reply-To: <ZvERI9fscLBC09_F@pengutronix.de>


> Hi Amit,
> 
> On Mon, Sep 23, 2024 at 01:19:03AM +0530, Amit Singh Tomar wrote:
>> Hi,
>> 
>> > +static int ma35_nand_do_write(struct nand_chip *chip, const u8 *addr, u32 len)
>> > +{
>> > +	struct ma35_nand_info *nand = nand_get_controller_data(chip);
>> > +	struct mtd_info *mtd = nand_to_mtd(chip);
>> > +	dma_addr_t dma_addr;
>> > +	int ret = 0, i;
>> > +	u32 reg;
>> > +
>> > +	if (len != mtd->writesize) {
>> > +		for (i = 0; i < len; i++)
>> > +			writel(addr[i], nand->regs + MA35_NFI_REG_NANDDATA);
>> > +		return 0;
>> > +	}
>> > +
>> > +	ma35_nand_dmac_init(nand);
>> > +
>> > +	writel(mtd->oobsize, nand->regs + MA35_NFI_REG_NANDRACTL);
>> > +
>> > +	writel(INT_DMA, nand->regs + MA35_NFI_REG_NANDINTEN);
>> > +	/* To mark this page as dirty. */
>> > +	reg = readl(nand->regs + MA35_NFI_REG_NANDRA0);
>> > +	if (reg & 0xffff0000)
>> > +		writel(reg & 0xffff, nand->regs + MA35_NFI_REG_NANDRA0);
>> > +
>> > +	dma_addr = dma_map_single(nand->dev, (void *)addr, len, DMA_TO_DEVICE);
>> > +	ret = dma_mapping_error(nand->dev, dma_addr);
>> > +	if (ret) {
>> > +		dev_err(nand->dev, "dma mapping error\n");
>> > +		return -EINVAL;
>> Shouldn't this return -ENOMEM or simply ret when there's an error? Also,
>> should we consider unmapping the page with dma_unmap_single in that case?
> 
> When dma_map_single() returns an error the pages are not mapped, no
> need to unmap then.
> 
Thanks for the clarification.
-Amit


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  reply	other threads:[~2024-09-23 18:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-20  6:37 [PATCH v5 0/2] Add support for nuvoton ma35 nand controller Hui-Ping Chen
2024-09-20  6:37 ` [PATCH v5 1/2] dt-bindings: mtd: nuvoton,ma35d1-nand: add new bindings Hui-Ping Chen
2024-09-20  6:37 ` [PATCH v5 2/2] mtd: rawnand: nuvoton: add new driver for the Nuvoton MA35 SoC Hui-Ping Chen
2024-09-22 19:49   ` Amit Singh Tomar
2024-09-23  6:56     ` Sascha Hauer
2024-09-23 18:05       ` Amit Singh Tomar [this message]
2024-09-24  2:11     ` Hui-Ping Chen

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=fad03af4-5dff-4a02-8fc2-926275feb386@marvell.com \
    --to=amitsinght@marvell.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=esben@geanix.com \
    --cc=hpchen0nvt@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=robh@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=vigneshr@ti.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