devicetree-compiler.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* DTB file appears to have corrupted node property according to fdtdump and kernel?
@ 2017-02-02 17:53 Frederik Lotter
       [not found] ` <CAPBAm7QSB_-LrAwouztLYLaC0mWF2V4QQ_Yz98p6jVw07SfT6Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Frederik Lotter @ 2017-02-02 17:53 UTC (permalink / raw)
  To: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA

Hi,

I have a particular device tree node property which refuses to reach
the Linux kernel without corruption:

 interrupts = <0xc 0x1>;

From the extract below from the preprocessed file:

   i2c1: i2c@f0018000 {
    compatible = "atmel,at91sam9x5-i2c";
    reg = <0xf0018000 0x4000>;
    interrupts = <0x13 0x4 0x6>;
    dmas = <0x2 0x2 0x9 0x2 0x2 0xa>;
    dma-names = "tx", "rx";
    pinctrl-names = "default";
    pinctrl-0 = <0x12>;
    #address-cells = <0x1>;
    #size-cells = <0x0>;
    clocks = <0x13>;
    status = "okay";
    clock-frequency = <0x61a80>;
    atmel,recover-scl = <0x14 0x1b 0x0>;
    atmel,recover-sda = <0x14 0x1a 0x0>;

    lsm6ds3@6b {
     compatible = "st,lsm6ds3";
     reg = <0x6b>;
     pinctrl-names = "default";
     pinctrl-0 = <0x15>;
     interrupt-parent = <0x16>;
     interrupts = <0xc 0x1>;
     interrupt-names = "lsm6ds_int1";
     st,drdy-int-pin = <0x1>;
    };
   };

Version: DTC 1.4.0 (ubuntu package) for manual testing.

(1)  fdtdump mix6000.dtb | grep interrupts

Thsi returns the interrupt line as:

interrupts = <0x0000000c 0x000001d0>;

(2) In the linux kernel the of_platform_populate() reads the same property as:

0x0000000c 0x00000000 with lenth=8

(3) If I take the DTS file and manually compile the DTB with the dtc
compiler, and convert it back to the DTS the correct values are shown

(4) If I change the interrupt value:

interrupts = <0xc 0x0>;

and I do:

cat <file-old.dtb> | od -t x1 > file1.txt
cat <file-mod.dtb> | od -t x1 > file2.txt
kdiff3 file1.txt file2.txt

I actually see a single hex byte change from 0x1 to 0x0.

If it was not for the faulty fdtdump output (in conjuection with the
Linux kernel zero at the same place) I would have said its definately
a kernel issue.

Any ideas?

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

* Re: DTB file appears to have corrupted node property according to fdtdump and kernel?
       [not found] ` <CAPBAm7QSB_-LrAwouztLYLaC0mWF2V4QQ_Yz98p6jVw07SfT6Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2017-02-02 22:56   ` David Gibson
  2017-02-03  2:28   ` Frank Rowand
  1 sibling, 0 replies; 4+ messages in thread
From: David Gibson @ 2017-02-02 22:56 UTC (permalink / raw)
  To: Frederik Lotter; +Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 2408 bytes --]

On Thu, Feb 02, 2017 at 07:53:11PM +0200, Frederik Lotter wrote:
> Hi,
> 
> I have a particular device tree node property which refuses to reach
> the Linux kernel without corruption:
> 
>  interrupts = <0xc 0x1>;
> 
> >From the extract below from the preprocessed file:
> 
>    i2c1: i2c@f0018000 {
>     compatible = "atmel,at91sam9x5-i2c";
>     reg = <0xf0018000 0x4000>;
>     interrupts = <0x13 0x4 0x6>;
>     dmas = <0x2 0x2 0x9 0x2 0x2 0xa>;
>     dma-names = "tx", "rx";
>     pinctrl-names = "default";
>     pinctrl-0 = <0x12>;
>     #address-cells = <0x1>;
>     #size-cells = <0x0>;
>     clocks = <0x13>;
>     status = "okay";
>     clock-frequency = <0x61a80>;
>     atmel,recover-scl = <0x14 0x1b 0x0>;
>     atmel,recover-sda = <0x14 0x1a 0x0>;
> 
>     lsm6ds3@6b {
>      compatible = "st,lsm6ds3";
>      reg = <0x6b>;
>      pinctrl-names = "default";
>      pinctrl-0 = <0x15>;
>      interrupt-parent = <0x16>;
>      interrupts = <0xc 0x1>;
>      interrupt-names = "lsm6ds_int1";
>      st,drdy-int-pin = <0x1>;
>     };
>    };
> 
> Version: DTC 1.4.0 (ubuntu package) for manual testing.
> 
> (1)  fdtdump mix6000.dtb | grep interrupts
> 
> Thsi returns the interrupt line as:
> 
> interrupts = <0x0000000c 0x000001d0>;
> 
> (2) In the linux kernel the of_platform_populate() reads the same property as:
> 
> 0x0000000c 0x00000000 with lenth=8
> 
> (3) If I take the DTS file and manually compile the DTB with the dtc
> compiler, and convert it back to the DTS the correct values are shown
> 
> (4) If I change the interrupt value:
> 
> interrupts = <0xc 0x0>;
> 
> and I do:
> 
> cat <file-old.dtb> | od -t x1 > file1.txt
> cat <file-mod.dtb> | od -t x1 > file2.txt
> kdiff3 file1.txt file2.txt
> 
> I actually see a single hex byte change from 0x1 to 0x0.
> 
> If it was not for the faulty fdtdump output (in conjuection with the
> Linux kernel zero at the same place) I would have said its definately
> a kernel issue.
> 
> Any ideas?

