All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chunfeng Yun <chunfeng.yun@mediatek.com>
To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
	Rob Herring <robh+dt@kernel.org>, Vinod Koul <vkoul@kernel.org>
Cc: Matthias Brugger <matthias.bgg@gmail.com>,
	Chunfeng Yun <chunfeng.yun@mediatek.com>,
	Kishon Vijay Abraham I <kishon@ti.com>,
	<devicetree@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-mediatek@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <linux-phy@lists.infradead.org>,
	Eddie Hung <eddie.hung@mediatek.com>,
	Andrew-CT Chen <andrew-ct.chen@mediatek.com>,
	Yz Wu <yz.wu@mediatek.com>
Subject: [PATCH 3/6] nvmem: mtk-efuse: support minimum one byte access stride and granularity
Date: Sun, 7 Nov 2021 15:56:43 +0800	[thread overview]
Message-ID: <20211107075646.4366-3-chunfeng.yun@mediatek.com> (raw)
In-Reply-To: <20211107075646.4366-1-chunfeng.yun@mediatek.com>

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 <chunfeng.yun@mediatek.com>
---
 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.18.0


WARNING: multiple messages have this Message-ID (diff)
From: Chunfeng Yun <chunfeng.yun@mediatek.com>
To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
	Rob Herring <robh+dt@kernel.org>, Vinod Koul <vkoul@kernel.org>
Cc: Matthias Brugger <matthias.bgg@gmail.com>,
	Chunfeng Yun <chunfeng.yun@mediatek.com>,
	Kishon Vijay Abraham I <kishon@ti.com>,
	<devicetree@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-mediatek@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <linux-phy@lists.infradead.org>,
	Eddie Hung <eddie.hung@mediatek.com>,
	Andrew-CT Chen <andrew-ct.chen@mediatek.com>,
	Yz Wu <yz.wu@mediatek.com>
Subject: [PATCH 3/6] nvmem: mtk-efuse: support minimum one byte access stride and granularity
Date: Sun, 7 Nov 2021 15:56:43 +0800	[thread overview]
Message-ID: <20211107075646.4366-3-chunfeng.yun@mediatek.com> (raw)
In-Reply-To: <20211107075646.4366-1-chunfeng.yun@mediatek.com>

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 <chunfeng.yun@mediatek.com>
---
 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.18.0


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

WARNING: multiple messages have this Message-ID (diff)
From: Chunfeng Yun <chunfeng.yun@mediatek.com>
To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
	Rob Herring <robh+dt@kernel.org>, Vinod Koul <vkoul@kernel.org>
Cc: Matthias Brugger <matthias.bgg@gmail.com>,
	Chunfeng Yun <chunfeng.yun@mediatek.com>,
	Kishon Vijay Abraham I <kishon@ti.com>,
	<devicetree@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-mediatek@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <linux-phy@lists.infradead.org>,
	Eddie Hung <eddie.hung@mediatek.com>,
	Andrew-CT Chen <andrew-ct.chen@mediatek.com>,
	Yz Wu <yz.wu@mediatek.com>
Subject: [PATCH 3/6] nvmem: mtk-efuse: support minimum one byte access stride and granularity
Date: Sun, 7 Nov 2021 15:56:43 +0800	[thread overview]
Message-ID: <20211107075646.4366-3-chunfeng.yun@mediatek.com> (raw)
In-Reply-To: <20211107075646.4366-1-chunfeng.yun@mediatek.com>

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 <chunfeng.yun@mediatek.com>
---
 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.18.0


-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

WARNING: multiple messages have this Message-ID (diff)
From: Chunfeng Yun <chunfeng.yun@mediatek.com>
To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
	Rob Herring <robh+dt@kernel.org>, Vinod Koul <vkoul@kernel.org>
Cc: Matthias Brugger <matthias.bgg@gmail.com>,
	Chunfeng Yun <chunfeng.yun@mediatek.com>,
	Kishon Vijay Abraham I <kishon@ti.com>,
	<devicetree@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-mediatek@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <linux-phy@lists.infradead.org>,
	Eddie Hung <eddie.hung@mediatek.com>,
	Andrew-CT Chen <andrew-ct.chen@mediatek.com>,
	Yz Wu <yz.wu@mediatek.com>
Subject: [PATCH 3/6] nvmem: mtk-efuse: support minimum one byte access stride and granularity
Date: Sun, 7 Nov 2021 15:56:43 +0800	[thread overview]
Message-ID: <20211107075646.4366-3-chunfeng.yun@mediatek.com> (raw)
In-Reply-To: <20211107075646.4366-1-chunfeng.yun@mediatek.com>

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 <chunfeng.yun@mediatek.com>
---
 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.18.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2021-11-07  7:57 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-07  7:56 [PATCH 1/6] dt-bindings: nvmem: mediatek: add support bits property Chunfeng Yun
