From patchwork Wed Feb 12 15:14:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Opaniuk X-Patchwork-Id: 1236915 X-Patchwork-Delegate: bmeng.cn@gmail.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; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=aUFXz6Ig; 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 48Hjqf60lgz9s1x for ; Thu, 13 Feb 2020 02:14:54 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DE9648121E; Wed, 12 Feb 2020 16:14:46 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="aUFXz6Ig"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F381A81216; Wed, 12 Feb 2020 16:14:41 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) (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 41B74811FE for ; Wed, 12 Feb 2020 16:14:38 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=igor.opaniuk@gmail.com Received: by mail-wr1-x441.google.com with SMTP id r11so2788415wrq.10 for ; Wed, 12 Feb 2020 07:14:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=nqA5hW+rr4CCKa/UURdseVRlwB4fqdZjJUFvKajBCUc=; b=aUFXz6IgTviOhJdGXrhti0eC/J6mRmfwVb3LGwk+q8eK2lBTOJx6pRFQ9TRURqL3WU wB2pZQkPQSBRoWvwt/ys4ZRDkcaOlLs5UUopzXOPtLUy+UFuY2eWpZMKzFKjmRw7m/c/ 3+VCHvp4nmSOf7nnN6mp2f+jhazbpLiMCNareQTeSqIsC1UM8nN8NuDbpN6w9F6t9IOQ fQVUIXvc3ujpnJMD5f6IKJIyeFuoxOgVZPzhs0acylsJ4/GTE4gLgPnYup3c5UIjVrXX eCWk0aXMGNVuEnBf/zq/VIu5b495cuuKHRBGaHk+hhIPV2tmy254zBaZudBN9FDNibyn A5Qw== 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; bh=nqA5hW+rr4CCKa/UURdseVRlwB4fqdZjJUFvKajBCUc=; b=cPOPNe7MRTYC1Fp+PqJdo5lPRNqcii4s4OVg1A/uH/8ah4ia7smTl1RCyv8ObIhT9w vB4TyuoiZ1HQ7w7EaAri1SySc79kEghHhY2mgPy/yReNHXmRW4jjI7vv4hz2zl3fpbgS InvOQ2RlKOuq2Oh6DZRBRVAKTnl+TEQr3KuxOv4VFxEfLNatzSiMlqxenwV3CAXowDhm mDKEyF8N37pNlBhSSDEUNfQH3D3Pd28OQSmn1MPehBN5PDLe3tTrB2b/WFemfCieE4wU R0bl48SCyKxRlqIX8wHp6qrG0ZVZe4mtw2yp9k359MRggDOOdtmGW+UQk53KHgZHGDrd Fa9A== X-Gm-Message-State: APjAAAXITZboPuwBolE6Q6ScJE/znLMKVrrrL3sZ593CkHS5dlZegWdi KM6gvXMmBGR9r2J6B77+F/dWpDvrHL0= X-Google-Smtp-Source: APXvYqxPO5czNQ9uj3fwgAjMaGLcTJnBzdEW5SBGzkywycEWJMMpSRAasAzf0BAtUjavmPXyFXOutw== X-Received: by 2002:adf:db84:: with SMTP id u4mr16013669wri.317.1581520477451; Wed, 12 Feb 2020 07:14:37 -0800 (PST) Received: from localhost ([194.105.145.90]) by smtp.gmail.com with ESMTPSA id e22sm1039085wme.45.2020.02.12.07.14.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 12 Feb 2020 07:14:36 -0800 (PST) From: Igor Opaniuk To: u-boot@lists.denx.de Cc: Marcel Ziswiler , Philippe Schenker , Max Krummenacher , Oleksandr Suvorov , Bin Meng , Heinrich Schuchardt , Igor Opaniuk Subject: [PATCH v5 1/6] doc: board: toradex: add colibri_imx7.rst Date: Wed, 12 Feb 2020 17:14:28 +0200 Message-Id: <20200212151433.9713-2-igor.opaniuk@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200212151433.9713-1-igor.opaniuk@gmail.com> References: <20200212151433.9713-1-igor.opaniuk@gmail.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.102.1 at phobos.denx.de X-Virus-Status: Clean From: Igor Opaniuk - add initial index for toradex boards reST documentation - add initial colibri_imx7.rst doc file which provides all needed information for obtaining a workable image ready for flashing for both eMMC/NAND versions of Colibri iMX7. Reviewed-by: Bin Meng Signed-off-by: Igor Opaniuk Reviewed-by: Oleksandr Suvorov Tested-by: Bin Meng --- doc/board/index.rst | 1 + doc/board/toradex/colibri_imx7.rst | 127 +++++++++++++++++++++++++++++ doc/board/toradex/index.rst | 9 ++ 3 files changed, 137 insertions(+) create mode 100644 doc/board/toradex/colibri_imx7.rst create mode 100644 doc/board/toradex/index.rst diff --git a/doc/board/index.rst b/doc/board/index.rst index 00e72f57cd..f2f5907b8c 100644 --- a/doc/board/index.rst +++ b/doc/board/index.rst @@ -15,4 +15,5 @@ Board-specific doc intel/index renesas/index sifive/index + toradex/index xilinx/index diff --git a/doc/board/toradex/colibri_imx7.rst b/doc/board/toradex/colibri_imx7.rst new file mode 100644 index 0000000000..0c7ae082d0 --- /dev/null +++ b/doc/board/toradex/colibri_imx7.rst @@ -0,0 +1,127 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +Colibri iMX7 +============ + +Quick Start +----------- + +- Build U-Boot +- NAND IMX image adjustments before flashing +- Flashing manually U-Boot to eMMC +- Flashing manually U-Boot to NAND +- Using ``update_uboot`` script + +Build U-Boot +------------ + +.. code-block:: bash + + $ export CROSS_COMPILE=arm-linux-gnueabi- + $ export ARCH=arm + $ make colibri_imx7_emmc_defconfig # For NAND: colibri_imx7_defconfig + $ make + +After build succeeds, you will obtain final ``u-boot-dtb.imx`` IMX specific +image, ready for flashing (but check next section for additional +adjustments). + +Final IMX program image includes (section ``6.6.7`` from `IMX7DRM +`_): + +* **Image vector table** (IVT) for BootROM +* **Boot data** -indicates the program image location, program image size + in bytes, and the plugin flag. +* **Device configuration data** +* **User image**: U-Boot image (``u-boot-dtb.bin``) + + +IMX image adjustments prior to flashing +-------------------------------------------- + +1. U-Boot for both Colibri iMX7 NAND and eMMC versions +is built with HABv4 support (`AN4581.pdf +`_) +enabled by default, which requires to generate a proper +Command Sequence File (CSF) by srktool from NXP (not included in the +U-Boot tree, check additional details in introduction_habv4.txt) +and concatenate it to the final ``u-boot-dtb.imx``. + +2. In case if you don't want to generate a proper ``CSF`` (for any reason), +you still need to pad the IMX image so i has the same size as specified in +in **Boot Data** section of IMX image. +To obtain this value, run: + +.. code-block:: bash + + $ od -X -N 0x30 u-boot-dtb.imx + 0000000 402000d1 87800000 00000000 877ff42c + 0000020 877ff420 877ff400 878a5000 00000000 + ^^^^^^^^ + 0000040 877ff000 000a8060 00000000 40b401d2 + ^^^^^^^^ ^^^^^^^^ + +Where: + +* ``877ff400`` - IVT self address +* ``877ff000`` - Program image address +* ``000a8060`` - Program image size + +To calculate the padding: + +* IVT offset = ``0x877ff400`` - ``0x877ff000`` = ``0x400`` +* Program image size = ``0xa8060`` - ``0x400`` = ``0xa7c60`` + +and then pad the image: + +.. code-block:: bash + + $ objcopy -I binary -O binary --pad-to 0xa7c60 --gap-fill=0x00 \ + u-boot-dtb.imx u-boot-dtb.imx.zero-padded + +3. Also, according to requirement from ``6.6.7.1``, the final image +should have ``0x400`` offset for initial IVT table. + +For eMMC setup we handle this by flashing it to ``0x400``, howewer +for NAND setup we adjust the image prior to flashing, adding padding in the +beginning of the image. + +.. code-block:: bash + + $ dd if=u-boot-dtb.imx.zero-padded of=u-boot-dtb.imx.ready bs=1024 seek=1 + +Flash U-Boot IMX image to eMMC +------------------------------ + +Flash the ``u-boot-dtb.imx.zero-padded`` binary to the primary eMMC hardware +boot area partition: + +.. code-block:: bash + + + => load mmc 1:1 $loadaddr u-boot-dtb.imx.zero-padded + => setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200 + => mmc dev 0 1 + => mmc write ${loadaddr} 0x2 ${blkcnt} + +Flash U-Boot IMX image to NAND +------------------------------ + +.. code-block:: bash + + => load mmc 1:1 $loadaddr u-boot-dtb.imx.ready + => nand erase.part u-boot1 + => nand write ${loadaddr} u-boot1 ${filesize} + => nand erase.part u-boot2 + => nand write ${loadaddr} u-boot2 ${filesize} + +Using update_uboot script +------------------------- + +You can also usb U-Boot env update_uboot script, +which wraps all eMMC/NAND specific command invocation: + +.. code-block:: bash + + => load mmc 1:1 $loadaddr u-boot-dtb.imx.ready + => run update_uboot diff --git a/doc/board/toradex/index.rst b/doc/board/toradex/index.rst new file mode 100644 index 0000000000..aa418d6bad --- /dev/null +++ b/doc/board/toradex/index.rst @@ -0,0 +1,9 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +Toradex +======= + +.. toctree:: + :maxdepth: 2 + + colibri_imx7