05 Mar, 2018

1 commit

  • Thomas reported U-Boot failed to build host tools if libfdt-devel
    package is installed because tools include libfdt headers from
    /usr/include/ instead of using internal ones.

    This commit moves the header code:
    include/libfdt.h -> include/linux/libfdt.h
    include/libfdt_env.h -> include/linux/libfdt_env.h

    and replaces include directives:
    #include -> #include
    #include -> #include

    Reported-by: Thomas Petazzoni
    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

17 Nov, 2017

1 commit

  • Since the compiler is free to place a char array to any address in
    memory (in this case the stack), also to a non word aligned address the
    function "fdt_prop_parse" runs into troubles upon it wants to write some
    (fdt32_t *) to such a variable (if it has been placed to a none word
    aligned address).

    To avoid this we tell the compiler to always align this scratchpad to a
    word aligned address.

    Signed-off-by: Bernhard Messerklinger
    Reviewed-by: Hannes Schmelzer
    Tested-by: Hannes Schmelzer
    Reviewed-by: Simon Glass

    Bernhard Messerklinger
     

15 Sep, 2017

1 commit


04 Sep, 2017

1 commit

  • This commit brings things back to the well known working state of the
    command.
    -
    With commit 9620d87259572ef21f0df60988d9a932ca673779
    (cmd/fdt: support single value replacement within an array)

    there was an error introduced modifying (inserting) a property to a
    device-tree node.
    fdt_getprop(...) returnes a len with -1 for a non-existing property, but
    a memcpy with len -1 isn't a good idea and things went wrong (crash).
    -
    Some times later Tom did repair this
    with commit 99bb38e2cce9d99238458e0f6d1880c6d2e80a4d
    (fdt: Check for NULL return from fdt_getprop in 'fdt set')

    This repairs the crash but the behaviour of the command isn't like
    before, it makes it impossible to insert a property.
    -

    Signed-off-by: Hannes Schmelzer
    Acked-by: Simon Glass

    Hannes Schmelzer
     

16 Aug, 2017

3 commits


12 Jul, 2017

1 commit

  • While the previous pass through fixed one place where we knew that
    fdt_getprop would be given a positive len, in the case of 'fdt set' we
    do not, so check that we did no get NULL from fdt_getprop().

    Cc: Simon Glass
    Reported-by: Coverity (CID: 163249)
    Fixes 72c98ed1ab48 ("fdt: Add a check to do_fdt() for coverity")
    Signed-off-by: Tom Rini
    Reviewed-by: Simon Glass

    Tom Rini
     

12 Jun, 2017

2 commits


10 Jun, 2017

1 commit

  • With this commit we can modify single values within an array of a dts
    property.

    This is useful if we have for example a pwm-backlight where we want to
    modifiy the pwm frequency per u-boot script.

    The pwm is described in dts like this:

    backlight {
    pwms = ;
    };

    For changing the frequency, here the 3rd parameter, we simply type:

    fdt set /backlight pwms ;

    For doing all this we:
    - backup the property content into our 'SCRATCHPAD'
    - only modify the array-cell if the new content doesn't start with '?'

    Signed-off-by: Hannes Schmelzer
    Reviewed-by: Simon Glass

    Hannes Schmelzer
     

22 May, 2017

1 commit


15 Jan, 2017

1 commit

  • On a Raspberry Pi 2 disagreements on cell endianness can be observed:

    U-Boot> fdt print /soc/gpio@7e200000 phandle
    phandle =
    U-Boot> fdt get value myvar /soc/gpio@7e200000 phandle; printenv myvar
    myvar=0x0D000000

    Fix this by always treating the pointer as BE and converting it in
    fdt_value_setenv(), like its counterpart fdt_parse_prop() already does.

    Consistently use fdt32_t, fdt32_to_cpu() and cpu_to_fdt32().

    Fixes: bc80295 ("fdt: Add get commands to fdt")
    Cc: Joe Hershberger
    Cc: Gerald Van Baren
    Signed-off-by: Andreas Färber
    Acked-by: Simon Glass

    Andreas Färber
     

14 Jan, 2017

1 commit


03 Dec, 2016

1 commit

  • The function that is processing the 'fdt' parameters is one big
    if-else if. In order to be able to type command faster only the first
    few letter are checked to know which block of code to execute. For
    systemsetup, the block of code that was executed was always the wrong
    one and ended up in a failure.

    } else if (argv[1][0] == 's') {
    process "fdt set" command
    } else if (strncmp(argv[1], "sys", 3) == 0) {
    process "fdt systemsetup" command.
    }

    When typing "fdt systemsetup", the code that was executed was the code
    for "fdt set".

    This commit fix this issue by moving the "else if" for systemsetup
    before the else if for "fdt set". This allow us to keep compatibility
    with any script that make use of "fdt s" to set node values.

    Signed-off-by: Fabien Parent
    Acked-by: Simon Glass

    Fabien Parent
     

14 Oct, 2016

1 commit

  • Sometimes devicetree nodes and or properties are added out of the u-boot
    console, maybe through some script or manual interaction.

    The devicetree as loaded or embedded is quite small, so the devicetree
    has to be resized to take up those new nodes/properties.

    In original the devicetree was only extended by effective
    4 * add_mem_rsv.

    With this commit we can add an argument to the "fdt resize" command,
    which takes the extrasize to be added.

    Signed-off-by: Hannes Schmelzer

    Signed-off-by: Hannes Schmelzer
    Acked-by: Simon Glass

    Hannes Schmelzer
     

20 Aug, 2016

2 commits

  • The device tree overlays are a good way to deal with user-modifyable
    boards or boards with some kind of an expansion mechanism where we can
    easily plug new board in (like the BBB or the raspberry pi).

    However, so far, the usual mechanism to deal with it was to have in Linux
    some driver detecting the expansion boards plugged in and then request
    these overlays using the firmware interface.

    That works in most cases, but in some cases, you might want to have the
    overlays applied before the userspace comes in. Either because the new
    board requires some kind of an early initialization, or because your root
    filesystem is accessed through that expansion board.

    The easiest solution in such a case is to simply have the component before
    Linux applying that overlay, removing all these drawbacks.

    Reviewed-by: Stefan Agner
    Acked-by: Pantelis Antoniou
    Acked-by: Simon Glass
    Signed-off-by: Maxime Ripard

    Maxime Ripard
     
  • The current code only checks if the fdt subcommand is fdt addr by checking
    whether it starts with 'a'.

    Since this is a pretty widely used letter, narrow down that check a bit.

    Acked-by: Simon Glass
    Acked-by: Pantelis Antoniou
    Signed-off-by: Maxime Ripard

    Maxime Ripard
     

06 May, 2016

1 commit


25 Jan, 2016

1 commit

  • Now that they are in their own directory, we can remove this prefix.
    This makes it easier to find a file since the prefix does not get in the
    way.

    Signed-off-by: Simon Glass
    Reviewed-by: Bin Meng
    Reviewed-by: Heiko Schocher
    Acked-by: Stefan Roese
    Acked-by: Przemyslaw Marczak

    Simon Glass