All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Szyprowski <m.szyprowski@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4 0/6] Raspberry Pi4: add support for DFU over USB
Date: Mon,  2 Dec 2019 12:11:12 +0100	[thread overview]
Message-ID: <20191202111118.12868-1-m.szyprowski@samsung.com> (raw)
In-Reply-To: CGME20191202111128eucas1p1398c5729ba6af763c7866cfd5462e3d1@eucas1p1.samsung.com

Hi All!

This patchset enables support for DFU over USB protocol on Raspberry Pi4
board. The board has DWC2 UDC controller connected to the USB-C power
connector. Enabling DFU on it, make the u-boot development much more
convenient, as one no longer needs to swap SD-card between RPi4 board and
host machine to update the u-boot binary.

Patches are based on current 'master' u-boot branch. They were tested on
the 2019-07-10-raspbian-buster-lite.img sd-card image with the following
lines added to config.txt:
dtoverlay=dwc2,dr_mode=peripheral
dtparam=i2c_arm=on
dtparam=spi=on
enable_uart=1
uart_2ndstage=1
kernel=u-boot.bin

To enable DFU, one has to enter follwing command:
# dfu 0 mmc 0

During the development of this feature I've encountered a serious bugs
in FAT write code. Over-writing discontiguous files always caused serious
filesystem corruption. This was especially anoying, because the system
environment is kept on FAT volume in uboot.env file, so 'saveenv'
basically corrupted the boot partiting on the second call. Another bunch
of the issues in the FAT write code has been revealed while removing
predefined file size limit in DFU MMC code and then running sandbox
tests.

I hope that my fixes for FAT code will be helpful for non-RPi users too.

Best regards
Marek Szyprowski
Samsung R&D Institute Poland


Changelog:

v4:
- rechecked the FAT related fixes, it turned out that much simpler patch
  fixes both issues discovered while working on DFU support; added simple
  sandbox based tests reveleaing the issue and showing correctness
  of the fix
- rebased patches onto current u-boot's master branch: 4b19b89ca4a8
  ("Merge tag 'rpi-next-2020.01' of https://github.com/mbgg/u-boot")

v3: https://patchwork.ozlabs.org/cover/1200793/
- fixed one more FAT issue revealed by sandbox tests

v3: (patch 6/6 posted separately): https://patchwork.ozlabs.org/patch/1195645/
- fixed non-RPi4 builds (missing #else ENV_DFU_SETTINGS def)
- removed config.txt entity (not needed in uboot-based boot)
- switched arm64 kernel filename to 'Image'

v2: https://patchwork.ozlabs.org/cover/1166589/
- added changes to rpi_4_defconfig too (arm64 version)
- extended DFU entity list by confix.txt, cmdline.txt and Image.gz
- fixed missing '\0' at the end of dfu_alt_info env
- added reviewed-by tags
- added patches for DFU MMC to remove file size limit
- added patch for fat write to fix issues on non-zero file offset
  (revealed by previous patch)

v1: https://patchwork.ozlabs.org/cover/1162770/
- initial version


Patch summary:

Marek Szyprowski (6):
  fat: write: fix broken write to fragmented files
  fat: write: adjust data written in each partial write
  dfu: mmc: rearrange the code
  dfu: mmc: remove file size limit for io operations
  usb: dwc2_udc_otg: add bcm2835 SoC (Raspberry Pi4) support
  config: enable DFU over USB on Raspberry Pi4 boards

 configs/rpi_4_32b_defconfig                | 11 +++
 configs/rpi_4_defconfig                    | 11 +++
 drivers/dfu/dfu_mmc.c                      | 93 +++++++++++++---------
 drivers/usb/gadget/dwc2_udc_otg.c          |  2 +
 drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c | 12 +--
 fs/fat/fat_write.c                         |  8 +-
 include/configs/rpi.h                      | 20 +++++
 7 files changed, 112 insertions(+), 45 deletions(-)

-- 
2.17.1

       reply	other threads:[~2019-12-02 11:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20191202111128eucas1p1398c5729ba6af763c7866cfd5462e3d1@eucas1p1.samsung.com>
2019-12-02 11:11 ` Marek Szyprowski [this message]
     [not found]   ` <CGME20191202111129eucas1p271b4ed0d90cb10addce5fefa0af576aa@eucas1p2.samsung.com>
2019-12-02 11:11     ` [U-Boot] [PATCH v4 1/6] fat: write: fix broken write to fragmented files Marek Szyprowski
2019-12-05 16:52       ` Lukasz Majewski
2019-12-05 17:58         ` Matthias Brugger
2019-12-05 18:37           ` Tom Rini
2020-02-08  0:05       ` [U-Boot] " Tom Rini
     [not found]   ` <CGME20191202111129eucas1p29846d2823438c5f9e7192925862e1df5@eucas1p2.samsung.com>
2019-12-02 11:11     ` [U-Boot] [PATCH v4 2/6] fat: write: adjust data written in each partial write Marek Szyprowski
2020-02-08  0:05       ` Tom Rini
     [not found]   ` <CGME20191202111130eucas1p22c4bc5190db03f1f3e0f2bdaf0f839e6@eucas1p2.samsung.com>
2019-12-02 11:11     ` [U-Boot] [PATCH v4 3/6] dfu: mmc: rearrange the code Marek Szyprowski
     [not found]   ` <CGME20191202111131eucas1p1ed88eead5f2dc4cb4bd6218aefde50fe@eucas1p1.samsung.com>
2019-12-02 11:11     ` [U-Boot] [PATCH v4 4/6] dfu: mmc: remove file size limit for io operations Marek Szyprowski
     [not found]   ` <CGME20191202111131eucas1p27821b1ee9dcca16146060fd744726a3c@eucas1p2.samsung.com>
2019-12-02 11:11     ` [U-Boot] [PATCH v4 5/6] usb: dwc2_udc_otg: add bcm2835 SoC (Raspberry Pi4) support Marek Szyprowski
     [not found]   ` <CGME20191202111132eucas1p1e25756addc317af3069b77557c8de60b@eucas1p1.samsung.com>
2019-12-02 11:11     ` [U-Boot] [PATCH v4 6/6] config: enable DFU over USB on Raspberry Pi4 boards Marek Szyprowski
2020-01-28 11:20       ` Matthias Brugger
2020-01-28 11:31         ` Jaehoon Chung
2020-01-27 22:36   ` [PATCH v4 0/6] Raspberry Pi4: add support for DFU over USB Lukasz Majewski
2020-01-28 11:11     ` Matthias Brugger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191202111118.12868-1-m.szyprowski@samsung.com \
    --to=m.szyprowski@samsung.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.