Re: [PATCH v7 2/2] nvmem: imx-ocotp-ele: Support accessing controller for i.MX9

From: Christophe JAILLET
Date: Sun Feb 02 2025 - 04:04:50 EST


Le 02/02/2025 à 01:49, Peng Fan (OSS) a écrit :
From: Peng Fan <peng.fan-3arQi8VN3Tc@xxxxxxxxxxxxxxxx>

i.MX9 OCOTP supports a specific peripheral or function being fused
which means disabled, so
- Introduce ocotp_access_gates to be container of efuse gate info
- Iterate all nodes to check accessing permission. If not
allowed to be accessed, detach the node
...

+struct access_gate {
+ u32 word;
+ u32 mask;
+};
+
+struct ocotp_access_gates {
+ u32 num_words;
+ u32 words[OCOTP_MAX_NUM_GATE_WORDS];
+ u32 num_gates;
+ struct access_gate *gates;

Could be const.

+};
+
struct imx_ocotp_priv {
struct device *dev;
void __iomem *base;

...

+
+ return imx_ele_ocotp_access_control(priv);
}
+struct access_gate imx93_access_gate[] = {

Could be static const.

+ [IMX93_OCOTP_NPU_GATE] = { .word = 19, .mask = BIT(13) },
+ [IMX93_OCOTP_A550_GATE] = { .word = 19, .mask = BIT(14) },
+ [IMX93_OCOTP_A551_GATE] = { .word = 19, .mask = BIT(15) },

...

@@ -183,7 +308,53 @@ static const struct ocotp_devtype_data imx93_ocotp_data = {
},
};
+struct access_gate imx95_access_gate[] = {

Could be static const.

+ [IMX95_OCOTP_CANFD1_GATE] = { .word = 17, .mask = BIT(20) },
+ [IMX95_OCOTP_CANFD2_GATE] = { .word = 17, .mask = BIT(21) },
+ [IMX95_OCOTP_CANFD3_GATE] = { .word = 17, .mask = BIT(22) },

...

CJ