Commit Graph

505 Commits

Author SHA1 Message Date
Pankaj Gupta
be13b6c87d drivers: nvmem: imx: ports ocotp driver to updated se kernel driver.
ports ocotp driver to updated se kernel driver.

Signed-off-by: Pankaj Gupta <pankaj.gupta@nxp.com>
Acked-by: Jason Liu <jason.hui.liu@nxp.com>
2025-05-28 10:40:30 +08:00
Alice Guo
f7e7a3f151 LF-15138-2 nvmem: imx-ocotp-fsb-s400: fix the bug caused by not getting the se-fw2 device
When not getting the se-fw2 device, calling read_common_fuse() or
ele_write_fuse() will result in segmentation fault because fuse->se_dev
is a NULL pointer. Check fuse->se_dev to avoid this error.

Signed-off-by: Alice Guo <alice.guo@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Acked-by: Jason Liu <jason.hui.liu@nxp.com>
2025-05-12 11:27:06 +08:00
Alice Guo
41adc16f98 LF-15138-1 nvmem: imx95: update imx-ocotp-fsb-s400.c for i.MX95
This update is according to i.MX95_Fusemap_v1.13_documentation.

Signed-off-by: Alice Guo <alice.guo@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Acked-by: Jason Liu <jason.hui.liu@nxp.com>
2025-05-12 11:27:05 +08:00
Michael Glembotzki
d8f7322db0 nvmem: imx-ocotp-fsb-s400: BUG: Fix the word count
Only a block size of 4 bytes is supported, so divide the offset by 4 to obtain
the correct word count, as is done in other drivers such as: imx-ocotp.c

How to reproduce the bug?
e.g. try to write first word of the MAC_ADDR1 on imx93
FUSE_DEV=/sys/bus/nvmem/devices/fsb_s400_fuse0/nvmem
OFFSET_MAC=315
dd if=<binfile> of=$FUSE_DEV bs=4 count=1 seek=$OFFSET_MAC conv=notrunc

fsl-se-fw se-fw2: Command Id[214], Status=0x29, Indicator=0xA7
ELE_WRONG_SIZE_FAILURE_IND:0xA7, because the fuse being programmed
is not in the SoC fuse map.

Signed-off-by: Michael Glembotzki <Michael.Glembotzki@iris-sensing.com>
Acked-by: Jason Liu <jason.hui.liu@nxp.com>
2025-03-20 13:23:54 +08:00
Jason Liu
f1bcbacde1 This is the 6.6.52 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmbrDMgACgkQONu9yGCS
 aT68BA/7BBhU3hpHgh4SXEZyUDoz2dh/OTh3ycwz3KoXHZUrxhVN+skyZ2rFzAZs
 myBwKACF7FBxsNx/XT3257AlgOGjsUHn6aDklQ99Km/f7NQ4ueZb1GA0YGS2CraZ
 NfzpnR07fb6ydI7CF7xh9eCEe+k6pMOYlDe5xy82xZTAOk3LyY6TZBcydzfgjp3g
 oO0wObgVN/veFosqBmKnTQ8L8+YgRt8z29Y0aew6ay2y8xFDamcvD4qcX0Ys6c5z
 nozTDmZmIzI6457PMyqjSQ+80WxQEV5482w8e+fKVrLPeDzVINMPv2Jidz6E57Yr
 8kuwUBJFlh3dFtjTU4wCa95mztezLEqm02iw+8TnjoJZcIWrl6MuHHNIqzznEvwn
 CMdM5IoSLTkseQNwZZL5G6hBOIQGde+onUCA4+1QYcxKbP3AYjfg9RhEvs7RrW7A
 7bwS/EUnAvXwM6ULSit0GQE1KanK67dKuTNa3AJJamRELQLH0PlWNw8a5bQdBzUf
 emPIloMVbi6SALJrSwe3IARAHdi4TiavM4eHPeZK2oQn1p3PRDfOD2/KN0RsUq9P
 o2ORcGyUYuQQzhxur2Y6FBFljDczVMnro6QfVeXPjk33qEDYnKP7GT0gvgSFJ+r5
 FH6z8JZVvduPgX8Kn/ZbLih4um/R1xEd+a8fQijzVMAu/C/YjBc=
 =l9D8
 -----END PGP SIGNATURE-----

