From patchwork Thu Apr 28 08:43:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 616066 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3qwVjl5TKvz9t6v for ; Thu, 28 Apr 2016 18:43:55 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20150623.gappssmtp.com header.i=@monstr-eu.20150623.gappssmtp.com header.b=x5vN+3JK; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C9107A7862; Thu, 28 Apr 2016 10:43:53 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ruYRERLNWXfs; Thu, 28 Apr 2016 10:43:53 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4B902A77ED; Thu, 28 Apr 2016 10:43:53 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id BB83FA77ED for ; Thu, 28 Apr 2016 10:43:50 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Q6vkRiyLBz_9 for ; Thu, 28 Apr 2016 10:43:50 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-wm0-f52.google.com (mail-wm0-f52.google.com [74.125.82.52]) by theia.denx.de (Postfix) with ESMTPS id 8AA5EA77EB for ; Thu, 28 Apr 2016 10:43:46 +0200 (CEST) Received: by mail-wm0-f52.google.com with SMTP id e201so67729594wme.0 for ; Thu, 28 Apr 2016 01:43:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id; bh=YkGa1MtFqK1vLoPG9u/JtBUSsm52lZoONyRQ9uZDixM=; b=x5vN+3JK22I4U2IJUWzOWRCnGddsGCej0hQbcdp9131IsR3uQzccxihBn6Utv9ptGy J9AoMw6lucAMmZ/tmK0MIUi/32i68wBdkl+8YoQVdNtccDoshI1QjoSLoe+KoAEWq17C /9jogB1sIUpF3B0/faIZSLRbeqst+VsG2U9zhEldnZQPI82XHKnccl0wVqE2AErgrNjD GXki4PvGepe8x3qTLVKGal3v6OGiwD/fazbLF0ZqRNy9ntaxdhzMtke8DpqnllcRBky4 E3bUVj/ePeVLb1WtHlZrTgggH0bDt2chjT+mn1w0/eI63mG65CP9fA0//r7cdHN7NbRA 2Jhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=YkGa1MtFqK1vLoPG9u/JtBUSsm52lZoONyRQ9uZDixM=; b=X7H8EuSYEm8gWpsbqegmQdUsSa49fVNZTqldrGCUzQ5y3k9P6gmoXpf0qaarhFjyq4 FjlpFUoGjUYQqdhg9cQvB7ZeYoyi/kudBeI0T0dUtClhKuzEDB+cOHMh/1jYlyRIGN8u 5pSP/gv1yGdbao+GVtG65VZ2ZPxWJ6S1zGwFc0AtfP2WFuTvg5cBS8D5I0CVJenEbBmS SZYNqE4nEeSMy4o4u5cj8XcTUFh03kDS8uBsDzJijPrvuefv+SnHR2J45Xto3IetNZAI PiqYBsTwZ9/TpcVplT/muK19OHQASSS3khY0X1EV2KJf/8yu5OGbJdSrTqouGpYh2B6j V4BQ== X-Gm-Message-State: AOPr4FWTkVvvkIfbzHCgLBpQzWpLT6qcyS6+Ak/x2NhU+pRbf2DDM6G2xSBMwcrfOBxG+Q== X-Received: by 10.194.201.37 with SMTP id jx5mr13569294wjc.60.1461833025681; Thu, 28 Apr 2016 01:43:45 -0700 (PDT) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id j6sm8420283wjb.29.2016.04.28.01.43.44 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Thu, 28 Apr 2016 01:43:45 -0700 (PDT) From: Michal Simek To: Simon Glass Date: Thu, 28 Apr 2016 10:43:44 +0200 Message-Id: <075110743b96bdd156e23615a8e92be0e73db52e.1461833021.git.michal.simek@xilinx.com> X-Mailer: git-send-email 1.9.1 Cc: u-boot@lists.denx.de Subject: [U-Boot] [RFC PATCH] SPL: FIT: Enable SPL_FIT_LOAD in RAM based boot mode X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 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" Support loading FIT in SPL for RAM bootmode. CONFIG_SPL_LOAD_FIT_ADRESS points to address where FIT image is stored in memory. Signed-off-by: Michal Simek Reviewed-by: Simon Glass --- Not sure if solution with CONFIG_SPL_LOAD_FIT_ADDRESS is accepted. But it should be out of TEXT_BASE. --- common/spl/spl.c | 44 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 9 deletions(-) diff --git a/common/spl/spl.c b/common/spl/spl.c index f1e792dd7c61..128ccaa55e3e 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -134,19 +134,45 @@ __weak void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image) } #ifdef CONFIG_SPL_RAM_DEVICE +#ifdef CONFIG_SPL_LOAD_FIT +static ulong spl_ram_load_read(struct spl_load_info *load, ulong sector, + ulong count, void *buf) +{ + + debug("%s: sector %lx, count %lx, buf %lx\n", + __func__, sector, count, (ulong)buf); + memcpy(buf, (void *)(CONFIG_SPL_LOAD_FIT_ADRESS + sector), count); + return count; +} +#endif + static int spl_ram_load_image(void) { - const struct image_header *header; + struct image_header *header; - /* - * Get the header. It will point to an address defined by handoff - * which will tell where the image located inside the flash. For - * now, it will temporary fixed to address pointed by U-Boot. - */ - header = (struct image_header *) - (CONFIG_SYS_TEXT_BASE - sizeof(struct image_header)); + header = (struct image_header *)CONFIG_SPL_LOAD_FIT_ADRESS; - spl_parse_image_header(header); + if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) && + image_get_magic(header) == FDT_MAGIC) { + struct spl_load_info load; + + debug("Found FIT\n"); + load.bl_len = 1; + load.read = spl_ram_load_read; + spl_load_simple_fit(&load, 0, header); + } else { + debug("Legacy image\n"); + /* + * Get the header. It will point to an address defined by + * handoff which will tell where the image located inside + * the flash. For now, it will temporary fixed to address + * pointed by U-Boot. + */ + header = (struct image_header *) + (CONFIG_SYS_TEXT_BASE - sizeof(struct image_header)); + + spl_parse_image_header(header); + } return 0; }