devicetree-compiler.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
To: Radha Mohan Chintakuntla
	<radhamohan.cta-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: fdt_setprop comma-separated cells
Date: Wed, 28 Sep 2022 15:35:31 +1000	[thread overview]
Message-ID: <YzPdI5iS11r+9Fsy@yekko> (raw)
In-Reply-To: <CA+Nonppng=cKrpwqz6YxiVLikvgZGeuYBfdEn3jH8fW49070Xw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 1500 bytes --]

On Wed, Sep 21, 2022 at 05:35:19PM -0700, Radha Mohan Chintakuntla wrote:
> Hi,
> Not sure if this right forum to discuss this issue.
> I have a requirement where I have to update the device tree property
> with comma-separated values. If I use fdt_setprop() and pass a
> 2-dimensional array then it is not creating the property with comma
> separation. Instead I get all the values in same cell separated by
> space.
> 
> Is there any other way this should be done?
> I have referred to some uboot code that used libfdt and does same way
> as me but even that has the same problem.
> 
> Any suggestions please?

I'm afraid it looks like you have a miunderstanding about the
flattened tree format (a very common one, alas).

In the dtb, properties are simply bytestrings, there is no type
information.  You can only separate them into typed values by knowing
the binding which describes the format.  In other words, in the dtb
there is no such thing as "comma separation".  Commas in dts are
simply a way to notate concatenating bytestrings which can be
generated from integers, strings or whatever.

When using dtc in dtb -> dts mode, it applies some heuristics to guess
the right format to display things in.  However it does not - and
cannot - get this right all the time.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      parent reply	other threads:[~2022-09-28  5:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-22  0:35 fdt_setprop comma-separated cells Radha Mohan Chintakuntla
     [not found] ` <CA+Nonppng=cKrpwqz6YxiVLikvgZGeuYBfdEn3jH8fW49070Xw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-09-26 16:49   ` Rob Herring
2022-09-28  5:35   ` David Gibson [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=YzPdI5iS11r+9Fsy@yekko \
    --to=david-xt8fgy+axnrb3ne2bgzf6laj5h9x9tb+@public.gmane.org \
    --cc=devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=radhamohan.cta-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /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 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).