Merge tag 'v6.6.52' into lf-6.6.y

This is the 6.6.52 stable release

* tag 'v6.6.52': (90 commits)
  Linux 6.6.52
  riscv: dts: starfive: add assigned-clock* to limit frquency
  ASoC: meson: axg-card: fix 'use-after-free'
  ...
2024-09-24 11:50:01 +08:00
Jason Liu
239f62168d This is the 6.6.51 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmbisF0ACgkQONu9yGCS
 aT5Y8xAAqS/rmrC+/qlFvbtAqK+KXLq9BIGvDHW2QHfCyMpSZ6isehVhh64apHE/
 /XvJ6a+2iPVp5o52iDTUKzbcDr3Jx/QwhS8Xa/HyQQy1rXIPpJNJb8Vuvkn/B2Cq
 cPCfTtfPZUUQTd09uAdBhy5NT8hsT2kSVpmSXDnahn9ih8k0tR40udw5Qf7xpWcf
 HqljbfonLP86mF/SB9m+VhDGF9fekujyb+0iS0OPE+TdvSjKB9ySoeL4PIeTSxrz
 goZdp9ygAYy8Bks825ztbfQszqIwceHU/xZRaUrGfOOk4A5kwTmbdUQu7ooMc+5F
 kbpifbewmY1UGn2KTxgj59xCjQ7HLQe+sqacy0/gALzRSajUNyjLn0n4w3UqaJWb
 pf+gwqHBLgDRfvWctggEdY2ApKgOlM9D7TTpWWB9uv1oR/g3PGfgehZgrMMPgPUw
 EZ8JiwnITfRaRFiH/vSR3aJKRj6qjb4mX3/U8HgGcACtyFfHgtuI7jzhnX36fRNO
 FG38bxSUMrJnlohghfBl6zyaruZBMHVaoQzs6MYZ7qrVvCbt3CHivJdaQ85nw0h7
 YHa2zYFfT0ztyaSMzWq6JatgI7BZfd8PjobhbRZADBBD39KC8aL8XLoDPnpzWMUY
 UDlK8n96gOKo0t8ILDWcIisCVGNogcHJlGppC8Fu7ZyKzYsMhN4=
 =OEL/
 -----END PGP SIGNATURE-----

Merge tag 'v6.6.51' into lf-6.6.y

This is the 6.6.51 stable release

* tag 'v6.6.51': (2369 commits)
  Linux 6.6.51
  Bluetooth: hci_sync: Fix UAF on hci_abort_conn_sync
  Bluetooth: hci_sync: Fix UAF on create_le_conn_complete
  ...

Signed-off-by: Jason Liu <jason.hui.liu@nxp.com>

 Conflicts:
	arch/arm64/boot/dts/freescale/imx8mp.dtsi
	arch/arm64/boot/dts/freescale/imx93.dtsi
	drivers/dma/fsl-edma-common.c
	drivers/dma/fsl-edma-common.h
	drivers/dma/fsl-edma.c
	drivers/irqchip/irq-imx-irqsteer.c
	drivers/perf/fsl_imx9_ddr_perf.c
	drivers/spi/spi-fsl-lpspi.c
	sound/soc/sof/imx/imx8m.c
2024-09-24 11:49:41 +08:00
John Thomson
2278629c3e nvmem: u-boot-env: error if NVMEM device is too small
[ Upstream commit 8679e8b4a1 ]

Verify data size before trying to parse it to avoid reading out of
buffer. This could happen in case of problems at MTD level or invalid DT
bindings.

Signed-off-by: John Thomson <git@johnthomson.fastmail.com.au>
Cc: stable <stable@kernel.org>
Fixes: d5542923f2 ("nvmem: add driver handling U-Boot environment variables")
[rmilecki: simplify commit description & rebase]
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20240902142510.71096-2-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-09-18 19:24:04 +02:00
Rafał Miłecki
368fa77b79 nvmem: u-boot-env: improve coding style
[ Upstream commit 6bafe07c93 ]

