06 Feb, 2020

1 commit

  • At present devres.h is included in all files that include dm.h but few
    make use of it. Also this pulls in linux/compat which adds several more
    headers. Drop the automatic inclusion and require files to include devres
    themselves. This provides a good indication of which files use devres.

    Signed-off-by: Simon Glass
    Reviewed-by: Anatolij Gustschin

    Simon Glass
     

05 Feb, 2020

1 commit


03 Feb, 2020

1 commit


30 Jan, 2020

2 commits

  • Add support for operations on files larger than
    CONFIG_SYS_DFU_MAX_FILE_SIZE. The buffered io mechanism is still used for
    aggregating io requests, so for files up to CONFIG_SYS_DFU_MAX_FILE_SIZE
    nothing is changed and they will be handled in a single filesystem call.

    Signed-off-by: Marek Szyprowski
    Acked-by: Lukasz Majewski
    Signed-off-by: Matthias Brugger

    Marek Szyprowski
     
  • Rename functions for bufferred file io operations to make them easier to
    understand. Also add missing file offset argument to them (currently
    unused). All this is a preparation to remove predefined file size limit
    (CONFIG_SYS_DFU_MAX_FILE_SIZE) for DFU read/write operations.

    Signed-off-by: Marek Szyprowski
    Acked-by: Lukasz Majewski
    Signed-off-by: Matthias Brugger

    Marek Szyprowski
     

07 Jan, 2020

1 commit

  • When the `dfu` command is called from the U-Boot environment,
    it now accepts an optional parameter that specifies a timeout (in seconds).
    If a DFU connection is not made within that time the `dfu` command exits
    (as it would if Ctrl+C was pressed). If the timeout is left empty or being
    zero the `dfu` command behaves as it does now.

    This is useful for allowing U-Boot to check to see if anything wants to
    upload new firmware before continuing to boot.

    The patch is based on the commit
    https://github.com/01org/edison-u-boot/commit/5e966ccc3c65c18c9783741fa04e0c45e021780c
    by Sebastien Colleur, which has been heavily reworked due to U-Boot changes
    in the past.

    Signed-off-by: Brad Campbell
    Signed-off-by: Andy Shevchenko

    Andy Shevchenko
     

05 Dec, 2019

1 commit


04 Dec, 2019

1 commit


31 Oct, 2019