2021-11-07  7:56 ` Chunfeng Yun
2021-11-07  7:56 ` Chunfeng Yun
2021-11-07  7:56 ` Chunfeng Yun
2021-11-07  7:56 ` [PATCH 2/6] dt-bindings: nvmem: mediatek: add support for mt8195 Chunfeng Yun
2021-11-07  7:56   ` Chunfeng Yun
2021-11-07  7:56   ` Chunfeng Yun
2021-11-07  7:56   ` Chunfeng Yun
2021-11-12 22:41   ` Rob Herring
2021-11-12 22:41     ` Rob Herring
2021-11-12 22:41     ` Rob Herring
2021-11-12 22:41     ` Rob Herring
2021-11-19 17:18   ` Srinivas Kandagatla
2021-11-19 17:18     ` Srinivas Kandagatla
2021-11-19 17:18     ` Srinivas Kandagatla
2021-11-19 17:18     ` Srinivas Kandagatla
2021-11-07  7:56 ` Chunfeng Yun [this message]
2021-11-07  7:56   ` [PATCH 3/6] nvmem: mtk-efuse: support minimum one byte access stride and granularity Chunfeng Yun
2021-11-07  7:56   ` Chunfeng Yun
2021-11-07  7:56   ` Chunfeng Yun
2021-11-19 17:18   ` Srinivas Kandagatla
2021-11-19 17:18     ` Srinivas Kandagatla
2021-11-19 17:18     ` Srinivas Kandagatla
2021-11-19 17:18     ` Srinivas Kandagatla
2021-11-07  7:56 ` [PATCH 4/6] dt-bindings: phy: mediatek: tphy: support software efuse load Chunfeng Yun
2021-11-07  7:56   ` Chunfeng Yun
2021-11-07  7:56   ` Chunfeng Yun
2021-11-07  7:56   ` Chunfeng Yun
2021-11-12 22:42   ` Rob Herring
2021-11-12 22:42     ` Rob Herring
2021-11-12 22:42     ` Rob Herring
2021-11-12 22:42     ` Rob Herring
2021-11-19 17:18   ` Srinivas Kandagatla
2021-11-19 17:18     ` Srinivas Kandagatla
2021-11-19 17:18     ` Srinivas Kandagatla
2021-11-19 17:18     ` Srinivas Kandagatla
2021-11-22  4:05     ` Chen-Yu Tsai
2021-11-22  4:05       ` Chen-Yu Tsai
2021-11-22  4:05       ` Chen-Yu Tsai
2021-11-22  4:05       ` Chen-Yu Tsai
2021-11-22  9:21       ` Srinivas Kandagatla
2021-11-22  9:21         ` Srinivas Kandagatla
2021-11-22  9:21         ` Srinivas Kandagatla
2021-11-22  9:21         ` Srinivas Kandagatla
2021-11-24  7:48         ` Chunfeng Yun
2021-11-24  7:48           ` Chunfeng Yun
2021-11-24  7:48           ` Chunfeng Yun
2021-11-24  7:48           ` Chunfeng Yun
2021-11-07  7:56 ` [PATCH 5/6] phy: phy-mtk-tphy: add support efuse setting Chunfeng Yun
2021-11-07  7:56   ` Chunfeng Yun
2021-11-07  7:56   ` Chunfeng Yun
2021-11-07  7:56   ` Chunfeng Yun
2021-11-22 11:35   ` Vinod Koul
2021-11-22 11:35     ` Vinod Koul
2021-11-22 11:35     ` Vinod Koul
2021-11-22 11:35     ` Vinod Koul
2021-11-24  6:54     ` Chunfeng Yun
2021-11-24  6:54       ` Chunfeng Yun
2021-11-24  6:54       ` Chunfeng Yun
2021-11-24  6:54       ` Chunfeng Yun
2021-11-25  5:12       ` Vinod Koul
2021-11-25  5:12         ` Vinod Koul
2021-11-25  5:12         ` Vinod Koul
2021-11-25  5:12         ` Vinod Koul
2021-12-02  8:48         ` Chunfeng Yun
2021-12-02  8:48           ` Chunfeng Yun
2021-12-02  8:48           ` Chunfeng Yun
2021-12-02  8:48           ` Chunfeng Yun
2021-11-07  7:56 ` [PATCH 6/6] arm64: dts: mediatek: mt8195: add efuse node and cells Chunfeng Yun
2021-11-07  7:56   ` Chunfeng Yun
2021-11-07  7:56   ` Chunfeng Yun
2021-11-07  7:56   ` Chunfeng Yun
2021-11-12 22:41 ` [PATCH 1/6] dt-bindings: nvmem: mediatek: add support bits property Rob Herring
2021-11-12 22:41   ` Rob Herring
2021-11-12 22:41   ` Rob Herring
2021-11-12 22:41   ` Rob Herring
2021-11-19 17:18 ` Srinivas Kandagatla
2021-11-19 17:18   ` Srinivas Kandagatla
2021-11-19 17:18   ` Srinivas Kandagatla
2021-11-19 17:18   ` Srinivas Kandagatla

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211107075646.4366-3-chunfeng.yun@mediatek.com \
    --to=chunfeng.yun@mediatek.com \
    --cc=andrew-ct.chen@mediatek.com \
    --cc=devicetree@vger.kernel.org \
    --cc=eddie.hung@mediatek.com \
    --cc=kishon@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=robh+dt@kernel.org \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=vkoul@kernel.org \
    --cc=yz.wu@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.