All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chuanhong Guo <gch981213@gmail.com>
To: Boris Brezillon <boris.brezillon@collabora.com>
Cc: linux-mtd@lists.infradead.org,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	Patrice Chotard <patrice.chotard@foss.st.com>,
	Christophe Kerello <christophe.kerello@foss.st.com>,
	Mark Brown <broonie@kernel.org>, Daniel Palmer <daniel@0x0f.com>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 2/3] mtd: spinand: add support for detection with param page
Date: Fri, 15 Apr 2022 15:28:57 +0800	[thread overview]
Message-ID: <CAJsYDVKbm+X8ARkgH6z9T0JaZ=cYkG+_3m-dtsbgAwWCrZeO8A@mail.gmail.com> (raw)
In-Reply-To: <20220415090058.5044ae17@collabora.com>

Hi!

On Fri, Apr 15, 2022 at 3:01 PM Boris Brezillon
<boris.brezillon@collabora.com> wrote:
> +#define SPINAND_IDR_EN BIT(6)

Looks like you're redefining CFG_OTP_ENABLE, why not use that
definition directly?

Oh. I didn't know that was available. I'll use it.
(IDR_EN comes from a toshiba datasheet if I remember correctly.)

>
> On Fri, 15 Apr 2022 11:48:43 +0800
> Chuanhong Guo <gch981213@gmail.com> wrote:
>
> > +
> > +static const struct spinand_manufacturer *spinand_onfi_manufacturers[] = {};
>
> Do we really need a separate manufacturer array? Looks like we could
> re-use the one we have in core.c and do the matching against it (we
> just need an extra NULL sentinel to detect the end of this array).

I'll do it.
I'll also add a onfi_nchips to spinand_manufacturer to share the same
manufacturer entry between two types of ID list.

>
> > +
> > +static const struct spinand_onfi_info *
> > +spinand_onfi_chip_match(struct nand_onfi_params *p,
> > +                     const struct spinand_manufacturer *m)
> > +{
> > +     size_t i, j;
> > +
> > +     for (i = 0; i < m->nchips; i++)
> > +             for (j = 0; m->onfi_chips[i].models[j]; j++)
> > +                     if (!strcasecmp(m->onfi_chips[i].models[j], p->model))
> > +                             return &m->onfi_chips[i];
> > +     return NULL;
> > +}
>
> > +/**
> > + * struct spinand_onfi_info - Structure used to describe SPI NAND with ONFI
> > + *                         parameter page
> > + * @models: Model name array. Null terminated.
> > + * @flags: OR-ing of the SPINAND_XXX flags
> > + * @eccinfo: on-die ECC info
> > + * @op_variants: operations variants
> > + * @op_variants.read_cache: variants of the read-cache operation
> > + * @op_variants.write_cache: variants of the write-cache operation
> > + * @op_variants.update_cache: variants of the update-cache operation
> > + * @select_target: function used to select a target/die. Required only for
> > + *              multi-die chips
> > + *
> > + * Each SPI NAND manufacturer driver should have a spinand_onfi_info table
> > + * describing all the chips supported by the driver.
> > + */
> > +struct spinand_onfi_info {
> > +     const char **const models;
> > +     u32 flags;
> > +     struct spinand_ecc_info eccinfo;
> > +     struct {
> > +             const struct spinand_op_variants *read_cache;
> > +             const struct spinand_op_variants *write_cache;
> > +             const struct spinand_op_variants *update_cache;
> > +     } op_variants;
> > +     int (*select_target)(struct spinand_device *spinand,
> > +                          unsigned int target);
> > +};
>
> Can't we just extend spinand_info instead of defining a new struct.

Yeah, that's better. I'll do it.

> AFAICT, the only difference is that model is replaced by a model array,
> and devid is dropped, and I think we can rework the existing ID-based
> matching logic to return ->models[0] instead of ->model.

In fact we don't even use this model string anywhere at the moment.

-- 
Regards,
Chuanhong Guo

WARNING: multiple messages have this Message-ID (diff)
From: Chuanhong Guo <gch981213@gmail.com>
To: Boris Brezillon <boris.brezillon@collabora.com>
Cc: linux-mtd@lists.infradead.org,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	 Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	Patrice Chotard <patrice.chotard@foss.st.com>,
	 Christophe Kerello <christophe.kerello@foss.st.com>,
	Mark Brown <broonie@kernel.org>,  Daniel Palmer <daniel@0x0f.com>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 2/3] mtd: spinand: add support for detection with param page
Date: Fri, 15 Apr 2022 15:28:57 +0800	[thread overview]
Message-ID: <CAJsYDVKbm+X8ARkgH6z9T0JaZ=cYkG+_3m-dtsbgAwWCrZeO8A@mail.gmail.com> (raw)
In-Reply-To: <20220415090058.5044ae17@collabora.com>

Hi!