11 commits

  • Add weak callback to allow board specific behavior
    - flush
    - initiated

    This patch prepare usage of DFU back end for communication with
    STM32CubeProgrammer on stm32mp1 platform with stm32prog command.

    Signed-off-by: Patrick Delaunay

    Patrick Delaunay
     
  • Add a virtual DFU backend to allow board specific read and write
    (for OTP update for example).

    Acked-by: Lukasz Majewski
    Signed-off-by: Patrick Delaunay

    Patrick Delaunay
     
  • Add the support of MTD partition for the MTD backend.

    The expected dfu_alt_info for one alternate on the mtd device :
    part
    partubi

    "partubi" also erase up to the end of the partition after write operation.

    For example: dfu_alt_info = "spl part 1;u-boot part 2; UBI partubi 3"

    U-Boot> dfu 0 mtd nand0

    Acked-by: Lukasz Majewski
    Signed-off-by: Patrick Delaunay

    Patrick Delaunay
     
  • Add DFU backend for MTD device: allow to read
    and write on all MTD device (NAND, SPI-NOR,
    SPI-NAND,...)

    For example :
    > set dfu_alt_info "nand_raw raw 0x0 0x100000"
    > dfu 0 mtd nand0

    This MTD backend provides the same level than dfu nand
    backend for NAND and dfu sf backend for SPI-NOR;
    So it can replace booth of them but it also
    add support of spi-nand.

    > set dfu_alt_info "nand_raw raw 0x0 0x100000"
    > dfu 0 mtd spi-nand0

    The backend code is based on the "mtd" command
    introduced by commit 5db66b3aee6f ("cmd: mtd:
    add 'mtd' command")

    Signed-off-by: Patrick Delaunay

    Patrick Delaunay
     
  • This patch allows the DFU backend to indicate that that it can't
    provide no more data to fill the DFU buffer, by setting b_left =0
    without error, even if the size of received data is lower of the
    expected total size indicated by get_medium_size.

    For USB DFU stack point of view, it is acceptable:
    the read length < requested size in DFU_UPLOAD and the
    transaction is stopped.

    That avoid infinite loop issue in dfu_read_buffer_fill because the
    size for the DFU read is limited by get_medium_size = r_left
    and the DFU stack expects that read is allowed up to this size.

    This issue never occurs for current flash device (where chunk are
    always completely read, and b_left will be never 0) but it is useful for
    virtual partition when the backend only know the max size of this
    alternate, the real size of the data are only known in the read
    treatment.

    PS: for file access on mmc, EOF is never reached as
    dfu_get_medium_size_mmc returns the exact size of the file.

    Signed-off-by: Patrick Delaunay

    Patrick Delaunay
     
  • Add support of DFU for several interface/device
    with one command.

    The format for "dfu_alt_info" in this case is :
    - '='alternate list (';' separated)
    - each interface is separated by '&'

    The previous behavior is always supported.

    One example for NOR (bootloaders) + NAND (rootfs in UBI):

    U-Boot> env set dfu_alt_info \
    "sf 0:0:10000000:0=spl part 0 1;u-boot part 0 2; \
    u-boot-env part 0 3&nand 0=UBI partubi 0,3"

    U-Boot> dfu 0 list

    DFU alt settings list:
    dev: SF alt: 0 name: spl layout: RAW_ADDR
    dev: SF alt: 1 name: ssbl layout: RAW_ADDR
    dev: SF alt: 2 name: u-boot-env layout: RAW_ADDR
    dev: NAND alt: 3 name: UBI layout: RAW_ADDR

    U-Boot> dfu 0

    $> dfu-util -l

    Found DFU: [0483:5720] ver=9999, devnum=96, cfg=1,\
    intf=0, alt=3, name="UBI", serial="002700333338511934383330"
    Found DFU: [0483:5720] ver=9999, devnum=96, cfg=1,\
    intf=0, alt=2, name="u-boot-env", serial="002700333338511934383330"
    Found DFU: [0483:5720] ver=9999, devnum=96, cfg=1,\
    intf=0, alt=1, name="u-boot", serial="002700333338511934383330"
    Found DFU: [0483:5720] ver=9999, devnum=96, cfg=1,\
    intf=0, alt=0, name="spl", serial="002700333338511934383330"

    Signed-off-by: Patrick Delaunay

    Patrick Delaunay
     
  • Split the function dfu_config_entities with 2 new functions
    - dfu_alt_init
    - dfu_alt_add

    Signed-off-by: Patrick Delaunay

    Patrick Delaunay
     
  • Copy the partition support from NAND backend to SF,
    support part and partubi option.
    In case of ubi partition, erase the rest of the
    partition as it is mandatory for UBI.

    The added code is under compilation flag CONFIG_DFU_SF_PART
    activated by default.

    for example:

    U-Boot> env set dfu_alt_info "spl part 0 1;\
    u-boot part 0 2;u-boot-env part 0 3;UBI partubi 0 4"
    U-Boot> dfu 0 sf 0:0:10000000:0

    Signed-off-by: Patrick Delaunay

    Patrick Delaunay
     
  • Signed-off-by: Patrick Delaunay
    Acked-by: Lukasz Majewski

    Patrick Delaunay
     
  • Add possibility to define a part of partition as a separate DFU entity.
    This allows to have more than one items on the given partition.

    The real use case for this option is TM2 board. It can use u-boot stored
    as Linux kernel on the defined partition (as RAW data) and load the real
    kernel from the same partition, but stored under the certain offset.

    Signed-off-by: Marek Szyprowski
    Acked-by: Lukasz Majewski

    Marek Szyprowski
     
  • In combination with multiple partitions in NAND, this printf() ends up
    being more noise than helpful. Change it to debug() instead.

    Signed-off-by: Ralph Siemsen
    Acked-by: Lukasz Majewski

    Ralph Siemsen
     

12 Aug, 2019

1 commit


31 Jan, 2019

1 commit

  • This unbreaks dfu mmc_file_op which is currently broken since using the
    load cmd on a buffer from heap is not allowed - added with
    commit aa3c609e2be5 ("fs: prevent overwriting reserved memory")

    Fixes: commit aa3c609e2be5 ("fs: prevent overwriting reserved memory")
    Reported-by: Stephen Warren
    Signed-off-by: Simon Goldschmidt
    Tested-by: Stephen Warren
    Acked-by: Lukasz Majewski

    Simon Goldschmidt
     

26 Jan, 2019

1 commit

  • Do this by using $(SPL_) in Makefiles and CONFIG_IS_ENABLED in C code.
    This ensures the files and features are only built into the right build
    for which they are enabled. Using the macros to simplify this patch was
    made possible by the config symbol rename done in the last patch.

    Signed-off-by: Andrew F. Davis
    Reviewed-by: Tom Rini
    Acked-by: Lukasz Majewski

    Andrew F. Davis
     

13 Nov, 2018

1 commit

  • dfu_fill_entity_nand() uses find_dev_and_part() and mtdparts_init()
    which are provided by cmd/mtdparts.c.

    Add the dependency to avoid build failures when CMD_MTDPARTS is not
    selected.

    Reported-by: Jagan Teki
    Fixes: 6828e602b722d ("dfu: Migrate to Kconfig")
    Signed-off-by: Boris Brezillon
    Reviewed-by: Lukasz Majewski
    Reviewed-by: Jagan Teki

    Boris Brezillon
     

09 Aug, 2018

3 commits

  • It might be useful for user to see some human-readable root cause
    message in addition to "configuration failed" message, so that the issue
    can be fixed quickly.

    Signed-off-by: Sam Protsenko

    Sam Protsenko
     
  • In case of error in dfu_init_env_entities(), env_bkp will leak. Fix it
    by providing single return path.

    Signed-off-by: Sam Protsenko

    Sam Protsenko
     
  • Commit 5d8fae79163e ("dfu: avoid memory leak") brings a regression which
    described below. This patch is effectively reverting that commit, adding
    corresponding comment to avoid such regressions in future.

    In case of error in dfu_config_entities(), it frees "dfu" array, which
    leads to "data abort" in dfu_free_entities(), which tries to free the
    same array (and even tries to access it from linked list first). The
    issue occurs e.g. when partition table on device does not match
    $dfu_alt_info layout:

    => dfu 0 mmc 1
    Couldn't find part #2 on mmc device #1
    DFU entities configuration failed!
    data abort

    To fix this issue, do not free "dfu" array in dfu_config_entities(). It
    will be freed later in dfu_free_entities().

    Tested on BeagleBone Black (where this regression was originally found).

    Signed-off-by: Sam Protsenko

    Sam Protsenko
     

07 May, 2018

1 commit

  • When U-Boot started using SPDX tags we were among the early adopters and
    there weren't a lot of other examples to borrow from. So we picked the
    area of the file that usually had a full license text and replaced it
    with an appropriate SPDX-License-Identifier: entry. Since then, the
    Linux Kernel has adopted SPDX tags and they place it as the very first
    line in a file (except where shebangs are used, then it's second line)
    and with slightly different comment styles than us.

    In part due to community overlap, in part due to better tag visibility
    and in part for other minor reasons, switch over to that style.

    This commit changes all instances where we have a single declared
    license in the tag as both the before and after are identical in tag
    contents. There's also a few places where I found we did not have a tag
    and have introduced one.

    Signed-off-by: Tom Rini

    Tom Rini
     

22 Feb, 2018

3 commits

  • Fix two build warnings when building for arm64:

    drivers/dfu/dfu_tftp.c: In function ‘dfu_tftp_write’:
    drivers/dfu/dfu_tftp.c:59:37: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
    ret = dfu_write_from_mem_addr(dfu, (void *)addr, len);
    ^
    and

    drivers/dfu/dfu_tftp.c: In function ‘dfu_tftp_write’:
    drivers/dfu/dfu_tftp.c:41:8: warning: format ‘%u’ expects argument of type ‘unsigned int’, but argument 4 has type ‘__kernel_size_t {aka long unsigned int}’ [-Wformat=]
    debug("%s: image name: %s strlen: %u\n", __func__, sb, strlen(sb));
    ^

    Signed-off-by: Marek Vasut
    Cc: Lukasz Majewski

    Marek Vasut
     
  • Do the following to make the symbol names less confusing.

    sed -i "s/\([TU][^_]\+\)_FUNCTION_DFU/DFU_OVER_\1/g" \
    `git grep _FUNCTION_DFU | cut -d ":" -f 1 | sort -u`

    Signed-off-by: Marek Vasut
    Cc: Lukasz Majewski

    Marek Vasut
     
  • Clean up the screaming mess of configuration options that DFU is.
    It was impossible to configure DFU such that TFTP is enabled and
    USB is not, this patch fixes that and assures that DFU TFTP and
    DFU USB can be enabled separatelly and that the correct pieces
    of code are compiled in.

    Signed-off-by: Marek Vasut
    Cc: Lukasz Majewski

    Marek Vasut
     

26 Jan, 2018

1 commit


04 Oct, 2017

1 commit

  • U-Boot widely uses error() as a bit noisier variant of printf().

    This macro causes name conflict with the following line in
    include/linux/compiler-gcc.h:

    # define __compiletime_error(message) __attribute__((error(message)))

    This prevents us from using __compiletime_error(), and makes it
    difficult to fully sync BUILD_BUG macros with Linux. (Notice
    Linux's BUILD_BUG_ON_MSG is implemented by using compiletime_assert().)

    Let's convert error() into now treewide-available pr_err().

    Done with the help of Coccinelle, excluing tools/ directory.

    The semantic patch I used is as follows:

    //
    @@@@
    -error
    +pr_err
    (...)
    //

    Signed-off-by: Masahiro Yamada
    Reviewed-by: Simon Glass
    [trini: Re-run Coccinelle]
    Signed-off-by: Tom Rini

    Masahiro Yamada
     

16 Aug, 2017

1 commit

  • We are now using an env_ prefix for environment functions. Rename these
    two functions for consistency. Also add function comments in common.h.

    Quite a few places use getenv() in a condition context, provoking a
    warning from checkpatch. These are fixed up in this patch also.

    Suggested-by: Wolfgang Denk
    Signed-off-by: Simon Glass

    Simon Glass
     

29 Jul, 2017

4 commits


12 Jul, 2017

1 commit


04 Jun, 2017

1 commit


12 May, 2017

1 commit