From patchwork Wed Jul 15 10:08:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1502 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id C1D6E3F1DD for ; Wed, 15 Jul 2020 12:09:57 +0200 (CEST) Received: by mail-pj1-f72.google.com with SMTP id q71sf2398841pjc.7 for ; Wed, 15 Jul 2020 03:09:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1594807796; cv=pass; d=google.com; s=arc-20160816; b=EqVtLkwXHNsaE6a7EJWQ3l5l0Qbwy1J0FOV3XvHE1480UjnQQyXzhEJVRz3h4rtfoT XltrFhtHpyg1JgUTAAOslwhWnBqJG5AxT1nYnMrWjWpMqBK00EPglHici/KzkoHoAGXK rE9oidSscZnpRZCXoa2yuPihI9sEESa1WbLSraTq3BLYWIYZ9LdYEioR+cg1klD3nKbe jjRMMMWaNdh8/mtx6D7H2jLx5kvXduAmEpz2vD8Yd20lHTJcS9rIyicgyXUJCWg7SXew m2y+3VED+0eXTjY+aIEhOpGfyW57mlNzUL7/BR2/oTLx0kohDhJROpQXeEcZvD+RjFEN 2DXw== 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:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=v8kGj80mJe/qvzSo7iHvfFGIWsPD/KRG8oxKEANoMOE=; b=DnuGbEoXg0qI8+2gxK3Nag3sRw2szI1RtxOqf8t40GKeHUTObTXsOIZE5qHNbRvC9l 7z24719odsBV4/n41fTO21+Ba3jkxDldwgkbKur1EopohbgnOyRnzdklZQ6SH1xLZD37 uAobs7mrsnmKLKPtOUgU0ns6WtMXd+BQdmAapi+PC3DKLSg74WMUKQ5CBbibZ3nAmojn 6r5etpNc1TIdUCcuyzZcOY86xrHBw+4oEBZDIlBuAR5UQkU75hsBha0/s4AFt+9kpiWh hGx0OhMV15Z5j68FmxdI12kmc7rBMCeMa1wpSIpZlOhngYNGknvXY3gHdzBz+Z/kUoba St6g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=r4rCpK19; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=v8kGj80mJe/qvzSo7iHvfFGIWsPD/KRG8oxKEANoMOE=; b=PgjgEeVz3NqRiJLhetuc2/ufw/dGHe2D1/kT2Z4ZUQiCdA29tQPyL2bjig5EKGvW+7 oRSxO4RWCFeOhAdKaOCEotR6pNjwvf7HYIjLiJIvKRKcOVaprfSTLpySRpvs7d4nA93S LOiodK+qGgOrpbHwIIigOl5ItUT2vaTOOWnSY= 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: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=v8kGj80mJe/qvzSo7iHvfFGIWsPD/KRG8oxKEANoMOE=; b=SLIyKFwO4hH8bgAA7qE6K0gf0vL0RzMYRwVXl4l7ZwpHEsUk6p+unS1kY/y2+x3HoM bBktYyYZP1Da8SrC0CsCjMDdXVz5MceUYCth8Fx+yxmY8TjS44llMRKUY1b0B1A+hK2i qNJJDU7oT76Taueqld2ZdixJsRXO85BPeynIrn1eR9DbzztprDg7L4rnE27d8PBGtHad vlm3GOx119N4EXgG8mmSCluTt+bRu+wDWRdW+f9XLOTYZVI7MjNQOfVwx4XOjxLeT94U Os9PG65Zbb0AvrNrB/NSgghirpBCTKFoqnCaaQ0OrNaBzkE9MeS3B2VoDBHmZAWQuy10 z0CA== X-Gm-Message-State: AOAM532Nft8TAAfnkGvOpIcSCr7B+0xGMiMQvNcjbmDA9eQIoBYMaMpD 3ewt1VFD+gs15tbKBGYJOEXvh1wQ X-Google-Smtp-Source: ABdhPJxJURZRelWf1CQIOsnjGx2bFCSyvNuwV8M8uOqQeOQIgx8pFWYt3mG2bk+4L79MrQICn4E1Yw== X-Received: by 2002:a63:5623:: with SMTP id k35mr7826887pgb.325.1594807796100; Wed, 15 Jul 2020 03:09:56 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a63:730d:: with SMTP id o13ls722293pgc.1.gmail; Wed, 15 Jul 2020 03:09:55 -0700 (PDT) X-Received: by 2002:a05:6a00:15c7:: with SMTP id o7mr7911107pfu.51.1594807795497; Wed, 15 Jul 2020 03:09:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594807795; cv=none; d=google.com; s=arc-20160816; b=udORAyIFwIvwINv1r1SyaBC3N/sVTg2O3lDyh1rXaNqr5oQjEwJ0ByqQEJ53d+xSjM nbPEeM9+c6Wj46fRE0tgUR+iR0RusuZY2UkvxKWv0FEtfDBh2ST3Qsd2XFUZRHcfiZUm wcreqyFks92T/wPMQ718O5TavgN8q+T+3CENuQEM3WRl0kTSnZ0dTuf5Cp3W9Xh65DsJ fXf1etuMLS5DHJtVYUbjDDfrZF3ofxGPKUt1s8MdxPjPn2pKbGloQ3UZ+Dmuhq/j4HLD TxbPyxq7jTdcI5QbpmKAwaquqoMjmh0FOxmau4Fw7DdvNRWK48RBy/SSA6Zw2q9X//p/ k5og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=Ysdit2OgVsRcFAop2cRPXYvJt6B+pLgu58WnYXV3fZU=; b=nQyslDBVCegp6N6xafjNFDdKagdzA7jBKargu49R+dXX3TR/0EL+0cCJNkqnzEP24C 1MxjjZj8snnez6vA0ytVNPzvLPEIlYC/7m3S+tndlATfT+mAiLsl1rmQJ1HIEU18TdYK vntaJYlKstaa19cS3/f5s+XPKb/Uh2dCx2/WJYkh3EHPi62jh5bR3Gb6N9eNVKQJb//O /g+opX4zNei6p4Iz6pGPMJd4es9aMKcK6V5PizwzOghOQpNI46mC2CqLAP6iKjR4K6Uq RiV13b6hjKGaab7r47Y7lenqyRX6yCCzGfGuWTkI7tmZgg00RpWZSHer8bLsMSvay6Y5 ZKVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=r4rCpK19; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@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 ay8sor1662374pjb.36.2020.07.15.03.09.55 for (Google Transport Security); Wed, 15 Jul 2020 03:09:55 -0700 (PDT) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; X-Received: by 2002:a17:90b:4c8b:: with SMTP id my11mr9405086pjb.153.1594807795203; Wed, 15 Jul 2020 03:09:55 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c809:c7d5:9887:56a8:c916:cfdb]) by smtp.gmail.com with ESMTPSA id p127sm1658577pfb.17.2020.07.15.03.09.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jul 2020 03:09:54 -0700 (PDT) From: Jagan Teki To: Rick Chen , Atish Patra , Palmer Dabbelt , Bin Meng , Paul Walmsley , Anup Patel , Sagar Kadam Cc: u-boot@lists.denx.de, linux-amarula@amarulasolutions.com, Jagan Teki , Bin Meng Subject: [PATCH v5 2/6] sifive: fu540: Add Booting from SPI Date: Wed, 15 Jul 2020 15:38:59 +0530 Message-Id: <20200715100903.161363-3-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200715100903.161363-1-jagan@amarulasolutions.com> References: <20200715100903.161363-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=r4rCpK19; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@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: , Add booting from SPI for SiFive Unleashed board. Signed-off-by: Jagan Teki Reviewed-by: Bin Meng Tested-by: Bin Meng --- Changes for v5: - rebase on master .../dts/hifive-unleashed-a00-u-boot.dtsi | 12 ++++++ configs/sifive_fu540_defconfig | 4 ++ doc/board/sifive/fu540.rst | 41 +++++++++++++++++++ 3 files changed, 57 insertions(+) diff --git a/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi index e037150520..7d838bf9de 100644 --- a/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi +++ b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi @@ -16,6 +16,10 @@ spi2 = &qspi2; }; + config { + u-boot,spl-payload-offset = <0x105000>; /* loader2 @1044KB */ + }; + hfclk { u-boot,dm-spl; }; @@ -26,6 +30,14 @@ }; +&qspi0 { + u-boot,dm-spl; + + flash@0 { + u-boot,dm-spl; + }; +}; + &qspi2 { mmc@0 { u-boot,dm-spl; diff --git a/configs/sifive_fu540_defconfig b/configs/sifive_fu540_defconfig index 9e00a56ce6..06e17860c6 100644 --- a/configs/sifive_fu540_defconfig +++ b/configs/sifive_fu540_defconfig @@ -6,6 +6,7 @@ CONFIG_SPL_DM_SPI=y CONFIG_SPL_MMC_SUPPORT=y CONFIG_NR_DRAM_BANKS=1 CONFIG_SPL=y +CONFIG_SPL_SPI_FLASH_SUPPORT=y CONFIG_SPL_SPI_SUPPORT=y CONFIG_TARGET_SIFIVE_FU540=y CONFIG_ARCH_RV64I=y @@ -16,8 +17,11 @@ CONFIG_MISC_INIT_R=y CONFIG_DISPLAY_CPUINFO=y CONFIG_DISPLAY_BOARDINFO=y CONFIG_SPL_SEPARATE_BSS=y +CONFIG_SPL_DM_SPI_FLASH=y +CONFIG_SPL_SPI_LOAD=y CONFIG_SPL_YMODEM_SUPPORT=y CONFIG_DEFAULT_DEVICE_TREE="hifive-unleashed-a00" CONFIG_SYS_RELOC_GD_ENV_ADDR=y +CONFIG_SPL_DM_SEQ_ALIAS=y CONFIG_SPL_CLK=y CONFIG_DM_MTD=y diff --git a/doc/board/sifive/fu540.rst b/doc/board/sifive/fu540.rst index 739eefa669..1ce9ab14f5 100644 --- a/doc/board/sifive/fu540.rst +++ b/doc/board/sifive/fu540.rst @@ -533,3 +533,44 @@ Sample boot log from HiFive Unleashed board type: 0fc63daf-8483-4772-8e79-3d69d8477de4 type: linux guid: 9faa81b6-39b1-4418-af5e-89c48f29c20d + +Booting from SPI +---------------- + +Use Building steps from "Booting from MMC using U-Boot SPL" section. + +Partition the SPI in Linux via mtdblock. (Require to boot the board in +SD boot mode by enabling MTD block in Linux) + +Use prebuilt image from here [1], which support to partition the SPI flash. + +.. code-block:: none + + # sgdisk --clear \ + > --set-alignment=2 \ + > --new=1:40:2087 --change-name=1:loader1 --typecode=1:5B193300-FC78-40CD-8002-E86C45580B47 \ + > --new=2:2088:10279 --change-name=2:loader2 --typecode=2:2E54B353-1271-4842-806F-E436D6AF6985 \ + > --new=3:10536:65494 --change-name=3:rootfs --typecode=3:0FC63DAF-8483-4772-8E79-3D69D8477DE4 \ + > /dev/mtdblock0 + +Program the SPI (Require to boot the board in SD boot mode) + +Execute below steps on U-Boot proper, + +.. code-block:: none + + tftpboot $kernel_addr_r u-boot-spl.bin + sf erase 0x5000 $filesize + sf write $kernel_addr_r 0x5000 $filesize + + tftpboot $kernel_addr_r u-boot.itb + sf erase 0x105000 $filesize + sf write $kernel_addr_r 0x105000 $filesize + +Power off the board + +Change DIP switches MSEL[3:0] are set to 0110 + +Power up the board. + +[1] https://github.com/amarula/bsp-sifive