From: Masahiro Yamada <masahiroy@kernel.org>
To: Marek Vasut <marex@denx.de>
Cc: Richard Weinberger <richard@nod.at>,
Miquel Raynal <miquel.raynal@bootlin.com>,
linux-mtd <linux-mtd@lists.infradead.org>,
Vignesh Raghavendra <vigneshr@ti.com>,
Tudor Ambarus <tudor.ambarus@microchip.com>
Subject: Re: [PATCH V2] mtd: rawnand: denali_dt: Add support for configuring SPARE_AREA_SKIP_BYTES
Date: Fri, 10 Jan 2020 01:06:20 +0900 [thread overview]
Message-ID: <CAK7LNARkwtNsRrmq=9Cv+hgM2b68m7_2sV1mnrLuYuZ6H4j=vA@mail.gmail.com> (raw)
In-Reply-To: <20191220093900.1855751-1-marex@denx.de>
On Fri, Dec 20, 2019 at 6:39 PM Marek Vasut <marex@denx.de> wrote:
>
> The SPARE_AREA_SKIP_BYTES register is reset when the controller reset
> signal is toggled. Yet, this register must be configured to match the
> content of the NAND OOB area. The current default value is always set
> to 8 and is programmed into the hardware in case the hardware was not
> programmed before (e.g. in a bootloader) with a different value. This
> however does not work when the block is reset properly by Linux.
>
> On Altera SoCFPGA CycloneV, ArriaV and Arria10, which are the SoCFPGA
> platforms which support booting from NAND, the SPARE_AREA_SKIP_BYTES
> value must be set to 2. On Socionext Uniphier, the value is 8. This
> patch adds support for preconfiguring the default value and handles
> the special SoCFPGA case by setting the default to 2 on all SoCFPGA
> platforms, while retaining the original behavior and default value of
> 8 on all the other platforms.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
> Cc: Miquel Raynal <miquel.raynal@bootlin.com>
> Cc: Richard Weinberger <richard@nod.at>
> Cc: Vignesh Raghavendra <vigneshr@ti.com>
> To: linux-mtd@lists.infradead.org
> Reviewed-by: Tudor Ambarus <tudor.ambarus@microchip.com>
> ---
> V2: Move denali->oob_skip_bytes = data->oob_skip_bytes; right after
> of_device_get_match_data()
FYI.
This patch was rebased to avoid a conflict:
http://patchwork.ozlabs.org/patch/1214018/
My Ack is in v3.
I solved a merge conflict, and bundled in a series:
http://patchwork.ozlabs.org/project/linux-mtd/list/?series=149821
> ---
> drivers/mtd/nand/raw/denali.c | 13 ++++++++++---
> drivers/mtd/nand/raw/denali_dt.c | 5 +++++
> 2 files changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/denali.c b/drivers/mtd/nand/raw/denali.c
> index 3102ddbd8abdb..b6c463d021677 100644
> --- a/drivers/mtd/nand/raw/denali.c
> +++ b/drivers/mtd/nand/raw/denali.c
> @@ -1302,14 +1302,21 @@ int denali_init(struct denali_controller *denali)
>
> /*
> * Set how many bytes should be skipped before writing data in OOB.
> + * If a non-zero value has already been configured, update it in HW.
> * If a non-zero value has already been set (by firmware or something),
> * just use it. Otherwise, set the driver's default.
> */
> - denali->oob_skip_bytes = ioread32(denali->reg + SPARE_AREA_SKIP_BYTES);
> - if (!denali->oob_skip_bytes) {
> - denali->oob_skip_bytes = DENALI_DEFAULT_OOB_SKIP_BYTES;
> + if (denali->oob_skip_bytes) {
> iowrite32(denali->oob_skip_bytes,
> denali->reg + SPARE_AREA_SKIP_BYTES);
> + } else {
> + denali->oob_skip_bytes =
> + ioread32(denali->reg + SPARE_AREA_SKIP_BYTES);
> + if (!denali->oob_skip_bytes) {
> + denali->oob_skip_bytes = DENALI_DEFAULT_OOB_SKIP_BYTES;
> + iowrite32(denali->oob_skip_bytes,
> + denali->reg + SPARE_AREA_SKIP_BYTES);
> + }
> }
>
> iowrite32(0, denali->reg + TRANSFER_SPARE_REG);
> diff --git a/drivers/mtd/nand/raw/denali_dt.c b/drivers/mtd/nand/raw/denali_dt.c
> index 8b779a899dcf4..443f9c1f6854d 100644
> --- a/drivers/mtd/nand/raw/denali_dt.c
> +++ b/drivers/mtd/nand/raw/denali_dt.c
> @@ -27,6 +27,7 @@ struct denali_dt {
> struct denali_dt_data {
> unsigned int revision;
> unsigned int caps;
> + unsigned int oob_skip_bytes;
> const struct nand_ecc_caps *ecc_caps;
> };
>
> @@ -34,6 +35,7 @@ NAND_ECC_CAPS_SINGLE(denali_socfpga_ecc_caps, denali_calc_ecc_bytes,
> 512, 8, 15);
> static const struct denali_dt_data denali_socfpga_data = {
> .caps = DENALI_CAP_HW_ECC_FIXUP,
> + .oob_skip_bytes = 2,
> .ecc_caps = &denali_socfpga_ecc_caps,
> };
>
> @@ -42,6 +44,7 @@ NAND_ECC_CAPS_SINGLE(denali_uniphier_v5a_ecc_caps, denali_calc_ecc_bytes,
> static const struct denali_dt_data denali_uniphier_v5a_data = {
> .caps = DENALI_CAP_HW_ECC_FIXUP |
> DENALI_CAP_DMA_64BIT,
> + .oob_skip_bytes = 8,
> .ecc_caps = &denali_uniphier_v5a_ecc_caps,
> };
>
> @@ -51,6 +54,7 @@ static const struct denali_dt_data denali_uniphier_v5b_data = {
> .revision = 0x0501,
> .caps = DENALI_CAP_HW_ECC_FIXUP |
> DENALI_CAP_DMA_64BIT,
> + .oob_skip_bytes = 8,
> .ecc_caps = &denali_uniphier_v5b_ecc_caps,
> };
>
> @@ -122,6 +126,7 @@ static int denali_dt_probe(struct platform_device *pdev)
> denali->revision = data->revision;
> denali->caps = data->caps;
> denali->ecc_caps = data->ecc_caps;
> + denali->oob_skip_bytes = data->oob_skip_bytes;
> }
>
> denali->dev = dev;
> --
> 2.24.1
>
>
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/
--
Best Regards
Masahiro Yamada
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2020-01-09 16:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-20 9:39 [PATCH V2] mtd: rawnand: denali_dt: Add support for configuring SPARE_AREA_SKIP_BYTES Marek Vasut
2020-01-09 16:06 ` Masahiro Yamada [this message]
2020-01-09 16:13 ` Miquel Raynal
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='CAK7LNARkwtNsRrmq=9Cv+hgM2b68m7_2sV1mnrLuYuZ6H4j=vA@mail.gmail.com' \
--to=masahiroy@kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=marex@denx.de \
--cc=miquel.raynal@bootlin.com \
--cc=richard@nod.at \
--cc=tudor.ambarus@microchip.com \
--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;
as well as URLs for NNTP newsgroup(s).