public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: srinivas.kandagatla@linaro•org (Srinivas Kandagatla)
To: linux-arm-kernel@lists•infradead.org
Subject: Query on using nvmem consumer API
Date: Thu, 18 Feb 2016 15:13:55 +0000	[thread overview]
Message-ID: <56C5DFB3.1020903@linaro.org> (raw)
In-Reply-To: <20160218120100.GA11366@Sanchayan-Arch.toradex.int>



On 18/02/16 12:01, maitysanchayan at gmail.com wrote:
> Hello Srinivas,
>
> I have a device tree node as follows
>
>                          ocotp: ocotp at 400a5000 {
>                                  compatible = "fsl,vf610-ocotp";
>                                  #address-cells = <1>;
>                                  #size-cells = <1>;
>                                  reg = <0x400a5000 0xCF0>;
>                                  clocks = <&clks VF610_CLK_OCOTP>;
>
>                                  ocotp_cfg: cfg at 410 {
>                                          reg = <0x410 0x20>;
>                                  };
>                          };
>
> and a nvmem data consumer node as follows
>
>          soc-bus {
>                  compatible = "fsl,vf610-soc-bus";
>                  nvmem = <&ocotp>;
>                  nvmem-names = "ocotp";
>                  nvmem-cell = <&ocotp_cfg>;
>                  nvmem-cell-names = "soc_id";
>                  status = "okay";
>          };
>
> I believe my device tree node entries are incorrect. I did like to
> use the devm_nvmem_device/cell_get functions and then read using
> cell or device consumer API's. I am looking at the NVMEM bindings
> but it is not clear to me as to what the correct DT entries and
> the corresponding arguments to devm_nvmem_device/cell_get should
> be?
>
> Can you help me out with as to what the correct entries and calls
> should be?

Sure,

Firstly you should grab a nvmem cell and then use it as part of 
nvmem_read/write.

In your case you would do this in soc-bus device.

struct nvmem_cell *soc_id = devm_nvmem_cell_get(dev, "soc_id");
data = nvmem_cell_read(soc_id, &len);

There is some documentation at Documentation/nvmem/nvmem.txt
Let me know if you find any issues with the doc.


thanks,
srini


>
> I currently have
> devm_nvmem_device_get(dev, "ocotp");
> devm_nvmem_cell_get(dev, "soc_id");
>
> where dev would be the soc-bus device.
>
> Thanks & Regards,
> Sanchayan.
>

      reply	other threads:[~2016-02-18 15:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-18 12:01 Query on using nvmem consumer API maitysanchayan at gmail.com
2016-02-18 15:13 ` Srinivas Kandagatla [this message]

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=56C5DFB3.1020903@linaro.org \
    --to=srinivas.kandagatla@linaro$(echo .)org \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox