Skip to contentSkip to conversation

"compatible" and "model" properties in .dts for ARC boards

DISCUSSION Alexey Brodkin 4 participants 5 messages Nov 5, 2015 – Nov 17, 2015 Synopsys ARC architecture

lore
Share & tools
lore
#0 lore raw

Hi Vineet,

During OpenWRT upsreaming process one interesting topic was raised.
See in the middle of https://lists.openwrt.org/pipermail/openwrt-devel/2015-November/036959.html

In Device Tree descriptions for our boards we don't use "model" property even though it is a required one as specified by ePAPR, see
http://free-electrons.com/~thomas/pub/Power_ePAPR_APPROVED_v1.0.pdf,
page 39 "Table 3-1 Root node properties".

Instead we put 2 items in "compatible" property.

For example:
------------------->8----------------
compatible = "snps,axs101", "snps,arc-sdp";
------------------->8----------------
here: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arc/boot/dts/axs101.dts#n16

And from ePAPR standpoint it makes sense to split contents of that "compatible" property in 2:
------------------->8----------------
compatible = "snps,arc-sdp";
model = "snps,axs101";
------------------->8----------------

But I do see problems with implementation of that thing. Today we have a luxury of selection of AXS init functionality based on that compatible value and if "snps,axs101" goes in "model" then we'll need to add some more code in arch/arc/plat-axs10x/axs10x.c that reads "model" value with of_get_property() and then compare to "axs10{1|3}".

Any thoughts?

-Alexey

#1 lore raw

+CC lkml,Arnd, Rob

Quoted 17 lines · Alexey Brodkin

Hi Vineet,

During OpenWRT upsreaming process one interesting topic was raised.
See in the middle of https://lists.openwrt.org/pipermail/openwrt-devel/2015-November/036959.html

In Device Tree descriptions for our boards we don't use "model" property even though it is a required one as specified by ePAPR, see
http://free-electrons.com/~thomas/pub/Power_ePAPR_APPROVED_v1.0.pdf,
page 39 "Table 3-1 Root node properties".

Instead we put 2 items in "compatible" property.

For example:
------------------->8----------------
compatible = "snps,axs101", "snps,arc-sdp";
------------------->8----------------

Quoted 6 lines

And from ePAPR standpoint it makes sense to split contents of that "compatible" property in 2:
------------------->8----------------
compatible = "snps,arc-sdp";
model = "snps,axs101";
------------------->8----------------

It seems model is just a descriptive label and we can surely add them to existing DT. compatible on the other hand is more fundamental used for exact comparisons etc and follows the vendor,device convention.
It is pretty common for compatible to have multiple strings for exactly the same reason as I have them here. Both axs101 and axs103 are based on sdp thus we want the ability to have both pieces of information and use as needed.

While doing some other DT research recently, I found some of the best basic DT documentation is a somewhat misnamed in-kernel document Documentation/devicetree/booting-without-of.txt

Quoted 10 lines

But I do see problems with implementation of that thing. Today we have a luxury of selection of AXS init functionality based on that compatible value and if "snps,axs101" goes in "model" then we'll need to add some more code in arch/arc/plat-axs10x/axs10x.c that reads "model" value with of_get_property() and then compare to "axs10{1|3}".

Any thoughts?

-Alexey

#2 lore raw
Quoted 23 lines · On Friday 06 November 2015 04:45:24 Vineet Gupta wrote:
Quoted 16 lines

During OpenWRT upsreaming process one interesting topic was raised.
See in the middle of https://lists.openwrt.org/pipermail/openwrt-devel/2015-November/036959.html

In Device Tree descriptions for our boards we don't use "model" property even though it is a required one as specified by ePAPR, see
http://free-electrons.com/~thomas/pub/Power_ePAPR_APPROVED_v1.0.pdf,
page 39 "Table 3-1 Root node properties".

Instead we put 2 items in "compatible" property.

For example:
------------------->8----------------
compatible = "snps,axs101", "snps,arc-sdp";
------------------->8----------------

Quoted 6 lines

And from ePAPR standpoint it makes sense to split contents of that "compatible" property in 2:
------------------->8----------------
compatible = "snps,arc-sdp";
model = "snps,axs101";
------------------->8----------------

Quoted 6 lines

It seems model is just a descriptive label and we can surely add them to existing DT. compatible on the other hand is more fundamental used for exact comparisons etc and follows the vendor,device convention.
It is pretty common for compatible to have multiple strings for exactly the same reason as I have them here. Both axs101 and axs103 are based on sdp thus we want the ability to have both pieces of information and use as needed.

Correct.

The model should also be a human readable name of the machine, just one string like "Synapsys AXS101 Development Board" (or whatever that is called).

Quoted 8 lines
Quoted 8 lines

