nvmem: rockchip-efuse: add optional property to get efuse size
authorChen Liang <cl@rock-chips.com>
Tue, 11 Apr 2017 07:51:23 +0000 (15:51 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Tue, 11 Apr 2017 08:37:57 +0000 (16:37 +0800)
The exact efuse size is defined in property <reg> before, this assume
that the length of registers is equal to efuse size, but it not true
for some chips, so we need anothor property to redefine efuse size.

Change-Id: I9cdab8adc2a13b55cfcacc3c2248295c4387a806
Signed-off-by: Chen Liang <cl@rock-chips.com>
Documentation/devicetree/bindings/nvmem/rockchip-efuse.txt
drivers/nvmem/rockchip-efuse.c

index ceab1d1..19b3dad 100644 (file)
@@ -13,6 +13,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
index c117d07..294816c 100644 (file)
@@ -361,7 +361,12 @@ static int __init 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_index(dev->of_node,
+                                      "rockchip,efuse-size",
+                                      0,
+                                      &econfig.size))
+               econfig.size = resource_size(res);
+
        econfig.reg_read = match->data;
        econfig.priv = efuse;
        econfig.dev = efuse->dev;