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
     

31 Oct, 2019

7 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
     
  • 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
     
  • 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
     
  • Add documentation for dfu stack and "dfu" command.

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

    Patrick Delaunay