Linux-mtd Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafał Miłecki" <rafal@milecki.pl>
To: Scott Branden <scott.branden@broadcom.com>
Cc: "Florian Fainelli" <f.fainelli@gmail.com>,
	"Rafał Miłecki" <zajec5@gmail.com>,
	"Srinivas Kandagatla" <srinivas.kandagatla@linaro.org>,
	linux-mtd@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	"Arınç ÜNAL" <arinc.unal@arinc9.com>,
	"Florian Fainelli" <florian.fainelli@broadcom.com>
Subject: Re: [PATCH] nvmem: brcm_nvram: store a copy of NVRAM content
Date: Fri, 15 Sep 2023 09:28:20 +0200	[thread overview]
Message-ID: <24ab9df46703695cfa7402695a5dc5a2@milecki.pl> (raw)
In-Reply-To: <CA+Jzhd+HLoUDifQQ5vF7m66X3rsk1Bk2yx_0h6eSzaUwXVa72w@mail.gmail.com>

On 2023-09-14 23:30, Scott Branden wrote:
> On Thu, Sep 14, 2023 at 2:26 PM Florian Fainelli <f.fainelli@gmail.com> 
> wrote:
>> 
>> On 9/13/23 23:49, Rafał Miłecki wrote:
>> > From: Rafał Miłecki <rafal@milecki.pl>
>> >
>> > This driver uses MMIO access for reading NVRAM from a flash device.
>> > Underneath there is a flash controller that reads data and provides
>> > mapping window.
>> >
>> > Using MMIO interface affects controller configuration and may break real
>> > controller driver. It was reported by multiple users of devices with
>> > NVRAM stored on NAND.
>> >
>> > Modify driver to read & cache all NVRAM content during init and use that
>> > copy to provide NVMEM data when requested.
>> >
>> > Link: https://lore.kernel.org/linux-mtd/CACna6rwf3_9QVjYcM+847biTX=K0EoWXuXcSMkJO1Vy_5vmVqA@mail.gmail.com/
>> > Cc: Arınç ÜNAL <arinc.unal@arinc9.com>
>> > Cc: Florian Fainelli <florian.fainelli@broadcom.com>
>> > Cc: Scott Branden <scott.branden@broadcom.com>
>> > Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
>> > ---
>> [snip]
>> > -     priv->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
>> > -     if (IS_ERR(priv->base))
>> > -             return PTR_ERR(priv->base);
>> > +     base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
>> > +     if (IS_ERR(base))
>> > +             return PTR_ERR(base);
>> > +
>> > +     priv->size = resource_size(res);
>> > +
>> > +     priv->data = devm_kzalloc(dev, priv->size, GFP_KERNEL);
>> 
>> These can conceivably quite big data structures, how about using 
>> kvmalloc()?
> Why do we even need to expose MMIO interface to NAND though?  Why not
> always go through the controller driver.  I don't see how the MMIO
> access would be used given bad blocks aren't handled?

We need to read NVMRAM *early* for booting purposes. Some vendors store
there information about used firmware in case of having main one and
fallback one. That info is required for partitioning which happens
during mtd initialization before we have NAND driver fully initialized.

-- 
Rafał Miłecki

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

  reply	other threads:[~2023-09-15  7:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-14  6:49 [PATCH] nvmem: brcm_nvram: store a copy of NVRAM content Rafał Miłecki
2023-09-14  7:56 ` Arınç ÜNAL
2023-09-14  8:02   ` Rafał Miłecki
2023-09-14 21:26 ` Florian Fainelli
2023-09-14 21:30   ` Scott Branden
2023-09-15  7:28     ` Rafał Miłecki [this message]
2023-09-15  9:08       ` Scott Branden
2023-09-15  7:25   ` Rafał Miłecki

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=24ab9df46703695cfa7402695a5dc5a2@milecki.pl \
    --to=rafal@milecki.pl \
    --cc=arinc.unal@arinc9.com \
    --cc=f.fainelli@gmail.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=scott.branden@broadcom.com \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=zajec5@gmail.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