mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* Barebox 2020.01.0 and Device Tree from Linux Kernel 5.4
@ 2020-01-24 15:32 gianluca
  2020-01-24 16:13 ` Ahmad Fatoum
  0 siblings, 1 reply; 3+ messages in thread
From: gianluca @ 2020-01-24 15:32 UTC (permalink / raw)
  To: barebox

Hello list!

I was wondering if the device tree from (latest) Linux Kernel can be 
used when building Barebox 2020.01.0 for iMX6 compatible custom board.

For sure the include path and other stuff are quite different (kernel 
and barebox), so I am pretty sure it will fail to build with some sort 
of "foreign" device-tree. Another issue, will be the drivers to have 
full access from Barebox-Point-Of-View. If the device-tree properties 
and compatible strings are quite different, Barebox will fail to 
activating/probing/using the internal driver.

So I am asking:
There is a "official" way to manage those differencies?

Am I forced to use TWO device-tree dts files (almost identical each 
other) ???

It seems it is like re-inventing the wheel...

I think this procedure can be used with ALL supported boards present in 
barebox source tree.

Actually I am using a slightly modified device-tree for my boards from 
kernel, then adapted to be compiled for Barebox.
Some nodes are "disabled" by default as status, so Barebox will activate 
them when probing the real-hardware.

I would like to keep my code to activate/deactivate device-tree drivers, 
but without modifying the Kernel device-tree each time when I do a 
Kernel update.

Any hint will be very accepted.

Regards,
-- 
Eurek s.r.l.                          |
Electronic Engineering                | http://www.eurek.it
via Celletta 8/B, 40026 Imola, Italy  | Phone: +39-(0)542-609120
p.iva 00690621206 - c.f. 04020030377  | Fax:   +39-(0)542-609212

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Barebox 2020.01.0 and Device Tree from Linux Kernel 5.4
  2020-01-24 15:32 Barebox 2020.01.0 and Device Tree from Linux Kernel 5.4 gianluca
@ 2020-01-24 16:13 ` Ahmad Fatoum
       [not found]   ` <8f731e2b-9c11-d183-a660-e0a7ea621074@eurek.it>
  0 siblings, 1 reply; 3+ messages in thread
From: Ahmad Fatoum @ 2020-01-24 16:13 UTC (permalink / raw)
  To: gianluca, barebox

Hello,

On 1/24/20 4:32 PM, gianluca wrote:
> I was wondering if the device tree from (latest) Linux Kernel can be used when building Barebox 2020.01.0 for iMX6 compatible custom board.
> For sure the include path and other stuff are quite different (kernel and barebox), so I am pretty sure it will fail to build with some sort of "foreign" device-tree.

barebox already regularly imports Linux's device tree directories into its dts/ directory.
v2020.01.0 contains the v5.4-rc7 state.

Another issue, will be the drivers to have full access from Barebox-Point-Of-View. If the device-tree properties and compatible strings are quite different, Barebox will fail to activating/probing/using the internal driver.

barebox driver compatibles should be aligned with the kernel's.
If a barebox driver lacks handling for a property, the driver can be extended.

> So I am asking:
> There is a "official" way to manage those differencies?

I recently added a short section about this in the Documentation
(https://barebox.org/doc/latest/devicetree/index.html):

  "For supporting architectures, barebox device trees are located in arch/$ARCH/dts.
   Usually the barebox board.dts imports the upstream device tree under dts/src/$ARCH
   with #include "$ARCH/board.dts" and then extends it with barebox-specifics like
   Barebox state, environment or boot-time device configuration."

Take a look at arch/arm/dts/imx6q-marsboard.dts to see how that looks in practice.
The kernel device tree is reused as is and extended slightly for barebox use.

> Am I forced to use TWO device-tree dts files (almost identical each other) ???
> 
> It seems it is like re-inventing the wheel...

No, as you can can extend the kernel device tree (see below).

> I think this procedure can be used with ALL supported boards present in barebox source tree.
> 
> Actually I am using a slightly modified device-tree for my boards from kernel, then adapted to be compiled for Barebox.
> Some nodes are "disabled" by default as status, so Barebox will activate them when probing the real-hardware.

I think

#include <arm/imx6q-yourboard.dts>

&device {
	status = "okay";
};

is what you're after.

> I would like to keep my code to activate/deactivate device-tree drivers, but without modifying the Kernel device-tree each time when I do a Kernel update.
> 
> Any hint will be very accepted.

HTH,
Ahmad

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Barebox 2020.01.0 and Device Tree from Linux Kernel 5.4
       [not found]   ` <8f731e2b-9c11-d183-a660-e0a7ea621074@eurek.it>