But I do see problems with implementation of that thing. Today we have a luxury of selection of AXS init functionality based on that compatible value and if "snps,axs101" goes in "model" then we'll need to add some more code in arch/arc/plat-axs10x/axs10x.c that reads "model" value with of_get_property() and then compare to "axs10{1|3}".

Any thoughts?

That should use the of_machine_is_compatible() helper. The model string is for printing in dmesg or /proc/cpuinfo.

Arnd

#3 lore raw
Quoted 31 lines · Arnd Bergmann
Quoted 23 lines · On Friday 06 November 2015 04:45:24 Vineet Gupta wrote:
Quoted 16 lines

During OpenWRT upsreaming process one interesting topic was raised.
See in the middle of https://lists.openwrt.org/pipermail/openwrt-devel/2015-November/036959.html

In Device Tree descriptions for our boards we don't use "model" property even though it is a required one as specified by ePAPR, see
http://free-electrons.com/~thomas/pub/Power_ePAPR_APPROVED_v1.0.pdf,
page 39 "Table 3-1 Root node properties".

Instead we put 2 items in "compatible" property.

For example:
------------------->8----------------
compatible = "snps,axs101", "snps,arc-sdp";
------------------->8----------------

Quoted 6 lines

And from ePAPR standpoint it makes sense to split contents of that "compatible" property in 2:
------------------->8----------------
compatible = "snps,arc-sdp";
model = "snps,axs101";
------------------->8----------------

Quoted 6 lines

It seems model is just a descriptive label and we can surely add them to existing DT. compatible on the other hand is more fundamental used for exact comparisons etc and follows the vendor,device convention.
It is pretty common for compatible to have multiple strings for exactly the same reason as I have them here. Both axs101 and axs103 are based on sdp thus we want the ability to have both pieces of information and use as needed.

Quoted 4 lines

Correct.

The model should also be a human readable name of the machine, just one string like "Synapsys AXS101 Development Board" (or whatever that is called).

This contradicts ePAPR, which says the model's recommended* format is the same as the compatible one's (<vendor>,<model>). Most PowerPC and some MIPS dts files follow that, while ARM(64) uses the free text form.

To me it looks like the intended usage was
model = <actual_model>; compatible = <platform>;
but the actual usage in arm is
model = <human readable string>; compatible = <actual_model>, <platform>;

Of course for changing this in the existing dts files it might be a bit late, but it would be good to decide which of these two is the actually expected format.

It also is a required property, and we have a few boards not having a model property, including the example in Documentation/devicetree/usage-model.txt.

Jonas

* compatible strings are also only "recommended" to be in that format.

#4 lore raw
Quoted 49 lines · Jonas Gorski
Quoted 31 lines · Arnd Bergmann
Quoted 23 lines · On Friday 06 November 2015 04:45:24 Vineet Gupta wrote:
Quoted 16 lines

During OpenWRT upsreaming process one interesting topic was raised.
See in the middle of https://lists.openwrt.org/pipermail/openwrt-devel/2015-November/036959.html

In Device Tree descriptions for our boards we don't use "model" property even though it is a required one as specified by ePAPR, see
http://free-electrons.com/~thomas/pub/Power_ePAPR_APPROVED_v1.0.pdf,
page 39 "Table 3-1 Root node properties".

Instead we put 2 items in "compatible" property.

For example:
------------------->8----------------
compatible = "snps,axs101", "snps,arc-sdp";
------------------->8----------------

Quoted 6 lines

And from ePAPR standpoint it makes sense to split contents of that "compatible" property in 2:
------------------->8----------------
compatible = "snps,arc-sdp";
model = "snps,axs101";
------------------->8----------------

Quoted 6 lines

It seems model is just a descriptive label and we can surely add them to existing DT. compatible on the other hand is more fundamental used for exact comparisons etc and follows the vendor,device convention.
It is pretty common for compatible to have multiple strings for exactly the same reason as I have them here. Both axs101 and axs103 are based on sdp thus we want the ability to have both pieces of information and use as needed.

Quoted 4 lines

Correct.

The model should also be a human readable name of the machine, just one string like "Synapsys AXS101 Development Board" (or whatever that is called).

This contradicts ePAPR, which says the model's recommended* format is the same as the compatible one's (<vendor>,<model>). Most PowerPC and some MIPS dts files follow that, while ARM(64) uses the free text form.

To me it looks like the intended usage was
model = <actual_model>; compatible = <platform>;
but the actual usage in arm is
model = <human readable string>; compatible = <actual_model>, <platform>;

Of course for changing this in the existing dts files it might be a bit late, but it would be good to decide which of these two is the actually expected format.

Quoted 8 lines

It also is a required property, and we have a few boards not having a model property, including the example in Documentation/devicetree/usage-model.txt.

Jonas

* compatible strings are also only "recommended" to be in that format.

Alexey, can u please rework the DT files per Jonas' suggestion above.

Thx,
-Vineet