Well that's certainly weird.  Is it possible for you to attach the
whole dts and dtb so I can experiment?

What output does decompiling with dtc -I dtb -O dts give you?

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: DTB file appears to have corrupted node property according to fdtdump and kernel?
       [not found] ` <CAPBAm7QSB_-LrAwouztLYLaC0mWF2V4QQ_Yz98p6jVw07SfT6Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2017-02-02 22:56   ` David Gibson
@ 2017-02-03  2:28   ` Frank Rowand
       [not found]     ` <5893EABE.10009-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  1 sibling, 1 reply; 4+ messages in thread
From: Frank Rowand @ 2017-02-03  2:28 UTC (permalink / raw)
  To: Frederik Lotter, devicetree-compiler-u79uwXL29TY76Z2rM5mHXA

On 02/02/17 09:53, Frederik Lotter wrote:
> Hi,
> 
> I have a particular device tree node property which refuses to reach
> the Linux kernel without corruption:
> 
>  interrupts = <0xc 0x1>;
> 
>>From the extract below from the preprocessed file:
> 
>    i2c1: i2c@f0018000 {
>     compatible = "atmel,at91sam9x5-i2c";
>     reg = <0xf0018000 0x4000>;
>     interrupts = <0x13 0x4 0x6>;
>     dmas = <0x2 0x2 0x9 0x2 0x2 0xa>;
>     dma-names = "tx", "rx";
>     pinctrl-names = "default";
>     pinctrl-0 = <0x12>;
>     #address-cells = <0x1>;
>     #size-cells = <0x0>;
>     clocks = <0x13>;
>     status = "okay";
>     clock-frequency = <0x61a80>;
>     atmel,recover-scl = <0x14 0x1b 0x0>;
>     atmel,recover-sda = <0x14 0x1a 0x0>;
> 
>     lsm6ds3@6b {
>      compatible = "st,lsm6ds3";
>      reg = <0x6b>;
>      pinctrl-names = "default";
>      pinctrl-0 = <0x15>;
>      interrupt-parent = <0x16>;
>      interrupts = <0xc 0x1>;
>      interrupt-names = "lsm6ds_int1";
>      st,drdy-int-pin = <0x1>;
>     };
>    };
> 
> Version: DTC 1.4.0 (ubuntu package) for manual testing.
> 
> (1)  fdtdump mix6000.dtb | grep interrupts
> 
> Thsi returns the interrupt line as:
> 
> interrupts = <0x0000000c 0x000001d0>;
> 
> (2) In the linux kernel the of_platform_populate() reads the same property as:
> 
> 0x0000000c 0x00000000 with lenth=8
> 
> (3) If I take the DTS file and manually compile the DTB with the dtc
> compiler, and convert it back to the DTS the correct values are shown
> 
> (4) If I change the interrupt value:
> 
> interrupts = <0xc 0x0>;
> 
> and I do:
> 
> cat <file-old.dtb> | od -t x1 > file1.txt
> cat <file-mod.dtb> | od -t x1 > file2.txt
> kdiff3 file1.txt file2.txt
> 
> I actually see a single hex byte change from 0x1 to 0x0.
> 
> If it was not for the faulty fdtdump output (in conjuection with the
> Linux kernel zero at the same place) I would have said its definately
> a kernel issue.
> 
> Any ideas?