1. Prefer kzalloc() over kcalloc()
   See memory-allocation.rst which says: "to be on the safe side it's
   best to use routines that set memory to zero, like kzalloc()"
2. Drop dev_err() for u_boot_env_add_cells() fail
   It can fail only on -ENOMEM. We don't want to print error then.
3. Add extra "crc32_addr" variable
   It makes code reading header's crc32 easier to understand / review.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20231221173421.13737-5-zajec5@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Stable-dep-of: 8679e8b4a1 ("nvmem: u-boot-env: error if NVMEM device is too small")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-09-18 19:24:04 +02:00
Rafał Miłecki
2eea394c31 nvmem: u-boot-env: use nvmem device helpers
[ Upstream commit a832556d23 ]

Use nvmem_dev_size() and nvmem_device_read() to make this driver less
mtd dependent.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20231221173421.13737-4-zajec5@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Stable-dep-of: 8679e8b4a1 ("nvmem: u-boot-env: error if NVMEM device is too small")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-09-18 19:24:04 +02:00
Rafał Miłecki
ae91c9c7b6 nvmem: u-boot-env: use nvmem_add_one_cell() nvmem subsystem helper
[ Upstream commit 7c8979b42b ]

Simplify adding NVMEM cells.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20231221173421.13737-3-zajec5@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Stable-dep-of: 8679e8b4a1 ("nvmem: u-boot-env: error if NVMEM device is too small")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-09-18 19:24:04 +02:00
Rafał Miłecki
820b1b981a nvmem: core: add nvmem_dev_size() helper
[ Upstream commit 33cf42e68e ]

This is required by layouts that need to read whole NVMEM content. It's
especially useful for NVMEM devices without hardcoded layout (like
U-Boot environment data block).

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20231221173421.13737-2-zajec5@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Stable-dep-of: 8679e8b4a1 ("nvmem: u-boot-env: error if NVMEM device is too small")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-09-18 19:24:04 +02:00
Geert Uytterhoeven
3d1baf322a nvmem: Fix return type of devm_nvmem_device_get() in kerneldoc
commit c69f37f655 upstream.

devm_nvmem_device_get() returns an nvmem device, not an nvmem cell.

Fixes: e2a5402ec7 ("nvmem: Add nvmem_device based consumer apis.")
Cc: stable <stable@kernel.org>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20240902142510.71096-3-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-09-12 11:11:41 +02:00
Heiko Stuebner
846ee3b60a nvmem: rockchip-otp: set add_legacy_fixed_of_cells config option
[ Upstream commit 2933e79db3 ]

The Rockchip OTP describes its layout via devicetree subnodes,
so set the appropriate property.

Fixes: 2cc3b37f5b ("nvmem: add explicit config option to read old syntax fixed OF cells")
Signed-off-by: Heiko Stuebner <heiko.stuebner@cherry.de>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20240705074852.423202-5-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-08-03 08:54:01 +02:00
Thomas Weißschuh
c01f9a6461 nvmem: core: only change name to fram for current attribute
commit 0ba424c934 upstream.

bin_attr_nvmem_eeprom_compat is the template from which all future
compat attributes are created.
Changing it means to change all subsquent compat attributes, too.

Instead only use the "fram" name for the currently registered attribute.

Fixes: fd307a4ad3 ("nvmem: prepare basics for FRAM support")
Cc: stable@vger.kernel.org
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20240628113704.13742-4-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-07-18 13:21:21 +02:00
Joy Chakraborty
c3debec577 nvmem: meson-efuse: Fix return value of nvmem callbacks
commit 7a0a6d0a7c upstream.

Read/write callbacks registered with nvmem core expect 0 to be returned
on success and a negative value to be returned on failure.

meson_efuse_read() and meson_efuse_write() call into
meson_sm_call_read() and meson_sm_call_write() respectively which return
the number of bytes read or written on success as per their api
description.

Fix to return error if meson_sm_call_read()/meson_sm_call_write()
returns an error else return 0.

Fixes: a29a63bdaf ("nvmem: meson-efuse: simplify read callback")
Cc: stable@vger.kernel.org
Signed-off-by: Joy Chakraborty <joychakr@google.com>
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20240628113704.13742-3-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-07-18 13:21:21 +02:00
Joy Chakraborty
5f97b616e2 nvmem: rmem: Fix return value of rmem_read()
commit 28b008751a upstream.

