lkml.org 
[lkml]   [2022]   [May]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectQueries: Using ifdef CONFIG condition in dts files
Hi,

I have a generic question regarding conditional compilation options in
dts/dtsi files.
Our Kernel version is: 4.14
Let's say I have a Kernel config such as CONFIG_XYZ.
This driver uses a CMA reserved memory and its node is defined in a
mysoc.dtsi file.
Like:
#if defined(CONFIG_XYZ)
&reserved_mem {
xyz_region: xyz_region {
compatible = "shared-dma-pool";
reusable;
size = <0x600000>;
};
};
#endif

The problem is as follows:
a) The same kernel/dts source is shared across 2 product versions.
b) In one product we need to enable this CONFIG_XYZ but in another
product we need to disable it.
c) When we disable the CONFIG we wanted this dts node also to be
disabled together.
d) When we add "#if defined(CONFIG_XYZ)" check in the dtsi file, it
works if the CONFIG is disabled, but it does not work if CONFIG is
enabled (node is not getting created).
e) This mysoc.dtsi file is getting included in many other dts files,
so we cannot add a compilation check in Makefile. We will end up
renaming many files just to protect this one change.

Is there any other better way to handle this situation ?

I see that in latest kernel we have a conditional compilation added like this:
#ifdef SOC_HAS_USB2_CH2
https://elixir.bootlin.com/linux/latest/source/arch/arm64/boot/dts/renesas/salvator-common.dtsi#L1028

But the same is not recognized by the device tree compiler when using
kernel CONFIG_ check.

Is it the device-tree compiler issue which got fixed in the latest version ?
Or, is it because Kernel config cannot be shared with device-tree ?

Please let us know if there is any other opinion.


Thank you.

Regards,
Pintu

\
 
 \ /
  Last update: 2022-05-26 10:47    [W:0.175 / U:0.284 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site