On Fri, Apr 15, 2022 at 3:01 PM Boris Brezillon
<boris.brezillon@collabora.com> wrote:
> +#define SPINAND_IDR_EN BIT(6)

Looks like you're redefining CFG_OTP_ENABLE, why not use that
definition directly?

Oh. I didn't know that was available. I'll use it.
(IDR_EN comes from a toshiba datasheet if I remember correctly.)

>
> On Fri, 15 Apr 2022 11:48:43 +0800
> Chuanhong Guo <gch981213@gmail.com> wrote:
>
> > +
> > +static const struct spinand_manufacturer *spinand_onfi_manufacturers[] = {};
>
> Do we really need a separate manufacturer array? Looks like we could
> re-use the one we have in core.c and do the matching against it (we
> just need an extra NULL sentinel to detect the end of this array).

I'll do it.
I'll also add a onfi_nchips to spinand_manufacturer to share the same
manufacturer entry between two types of ID list.

>
> > +
> > +static const struct spinand_onfi_info *
> > +spinand_onfi_chip_match(struct nand_onfi_params *p,
> > +                     const struct spinand_manufacturer *m)
> > +{
> > +     size_t i, j;
> > +
> > +     for (i = 0; i < m->nchips; i++)
> > +             for (j = 0; m->onfi_chips[i].models[j]; j++)
> > +                     if (!strcasecmp(m->onfi_chips[i].models[j], p->model))
> > +                             return &m->onfi_chips[i];
> > +     return NULL;
> > +}
>
> > +/**
> > + * struct spinand_onfi_info - Structure used to describe SPI NAND with ONFI
> > + *                         parameter page
> > + * @models: Model name array. Null terminated.
> > + * @flags: OR-ing of the SPINAND_XXX flags
> > + * @eccinfo: on-die ECC info
> > + * @op_variants: operations variants
> > + * @op_variants.read_cache: variants of the read-cache operation
> > + * @op_variants.write_cache: variants of the write-cache operation
> > + * @op_variants.update_cache: variants of the update-cache operation
> > + * @select_target: function used to select a target/die. Required only for
> > + *              multi-die chips
> > + *
> > + * Each SPI NAND manufacturer driver should have a spinand_onfi_info table
> > + * describing all the chips supported by the driver.
> > + */
> > +struct spinand_onfi_info {
> > +     const char **const models;
> > +     u32 flags;
> > +     struct spinand_ecc_info eccinfo;
> > +     struct {
> > +             const struct spinand_op_variants *read_cache;
> > +             const struct spinand_op_variants *write_cache;
> > +             const struct spinand_op_variants *update_cache;
> > +     } op_variants;
> > +     int (*select_target)(struct spinand_device *spinand,
> > +                          unsigned int target);
> > +};
>
> Can't we just extend spinand_info instead of defining a new struct.

Yeah, that's better. I'll do it.

> AFAICT, the only difference is that model is replaced by a model array,
> and devid is dropped, and I think we can rework the existing ID-based
> matching logic to return ->models[0] instead of ->model.

In fact we don't even use this model string anywhere at the moment.

-- 
Regards,
Chuanhong Guo

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

  reply	other threads:[~2022-04-15  7:29 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-15  3:48 [PATCH v2 0/3] mtd: spinand: add support for detection with param page Chuanhong Guo
2022-04-15  3:48 ` Chuanhong Guo
2022-04-15  3:48 ` [PATCH v2 1/3] mtd: nand: extract some onfi functions to nandcore Chuanhong Guo
2022-04-15  3:48   ` Chuanhong Guo
2022-04-15  3:48 ` [PATCH v2 2/3] mtd: spinand: add support for detection with param page Chuanhong Guo
2022-04-15  3:48   ` Chuanhong Guo
2022-04-15  6:48   ` Boris Brezillon
2022-04-15  6:48     ` Boris Brezillon
2022-04-15  7:00   ` Boris Brezillon
2022-04-15  7:00     ` Boris Brezillon
2022-04-15  7:28     ` Chuanhong Guo [this message]
2022-04-15  7:28       ` Chuanhong Guo
2022-04-15  3:48 ` [PATCH v2 3/3] mtd: spinand: probe Winbond W25N01GV/W using " Chuanhong Guo
2022-04-15  3:48   ` Chuanhong Guo
2022-04-16 10:10   ` Chuanhong Guo
2022-04-16 10:10     ` Chuanhong Guo

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='CAJsYDVKbm+X8ARkgH6z9T0JaZ=cYkG+_3m-dtsbgAwWCrZeO8A@mail.gmail.com' \
    --to=gch981213@gmail.com \
    --cc=boris.brezillon@collabora.com \
    --cc=broonie@kernel.org \
    --cc=christophe.kerello@foss.st.com \
    --cc=daniel@0x0f.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=patrice.chotard@foss.st.com \
    --cc=richard@nod.at \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.