Re: Queries: Using ifdef CONFIG condition in dts files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Thu, 26 May 2022 at 19:53, T.Michael Turney <quic_mturney@xxxxxxxxxxx> wrote:
>
> Kernel developers correct me where I go astray, but this seems like the
> CONFIG_XYZ value is not available in this file.  This would explain why
> the disable case works.
>
> At top of dtsi file are you #include <config.h> or whatever the correct
> syntax is to see the CONFIG values?

Thanks for your comments.
No, I could not find any specific config,h to be included to make the
CONFIG values visible to dts.

Thanks,
Pintu

>
> On 5/26/2022 1:46 AM, Pintu Agarwal wrote:
> > 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




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux