From mboxrd@z Thu Jan 1 00:00:00 1970 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 42FABC433EF for ; Wed, 6 Apr 2022 05:33:49 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4D30083CD8; Wed, 6 Apr 2022 07:33:44 +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=1649223224; bh=KwSmB67ixbXc48ssZq/+sLDyzy80H+QgDam/M59oKcc=; h=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=b5fydDg2ZjY3DcU+wpD5fhccjcgY2A0GUD2kuXoVb2TIs2k1o4t4jRJ5wG6FuE9Q9 XDR0mDhP0oi5DHyrLgz69ZLZBQTipoPBHlkZRqiod0R5rWCokETJ6D6UTM5uJ7vY2L K6e3PY1PAvEHQya82kg+t0qKUwOdicTV8o5ELo9bMejXnDyCJr5bSpxGuvaJ/1eCh+ HIgcJRpUdsee6PdK5rLpMU6jGOM6B162Pohba4PhJtGWSYYwyiKFwbdai6LeVWn0Rl kSjWJvdmkLmheWqvPY/b7qeb2sUrIg8xzh+qAXXeExYPWthWJsJ0qReAGcUvL1e5Xw xKLv3aCQ2JApw== Received: by phobos.denx.de (Postfix, from userid 109) id 940B583C9E; Wed, 6 Apr 2022 07:33:42 +0200 (CEST) Received: from mout-u-204.mailbox.org (mout-u-204.mailbox.org [91.198.250.253]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id BFF1983C35 for ; Wed, 6 Apr 2022 07:33:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sr@denx.de Received: from smtp102.mailbox.org (unknown [91.198.250.119]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-204.mailbox.org (Postfix) with ESMTPS id 4KYCq01Rx0z9sWv; Wed, 6 Apr 2022 07:33:32 +0200 (CEST) Message-ID: Date: Wed, 6 Apr 2022 07:33:21 +0200 MIME-Version: 1.0 Subject: Re: [RFC PATCH 7/7] spl: Convert spi to spl_load Content-Language: en-US To: Sean Anderson , Simon Glass Cc: =?UTF-8?Q?Marek_Beh=c3=ban?= , u-boot@lists.denx.de, Marek Vasut , =?UTF-8?Q?Pali_Roh=c3=a1r?= References: <20220401190405.1932697-1-sean.anderson@seco.com> <20220401190405.1932697-8-sean.anderson@seco.com> From: Stefan Roese In-Reply-To: <20220401190405.1932697-8-sean.anderson@seco.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.5 at phobos.denx.de X-Virus-Status: Clean On 4/1/22 21:04, Sean Anderson wrote: > This converts the spi load method to use spl_load. As a consequence, it > also adds support for LOAD_FIT_FULL. > > Signed-off-by: Sean Anderson Reviewed-by: Stefan Roese Thanks, Stefan > --- > > common/spl/spl_spi.c | 48 +++++++------------------------------------- > 1 file changed, 7 insertions(+), 41 deletions(-) > > diff --git a/common/spl/spl_spi.c b/common/spl/spl_spi.c > index cf3f7ef4c0..037db1a19f 100644 > --- a/common/spl/spl_spi.c > +++ b/common/spl/spl_spi.c > @@ -83,6 +83,10 @@ static int spl_spi_load_image(struct spl_image_info *spl_image, > unsigned int payload_offs; > struct spi_flash *flash; > struct image_header *header; > + struct spl_load_info load = { > + .bl_len = 1, > + .read = spl_spi_fit_read, > + }; > > /* > * Load U-Boot image from SPI flash into RAM > @@ -99,6 +103,7 @@ static int spl_spi_load_image(struct spl_image_info *spl_image, > return -ENODEV; > } > > + load.dev = flash; > payload_offs = spl_spi_get_uboot_offs(flash); > > header = spl_get_load_buffer(-sizeof(*header), sizeof(*header)); > @@ -121,47 +126,8 @@ static int spl_spi_load_image(struct spl_image_info *spl_image, > return err; > } > > - if (IS_ENABLED(CONFIG_SPL_LOAD_FIT_FULL) && > - image_get_magic(header) == FDT_MAGIC) { > - err = spi_flash_read(flash, payload_offs, > - roundup(fdt_totalsize(header), 4), > - (void *)CONFIG_SYS_LOAD_ADDR); > - if (err) > - return err; > - err = spl_parse_image_header(spl_image, bootdev, > - (struct image_header *)CONFIG_SYS_LOAD_ADDR); > - } else if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) && > - image_get_magic(header) == FDT_MAGIC) { > - struct spl_load_info load; > - > - debug("Found FIT\n"); > - load.dev = flash; > - load.priv = NULL; > - load.filename = NULL; > - load.bl_len = 1; > - load.read = spl_spi_fit_read; > - err = spl_load_simple_fit(spl_image, &load, > - payload_offs, > - header); > - } else if (IS_ENABLED(CONFIG_SPL_LOAD_IMX_CONTAINER)) { > - struct spl_load_info load; > - > - load.dev = flash; > - load.priv = NULL; > - load.filename = NULL; > - load.bl_len = 1; > - load.read = spl_spi_fit_read; > - > - err = spl_load_imx_container(spl_image, &load, > - payload_offs); > - } else { > - err = spl_parse_image_header(spl_image, bootdev, header); > - if (err) > - return err; > - err = spi_flash_read(flash, payload_offs + spl_image->offset, > - spl_image->size, > - (void *)spl_image->load_addr); > - } > + err = spl_load(spl_image, bootdev, &load, header, 0, > + payload_offs); > } > > return err; Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de