Thread (18 messages) 18 messages, 5 authors, 2025-02-05

Re: [PATCH 3/4] nvmem: imx-ocotp: Support accessing controller for i.MX8M Nano

From: Frank Li <Frank.li@nxp.com>
Date: 2025-02-05 17:03:02
Also in: imx, linux-arm-kernel, lkml

On Wed, Feb 05, 2025 at 11:43:22AM -0500, Frank Li wrote:
On Wed, Feb 05, 2025 at 07:51:23AM +0100, Alexander Stein wrote:
quoted
Am Freitag, 31. Januar 2025, 17:06:23 CET schrieb Frank Li:
quoted
On Fri, Jan 31, 2025 at 02:54:06PM +0100, Alexander Stein wrote:
quoted
Hi,

Am Donnerstag, 30. Januar 2025, 17:42:32 CET schrieb Frank Li:
quoted
On Thu, Jan 30, 2025 at 02:01:00PM +0100, Alexander Stein wrote:
quoted
i.MX8M OCOTP supports a specific peripheral or function being fused
which means disabled, so
 - Introduce disable_fuse for a list of possible fused peripherals.
 - Iterate all nodes to check accessing permission. If not
   allowed to be accessed, detach the node

Signed-off-by: Alexander Stein <redacted>
---
 drivers/nvmem/Kconfig     |   3 ++
 drivers/nvmem/imx-ocotp.c | 105 +++++++++++++++++++++++++++++++++++++-
 2 files changed, 107 insertions(+), 1 deletion(-)
...
quoted
quoted
quoted
multiples fuses for disables. This is an excerpt from imx8mp WIP
quoted
struct disable_fuse imx8mp_disable_fuse[] = {
	[IMX8MP_OCOTP_CAN_DISABLE]		= { .fuse_addr = 16, .mask = BIT(28) },
	[IMX8MP_OCOTP_CAN_FD_DISABLE]		= { .fuse_addr = 16, .mask = BIT(29) },
	[IMX8MP_OCOTP_VPU_VC8000E_DISABLE]	= { .fuse_addr = 16, .mask = BIT(30) },
	[IMX8MP_OCOTP_IMG_ISP1_DISABLE]		= { .fuse_addr = 20, .mask = BIT(0) },
	[IMX8MP_OCOTP_IMG_ISP2_DISABLE]		= { .fuse_addr = 20, .mask = BIT(1) },
	[IMX8MP_OCOTP_IMG_DEWARP_DISABLE]	= { .fuse_addr = 20, .mask = BIT(2) },
};
Notice the fuse_addr of 16 and 20.
Yes, I am not sure if it good idea to encode fuse_addr to IMX8MP_OCOTP_CAN_DISABLE

like

#define IMX8MP_OCOTP_CAN_DISABLE  16 << 16 | BIT(28)

So dt-bindings/nvmem/fsl,imx8mn-ocotp.h can be moved to dts directory.
Mh, I personally don't like encoding offsets into bits. How about using
quoted
'#access-controller-cells = <2>'
and using the defines like this
quoted
#define IMX8MP_OCOTP_CAN_DISABLE  16 0x10000000
I think it is good. better told peng fan to align this!
It'd better use bit offset directly. such as

#define IMX8MP_OCOTP_CAN_DISABLE  16 28

So binding doc easy to limit it to 0..31.

Frank
Frank
quoted
DT stays the same:
quoted
access-controllers = <&ocotp IMX8MP_OCOTP_CAN_DISABLE>;
Note: It seems BIT(x) is not usable in DT.

Best regards,
Alexander
--
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help