From patchwork Tue Apr 2 08:49:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1918694 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=F9s9Oiza; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V81lk1Zr0z1yYw for ; Tue, 2 Apr 2024 19:49:38 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9B7218808A; Tue, 2 Apr 2024 10:49:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.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=canonical.com header.i=@canonical.com header.b="F9s9Oiza"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A202188339; Tue, 2 Apr 2024 10:49:24 +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.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C4BE687E30 for ; Tue, 2 Apr 2024 10:49:22 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=heinrich.schuchardt@canonical.com Received: from mail-lj1-f198.google.com (mail-lj1-f198.google.com [209.85.208.198]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id E114142494 for ; Tue, 2 Apr 2024 08:49:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1712047760; bh=jGfCyigdV5qIBn7xiTOC6sWrrihMectfEY6o36E85X4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=F9s9OizaN9TdslFjPNFzrZdUAw9LS08O/FukcfTWkVZR6rfwPtlJh6uN20Djj+HFP ONO3ovyV/gq7i3OqMeG8S94Lgh4QNeeT+Eh9k8DPEm6VLI0OIQYtEMtQKOCgEHkVX7 dNh7e63r6/fh4NV6E8KAHXOJPykMTOhbrLAbToomVT38JC0LVPpX1B/REaPYYSBR0F DHo5if75lZAbYsiqXHNHCaNJxORkKKM2T4m1xIIMB5d0sp/ohQp25v0ugTXKsZyNyH kGIGVdSFmlpqfbowzgm8OGqcmlJoTLSHT22Odo519dsxaCoOyAooqC/wJayY1NXu05 pywU85tfQH24A== Received: by mail-lj1-f198.google.com with SMTP id 38308e7fff4ca-2d81eef59e8so11447461fa.3 for ; Tue, 02 Apr 2024 01:49:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712047760; x=1712652560; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jGfCyigdV5qIBn7xiTOC6sWrrihMectfEY6o36E85X4=; b=CIP0zkkBL5tq3V7QnmdhQltWB37sM8XHlE5hqQQVfmsTzTEwAHbcoxju5zeJo3d/C8 W9gIOMHErw9m0ySj2sv8n74Z4zcxcn4XYtMF8tZY+xTDwdsmu1GPomps+HYbNRMBnxb7 B9+SjD0fIMJbNXMqr5Dq6dK78jADYAUKIa05idcFvT6uYsd/6440VvrggpB6M26A5p9/ vjUtq2oFPDLljgw9RNrHqRhuVCeSQNUDswlI84TkAeafjn1YW5WQYRMyANv2NF953a3S gT3fYEz3IoOLl1bXbkMtHPITp+4QHYaLjxW1Fi2o/lMU6MaKSc8XxRL/nnzYxVe3FoDs 21cg== X-Forwarded-Encrypted: i=1; AJvYcCXDXpFLVAl/dRdRZSnVNZT2qV3Bn8HrRpklyUpTKQwNSBFW/oNbiHevZuOkSgrnpB/MO9qg+vWaZBUBW5R2fWk8m32zVw== X-Gm-Message-State: AOJu0YylmZRCra0uyVyf8GWe4XSxfQxKxbjCvF1ffUZPXnSZpbeW7oGG pxDlY9lqhhNrSQYZ4j9wazTdT2mAP9yiMBCnsH76GmT75cGuiedFOa2D9RzF5kKs+DEnL+1fF8r zLByyzYklW4itQhZVm2z5cpksNwRkAOJwazWenkm26IPy8PAOmO1GvVOlBBE88X5F3jE= X-Received: by 2002:a05:651c:208:b0:2d8:12a4:8c5b with SMTP id y8-20020a05651c020800b002d812a48c5bmr3684105ljn.16.1712047760251; Tue, 02 Apr 2024 01:49:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHUWuQ4x4Ao2En4w8SOgAziPnyXjEVMzSZGZ+PSFKj4spM9TYwSPVLa5mxMZmOFav7ssSNdUg== X-Received: by 2002:a05:651c:208:b0:2d8:12a4:8c5b with SMTP id y8-20020a05651c020800b002d812a48c5bmr3684088ljn.16.1712047759885; Tue, 02 Apr 2024 01:49:19 -0700 (PDT) Received: from workstation5.fritz.box (ip-062-143-245-032.um16.pools.vodafone-ip.de. [62.143.245.32]) by smtp.gmail.com with ESMTPSA id n18-20020a05600c4f9200b004148c3685ffsm17409318wmq.3.2024.04.02.01.49.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 01:49:19 -0700 (PDT) From: Heinrich Schuchardt To: Minda Chen , Hal Feng , Rick Chen , Leo Cc: Aurelien Jarno , Lukasz Tekieli , Shiji Yang , Shengyu Qu , Seung-Woo Kim , E Shattow , u-boot@lists.denx.de, Heinrich Schuchardt Subject: [PATCH v3 1/6] riscv: do not set default fdt for VisionFive 2 Date: Tue, 2 Apr 2024 10:49:07 +0200 Message-ID: <20240402084912.43228-2-heinrich.schuchardt@canonical.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240402084912.43228-1-heinrich.schuchardt@canonical.com> References: <20240402084912.43228-1-heinrich.schuchardt@canonical.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean Currently in set_fdtfile() we set the value of environment variable fdtfile unconditionally. The implies that a value in the environment will be ignored. With the patch environment variable fdtfile will only be set if it does not yet exist. This requires that CONFIG_DEFAULT_FDT_FILE is not set. Now the user can either set and save fdtfile interactively or in the U-Boot configuration to overrule the device-tree name chosen based on the hardware in set_fdtfile(). Reported-by: E Shattow Signed-off-by: Heinrich Schuchardt Reviewed-by: Leo Yu-Chi Liang --- v3: Rephrase last added sentence in doc/board/starfive/visionfive2.rst v2: new patch --- .../visionfive2/starfive_visionfive2.c | 4 ++++ configs/starfive_visionfive2_defconfig | 1 - doc/board/starfive/visionfive2.rst | 18 ++++++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/board/starfive/visionfive2/starfive_visionfive2.c b/board/starfive/visionfive2/starfive_visionfive2.c index 78e118d5a05..76439179fa7 100644 --- a/board/starfive/visionfive2/starfive_visionfive2.c +++ b/board/starfive/visionfive2/starfive_visionfive2.c @@ -49,6 +49,10 @@ static void set_fdtfile(void) u8 version; const char *fdtfile; + fdtfile = env_get("fdtfile"); + if (fdtfile) + return; + version = get_pcb_revision_from_eeprom(); switch (version) { case 'a': diff --git a/configs/starfive_visionfive2_defconfig b/configs/starfive_visionfive2_defconfig index 7a3f1d4dbdf..fa80d489f5e 100644 --- a/configs/starfive_visionfive2_defconfig +++ b/configs/starfive_visionfive2_defconfig @@ -40,7 +40,6 @@ CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="console=ttyS0,115200 debug rootwait earlycon=sbi" CONFIG_USE_PREBOOT=y CONFIG_PREBOOT="nvme scan; usb start; setenv fdt_addr ${fdtcontroladdr}; fdt addr ${fdtcontroladdr};" -CONFIG_DEFAULT_FDT_FILE="starfive/jh7110-starfive-visionfive-2.dtb" CONFIG_SYS_CBSIZE=256 CONFIG_SYS_PBSIZE=276 CONFIG_DISPLAY_CPUINFO=y diff --git a/doc/board/starfive/visionfive2.rst b/doc/board/starfive/visionfive2.rst index abda8ac21bc..2c68df3ce4d 100644 --- a/doc/board/starfive/visionfive2.rst +++ b/doc/board/starfive/visionfive2.rst @@ -71,6 +71,24 @@ Now build the U-Boot SPL and U-Boot proper This will generate the U-Boot SPL image (spl/u-boot-spl.bin.normal.out) as well as the FIT image (u-boot.itb) with OpenSBI and U-Boot. +Device-tree selection +~~~~~~~~~~~~~~~~~~~~~ + +Depending on the board version U-Boot set variable $fdtfile to either +starfive/jh7110-starfive-visionfive-2-v1.2a.dtb or +starfive/jh7110-starfive-visionfive-2-v1.3b.dtb. + +To overrule this selection the variable can be set manually and saved in the +environment + +:: + + setenv fdtfile my_device-tree.dtb + env save + +or the configuration variable CONFIG_DEFAULT_FDT_FILE can be used to provide +a default value. + Flashing ~~~~~~~~ From patchwork Tue Apr 2 08:49:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1918695 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=UPKYdFAp; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V81ly0MGbz1yYw for ; Tue, 2 Apr 2024 19:49:50 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2B95C8835C; Tue, 2 Apr 2024 10:49:27 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.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=canonical.com header.i=@canonical.com header.b="UPKYdFAp"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BCB12880E5; Tue, 2 Apr 2024 10:49:25 +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.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B83BB880E5 for ; Tue, 2 Apr 2024 10:49:23 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=heinrich.schuchardt@canonical.com Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id F3050424A1 for ; Tue, 2 Apr 2024 08:49:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1712047762; bh=IKfhwraG6bAHt2xyiFOlL12GxzRez/OCUjpTwVzKueM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UPKYdFAp3joPB+tJSNlq4cZKVh8XslX8hY4gcDARV3c9ozFlH1GtSir47V/JQVB2V GLNHXfjMVeu+6AdAPrNkGqbDL1ZfVZsehVVXXM4ziP+//HMD6b0i3LKn0G8OxK4ngl IeChp1YTWWX6OmE5kHGPmgYsDQddTG5iP8/a6iRN8h5XMK6zuZfYxJQ+o+aN0cBWD5 GsB7tH93jA88y7ndY0uzKI8RwdSJdFTne4qul/A9naY3zPQ5Y0mXm7B2NEg7gHlykM fFr3E0d2mGcGeIL3cnU5FOj9Sgc7LJmIEcgITNB+Kptt/f5gLCTtXLM1aPv5+0mrlb bVqBYSmCbGm0Q== Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-41545bc8962so17770735e9.2 for ; Tue, 02 Apr 2024 01:49:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712047761; x=1712652561; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IKfhwraG6bAHt2xyiFOlL12GxzRez/OCUjpTwVzKueM=; b=DrUuhg0Ine4N/TvKztyJXAulAiIzGTLQkYkAMaqZng5jLa687NWV9SNh16/4fjMm01 PaO8pKd4sspo2vbu3wUDk+GEZ6S7K1YEQt9ekx9J2RQlj8km8VlRI/7P/Al7Rw/0XvyO KVO3qLK2G8FSdVyjbPWwdllEfvGtIOC3Ikt5AJW73CwtB3+w7w0PzGfF7xHFXMHIydTn aYrnMpSepbmMEtbU9eAy6hIu1f8wMyQopPfGlDjLGZU5LVnD4XnANdVn17YhEcUVMynq ES1eeO+afkngsZjvEWvrOrfIkUYxDplDt71IgkHo3JulL91JewT6fghaAeBlks4qUWgb ylkw== X-Forwarded-Encrypted: i=1; AJvYcCXkFovradDe7MCNGJDleHF/X3bre1CGz1xmNuB779e2lBLb9CkuNoTtPy5LKtC0RAcjgZnHPd1y2OgnXiD7TwdISMA5Cw== X-Gm-Message-State: AOJu0YyoLOQyBb0oCDtL7XJqamvrkDW4tFWfwllLNGyT1+EUML4zYDEb r6Jt9sGlduSCjOfDVgKFMb3hrMGfYXfQHwIN7SbyPhGX41pb+vdHA03F/Sn0uaFKJubglO7pi3G Q8/dDiLNrOVH4fMyYj/F4ii64L0xO0GIr7tAQNe2/Ho1PPeaPewCQ3fGqGWtVrwTMw24= X-Received: by 2002:a05:600c:4f13:b0:415:6cf0:b25b with SMTP id l19-20020a05600c4f1300b004156cf0b25bmr1934849wmq.6.1712047761177; Tue, 02 Apr 2024 01:49:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG9d2CSoTZPogI3iDIioLu/iu+VmdzfxAteuT/wCYjv0kCVUjb6DOwR2Ys0BqPPTGwansTHjw== X-Received: by 2002:a05:600c:4f13:b0:415:6cf0:b25b with SMTP id l19-20020a05600c4f1300b004156cf0b25bmr1934834wmq.6.1712047760767; Tue, 02 Apr 2024 01:49:20 -0700 (PDT) Received: from workstation5.fritz.box (ip-062-143-245-032.um16.pools.vodafone-ip.de. [62.143.245.32]) by smtp.gmail.com with ESMTPSA id n18-20020a05600c4f9200b004148c3685ffsm17409318wmq.3.2024.04.02.01.49.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 01:49:20 -0700 (PDT) From: Heinrich Schuchardt To: Minda Chen , Hal Feng , Rick Chen , Leo Cc: Aurelien Jarno , Lukasz Tekieli , Shiji Yang , Shengyu Qu , Seung-Woo Kim , E Shattow , u-boot@lists.denx.de, Heinrich Schuchardt Subject: [PATCH v3 2/6] eeprom: starfive: function get_product_id_from_eeprom() Date: Tue, 2 Apr 2024 10:49:08 +0200 Message-ID: <20240402084912.43228-3-heinrich.schuchardt@canonical.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240402084912.43228-1-heinrich.schuchardt@canonical.com> References: <20240402084912.43228-1-heinrich.schuchardt@canonical.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean Export a function get_product_id_from_eeprom() to read the product ID. This value can be used for fixing up the device-tree on JH7110 based products. Signed-off-by: Heinrich Schuchardt Reviewed-by: Leo Yu-Chi Liang --- v3: no change v2: no change --- arch/riscv/include/asm/arch-jh7110/eeprom.h | 9 +++++++++ board/starfive/visionfive2/visionfive2-i2c-eeprom.c | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/arch/riscv/include/asm/arch-jh7110/eeprom.h b/arch/riscv/include/asm/arch-jh7110/eeprom.h index d2776d5b6cb..62d184aeb57 100644 --- a/arch/riscv/include/asm/arch-jh7110/eeprom.h +++ b/arch/riscv/include/asm/arch-jh7110/eeprom.h @@ -12,4 +12,13 @@ u8 get_pcb_revision_from_eeprom(void); u32 get_ddr_size_from_eeprom(void); +/** + * get_product_id_from_eeprom - get product ID string + * + * A string like "VF7110A1-2228-D008E000-00000001" is returned. + * + * Return: product ID string + */ +const char *get_product_id_from_eeprom(void); + #endif /* _ASM_RISCV_EEPROM_H */ diff --git a/board/starfive/visionfive2/visionfive2-i2c-eeprom.c b/board/starfive/visionfive2/visionfive2-i2c-eeprom.c index c36de1a5125..a9f4376c8e1 100644 --- a/board/starfive/visionfive2/visionfive2-i2c-eeprom.c +++ b/board/starfive/visionfive2/visionfive2-i2c-eeprom.c @@ -405,6 +405,14 @@ static void set_product_id(char *string) update_crc(); } +const char *get_product_id_from_eeprom(void) +{ + if (read_eeprom()) + return NULL; + + return pbuf.eeprom.atom1.data.pstr; +} + int do_mac(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { char *cmd; From patchwork Tue Apr 2 08:49:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1918696 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=UmdXiClm; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V81mB59tfz1yZ3 for ; Tue, 2 Apr 2024 19:50:02 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9F73888362; Tue, 2 Apr 2024 10:49:30 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.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=canonical.com header.i=@canonical.com header.b="UmdXiClm"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8E7B987E30; Tue, 2 Apr 2024 10:49:29 +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.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 35E4E88352 for ; Tue, 2 Apr 2024 10:49:26 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=heinrich.schuchardt@canonical.com Received: from mail-lj1-f197.google.com (mail-lj1-f197.google.com [209.85.208.197]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 428FA424A9 for ; Tue, 2 Apr 2024 08:49:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1712047763; bh=1CJk8YyTV1W4xY5TIyJqrF7DbOF+Z33g1KK6xyvA9lA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UmdXiClmPMoyefy1uzsxqYfktrvjTtTopq80ThAbTsU24jpxquk23Sh56qbSdRpj3 9YxYo+DWjTGB4h+D08WjlMJJzPGqs7Cdrjovb5AIDlta6H/rVECYAubiuv4taSQfY3 +N6B+vy4zhXIRPRvPFUJpHnGltxj9GR1oeBhAeiHOsFtaC2ovb8psyR++l4Ph+Oltg tUDNx4bLwBNfFc1DOzCP3w1d8NL7VkuERtQaiBcXmYD0OVnATqt/a1OYj3/aHnaK4f MQpeeRh+NxSBj1bXuRyVgO1DPAlGnNlRJvwJHcAhLam7wOVUaLdcucpHCRYUZ0a9ht 2v9x1h1yQZI0g== Received: by mail-lj1-f197.google.com with SMTP id 38308e7fff4ca-2d6f7def478so41756941fa.2 for ; Tue, 02 Apr 2024 01:49:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712047762; x=1712652562; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1CJk8YyTV1W4xY5TIyJqrF7DbOF+Z33g1KK6xyvA9lA=; b=u0PonWVdd/vXNyCOpyqrS4LcdF5dlBMl5PSaWir88UtBK7O4tTj9XA4A2f8Zt3Z6Jx QYXTs0tANiH6ozguwoo8ZrFzOF8TQjXP3BtSEr7+3u9fdC2C0Z+LSQT/y1iX0lyrp2ZJ wvvwNHyD4kiOr4oAQ1DG3TeUIG/8/YA3XmoPlmb5o3hisYpFtM1cAZD0oFpqpruy70Mi fzOpGdYMJ0Jymth92ZpyQumNUz8NVR/YPU3Hx/GKPiroW8Ux+DATcqA/cwOhwLl13O4l LRZcvk+SrpExiGJ42kvigs9sjHEzsHIkzH14gH6SjdFMAp3LFv7lCWrm37KkoyAORkSW r90A== X-Forwarded-Encrypted: i=1; AJvYcCUZAvdoKJi24+uZ/rr/cDd2F3pVs5rENbbpuEPDH9WdbcNYND8rd35vMvaVqbSxYSjs1L539UQNks4zD6JVS6rmgjy3eQ== X-Gm-Message-State: AOJu0YxzOGRnfWGPliDb6/a6b6bTrtEMKjvxhifimGSO+if3Djpd5458 69ZI2ntOy0rRVOTEADMQjJeQe17cDjSmhMQdkcUhpvurT6QVqjE+d6JGg56AvqtsXFR6SxiXcnP ZSgV/zi0f9FFqeHPliF8iYqsJ3drH2O4kWvPlzP4jFYM6VRsRIo+yO4PKbs7pIYhhDzE= X-Received: by 2002:a2e:6a17:0:b0:2d4:269e:59df with SMTP id f23-20020a2e6a17000000b002d4269e59dfmr8000468ljc.52.1712047761992; Tue, 02 Apr 2024 01:49:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEvFXNM1m0YP9gFM5x9TS6ewTcb3Glj07ZtKQjNgarxH59ylVsoWLx3MtRlWgFaVR4UxXgObA== X-Received: by 2002:a2e:6a17:0:b0:2d4:269e:59df with SMTP id f23-20020a2e6a17000000b002d4269e59dfmr8000446ljc.52.1712047761676; Tue, 02 Apr 2024 01:49:21 -0700 (PDT) Received: from workstation5.fritz.box (ip-062-143-245-032.um16.pools.vodafone-ip.de. [62.143.245.32]) by smtp.gmail.com with ESMTPSA id n18-20020a05600c4f9200b004148c3685ffsm17409318wmq.3.2024.04.02.01.49.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 01:49:21 -0700 (PDT) From: Heinrich Schuchardt To: Minda Chen , Hal Feng , Rick Chen , Leo Cc: Aurelien Jarno , Lukasz Tekieli , Shiji Yang , Shengyu Qu , Seung-Woo Kim , E Shattow , u-boot@lists.denx.de, Heinrich Schuchardt Subject: [PATCH v3 3/6] riscv: set fdtfile on Milk-V Mars Date: Tue, 2 Apr 2024 10:49:09 +0200 Message-ID: <20240402084912.43228-4-heinrich.schuchardt@canonical.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240402084912.43228-1-heinrich.schuchardt@canonical.com> References: <20240402084912.43228-1-heinrich.schuchardt@canonical.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean Set environment variable fdtfile to the correct value for the Milk-V Mars board. Signed-off-by: Heinrich Schuchardt Reviewed-by: Leo Yu-Chi Liang --- v3: no change v2: rebase patch --- .../visionfive2/starfive_visionfive2.c | 43 +++++++++++++------ 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/board/starfive/visionfive2/starfive_visionfive2.c b/board/starfive/visionfive2/starfive_visionfive2.c index 76439179fa7..5ae8b850280 100644 --- a/board/starfive/visionfive2/starfive_visionfive2.c +++ b/board/starfive/visionfive2/starfive_visionfive2.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -17,6 +18,8 @@ DECLARE_GLOBAL_DATA_PTR; #define JH7110_L2_PREFETCHER_BASE_ADDR 0x2030000 #define JH7110_L2_PREFETCHER_HART_OFFSET 0x2000 +#define FDTFILE_MILK_V_MARS \ + "starfive/jh7110-milkv-mars.dtb" #define FDTFILE_VISIONFIVE2_1_2A \ "starfive/jh7110-starfive-visionfive-2-v1.2a.dtb" #define FDTFILE_VISIONFIVE2_1_3B \ @@ -48,24 +51,38 @@ static void set_fdtfile(void) { u8 version; const char *fdtfile; + const char *product_id; fdtfile = env_get("fdtfile"); if (fdtfile) return; - version = get_pcb_revision_from_eeprom(); - switch (version) { - case 'a': - case 'A': - fdtfile = FDTFILE_VISIONFIVE2_1_2A; - break; - - case 'b': - case 'B': - default: - fdtfile = FDTFILE_VISIONFIVE2_1_3B; - break; - }; + product_id = get_product_id_from_eeprom(); + if (!product_id) { + log_err("Can't read EEPROM\n"); + return; + } + if (!strncmp(product_id, "MARS", 4)) { + fdtfile = FDTFILE_MILK_V_MARS; + } else if (!strncmp(product_id, "VF7110", 6)) { + version = get_pcb_revision_from_eeprom(); + + switch (version) { + case 'a': + case 'A': + fdtfile = FDTFILE_VISIONFIVE2_1_2A; + break; + + case 'b': + case 'B': + default: + fdtfile = FDTFILE_VISIONFIVE2_1_3B; + break; + } + } else { + log_err("Unknown product\n"); + return; + } env_set("fdtfile", fdtfile); } From patchwork Tue Apr 2 08:49:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1918697 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=a0cjROtK; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V81mV527Xz1yYB for ; Tue, 2 Apr 2024 19:50:18 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 753E18836C; Tue, 2 Apr 2024 10:49:31 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.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=canonical.com header.i=@canonical.com header.b="a0cjROtK"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 771A188301; Tue, 2 Apr 2024 10:49:30 +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.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id EBB01880E5 for ; Tue, 2 Apr 2024 10:49:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=heinrich.schuchardt@canonical.com Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 410D0424A7 for ; Tue, 2 Apr 2024 08:49:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1712047763; bh=iCyf9Eh9pZLi/g1WblAo1KAEWUKkwi6fjh3REKCQQUU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=a0cjROtKwNDASNpi9zhD9tWFgs40p5nBENsQIglzDjiOXKbhczkHWhYSh9eV/Qne8 jq2qRsscEKezx0pymGCM+vv/+cHk9rjQeRrkAEDDxHhSa4/BXTWFOL03FVlNt96SiR ebmV0d1ZCA8w1k9knHNMoyXcJqUPH5pGC3yJloWmga/HbdIDjI2JG3IJ+/62fFnJVv NrQDnvo7h6c5giBMhh6oHJmBdH84MUebqRfJg1b6lHlOBJm/SPqHqWBAxjKIHi2+J0 6NfIsOAl9xMVWrbA0ZBFzlNLu2FdXEShr20LSj0T2xfvcAdte2GLbpJuzfO0lW9gKt I0bVgzScGx1mA== Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-41463be093aso23432495e9.3 for ; Tue, 02 Apr 2024 01:49:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712047763; x=1712652563; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iCyf9Eh9pZLi/g1WblAo1KAEWUKkwi6fjh3REKCQQUU=; b=mRrYzuPfkOKnY7rUCecsve6Fve453+5PQFVI9/edviYrx5jVo4mV7z+AkuTVoSZ3tT DyLJMuUF7ldm+OX1XwT2aphO/qwWN7ANk0rdBLEJDkI85FFxnc/uGDlPhRZvzq9gV/zL qn9kvc+1dWt8hPzFUhDl7VgExNGtqMXl2mZ451GzpJppMzQwWFn8EooDOZao6UaMlcbX hdSU+tl23SPBr/IYOS8UHNNtGVLYELZfNZ73O0GXj+E6LuaRAr+8QyM54zbgGTWfV4gh wxLk5DUdXJXnsUT6273QrDgtZPTMzZ9nnPP5RrcYHulg4Dt6vnv2nUc5wBDo5VQI+Bv8 uOdA== X-Forwarded-Encrypted: i=1; AJvYcCX6AvOtgpNhVecl31uAsMLTO1UO1LQIg0MzzU/nwsD9MlOqG3Oy9NXGuLriXLPYupPeK7zGzmkcoioEMASV5tJct5jsOA== X-Gm-Message-State: AOJu0Yzkv0WqnfwkHRUAtKGo0lLRL3bm3hC/H+Baoudu8pzjsYUhmEkf dGH7VJcqC5+2MvVeTdKsrotRaI0cVBV1cbSfKnf/u5toaDyLHugGUuZEYlizDONc1OcNhi4vo+Y Yu8IYKLsNUV1U4w6ltgI1PaM3GDd4A84Y1VlNNI+m+aDdcDFAg6QmgN5LU7FR7nOPIGE= X-Received: by 2002:a05:600c:5246:b0:414:69be:54b0 with SMTP id fc6-20020a05600c524600b0041469be54b0mr7847879wmb.22.1712047762847; Tue, 02 Apr 2024 01:49:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEfcI75MnPxI2Mru5rqFddpjCf5HP4HoojhFiydHKeZxRW4NKswz7LL1WXEhuC2gcdi9BsD7g== X-Received: by 2002:a05:600c:5246:b0:414:69be:54b0 with SMTP id fc6-20020a05600c524600b0041469be54b0mr7847867wmb.22.1712047762568; Tue, 02 Apr 2024 01:49:22 -0700 (PDT) Received: from workstation5.fritz.box (ip-062-143-245-032.um16.pools.vodafone-ip.de. [62.143.245.32]) by smtp.gmail.com with ESMTPSA id n18-20020a05600c4f9200b004148c3685ffsm17409318wmq.3.2024.04.02.01.49.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 01:49:22 -0700 (PDT) From: Heinrich Schuchardt To: Minda Chen , Hal Feng , Rick Chen , Leo Cc: Aurelien Jarno , Lukasz Tekieli , Shiji Yang , Shengyu Qu , Seung-Woo Kim , E Shattow , u-boot@lists.denx.de, Heinrich Schuchardt Subject: [PATCH v3 4/6] board: starfive: support Milk-V Mars board Date: Tue, 2 Apr 2024 10:49:10 +0200 Message-ID: <20240402084912.43228-5-heinrich.schuchardt@canonical.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240402084912.43228-1-heinrich.schuchardt@canonical.com> References: <20240402084912.43228-1-heinrich.schuchardt@canonical.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean The differences between the Milk-V Mars board and the VisionFive 2 board are small enough that we can support both using the same U-Boot build. * The model and compatible property are taken from proposed Linux patches. * The EEPROM is atmel,24c02 according to the vendor U-Boot. * The second Ethernet port is not available. usb@10100000 does not exist in U-Boot yet. So we don't have to reflect differences in usage here. Signed-off-by: Heinrich Schuchardt Reviewed-by: Leo Yu-Chi Liang --- For the mmc card-detect a separate patch has been created: https://lore.kernel.org/u-boot/20240328214615.21501-1-heinrich.schuchardt@canonical.com/ v3: Replace misplaced starfive_verb[i] by milk_v_mars[i]. v2: do not overwrite /soc/i2c@12050000/eeprom@50/compatible --- board/starfive/visionfive2/spl.c | 99 ++++++++++++++++++++++++++++---- 1 file changed, 87 insertions(+), 12 deletions(-) diff --git a/board/starfive/visionfive2/spl.c b/board/starfive/visionfive2/spl.c index 1b49945d11b..e8f97d963a0 100644 --- a/board/starfive/visionfive2/spl.c +++ b/board/starfive/visionfive2/spl.c @@ -27,6 +27,26 @@ struct starfive_vf2_pro { const char *value; }; +static const struct starfive_vf2_pro milk_v_mars[] = { + {"/soc/ethernet@16030000", "starfive,tx-use-rgmii-clk", NULL}, + {"/soc/ethernet@16040000", "starfive,tx-use-rgmii-clk", NULL}, + + {"/soc/ethernet@16030000/mdio/ethernet-phy@0", + "motorcomm,tx-clk-adj-enabled", NULL}, + {"/soc/ethernet@16030000/mdio/ethernet-phy@0", + "motorcomm,tx-clk-100-inverted", NULL}, + {"/soc/ethernet@16030000/mdio/ethernet-phy@0", + "motorcomm,tx-clk-1000-inverted", NULL}, + {"/soc/ethernet@16030000/mdio/ethernet-phy@0", + "motorcomm,rx-clk-drv-microamp", "3970"}, + {"/soc/ethernet@16030000/mdio/ethernet-phy@0", + "motorcomm,rx-data-drv-microamp", "2910"}, + {"/soc/ethernet@16030000/mdio/ethernet-phy@0", + "rx-internal-delay-ps", "1900"}, + {"/soc/ethernet@16030000/mdio/ethernet-phy@0", + "tx-internal-delay-ps", "1500"}, +}; + static const struct starfive_vf2_pro starfive_vera[] = { {"/soc/ethernet@16030000/mdio/ethernet-phy@0", "rx-internal-delay-ps", "1900"}, @@ -67,6 +87,49 @@ static const struct starfive_vf2_pro starfive_verb[] = { "tx-internal-delay-ps", "0"}, }; +void spl_fdt_fixup_mars(void *fdt) +{ + static const char compat[] = "milkv,mars\0starfive,jh7110"; + u32 phandle; + u8 i; + int offset; + int ret; + + fdt_setprop(fdt, fdt_path_offset(fdt, "/"), "compatible", compat, sizeof(compat)); + fdt_setprop_string(fdt, fdt_path_offset(fdt, "/"), "model", + "Milk-V Mars"); + + /* gmac0 */ + offset = fdt_path_offset(fdt, "/soc/clock-controller@17000000"); + phandle = fdt_get_phandle(fdt, offset); + offset = fdt_path_offset(fdt, "/soc/ethernet@16030000"); + + fdt_setprop_u32(fdt, offset, "assigned-clocks", phandle); + fdt_appendprop_u32(fdt, offset, "assigned-clocks", JH7110_AONCLK_GMAC0_TX); + fdt_setprop_u32(fdt, offset, "assigned-clock-parents", phandle); + fdt_appendprop_u32(fdt, offset, "assigned-clock-parents", + JH7110_AONCLK_GMAC0_RMII_RTX); + + /* gmac1 */ + fdt_setprop_string(fdt, fdt_path_offset(fdt, "/soc/ethernet@16040000"), + "status", "disabled"); + + for (i = 0; i < ARRAY_SIZE(milk_v_mars); i++) { + offset = fdt_path_offset(fdt, milk_v_mars[i].path); + + if (milk_v_mars[i].value) + ret = fdt_setprop_u32(fdt, offset, milk_v_mars[i].name, + dectoul(milk_v_mars[i].value, NULL)); + else + ret = fdt_setprop_empty(fdt, offset, milk_v_mars[i].name); + + if (ret) { + pr_err("%s set prop %s fail.\n", __func__, milk_v_mars[i].name); + break; + } + } +} + void spl_fdt_fixup_version_a(void *fdt) { static const char compat[] = "starfive,visionfive-2-v1.2a\0starfive,jh7110"; @@ -167,22 +230,34 @@ void spl_fdt_fixup_version_b(void *fdt) void spl_perform_fixups(struct spl_image_info *spl_image) { u8 version; + const char *product_id; - version = get_pcb_revision_from_eeprom(); - switch (version) { - case 'a': - case 'A': - spl_fdt_fixup_version_a(spl_image->fdt_addr); - break; - - case 'b': - case 'B': - default: - spl_fdt_fixup_version_b(spl_image->fdt_addr); + product_id = get_product_id_from_eeprom(); + if (!product_id) { + pr_err("Can't read EEPROM\n"); + return; + } + if (!strncmp(product_id, "MARS", 4)) { + spl_fdt_fixup_mars(spl_image->fdt_addr); + } else if (!strncmp(product_id, "VF7110", 6)) { + version = get_pcb_revision_from_eeprom(); + switch (version) { + case 'a': + case 'A': + spl_fdt_fixup_version_a(spl_image->fdt_addr); + break; + + case 'b': + case 'B': + default: + spl_fdt_fixup_version_b(spl_image->fdt_addr); break; + }; + } else { + pr_err("Unknown product %s\n", product_id); }; - /* Update the memory size which read form eeprom or DT */ + /* Update the memory size which read from eeprom or DT */ fdt_fixup_memory(spl_image->fdt_addr, 0x40000000, gd->ram_size); } From patchwork Tue Apr 2 08:49:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1918698 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=gBmg9w95; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V81mg6C5hz1yYB for ; Tue, 2 Apr 2024 19:50:27 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 02B2F88352; Tue, 2 Apr 2024 10:49:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.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=canonical.com header.i=@canonical.com header.b="gBmg9w95"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C5C698836F; Tue, 2 Apr 2024 10:49:31 +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.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 58F8288356 for ; Tue, 2 Apr 2024 10:49:26 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=heinrich.schuchardt@canonical.com Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 77586424A1 for ; Tue, 2 Apr 2024 08:49:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1712047764; bh=k7ApjvI1MJPSMrWbfFkQGXfl/Ld2kUn5dAwESlColWg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gBmg9w95Uh3ULW3ij6+xrE6UT58pDwCBajpxiTh8MppsdD0VMBrkrup/+/IyfX972 QpCmVjyKbyoS/oB3Kyw99MwC2HAWmkMkUAquGmyY7Q0G8QJY6EBoQaUdmU4lPgE3/t JWRb/jvoQGGkz4hF7KKaouE67Rcr0Dfo0pGo7GSyX84A2yO6xwhBP2LFrJF2bdcexO XiP8OC4TeJ395S2nKtt8+VUujIPfATDh300OwXFcRH6O3ZieMoGGExSl3TJ6fshGaD gDEqv7aPCclvJmY5lIXC72hrszGrRXozcwvOOEEffDCBZxn6fRkjykZ3DrojtsyoR+ 9p/2zMo06MXrQ== Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-41407fd718dso26964905e9.1 for ; Tue, 02 Apr 2024 01:49:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712047763; x=1712652563; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=k7ApjvI1MJPSMrWbfFkQGXfl/Ld2kUn5dAwESlColWg=; b=N007PRjh/1bLjky1HPCEiShc7wUCQ84oN8VKE5M971nnKOKGHQxWAO9CRlW6WlC9n0 6rWNhKAp0xcOxZCh+8bhd2jSo7hkVMwXxPOqjZ3eMeVZMl+tq1njMj6vhVFedXR0CtRO DsJwYiz+SoszTYfn+j+DbRhBumBYGUVlGrlKu1juumJ2ODrd1isEXE39M7CEDbdL3S+5 Z5EVUplg4Ei4J2JtcNrnNzTjSb1W+s/er5FXmnKmy6AMoqlQL7z1Mc+qQmXpZ/bzXTI6 8X0hCN2vR79GO/+dfRDx2I0NoTpQmJlovWnfmKV8nYdBni05ChFawH3/5vNU49Jv3duQ WpGw== X-Forwarded-Encrypted: i=1; AJvYcCXVYEVW51NQ4YMhF19t9GhzLitebBJfY97ThV9ngg/pb6qv835EO+LDWfSGWZmj8DHdriolOmBT9e2c1y1fsYsQZKh2Aw== X-Gm-Message-State: AOJu0YzpWHo4rc5YK7WrO/K29ZRTx0lt1gdVThlSqlJ+Y1hGua9KQZ6g aW3DqHmoLpIlb1f5vhxSfgwHY07Njt/kcxNLsXqZVD9IXGBtj+UpXQmHLp05vMxE1iJXIdgc17s RZbKTtjZAHAw+Zk7R5w7DTLRZwMrLykzdcmz1ysCI3Ypc0rOm46TVx75Sw/zYYxlEznxqx6EpBc L61Q== X-Received: by 2002:a05:600c:1d18:b0:415:6616:6513 with SMTP id l24-20020a05600c1d1800b0041566166513mr3372713wms.12.1712047763640; Tue, 02 Apr 2024 01:49:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG4tkAcVjo7nUhbL8GUxRjd6+UIg/W7hbw3m+5+y1BnfXsFCZejQqHlY4m6+HH61AJqwlEOzQ== X-Received: by 2002:a05:600c:1d18:b0:415:6616:6513 with SMTP id l24-20020a05600c1d1800b0041566166513mr3372708wms.12.1712047763358; Tue, 02 Apr 2024 01:49:23 -0700 (PDT) Received: from workstation5.fritz.box (ip-062-143-245-032.um16.pools.vodafone-ip.de. [62.143.245.32]) by smtp.gmail.com with ESMTPSA id n18-20020a05600c4f9200b004148c3685ffsm17409318wmq.3.2024.04.02.01.49.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 01:49:23 -0700 (PDT) From: Heinrich Schuchardt To: Minda Chen , Hal Feng , Rick Chen , Leo Cc: Aurelien Jarno , Lukasz Tekieli , Shiji Yang , Shengyu Qu , Seung-Woo Kim , E Shattow , u-boot@lists.denx.de, Heinrich Schuchardt Subject: [PATCH v3 5/6] riscv: starfive: avoid including common.h Date: Tue, 2 Apr 2024 10:49:11 +0200 Message-ID: <20240402084912.43228-6-heinrich.schuchardt@canonical.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240402084912.43228-1-heinrich.schuchardt@canonical.com> References: <20240402084912.43228-1-heinrich.schuchardt@canonical.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean The usage of common.h is deprecated. Remove it from board files. Signed-off-by: Heinrich Schuchardt Reviewed-by: Leo Yu-Chi Liang --- v3: no change v2: no change --- board/starfive/visionfive2/spl.c | 1 - board/starfive/visionfive2/starfive_visionfive2.c | 1 - board/starfive/visionfive2/visionfive2-i2c-eeprom.c | 1 - 3 files changed, 3 deletions(-) diff --git a/board/starfive/visionfive2/spl.c b/board/starfive/visionfive2/spl.c index e8f97d963a0..45848db6d8b 100644 --- a/board/starfive/visionfive2/spl.c +++ b/board/starfive/visionfive2/spl.c @@ -4,7 +4,6 @@ * Author: Yanhong Wang */ -#include #include #include #include diff --git a/board/starfive/visionfive2/starfive_visionfive2.c b/board/starfive/visionfive2/starfive_visionfive2.c index 5ae8b850280..a86bca533b2 100644 --- a/board/starfive/visionfive2/starfive_visionfive2.c +++ b/board/starfive/visionfive2/starfive_visionfive2.c @@ -4,7 +4,6 @@ * Author: Yanhong Wang */ -#include #include #include #include diff --git a/board/starfive/visionfive2/visionfive2-i2c-eeprom.c b/board/starfive/visionfive2/visionfive2-i2c-eeprom.c index a9f4376c8e1..ddef7d61235 100644 --- a/board/starfive/visionfive2/visionfive2-i2c-eeprom.c +++ b/board/starfive/visionfive2/visionfive2-i2c-eeprom.c @@ -4,7 +4,6 @@ * Author: Yanhong Wang */ -#include #include #include #include From patchwork Tue Apr 2 08:49:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1918699 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=Wbd1UG49; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V81mt2rctz1yYB for ; Tue, 2 Apr 2024 19:50:38 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7E27B8835B; Tue, 2 Apr 2024 10:49:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.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=canonical.com header.i=@canonical.com header.b="Wbd1UG49"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CD90B8835F; Tue, 2 Apr 2024 10:49:31 +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.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 67D9188359 for ; Tue, 2 Apr 2024 10:49:26 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=heinrich.schuchardt@canonical.com Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 9F232424B3 for ; Tue, 2 Apr 2024 08:49:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1712047765; bh=HrXjwxnkIuJ1JE5y6HHTOs6yfsQp0sPwbrcXk+zykF0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Wbd1UG49bLoD9AKSnKUJXe8eSWXXZ9UBWTumfr6kfeT8uF9gRzEJbE+xFbMezWYmX Kq9StvQ6VF49ddG+L1ZKTT9pO9ZeDjd9uJN1OmHvvJ1rGBNfGwMT1pddu9N724hcbp EoKttb59UlqZV0UYgEOIN/8+JOpA8dHIpuiSTH665rImNVNfSvWO9QPtUoQWqj/6cc o6w12imZLNfSp0KJ4RQ6lgHm2xbRL6b+IFwOMaGDbO3KTHQ3YhIbiAVwimLXCxl9sp 49E/+JmCXGU5kLvCxYe+g2jhZegfDX96AEYT8HQJReXi86PMmLBV94oBb0pFEn9jfT zIeeqLj1TsPtw== Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-41489c04f8cso25203015e9.3 for ; Tue, 02 Apr 2024 01:49:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712047764; x=1712652564; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HrXjwxnkIuJ1JE5y6HHTOs6yfsQp0sPwbrcXk+zykF0=; b=aWe8G5TQJcqQj6UcbcGCFSJiIAs8QBTzQKHgqG3GKUEbSHt8LGmdtISQcbAgvtidFP +0CFLhsuqDQN53CO6qce7H5Y8fMR1oawg+moOu2O6hqWtuuN5AIIr0WvmqsB7X+xmBkJ CPcGsP9uhdpuOLOQ6lXqPnFOtu55llkDzekhBFiOH0WqH2+zVCvOizMy3Vw1g19l4d4c QjSd3X7Kta+o+vtqN1MkTa5IurAydEIlzdQ4eubbLtRD3SULWUE4rDZ3ukL+i5oUvs5G AgjlnDTBogkNlyP+glZXdFpfu1HJM0Vq5VkCTC5LghOfaknB7FlMRdVVKHNL69rPLU+P KxZA== X-Forwarded-Encrypted: i=1; AJvYcCUFXdy/6iXEIjiir6ZCwKK8s59o8c5QbBUJjbKhVA9zhxbzM2gDK0jyYju23wmzaGHoI7Ov7U083agRRvAFfz84QsdmNg== X-Gm-Message-State: AOJu0Yzs3tQ3qSoYa92mdDOfUCTBEq5v9Rx9hWICiEir9Y0/88mAuktf u2QKUWjW/lp6xapw/d+xbGUAKmGSyr6GWNqFoKgJ+YV5hyWGF2mANmMLC8WM1j3Ss3gbZTm5NnX BREN3zts0NB/n7J+QTTGILS0sthup0cFVRMpi9hgjDu3hgBbsH9FNjs/kqBageJWHU9A= X-Received: by 2002:a05:600c:4710:b0:414:63da:a2a2 with SMTP id v16-20020a05600c471000b0041463daa2a2mr9538087wmo.29.1712047764526; Tue, 02 Apr 2024 01:49:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGoPc1L7zOztxrnJVIOTfXKs1wEobSS+wSzV5Pgez3ZhiWaegIhmnncZGX7QYuZF0uqTy6BhQ== X-Received: by 2002:a05:600c:4710:b0:414:63da:a2a2 with SMTP id v16-20020a05600c471000b0041463daa2a2mr9538071wmo.29.1712047764218; Tue, 02 Apr 2024 01:49:24 -0700 (PDT) Received: from workstation5.fritz.box (ip-062-143-245-032.um16.pools.vodafone-ip.de. [62.143.245.32]) by smtp.gmail.com with ESMTPSA id n18-20020a05600c4f9200b004148c3685ffsm17409318wmq.3.2024.04.02.01.49.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 01:49:23 -0700 (PDT) From: Heinrich Schuchardt To: Minda Chen , Hal Feng , Rick Chen , Leo Cc: Aurelien Jarno , Lukasz Tekieli , Shiji Yang , Shengyu Qu , Seung-Woo Kim , E Shattow , u-boot@lists.denx.de, Heinrich Schuchardt Subject: [PATCH v3 6/6] doc: describe Milk-V Mars board Date: Tue, 2 Apr 2024 10:49:12 +0200 Message-ID: <20240402084912.43228-7-heinrich.schuchardt@canonical.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240402084912.43228-1-heinrich.schuchardt@canonical.com> References: <20240402084912.43228-1-heinrich.schuchardt@canonical.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean Add instructions to build U-Boot for the Milk-V Mars board Signed-off-by: Heinrich Schuchardt Reviewed-by: Leo Yu-Chi Liang --- v3: no change v2: describe how to preset fdtfile --- doc/board/starfive/index.rst | 1 + doc/board/starfive/milk-v_mars.rst | 111 +++++++++++++++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 doc/board/starfive/milk-v_mars.rst diff --git a/doc/board/starfive/index.rst b/doc/board/starfive/index.rst index 0c52dc7b095..2762bf74c11 100644 --- a/doc/board/starfive/index.rst +++ b/doc/board/starfive/index.rst @@ -6,4 +6,5 @@ StarFive .. toctree:: :maxdepth: 1 + milk-v_mars.rst visionfive2 diff --git a/doc/board/starfive/milk-v_mars.rst b/doc/board/starfive/milk-v_mars.rst new file mode 100644 index 00000000000..554932ecfd4 --- /dev/null +++ b/doc/board/starfive/milk-v_mars.rst @@ -0,0 +1,111 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +Milk-V Mars +=========== + +U-Boot for the Milk-V Mars uses the same U-Boot binaries as the VisionFive 2 +board. In U-Boot SPL the actual board is detected and the device-tree patched +accordingly. + +Building +~~~~~~~~ + +1. Add the RISC-V toolchain to your PATH. +2. Setup ARCH & cross compilation environment variable: + +.. code-block:: none + + export CROSS_COMPILE= + +The M-mode software OpenSBI provides the supervisor binary interface (SBI) and +is responsible for the switch to S-Mode. It is a prerequisite to build U-Boot. +Support for the JH7110 was introduced in OpenSBI 1.2. It is recommended to use +a current release. + +.. code-block:: console + + git clone https://github.com/riscv/opensbi.git + cd opensbi + make PLATFORM=generic FW_TEXT_START=0x40000000 FW_OPTIONS=0 + +Now build the U-Boot SPL and U-Boot proper. + +.. code-block:: console + + cd + make starfive_visionfive2_defconfig + make OPENSBI=$(opensbi_dir)/build/platform/generic/firmware/fw_dynamic.bin + +This will generate the U-Boot SPL image (spl/u-boot-spl.bin.normal.out) as well +as the FIT image (u-boot.itb) with OpenSBI and U-Boot. + +Device-tree selection +~~~~~~~~~~~~~~~~~~~~~ + +Depending on the board version U-Boot set variable $fdtfile to either +starfive/jh7110-starfive-visionfive-2-v1.2a.dtb or +starfive/jh7110-starfive-visionfive-2-v1.3b.dtb. + +To overrule this selection the variable can be set manually and saved in the +environment + +:: + + setenv fdtfile my_device-tree.dtb + env save + +or the configuration variable CONFIG_DEFAULT_FDT_FILE can be used to set to +provide a default value. + +Boot source selection +~~~~~~~~~~~~~~~~~~~~~ + +The board provides the DIP switches MSEL[1:0] to select the boot device out of +SPI flash, eMMC, SD-card, UART. To select booting from SD-card set the DIP +switches MSEL[1:0] to 10. + +Preparing the SD-Card +~~~~~~~~~~~~~~~~~~~~~ + +The device firmware loads U-Boot SPL (u-boot-spl.bin.normal.out) from the +partition with type GUID 2E54B353-1271-4842-806F-E436D6AF6985. You are free +to choose any partition number. + +With the default configuration U-Boot SPL loads the U-Boot FIT image +(u-boot.itb) from partition 2 (CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION=0x2). +When formatting it is recommended to use GUID +BC13C2FF-59E6-4262-A352-B275FD6F7172 for this partition. + +The FIT image (u-boot.itb) is a combination of OpenSBI's fw_dynamic.bin, +u-boot-nodtb.bin and the device tree blob. + +Format the SD card (make sure the disk has GPT, otherwise use gdisk to switch) + +.. code-block:: bash + + sudo sgdisk --clear \ + --set-alignment=2 \ + --new=1:4096:8191 --change-name=1:spl --typecode=1:2E54B353-1271-4842-806F-E436D6AF6985\ + --new=2:8192:16383 --change-name=2:uboot --typecode=2:BC13C2FF-59E6-4262-A352-B275FD6F7172 \ + --new=3:16384:1654784 --change-name=3:system --typecode=3:EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 \ + /dev/sdb + +Copy U-Boot to the SD card + +.. code-block:: bash + + sudo dd if=u-boot-spl.bin.normal.out of=/dev/sdb1 + sudo dd if=u-boot.itb of=/dev/sdb2 + + sudo mount /dev/sdb3 /mnt/ + sudo cp u-boot-spl.bin.normal.out /mnt/ + sudo cp u-boot.itb /mnt/ + sudo cp Image.gz /mnt/ + sudo cp initramfs.cpio.gz /mnt/ + sudo cp jh7110-starfive-visionfive-2.dtb /mnt/ + sudo umount /mnt + +Booting +~~~~~~~ + +Once you plugin the sdcard and power up, you should see the U-Boot prompt.