reg_read() callback registered with nvmem core expects 0 on success and
a negative value on error but rmem_read() returns the number of bytes
read which is treated as an error at the nvmem core.

This does not break when rmem is accessed using sysfs via
bin_attr_nvmem_read()/write() but causes an error when accessed from
places like nvmem_access_with_keepouts(), etc.

Change to return 0 on success and error in case
memory_read_from_buffer() returns an error or -EIO if bytes read do not
match what was requested.

Fixes: 5a3fa75a4d ("nvmem: Add driver to expose reserved memory as nvmem")
Cc: stable@vger.kernel.org
Signed-off-by: Joy Chakraborty <joychakr@google.com>
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20240628113704.13742-2-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-07-18 13:21:21 +02:00
Pengfei Li
3354fe3506 LF-12894 nvmem: imx-ocotp-fsb: Add a flag to read old syntax fixed OF cells
Add a flag to enable binding for fixed NVMEM cells defined directly
as subnodes of the NVMEM device.

Signed-off-by: Pengfei Li <pengfei.li_1@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
2024-07-15 14:26:06 +08:00
Jason Liu
21efea47c1 This is the 6.6.34 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmZu0U0ACgkQONu9yGCS
 aT4c2Q//SGn9+yEUml1/7nQUTND434ly4JPMdrR1jjJSKwxAsgzOYKCoUpzpXim8
 7mdKz7q1cXx/l+tfJgEDdJ8JzVS6ipJWAwF4vE+18zWZjEax/M3dgluZUUswXKYg
 Da76wSaNkfGiIewu8HV90LKAKaQoCR4ypyWG8CqDZkCnGJORUJA09GNDrKFhOodT
 f0TzjIvPw8E3rU2+HZfPmxUI0XQEzfVPWb5DK+0F7hcHw4ETcij7y0AInBkQ5bNt
 tFRCc462nT23e3jXJECWMbSXdRF57LlT8G9626Om0iS+TY7YD6PPNa7/bdqVHzcw
 hDmKE+xONslwvuzkYn2R9u+nc/dw/hJ8QI5j9QohbJCcXjcv8N3QeXoiLPjiDxxv
 1JVVi6emyKvKx26kjY/m0ZTZ/QWWwQlj/+R8Or/yIMMYZvPwyBUX3I8cZIQhyAg4
 n/fc2tFqmax0K6e9YOXj3sa+OlXx02DAC8oVToNrSS7HT5uhtoKT4vU1d+et2alo
 dFJAhklt27k+eV+Ayxo+RUaxUVggM0MAB67S7XUR0kylP2BeL2l9wMKVzZz2V5T4
 O9PHY1RpD8OGk7aZvlbZYIis7LBqVTXcaEB4l5QtSYM4RMON4BYb5QLEc0jYywzV
 U7GMNiKhhuwEHjiPD0cIXyeWeQzTlH9os5lhW8moVY9mtthGlr0=
 =zdH0
 -----END PGP SIGNATURE-----

Merge tag 'v6.6.34' into lf-6.6.y

This is the 6.6.34 stable release

* tag 'v6.6.34': (2530 commits)
  Linux 6.6.34
  smp: Provide 'setup_max_cpus' definition on UP too
  selftests: net: more strict check in net_helper
  ...

Signed-off-by: Jason Liu <jason.hui.liu@nxp.com>

 Conflicts:
	arch/arm64/boot/dts/freescale/imx8-ss-conn.dtsi
	drivers/net/ethernet/freescale/fec_ptp.c
	drivers/pmdomain/imx/imx8mp-blk-ctrl.c
	drivers/usb/dwc3/host.c
	tools/perf/util/pmu.c
2024-06-18 17:16:08 +08:00
Rafał Miłecki
26e2fe4cab nvmem: add explicit config option to read old syntax fixed OF cells
[ Upstream commit 2cc3b37f5b ]

Binding for fixed NVMEM cells defined directly as NVMEM device subnodes
has been deprecated. It has been replaced by the "fixed-layout" NVMEM
layout binding.

New syntax is meant to be clearer and should help avoiding imprecise
bindings.

NVMEM subsystem already supports the new binding. It should be a good
idea to limit support for old syntax to existing drivers that actually
support & use it (we can't break backward compatibility!). That way we
additionally encourage new bindings & drivers to ignore deprecated
binding.

It wasn't clear (to me) if rtc and w1 code actually uses old syntax
fixed cells. I enabled them to don't risk any breakage.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
[for meson-{efuse,mx-efuse}.c]
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
[for mtk-efuse.c, nvmem/core.c, nvmem-provider.h]
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
[MT8192, MT8195 Chromebooks]
Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
[for microchip-otpc.c]
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
[SAMA7G5-EK]
Tested-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20231020105545.216052-3-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Stable-dep-of: d2d73a6dd1 ("mtd: limit OTP NVMEM cell parse to non-NAND devices")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-05-17 12:01:55 +02:00
Jerome Brunet
63c7a5cf22 nvmem: meson-efuse: fix function pointer type mismatch
[ Upstream commit cbd38332c1 ]

clang-16 warns about casting functions to incompatible types, as is done
here to call clk_disable_unprepare:

drivers/nvmem/meson-efuse.c:78:12: error: cast from 'void (*)(struct clk *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
   78 |                                        (void(*)(void *))clk_disable_unprepare,

The pattern of getting, enabling and setting a disable callback for a
clock can be replaced with devm_clk_get_enabled(), which also fixes
this warning.

Fixes: 611fbca1c8 ("nvmem: meson-efuse: add peripheral clock")
Cc: Stable@vger.kernel.org
Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Justin Stitt <justinstitt@google.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20240224114023.85535-2-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-04-03 15:28:28 +02:00
Peng Fan
e4bb417122 LF-11560-2 nvmem: imx-ocotp-fsb: support program fuse for i.MX93/95
Add program fuse support for i.MX93/95

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Sebastien Haezebrouck <sebastien.haezebrouck@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2024-04-01 14:04:08 +08:00
Jason Liu
8eb8dd316c This is the 6.6.20 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAmXjYIIACgkQONu9yGCS
 aT5mvw/9GnG2BWbZp9BgVzBnT00CXnIpiGlsoSU0I0Uiso3XqpNYBu7jIZ+vmsqz
 3H2bpkToEwJgg40I+w3iRaY84FWJZtl6HWtXydVQghQzXdA7qSuKBmbqQdUGKqZq
 Uqy7SFabkqQmlmF+RX1tYsgj7Vg3tqThERLUKQRhZIRa+Xek6Izi16RKEXcBNoXv
 vN+Q6AJ6vgjzHdw/UndsTH48bA/NofLlGapf7ZRGaSO7vY6bO5N23Xeg8gBIUh3M
 RHYf0ubKOvOw6LfZrE8BAbLd9Om2IHRAwHTqvDUNaIOl6y7exwCCIMK2lDdlzQ3W
 7gug4HzlQjVz93OtL8MjLnfINOO7en65gyqvwit9N7O7nJKvuIMtt5vVam+h4ikB
 xF/QmFj95GNeRLwBmOJxOS89KyC8BrjE3PfYtL1mUO9joH8vZBccon6WIV7C2u5M
 d+0UglxC4lNTJ3s3FcnrzEKCn5YaE8WvFYQX0xvFQL3GWGDkyrNaafqoz19a8yd2
 ndf3xUh5QKYWI2UGhqV6FdfYC9BolEh/niMKrJYCEJ6BroO3nzh1L8keC+MHbJwp
 Yuu9FCT+vNDKfR/HQwUhUGX/3wyBKb8jqzDXUB2s4FLPUSBX+/RAso13FWua1TGd
 E432ZXaobuUx3+kHsqB+0dc99QVblnMFMPEoM4ye3lYHzq8PDJ0=
 =7IL4
 -----END PGP SIGNATURE-----

Merge tag 'v6.6.20' into lf-6.6.y

This is the 6.6.20 stable release

* tag 'v6.6.20': (3154 commits)
  Linux 6.6.20
  fs/ntfs3: fix build without CONFIG_NTFS3_LZX_XPRESS
  Linux 6.6.19
  ...

Signed-off-by: Jason Liu <jason.hui.liu@nxp.com>

 Conflicts:
	arch/arm64/boot/dts/freescale/imx8mm.dtsi
	arch/arm64/boot/dts/freescale/imx8mq.dtsi
	drivers/clk/imx/clk-imx8qxp.c
	drivers/dma/fsl-edma.c
	drivers/firmware/arm_scmi/perf.c
	drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
	drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c
	drivers/net/ethernet/freescale/fec_main.c
	drivers/scsi/scsi_error.c
	drivers/spi/spi-imx.c
	sound/soc/fsl/fsl_sai.c
2024-03-11 14:59:44 +08:00
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
Miquel Raynal
a05c646d3c nvmem: Do not expect fixed layouts to grab a layout driver
commit b7c1e53751 upstream.

Two series lived in parallel for some time, which led to this situation:
- The nvmem-layout container is used for dynamic layouts
- We now expect fixed layouts to also use the nvmem-layout container but
this does not require any additional driver, the support is built-in the
nvmem core.

Ensure we don't refuse to probe for wrong reasons.

Fixes: 27f699e578 ("nvmem: core: add support for fixed cells *layout*")
Cc: stable@vger.kernel.org
Reported-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Tested-by: Rafał Miłecki <rafal@milecki.pl>
Tested-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Link: https://lore.kernel.org/r/20231124193814.360552-1-miquel.raynal@bootlin.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-12-13 18:45:31 +01:00
Clark Wang
acc1d905aa LF-10932-2 nvmem: imx95: add the support to return the mac addr of PFs
The 3 PFs of imx95 use 9 mac addresses, but only saves one mac base
address in fuse, which is the mac address of the first PF. The others
PF mac addresses need to be calculated through offsets.
According to the ocotp framework, adding the PF offset to bits 15~12 of
offset. This will not affect the dts node setting of other fuse devices.
In imx95, the value range of offset is 0~0x984.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
Reviewed-by: Alice Guo <alice.guo@nxp.com>
Reviewed-by: Wei Fang <wei.fang@nxp.com>
2023-12-12 16:06:37 +08:00
Alice Guo
195d1a64dd LF-10610-3 nvmem: imx95: add i.MX95 fuse read driver
Add i.MX95 fuse read driver.

Signed-off-by: Alice Guo <alice.guo@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
2023-11-17 18:30:26 +08:00
Alice Guo
c072e99dec LF-10365 nvmem: imx: i.MX8ULP: update fsb_bank_reg of imx8ulp_fsb_s400_hw
Values of bank 5 fuses are in FUSE64 - FUSE71, and Values of bank 6
fuses are in FUSE72 - FUSE79.

Signed-off-by: Alice Guo <alice.guo@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
2023-10-30 16:24:09 +08:00
Pankaj Gupta
e138a8c879 LF-10342: nvmem: ocotp: s400: fuse_base sent zero.
Fixes: 5db3ae5329ff (LF-10342: nvmem: ocotp: s400: ported the driver to new ele driver.

Signed-off-by: Pankaj Gupta <pankaj.gupta@nxp.com>
2023-10-30 16:24:09 +08:00
Pankaj Gupta
8295f99c6b LF-10342: nvmem: ocotp: s400: ported the driver to new ele driver.
nvmem: ocotp: s400: ported the driver to new ele driver.

Signed-off-by: Pankaj Gupta <pankaj.gupta@nxp.com>
Reviewed-by: Alice Guo <alice.guo@nxp.com>
2023-10-30 16:24:09 +08:00
Clark Wang
9f82391c13 LF-9584-1 nvmem: imx: add the function of swapping 6bytes of MAC address
The mac address stored in fuse is big endian. Only after the converted mac
address will be correct and it can be provided to the ethernet framework.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit b82483f0f8)
2023-10-30 16:24:09 +08:00
Clark Wang
4dfae4c4b3 LF-9574-1 nvmem: imx: change the unit of offset
Let offset use byte as the unit instead of word. Because some data
needs to be read from the position of the unaligned word.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit 06369e9a79)
2023-10-30 16:24:09 +08:00
Alice Guo
92ab8f3beb LF-9476-3 nvmem: imx: update i.MX93 fuse read driver
When the value of  OSCCA_FUSE_READ_DIS is 1, i.MX93 is not allowed to
access the OCOTP registers. In this case, change to use ELE API to read
fuse.

