From patchwork Tue Sep 24 13:11:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 1166589 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=samsung.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=samsung.com header.i=@samsung.com header.b="UX1MIvGY"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 46d1qb1B0Nz9sNF for ; Tue, 24 Sep 2019 23:14:19 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id C64E7C21DA6; Tue, 24 Sep 2019 13:12:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_PASS, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 4D603C21E3B; Tue, 24 Sep 2019 13:11:27 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 62A44C21C29; Tue, 24 Sep 2019 13:11:24 +0000 (UTC) Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lists.denx.de (Postfix) with ESMTPS id 0BF06C21D56 for ; Tue, 24 Sep 2019 13:11:22 +0000 (UTC) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20190924131120euoutp0100c825961fe27adffeddd49176bf6b5a~HYfBugcaV0815908159euoutp01D for ; Tue, 24 Sep 2019 13:11:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20190924131120euoutp0100c825961fe27adffeddd49176bf6b5a~HYfBugcaV0815908159euoutp01D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1569330680; bh=cEMZABgKaa+YzhRxfiJSraxsfVXCZudxWQ6OJ+H6ri4=; h=From:To:Cc:Subject:Date:References:From; b=UX1MIvGYnF2ul3NYPQ3d+IcShyNDAS+8nqagsBLN0YZzWb3h15Cw0y8IUs284ODkG unTz7Z7It7fZeCKmAx0+tn6z2ej4lU1xrW+NO2NUZO8Z8KKVCENzf7OjVsHJI6Joar tgW+IiMBXFOsRFH57BkT5PTY8NmuT73/JoZDl1lM= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20190924131120eucas1p2ed063e0b0f6915728ecaa308b6007635~HYfBfIn9o1156211562eucas1p2u; Tue, 24 Sep 2019 13:11:20 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 6D.2B.04309.8F51A8D5; Tue, 24 Sep 2019 14:11:20 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20190924131119eucas1p2e457a2eaa370e6930d90b93d3ace9ce2~HYfBORoQ31156311563eucas1p2m; Tue, 24 Sep 2019 13:11:19 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20190924131119eusmtrp2bc7a0e3755898fc7d54532d0cbb11638~HYfBNosz61486314863eusmtrp2o; Tue, 24 Sep 2019 13:11:19 +0000 (GMT) X-AuditID: cbfec7f4-afbff700000010d5-a9-5d8a15f8c979 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 8B.93.04117.7F51A8D5; Tue, 24 Sep 2019 14:11:19 +0100 (BST) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20190924131119eusmtip222c02e4f466421cad1418252de4ebf1d~HYfAst6NK0370503705eusmtip2X; Tue, 24 Sep 2019 13:11:19 +0000 (GMT) From: Marek Szyprowski To: u-boot@lists.denx.de Date: Tue, 24 Sep 2019 15:11:05 +0200 Message-Id: <20190924131111.1691-1-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrGIsWRmVeSWpSXmKPExsWy7djP87o/RLtiDRZtZrfYOGM9q8WNX22s Fs/fXWayWHvkLrvFgslPWC02zH/LYjFj8ks2i7d7O9kdODzmzTrB4nH2zg5Gj74tqxg91m+5 yuKx6ZVHAGsUl01Kak5mWWqRvl0CV8aZY21sBetEKn7caGNqYHzP38XIySEhYCLx51kPSxcj F4eQwApGiRW/N0A5XxgljvT0M0E4nxkl3i3byA7T0nvxMxtEYjmjxNv3D5ngWhau/c0MUsUm YCjR9baLDcQWEZCQ+NV/lRGkiFlgO5NEe+t1FpCEsICzxNcdcxlBbBYBVYmNl3uYQGxeARuJ BbduQK2Tl1i94QAzSLOEwH02ieef9kElXCRmTNsDZQtLvDq+BcqWkfi/cz4TREMzo8TDc2vZ IZweRonLTTMYIaqsJQ4fv8jaxcgBdJOmxPpd+hBhR4mXW84zgoQlBPgkbrwVBAkzA5mTtk1n hgjzSnS0CUFUq0nMOr4Obu3BC5eYIWwPiYPdJ8CeFxKIlVi/aB7jBEa5WQi7FjAyrmIUTy0t zk1PLTbKSy3XK07MLS7NS9dLzs/dxAhMDaf/Hf+yg3HXn6RDjAIcjEo8vA6sXbFCrIllxZW5 hxglOJiVRHg3abXFCvGmJFZWpRblxxeV5qQWH2KU5mBREuetZngQLSSQnliSmp2aWpBaBJ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p2e457a2eaa370e6930d90b93d3ace9ce2 X-Msg-Generator: CA X-RootMTR: 20190924131119eucas1p2e457a2eaa370e6930d90b93d3ace9ce2 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20190924131119eucas1p2e457a2eaa370e6930d90b93d3ace9ce2 References: Cc: Matthias Brugger , Bartlomiej Zolnierkiewicz , Marek Szyprowski Subject: [U-Boot] [PATCH v2 0/6] Raspberry Pi4: add support for DFU over USB X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" 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. 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: v2: - 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: fix broken write at non-zero file offset 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 | 18 ++--- include/configs/rpi.h | 17 ++++ 7 files changed, 113 insertions(+), 51 deletions(-)