From patchwork Thu Sep 5 16:50:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe REYNES X-Patchwork-Id: 1158611 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=softathome.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 46PRWw2nX6z9s7T for ; Fri, 6 Sep 2019 02:50:34 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 24451C21DA1; Thu, 5 Sep 2019 16:50:28 +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=KHOP_BIG_TO_CC 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 9472EC21C51; Thu, 5 Sep 2019 16:50:26 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 2172BC21C51; Thu, 5 Sep 2019 16:50:26 +0000 (UTC) Received: from vrout10.yaziba.net (vrout10-bl2.yaziba.net [185.56.204.56]) by lists.denx.de (Postfix) with ESMTPS id C9EB3C21C2F for ; Thu, 5 Sep 2019 16:50:25 +0000 (UTC) Received: from mtaout10.int.yaziba.net (mtaout10.int.yaziba.net [10.4.20.36]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by vrout10.yaziba.net (mx10.yaziba.net) with ESMTPS id E81E652020; Thu, 5 Sep 2019 18:50:24 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mtaout10.int.yaziba.net (Postfix) with ESMTP id 4D9DF1602E4; Thu, 5 Sep 2019 18:50:25 +0200 (CEST) Received: from mtaout10.int.yaziba.net ([127.0.0.1]) by localhost (mtaout10.int.yaziba.net [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id SVvJhEm3tBAT; Thu, 5 Sep 2019 18:50:25 +0200 (CEST) Received: from sahnlpt0333.softathome.com (unknown [149.6.166.170]) by mtaout10.int.yaziba.net (Postfix) with ESMTPSA id 21ED316029E; Thu, 5 Sep 2019 18:50:25 +0200 (CEST) From: Philippe Reynes To: simon.k.r.goldschmidt@gmail.com, sjg@chromium.org, lokeshvutla@ti.com, markus.klotzbuecher@kistler.com, tien.fong.chee@intel.com, vigneshr@ti.com, afd@ti.com, nsekhar@ti.com, marex@denx.de, sr@denx.de, anup.patel@wdc.com, lukas.auer@aisec.fraunhofer.de Date: Thu, 5 Sep 2019 18:50:16 +0200 Message-Id: <1567702216-12153-1-git-send-email-philippe.reynes@softathome.com> X-Mailer: git-send-email 2.7.4 X-CLAMAV-SCAN: ok X-VRSPAM-SCORE: 0 X-VRSPAM-STATE: legit X-VRSPAM-CAUSE: gggruggvucftvghtrhhoucdtuddrgeduvddrudejjedgleduucetufdoteggodetrfcurfhrohhfihhlvgemucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffosedttdertdertddtnecuhfhrohhmpefrhhhilhhiphhpvgcutfgvhihnvghsuceophhhihhlihhpphgvrdhrvgihnhgvshesshhofhhtrghthhhomhgvrdgtohhmqeenucfkphepudegledriedrudeiiedrudejtdenucfrrghrrghmpehmohguvgepshhmthhpohhuth X-VRSPAM-EXTCAUSE: mhhouggvpehsmhhtphhouhht Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH] spl: add a generic function board_init_r 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" This commit add a generic function board_init_r that only initialize some device (for example serial). It avoid to define a board function only to launch the serial configuration. Signed-off-by: Philippe Reynes --- common/spl/Kconfig | 8 ++++++++ common/spl/spl.c | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/common/spl/Kconfig b/common/spl/Kconfig index f467eca..d5b331a 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -25,6 +25,14 @@ config SPL_FRAMEWORK supports MMC, NAND and YMODEM and other methods loading of U-Boot and the Linux Kernel. If unsure, say Y. +config SPL_FRAMEWORK_BOARD_INIT_F + bool "Define a generic function board_init_f" + depends on SPL_FRAMEWORK + default n + help + Define a generic function board_init_f, unless you want to + provide your own board_init_f, you should say Y. + config SPL_SIZE_LIMIT int "Maximum size of SPL image" depends on SPL diff --git a/common/spl/spl.c b/common/spl/spl.c index 082fa2b..73bf984 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -566,6 +566,25 @@ static int boot_from_devices(struct spl_image_info *spl_image, return -ENODEV; } +#if defined(CONFIG_SPL_FRAMEWORK_BOARD_INIT_F) +void board_init_f(ulong dummy) +{ +#if CONFIG_IS_ENABLED(OF_CONTROL) + int ret; + + ret = spl_early_init(); + if (ret) { + debug("spl_early_init() failed: %d\n", ret); + hang(); + } +#endif + +#if CONFIG_IS_ENABLED(SERIAL_SUPPORT) + preloader_console_init(); +#endif +} +#endif + void board_init_r(gd_t *dummy1, ulong dummy2) { u32 spl_boot_list[] = {