Signed-off-by: Alice Guo <alice.guo@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
2023-10-30 16:24:09 +08:00
Alice Guo
346fe29ce6 LF-9476-2 nvmem: imx: update read_common_fuse with special ID
Read_common_fuse is added a argument special_id. Currently, only 8ULP
reads OTP_UNIQ_ID with fuse_id 1 which is a special id.

Signed-off-by: Alice Guo <alice.guo@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
2023-10-30 16:24:09 +08:00
Alice Guo
9e134a8c0a LF-8021 nvmem: imx: remove information such as author name and email
It is NXP policy that NXP emails and employee names are not released
thus remove them.

Signed-off-by: Alice Guo <alice.guo@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
2023-10-30 16:24:08 +08:00
Alice Guo
abe36a4320 LF-7970 nvmem: imx: update fuse read for iMX8ULP
iMX8ULP A1 S400 FW (v0.0.8-e329b760) can support to read more fuse
banks, so update fuse read for iMX8ULP.

Signed-off-by: Alice Guo <alice.guo@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
2023-10-30 16:24:08 +08:00
Alice Guo
e8849336c2 MLK-25895-1 nvmem: imx: i.MX93 nvmem ocotp driver
This patch adds i.MX93 nvmem ocotp driver to access the fuse in i.MX93.
Sentinel have read access of OTP shadow register 0-511, and fsb have
read access of shadow 0-51/312-511.