You can see what the dtb looked like when given to the kernel. Take
/sys/firmware/fdt and decompile that with dtc.

If it already looks bad at this point, does your bootloader have any
way to look at the dtb?

-Frank

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

* Re: DTB file appears to have corrupted node property according to fdtdump and kernel?
       [not found]     ` <5893EABE.10009-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-02-03  8:35       ` Frederik Lotter
  0 siblings, 0 replies; 4+ messages in thread
From: Frederik Lotter @ 2017-02-03  8:35 UTC (permalink / raw)
  To: Frank Rowand, david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+,
	devicetree-compiler-u79uwXL29TY76Z2rM5mHXA

On 3 February 2017 at 04:28, Frank Rowand <frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> On 02/02/17 09:53, Frederik Lotter wrote:
>> Hi,
>>
>> I have a particular device tree node property which refuses to reach
>> the Linux kernel without corruption:
>>
>>  interrupts = <0xc 0x1>;
>>
>>>From the extract below from the preprocessed file:
>>
>>    i2c1: i2c@f0018000 {
>>     compatible = "atmel,at91sam9x5-i2c";
>>     reg = <0xf0018000 0x4000>;
>>     interrupts = <0x13 0x4 0x6>;
>>     dmas = <0x2 0x2 0x9 0x2 0x2 0xa>;
>>     dma-names = "tx", "rx";
>>     pinctrl-names = "default";
>>     pinctrl-0 = <0x12>;
>>     #address-cells = <0x1>;
>>     #size-cells = <0x0>;
>>     clocks = <0x13>;
>>     status = "okay";
>>     clock-frequency = <0x61a80>;
>>     atmel,recover-scl = <0x14 0x1b 0x0>;
>>     atmel,recover-sda = <0x14 0x1a 0x0>;
>>
>>     lsm6ds3@6b {
>>      compatible = "st,lsm6ds3";
>>      reg = <0x6b>;
>>      pinctrl-names = "default";
>>      pinctrl-0 = <0x15>;
>>      interrupt-parent = <0x16>;
>>      interrupts = <0xc 0x1>;
>>      interrupt-names = "lsm6ds_int1";
>>      st,drdy-int-pin = <0x1>;
>>     };
>>    };
>>
>> Version: DTC 1.4.0 (ubuntu package) for manual testing.
>>
>> (1)  fdtdump mix6000.dtb | grep interrupts
>>
>> Thsi returns the interrupt line as:
>>
>> interrupts = <0x0000000c 0x000001d0>;
>>
>> (2) In the linux kernel the of_platform_populate() reads the same property as:
>>
>> 0x0000000c 0x00000000 with lenth=8
>>
>> (3) If I take the DTS file and manually compile the DTB with the dtc
>> compiler, and convert it back to the DTS the correct values are shown
>>
>> (4) If I change the interrupt value:
>>
>> interrupts = <0xc 0x0>;
>>
>> and I do:
>>
>> cat <file-old.dtb> | od -t x1 > file1.txt
>> cat <file-mod.dtb> | od -t x1 > file2.txt
>> kdiff3 file1.txt file2.txt
>>
>> I actually see a single hex byte change from 0x1 to 0x0.
>>
>> If it was not for the faulty fdtdump output (in conjuection with the
>> Linux kernel zero at the same place) I would have said its definately
>> a kernel issue.
>>
>> Any ideas?
>
> You can see what the dtb looked like when given to the kernel. Take
> /sys/firmware/fdt and decompile that with dtc.
>
> If it already looks bad at this point, does your bootloader have any
> way to look at the dtb?
>
> -Frank

Thank you for the hint - this made me discover a very embarrassing
mistake on my behalf.

Our system is complex and has two boot paths (one from eMMC and one
from SDCARD), each with their own DT file. I was testing on the SDCARD
environment and modifying the eMMC DT file. The SDCARD DT file
happened to have the second property on the "interrupts" field hard
coded as zero from a legacy device we had there.

Thank you for your time to answer me. Much appreciated.

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

end of thread, other threads:[~2017-02-03  8:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-02 17:53 DTB file appears to have corrupted node property according to fdtdump and kernel? Frederik Lotter
     [not found] ` <CAPBAm7QSB_-LrAwouztLYLaC0mWF2V4QQ_Yz98p6jVw07SfT6Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-02-02 22:56   ` David Gibson
2017-02-03  2:28   ` Frank Rowand
     [not found]     ` <5893EABE.10009-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-02-03  8:35       ` Frederik Lotter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).