Re: Phandles

Krzysztof Kozlowski <[email protected]> Mon, 13 Apr 2026 11:57:53 +0200
Newsgroups org.kernel.vger.devicetree-compiler,org.kernel.vger.linux-devicetree
Message-ID <[email protected]>
On 13/04/2026 11:50, Kyle Bonnici wrote:
> 
>> You cannot have random values. I quoted the DT spec.
> 
> Where in the DTS 0.4 spec are property names such as  pwms, clocks
>  etc… mandated to be of format <phandle cell …>?

Ah, true, this is not expressed but DT spec defines types for only a few
cases.

> 
>> Well, we don't use discord but IRC... but that github issue also uses
>> "pwms = <1 &pwm0 1 20 PWM_POLARITY_NORMAL>;"
>>
>> So again - what is "1"?
>>
>> I am asking because if you use incorrect value as phandle value, then
>> DTC warning is obviously expected and nothing to fix here.
> 
> The warning is only valid if ‘1’  is expected to be a phandle which is what I am
> Arguing the spec does not mandate this.

The "&foo" used in the property defines that it is phandle, no?

> 
>> You asked why phandle has to be the first entry in phandle-value type? I
>> responded that DT spec makes it.
> 
> Which section in DTS 0.4 spec?

2.2.4.2. Property Values
"That number is used for the value of properties with a phandle value type.

The properties having phandle value must have proper, well, value :)

> 
>> We discuss DTC here, yes? Whether it has or has not a bug? Please help
>> me to understand the topic. Why would we care about Zephyr's
>> implementation? It's Zephyr's problem and I am not a Zephyr developer. I
>> am not saying that it is not important, just saying that I am not the
>> audience to discuss it.
> 
> I am arguing that the DTC Spec 0.4 does NOT mandate any of these any of these
> “cooling_device”, “dmas”, “hwlocks”, “io_channels”, “iommus”, “mboxes”, 
> “msi_parent”, “mux_controls”, “phys”, “power_domains”, “pwms”, “resets”, 
> “clocks”,  “sound_dai” and “thermal_sensors” 
> must follow <phandle cell …>. 
> 
> This is only mandated by the dt-schema as far as I understand, that is a used by 
> Linux, but not Zephyr and the DTC Making the assumption that this is true for 
> all systems

No, dtschema is irrelevant here and DTC was validating it since 2017, so
years before dtschema.

DT spec indeed does not mandate it as pwms, but replacing that check in
DTC with something only validating phandles would not solve your
problem. Your 'pwm' is a phandle-value type, because you use phandle
there, and still is has wrong value.

Best regards,
Krzysztof