mirror of https://lore.kernel.org/linux-amlogic/
 help / color / mirror / Atom feed
From: Arseniy Krasnov <avkrasnov@sberdevices.ru>
To: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Liang Yang <liang.yang@amlogic.com>,
	Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Kevin Hilman <khilman@baylibre.com>,
	Jerome Brunet <jbrunet@baylibre.com>,
	Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
	Jianxin Pan <jianxin.pan@amlogic.com>,
	Yixun Lan <yixun.lan@amlogic.com>, <oxffffaa@gmail.com>,
	<kernel@sberdevices.ru>, <linux-mtd@lists.infradead.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-amlogic@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4 3/5] mtd: rawnand: meson: always read whole OOB bytes
Date: Tue, 23 May 2023 20:27:35 +0300	[thread overview]
Message-ID: <84a2e0c4-cc6f-1743-ee93-c13bc8bf09f1@sberdevices.ru> (raw)
In-Reply-To: <20230522173813.08afe6b8@xps-13>



On 22.05.2023 18:38, Miquel Raynal wrote:
> Hi Arseniy,
> 
> AVKrasnov@sberdevices.ru wrote on Mon, 15 May 2023 12:44:37 +0300:
> 
>> This changes size of read access to OOB area by reading all bytes of
>> OOB (free bytes + ECC engine bytes).
> 
> This is normally up to the user (user in your case == jffs2). The
> controller driver should expose a number of user accessible bytes and
> then when users want the OOB area, they should access it entirely. On
> top of that read, they can extract (or "write only") the user bytes.

Sorry, I didn't get it. If driver exposes N bytes of user accessible bytes,
I must always return whole OOB yes? E.g. N + rest of OOB

> 
>> Signed-off-by: Arseniy Krasnov <AVKrasnov@sberdevices.ru>
>> ---
>>  drivers/mtd/nand/raw/meson_nand.c | 24 ++++++++++++++++++++++++
>>  1 file changed, 24 insertions(+)
>>
>> diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c
>> index 8526a6b87720..a31106c943d7 100644
>> --- a/drivers/mtd/nand/raw/meson_nand.c
>> +++ b/drivers/mtd/nand/raw/meson_nand.c
>> @@ -755,6 +755,30 @@ static int __meson_nfc_read_oob(struct nand_chip *nand, int page,
>>  	u32 oob_bytes;
>>  	u32 page_size;
>>  	int ret;
>> +	int i;
>> +
>> +	/* Read ECC codes and user bytes. */
>> +	for (i = 0; i < nand->ecc.steps; i++) {
>> +		u32 ecc_offs = nand->ecc.size * (i + 1) +
>> +			       NFC_OOB_PER_ECC(nand) * i;
>> +
>> +		ret = nand_read_page_op(nand, page, 0, NULL, 0);
>> +		if (ret)
>> +			return ret;
>> +
>> +		/* Use temporary buffer, because 'nand_change_read_column_op()'
>> +		 * seems work with some alignment, so we can't read data to
>> +		 * 'oob_buf' directly.
> 
> DMA?

Yes I guess, this address passed to exec_op code and used as DMA.

> 
>> +		 */
>> +		ret = nand_change_read_column_op(nand, ecc_offs, meson_chip->oob_buf,
>> +						 NFC_OOB_PER_ECC(nand), false);
>> +		if (ret)
>> +			return ret;
>> +
>> +		memcpy(oob_buf + i * NFC_OOB_PER_ECC(nand),
>> +		       meson_chip->oob_buf,
>> +		       NFC_OOB_PER_ECC(nand));
>> +	}
>>  
>>  	oob_bytes = meson_nfc_get_oob_bytes(nand);
>>  
> 
> 
> Thanks,
> Miquèl

Thanks, Arseniy

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

  reply	other threads:[~2023-05-23 17:32 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-15  9:44 [PATCH v4 0/5] refactoring and fix for Meson NAND Arseniy Krasnov
2023-05-15  9:44 ` [PATCH v4 1/5] mtd: rawnand: meson: fix command sequence for read/write Arseniy Krasnov
2023-05-22 15:05   ` Miquel Raynal
2023-05-23  9:12     ` Arseniy Krasnov
2023-05-24  9:05       ` Arseniy Krasnov
2023-05-26 17:22         ` Miquel Raynal
2023-05-30 11:19           ` Arseniy Krasnov
2023-05-30 13:05             ` Miquel Raynal
2023-05-30 13:35               ` Arseniy Krasnov
2023-05-30 13:58                 ` Miquel Raynal
2023-05-15  9:44 ` [PATCH v4 2/5] mtd: rawnand: meson: move OOB to non-protected ECC area Arseniy Krasnov
2023-05-22 15:33   ` Miquel Raynal
2023-05-23 17:17     ` Arseniy Krasnov
2023-05-26 17:03       ` Miquel Raynal
2023-05-29 19:43         ` Arseniy Krasnov
2023-05-30  7:44           ` Miquel Raynal
2023-05-30  8:09             ` Arseniy Krasnov
2023-05-30  8:21               ` Miquel Raynal
2023-05-30  8:28                 ` Arseniy Krasnov
2023-05-15  9:44 ` [PATCH v4 3/5] mtd: rawnand: meson: always read whole OOB bytes Arseniy Krasnov
2023-05-22 15:38   ` Miquel Raynal
2023-05-23 17:27     ` Arseniy Krasnov [this message]
2023-05-26 17:09       ` Miquel Raynal
2023-05-29 19:46         ` Arseniy Krasnov
2023-05-15  9:44 ` [PATCH v4 4/5] mtd: rawnand: meson: check buffer length Arseniy Krasnov
2023-05-22 15:43   ` Miquel Raynal
2023-05-15  9:44 ` [PATCH v4 5/5] mtd: rawnand: meson: remove unneeded bitwise OR with zeroes Arseniy Krasnov

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=84a2e0c4-cc6f-1743-ee93-c13bc8bf09f1@sberdevices.ru \
    --to=avkrasnov@sberdevices.ru \
    --cc=jbrunet@baylibre.com \
    --cc=jianxin.pan@amlogic.com \
    --cc=kernel@sberdevices.ru \
    --cc=khilman@baylibre.com \
    --cc=liang.yang@amlogic.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=neil.armstrong@linaro.org \
    --cc=oxffffaa@gmail.com \
    --cc=richard@nod.at \
    --cc=vigneshr@ti.com \
    --cc=yixun.lan@amlogic.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

all inboxes | Powered by JetHome®