When CONFIG_MODULES=y, driver_deferred_probe_timeout is 10, which makes
ending deferred probe depend on initcalls_done or
driver_deferred_probe_timeout. Deferred probe does not wait for its
dependent devices to probe all the time. This is likely to cause that
imx_fsb_s400_fuse_probe is not finished before calling
imx9_init_soc_probe and result in handling kernel NULL pointer
dereference fuse->hw. So put of_device_get_match_data in front of
devm_nvmem_register and initialize fuse->hw and fuse->lock earlier.

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Alice Guo <alice.guo@nxp.com>
2023-10-30 16:24:08 +08:00
Pankaj Gupta
bee04f867f nvmem: imx: enhanced base API read_common_fuses
- Added the support to invoke the base API(s) offered by
  Secure Enclave.
  -- Update the read_common_fuses to use the above
     common functions.

- Updated the base API "read_common_fuses", to take minimum arguments:
  -- fuse id, and
  -- pointer to the value, to be populated with fuse values.

- With the update in the base API "read_common_fuses", function calls
  in drivers/nvmem/imx-ocotp-fsb-s400.c, is update.
  -- depency on IMX_EL_ENCLAVE is added to drivers/nvmem/Kconfig

Signed-off-by: Pankaj Gupta <pankaj.gupta@nxp.com>
Reviewed-by: Alice Guo <alice.guo@nxp.com>
2023-10-30 16:24:08 +08:00
Alice Guo
67bf8a7ff5 LF-4523 nvmem: imx8ulp: fix the wrong position of the reserved 48 words
According to the FSB words list, the reserved 48 words are ahead of the
bank 5.

Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Alice Guo <alice.guo@nxp.com>
Acked-by: Jason Liu <jason.hui.liu@nxp.com>
2023-10-30 16:24:08 +08:00
Alice Guo
8328433e35 MLK-25246-5 nvmem: imx: i.MX8ULP nvmem ocotp driver
i.MX8ULP nvmem ocotp driver provides the services to access common fuse
through s400 baseline api and fuse status block.

Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Alice Guo <alice.guo@nxp.com>
(cherry picked from commit f221b7e283)
2023-10-30 16:24:08 +08:00
Peng Fan
9e307be5a1 MLK-24529 nvmem: ocotp: use high bus when programming/reloading fuse
There might be chance that after we calculate timing based on the ipg_clk,
but ipg_clk was changed by busfreq which cause fuse prog and shadow
reload not work stable. So let request high bus to let the ipg clk fixed
during the stage programming and reloading.

