* Query on using nvmem consumer API
@ 2016-02-18 12:01 maitysanchayan at gmail.com
2016-02-18 15:13 ` Srinivas Kandagatla
0 siblings, 1 reply; 2+ messages in thread
From: maitysanchayan at gmail.com @ 2016-02-18 12:01 UTC (permalink / raw)
To: linux-arm-kernel
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?
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Query on using nvmem consumer API
2016-02-18 12:01 Query on using nvmem consumer API maitysanchayan at gmail.com
@ 2016-02-18 15:13 ` Srinivas Kandagatla
0 siblings, 0 replies; 2+ messages in thread
From: Srinivas Kandagatla @ 2016-02-18 15:13 UTC (permalink / raw)
To: linux-arm-kernel
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.
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-02-18 15:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-18 12:01 Query on using nvmem consumer API maitysanchayan at gmail.com
2016-02-18 15:13 ` Srinivas Kandagatla
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).