From patchwork Mon Jul 12 02:19:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1503755 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=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=ElWOTx7q; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GNSCD5CWsz9sV8 for ; Mon, 12 Jul 2021 12:19:52 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 32CE382C66; Mon, 12 Jul 2021 04:19:35 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="ElWOTx7q"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B434682C66; Mon, 12 Jul 2021 04:19:33 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x22d.google.com (mail-oi1-x22d.google.com [IPv6:2607:f8b0:4864:20::22d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A49D982C3F for ; Mon, 12 Jul 2021 04:19:26 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-oi1-x22d.google.com with SMTP id x70so11604363oif.11 for ; Sun, 11 Jul 2021 19:19:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=L+BVxXPD4e5MKVUwBPR5S7d9vlEVSbnv18heZNyuD1E=; b=ElWOTx7qG5Pth57gxkCrGjRhaEXREObeX+DFuk2Q5aZIbl/CRMx5oKpnI86saXThqq 975hGS3fYq/YGsYPrA1Ytl3xiir7ZA63Kr97NiE951XXl8VpE1HB9uut0dEyC+shtnFk s5kNUjF/6Lnw17+5xAAtQzLh5Uq08TVv9QG70= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=L+BVxXPD4e5MKVUwBPR5S7d9vlEVSbnv18heZNyuD1E=; b=FKswK7T5UbEfEA+HhFSwULf0yGlitwv8J/t93xgN6n+kviOabzZChJg7sRCId5SSym thXXUrT/xftkWGnPciA4rfgDfmNQKYGfVqhHoE97pksrz3emw6fpR3nLvA4Hcph555c+ iEMiJ9+rWQymSVJcI446xKAsRijlZATngwjgCKggVnleLYfnYWkdBzvUVLfiER8pyHQ5 xHpbKf99I0xkfpnV1ezjnikF2NHv1412S6IpQb6N8sDx1tqR6wDujAN1HbGI9jx2JcOi 88b2Db4fehMG9mVbU5YNrY7cyvgDgy+lfMjZZXxXr8O/4XSLmNoGXuPEAZEFWdDPqTbT eHXQ== X-Gm-Message-State: AOAM533Np5vwmmMUJVNdUKdSeVgWCwK8k6d2AzhATgi/UPkAFka9/Kuj zr/oHvoZxEHTBWLV27x//UhgNf2SskcYz7ay X-Google-Smtp-Source: ABdhPJymJncfPas8qoXj0pjt23OfXesg/IwTzqGMaMAqnpMo3+DIlzMcStAmET6jRrppdIB74tjPMw== X-Received: by 2002:a05:6808:4c2:: with SMTP id a2mr8711446oie.18.1626056365113; Sun, 11 Jul 2021 19:19:25 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id a44sm2270312ooj.12.2021.07.11.19.19.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Jul 2021 19:19:24 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass Subject: [PATCH v3 2/7] doc: Expand SPL docs to explain the phase and config Date: Sun, 11 Jul 2021 20:19:14 -0600 Message-Id: <20210711201855.v3.2.I0d67c4ce0fa42058bebd7a5f533f4aabbafda71b@changeid> X-Mailer: git-send-email 2.32.0.93.g670b81a890-goog In-Reply-To: <20210712021919.3409934-1-sjg@chromium.org> References: <20210712021919.3409934-1-sjg@chromium.org> MIME-Version: 1.0 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 Add a bit more information about how to use SPL. Signed-off-by: Simon Glass --- (no changes since v1) doc/develop/spl.rst | 59 +++++++++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 23 deletions(-) diff --git a/doc/develop/spl.rst b/doc/develop/spl.rst index 1165f95335f..c2a29a8c0a4 100644 --- a/doc/develop/spl.rst +++ b/doc/develop/spl.rst @@ -42,29 +42,42 @@ configured by defining CONFIG_SPL_TEXT_BASE. The linker script has to be defined with CONFIG_SPL_LDSCRIPT. To support generic U-Boot libraries and drivers in the SPL binary one can -optionally define CONFIG_SPL_XXX_SUPPORT. Currently following options -are supported: - -CONFIG_SPL_LIBCOMMON_SUPPORT (common/libcommon.o) -CONFIG_SPL_LIBDISK_SUPPORT (disk/libdisk.o) -CONFIG_SPL_I2C_SUPPORT (drivers/i2c/libi2c.o) -CONFIG_SPL_GPIO_SUPPORT (drivers/gpio/libgpio.o) -CONFIG_SPL_MMC_SUPPORT (drivers/mmc/libmmc.o) -CONFIG_SPL_SERIAL_SUPPORT (drivers/serial/libserial.o) -CONFIG_SPL_SPI_FLASH_SUPPORT (drivers/mtd/spi/libspi_flash.o) -CONFIG_SPL_SPI_SUPPORT (drivers/spi/libspi.o) -CONFIG_SPL_FS_FAT (fs/fat/libfat.o) -CONFIG_SPL_FS_EXT4 -CONFIG_SPL_LIBGENERIC_SUPPORT (lib/libgeneric.o) -CONFIG_SPL_POWER_SUPPORT (drivers/power/libpower.o) -CONFIG_SPL_NAND_SUPPORT (drivers/mtd/nand/raw/libnand.o) -CONFIG_SPL_DRIVERS_MISC_SUPPORT (drivers/misc) -CONFIG_SPL_DMA (drivers/dma/libdma.o) -CONFIG_SPL_POST_MEM_SUPPORT (post/drivers/memory.o) -CONFIG_SPL_NAND_LOAD (drivers/mtd/nand/raw/nand_spl_load.o) -CONFIG_SPL_SPI_LOAD (drivers/mtd/spi/spi_spl_load.o) -CONFIG_SPL_RAM_DEVICE (common/spl/spl.c) -CONFIG_SPL_WATCHDOG_SUPPORT (drivers/watchdog/libwatchdog.o) +optionally define CONFIG_SPL_XXX_SUPPORT (or CONFIG_SPL_XXX_SUPPORT for older +options). + +Adding SPL-specific code +------------------------ + +To check whether a feature is enabled, use CONFIG_IS_ENABLED():: + + if (CONFIG_IS_ENABLED(CLK)) + ... + +This checks CONFIG_CLK for the main build, CONFIG_SPL_CLK for the SPL build, +CONFIG_TPL_CLK for the TPL build, etc. + +U-Boot Phases +------------- + +U-Boot boots through the following phases: + +TPL + Very early init, as tiny as possible. This loads SPL. + +SPL + Secondary program loader. Sets up SDRAM and loads U-Boot proper. It may also + load other firmware components. + +U-Boot + U-Boot proper, containing the command line and boot logic. + + +Checking the boot phase +----------------------- + +Use `spl_phase()` to find the current U-Boot phase, e.g. `PHASE_SPL`. You can +also find the previous and next phase and get the phase name. + Device tree -----------