linux-stable/drivers/nvmem
Rafał Miłecki 09283d60bc nvmem: brcm_nvram: store a copy of NVRAM content
commit 1e37bf84af upstream.

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 NVRAM content during init and use that
copy to provide NVMEM data when requested. On NAND flashes due to their
alignment NVRAM partitions can be quite big (1 MiB and more) while
actual NVRAM content stays quite small (usually 16 to 32 KiB). To avoid
allocating so much memory check for actual data length.

Link: https://lore.kernel.org/linux-mtd/CACna6rwf3_9QVjYcM+847biTX=K0EoWXuXcSMkJO1Vy_5vmVqA@mail.gmail.com/
Fixes: 3fef9ed062 ("nvmem: brcm_nvram: new driver exposing Broadcom's NVRAM")
Cc:  <Stable@vger.kernel.org>
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>
Acked-by: Arınç ÜNAL <arinc.unal@arinc9.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20231215111358.316727-3-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-01-01 12:42:44 +00:00
..
layouts nvmem: layouts: sl28vpd: set varaiable sl28vpd_layout storage-class-specifier to static 2023-04-05 19:41:13 +02:00
apple-efuses.c nvmem: Add Apple eFuse driver 2022-05-09 15:44:21 +02:00
bcm-ocotp.c nvmem: Explicitly include correct DT includes 2023-08-23 16:34:01 +02:00
brcm_nvram.c nvmem: brcm_nvram: store a copy of NVRAM content 2024-01-01 12:42:44 +00:00
core.c nvmem: Do not expect fixed layouts to grab a layout driver 2023-12-13 18:45:31 +01:00
imx-iim.c nvmem: Explicitly include correct DT includes 2023-08-23 16:34:01 +02:00
imx-ocotp-ele.c nvmem: Explicitly include correct DT includes 2023-08-23 16:34:01 +02:00
imx-ocotp-scu.c nvmem: Explicitly include correct DT includes 2023-08-23 16:34:01 +02:00
imx-ocotp.c nvmem: imx: correct nregs for i.MX6ULL 2023-10-16 21:00:08 +02:00
jz4780-efuse.c
Kconfig nvmem: sec-qfprom: Add Qualcomm secure QFPROM support 2023-08-23 16:34:01 +02:00
lan9662-otpc.c nvmem: lan9662-otp: Change return type of lan9662_otp_wait_flag_clear() 2022-11-22 18:22:05 +01:00
layerscape-sfp.c nvmem: sfp: Add support for TA 2.1 devices 2022-05-09 15:46:29 +02:00
lpc18xx_eeprom.c
lpc18xx_otp.c nvmem: Explicitly include correct DT includes 2023-08-23 16:34:01 +02:00
Makefile nvmem: sec-qfprom: Add Qualcomm secure QFPROM support 2023-08-23 16:34:01 +02:00
meson-efuse.c
meson-mx-efuse.c nvmem: Explicitly include correct DT includes 2023-08-23 16:34:01 +02:00
microchip-otpc.c nvmem: microchip-otpc: add support 2022-07-08 15:45:05 +02:00
mtk-efuse.c nvmem: mtk-efuse: Support postprocessing for GPU speed binning data 2023-04-05 19:41:12 +02:00
mxs-ocotp.c
nintendo-otp.c nvmem: nintendo-otp: Use devm_platform_ioremap_resource() 2023-04-05 19:41:12 +02:00
qcom-spmi-sdam.c nvmem: Explicitly include correct DT includes 2023-08-23 16:34:01 +02:00
qfprom.c nvmem: qfprom: do some cleanup 2023-08-23 16:34:01 +02:00
qoriq-efuse.c nvmem: add new NXP QorIQ eFuse driver 2023-08-23 16:34:01 +02:00
rave-sp-eeprom.c nvmem: Explicitly include correct DT includes 2023-08-23 16:34:01 +02:00
rmem.c nvmem: rmem: Use NVMEM_DEVID_AUTO 2023-06-15 13:42:18 +02:00
rockchip-efuse.c nvmem: rockchip-efuse: Use devm_platform_get_and_ioremap_resource() 2023-08-23 16:34:00 +02:00
rockchip-otp.c nvmem: rockchip-otp: Add support for RK3588 2023-06-15 13:42:17 +02:00
sc27xx-efuse.c nvmem: Explicitly include correct DT includes 2023-08-23 16:34:01 +02:00
sec-qfprom.c nvmem: sec-qfprom: Add Qualcomm secure QFPROM support 2023-08-23 16:34:01 +02:00
snvs_lpgpr.c nvmem: Explicitly include correct DT includes 2023-08-23 16:34:01 +02:00
sprd-efuse.c nvmem: Explicitly include correct DT includes 2023-08-23 16:34:01 +02:00
stm32-bsec-optee-ta.c nvmem: stm32: add OP-TEE support for STM32MP13x 2023-02-06 19:06:59 +01:00
stm32-bsec-optee-ta.h nvmem: stm32: add OP-TEE support for STM32MP13x 2023-02-06 19:06:59 +01:00
stm32-romem.c nvmem: stm32-romem: Use devm_platform_get_and_ioremap_resource() 2023-08-23 16:34:01 +02:00
sunplus-ocotp.c nvmem: Explicitly include correct DT includes 2023-08-23 16:34:01 +02:00
sunxi_sid.c nvmem: Explicitly include correct DT includes 2023-08-23 16:34:01 +02:00
u-boot-env.c nvmem: u-boot-env:: Replace zero-length array with DECLARE_FLEX_ARRAY() helper 2023-08-23 16:34:02 +02:00
uniphier-efuse.c nvmem: uniphier: Use devm_platform_get_and_ioremap_resource() 2023-08-23 16:34:01 +02:00
vf610-ocotp.c nvmem: vf610-ocotp: Use devm_platform_get_and_ioremap_resource() 2023-04-05 19:41:13 +02:00
zynqmp_nvmem.c nvmem: zynqmp: Switch @xilinx.com emails to @amd.com 2023-06-15 13:42:17 +02:00