Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6DDE3C433F5 for ; Fri, 22 Oct 2021 22:34:56 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 86D876112D for ; Fri, 22 Oct 2021 22:34:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 86D876112D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A3D2883536; Sat, 23 Oct 2021 00:34:52 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1634942093; bh=EiI8TcBCSUBl+0EoY36Bm9JpKLUmyl7R/N97l4ByE0Y=; h=Subject:To:Cc:References:From:Date:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=I/9jWJYhcpsNTQfJLIvm60IEmL7jN0bDS9zBDK2LxveIYfTl/0RCVfJEovTN7q611 i57Z3mMlUe8yA+854aLfKz0Yg8GDyKa9za1m2YACOKuH8nT07hvJthF3UKQv7Hz+o1 wxxvoCryM9mo4cAMhLc+KyNe+UPKlQQuJTlkF7o5eOKc4CtPSlkXoCTRD1qDDB3EhG LarTvUWefYf6XfUAq329j/rzr5CjfHJlffPE/N6TsjfLylPl8RJmhalhj8pm4WcCRy ouVzwOEVajPbPO0HkKPBzOXWywEssPgY36WHRntuyFaPpqtp1vFzEKkjgWcPBZRfyi 2RMtfwmKjAhrA== Received: from [IPv6:::1] (p578adb1c.dip0.t-ipconnect.de [87.138.219.28]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 5816D834B0; Sat, 23 Oct 2021 00:34:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1634942090; bh=EiI8TcBCSUBl+0EoY36Bm9JpKLUmyl7R/N97l4ByE0Y=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=Jrcf2ajL+eTEARRr/UvG5OU5a2ZRUEU2DphFL+gVkgo8gBRf5hzn8DciNOJCUKv+o eBAtF1jN6LHMH9VyuFAjToz5fqZQ1v1RucB/6mMidmmyyLSco/RolLRDJkkb/RXh1d ApNZErptAMJ1cEv3QWw4wiWX/5JUjQ7eLzlgaE37EQ8qDpPwA49haMa0u5Qg6YdZvX PNHCgLNauH0yvIQ1fgWVzNFfy/rTnztQCxaTgkhleHENxHKfgqGQyqqppK3dJFdfQV qw6R0c/lUeYrRzRMGIKkScwey8VcwDMVICJxUBVpmUwnU0Y73La7cN45Maio8yEonL piH6VuElfvbaw== Subject: Re: [PATCH] dfu: dfu_sf: Read the SPI flash in 16 MiB chunks To: Lukasz Majewski Cc: u-boot@lists.denx.de, Tom Rini References: <20210914032651.273567-1-marex@denx.de> <20210914113118.2253842c@ktm> From: Marek Vasut Message-ID: <21dea22a-3296-6cb1-5b07-a9ceed2f65ff@denx.de> Date: Sat, 23 Oct 2021 00:34:49 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20210914113118.2253842c@ktm> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean On 9/14/21 11:31 AM, Lukasz Majewski wrote: > On Tue, 14 Sep 2021 05:26:51 +0200 > Marek Vasut wrote: > >> Not all SPI flashes and controllers can do continuous transfer longer >> than 16 MiB, so perform the DFU read in 16 MiB chunks. >> >> Signed-off-by: Marek Vasut >> Cc: Lukasz Majewski >> --- >> drivers/dfu/dfu_sf.c | 14 ++++++++++++-- >> 1 file changed, 12 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/dfu/dfu_sf.c b/drivers/dfu/dfu_sf.c >> index 7e64ab772f0..b72493ced86 100644 >> --- a/drivers/dfu/dfu_sf.c >> +++ b/drivers/dfu/dfu_sf.c >> @@ -24,8 +24,18 @@ static int dfu_get_medium_size_sf(struct >> dfu_entity *dfu, u64 *size) static int dfu_read_medium_sf(struct >> dfu_entity *dfu, u64 offset, void *buf, long *len) >> { >> - return spi_flash_read(dfu->data.sf.dev, dfu->data.sf.start + >> offset, >> - *len, buf); >> + long seglen = *len; >> + int ret; >> + >> + if (seglen > (16 << 20)) >> + seglen = (16 << 20); >> + >> + ret = spi_flash_read(dfu->data.sf.dev, dfu->data.sf.start + >> offset, >> + seglen, buf); >> + if (!ret) >> + *len = seglen; >> + >> + return ret; >> } >> >> static u64 find_sector(struct dfu_entity *dfu, u64 start, u64 offset) > > Reviewed-by: Lukasz Majewski Is there going to be a PR with this or shall Tom pick it directly, since it is just one patch ?