Dear All, This is a quick-and-dirty proof-of-concept for splitting the dfu into core dfu gadget, generic parts of dfu backend, dfu command and target-specific implementation for Goni.
This patch definitely needs some coding style cleanups. Also, the place for storing generic parts of dfu was chosen somewhat arbitrary and can be changed if a better alternative is found. The original idea of the flash_entity was to equip it with a void * to a context structure, which is not interpreted by the dfu gadget but passed to the dfu backend and understood there. I am still hesitating if flash_entity_ctx is generic enough to be generalized, as of now I assumed it is. If it wasn't then less common code could be extracted. @Stefan: you need the first 3 patches from this series, and then you need to implement your own target-specific parts. In fact, all is expected from the target, is to provide board_dfu_init/cleanup pair and call register_flash_entities. Andrzej Pietrasiewicz (4): dfu: protocol initial implementation dfu: generic backend parts dfu: command implementation dfu: target-specific implementation for Goni Makefile | 1 + board/samsung/goni/Makefile | 2 + board/samsung/goni/flash.c | 341 ++++++++++++++++ board/samsung/goni/flash.h | 28 ++ board/samsung/goni/goni.c | 17 + common/Makefile | 1 + common/cmd_dfu.c | 51 +++ drivers/usb/dfu/Makefile | 33 ++ drivers/usb/dfu/dfu.c | 109 +++++ drivers/usb/dfu/fat.c | 77 ++++ drivers/usb/dfu/mmc.c | 124 ++++++ drivers/usb/gadget/Makefile | 1 + drivers/usb/gadget/dfu.c | 920 +++++++++++++++++++++++++++++++++++++++++++ drivers/usb/gadget/dfu.h | 171 ++++++++ include/configs/s5p_goni.h | 4 + include/dfu.h | 28 ++ include/dfu_backend.h | 71 ++++ include/flash_entity.h | 39 ++ include/mbr.h | 49 +++ 19 files changed, 2067 insertions(+), 0 deletions(-) create mode 100644 board/samsung/goni/flash.c create mode 100644 board/samsung/goni/flash.h create mode 100644 common/cmd_dfu.c create mode 100644 drivers/usb/dfu/Makefile create mode 100644 drivers/usb/dfu/dfu.c create mode 100644 drivers/usb/dfu/fat.c create mode 100644 drivers/usb/dfu/mmc.c create mode 100644 drivers/usb/gadget/dfu.c create mode 100644 drivers/usb/gadget/dfu.h create mode 100644 include/dfu.h create mode 100644 include/dfu_backend.h create mode 100644 include/flash_entity.h create mode 100644 include/mbr.h _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot