From patchwork Wed Nov 7 15:01:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 150404 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp5275466ljp; Wed, 7 Nov 2018 07:04:53 -0800 (PST) X-Google-Smtp-Source: AJdET5fo1fhd4UtFajR/Qp+1WxMbTIR/E+Kw1SdCQXT3cjtJqMn0/cSDp9em9WRLL96R8iq+5CGM X-Received: by 2002:a50:f4c3:: with SMTP id v3-v6mr438243edm.223.1541603093762; Wed, 07 Nov 2018 07:04:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541603093; cv=none; d=google.com; s=arc-20160816; b=X4PvYQhr/wjKZ64htqEkpOaquX5t1QCJ2VN7NDlm6WQNyAtg4QdqmiXebRhrLXyNk3 LD6BfIfw6lvFBdSCoRZY+HmumszWDH/2bdzeZyp4+U5gZ+7wL3iL4iGqbS9xUQeYQFJO k5p8Dqmz8p3nKf9iBM9cUKibLgB8j5hlI1KdN4r+4V2t+tHuLipfRNYZ2fNNtCbp86Z+ q88Q23pg5W7aDjytUyCwGWcMtTfX4O8/BfwLL8voVwTheAoDK7YFdamslE10WIdXB96j d89ctmK9xyLKAvBq/2CfuEzmDqxxAv9S+tq+yR0ZzmFt8KR/OqaeqYYodIJ1HRVAZpyI Un4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:cms-type:in-reply-to :message-id:date:to:from:dkim-signature:dkim-filter; bh=3I4dI0AsVD5Hyf2hxwEKpnAqiJX+A2swi5IeKt0ZukI=; b=x0ChJwCy7cfObREnni5BFO2/sJmbYJZtlzPc2RcivQMQo8C7vjszNnZcfPLdYKfQEU PF5vQjw7/7EeP1xPrDE+OiPkyCEjCOj/FHb5I8uNXkTfpMjI3LGtASNbdEmsuCXL7Ba+ gbfwVAug5LhHXmgxBu6yOl9E2i3dQ6MFjgoTtY0A0b6uJ3HpQ9OescBrTCLsp8zeWq+W OpSkDS6S5XRywlEa6DzpsLgqVUlTkXDXEIOJ1kntyoJegzNbrq7B2by6o8buVUJvmEJZ EiryRPO+yBktfEYM7sfdr1ciFPeq3Anzw4+L6SQRFkda3XRZkOyk+7Hq0vWiHCZcoHAY SqhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@samsung.com header.s=mail20170921 header.b=oadUOuDN; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id q19-v6si585303eju.57.2018.11.07.07.04.53; Wed, 07 Nov 2018 07:04:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@samsung.com header.s=mail20170921 header.b=oadUOuDN; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: by lists.denx.de (Postfix, from userid 105) id 62931C22512; Wed, 7 Nov 2018 15:02:56 +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 ADEE1C224E1; Wed, 7 Nov 2018 15:02:19 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id EECB0C224A3; Wed, 7 Nov 2018 15:01:16 +0000 (UTC) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lists.denx.de (Postfix) with ESMTPS id 917F0C224BE for ; Wed, 7 Nov 2018 15:01:16 +0000 (UTC) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20181107150116euoutp02148a57816d39012eafdbf2c8f2720675~k36XuUHfW0236402364euoutp02j; Wed, 7 Nov 2018 15:01:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20181107150116euoutp02148a57816d39012eafdbf2c8f2720675~k36XuUHfW0236402364euoutp02j DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1541602876; bh=0c0H991MMEDOzwTuOqBL5SdvBkP/IhIvIIbAiJcTYww=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=oadUOuDNW+8GREs4Ya1GZqO9xsC+Ub/BUT4fxs1glI58zNUpICUHxBSBjWCb+sVKX 935g9lq1LOUZI7RPjX/1mEtpDi92uv4e3iAwElsrwA25z+EkyAAwkT7fGyeQXYawny RajHDaaVbIw57mz+59/BRHtMKRjospPg8T27Ajmw= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20181107150115eucas1p1ccd08c8fcfc8f5edf33c81582ed22b2d~k36XUt87E2021220212eucas1p1Q; Wed, 7 Nov 2018 15:01:15 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 44.4B.04806.B3EF2EB5; Wed, 7 Nov 2018 15:01:15 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20181107150115eucas1p1104597e81bb7420a9115fb4f15b49409~k36WuxtKm2023720237eucas1p1T; Wed, 7 Nov 2018 15:01:15 +0000 (GMT) X-AuditID: cbfec7f5-367ff700000012c6-ce-5be2fe3b8860 Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id D5.C4.04128.B3EF2EB5; Wed, 7 Nov 2018 15:01:15 +0000 (GMT) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PHT005I7WDUVY00@eusync3.samsung.com>; Wed, 07 Nov 2018 15:01:15 +0000 (GMT) From: Marek Szyprowski To: u-boot@lists.denx.de Date: Wed, 07 Nov 2018 16:01:00 +0100 Message-id: <20181107150105.23165-5-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20181107150105.23165-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrIIsWRmVeSWpSXmKPExsWy7djP87rW/x5FG5yZp2KxccZ6Vosbv9pY LZ6/u8xksfbIXXaLN22NjBYdR1oYLd7u7WR3YPeYN+sEi8fZOzsYPfq2rGIMYI7isklJzcks Sy3St0vgyljVf5m14AJvxc0305kbGH9zdTFyckgImEjsu/+AuYuRi0NIYAWjRNePNewQzmdG iRVXJjLCVO2c/I4NIrGMUeLtrw5WCKeBSeLY0RPMIFVsAoYSXW+72EBsEQEJiV/9VxlBipgF vjJKTDt5CSwhLOAk8enzE7AGFgFVif+3Z7OD2LwCthJf525jh1gnL7F6wwGwGk4BO4nunsks EPGfrBJLf9hD2C4Sp76ugTpPWOLV8S1QvTISlyd3s4AslhBoZpRonzGLHcLpYZTYOmcHG0SV tcTh4xdZQWxmAT6JSdumA23jAIrzSnS0CUGYHhKX94VDfDmRUeLTnJ/sExglFzAyrGIUTy0t zk1PLTbOSy3XK07MLS7NS9dLzs/dxAiMuNP/jn/dwbjvT9IhRgEORiUe3gtbH0YLsSaWFVfm HmKU4GBWEuHtXf0oWog3JbGyKrUoP76oNCe1+BCjNAeLkjhvNcODaCGB9MSS1OzU1ILUIpgs EwenVAOjVljSqVLplX++t+lczokpemOm8eXWCv1F5+7z67zxSZmYekhwxuc+i6Sg3EnnuPcf UWLetG0vM+9T8/7vqXraW699Vnpzdk2qRcBnrce+1nf/zN/xbHGUimv46v439yd/S1t6Wkgj YvcbKb442/jmua80th5+tjjvSsfG3qTcB/N41zW46CmuUmIpzkg01GIuKk4EAOHV8FW0AgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrLJMWRmVeSWpSXmKPExsVy+t/xq7rW/x5FG5xaxWyxccZ6Vosbv9pY LZ6/u8xksfbIXXaLN22NjBYdR1oYLd7u7WR3YPeYN+sEi8fZOzsYPfq2rGIMYI7isklJzcks Sy3St0vgyljVf5m14AJvxc0305kbGH9zdTFyckgImEjsnPyOrYuRi0NIYAmjxPWHN1lBEkIC TUwS95t5QGw2AUOJrrddbCC2iICExK/+q4wgNrPAd0aJ0/9ZQGxhASeJT5+fMIPYLAKqEv9v z2YHsXkFbCW+zt3GDrFMXmL1hgNgNZwCdhLdPZNZIHbZSjy8ep5xAiPPAkaGVYwiqaXFuem5 xUZ6xYm5xaV56XrJ+bmbGIGBsu3Yzy07GLveBR9iFOBgVOLh1djxMFqINbGsuDL3EKMEB7OS CG/v6kfRQrwpiZVVqUX58UWlOanFhxilOViUxHnPG1RGCQmkJ5akZqemFqQWwWSZODilGhjP 7zjp1SiiI8qjWMfyfbovB/eRPp5fUeWVj41yTZcm1tt4Lv6z3VFGbvPDd3snHZox02H5lJOl lhMumUwo0rzQNPnip7j0luMcTFbxWxVb9pw+0V0p3OQuup1l/eq04AULs3vNv/Ap9L7Z/Wua 66LTsqXz++3comOLE6o0JJ2OLJ5wxchM6bUSS3FGoqEWc1FxIgAT9H3OEAIAAA== X-CMS-MailID: 20181107150115eucas1p1104597e81bb7420a9115fb4f15b49409 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181107150115eucas1p1104597e81bb7420a9115fb4f15b49409 References: <20181107150105.23165-1-m.szyprowski@samsung.com> X-Mailman-Approved-At: Wed, 07 Nov 2018 15:02:17 +0000 Cc: Marek Vasut , Bartlomiej Zolnierkiewicz , Marek Szyprowski Subject: [U-Boot] [PATCH 4/9] dfu: mmc: add support for in-partition offset 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" Add possibility to define a part of partition as a separate DFU entity. This allows to have more than one items on the given partiton. The real use case for this option is TM2 board. It can use u-boot stored as Linux kernel on the defined partiton (as RAW data) and load the real kernel from the same partition, but stored under the certain offset. Signed-off-by: Marek Szyprowski Acked-by: Lukasz Majewski --- drivers/dfu/dfu_mmc.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c index b45e6dc54c..826e70ffec 100644 --- a/drivers/dfu/dfu_mmc.c +++ b/drivers/dfu/dfu_mmc.c @@ -357,6 +357,7 @@ int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *devstr, char *s) struct blk_desc *blk_dev = mmc_get_blk_desc(mmc); int mmcdev = second_arg; int mmcpart = third_arg; + int offset = 0; if (part_get_info(blk_dev, mmcpart, &partinfo) != 0) { pr_err("Couldn't find part #%d on mmc device #%d\n", @@ -364,9 +365,17 @@ int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *devstr, char *s) return -ENODEV; } + /* + * Check for an extra entry at dfu_alt_info env variable + * specifying the mmc HW defined partition number + */ + if (s) + if (!strcmp(strsep(&s, " "), "offset")) + offset = simple_strtoul(s, NULL, 0); + dfu->layout = DFU_RAW_ADDR; - dfu->data.mmc.lba_start = partinfo.start; - dfu->data.mmc.lba_size = partinfo.size; + dfu->data.mmc.lba_start = partinfo.start+offset; + dfu->data.mmc.lba_size = partinfo.size-offset; dfu->data.mmc.lba_blk_size = partinfo.blksz; } else if (!strcmp(entity_type, "fat")) { dfu->layout = DFU_FS_FAT;