[PATCH] nvmem: brcm_nvram: store a copy of NVRAM content

Scott Branden scott.branden at broadcom.com
Thu Sep 14 14:30:58 PDT 2023


On Thu, Sep 14, 2023 at 2:26 PM Florian Fainelli <f.fainelli at gmail.com> wrote:
>
> On 9/13/23 23:49, Rafał Miłecki wrote:
> > From: Rafał Miłecki <rafal at 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 at arinc9.com>
> > Cc: Florian Fainelli <florian.fainelli at broadcom.com>
> > Cc: Scott Branden <scott.branden at broadcom.com>
> > Signed-off-by: Rafał Miłecki <rafal at 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?
> --
> Florian
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4212 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.infradead.org/pipermail/linux-mtd/attachments/20230914/79224661/attachment.p7s>


More information about the linux-mtd mailing list