From patchwork Mon Mar 23 10:06:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 46176 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0655120D10 for ; Mon, 23 Mar 2015 10:06:57 +0000 (UTC) Received: by lbiz11 with SMTP id z11sf26448562lbi.2 for ; Mon, 23 Mar 2015 03:06:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:cc:subject:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :content-type:content-transfer-encoding:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list; bh=as6bBrx5Tw0HrxZ8AcX79fx/jZYAnpFo7QSRjmX7rDc=; b=fmHw+Dny/xjX+EcCHcxpq5mtLtFUoJwUM9llDdqEOxtQ5ydGLRI8ig5T/WXxq81gI9 Kv4gvwLC3sbDVSCu+jjDL2UKBs9z2dZ0m9r7TvE9kTUjA3iKyZ5dgu3BAsEdRsNoiQeh WDqkNmsTSzG/7CUoHFFJcRRFITKTVIpqyKF+bCZ0EYXtgRYID2MBXfblDvkDz2RW7TCT nBbTt2P6rkE4iOTX5O+510tOv3ot5sDc84X3eJJr+bYnH5coyOF/xT5MCQ997wnYE+Pp Prxz6imVenAiNlRPwXMna8jdnmVxlHtDRCIM98tJngs4XEJPkAc/uZEvo7PgrMl0Urz+ FYBQ== X-Gm-Message-State: ALoCoQn8K/pJrTzJ3HIDEBahbdbyqBqgV+TGJifwJW9d0Jk83REB8Ak2wSCeQaRQ/EaopuD1DWAC X-Received: by 10.194.53.225 with SMTP id e1mr15415613wjp.4.1427105215900; Mon, 23 Mar 2015 03:06:55 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.36 with SMTP id n4ls554001laj.27.gmail; Mon, 23 Mar 2015 03:06:55 -0700 (PDT) X-Received: by 10.112.223.7 with SMTP id qq7mr83538309lbc.81.1427105215732; Mon, 23 Mar 2015 03:06:55 -0700 (PDT) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com. [209.85.215.47]) by mx.google.com with ESMTPS id y7si284765lbb.44.2015.03.23.03.06.55 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Mar 2015 03:06:55 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by labe2 with SMTP id e2so54503974lab.3 for ; Mon, 23 Mar 2015 03:06:55 -0700 (PDT) X-Received: by 10.112.130.100 with SMTP id od4mr60612355lbb.86.1427105215594; Mon, 23 Mar 2015 03:06:55 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.57.201 with SMTP id k9csp724888lbq; Mon, 23 Mar 2015 03:06:55 -0700 (PDT) X-Received: by 10.180.7.134 with SMTP id j6mr18176983wia.11.1427105214876; Mon, 23 Mar 2015 03:06:54 -0700 (PDT) Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id f9si506008wjx.87.2015.03.23.03.06.54; Mon, 23 Mar 2015 03:06:54 -0700 (PDT) Received-SPF: none (google.com: u-boot-bounces@lists.denx.de does not designate permitted sender hosts) client-ip=85.214.87.163; Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1281DA744C; Mon, 23 Mar 2015 11:06:53 +0100 (CET) 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 5j85WP2VUs7k; Mon, 23 Mar 2015 11:06:52 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 52E46A7463; Mon, 23 Mar 2015 11:06:51 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DC5B6A7462 for ; Mon, 23 Mar 2015 11:06:43 +0100 (CET) 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 UrBpprco-SkI for ; Mon, 23 Mar 2015 11:06:43 +0100 (CET) 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-lb0-f174.google.com (mail-lb0-f174.google.com [209.85.217.174]) by theia.denx.de (Postfix) with ESMTPS id 1259BA745C for ; Mon, 23 Mar 2015 11:06:39 +0100 (CET) Received: by lbbug6 with SMTP id ug6so20110675lbb.3 for ; Mon, 23 Mar 2015 03:06:39 -0700 (PDT) X-Received: by 10.152.10.66 with SMTP id g2mr83017320lab.44.1427105199078; Mon, 23 Mar 2015 03:06:39 -0700 (PDT) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id x7sm87147lag.3.2015.03.23.03.06.36 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Mar 2015 03:06:37 -0700 (PDT) From: Linus Walleij To: u-boot@lists.denx.de, Albert Aribaud , Tom Rini Date: Mon, 23 Mar 2015 11:06:12 +0100 Message-Id: <1427105174-20072-3-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1427105174-20072-1-git-send-email-linus.walleij@linaro.org> References: <1427105174-20072-1-git-send-email-linus.walleij@linaro.org> Cc: Steve Rae , u-boot-review@google.com Subject: [U-Boot] [PATCH 3/5] vexpress64: remove board late init, use smhload X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: 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" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linus.walleij@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 This removes the kludgy late board init from the FVP simulator version of Versatile Express 64bit (ARMv8), and replace it with a default boot command using the new smhload command to load the files using semihosting. Tested on the Foundation Model. Signed-off-by: Linus Walleij --- board/armltd/vexpress64/vexpress64.c | 96 ------------------------------------ include/configs/vexpress_aemv8a.h | 18 ++++--- 2 files changed, 10 insertions(+), 104 deletions(-) diff --git a/board/armltd/vexpress64/vexpress64.c b/board/armltd/vexpress64/vexpress64.c index de6286435d97..876cb678eb03 100644 --- a/board/armltd/vexpress64/vexpress64.c +++ b/board/armltd/vexpress64/vexpress64.c @@ -11,7 +11,6 @@ #include #include #include -#include DECLARE_GLOBAL_DATA_PTR; @@ -33,101 +32,6 @@ void reset_cpu(ulong addr) { } -#ifdef CONFIG_BOARD_LATE_INIT -int board_late_init(void) -{ -#ifdef CONFIG_SEMIHOSTING - /* - * Please refer to doc/README.semihosting for a more complete - * description. - * - * We require that the board include file defines these env variables: - * - kernel_name - * - kernel_addr_r - * - initrd_name - * - initrd_addr_r - * - fdt_name - * - fdt_addr_r - * - * For the "fdt chosen" startup macro, this code will then define: - * - initrd_end (based on initrd_addr_r plus actual initrd_size) - * - * We will then load the kernel, initrd, and fdt into the specified - * locations in memory in a similar way that the ATF fastmodel code - * uses semihosting calls to load other boot stages and u-boot itself. - */ - - /* Env variable strings */ - char *kernel_name = getenv("kernel_name"); - char *kernel_addr_str = getenv("kernel_addr_r"); - char *initrd_name = getenv("initrd_name"); - char *initrd_addr_str = getenv("initrd_addr_r"); - char *fdt_name = getenv("fdt_name"); - char *fdt_addr_str = getenv("fdt_addr_r"); - char initrd_end_str[64]; - - /* Actual addresses converted from env variables */ - void *kernel_addr_r; - void *initrd_addr_r; - void *fdt_addr_r; - - /* Actual initrd base and size */ - unsigned long initrd_base; - unsigned long initrd_size; - - /* Space available */ - int avail; - - /* Make sure the environment variables needed are set */ - if (!(kernel_addr_str && initrd_addr_str && fdt_addr_str)) { - printf("%s: Define {kernel/initrd/fdt}_addr_r\n", __func__); - return -1; - } - if (!(kernel_name && initrd_name && fdt_name)) { - printf("%s: Define {kernel/initrd/fdt}_name\n", __func__); - return -1; - } - - /* Get exact initrd_size */ - initrd_size = smh_len(initrd_name); - if (initrd_size == -1) { - printf("%s: Can't get file size for \'%s\'\n", __func__, - initrd_name); - return -1; - } - - /* Set initrd_end */ - initrd_base = simple_strtoul(initrd_addr_str, NULL, 16); - initrd_addr_r = (void *)initrd_base; - sprintf(initrd_end_str, "0x%lx", initrd_base + initrd_size - 1); - setenv("initrd_end", initrd_end_str); - - /* Load kernel to memory */ - fdt_addr_r = (void *)simple_strtoul(fdt_addr_str, NULL, 16); - kernel_addr_r = (void *)simple_strtoul(kernel_addr_str, NULL, 16); - - /* - * The kernel must be lower in memory than fdt and loading the - * kernel must not trample the fdt or vice versa. - */ - avail = fdt_addr_r - kernel_addr_r; - if (avail < 0) { - printf("%s: fdt must be after kernel\n", __func__); - return -1; - } - smh_load(kernel_name, kernel_addr_r, avail, 1); - - /* Load fdt to memory */ - smh_load(fdt_name, fdt_addr_r, 0x20000, 1); - - /* Load initrd to memory */ - smh_load(initrd_name, initrd_addr_r, initrd_size, 1); - -#endif /* CONFIG_SEMIHOSTING */ - return 0; -} -#endif /* CONFIG_BOARD_LATE_INIT */ - /* * Board specific ethernet initialization routine. */ diff --git a/include/configs/vexpress_aemv8a.h b/include/configs/vexpress_aemv8a.h index e6fc2aeea2b8..cda89d8ca814 100644 --- a/include/configs/vexpress_aemv8a.h +++ b/include/configs/vexpress_aemv8a.h @@ -15,7 +15,6 @@ #ifndef CONFIG_SEMIHOSTING #error CONFIG_TARGET_VEXPRESS64_BASE_FVP requires CONFIG_SEMIHOSTING #endif -#define CONFIG_BOARD_LATE_INIT #define CONFIG_ARMV8_SWITCH_TO_EL1 #endif @@ -228,11 +227,11 @@ #elif CONFIG_TARGET_VEXPRESS64_BASE_FVP #define CONFIG_EXTRA_ENV_SETTINGS \ "kernel_name=uImage\0" \ - "kernel_addr_r=0x80000000\0" \ + "kernel_addr=0x80000000\0" \ "initrd_name=ramdisk.img\0" \ - "initrd_addr_r=0x88000000\0" \ - "fdt_name=devtree.dtb\0" \ - "fdt_addr_r=0x83000000\0" \ + "initrd_addr=0x88000000\0" \ + "fdt_name=devtree.dtb\0" \ + "fdt_addr=0x83000000\0" \ "fdt_high=0xffffffffffffffff\0" \ "initrd_high=0xffffffffffffffff\0" @@ -240,9 +239,12 @@ "0x1c090000 debug user_debug=31 "\ "loglevel=9" -#define CONFIG_BOOTCOMMAND "fdt addr $fdt_addr_r; fdt resize; " \ - "fdt chosen $initrd_addr_r $initrd_end; " \ - "bootm $kernel_addr_r - $fdt_addr_r" +#define CONFIG_BOOTCOMMAND "smhload ${kernel_name} ${kernel_addr}; " \ + "smhload ${fdt_name} $fdt_addr; " \ + "smhload ${initrd_name} $initrd_addr initrd_end; " \ + "fdt addr $fdt_addr; fdt resize; " \ + "fdt chosen $initrd_addr $initrd_end; " \ + "bootm $kernel_addr - $fdt_addr" #define CONFIG_BOOTDELAY 1