From patchwork Tue Nov 26 08:15:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 1200793 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) 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="R2M33h3i"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 47McDD4f7cz9sP3 for ; Tue, 26 Nov 2019 19:15:56 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id ED155C21F38; Tue, 26 Nov 2019 08:15:50 +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 211E9C21E3A; Tue, 26 Nov 2019 08:15:48 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 2813AC21E4F; Tue, 26 Nov 2019 08:15:46 +0000 (UTC) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lists.denx.de (Postfix) with ESMTPS id 9624FC21E31 for ; Tue, 26 Nov 2019 08:15:45 +0000 (UTC) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20191126081544euoutp02194aeb523b700783650bd45d794cd5a2~aqF60VFz30263002630euoutp02a for ; Tue, 26 Nov 2019 08:15:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20191126081544euoutp02194aeb523b700783650bd45d794cd5a2~aqF60VFz30263002630euoutp02a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1574756144; bh=Uir1bqEL7puJmEeEL4/ALvpOqWNGqW8M7fBEPpJDkpE=; h=From:To:Cc:Subject:Date:References:From; b=R2M33h3i2NF8JOwDXePUhk4DKFueXIwshAzOF1+4vHFWvWgvsl2w7NfzdegOb4INv WvTJccUIq512MX9h/Wfb1jeBXIE068AQmh1ScTrZcb1m6Tj5+W3bPtijpZbay5D3U4 H3zDfQo4uhbjFJ6Asv/EjhW8hUbiSPiySQxXVJIM= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20191126081544eucas1p187126e71d14b7b33d1b1b7991048fdaf~aqF6lu9vi0608006080eucas1p1e; Tue, 26 Nov 2019 08:15:44 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 29.97.61286.03FDCDD5; Tue, 26 Nov 2019 08:15:44 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20191126081543eucas1p2a86f5aecbfd7bdf740574fec2671bb4b~aqF510fFP2623426234eucas1p2T; Tue, 26 Nov 2019 08:15:43 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20191126081543eusmtrp190788db47fefa28d859494a5c16c9f30~aqF51I-F62279022790eusmtrp1n; Tue, 26 Nov 2019 08:15:43 +0000 (GMT) X-AuditID: cbfec7f2-f0bff7000001ef66-40-5ddcdf3049a8 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 7E.C3.08375.F2FDCDD5; Tue, 26 Nov 2019 08:15:43 +0000 (GMT) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20191126081542eusmtip210caed12907a2a3643cc0874f7315016~aqF5YXEDR2192621926eusmtip2M; Tue, 26 Nov 2019 08:15:42 +0000 (GMT) From: Marek Szyprowski To: u-boot@lists.denx.de Date: Tue, 26 Nov 2019 09:15:06 +0100 Message-Id: <20191126081512.5138-1-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrGIsWRmVeSWpSXmKPExsWy7djPc7oG9+/EGuzdx2qxccZ6Vosbv9pY LZ6/u8xksfbIXXaLBZOfsFpsmP+WxWLG5JdsFm/3drI7cHjMm3WCxePsnR2MHn1bVjF6rN9y lcVj0yuPANYoLpuU1JzMstQifbsErox90xayFWwWr9j3ZRdLA+MuoS5GTg4JAROJV1fWsHUx cnEICaxglHh07SIjhPOFUWJS62FWCOczo8TWVy/ZYVqWzZ0JlVjOKHG8fR4zXMudey1sIFVs AoYSXW+7wGwRAQmJX/1XweYyC2xnkmhvvc4CkhAWcJY4uW4p2FgWAVWJqY+XMYPYvAI2Epcm 7mOEWCcvsXrDAbANEgKP2SSeNd5ghUi4SGx/P5EFwhaWeHV8C9R9MhKnJ/ewQDQ0M0o8PLeW HcLpYZS43DQDaqy1xOHjF4EmcQDdpCmxfpc+RNhR4vzvLWBhCQE+iRtvBUHCzEDmpG3TmSHC vBIdbdDQU5OYdXwd3NqDFy4xQ9geEi1XroKdJiQQK3Fj60XGCYxysxB2LWBkXMUonlpanJue WmyYl1quV5yYW1yal66XnJ+7iRGYGk7/O/5pB+PXS0mHGAU4GJV4eH+cvR0rxJpYVlyZe4hR goNZSYRX+/CdWCHelMTKqtSi/Pii0pzU4kOM0hwsSuK81QwPooUE0hNLUrNTUwtSi2CyTByc Ug2Ma2ae9ltwOVx8sZpG7Cru+HuTtkgdNjbxPZi9dJXXthlGSfVM9/YFunZfT4tKvZBoxTih Tyx9z84fcx1tUlMNtfQuz7vq+r9Q4rqR3NXVQZreb6boRshMkBbvXDDfWnCvsq/WJPbw9PXf OTn3l0dWVPavWG/udoV50a7OaW7u/r+nrLxamrpXiaU4I9FQi7moOBEAQWbrCgkDAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrFLMWRmVeSWpSXmKPExsVy+t/xe7r69+/EGvzcJWKxccZ6Vosbv9pY LZ6/u8xksfbIXXaLBZOfsFpsmP+WxWLG5JdsFm/3drI7cHjMm3WCxePsnR2MHn1bVjF6rN9y lcVj0yuPANYoPZui/NKSVIWM/OISW6VoQwsjPUNLCz0jE0s9Q2PzWCsjUyV9O5uU1JzMstQi fbsEvYx90xayFWwWr9j3ZRdLA+MuoS5GTg4JAROJZXNnsoLYQgJLGSVa+hQg4jISJ6c1sELY whJ/rnWxdTFyAdV8YpRY/mQmO0iCTcBQoustSIKTQ0RAQuJX/1VGkCJmgd1MEtdXHWMESQgL OEucXLcUrIFFQFVi6uNlzCA2r4CNxKWJ+xghNshLrN5wgHkCI88CRoZVjCKppcW56bnFhnrF ibnFpXnpesn5uZsYgeG47djPzTsYL20MPsQowMGoxMP74+ztWCHWxLLiytxDjBIczEoivNqH 78QK8aYkVlalFuXHF5XmpBYfYjQFWj6RWUo0OR8YK3kl8YamhuYWlobmxubGZhZK4rwdAgdj hATSE0tSs1NTC1KLYPqYODilGhj1pz3mvW5xoCV0RdOCiX92Zhb16zIt1g6x+isftqXrnX+n ubqz9QUdC/GmmkOGAXP37/rVF8C6STly402+ti42tyZtvmQL1uMrLf4+9GBsT2dTVhT4uuBJ 8OrpVZ78Bncm1W6b9OXRkjuHA8NqNV43sDqKMXM8FfTxejPTRf9l0NznU9enRSuxFGckGmox FxUnAgDocDm7XQIAAA== X-CMS-MailID: 20191126081543eucas1p2a86f5aecbfd7bdf740574fec2671bb4b X-Msg-Generator: CA X-RootMTR: 20191126081543eucas1p2a86f5aecbfd7bdf740574fec2671bb4b X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20191126081543eucas1p2a86f5aecbfd7bdf740574fec2671bb4b References: Cc: Matthias Brugger , Bartlomiej Zolnierkiewicz , Marek Szyprowski Subject: [U-Boot] [PATCH v3 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 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: v3: - 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: 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 | 19 +++-- include/configs/rpi.h | 20 +++++ 7 files changed, 116 insertions(+), 52 deletions(-)