@ 2020-01-28 12:45     ` Ahmad Fatoum
  0 siblings, 0 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2020-01-28 12:45 UTC (permalink / raw)
  To: gianluca, Barebox List

Hello,

(please keep the barebox mailing list in CC)

On 1/27/20 3:02 PM, gianluca wrote:
> On 01/24/2020 05:13 PM, Ahmad Fatoum wrote:
>> Hello,
>>
>> On 1/24/20 4:32 PM, gianluca wrote:
>>> I was wondering if the device tree from (latest) Linux Kernel can be used when building Barebox 2020.01.0 for iMX6 compatible custom board.
>>> For sure the include path and other stuff are quite different (kernel and barebox), so I am pretty sure it will fail to build with some sort of "foreign" device-tree.
>>
>> barebox already regularly imports Linux's device tree directories into its dts/ directory.
>> v2020.01.0 contains the v5.4-rc7 state.
>>
> 
> Good to hear...
> 
>> Another issue, will be the drivers to have full access from Barebox-Point-Of-View. If the device-tree properties and compatible strings are quite different, Barebox will fail to activating/probing/using the internal driver.
>>
>> barebox driver compatibles should be aligned with the kernel's.
>> If a barebox driver lacks handling for a property, the driver can be extended.
>>
>>> So I am asking:
>>> There is a "official" way to manage those differencies?
>>
>> I recently added a short section about this in the Documentation
>> (https://barebox.org/doc/latest/devicetree/index.html):
>>
>>   "For supporting architectures, barebox device trees are located in arch/$ARCH/dts.
>>    Usually the barebox board.dts imports the upstream device tree under dts/src/$ARCH
>>    with #include "$ARCH/board.dts" and then extends it with barebox-specifics like
>>    Barebox state, environment or boot-time device configuration."
>>
>> Take a look at arch/arm/dts/imx6q-marsboard.dts to see how that looks in practice.
>> The kernel device tree is reused as is and extended slightly for barebox use.
> 
> So, basically the device-tree stuff in Barebox are different from the Linux kernel one only for the #include path?

The barebox device trees for ARM are in arch/arm/dts. Best practice
is that these device trees include the upstream device tree with just
the barebox changes custom.

> The biggest issue I've found here, is the compatibility of the device-tree nodes for my board referring the standard imx6 board. For example:
> 
> &uart3 {
>     status = "okay";
> };
> 
> is good as you are using the standard pinout for uart3.
> 
> But, if I am using a different pinout layout for the same device, this is not working at all.
> 
> Maybe I have to find the device-node parent, then looking for its configuration, and if it fits my needs, ok I will use it.
> 
> Otherwise I have to redefine a new configuration node:
> 
> uart3 {
>     pinctrl = ....
>     interrupts = ...
> };
> 
> But this does not work. uart3 is already defined into the parent node of imx6q.dtsi.
> 
> In that case I need to redefine a new name:
> 
> my_uart3 {
>    pinctrl = ...
>    interrupts = ...
> };
> 
> &my_uart3 {
>    status = "okay";
> };
> 
> I hope you understand what I am trying to tell you.

You don't need to do this, you can just write

&uart3 {
	pinctrl = ...;
	status = "okay";
};

These properties will override the properties from earlier in the preprocessed file.

Cheers
Ahmad

> 
> Best regards,
> Gianluca


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | https://www.pengutronix.de/ |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-01-28 12:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-24 15:32 Barebox 2020.01.0 and Device Tree from Linux Kernel 5.4 gianluca
2020-01-24 16:13 ` Ahmad Fatoum
     [not found]   ` <8f731e2b-9c11-d183-a660-e0a7ea621074@eurek.it>
2020-01-28 12:45     ` Ahmad Fatoum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox