From patchwork Fri Jun 14 07:35:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shyam Saini X-Patchwork-Id: 559 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 8CCF93F033 for ; Fri, 14 Jun 2019 09:37:43 +0200 (CEST) Received: by mail-pg1-f200.google.com with SMTP id c4sf1267372pgm.21 for ; Fri, 14 Jun 2019 00:37:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1560497862; cv=pass; d=google.com; s=arc-20160816; b=nuJtvq6zunChBzRPxVuP+dv3R67IoREFvwdQ+RF5wn69kAUIZaxlH3Nd0qfeSBW+LH KiayR2iTqJVlK6CXclIUPwyZ+i0gj4EGLah3Rh7sIKGYIWcP1PIXJA7YMn6a3IJFa24L wdvpr5C2CvRzYF8v9CSMfCJ5xj+GJ3h5fZp9Fu+fvt5SBf2mRPAJv8+7NUiNqN7qeVIM BObsCIC4aQ4qKqFnN51XTTi85Jrcq9AP6QjsR9VjZiszkrC2z8ecNEDsp/T+9FbRW5Q3 2DxrxWusGzyRnZAfTu2vSJqd+Wefg5l4Nn3VgOBdApsGbOkEpjdF1HqEEHTZcRWU0bGY Fn6w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:references:in-reply-to:message-id:date :subject:cc:to:from:mime-version:dkim-signature; bh=EmSoC8lveNN5qYIWVnBFDBGCQGhoAuytr/Dzwfe+feo=; b=C/iL+Fss1fONmN0vKBYymscgBr5JZauGBY3oEWccMqpYhoWkk6ehEqXZrKpsyh6RDR +8s0ZwzQSJSjE6EbrT4yZum63bM6yqaK6vfBbF0dlUishWZ4FqIgZyRDTtkuFNuUN4fw pFEbI0E3Ln6jy4aghj95h2G/1c3doypVPyynJZZ7LIl7rEbPIIHsBGL1TqsBsEkJTcTy JyDsqREYenPUCLFXFW47rUGplERhCKiUlsbywnA+E/MzWooLmn5M5Di/8BVFMs3Kqi3d QTdPXDptbNJefHfCZ2iddo4CG1KMVgL1E5OZ0b0Z/AszHKtNGM7Ze0oBx47lDI9nkL2a nNYA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=g3VDvbwo; spf=pass (google.com: domain of shyam.saini@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=shyam.saini@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=mime-version:from:to:cc:subject:date:message-id:in-reply-to :references:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=EmSoC8lveNN5qYIWVnBFDBGCQGhoAuytr/Dzwfe+feo=; b=KHpCCoz4BJw22VKAQAszCo6n+z4u3z1RppsSgFqIAQ+sbLuqwj5uRV5JesrhbxLvx5 89wEcCRVkr+71ng6NqL7Dje88boJgG4KuyUR6pq4Knv2FVCoyEDG0h7E6CpEQjD35RnV RE8ztHBxogN4P1Upfo/fOudEfzdf8K2h5cso4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:to:cc:subject:date:message-id :in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=EmSoC8lveNN5qYIWVnBFDBGCQGhoAuytr/Dzwfe+feo=; b=mkwgSb+cwvyJqBKgnJi+A456h7aqr6wglMzassAYGKW8YzxypTDIkGsoLjqODuQz8+ 5fmvxw3AS/dY0P7o9ZOkBq+VHVEefRy3lhFNRZKVRj7NGt5hEvT2Gaz6+WCQcv9V4dDL 8QtQJM3gCcqb1Jdue16gDbOkRyqMEMRRoVSrErGsI6heLRmXkKP5dP7EikbF8ygcjrJ4 rlBMQUXB0/FP129Au2j4/4utrI+weFbbKYDMswrcXK0HTqqsaCeO7HSTR2gZ3yC/U+bR vqF3v0Nzn2Saxi+FhfZARGht8gdB+a3T0h3ccV+B+NKgBUfRI4zGwoJGn4yniLK8I5tc y7MA== X-Gm-Message-State: APjAAAV+gwrCLrohsn7G3R7PZajlcFeQkRLkncB07EawvviXACaG9dKW 6FXm+x65INHtA/EdAjW7C3nOw0qv X-Google-Smtp-Source: APXvYqzUZUIRCf7YesnO0nZB3v8Pl35MrOAJ69Y2JxM4R/zTprofsJK1Kb4I7q8cNWJranUWj6b9vg== X-Received: by 2002:a63:a84c:: with SMTP id i12mr34869931pgp.115.1560497861469; Fri, 14 Jun 2019 00:37:41 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:bd8b:: with SMTP id q11ls2020741pls.4.gmail; Fri, 14 Jun 2019 00:37:41 -0700 (PDT) X-Received: by 2002:a17:90a:3544:: with SMTP id q62mr8801784pjb.53.1560497861018; Fri, 14 Jun 2019 00:37:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560497861; cv=none; d=google.com; s=arc-20160816; b=MpY9WlgVgrgne6EGaed5qEvTvbPuNaejYDv1nMKip4EBTOYCNmzqxNUTkS5N6UFMOE 3p8OaRCp3ufndsMsP9ymU9YOanWgx+KyNpQnUFaWs+PCiU65L+IGH2f42wFF67umTkBu ji6bQVDXrxVq0PO8m6jOO7NYnbEGOJMHRLWyGoAqRaIMgL/fMtHLykt97OEa8yHLm7WR IcicdHxquIvGdo5RiSJ/0xtylpO9nlIrpSTn3t9oDSbEZ95B8VwnMVYDLvmloJmaOeaa Jubb8/c91rAHiIHKWyi3Xe84sWv0S1Ggxo/GCl9mdwz7FNprDpAupD95Dod+Z/lmZVge hLXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=C1FOLgewwrxSe2tMRN8cITeMNwRmrSSodIfL+Et9fn4=; b=sRTyt11bk0PkcPKGcvOMWBnTpiMw1dOuPpm2EPbPfv8yM5GgQLNSj/R+AF77mqTmK2 LXdSjKLawlx6bL+4eBcVG+Z/FRAMSCK1uHBOcKBe+hlvkSGgkgGAf0xBVclKMd9uEZ7t jFGsXullVAp8DSp2TBMS938BMS2A01JXf2jiTKGjtjwvRGkVNBkMhqSGtu9GidjqD8xw YgFupupduGipJW/K2EFYBLjH8ZwVJxVjaF67yctZuL7g8+x7lRy0KS2HbklH12KfoTIB IDPlzGkmzFv784nkfJLWxEIMLMmchQaXv9YU4hX+0wo+rZgjpW7YXUGhoyJJ4PQ/zlMr vJhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=g3VDvbwo; spf=pass (google.com: domain of shyam.saini@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=shyam.saini@amarulasolutions.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id w2sor2626634ply.72.2019.06.14.00.37.40 for (Google Transport Security); Fri, 14 Jun 2019 00:37:41 -0700 (PDT) Received-SPF: pass (google.com: domain of shyam.saini@amarulasolutions.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; X-Received: by 2002:a17:902:d916:: with SMTP id c22mr67567722plz.195.1560497860698; Fri, 14 Jun 2019 00:37:40 -0700 (PDT) Received: from localhost.localdomain ([183.82.230.16]) by smtp.googlemail.com with ESMTPSA id c14sm887609pgm.40.2019.06.14.00.37.36 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 14 Jun 2019 00:37:40 -0700 (PDT) From: Shyam Saini To: sbabic@denx.de Cc: u-boot@lists.denx.de, ksi@koi8.net, stefan.agner@toradex.com, festevam@gmail.com, jagan@amarulasolutions.com, michael@amarulasolutions.com, linux-amarula@amarulasolutions.com, uboot-imx@nxp.com, Shyam Saini Subject: [PATCH 3/3] doc: imx: Add documentation for nandbcb command Date: Fri, 14 Jun 2019 13:05:35 +0530 Message-Id: <20190614073535.12502-3-shyam.saini@amarulasolutions.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190614073535.12502-1-shyam.saini@amarulasolutions.com> References: <20190614073535.12502-1-shyam.saini@amarulasolutions.com> X-Original-Sender: shyam.saini@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=g3VDvbwo; spf=pass (google.com: domain of shyam.saini@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=shyam.saini@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Signed-off-by: Shyam Saini --- doc/imx/common/imx6.txt | 74 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/doc/imx/common/imx6.txt b/doc/imx/common/imx6.txt index eab88353f6..0b5061128c 100644 --- a/doc/imx/common/imx6.txt +++ b/doc/imx/common/imx6.txt @@ -88,3 +88,77 @@ Reading bank 4: Word 0x00000002: 9f027772 00000004 +NAND Boot on i.MX6 with SPL support +-------------------------------------- + +Writing/updating boot image in nand device is not straight forward in +i.MX6 platform and it requires boot control block(BCB) to be configured. + +BCB contains two data structures, Firmware Configuration Block(FCB) and +Discovered Bad Block Table(DBBT). FCB has nand timings, DBBT search area, +and firmware. See IMX6DQRM Section 8.5.2.2 +for more information. + +We can't use 'nand write' command to write SPL/firmware image directly +like other platforms does. So we need special setup to write BCB block +as per IMX6QDL reference manual 'nandbcb update' command do that job. + +for nand boot, up on reset bootrom look for FCB structure in +first block's if FCB found the nand timings are loaded for +further reads. once FCB read done, DTTB will be loaded and +finally firmware will be loaded which is boot image. + +cmd_nandbcb will create FCB these structures +by taking mtd partition as an example. +- initial code will erase entire partition +- followed by FCB setup, like first 2 blocks for FCB/DBBT write, + and next block for FW1/SPL +- write firmware at FW1 block and +- finally write fcb/dttb in first 2 block. + +Typical NAND BCB layout: +======================= + + no.of blocks = partition size / erasesize + no.of fcb/dbbt blocks = 2 + FW1 offset = no.of fcb/dbbt + +block 0 1 2 + ------------------------------- + |FCB/DBBT 0|FCB/DBBT 1| FW 1 | + -------------------------------- + +On summary, nandbcb update will +- erase the entire partition +- create BCB by creating 2 FCB/BDDT block followed by + 1 FW blocks based on partition size and erasesize. +- fill FCB/DBBT structures +- write FW/SPL in FW1 +- write FCB/DBBT in first 2 blocks + +step-1: write SPL + +icorem6qdl> ext4load mmc 0:1 $loadaddr SPL +39936 bytes read in 10 ms (3.8 MiB/s) + +icorem6qdl> nandbcb update $loadaddr spl $filesize +device 0 offset 0x0, size 0x9c00 +Erasing at 0x1c0000 -- 100% complete. +NAND fw write: 0x80000 offset, 0xb000 bytes written: OK + +step-2: write u-boot-dtb.img + +icorem6qdl> nand erase.part uboot + +NAND erase.part: device 0 offset 0x200000, size 0x200000 +Erasing at 0x3c0000 -- 100% complete. +OK + +icorem6qdl> ext4load mmc 0:1 $loadaddr u-boot-dtb.img +589094 bytes read in 37 ms (15.2 MiB/s) + +icorem6qdl> nand write ${loadaddr} uboot ${filesize} + +NAND write: device 0 offset 0x200000, size 0x8fd26 + 589094 bytes written: OK +icorem6qdl>