From: Boris Brezillon <boris.brezillon@bootlin.com>
To: Aaron Sierra <asierra@xes-inc.com>
Cc: David Woodhouse <dwmw2@infradead.org>,
Brian Norris <computersforpeace@gmail.com>,
Boris Brezillon <boris.brezillon@free-electrons.com>,
Marek Vasut <marek.vasut@gmail.com>,
Richard Weinberger <richard@nod.at>,
linux-mtd <linux-mtd@lists.infradead.org>
Subject: Re: [PATCH v2 1/2] mtd: cfi: Support early CFI fixups
Date: Thu, 3 May 2018 11:31:58 +0200 [thread overview]
Message-ID: <20180503113158.56ce5798@bbrezillon> (raw)
In-Reply-To: <286315039.117511.1525106089951.JavaMail.zimbra@xes-inc.com>
Hi Aaron,
On Mon, 30 Apr 2018 11:34:49 -0500 (CDT)
Aaron Sierra <asierra@xes-inc.com> wrote:
> Some CFI devices need fixups that affect the number of chips detected,
> but the current fixup infrastructure (struct cfi_fixup and cfi_fixup())
> does not cover this situation.
>
> Introduce struct cfi_early_fixup and cfi_early_fixup() to fill the void.
>
> Signed-off-by: Aaron Sierra <asierra@xes-inc.com>
This version looks good to me, just a few minor things which I can fix
when applying if you agree with the changes I suggest.
> ---
>
> v2 - Split into two patches. One adding infrastructure and one adding
> the first early fixup.
> - Define struct cfi_early_fixup and cfi_early_fixup() in cfi_probe.c
>
> drivers/mtd/chips/cfi_probe.c | 29 +++++++++++++++++++++++++++++
> 1 file changed, 29 insertions(+)
>
> diff --git a/drivers/mtd/chips/cfi_probe.c b/drivers/mtd/chips/cfi_probe.c
> index e8d0164..c05deac 100644
> --- a/drivers/mtd/chips/cfi_probe.c
> +++ b/drivers/mtd/chips/cfi_probe.c
> @@ -63,6 +63,29 @@ do { \
>
> #endif
>
> +/*
> + * This fixup occurs immediately after reading the CFI structure and can affect
> + * the number of chips detected, unlike cfi_fixup, which occurs after an
> + * mtd_info structure has been created for the chip.
> + */
> +struct cfi_early_fixup {
> + uint16_t mfr;
> + uint16_t id;
> + void (*fixup)(struct cfi_private *cfi);
> +};
> +
> +void cfi_early_fixup(struct cfi_private *cfi, struct cfi_early_fixup *fixups)
> +{
> + struct cfi_early_fixup *f;
const struct cfi_early_fixup *f;
> +
> + for (f = fixups; f->fixup; f++) {
> + if (((f->mfr == CFI_MFR_ANY) || (f->mfr == cfi->mfr)) &&
> + ((f->id == CFI_ID_ANY) || (f->id == cfi->id))) {
> + f->fixup(cfi);
> + }
> + }
> +}
> +
> /* check for QRY.
> in: interleave,type,mode
> ret: table index, <0 for error
> @@ -151,6 +174,10 @@ static int __xipram cfi_probe_chip(struct map_info *map, __u32 base,
> return 1;
> }
>
> +static struct cfi_early_fixup cfi_early_fixup_table[] = {
static const ...
> + { 0, 0, NULL },
No need to fill all the fields, just do
{ },
and the compiler will initialize everything to zero.
> +};
> +
> static int __xipram cfi_chip_setup(struct map_info *map,
> struct cfi_private *cfi)
> {
> @@ -235,6 +262,8 @@ static int __xipram cfi_chip_setup(struct map_info *map,
> cfi_qry_mode_off(base, map, cfi);
> xip_allowed(base, map);
>
> + cfi_early_fixup(cfi, cfi_early_fixup_table);
> +
> printk(KERN_INFO "%s: Found %d x%d devices at 0x%x in %d-bit bank. Manufacturer ID %#08x Chip ID %#08x\n",
> map->name, cfi->interleave, cfi->device_type*8, base,
> map->bankwidth*8, cfi->mfr, cfi->id);
Thanks,
Boris
next prev parent reply other threads:[~2018-05-03 9:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-30 16:34 [PATCH v2 1/2] mtd: cfi: Support early CFI fixups Aaron Sierra
2018-05-03 9:31 ` Boris Brezillon [this message]
2018-05-03 14:34 ` Aaron Sierra
2018-05-04 19:35 ` Boris Brezillon
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=20180503113158.56ce5798@bbrezillon \
--to=boris.brezillon@bootlin.com \
--cc=asierra@xes-inc.com \
--cc=boris.brezillon@free-electrons.com \
--cc=computersforpeace@gmail.com \
--cc=dwmw2@infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=marek.vasut@gmail.com \
--cc=richard@nod.at \
/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