Subject: [PATCH v3 4/6] gnu: u-boot: Use search-patches.

From: Herman Rimm <[email-masked]>
Date: Fri, 13 Dec 2024 20:58:32 +0100

* gnu/packages/bootloaders.scm (%u-boot-rockchip-inno-usb-patch,
%u-boot-allow-disabling-openssl-patch): Remove variables, move comments.
(u-boot)[source]: Use search-patches.
* gnu/packages/patches/u-boot-allow-disabling-openssl.patch: Comment.
* gnu/packages/patches/u-boot-rockchip-inno-usb.patch: Remove E-Mail
metadata.  Replace diffstat with comments.  Reapply to U-Boot v2024.10.

Change-Id: I760a2e81bddfc2a80ef149fe1ac4496cbbd937a0
---
 gnu/packages/bootloaders.scm                  |  34 ++--
 .../u-boot-allow-disabling-openssl.patch      |   3 +
 .../patches/u-boot-rockchip-inno-usb.patch    | 171 ++----------------
 3 files changed, 30 insertions(+), 178 deletions(-)

diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 2a3ca30046..ca189fca3a 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -744,33 +744,21 @@ (define-public dtc
 tree binary files.  These are board description files used by Linux and BSD.")
     (license license:gpl2+)))
 
-(define %u-boot-rockchip-inno-usb-patch
-  ;; Fix regression in 2020.10 causing freezes on boot with USB boot enabled.
-  ;; See https://gitlab.manjaro.org/manjaro-arm/packages/core/uboot-rockpro64/-/issues/4
-  ;; and https://patchwork.ozlabs.org/project/uboot/patch/[email-masked]
-  (search-patch "u-boot-rockchip-inno-usb.patch"))
-
-(define %u-boot-allow-disabling-openssl-patch
-  ;; Fixes build of u-boot 2021.10 without openssl
-  ;; https://lists.denx.de/pipermail/u-boot/2021-October/462728.html
-  (search-patch "u-boot-allow-disabling-openssl.patch"))
-
 (define u-boot
   (package
     (name "u-boot")
     (version "2024.10")
-    (source (origin
-              (patches
-               (list %u-boot-rockchip-inno-usb-patch
-                     %u-boot-allow-disabling-openssl-patch))
-              (method git-fetch)
-              (uri (git-reference
-                     (url "https://source.denx.de/u-boot/u-boot.git")
-                     (commit (string-append "v" version))))
-              (file-name (git-file-name name version))
-              (sha256
-               (base32
-                "0yrhb0izihv47p781dc4cp0znc5g225ayl7anz23c6jdrmfbpz2h"))))
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+              (url "https://source.denx.de/u-boot/u-boot.git")
+              (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0yrhb0izihv47p781dc4cp0znc5g225ayl7anz23c6jdrmfbpz2h"))
+       (patches (search-patches "u-boot-allow-disabling-openssl.patch"
+                                "u-boot-rockchip-inno-usb.patch"))))
     (build-system gnu-build-system)
     (native-inputs
      (list bison
diff --git a/gnu/packages/patches/u-boot-allow-disabling-openssl.patch b/gnu/packages/patches/u-boot-allow-disabling-openssl.patch
index 9201f9a51d..308424e1a4 100644
--- a/gnu/packages/patches/u-boot-allow-disabling-openssl.patch
+++ b/gnu/packages/patches/u-boot-allow-disabling-openssl.patch
@@ -10,6 +10,9 @@ CONFIG_FIT_PRELOAD to remove fit_pre_load_data, which depends on openssl.
 
 Addendum 2024-01-18, Herman Rimm: Patch updated to leave out upstreamed
 diffs with CONFIG_FIT_PRELOAD.
+---
+Fixes build of U-Boot v2021.10 without openssl.  See:
+https://lists.denx.de/pipermail/u-boot/2021-October/462728.html
 
 diff --git a/tools/kwbimage.c b/tools/kwbimage.c
 index 4dce495ff0..976174ae77 100644
diff --git a/gnu/packages/patches/u-boot-rockchip-inno-usb.patch b/gnu/packages/patches/u-boot-rockchip-inno-usb.patch
index eeb25f4b89..5962e19e01 100644
--- a/gnu/packages/patches/u-boot-rockchip-inno-usb.patch
+++ b/gnu/packages/patches/u-boot-rockchip-inno-usb.patch
@@ -1,149 +1,7 @@
-Downloaded from:
-https://patchwork.ozlabs.org/project/uboot/patch/[email-masked]
-
-From patchwork Tue Apr  6 15:10:59 2021
-Content-Type: text/plain; charset="utf-8"
-MIME-Version: 1.0
-Content-Transfer-Encoding: 7bit
-X-Patchwork-Submitter: Icenowy Zheng <[email-masked]>
-X-Patchwork-Id: 1462876
-X-Patchwork-Delegate: [email-masked]
-Return-Path: <[email-masked]>
-X-Original-To: [email-masked]
-Delivered-To: [email-masked]
-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=[email-masked]; receiver=<UNKNOWN>)
-Authentication-Results: ozlabs.org;
-	dkim=fail reason="signature verification failed" (1024-bit key;
- unprotected) header.d=mymailcheap.com header.i=@mymailcheap.com
- header.a=rsa-sha256 header.s=default header.b=unszVtqT;
-	dkim=fail reason="signature verification failed" (1024-bit key;
- unprotected) header.d=aosc.io header.i=@aosc.io header.a=rsa-sha256
- header.s=default header.b=mWwYCh9A;
-	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 4FF9wc3GdNz9sW1
-	for <[email-masked]>; Wed,  7 Apr 2021 01:11:42 +1000 (AEST)
-Received: from h2850616.stratoserver.net (localhost [IPv6:::1])
-	by phobos.denx.de (Postfix) with ESMTP id C1F9C8040A;
-	Tue,  6 Apr 2021 17:11:32 +0200 (CEST)
-Authentication-Results: phobos.denx.de;
- dmarc=none (p=none dis=none) header.from=aosc.io
-Authentication-Results: phobos.denx.de;
- spf=pass smtp.mailfrom=[email-masked]
-Authentication-Results: phobos.denx.de;
-	dkim=fail reason="signature verification failed" (1024-bit key;
- unprotected) header.d=mymailcheap.com header.i=@mymailcheap.com
- header.b="unszVtqT";
-	dkim=fail reason="signature verification failed" (1024-bit key;
- unprotected) header.d=aosc.io header.i=@aosc.io header.b="mWwYCh9A";
-	dkim-atps=neutral
-Received: by phobos.denx.de (Postfix, from userid 109)
- id E4F22805B4; Tue,  6 Apr 2021 17:11: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.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,
- DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham
- autolearn_force=no version=3.4.2
-Received: from relay3.mymailcheap.com (relay3.mymailcheap.com
- [217.182.66.161])
- (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
- (No client certificate requested)
- by phobos.denx.de (Postfix) with ESMTPS id 2FC4A8039D
- for <[email-masked]>; Tue,  6 Apr 2021 17:11:27 +0200 (CEST)
-Authentication-Results: phobos.denx.de;
- dmarc=none (p=none dis=none) header.from=aosc.io
-Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=[email-masked]
-Received: from filter2.mymailcheap.com (filter2.mymailcheap.com
- [91.134.140.82])
- by relay3.mymailcheap.com (Postfix) with ESMTPS id A6AC13ECDF;
- Tue,  6 Apr 2021 17:11:26 +0200 (CEST)
-Received: from localhost (localhost [127.0.0.1])
- by filter2.mymailcheap.com (Postfix) with ESMTP id 88D512A915;
- Tue,  6 Apr 2021 17:11:26 +0200 (CEST)
-DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mymailcheap.com;
- s=default; t=1617721886;
- bh=qb5gt5o7M9qjdJd67A3WHGZp/76w4s4FS6+u1VuEh/o=;
- h=From:To:Cc:Subject:Date:From;
- b=unszVtqTnO9MGZVbgLH5H0cMo3VfQ+g5377blmOUcrtzMSqNbDD5SM25MUhlTUKiB
- hTFq4L53gszBYfRPfh7Z5XgNVERULL5Zx0+WnVjZ7kUIp/wS3IQqxe81ChoFEsLTr8
- 22UB9NN3OSVkuN/jRAzX+lKpugVGBHwOCjZBZukQ=
-Received: from filter2.mymailcheap.com ([127.0.0.1])
- by localhost (filter2.mymailcheap.com [127.0.0.1]) (amavisd-new, port 10024)
- with ESMTP id V9lVOgo6gApH; Tue,  6 Apr 2021 17:11:25 +0200 (CEST)
-Received: from mail20.mymailcheap.com (mail20.mymailcheap.com [51.83.111.147])
- (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))
- (No client certificate requested)
- by filter2.mymailcheap.com (Postfix) with ESMTPS;
- Tue,  6 Apr 2021 17:11:25 +0200 (CEST)
-Received: from [213.133.102.83] (ml.mymailcheap.com [213.133.102.83])
- by mail20.mymailcheap.com (Postfix) with ESMTP id C9EA3400B6;
- Tue,  6 Apr 2021 15:11:24 +0000 (UTC)
-Authentication-Results: mail20.mymailcheap.com; dkim=pass (1024-bit key;
- unprotected) header.d=aosc.io header.i=@aosc.io header.b="mWwYCh9A";
- dkim-atps=neutral
-AI-Spam-Status: Not processed
-Received: from ice-e5v2.lan (unknown [59.41.163.135])
- (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
- key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest
- SHA256) (No client certificate requested)
- by mail20.mymailcheap.com (Postfix) with ESMTPSA id 251F840C16;
- Tue,  6 Apr 2021 15:11:10 +0000 (UTC)
-DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=aosc.io; s=default;
- t=1617721874; bh=qb5gt5o7M9qjdJd67A3WHGZp/76w4s4FS6+u1VuEh/o=;
- h=From:To:Cc:Subject:Date:From;
- b=mWwYCh9AM8eRWm9hiEqirytotj/G/C1p9r2fd0zUxPhS0UQH+kw6L3RWZnsfmXAYq
- HmYFiM3ktIfwevqQw89tOi8c2ktb49iYOyHXkfi8hTZl1dNsJDS94uyzBiHYY+U7x5
- P0aTRRaL5C8ua2c1GedoPx06nrARO/KMEFy39rxI=
 From: Icenowy Zheng <[email-masked]>
-To: Simon Glass <[email-masked]>, Kever Yang <[email-masked]>,
- Frank Wang <[email-masked]>,
- Jagan Teki <[email-masked]>
-Cc: [email-masked],
-	Icenowy Zheng <[email-masked]>
+Date: Tue, 6 Apr 2021 23:10:59 +0800
 Subject: [PATCH] phy: rockchip: inno-usb2: fix hang when multiple controllers
  exit
-Date: Tue,  6 Apr 2021 23:10:59 +0800
-Message-Id: <[email-masked]>
-X-Mailer: git-send-email 2.30.2
-MIME-Version: 1.0
-X-Rspamd-Server: mail20.mymailcheap.com
-X-Spamd-Result: default: False [4.90 / 20.00]; RCVD_VIA_SMTP_AUTH(0.00)[];
- ARC_NA(0.00)[]; R_DKIM_ALLOW(0.00)[aosc.io:s=default];
- RECEIVED_SPAMHAUS_PBL(0.00)[59.41.163.135:received];
- FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[];
- R_MISSING_CHARSET(2.50)[]; TO_MATCH_ENVRCPT_ALL(0.00)[];
- MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[aosc.io];
- BROKEN_CONTENT_TYPE(1.50)[]; R_SPF_SOFTFAIL(0.00)[~all];
- RCPT_COUNT_FIVE(0.00)[6]; ML_SERVERS(-3.10)[213.133.102.83];
- DKIM_TRACE(0.00)[aosc.io:+]; MID_CONTAINS_FROM(1.00)[];
- RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[];
- MIME_TRACE(0.00)[0:+];
- ASN(0.00)[asn:24940, ipnet:213.133.96.0/19, country:DE];
- RCVD_COUNT_TWO(0.00)[2];
- HFILTER_HELO_BAREIP(3.00)[213.133.102.83,1]
-X-Rspamd-Queue-Id: C9EA3400B6
-X-BeenThere: [email-masked]
-X-Mailman-Version: 2.1.34
-Precedence: list
-List-Id: U-Boot discussion <u-boot.lists.denx.de>
-List-Unsubscribe: <https://lists.denx.de/options/u-boot>,
- <mailto:[email-masked]?subject=unsubscribe>
-List-Archive: <https://lists.denx.de/pipermail/u-boot/>
-List-Post: <mailto:[email-masked]>
-List-Help: <mailto:[email-masked]?subject=help>
-List-Subscribe: <https://lists.denx.de/listinfo/u-boot>,
- <mailto:[email-masked]?subject=subscribe>
-Errors-To: [email-masked]
-Sender: "U-Boot" <[email-masked]>
-X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de
-X-Virus-Status: Clean
 
 The OHCI and EHCI controllers are both bound to the same PHY. They will
 both do init and power_on operations when the controller is brought up
@@ -166,23 +24,26 @@ Signed-off-by: Icenowy Zheng <[email-masked]>
 Fixes: ac97a9ece14e ("phy: rockchip: Add Rockchip USB2PHY driver")
 Tested-by: Peter Robinson <[email-masked]>
 ---
- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 21 +++++++++++++++++++
- 1 file changed, 21 insertions(+)
+Fix U-Boot v2020.10 regression, freezing on boot with USB boot enabled:
+https://gitlab.manjaro.org/manjaro-arm/packages/core/uboot-rockpro64/-/issues/4
+
+Downloaded from:
+https://patchwork.ozlabs.org/project/uboot/patch/[email-masked]
 
 diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
-index 70e61eccb7..ce36db94a7 100644
+index 43f6e020a6a..2086192445d 100644
 --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
 +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c
-@@ -64,6 +64,8 @@ struct rockchip_usb2phy {
- 	void *reg_base;
+@@ -47,6 +47,8 @@ struct rockchip_usb2phy {
+ 	struct regmap *reg_base;
  	struct clk phyclk;
  	const struct rockchip_usb2phy_cfg *phy_cfg;
 +	int init_count;
 +	int power_on_count;
  };
  
- static inline int property_enable(void *reg_base,
-@@ -106,6 +108,10 @@ static int rockchip_usb2phy_power_on(struct phy *phy)
+ static inline int property_enable(struct regmap *base,
+@@ -98,6 +100,10 @@ static int rockchip_usb2phy_power_on(struct phy *phy)
  	struct rockchip_usb2phy *priv = dev_get_priv(parent);
  	const struct rockchip_usb2phy_port_cfg *port_cfg = us2phy_get_port(phy);
  
@@ -193,7 +54,7 @@ index 70e61eccb7..ce36db94a7 100644
  	property_enable(priv->reg_base, &port_cfg->phy_sus, false);
  
  	/* waiting for the utmi_clk to become stable */
-@@ -120,6 +126,10 @@ static int rockchip_usb2phy_power_off(struct phy *phy)
+@@ -112,6 +118,10 @@ static int rockchip_usb2phy_power_off(struct phy *phy)
  	struct rockchip_usb2phy *priv = dev_get_priv(parent);
  	const struct rockchip_usb2phy_port_cfg *port_cfg = us2phy_get_port(phy);
  
@@ -204,8 +65,8 @@ index 70e61eccb7..ce36db94a7 100644
  	property_enable(priv->reg_base, &port_cfg->phy_sus, true);
  
  	return 0;
-@@ -132,6 +142,10 @@ static int rockchip_usb2phy_init(struct phy *phy)
- 	const struct rockchip_usb2phy_port_cfg *port_cfg = us2phy_get_port(phy);
+@@ -123,6 +133,10 @@ static int rockchip_usb2phy_init(struct phy *phy)
+ 	struct rockchip_usb2phy *priv = dev_get_priv(parent);
  	int ret;
  
 +	priv->init_count++;
@@ -215,7 +76,7 @@ index 70e61eccb7..ce36db94a7 100644
  	ret = clk_enable(&priv->phyclk);
  	if (ret && ret != -ENOSYS) {
  		dev_err(phy->dev, "failed to enable phyclk (ret=%d)\n", ret);
-@@ -154,6 +168,10 @@ static int rockchip_usb2phy_exit(struct phy *phy)
+@@ -137,6 +151,10 @@ static int rockchip_usb2phy_exit(struct phy *phy)
  	struct udevice *parent = dev_get_parent(phy->dev);
  	struct rockchip_usb2phy *priv = dev_get_priv(parent);
  
@@ -226,7 +87,7 @@ index 70e61eccb7..ce36db94a7 100644
  	clk_disable(&priv->phyclk);
  
  	return 0;
-@@ -294,6 +312,9 @@ static int rockchip_usb2phy_probe(struct udevice *dev)
+@@ -281,6 +299,9 @@ static int rockchip_usb2phy_probe(struct udevice *dev)
  		return ret;
  	}
  
-- 
2.45.2