From patchwork Tue May 19 19:23:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1293693 X-Patchwork-Delegate: jagannadh.teki@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=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.a=rsa-sha256 header.s=google header.b=cvm8jLjP; 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 49RQnD3Fhbz9sPK for ; Wed, 20 May 2020 05:24:48 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 660FD81584; Tue, 19 May 2020 21:24:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=amarulasolutions.com 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=amarulasolutions.com header.i=@amarulasolutions.com header.b="cvm8jLjP"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5222881584; Tue, 19 May 2020 21:24:38 +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.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) (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 4B37281584 for ; Tue, 19 May 2020 21:24:29 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jagan@amarulasolutions.com Received: by mail-pj1-x1042.google.com with SMTP id s69so106779pjb.4 for ; Tue, 19 May 2020 12:24:29 -0700 (PDT) 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:content-transfer-encoding; bh=Ug5Mn9JNdBHG8t5caMWjKTyxBhHTQ22TxGk0ePPcLl4=; b=cvm8jLjP1qvHTEajelP1Sh1SniXk00AXlv7C6oL0TpfIBryrGRyhT/b1Cl/CwonATI Ag3M8dpBc+6h7oXYd3UubgIbidkQ4ZR2hJ6be4j7KU1FRERgogQJ37/DtyTcVKa5RDGv sgJcm3vFF1hO0Ns9VHMHWiYHLX6zbFKtlc6Us= 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=Ug5Mn9JNdBHG8t5caMWjKTyxBhHTQ22TxGk0ePPcLl4=; b=tkK8na+2FylY0GZcCZRs31CrBrGjT64iUTf580iKTQ/ez2ZboI9wpbzyNbslf7AZEa Ajovh0CWvEUgg6QWzze5qqkI9npXKK91SJBt/rWqvdQxWhuoXRiwUCWvRpTlD4FWbvFo BxnJqwOPFxQF/1vn+v1k3bM9Oy0om4Lyovfg6Got74Ui0P8W8UYvegs0Nv/lVV8mnmNG Hpv1boVXqMfklDuPE6dN6mWoh0Ktu+/fVJM0eVtLD6BOW2MWsvqYpJQs94wWu0QY6f6S HxfovyoTsjTveSzy22MzZHVlJoDB0ODOnAzLjZotEQzeCcgl3HDe8Dh9Do0hNFjHGE1f M0oA== X-Gm-Message-State: AOAM5335y65YeNfZfx1yPkDMSx+OkHqZv67HJg5RpSXmyVKr4+d3hksA zhoyg+nY0udx2LWInQ7vEHU/xg== X-Google-Smtp-Source: ABdhPJxzUBC9BMRhJ2VHbzpA4s3PwaevB8Klq+4Tqh+uJLBmJJvSc0+Q1KUWVXcF82vP6jkARHvUMg== X-Received: by 2002:a17:902:fe06:: with SMTP id g6mr973149plj.118.1589916267718; Tue, 19 May 2020 12:24:27 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c809:c7d5:713c:4a0a:47eb:ffcd]) by smtp.gmail.com with ESMTPSA id w192sm222553pff.126.2020.05.19.12.24.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 12:24:26 -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 , Mario Six , Tom Rini , Simon Glass , Jean-Jacques Hiblot Subject: [PATCH v2 1/9] spl: Try to get SPL boot device via board_get_int Date: Wed, 20 May 2020 00:53:32 +0530 Message-Id: <20200519192340.16624-2-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200519192340.16624-1-jagan@amarulasolutions.com> References: <20200519192340.16624-1-jagan@amarulasolutions.com> MIME-Version: 1.0 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.2 at phobos.denx.de X-Virus-Status: Clean Usually, the associated board would supply spl boot device using spl_boot_device() but some boards have board driver that are possible to supply boot device via board_get_int with BOARD_SPL_BOOT_DEVICE id. This patch add support for those. Cc: Mario Six Cc: Tom Rini Cc: Simon Glass Cc: Jean-Jacques Hiblot Signed-off-by: Jagan Teki --- Changes for v2: - new patch common/spl/spl.c | 14 +++++++++++++- include/board.h | 9 +++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/common/spl/spl.c b/common/spl/spl.c index fc5cbbbeba..a07b71b3c1 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -483,9 +484,20 @@ int spl_init(void) #define BOOT_DEVICE_NONE 0xdeadbeef #endif +__weak u32 spl_boot_device(void) +{ + return 0; +} + __weak void board_boot_order(u32 *spl_boot_list) { - spl_boot_list[0] = spl_boot_device(); + struct udevice *board; + + if (!board_get(&board)) + board_get_int(board, BOARD_SPL_BOOT_DEVICE, + (int *)&spl_boot_list[0]); + else + spl_boot_list[0] = spl_boot_device(); } static struct spl_image_loader *spl_ll_find_loader(uint boot_device) diff --git a/include/board.h b/include/board.h index 678b652b0a..ce4eaba38d 100644 --- a/include/board.h +++ b/include/board.h @@ -211,3 +211,12 @@ static inline int board_get_fit_loadable(struct udevice *dev, int index, } #endif + +/** + * Common board unique identifier + * + * @BOARD_SPL_BOOT_DEVICE: id to get SPL boot device. + */ +enum common_ids { + BOARD_SPL_BOOT_DEVICE, +}; From patchwork Tue May 19 19:23:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1293695 X-Patchwork-Delegate: jagannadh.teki@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=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.a=rsa-sha256 header.s=google header.b=oyjqWhGw; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49RQnS1LCkz9sPK for ; Wed, 20 May 2020 05:25:00 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1BAB481E24; Tue, 19 May 2020 21:24:44 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=amarulasolutions.com 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=amarulasolutions.com header.i=@amarulasolutions.com header.b="oyjqWhGw"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3527181E17; Tue, 19 May 2020 21:24:41 +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.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) (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 45B5781E20 for ; Tue, 19 May 2020 21:24:38 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jagan@amarulasolutions.com Received: by mail-pg1-x544.google.com with SMTP id s10so298886pgm.0 for ; Tue, 19 May 2020 12:24:38 -0700 (PDT) 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:content-transfer-encoding; bh=sHyfWYVdSf0sDAPyFHIINfBPsPCytqWb7we7stjjx/g=; b=oyjqWhGw3chzoVzgxhFNtyzi3mFCQHiEijUPBdzGWGqHpSeaUXdo/7Ki3tAPeZNZ0P pxCppHr0EDY0hzMjrUyKriIotOX8+KWfdoT3Xr3Y9lbnW5MrZbtLeqfYjEYkw7bOAMrj dsnKDfRvqOQj5/z6tIqcgEE5GdULAcTZ2h6qw= 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=sHyfWYVdSf0sDAPyFHIINfBPsPCytqWb7we7stjjx/g=; b=sMJjgILYKMkB6PJiVQDfeAFTYuWX8buMF6dK+cn/ugtXrttgxbq/lraUJ/l/adNiPt 1jN9fOAu7WpKX4MJ2FsPfLNpRq/p8UD1y9q9tITNOqFOuFdSs049tTFNHQ+kBowTD+Xi VHIvofFrYbp3vRd9633ql4bb4DQk8bmF0dD/sm/WBHaRjlVEYlHSCD8P3mI1QYYuI2L+ 9yBLlXBQtpGTMg5UNRQCMUBTHkER4uR2X+0Gp/C0Vdi35vqyEwAGvT5be8PKUvtIt98a gVVYmrfmOBFvZAQcl00V3IfiAFWoO1Cz7lpbeEY5YD5vWjiomPOrA9HiAFB9WYX25gZj 6+ew== X-Gm-Message-State: AOAM532LS2iOVuMGs2yxY1CazJtzxzOmL1Otd9KantuPJZjBwN/CV5L1 leJtD1ALW5ifEM3+D0GaAyY9rA== X-Google-Smtp-Source: ABdhPJwE++eOa127E8DDasMBWoDa1lYcI8FkH/XrqAsp35hZVA5bqTQalKDHJ/hNYOZMgzefnDuBKQ== X-Received: by 2002:a63:de06:: with SMTP id f6mr748914pgg.238.1589916272500; Tue, 19 May 2020 12:24:32 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c809:c7d5:713c:4a0a:47eb:ffcd]) by smtp.gmail.com with ESMTPSA id w192sm222553pff.126.2020.05.19.12.24.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 12:24:31 -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 , Simon Glass Subject: [PATCH v2 2/9] dt-bindings: board: Document sifive,fu540-modeselect Date: Wed, 20 May 2020 00:53:33 +0530 Message-Id: <20200519192340.16624-3-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200519192340.16624-1-jagan@amarulasolutions.com> References: <20200519192340.16624-1-jagan@amarulasolutions.com> MIME-Version: 1.0 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.2 at phobos.denx.de X-Virus-Status: Clean Add dt-bindings documentation for sifive,fu540-modeselect board driver, which usually get runtime boot mode of fu540 boards. Cc: Simon Glass Signed-off-by: Jagan Teki --- Changes for v2: - new patch .../board/sifive,fu540-modeselect.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 doc/device-tree-bindings/board/sifive,fu540-modeselect.txt diff --git a/doc/device-tree-bindings/board/sifive,fu540-modeselect.txt b/doc/device-tree-bindings/board/sifive,fu540-modeselect.txt new file mode 100644 index 0000000000..801c068390 --- /dev/null +++ b/doc/device-tree-bindings/board/sifive,fu540-modeselect.txt @@ -0,0 +1,15 @@ +fu540 board driver + +This driver provides capabilities to get the current boot device for +fu540 associated board. + +Required properties: +- compatible: should be "sifive,fu540-modeselect" +- reg: physical base address and size of fu540 modeselct + +Example: + +board: mode@1000 { + compatible = "sifive,fu540-modeselect"; + reg = <0x0 0x1000 0x0 0x1FFF>; +}; From patchwork Tue May 19 19:23:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1293696 X-Patchwork-Delegate: jagannadh.teki@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=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.a=rsa-sha256 header.s=google header.b=AnuMOFdw; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 49RQnh2y6Nz9sPK for ; Wed, 20 May 2020 05:25:12 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 50B5181E2A; Tue, 19 May 2020 21:24:54 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b="AnuMOFdw"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6387A81E17; Tue, 19 May 2020 21:24:42 +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.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) (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 E4D4B81584 for ; Tue, 19 May 2020 21:24:38 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jagan@amarulasolutions.com Received: by mail-pg1-x542.google.com with SMTP id n11so273425pgl.9 for ; Tue, 19 May 2020 12:24:38 -0700 (PDT) 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:content-transfer-encoding; bh=wQRnrCcKBaUZ5qrH7kStrqLRK78MH5/+WJ8rfYLkS4E=; b=AnuMOFdw5+GvR7jKRZ8GkOHu54O63BP6J/WAoe9ci7hekGIPSbG8UbxLWb4qY7AfW3 3GuQpQ/K9Qhn1/aF93FK5Svl/rL0FEN1QOx/TFM4E97AvVK04jjeiyweKLyh8VFNjd6y iGTtkUUwJaKMmAaMqhiBZBQS/WqywN1CO7RLI= 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=wQRnrCcKBaUZ5qrH7kStrqLRK78MH5/+WJ8rfYLkS4E=; b=eKcLWWRnbg9TioctPfyYxQ6S9M1NrS5a9R1uMoZFqDtkyhCh9zORyqXgci1gR53S0s ZQKEFmI0MjVj22/59XmzAnJPJjGGOMxdysU5ZKkHOITXMVccAl4OytDzUt5A1yqxzHFq U2vAKtwvmchkZdJcElg+SKZ7sAeViflLssuJ+LJMPiG8m6DYLuuJRhpq18lRx1NgD7PV rTt7Ry46EDeIU4+P3pwzF06oo44le+LqrXafpMS5jczxiYLnVjaKa+VnClGlwHa5Zoa8 6L5aKHG/bxzFYcSzI8hGsuO9AhrSNa98eThEdkyOVF4KuQ38AUAcX4DPtCMHSBufTVks VLTw== X-Gm-Message-State: AOAM5330zOgkGwmDDR9Vm8bmGWMgzfH8rw0dMRCowqlKW00sSR0+fQMP qLlwVyZPZeWnzwPYrG/8r2ArBpoL4dV21Q== X-Google-Smtp-Source: ABdhPJw86K9ZPEmmo1pMXwE8ZEsBUASmoHOr+Ecj8jcbrPSwV2FK4FyHjmkHGyVSaTRaFCqNOYPg8w== X-Received: by 2002:a63:b0f:: with SMTP id 15mr702692pgl.6.1589916276314; Tue, 19 May 2020 12:24:36 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c809:c7d5:713c:4a0a:47eb:ffcd]) by smtp.gmail.com with ESMTPSA id w192sm222553pff.126.2020.05.19.12.24.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 12:24:35 -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 Subject: [PATCH v2 3/9] riscv: dts: fu540-c000-u-boot: Add sifive, fu540-modeselect Date: Wed, 20 May 2020 00:53:34 +0530 Message-Id: <20200519192340.16624-4-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200519192340.16624-1-jagan@amarulasolutions.com> References: <20200519192340.16624-1-jagan@amarulasolutions.com> MIME-Version: 1.0 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.2 at phobos.denx.de X-Virus-Status: Clean Add sifive,fu540-modeselect node, which usually get runtime boot mode of fu540 boards. Signed-off-by: Jagan Teki --- Changes for v2: - new patch arch/riscv/dts/fu540-c000-u-boot.dtsi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/riscv/dts/fu540-c000-u-boot.dtsi b/arch/riscv/dts/fu540-c000-u-boot.dtsi index fc91a7c987..0ccda0e59b 100644 --- a/arch/riscv/dts/fu540-c000-u-boot.dtsi +++ b/arch/riscv/dts/fu540-c000-u-boot.dtsi @@ -48,6 +48,13 @@ soc { u-boot,dm-spl; + + board: mode@1000 { + compatible = "sifive,fu540-modeselect"; + reg = <0x0 0x1000 0x0 0x1FFF>; + u-boot,dm-spl; + }; + otp: otp@10070000 { compatible = "sifive,fu540-c000-otp"; reg = <0x0 0x10070000 0x0 0x0FFF>; From patchwork Tue May 19 19:23:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1293697 X-Patchwork-Delegate: jagannadh.teki@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=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.a=rsa-sha256 header.s=google header.b=Kqjk1duo; 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 49RQpY1HFRz9sT4 for ; Wed, 20 May 2020 05:25:57 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C112181E35; Tue, 19 May 2020 21:24:55 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=amarulasolutions.com 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=amarulasolutions.com header.i=@amarulasolutions.com header.b="Kqjk1duo"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1F81581E2C; Tue, 19 May 2020 21:24:46 +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.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) (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 7B62781DFE for ; Tue, 19 May 2020 21:24:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jagan@amarulasolutions.com Received: by mail-pj1-x1041.google.com with SMTP id 5so117836pjd.0 for ; Tue, 19 May 2020 12:24:42 -0700 (PDT) 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:content-transfer-encoding; bh=m6tHTWPu33s92LiU+iJcaJyzN2BnUnszfQVO3bujTUk=; b=Kqjk1duoDZzuUqmzHyurxBo3bWP0QPkDnCUrCUey02Ko7OxOQ4n9M/QgL1GOUULWRB cbbq3I4aBFIs1dIV9pU2rvrdfnCtZp2U181ibfXI3dQvidbWhYeHkujLu7sS0M0cda/j EnW0fvvqqBswDcT1pQZ9XEfifuiRP7iMiVizc= 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=m6tHTWPu33s92LiU+iJcaJyzN2BnUnszfQVO3bujTUk=; b=W92fGahRFf3hzuJR/sc3fvhvPQpZx/FF/W+GVXME8v3JgA4KFtkYGquIouD+LzU5p+ lTn8rLsqCUh3opJbTXcYe3XJDRH7AfDrp4BWQ0NBNbyt5x+BAN7UcB9ON/NAleXVL8cb oXfvZv+QA3JUPgZR8s+CftkqewRefE1O4YyOwoiiH4+vA3yhB6D5+UI0P1Pbo3apHD9V KZtdHYcCvuPwH0zKsVHuBlmfl3B/Um5IiININNdZj4dzrVz1I9GYJg0Gixtm95SSij9f 24WpzAYEZpPrYtidu9u2wh3naVPvZWzMCvFy7K81N6kuQp5x8XNkkTV67oAMchF54gJ/ I+pA== X-Gm-Message-State: AOAM53388mnP5ymc/W4t/fQa6ks/GHqr30BHKYh0N58WcS9RetgGzusp lRnpQCLchhKi3RtLQohq2JqUzQ== X-Google-Smtp-Source: ABdhPJza0FMe1NM4Xj2GC/MT+ftxAhJCWZSRS4j7rwJ9jzsg/FIXmZWOaKhnZfNmguojPb/qfE+a6A== X-Received: by 2002:a17:902:bc42:: with SMTP id t2mr954438plz.233.1589916281000; Tue, 19 May 2020 12:24:41 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c809:c7d5:713c:4a0a:47eb:ffcd]) by smtp.gmail.com with ESMTPSA id w192sm222553pff.126.2020.05.19.12.24.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 12:24:40 -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 , Mario Six , Tom Rini , Simon Glass , Jean-Jacques Hiblot Subject: [PATCH v2 4/9] drivers: Add fu540 board driver Date: Wed, 20 May 2020 00:53:35 +0530 Message-Id: <20200519192340.16624-5-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200519192340.16624-1-jagan@amarulasolutions.com> References: <20200519192340.16624-1-jagan@amarulasolutions.com> MIME-Version: 1.0 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.2 at phobos.denx.de X-Virus-Status: Clean Add fu540 board driver, which is used to get runtime boot mode of fu540 boards. Cc: Mario Six Cc: Tom Rini Cc: Simon Glass Cc: Jean-Jacques Hiblot Signed-off-by: Jagan Teki --- Changes for v2: - new patch drivers/board/Kconfig | 8 ++++ drivers/board/Makefile | 1 + drivers/board/fu540.c | 86 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+) create mode 100644 drivers/board/fu540.c diff --git a/drivers/board/Kconfig b/drivers/board/Kconfig index 254f657049..306ee76bbd 100644 --- a/drivers/board/Kconfig +++ b/drivers/board/Kconfig @@ -12,6 +12,14 @@ config SPL_BOARD depends on SPL_DM bool "Enable board driver support in SPL" +config BOARD_FU540 + bool "Enable board driver for the FU540 boards" + depends on RISCV + select SPL_BOARD + help + Support querying board information for the fu540 boards, like + get soc mode select, get SPL boot device and etc. + config BOARD_GAZERBEAM bool "Enable board driver for the Gazerbeam board" help diff --git a/drivers/board/Makefile b/drivers/board/Makefile index cc16361755..e924472779 100644 --- a/drivers/board/Makefile +++ b/drivers/board/Makefile @@ -3,5 +3,6 @@ # (C) Copyright 2017 # Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc obj-y += board-uclass.o +obj-$(CONFIG_BOARD_FU540) += fu540.o obj-$(CONFIG_BOARD_GAZERBEAM) += gazerbeam.o obj-$(CONFIG_BOARD_SANDBOX) += sandbox.o diff --git a/drivers/board/fu540.c b/drivers/board/fu540.c new file mode 100644 index 0000000000..68d356df6b --- /dev/null +++ b/drivers/board/fu540.c @@ -0,0 +1,86 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (c) 2020 Amarula Solutions(India) + */ + +#include +#include +#include +#include +#include +#include + +#define MODE_SELECT_QSPI 0x6 +#define MODE_SELECT_SD 0xb +#define MODE_SELECT_MASK GENMASK(3, 0) + +struct fu540_board { + void __iomem *regs; +}; + +static int fu540_get_boot_device(struct udevice *dev) +{ + struct fu540_board *priv = dev_get_priv(dev); + u8 boot_device = BOOT_DEVICE_MMC1; + u32 reg; + + reg = readl(priv->regs); + switch (reg & MODE_SELECT_MASK) { + case MODE_SELECT_QSPI: + boot_device = BOOT_DEVICE_SPI; + break; + case MODE_SELECT_SD: + boot_device = BOOT_DEVICE_MMC1; + break; + default: + dev_err(dev, + "Unsupported boot device 0x%x but trying MMC1\n", + boot_device); + break; + } + + return boot_device; +} + +static int fu540_board_get_int(struct udevice *dev, int id, int *val) +{ + switch (id) { + case BOARD_SPL_BOOT_DEVICE: + *val = fu540_get_boot_device(dev); + break; + default: + dev_err(dev, "%s: Integer value %d unknown\n", dev->name, id); + return -EINVAL; + } + + return 0; +} + +static const struct board_ops fu540_board_ops = { + .get_int = fu540_board_get_int, +}; + +static int fu540_board_probe(struct udevice *dev) +{ + struct fu540_board *priv = dev_get_priv(dev); + + priv->regs = (void __iomem *)dev_read_addr(dev); + if (IS_ERR(priv->regs)) + return PTR_ERR(priv->regs); + + return 0; +} + +static const struct udevice_id fu540_board_ids[] = { + { .compatible = "sifive,fu540-modeselect", }, + { /* sentinel */ } +}; + +U_BOOT_DRIVER(fu540_board) = { + .id = UCLASS_BOARD, + .name = "fu540_board", + .of_match = fu540_board_ids, + .ops = &fu540_board_ops, + .priv_auto_alloc_size = sizeof(struct fu540_board), + .probe = fu540_board_probe, +}; From patchwork Tue May 19 19:23:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1293698 X-Patchwork-Delegate: jagannadh.teki@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=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.a=rsa-sha256 header.s=google header.b=HTB14d5e; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 49RQr32W6Yz9sPK for ; Wed, 20 May 2020 05:27:12 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5AE6381E39; Tue, 19 May 2020 21:24:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=amarulasolutions.com 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=amarulasolutions.com header.i=@amarulasolutions.com header.b="HTB14d5e"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 51B4981E2A; Tue, 19 May 2020 21:24:50 +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.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) (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 5E06881DFE for ; Tue, 19 May 2020 21:24:46 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jagan@amarulasolutions.com Received: by mail-pj1-x1041.google.com with SMTP id 5so117936pjd.0 for ; Tue, 19 May 2020 12:24:46 -0700 (PDT) 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:content-transfer-encoding; bh=09Qf1T+fvlhBfVx1TLgBZwQYUWr10jqdqIDeq0OFCJI=; b=HTB14d5ew/oytZfWJ1+Hd6U0zCLWm0lvQzi86QdVYfgJMLkid9xybn15gmU2CBW2rh wJDSYXOuCjQsDkHr4ZtokFghoH0Zpz0slB97snenBoFrUQla/9aY2KIriEvT9ODdw9zN sQzyl/OrbhngoFEeo5+kO3/9wFsVi0IYLhuLA= 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=09Qf1T+fvlhBfVx1TLgBZwQYUWr10jqdqIDeq0OFCJI=; b=lEe7C41K8gIRunCdbDFtQLTBUWgmGD3if4JmJ/2fq+tNSmbRZDsEQ2ltjvbumHavBx Q3QNR0Fb1nko7me3inqJlsFUg4dKv15+RTZIvvbIiFjo6dsqJRY+JmRL79fedQSwFMjJ xych+I2QVw8ab2HP1ohm2LBDy1O7D1VdS/TzstsbHkmUqlRTxk3ieKvX1Tgk28bE74nA 9IUCdbiaihKp/1xeUp5uShIEr1OqHPaVY4YKk338ihjHQ6DgW4nOS0rrfcJ6jzbNY2ZQ A36pglNUQblXLiPHAEc4Y+NVQAjXBAV9otoEJL+Gqf1pcVpBG5y8og/DDb4w9ij3J6jM hXdQ== X-Gm-Message-State: AOAM531AnxOf2KDw7JhL26SKy5yW7sQKJfdLDjzhdD0X1zgRNpuX2PPs gw5X8z4MfG952DRg06O1FOS56g== X-Google-Smtp-Source: ABdhPJwoAAgIo3Bn+Jen62wG0zcUJLMgnAjLvooLjQND1aNWhMaI802ZTlhxoMIYNBCHE06ZTBNC7w== X-Received: by 2002:a17:902:8b82:: with SMTP id ay2mr973898plb.94.1589916284793; Tue, 19 May 2020 12:24:44 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c809:c7d5:713c:4a0a:47eb:ffcd]) by smtp.gmail.com with ESMTPSA id w192sm222553pff.126.2020.05.19.12.24.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 12:24:44 -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 Subject: [PATCH v2 5/9] sifive: fu540: Add Booting from SPI Date: Wed, 20 May 2020 00:53:36 +0530 Message-Id: <20200519192340.16624-6-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200519192340.16624-1-jagan@amarulasolutions.com> References: <20200519192340.16624-1-jagan@amarulasolutions.com> MIME-Version: 1.0 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.2 at phobos.denx.de X-Virus-Status: Clean U-Boot SPL 2020.07-rc2-00156-gb9abb0716a-dirty (May 19 2020 - 21:56:17 +0530) Trying to boot from SPI U-Boot 2020.07-rc2-00156-gb9abb0716a-dirty (May 19 2020 - 21:56:17 +0530) CPU: rv64imafdc Model: SiFive HiFive Unleashed A00 DRAM: 8 GiB No reserved memory region found in source FDT MMC: spi@10050000:mmc@0: 0 In: serial@10010000 Out: serial@10010000 Err: serial@10010000 Net: eth0: ethernet@10090000 Hit any key to stop autoboot: 0 Signed-off-by: Jagan Teki --- Changes for v2: - enable board driver - comment spl-payloade-offset - reference for SPI partition arch/riscv/cpu/fu540/Kconfig | 2 + .../dts/hifive-unleashed-a00-u-boot.dtsi | 12 ++++++ board/sifive/fu540/fu540.c | 12 ------ configs/sifive_fu540_defconfig | 4 ++ doc/board/sifive/fu540.rst | 41 +++++++++++++++++++ 5 files changed, 59 insertions(+), 12 deletions(-) diff --git a/arch/riscv/cpu/fu540/Kconfig b/arch/riscv/cpu/fu540/Kconfig index e9302e87c0..7a813a9ac8 100644 --- a/arch/riscv/cpu/fu540/Kconfig +++ b/arch/riscv/cpu/fu540/Kconfig @@ -5,6 +5,8 @@ config SIFIVE_FU540 bool select ARCH_EARLY_INIT_R + imply BOARD + imply BOARD_FU540 imply CPU imply CPU_RISCV imply RISCV_TIMER diff --git a/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi index 303806454b..4b2b242deb 100644 --- a/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi +++ b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi @@ -12,6 +12,10 @@ spi2 = &qspi2; }; + config { + u-boot,spl-payload-offset = <0x105000>; /* loader2 @1044KB */ + }; + hfclk { u-boot,dm-spl; }; @@ -22,6 +26,14 @@ }; +&qspi0 { + u-boot,dm-spl; + + flash@0 { + u-boot,dm-spl; + }; +}; + &qspi2 { mmc@0 { u-boot,dm-spl; diff --git a/board/sifive/fu540/fu540.c b/board/sifive/fu540/fu540.c index 535ab60aed..a7b530b281 100644 --- a/board/sifive/fu540/fu540.c +++ b/board/sifive/fu540/fu540.c @@ -116,18 +116,6 @@ int board_init(void) return 0; } -#ifdef CONFIG_SPL -u32 spl_boot_device(void) -{ -#ifdef CONFIG_SPL_MMC_SUPPORT - return BOOT_DEVICE_MMC1; -#else - puts("Unknown boot device\n"); - hang(); -#endif -} -#endif - #ifdef CONFIG_SPL_LOAD_FIT int board_fit_config_name_match(const char *name) { diff --git a/configs/sifive_fu540_defconfig b/configs/sifive_fu540_defconfig index 8d412f8d6a..551d4b04a5 100644 --- a/configs/sifive_fu540_defconfig +++ b/configs/sifive_fu540_defconfig @@ -2,9 +2,11 @@ CONFIG_RISCV=y CONFIG_SPL_GPIO_SUPPORT=y CONFIG_SYS_MALLOC_F_LEN=0x3000 CONFIG_ENV_SIZE=0x20000 +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 @@ -15,9 +17,11 @@ CONFIG_MISC_INIT_R=y CONFIG_DISPLAY_CPUINFO=y CONFIG_DISPLAY_BOARDINFO=y CONFIG_SPL_SEPARATE_BSS=y +CONFIG_SPL_SPI_LOAD=y CONFIG_SPL_YMODEM_SUPPORT=y CONFIG_OF_BOARD_FIXUP=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 9e9ae98b64..d3d38eb966 100644 --- a/doc/board/sifive/fu540.rst +++ b/doc/board/sifive/fu540.rst @@ -541,3 +541,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 + + sf erase 0x5000 0x100000 + tftpboot $kernel_addr_r u-boot-spl.bin + sf write $kernel_addr_r 0x5000 $filesize + + sf erase 0x105000 0x100000 + tftpboot $kernel_addr_r u-boot.itb + 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 From patchwork Tue May 19 19:23:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1293700 X-Patchwork-Delegate: jagannadh.teki@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=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.a=rsa-sha256 header.s=google header.b=Pv1xQCbJ; 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 49RQrJ19hfz9sPK for ; Wed, 20 May 2020 05:27:27 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4F03081E41; Tue, 19 May 2020 21:24:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=amarulasolutions.com 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=amarulasolutions.com header.i=@amarulasolutions.com header.b="Pv1xQCbJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2D96B81E26; Tue, 19 May 2020 21:24:53 +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.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) (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 37A4F81E2C for ; Tue, 19 May 2020 21:24:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jagan@amarulasolutions.com Received: by mail-pl1-x641.google.com with SMTP id x10so296793plr.4 for ; Tue, 19 May 2020 12:24:50 -0700 (PDT) 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:content-transfer-encoding; bh=QN1n4c5LMxVf1YaYQWpBH3NQf3Ufv/ksTgLkPGZFTCM=; b=Pv1xQCbJDZfla9BolEmehe9yvicPNyVRvyiHkiKWh8vkmYxXb2x45fKcAm090FLKes /dNMsEQjnaeltr9MhXDd4gDnQ39ggYRnLwM7Xpljfs8Rtl997VNVUHtJkYfcSJSuVmW6 xV2H2mGo4SmO56G3sTzo8O9xddw2ITrtOeIbs= 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=QN1n4c5LMxVf1YaYQWpBH3NQf3Ufv/ksTgLkPGZFTCM=; b=s7IAqfQQs2p96ZlBc1ASJeRngoqu/XgGN8ae/Y1osq5Og+xTl+iemCMNHnckQivY4S dIfy6zpktH8OgVIjVgRw9v19Tx1cHwPjTmafRfV+Pr59beXhqJlndXB7QVJVBN0RN9O4 3XwnbmKTJX9VN5M5XU+cPm1KT3z49kfid2ZF1+yfys10WEW1+Tn1Z+q84Rd/OQy6x69R Ua7tOAXcgWnEDYk/7MX6GQQ4OAso/Wqvg0IBzIJaLv5hKgfMmPhrx950zpMUkdUNaEFc VwigdNvknUeTIpBA+wccB7wLnnhuW29xndket5Qqtr0BMQo84Hyw3R84SLM/CCzn4dNz YuxA== X-Gm-Message-State: AOAM532PLpco5iY+7++NZfoaIH8dXgmPtmpgqVFNeVf6my9PBuRjE6J0 M/+GPiMjToBydz2dc7TO6ykRiw== X-Google-Smtp-Source: ABdhPJzAUGYOVNZL8bEpFvrAFti3Y1rzyGhaVsM99g6Y1rfcbVSRktg8eSszt1l8+87MsOF4zVfcng== X-Received: by 2002:a17:902:7b86:: with SMTP id w6mr968557pll.292.1589916288629; Tue, 19 May 2020 12:24:48 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c809:c7d5:713c:4a0a:47eb:ffcd]) by smtp.gmail.com with ESMTPSA id w192sm222553pff.126.2020.05.19.12.24.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 12:24:47 -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 Subject: [PATCH v2 6/9] env: Enable SPI flash env for SiFive FU540 Date: Wed, 20 May 2020 00:53:37 +0530 Message-Id: <20200519192340.16624-7-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200519192340.16624-1-jagan@amarulasolutions.com> References: <20200519192340.16624-1-jagan@amarulasolutions.com> MIME-Version: 1.0 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.2 at phobos.denx.de X-Virus-Status: Clean SPI flash device on HiFive Unleashed has 32MiB Size. This patch add SPI flash environment after U-Boot proper partition with a size of 128KiB. SPI flash partition layout(32MiB): 0 - 34 : reserved for GPT header 35 - 39 : unused 40 - 2087 : loader1 (SPL, FSBL) 2088 - 10279 : loader2 (U-Boot proper, U-Boot) 10280 - 10535 : environment 10536 - 65494 : rootfs 65528 - 65536 : distro script Note: the loader1 must start from 40th sector even though there are 6 free sectors prior since 40th sector is nearest flash sector boundary.  Signed-off-by: Jagan Teki --- Changes for v2: - move env offsets from generic to cpu Kconfig arch/riscv/cpu/fu540/Kconfig | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/riscv/cpu/fu540/Kconfig b/arch/riscv/cpu/fu540/Kconfig index 7a813a9ac8..417926d2cf 100644 --- a/arch/riscv/cpu/fu540/Kconfig +++ b/arch/riscv/cpu/fu540/Kconfig @@ -15,3 +15,16 @@ config SIFIVE_FU540 imply SPL_CPU_SUPPORT imply SPL_OPENSBI imply SPL_LOAD_FIT + +if CONFIG_ENV_IS_IN_SPI_FLASH + +config ENV_OFFSET + default 0x505000 + +config ENV_SIZE + default 0x20000 + +config ENV_SECT_SIZE + default 0x10000 + +endif # CONFIG_ENV_IS_IN_SPI_FLASH From patchwork Tue May 19 19:23:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1293702 X-Patchwork-Delegate: jagannadh.teki@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=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.a=rsa-sha256 header.s=google header.b=F0iF0/ol; 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 49RQrc5xqJz9sPK for ; Wed, 20 May 2020 05:27:44 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E6DAF81E24; Tue, 19 May 2020 21:27:23 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=amarulasolutions.com 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=amarulasolutions.com header.i=@amarulasolutions.com header.b="F0iF0/ol"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 240AC81E3C; Tue, 19 May 2020 21:24:57 +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.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0: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 3EAFD81DFE for ; Tue, 19 May 2020 21:24:54 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jagan@amarulasolutions.com Received: by mail-pf1-x441.google.com with SMTP id x13so348417pfn.11 for ; Tue, 19 May 2020 12:24:54 -0700 (PDT) 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:content-transfer-encoding; bh=wI652VJdyWuIcU29W3eIGaODun8gpyBhHddUGFzIduA=; b=F0iF0/olgVoJ+WpfQSQ0cOFOA/Exg7l1qaD9vW1Di/9zssEO0WIi+w+oGTRbKTT4jo iesQxJtQ4T7YFaASsCmc7ZyGYzSerIOK8Uwd6cfDUwjHJ1oXFZEbMVp5QGx78DrK5x/Z 4o78wskZxrkuldxKMpZf+Eq3He72EiJVHJ95o= 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=wI652VJdyWuIcU29W3eIGaODun8gpyBhHddUGFzIduA=; b=mNMeGVrbn/moX6BmSfXmKIK36qrtyE9DHxWR/DIaYiAh+5qOrYaXd2BD3WMDScmTVX MslPTVdxMsWARO7pUr07TwQYBCLUt1aZ3q7u7ywrLdUhDj9PpCe8nFP+pU+vsEox+zkl WobHxWbK3WD7ExE0P0YMqjr9ZLHyMV1kEgixiHw1pFMnXkXRCFU+l7r4sKKWn8GmMKbw Tu8dNMX/m1rZ34PTUfu57bTclMFhkiieZBnMNmM8VJ10qxIlCntQSDUqt33GSbIX36XA bGUWIRMxU22wTO7xP165L4ebleipugo2VpB+ycrxPk+UTOvjV54t7PlDQyK70tGSImjT XB6g== X-Gm-Message-State: AOAM530m5fE1CJL35OtfOuvfH3XkLxZ3u/LsBOB1wmmyLPWAw6oPcP2C i/SNxgxAnwFDvcDTRIPiDtcfKw== X-Google-Smtp-Source: ABdhPJyrLlZyVYfU3bioc6VYfUD1hZDYDeJjLPogktJ3uFLZMMrHTEErWU2OW0HEvTlS/VcAvOLfKQ== X-Received: by 2002:aa7:93d2:: with SMTP id y18mr572727pff.181.1589916292630; Tue, 19 May 2020 12:24:52 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c809:c7d5:713c:4a0a:47eb:ffcd]) by smtp.gmail.com with ESMTPSA id w192sm222553pff.126.2020.05.19.12.24.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 12:24:51 -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 Subject: [PATCH v2 7/9] sifive: fu540: Mark the default env as SPI flash Date: Wed, 20 May 2020 00:53:38 +0530 Message-Id: <20200519192340.16624-8-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200519192340.16624-1-jagan@amarulasolutions.com> References: <20200519192340.16624-1-jagan@amarulasolutions.com> MIME-Version: 1.0 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.2 at phobos.denx.de X-Virus-Status: Clean Mark the default U-Boot environment as SPI flash since this is an on board flash device. Reviewed-by: Bin Meng Signed-off-by: Jagan Teki --- Changes for v2: - none board/sifive/fu540/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/board/sifive/fu540/Kconfig b/board/sifive/fu540/Kconfig index 86193d7668..e1ba629e37 100644 --- a/board/sifive/fu540/Kconfig +++ b/board/sifive/fu540/Kconfig @@ -27,6 +27,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy def_bool y select SIFIVE_FU540 select SUPPORT_SPL + select ENV_IS_IN_SPI_FLASH select RAM select SPL_RAM if SPL imply CMD_DHCP From patchwork Tue May 19 19:23:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1293701 X-Patchwork-Delegate: jagannadh.teki@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=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.a=rsa-sha256 header.s=google header.b=TSmkE5US; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 49RQrP1Ck3z9sPK for ; Wed, 20 May 2020 05:27:33 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3E698810DB; Tue, 19 May 2020 21:27:22 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=amarulasolutions.com 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=amarulasolutions.com header.i=@amarulasolutions.com header.b="TSmkE5US"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A2BA981E4B; Tue, 19 May 2020 21:25:02 +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.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) (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 1815581E3F for ; Tue, 19 May 2020 21:24:58 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jagan@amarulasolutions.com Received: by mail-pj1-x1042.google.com with SMTP id l73so1492778pjb.1 for ; Tue, 19 May 2020 12:24:58 -0700 (PDT) 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:content-transfer-encoding; bh=E3cVPagWu9WBt6nhTDhaTTsD8dnBMhEElnF1hpAyA5Q=; b=TSmkE5USLxye1qUbtcZlIo6CjtcTBsSvcyfWaX/f28/UR5YN/jKO58IzpHZRItZTtd AqoowV6E54Dq2xNu5NZurCisN3h642QFnkqaKCbrr/iHrkcEs160ur4CM7IViP/+swjr LuINS2FsuwKuNOEYkuHVVbnElAsrsJuvI172A= 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=E3cVPagWu9WBt6nhTDhaTTsD8dnBMhEElnF1hpAyA5Q=; b=lC1JgBLaoCZXDvR0zIMq9u+z+caURLgeZnZNWSxFGmovk/nuOdilOrMGBzpPPvYYbr c0bQ7d+UquwWihJi+qoZMAa1aveUaaciZkl3ymZrBgJiqNk2n9JicS9NfQBoWsTHNZxF BNH72dvM3y4fbqjDxurMYI1zdMTULJ1VyEbgKFs60U9ZR/OBQCswPvijpQmLeVCUkcqu gNctau+jc70Oh+IZlZXBFK8QjShBCzwCUPwc3UsMrR1qE6+c2ZkWwbS8hGNUiM4KtunE p6815yMXCF+6ypD5f5MAokCCbNn9Sperhj3mchkjRKwlN/qY9q9/l8Kfzq14iz9iBJjz 2REg== X-Gm-Message-State: AOAM533q1TrX42lDCGw1GDvseUqoRdXE+dPEKXeuOmljXkKFOMHLGhYW jbxnm/qbVHxwISIU1tY3v2JIyg== X-Google-Smtp-Source: ABdhPJwmNZfcMaf8YQ9SmCGkue8O3ErKMuNOQrgk+dRXxRXT45SoBMqappv8jPuhzjvMNlL5Bix4Lw== X-Received: by 2002:a17:902:7281:: with SMTP id d1mr1056659pll.78.1589916296553; Tue, 19 May 2020 12:24:56 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c809:c7d5:713c:4a0a:47eb:ffcd]) by smtp.gmail.com with ESMTPSA id w192sm222553pff.126.2020.05.19.12.24.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 12:24:55 -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 Subject: [PATCH v2 8/9] sifive: fu540: Add boot flash script offset, size Date: Wed, 20 May 2020 00:53:39 +0530 Message-Id: <20200519192340.16624-9-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200519192340.16624-1-jagan@amarulasolutions.com> References: <20200519192340.16624-1-jagan@amarulasolutions.com> MIME-Version: 1.0 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.2 at phobos.denx.de X-Virus-Status: Clean HiFive-Unleashed-A00 has SPI flash with 32MiB size. So, let's use the script offset at the end of 4K. This way it cannot overlap any offsets being used by software components in flash layout. So, SF distrocmd will pick the script at desired script address and run. Signed-off-by: Jagan Teki --- Changes for v2: - none include/configs/sifive-fu540.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/configs/sifive-fu540.h b/include/configs/sifive-fu540.h index 72c841eb9b..68fda14d76 100644 --- a/include/configs/sifive-fu540.h +++ b/include/configs/sifive-fu540.h @@ -62,6 +62,8 @@ "kernel_addr_r=0x84000000\0" \ "fdt_addr_r=0x88000000\0" \ "scriptaddr=0x88100000\0" \ + "script_offset_f=0x1fff000\0" \ + "script_size_f=0x1000\0" \ "pxefile_addr_r=0x88200000\0" \ "ramdisk_addr_r=0x88300000\0" \ "type_guid_gpt_loader1=" TYPE_GUID_LOADER1 "\0" \ From patchwork Tue May 19 19:23:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1293703 X-Patchwork-Delegate: jagannadh.teki@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=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.a=rsa-sha256 header.s=google header.b=rkvUNwhl; 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 49RQrr0qM8z9sPK for ; Wed, 20 May 2020 05:27:56 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 22166813A6; Tue, 19 May 2020 21:27:26 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=amarulasolutions.com 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=amarulasolutions.com header.i=@amarulasolutions.com header.b="rkvUNwhl"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2F46981E3F; Tue, 19 May 2020 21:25:08 +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.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) (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 4A9EF81E49 for ; Tue, 19 May 2020 21:25:02 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jagan@amarulasolutions.com Received: by mail-pj1-x1042.google.com with SMTP id n15so109857pjt.4 for ; Tue, 19 May 2020 12:25:01 -0700 (PDT) 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:content-transfer-encoding; bh=yNd1yFhWYcDllJiJJ9+yuaO19BfAZRDmvARM5Sau0n4=; b=rkvUNwhlkU0T8d2aB3wdzrjX1YVV83zNCh0zDadPSt6bwv/YRtFBMPziCYLDGLVktT 3zoF9xgT78uuDLD8CcZCBvDuPrlofDqTLe1Cv8VoA+z3IpQzzaO2Ok91j/rZa14ZYTSv l3TQtjrFIg5MqzHClrMAtmye06sfwcnMfzPn4= 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=yNd1yFhWYcDllJiJJ9+yuaO19BfAZRDmvARM5Sau0n4=; b=db0Dfp+mgMXK2/A6Oh1eetXwIId4oWbAmHHNBfcc3UpBedt+eeVvu1EV1KIKopYon1 3E3zNQtVa/aYuB4FVkjzPq06HbVRY2inXcWDZ0+RfuExWlR4Eos7Ldg1MAOnODoJ/L75 73UZoDJ21EYLbYugr1wnXObZq7qGc/HKcM3w8qqvJ0uvKF5mIG12LFE6kda/c3Oz1wf/ Ucp1Oeldj0cFmxnZLokKlPca1qr7r3BMJtG9I/INT4l5klBLFf9TSc64Ws7W9cDD/aUU jZJueItQSI4LKGTJ2qq8I8eYHC3YCNInAS2CmbhfBOMQQKlbRGqsnVXKg88/8JXH2T6F xcHg== X-Gm-Message-State: AOAM530dftvzXwoXbbUzNM5TgMloY/ODrp2DatwqgjaYhDFUyS2ZaqZN M/ItFXQbfAxcGG0P3IK7M0gHJA== X-Google-Smtp-Source: ABdhPJy8B76Gbi+UWYGhyjbXVw9s/yFF8Y6Kz9Y4nURJ330Tce326tjyKp55pMKCjyWixaTsaj2J6A== X-Received: by 2002:a17:90a:648c:: with SMTP id h12mr1113560pjj.229.1589916300538; Tue, 19 May 2020 12:25:00 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c809:c7d5:713c:4a0a:47eb:ffcd]) by smtp.gmail.com with ESMTPSA id w192sm222553pff.126.2020.05.19.12.24.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 12:24:59 -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 Subject: [PATCH v2 9/9] sifive: fu540: Enable SF distro bootcmd Date: Wed, 20 May 2020 00:53:40 +0530 Message-Id: <20200519192340.16624-10-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200519192340.16624-1-jagan@amarulasolutions.com> References: <20200519192340.16624-1-jagan@amarulasolutions.com> MIME-Version: 1.0 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.2 at phobos.denx.de X-Virus-Status: Clean Enable SPI flash(SF) distro boot command in Sifive FU540. This distro boot will read the boot script at specific location at the flash and start sourcing the same. Included the SF device at the last of the target devices list since all the rest of the devices on the list have more possibility to boot the distribution due to the size of the SPI flash is concern. Signed-off-by: Jagan Teki --- Changes for v2: - none include/configs/sifive-fu540.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/configs/sifive-fu540.h b/include/configs/sifive-fu540.h index 68fda14d76..f21411a701 100644 --- a/include/configs/sifive-fu540.h +++ b/include/configs/sifive-fu540.h @@ -43,9 +43,11 @@ #ifndef CONFIG_SPL_BUILD #define BOOT_TARGET_DEVICES(func) \ func(MMC, mmc, 0) \ + func(SF, sf, 0) \ func(DHCP, dhcp, na) #include +#include #define TYPE_GUID_LOADER1 "5B193300-FC78-40CD-8002-E86C45580B47" #define TYPE_GUID_LOADER2 "2E54B353-1271-4842-806F-E436D6AF6985" @@ -70,7 +72,8 @@ "type_guid_gpt_loader2=" TYPE_GUID_LOADER2 "\0" \ "type_guid_gpt_system=" TYPE_GUID_SYSTEM "\0" \ "partitions=" PARTS_DEFAULT "\0" \ - BOOTENV + BOOTENV \ + BOOTENV_SF #define CONFIG_PREBOOT \ "setenv fdt_addr ${fdtcontroladdr};" \