2021-12-09 17:42:49

by Srinivas Kandagatla

[permalink] [raw]
Subject: [PATCH 0/4] nvmem: patches (set 1) for 5.17

Here are some nvmem patches for 5.17 mostly bindings updates and update in mtk-fuse
to support one byte access.

Can you please queue them up for 5.17.

thanks for you help,
srini

Chunfeng Yun (3):
dt-bindings: nvmem: mediatek: add support bits property
dt-bindings: nvmem: mediatek: add support for mt8195
nvmem: mtk-efuse: support minimum one byte access stride and
granularity

Rob Herring (1):
dt-bindings: nvmem: Add missing 'reg' property

.../devicetree/bindings/nvmem/brcm,nvram.yaml | 3 +++
.../devicetree/bindings/nvmem/mtk-efuse.txt | 2 ++
Documentation/devicetree/bindings/nvmem/rmem.yaml | 3 +++
.../devicetree/bindings/nvmem/st,stm32-romem.yaml | 3 +++
drivers/nvmem/mtk-efuse.c | 13 +++++++------
5 files changed, 18 insertions(+), 6 deletions(-)

--
2.21.0



2021-12-09 17:42:51

by Srinivas Kandagatla

[permalink] [raw]
Subject: [PATCH 1/4] dt-bindings: nvmem: mediatek: add support bits property

From: Chunfeng Yun <[email protected]>

Add support bits property, will satisfy more consumers.

Signed-off-by: Chunfeng Yun <[email protected]>
Acked-by: Rob Herring <[email protected]>
Signed-off-by: Srinivas Kandagatla <[email protected]>
---
Documentation/devicetree/bindings/nvmem/mtk-efuse.txt | 1 +
1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/nvmem/mtk-efuse.txt b/Documentation/devicetree/bindings/nvmem/mtk-efuse.txt
index b6791702bcfc..ec70c5b7a340 100644
--- a/Documentation/devicetree/bindings/nvmem/mtk-efuse.txt
+++ b/Documentation/devicetree/bindings/nvmem/mtk-efuse.txt
@@ -10,6 +10,7 @@ Required properties:
"mediatek,mt8192-efuse", "mediatek,efuse": for MT8192
"mediatek,mt8516-efuse", "mediatek,efuse": for MT8516
- reg: Should contain registers location and length
+- bits: contain the bits range by offset and size

= Data cells =
Are child nodes of MTK-EFUSE, bindings of which as described in
--
2.21.0


2021-12-09 17:42:53

by Srinivas Kandagatla

[permalink] [raw]
Subject: [PATCH 2/4] dt-bindings: nvmem: mediatek: add support for mt8195

From: Chunfeng Yun <[email protected]>

Add compatible for mt8195

Signed-off-by: Chunfeng Yun <[email protected]>
Acked-by: Rob Herring <[email protected]>
Signed-off-by: Srinivas Kandagatla <[email protected]>
---
Documentation/devicetree/bindings/nvmem/mtk-efuse.txt | 1 +
1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/nvmem/mtk-efuse.txt b/Documentation/devicetree/bindings/nvmem/mtk-efuse.txt
index ec70c5b7a340..39d529599444 100644
--- a/Documentation/devicetree/bindings/nvmem/mtk-efuse.txt
+++ b/Documentation/devicetree/bindings/nvmem/mtk-efuse.txt
@@ -8,6 +8,7 @@ Required properties:
"mediatek,mt7623-efuse", "mediatek,efuse": for MT7623
"mediatek,mt8173-efuse" or "mediatek,efuse": for MT8173
"mediatek,mt8192-efuse", "mediatek,efuse": for MT8192
+ "mediatek,mt8195-efuse", "mediatek,efuse": for MT8195
"mediatek,mt8516-efuse", "mediatek,efuse": for MT8516
- reg: Should contain registers location and length
- bits: contain the bits range by offset and size
--
2.21.0


2021-12-09 17:42:57

by Srinivas Kandagatla

[permalink] [raw]
Subject: [PATCH 3/4] nvmem: mtk-efuse: support minimum one byte access stride and granularity

From: Chunfeng Yun <[email protected]>

In order to support nvmem bits property, should support minimum 1 byte
read stride and minimum 1 byte read granularity at the same time.