Reviewed-by: Jacky Bai <ping.bai@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
2023-10-30 16:24:08 +08:00
Peng Fan
2382c1b044 nvmem: imx: correct nregs for i.MX6ULL
The nregs for i.MX6ULL should be 80 per fuse map, correct it.

Fixes: ffbc34bf0e ("nvmem: imx-ocotp: Implement i.MX6ULL/ULZ support")
Cc: Stable@vger.kernel.org
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20231013124904.175782-4-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-16 21:00:08 +02:00
Peng Fan
7d6e10f5d2 nvmem: imx: correct nregs for i.MX6UL
The nregs for i.MX6UL should be 144 per fuse map, correct it.

Fixes: 4aa2b48020 ("nvmem: octop: Add support for imx6ul")
Cc: Stable@vger.kernel.org
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20231013124904.175782-3-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-16 21:00:08 +02:00
Peng Fan
414a98abbe nvmem: imx: correct nregs for i.MX6SLL
The nregs for i.MX6SLL should be 80 per fuse map, correct it.

Fixes: 6da27821a6 ("nvmem: imx-ocotp: add support for imx6sll")
Cc: Stable@vger.kernel.org
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20231013124904.175782-2-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-16 21:00:08 +02:00
Miquel Raynal
eb176cb461 nvmem: core: Notify when a new layout is registered
Tell listeners a new layout was introduced and is now available.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20230823132744.350618-23-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-08-23 16:34:02 +02:00
Miquel Raynal
b97400912a nvmem: core: Do not open-code existing functions
Use of_nvmem_layout_get_container() instead of hardcoding it.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Michael Walle <michael@walle.cc>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20230823132744.350618-22-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-08-23 16:34:02 +02:00
Miquel Raynal
f4d1d17e1d nvmem: core: Create all cells before adding the nvmem device
Let's pack all the cells creation in one place, so they are all created
before we add the nvmem device.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Michael Walle <michael@walle.cc>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20230823132744.350618-20-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-08-23 16:34:02 +02:00
Atul Raut
1006ebe9f1 nvmem: u-boot-env:: Replace zero-length array with DECLARE_FLEX_ARRAY() helper
We are moving toward replacing zero-length arrays with C99 flexible-array
members since they are deprecated. Therefore, the new DECLARE_FLEX_ARRAY()
helper macro should be used to replace the zero-length array declaration.

This fixes warnings such as:
./drivers/nvmem/u-boot-env.c:50:9-13: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)

Signed-off-by: Atul Raut <rauji.raut@gmail.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20230823132744.350618-19-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-08-23 16:34:02 +02:00
Komal Bajaj
c471245bd9 nvmem: sec-qfprom: Add Qualcomm secure QFPROM support
For some of the Qualcomm SoC's, it is possible that
some of the fuse regions or entire qfprom region is
protected from non-secure access. In such situations,
the OS will have to use secure calls to read the region.
With that motivation, add secure qfprom driver.

Signed-off-by: Komal Bajaj <quic_kbajaj@quicinc.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20230823132744.350618-18-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-08-23 16:34:01 +02:00
Diederik de Haas
23b7b49198 nvmem: Kconfig: Fix typo "drive" -> "driver"
Fix typo where "driver" was meant instead of "drive".
While at it, also capitalize "OTP".

Signed-off-by: Diederik de Haas <didi.debian@cknow.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20230823132744.350618-15-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-08-23 16:34:01 +02:00
Rob Herring
9bf75da0e2 nvmem: Explicitly include correct DT includes
The DT of_device.h and of_platform.h date back to the separate
of_platform_bus_type before it as merged into the regular platform bus.
As part of that merge prepping Arm DT support 13 years ago, they
"temporarily" include each other. They also include platform_device.h
and of.h. As a result, there's a pretty much random mix of those include
files used throughout the tree. In order to detangle these headers and
replace the implicit includes with struct declarations, users need to
explicitly include the correct includes.

Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20230823132744.350618-14-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-08-23 16:34:01 +02:00