All of lore.kernel.org
 help / color / mirror / Atom feed
From: Finley Xiao <finley.xiao@rock-chips.com>
To: srinivas.kandagatla@linaro.org, robh+dt@kernel.org,
	mark.rutland@arm.com, heiko@sntech.de
Cc: linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, jay.xu@rock-chips.com,
	huangtao@rock-chips.com, tony.xie@rock-chips.com,
	cl@rock-chips.com, Finley Xiao <finley.xiao@rock-chips.com>
Subject: [PATCH 1/2] nvmem: rockchip-efuse: parse 'rockchip,efuse-size'
Date: Thu,  6 Jul 2017 15:36:36 +0800	[thread overview]
Message-ID: <1499326597-10821-2-git-send-email-finley.xiao@rock-chips.com> (raw)
In-Reply-To: <1499326597-10821-1-git-send-email-finley.xiao@rock-chips.com>

The eFuse size is defined in property <reg> before, but the length
of registers is not equal to the size on some platforms, so we
add a new property to redefine it.

Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
---
 Documentation/devicetree/bindings/nvmem/rockchip-efuse.txt | 4 ++++
 drivers/nvmem/rockchip-efuse.c                             | 4 +++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/nvmem/rockchip-efuse.txt b/Documentation/devicetree/bindings/nvmem/rockchip-efuse.txt
index 194926f..d206aa1 100644
--- a/Documentation/devicetree/bindings/nvmem/rockchip-efuse.txt
+++ b/Documentation/devicetree/bindings/nvmem/rockchip-efuse.txt
@@ -11,6 +11,10 @@ Required properties:
 - clocks: Should be the clock id of eFuse
 - clock-names: Should be "pclk_efuse"
 
+Optional properties:
+- rockchip,efuse-size: Should be exact eFuse size in byte, the eFuse
+  size in property <reg> will be invalid if define this property.
+
 Deprecated properties:
 - compatible: "rockchip,rockchip-efuse"
   Old efuse compatible value compatible to rk3066a, rk3188 and rk3288
diff --git a/drivers/nvmem/rockchip-efuse.c b/drivers/nvmem/rockchip-efuse.c
index a0d4ede..8e3e5d0 100644
--- a/drivers/nvmem/rockchip-efuse.c
+++ b/drivers/nvmem/rockchip-efuse.c
@@ -214,7 +214,9 @@ static int rockchip_efuse_probe(struct platform_device *pdev)
 		return PTR_ERR(efuse->clk);
 
 	efuse->dev = &pdev->dev;
-	econfig.size = resource_size(res);
+	if (of_property_read_u32(dev->of_node, "rockchip,efuse-size",
+				 &econfig.size))
+		econfig.size = resource_size(res);
 	econfig.reg_read = match->data;
 	econfig.priv = efuse;
 	econfig.dev = efuse->dev;
-- 
2.7.4

WARNING: multiple messages have this Message-ID (diff)
From: finley.xiao@rock-chips.com (Finley Xiao)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] nvmem: rockchip-efuse: parse 'rockchip,efuse-size'
Date: Thu,  6 Jul 2017 15:36:36 +0800	[thread overview]
Message-ID: <1499326597-10821-2-git-send-email-finley.xiao@rock-chips.com> (raw)
In-Reply-To: <1499326597-10821-1-git-send-email-finley.xiao@rock-chips.com>

The eFuse size is defined in property <reg> before, but the length
of registers is not equal to the size on some platforms, so we
add a new property to redefine it.

Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
---
 Documentation/devicetree/bindings/nvmem/rockchip-efuse.txt | 4 ++++
 drivers/nvmem/rockchip-efuse.c                             | 4 +++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/nvmem/rockchip-efuse.txt b/Documentation/devicetree/bindings/nvmem/rockchip-efuse.txt
index 194926f..d206aa1 100644
--- a/Documentation/devicetree/bindings/nvmem/rockchip-efuse.txt
+++ b/Documentation/devicetree/bindings/nvmem/rockchip-efuse.txt
@@ -11,6 +11,10 @@ Required properties:
 - clocks: Should be the clock id of eFuse
 - clock-names: Should be "pclk_efuse"
 
+Optional properties:
+- rockchip,efuse-size: Should be exact eFuse size in byte, the eFuse
+  size in property <reg> will be invalid if define this property.
+
 Deprecated properties:
 - compatible: "rockchip,rockchip-efuse"
   Old efuse compatible value compatible to rk3066a, rk3188 and rk3288
diff --git a/drivers/nvmem/rockchip-efuse.c b/drivers/nvmem/rockchip-efuse.c
index a0d4ede..8e3e5d0 100644
--- a/drivers/nvmem/rockchip-efuse.c
+++ b/drivers/nvmem/rockchip-efuse.c
@@ -214,7 +214,9 @@ static int rockchip_efuse_probe(struct platform_device *pdev)
 		return PTR_ERR(efuse->clk);
 
 	efuse->dev = &pdev->dev;
-	econfig.size = resource_size(res);
+	if (of_property_read_u32(dev->of_node, "rockchip,efuse-size",
+				 &econfig.size))
+		econfig.size = resource_size(res);
 	econfig.reg_read = match->data;
 	econfig.priv = efuse;
 	econfig.dev = efuse->dev;
-- 
2.7.4

  reply	other threads:[~2017-07-06  7:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-06  7:36 [PATCH 0/2] nvmem: rockchip-efuse: add support for rk3328-efuse Finley Xiao
2017-07-06  7:36 ` Finley Xiao
2017-07-06  7:36 ` Finley Xiao
2017-07-06  7:36 ` Finley Xiao [this message]
2017-07-06  7:36   ` [PATCH 1/2] nvmem: rockchip-efuse: parse 'rockchip,efuse-size' Finley Xiao
2017-07-10  1:26   ` Rob Herring
2017-07-10  1:26     ` Rob Herring
2017-07-10  1:26     ` Rob Herring
2017-07-06  7:36 ` [PATCH 2/2] nvmem: rockchip-efuse: add support for rk3328-efuse Finley Xiao
2017-07-06  7:36   ` Finley Xiao
2017-07-10  1:26   ` Rob Herring
2017-07-10  1:26     ` Rob Herring
2017-07-10  1:26     ` Rob Herring

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=1499326597-10821-2-git-send-email-finley.xiao@rock-chips.com \
    --to=finley.xiao@rock-chips.com \
    --cc=cl@rock-chips.com \
    --cc=devicetree@vger.kernel.org \
    --cc=heiko@sntech.de \
    --cc=huangtao@rock-chips.com \
    --cc=jay.xu@rock-chips.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=tony.xie@rock-chips.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.