Signed-off-by: Chunfeng Yun <[email protected]>
Signed-off-by: Srinivas Kandagatla <[email protected]>
---
drivers/nvmem/mtk-efuse.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/nvmem/mtk-efuse.c b/drivers/nvmem/mtk-efuse.c
index 6a537d959f14..e9a375dd84af 100644
--- a/drivers/nvmem/mtk-efuse.c
+++ b/drivers/nvmem/mtk-efuse.c
@@ -19,11 +19,12 @@ static int mtk_reg_read(void *context,
unsigned int reg, void *_val, size_t bytes)
{
struct mtk_efuse_priv *priv = context;
- u32 *val = _val;
- int i = 0, words = bytes / 4;
+ void __iomem *addr = priv->base + reg;
+ u8 *val = _val;
+ int i;

- while (words--)
- *val++ = readl(priv->base + reg + (i++ * 4));
+ for (i = 0; i < bytes; i++, val++)
+ *val = readb(addr + i);

return 0;
}
@@ -45,8 +46,8 @@ static int mtk_efuse_probe(struct platform_device *pdev)
if (IS_ERR(priv->base))
return PTR_ERR(priv->base);

- econfig.stride = 4;
- econfig.word_size = 4;
+ econfig.stride = 1;
+ econfig.word_size = 1;
econfig.reg_read = mtk_reg_read;
econfig.size = resource_size(res);
econfig.priv = priv;
--
2.21.0


2021-12-09 17:43:18

by Srinivas Kandagatla

[permalink] [raw]
Subject: [PATCH 4/4] dt-bindings: nvmem: Add missing 'reg' property

From: Rob Herring <[email protected]>

With 'unevaluatedProperties' support implemented, the following warnings
are generated in the nvmem examples:

Documentation/devicetree/bindings/nvmem/st,stm32-romem.example.dt.yaml: efuse@1fff7800: Unevaluated properties are not allowed ('reg' was unexpected)
Documentation/devicetree/bindings/nvmem/rmem.example.dt.yaml: nvram@10000000: Unevaluated properties are not allowed ('reg' was unexpected)
Documentation/devicetree/bindings/nvmem/brcm,nvram.example.dt.yaml: nvram@1eff0000: Unevaluated properties are not allowed ('reg' was unexpected)

Add the missing 'reg' property definition.

Cc: Srinivas Kandagatla <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Rafał Miłecki <[email protected]>
Cc: Saenz Julienne <[email protected]>
Cc: Fabrice Gasnier <[email protected]>
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Rob Herring <[email protected]>
Reviewed-by: Fabrice Gasnier <[email protected]>
Reviewed-by: Thierry Reding <[email protected]>
Signed-off-by: Srinivas Kandagatla <[email protected]>
---
Documentation/devicetree/bindings/nvmem/brcm,nvram.yaml | 3 +++
Documentation/devicetree/bindings/nvmem/rmem.yaml | 3 +++
Documentation/devicetree/bindings/nvmem/st,stm32-romem.yaml | 3 +++
3 files changed, 9 insertions(+)

diff --git a/Documentation/devicetree/bindings/nvmem/brcm,nvram.yaml b/Documentation/devicetree/bindings/nvmem/brcm,nvram.yaml
index 58ff6b0bdb1a..8c3f0cd22821 100644
--- a/Documentation/devicetree/bindings/nvmem/brcm,nvram.yaml
+++ b/Documentation/devicetree/bindings/nvmem/brcm,nvram.yaml
@@ -24,6 +24,9 @@ properties:
compatible:
const: brcm,nvram

+ reg:
+ maxItems: 1
+
unevaluatedProperties: false

examples:
diff --git a/Documentation/devicetree/bindings/nvmem/rmem.yaml b/Documentation/devicetree/bindings/nvmem/rmem.yaml
index 1d85a0a30846..a4a755dcfc43 100644
--- a/Documentation/devicetree/bindings/nvmem/rmem.yaml
+++ b/Documentation/devicetree/bindings/nvmem/rmem.yaml
@@ -19,6 +19,9 @@ properties:
- raspberrypi,bootloader-config
- const: nvmem-rmem

+ reg:
+ maxItems: 1
+
no-map:
$ref: /schemas/types.yaml#/definitions/flag
description:
diff --git a/Documentation/devicetree/bindings/nvmem/st,stm32-romem.yaml b/Documentation/devicetree/bindings/nvmem/st,stm32-romem.yaml
index a48c8fa56bce..448a2678dc62 100644
--- a/Documentation/devicetree/bindings/nvmem/st,stm32-romem.yaml
+++ b/Documentation/devicetree/bindings/nvmem/st,stm32-romem.yaml
@@ -24,6 +24,9 @@ properties:
- st,stm32f4-otp
- st,stm32mp15-bsec

+ reg:
+ maxItems: 1
+
patternProperties:
"^.*@[0-9a-f]+$":
type: object
--
2.21.0